]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Pull trivial2 into release branch
authorLen Brown <len.brown@intel.com>
Fri, 16 Jun 2006 01:31:17 +0000 (21:31 -0400)
committerLen Brown <len.brown@intel.com>
Fri, 16 Jun 2006 01:31:17 +0000 (21:31 -0400)
727 files changed:
CREDITS
Documentation/devices.txt
Documentation/dvb/get_dvb_firmware
Documentation/feature-removal-schedule.txt
Documentation/firmware_class/README
Documentation/firmware_class/firmware_sample_driver.c
Documentation/kernel-parameters.txt
Documentation/memory-barriers.txt
Documentation/serial/driver
Documentation/spi/pxa2xx [new file with mode: 0644]
Documentation/spi/spi-summary
Documentation/watchdog/watchdog-api.txt
MAINTAINERS
Makefile
arch/alpha/Kconfig
arch/alpha/kernel/alpha_ksyms.c
arch/alpha/kernel/process.c
arch/alpha/kernel/smp.c
arch/alpha/kernel/sys_titan.c
arch/arm/Kconfig.debug
arch/arm/kernel/asm-offsets.c
arch/arm/kernel/dma-isa.c
arch/arm/kernel/process.c
arch/arm/lib/backtrace.S
arch/arm/lib/div64.S
arch/arm/mach-ep93xx/ts72xx.c
arch/arm/mach-imx/irq.c
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-ixp23xx/core.c
arch/arm/mach-ixp4xx/Kconfig
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/spitz.c
arch/arm/mach-realview/realview_eb.c
arch/arm/mach-s3c2410/Kconfig
arch/arm/mach-s3c2410/sleep.S
arch/arm/mach-sa1100/neponset.c
arch/arm/mach-versatile/core.c
arch/arm/mm/ioremap.c
arch/arm/mm/mm-armv.c
arch/arm/mm/proc-xsc3.S
arch/i386/Kconfig
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/acpi/earlyquirk.c
arch/i386/kernel/apic.c
arch/i386/kernel/setup.c
arch/i386/kernel/syscall_table.S
arch/i386/kernel/traps.c
arch/i386/mach-generic/probe.c
arch/i386/mm/init.c
arch/i386/oprofile/nmi_int.c
arch/i386/power/cpu.c
arch/ia64/Kconfig
arch/ia64/configs/sn2_defconfig
arch/ia64/hp/common/sba_iommu.c
arch/ia64/kernel/iosapic.c
arch/ia64/kernel/irq.c
arch/mips/Kconfig
arch/mips/au1000/common/irq.c
arch/mips/au1000/common/prom.c
arch/mips/au1000/common/sleeper.S
arch/mips/au1000/common/time.c
arch/mips/ddb5xxx/ddb5476/dbg_io.c
arch/mips/ddb5xxx/ddb5477/kgdb_io.c
arch/mips/gt64120/ev64120/serialGT.c
arch/mips/gt64120/momenco_ocelot/dbg_io.c
arch/mips/ite-boards/generic/dbg_io.c
arch/mips/kernel/asm-offsets.c
arch/mips/kernel/cpu-bugs64.c
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/entry.S
arch/mips/kernel/gdb-low.S
arch/mips/kernel/module.c
arch/mips/kernel/proc.c
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/setup.c
arch/mips/kernel/signal-common.h
arch/mips/kernel/smp.c
arch/mips/kernel/syscall.c
arch/mips/kernel/traps.c
arch/mips/kernel/vmlinux.lds.S
arch/mips/math-emu/dp_fint.c
arch/mips/math-emu/dp_flong.c
arch/mips/math-emu/sp_fint.c
arch/mips/math-emu/sp_flong.c
arch/mips/mm/c-r4k.c
arch/mips/mm/init.c
arch/mips/mm/pg-r4k.c
arch/mips/mm/tlbex.c
arch/mips/momentum/jaguar_atx/dbg_io.c
arch/mips/momentum/ocelot_c/dbg_io.c
arch/mips/momentum/ocelot_g/dbg_io.c
arch/mips/oprofile/common.c
arch/mips/oprofile/op_model_mipsxx.c
arch/mips/oprofile/op_model_rm9000.c
arch/mips/sgi-ip32/ip32-irq.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/signal_64.c
arch/powerpc/kernel/systbl.S
arch/powerpc/platforms/cell/setup.c
arch/powerpc/platforms/cell/spu_callbacks.c
arch/powerpc/platforms/powermac/low_i2c.c
arch/powerpc/platforms/powermac/pfunc_core.c
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/pseries/setup.c
arch/ppc/kernel/asm-offsets.c
arch/ppc/platforms/mpc8272ads_setup.c
arch/ppc/syslib/pq2_devices.c
arch/ppc/syslib/pq2_sys.c
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/syscalls.S
arch/s390/kernel/time.c
arch/sparc/kernel/ioport.c
arch/sparc/kernel/module.c
arch/sparc/kernel/smp.c
arch/sparc/kernel/sparc_ksyms.c
arch/sparc/kernel/systbls.S
arch/sparc64/defconfig
arch/sparc64/kernel/head.S
arch/sparc64/kernel/module.c
arch/sparc64/kernel/pci_iommu.c
arch/sparc64/kernel/pci_sun4v.c
arch/sparc64/kernel/setup.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/systbls.S
arch/sparc64/kernel/traps.c
arch/sparc64/lib/checksum.S
arch/sparc64/lib/csum_copy.S
arch/um/Makefile-i386
arch/um/include/kern_util.h
arch/um/kernel/time_kern.c
arch/um/os-Linux/main.c
arch/um/os-Linux/time.c
arch/um/sys-i386/syscalls.c
arch/um/sys-x86_64/signal.c
arch/um/sys-x86_64/syscalls.c
arch/x86_64/Kconfig
arch/x86_64/ia32/ia32_binfmt.c
arch/x86_64/kernel/acpi/Makefile
arch/x86_64/kernel/acpi/processor.c [deleted file]
arch/x86_64/kernel/e820.c
arch/x86_64/kernel/entry.S
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/kprobes.c
arch/x86_64/kernel/pci-dma.c
arch/x86_64/kernel/pci-gart.c
arch/x86_64/kernel/pci-nommu.c
arch/x86_64/kernel/pmtimer.c
arch/x86_64/kernel/setup.c
arch/x86_64/kernel/traps.c
arch/x86_64/mm/srat.c
block/as-iosched.c
block/cfq-iosched.c
block/deadline-iosched.c
block/elevator.c
block/genhd.c
block/ll_rw_blk.c
block/noop-iosched.c
drivers/acpi/Kconfig
drivers/acpi/acpi_memhotplug.c
drivers/acpi/asus_acpi.c
drivers/acpi/bus.c
drivers/acpi/dispatcher/dsfield.c
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswscope.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/ec.c
drivers/acpi/events/evevent.c
drivers/acpi/events/evgpe.c
drivers/acpi/events/evgpeblk.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/events/evxfregn.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/excreate.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exmutex.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exoparg6.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exregion.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstore.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exstorob.c
drivers/acpi/executer/exsystem.c
drivers/acpi/executer/exutils.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/hardware/hwtimer.c
drivers/acpi/hotkey.c
drivers/acpi/motherboard.c
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nsdumpdv.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nsobject.c
drivers/acpi/namespace/nsparse.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nswalk.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/namespace/nsxfobj.c
drivers/acpi/osl.c
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psloop.c
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psscope.c
drivers/acpi/parser/pstree.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/pswalk.c
drivers/acpi/parser/psxface.c
drivers/acpi/processor_core.c
drivers/acpi/processor_perflib.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/resources/rsdump.c
drivers/acpi/resources/rsinfo.c
drivers/acpi/resources/rslist.c
drivers/acpi/resources/rsmisc.c
drivers/acpi/resources/rsutils.c
drivers/acpi/resources/rsxface.c
drivers/acpi/scan.c
drivers/acpi/sleep/wakeup.c
drivers/acpi/system.c
drivers/acpi/tables.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbget.c
drivers/acpi/tables/tbgetall.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbrsdt.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/thermal.c
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcache.c
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/uteval.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utinit.c
drivers/acpi/utilities/utmath.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmutex.c
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utresrc.c
drivers/acpi/utilities/utstate.c
drivers/acpi/utilities/utxface.c
drivers/acpi/video.c
drivers/base/firmware_class.c
drivers/base/power/suspend.c
drivers/block/ub.c
drivers/char/Kconfig
drivers/char/Makefile
drivers/char/agp/Kconfig
drivers/char/agp/amd64-agp.c
drivers/char/agp/hp-agp.c
drivers/char/agp/via-agp.c
drivers/char/hpet.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/n_tty.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/rio/host.h
drivers/char/rio/rioboot.c
drivers/char/rio/rioctrl.c
drivers/char/rio/rioioctl.h
drivers/char/sonypi.c
drivers/char/tpm/Kconfig
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm_bios.c
drivers/char/tpm/tpm_tis.c
drivers/char/tty_io.c
drivers/char/vt.c
drivers/char/watchdog/i8xx_tco.c
drivers/char/watchdog/s3c2410_wdt.c
drivers/char/watchdog/sc1200wdt.c
drivers/i2c/busses/scx200_acb.c
drivers/ide/legacy/ide-cs.c
drivers/ide/pci/sgiioc4.c
drivers/ide/ppc/pmac.c
drivers/ieee1394/ohci1394.c
drivers/ieee1394/sbp2.c
drivers/ieee1394/sbp2.h
drivers/infiniband/core/cm.c
drivers/infiniband/core/mad.c
drivers/infiniband/core/mad_priv.h
drivers/infiniband/core/mad_rmpp.c
drivers/infiniband/core/ucm.c
drivers/infiniband/core/uverbs_mem.c
drivers/infiniband/hw/ipath/ipath_driver.c
drivers/infiniband/hw/ipath/ipath_eeprom.c
drivers/infiniband/hw/ipath/ipath_file_ops.c
drivers/infiniband/hw/ipath/ipath_ht400.c
drivers/infiniband/hw/ipath/ipath_init_chip.c
drivers/infiniband/hw/ipath/ipath_kernel.h
drivers/infiniband/hw/ipath/ipath_keys.c
drivers/infiniband/hw/ipath/ipath_layer.c
drivers/infiniband/hw/ipath/ipath_pe800.c
drivers/infiniband/hw/ipath/ipath_qp.c
drivers/infiniband/hw/ipath/ipath_rc.c
drivers/infiniband/hw/ipath/ipath_ruc.c
drivers/infiniband/hw/ipath/ipath_verbs.c
drivers/infiniband/hw/mthca/mthca_cmd.c
drivers/infiniband/hw/mthca/mthca_qp.c
drivers/infiniband/hw/mthca/mthca_srq.c
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/srp/ib_srp.c
drivers/input/joystick/sidewinder.c
drivers/input/keyboard/corgikbd.c
drivers/input/keyboard/spitzkbd.c
drivers/input/misc/wistron_btns.c
drivers/input/mouse/alps.c
drivers/input/mouse/lifebook.c
drivers/input/mouse/logips2pp.c
drivers/input/touchscreen/ads7846.c
drivers/isdn/capi/capi.c
drivers/isdn/gigaset/usb-gigaset.c
drivers/isdn/i4l/isdn_tty.c
drivers/leds/Kconfig
drivers/leds/led-class.c
drivers/leds/ledtrig-timer.c
drivers/md/md.c
drivers/md/raid0.c
drivers/media/Kconfig
drivers/media/common/Kconfig
drivers/media/dvb/Kconfig
drivers/media/dvb/b2c2/Kconfig
drivers/media/dvb/bt8xx/Kconfig
drivers/media/dvb/bt8xx/dvb-bt8xx.c
drivers/media/dvb/cinergyT2/cinergyT2.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/dvb-core/dvbdev.c
drivers/media/dvb/dvb-usb/Kconfig
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/frontends/cx24123.c
drivers/media/dvb/frontends/dvb-pll.c
drivers/media/dvb/pluto2/Kconfig
drivers/media/dvb/pluto2/Makefile
drivers/media/dvb/ttpci/Kconfig
drivers/media/dvb/ttpci/budget-av.c
drivers/media/dvb/ttpci/budget-ci.c
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/radio/Kconfig
drivers/media/video/Kconfig
drivers/media/video/Makefile
drivers/media/video/bt8xx/Kconfig
drivers/media/video/bt8xx/Makefile
drivers/media/video/bt8xx/bttv-cards.c
drivers/media/video/bt8xx/bttv-risc.c
drivers/media/video/cx25840/cx25840-firmware.c
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-core.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/em28xx/Kconfig
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/et61x251/Kconfig
drivers/media/video/pwc/Kconfig
drivers/media/video/pwc/Makefile
drivers/media/video/saa7127.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/sn9c102/Kconfig
drivers/media/video/tuner-types.c
drivers/media/video/tveeprom.c
drivers/media/video/usbvideo/Kconfig
drivers/media/video/vivi.c
drivers/media/video/zc0301/Kconfig
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptspi.c
drivers/message/i2o/exec-osm.c
drivers/message/i2o/iop.c
drivers/mmc/Kconfig
drivers/mmc/au1xmmc.c
drivers/mmc/imxmmc.c
drivers/mmc/mmc.c
drivers/mmc/mmc_block.c
drivers/mmc/pxamci.c
drivers/mmc/wbsd.c
drivers/net/b44.c
drivers/net/bnx2.c
drivers/net/dl2k.c
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_main.c
drivers/net/forcedeth.c
drivers/net/irda/Kconfig
drivers/net/ixp2000/enp2611.c
drivers/net/ixp2000/pm3386.c
drivers/net/ixp2000/pm3386.h
drivers/net/netconsole.c
drivers/net/pcmcia/axnet_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcnet32.c
drivers/net/pppoe.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/sky2.h
drivers/net/tg3.c
drivers/net/tg3.h
drivers/net/tulip/winbond-840.c
drivers/net/via-rhine.c
drivers/net/wireless/arlan-main.c
drivers/net/wireless/bcm43xx/bcm43xx_dma.c
drivers/net/wireless/bcm43xx/bcm43xx_main.c
drivers/net/wireless/orinoco.c
drivers/net/wireless/wavelan.c
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/quirks.c
drivers/pcmcia/ds.c
drivers/pcmcia/pcmcia_ioctl.c
drivers/pcmcia/pd6729.c
drivers/pnp/pnpacpi/rsparser.c
drivers/rtc/rtc-dev.c
drivers/rtc/rtc-m48t86.c
drivers/rtc/rtc-sa1100.c
drivers/rtc/rtc-test.c
drivers/rtc/rtc-vr41xx.c
drivers/s390/cio/css.h
drivers/s390/cio/device_fsm.c
drivers/s390/net/ctcmain.c
drivers/s390/net/ctctty.c
drivers/s390/net/cu3088.c
drivers/s390/net/iucv.c
drivers/s390/net/iucv.h
drivers/s390/net/lcs.c
drivers/s390/net/lcs.h
drivers/s390/net/netiucv.c
drivers/s390/net/qeth.h
drivers/s390/net/qeth_eddp.c
drivers/s390/net/qeth_fs.h
drivers/s390/net/qeth_main.c
drivers/s390/net/qeth_mpc.h
drivers/s390/net/qeth_proc.c
drivers/s390/net/qeth_sys.c
drivers/s390/net/qeth_tso.h
drivers/sbus/char/openprom.c
drivers/scsi/libata-core.c
drivers/scsi/ppa.c
drivers/scsi/sata_mv.c
drivers/scsi/sata_sil24.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_transport_sas.c
drivers/scsi/st.c
drivers/serial/cpm_uart/cpm_uart_core.c
drivers/serial/cpm_uart/cpm_uart_cpm2.c
drivers/serial/serial_core.c
drivers/serial/sunsu.c
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/spi/pxa2xx_spi.c [new file with mode: 0644]
drivers/spi/spi.c
drivers/spi/spi_bitbang.c
drivers/spi/spi_butterfly.c
drivers/spi/spi_mpc83xx.c [new file with mode: 0644]
drivers/spi/spi_s3c24xx.c [new file with mode: 0644]
drivers/spi/spi_s3c24xx_gpio.c [new file with mode: 0644]
drivers/usb/atm/speedtch.c
drivers/usb/atm/usbatm.c
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-pxa27x.c
drivers/usb/input/hid-core.c
drivers/usb/input/hiddev.c
drivers/usb/misc/emi26.c
drivers/usb/misc/emi62.c
drivers/usb/net/pegasus.c
drivers/usb/serial/Kconfig
drivers/usb/serial/Makefile
drivers/usb/serial/airprime.c
drivers/usb/serial/ark3116.c [new file with mode: 0644]
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/generic.c
drivers/usb/serial/omninet.c
drivers/usb/serial/usb-serial.c
drivers/video/au1100fb.c
drivers/video/backlight/backlight.c
drivers/video/backlight/lcd.c
drivers/video/console/fbcon.c
drivers/video/i810/i810_main.c
drivers/video/matrox/g450_pll.c
drivers/video/matrox/matroxfb_DAC1064.h
drivers/video/matrox/matroxfb_base.h
drivers/video/maxinefb.c
fs/9p/fcall.c
fs/9p/mux.c
fs/9p/mux.h
fs/9p/vfs_file.c
fs/9p/vfs_inode.c
fs/Makefile
fs/affs/namei.c
fs/autofs4/autofs_i.h
fs/autofs4/root.c
fs/autofs4/waitq.c
fs/binfmt_flat.c
fs/bio.c
fs/cifs/CHANGES
fs/cifs/cifsfs.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/file.c
fs/compat.c
fs/configfs/dir.c
fs/debugfs/inode.c
fs/exportfs/expfs.c
fs/ext3/resize.c
fs/inotify.c
fs/jffs2/nodelist.c
fs/jfs/jfs_metapage.c
fs/locks.c
fs/namei.c
fs/namespace.c
fs/nfsd/export.c
fs/nfsd/vfs.c
fs/ocfs2/aops.c
fs/ocfs2/aops.h
fs/ocfs2/extent_map.c
fs/ocfs2/file.c
fs/ocfs2/journal.c
fs/ocfs2/uptodate.c
fs/ocfs2/vote.c
fs/open.c
fs/partitions/check.c
fs/smbfs/dir.c
fs/smbfs/request.c
include/acpi/acconfig.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acevents.h
include/acpi/acexcep.h
include/acpi/acglobal.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acnamesp.h
include/acpi/acobject.h
include/acpi/acopcode.h
include/acpi/acoutput.h
include/acpi/acparser.h
include/acpi/acpi_bus.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acresrc.h
include/acpi/acstruct.h
include/acpi/actables.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/amlcode.h
include/acpi/amlresrc.h
include/acpi/platform/acenv.h
include/acpi/platform/aclinux.h
include/asm-alpha/smp.h
include/asm-alpha/termbits.h
include/asm-arm/arch-ixp23xx/memory.h
include/asm-arm/arch-l7200/serial_l7200.h
include/asm-arm/arch-l7200/uncompress.h
include/asm-arm/arch-pxa/ohci.h
include/asm-arm/arch-pxa/pxa2xx_spi.h [new file with mode: 0644]
include/asm-arm/arch-s3c2410/spi-gpio.h [new file with mode: 0644]
include/asm-arm/arch-s3c2410/spi.h [new file with mode: 0644]
include/asm-arm/procinfo.h
include/asm-arm/spinlock.h
include/asm-arm/system.h
include/asm-generic/pgtable.h
include/asm-i386/apicdef.h
include/asm-mips/addrspace.h
include/asm-mips/cpu.h
include/asm-mips/delay.h
include/asm-mips/futex.h
include/asm-mips/inst.h
include/asm-mips/mipsregs.h
include/asm-mips/page.h
include/asm-mips/pgtable-32.h
include/asm-mips/pgtable-64.h
include/asm-mips/pgtable.h
include/asm-mips/sigcontext.h
include/asm-mips/smp.h
include/asm-mips/sparsemem.h [new file with mode: 0644]
include/asm-powerpc/termbits.h
include/asm-powerpc/unistd.h
include/asm-s390/futex.h
include/asm-s390/lowcore.h
include/asm-s390/unistd.h
include/asm-sparc/unistd.h
include/asm-sparc64/dma-mapping.h
include/asm-sparc64/pci.h
include/asm-sparc64/pgtable.h
include/asm-sparc64/unistd.h
include/asm-um/irqflags.h [new file with mode: 0644]
include/asm-um/uaccess.h
include/asm-x86_64/acpi.h
include/asm-x86_64/apicdef.h
include/asm-x86_64/elf.h
include/linux/elevator.h
include/linux/firmware.h
include/linux/fs.h
include/linux/fsl_devices.h
include/linux/i2o.h
include/linux/input.h
include/linux/kernel.h
include/linux/m48t86.h
include/linux/mempolicy.h
include/linux/mmc/mmc.h
include/linux/mmzone.h
include/linux/pci-acpi.h
include/linux/pci_ids.h
include/linux/rcupdate.h
include/linux/slab.h
include/linux/spi/spi.h
include/linux/spi/spi_bitbang.h
include/linux/swap.h
include/linux/syscalls.h
include/linux/videodev2.h
include/linux/vt_kern.h
include/net/compat.h
include/net/irda/irlmp.h
include/net/neighbour.h
include/net/sctp/command.h
include/net/sctp/sctp.h
init/do_mounts.c
init/initramfs.c
kernel/cpuset.c
kernel/extable.c
kernel/hrtimer.c
kernel/module.c
kernel/rcupdate.c
kernel/sched.c
kernel/timer.c
lib/Kconfig.debug
lib/kobject.c
mm/memory_hotplug.c
mm/page_alloc.c
mm/shmem.c
mm/slab.c
mm/sparse.c
mm/vmscan.c
net/802/tr.c
net/atm/clip.c
net/bridge/br.c
net/bridge/br_if.c
net/bridge/netfilter/ebt_log.c
net/core/dev.c
net/core/neighbour.c
net/dccp/ackvec.c
net/ethernet/Makefile
net/ethernet/sysctl_net_ether.c [deleted file]
net/ipv4/ip_forward.c
net/ipv4/ipcomp.c
net/ipv4/netfilter/Kconfig
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_conntrack_core.c
net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
net/ipv4/netfilter/ip_conntrack_helper_pptp.c
net/ipv4/netfilter/ip_nat_proto_gre.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/netfilter/ipt_LOG.c
net/ipv4/netfilter/ipt_recent.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/tcp_highspeed.c
net/ipv4/tcp_input.c
net/ipv4/tcp_output.c
net/ipv4/xfrm4_policy.c
net/ipv6/ipcomp6.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6t_LOG.c
net/ipv6/netfilter/ip6t_eui64.c
net/ipv6/route.c
net/ipx/af_ipx.c
net/ipx/ipx_route.c
net/irda/iriap.c
net/irda/irlap.c
net/netfilter/nfnetlink_log.c
net/sched/sch_generic.c
net/sctp/input.c
net/sctp/sm_sideeffect.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sunrpc/cache.c
net/sysctl_net.c
net/xfrm/xfrm_input.c
scripts/mod/modpost.c
scripts/mod/modpost.h
security/selinux/hooks.c
security/selinux/ss/services.c
sound/drivers/mpu401/mpu401.c
sound/isa/es18xx.c
sound/oss/ad1848.c
sound/oss/nm256_audio.c

diff --git a/CREDITS b/CREDITS
index 6f50be37fa0f81dbcccd5929b0c92c4f59775dd6..9bf714a1c7d97e92a634161c3538ee93e30f07d3 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -3241,14 +3241,9 @@ S: 12725 SW Millikan Way, Suite 400
 S: Beaverton, Oregon 97005
 S: USA
 
-N: Marcelo W. Tosatti
-E: marcelo.tosatti@cyclades.com
-D: Miscellaneous kernel hacker
+N: Marcelo Tosatti
+E: marcelo@kvack.org
 D: v2.4 kernel maintainer
-D: Current pc300/cyclades maintainer
-S: Cyclades Corporation
-S: Av Cristovao Colombo, 462. Floresta.
-S: Porto Alegre
 S: Brazil
 
 N: Stefan Traby
index 3c406acd4dfae8c65e4f88ab5552416972c98276..b369a8c46a7311c8d5561d730a95a6049cee2ff2 100644 (file)
@@ -1721,11 +1721,6 @@ Your cooperation is appreciated.
                These devices support the same API as the generic SCSI
                devices.
 
- 97 block      Packet writing for CD/DVD devices
-                 0 = /dev/pktcdvd0     First packet-writing module
-                 1 = /dev/pktcdvd1     Second packet-writing module
-                   ...
-
  98 char       Control and Measurement Device (comedi)
                  0 = /dev/comedi0      First comedi device
                  1 = /dev/comedi1      Second comedi device
index 15fc8fbef67e3fa48a8d68365b1852103e501115..4820366b6ae899667cf0589b789661d990eda7cc 100644 (file)
@@ -259,9 +259,9 @@ sub dibusb {
 }
 
 sub nxt2002 {
-    my $sourcefile = "Broadband4PC_4_2_11.zip";
+    my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip";
     my $url = "http://www.bbti.us/download/windows/$sourcefile";
-    my $hash = "c6d2ea47a8f456d887ada0cfb718ff2a";
+    my $hash = "476befae8c7c1bb9648954060b1eec1f";
     my $outfile = "dvb-fe-nxt2002.fw";
     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
 
@@ -269,8 +269,8 @@ sub nxt2002 {
 
     wgetfile($sourcefile, $url);
     unzip($sourcefile, $tmpdir);
-    verify("$tmpdir/SkyNETU.sys", $hash);
-    extract("$tmpdir/SkyNETU.sys", 375832, 5908, $outfile);
+    verify("$tmpdir/SkyNET.sys", $hash);
+    extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile);
 
     $outfile;
 }
index 421bcfff6ad21be680fcf819243ca9d750fa8ab2..43ab119963d5ef706f1f5c602526a4a9caf28ae9 100644 (file)
@@ -57,6 +57,15 @@ Who: Jody McIntyre <scjody@steamballoon.com>
 
 ---------------------------
 
+What:  sbp2: module parameter "force_inquiry_hack"
+When:  July 2006
+Why:   Superceded by parameter "workarounds". Both parameters are meant to be
+       used ad-hoc and for single devices only, i.e. not in modprobe.conf,
+       therefore the impact of this feature replacement should be low.
+Who:   Stefan Richter <stefanr@s5r6.in-berlin.de>
+
+---------------------------
+
 What:  Video4Linux API 1 ioctls and video_decoder.h from Video devices.
 When:  July 2006
 Why:   V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
index 43e836c07ae89ee817ad75fe33e9cd37ea5b44ae..e9cc8bb26f7d0952b0226c66e6a43abe8e00a211 100644 (file)
    on the setup, so I think that the choice on what firmware to make
    persistent should be left to userspace.
 
- - Why register_firmware()+__init can be useful:
-       - For boot devices needing firmware.
-       - To make the transition easier:
-               The firmware can be declared __init and register_firmware()
-               called on module_init. Then the firmware is warranted to be
-               there even if "firmware hotplug userspace" is not there yet or
-               it doesn't yet provide the needed firmware.
-               Once the firmware is widely available in userspace, it can be
-               removed from the kernel. Or made optional (CONFIG_.*_FIRMWARE).
-
-       In either case, if firmware hotplug support is there, it can move the
-       firmware out of kernel memory into the real filesystem for later
-       usage.
-
-       Note: If persistence is implemented on top of initramfs,
-       register_firmware() may not be appropriate.
-
index ad3edaba4533cf33d5452e5b4bb877455000c05b..87feccdb5c9f8f67b2739358edca07c76a9a24a1 100644 (file)
@@ -5,8 +5,6 @@
  *
  * Sample code on how to use request_firmware() from drivers.
  *
- * Note that register_firmware() is currently useless.
- *
  */
 
 #include <linux/module.h>
 
 #include "linux/firmware.h"
 
-#define WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE
-#ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE
-char __init inkernel_firmware[] = "let's say that this is firmware\n";
-#endif
-
 static struct device ghost_device = {
        .bus_id    = "ghost0",
 };
@@ -104,10 +97,6 @@ static void sample_probe_async(void)
 
 static int sample_init(void)
 {
-#ifdef WE_CAN_NEED_FIRMWARE_BEFORE_USERSPACE_IS_AVAILABLE
-       register_firmware("sample_driver_fw", inkernel_firmware,
-                         sizeof(inkernel_firmware));
-#endif
        device_initialize(&ghost_device);
        /* since there is no real hardware insertion I just call the
         * sample probe functions here */
index b3a6187e53051866004696e4d5718cd85240e1c2..a853e860786527415a15eadcf9e0388d80a25424 100644 (file)
@@ -147,6 +147,9 @@ running once the system is up.
        acpi_irq_isa=   [HW,ACPI] If irq_balance, mark listed IRQs used by ISA
                        Format: <irq>,<irq>...
 
+       acpi_os_name=   [HW,ACPI] Tell ACPI BIOS the name of the OS
+                       Format: To spoof as Windows 98: ="Microsoft Windows"
+
        acpi_osi=       [HW,ACPI] empty param disables _OSI
 
        acpi_serialize  [HW,ACPI] force serialization of AML methods
index 92f0056d928c1f5ff485e250a93a843bb60058bc..4710845dbac4fb663e35fcf0056499614a06e56b 100644 (file)
@@ -19,6 +19,7 @@ Contents:
      - Control dependencies.
      - SMP barrier pairing.
      - Examples of memory barrier sequences.
+     - Read memory barriers vs load speculation.
 
  (*) Explicit kernel barriers.
 
@@ -248,7 +249,7 @@ And there are a number of things that _must_ or _must_not_ be assumed:
      we may get either of:
 
        STORE *A = X; Y = LOAD *A;
-       STORE *A = Y;
+       STORE *A = Y = X;
 
 
 =========================
@@ -344,9 +345,12 @@ Memory barriers come in four basic varieties:
 
  (4) General memory barriers.
 
-     A general memory barrier is a combination of both a read memory barrier
-     and a write memory barrier.  It is a partial ordering over both loads and
-     stores.
+     A general memory barrier gives a guarantee that all the LOAD and STORE
+     operations specified before the barrier will appear to happen before all
+     the LOAD and STORE operations specified after the barrier with respect to
+     the other components of the system.
+
+     A general memory barrier is a partial ordering over both loads and stores.
 
      General memory barriers imply both read and write memory barriers, and so
      can substitute for either.
@@ -546,9 +550,9 @@ write barrier, though, again, a general barrier is viable:
        =============== ===============
        a = 1;
        <write barrier>
-       b = 2;          x = a;
+       b = 2;          x = b;
                        <read barrier>
-                       y = b;
+                       y = a;
 
 Or:
 
@@ -563,6 +567,18 @@ Or:
 Basically, the read barrier always has to be there, even though it can be of
 the "weaker" type.
 
+[!] Note that the stores before the write barrier would normally be expected to
+match the loads after the read barrier or data dependency barrier, and vice
+versa:
+
+       CPU 1                           CPU 2
+       ===============                 ===============
+       a = 1;           }----   --->{  v = c
+       b = 2;           }    \ /    {  w = d
+       <write barrier>        \        <read barrier>
+       c = 3;           }    / \    {  x = a;
+       d = 4;           }----   --->{  y = b;
+
 
 EXAMPLES OF MEMORY BARRIER SEQUENCES
 ------------------------------------
@@ -600,8 +616,8 @@ STORE B, STORE C } all occuring before the unordered set of { STORE D, STORE E
        |       |       +------+
        +-------+       :      :
                           |
-                          | Sequence in which stores committed to memory system
-                          | by CPU 1
+                          | Sequence in which stores are committed to the
+                          | memory system by CPU 1
                           V
 
 
@@ -683,14 +699,12 @@ then the following will occur:
                                       |        :       :       |       |
                                       |        :       :       | CPU 2 |
                                       |        +-------+       |       |
-                                       \       | X->9  |------>|       |
-                                        \      +-------+       |       |
-                                         ----->| B->2  |       |       |
-                                               +-------+       |       |
-            Makes sure all effects --->    ddddddddddddddddd   |       |
-            prior to the store of C            +-------+       |       |
-            are perceptible to                 | B->2  |------>|       |
-            successive loads                   +-------+       |       |
+                                      |        | X->9  |------>|       |
+                                      |        +-------+       |       |
+         Makes sure all effects --->   \   ddddddddddddddddd   |       |
+         prior to the store of C        \      +-------+       |       |
+         are perceptible to              ----->| B->2  |------>|       |
+         subsequent loads                      +-------+       |       |
                                                :       :       +-------+
 
 
@@ -699,73 +713,239 @@ following sequence of events:
 
        CPU 1                   CPU 2
        ======================= =======================
+               { A = 0, B = 9 }
        STORE A=1
-       STORE B=2
-       STORE C=3
        <write barrier>
-       STORE D=4
-       STORE E=5
-                               LOAD A
+       STORE B=2
                                LOAD B
-                               LOAD C
-                               LOAD D
-                               LOAD E
+                               LOAD A
 
 Without intervention, CPU 2 may then choose to perceive the events on CPU 1 in
 some effectively random order, despite the write barrier issued by CPU 1:
 
-       +-------+       :      :
-       |       |       +------+
-       |       |------>| C=3  | }
-       |       |  :    +------+ }
-       |       |  :    | A=1  | }
-       |       |  :    +------+ }
-       | CPU 1 |  :    | B=2  | }---
-       |       |       +------+ }   \
-       |       |   wwwwwwwwwwwww}    \
-       |       |       +------+ }     \          :       :       +-------+
-       |       |  :    | E=5  | }      \         +-------+       |       |
-       |       |  :    +------+ }       \      { | C->3  |------>|       |
-       |       |------>| D=4  | }        \     { +-------+    :  |       |
-       |       |       +------+           \    { | E->5  |    :  |       |
-       +-------+       :      :            \   { +-------+    :  |       |
-                                  Transfer  -->{ | A->1  |    :  | CPU 2 |
-                                 from CPU 1    { +-------+    :  |       |
-                                  to CPU 2     { | D->4  |    :  |       |
-                                               { +-------+    :  |       |
-                                               { | B->2  |------>|       |
-                                                 +-------+       |       |
-                                                 :       :       +-------+
-
-
-If, however, a read barrier were to be placed between the load of C and the
-load of D on CPU 2, then the partial ordering imposed by CPU 1 will be
-perceived correctly by CPU 2.
+       +-------+       :      :                :       :
+       |       |       +------+                +-------+
+       |       |------>| A=1  |------      --->| A->0  |
+       |       |       +------+      \         +-------+
+       | CPU 1 |   wwwwwwwwwwwwwwww   \    --->| B->9  |
+       |       |       +------+        |       +-------+
+       |       |------>| B=2  |---     |       :       :
+       |       |       +------+   \    |       :       :       +-------+
+       +-------+       :      :    \   |       +-------+       |       |
+                                    ---------->| B->2  |------>|       |
+                                       |       +-------+       | CPU 2 |
+                                       |       | A->0  |------>|       |
+                                       |       +-------+       |       |
+                                       |       :       :       +-------+
+                                        \      :       :
+                                         \     +-------+
+                                          ---->| A->1  |
+                                               +-------+
+                                               :       :
 
-       +-------+       :      :
-       |       |       +------+
-       |       |------>| C=3  | }
-       |       |  :    +------+ }
-       |       |  :    | A=1  | }---
-       |       |  :    +------+ }   \
-       | CPU 1 |  :    | B=2  | }    \
-       |       |       +------+       \
-       |       |   wwwwwwwwwwwwwwww    \
-       |       |       +------+         \        :       :       +-------+
-       |       |  :    | E=5  | }        \       +-------+       |       |
-       |       |  :    +------+ }---      \    { | C->3  |------>|       |
-       |       |------>| D=4  | }   \      \   { +-------+    :  |       |
-       |       |       +------+      \      -->{ | B->2  |    :  |       |
-       +-------+       :      :       \        { +-------+    :  |       |
-                                       \       { | A->1  |    :  | CPU 2 |
-                                        \        +-------+       |       |
-          At this point the read ---->   \   rrrrrrrrrrrrrrrrr   |       |
-          barrier causes all effects      \      +-------+       |       |
-          prior to the storage of C        \   { | E->5  |    :  |       |
-          to be perceptible to CPU 2        -->{ +-------+    :  |       |
-                                               { | D->4  |------>|       |
-                                                 +-------+       |       |
-                                                 :       :       +-------+
+
+If, however, a read barrier were to be placed between the load of E and the
+load of A on CPU 2:
+
+       CPU 1                   CPU 2
+       ======================= =======================
+               { A = 0, B = 9 }
+       STORE A=1
+       <write barrier>
+       STORE B=2
+                               LOAD B
+                               <read barrier>
+                               LOAD A
+
+then the partial ordering imposed by CPU 1 will be perceived correctly by CPU
+2:
+
+       +-------+       :      :                :       :
+       |       |       +------+                +-------+
+       |       |------>| A=1  |------      --->| A->0  |
+       |       |       +------+      \         +-------+
+       | CPU 1 |   wwwwwwwwwwwwwwww   \    --->| B->9  |
+       |       |       +------+        |       +-------+
+       |       |------>| B=2  |---     |       :       :
+       |       |       +------+   \    |       :       :       +-------+
+       +-------+       :      :    \   |       +-------+       |       |
+                                    ---------->| B->2  |------>|       |
+                                       |       +-------+       | CPU 2 |
+                                       |       :       :       |       |
+                                       |       :       :       |       |
+         At this point the read ---->   \  rrrrrrrrrrrrrrrrr   |       |
+         barrier causes all effects      \     +-------+       |       |
+         prior to the storage of B        ---->| A->1  |------>|       |
+         to be perceptible to CPU 2            +-------+       |       |
+                                               :       :       +-------+
+
+
+To illustrate this more completely, consider what could happen if the code
+contained a load of A either side of the read barrier:
+
+       CPU 1                   CPU 2
+       ======================= =======================
+               { A = 0, B = 9 }
+       STORE A=1
+       <write barrier>
+       STORE B=2
+                               LOAD B
+                               LOAD A [first load of A]
+                               <read barrier>
+                               LOAD A [second load of A]
+
+Even though the two loads of A both occur after the load of B, they may both
+come up with different values:
+
+       +-------+       :      :                :       :
+       |       |       +------+                +-------+
+       |       |------>| A=1  |------      --->| A->0  |
+       |       |       +------+      \         +-------+
+       | CPU 1 |   wwwwwwwwwwwwwwww   \    --->| B->9  |
+       |       |       +------+        |       +-------+
+       |       |------>| B=2  |---     |       :       :
+       |       |       +------+   \    |       :       :       +-------+
+       +-------+       :      :    \   |       +-------+       |       |
+                                    ---------->| B->2  |------>|       |
+                                       |       +-------+       | CPU 2 |
+                                       |       :       :       |       |
+                                       |       :       :       |       |
+                                       |       +-------+       |       |
+                                       |       | A->0  |------>| 1st   |
+                                       |       +-------+       |       |
+         At this point the read ---->   \  rrrrrrrrrrrrrrrrr   |       |
+         barrier causes all effects      \     +-------+       |       |
+         prior to the storage of B        ---->| A->1  |------>| 2nd   |
+         to be perceptible to CPU 2            +-------+       |       |
+                                               :       :       +-------+
+
+
+But it may be that the update to A from CPU 1 becomes perceptible to CPU 2
+before the read barrier completes anyway:
+
+       +-------+       :      :                :       :
+       |       |       +------+                +-------+
+       |       |------>| A=1  |------      --->| A->0  |
+       |       |       +------+      \         +-------+
+       | CPU 1 |   wwwwwwwwwwwwwwww   \    --->| B->9  |
+       |       |       +------+        |       +-------+
+       |       |------>| B=2  |---     |       :       :
+       |       |       +------+   \    |       :       :       +-------+
+       +-------+       :      :    \   |       +-------+       |       |
+                                    ---------->| B->2  |------>|       |
+                                       |       +-------+       | CPU 2 |
+                                       |       :       :       |       |
+                                        \      :       :       |       |
+                                         \     +-------+       |       |
+                                          ---->| A->1  |------>| 1st   |
+                                               +-------+       |       |
+                                           rrrrrrrrrrrrrrrrr   |       |
+                                               +-------+       |       |
+                                               | A->1  |------>| 2nd   |
+                                               +-------+       |       |
+                                               :       :       +-------+
+
+
+The guarantee is that the second load will always come up with A == 1 if the
+load of B came up with B == 2.  No such guarantee exists for the first load of
+A; that may come up with either A == 0 or A == 1.
+
+
+READ MEMORY BARRIERS VS LOAD SPECULATION
+----------------------------------------
+
+Many CPUs speculate with loads: that is they see that they will need to load an
+item from memory, and they find a time where they're not using the bus for any
+other loads, and so do the load in advance - even though they haven't actually
+got to that point in the instruction execution flow yet.  This permits the
+actual load instruction to potentially complete immediately because the CPU
+already has the value to hand.
+
+It may turn out that the CPU didn't actually need the value - perhaps because a
+branch circumvented the load - in which case it can discard the value or just
+cache it for later use.
+
+Consider:
+
+       CPU 1                   CPU 2
+       ======================= =======================
+                               LOAD B
+                               DIVIDE          } Divide instructions generally
+                               DIVIDE          } take a long time to perform
+                               LOAD A
+
+Which might appear as this:
+
+                                               :       :       +-------+
+                                               +-------+       |       |
+                                           --->| B->2  |------>|       |
+                                               +-------+       | CPU 2 |
+                                               :       :DIVIDE |       |
+                                               +-------+       |       |
+       The CPU being busy doing a --->     --->| A->0  |~~~~   |       |
+       division speculates on the              +-------+   ~   |       |
+       LOAD of A                               :       :   ~   |       |
+                                               :       :DIVIDE |       |
+                                               :       :   ~   |       |
+       Once the divisions are complete -->     :       :   ~-->|       |
+       the CPU can then perform the            :       :       |       |
+       LOAD with immediate effect              :       :       +-------+
+
+
+Placing a read barrier or a data dependency barrier just before the second
+load:
+
+       CPU 1                   CPU 2
+       ======================= =======================
+                               LOAD B
+                               DIVIDE
+                               DIVIDE
+                               <read barrier>
+                               LOAD A
+
+will force any value speculatively obtained to be reconsidered to an extent
+dependent on the type of barrier used.  If there was no change made to the
+speculated memory location, then the speculated value will just be used:
+
+                                               :       :       +-------+
+                                               +-------+       |       |
+                                           --->| B->2  |------>|       |
+                                               +-------+       | CPU 2 |
+                                               :       :DIVIDE |       |
+                                               +-------+       |       |
+       The CPU being busy doing a --->     --->| A->0  |~~~~   |       |
+       division speculates on the              +-------+   ~   |       |
+       LOAD of A                               :       :   ~   |       |
+                                               :       :DIVIDE |       |
+                                               :       :   ~   |       |
+                                               :       :   ~   |       |
+                                           rrrrrrrrrrrrrrrr~   |       |
+                                               :       :   ~   |       |
+                                               :       :   ~-->|       |
+                                               :       :       |       |
+                                               :       :       +-------+
+
+
+but if there was an update or an invalidation from another CPU pending, then
+the speculation will be cancelled and the value reloaded:
+
+                                               :       :       +-------+
+                                               +-------+       |       |
+                                           --->| B->2  |------>|       |
+                                               +-------+       | CPU 2 |
+                                               :       :DIVIDE |       |
+                                               +-------+       |       |
+       The CPU being busy doing a --->     --->| A->0  |~~~~   |       |
+       division speculates on the              +-------+   ~   |       |
+       LOAD of A                               :       :   ~   |       |
+                                               :       :DIVIDE |       |
+                                               :       :   ~   |       |
+                                               :       :   ~   |       |
+                                           rrrrrrrrrrrrrrrrr   |       |
+                                               +-------+       |       |
+       The speculation is discarded --->   --->| A->1  |------>|       |
+       and an updated value is                 +-------+       |       |
+       retrieved                               :       :       +-------+
 
 
 ========================
@@ -901,7 +1081,7 @@ IMPLICIT KERNEL MEMORY BARRIERS
 ===============================
 
 Some of the other functions in the linux kernel imply memory barriers, amongst
-which are locking, scheduling and memory allocation functions.
+which are locking and scheduling functions.
 
 This specification is a _minimum_ guarantee; any particular architecture may
 provide more substantial guarantees, but these may not be relied upon outside
@@ -966,6 +1146,20 @@ equivalent to a full barrier, but a LOCK followed by an UNLOCK is not.
     barriers is that the effects instructions outside of a critical section may
     seep into the inside of the critical section.
 
+A LOCK followed by an UNLOCK may not be assumed to be full memory barrier
+because it is possible for an access preceding the LOCK to happen after the
+LOCK, and an access following the UNLOCK to happen before the UNLOCK, and the
+two accesses can themselves then cross:
+
+       *A = a;
+       LOCK
+       UNLOCK
+       *B = b;
+
+may occur as:
+
+       LOCK, STORE *B, STORE *A, UNLOCK
+
 Locks and semaphores may not provide any guarantee of ordering on UP compiled
 systems, and so cannot be counted on in such a situation to actually achieve
 anything at all - especially with respect to I/O accesses - unless combined
@@ -1016,8 +1210,6 @@ Other functions that imply barriers:
 
  (*) schedule() and similar imply full memory barriers.
 
- (*) Memory allocation and release functions imply full memory barriers.
-
 
 =================================
 INTER-CPU LOCKING BARRIER EFFECTS
@@ -1031,7 +1223,7 @@ conflict on any particular lock.
 LOCKS VS MEMORY ACCESSES
 ------------------------
 
-Consider the following: the system has a pair of spinlocks (N) and (Q), and
+Consider the following: the system has a pair of spinlocks (M) and (Q), and
 three CPUs; then should the following sequence of events occur:
 
        CPU 1                           CPU 2
@@ -1678,7 +1870,7 @@ CPU's caches by some other cache event:
        smp_wmb();
        <A:modify v=2>  <C:busy>
                        <C:queue v=2>
-       p = &b;         q = p;
+       p = &v;         q = p;
                        <D:request p>
        <B:modify p=&v> <D:commit p=&v>
                        <D:read p>
index df82116a9f261c35998c3bb5a69eb1a38c8d83d1..88ad615dd338d75e2b282422c8f2d6f7f3af80b7 100644 (file)
@@ -214,12 +214,13 @@ hardware.
        The interaction of the iflag bits is as follows (parity error
        given as an example):
        Parity error    INPCK   IGNPAR
-       None            n/a     n/a     character received
-       Yes             n/a     0       character discarded
-       Yes             0       1       character received, marked as
+       n/a             0       n/a     character received, marked as
                                        TTY_NORMAL
-       Yes             1       1       character received, marked as
+       None            1       n/a     character received, marked as
+                                       TTY_NORMAL
+       Yes             1       0       character received, marked as
                                        TTY_PARITY
+       Yes             1       1       character discarded
 
        Other flags may be used (eg, xon/xoff characters) if your
        hardware supports hardware "soft" flow control.
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx
new file mode 100644 (file)
index 0000000..9c45f3d
--- /dev/null
@@ -0,0 +1,234 @@
+PXA2xx SPI on SSP driver HOWTO
+===================================================
+This a mini howto on the pxa2xx_spi driver.  The driver turns a PXA2xx
+synchronous serial port into a SPI master controller
+(see Documentation/spi/spi_summary). The driver has the following features
+
+- Support for any PXA2xx SSP
+- SSP PIO and SSP DMA data transfers.
+- External and Internal (SSPFRM) chip selects.
+- Per slave device (chip) configuration.
+- Full suspend, freeze, resume support.
+
+The driver is built around a "spi_message" fifo serviced by workqueue and a
+tasklet. The workqueue, "pump_messages", drives message fifo and the tasklet
+(pump_transfer) is responsible for queuing SPI transactions and setting up and
+launching the dma/interrupt driven transfers.
+
+Declaring PXA2xx Master Controllers
+-----------------------------------
+Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a
+"platform device".  The master configuration is passed to the driver via a table
+found in include/asm-arm/arch-pxa/pxa2xx_spi.h:
+
+struct pxa2xx_spi_master {
+       enum pxa_ssp_type ssp_type;
+       u32 clock_enable;
+       u16 num_chipselect;
+       u8 enable_dma;
+};
+
+The "pxa2xx_spi_master.ssp_type" field must have a value between 1 and 3 and
+informs the driver which features a particular SSP supports.
+
+The "pxa2xx_spi_master.clock_enable" field is used to enable/disable the
+corresponding SSP peripheral block in the "Clock Enable Register (CKEN"). See
+the "PXA2xx Developer Manual" section "Clocks and Power Management".
+
+The "pxa2xx_spi_master.num_chipselect" field is used to determine the number of
+slave device (chips) attached to this SPI master.
+
+The "pxa2xx_spi_master.enable_dma" field informs the driver that SSP DMA should
+be used.  This caused the driver to acquire two DMA channels: rx_channel and
+tx_channel.  The rx_channel has a higher DMA service priority the tx_channel.
+See the "PXA2xx Developer Manual" section "DMA Controller".
+
+NSSP MASTER SAMPLE
+------------------
+Below is a sample configuration using the PXA255 NSSP.
+
+static struct resource pxa_spi_nssp_resources[] = {
+       [0] = {
+               .start  = __PREG(SSCR0_P(2)), /* Start address of NSSP */
+               .end    = __PREG(SSCR0_P(2)) + 0x2c, /* Range of registers */
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_NSSP, /* NSSP IRQ */
+               .end    = IRQ_NSSP,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct pxa2xx_spi_master pxa_nssp_master_info = {
+       .ssp_type = PXA25x_NSSP, /* Type of SSP */
+       .clock_enable = CKEN9_NSSP, /* NSSP Peripheral clock */
+       .num_chipselect = 1, /* Matches the number of chips attached to NSSP */
+       .enable_dma = 1, /* Enables NSSP DMA */
+};
+
+static struct platform_device pxa_spi_nssp = {
+       .name = "pxa2xx-spi", /* MUST BE THIS VALUE, so device match driver */
+       .id = 2, /* Bus number, MUST MATCH SSP number 1..n */
+       .resource = pxa_spi_nssp_resources,
+       .num_resources = ARRAY_SIZE(pxa_spi_nssp_resources),
+       .dev = {
+               .platform_data = &pxa_nssp_master_info, /* Passed to driver */
+       },
+};
+
+static struct platform_device *devices[] __initdata = {
+       &pxa_spi_nssp,
+};
+
+static void __init board_init(void)
+{
+       (void)platform_add_device(devices, ARRAY_SIZE(devices));
+}
+
+Declaring Slave Devices
+-----------------------
+Typically each SPI slave (chip) is defined in the arch/.../mach-*/board-*.c
+using the "spi_board_info" structure found in "linux/spi/spi.h". See
+"Documentation/spi/spi_summary" for additional information.
+
+Each slave device attached to the PXA must provide slave specific configuration
+information via the structure "pxa2xx_spi_chip" found in
+"include/asm-arm/arch-pxa/pxa2xx_spi.h".  The pxa2xx_spi master controller driver
+will uses the configuration whenever the driver communicates with the slave
+device.
+
+struct pxa2xx_spi_chip {
+       u8 tx_threshold;
+       u8 rx_threshold;
+       u8 dma_burst_size;
+       u32 timeout_microsecs;
+       u8 enable_loopback;
+       void (*cs_control)(u32 command);
+};
+
+The "pxa2xx_spi_chip.tx_threshold" and "pxa2xx_spi_chip.rx_threshold" fields are
+used to configure the SSP hardware fifo.  These fields are critical to the
+performance of pxa2xx_spi driver and misconfiguration will result in rx
+fifo overruns (especially in PIO mode transfers). Good default values are
+
+       .tx_threshold = 12,
+       .rx_threshold = 4,
+
+The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA
+engine and is related the "spi_device.bits_per_word" field.  Read and understand
+the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers
+to determine the correct value. An SSP configured for byte-wide transfers would
+use a value of 8.
+
+The "pxa2xx_spi_chip.timeout_microsecs" fields is used to efficiently handle
+trailing bytes in the SSP receiver fifo.  The correct value for this field is
+dependent on the SPI bus speed ("spi_board_info.max_speed_hz") and the specific
+slave device.  Please note the the PXA2xx SSP 1 does not support trailing byte
+timeouts and must busy-wait any trailing bytes.
+
+The "pxa2xx_spi_chip.enable_loopback" field is used to place the SSP porting
+into internal loopback mode.  In this mode the SSP controller internally
+connects the SSPTX pin the the SSPRX pin.  This is useful for initial setup
+testing.
+
+The "pxa2xx_spi_chip.cs_control" field is used to point to a board specific
+function for asserting/deasserting a slave device chip select.  If the field is
+NULL, the pxa2xx_spi master controller driver assumes that the SSP port is
+configured to use SSPFRM instead.
+
+NSSP SALVE SAMPLE
+-----------------
+The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the
+"spi_board_info.controller_data" field. Below is a sample configuration using
+the PXA255 NSSP.
+
+/* Chip Select control for the CS8415A SPI slave device */
+static void cs8415a_cs_control(u32 command)
+{
+       if (command & PXA2XX_CS_ASSERT)
+               GPCR(2) = GPIO_bit(2);
+       else
+               GPSR(2) = GPIO_bit(2);
+}
+
+/* Chip Select control for the CS8405A SPI slave device */
+static void cs8405a_cs_control(u32 command)
+{
+       if (command & PXA2XX_CS_ASSERT)
+               GPCR(3) = GPIO_bit(3);
+       else
+               GPSR(3) = GPIO_bit(3);
+}
+
+static struct pxa2xx_spi_chip cs8415a_chip_info = {
+       .tx_threshold = 12, /* SSP hardward FIFO threshold */
+       .rx_threshold = 4, /* SSP hardward FIFO threshold */
+       .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */
+       .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */
+       .cs_control = cs8415a_cs_control, /* Use external chip select */
+};
+
+static struct pxa2xx_spi_chip cs8405a_chip_info = {
+       .tx_threshold = 12, /* SSP hardward FIFO threshold */
+       .rx_threshold = 4, /* SSP hardward FIFO threshold */
+       .dma_burst_size = 8, /* Byte wide transfers used so 8 byte bursts */
+       .timeout_microsecs = 64, /* Wait at least 64usec to handle trailing */
+       .cs_control = cs8405a_cs_control, /* Use external chip select */
+};
+
+static struct spi_board_info streetracer_spi_board_info[] __initdata = {
+       {
+               .modalias = "cs8415a", /* Name of spi_driver for this device */
+               .max_speed_hz = 3686400, /* Run SSP as fast a possbile */
+               .bus_num = 2, /* Framework bus number */
+               .chip_select = 0, /* Framework chip select */
+               .platform_data = NULL; /* No spi_driver specific config */
+               .controller_data = &cs8415a_chip_info, /* Master chip config */
+               .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */
+       },
+       {
+               .modalias = "cs8405a", /* Name of spi_driver for this device */
+               .max_speed_hz = 3686400, /* Run SSP as fast a possbile */
+               .bus_num = 2, /* Framework bus number */
+               .chip_select = 1, /* Framework chip select */
+               .controller_data = &cs8405a_chip_info, /* Master chip config */
+               .irq = STREETRACER_APCI_IRQ, /* Slave device interrupt */
+       },
+};
+
+static void __init streetracer_init(void)
+{
+       spi_register_board_info(streetracer_spi_board_info,
+                               ARRAY_SIZE(streetracer_spi_board_info));
+}
+
+
+DMA and PIO I/O Support
+-----------------------
+The pxa2xx_spi driver support both DMA and interrupt driven PIO message
+transfers.  The driver defaults to PIO mode and DMA transfers must enabled by
+setting the "enable_dma" flag in the "pxa2xx_spi_master" structure and and
+ensuring that the "pxa2xx_spi_chip.dma_burst_size" field is non-zero.  The DMA
+mode support both coherent and stream based DMA mappings.
+
+The following logic is used to determine the type of I/O to be used on
+a per "spi_transfer" basis:
+
+if !enable_dma or dma_burst_size == 0 then
+       always use PIO transfers
+
+if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then
+       use coherent DMA mode
+
+if rx_buf and tx_buf are aligned on 8 byte boundary then
+       use streaming DMA mode
+
+otherwise
+       use PIO transfer
+
+THANKS TO
+---------
+
+David Brownell and others for mentoring the development of this driver.
+
index a5ffba33a35188a0d858871c06c090361de81b88..068732d32276b1f32bf285c10522b7e103e781e4 100644 (file)
@@ -414,7 +414,33 @@ to get the driver-private data allocated for that device.
 The driver will initialize the fields of that spi_master, including the
 bus number (maybe the same as the platform device ID) and three methods
 used to interact with the SPI core and SPI protocol drivers.  It will
-also initialize its own internal state.
+also initialize its own internal state.  (See below about bus numbering
+and those methods.)
+
+After you initialize the spi_master, then use spi_register_master() to
+publish it to the rest of the system.  At that time, device nodes for
+the controller and any predeclared spi devices will be made available,
+and the driver model core will take care of binding them to drivers.
+
+If you need to remove your SPI controller driver, spi_unregister_master()
+will reverse the effect of spi_register_master().
+
+
+BUS NUMBERING
+
+Bus numbering is important, since that's how Linux identifies a given
+SPI bus (shared SCK, MOSI, MISO).  Valid bus numbers start at zero.  On
+SOC systems, the bus numbers should match the numbers defined by the chip
+manufacturer.  For example, hardware controller SPI2 would be bus number 2,
+and spi_board_info for devices connected to it would use that number.
+
+If you don't have such hardware-assigned bus number, and for some reason
+you can't just assign them, then provide a negative bus number.  That will
+then be replaced by a dynamically assigned number. You'd then need to treat
+this as a non-static configuration (see above).
+
+
+SPI MASTER METHODS
 
     master->setup(struct spi_device *spi)
        This sets up the device clock rate, SPI mode, and word sizes.
@@ -431,6 +457,9 @@ also initialize its own internal state.
        state it dynamically associates with that device.  If you do that,
        be sure to provide the cleanup() method to free that state.
 
+
+SPI MESSAGE QUEUE
+
 The bulk of the driver will be managing the I/O queue fed by transfer().
 
 That queue could be purely conceptual.  For example, a driver used only
@@ -440,6 +469,9 @@ But the queue will probably be very real, using message->queue, PIO,
 often DMA (especially if the root filesystem is in SPI flash), and
 execution contexts like IRQ handlers, tasklets, or workqueues (such
 as keventd).  Your driver can be as fancy, or as simple, as you need.
+Such a transfer() method would normally just add the message to a
+queue, and then start some asynchronous transfer engine (unless it's
+already running).
 
 
 THANKS TO
index c5beb548cfc42b781fd825ff9345f411f087897d..21ed5117366240d2a33af5af7f5605733bd514c1 100644 (file)
@@ -36,6 +36,9 @@ timeout or margin.  The simplest way to ping the watchdog is to write
 some data to the device.  So a very simple watchdog daemon would look
 like this:
 
+#include <stdlib.h>
+#include <fcntl.h>
+
 int main(int argc, const char *argv[]) {
        int fd=open("/dev/watchdog",O_WRONLY);
        if (fd==-1) {
index 5e33558714167ecafd03bbe7190fcc4a2dea269e..c3c5842402df553bc497a594fac2b30b7d4a3b84 100644 (file)
@@ -40,11 +40,20 @@ trivial patch so apply some common sense.
        PLEASE document known bugs. If it doesn't work for everything
        or does something very odd once a month document it.
 
+       PLEASE remember that submissions must be made under the terms
+       of the OSDL certificate of contribution
+       (http://www.osdl.org/newsroom/press_releases/2004/2004_05_24_dco.html)
+       and should include a Signed-off-by: line.
+
 6.     Make sure you have the right to send any changes you make. If you
        do changes at work you may find your employer owns the patch
        not you.
 
-7.     Happy hacking.
+7.     When sending security related changes or reports to a maintainer
+       please Cc: security@kernel.org, especially if the maintainer
+       does not respond.
+
+8.     Happy hacking.
 
                -----------------------------------
 
@@ -556,7 +565,19 @@ BROADBAND PROCESSOR ARCHITECTURE
 P:     Arnd Bergmann
 M:     arnd@arndb.de
 L:     linuxppc-dev@ozlabs.org
-W:     http://linuxppc64.org
+W:     http://www.penguinppc.org/ppc64/
+S:     Supported
+
+BROADCOM BNX2 GIGABIT ETHERNET DRIVER
+P:     Michael Chan
+M:     mchan@broadcom.com
+L:     netdev@vger.kernel.org
+S:     Supported
+
+BROADCOM TG3 GIGABIT ETHERNET DRIVER
+P:     Michael Chan
+M:     mchan@broadcom.com
+L:     netdev@vger.kernel.org
 S:     Supported
 
 BTTV VIDEO4LINUX DRIVER
@@ -969,7 +990,7 @@ S:  Maintained
 EXT3 FILE SYSTEM
 P:     Stephen Tweedie, Andrew Morton
 M:     sct@redhat.com, akpm@osdl.org, adilger@clusterfs.com
-L:     ext3-users@redhat.com
+L:     ext2-devel@lists.sourceforge.net
 S:     Maintained
 
 F71805F HARDWARE MONITORING DRIVER
@@ -1530,12 +1551,28 @@ W:      http://jfs.sourceforge.net/
 T:     git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git
 S:     Supported
 
+JOURNALLING LAYER FOR BLOCK DEVICS (JBD)
+P:     Stephen Tweedie, Andrew Morton
+M:     sct@redhat.com, akpm@osdl.org
+L:     ext2-devel@lists.sourceforge.net
+S:     Maintained
+
 KCONFIG
 P:     Roman Zippel
 M:     zippel@linux-m68k.org
 L:     kbuild-devel@lists.sourceforge.net
 S:     Maintained
 
+KDUMP
+P:     Vivek Goyal
+M:     vgoyal@in.ibm.com
+P:     Haren Myneni
+M:     hbabu@us.ibm.com
+L:     fastboot@lists.osdl.org
+L:     linux-kernel@vger.kernel.org
+W:     http://lse.sourceforge.net/kdump/
+S:     Maintained
+
 KERNEL AUTOMOUNTER (AUTOFS)
 P:     H. Peter Anvin
 M:     hpa@zytor.com
@@ -1603,6 +1640,11 @@ M:       James.Bottomley@HansenPartnership.com
 L:     linux-scsi@vger.kernel.org
 S:     Maintained
 
+LED SUBSYSTEM
+P:     Richard Purdie
+M:     rpurdie@rpsys.net
+S:     Maintained
+
 LEGO USB Tower driver
 P:     Juergen Stuber
 M:     starblue@users.sourceforge.net
@@ -1662,7 +1704,7 @@ S:        Maintained
 
 LINUX FOR POWERPC EMBEDDED PPC8XX
 P:     Marcelo Tosatti
-M:     marcelo.tosatti@cyclades.com
+M:     marcelo@kvack.org
 W:     http://www.penguinppc.org/
 L:     linuxppc-embedded@ozlabs.org
 S:     Maintained
@@ -1686,7 +1728,7 @@ M:        paulus@au.ibm.com
 P:     Anton Blanchard
 M:     anton@samba.org
 M:     anton@au.ibm.com
-W:     http://linuxppc64.org
+W:     http://www.penguinppc.org/ppc64/
 L:     linuxppc-dev@ozlabs.org
 S:     Supported
 
@@ -1847,6 +1889,11 @@ L:       linux-kernel@vger.kernel.org
 W:     http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html
 S:     Maintained
 
+MULTIMEDIA CARD SUBSYSTEM
+P:     Russell King
+M:     rmk+mmc@arm.linux.org.uk
+S:     Maintained
+
 MULTISOUND SOUND DRIVER
 P:     Andrew Veliath
 M:     andrewtv@usa.net
@@ -1869,6 +1916,12 @@ M:       James.Bottomley@HansenPartnership.com
 L:     linux-scsi@vger.kernel.org
 S:     Maintained
 
+NETEM NETWORK EMULATOR
+P:     Stephen Hemminger
+M:     shemminger@osdl.org
+L:     netem@osdl.org
+S:     Maintained
+
 NETFILTER/IPTABLES/IPCHAINS
 P:     Rusty Russell
 P:     Marc Boucher
@@ -2513,6 +2566,12 @@ M:       perex@suse.cz
 L:     alsa-devel@alsa-project.org
 S:     Maintained
 
+SPI SUBSYSTEM
+P:     David Brownell
+M:     dbrownell@users.sourceforge.net
+L:     spi-devel-general@lists.sourceforge.net
+S:     Maintained
+
 TPM DEVICE DRIVER
 P:     Kylene Hall
 M:     kjhall@us.ibm.com
index 3494c17c9fb9fe437134057e01bac2f4ffc887aa..a3a7baad85550690b45ea007f98477ff948e5186 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 17
-EXTRAVERSION =-rc4
-NAME=Sliding Snow Leopard
+EXTRAVERSION =-rc6
+NAME=Crazed Snow-Weasel
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
index 8290b69da20214a7e19fedd0fc047d33d5d82ba7..213c7850d5fb9639a007616b7357fe93f5ae64e8 100644 (file)
@@ -453,7 +453,7 @@ config ALPHA_IRONGATE
 
 config GENERIC_HWEIGHT
        bool
-       default y if !ALPHA_EV6 && !ALPHA_EV67
+       default y if !ALPHA_EV67
 
 config ALPHA_AVANTI
        bool
index c645c5e14786fdd17efddf40bb3ae2b40524ffd8..2b245ad731ee8f85a4e02ce3de100713760a414c 100644 (file)
@@ -182,7 +182,6 @@ EXPORT_SYMBOL(smp_num_cpus);
 EXPORT_SYMBOL(smp_call_function);
 EXPORT_SYMBOL(smp_call_function_on_cpu);
 EXPORT_SYMBOL(_atomic_dec_and_lock);
-EXPORT_SYMBOL(cpu_present_mask);
 #endif /* CONFIG_SMP */
 
 /*
index 9924fd07743abfd5bb4cda9e78ac3e58ca72a9d7..c760a831fd1a250d45bdc2e6e70f6f5c243fd3c1 100644 (file)
@@ -94,7 +94,7 @@ common_shutdown_1(void *generic_ptr)
        if (cpuid != boot_cpuid) {
                flags |= 0x00040000UL; /* "remain halted" */
                *pflags = flags;
-               clear_bit(cpuid, &cpu_present_mask);
+               cpu_clear(cpuid, cpu_present_map);
                halt();
        }
 #endif
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr)
 
 #ifdef CONFIG_SMP
        /* Wait for the secondaries to halt. */
-       cpu_clear(boot_cpuid, cpu_possible_map);
-       while (cpus_weight(cpu_possible_map))
+       cpu_clear(boot_cpuid, cpu_present_map);
+       while (cpus_weight(cpu_present_map))
                barrier();
 #endif
 
index 185255416e8538c22384ae89491720834aa6fcc1..4dc273e537fdd38830deb0ede8a3b560827a8ab0 100644 (file)
@@ -68,7 +68,6 @@ enum ipi_message_type {
 static int smp_secondary_alive __initdata = 0;
 
 /* Which cpus ids came online.  */
-cpumask_t cpu_present_mask;
 cpumask_t cpu_online_map;
 
 EXPORT_SYMBOL(cpu_online_map);
@@ -439,7 +438,7 @@ setup_smp(void)
                        if ((cpu->flags & 0x1cc) == 0x1cc) {
                                smp_num_probed++;
                                /* Assume here that "whami" == index */
-                               cpu_set(i, cpu_present_mask);
+                               cpu_set(i, cpu_present_map);
                                cpu->pal_revision = boot_cpu_palrev;
                        }
 
@@ -450,11 +449,10 @@ setup_smp(void)
                }
        } else {
                smp_num_probed = 1;
-               cpu_set(boot_cpuid, cpu_present_mask);
        }
 
-       printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n",
-              smp_num_probed, cpu_possible_map.bits[0]);
+       printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_map = %lx\n",
+              smp_num_probed, cpu_present_map.bits[0]);
 }
 
 /*
@@ -473,7 +471,7 @@ smp_prepare_cpus(unsigned int max_cpus)
 
        /* Nothing to do on a UP box, or when told not to.  */
        if (smp_num_probed == 1 || max_cpus == 0) {
-               cpu_present_mask = cpumask_of_cpu(boot_cpuid);
+               cpu_present_map = cpumask_of_cpu(boot_cpuid);
                printk(KERN_INFO "SMP mode deactivated.\n");
                return;
        }
@@ -486,10 +484,6 @@ smp_prepare_cpus(unsigned int max_cpus)
 void __devinit
 smp_prepare_boot_cpu(void)
 {
-       /*
-        * Mark the boot cpu (current cpu) as online
-        */ 
-       cpu_set(smp_processor_id(), cpu_online_map);
 }
 
 int __devinit
index 5f84417eeb7bee9502d0da72805bc895b864ca0f..2551fb49ae099150561407adc726e410b8e03c9f 100644 (file)
@@ -66,7 +66,7 @@ titan_update_irq_hw(unsigned long mask)
        register int bcpu = boot_cpuid;
 
 #ifdef CONFIG_SMP
-       cpumask_t cpm = cpu_present_mask;
+       cpumask_t cpm = cpu_present_map;
        volatile unsigned long *dim0, *dim1, *dim2, *dim3;
        unsigned long mask0, mask1, mask2, mask3, dummy;
 
index 5d3acff8c596e0c0670d7d956379d860e9591ba7..d22f38b957db9c825e5cae7bec8bee90357efa06 100644 (file)
@@ -101,7 +101,7 @@ config DEBUG_S3C2410_UART
        help
          Choice for UART for kernel low-level using S3C2410 UARTS,
          should be between zero and two. The port must have been
-         initalised by the boot-loader before use.
+         initialised by the boot-loader before use.
 
          The uncompressor code port configuration is now handled
          by CONFIG_S3C2410_LOWLEVEL_UART_PORT.
index 45fdf4a51a2ad0a7d1d127ff9dc75898a3aa6369..396efba9bacd2d6fb6351e18149576cc1d779665 100644 (file)
@@ -99,6 +99,8 @@ int main(void)
   DEFINE(MACHINFO_NAME,                offsetof(struct machine_desc, name));
   DEFINE(MACHINFO_PHYSIO,      offsetof(struct machine_desc, phys_io));
   DEFINE(MACHINFO_PGOFFIO,     offsetof(struct machine_desc, io_pg_offst));
+  BLANK();
+  DEFINE(PROC_INFO_SZ,         sizeof(struct proc_info_list));
   DEFINE(PROCINFO_INITFUNC,    offsetof(struct proc_info_list, __cpu_flush));
   DEFINE(PROCINFO_MMUFLAGS,    offsetof(struct proc_info_list, __cpu_mmu_flags));
   return 0; 
index 03532769a97f38840bea46f2969c914d857eb9d4..0a3e9ad297d8ba8be45967e811be5d226941eb90 100644 (file)
@@ -143,12 +143,23 @@ static struct dma_ops isa_dma_ops = {
        .residue        = isa_get_dma_residue,
 };
 
-static struct resource dma_resources[] = {
-       { "dma1",               0x0000, 0x000f },
-       { "dma low page",       0x0080, 0x008f },
-       { "dma2",               0x00c0, 0x00df },
-       { "dma high page",      0x0480, 0x048f }
-};
+static struct resource dma_resources[] = { {
+       .name   = "dma1",
+       .start  = 0x0000,
+       .end    = 0x000f
+}, {
+       .name   = "dma low page",
+       .start  = 0x0080,
+       .end    = 0x008f
+}, {
+       .name   = "dma2",
+       .start  = 0x00c0,
+       .end    = 0x00df
+}, {
+       .name   = "dma high page",
+       .start  = 0x0480,
+       .end    = 0x048f
+} };
 
 void __init isa_init_dma(dma_t *dma)
 {
index 1a1539e3a9462eef17f949445f116356bee810de..7df6e1aaa323b83ae0cedad37a943404d106868f 100644 (file)
@@ -311,7 +311,7 @@ void free_thread_info(struct thread_info *thread)
                struct thread_info_list *th = &get_cpu_var(thread_info_list);
                if (th->nr < EXTRA_TASK_STRUCT) {
                        unsigned long *p = (unsigned long *)thread;
-                       p[0] = th->head;
+                       p[0] = (unsigned long)th->head;
                        th->head = p;
                        th->nr += 1;
                        put_cpu_var(thread_info_list);
index 3bdc8c6949c59aabf7ef812c2b890307bb0ab43f..16153c86c3f871a69674f7c293784981431f6b56 100644 (file)
@@ -122,7 +122,7 @@ ENTRY(c_backtrace)
 #define reg   r5
 #define stack r6
 
-.Ldumpstm:     stmfd   sp!, {instr, reg, stack, r7, lr}
+.Ldumpstm:     stmfd   sp!, {instr, reg, stack, r7, r8, lr}
                mov     stack, r0
                mov     instr, r1
                mov     reg, #9
@@ -145,7 +145,7 @@ ENTRY(c_backtrace)
                adrne   r0, .Lcr
                blne    printk
                mov     r0, stack
-               LOADREGS(fd, sp!, {instr, reg, stack, r7, pc})
+               LOADREGS(fd, sp!, {instr, reg, stack, r7, r8, pc})
 
 .Lfp:          .asciz  " r%d = %08X%c"
 .Lcr:          .asciz  "\n"
index ec9a1cd6176fddb9c97fbb79992ac6699d6ad07f..58eef66076293a923d00a81e03370bcc1c734f83 100644 (file)
@@ -189,12 +189,12 @@ ENTRY(__do_div64)
        moveq   pc, lr
 
        @ Division by 0:
-       str     lr, [sp, #-4]!
+       str     lr, [sp, #-8]!
        bl      __div0
 
        @ as wrong as it could be...
        mov     yl, #0
        mov     yh, #0
        mov     xh, #0
-       ldr     pc, [sp], #4
+       ldr     pc, [sp], #8
 
index 9be01b0c3f4876f19a0a23c8b093321598658978..e24566b88a783744059639191d35af51db83aba4 100644 (file)
@@ -111,21 +111,21 @@ static void __init ts72xx_map_io(void)
        }
 }
 
-static unsigned char ts72xx_rtc_readb(unsigned long addr)
+static unsigned char ts72xx_rtc_readbyte(unsigned long addr)
 {
        __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE);
        return __raw_readb(TS72XX_RTC_DATA_VIRT_BASE);
 }
 
-static void ts72xx_rtc_writeb(unsigned char value, unsigned long addr)
+static void ts72xx_rtc_writebyte(unsigned char value, unsigned long addr)
 {
        __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE);
        __raw_writeb(value, TS72XX_RTC_DATA_VIRT_BASE);
 }
 
 static struct m48t86_ops ts72xx_rtc_ops = {
-       .readb                  = ts72xx_rtc_readb,
-       .writeb                 = ts72xx_rtc_writeb,
+       .readbyte               = ts72xx_rtc_readbyte,
+       .writebyte              = ts72xx_rtc_writebyte,
 };
 
 static struct platform_device ts72xx_rtc_device = {
index eeb8a6d4a3999c1f9f605588ab0852e0b4b88621..a5de5f1da9f2e65dd0c83e99556eeed7f40807aa 100644 (file)
@@ -127,7 +127,7 @@ static void
 imx_gpio_ack_irq(unsigned int irq)
 {
        DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, irq);
-       ISR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32);
+       ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32);
 }
 
 static void
index a0724f2b24cec783a242887971b5fc0d2e5a6592..9f55f5ae1044ffcd4e4a3080e581525646e8d639 100644 (file)
@@ -232,8 +232,6 @@ static void __init intcp_init_irq(void)
        for (i = IRQ_PIC_START; i <= IRQ_PIC_END; i++) {
                if (i == 11)
                        i = 22;
-               if (i == IRQ_CP_CPPLDINT)
-                       i++;
                if (i == 29)
                        break;
                set_irq_chip(i, &pic_chip);
@@ -259,8 +257,7 @@ static void __init intcp_init_irq(void)
                set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
        }
 
-       set_irq_handler(IRQ_CP_CPPLDINT, sic_handle_irq);
-       pic_unmask_irq(IRQ_CP_CPPLDINT);
+       set_irq_chained_handler(IRQ_CP_CPPLDINT, sic_handle_irq);
 }
 
 /*
index 092ee12ced425dcfaaff125a4f8f4cc3324c85c3..affd1d5d744049c44c19d8214d74478317ccc672 100644 (file)
@@ -178,8 +178,12 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
 
 static void ixp23xx_irq_mask(unsigned int irq)
 {
-       volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
+       volatile unsigned long *intr_reg;
 
+       if (irq >= 56)
+               irq += 8;
+
+       intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
        *intr_reg &= ~(1 << (irq % 32));
 }
 
@@ -199,17 +203,25 @@ static void ixp23xx_irq_ack(unsigned int irq)
  */
 static void ixp23xx_irq_level_unmask(unsigned int irq)
 {
-       volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
+       volatile unsigned long *intr_reg;
 
        ixp23xx_irq_ack(irq);
 
+       if (irq >= 56)
+               irq += 8;
+
+       intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
        *intr_reg |= (1 << (irq % 32));
 }
 
 static void ixp23xx_irq_edge_unmask(unsigned int irq)
 {
-       volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
+       volatile unsigned long *intr_reg;
+
+       if (irq >= 56)
+               irq += 8;
 
+       intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
        *intr_reg |= (1 << (irq % 32));
 }
 
index 2a39f9e481ad2d455ae6f00b13f26042755f37d8..3b23f43cb1609f0ffaf38d07cb63f6c207532f56 100644 (file)
@@ -141,7 +141,7 @@ config IXP4XX_INDIRECT_PCI
           2) If > 64MB of memory space is required, the IXP4xx can be 
             configured to use indirect registers to access PCI This allows 
             for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. 
-            The disadvantadge of this is that every PCI access requires 
+            The disadvantage of this is that every PCI access requires 
             three local register accesses plus a spinlock, but in some 
             cases the performance hit is acceptable. In addition, you cannot 
             mmap() PCI devices in this case due to the indirect nature
index 98356f810007fad31d4fdc2cc39bea2e9b1b5c68..b307f11951dfa9d7d14e8b206c4d2abe02f60fea 100644 (file)
@@ -95,7 +95,10 @@ static void __init mainstone_init_irq(void)
        for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) {
                set_irq_chip(irq, &mainstone_irq_chip);
                set_irq_handler(irq, do_level_IRQ);
-               set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+               if (irq == MAINSTONE_IRQ(10) || irq == MAINSTONE_IRQ(14))
+                       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE | IRQF_NOAUTOEN);
+               else
+                       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
        set_irq_flags(MAINSTONE_IRQ(8), 0);
        set_irq_flags(MAINSTONE_IRQ(12), 0);
@@ -490,6 +493,7 @@ static void __init mainstone_map_io(void)
 MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
        /* Maintainer: MontaVista Software Inc. */
        .phys_io        = 0x40000000,
+       .boot_params    = 0xa0000100,   /* BLOB boot parameter setting */
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .map_io         = mainstone_map_io,
        .init_irq       = mainstone_init_irq,
index 19b372df544a094a086c05cc3e438c9fb7a606b6..44bcb8097c7ada753a985170a4e2e3a44df2be9c 100644 (file)
@@ -371,6 +371,7 @@ static int spitz_ohci_init(struct device *dev)
 static struct pxaohci_platform_data spitz_ohci_platform_data = {
        .port_mode      = PMM_NPS_MODE,
        .init           = spitz_ohci_init,
+       .power_budget   = 150,
 };
 
 
index d4a586e38d5b2665c797b9558ff24abdc8937a54..693fb1e396e033e95ecd6afdce8552dec4ef4591 100644 (file)
@@ -137,8 +137,11 @@ static struct amba_device *amba_devs[] __initdata = {
 static void __init gic_init_irq(void)
 {
 #ifdef CONFIG_REALVIEW_MPCORE
+       unsigned int pldctrl;
        writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
-       writel(0x008003c0, __io_address(REALVIEW_SYS_BASE) + 0xd8);
+       pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + 0xd8);
+       pldctrl |= 0x00800000;  /* New irq mode */
+       writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + 0xd8);
        writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
 #endif
        gic_dist_init(__io_address(REALVIEW_GIC_DIST_BASE));
index ce7d81000695e38718c15a0567e00bdffcdc54df..970f98dadffc19bd4e483b0ac4ddd136b49a2da7 100644 (file)
@@ -170,7 +170,7 @@ config S3C2410_PM_DEBUG
        depends on ARCH_S3C2410 && PM
        help
          Say Y here if you want verbose debugging from the PM Suspend and
-         Resume code. See `Documentation/arm/Samsing-S3C24XX/Suspend.txt`
+         Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
          for more information.
 
 config S3C2410_PM_CHECK
index 832fb86a03b430343dd26e9e5be83168ab644c17..73de2eaca22a1c136db339177eb95d1acc4a7610 100644 (file)
@@ -59,8 +59,7 @@ ENTRY(s3c2410_cpu_suspend)
        mrc     p15, 0, r5, c13, c0, 0  @ PID
        mrc     p15, 0, r6, c3, c0, 0   @ Domain ID
        mrc     p15, 0, r7, c2, c0, 0   @ translation table base address
-       mrc     p15, 0, r8, c2, c0, 0   @ auxiliary control register
-       mrc     p15, 0, r9, c1, c0, 0   @ control register
+       mrc     p15, 0, r8, c1, c0, 0   @ control register
 
        stmia   r0, { r4 - r13 }
 
@@ -165,7 +164,6 @@ ENTRY(s3c2410_cpu_resume)
        mcr     p15, 0, r5, c13, c0, 0          @ PID
        mcr     p15, 0, r6, c3, c0, 0           @ Domain ID
        mcr     p15, 0, r7, c2, c0, 0           @ translation table base
-       mcr     p15, 0, r8, c1, c1, 0           @ auxilliary control
 
 #ifdef CONFIG_DEBUG_RESUME
        mov     r3, #'R'
@@ -173,7 +171,7 @@ ENTRY(s3c2410_cpu_resume)
 #endif
 
        ldr     r2, =resume_with_mmu
-       mcr     p15, 0, r9, c1, c0, 0           @ turn on MMU, etc
+       mcr     p15, 0, r8, c1, c0, 0           @ turn on MMU, etc
        nop                                     @ second-to-last before mmu
        mov     pc, r2                          @ go back to virtual address
 
index 9e02bc3712a00b5046245e71a13c1c99101bbcbc..af6d2775cf8237e34aecd21f8039083acbabc5db 100644 (file)
@@ -59,6 +59,14 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
                if (irr & (IRR_ETHERNET | IRR_USAR)) {
                        desc->chip->mask(irq);
 
+                       /*
+                        * Ack the interrupt now to prevent re-entering
+                        * this neponset handler.  Again, this is safe
+                        * since we'll check the IRR register prior to
+                        * leaving.
+                        */
+                       desc->chip->ack(irq);
+
                        if (irr & IRR_ETHERNET) {
                                d = irq_desc + IRQ_NEPONSET_SMC9196;
                                desc_handle_irq(IRQ_NEPONSET_SMC9196, d, regs);
index 799697d32decb052f60cb50190541194f65bb92e..cebd48a3dae4b757f7a44c95030e6dafe2945a95 100644 (file)
@@ -112,10 +112,9 @@ void __init versatile_init_irq(void)
 {
        unsigned int i;
 
-       vic_init(VA_VIC_BASE, IRQ_VIC_START, ~(1 << 31));
+       vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0);
 
-       set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq);
-       enable_irq(IRQ_VICSOURCE31);
+       set_irq_chained_handler(IRQ_VICSOURCE31, sic_handle_irq);
 
        /* Do second interrupt controller */
        writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
index 25e0ca3e598cfc97ac0140aaa383effaf5e76b77..c1f7180c7beda07ff35d3211880902b8a83c2a2c 100644 (file)
@@ -141,7 +141,7 @@ __ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
                return NULL;
        addr = (unsigned long)area->addr;
        if (remap_area_pages(addr, pfn, size, flags)) {
-               vfree((void *)addr);
+               vunmap((void *)addr);
                return NULL;
        }
        return (void __iomem *) (offset + (char *)addr);
@@ -173,7 +173,7 @@ EXPORT_SYMBOL(__ioremap);
 
 void __iounmap(void __iomem *addr)
 {
-       vfree((void *) (PAGE_MASK & (unsigned long) addr));
+       vunmap((void *)(PAGE_MASK & (unsigned long)addr));
 }
 EXPORT_SYMBOL(__iounmap);
 
index f14b2d0f3690a002cf396bfa521c57eae068a242..95273de4f772515780e2eac97ed2ae892ac52a0d 100644 (file)
@@ -376,7 +376,7 @@ void __init build_mem_type_table(void)
                ecc_mask = 0;
        }
 
-       if (cpu_arch <= CPU_ARCH_ARMv5TEJ) {
+       if (cpu_arch <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale()) {
                for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
                        if (mem_types[i].prot_l1)
                                mem_types[i].prot_l1 |= PMD_BIT4;
@@ -631,7 +631,7 @@ void setup_mm_for_reboot(char mode)
                pgd = init_mm.pgd;
 
        base_pmdval = PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT;
-       if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ)
+       if (cpu_architecture() <= CPU_ARCH_ARMv5TEJ && !cpu_is_xscale())
                base_pmdval |= PMD_BIT4;
 
        for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++, pgd++) {
index 80873b36c3f7a562657a32d9de47e790972cb2d9..8d32e21fe151a919630dc866205974888b624e3a 100644 (file)
@@ -427,12 +427,13 @@ __xsc3_setup:
 #endif
        mcr     p15, 0, r0, c1, c0, 1           @ set auxiliary control reg
        mrc     p15, 0, r0, c1, c0, 0           @ get control register
-       bic     r0, r0, #0x0200                 @ .... ..R. .... ....
        bic     r0, r0, #0x0002                 @ .... .... .... ..A.
        orr     r0, r0, #0x0005                 @ .... .... .... .C.M
 #if BTB_ENABLE
+       bic     r0, r0, #0x0200                 @ .... ..R. .... ....
        orr     r0, r0, #0x3900                 @ ..VI Z..S .... ....
 #else
+       bic     r0, r0, #0x0a00                 @ .... Z.R. .... ....
        orr     r0, r0, #0x3100                 @ ..VI ...S .... ....
 #endif
 #if L2_CACHE_ENABLE
index c6fe99e57a0526ae2884eb49d500023ca3ef6ea0..8dfa3054f10fb0ce83576277f080caccf7644535 100644 (file)
@@ -758,10 +758,10 @@ config HOTPLUG_CPU
        bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
        depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
        ---help---
-         Say Y here to experiment with turning CPUs off and on.  CPUs
-         can be controlled through /sys/devices/system/cpu.
+         Say Y here to experiment with turning CPUs off and on, and to
+         enable suspend on SMP systems. CPUs can be controlled through
+         /sys/devices/system/cpu.
 
-         Say N.
 
 endmenu
 
index 40e5aba3ad3d425f1545ff7e199e1356a56e38d8..5ccbf58ec94feb7ad7e2a7955fe536e398bbc081 100644 (file)
@@ -215,7 +215,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
        struct acpi_table_madt *madt = NULL;
 
-       if (!phys_addr || !size)
+       if (!phys_addr || !size || !cpu_has_apic)
                return -EINVAL;
 
        madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
@@ -621,9 +621,9 @@ extern u32 pmtmr_ioport;
 
 static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
 {
-       struct fadt_descriptor_rev2 *fadt = NULL;
+       struct fadt_descriptor *fadt = NULL;
 
-       fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
+       fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
        if (!fadt) {
                printk(KERN_WARNING PREFIX "Unable to map FADT\n");
                return 0;
@@ -754,7 +754,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
                return -ENODEV;
        }
 
-       if (!cpu_has_apic)
+       if (!cpu_has_apic) 
                return -ENODEV;
 
        /*
index 2e3b643a4dc4df57552562015349c7657ca5b5d6..1649a175a206ab4bd6ed0add0040580ff83d036e 100644 (file)
@@ -5,17 +5,34 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
+#include <linux/acpi.h>
+
 #include <asm/pci-direct.h>
 #include <asm/acpi.h>
 #include <asm/apic.h>
 
+#ifdef CONFIG_ACPI
+
+static int nvidia_hpet_detected __initdata;
+
+static int __init nvidia_hpet_check(unsigned long phys, unsigned long size)
+{
+       nvidia_hpet_detected = 1;
+       return 0;
+}
+#endif
+
 static int __init check_bridge(int vendor, int device)
 {
 #ifdef CONFIG_ACPI
-       /* According to Nvidia all timer overrides are bogus. Just ignore
-          them all. */
+       /* According to Nvidia all timer overrides are bogus unless HPET
+          is enabled. */
        if (vendor == PCI_VENDOR_ID_NVIDIA) {
-               acpi_skip_timer_override = 1;
+               nvidia_hpet_detected = 0;
+               acpi_table_parse(ACPI_HPET, nvidia_hpet_check);
+               if (nvidia_hpet_detected == 0) {
+                       acpi_skip_timer_override = 1;
+               }
        }
 #endif
        if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
index 013b85df18c658a87e408fd137fb7b30e32c9c26..3d4b2f3d116a796ffad8ef911353b6a71a2f43b7 100644 (file)
@@ -1341,6 +1341,14 @@ int __init APIC_init_uniprocessor (void)
 
        connect_bsp_APIC();
 
+       /*
+        * Hack: In case of kdump, after a crash, kernel might be booting
+        * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
+        * might be zero if read from MP tables. Get it from LAPIC.
+        */
+#ifdef CONFIG_CRASH_DUMP
+       boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
+#endif
        phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
 
        setup_local_APIC();
index d77e89ac0d540361c06da2854d8450fb4c81044e..dd6b0e3386ce8f3af2c65d74853d0b001ae07440 100644 (file)
@@ -1320,6 +1320,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
        probe_roms();
        for (i = 0; i < e820.nr_map; i++) {
                struct resource *res;
+               if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
+                       continue;
                res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
                switch (e820.map[i].type) {
                case E820_RAM:  res->name = "System RAM"; break;
@@ -1545,15 +1547,18 @@ void __init setup_arch(char **cmdline_p)
        if (efi_enabled)
                efi_map_memmap();
 
-#ifdef CONFIG_X86_IO_APIC
-       check_acpi_pci();       /* Checks more than just ACPI actually */
-#endif
-
 #ifdef CONFIG_ACPI
        /*
         * Parse the ACPI tables for possible boot-time SMP configuration.
         */
        acpi_boot_table_init();
+#endif
+
+#ifdef CONFIG_X86_IO_APIC
+       check_acpi_pci();       /* Checks more than just ACPI actually */
+#endif
+
+#ifdef CONFIG_ACPI
        acpi_boot_init();
 
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
index f48bef15b4f0dd5de72d4bbcc39f8c4f881947b6..af56987f69b02503c82cdc2a48660f56db02153a 100644 (file)
@@ -315,3 +315,4 @@ ENTRY(sys_call_table)
        .long sys_splice
        .long sys_sync_file_range
        .long sys_tee                   /* 315 */
+       .long sys_vmsplice
index 2d22f5761b1dc51ac6bee90789e1e867ad62e779..0e498369f35e916e547485db5f8fed45e3d80055 100644 (file)
@@ -130,9 +130,8 @@ static inline int print_addr_and_symbol(unsigned long addr, char *log_lvl,
        print_symbol("%s", addr);
 
        printed = (printed + 1) % CONFIG_STACK_BACKTRACE_COLS;
-
        if (printed)
-               printk("  ");
+               printk(" ");
        else
                printk("\n");
 
@@ -212,7 +211,6 @@ static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp,
        }
 
        stack = esp;
-       printk(log_lvl);
        for(i = 0; i < kstack_depth_to_print; i++) {
                if (kstack_end(stack))
                        break;
index cea5b3ce4b5766c9747294090542e4eb063b75eb..d55fa7b187ab656f9c581b11c5dfc12f7186f82e 100644 (file)
@@ -93,9 +93,11 @@ int __init mps_oem_check(struct mp_config_table *mpc, char *oem, char *productid
        int i;
        for (i = 0; apic_probe[i]; ++i) { 
                if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) { 
-                       genapic = apic_probe[i];
-                       printk(KERN_INFO "Switched to APIC driver `%s'.\n", 
-                              genapic->name);
+                       if (!cmdline_apic) {
+                               genapic = apic_probe[i];
+                               printk(KERN_INFO "Switched to APIC driver `%s'.\n",
+                                      genapic->name);
+                       }
                        return 1;
                } 
        } 
@@ -107,9 +109,11 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
        int i;
        for (i = 0; apic_probe[i]; ++i) { 
                if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { 
-                       genapic = apic_probe[i];
-                       printk(KERN_INFO "Switched to APIC driver `%s'.\n", 
-                              genapic->name);
+                       if (!cmdline_apic) {
+                               genapic = apic_probe[i];
+                               printk(KERN_INFO "Switched to APIC driver `%s'.\n",
+                                      genapic->name);
+                       }
                        return 1;
                } 
        } 
index ae6534ad816113d40b05cc514e2626adf26a5de6..3df1371d4520bb39a8346f6a26326dbce9f589ec 100644 (file)
@@ -651,7 +651,7 @@ void __init mem_init(void)
  * Specifically, in the case of x86, we will always add
  * memory to the highmem for now.
  */
-#ifdef CONFIG_HOTPLUG_MEMORY
+#ifdef CONFIG_MEMORY_HOTPLUG
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 int add_memory(u64 start, u64 size)
 {
index 1a2076ce6f6a7107346a46ce29cfb8a956d2aed9..ec0fd3cfa774aa575fe6c3cf42da2af2c0e56f96 100644 (file)
@@ -332,10 +332,11 @@ static int __init ppro_init(char ** cpu_type)
 {
        __u8 cpu_model = boot_cpu_data.x86_model;
 
-       if (cpu_model > 0xd)
+       if (cpu_model == 14)
+               *cpu_type = "i386/core";
+       else if (cpu_model > 0xd)
                return 0;
-
-       if (cpu_model == 9) {
+       else if (cpu_model == 9) {
                *cpu_type = "i386/p6_mobile";
        } else if (cpu_model > 5) {
                *cpu_type = "i386/piii";
index 50a0bef8c85f691bc135167e595dc5b6521a8ec0..79b2370c7facda90db18255983dc85b58523dab0 100644 (file)
@@ -92,7 +92,7 @@ void __restore_processor_state(struct saved_context *ctxt)
        write_cr4(ctxt->cr4);
        write_cr3(ctxt->cr3);
        write_cr2(ctxt->cr2);
-       write_cr2(ctxt->cr0);
+       write_cr0(ctxt->cr0);
 
        /*
         * now restore the descriptor tables to their proper values
index 0f3076a820c3af7dd7c71790be13e212354b3e1a..f0252eda12a8e08f0c6682e89ff796238e8f7739 100644 (file)
@@ -77,6 +77,7 @@ choice
 config IA64_GENERIC
        bool "generic"
        select ACPI
+       select PCI
        select NUMA
        select ACPI_NUMA
        help
index f6a8853cd1b48fb8df9bbdab6beeca4ed886cc4a..9ea35398e10d0b9a28d43152d274a3b40dd05258 100644 (file)
@@ -134,7 +134,7 @@ CONFIG_ARCH_FLATMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
 CONFIG_NUMA=y
-CONFIG_NODES_SHIFT=8
+CONFIG_NODES_SHIFT=10
 CONFIG_VIRTUAL_MEM_MAP=y
 CONFIG_HOLES_IN_ZONE=y
 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
@@ -1159,7 +1159,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 CONFIG_DEBUG_PREEMPT=y
-CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_MUTEXES is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_KOBJECT is not set
index bdccd0b1eb601387a527aeff1b8f800cf6657a42..dd4a2f79263290b47a5491002a3eb0107aca921f 100644 (file)
@@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *device)
                if (!iovp_shift)
                        iovp_shift = min(PAGE_SHIFT, 16);
        }
-       ACPI_MEM_FREE(dev_info);
+       kfree(dev_info);
 
        /*
         * default anything not caught above or specified on cmdline to 4k
index 7956eb9058fcb873a65b5889d66f6eb6208e4c76..d58c1c5c903a9cfdae0981411ae53604fce020f1 100644 (file)
@@ -416,7 +416,7 @@ iosapic_end_level_irq (unsigned int irq)
        ia64_vector vec = irq_to_vector(irq);
        struct iosapic_rte_info *rte;
 
-       move_irq(irq);
+       move_native_irq(irq);
        list_for_each_entry(rte, &iosapic_intr_info[vec].rtes, rte_list)
                iosapic_eoi(rte->addr, vec);
 }
@@ -458,7 +458,7 @@ iosapic_ack_edge_irq (unsigned int irq)
 {
        irq_desc_t *idesc = irq_descp(irq);
 
-       move_irq(irq);
+       move_native_irq(irq);
        /*
         * Once we have recorded IRQ_PENDING already, we can mask the
         * interrupt for real. This prevents IRQ storms from unhandled
index 5ce908ef9c9585f5f0350503fa39caf0e3e732bf..9c72ea3f6432d115ca32090d0c8bd9c8365d5c07 100644 (file)
@@ -101,7 +101,6 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
 
        if (irq < NR_IRQS) {
                irq_affinity[irq] = mask;
-               set_irq_info(irq, mask);
                irq_redir[irq] = (char) (redir & 0xff);
        }
 }
index ee5fbb02b28f4f56caa06531d424b8136b0e6748..e8ff09fe73d9dc0f9163f3fcec821521a08ca9c1 100644 (file)
@@ -13,7 +13,7 @@ choice
        default SGI_IP22
 
 config MIPS_MTX1
-       bool "Support for 4G Systems MTX-1 board"
+       bool "4G Systems MTX-1 board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select SOC_AU1500
@@ -120,7 +120,7 @@ config MIPS_MIRAGE
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config MIPS_COBALT
-       bool "Support for Cobalt Server"
+       bool "Cobalt Server"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select I8259
@@ -132,7 +132,7 @@ config MIPS_COBALT
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config MACH_DECSTATION
-       bool "Support for DECstations"
+       bool "DECstations"
        select BOOT_ELF32
        select DMA_NONCOHERENT
        select EARLY_PRINTK
@@ -158,7 +158,7 @@ config MACH_DECSTATION
          otherwise choose R3000.
 
 config MIPS_EV64120
-       bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)"
+       bool "Galileo EV64120 Evaluation board (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        select DMA_NONCOHERENT
        select HW_HAS_PCI
@@ -175,7 +175,7 @@ config MIPS_EV64120
          kernel for this platform.
 
 config MIPS_EV96100
-       bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)"
+       bool "Galileo EV96100 Evaluation board (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        select DMA_NONCOHERENT
        select HW_HAS_PCI
@@ -195,7 +195,7 @@ config MIPS_EV96100
          here if you wish to build a kernel for this platform.
 
 config MIPS_IVR
-       bool "Support for Globespan IVR board"
+       bool "Globespan IVR board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select ITE_BOARD_GEN
@@ -211,7 +211,7 @@ config MIPS_IVR
          build a kernel for this platform.
 
 config MIPS_ITE8172
-       bool "Support for ITE 8172G board"
+       bool "ITE 8172G board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select ITE_BOARD_GEN
@@ -228,7 +228,7 @@ config MIPS_ITE8172
          a kernel for this platform.
 
 config MACH_JAZZ
-       bool "Support for the Jazz family of machines"
+       bool "Jazz family of machines"
        select ARC
        select ARC32
        select ARCH_MAY_HAVE_PC_FDC
@@ -246,7 +246,7 @@ config MACH_JAZZ
         Olivetti M700-10 workstations.
 
 config LASAT
-       bool "Support for LASAT Networks platforms"
+       bool "LASAT Networks platforms"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select MIPS_GT64120
@@ -258,7 +258,7 @@ config LASAT
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config MIPS_ATLAS
-       bool "Support for MIPS Atlas board"
+       bool "MIPS Atlas board"
        select BOOT_ELF32
        select DMA_NONCOHERENT
        select IRQ_CPU
@@ -283,7 +283,7 @@ config MIPS_ATLAS
          board.
 
 config MIPS_MALTA
-       bool "Support for MIPS Malta board"
+       bool "MIPS Malta board"
        select ARCH_MAY_HAVE_PC_FDC
        select BOOT_ELF32
        select HAVE_STD_PC_SERIAL_PORT
@@ -311,7 +311,7 @@ config MIPS_MALTA
          board.
 
 config MIPS_SEAD
-       bool "Support for MIPS SEAD board (EXPERIMENTAL)"
+       bool "MIPS SEAD board (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        select IRQ_CPU
        select DMA_NONCOHERENT
@@ -328,7 +328,7 @@ config MIPS_SEAD
          board.
 
 config MIPS_SIM
-       bool 'Support for MIPS simulator (MIPSsim)'
+       bool 'MIPS simulator (MIPSsim)'
        select DMA_NONCOHERENT
        select IRQ_CPU
        select SYS_HAS_CPU_MIPS32_R1
@@ -341,7 +341,7 @@ config MIPS_SIM
          emulator.
 
 config MOMENCO_JAGUAR_ATX
-       bool "Support for Momentum Jaguar board"
+       bool "Momentum Jaguar board"
        select BOOT_ELF32
        select DMA_NONCOHERENT
        select HW_HAS_PCI
@@ -361,7 +361,7 @@ config MOMENCO_JAGUAR_ATX
          Momentum Computer <http://www.momenco.com/>.
 
 config MOMENCO_OCELOT
-       bool "Support for Momentum Ocelot board"
+       bool "Momentum Ocelot board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select IRQ_CPU
@@ -378,7 +378,7 @@ config MOMENCO_OCELOT
          Momentum Computer <http://www.momenco.com/>.
 
 config MOMENCO_OCELOT_3
-       bool "Support for Momentum Ocelot-3 board"
+       bool "Momentum Ocelot-3 board"
        select BOOT_ELF32
        select DMA_NONCOHERENT
        select HW_HAS_PCI
@@ -397,7 +397,7 @@ config MOMENCO_OCELOT_3
          PMC-Sierra Rm79000 core.
 
 config MOMENCO_OCELOT_C
-       bool "Support for Momentum Ocelot-C board"
+       bool "Momentum Ocelot-C board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select IRQ_CPU
@@ -414,7 +414,7 @@ config MOMENCO_OCELOT_C
          Momentum Computer <http://www.momenco.com/>.
 
 config MOMENCO_OCELOT_G
-       bool "Support for Momentum Ocelot-G board"
+       bool "Momentum Ocelot-G board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select IRQ_CPU
@@ -431,23 +431,23 @@ config MOMENCO_OCELOT_G
          Momentum Computer <http://www.momenco.com/>.
 
 config MIPS_XXS1500
-       bool "Support for MyCable XXS1500 board"
+       bool "MyCable XXS1500 board"
        select DMA_NONCOHERENT
        select SOC_AU1500
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config PNX8550_V2PCI
-       bool "Support for Philips PNX8550 based Viper2-PCI board"
+       bool "Philips PNX8550 based Viper2-PCI board"
        select PNX8550
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config PNX8550_JBS
-       bool "Support for Philips PNX8550 based JBS board"
+       bool "Philips PNX8550 based JBS board"
        select PNX8550
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config DDB5074
-       bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)"
+       bool "NEC DDB Vrc-5074 (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        select DDB5XXX_COMMON
        select DMA_NONCOHERENT
@@ -465,7 +465,7 @@ config DDB5074
          evaluation board.
 
 config DDB5476
-       bool "Support for NEC DDB Vrc-5476"
+       bool "NEC DDB Vrc-5476"
        select DDB5XXX_COMMON
        select DMA_NONCOHERENT
        select HAVE_STD_PC_SERIAL_PORT
@@ -486,7 +486,7 @@ config DDB5476
          IDE controller, PS2 keyboard, PS2 mouse, etc.
 
 config DDB5477
-       bool "Support for NEC DDB Vrc-5477"
+       bool "NEC DDB Vrc-5477"
        select DDB5XXX_COMMON
        select DMA_NONCOHERENT
        select HW_HAS_PCI
@@ -504,13 +504,13 @@ config DDB5477
          ether port USB, AC97, PCI, etc.
 
 config MACH_VR41XX
-       bool "Support for NEC VR4100 series based machines"
+       bool "NEC VR41XX-based machines"
        select SYS_HAS_CPU_VR41XX
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
 
 config PMC_YOSEMITE
-       bool "Support for PMC-Sierra Yosemite eval board"
+       bool "PMC-Sierra Yosemite eval board"
        select DMA_COHERENT
        select HW_HAS_PCI
        select IRQ_CPU
@@ -527,7 +527,7 @@ config PMC_YOSEMITE
          manufactured by PMC-Sierra.
 
 config QEMU
-       bool "Support for Qemu"
+       bool "Qemu"
        select DMA_COHERENT
        select GENERIC_ISA_DMA
        select HAVE_STD_PC_SERIAL_PORT
@@ -547,7 +547,7 @@ config QEMU
          can be found at http://www.linux-mips.org/wiki/Qemu.
 
 config SGI_IP22
-       bool "Support for SGI IP22 (Indy/Indigo2)"
+       bool "SGI IP22 (Indy/Indigo2)"
        select ARC
        select ARC32
        select BOOT_ELF32
@@ -567,7 +567,7 @@ config SGI_IP22
          that runs on these, say Y here.
 
 config SGI_IP27
-       bool "Support for SGI IP27 (Origin200/2000)"
+       bool "SGI IP27 (Origin200/2000)"
        select ARC
        select ARC64
        select BOOT_ELF64
@@ -583,7 +583,7 @@ config SGI_IP27
          here.
 
 config SGI_IP32
-       bool "Support for SGI IP32 (O2) (EXPERIMENTAL)"
+       bool "SGI IP32 (O2) (EXPERIMENTAL)"
        depends on EXPERIMENTAL
        select ARC
        select ARC32
@@ -604,7 +604,7 @@ config SGI_IP32
          If you want this kernel to run on SGI O2 workstation, say Y here.
 
 config SIBYTE_BIGSUR
-       bool "Support for Sibyte BCM91480B-BigSur"
+       bool "Sibyte BCM91480B-BigSur"
        select BOOT_ELF32
        select DMA_COHERENT
        select PCI_DOMAINS
@@ -615,7 +615,7 @@ config SIBYTE_BIGSUR
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_SWARM
-       bool "Support for Sibyte BCM91250A-SWARM"
+       bool "Sibyte BCM91250A-SWARM"
        select BOOT_ELF32
        select DMA_COHERENT
        select SIBYTE_SB1250
@@ -626,7 +626,7 @@ config SIBYTE_SWARM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_SENTOSA
-       bool "Support for Sibyte BCM91250E-Sentosa"
+       bool "Sibyte BCM91250E-Sentosa"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -637,7 +637,7 @@ config SIBYTE_SENTOSA
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_RHONE
-       bool "Support for Sibyte BCM91125E-Rhone"
+       bool "Sibyte BCM91125E-Rhone"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -648,7 +648,7 @@ config SIBYTE_RHONE
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_CARMEL
-       bool "Support for Sibyte BCM91120x-Carmel"
+       bool "Sibyte BCM91120x-Carmel"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -659,7 +659,7 @@ config SIBYTE_CARMEL
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_PTSWARM
-       bool "Support for Sibyte BCM91250PT-PTSWARM"
+       bool "Sibyte BCM91250PT-PTSWARM"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -671,7 +671,7 @@ config SIBYTE_PTSWARM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_LITTLESUR
-       bool "Support for Sibyte BCM91250C2-LittleSur"
+       bool "Sibyte BCM91250C2-LittleSur"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -683,7 +683,7 @@ config SIBYTE_LITTLESUR
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_CRHINE
-       bool "Support for Sibyte BCM91120C-CRhine"
+       bool "Sibyte BCM91120C-CRhine"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -694,7 +694,7 @@ config SIBYTE_CRHINE
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_CRHONE
-       bool "Support for Sibyte BCM91125C-CRhone"
+       bool "Sibyte BCM91125C-CRhone"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -706,7 +706,7 @@ config SIBYTE_CRHONE
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SNI_RM200_PCI
-       bool "Support for SNI RM200 PCI"
+       bool "SNI RM200 PCI"
        select ARC
        select ARC32
        select ARCH_MAY_HAVE_PC_FDC
@@ -732,7 +732,7 @@ config SNI_RM200_PCI
          support this machine type.
 
 config TOSHIBA_JMR3927
-       bool "Support for Toshiba JMR-TX3927 board"
+       bool "Toshiba JMR-TX3927 board"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select MIPS_TX3927
@@ -743,7 +743,7 @@ config TOSHIBA_JMR3927
        select TOSHIBA_BOARDS
 
 config TOSHIBA_RBTX4927
-       bool "Support for Toshiba TBTX49[23]7 board"
+       bool "Toshiba TBTX49[23]7 board"
        select DMA_NONCOHERENT
        select HAS_TXX9_SERIAL
        select HW_HAS_PCI
@@ -760,7 +760,7 @@ config TOSHIBA_RBTX4927
          support this machine type
 
 config TOSHIBA_RBTX4938
-       bool "Support for Toshiba RBTX4938 board"
+       bool "Toshiba RBTX4938 board"
        select HAVE_STD_PC_SERIAL_PORT
        select DMA_NONCOHERENT
        select GENERIC_ISA_DMA
@@ -1411,13 +1411,12 @@ config PAGE_SIZE_8KB
 
 config PAGE_SIZE_16KB
        bool "16kB"
-       depends on EXPERIMENTAL && !CPU_R3000 && !CPU_TX39XX
+       depends on !CPU_R3000 && !CPU_TX39XX
        help
          Using 16kB page size will result in higher performance kernel at
          the price of higher memory consumption.  This option is available on
-         all non-R3000 family processor.  Not that at the time of this
-         writing this option is still high experimental; there are also
-         issues with compatibility of user applications.
+         all non-R3000 family processors.  Note that you will need a suitable
+         Linux distribution to support this.
 
 config PAGE_SIZE_64KB
        bool "64kB"
@@ -1426,8 +1425,7 @@ config PAGE_SIZE_64KB
          Using 64kB page size will result in higher performance kernel at
          the price of higher memory consumption.  This option is available on
          all non-R3000 family processor.  Not that at the time of this
-         writing this option is still high experimental; there are also
-         issues with compatibility of user applications.
+         writing this option is still high experimental.
 
 endchoice
 
index da61de7761549d89c3e5bc08204ebbdfdea5cd2a..afe05ec12c27d31326d73937081eb7e0631d1c33 100644 (file)
@@ -68,6 +68,7 @@
 
 extern void set_debug_traps(void);
 extern irq_cpustat_t irq_stat [NR_CPUS];
+extern void mips_timer_interrupt(struct pt_regs *regs);
 
 static void setup_local_irq(unsigned int irq, int type, int int_req);
 static unsigned int startup_irq(unsigned int irq);
index 9c171afd9a534f121e1e4c0ff5c0c8165e9951e8..ae7d8c57bf3f8d889758f02607a2ad0aec16e4c2 100644 (file)
@@ -1,10 +1,9 @@
 /*
  *
  * BRIEF MODULE DESCRIPTION
- *    PROM library initialisation code, assuming a version of
- *    pmon is the boot code.
+ *    PROM library initialisation code, assuming YAMON is the boot loader.
  *
- * Copyright 2000,2001 MontaVista Software Inc.
+ * Copyright 2000, 2001, 2006 MontaVista Software Inc.
  * Author: MontaVista Software, Inc.
  *             ppopov@mvista.com or source@mvista.com
  *
@@ -49,9 +48,9 @@ extern char **prom_argv, **prom_envp;
 
 typedef struct
 {
-    char *name;
-/*    char *val; */
-}t_env_var;
+       char *name;
+       char *val;
+} t_env_var;
 
 
 char * prom_getcmdline(void)
@@ -85,21 +84,16 @@ char *prom_getenv(char *envname)
 {
        /*
         * Return a pointer to the given environment variable.
-        * Environment variables are stored in the form of "memsize=64".
         */
 
        t_env_var *env = (t_env_var *)prom_envp;
-       int i;
-
-       i = strlen(envname);
 
-       while(env->name) {
-               if(strncmp(envname, env->name, i) == 0) {
-                       return(env->name + strlen(envname) + 1);
-               }
+       while (env->name) {
+               if (strcmp(envname, env->name) == 0)
+                       return env->val;
                env++;
        }
-       return(NULL);
+       return NULL;
 }
 
 inline unsigned char str2hexnum(unsigned char c)
index 44dac3b0df3b2575e705e1a7925928a18a9c7194..683d9da84b6695832193c8c5fe0e2b61496ed1fb 100644 (file)
@@ -112,6 +112,11 @@ sdsleep:
        mtc0    k0, CP0_PAGEMASK
        lw      k0, 0x14(sp)
        mtc0    k0, CP0_CONFIG
+
+       /* We need to catch the ealry Alchemy SOCs with
+        * the write-only Config[OD] bit and set it back to one...
+        */
+       jal     au1x00_fixup_config_od
        lw      $1, PT_R1(sp)
        lw      $2, PT_R2(sp)
        lw      $3, PT_R3(sp)
index f85f1524b36639a1c9c2e9bf0e7ef8673afb4c97..f74d66a58a21a51c8dc2915c8e741fc0b500440a 100644 (file)
@@ -116,6 +116,7 @@ void mips_timer_interrupt(struct pt_regs *regs)
 
 null:
        ack_r4ktimer(0);
+       irq_exit();
 }
 
 #ifdef CONFIG_PM
index 85e9e5013679f83142f602940374226ca0858aaa..f2296a9999534ea2003064a5f468e77a657d4f2a 100644 (file)
@@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
         /* disable interrupts */
         UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-        /* set up buad rate */
+        /* set up baud rate */
         {
                 uint32 divisor;
 
index 1d18d590495b138ac7687d94ecdd1c8b3302cafb..385bbdb10170a058e065b6400615f626f340d98a 100644 (file)
@@ -86,7 +86,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
         /* disable interrupts */
         UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-        /* set up buad rate */
+        /* set up baud rate */
         {
                 uint32 divisor;
 
index 16e34a546e547d0cfe9dc15c1fc04785fb3fc1db..8f0d835491ff46bfce7252479607d3cf4f7a4393 100644 (file)
@@ -149,7 +149,7 @@ void serial_set(int channel, unsigned long baud)
 #else
        /*
         * Note: Set baud rate, hardcoded here for rate of 115200
-        * since became unsure of above "buad rate" algorithm (??).
+        * since became unsure of above "baud rate" algorithm (??).
         */
        outreg(channel, LCR, 0x83);
        outreg(channel, DLM, 0x00);     // See note above
index 8720bccfdea250dd9eddbe580c22b8f4e75fa60e..f0a6a38fcf4d9fae50fc20da3b7c1505ebc451ef 100644 (file)
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
        /* disable interrupts */
        UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-       /* set up buad rate */
+       /* set up baud rate */
        {
                uint32 divisor;
 
index c4f8530fd07e95c129c6c11ae3f7a530c360838e..6a7ccaf9350247d1fea9a44d427151ee2e71b918 100644 (file)
@@ -72,7 +72,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
        /* disable interrupts */
        UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-       /* set up buad rate */
+       /* set up baud rate */
        {
                uint32 divisor;
 
index 92b28b674d6f615be8ab8894ea117e06018f44d1..0facfaf4e9508d7a2d827cfff7e612323d2c9cc5 100644 (file)
@@ -272,8 +272,8 @@ void output_sc_defines(void)
        text("/* Linux sigcontext offsets. */");
        offset("#define SC_REGS       ", struct sigcontext, sc_regs);
        offset("#define SC_FPREGS     ", struct sigcontext, sc_fpregs);
-       offset("#define SC_MDHI       ", struct sigcontext, sc_hi);
-       offset("#define SC_MDLO       ", struct sigcontext, sc_lo);
+       offset("#define SC_MDHI       ", struct sigcontext, sc_mdhi);
+       offset("#define SC_MDLO       ", struct sigcontext, sc_mdlo);
        offset("#define SC_PC         ", struct sigcontext, sc_pc);
        offset("#define SC_FPC_CSR    ", struct sigcontext, sc_fpc_csr);
        linefeed;
index 47a087b6c11ba881d33d2aa2d3aaf2ffce50374a..d268827c62bdd167459e8e43d2467781ff9f879a 100644 (file)
@@ -206,7 +206,7 @@ static inline void check_daddi(void)
                "daddi  %0, %1, %3\n\t"
                ".set   pop"
                : "=r" (v), "=&r" (tmp)
-               : "I" (0xffffffffffffdb9a), "I" (0x1234));
+               : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
        set_except_vector(12, handler);
        local_irq_restore(flags);
 
@@ -224,7 +224,7 @@ static inline void check_daddi(void)
                "dsrl   %1, %1, 1\n\t"
                "daddi  %0, %1, %3"
                : "=r" (v), "=&r" (tmp)
-               : "I" (0xffffffffffffdb9a), "I" (0x1234));
+               : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
        set_except_vector(12, handler);
        local_irq_restore(flags);
 
@@ -280,7 +280,7 @@ static inline void check_daddiu(void)
                "daddu  %1, %2\n\t"
                ".set   pop"
                : "=&r" (v), "=&r" (w), "=&r" (tmp)
-               : "I" (0xffffffffffffdb9a), "I" (0x1234));
+               : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
 
        if (v == w) {
                printk("no.\n");
@@ -296,7 +296,7 @@ static inline void check_daddiu(void)
                "addiu  %1, $0, %4\n\t"
                "daddu  %1, %2"
                : "=&r" (v), "=&r" (w), "=&r" (tmp)
-               : "I" (0xffffffffffffdb9a), "I" (0x1234));
+               : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
 
        if (v == w) {
                printk("yes.\n");
index 58b3b14873cb572a10d9a87e2b57cece1fc061b8..8c2c359a05f413bd089a8eb40cf64781ac8bb89a 100644 (file)
@@ -121,6 +121,7 @@ static inline void check_wait(void)
        case CPU_24K:
        case CPU_25KF:
        case CPU_34K:
+       case CPU_74K:
        case CPU_PR4450:
                cpu_wait = r4k_wait;
                printk(" available.\n");
@@ -432,6 +433,15 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
                             MIPS_CPU_LLSC;
                c->tlbsize = 64;
                break;
+       case PRID_IMP_R14000:
+               c->cputype = CPU_R14000;
+               c->isa_level = MIPS_CPU_ISA_IV;
+               c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
+                            MIPS_CPU_FPU | MIPS_CPU_32FPR |
+                            MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
+                            MIPS_CPU_LLSC;
+               c->tlbsize = 64;
+               break;
        }
 }
 
@@ -593,6 +603,9 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
        case PRID_IMP_34K:
                c->cputype = CPU_34K;
                break;
+       case PRID_IMP_74K:
+               c->cputype = CPU_74K;
+               break;
        }
 }
 
@@ -642,7 +655,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c)
        case PRID_IMP_SB1:
                c->cputype = CPU_SB1;
                /* FPU in pass1 is known to have issues. */
-               if ((c->processor_id & 0xff) < 0x20)
+               if ((c->processor_id & 0xff) < 0x02)
                        c->options &= ~(MIPS_CPU_FPU | MIPS_CPU_32FPR);
                break;
        case PRID_IMP_SB1A:
index d101d2fb24caab6f8283647a20a5c37768f30c05..a9c6de1b954257e8e30e73518009f7cf3d1444ae 100644 (file)
@@ -101,7 +101,7 @@ FEXPORT(restore_all)                        # restore full frame
        EMT
 1:
        mfc0    v1, CP0_TCSTATUS
-       /* We set IXMT above, XOR should cler it here */
+       /* We set IXMT above, XOR should clear it here */
        xori    v1, v1, TCSTATUS_IXMT
        or      v1, v0, v1
        mtc0    v1, CP0_TCSTATUS
index 10f28fb9f008a92fc89b68c89734233297e8472b..5fd7a8af0c6256bc720c7fa232ee14d551be3e63 100644 (file)
                 */
                mfc0    k0, CP0_CAUSE
                andi    k0, k0, 0x7c
-               add     k1, k1, k0
-               PTR_L   k0, saved_vectors(k1)
-               jr      k0
+#ifdef CONFIG_64BIT
+               dsll    k0, k0, 1
+#endif
+               PTR_L   k1, saved_vectors(k0)
+               jr      k1
                nop
 1:
                move    k0, sp
index e54a7f442f8adc271af20fcf7ac310e9fb9e8bb0..d7bf0215bc1d28eb40160366afbdd59b41fea470 100644 (file)
@@ -288,6 +288,9 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
                sym = (Elf_Sym *)sechdrs[symindex].sh_addr
                        + ELF_MIPS_R_SYM(rel[i]);
                if (!sym->st_value) {
+                       /* Ignore unresolved weak symbol */
+                       if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+                               continue;
                        printk(KERN_WARNING "%s: Unknown symbol %s\n",
                               me->name, strtab + sym->st_name);
                        return -ENOENT;
@@ -325,6 +328,9 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
                sym = (Elf_Sym *)sechdrs[symindex].sh_addr
                        + ELF_MIPS_R_SYM(rel[i]);
                if (!sym->st_value) {
+                       /* Ignore unresolved weak symbol */
+                       if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+                               continue;
                        printk(KERN_WARNING "%s: Unknown symbol %s\n",
                               me->name, strtab + sym->st_name);
                        return -ENOENT;
index 84ab959f924ac57d1b05edc73aa48ce84c2da04f..9def554f335b8f430dd0483dcca482b83c083d07 100644 (file)
@@ -42,6 +42,7 @@ static const char *cpu_name[] = {
        [CPU_R8000]     = "R8000",
        [CPU_R10000]    = "R10000",
        [CPU_R12000]    = "R12000",
+       [CPU_R14000]    = "R14000",
        [CPU_R4300]     = "R4300",
        [CPU_R4650]     = "R4650",
        [CPU_R4700]     = "R4700",
@@ -74,6 +75,7 @@ static const char *cpu_name[] = {
        [CPU_24K]       = "MIPS 24K",
        [CPU_25KF]      = "MIPS 25Kf",
        [CPU_34K]       = "MIPS 34K",
+       [CPU_74K]       = "MIPS 74K",
        [CPU_VR4111]    = "NEC VR4111",
        [CPU_VR4121]    = "NEC VR4121",
        [CPU_VR4122]    = "NEC VR4122",
index b53a9207f530a9db07d58c19b556b9d1cc379594..8efb23a841317a03a385f7ccb2c8d9b47b250475 100644 (file)
@@ -209,7 +209,7 @@ sys_call_table:
        PTR     sys_fork
        PTR     sys_read
        PTR     sys_write
-       PTR     sys_open                        /* 4005 */
+       PTR     compat_sys_open                 /* 4005 */
        PTR     sys_close
        PTR     sys_waitpid
        PTR     sys_creat
index bcf1b10e518f8be4b4302e13bb3186d1e1773438..397a70e651b5e9c21dbe7e3347dcc279df728b78 100644 (file)
@@ -246,7 +246,7 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en
 #ifdef CONFIG_64BIT
        /* HACK: Guess if the sign extension was forgotten */
        if (start > 0x0000000080000000 && start < 0x00000000ffffffff)
-               start |= 0xffffffff00000000;
+               start |= 0xffffffff00000000UL;
 #endif
 
        end = start + size;
@@ -355,8 +355,6 @@ static inline void bootmem_init(void)
        }
 #endif
 
-       memory_present(0, first_usable_pfn, max_low_pfn);
-
        /* Initialize the boot-time allocator with low memory only.  */
        bootmap_size = init_bootmem(first_usable_pfn, max_low_pfn);
 
@@ -410,6 +408,7 @@ static inline void bootmem_init(void)
 
                /* Register lowmem ranges */
                free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
+               memory_present(0, curr_pfn, curr_pfn + size - 1);
        }
 
        /* Reserve the bootmap memory.  */
@@ -419,17 +418,20 @@ static inline void bootmem_init(void)
 #ifdef CONFIG_BLK_DEV_INITRD
        initrd_below_start_ok = 1;
        if (initrd_start) {
-               unsigned long initrd_size = ((unsigned char *)initrd_end) - ((unsigned char *)initrd_start);
+               unsigned long initrd_size = ((unsigned char *)initrd_end) -
+                       ((unsigned char *)initrd_start);
+               const int width = sizeof(long) * 2;
+
                printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
                       (void *)initrd_start, initrd_size);
 
                if (CPHYSADDR(initrd_end) > PFN_PHYS(max_low_pfn)) {
                        printk("initrd extends beyond end of memory "
                               "(0x%0*Lx > 0x%0*Lx)\ndisabling initrd\n",
-                              sizeof(long) * 2,
-                              (unsigned long long)CPHYSADDR(initrd_end),
-                              sizeof(long) * 2,
-                              (unsigned long long)PFN_PHYS(max_low_pfn));
+                              width,
+                              (unsigned long long) CPHYSADDR(initrd_end),
+                              width,
+                              (unsigned long long) PFN_PHYS(max_low_pfn));
                        initrd_start = initrd_end = 0;
                        initrd_reserve_bootmem = 0;
                }
index 3ca786215d48c172fe0948c450c359d16e3f3c20..ce6cb915c0a7a703ab6c49a2e269d4de1256db38 100644 (file)
@@ -31,7 +31,6 @@ setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
        save_gp_reg(31);
 #undef save_gp_reg
 
-#ifdef CONFIG_32BIT
        err |= __put_user(regs->hi, &sc->sc_mdhi);
        err |= __put_user(regs->lo, &sc->sc_mdlo);
        if (cpu_has_dsp) {
@@ -43,20 +42,6 @@ setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
                err |= __put_user(mflo3(), &sc->sc_lo3);
                err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
        }
-#endif
-#ifdef CONFIG_64BIT
-       err |= __put_user(regs->hi, &sc->sc_hi[0]);
-       err |= __put_user(regs->lo, &sc->sc_lo[0]);
-       if (cpu_has_dsp) {
-               err |= __put_user(mfhi1(), &sc->sc_hi[1]);
-               err |= __put_user(mflo1(), &sc->sc_lo[1]);
-               err |= __put_user(mfhi2(), &sc->sc_hi[2]);
-               err |= __put_user(mflo2(), &sc->sc_lo[2]);
-               err |= __put_user(mfhi3(), &sc->sc_hi[3]);
-               err |= __put_user(mflo3(), &sc->sc_lo[3]);
-               err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
-       }
-#endif
 
        err |= __put_user(!!used_math(), &sc->sc_used_math);
 
@@ -92,7 +77,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
        current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
        err |= __get_user(regs->cp0_epc, &sc->sc_pc);
-#ifdef CONFIG_32BIT
        err |= __get_user(regs->hi, &sc->sc_mdhi);
        err |= __get_user(regs->lo, &sc->sc_mdlo);
        if (cpu_has_dsp) {
@@ -104,20 +88,6 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
                err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg);
                err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
        }
-#endif
-#ifdef CONFIG_64BIT
-       err |= __get_user(regs->hi, &sc->sc_hi[0]);
-       err |= __get_user(regs->lo, &sc->sc_lo[0]);
-       if (cpu_has_dsp) {
-               err |= __get_user(treg, &sc->sc_hi[1]); mthi1(treg);
-               err |= __get_user(treg, &sc->sc_lo[1]); mthi1(treg);
-               err |= __get_user(treg, &sc->sc_hi[2]); mthi2(treg);
-               err |= __get_user(treg, &sc->sc_lo[2]); mthi2(treg);
-               err |= __get_user(treg, &sc->sc_hi[3]); mthi3(treg);
-               err |= __get_user(treg, &sc->sc_lo[3]); mthi3(treg);
-               err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
-       }
-#endif
 
 #define restore_gp_reg(i) do {                                         \
        err |= __get_user(regs->regs[i], &sc->sc_regs[i]);              \
index d42f358754ad829129663f01350d7c0757f8f078..298f82fe8440a43d1a8140ed8a256d44595ed6d8 100644 (file)
@@ -247,6 +247,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        current_thread_info()->cpu = 0;
        smp_tune_scheduling();
        plat_prepare_cpus(max_cpus);
+#ifndef CONFIG_HOTPLUG_CPU
+       cpu_present_map = cpu_possible_map;
+#endif
 }
 
 /* preload SMP state for boot cpu */
@@ -442,7 +445,7 @@ static int __init topology_init(void)
        int cpu;
        int ret;
 
-       for_each_cpu(cpu) {
+       for_each_present_cpu(cpu) {
                ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL);
                if (ret)
                        printk(KERN_WARNING "topology_init: register_cpu %d "
index 2aeaa2fd4b322a1ebec61d1861eda4aab1ad4e0a..5e8a18a8e2bda49d4ac59388d6df985eeafe4b1d 100644 (file)
@@ -276,31 +276,9 @@ void sys_set_thread_area(unsigned long addr)
 
 asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
 {
-       int     tmp, len;
-       char    __user *name;
+       int     tmp;
 
        switch(cmd) {
-       case SETNAME: {
-               char nodename[__NEW_UTS_LEN + 1];
-
-               if (!capable(CAP_SYS_ADMIN))
-                       return -EPERM;
-
-               name = (char __user *) arg1;
-
-               len = strncpy_from_user(nodename, name, __NEW_UTS_LEN);
-               if (len < 0)
-                       return -EFAULT;
-
-               down_write(&uts_sem);
-               strncpy(system_utsname.nodename, nodename, len);
-               nodename[__NEW_UTS_LEN] = '\0';
-               strlcpy(system_utsname.nodename, nodename,
-                       sizeof(system_utsname.nodename));
-               up_write(&uts_sem);
-               return 0;
-       }
-
        case MIPS_ATOMIC_SET:
                printk(KERN_CRIT "How did I get here?\n");
                return -EINVAL;
@@ -313,9 +291,6 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
        case FLUSH_CACHE:
                __flush_cache_all();
                return 0;
-
-       case MIPS_RDNVRAM:
-               return -EIO;
        }
 
        return -EINVAL;
index 4901f0a37fca2b3ddb2de93dcf998873b10e6643..a7564b08eb4da273c3252d64cd46f8daf00a45d9 100644 (file)
@@ -819,15 +819,30 @@ asmlinkage void do_watch(struct pt_regs *regs)
 
 asmlinkage void do_mcheck(struct pt_regs *regs)
 {
+       const int field = 2 * sizeof(unsigned long);
+       int multi_match = regs->cp0_status & ST0_TS;
+
        show_regs(regs);
-       dump_tlb_all();
+
+       if (multi_match) {
+               printk("Index   : %0x\n", read_c0_index());
+               printk("Pagemask: %0x\n", read_c0_pagemask());
+               printk("EntryHi : %0*lx\n", field, read_c0_entryhi());
+               printk("EntryLo0: %0*lx\n", field, read_c0_entrylo0());
+               printk("EntryLo1: %0*lx\n", field, read_c0_entrylo1());
+               printk("\n");
+               dump_tlb_all();
+       }
+
+       show_code((unsigned int *) regs->cp0_epc);
+
        /*
         * Some chips may have other causes of machine check (e.g. SB1
         * graduation timer)
         */
        panic("Caught Machine Check exception - %scaused by multiple "
              "matching entries in the TLB.",
-             (regs->cp0_status & ST0_TS) ? "" : "not ");
+             (multi_match) ? "" : "not ");
 }
 
 asmlinkage void do_mt(struct pt_regs *regs)
@@ -902,6 +917,7 @@ static inline void parity_protection_init(void)
 {
        switch (current_cpu_data.cputype) {
        case CPU_24K:
+       case CPU_34K:
        case CPU_5KC:
                write_c0_ecc(0x80000000);
                back_to_back_c0_hazard();
index 14fa00e3cdfa6007332e58fbd84fc9eba3c4d1ac..b84d1f9ce28ef169e0fbb633ba184c5341e03e40 100644 (file)
@@ -151,23 +151,13 @@ SECTIONS
 
   /* This is the MIPS specific mdebug section.  */
   .mdebug : { *(.mdebug) }
-  /* These are needed for ELF backends which have not yet been
-     converted to the new style linker.  */
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  /* DWARF debug sections.
-     Symbols in the .debug DWARF section are relative to the beginning of the
-     section so we begin .debug at 0.  It's not clear yet what needs to happen
-     for the others.   */
-  .debug          0 : { *(.debug) }
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  .line           0 : { *(.line) }
+
+  STABS_DEBUG
+
+  DWARF_DEBUG
+
   /* These must appear regardless of  .  */
   .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
   .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-  .comment : { *(.comment) }
   .note : { *(.note) }
 }
index a1962eb460f827f5d9dfc24dd0739159333d9a54..39a71de16f47ed8ccfaadc575f2330a0a3dcbadb 100644 (file)
@@ -29,7 +29,9 @@
 
 ieee754dp ieee754dp_fint(int x)
 {
-       COMPXDP;
+       u64 xm;
+       int xe;
+       int xs;
 
        CLEARCX;
 
index eae90a866aa19e1bb60477f5ef98f828bf68a32c..f08f223e488a3a68a07038124dc045811b20bf98 100644 (file)
@@ -29,7 +29,9 @@
 
 ieee754dp ieee754dp_flong(s64 x)
 {
-       COMPXDP;
+       u64 xm;
+       int xe;
+       int xs;
 
        CLEARCX;
 
index 7aac13afb09a6b2b706507611501da910337949d..e88e125e01c2f394b2dcf4d97730207a11cc0d0d 100644 (file)
@@ -29,7 +29,9 @@
 
 ieee754sp ieee754sp_fint(int x)
 {
-       COMPXSP;
+       unsigned xm;
+       int xe;
+       int xs;
 
        CLEARCX;
 
index 3d6c1d11c17889bfea252f2c78d4711e0f3049e4..26d6919a269af143ad590d58233d5a8bd8b80310 100644 (file)
@@ -29,7 +29,9 @@
 
 ieee754sp ieee754sp_flong(s64 x)
 {
-       COMPXDP;                /* <--- need 64-bit mantissa temp */
+       u64 xm;         /* <--- need 64-bit mantissa temp */
+       int xe;
+       int xs;
 
        CLEARCX;
 
index 4182e1176faeaeb1181af9fe7d12094b42db1fc4..4a43924cd4fccd1f3415a79bc0562d20420632c8 100644 (file)
 #include <asm/war.h>
 #include <asm/cacheflush.h> /* for run_uncached() */
 
+
+/*
+ * Special Variant of smp_call_function for use by cache functions:
+ *
+ *  o No return value
+ *  o collapses to normal function call on UP kernels
+ *  o collapses to normal function call on systems with a single shared
+ *    primary cache.
+ */
+static inline void r4k_on_each_cpu(void (*func) (void *info), void *info,
+                                   int retry, int wait)
+{
+       preempt_disable();
+
+#if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC)
+       smp_call_function(func, info, retry, wait);
+#endif
+       func(info);
+       preempt_enable();
+}
+
 /*
  * Must die.
  */
@@ -299,7 +320,7 @@ static void r4k_flush_cache_all(void)
        if (!cpu_has_dc_aliases)
                return;
 
-       on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1);
 }
 
 static inline void local_r4k___flush_cache_all(void * args)
@@ -314,13 +335,14 @@ static inline void local_r4k___flush_cache_all(void * args)
        case CPU_R4400MC:
        case CPU_R10000:
        case CPU_R12000:
+       case CPU_R14000:
                r4k_blast_scache();
        }
 }
 
 static void r4k___flush_cache_all(void)
 {
-       on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
+       r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
 }
 
 static inline void local_r4k_flush_cache_range(void * args)
@@ -341,7 +363,7 @@ static inline void local_r4k_flush_cache_range(void * args)
 static void r4k_flush_cache_range(struct vm_area_struct *vma,
        unsigned long start, unsigned long end)
 {
-       on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
 }
 
 static inline void local_r4k_flush_cache_mm(void * args)
@@ -370,7 +392,7 @@ static void r4k_flush_cache_mm(struct mm_struct *mm)
        if (!cpu_has_dc_aliases)
                return;
 
-       on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1);
 }
 
 struct flush_cache_page_args {
@@ -461,7 +483,7 @@ static void r4k_flush_cache_page(struct vm_area_struct *vma,
        args.addr = addr;
        args.pfn = pfn;
 
-       on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1);
 }
 
 static inline void local_r4k_flush_data_cache_page(void * addr)
@@ -471,7 +493,7 @@ static inline void local_r4k_flush_data_cache_page(void * addr)
 
 static void r4k_flush_data_cache_page(unsigned long addr)
 {
-       on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1);
 }
 
 struct flush_icache_range_args {
@@ -514,7 +536,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
        args.start = start;
        args.end = end;
 
-       on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1);
        instruction_hazard();
 }
 
@@ -590,7 +612,7 @@ static void r4k_flush_icache_page(struct vm_area_struct *vma,
        args.vma = vma;
        args.page = page;
 
-       on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1);
 }
 
 
@@ -689,7 +711,7 @@ static void local_r4k_flush_cache_sigtramp(void * arg)
 
 static void r4k_flush_cache_sigtramp(unsigned long addr)
 {
-       on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1);
+       r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1);
 }
 
 static void r4k_flush_icache_all(void)
@@ -812,6 +834,7 @@ static void __init probe_pcache(void)
 
        case CPU_R10000:
        case CPU_R12000:
+       case CPU_R14000:
                icache_size = 1 << (12 + ((config & R10K_CONF_IC) >> 29));
                c->icache.linesz = 64;
                c->icache.ways = 2;
@@ -965,9 +988,11 @@ static void __init probe_pcache(void)
                c->dcache.flags |= MIPS_CACHE_PINDEX;
        case CPU_R10000:
        case CPU_R12000:
+       case CPU_R14000:
        case CPU_SB1:
                break;
        case CPU_24K:
+       case CPU_34K:
                if (!(read_c0_config7() & (1 << 16)))
        default:
                        if (c->dcache.waysize > PAGE_SIZE)
@@ -1091,6 +1116,7 @@ static void __init setup_scache(void)
 
        case CPU_R10000:
        case CPU_R12000:
+       case CPU_R14000:
                scache_size = 0x80000 << ((config & R10K_CONF_SS) >> 16);
                c->scache.linesz = 64 << ((config >> 13) & 1);
                c->scache.ways = 2;
@@ -1135,6 +1161,31 @@ static void __init setup_scache(void)
        c->options |= MIPS_CPU_SUBSET_CACHES;
 }
 
+void au1x00_fixup_config_od(void)
+{
+       /*
+        * c0_config.od (bit 19) was write only (and read as 0)
+        * on the early revisions of Alchemy SOCs.  It disables the bus
+        * transaction overlapping and needs to be set to fix various errata.
+        */
+       switch (read_c0_prid()) {
+       case 0x00030100: /* Au1000 DA */
+       case 0x00030201: /* Au1000 HA */
+       case 0x00030202: /* Au1000 HB */
+       case 0x01030200: /* Au1500 AB */
+       /*
+        * Au1100 errata actually keeps silence about this bit, so we set it
+        * just in case for those revisions that require it to be set according
+        * to arch/mips/au1000/common/cputable.c
+        */
+       case 0x02030200: /* Au1100 AB */
+       case 0x02030201: /* Au1100 BA */
+       case 0x02030202: /* Au1100 BC */
+               set_c0_config(1 << 19);
+               break;
+       }
+}
+
 static inline void coherency_setup(void)
 {
        change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
@@ -1155,6 +1206,15 @@ static inline void coherency_setup(void)
        case CPU_R4400MC:
                clear_c0_config(CONF_CU);
                break;
+       /*
+        * We need to catch the ealry Alchemy SOCs with
+        * the write-only co_config.od bit and set it back to one...
+        */
+       case CPU_AU1000: /* rev. DA, HA, HB */
+       case CPU_AU1100: /* rev. AB, BA, BC ?? */
+       case CPU_AU1500: /* rev. AB */
+               au1x00_fixup_config_od();
+               break;
        }
 }
 
index c22308b93ff05ce04aee860042733a63dc2bf713..33f6e1cdfd5b409341488e4e2f15424f82451c3b 100644 (file)
@@ -227,7 +227,7 @@ void __init mem_init(void)
        for (tmp = 0; tmp < max_low_pfn; tmp++)
                if (page_is_ram(tmp)) {
                        ram++;
-                       if (PageReserved(mem_map+tmp))
+                       if (PageReserved(pfn_to_page(tmp)))
                                reservedpages++;
                }
 
index e4390dc3eb48e29d9b9a950d5a020d27af32676e..b7c749232ffef80bb50c131f2853965aa7e72396 100644 (file)
@@ -357,6 +357,7 @@ void __init build_clear_page(void)
 
                case CPU_R10000:
                case CPU_R12000:
+               case CPU_R14000:
                        pref_src_mode = Pref_LoadStreamed;
                        pref_dst_mode = Pref_StoreStreamed;
                        break;
index 053dbacac56bdf4d5a797b0d115ddb1951297aa0..54507be2ab5bb07f967f23e9c8305ab5f2ddf48a 100644 (file)
@@ -875,6 +875,7 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l,
 
        case CPU_R10000:
        case CPU_R12000:
+       case CPU_R14000:
        case CPU_4KC:
        case CPU_SB1:
        case CPU_SB1A:
@@ -906,6 +907,7 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l,
        case CPU_4KEC:
        case CPU_24K:
        case CPU_34K:
+       case CPU_74K:
                i_ehb(p);
                tlbw(p);
                break;
index 542eac82b63c2908065fcd51bda2625c4b2e1aed..d7dea0a136aabedd95a98f0646e756ffce77c8ab 100644 (file)
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
        /* disable interrupts */
        UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-       /* set up buad rate */
+       /* set up baud rate */
        {
                uint32 divisor;
 
index 8720bccfdea250dd9eddbe580c22b8f4e75fa60e..f0a6a38fcf4d9fae50fc20da3b7c1505ebc451ef 100644 (file)
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
        /* disable interrupts */
        UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-       /* set up buad rate */
+       /* set up baud rate */
        {
                uint32 divisor;
 
index 8720bccfdea250dd9eddbe580c22b8f4e75fa60e..f0a6a38fcf4d9fae50fc20da3b7c1505ebc451ef 100644 (file)
@@ -73,7 +73,7 @@ void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
        /* disable interrupts */
        UART16550_WRITE(OFS_INTR_ENABLE, 0);
 
-       /* set up buad rate */
+       /* set up baud rate */
        {
                uint32 divisor;
 
index f2b4862aaae505fbcb8e902214633b6078d64fe4..c31e4cff64e043437a9019bfeae3890c2ee043eb 100644 (file)
@@ -14,8 +14,8 @@
 
 #include "op_impl.h"
 
-extern struct op_mips_model op_model_mipsxx __attribute__((weak));
-extern struct op_mips_model op_model_rm9000 __attribute__((weak));
+extern struct op_mips_model op_model_mipsxx_ops __attribute__((weak));
+extern struct op_mips_model op_model_rm9000_ops __attribute__((weak));
 
 static struct op_mips_model *model;
 
@@ -80,13 +80,14 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        case CPU_24K:
        case CPU_25KF:
        case CPU_34K:
+       case CPU_74K:
        case CPU_SB1:
        case CPU_SB1A:
-               lmodel = &op_model_mipsxx;
+               lmodel = &op_model_mipsxx_ops;
                break;
 
        case CPU_RM9000:
-               lmodel = &op_model_rm9000;
+               lmodel = &op_model_rm9000_ops;
                break;
        };
 
index 95d488ca075473be4d4e0a3e0d032a0c413eaf27..f26a00e13204dd62b6848120f14a6d46af00b39e 100644 (file)
@@ -23,7 +23,7 @@
 
 #define M_COUNTER_OVERFLOW             (1UL    << 31)
 
-struct op_mips_model op_model_mipsxx;
+struct op_mips_model op_model_mipsxx_ops;
 
 static struct mipsxx_register_config {
        unsigned int control[4];
@@ -34,7 +34,7 @@ static struct mipsxx_register_config {
 
 static void mipsxx_reg_setup(struct op_counter_config *ctr)
 {
-       unsigned int counters = op_model_mipsxx.num_counters;
+       unsigned int counters = op_model_mipsxx_ops.num_counters;
        int i;
 
        /* Compute the performance counter control word.  */
@@ -62,7 +62,7 @@ static void mipsxx_reg_setup(struct op_counter_config *ctr)
 
 static void mipsxx_cpu_setup (void *args)
 {
-       unsigned int counters = op_model_mipsxx.num_counters;
+       unsigned int counters = op_model_mipsxx_ops.num_counters;
 
        switch (counters) {
        case 4:
@@ -83,7 +83,7 @@ static void mipsxx_cpu_setup (void *args)
 /* Start all counters on current CPU */
 static void mipsxx_cpu_start(void *args)
 {
-       unsigned int counters = op_model_mipsxx.num_counters;
+       unsigned int counters = op_model_mipsxx_ops.num_counters;
 
        switch (counters) {
        case 4:
@@ -100,7 +100,7 @@ static void mipsxx_cpu_start(void *args)
 /* Stop all counters on current CPU */
 static void mipsxx_cpu_stop(void *args)
 {
-       unsigned int counters = op_model_mipsxx.num_counters;
+       unsigned int counters = op_model_mipsxx_ops.num_counters;
 
        switch (counters) {
        case 4:
@@ -116,7 +116,7 @@ static void mipsxx_cpu_stop(void *args)
 
 static int mipsxx_perfcount_handler(struct pt_regs *regs)
 {
-       unsigned int counters = op_model_mipsxx.num_counters;
+       unsigned int counters = op_model_mipsxx_ops.num_counters;
        unsigned int control;
        unsigned int counter;
        int handled = 0;
@@ -187,33 +187,37 @@ static int __init mipsxx_init(void)
 
        reset_counters(counters);
 
-       op_model_mipsxx.num_counters = counters;
+       op_model_mipsxx_ops.num_counters = counters;
        switch (current_cpu_data.cputype) {
        case CPU_20KC:
-               op_model_mipsxx.cpu_type = "mips/20K";
+               op_model_mipsxx_ops.cpu_type = "mips/20K";
                break;
 
        case CPU_24K:
-               op_model_mipsxx.cpu_type = "mips/24K";
+               op_model_mipsxx_ops.cpu_type = "mips/24K";
                break;
 
        case CPU_25KF:
-               op_model_mipsxx.cpu_type = "mips/25K";
+               op_model_mipsxx_ops.cpu_type = "mips/25K";
                break;
 
 #ifndef CONFIG_SMP
        case CPU_34K:
-               op_model_mipsxx.cpu_type = "mips/34K";
+               op_model_mipsxx_ops.cpu_type = "mips/34K";
+               break;
+
+       case CPU_74K:
+               op_model_mipsxx_ops.cpu_type = "mips/74K";
                break;
 #endif
 
        case CPU_5KC:
-               op_model_mipsxx.cpu_type = "mips/5K";
+               op_model_mipsxx_ops.cpu_type = "mips/5K";
                break;
 
        case CPU_SB1:
        case CPU_SB1A:
-               op_model_mipsxx.cpu_type = "mips/sb1";
+               op_model_mipsxx_ops.cpu_type = "mips/sb1";
                break;
 
        default:
@@ -229,12 +233,12 @@ static int __init mipsxx_init(void)
 
 static void mipsxx_exit(void)
 {
-       reset_counters(op_model_mipsxx.num_counters);
+       reset_counters(op_model_mipsxx_ops.num_counters);
 
        perf_irq = null_perf_irq;
 }
 
-struct op_mips_model op_model_mipsxx = {
+struct op_mips_model op_model_mipsxx_ops = {
        .reg_setup      = mipsxx_reg_setup,
        .cpu_setup      = mipsxx_cpu_setup,
        .init           = mipsxx_init,
index 9b75e41c78ef891a02021db2cf40d5c004c7e391..b7063fefa65b46d80c658697fbe629f9e95bd4f4 100644 (file)
@@ -126,7 +126,7 @@ static void rm9000_exit(void)
        free_irq(rm9000_perfcount_irq, NULL);
 }
 
-struct op_mips_model op_model_rm9000 = {
+struct op_mips_model op_model_rm9000_ops = {
        .reg_setup      = rm9000_reg_setup,
        .cpu_setup      = rm9000_cpu_setup,
        .init           = rm9000_init,
index de01c9815bddf719f6b40dd85bf0d67dee95913b..8ba08047d164222b31bf6315b66fb51603d3a93a 100644 (file)
 /* issue a PIO read to make sure no PIO writes are pending */
 static void inline flush_crime_bus(void)
 {
-       volatile unsigned long junk = crime->control;
+       crime->control;
 }
 
 static void inline flush_mace_bus(void)
 {
-       volatile unsigned long junk = mace->perif.ctrl.misc;
+       mace->perif.ctrl.misc;
 }
 
 #undef DEBUG_IRQ
index 078fb5533541d001db70eb618fb59a791d0b35f6..f70bd090dacda51fb52b716fb7c8e92e8c27fc1a 100644 (file)
@@ -822,6 +822,7 @@ static void __init prom_send_capabilities(void)
                /* try calling the ibm,client-architecture-support method */
                if (call_prom_ret("call-method", 3, 2, &ret,
                                  ADDR("ibm,client-architecture-support"),
+                                 root,
                                  ADDR(ibm_architecture_vec)) == 0) {
                        /* the call exists... */
                        if (ret)
@@ -1622,6 +1623,15 @@ static int __init prom_find_machine_type(void)
                        if (strstr(p, RELOC("Power Macintosh")) ||
                            strstr(p, RELOC("MacRISC")))
                                return PLATFORM_POWERMAC;
+#ifdef CONFIG_PPC64
+                       /* We must make sure we don't detect the IBM Cell
+                        * blades as pSeries due to some firmware issues,
+                        * so we do it here.
+                        */
+                       if (strstr(p, RELOC("IBM,CBEA")) ||
+                           strstr(p, RELOC("IBM,CPBW-1.0")))
+                               return PLATFORM_GENERIC;
+#endif /* CONFIG_PPC64 */
                        i += sl + 1;
                }
        }
@@ -1636,7 +1646,7 @@ static int __init prom_find_machine_type(void)
                           compat, sizeof(compat)-1);
        if (len <= 0)
                return PLATFORM_GENERIC;
-       if (strncmp(compat, RELOC("chrp"), 4))
+       if (strcmp(compat, RELOC("chrp")))
                return PLATFORM_GENERIC;
 
        /* Default to pSeries. We need to know if we are running LPAR */
@@ -2057,10 +2067,45 @@ static void __init flatten_device_tree(void)
 
 }
 
-
-static void __init fixup_device_tree(void)
+#ifdef CONFIG_PPC_MAPLE
+/* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges property.
+ * The values are bad, and it doesn't even have the right number of cells. */
+static void __init fixup_device_tree_maple(void)
 {
+       phandle isa;
+       u32 isa_ranges[6];
+
+       isa = call_prom("finddevice", 1, 1, ADDR("/ht@0/isa@4"));
+       if (!PHANDLE_VALID(isa))
+               return;
+
+       if (prom_getprop(isa, "ranges", isa_ranges, sizeof(isa_ranges))
+               == PROM_ERROR)
+               return;
+
+       if (isa_ranges[0] != 0x1 ||
+               isa_ranges[1] != 0xf4000000 ||
+               isa_ranges[2] != 0x00010000)
+               return;
+
+       prom_printf("fixing up bogus ISA range on Maple...\n");
+
+       isa_ranges[0] = 0x1;
+       isa_ranges[1] = 0x0;
+       isa_ranges[2] = 0x01002000; /* IO space; PCI device = 4 */
+       isa_ranges[3] = 0x0;
+       isa_ranges[4] = 0x0;
+       isa_ranges[5] = 0x00010000;
+       prom_setprop(isa, "/ht@0/isa@4", "ranges",
+                       isa_ranges, sizeof(isa_ranges));
+}
+#else
+#define fixup_device_tree_maple()
+#endif
+
 #if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC)
+static void __init fixup_device_tree_pmac(void)
+{
        phandle u3, i2c, mpic;
        u32 u3_rev;
        u32 interrupts[2];
@@ -2097,9 +2142,16 @@ static void __init fixup_device_tree(void)
        parent = (u32)mpic;
        prom_setprop(i2c, "/u3@0,f8000000/i2c@f8001000", "interrupt-parent",
                     &parent, sizeof(parent));
-#endif
 }
+#else
+#define fixup_device_tree_pmac()
+#endif
 
+static void __init fixup_device_tree(void)
+{
+       fixup_device_tree_maple();
+       fixup_device_tree_pmac();
+}
 
 static void __init prom_find_boot_cpu(void)
 {
index 01e3c08cb5503617318d05c38ee3f02862e83125..8fdeca2d4597c35295271ff9ea844a91ea856a4d 100644 (file)
@@ -803,10 +803,13 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
                if (__get_user(cmcp, &ucp->uc_regs))
                        return -EFAULT;
                mcp = (struct mcontext __user *)(u64)cmcp;
+               /* no need to check access_ok(mcp), since mcp < 4GB */
        }
 #else
        if (__get_user(mcp, &ucp->uc_regs))
                return -EFAULT;
+       if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp)))
+               return -EFAULT;
 #endif
        restore_sigmask(&set);
        if (restore_user_regs(regs, mcp, sig))
@@ -908,13 +911,14 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
 {
        struct sig_dbg_op op;
        int i;
+       unsigned char tmp;
        unsigned long new_msr = regs->msr;
 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
        unsigned long new_dbcr0 = current->thread.dbcr0;
 #endif
 
        for (i=0; i<ndbg; i++) {
-               if (__copy_from_user(&op, dbg, sizeof(op)))
+               if (copy_from_user(&op, dbg + i, sizeof(op)))
                        return -EFAULT;
                switch (op.dbg_type) {
                case SIG_DBG_SINGLE_STEPPING:
@@ -959,6 +963,11 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
        current->thread.dbcr0 = new_dbcr0;
 #endif
 
+       if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
+           || __get_user(tmp, (u8 __user *) ctx)
+           || __get_user(tmp, (u8 __user *) (ctx + 1) - 1))
+               return -EFAULT;
+
        /*
         * If we get a fault copying the context into the kernel's
         * image of the user's registers, we can't just return -EFAULT
index 27f65b95184d39eadfae53a877afd3e1ba6caafe..c2db642f4cdd44c32695432b9622406204fdd866 100644 (file)
@@ -182,6 +182,8 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
        err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
        if (err)
                return err;
+       if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
+               return -EFAULT;
        /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
        if (v_regs != 0 && (msr & MSR_VEC) != 0)
                err |= __copy_from_user(current->thread.vr, v_regs,
index cf56a1d499ff740b5ee56efa4f22844e679a7359..26ed1f5ef16e12e8cde5e955b3ced3592f34bc54 100644 (file)
@@ -338,6 +338,8 @@ SYSCALL(symlinkat)
 SYSCALL(readlinkat)
 SYSCALL(fchmodat)
 SYSCALL(faccessat)
+COMPAT_SYS(get_robust_list)
+COMPAT_SYS(set_robust_list)
 
 /*
  * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
index 6574b22b3cf3d4eb5feb828583ec721aa4685b6f..fd3e5609e3e004492fdbded682e899f4da21eec8 100644 (file)
@@ -125,14 +125,13 @@ static void __init cell_init_early(void)
 
 static int __init cell_probe(void)
 {
-       /* XXX This is temporary, the Cell maintainer will come up with
-        * more appropriate detection logic
-        */
        unsigned long root = of_get_flat_dt_root();
-       if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
-               return 0;
 
-       return 1;
+       if (of_flat_dt_is_compatible(root, "IBM,CBEA") ||
+           of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
+               return 1;
+
+       return 0;
 }
 
 /*
index 95b36430aa0fa4b495ee08342bee9b9756065c2d..b47fcc5ddb7867636acc0acbed6613ae266215b0 100644 (file)
@@ -258,6 +258,7 @@ void *spu_syscall_table[] = {
        [__NR_futex]                    sys_futex,
        [__NR_sched_setaffinity]        sys_sched_setaffinity,
        [__NR_sched_getaffinity]        sys_sched_getaffinity,
+       [224]                           sys_ni_syscall,
        [__NR_tuxcall]                  sys_ni_syscall,
        [226]                           sys_ni_syscall,
        [__NR_io_setup]                 sys_io_setup,
@@ -332,19 +333,21 @@ void *spu_syscall_table[] = {
        [__NR_readlinkat]               sys_readlinkat,
        [__NR_fchmodat]                 sys_fchmodat,
        [__NR_faccessat]                sys_faccessat,
+       [__NR_get_robust_list]          sys_get_robust_list,
+       [__NR_set_robust_list]          sys_set_robust_list,
 };
 
 long spu_sys_callback(struct spu_syscall_block *s)
 {
        long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
 
-       syscall = spu_syscall_table[s->nr_ret];
-
        if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
                pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret);
                return -ENOSYS;
        }
 
+       syscall = spu_syscall_table[s->nr_ret];
+
 #ifdef DEBUG
        print_symbol(KERN_DEBUG "SPU-syscall %s:", (unsigned long)syscall);
        printk("syscall%ld(%lx, %lx, %lx, %lx, %lx, %lx)\n",
index df2343e1956bc266cc634ac88a217dd51f86d9ce..c896ce83d412917da2820292c32c9b6e4c32dcd1 100644 (file)
@@ -1157,6 +1157,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_xfer);
 /* some quirks for platform function decoding */
 enum {
        pmac_i2c_quirk_invmask = 0x00000001u,
+       pmac_i2c_quirk_skip = 0x00000002u,
 };
 
 static void pmac_i2c_devscan(void (*callback)(struct device_node *dev,
@@ -1172,6 +1173,15 @@ static void pmac_i2c_devscan(void (*callback)(struct device_node *dev,
                /* XXX Study device-tree's & apple drivers are get the quirks
                 * right !
                 */
+               /* Workaround: It seems that running the clockspreading
+                * properties on the eMac will cause lockups during boot.
+                * The machine seems to work fine without that. So for now,
+                * let's make sure i2c-hwclock doesn't match about "imic"
+                * clocks and we'll figure out if we really need to do
+                * something special about those later.
+                */
+               { "i2c-hwclock", "imic5002", pmac_i2c_quirk_skip },
+               { "i2c-hwclock", "imic5003", pmac_i2c_quirk_skip },
                { "i2c-hwclock", NULL, pmac_i2c_quirk_invmask },
                { "i2c-cpu-voltage", NULL, 0},
                {  "temp-monitor", NULL, 0 },
@@ -1198,6 +1208,8 @@ static void pmac_i2c_devscan(void (*callback)(struct device_node *dev,
                                if (p->compatible &&
                                    !device_is_compatible(np, p->compatible))
                                        continue;
+                               if (p->quirks & pmac_i2c_quirk_skip)
+                                       break;
                                callback(np, p->quirks);
                                break;
                        }
index 4baa75b1d36ff60a7cb9088a7e6ffa5d10301e0f..f08173b0f06593dd9da152025e728386934a5a30 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 
 #include <asm/semaphore.h>
 #include <asm/prom.h>
@@ -546,6 +547,7 @@ struct pmf_device {
 
 static LIST_HEAD(pmf_devices);
 static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_MUTEX(pmf_irq_mutex);
 
 static void pmf_release_device(struct kref *kref)
 {
@@ -864,15 +866,17 @@ int pmf_register_irq_client(struct device_node *target,
 
        spin_lock_irqsave(&pmf_lock, flags);
        func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN);
-       if (func == NULL) {
-               spin_unlock_irqrestore(&pmf_lock, flags);
+       if (func)
+               func = pmf_get_function(func);
+       spin_unlock_irqrestore(&pmf_lock, flags);
+       if (func == NULL)
                return -ENODEV;
-       }
+       mutex_lock(&pmf_irq_mutex);
        if (list_empty(&func->irq_clients))
                func->dev->handlers->irq_enable(func);
        list_add(&client->link, &func->irq_clients);
        client->func = func;
-       spin_unlock_irqrestore(&pmf_lock, flags);
+       mutex_unlock(&pmf_irq_mutex);
 
        return 0;
 }
@@ -881,16 +885,16 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client);
 void pmf_unregister_irq_client(struct pmf_irq_client *client)
 {
        struct pmf_function *func = client->func;
-       unsigned long flags;
 
        BUG_ON(func == NULL);
 
-       spin_lock_irqsave(&pmf_lock, flags);
+       mutex_lock(&pmf_irq_mutex);
        client->func = NULL;
        list_del(&client->link);
        if (list_empty(&func->irq_clients))
                func->dev->handlers->irq_disable(func);
-       spin_unlock_irqrestore(&pmf_lock, flags);
+       mutex_unlock(&pmf_irq_mutex);
+       pmf_put_function(func);
 }
 EXPORT_SYMBOL_GPL(pmf_unregister_irq_client);
 
index 4d15e396655c1a095ab8c4a5df6600e054ab4c99..b9200fb078157f3498e16f4be98e92a5b8d8194d 100644 (file)
@@ -463,11 +463,23 @@ static int pmac_pm_finish(suspend_state_t state)
        return 0;
 }
 
+static int pmac_pm_valid(suspend_state_t state)
+{
+       switch (state) {
+       case PM_SUSPEND_DISK:
+               return 1;
+       /* can't do any other states via generic mechanism yet */
+       default:
+               return 0;
+       }
+}
+
 static struct pm_ops pmac_pm_ops = {
        .pm_disk_mode   = PM_DISK_SHUTDOWN,
        .prepare        = pmac_pm_prepare,
        .enter          = pmac_pm_enter,
        .finish         = pmac_pm_finish,
+       .valid          = pmac_pm_valid,
 };
 
 #endif /* CONFIG_SOFTWARE_SUSPEND */
index 5eb55ef1c91cd20a99ffe811596458c7d8acf326..3ba87835757e2cfd5319d54e6992dd2d313488e7 100644 (file)
@@ -255,7 +255,7 @@ static int __init pSeries_init_panel(void)
 {
        /* Manually leave the kernel version on the panel. */
        ppc_md.progress("Linux ppc64\n", 0);
-       ppc_md.progress(system_utsname.version, 0);
+       ppc_md.progress(system_utsname.release, 0);
 
        return 0;
 }
@@ -389,6 +389,7 @@ static int __init pSeries_probe_hypertas(unsigned long node,
 
 static int __init pSeries_probe(void)
 {
+       unsigned long root = of_get_flat_dt_root();
        char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
                                          "device_type", NULL);
        if (dtype == NULL)
@@ -396,6 +397,13 @@ static int __init pSeries_probe(void)
        if (strcmp(dtype, "chrp"))
                return 0;
 
+       /* Cell blades firmware claims to be chrp while it's not. Until this
+        * is fixed, we need to avoid those here.
+        */
+       if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") ||
+           of_flat_dt_is_compatible(root, "IBM,CBEA"))
+               return 0;
+
        DBG("pSeries detected, looking for LPAR capability...\n");
 
        /* Now try to figure out if we are running on LPAR */
index cc7c4aea939751a42985f5bc944614290993ffad..2f5c5e1576175ffb5bc4e3a7e9868dda7bc1caf7 100644 (file)
@@ -134,7 +134,7 @@ main(void)
        DEFINE(TI_TASK, offsetof(struct thread_info, task));
        DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
        DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
-       DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, flags));
+       DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
        DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
        DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
 
index e62b75707f7a3f0551575f936d6258b6c97eb0d8..abb7154de2c7fcba30125b5b1971da761a2a59df 100644 (file)
@@ -279,11 +279,11 @@ static int mpc8272ads_platform_notify(struct device *dev)
        static const struct platform_notify_dev_map dev_map[] = {
                {
                        .bus_id = "fsl-cpm-fcc",
-                       .rtn = mpc8272ads_fixup_enet_pdata
+                       .rtn = mpc8272ads_fixup_enet_pdata,
                },
                {
                        .bus_id = "fsl-cpm-scc:uart",
-                       .rtn = mpc
+                       .rtn = mpc8272ads_fixup_uart_pdata,
                },
                {
                        .bus_id = NULL
@@ -335,15 +335,15 @@ struct platform_device* early_uart_get_pdev(int index)
        struct platform_device* pdev = NULL;
        if(index) { /*assume SCC4 here*/
                pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4];
-               pinfo = &mpc8272<F12>_uart_pdata[1];
+               pinfo = &mpc8272_uart_pdata[fsid_scc4_uart];
        } else { /*over SCC1*/
                pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1];
-               pinfo = &mpc8272_uart_pdata[0];
+               pinfo = &mpc8272_uart_pdata[fsid_scc1_uart];
        }
 
        pinfo->uart_clk = bd->bi_intfreq;
        pdev->dev.platform_data = pinfo;
-       ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR);
+       ppc_sys_fixup_mem_resource(pdev, CPM_MAP_ADDR);
        return NULL;
 }
 
index 0636aed7b8271b2f9357c27a6cb9da1a9a63c31b..8692d00c08c42d7e3c33e59b57abbd7f75a6c5fb 100644 (file)
@@ -121,13 +121,13 @@ struct platform_device ppc_sys_platform_devices[] = {
                .num_resources   = 3,
                .resource = (struct resource[]) {
                        {
-                               .name   = "scc_mem",
+                               .name   = "regs",
                                .start  = 0x11A00,
                                .end    = 0x11A1F,
                                .flags  = IORESOURCE_MEM,
                        },
                        {
-                               .name   = "scc_pram",
+                               .name   = "pram",
                                .start  = 0x8000,
                                .end    = 0x80ff,
                                .flags  = IORESOURCE_MEM,
@@ -145,13 +145,13 @@ struct platform_device ppc_sys_platform_devices[] = {
                .num_resources   = 3,
                .resource = (struct resource[]) {
                        {
-                               .name   = "scc_mem",
+                               .name   = "regs",
                                .start  = 0x11A20,
                                .end    = 0x11A3F,
                                .flags  = IORESOURCE_MEM,
                        },
                        {
-                               .name   = "scc_pram",
+                               .name   = "pram",
                                .start  = 0x8100,
                                .end    = 0x81ff,
                                .flags  = IORESOURCE_MEM,
@@ -169,13 +169,13 @@ struct platform_device ppc_sys_platform_devices[] = {
                .num_resources   = 3,
                .resource = (struct resource[]) {
                        {
-                               .name   = "scc_mem",
+                               .name   = "regs",
                                .start  = 0x11A40,
                                .end    = 0x11A5F,
                                .flags  = IORESOURCE_MEM,
                        },
                        {
-                               .name   = "scc_pram",
+                               .name   = "pram",
                                .start  = 0x8200,
                                .end    = 0x82ff,
                                .flags  = IORESOURCE_MEM,
@@ -193,13 +193,13 @@ struct platform_device ppc_sys_platform_devices[] = {
                .num_resources   = 3,
                .resource = (struct resource[]) {
                        {
-                               .name   = "scc_mem",
+                               .name   = "regs",
                                .start  = 0x11A60,
                                .end    = 0x11A7F,
                                .flags  = IORESOURCE_MEM,
                        },
                        {
-                               .name   = "scc_pram",
+                               .name   = "pram",
                                .start  = 0x8300,
                                .end    = 0x83ff,
                                .flags  = IORESOURCE_MEM,
index 433b0fa203e110029aa103fa639ca340560f23af..fee8948162b9a49a7c9767cd6e389db223065ef3 100644 (file)
@@ -139,13 +139,13 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                .ppc_sys_name   = "8272",
                .mask           = 0x0000ff00,
                .value          = 0x00000c00,
-               .num_devices    = 11,
+               .num_devices    = 12,
                .device_list = (enum ppc_sys_devices[])
                {
                        MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1,
-                       MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1,
-                       MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C,
-                       MPC82xx_CPM_USB, MPC82xx_SEC1,
+                       MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4,
+                       MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI,
+                       MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1,
                },
        },
        /* below is a list of the 8280 family of processors */
index ef5b9c44b86b50ac5c7f80fd3e0ddda66dcf3f1a..4d53b2739357d21aa707d838184dedf29486e220 100644 (file)
@@ -1650,3 +1650,11 @@ sys_tee_wrapper:
        llgfr   %r4,%r4                 # size_t
        llgfr   %r5,%r5                 # unsigned int
        jg      sys_tee
+
+       .globl compat_sys_vmsplice_wrapper
+compat_sys_vmsplice_wrapper:
+       lgfr    %r2,%r2                 # int
+       llgtr   %r3,%r3                 # compat_iovec *
+       llgfr   %r4,%r4                 # unsigned int
+       llgfr   %r5,%r5                 # unsigned int
+       jg      compat_sys_vmsplice
index fc2c0767202b22d6595f940dc7f278d36e704810..93be1d56c03662d46da46e1effc788a954dbc096 100644 (file)
@@ -317,3 +317,4 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list_wrapp
 SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
 SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
 SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
+SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper)
index fea043b69b913953c95d5c9ab97307d26e0083c5..2a6c6efb68653db8880853d09648d86f21af60b9 100644 (file)
@@ -249,18 +249,19 @@ static inline void stop_hz_timer(void)
        unsigned long flags;
        unsigned long seq, next;
        __u64 timer, todval;
+       int cpu = smp_processor_id();
 
        if (sysctl_hz_timer != 0)
                return;
 
-       cpu_set(smp_processor_id(), nohz_cpu_mask);
+       cpu_set(cpu, nohz_cpu_mask);
 
        /*
         * Leave the clock comparator set up for the next timer
         * tick if either rcu or a softirq is pending.
         */
-       if (rcu_pending(smp_processor_id()) || local_softirq_pending()) {
-               cpu_clear(smp_processor_id(), nohz_cpu_mask);
+       if (rcu_needs_cpu(cpu) || local_softirq_pending()) {
+               cpu_clear(cpu, nohz_cpu_mask);
                return;
        }
 
@@ -271,7 +272,7 @@ static inline void stop_hz_timer(void)
        next = next_timer_interrupt();
        do {
                seq = read_seqbegin_irqsave(&xtime_lock, flags);
-               timer = (__u64)(next - jiffies) + jiffies_64;
+               timer = ((__u64) next) - ((__u64) jiffies) + jiffies_64;
        } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
        todval = -1ULL;
        /* Be careful about overflows. */
index 460f72e640e6593e37005bc62f5a8af0b46bbdd8..f9ff29734848709b56dfb873d0e530b5aebf79db 100644 (file)
@@ -274,6 +274,11 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
        if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
                goto err_noiommu;
 
+       /* Set the resource name, if known. */
+       if (sdev) {
+               res->name = sdev->prom_name;
+       }
+
        return (void *)res->start;
 
 err_noiommu:
index 787d5f1347ec48de6538bc46e44d712acbddab40..598682f31ebfd942eec586fc23fd6919ce42d710 100644 (file)
@@ -113,6 +113,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
 
                switch (ELF32_R_TYPE(rel[i].r_info)) {
                case R_SPARC_32:
+               case R_SPARC_UA32:
                        location[0] = v >> 24;
                        location[1] = v >> 16;
                        location[2] = v >>  8;
index a93f5da6855d58b1164ae734c9f5d2991ebbf8c1..40b42c88e6a7876c09598e93d30df54def747338 100644 (file)
@@ -69,6 +69,17 @@ void __init smp_store_cpu_info(int id)
                                                     "clock-frequency", 0);
        cpu_data(id).prom_node = cpu_node;
        cpu_data(id).mid = cpu_get_hwmid(cpu_node);
+
+       /* this is required to tune the scheduler correctly */
+       /* is it possible to have CPUs with different cache sizes? */
+       if (id == boot_cpu_id) {
+               int cache_line,cache_nlines;
+               cache_line = 0x20;
+               cache_line = prom_getintdefault(cpu_node, "ecache-line-size", cache_line);
+               cache_nlines = 0x8000;
+               cache_nlines = prom_getintdefault(cpu_node, "ecache-nlines", cache_nlines);
+               max_cache_size = cache_line * cache_nlines;
+       }
        if (cpu_data(id).mid < 0)
                panic("No MID found for CPU%d at node 0x%08d", id, cpu_node);
 }
index ec1c9687d67920312df790ec0b550d3740c1c08c..4b376fae752c464cf2f2426619a26a3a606c703a 100644 (file)
@@ -251,19 +251,9 @@ EXPORT_SYMBOL(__prom_getchild);
 EXPORT_SYMBOL(__prom_getsibling);
 
 /* sparc library symbols */
-EXPORT_SYMBOL(memchr);
 EXPORT_SYMBOL(memscan);
 EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(strcpy);
-EXPORT_SYMBOL(strncpy);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strcmp);
 EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strstr);
 EXPORT_SYMBOL(page_kernel);
 
 /* Special internal versions of library functions. */
@@ -317,6 +307,3 @@ EXPORT_SYMBOL(do_BUG);
 
 /* Sun Power Management Idle Handler */
 EXPORT_SYMBOL(pm_idle);
-
-/* Binfmt_misc needs this */
-EXPORT_SYMBOL(sys_close);
index 6e1135cc03b08a42e4def9f77511ef0322bd09bc..2856551bddf1b7451aab44512f84cd4aae0f7eab 100644 (file)
@@ -79,6 +79,7 @@ sys_call_table:
 /*285*/        .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
 /*290*/        .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
 /*295*/        .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
+/*300*/        .long sys_set_robust_list, sys_get_robust_list
 
 #ifdef CONFIG_SUNOS_EMUL
        /* Now the SunOS syscall table. */
@@ -190,6 +191,6 @@ sunos_sys_table:
 /*290*/        .long sunos_nosys, sunos_nosys, sunos_nosys
        .long sunos_nosys, sunos_nosys, sunos_nosys
        .long sunos_nosys, sunos_nosys, sunos_nosys
-       .long sunos_nosys
+       .long sunos_nosys, sunos_nosys, sunos_nosys
 
 #endif
index 1317380fa93779899be32254c629629fec2c84a3..f09a70b8aabd30bad84454ef1df39ba54cccd52f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16
-# Sun Apr  2 19:31:04 2006
+# Linux kernel version: 2.6.17-rc3
+# Fri May 12 12:43:49 2006
 #
 CONFIG_SPARC=y
 CONFIG_SPARC64=y
@@ -114,6 +114,7 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_HUGETLB_PAGE_SIZE_4MB=y
 # CONFIG_HUGETLB_PAGE_SIZE_512K is not set
 # CONFIG_HUGETLB_PAGE_SIZE_64K is not set
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
 CONFIG_LARGE_ALLOCS=y
@@ -430,7 +431,6 @@ CONFIG_ISCSI_TCP=m
 # CONFIG_SCSI_INIA100 is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
 # CONFIG_SCSI_QLOGICPTI is not set
 # CONFIG_SCSI_QLA_FC is not set
@@ -1042,9 +1042,7 @@ CONFIG_USB_HIDDEV=y
 # CONFIG_USB_ACECAD is not set
 # CONFIG_USB_KBTAB is not set
 # CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_MTOUCH is not set
-# CONFIG_USB_ITMTOUCH is not set
-# CONFIG_USB_EGALAX is not set
+# CONFIG_USB_TOUCHSCREEN is not set
 # CONFIG_USB_YEALINK is not set
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
@@ -1114,6 +1112,14 @@ CONFIG_USB_HIDDEV=y
 #
 # CONFIG_NEW_LEDS is not set
 
+#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
+
 #
 # InfiniBand support
 #
@@ -1303,6 +1309,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_INFO is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_VM is not set
+# CONFIG_UNWIND_INFO is not set
 CONFIG_FORCED_INLINING=y
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
index 3eadac5e171e489e157ffbb902609274a017ce17..31c5892f5acc49669c4326bf5162a42ebceb36ea 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/config.h>
 #include <linux/version.h>
 #include <linux/errno.h>
+#include <linux/threads.h>
 #include <asm/thread_info.h>
 #include <asm/asi.h>
 #include <asm/pstate.h>
@@ -493,6 +494,35 @@ tlb_fixup_done:
        call    prom_init
         mov    %l7, %o0                        ! OpenPROM cif handler
 
+       /* Initialize current_thread_info()->cpu as early as possible.
+        * In order to do that accurately we have to patch up the get_cpuid()
+        * assembler sequences.  And that, in turn, requires that we know
+        * if we are on a Starfire box or not.  While we're here, patch up
+        * the sun4v sequences as well.
+        */
+       call    check_if_starfire
+        nop
+       call    per_cpu_patch
+        nop
+       call    sun4v_patch
+        nop
+
+#ifdef CONFIG_SMP
+       call    hard_smp_processor_id
+        nop
+       cmp     %o0, NR_CPUS
+       blu,pt  %xcc, 1f
+        nop
+       call    boot_cpu_id_too_large
+        nop
+       /* Not reached... */
+
+1:
+#else
+       mov     0, %o0
+#endif
+       stb     %o0, [%g6 + TI_CPU]
+
        /* Off we go.... */
        call    start_kernel
         nop
index 6c83e372f75d8ae71f57a9ce0dcec13c91582a76..579871527699ed616a7a5c838be648a88884ca1a 100644 (file)
@@ -143,6 +143,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
                        location[3] = v >>  0;
                        break;
 
+               case R_SPARC_DISP32:
+                       v -= (Elf64_Addr) location;
+                       *loc32 = v;
+                       break;
+
                case R_SPARC_WDISP30:
                        v -= (Elf64_Addr) location;
                        *loc32 = (*loc32 & ~0x3fffffff) |
index 8efbc139769d22d45990266d941055a7fef4a0c6..82e5455134c67719c9cafbdf7dc107a187c56302 100644 (file)
@@ -218,7 +218,7 @@ static inline void iommu_free_ctx(struct pci_iommu *iommu, int ctx)
  * DMA for PCI device PDEV.  Return non-NULL cpu-side address if
  * successful and set *DMA_ADDRP to the PCI side dma address.
  */
-static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
+static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)
 {
        struct pcidev_cookie *pcp;
        struct pci_iommu *iommu;
@@ -232,7 +232,7 @@ static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
        if (order >= 10)
                return NULL;
 
-       first_page = __get_free_pages(GFP_ATOMIC, order);
+       first_page = __get_free_pages(gfp, order);
        if (first_page == 0UL)
                return NULL;
        memset((char *)first_page, 0, PAGE_SIZE << order);
index 9e94db2573a2f83f8c1d58072d8e2d28cd0035d4..0c08952029707c846fb3e152a16d30edd42b453a 100644 (file)
@@ -154,7 +154,7 @@ static void pci_arena_free(struct pci_iommu_arena *arena, unsigned long base, un
                __clear_bit(i, arena->map);
 }
 
-static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp)
+static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)
 {
        struct pcidev_cookie *pcp;
        struct pci_iommu *iommu;
@@ -169,7 +169,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
 
        npages = size >> IO_PAGE_SHIFT;
 
-       first_page = __get_free_pages(GFP_ATOMIC, order);
+       first_page = __get_free_pages(gfp, order);
        if (unlikely(first_page == 0UL))
                return NULL;
 
@@ -599,18 +599,128 @@ struct pci_iommu_ops pci_sun4v_iommu_ops = {
 
 /* SUN4V PCI configuration space accessors. */
 
-static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func)
+struct pdev_entry {
+       struct pdev_entry       *next;
+       u32                     devhandle;
+       unsigned int            bus;
+       unsigned int            device;
+       unsigned int            func;
+};
+
+#define PDEV_HTAB_SIZE 16
+#define PDEV_HTAB_MASK (PDEV_HTAB_SIZE - 1)
+static struct pdev_entry *pdev_htab[PDEV_HTAB_SIZE];
+
+static inline unsigned int pdev_hashfn(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
 {
-       if (bus == pbm->pci_first_busno) {
-               if (device == 0 && func == 0)
-                       return 0;
-               return 1;
+       unsigned int val;
+
+       val = (devhandle ^ (devhandle >> 4));
+       val ^= bus;
+       val ^= device;
+       val ^= func;
+
+       return val & PDEV_HTAB_MASK;
+}
+
+static int pdev_htab_add(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
+{
+       struct pdev_entry *p = kmalloc(sizeof(*p), GFP_KERNEL);
+       struct pdev_entry **slot;
+
+       if (!p)
+               return -ENOMEM;
+
+       slot = &pdev_htab[pdev_hashfn(devhandle, bus, device, func)];
+       p->next = *slot;
+       *slot = p;
+
+       p->devhandle = devhandle;
+       p->bus = bus;
+       p->device = device;
+       p->func = func;
+
+       return 0;
+}
+
+/* Recursively descend into the OBP device tree, rooted at toplevel_node,
+ * looking for a PCI device matching bus and devfn.
+ */
+static int obp_find(struct linux_prom_pci_registers *pregs, int toplevel_node, unsigned int bus, unsigned int devfn)
+{
+       toplevel_node = prom_getchild(toplevel_node);
+
+       while (toplevel_node != 0) {
+               int ret = obp_find(pregs, toplevel_node, bus, devfn);
+
+               if (ret != 0)
+                       return ret;
+
+               ret = prom_getproperty(toplevel_node, "reg", (char *) pregs,
+                                      sizeof(*pregs) * PROMREG_MAX);
+               if (ret == 0 || ret == -1)
+                       goto next_sibling;
+
+               if (((pregs[0].phys_hi >> 16) & 0xff) == bus &&
+                   ((pregs[0].phys_hi >> 8) & 0xff) == devfn)
+                       break;
+
+       next_sibling:
+               toplevel_node = prom_getsibling(toplevel_node);
+       }
+
+       return toplevel_node;
+}
+
+static int pdev_htab_populate(struct pci_pbm_info *pbm)
+{
+       struct linux_prom_pci_registers pr[PROMREG_MAX];
+       u32 devhandle = pbm->devhandle;
+       unsigned int bus;
+
+       for (bus = pbm->pci_first_busno; bus <= pbm->pci_last_busno; bus++) {
+               unsigned int devfn;
+
+               for (devfn = 0; devfn < 256; devfn++) {
+                       unsigned int device = PCI_SLOT(devfn);
+                       unsigned int func = PCI_FUNC(devfn);
+
+                       if (obp_find(pr, pbm->prom_node, bus, devfn)) {
+                               int err = pdev_htab_add(devhandle, bus,
+                                                       device, func);
+                               if (err)
+                                       return err;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+static struct pdev_entry *pdev_find(u32 devhandle, unsigned int bus, unsigned int device, unsigned int func)
+{
+       struct pdev_entry *p;
+
+       p = pdev_htab[pdev_hashfn(devhandle, bus, device, func)];
+       while (p) {
+               if (p->devhandle == devhandle &&
+                   p->bus == bus &&
+                   p->device == device &&
+                   p->func == func)
+                       break;
+
+               p = p->next;
        }
 
+       return p;
+}
+
+static inline int pci_sun4v_out_of_range(struct pci_pbm_info *pbm, unsigned int bus, unsigned int device, unsigned int func)
+{
        if (bus < pbm->pci_first_busno ||
            bus > pbm->pci_last_busno)
                return 1;
-       return 0;
+       return pdev_find(pbm->devhandle, bus, device, func) == NULL;
 }
 
 static int pci_sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
@@ -1063,6 +1173,8 @@ static void pci_sun4v_pbm_init(struct pci_controller_info *p, int prom_node, u32
 
        pci_sun4v_get_bus_range(pbm);
        pci_sun4v_iommu_init(pbm);
+
+       pdev_htab_populate(pbm);
 }
 
 void sun4v_pci_init(int node, char *model_name)
index 005167f82419b475cb7ae1e4ef109610ba61a5dd..9cf1c88cd774ffbcbe3b58da0574986c4e6860ff 100644 (file)
@@ -220,7 +220,7 @@ char reboot_command[COMMAND_LINE_SIZE];
 
 static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
 
-static void __init per_cpu_patch(void)
+void __init per_cpu_patch(void)
 {
        struct cpuid_patch_entry *p;
        unsigned long ver;
@@ -280,7 +280,7 @@ static void __init per_cpu_patch(void)
        }
 }
 
-static void __init sun4v_patch(void)
+void __init sun4v_patch(void)
 {
        struct sun4v_1insn_patch_entry *p1;
        struct sun4v_2insn_patch_entry *p2;
@@ -315,6 +315,15 @@ static void __init sun4v_patch(void)
        }
 }
 
+#ifdef CONFIG_SMP
+void __init boot_cpu_id_too_large(int cpu)
+{
+       prom_printf("Serious problem, boot cpu id (%d) >= NR_CPUS (%d)\n",
+                   cpu, NR_CPUS);
+       prom_halt();
+}
+#endif
+
 void __init setup_arch(char **cmdline_p)
 {
        /* Initialize PROM console and command line. */
@@ -332,16 +341,6 @@ void __init setup_arch(char **cmdline_p)
        conswitchp = &prom_con;
 #endif
 
-       /* Work out if we are starfire early on */
-       check_if_starfire();
-
-       /* Now we know enough to patch the get_cpuid sequences
-        * used by trap code.
-        */
-       per_cpu_patch();
-
-       sun4v_patch();
-
        boot_flags_init(*cmdline_p);
 
        idprom_init();
index 90eaca3ec9a628c40ba90f27c2a89e825afdf736..f03d52d0b88dd73803cee49b98d9b0aeb90e5d92 100644 (file)
@@ -1264,7 +1264,6 @@ void __init smp_tick_init(void)
        boot_cpu_id = hard_smp_processor_id();
        current_tick_offset = timer_tick_offset;
 
-       cpu_set(boot_cpu_id, cpu_online_map);
        prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;
 }
 
@@ -1288,6 +1287,40 @@ int setup_profiling_timer(unsigned int multiplier)
        return 0;
 }
 
+static void __init smp_tune_scheduling(void)
+{
+       int instance, node;
+       unsigned int def, smallest = ~0U;
+
+       def = ((tlb_type == hypervisor) ?
+              (3 * 1024 * 1024) :
+              (4 * 1024 * 1024));
+
+       instance = 0;
+       while (!cpu_find_by_instance(instance, &node, NULL)) {
+               unsigned int val;
+
+               val = prom_getintdefault(node, "ecache-size", def);
+               if (val < smallest)
+                       smallest = val;
+
+               instance++;
+       }
+
+       /* Any value less than 256K is nonsense.  */
+       if (smallest < (256U * 1024U))
+               smallest = 256 * 1024;
+
+       max_cache_size = smallest;
+
+       if (smallest < 1U * 1024U * 1024U)
+               printk(KERN_INFO "Using max_cache_size of %uKB\n",
+                      smallest / 1024U);
+       else
+               printk(KERN_INFO "Using max_cache_size of %uMB\n",
+                      smallest / 1024U / 1024U);
+}
+
 /* Constrain the number of cpus to max_cpus.  */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
@@ -1323,6 +1356,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        }
 
        smp_store_cpu_info(boot_cpu_id);
+       smp_tune_scheduling();
 }
 
 /* Set this up early so that things like the scheduler can init
@@ -1345,18 +1379,6 @@ void __init smp_setup_cpu_possible_map(void)
 
 void __devinit smp_prepare_boot_cpu(void)
 {
-       int cpu = hard_smp_processor_id();
-
-       if (cpu >= NR_CPUS) {
-               prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
-               prom_halt();
-       }
-
-       current_thread_info()->cpu = cpu;
-       __local_per_cpu_offset = __per_cpu_offset(cpu);
-
-       cpu_set(smp_processor_id(), cpu_online_map);
-       cpu_set(smp_processor_id(), phys_cpu_present_map);
 }
 
 int __devinit __cpu_up(unsigned int cpu)
@@ -1433,4 +1455,7 @@ void __init setup_per_cpu_areas(void)
 
        for (i = 0; i < NR_CPUS; i++, ptr += size)
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+
+       /* Setup %g5 for the boot cpu.  */
+       __local_per_cpu_offset = __per_cpu_offset(smp_processor_id());
 }
index 62d8a99271eac044e66906d15f3435944eaa3845..38e569f786ddc490dc009c23640128589e6de6ec 100644 (file)
@@ -297,7 +297,6 @@ EXPORT_SYMBOL(svr4_getcontext);
 EXPORT_SYMBOL(svr4_setcontext);
 EXPORT_SYMBOL(compat_sys_ioctl);
 EXPORT_SYMBOL(sparc32_open);
-EXPORT_SYMBOL(sys_close);
 #endif
 
 /* Special internal versions of library functions. */
index d4b39cd30310047356858a500f696f234ce01509..1136fc465e37555431f2ebebd927aa32f61e41e3 100644 (file)
@@ -78,8 +78,9 @@ sys_call_table32:
        .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
 /*280*/        .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
        .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
-/*285*/        .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
+/*290*/        .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
        .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
+/*300*/        .word compat_sys_set_robust_list, compat_sys_get_robust_list
 
 #endif /* CONFIG_COMPAT */
 
@@ -147,8 +148,9 @@ sys_call_table:
        .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
 /*280*/        .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
        .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_fstatat64
-/*285*/        .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
+/*290*/        .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
        .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare
+/*300*/        .word sys_set_robust_list, sys_get_robust_list
 
 #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
     defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -261,5 +263,5 @@ sunos_sys_table:
 /*290*/        .word sunos_nosys, sunos_nosys, sunos_nosys
        .word sunos_nosys, sunos_nosys, sunos_nosys
        .word sunos_nosys, sunos_nosys, sunos_nosys
-       .word sunos_nosys
+       .word sunos_nosys, sunos_nosys, sunos_nosys
 #endif
index 2793a5d823803cb7b96055802935179d5e3d4333..563db528e031830cdcded747e7fa2ecae7e0ec31 100644 (file)
@@ -1797,7 +1797,9 @@ static const char *sun4v_err_type_to_str(u32 type)
        };
 }
 
-static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt)
+extern void __show_regs(struct pt_regs * regs);
+
+static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt)
 {
        int cnt;
 
@@ -1830,6 +1832,8 @@ static void sun4v_log_error(struct sun4v_error_entry *ent, int cpu, const char *
               pfx,
               ent->err_raddr, ent->err_size, ent->err_cpu);
 
+       __show_regs(regs);
+
        if ((cnt = atomic_read(ocnt)) != 0) {
                atomic_set(ocnt, 0);
                wmb();
@@ -1862,7 +1866,7 @@ void sun4v_resum_error(struct pt_regs *regs, unsigned long offset)
 
        put_cpu();
 
-       sun4v_log_error(&local_copy, cpu,
+       sun4v_log_error(regs, &local_copy, cpu,
                        KERN_ERR "RESUMABLE ERROR",
                        &sun4v_resum_oflow_cnt);
 }
@@ -1910,7 +1914,7 @@ void sun4v_nonresum_error(struct pt_regs *regs, unsigned long offset)
        }
 #endif
 
-       sun4v_log_error(&local_copy, cpu,
+       sun4v_log_error(regs, &local_copy, cpu,
                        KERN_EMERG "NON-RESUMABLE ERROR",
                        &sun4v_nonresum_oflow_cnt);
 
@@ -2200,7 +2204,6 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
 void die_if_kernel(char *str, struct pt_regs *regs)
 {
        static int die_counter;
-       extern void __show_regs(struct pt_regs * regs);
        extern void smp_report_regs(void);
        int count = 0;
        
index ba9cd3ccc2b26a3f25bd7a2653c1063bf69d61f1..1d230f693dc4b1806e4c80b8df2918abeee878b8 100644 (file)
@@ -165,8 +165,9 @@ csum_partial_end_cruft:
        sll             %g1, 8, %g1
        or              %o5, %g1, %o4
 
-1:     add             %o2, %o4, %o2
+1:     addcc           %o2, %o4, %o2
+       addc            %g0, %o2, %o2
 
 csum_partial_finish:
        retl
-        mov            %o2, %o0
+        srl            %o2, 0, %o0
index 71af488390646d4e7658af9b96c8240d87995c04..e566c770a0f6372de5e4e7856ff520a9ac8920ac 100644 (file)
@@ -221,11 +221,12 @@ FUNC_NAME:                /* %o0=src, %o1=dst, %o2=len, %o3=sum */
        sll             %g1, 8, %g1
        or              %o5, %g1, %o4
 
-1:     add             %o3, %o4, %o3
+1:     addcc           %o3, %o4, %o3
+       addc            %g0, %o3, %o3
 
 70:
        retl
-        mov            %o3, %o0
+        srl            %o3, 0, %o0
 
 95:    mov             0, GLOBAL_SPARE
        brlez,pn        %o2, 4f
index 7a0e04e34bf96f2cb4a89a6be34cfbe8f1e6cf90..b65ca115ef7778553473a157998ada3c54869051 100644 (file)
@@ -33,5 +33,9 @@ include $(srctree)/arch/i386/Makefile.cpu
 # prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
 cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
 
+# Prevent sprintf in nfsd from being converted to strcpy and resulting in
+# an unresolved reference.
+cflags-y += -ffreestanding
+
 CFLAGS += $(cflags-y)
 USER_CFLAGS += $(cflags-y)
index efa3d33c0be6577a6ab533449ce2ed34032957de..310980b3217395a591a0eeee7a748dcb4fdf2925 100644 (file)
@@ -120,20 +120,11 @@ extern int is_syscall(unsigned long addr);
 extern void free_irq(unsigned int, void *);
 extern int cpu(void);
 
+extern void time_init_kern(void);
+
 /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */
 extern int __cant_sleep(void);
 extern void segv_handler(int sig, union uml_pt_regs *regs);
 extern void sigio_handler(int sig, union uml_pt_regs *regs);
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index 528cf623f8b4144cbf77b4c0337a1ee6ab423185..86f51d04c98df366d7a139468cf3afb08c402251 100644 (file)
@@ -84,6 +84,16 @@ void timer_irq(union uml_pt_regs *regs)
        }
 }
 
+
+void time_init_kern(void)
+{
+       unsigned long long nsecs;
+
+       nsecs = os_nsecs();
+       set_normalized_timespec(&wall_to_monotonic, -nsecs / BILLION,
+                               -nsecs % BILLION);
+}
+
 void do_boot_timer_handler(struct sigcontext * sc)
 {
        struct pt_regs regs;
index 3a0ac38e978bffa982f68badb8e9dd1e168bd3f6..90912aaca7aa154ef577e63bbc0d9c6aa6d87800 100644 (file)
@@ -59,7 +59,7 @@ static __init void do_uml_initcalls(void)
        initcall_t *call;
 
        call = &__uml_initcall_start;
-       while (call < &__uml_initcall_end){;
+       while (call < &__uml_initcall_end){
                (*call)();
                call++;
        }
index 6f7626775acb983e7f2e663d2312533d80c1a792..280c4fb9b585a15813e4cf9669a0b3b258181623 100644 (file)
@@ -81,20 +81,12 @@ void uml_idle_timer(void)
        set_interval(ITIMER_REAL);
 }
 
-extern void ktime_get_ts(struct timespec *ts);
-#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
-
 void time_init(void)
 {
-       struct timespec now;
-
        if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR)
                panic("Couldn't set SIGVTALRM handler");
        set_interval(ITIMER_VIRTUAL);
-
-       do_posix_clock_monotonic_gettime(&now);
-       wall_to_monotonic.tv_sec = -now.tv_sec;
-       wall_to_monotonic.tv_nsec = -now.tv_nsec;
+       time_init_kern();
 }
 
 unsigned long long os_nsecs(void)
index 749dd1bfe60f9009127adfbd4a958173d280e1b7..710d5fb807e1d6b9ae7e24e7542814aa36b69348 100644 (file)
@@ -99,11 +99,12 @@ long sys_ipc (uint call, int first, int second,
 
        switch (call) {
        case SEMOP:
-               return sys_semtimedop(first, (struct sembuf *) ptr, second,
-                                     NULL);
+               return sys_semtimedop(first, (struct sembuf __user *) ptr,
+                                     second, NULL);
        case SEMTIMEDOP:
-               return sys_semtimedop(first, (struct sembuf *) ptr, second,
-                                     (const struct timespec *) fifth);
+               return sys_semtimedop(first, (struct sembuf __user *) ptr,
+                                     second,
+                                     (const struct timespec __user *) fifth);
        case SEMGET:
                return sys_semget (first, second, third);
        case SEMCTL: {
index a4c46a8af00842078fb03e2f36592f4706abf49c..9edf114faf79c571831fd1ca84127204094bb846 100644 (file)
@@ -21,7 +21,7 @@
 #include "skas.h"
 
 static int copy_sc_from_user_skas(struct pt_regs *regs,
-                                 struct sigcontext *from)
+                                 struct sigcontext __user *from)
 {
        int err = 0;
 
@@ -54,7 +54,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
        return(err);
 }
 
-int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
+int copy_sc_to_user_skas(struct sigcontext __user *to,
+                        struct _fpstate __user *to_fp,
                         struct pt_regs *regs, unsigned long mask,
                         unsigned long sp)
 {
@@ -106,10 +107,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
 #endif
 
 #ifdef CONFIG_MODE_TT
-int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
+int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
                         int fpsize)
 {
-       struct _fpstate *to_fp, *from_fp;
+       struct _fpstate *to_fp;
+       struct _fpstate __user *from_fp;
        unsigned long sigs;
        int err;
 
@@ -124,13 +126,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
        return(err);
 }
 
-int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
+int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp,
                       struct sigcontext *from, int fpsize, unsigned long sp)
 {
-       struct _fpstate *to_fp, *from_fp;
+       struct _fpstate __user *to_fp;
+       struct _fpstate *from_fp;
        int err;
 
-       to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
+       to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
        from_fp = from->fpstate;
        err = copy_to_user(to, from, sizeof(*to));
        /* The SP in the sigcontext is the updated one for the signal
@@ -158,7 +161,8 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
        return(ret);
 }
 
-static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
+static int copy_sc_to_user(struct sigcontext __user *to,
+                          struct _fpstate __user *fp,
                           struct pt_regs *from, unsigned long mask,
                           unsigned long sp)
 {
@@ -169,7 +173,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
 
 struct rt_sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        struct ucontext uc;
        struct siginfo info;
 };
@@ -188,7 +192,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
 
        frame = (struct rt_sigframe __user *)
                round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
-        frame = (struct rt_sigframe *) ((unsigned long) frame - 128);
+        frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128);
 
        if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
                goto out;
index 6acee5c4ada6fcdff56ddd95313865dd295df508..6fce9f45dfdc0257aafafaf543afffcfc42127e3 100644 (file)
@@ -45,7 +45,7 @@ static long arch_prctl_tt(int code, unsigned long addr)
        case ARCH_GET_GS:
                ret = arch_prctl(code, (unsigned long) &tmp);
                if(!ret)
-                       ret = put_user(tmp, &addr);
+                       ret = put_user(tmp, (long __user *)addr);
                break;
        default:
                ret = -EINVAL;
index 408d44a59756f8050c4455fdbb471eb9c9881f09..6527a368fb9ca786489ec6ce9bb39e935aaf2b37 100644 (file)
@@ -299,6 +299,7 @@ config X86_64_ACPI_NUMA
        bool "ACPI NUMA detection"
        depends on NUMA
        select ACPI 
+       select PCI
        select ACPI_NUMA
        default y
        help
index e776139afb2019e804d65ddd468a834ee04d6ed1..926c4743d13b27220cd00494a99f3eb2d74a1ff1 100644 (file)
@@ -339,7 +339,7 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top,
        struct mm_struct *mm = current->mm;
        int i, ret;
 
-       stack_base = IA32_STACK_TOP - MAX_ARG_PAGES * PAGE_SIZE;
+       stack_base = stack_top - MAX_ARG_PAGES * PAGE_SIZE;
        mm->arg_start = bprm->p + stack_base;
 
        bprm->p += stack_base;
@@ -357,7 +357,7 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top,
        {
                mpnt->vm_mm = mm;
                mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
-               mpnt->vm_end = IA32_STACK_TOP;
+               mpnt->vm_end = stack_top;
                if (executable_stack == EXSTACK_ENABLE_X)
                        mpnt->vm_flags = VM_STACK_FLAGS |  VM_EXEC;
                else if (executable_stack == EXSTACK_DISABLE_X)
index 4fe97071f2974f28aaa2fb8ab1f9a7ebd292dfed..080b9963f1bc1a6f0213a8a59b7ef8898f6d829c 100644 (file)
@@ -4,5 +4,6 @@ obj-$(CONFIG_ACPI_SLEEP)        += sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y                  += processor.o
+processor-y            := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o
 endif
 
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c
deleted file mode 100644 (file)
index 3bdc2ba..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * arch/x86_64/kernel/acpi/processor.c
- *
- * Copyright (C) 2005 Intel Corporation
- *     Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
- *     - Added _PDC for platforms with Intel CPUs
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/acpi.h>
-
-#include <acpi/processor.h>
-#include <asm/acpi.h>
-
-static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
-{
-       struct acpi_object_list *obj_list;
-       union acpi_object *obj;
-       u32 *buf;
-
-       /* allocate and initialize pdc. It will be used later. */
-       obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
-       if (!obj_list) {
-               printk(KERN_ERR "Memory allocation error\n");
-               return;
-       }
-
-       obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
-       if (!obj) {
-               printk(KERN_ERR "Memory allocation error\n");
-               kfree(obj_list);
-               return;
-       }
-
-       buf = kmalloc(12, GFP_KERNEL);
-       if (!buf) {
-               printk(KERN_ERR "Memory allocation error\n");
-               kfree(obj);
-               kfree(obj_list);
-               return;
-       }
-
-       buf[0] = ACPI_PDC_REVISION_ID;
-       buf[1] = 1;
-       buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
-
-       obj->type = ACPI_TYPE_BUFFER;
-       obj->buffer.length = 12;
-       obj->buffer.pointer = (u8 *) buf;
-       obj_list->count = 1;
-       obj_list->pointer = obj;
-       pr->pdc = obj_list;
-
-       return;
-}
-
-/* Initialize _PDC data based on the CPU vendor */
-void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
-{
-       unsigned int cpu = pr->id;
-       struct cpuinfo_x86 *c = cpu_data + cpu;
-
-       pr->pdc = NULL;
-       if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
-               init_intel_pdc(pr, c);
-
-       return;
-}
-
-EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
index 222b5b46d2b2df6546ab01e67be1d1b92d713667..1ef6028f721ea843936b4994581c67dfa7e1b9c6 100644 (file)
@@ -149,7 +149,7 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, unsi
                        addr = start;
                if (addr > ei->addr + ei->size) 
                        continue; 
-               while (bad_addr(&addr, size) && addr+size < ei->addr + ei->size)
+               while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size)
                        ;
                last = addr + size;
                if (last > ei->addr + ei->size)
index c946e4fe67a7937ab15eba697246602c7dc67dbd..586b34c00c489a2d3d495a904c00b158a1abfba4 100644 (file)
@@ -281,12 +281,7 @@ tracesys:
        ja  1f
        movq %r10,%rcx  /* fixup for C */
        call *sys_call_table(,%rax,8)
-       movq %rax,RAX-ARGOFFSET(%rsp)
-1:     SAVE_REST
-       movq %rsp,%rdi
-       call syscall_trace_leave
-       RESTORE_TOP_OF_STACK %rbx
-       RESTORE_REST
+1:     movq %rax,RAX-ARGOFFSET(%rsp)
        /* Use IRET because user could have changed frame */
        jmp int_ret_from_sys_call
        CFI_ENDPROC
index 0de3ea938830f6f8934e39a537fecaec6237b29e..9cc7031b715178cb069243fffb1bdbbe49483e1e 100644 (file)
@@ -271,6 +271,18 @@ __setup("enable_8254_timer", setup_enable_8254_timer);
 #include <linux/pci_ids.h>
 #include <linux/pci.h>
 
+
+#ifdef CONFIG_ACPI
+
+static int nvidia_hpet_detected __initdata;
+
+static int __init nvidia_hpet_check(unsigned long phys, unsigned long size)
+{
+       nvidia_hpet_detected = 1;
+       return 0;
+}
+#endif
+
 /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC
    off. Check for an Nvidia or VIA PCI bridge and turn it off.
    Use pci direct infrastructure because this runs before the PCI subsystem. 
@@ -317,11 +329,19 @@ void __init check_ioapic(void)
                                        return;
                                case PCI_VENDOR_ID_NVIDIA:
 #ifdef CONFIG_ACPI
-                                       /* All timer overrides on Nvidia
-                                          seem to be wrong. Skip them. */
-                                       acpi_skip_timer_override = 1;
-                                       printk(KERN_INFO 
-            "Nvidia board detected. Ignoring ACPI timer override.\n");
+                                       /*
+                                        * All timer overrides on Nvidia are
+                                        * wrong unless HPET is enabled.
+                                        */
+                                       nvidia_hpet_detected = 0;
+                                       acpi_table_parse(ACPI_HPET,
+                                                       nvidia_hpet_check);
+                                       if (nvidia_hpet_detected == 0) {
+                                               acpi_skip_timer_override = 1;
+                                               printk(KERN_INFO "Nvidia board "
+                                                   "detected. Ignoring ACPI "
+                                                   "timer override.\n");
+                                       }
 #endif
                                        /* RED-PEN skip them on mptables too? */
                                        return;
index 1eaa5dae6174ff57b514a56828f07e6f8ed0a149..fa1d19ca700ae82a23df77f068bee660e47f80f2 100644 (file)
@@ -514,13 +514,13 @@ static void __kprobes resume_execution(struct kprobe *p,
                *tos = orig_rip + (*tos - copy_rip);
                break;
        case 0xff:
-               if ((*insn & 0x30) == 0x10) {
+               if ((insn[1] & 0x30) == 0x10) {
                        /* call absolute, indirect */
                        /* Fix return addr; rip is correct. */
                        next_rip = regs->rip;
                        *tos = orig_rip + (*tos - copy_rip);
-               } else if (((*insn & 0x31) == 0x20) ||  /* jmp near, absolute indirect */
-                          ((*insn & 0x31) == 0x21)) {  /* jmp far, absolute indirect */
+               } else if (((insn[1] & 0x31) == 0x20) ||        /* jmp near, absolute indirect */
+                          ((insn[1] & 0x31) == 0x21)) {        /* jmp far, absolute indirect */
                        /* rip is correct. */
                        next_rip = regs->rip;
                }
index af035ede70cd43386f240438e2192cb343cab750..a9275c9557cf432ea3187f806c15fb369d72b312 100644 (file)
@@ -54,6 +54,10 @@ dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
        else
 #endif
                node = numa_node_id();
+
+       if (node < first_node(node_online_map))
+               node = first_node(node_online_map);
+
        page = alloc_pages_node(node, gfp, order);
        return page ? page_address(page) : NULL;
 }
index 2480d3f08a470865b90f1dd8cb35e2c6c30a9e1a..82a7c9bfdfa0f3e0bd1945225fd0f86df67b1c96 100644 (file)
@@ -631,10 +631,8 @@ static int __init pci_iommu_init(void)
                printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
                if (end_pfn > MAX_DMA32_PFN) {
                        printk(KERN_ERR "WARNING more than 4GB of memory "
-                                       "but IOMMU not compiled in.\n"
-                              KERN_ERR "WARNING 32bit PCI may malfunction.\n"
-                              KERN_ERR "You might want to enable "
-                                       "CONFIG_GART_IOMMU\n");
+                                       "but IOMMU not available.\n"
+                              KERN_ERR "WARNING 32bit PCI may malfunction.\n");
                }
                return -1;
        }
index 44adcc2d5e5be43299d8f640161c6ec50658c285..1f6ecc62061d9121633e53edf672dec81b2da7c3 100644 (file)
@@ -12,9 +12,10 @@ static int
 check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
 {
         if (hwdev && bus + size > *hwdev->dma_mask) {
-               printk(KERN_ERR
-                   "nommu_%s: overflow %Lx+%lu of device mask %Lx\n",
-              name, (long long)bus, size, (long long)*hwdev->dma_mask);
+               if (*hwdev->dma_mask >= 0xffffffffULL)
+                       printk(KERN_ERR
+                           "nommu_%s: overflow %Lx+%lu of device mask %Lx\n",
+                               name, (long long)bus, size, (long long)*hwdev->dma_mask);
                return 0;
        }
        return 1;
index b0444a415bd60670a2314d9e0f9c0c54641a7e56..bf421ed26808cec48cc9ca1207865bcee52f0f07 100644 (file)
@@ -68,7 +68,7 @@ int pmtimer_mark_offset(void)
        offset_delay = delta % (USEC_PER_SEC / HZ);
 
        rdtscll(tsc);
-       vxtime.last_tsc = tsc - offset_delay * cpu_khz;
+       vxtime.last_tsc = tsc - offset_delay * (u64)cpu_khz / 1000;
 
        /* don't calculate delay for first run,
           or if we've got less then a tick */
index f0870bef24d114b521f625952b79e973ed2a5e1c..655b9192eeb3727d85a8921d10cdd4049c2a5232 100644 (file)
@@ -1051,7 +1051,7 @@ static void srat_detect_node(void)
           for now. */
        node = apicid_to_node[hard_smp_processor_id()];
        if (node == NUMA_NO_NODE)
-               node = 0;
+               node = first_node(node_online_map);
        numa_set_node(cpu, node);
 
        if (acpi_numa > 0)
index 6b87268c5c2e8711e16c3066e1661828ddb3f7a9..cea335e8746ca451b6b8571dfa052785e07a27aa 100644 (file)
@@ -102,6 +102,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
        if (regs->eflags & X86_EFLAGS_IF)
                local_irq_disable();
+       /* Make sure to not schedule here because we could be running
+          on an exception stack. */
        preempt_enable_no_resched();
 }
 
@@ -483,8 +485,6 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
 {
        struct task_struct *tsk = current;
 
-       conditional_sti(regs);
-
        tsk->thread.error_code = error_code;
        tsk->thread.trap_no = trapnr;
 
@@ -521,6 +521,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                        == NOTIFY_STOP) \
                return; \
+       conditional_sti(regs);                                          \
        do_trap(trapnr, signr, str, regs, error_code, NULL); \
 }
 
@@ -535,6 +536,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                        == NOTIFY_STOP) \
                return; \
+       conditional_sti(regs);                                          \
        do_trap(trapnr, signr, str, regs, error_code, &info); \
 }
 
@@ -548,7 +550,17 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
 DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
 DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
 DO_ERROR(18, SIGSEGV, "reserved", reserved)
-DO_ERROR(12, SIGBUS,  "stack segment", stack_segment)
+
+/* Runs on IST stack */
+asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
+{
+       if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
+                       12, SIGBUS) == NOTIFY_STOP)
+               return;
+       preempt_conditional_sti(regs);
+       do_trap(12, SIGBUS, "stack segment", regs, error_code, NULL);
+       preempt_conditional_cli(regs);
+}
 
 asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
 {
@@ -682,8 +694,9 @@ asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
        if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
                return;
        }
+       preempt_conditional_sti(regs);
        do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);
-       return;
+       preempt_conditional_cli(regs);
 }
 
 /* Help handler running on IST stack to switch back to user stack
index 15ae9fcd65a700c9f9060860f0fce56f7f6f3fcf..474df22c6ed20fb7aa0f2b6e503dc232d0ec3050 100644 (file)
@@ -34,7 +34,10 @@ static nodemask_t nodes_found __initdata;
 static struct bootnode nodes[MAX_NUMNODES] __initdata;
 static struct bootnode nodes_add[MAX_NUMNODES] __initdata;
 static int found_add_area __initdata;
-int hotadd_percent __initdata = 10;
+int hotadd_percent __initdata = 0;
+#ifndef RESERVE_HOTADD
+#define hotadd_percent 0       /* Ignore all settings */
+#endif
 static u8 pxm2node[256] = { [0 ... 255] = 0xff };
 
 /* Too small nodes confuse the VM badly. Usually they result
@@ -103,6 +106,7 @@ static __init void bad_srat(void)
        int i;
        printk(KERN_ERR "SRAT: SRAT not used.\n");
        acpi_numa = -1;
+       found_add_area = 0;
        for (i = 0; i < MAX_LOCAL_APIC; i++)
                apicid_to_node[i] = NUMA_NO_NODE;
        for (i = 0; i < MAX_NUMNODES; i++)
@@ -154,7 +158,8 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
        int pxm, node;
        if (srat_disabled())
                return;
-       if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) {                bad_srat();
+       if (pa->header.length != sizeof(struct acpi_table_processor_affinity)) {
+               bad_srat();
                return;
        }
        if (pa->flags.enabled == 0)
@@ -191,15 +196,17 @@ static int hotadd_enough_memory(struct bootnode *nd)
        allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE;
        allowed = (allowed / 100) * hotadd_percent;
        if (allocated + mem > allowed) {
+               unsigned long range;
                /* Give them at least part of their hotadd memory upto hotadd_percent
                   It would be better to spread the limit out
                   over multiple hotplug areas, but that is too complicated
                   right now */
                if (allocated >= allowed)
                        return 0;
-               pages = (allowed - allocated + mem) / sizeof(struct page);
+               range = allowed - allocated;
+               pages = (range / PAGE_SIZE);
                mem = pages * sizeof(struct page);
-               nd->end = nd->start + pages*PAGE_SIZE;
+               nd->end = nd->start + range;
        }
        /* Not completely fool proof, but a good sanity check */
        addr = find_e820_area(last_area_end, end_pfn<<PAGE_SHIFT, mem);
@@ -392,8 +399,10 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
        /* First clean up the node list */
        for (i = 0; i < MAX_NUMNODES; i++) {
                cutoff_node(i, start, end);
-               if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE)
+               if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) {
                        unparse_node(i);
+                       node_set_offline(i);
+               }
        }
 
        if (acpi_numa <= 0)
index e25a5d79ab2715b2f3a07ce3331e46cd45ab86f1..a7caf35ca0c2258e03575b03d503c102f951b938 100644 (file)
@@ -1648,17 +1648,17 @@ static void as_exit_queue(elevator_t *e)
  * initialize elevator private data (as_data), and alloc a arq for
  * each request on the free lists
  */
-static int as_init_queue(request_queue_t *q, elevator_t *e)
+static void *as_init_queue(request_queue_t *q, elevator_t *e)
 {
        struct as_data *ad;
        int i;
 
        if (!arq_pool)
-               return -ENOMEM;
+               return NULL;
 
        ad = kmalloc_node(sizeof(*ad), GFP_KERNEL, q->node);
        if (!ad)
-               return -ENOMEM;
+               return NULL;
        memset(ad, 0, sizeof(*ad));
 
        ad->q = q; /* Identify what queue the data belongs to */
@@ -1667,7 +1667,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
                                GFP_KERNEL, q->node);
        if (!ad->hash) {
                kfree(ad);
-               return -ENOMEM;
+               return NULL;
        }
 
        ad->arq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
@@ -1675,7 +1675,7 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
        if (!ad->arq_pool) {
                kfree(ad->hash);
                kfree(ad);
-               return -ENOMEM;
+               return NULL;
        }
 
        /* anticipatory scheduling helpers */
@@ -1696,14 +1696,13 @@ static int as_init_queue(request_queue_t *q, elevator_t *e)
        ad->antic_expire = default_antic_expire;
        ad->batch_expire[REQ_SYNC] = default_read_batch_expire;
        ad->batch_expire[REQ_ASYNC] = default_write_batch_expire;
-       e->elevator_data = ad;
 
        ad->current_batch_expires = jiffies + ad->batch_expire[REQ_SYNC];
        ad->write_batch_count = ad->batch_expire[REQ_ASYNC] / 10;
        if (ad->write_batch_count < 2)
                ad->write_batch_count = 2;
 
-       return 0;
+       return ad;
 }
 
 /*
index 2540dfaa3e385def27a44284bf3e552f986ee15d..052b17487625f0edf905feb1beadaec7c8e5fa96 100644 (file)
@@ -33,7 +33,7 @@ static int cfq_slice_idle = HZ / 70;
 
 #define CFQ_KEY_ASYNC          (0)
 
-static DEFINE_RWLOCK(cfq_exit_lock);
+static DEFINE_SPINLOCK(cfq_exit_lock);
 
 /*
  * for the hash of cfqq inside the cfqd
@@ -133,6 +133,7 @@ struct cfq_data {
        mempool_t *crq_pool;
 
        int rq_in_driver;
+       int hw_tag;
 
        /*
         * schedule slice state info
@@ -500,10 +501,13 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted)
 
        /*
         * if queue was preempted, just add to front to be fair. busy_rr
-        * isn't sorted.
+        * isn't sorted, but insert at the back for fairness.
         */
        if (preempted || list == &cfqd->busy_rr) {
-               list_add(&cfqq->cfq_list, list);
+               if (preempted)
+                       list = list->prev;
+
+               list_add_tail(&cfqq->cfq_list, list);
                return;
        }
 
@@ -664,6 +668,15 @@ static void cfq_activate_request(request_queue_t *q, struct request *rq)
        struct cfq_data *cfqd = q->elevator->elevator_data;
 
        cfqd->rq_in_driver++;
+
+       /*
+        * If the depth is larger 1, it really could be queueing. But lets
+        * make the mark a little higher - idling could still be good for
+        * low queueing, and a low queueing number could also just indicate
+        * a SCSI mid layer like behaviour where limit+1 is often seen.
+        */
+       if (!cfqd->hw_tag && cfqd->rq_in_driver > 4)
+               cfqd->hw_tag = 1;
 }
 
 static void cfq_deactivate_request(request_queue_t *q, struct request *rq)
@@ -878,6 +891,13 @@ static struct cfq_queue *cfq_set_active_queue(struct cfq_data *cfqd)
        if (!list_empty(&cfqd->cur_rr) || cfq_get_next_prio_level(cfqd) != -1)
                cfqq = list_entry_cfqq(cfqd->cur_rr.next);
 
+       /*
+        * If no new queues are available, check if the busy list has some
+        * before falling back to idle io.
+        */
+       if (!cfqq && !list_empty(&cfqd->busy_rr))
+               cfqq = list_entry_cfqq(cfqd->busy_rr.next);
+
        /*
         * if we have idle queues and no rt or be queues had pending
         * requests, either allow immediate service if the grace period
@@ -1284,7 +1304,7 @@ static void cfq_exit_io_context(struct io_context *ioc)
        /*
         * put the reference this task is holding to the various queues
         */
-       read_lock_irqsave(&cfq_exit_lock, flags);
+       spin_lock_irqsave(&cfq_exit_lock, flags);
 
        n = rb_first(&ioc->cic_root);
        while (n != NULL) {
@@ -1294,7 +1314,7 @@ static void cfq_exit_io_context(struct io_context *ioc)
                n = rb_next(n);
        }
 
-       read_unlock_irqrestore(&cfq_exit_lock, flags);
+       spin_unlock_irqrestore(&cfq_exit_lock, flags);
 }
 
 static struct cfq_io_context *
@@ -1303,17 +1323,12 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
        struct cfq_io_context *cic = kmem_cache_alloc(cfq_ioc_pool, gfp_mask);
 
        if (cic) {
-               RB_CLEAR(&cic->rb_node);
-               cic->key = NULL;
-               cic->cfqq[ASYNC] = NULL;
-               cic->cfqq[SYNC] = NULL;
+               memset(cic, 0, sizeof(*cic));
+               RB_CLEAR_COLOR(&cic->rb_node);
                cic->last_end_request = jiffies;
-               cic->ttime_total = 0;
-               cic->ttime_samples = 0;
-               cic->ttime_mean = 0;
+               INIT_LIST_HEAD(&cic->queue_list);
                cic->dtor = cfq_free_io_context;
                cic->exit = cfq_exit_io_context;
-               INIT_LIST_HEAD(&cic->queue_list);
                atomic_inc(&ioc_count);
        }
 
@@ -1400,17 +1415,17 @@ static int cfq_ioc_set_ioprio(struct io_context *ioc, unsigned int ioprio)
        struct cfq_io_context *cic;
        struct rb_node *n;
 
-       write_lock(&cfq_exit_lock);
+       spin_lock(&cfq_exit_lock);
 
        n = rb_first(&ioc->cic_root);
        while (n != NULL) {
                cic = rb_entry(n, struct cfq_io_context, rb_node);
+
                changed_ioprio(cic);
                n = rb_next(n);
        }
 
-       write_unlock(&cfq_exit_lock);
+       spin_unlock(&cfq_exit_lock);
 
        return 0;
 }
@@ -1458,7 +1473,8 @@ retry:
                 * set ->slice_left to allow preemption for a new process
                 */
                cfqq->slice_left = 2 * cfqd->cfq_slice_idle;
-               cfq_mark_cfqq_idle_window(cfqq);
+               if (!cfqd->hw_tag)
+                       cfq_mark_cfqq_idle_window(cfqq);
                cfq_mark_cfqq_prio_changed(cfqq);
                cfq_init_prio_data(cfqq);
        }
@@ -1475,9 +1491,10 @@ out:
 static void
 cfq_drop_dead_cic(struct io_context *ioc, struct cfq_io_context *cic)
 {
-       read_lock(&cfq_exit_lock);
+       spin_lock(&cfq_exit_lock);
        rb_erase(&cic->rb_node, &ioc->cic_root);
-       read_unlock(&cfq_exit_lock);
+       list_del_init(&cic->queue_list);
+       spin_unlock(&cfq_exit_lock);
        kmem_cache_free(cfq_ioc_pool, cic);
        atomic_dec(&ioc_count);
 }
@@ -1545,11 +1562,11 @@ restart:
                        BUG();
        }
 
-       read_lock(&cfq_exit_lock);
+       spin_lock(&cfq_exit_lock);
        rb_link_node(&cic->rb_node, parent, p);
        rb_insert_color(&cic->rb_node, &ioc->cic_root);
        list_add(&cic->queue_list, &cfqd->cic_list);
-       read_unlock(&cfq_exit_lock);
+       spin_unlock(&cfq_exit_lock);
 }
 
 /*
@@ -1648,7 +1665,7 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 {
        int enable_idle = cfq_cfqq_idle_window(cfqq);
 
-       if (!cic->ioc->task || !cfqd->cfq_slice_idle)
+       if (!cic->ioc->task || !cfqd->cfq_slice_idle || cfqd->hw_tag)
                enable_idle = 0;
        else if (sample_valid(cic->ttime_samples)) {
                if (cic->ttime_mean > cfqd->cfq_slice_idle)
@@ -1739,14 +1756,24 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 
        cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq);
 
+       cic = crq->io_context;
+
        /*
         * we never wait for an async request and we don't allow preemption
         * of an async request. so just return early
         */
-       if (!cfq_crq_is_sync(crq))
+       if (!cfq_crq_is_sync(crq)) {
+               /*
+                * sync process issued an async request, if it's waiting
+                * then expire it and kick rq handling.
+                */
+               if (cic == cfqd->active_cic &&
+                   del_timer(&cfqd->idle_slice_timer)) {
+                       cfq_slice_expired(cfqd, 0);
+                       cfq_start_queueing(cfqd, cfqq);
+               }
                return;
-
-       cic = crq->io_context;
+       }
 
        cfq_update_io_thinktime(cfqd, cic);
        cfq_update_io_seektime(cfqd, cic, crq);
@@ -2164,10 +2191,9 @@ static void cfq_idle_class_timer(unsigned long data)
         * race with a non-idle queue, reset timer
         */
        end = cfqd->last_end_request + CFQ_IDLE_GRACE;
-       if (!time_after_eq(jiffies, end)) {
-               cfqd->idle_class_timer.expires = end;
-               add_timer(&cfqd->idle_class_timer);
-       } else
+       if (!time_after_eq(jiffies, end))
+               mod_timer(&cfqd->idle_class_timer, end);
+       else
                cfq_schedule_dispatch(cfqd);
 
        spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);
@@ -2187,7 +2213,7 @@ static void cfq_exit_queue(elevator_t *e)
 
        cfq_shutdown_timer_wq(cfqd);
 
-       write_lock(&cfq_exit_lock);
+       spin_lock(&cfq_exit_lock);
        spin_lock_irq(q->queue_lock);
 
        if (cfqd->active_queue)
@@ -2210,7 +2236,7 @@ static void cfq_exit_queue(elevator_t *e)
        }
 
        spin_unlock_irq(q->queue_lock);
-       write_unlock(&cfq_exit_lock);
+       spin_unlock(&cfq_exit_lock);
 
        cfq_shutdown_timer_wq(cfqd);
 
@@ -2220,14 +2246,14 @@ static void cfq_exit_queue(elevator_t *e)
        kfree(cfqd);
 }
 
-static int cfq_init_queue(request_queue_t *q, elevator_t *e)
+static void *cfq_init_queue(request_queue_t *q, elevator_t *e)
 {
        struct cfq_data *cfqd;
        int i;
 
        cfqd = kmalloc(sizeof(*cfqd), GFP_KERNEL);
        if (!cfqd)
-               return -ENOMEM;
+               return NULL;
 
        memset(cfqd, 0, sizeof(*cfqd));
 
@@ -2257,8 +2283,6 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
        for (i = 0; i < CFQ_QHASH_ENTRIES; i++)
                INIT_HLIST_HEAD(&cfqd->cfq_hash[i]);
 
-       e->elevator_data = cfqd;
-
        cfqd->queue = q;
 
        cfqd->max_queued = q->nr_requests / 4;
@@ -2285,14 +2309,14 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
        cfqd->cfq_slice_async_rq = cfq_slice_async_rq;
        cfqd->cfq_slice_idle = cfq_slice_idle;
 
-       return 0;
+       return cfqd;
 out_crqpool:
        kfree(cfqd->cfq_hash);
 out_cfqhash:
        kfree(cfqd->crq_hash);
 out_crqhash:
        kfree(cfqd);
-       return -ENOMEM;
+       return NULL;
 }
 
 static void cfq_slab_kill(void)
index 399fa1e60e1fd6b7ca8200b7d5ef14a67b0b7672..3bd0415a9828673c6bb28a6cd52d1fe6fac730d2 100644 (file)
@@ -613,24 +613,24 @@ static void deadline_exit_queue(elevator_t *e)
  * initialize elevator private data (deadline_data), and alloc a drq for
  * each request on the free lists
  */
-static int deadline_init_queue(request_queue_t *q, elevator_t *e)
+static void *deadline_init_queue(request_queue_t *q, elevator_t *e)
 {
        struct deadline_data *dd;
        int i;
 
        if (!drq_pool)
-               return -ENOMEM;
+               return NULL;
 
        dd = kmalloc_node(sizeof(*dd), GFP_KERNEL, q->node);
        if (!dd)
-               return -ENOMEM;
+               return NULL;
        memset(dd, 0, sizeof(*dd));
 
        dd->hash = kmalloc_node(sizeof(struct list_head)*DL_HASH_ENTRIES,
                                GFP_KERNEL, q->node);
        if (!dd->hash) {
                kfree(dd);
-               return -ENOMEM;
+               return NULL;
        }
 
        dd->drq_pool = mempool_create_node(BLKDEV_MIN_RQ, mempool_alloc_slab,
@@ -638,7 +638,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e)
        if (!dd->drq_pool) {
                kfree(dd->hash);
                kfree(dd);
-               return -ENOMEM;
+               return NULL;
        }
 
        for (i = 0; i < DL_HASH_ENTRIES; i++)
@@ -653,8 +653,7 @@ static int deadline_init_queue(request_queue_t *q, elevator_t *e)
        dd->writes_starved = writes_starved;
        dd->front_merges = 1;
        dd->fifo_batch = fifo_batch;
-       e->elevator_data = dd;
-       return 0;
+       return dd;
 }
 
 static void deadline_put_request(request_queue_t *q, struct request *rq)
index 8768a367fdded922a17b1c7c47ac24ec993a1628..a0afdd317ceffb3d59f230c775da6c03740a426f 100644 (file)
@@ -121,16 +121,16 @@ static struct elevator_type *elevator_get(const char *name)
        return e;
 }
 
-static int elevator_attach(request_queue_t *q, struct elevator_queue *eq)
+static void *elevator_init_queue(request_queue_t *q, struct elevator_queue *eq)
 {
-       int ret = 0;
+       return eq->ops->elevator_init_fn(q, eq);
+}
 
+static void elevator_attach(request_queue_t *q, struct elevator_queue *eq,
+                          void *data)
+{
        q->elevator = eq;
-
-       if (eq->ops->elevator_init_fn)
-               ret = eq->ops->elevator_init_fn(q, eq);
-
-       return ret;
+       eq->elevator_data = data;
 }
 
 static char chosen_elevator[16];
@@ -181,6 +181,7 @@ int elevator_init(request_queue_t *q, char *name)
        struct elevator_type *e = NULL;
        struct elevator_queue *eq;
        int ret = 0;
+       void *data;
 
        INIT_LIST_HEAD(&q->queue_head);
        q->last_merge = NULL;
@@ -202,10 +203,13 @@ int elevator_init(request_queue_t *q, char *name)
        if (!eq)
                return -ENOMEM;
 
-       ret = elevator_attach(q, eq);
-       if (ret)
+       data = elevator_init_queue(q, eq);
+       if (!data) {
                kobject_put(&eq->kobj);
+               return -ENOMEM;
+       }
 
+       elevator_attach(q, eq, data);
        return ret;
 }
 
@@ -722,13 +726,16 @@ int elv_register_queue(struct request_queue *q)
        return error;
 }
 
+static void __elv_unregister_queue(elevator_t *e)
+{
+       kobject_uevent(&e->kobj, KOBJ_REMOVE);
+       kobject_del(&e->kobj);
+}
+
 void elv_unregister_queue(struct request_queue *q)
 {
-       if (q) {
-               elevator_t *e = q->elevator;
-               kobject_uevent(&e->kobj, KOBJ_REMOVE);
-               kobject_del(&e->kobj);
-       }
+       if (q)
+               __elv_unregister_queue(q->elevator);
 }
 
 int elv_register(struct elevator_type *e)
@@ -780,6 +787,7 @@ EXPORT_SYMBOL_GPL(elv_unregister);
 static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
 {
        elevator_t *old_elevator, *e;
+       void *data;
 
        /*
         * Allocate new elevator
@@ -788,6 +796,12 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
        if (!e)
                return 0;
 
+       data = elevator_init_queue(q, e);
+       if (!data) {
+               kobject_put(&e->kobj);
+               return 0;
+       }
+
        /*
         * Turn on BYPASS and drain all requests w/ elevator private data
         */
@@ -806,19 +820,19 @@ static int elevator_switch(request_queue_t *q, struct elevator_type *new_e)
                elv_drain_elevator(q);
        }
 
-       spin_unlock_irq(q->queue_lock);
-
        /*
-        * unregister old elevator data
+        * Remember old elevator.
         */
-       elv_unregister_queue(q);
        old_elevator = q->elevator;
 
        /*
         * attach and start new elevator
         */
-       if (elevator_attach(q, e))
-               goto fail;
+       elevator_attach(q, e, data);
+
+       spin_unlock_irq(q->queue_lock);
+
+       __elv_unregister_queue(old_elevator);
 
        if (elv_register_queue(q))
                goto fail_register;
@@ -837,7 +851,6 @@ fail_register:
         */
        elevator_exit(e);
        e = NULL;
-fail:
        q->elevator = old_elevator;
        elv_register_queue(q);
        clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
index d96572589621e10ecae8107616459f227e3be111..5a8d3bf02f1715702fe94515339f1cdfbfd3d088 100644 (file)
@@ -182,7 +182,6 @@ static int exact_lock(dev_t dev, void *data)
  */
 void add_disk(struct gendisk *disk)
 {
-       get_device(disk->driverfs_dev);
        disk->flags |= GENHD_FL_UP;
        blk_register_region(MKDEV(disk->major, disk->first_minor),
                            disk->minors, NULL, exact_match, exact_lock, disk);
@@ -428,7 +427,6 @@ static struct attribute * default_attrs[] = {
 static void disk_release(struct kobject * kobj)
 {
        struct gendisk *disk = to_disk(kobj);
-       put_device(disk->driverfs_dev);
        kfree(disk->random);
        kfree(disk->part);
        free_disk_stats(disk);
index eac48bec14791533a594af0e2909b7ed5347c091..7eb36c53f4b7868247141a105ef82e8be3e2d96f 100644 (file)
@@ -3452,7 +3452,12 @@ void end_that_request_last(struct request *req, int uptodate)
        if (unlikely(laptop_mode) && blk_fs_request(req))
                laptop_io_completion();
 
-       if (disk && blk_fs_request(req)) {
+       /*
+        * Account IO completion.  bar_rq isn't accounted as a normal
+        * IO on queueing nor completion.  Accounting the containing
+        * request is enough.
+        */
+       if (disk && blk_fs_request(req) && req != &req->q->bar_rq) {
                unsigned long duration = jiffies - req->start_time;
                const int rw = rq_data_dir(req);
 
index f370e4a7fe6d7a26e66f988774c002af6b772725..56a7c620574f86c0338a431354344d149314ce0f 100644 (file)
@@ -65,16 +65,15 @@ noop_latter_request(request_queue_t *q, struct request *rq)
        return list_entry(rq->queuelist.next, struct request, queuelist);
 }
 
-static int noop_init_queue(request_queue_t *q, elevator_t *e)
+static void *noop_init_queue(request_queue_t *q, elevator_t *e)
 {
        struct noop_data *nd;
 
        nd = kmalloc(sizeof(*nd), GFP_KERNEL);
        if (!nd)
-               return -ENOMEM;
+               return NULL;
        INIT_LIST_HEAD(&nd->queue);
-       e->elevator_data = nd;
-       return 0;
+       return nd;
 }
 
 static void noop_exit_queue(elevator_t *e)
index c24652d31bf9b6f2fe763ecd20546fe047729e84..2b2fbec14540f8f27d8de0ec5b3b796f226d27c0 100644 (file)
@@ -10,9 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support"
 config ACPI
        bool "ACPI Support"
        depends on IA64 || X86
+       depends on PCI
        select PM
-       select PCI
-
        default y
        ---help---
          Advanced Configuration and Power Interface (ACPI) support for 
index d882bf87fa968fa191a8f647989ef954f89b581e..e0a95ba72371562fc1c250ebcadd0b170eb50881 100644 (file)
@@ -74,7 +74,7 @@ struct acpi_memory_device {
        unsigned short caching; /* memory cache attribute */
        unsigned short write_protect;   /* memory read/write attribute */
        u64 start_addr;         /* Memory Range start physical addr */
-       u64 end_addr;           /* Memory Range end physical addr */
+       u64 length;             /* Memory Range length */
 };
 
 static int
@@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
        if (ACPI_SUCCESS(status)) {
                if (address64.resource_type == ACPI_MEMORY_RANGE) {
                        /* Populate the structure */
-                       mem_device->caching =
-                           address64.info.mem.caching;
+                       mem_device->caching = address64.info.mem.caching;
                        mem_device->write_protect =
                            address64.info.mem.write_protect;
                        mem_device->start_addr = address64.minimum;
-                       mem_device->end_addr = address64.maximum;
+                       mem_device->length = address64.address_length;
                }
        }
 
@@ -199,8 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
         * Tell the VM there is more memory here...
         * Note: Assume that this function returns zero on success
         */
-       result = add_memory(mem_device->start_addr,
-                           (mem_device->end_addr - mem_device->start_addr) + 1);
+       result = add_memory(mem_device->start_addr, mem_device->length);
        if (result) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
                mem_device->state = MEMORY_INVALID_STATE;
@@ -249,7 +247,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 {
        int result;
        u64 start = mem_device->start_addr;
-       u64 len = mem_device->end_addr - start + 1;
+       u64 len = mem_device->length;
 
        ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
 
index fccbf938ea04c13bf3a7ba4c68543f78aa789542..839f423d738d8618f8bc444b5707c672f833a5ac 100644 (file)
@@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer,
                              unsigned long count, void *data);
 
 static int
-__init asus_proc_add(char *name, proc_writefunc * writefunc,
+asus_proc_add(char *name, proc_writefunc * writefunc,
                     proc_readfunc * readfunc, mode_t mode,
                     struct acpi_device *device)
 {
@@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc,
        return 0;
 }
 
-static int __init asus_hotk_add_fs(struct acpi_device *device)
+static int asus_hotk_add_fs(struct acpi_device *device)
 {
        struct proc_dir_entry *proc;
        mode_t mode;
@@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
  * This function is used to initialize the hotk with right values. In this
  * method, we can make all the detection we want, and modify the hotk struct
  */
-static int __init asus_hotk_get_info(void)
+static int asus_hotk_get_info(void)
 {
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -970,7 +970,7 @@ static int __init asus_hotk_get_info(void)
         * HID), this bit will be moved. A global variable asus_info contains
         * the DSDT header.
         */
-       status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt);
+       status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
        if (ACPI_FAILURE(status))
                printk(KERN_WARNING "  Couldn't get the DSDT table header\n");
        else
@@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void)
        return AE_OK;
 }
 
-static int __init asus_hotk_check(void)
+static int asus_hotk_check(void)
 {
        int result = 0;
 
@@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void)
        return result;
 }
 
-static int __init asus_hotk_add(struct acpi_device *device)
+static int asus_hotk_found;
+
+static int asus_hotk_add(struct acpi_device *device)
 {
        acpi_status status = AE_OK;
        int result;
@@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device)
                }
        }
 
+       asus_hotk_found = 1;
+
       end:
        if (result) {
                kfree(hotk);
@@ -1226,7 +1230,19 @@ static int __init asus_acpi_init(void)
        asus_proc_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&asus_hotk_driver);
-       if (result < 1) {
+       if (result < 0) {
+               remove_proc_entry(PROC_ASUS, acpi_root_dir);
+               return -ENODEV;
+       }
+
+       /*
+        * This is a bit of a kludge.  We only want this module loaded
+        * for ASUS systems, but there's currently no way to probe the
+        * ACPI namespace for ASUS HIDs.  So we just return failure if
+        * we didn't find one, which will cause the module to be
+        * unloaded.
+        */
+       if (!asus_hotk_found) {
                acpi_bus_unregister_driver(&asus_hotk_driver);
                remove_proc_entry(PROC_ASUS, acpi_root_dir);
                return result;
index 606f8733a776cf4ab3473db6a8288431f7d9bc84..b77f03d51f0b6b7c7879612b6233fda2ccc1a7a9 100644 (file)
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus")
 extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
 #endif
 
-FADT_DESCRIPTOR acpi_fadt;
+struct fadt_descriptor acpi_fadt;
 EXPORT_SYMBOL(acpi_fadt);
 
 struct acpi_device *acpi_root;
@@ -596,6 +596,8 @@ void __init acpi_early_init(void)
        if (acpi_disabled)
                return_VOID;
 
+       printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION);
+
        /* enable workarounds, unless strict ACPI spec. compliance */
        if (!acpi_strict)
                acpi_gbl_enable_interpreter_slack = TRUE;
@@ -617,7 +619,7 @@ void __init acpi_early_init(void)
        /*
         * Get a separate copy of the FADT for use by other drivers.
         */
-       status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer);
+       status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer);
        if (ACPI_FAILURE(status)) {
                printk(KERN_ERR PREFIX "Unable to get the FADT\n");
                goto error0;
@@ -743,8 +745,6 @@ static int __init acpi_init(void)
 
        ACPI_FUNCTION_TRACE("acpi_init");
 
-       printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
-
        if (acpi_disabled) {
                printk(KERN_INFO PREFIX "Interpreter disabled.\n");
                return_VALUE(-ENODEV);
index 76bc0463f6de456814bbde5bc771a2690c1f9396..a6d77efb41a0437f1a19e36c7c0683749c317e25 100644 (file)
@@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
        union acpi_operand_object *second_desc = NULL;
        u32 flags;
 
-       ACPI_FUNCTION_TRACE("ds_create_buffer_field");
+       ACPI_FUNCTION_TRACE(ds_create_buffer_field);
 
        /* Get the name_string argument */
 
@@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
        acpi_status status;
        acpi_integer position;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info);
 
        /* First field starts at bit zero */
 
@@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
        union acpi_parse_object *arg;
        struct acpi_create_field_info info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_field, op);
 
        /* First arg is the name of the parent op_region (must already exist) */
 
@@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
        struct acpi_namespace_node *node;
        u8 type = 0;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op);
 
        switch (walk_state->opcode) {
        case AML_FIELD_OP:
@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
         * Walk the list of entries in the field_list
         */
        while (arg) {
+
                /* Ignore OFFSET and ACCESSAS terms here */
 
                if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
@@ -481,7 +482,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
        union acpi_parse_object *arg;
        struct acpi_create_field_info info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op);
 
        /* First arg is the name of the parent op_region (must already exist) */
 
@@ -554,7 +555,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
        union acpi_parse_object *arg;
        struct acpi_create_field_info info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op);
 
        /* First arg is the name of the Index register (must already exist) */
 
index e65a07ad2422a3d9fb8a4195109e0ffbb0356192..bbdf990e9f658c3ed9e08af3646e96244a0de844 100644 (file)
@@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Walk the namespace starting at "start_node" and perform any
+ * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
  *              necessary initialization on the objects found therein
  *
  ******************************************************************************/
@@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
        acpi_status status;
        struct acpi_init_walk_info info;
 
-       ACPI_FUNCTION_TRACE("ds_initialize_objects");
+       ACPI_FUNCTION_TRACE(ds_initialize_objects);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                          "**** Starting initialization of namespace objects ****\n"));
@@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
        status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
                                     acpi_ds_init_one_object, &info, NULL);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
+               ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
index c475546535b652fb313456c5440519c6fc66a0b9..bc9aca4e74019ea34a43077904fe1809de789a6a 100644 (file)
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
        /* Invoke the global exception handler */
 
        if (acpi_gbl_exception_handler) {
+
                /* Exit the interpreter, allow handler to execute methods */
 
                acpi_ex_exit_interpreter();
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
        }
 #ifdef ACPI_DISASSEMBLER
        if (ACPI_FAILURE(status)) {
+
                /* Display method locals/args if disassembler is present */
 
                acpi_dm_dump_method_info(status, walk_state, walk_state->op);
@@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
+       ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node);
 
        if (!method_node) {
                return_ACPI_STATUS(AE_NULL_ENTRY);
@@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
 
                /*
                 * Get a unit from the method semaphore. This releases the
-                * interpreter if we block
+                * interpreter if we block (then reacquires it)
                 */
                status =
                    acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
                                                  ACPI_WAIT_FOREVER);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
        }
 
        /*
@@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
        if (!obj_desc->method.owner_id) {
                status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
                if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
+                       goto cleanup;
                }
        }
 
@@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
         */
        obj_desc->method.thread_count++;
        return_ACPI_STATUS(status);
+
+      cleanup:
+       /* On error, must signal the method semaphore if present */
+
+       if (obj_desc->method.semaphore) {
+               (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1);
+       }
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
        struct acpi_namespace_node *method_node;
        struct acpi_walk_state *next_walk_state = NULL;
        union acpi_operand_object *obj_desc;
-       struct acpi_parameter_info info;
+       struct acpi_evaluate_info *info;
        u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                          "Execute method %p, currentstate=%p\n",
@@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
-       /* Init for new method, wait on concurrency semaphore */
+       /* Init for new method, possibly wait on concurrency semaphore */
 
        status = acpi_ds_begin_method_execution(method_node, obj_desc,
                                                this_walk_state->method_node);
        if (ACPI_FAILURE(status)) {
-               goto cleanup;
+               return_ACPI_STATUS(status);
        }
 
+       /*
+        * 1) Parse the method. All "normal" methods are parsed for each execution.
+        * Internal methods (_OSI, etc.) do not require parsing.
+        */
        if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
-               /* 1) Parse: Create a new walk state for the preempting walk */
+
+               /* Create a new walk state for the parse */
 
                next_walk_state =
                    acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
                                              obj_desc, NULL);
                if (!next_walk_state) {
-                       return_ACPI_STATUS(AE_NO_MEMORY);
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
                }
 
-               /* Create and init a Root Node */
+               /* Create and init a parse tree root */
 
                op = acpi_ps_create_scope_op();
                if (!op) {
@@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                                               obj_desc->method.aml_length,
                                               NULL, 1);
                if (ACPI_FAILURE(status)) {
-                       acpi_ds_delete_walk_state(next_walk_state);
+                       acpi_ps_delete_parse_tree(op);
                        goto cleanup;
                }
 
-               /* Begin AML parse */
+               /* Begin AML parse (deletes next_walk_state) */
 
                status = acpi_ps_parse_aml(next_walk_state);
                acpi_ps_delete_parse_tree(op);
+               if (ACPI_FAILURE(status)) {
+                       goto cleanup;
+               }
        }
 
-       /* 2) Execute: Create a new state for the preempting walk */
+       /* 2) Begin method execution. Create a new walk state */
 
        next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
                                                    NULL, obj_desc, thread);
@@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                status = AE_NO_MEMORY;
                goto cleanup;
        }
+
        /*
         * The resolved arguments were put on the previous walk state's operand
         * stack. Operands on the previous walk state stack always
@@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
         */
        this_walk_state->operands[this_walk_state->num_operands] = NULL;
 
-       info.parameters = &this_walk_state->operands[0];
-       info.parameter_type = ACPI_PARAM_ARGS;
+       /*
+        * Allocate and initialize the evaluation information block
+        * TBD: this is somewhat inefficient, should change interface to
+        * ds_init_aml_walk. For now, keeps this struct off the CPU stack
+        */
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       info->parameters = &this_walk_state->operands[0];
+       info->parameter_type = ACPI_PARAM_ARGS;
 
        status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
                                       obj_desc->method.aml_start,
-                                      obj_desc->method.aml_length, &info, 3);
+                                      obj_desc->method.aml_length, info, 3);
+
+       ACPI_FREE(info);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
@@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                          "Starting nested execution, newstate=%p\n",
                          next_walk_state));
 
+       /* Invoke an internal method if necessary */
+
        if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
                status = obj_desc->method.implementation(next_walk_state);
        }
@@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
        return_ACPI_STATUS(status);
 
       cleanup:
-       /* Decrement the thread count on the method parse tree */
 
-       if (next_walk_state && (next_walk_state->method_desc)) {
-               next_walk_state->method_desc->method.thread_count--;
-       }
+       /* On error, we must terminate the method properly */
 
-       /* On error, we must delete the new walk state */
+       acpi_ds_terminate_control_method(obj_desc, next_walk_state);
+       if (next_walk_state) {
+               acpi_ds_delete_walk_state(next_walk_state);
+       }
 
-       acpi_ds_terminate_control_method(next_walk_state);
-       acpi_ds_delete_walk_state(next_walk_state);
        return_ACPI_STATUS(status);
 }
 
@@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
                               union acpi_operand_object *return_desc)
 {
        acpi_status status;
+       int same_as_implicit_return;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                         "****Restart [%4.4s] Op %p return_value_from_callee %p\n",
+                         "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n",
                          (char *)&walk_state->method_node->name,
                          walk_state->method_call_op, return_desc));
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                         "    return_from_this_method_used?=%X res_stack %p Walk %p\n",
+                         "    ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n",
                          walk_state->return_used,
                          walk_state->results, walk_state));
 
        /* Did the called method return a value? */
 
        if (return_desc) {
+
+               /* Is the implicit return object the same as the return desc? */
+
+               same_as_implicit_return =
+                   (walk_state->implicit_return_obj == return_desc);
+
                /* Are we actually going to use the return value? */
 
                if (walk_state->return_used) {
+
                        /* Save the return value from the previous method */
 
                        status = acpi_ds_result_push(return_desc, walk_state);
@@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
                }
 
                /*
-                * The following code is the
-                * optional support for a so-called "implicit return". Some AML code
-                * assumes that the last value of the method is "implicitly" returned
-                * to the caller. Just save the last result as the return value.
+                * The following code is the optional support for the so-called
+                * "implicit return". Some AML code assumes that the last value of the
+                * method is "implicitly" returned to the caller, in the absence of an
+                * explicit return value.
+                *
+                * Just save the last result of the method as the return value.
+                *
                 * NOTE: this is optional because the ASL language does not actually
                 * support this behavior.
                 */
                else if (!acpi_ds_do_implicit_return
-                        (return_desc, walk_state, FALSE)) {
+                        (return_desc, walk_state, FALSE)
+                        || same_as_implicit_return) {
                        /*
                         * Delete the return value if it will not be used by the
-                        * calling method
+                        * calling method or remove one reference if the explicit return
+                        * is the same as the implicit return value.
                         */
                        acpi_ut_remove_reference(return_desc);
                }
@@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
  *
  * FUNCTION:    acpi_ds_terminate_control_method
  *
- * PARAMETERS:  walk_state          - State of the method
+ * PARAMETERS:  method_desc         - Method object
+ *              walk_state          - State associated with the method
  *
  * RETURN:      None
  *
@@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
  *
  ******************************************************************************/
 
-void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
+void
+acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
+                                struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object *obj_desc;
        struct acpi_namespace_node *method_node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state);
 
-       if (!walk_state) {
-               return_VOID;
-       }
+       /* method_desc is required, walk_state is optional */
 
-       /* The current method object was saved in the walk state */
-
-       obj_desc = walk_state->method_desc;
-       if (!obj_desc) {
+       if (!method_desc) {
                return_VOID;
        }
 
-       /* Delete all arguments and locals */
+       if (walk_state) {
 
-       acpi_ds_method_data_delete_all(walk_state);
+               /* Delete all arguments and locals */
+
+               acpi_ds_method_data_delete_all(walk_state);
+       }
 
        /*
         * Lock the parser while we terminate this method.
         * If this is the last thread executing the method,
         * we have additional cleanup to perform
         */
-       status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD);
        if (ACPI_FAILURE(status)) {
                return_VOID;
        }
 
        /* Signal completion of the execution of this method if necessary */
 
-       if (walk_state->method_desc->method.semaphore) {
+       if (method_desc->method.semaphore) {
                status =
-                   acpi_os_signal_semaphore(walk_state->method_desc->method.
-                                            semaphore, 1);
+                   acpi_os_signal_semaphore(method_desc->method.semaphore, 1);
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR((AE_INFO,
-                                   "Could not signal method semaphore"));
 
-                       /* Ignore error and continue cleanup */
+                       /* Ignore error and continue */
+
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Could not signal method semaphore"));
                }
        }
 
-       /*
-        * There are no more threads executing this method.  Perform
-        * additional cleanup.
-        *
-        * The method Node is stored in the walk state
-        */
-       method_node = walk_state->method_node;
+       if (walk_state) {
+               /*
+                * Delete any objects created by this method during execution.
+                * The method Node is stored in the walk state
+                */
+               method_node = walk_state->method_node;
 
-       /* Lock namespace for possible update */
+               /* Lock namespace for possible update */
 
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               goto exit;
-       }
+               status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
+               }
 
-       /*
-        * Delete any namespace entries created immediately underneath
-        * the method
-        */
-       if (method_node->child) {
-               acpi_ns_delete_namespace_subtree(method_node);
+               /*
+                * Delete any namespace entries created immediately underneath
+                * the method
+                */
+               if (method_node && method_node->child) {
+                       acpi_ns_delete_namespace_subtree(method_node);
+               }
+
+               /*
+                * Delete any namespace entries created anywhere else within
+                * the namespace by the execution of this method
+                */
+               acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id);
+               status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        }
 
-       /*
-        * Delete any namespace entries created anywhere else within
-        * the namespace by the execution of this method
-        */
-       acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method.
-                                         owner_id);
-       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       /* Decrement the thread count on the method */
+
+       if (method_desc->method.thread_count) {
+               method_desc->method.thread_count--;
+       } else {
+               ACPI_ERROR((AE_INFO, "Invalid zero thread count in method"));
+       }
 
        /* Are there any other threads currently executing this method? */
 
-       if (walk_state->method_desc->method.thread_count) {
+       if (method_desc->method.thread_count) {
                /*
                 * Additional threads. Do not release the owner_id in this case,
                 * we immediately reuse it for the next thread executing this method
                 */
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                                  "*** Completed execution of one thread, %d threads remaining\n",
-                                 walk_state->method_desc->method.
-                                 thread_count));
+                                 method_desc->method.thread_count));
        } else {
                /* This is the only executing thread for this method */
 
@@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
                 * This code is here because we must wait until the last thread exits
                 * before creating the synchronization semaphore.
                 */
-               if ((walk_state->method_desc->method.concurrency == 1) &&
-                   (!walk_state->method_desc->method.semaphore)) {
+               if ((method_desc->method.concurrency == 1) &&
+                   (!method_desc->method.semaphore)) {
                        status = acpi_os_create_semaphore(1, 1,
-                                                         &walk_state->
-                                                         method_desc->method.
+                                                         &method_desc->method.
                                                          semaphore);
                }
 
                /* No more threads, we can free the owner_id */
 
-               acpi_ut_release_owner_id(&walk_state->method_desc->method.
-                                        owner_id);
+               acpi_ut_release_owner_id(&method_desc->method.owner_id);
        }
 
       exit:
-       (void)acpi_ut_release_mutex(ACPI_MTX_PARSER);
+       (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD);
        return_VOID;
 }
 
@@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
        union acpi_parse_object *op;
        struct acpi_walk_state *walk_state;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
+       ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node);
 
        /* Parameter Validation */
 
@@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "**** Parsing [%4.4s] **** named_obj=%p\n",
+                         "**** Parsing [%4.4s] **** NamedObj=%p\n",
                          acpi_ut_get_node_name(node), node));
 
        /* Extract the method object from the method Node */
@@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
+                         "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
                          acpi_ut_get_node_name(node), node, op));
 
        /*
index c025674f938bd14a75b802d89357464ae7117650..459160ff90585108f6b3689a2b127975500c95b7 100644 (file)
@@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode,
  *              special data types.
  *
  * NOTES:       walk_state fields are initialized to zero by the
- *              ACPI_MEM_CALLOCATE().
+ *              ACPI_ALLOCATE_ZEROED().
  *
  *              A pseudo-Namespace Node is assigned to each argument and local
  *              so that ref_of() can return a pointer to the Node.
@@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_init");
+       ACPI_FUNCTION_TRACE(ds_method_data_init);
 
        /* Init the method arguments */
 
@@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
                ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
                                   NAMEOF_ARG_NTE);
                walk_state->arguments[i].name.integer |= (i << 24);
-               walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
+               walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED;
                walk_state->arguments[i].type = ACPI_TYPE_ANY;
-               walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
-                   ANOBJ_METHOD_ARG;
+               walk_state->arguments[i].flags =
+                   ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
        }
 
        /* Init the method locals */
@@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
                                   NAMEOF_LOCAL_NTE);
 
                walk_state->local_variables[i].name.integer |= (i << 24);
-               walk_state->local_variables[i].descriptor =
+               walk_state->local_variables[i].descriptor_type =
                    ACPI_DESC_TYPE_NAMED;
                walk_state->local_variables[i].type = ACPI_TYPE_ANY;
-               walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
-                   ANOBJ_METHOD_LOCAL;
+               walk_state->local_variables[i].flags =
+                   ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
        }
 
        return_VOID;
@@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
 {
        u32 index;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_delete_all");
+       ACPI_FUNCTION_TRACE(ds_method_data_delete_all);
 
        /* Detach the locals */
 
@@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
        acpi_status status;
        u32 index = 0;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params);
+       ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params);
 
        if (!params) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode,
                             struct acpi_walk_state *walk_state,
                             struct acpi_namespace_node **node)
 {
-       ACPI_FUNCTION_TRACE("ds_method_data_get_node");
+       ACPI_FUNCTION_TRACE(ds_method_data_get_node);
 
        /*
         * Method Locals and Arguments are supported
@@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode,
        acpi_status status;
        struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_set_value");
+       ACPI_FUNCTION_TRACE(ds_method_data_set_value);
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
+                         "NewObj %p Opcode %X, Refs=%d [%s]\n", object,
                          opcode, object->common.reference_count,
                          acpi_ut_get_type_name(object->common.type)));
 
@@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode,
         * Increment ref count so object can't be deleted while installed.
         * NOTE: We do not copy the object in order to preserve the call by
         * reference semantics of ACPI Control Method invocation.
-        * (See ACPI specification 2.0_c)
+        * (See ACPI Specification 2.0_c)
         */
        acpi_ut_add_reference(object);
 
@@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode,
  * FUNCTION:    acpi_ds_method_data_get_value
  *
  * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
- *              Index               - which local_var or argument to get
+ *              Index               - Which local_var or argument to get
  *              walk_state          - Current walk state object
  *              dest_desc           - Where Arg or Local value is returned
  *
@@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode,
        struct acpi_namespace_node *node;
        union acpi_operand_object *object;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_get_value");
+       ACPI_FUNCTION_TRACE(ds_method_data_get_value);
 
        /* Validate the object descriptor */
 
@@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode,
  * FUNCTION:    acpi_ds_method_data_delete_value
  *
  * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
- *              Index               - which local_var or argument to delete
+ *              Index               - Which local_var or argument to delete
  *              walk_state          - Current walk state object
  *
  * RETURN:      None
@@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
        struct acpi_namespace_node *node;
        union acpi_operand_object *object;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_delete_value");
+       ACPI_FUNCTION_TRACE(ds_method_data_delete_value);
 
        /* Get the namespace node for the arg/local */
 
@@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode,
        union acpi_operand_object *current_obj_desc;
        union acpi_operand_object *new_obj_desc;
 
-       ACPI_FUNCTION_TRACE("ds_store_object_to_local");
+       ACPI_FUNCTION_TRACE(ds_store_object_to_local);
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
                          opcode, index, obj_desc));
 
@@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode,
                            && (current_obj_desc->reference.opcode ==
                                AML_REF_OF_OP)) {
                                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                                 "Arg (%p) is an obj_ref(Node), storing in node %p\n",
+                                                 "Arg (%p) is an ObjRef(Node), storing in node %p\n",
                                                  new_obj_desc,
                                                  current_obj_desc));
 
@@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode,
        struct acpi_namespace_node *node;
        union acpi_operand_object *object;
 
-       ACPI_FUNCTION_TRACE("ds_method_data_get_type");
+       ACPI_FUNCTION_TRACE(ds_method_data_get_type);
 
        /* Get the namespace node for the arg/local */
 
@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode,
 
        object = acpi_ns_get_attached_object(node);
        if (!object) {
+
                /* Uninitialized local/arg, return TYPE_ANY */
 
                return_VALUE(ACPI_TYPE_ANY);
index 8b21f0f9e5177f3d82f9ea72b38ff772c75f972f..72190abb1d59cb9036484b9560cee9a6105f30b3 100644 (file)
@@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ds_build_internal_object");
+       ACPI_FUNCTION_TRACE(ds_build_internal_object);
 
        *obj_desc_ptr = NULL;
        if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
                                                                         common.
                                                                         node)));
                        if (ACPI_FAILURE(status)) {
+
                                /* Check if we are resolving a named reference within a package */
 
                                if ((status == AE_NOT_FOUND)
@@ -186,7 +187,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
        union acpi_parse_object *byte_list;
        u32 byte_list_length = 0;
 
-       ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
+       ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj);
 
        /*
         * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
         */
        obj_desc = *obj_desc_ptr;
        if (!obj_desc) {
+
                /* Create a new buffer object */
 
                obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
                                  "Buffer defined with zero length in AML, creating\n"));
        } else {
                obj_desc->buffer.pointer =
-                   ACPI_MEM_CALLOCATE(obj_desc->buffer.length);
+                   ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length);
                if (!obj_desc->buffer.pointer) {
                        acpi_ut_delete_object_desc(obj_desc);
                        return_ACPI_STATUS(AE_NO_MEMORY);
@@ -291,7 +293,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
        acpi_status status = AE_OK;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
+       ACPI_FUNCTION_TRACE(ds_build_internal_package_obj);
 
        /* Find the parent of a possibly nested package */
 
@@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
         * individual objects). Add an extra pointer slot so
         * that the list is always null terminated.
         */
-       obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc->
-                                                        package.count +
-                                                        1) * sizeof(void *));
+       obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
+                                                          obj_desc->package.
+                                                          count +
+                                                          1) * sizeof(void *));
 
        if (!obj_desc->package.elements) {
                acpi_ut_delete_object_desc(obj_desc);
@@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
        arg = arg->common.next;
        for (i = 0; arg; i++) {
                if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
+
                        /* Object (package or buffer) is already built */
 
                        obj_desc->package.elements[i] =
@@ -396,7 +400,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
        acpi_status status;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_node", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_node, op);
 
        /*
         * Because of the execution pass through the non-control-method
@@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
        }
 
        if (!op->common.value.arg) {
+
                /* No arguments, there is nothing to do */
 
                return_ACPI_STATUS(AE_OK);
@@ -464,11 +469,12 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
        union acpi_operand_object *obj_desc;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ds_init_object_from_op");
+       ACPI_FUNCTION_TRACE(ds_init_object_from_op);
 
        obj_desc = *ret_obj_desc;
        op_info = acpi_ps_get_opcode_info(opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
+
                /* Unknown opcode */
 
                return_ACPI_STATUS(AE_TYPE);
@@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
                default:        /* Other literals, etc.. */
 
                        if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
+
                                /* Node was saved in Op */
 
                                obj_desc->reference.node = op->common.node;
index 6229c10674e186c41bb690d58d8c80feff6da6b6..5b974a8fe614162c3ec0242aaabe63fe0fc34290 100644 (file)
@@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
        union acpi_parse_object *op;
        struct acpi_walk_state *walk_state;
 
-       ACPI_FUNCTION_TRACE("ds_execute_arguments");
+       ACPI_FUNCTION_TRACE(ds_execute_arguments);
 
        /*
         * Allocate a new parser op to be the root of the parsed tree
@@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
                return_ACPI_STATUS(AE_OK);
@@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 
        ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
                        (ACPI_TYPE_BUFFER_FIELD, node, NULL));
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
                          acpi_ut_get_node_name(node)));
 
        /* Execute the AML code for the term_arg arguments */
@@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
                return_ACPI_STATUS(AE_OK);
@@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
                return_ACPI_STATUS(AE_OK);
@@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
        acpi_status status;
        union acpi_operand_object *extra_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc);
 
        if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
                return_ACPI_STATUS(AE_OK);
@@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
        ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
                        (ACPI_TYPE_REGION, node, NULL));
 
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "[%4.4s] op_region Arg Init at AML %p\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
                          acpi_ut_get_node_name(node),
                          extra_desc->extra.aml_start));
 
@@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
        status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
                                           extra_desc->extra.aml_length,
                                           extra_desc->extra.aml_start);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       /* Validate the region address/length via the host OS */
+
+       status = acpi_os_validate_address(obj_desc->region.space_id,
+                                         obj_desc->region.address,
+                                         (acpi_size) obj_desc->region.length);
+       if (ACPI_FAILURE(status)) {
+               /*
+                * Invalid address/length. We will emit an error message and mark
+                * the region as invalid, so that it will cause an additional error if
+                * it is ever used. Then return AE_OK.
+                */
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "During address validation of OpRegion [%4.4s]",
+                               node->name.ascii));
+               obj_desc->common.flags |= AOPOBJ_INVALID;
+               status = AE_OK;
+       }
+
        return_ACPI_STATUS(status);
 }
 
@@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
        u8 field_flags;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
 
        /* Host object must be a Buffer */
 
@@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
 
                if (bit_count == 0) {
                        ACPI_ERROR((AE_INFO,
-                                   "Attempt to create_field of length zero"));
+                                   "Attempt to CreateField of length zero"));
                        status = AE_AML_OPERAND_VALUE;
                        goto cleanup;
                }
@@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
        struct acpi_namespace_node *node;
        union acpi_parse_object *next_op;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op);
 
        /*
         * This is where we evaluate the address and length fields of the
@@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
        ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
                           acpi_ps_get_opcode_name(op->common.aml_opcode),
                           walk_state->num_operands,
-                          "after acpi_ex_resolve_operands");
+                          "after AcpiExResolveOperands");
 
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
@@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
        /* Initialize the Buffer Field */
 
        if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
+
                /* NOTE: Slightly different operands for this opcode */
 
                status =
@@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
        struct acpi_namespace_node *node;
        union acpi_parse_object *next_op;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
 
        /*
         * This is where we evaluate the address and length fields of the
@@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
 
        ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
                           acpi_ps_get_opcode_name(op->common.aml_opcode),
-                          1, "after acpi_ex_resolve_operands");
+                          1, "after AcpiExResolveOperands");
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
@@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
            operand_desc->integer.value;
        acpi_ut_remove_reference(operand_desc);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
                          obj_desc,
                          ACPI_FORMAT_UINT64(obj_desc->region.address),
                          obj_desc->region.length));
@@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
        union acpi_operand_object *arg_desc;
        u32 length;
 
-       ACPI_FUNCTION_TRACE("ds_eval_data_object_operands");
+       ACPI_FUNCTION_TRACE(ds_eval_data_object_operands);
 
        /* The first operand (for all of these data objects) is the length */
 
@@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
        acpi_status status = AE_OK;
        union acpi_generic_state *control_state;
 
-       ACPI_FUNCTION_NAME("ds_exec_begin_control_op");
+       ACPI_FUNCTION_NAME(ds_exec_begin_control_op);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
                          op->common.aml_opcode, walk_state));
@@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
        acpi_status status = AE_OK;
        union acpi_generic_state *control_state;
 
-       ACPI_FUNCTION_NAME("ds_exec_end_control_op");
+       ACPI_FUNCTION_NAME(ds_exec_end_control_op);
 
        switch (op->common.aml_opcode) {
        case AML_IF_OP:
@@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
 
                if (walk_state->control_state->common.value) {
+
                        /* Predicate was true, go back and evaluate it again! */
 
                        status = AE_CTRL_PENDING;
@@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
                 * has been bubbled up the tree
                 */
                if (op->common.value.arg) {
+
                        /* Since we have a real Return(), delete any implicit return */
 
                        acpi_ds_clear_implicit_return(walk_state);
@@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
                        walk_state->return_desc = walk_state->operands[0];
                } else if ((walk_state->results) &&
                           (walk_state->results->results.num_results > 0)) {
+
                        /* Since we have a real Return(), delete any implicit return */
 
                        acpi_ds_clear_implicit_return(walk_state);
@@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
                }
 
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                 "Completed RETURN_OP State=%p, ret_val=%p\n",
+                                 "Completed RETURN_OP State=%p, RetVal=%p\n",
                                  walk_state, walk_state->return_desc));
 
                /* End the control method execution right now */
index 53356a591ac19da2e7881fc81c0d9431920318b2..05230baf5de8ed5e738c93e07a3ecd327a53946a 100644 (file)
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils")
  ******************************************************************************/
 void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
 {
-       ACPI_FUNCTION_NAME("ds_clear_implicit_return");
+       ACPI_FUNCTION_NAME(ds_clear_implicit_return);
 
        /*
         * Slack must be enabled for this feature
@@ -115,7 +115,7 @@ u8
 acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
                           struct acpi_walk_state *walk_state, u8 add_reference)
 {
-       ACPI_FUNCTION_NAME("ds_do_implicit_return");
+       ACPI_FUNCTION_NAME(ds_do_implicit_return);
 
        /*
         * Slack must be enabled for this feature, and we must
@@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 {
        const struct acpi_opcode_info *parent_info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
+       ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op);
 
        /* Must have both an Op and a Result Object */
 
@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
         */
        if ((!op->common.parent) ||
            (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
+
                /* No parent, the return value cannot possibly be used */
 
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -340,7 +341,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
+       ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj);
 
        if (!op) {
                ACPI_ERROR((AE_INFO, "Null Op"));
@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
        }
 
        if (!acpi_ds_is_result_used(op, walk_state)) {
+
                /* Must pop the result stack (obj_desc should be equal to result_obj) */
 
                status = acpi_ds_result_pop(&obj_desc, walk_state);
@@ -382,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
        u32 i;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state);
 
        /*
         * Attempt to resolve each of the valid operands
@@ -417,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state);
 
        /* Remove a reference on each operand on the stack */
 
@@ -465,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
        acpi_interpreter_mode interpreter_mode;
        const struct acpi_opcode_info *op_info;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg);
 
        /* A valid name must be looked up in the namespace */
 
@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                 */
                if ((walk_state->deferred_node) &&
                    (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
-                   && (arg_index != 0)) {
+                   && (arg_index ==
+                       (u32) ((walk_state->opcode ==
+                               AML_CREATE_FIELD_OP) ? 3 : 2))) {
                        obj_desc =
                            ACPI_CAST_PTR(union acpi_operand_object,
                                          walk_state->deferred_node);
@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                            && (parent_op->common.aml_opcode != AML_REGION_OP)
                            && (parent_op->common.aml_opcode !=
                                AML_INT_NAMEPATH_OP)) {
+
                                /* Enter name into namespace if not found */
 
                                interpreter_mode = ACPI_IMODE_LOAD_PASS2;
@@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
 
                /* Free the namestring created above */
 
-               ACPI_MEM_FREE(name_string);
+               ACPI_FREE(name_string);
 
                /* Check status from the lookup */
 
@@ -696,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
        union acpi_parse_object *arg;
        u32 arg_count = 0;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
+       ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg);
 
        /* For all arguments in the list... */
 
index f1af655ff11350dc82ebdd77eb03fcbc6b2666ab..3acbd9145d72f5309ed67964ebd4dd5bdf68d067 100644 (file)
@@ -49,7 +49,6 @@
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdebug.h>
-#include <acpi/acdisasm.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
 ACPI_MODULE_NAME("dswexec")
@@ -93,7 +92,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
        union acpi_operand_object *obj_desc;
        union acpi_operand_object *local_obj_desc = NULL;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state);
 
        walk_state->control_state->common.state = 0;
 
@@ -123,7 +122,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
 
        if (!obj_desc) {
                ACPI_ERROR((AE_INFO,
-                           "No predicate obj_desc=%p State=%p",
+                           "No predicate ObjDesc=%p State=%p",
                            obj_desc, walk_state));
 
                return_ACPI_STATUS(AE_AML_NO_OPERAND);
@@ -140,7 +139,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
 
        if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
                ACPI_ERROR((AE_INFO,
-                           "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X",
+                           "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
                            obj_desc, walk_state,
                            ACPI_GET_OBJECT_TYPE(obj_desc)));
 
@@ -214,7 +213,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
        acpi_status status = AE_OK;
        u32 opcode_class;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state);
 
        op = walk_state->op;
        if (!op) {
@@ -296,7 +295,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
 
        case AML_CLASS_NAMED_OBJECT:
 
-               if (walk_state->walk_type == ACPI_WALK_METHOD) {
+               if (walk_state->walk_type & ACPI_WALK_METHOD) {
                        /*
                         * Found a named object declaration during method execution;
                         * we must enter this object into the namespace.  The created
@@ -354,7 +353,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
        union acpi_parse_object *next_op;
        union acpi_parse_object *first_arg;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state);
 
        op = walk_state->op;
        op_type = walk_state->op_info->type;
@@ -409,6 +408,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                 * being the object_type and size_of operators.
                 */
                if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
+
                        /* Resolve all operands */
 
                        status = acpi_ex_resolve_operands(walk_state->opcode,
@@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                                                   acpi_ps_get_opcode_name
                                                   (walk_state->opcode),
                                                   walk_state->num_operands,
-                                                  "after ex_resolve_operands");
+                                                  "after ExResolveOperands");
                        }
                }
 
@@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                            acpi_gbl_op_type_dispatch[op_type] (walk_state);
                } else {
                        /*
-                        * Treat constructs of the form "Store(local_x,local_x)" as noops when the
+                        * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
                         * Local is uninitialized.
                         */
                        if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
@@ -548,6 +548,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                         */
                        status = acpi_ds_resolve_operands(walk_state);
                        if (ACPI_FAILURE(status)) {
+
                                /* On error, clear all resolved operands */
 
                                acpi_ds_clear_operands(walk_state);
@@ -569,7 +570,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                case AML_TYPE_CREATE_FIELD:
 
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                         "Executing create_field Buffer/Index Op=%p\n",
+                                         "Executing CreateField Buffer/Index Op=%p\n",
                                          op));
 
                        status = acpi_ds_load2_end_op(walk_state);
@@ -584,7 +585,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                case AML_TYPE_CREATE_OBJECT:
 
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                         "Executing create_object (Buffer/Package) Op=%p\n",
+                                         "Executing CreateObject (Buffer/Package) Op=%p\n",
                                          op));
 
                        switch (op->common.parent->common.aml_opcode) {
@@ -657,7 +658,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 
                        if (op->common.aml_opcode == AML_REGION_OP) {
                                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                                 "Executing op_region Address/Length Op=%p\n",
+                                                 "Executing OpRegion Address/Length Op=%p\n",
                                                  op));
 
                                status =
@@ -722,6 +723,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
       cleanup:
 
        if (walk_state->result_obj) {
+
                /* Break to debugger to display result */
 
                ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
index d3d24da31c814db68766a705c9eb210dfa95a7ba..35074399c6179d83fecd8d81c4a95213a55c43f0 100644 (file)
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
        char *path;
        u32 flags;
 
-       ACPI_FUNCTION_TRACE("ds_load1_begin_op");
+       ACPI_FUNCTION_TRACE(ds_load1_begin_op);
 
        op = walk_state->op;
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                         * Target of Scope() not found.  Generate an External for it, and
                         * insert the name into the namespace.
                         */
-                       acpi_dm_add_to_external_list(path);
+                       acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0);
                        status =
                            acpi_ns_lookup(walk_state->scope_info, path,
                                           object_type, ACPI_IMODE_LOAD_PASS1,
                                           ACPI_NS_SEARCH_PARENT, walk_state,
-                                          &(node));
+                                          &node);
                }
 #endif
                if (ACPI_FAILURE(status)) {
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                 */
 
                if (walk_state->deferred_node) {
+
                        /* This name is already in the namespace, get the node */
 
                        node = walk_state->deferred_node;
@@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                status =
                    acpi_ns_lookup(walk_state->scope_info, path, object_type,
                                   ACPI_IMODE_LOAD_PASS1, flags, walk_state,
-                                  &(node));
+                                  &node);
                if (ACPI_FAILURE(status)) {
-                       ACPI_ERROR_NAMESPACE(path, status);
-                       return_ACPI_STATUS(status);
+                       if (status == AE_ALREADY_EXISTS) {
+
+                               /* The name already exists in this scope */
+
+                               if (node->flags & ANOBJ_IS_EXTERNAL) {
+                                       /*
+                                        * Allow one create on an object or segment that was
+                                        * previously declared External
+                                        */
+                                       node->flags &= ~ANOBJ_IS_EXTERNAL;
+                                       node->type = (u8) object_type;
+
+                                       /* Just retyped a node, probably will need to open a scope */
+
+                                       if (acpi_ns_opens_scope(object_type)) {
+                                               status =
+                                                   acpi_ds_scope_stack_push
+                                                   (node, object_type,
+                                                    walk_state);
+                                               if (ACPI_FAILURE(status)) {
+                                                       return_ACPI_STATUS
+                                                           (status);
+                                               }
+                                       }
+                                       status = AE_OK;
+                               }
+                       }
+
+                       if (ACPI_FAILURE(status)) {
+
+                               ACPI_ERROR_NAMESPACE(path, status);
+                               return_ACPI_STATUS(status);
+                       }
                }
                break;
        }
@@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
        /* Common exit */
 
        if (!op) {
+
                /* Create a new op */
 
                op = acpi_ps_alloc_op(walk_state->opcode);
@@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
        acpi_object_type object_type;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ds_load1_end_op");
+       ACPI_FUNCTION_TRACE(ds_load1_end_op);
 
        op = walk_state->op;
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
 #endif
 
        if (op->common.aml_opcode == AML_NAME_OP) {
+
                /* For Name opcode, get the object type from the argument */
 
                if (op->common.value.arg) {
@@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
                         * arguments.)
                         */
                        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                         "LOADING-Method: State=%p Op=%p named_obj=%p\n",
+                                         "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
                                          walk_state, op, op->named.node));
 
                        if (!acpi_ns_get_attached_object(op->named.node)) {
@@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
        acpi_object_type object_type;
        char *buffer_ptr;
 
-       ACPI_FUNCTION_TRACE("ds_load2_begin_op");
+       ACPI_FUNCTION_TRACE(ds_load2_begin_op);
 
        op = walk_state->op;
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                if ((walk_state->control_state) &&
                    (walk_state->control_state->common.state ==
                     ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+
                        /* We are executing a while loop outside of a method */
 
                        status = acpi_ds_exec_begin_op(walk_state, out_op);
@@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                /* Get the name we are going to enter or lookup in the namespace */
 
                if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
+
                        /* For Namepath op, get the path string */
 
                        buffer_ptr = op->common.value.string;
                        if (!buffer_ptr) {
+
                                /* No name, just exit */
 
                                return_ACPI_STATUS(AE_OK);
@@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                /* All other opcodes */
 
                if (op && op->common.node) {
+
                        /* This op/node was previously entered into the namespace */
 
                        node = op->common.node;
@@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                 * Note: Name may already exist if we are executing a deferred opcode.
                 */
                if (walk_state->deferred_node) {
+
                        /* This name is already in the namespace, get the node */
 
                        node = walk_state->deferred_node;
@@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
        }
 
        if (!op) {
+
                /* Create a new op */
 
                op = acpi_ps_alloc_op(walk_state->opcode);
@@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
        u32 i;
 #endif
 
-       ACPI_FUNCTION_TRACE("ds_load2_end_op");
+       ACPI_FUNCTION_TRACE(ds_load2_end_op);
 
        op = walk_state->op;
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
@@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
         */
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                         "Create-Load [%s] State=%p Op=%p named_obj=%p\n",
+                         "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
                          acpi_ps_get_opcode_name(op->common.aml_opcode),
                          walk_state, op, node));
 
@@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                         * arguments.)
                         */
                        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                         "LOADING-Method: State=%p Op=%p named_obj=%p\n",
+                                         "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
                                          walk_state, op, op->named.node));
 
                        if (!acpi_ns_get_attached_object(op->named.node)) {
@@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
        case AML_CLASS_METHOD_CALL:
 
                ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                 "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
+                                 "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
                                  walk_state, op, node));
 
                /*
@@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                                   ACPI_NS_DONT_OPEN_SCOPE, walk_state,
                                   &(new_node));
                if (ACPI_SUCCESS(status)) {
-
                        /*
                         * Make sure that what we found is indeed a method
                         * We didn't search for a method on purpose, to see if the name
index ada21ef4a1744d0c9e39aa0c16bdb7333b9e2e32..c9228972f5f65a08a1ed6bb464dc255d9413c362 100644 (file)
@@ -63,9 +63,10 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
 {
        union acpi_generic_state *scope_info;
 
-       ACPI_FUNCTION_NAME("ds_scope_stack_clear");
+       ACPI_FUNCTION_NAME(ds_scope_stack_clear);
 
        while (walk_state->scope_info) {
+
                /* Pop a scope off the stack */
 
                scope_info = walk_state->scope_info;
@@ -102,9 +103,10 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
        union acpi_generic_state *scope_info;
        union acpi_generic_state *old_scope_info;
 
-       ACPI_FUNCTION_TRACE("ds_scope_stack_push");
+       ACPI_FUNCTION_TRACE(ds_scope_stack_push);
 
        if (!node) {
+
                /* Invalid scope   */
 
                ACPI_ERROR((AE_INFO, "Null scope parameter"));
@@ -126,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
 
        /* Init new scope object */
 
-       scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
+       scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE;
        scope_info->scope.node = node;
        scope_info->common.value = (u16) type;
 
@@ -176,7 +178,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state)
        union acpi_generic_state *scope_info;
        union acpi_generic_state *new_scope_info;
 
-       ACPI_FUNCTION_TRACE("ds_scope_stack_pop");
+       ACPI_FUNCTION_TRACE(ds_scope_stack_pop);
 
        /*
         * Pop scope info object off the stack.
index fa78cb74ee367eb69ea4a359d681e1448ee146f5..7817e552267962f56a3cd761f073efc9b8088d7e 100644 (file)
@@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 index,
 #endif
 
 #ifdef ACPI_FUTURE_USAGE
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_result_remove
@@ -88,7 +87,7 @@ acpi_ds_result_remove(union acpi_operand_object **object,
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_remove");
+       ACPI_FUNCTION_NAME(ds_result_remove);
 
        state = walk_state->results;
        if (!state) {
@@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand_object **object,
 
        return (AE_OK);
 }
-
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -152,7 +150,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
        acpi_native_uint index;
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_pop");
+       ACPI_FUNCTION_NAME(ds_result_pop);
 
        state = walk_state->results;
        if (!state) {
@@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
        state->results.num_results--;
 
        for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) {
+
                /* Check for a valid result object */
 
                if (state->results.obj_desc[index - 1]) {
@@ -213,7 +212,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
        acpi_native_uint index;
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_pop_from_bottom");
+       ACPI_FUNCTION_NAME(ds_result_pop_from_bottom);
 
        state = walk_state->results;
        if (!state) {
@@ -278,7 +277,7 @@ acpi_ds_result_push(union acpi_operand_object * object,
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_push");
+       ACPI_FUNCTION_NAME(ds_result_push);
 
        state = walk_state->results;
        if (!state) {
@@ -331,14 +330,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state)
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_stack_push");
+       ACPI_FUNCTION_NAME(ds_result_stack_push);
 
        state = acpi_ut_create_generic_state();
        if (!state) {
                return (AE_NO_MEMORY);
        }
 
-       state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT;
+       state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT;
        acpi_ut_push_generic_state(&walk_state->results, state);
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n",
@@ -363,7 +362,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state)
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_stack_pop");
+       ACPI_FUNCTION_NAME(ds_result_stack_pop);
 
        /* Check for stack underflow */
 
@@ -376,7 +375,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state)
        state = acpi_ut_pop_generic_state(&walk_state->results);
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "Result=%p remaining_results=%X State=%p\n",
+                         "Result=%p RemainingResults=%X State=%p\n",
                          state, state->results.num_results, walk_state));
 
        acpi_ut_delete_generic_state(state);
@@ -400,7 +399,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state)
 acpi_status
 acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
 {
-       ACPI_FUNCTION_NAME("ds_obj_stack_push");
+       ACPI_FUNCTION_NAME(ds_obj_stack_push);
 
        /* Check for stack overflow */
 
@@ -445,9 +444,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
 {
        u32 i;
 
-       ACPI_FUNCTION_NAME("ds_obj_stack_pop");
+       ACPI_FUNCTION_NAME(ds_obj_stack_pop);
 
        for (i = 0; i < pop_count; i++) {
+
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
@@ -491,9 +491,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
        u32 i;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete");
+       ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete);
 
        for (i = 0; i < pop_count; i++) {
+
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
@@ -538,13 +539,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
 struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
                                                       *thread)
 {
-       ACPI_FUNCTION_NAME("ds_get_current_walk_state");
+       ACPI_FUNCTION_NAME(ds_get_current_walk_state);
 
        if (!thread) {
                return (NULL);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n",
                          thread->walk_state_list));
 
        return (thread->walk_state_list);
@@ -567,7 +568,7 @@ void
 acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
                        struct acpi_thread_state *thread)
 {
-       ACPI_FUNCTION_TRACE("ds_push_walk_state");
+       ACPI_FUNCTION_TRACE(ds_push_walk_state);
 
        walk_state->next = thread->walk_state_list;
        thread->walk_state_list = walk_state;
@@ -593,11 +594,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
 {
        struct acpi_walk_state *walk_state;
 
-       ACPI_FUNCTION_TRACE("ds_pop_walk_state");
+       ACPI_FUNCTION_TRACE(ds_pop_walk_state);
 
        walk_state = thread->walk_state_list;
 
        if (walk_state) {
+
                /* Next walk state becomes the current walk state */
 
                thread->walk_state_list = walk_state->next;
@@ -618,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
  *
  * PARAMETERS:  owner_id        - ID for object creation
  *              Origin          - Starting point for this walk
- *              mth_desc        - Method object
+ *              method_desc     - Method object
  *              Thread          - Current thread state
  *
  * RETURN:      Pointer to the new walk state.
@@ -632,24 +634,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
                                                  union acpi_parse_object
                                                  *origin,
                                                  union acpi_operand_object
-                                                 *mth_desc,
+                                                 *method_desc,
                                                  struct acpi_thread_state
                                                  *thread)
 {
        struct acpi_walk_state *walk_state;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ds_create_walk_state");
+       ACPI_FUNCTION_TRACE(ds_create_walk_state);
 
-       walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state));
+       walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state));
        if (!walk_state) {
                return_PTR(NULL);
        }
 
-       walk_state->data_type = ACPI_DESC_TYPE_WALK;
+       walk_state->descriptor_type = ACPI_DESC_TYPE_WALK;
+       walk_state->method_desc = method_desc;
        walk_state->owner_id = owner_id;
        walk_state->origin = origin;
-       walk_state->method_desc = mth_desc;
        walk_state->thread = thread;
 
        walk_state->parser_state.start_op = origin;
@@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
 
        status = acpi_ds_result_stack_push(walk_state);
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(walk_state);
+               ACPI_FREE(walk_state);
                return_PTR(NULL);
        }
 
@@ -701,13 +703,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
                      struct acpi_namespace_node *method_node,
                      u8 * aml_start,
                      u32 aml_length,
-                     struct acpi_parameter_info *info, u8 pass_number)
+                     struct acpi_evaluate_info *info, u8 pass_number)
 {
        acpi_status status;
        struct acpi_parse_state *parser_state = &walk_state->parser_state;
        union acpi_parse_object *extra_op;
 
-       ACPI_FUNCTION_TRACE("ds_init_aml_walk");
+       ACPI_FUNCTION_TRACE(ds_init_aml_walk);
 
        walk_state->parser_state.aml =
            walk_state->parser_state.aml_start = aml_start;
@@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
                }
 
                if (parser_state->start_node) {
+
                        /* Push start scope on scope stack and make it current  */
 
                        status =
@@ -810,21 +813,24 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state);
 
        if (!walk_state) {
                return;
        }
 
-       if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
+       if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
                ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
                            walk_state));
                return;
        }
 
+       /* There should not be any open scopes */
+
        if (walk_state->parser_state.scope) {
                ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
                            walk_state));
+               acpi_ps_cleanup_scope(&walk_state->parser_state);
        }
 
        /* Always must free any linked control states */
@@ -854,7 +860,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
                acpi_ut_delete_generic_state(state);
        }
 
-       ACPI_MEM_FREE(walk_state);
+       ACPI_FREE(walk_state);
        return_VOID;
 }
 
@@ -879,7 +885,7 @@ acpi_ds_result_insert(void *object,
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_NAME("ds_result_insert");
+       ACPI_FUNCTION_NAME(ds_result_insert);
 
        state = walk_state->results;
        if (!state) {
@@ -937,7 +943,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state)
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state);
 
        /* The stack size is configurable, but fixed */
 
@@ -969,7 +975,7 @@ acpi_status
 acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
                             struct acpi_walk_state *walk_state)
 {
-       ACPI_FUNCTION_NAME("ds_obj_stack_pop_object");
+       ACPI_FUNCTION_NAME(ds_obj_stack_pop_object);
 
        /* Check for stack underflow */
 
@@ -1025,7 +1031,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
 void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state)
 {
 
-       ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state);
 
        /* Can't do it if the stack is empty */
 
index eee0864ba300a6d8f2287f5919d8cd2fffa4e49b..c036e2a69f33299fb403e1c2ad0749f1711cd46b 100644 (file)
@@ -763,8 +763,7 @@ static u32 acpi_ec_gpe_poll_handler(void *data)
 
        acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
 
-       status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
-                                            acpi_ec_gpe_query, ec);
+       status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec);
 
        if (status == AE_OK)
                return ACPI_INTERRUPT_HANDLED;
@@ -799,7 +798,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data)
 
        if (value & ACPI_EC_FLAG_SCI) {
                atomic_add(1, &ec->intr.pending_gpe);
-               status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+               status = acpi_os_execute(OSL_EC_BURST_HANDLER,
                                                     acpi_ec_gpe_query, ec);
                return status == AE_OK ?
                    ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
@@ -991,7 +990,6 @@ static int acpi_ec_poll_add(struct acpi_device *device)
        int result = 0;
        acpi_status status = AE_OK;
        union acpi_ec *ec = NULL;
-       unsigned long uid;
 
        ACPI_FUNCTION_TRACE("acpi_ec_add");
 
@@ -1014,10 +1012,9 @@ static int acpi_ec_poll_add(struct acpi_device *device)
        acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
                              &ec->common.global_lock);
 
-       /* If our UID matches the UID for the ECDT-enumerated EC,
-          we now have the *real* EC info, so kill the makeshift one. */
-       acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
-       if (ec_ecdt && ec_ecdt->common.uid == uid) {
+       /* XXX we don't test uids, because on some boxes ecdt uid = 0, see:
+          http://bugzilla.kernel.org/show_bug.cgi?id=6111 */
+       if (ec_ecdt) {
                acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
                                                  ACPI_ADR_SPACE_EC,
                                                  &acpi_ec_space_handler);
@@ -1062,7 +1059,6 @@ static int acpi_ec_intr_add(struct acpi_device *device)
        int result = 0;
        acpi_status status = AE_OK;
        union acpi_ec *ec = NULL;
-       unsigned long uid;
 
        ACPI_FUNCTION_TRACE("acpi_ec_add");
 
@@ -1088,10 +1084,9 @@ static int acpi_ec_intr_add(struct acpi_device *device)
        acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
                              &ec->common.global_lock);
 
-       /* If our UID matches the UID for the ECDT-enumerated EC,
-          we now have the *real* EC info, so kill the makeshift one. */
-       acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
-       if (ec_ecdt && ec_ecdt->common.uid == uid) {
+       /* XXX we don't test uids, because on some boxes ecdt uid = 0, see:
+          http://bugzilla.kernel.org/show_bug.cgi?id=6111 */
+       if (ec_ecdt) {
                acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
                                                  ACPI_ADR_SPACE_EC,
                                                  &acpi_ec_space_handler);
index c9ac05c4685fae95ff7a54322dafb293e11631f5..919037d6acff813f341e5ad3ef96675137dad258 100644 (file)
@@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_initialize_events");
+       ACPI_FUNCTION_TRACE(ev_initialize_events);
 
        /* Make sure we have ACPI tables */
 
@@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_install_fadt_gpes");
+       ACPI_FUNCTION_TRACE(ev_install_fadt_gpes);
 
        /* Namespace must be locked */
 
@@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
+       ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers);
 
        /* Install the SCI handler */
 
@@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void)
        u32 fixed_enable;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_NAME("ev_fixed_event_detect");
+       ACPI_FUNCTION_NAME(ev_fixed_event_detect);
 
        /*
         * Read the fixed feature status and enable registers, as all the cases
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void)
         * Check for all possible Fixed Events and dispatch those that are active
         */
        for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
+
                /* Both the status and enable bits must be on for this event */
 
                if ((fixed_status & acpi_gbl_fixed_event_info[i].
                     status_bit_mask)
                    && (fixed_enable & acpi_gbl_fixed_event_info[i].
                        enable_bit_mask)) {
+
                        /* Found an active (signalled) event */
 
                        int_status |= acpi_ev_fixed_event_dispatch((u32) i);
index f64f977dd3d5a04b118ebc6f904f47a138f19ed8..f01d339407f8cc3c42e35b81f0a083ae32e5daf0 100644 (file)
@@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_set_gpe_type");
+       ACPI_FUNCTION_TRACE(ev_set_gpe_type);
 
        /* Validate type and update register enable masks */
 
@@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
        struct acpi_gpe_register_info *gpe_register_info;
        u8 register_bit;
 
-       ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
+       ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks);
 
        gpe_register_info = gpe_event_info->register_info;
        if (!gpe_register_info) {
@@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_enable_gpe");
+       ACPI_FUNCTION_TRACE(ev_enable_gpe);
 
        /* Make sure HW enable masks are updated */
 
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
                ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
 
                if (write_to_hardware) {
+
                        /* Clear the GPE (of stale events), then enable it */
 
                        status = acpi_hw_clear_gpe(gpe_event_info);
@@ -243,7 +244,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_disable_gpe");
+       ACPI_FUNCTION_TRACE(ev_disable_gpe);
 
        if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
                return_ACPI_STATUS(AE_OK);
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
        /* A NULL gpe_block means use the FADT-defined GPE block(s) */
 
        if (!gpe_device) {
+
                /* Examine GPE Block 0 and 1 (These blocks are permanent) */
 
                for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
@@ -380,10 +382,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
        u32 status_reg;
        u32 enable_reg;
        acpi_cpu_flags flags;
+       acpi_cpu_flags hw_flags;
        acpi_native_uint i;
        acpi_native_uint j;
 
-       ACPI_FUNCTION_NAME("ev_gpe_detect");
+       ACPI_FUNCTION_NAME(ev_gpe_detect);
 
        /* Check for the case where there are no GPEs */
 
@@ -391,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                return (int_status);
        }
 
-       /* Examine all GPE blocks attached to this interrupt level */
+       /* We need to hold the GPE lock now, hardware lock in the loop */
 
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
+
+       /* Examine all GPE blocks attached to this interrupt level */
+
        gpe_block = gpe_xrupt_list->gpe_block_list_head;
        while (gpe_block) {
                /*
@@ -402,10 +408,13 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                 * Find all currently active GP events.
                 */
                for (i = 0; i < gpe_block->register_count; i++) {
+
                        /* Get the next status/enable pair */
 
                        gpe_register_info = &gpe_block->register_info[i];
 
+                       hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
+
                        /* Read the Status Register */
 
                        status =
@@ -414,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                                                   &gpe_register_info->
                                                   status_address);
                        if (ACPI_FAILURE(status)) {
+                               acpi_os_release_lock(acpi_gbl_hardware_lock,
+                                                    hw_flags);
                                goto unlock_and_exit;
                        }
 
@@ -424,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                                                   &enable_reg,
                                                   &gpe_register_info->
                                                   enable_address);
+                       acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags);
+
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
@@ -437,6 +450,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 
                        enabled_status_byte = (u8) (status_reg & enable_reg);
                        if (!enabled_status_byte) {
+
                                /* No active GPEs in this register, move on */
 
                                continue;
@@ -445,6 +459,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                        /* Now look at the individual GPEs in this byte register */
 
                        for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
+
                                /* Examine one GPE bit */
 
                                if (enabled_status_byte &
@@ -483,9 +498,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Perform the actual execution of a GPE control method.  This
- *              function is called from an invocation of acpi_os_queue_for_execution
- *              (and therefore does NOT execute at interrupt level) so that
+ * DESCRIPTION: Perform the actual execution of a GPE control method. This
+ *              function is called from an invocation of acpi_os_execute and
+ *              therefore does NOT execute at interrupt level - so that
  *              the control method itself is not executed in the context of
  *              an interrupt handler.
  *
@@ -494,12 +509,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 {
        struct acpi_gpe_event_info *gpe_event_info = (void *)context;
-       u32 gpe_number = 0;
        acpi_status status;
        struct acpi_gpe_event_info local_gpe_event_info;
-       struct acpi_parameter_info info;
+       struct acpi_evaluate_info *info;
 
-       ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
+       ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
@@ -535,22 +549,35 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
         */
        if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
            ACPI_GPE_DISPATCH_METHOD) {
-               /*
-                * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
-                * control method that corresponds to this GPE
-                */
-               info.node = local_gpe_event_info.dispatch.method_node;
-               info.parameters =
-                   ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
-               info.parameter_type = ACPI_PARAM_GPE;
 
-               status = acpi_ns_evaluate_by_handle(&info);
+               /* Allocate the evaluation information block */
+
+               info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+               if (!info) {
+                       status = AE_NO_MEMORY;
+               } else {
+                       /*
+                        * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
+                        * control method that corresponds to this GPE
+                        */
+                       info->prefix_node =
+                           local_gpe_event_info.dispatch.method_node;
+                       info->parameters =
+                           ACPI_CAST_PTR(union acpi_operand_object *,
+                                         gpe_event_info);
+                       info->parameter_type = ACPI_PARAM_GPE;
+                       info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+                       status = acpi_ns_evaluate(info);
+                       ACPI_FREE(info);
+               }
+
                if (ACPI_FAILURE(status)) {
                        ACPI_EXCEPTION((AE_INFO, status,
-                                       "While evaluating method [%4.4s] for GPE[%2X]",
+                                       "While evaluating GPE method [%4.4s]",
                                        acpi_ut_get_node_name
                                        (local_gpe_event_info.dispatch.
-                                        method_node), gpe_number));
+                                        method_node)));
                }
        }
 
@@ -593,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
+       ACPI_FUNCTION_TRACE(ev_gpe_dispatch);
 
        /*
         * If edge-triggered, clear the GPE status bit now.  Note that
@@ -669,9 +696,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
                 * Execute the method associated with the GPE
                 * NOTE: Level-triggered GPEs are cleared after the method completes.
                 */
-               status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
-                                                    acpi_ev_asynch_execute_gpe_method,
-                                                    gpe_event_info);
+               status = acpi_os_execute(OSL_GPE_HANDLER,
+                                        acpi_ev_asynch_execute_gpe_method,
+                                        gpe_event_info);
                if (ACPI_FAILURE(status)) {
                        ACPI_EXCEPTION((AE_INFO, status,
                                        "Unable to queue handler for GPE[%2X] - event disabled",
@@ -716,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
  *
  * DESCRIPTION: Determine if a a GPE is "wake-only".
  *
- *              Called from Notify() code in interpreter when a "device_wake"
+ *              Called from Notify() code in interpreter when a "DeviceWake"
  *              Notify comes in.
  *
  ******************************************************************************/
@@ -726,7 +753,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
+       ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe);
 
        if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */
            ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) {      /* System state at GPE time */
index 0fd00b5ad650c454776908905cc73484f9bc3383..95ddeb48bc0f35bbd718a2b9adf2cc4f783c5c65 100644 (file)
@@ -131,14 +131,14 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
  *
  ******************************************************************************/
 
-acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
+acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
 {
        struct acpi_gpe_block_info *gpe_block;
        struct acpi_gpe_xrupt_info *gpe_xrupt_info;
        acpi_status status = AE_OK;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
+       ACPI_FUNCTION_TRACE(ev_walk_gpe_list);
 
        flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
 
        gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
        while (gpe_xrupt_info) {
+
                /* Walk all Gpe Blocks attached to this interrupt level */
 
                gpe_block = gpe_xrupt_info->gpe_block_list_head;
                while (gpe_block) {
+
                        /* One callback per GPE block */
 
                        status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
@@ -190,11 +192,12 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
        acpi_native_uint i;
        acpi_native_uint j;
 
-       ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers");
+       ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers);
 
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Now look at the individual GPEs in this byte register */
 
                for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
@@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                        if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
                            ACPI_GPE_DISPATCH_HANDLER) {
-                               ACPI_MEM_FREE(gpe_event_info->dispatch.handler);
+                               ACPI_FREE(gpe_event_info->dispatch.handler);
                                gpe_event_info->dispatch.handler = NULL;
                                gpe_event_info->flags &=
                                    ~ACPI_GPE_DISPATCH_MASK;
@@ -248,7 +251,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
        u8 type;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_save_method_info");
+       ACPI_FUNCTION_TRACE(ev_save_method_info);
 
        /*
         * _Lxx and _Exx GPE method support
@@ -279,9 +282,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
        default:
                /* Unknown method type, just ignore it! */
 
-               ACPI_ERROR((AE_INFO,
-                           "Unknown GPE method type: %s (name not of form _Lxx or _Exx)",
-                           name));
+               ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                 "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
+                                 name));
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -289,11 +292,12 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
 
        gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
        if (gpe_number == ACPI_UINT32_MAX) {
+
                /* Conversion failed; invalid method, just ignore it */
 
-               ACPI_ERROR((AE_INFO,
-                           "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
-                           name));
+               ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
+                                 name));
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -364,13 +368,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
        u32 gpe_number;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe");
+       ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe);
 
        /* Check for a _PRW method under this device */
 
        status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
                                         ACPI_BTYPE_PACKAGE, &pkg_desc);
        if (ACPI_FAILURE(status)) {
+
                /* Ignore all errors from _PRW, we don't want to abort the subsystem */
 
                return_ACPI_STATUS(AE_OK);
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
        obj_desc = pkg_desc->package.elements[0];
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
+
                /* Use FADT-defined GPE device (from definition of _PRW) */
 
                target_gpe_device = acpi_gbl_fadt_gpe_device;
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
 
                gpe_number = (u32) obj_desc->integer.value;
        } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
+
                /* Package contains a GPE reference and GPE number within a GPE block */
 
                if ((obj_desc->package.count < 2) ||
@@ -482,7 +489,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
+       ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block);
 
        /* No need for lock since we are not changing any list elements here */
 
@@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
 
        /* Not found, must allocate a new xrupt descriptor */
 
-       gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info));
+       gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info));
        if (!gpe_xrupt) {
                return_PTR(NULL);
        }
@@ -556,7 +563,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
+       ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt);
 
        /* We never want to remove the SCI interrupt handler */
 
@@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
 
        /* Free the block */
 
-       ACPI_MEM_FREE(gpe_xrupt);
+       ACPI_FREE(gpe_xrupt);
        return_ACPI_STATUS(AE_OK);
 }
 
@@ -614,7 +621,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("ev_install_gpe_block");
+       ACPI_FUNCTION_TRACE(ev_install_gpe_block);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
@@ -667,7 +674,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("ev_install_gpe_block");
+       ACPI_FUNCTION_TRACE(ev_install_gpe_block);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
        status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
 
        if (!gpe_block->previous && !gpe_block->next) {
+
                /* This is the last gpe_block on this interrupt */
 
                status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
@@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
 
        /* Free the gpe_block */
 
-       ACPI_MEM_FREE(gpe_block->register_info);
-       ACPI_MEM_FREE(gpe_block->event_info);
-       ACPI_MEM_FREE(gpe_block);
+       ACPI_FREE(gpe_block->register_info);
+       ACPI_FREE(gpe_block->event_info);
+       ACPI_FREE(gpe_block);
 
       unlock_and_exit:
        status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
@@ -736,17 +744,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
        acpi_native_uint j;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks");
+       ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks);
 
        /* Allocate the GPE register information block */
 
-       gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block->
-                                              register_count *
-                                              sizeof(struct
-                                                     acpi_gpe_register_info));
+       gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->
+                                                register_count *
+                                                sizeof(struct
+                                                       acpi_gpe_register_info));
        if (!gpe_register_info) {
                ACPI_ERROR((AE_INFO,
-                           "Could not allocate the gpe_register_info table"));
+                           "Could not allocate the GpeRegisterInfo table"));
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
@@ -754,13 +762,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
         * Allocate the GPE event_info block. There are eight distinct GPEs
         * per register. Initialization to zeros is sufficient.
         */
-       gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block->
-                                            register_count *
-                                            ACPI_GPE_REGISTER_WIDTH) *
-                                           sizeof(struct acpi_gpe_event_info));
+       gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block->
+                                              register_count *
+                                              ACPI_GPE_REGISTER_WIDTH) *
+                                             sizeof(struct
+                                                    acpi_gpe_event_info));
        if (!gpe_event_info) {
                ACPI_ERROR((AE_INFO,
-                           "Could not allocate the gpe_event_info table"));
+                           "Could not allocate the GpeEventInfo table"));
                status = AE_NO_MEMORY;
                goto error_exit;
        }
@@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
        this_event = gpe_event_info;
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Init the register_info for this GPE register (8 GPEs) */
 
                this_register->base_gpe_number =
@@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
       error_exit:
        if (gpe_register_info) {
-               ACPI_MEM_FREE(gpe_register_info);
+               ACPI_FREE(gpe_register_info);
        }
        if (gpe_event_info) {
-               ACPI_MEM_FREE(gpe_event_info);
+               ACPI_FREE(gpe_event_info);
        }
 
        return_ACPI_STATUS(status);
@@ -878,7 +888,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
        acpi_status status;
        struct acpi_gpe_block_info *gpe_block;
 
-       ACPI_FUNCTION_TRACE("ev_create_gpe_block");
+       ACPI_FUNCTION_TRACE(ev_create_gpe_block);
 
        if (!register_count) {
                return_ACPI_STATUS(AE_OK);
@@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
 
        /* Allocate a new GPE block */
 
-       gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info));
+       gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info));
        if (!gpe_block) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
         */
        status = acpi_ev_create_gpe_info_blocks(gpe_block);
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(gpe_block);
+               ACPI_FREE(gpe_block);
                return_ACPI_STATUS(status);
        }
 
@@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
 
        status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(gpe_block);
+               ACPI_FREE(gpe_block);
                return_ACPI_STATUS(status);
        }
 
@@ -971,7 +981,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
        acpi_native_uint i;
        acpi_native_uint j;
 
-       ACPI_FUNCTION_TRACE("ev_initialize_gpe_block");
+       ACPI_FUNCTION_TRACE(ev_initialize_gpe_block);
 
        /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
 
@@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
 
        for (i = 0; i < gpe_block->register_count; i++) {
                for (j = 0; j < 8; j++) {
+
                        /* Get the info block for this particular GPE */
 
                        gpe_event_info =
@@ -1040,7 +1051,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
 
        status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
        if (ACPI_FAILURE(status)) {
-               ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p",
+               ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
                            gpe_block));
        }
 
@@ -1066,7 +1077,7 @@ acpi_status acpi_ev_gpe_initialize(void)
        u32 gpe_number_max = 0;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_gpe_initialize");
+       ACPI_FUNCTION_TRACE(ev_gpe_initialize);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void)
         * particular block is not supported.
         */
        if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
+
                /* GPE block 0 exists (has both length and address > 0) */
 
                register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
@@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void)
        }
 
        if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
+
                /* GPE block 1 exists (has both length and address > 0) */
 
                register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
@@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void)
        /* Exit if there are no GPE registers */
 
        if ((register_count0 + register_count1) == 0) {
+
                /* GPEs are not required by ACPI, this is OK */
 
                ACPI_DEBUG_PRINT((ACPI_DB_INIT,
index 0909ba69577e6806f4315f11389c97518423c2bf..6eef4efddcf62b0f83fba9f2014b61403e4564fe 100644 (file)
 #define _COMPONENT          ACPI_EVENTS
 ACPI_MODULE_NAME("evmisc")
 
+/* Names for Notify() values, used for debug output */
 #ifdef ACPI_DEBUG_OUTPUT
 static const char *acpi_notify_value_names[] = {
        "Bus Check",
        "Device Check",
        "Device Wake",
-       "Eject request",
+       "Eject Request",
        "Device Check Light",
        "Frequency Mismatch",
        "Bus Mode Mismatch",
@@ -124,7 +125,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
        union acpi_generic_state *notify_info;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_NAME("ev_queue_notify_request");
+       ACPI_FUNCTION_NAME(ev_queue_notify_request);
 
        /*
         * For value 3 (Ejection Request), some device method may need to be run.
@@ -150,6 +151,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (obj_desc) {
+
                /* We have the notify object, Get the right handler */
 
                switch (node->type) {
@@ -184,14 +186,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
                        return (AE_NO_MEMORY);
                }
 
-               notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
+               notify_info->common.descriptor_type =
+                   ACPI_DESC_TYPE_STATE_NOTIFY;
                notify_info->notify.node = node;
                notify_info->notify.value = (u16) notify_value;
                notify_info->notify.handler_obj = handler_obj;
 
-               status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
-                                                    acpi_ev_notify_dispatch,
-                                                    notify_info);
+               status =
+                   acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch,
+                                   notify_info);
                if (ACPI_FAILURE(status)) {
                        acpi_ut_delete_generic_state(notify_info);
                }
@@ -240,6 +243,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
         * to the device.
         */
        if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
+
                /* Global system notification handler */
 
                if (acpi_gbl_system_notify.handler) {
@@ -297,6 +301,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
        /* Signal threads that are waiting for the lock */
 
        if (acpi_gbl_global_lock_thread_count) {
+
                /* Send sufficient units to the semaphore */
 
                status =
@@ -335,15 +340,16 @@ static u32 acpi_ev_global_lock_handler(void *context)
         */
        ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
        if (acquired) {
+
                /* Got the lock, now wake all threads waiting for it */
 
                acpi_gbl_global_lock_acquired = TRUE;
 
                /* Run the Global Lock thread which will signal all waiting threads */
 
-               status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
-                                                    acpi_ev_global_lock_thread,
-                                                    context);
+               status =
+                   acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER,
+                                   acpi_ev_global_lock_thread, context);
                if (ACPI_FAILURE(status)) {
                        ACPI_EXCEPTION((AE_INFO, status,
                                        "Could not queue Global Lock thread"));
@@ -371,7 +377,7 @@ acpi_status acpi_ev_init_global_lock_handler(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
+       ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
 
        acpi_gbl_global_lock_present = TRUE;
        status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
@@ -413,7 +419,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
        acpi_status status = AE_OK;
        u8 acquired = FALSE;
 
-       ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
+       ACPI_FUNCTION_TRACE(ev_acquire_global_lock);
 
 #ifndef ACPI_APPLICATION
        /* Make sure that we actually have a global lock */
@@ -439,6 +445,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 
        ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
        if (acquired) {
+
                /* We got the lock */
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -458,8 +465,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
         * Acquire the global lock semaphore first.
         * Since this wait will block, we must release the interpreter
         */
-       status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
-                                              timeout);
+       status =
+           acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
+                                         timeout);
        return_ACPI_STATUS(status);
 }
 
@@ -480,7 +488,7 @@ acpi_status acpi_ev_release_global_lock(void)
        u8 pending = FALSE;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ev_release_global_lock");
+       ACPI_FUNCTION_TRACE(ev_release_global_lock);
 
        if (!acpi_gbl_global_lock_thread_count) {
                ACPI_WARNING((AE_INFO,
@@ -492,6 +500,7 @@ acpi_status acpi_ev_release_global_lock(void)
 
        acpi_gbl_global_lock_thread_count--;
        if (acpi_gbl_global_lock_thread_count) {
+
                /* There are still some threads holding the lock, cannot release */
 
                return_ACPI_STATUS(AE_OK);
@@ -533,7 +542,7 @@ void acpi_ev_terminate(void)
        acpi_native_uint i;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_terminate");
+       ACPI_FUNCTION_TRACE(ev_terminate);
 
        if (acpi_gbl_events_initialized) {
                /*
@@ -573,7 +582,7 @@ void acpi_ev_terminate(void)
        if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
                status = acpi_disable();
                if (ACPI_FAILURE(status)) {
-                       ACPI_WARNING((AE_INFO, "acpi_disable failed"));
+                       ACPI_WARNING((AE_INFO, "AcpiDisable failed"));
                }
        }
        return_VOID;
index 6da58e776413a819123d3401f080ac7df702d9c0..094a17e4c86deec03416cd71cd39fd075e660751 100644 (file)
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void)
        acpi_status status;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ev_install_region_handlers");
+       ACPI_FUNCTION_TRACE(ev_install_region_handlers);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
        acpi_status status;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ev_initialize_op_regions");
+       ACPI_FUNCTION_TRACE(ev_initialize_op_regions);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
         * Run the _REG methods for op_regions in each default address space
         */
        for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
+
                /* TBD: Make sure handler is the DEFAULT handler, otherwise
                 * _REG will have already been run.
                 */
@@ -192,12 +193,12 @@ acpi_status acpi_ev_initialize_op_regions(void)
 acpi_status
 acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 {
-       struct acpi_parameter_info info;
-       union acpi_operand_object *params[3];
+       struct acpi_evaluate_info *info;
+       union acpi_operand_object *args[3];
        union acpi_operand_object *region_obj2;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_execute_reg_method");
+       ACPI_FUNCTION_TRACE(ev_execute_reg_method);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -208,48 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
                return_ACPI_STATUS(AE_OK);
        }
 
+       /* Allocate and initialize the evaluation information block */
+
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       info->prefix_node = region_obj2->extra.method_REG;
+       info->pathname = NULL;
+       info->parameters = args;
+       info->parameter_type = ACPI_PARAM_ARGS;
+       info->flags = ACPI_IGNORE_RETURN_VALUE;
+
        /*
         * The _REG method has two arguments:
         *
-        * Arg0, Integer: Operation region space ID
-        *          Same value as region_obj->Region.space_id
-        * Arg1, Integer: connection status
-        *          1 for connecting the handler,
-        *          0 for disconnecting the handler
-        *          Passed as a parameter
+        * Arg0 - Integer:
+        *  Operation region space ID Same value as region_obj->Region.space_id
+        *
+        * Arg1 - Integer:
+        *  connection status 1 for connecting the handler, 0 for disconnecting
+        *  the handler (Passed as a parameter)
         */
-       params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
-       if (!params[0]) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
+       args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
+       if (!args[0]) {
+               status = AE_NO_MEMORY;
+               goto cleanup1;
        }
 
-       params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
-       if (!params[1]) {
+       args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
+       if (!args[1]) {
                status = AE_NO_MEMORY;
-               goto cleanup;
+               goto cleanup2;
        }
 
        /* Setup the parameter objects */
 
-       params[0]->integer.value = region_obj->region.space_id;
-       params[1]->integer.value = function;
-       params[2] = NULL;
-
-       info.node = region_obj2->extra.method_REG;
-       info.parameters = params;
-       info.parameter_type = ACPI_PARAM_ARGS;
+       args[0]->integer.value = region_obj->region.space_id;
+       args[1]->integer.value = function;
+       args[2] = NULL;
 
        /* Execute the method, no return value */
 
        ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
-                       (ACPI_TYPE_METHOD, info.node, NULL));
-       status = acpi_ns_evaluate_by_handle(&info);
+                       (ACPI_TYPE_METHOD, info->prefix_node, NULL));
 
-       acpi_ut_remove_reference(params[1]);
+       status = acpi_ns_evaluate(info);
+       acpi_ut_remove_reference(args[1]);
 
-      cleanup:
-       acpi_ut_remove_reference(params[0]);
+      cleanup2:
+       acpi_ut_remove_reference(args[0]);
 
+      cleanup1:
+       ACPI_FREE(info);
        return_ACPI_STATUS(status);
 }
 
@@ -261,7 +274,8 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
  *              Function            - Read or Write operation
  *              Address             - Where in the space to read or write
  *              bit_width           - Field width in bits (8, 16, 32, or 64)
- *              Value               - Pointer to in or out value
+ *              Value               - Pointer to in or out value, must be
+ *                                    full 64-bit acpi_integer
  *
  * RETURN:      Status
  *
@@ -274,7 +288,7 @@ acpi_status
 acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                               u32 function,
                               acpi_physical_address address,
-                              u32 bit_width, void *value)
+                              u32 bit_width, acpi_integer * value)
 {
        acpi_status status;
        acpi_status status2;
@@ -284,7 +298,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
        union acpi_operand_object *region_obj2;
        void *region_context = NULL;
 
-       ACPI_FUNCTION_TRACE("ev_address_space_dispatch");
+       ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -315,6 +329,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                 */
                region_setup = handler_desc->address_space.setup;
                if (!region_setup) {
+
                        /* No initialization routine, exit with error */
 
                        ACPI_ERROR((AE_INFO,
@@ -361,9 +376,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                        region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
                        if (region_obj2->extra.region_context) {
+
                                /* The handler for this region was already installed */
 
-                               ACPI_MEM_FREE(region_context);
+                               ACPI_FREE(region_context);
                        } else {
                                /*
                                 * Save the returned context for use in all accesses to
@@ -386,9 +402,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                          acpi_ut_get_region_name(region_obj->region.
                                                  space_id)));
 
-       if (!
-           (handler_desc->address_space.
-            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!(handler_desc->address_space.handler_flags &
+             ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * For handlers other than the default (supplied) handlers, we must
                 * exit the interpreter because the handler *might* block -- we don't
@@ -409,9 +424,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                                                        space_id)));
        }
 
-       if (!
-           (handler_desc->address_space.
-            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!(handler_desc->address_space.handler_flags &
+             ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * We just returned from a non-default handler, we must re-enter the
                 * interpreter
@@ -451,7 +465,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
        union acpi_operand_object *region_obj2;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_detach_region");
+       ACPI_FUNCTION_TRACE(ev_detach_region);
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
@@ -463,6 +477,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
 
        handler_obj = region_obj->region.handler;
        if (!handler_obj) {
+
                /* This region has no handler, all done */
 
                return_VOID;
@@ -474,6 +489,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
        last_obj_ptr = &handler_obj->address_space.region_list;
 
        while (obj_desc) {
+
                /* Is this the correct Region? */
 
                if (obj_desc == region_obj) {
@@ -583,7 +599,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
                      u8 acpi_ns_is_locked)
 {
 
-       ACPI_FUNCTION_TRACE("ev_attach_region");
+       ACPI_FUNCTION_TRACE(ev_attach_region);
 
        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
                          "Adding Region [%4.4s] %p to address handler %p [%s]\n",
@@ -636,7 +652,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("ev_install_handler");
+       ACPI_FUNCTION_NAME(ev_install_handler);
 
        handler_obj = (union acpi_operand_object *)context;
 
@@ -666,6 +682,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
+
                /* No object, just exit */
 
                return (AE_OK);
@@ -674,10 +691,12 @@ acpi_ev_install_handler(acpi_handle obj_handle,
        /* Devices are handled different than regions */
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
+
                /* Check if this Device already has a handler for this address space */
 
                next_handler_obj = obj_desc->device.handler;
                while (next_handler_obj) {
+
                        /* Found a handler, is it for the same address space? */
 
                        if (next_handler_obj->address_space.space_id ==
@@ -764,9 +783,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        union acpi_operand_object *handler_obj;
        acpi_status status;
        acpi_object_type type;
-       u16 flags = 0;
+       u8 flags = 0;
 
-       ACPI_FUNCTION_TRACE("ev_install_space_handler");
+       ACPI_FUNCTION_TRACE(ev_install_space_handler);
 
        /*
         * This registration is valid for only the types below
@@ -839,6 +858,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
                /* Walk the handler list for this device */
 
                while (handler_obj) {
+
                        /* Same space_id indicates a handler already installed */
 
                        if (handler_obj->address_space.space_id == space_id) {
@@ -921,7 +941,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
        /* Init handler obj */
 
        handler_obj->address_space.space_id = (u8) space_id;
-       handler_obj->address_space.hflags = flags;
+       handler_obj->address_space.handler_flags = flags;
        handler_obj->address_space.region_list = NULL;
        handler_obj->address_space.node = node;
        handler_obj->address_space.handler = handler;
@@ -979,7 +999,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_execute_reg_methods");
+       ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
 
        /*
         * Run all _REG methods for all Operation Regions for this
@@ -1001,7 +1021,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
  *
  * PARAMETERS:  walk_namespace callback
  *
- * DESCRIPTION: Run _REg method for region objects of the requested space_iD
+ * DESCRIPTION: Run _REG method for region objects of the requested space_iD
  *
  ******************************************************************************/
 
@@ -1035,6 +1055,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
+
                /* No object, just exit */
 
                return (AE_OK);
index baed8c1a1b9fb74542f9ef1345382ab1a660fa09..5b3c7a85eb9a609e7e1fcbc8910f15e95e5f1f26 100644 (file)
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
            (union acpi_operand_object *)handle;
        struct acpi_mem_space_context *local_region_context;
 
-       ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
+       ACPI_FUNCTION_TRACE(ev_system_memory_region_setup);
 
        if (function == ACPI_REGION_DEACTIVATE) {
                if (*region_context) {
-                       ACPI_MEM_FREE(*region_context);
+                       local_region_context =
+                           (struct acpi_mem_space_context *)*region_context;
+
+                       /* Delete a cached mapping if present */
+
+                       if (local_region_context->mapped_length) {
+                               acpi_os_unmap_memory(local_region_context->
+                                                    mapped_logical_address,
+                                                    local_region_context->
+                                                    mapped_length);
+                       }
+                       ACPI_FREE(local_region_context);
                        *region_context = NULL;
                }
                return_ACPI_STATUS(AE_OK);
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
        /* Create a new context */
 
        local_region_context =
-           ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context));
+           ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context));
        if (!(local_region_context)) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle,
                              u32 function,
                              void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
+       ACPI_FUNCTION_TRACE(ev_io_space_region_setup);
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
            (union acpi_operand_object *)handle;
        struct acpi_device_id object_hID;
 
-       ACPI_FUNCTION_TRACE("ev_pci_config_region_setup");
+       ACPI_FUNCTION_TRACE(ev_pci_config_region_setup);
 
        handler_obj = region_obj->region.handler;
        if (!handler_obj) {
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
        *region_context = NULL;
        if (function == ACPI_REGION_DEACTIVATE) {
                if (pci_id) {
-                       ACPI_MEM_FREE(pci_id);
+                       ACPI_FREE(pci_id);
                }
                return_ACPI_STATUS(status);
        }
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
         * handlers with that device.
         */
        if (handler_obj->address_space.node == acpi_gbl_root_node) {
+
                /* Start search from the parent object */
 
                pci_root_node = parent_node;
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
                                        PCI_EXPRESS_ROOT_HID_STRING,
                                        sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
                                {
+
                                        /* Install a handler for this PCI root bridge */
 
                                        status =
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
                                                } else {
                                                        ACPI_EXCEPTION((AE_INFO,
                                                                        status,
-                                                                       "Could not install pci_config handler for Root Bridge %4.4s",
+                                                                       "Could not install PciConfig handler for Root Bridge %4.4s",
                                                                        acpi_ut_get_node_name
                                                                        (pci_root_node)));
                                                }
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
 
        /* Region is still not initialized. Create a new context */
 
-       pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id));
+       pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id));
        if (!pci_id) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle,
                             u32 function,
                             void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
+       ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup);
 
        return_ACPI_STATUS(AE_OK);
 }
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle,
                          u32 function,
                          void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
+       ACPI_FUNCTION_TRACE(ev_cmos_region_setup);
 
        return_ACPI_STATUS(AE_OK);
 }
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle,
                             u32 function,
                             void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE("ev_default_region_setup");
+       ACPI_FUNCTION_TRACE(ev_default_region_setup);
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
        acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
        union acpi_operand_object *region_obj2;
 
-       ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
+       ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked);
 
        if (!region_obj) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
 
        /* Find any "_REG" method associated with this region definition */
 
-       status = acpi_ns_search_node(*reg_name_ptr, node,
-                                    ACPI_TYPE_METHOD, &method_node);
+       status =
+           acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
+                                    &method_node);
        if (ACPI_SUCCESS(status)) {
                /*
                 * The _REG method is optional and there can be only one per region
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
         * ie: acpi_gbl_root_node->parent_entry being set to NULL
         */
        while (node) {
+
                /* Check to see if a handler exists */
 
                handler_obj = NULL;
                obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
+
                        /* Can only be a handler if the object exists */
 
                        switch (node->type) {
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
                        }
 
                        while (handler_obj) {
+
                                /* Is this handler of the correct type? */
 
                                if (handler_obj->address_space.space_id ==
                                    space_id) {
+
                                        /* Found correct handler */
 
                                        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
        /* If we get here, there is no handler for this region */
 
        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
-                         "No handler for region_type %s(%X) (region_obj %p)\n",
+                         "No handler for RegionType %s(%X) (RegionObj %p)\n",
                          acpi_ut_get_region_name(space_id), space_id,
                          region_obj));
 
index 9a622169008a45d261131f925093c39eef153656..8106215ad55457a8898d7caf07b03f760761a022 100644 (file)
@@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
        struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
        u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
-       ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
+       ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler);
 
        /*
         * We are guaranteed by the ACPI CA initialization/shutdown code that
@@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
        struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
        u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
-       ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
+       ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler);
 
        /*
         * We are guaranteed by the ACPI CA initialization/shutdown code that
@@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void)
 {
        u32 status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ev_install_sci_handler");
+       ACPI_FUNCTION_TRACE(ev_install_sci_handler);
 
        status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
                                                   acpi_ev_sci_xrupt_handler,
@@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
+       ACPI_FUNCTION_TRACE(ev_remove_sci_handler);
 
        /* Just let the OS remove the handler and disable the level */
 
index b38b39dde54318619a29268bebf4ec6bb61df56c..76c34a66e0e0cddc19db672150d8295183004e7e 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
@@ -68,7 +66,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
+       ACPI_FUNCTION_TRACE(acpi_install_exception_handler);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
        if (ACPI_FAILURE(status)) {
@@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        return_ACPI_STATUS(status);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -107,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
  *              event.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_install_fixed_event_handler(u32 event,
                                 acpi_event_handler handler, void *context)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
+       ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler);
 
        /* Parameter validation */
 
@@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_install_fixed_event_handler);
+ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler)
 
 /*******************************************************************************
  *
@@ -175,13 +174,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
  * DESCRIPTION: Disables the event and unregisters the event handler.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
+       ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler);
 
        /* Parameter validation */
 
@@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
+ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
 
 /*******************************************************************************
  *
@@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
  * DESCRIPTION: Install a handler for notifies on an ACPI device
  *
  ******************************************************************************/
-
 acpi_status
 acpi_install_notify_handler(acpi_handle device,
                            u32 handler_type,
@@ -246,7 +243,7 @@ acpi_install_notify_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
+       ACPI_FUNCTION_TRACE(acpi_install_notify_handler);
 
        /* Parameter validation */
 
@@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device,
         * only one <external> global handler can be regsitered (per notify type).
         */
        if (device == ACPI_ROOT_OBJECT) {
+
                /* Make sure the handler is not already installed */
 
                if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle device,
 
                obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
+
                        /* Object exists - make sure there's no handler */
 
                        if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle device,
                }
 
                if (handler_type == ACPI_ALL_NOTIFY) {
+
                        /* Extra ref if installed in both */
 
                        acpi_ut_add_reference(notify_obj);
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_install_notify_handler);
+ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
 
 /*******************************************************************************
  *
@@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
  * DESCRIPTION: Remove a handler for notifies on an ACPI device
  *
  ******************************************************************************/
-
 acpi_status
 acpi_remove_notify_handler(acpi_handle device,
                           u32 handler_type, acpi_notify_handler handler)
@@ -409,7 +408,7 @@ acpi_remove_notify_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
+       ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
 
        /* Parameter validation */
 
@@ -535,7 +534,7 @@ acpi_remove_notify_handler(acpi_handle device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_remove_notify_handler);
+ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler)
 
 /*******************************************************************************
  *
@@ -554,7 +553,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
  * DESCRIPTION: Install a handler for a General Purpose Event.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_install_gpe_handler(acpi_handle gpe_device,
                         u32 gpe_number,
@@ -565,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
+       ACPI_FUNCTION_TRACE(acpi_install_gpe_handler);
 
        /* Parameter validation */
 
@@ -596,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
 
        /* Allocate and init handler object */
 
-       handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
+       handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
        if (!handler) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
@@ -630,7 +628,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_install_gpe_handler);
+ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
 
 /*******************************************************************************
  *
@@ -646,7 +644,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
  * DESCRIPTION: Remove a handler for a General Purpose acpi_event.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_remove_gpe_handler(acpi_handle gpe_device,
                        u32 gpe_number, acpi_event_handler address)
@@ -656,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
        acpi_status status;
        acpi_cpu_flags flags;
 
-       ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
+       ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler);
 
        /* Parameter validation */
 
@@ -724,14 +721,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
 
        /* Now we can free the handler object */
 
-       ACPI_MEM_FREE(handler);
+       ACPI_FREE(handler);
 
       unlock_and_exit:
        (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_remove_gpe_handler);
+ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
 
 /*******************************************************************************
  *
@@ -746,7 +743,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
  * DESCRIPTION: Acquire the ACPI Global Lock
  *
  ******************************************************************************/
-
 acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
 {
        acpi_status status;
@@ -771,7 +767,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_acquire_global_lock);
+ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock)
 
 /*******************************************************************************
  *
@@ -784,7 +780,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
  * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
  *
  ******************************************************************************/
-
 acpi_status acpi_release_global_lock(u32 handle)
 {
        acpi_status status;
@@ -797,4 +792,4 @@ acpi_status acpi_release_global_lock(u32 handle)
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_release_global_lock);
+ACPI_EXPORT_SYMBOL(acpi_release_global_lock)
index ec9ce8429f15b823d5b0077f1e9da1c69888d70b..7ebc2efac936ce5a2d3a7005a508fe658580af4c 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
@@ -65,7 +63,7 @@ acpi_status acpi_enable(void)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_enable");
+       ACPI_FUNCTION_TRACE(acpi_enable);
 
        /* Make sure we have the FADT */
 
@@ -94,6 +92,8 @@ acpi_status acpi_enable(void)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_enable)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable
@@ -105,12 +105,11 @@ acpi_status acpi_enable(void)
  * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
  *
  ******************************************************************************/
-
 acpi_status acpi_disable(void)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_disable");
+       ACPI_FUNCTION_TRACE(acpi_disable);
 
        if (!acpi_gbl_FADT) {
                ACPI_WARNING((AE_INFO, "No FADT information present!"));
@@ -137,6 +136,8 @@ acpi_status acpi_disable(void)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_disable)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable_event
@@ -149,13 +150,12 @@ acpi_status acpi_disable(void)
  * DESCRIPTION: Enable an ACPI event (fixed)
  *
  ******************************************************************************/
-
 acpi_status acpi_enable_event(u32 event, u32 flags)
 {
        acpi_status status = AE_OK;
        u32 value;
 
-       ACPI_FUNCTION_TRACE("acpi_enable_event");
+       ACPI_FUNCTION_TRACE(acpi_enable_event);
 
        /* Decode the Fixed Event */
 
@@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_enable_event);
+ACPI_EXPORT_SYMBOL(acpi_enable_event)
 
 /*******************************************************************************
  *
@@ -208,13 +208,12 @@ EXPORT_SYMBOL(acpi_enable_event);
  * DESCRIPTION: Set the type of an individual GPE
  *
  ******************************************************************************/
-
 acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
 {
        acpi_status status = AE_OK;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
+       ACPI_FUNCTION_TRACE(acpi_set_gpe_type);
 
        /* Ensure that we have a valid GPE number */
 
@@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_set_gpe_type);
+ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
 
 /*******************************************************************************
  *
@@ -252,13 +251,12 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
  * DESCRIPTION: Enable an ACPI event (general purpose)
  *
  ******************************************************************************/
-
 acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
        acpi_status status = AE_OK;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE("acpi_enable_gpe");
+       ACPI_FUNCTION_TRACE(acpi_enable_gpe);
 
        /* Use semaphore lock if not executing at interrupt level */
 
@@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_enable_gpe);
+ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
 
 /*******************************************************************************
  *
@@ -304,13 +302,12 @@ EXPORT_SYMBOL(acpi_enable_gpe);
  * DESCRIPTION: Disable an ACPI event (general purpose)
  *
  ******************************************************************************/
-
 acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
        acpi_status status = AE_OK;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE("acpi_disable_gpe");
+       ACPI_FUNCTION_TRACE(acpi_disable_gpe);
 
        /* Use semaphore lock if not executing at interrupt level */
 
@@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable_event
@@ -350,13 +349,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
  * DESCRIPTION: Disable an ACPI event (fixed)
  *
  ******************************************************************************/
-
 acpi_status acpi_disable_event(u32 event, u32 flags)
 {
        acpi_status status = AE_OK;
        u32 value;
 
-       ACPI_FUNCTION_TRACE("acpi_disable_event");
+       ACPI_FUNCTION_TRACE(acpi_disable_event);
 
        /* Decode the Fixed Event */
 
@@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_disable_event);
+ACPI_EXPORT_SYMBOL(acpi_disable_event)
 
 /*******************************************************************************
  *
@@ -405,12 +403,11 @@ EXPORT_SYMBOL(acpi_disable_event);
  * DESCRIPTION: Clear an ACPI event (fixed)
  *
  ******************************************************************************/
-
 acpi_status acpi_clear_event(u32 event)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_clear_event");
+       ACPI_FUNCTION_TRACE(acpi_clear_event);
 
        /* Decode the Fixed Event */
 
@@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_clear_event);
+ACPI_EXPORT_SYMBOL(acpi_clear_event)
 
 /*******************************************************************************
  *
@@ -444,13 +441,12 @@ EXPORT_SYMBOL(acpi_clear_event);
  * DESCRIPTION: Clear an ACPI event (general purpose)
  *
  ******************************************************************************/
-
 acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
        acpi_status status = AE_OK;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE("acpi_clear_gpe");
+       ACPI_FUNCTION_TRACE(acpi_clear_gpe);
 
        /* Use semaphore lock if not executing at interrupt level */
 
@@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
+
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -492,12 +490,11 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
  * DESCRIPTION: Obtains and returns the current status of the event
  *
  ******************************************************************************/
-
 acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_get_event_status");
+       ACPI_FUNCTION_TRACE(acpi_get_event_status);
 
        if (!event_status) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_get_event_status)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_gpe_status
@@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
  * DESCRIPTION: Get status of an event (general purpose)
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_gpe_status(acpi_handle gpe_device,
                    u32 gpe_number, u32 flags, acpi_event_status * event_status)
@@ -541,7 +539,7 @@ acpi_get_gpe_status(acpi_handle gpe_device,
        acpi_status status = AE_OK;
        struct acpi_gpe_event_info *gpe_event_info;
 
-       ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
+       ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
 
        /* Use semaphore lock if not executing at interrupt level */
 
@@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_device,
        }
        return_ACPI_STATUS(status);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_device,
  * DESCRIPTION: Create and Install a block of GPE registers
  *
  ******************************************************************************/
-
 acpi_status
 acpi_install_gpe_block(acpi_handle gpe_device,
                       struct acpi_generic_address *gpe_block_address,
@@ -597,7 +596,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
        struct acpi_namespace_node *node;
        struct acpi_gpe_block_info *gpe_block;
 
-       ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
+       ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
 
        if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
 
        obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
+
                /* No object, create a new one */
 
                obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
@@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_install_gpe_block);
+ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
 
 /*******************************************************************************
  *
@@ -678,14 +678,13 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
  * DESCRIPTION: Remove a previously installed block of GPE registers
  *
  ******************************************************************************/
-
 acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
        struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
+       ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
 
        if (!gpe_device) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_remove_gpe_block);
+ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
index abf5caca9ae5a541596e6ee612665cc4566b9a82..e8b86a0baad01f710121fe977d1d920d0606dcf9 100644 (file)
@@ -42,8 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
@@ -75,7 +73,7 @@ acpi_install_address_space_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
+       ACPI_FUNCTION_TRACE(acpi_install_address_space_handler);
 
        /* Parameter validation */
 
@@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_handle device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_install_address_space_handler);
+ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler)
 
 /*******************************************************************************
  *
@@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
  * DESCRIPTION: Remove a previously installed handler.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_remove_address_space_handler(acpi_handle device,
                                  acpi_adr_space_type space_id,
@@ -142,7 +139,7 @@ acpi_remove_address_space_handler(acpi_handle device,
        struct acpi_namespace_node *node;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
+       ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler);
 
        /* Parameter validation */
 
@@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_handle device,
        handler_obj = obj_desc->device.handler;
        last_obj_ptr = &obj_desc->device.handler;
        while (handler_obj) {
+
                /* We have a handler, see if user requested this one */
 
                if (handler_obj->address_space.space_id == space_id) {
+
                        /* Matched space_id, first dereference this in the Regions */
 
                        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
@@ -229,7 +228,7 @@ acpi_remove_address_space_handler(acpi_handle device,
        /* The handler does not exist */
 
        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
-                         "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
+                         "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
                          handler, acpi_ut_get_region_name(space_id), space_id,
                          node, obj_desc));
 
@@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_handle device,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_remove_address_space_handler);
+ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler)
index a29782fe3ecf20e3bd2c9e44469b3cc9af5b75f6..823352435e08ab676cdf26e4489b009ae371cd28 100644 (file)
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
        struct acpi_table_desc table_info;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE("ex_add_table");
+       ACPI_FUNCTION_TRACE(ex_add_table);
 
        /* Create an object to be the table handle */
 
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
 
        ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
 
-       table_info.type = ACPI_TABLE_SSDT;
+       table_info.type = ACPI_TABLE_ID_SSDT;
        table_info.pointer = table;
        table_info.length = (acpi_size) table->length;
        table_info.allocation = ACPI_MEM_ALLOCATED;
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
 
        if (ACPI_FAILURE(status)) {
                if (status == AE_ALREADY_EXISTS) {
+
                        /* Table already exists, just return the handle */
 
                        return_ACPI_STATUS(AE_OK);
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table,
 
        status = acpi_ns_load_table(table_info.installed_desc, parent_node);
        if (ACPI_FAILURE(status)) {
+
                /* Uninstall table on error */
 
                (void)acpi_tb_uninstall_table(table_info.installed_desc);
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
        struct acpi_namespace_node *parameter_node = NULL;
        union acpi_operand_object *ddb_handle;
 
-       ACPI_FUNCTION_TRACE("ex_load_table_op");
+       ACPI_FUNCTION_TRACE(ex_load_table_op);
 
 #if 0
        /*
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
         */
        status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
        if (status == AE_OK) {
+
                /* Signature matched -- don't allow override */
 
                return_ACPI_STATUS(AE_ALREADY_EXISTS);
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
                 * location within the namespace where the table will be loaded.
                 */
                status =
-                   acpi_ns_get_node_by_path(operand[3]->string.pointer,
-                                            start_node, ACPI_NS_SEARCH_PARENT,
-                                            &parent_node);
+                   acpi_ns_get_node(start_node, operand[3]->string.pointer,
+                                    ACPI_NS_SEARCH_PARENT, &parent_node);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
                /* Find the node referenced by the parameter_path_string */
 
                status =
-                   acpi_ns_get_node_by_path(operand[4]->string.pointer,
-                                            start_node, ACPI_NS_SEARCH_PARENT,
-                                            &parameter_node);
+                   acpi_ns_get_node(start_node, operand[4]->string.pointer,
+                                    ACPI_NS_SEARCH_PARENT, &parameter_node);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
        /* Parameter Data (optional) */
 
        if (parameter_node) {
+
                /* Store the parameter data into the optional parameter object */
 
                status = acpi_ex_store(operand[5],
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
        struct acpi_table_header *table_ptr = NULL;
        acpi_physical_address address;
        struct acpi_table_header table_header;
+       acpi_integer temp;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ex_load_op");
+       ACPI_FUNCTION_TRACE(ex_load_op);
 
        /* Object can be either an op_region or a Field */
 
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
                address = obj_desc->region.address;
 
-               /* Get the table length from the table header */
+               /* Get part of the table header to get the table length */
 
                table_header.length = 0;
                for (i = 0; i < 8; i++) {
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                            acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
                                                           (acpi_physical_address)
                                                           (i + address), 8,
-                                                          ((u8 *) &
-                                                           table_header) + i);
+                                                          &temp);
                        if (ACPI_FAILURE(status)) {
                                return_ACPI_STATUS(status);
                        }
+
+                       /* Get the one valid byte of the returned 64-bit value */
+
+                       ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp;
                }
 
                /* Sanity check the table length */
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
                /* Allocate a buffer for the entire table */
 
-               table_ptr = ACPI_MEM_ALLOCATE(table_header.length);
+               table_ptr = ACPI_ALLOCATE(table_header.length);
                if (!table_ptr) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                            acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
                                                           (acpi_physical_address)
                                                           (i + address), 8,
-                                                          ((u8 *) table_ptr +
-                                                           i));
+                                                          &temp);
                        if (ACPI_FAILURE(status)) {
                                goto cleanup;
                        }
+
+                       /* Get the one valid byte of the returned 64-bit value */
+
+                       ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp;
                }
                break;
 
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
        /* The table must be either an SSDT or a PSDT */
 
-       if ((!ACPI_STRNCMP(table_ptr->signature,
-                          acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
-                          acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
-           (!ACPI_STRNCMP(table_ptr->signature,
-                          acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
-                          acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
+       if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) &&
+           (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) {
                ACPI_ERROR((AE_INFO,
                            "Table has invalid signature [%4.4s], must be SSDT or PSDT",
                            table_ptr->signature));
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
        status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
        if (ACPI_FAILURE(status)) {
+
                /* On error, table_ptr was deallocated above */
 
                return_ACPI_STATUS(status);
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 
       cleanup:
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(table_ptr);
+               ACPI_FREE(table_ptr);
        }
        return_ACPI_STATUS(status);
 }
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
        union acpi_operand_object *table_desc = ddb_handle;
        struct acpi_table_desc *table_info;
 
-       ACPI_FUNCTION_TRACE("ex_unload_table");
+       ACPI_FUNCTION_TRACE(ex_unload_table);
 
        /*
         * Validate the handle
index e6d52e12d77a6bc18a35c9e54ccae51d84aa0a23..b732e399b1eff86abb6439ef0657ff9a5fda0272 100644 (file)
@@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
        u32 count;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc);
 
        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_INTEGER:
@@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
        union acpi_operand_object *return_desc;
        u8 *new_buf;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc);
 
        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_BUFFER:
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
                remainder = 0;
 
                for (i = decimal_length; i > 0; i--) {
+
                        /* Divide by nth factor of 10 */
 
                        digit = integer;
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
 
                hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
                for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
+
                        /* Get one hex digit, most significant digits first */
 
                        string[k] =
@@ -400,7 +402,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
        u16 base = 16;
        u8 separator = ',';
 
-       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc);
 
        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_STRING:
@@ -567,7 +569,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_convert_to_target_type");
+       ACPI_FUNCTION_TRACE(ex_convert_to_target_type);
 
        /* Default behavior */
 
@@ -657,7 +659,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
 
        default:
                ACPI_ERROR((AE_INFO,
-                           "Unknown Target type ID 0x%X aml_opcode %X dest_type %s",
+                           "Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
                            GET_CURRENT_ARG_TYPE(walk_state->op_info->
                                                 runtime_args),
                            walk_state->opcode,
index 680575402835aa735b7bb76ecc1f536e0d94fedb..106dc7219df713a70495e915655a3d6b7f362c97 100644 (file)
@@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
        struct acpi_namespace_node *alias_node;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_create_alias");
+       ACPI_FUNCTION_TRACE(ex_create_alias);
 
        /* Get the source/alias operands (both namespace nodes) */
 
@@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
        acpi_status status;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE("ex_create_event");
+       ACPI_FUNCTION_TRACE(ex_create_event);
 
        obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
        if (!obj_desc) {
@@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS);
+       ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS);
 
        /* Create the new mutex object */
 
@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
        obj_desc->mutex.node =
            (struct acpi_namespace_node *)walk_state->operands[0];
 
-       status = acpi_ns_attach_object(obj_desc->mutex.node,
-                                      obj_desc, ACPI_TYPE_MUTEX);
+       status =
+           acpi_ns_attach_object(obj_desc->mutex.node, obj_desc,
+                                 ACPI_TYPE_MUTEX);
 
       cleanup:
        /*
@@ -280,7 +281,7 @@ acpi_ex_create_region(u8 * aml_start,
        struct acpi_namespace_node *node;
        union acpi_operand_object *region_obj2;
 
-       ACPI_FUNCTION_TRACE("ex_create_region");
+       ACPI_FUNCTION_TRACE(ex_create_region);
 
        /* Get the Namespace Node */
 
@@ -300,7 +301,7 @@ acpi_ex_create_region(u8 * aml_start,
         */
        if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
            (region_space < ACPI_USER_REGION_BEGIN)) {
-               ACPI_ERROR((AE_INFO, "Invalid address_space type %X",
+               ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X",
                            region_space));
                return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
        }
@@ -364,7 +365,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
        struct acpi_table_header *table;
        union acpi_operand_object *region_obj2;
 
-       ACPI_FUNCTION_TRACE("ex_create_table_region");
+       ACPI_FUNCTION_TRACE(ex_create_table_region);
 
        /* Get the Node from the object stack  */
 
@@ -452,7 +453,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state);
 
        /* Create the processor object */
 
@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
        /* Initialize the processor object from the operands */
 
        obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
+       obj_desc->processor.length = (u8) operand[3]->integer.value;
        obj_desc->processor.address =
            (acpi_io_address) operand[2]->integer.value;
-       obj_desc->processor.length = (u8) operand[3]->integer.value;
 
        /* Install the processor object in the parent Node */
 
@@ -499,7 +500,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
        acpi_status status;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state);
 
        /* Create the power resource object */
 
@@ -549,7 +550,7 @@ acpi_ex_create_method(u8 * aml_start,
        acpi_status status;
        u8 method_flags;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state);
 
        /* Create a new method object */
 
index a7cca8d4f85525f950724527e8df053bb3be5013..7b9718e976bf44f5e0575750f2be6eec5d5df427 100644 (file)
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value);
 
 static void acpi_ex_out_address(char *title, acpi_physical_address value);
 
+static void
+acpi_ex_dump_object(union acpi_operand_object *obj_desc,
+                   struct acpi_exdump_info *info);
+
 static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
 
 static void
@@ -119,7 +123,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = {
 
 static struct acpi_exdump_info acpi_ex_dump_method[8] = {
        {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
-       {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"},
+       {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"},
        {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"},
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"},
        {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
@@ -263,12 +267,10 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
 };
 
-static struct acpi_exdump_info acpi_ex_dump_node[6] = {
+static struct acpi_exdump_info acpi_ex_dump_node[5] = {
        {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
        {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
        {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
-       {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count),
-        "Reference Count"},
        {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"},
        {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"}
 };
@@ -330,7 +332,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
 
        if (!info) {
                acpi_os_printf
-                   ("ex_dump_object: Display not implemented for object type %s\n",
+                   ("ExDumpObject: Display not implemented for object type %s\n",
                     acpi_ut_get_object_type_name(obj_desc));
                return;
        }
@@ -454,7 +456,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
        u32 length;
        u32 index;
 
-       ACPI_FUNCTION_NAME("ex_dump_operand")
+       ACPI_FUNCTION_NAME(ex_dump_operand)
 
            if (!
                ((ACPI_LV_EXEC & acpi_dbg_level)
@@ -463,6 +465,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
        }
 
        if (!obj_desc) {
+
                /* This could be a null element of a package */
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
@@ -522,7 +525,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
                case AML_REF_OF_OP:
 
-                       acpi_os_printf("Reference: (ref_of) %p\n",
+                       acpi_os_printf("Reference: (RefOf) %p\n",
                                       obj_desc->reference.object);
                        break;
 
@@ -532,6 +535,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
                                       obj_desc->reference.offset);
 
                        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
+
                                /* Value is an Integer */
 
                                acpi_os_printf(" value is [%8.8X%8.8x]",
@@ -610,7 +614,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
        case ACPI_TYPE_PACKAGE:
 
-               acpi_os_printf("Package [Len %X] element_array %p\n",
+               acpi_os_printf("Package [Len %X] ElementArray %p\n",
                               obj_desc->package.count,
                               obj_desc->package.elements);
 
@@ -662,13 +666,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
        case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-               acpi_os_printf("bank_field\n");
+               acpi_os_printf("BankField\n");
                break;
 
        case ACPI_TYPE_LOCAL_REGION_FIELD:
 
                acpi_os_printf
-                   ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+                   ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
                     obj_desc->field.bit_length,
                     obj_desc->field.access_byte_width,
                     obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
@@ -681,12 +685,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               acpi_os_printf("index_field\n");
+               acpi_os_printf("IndexField\n");
                break;
 
        case ACPI_TYPE_BUFFER_FIELD:
 
-               acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n",
+               acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n",
                               obj_desc->buffer_field.bit_length,
                               obj_desc->buffer_field.base_byte_offset,
                               obj_desc->buffer_field.start_field_bit_offset);
@@ -777,7 +781,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
 {
        acpi_native_uint i;
 
-       ACPI_FUNCTION_NAME("ex_dump_operands");
+       ACPI_FUNCTION_NAME(ex_dump_operands);
 
        if (!ident) {
                ident = "?";
@@ -901,7 +905,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
                        acpi_os_printf("Could not convert name to pathname\n");
                } else {
                        acpi_os_printf("%s\n", (char *)ret_buf.pointer);
-                       ACPI_MEM_FREE(ret_buf.pointer);
+                       ACPI_FREE(ret_buf.pointer);
                }
        } else if (obj_desc->reference.object) {
                acpi_os_printf("\nReferenced Object: %p\n",
@@ -1017,7 +1021,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
 void
 acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
 {
-       ACPI_FUNCTION_TRACE("ex_dump_object_descriptor");
+       ACPI_FUNCTION_TRACE(ex_dump_object_descriptor);
 
        if (!obj_desc) {
                return_VOID;
@@ -1046,7 +1050,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
 
        if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
                acpi_os_printf
-                   ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
+                   ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
                     obj_desc, acpi_ut_get_descriptor_name(obj_desc));
                return_VOID;
        }
index e259201ce9a091986ac2b92a4114d8e15eabe6bb..9ea9c3a67ca91c69a772a5291eec3cb0d0abe5ce 100644 (file)
@@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
        void *buffer;
        u8 locked;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc);
 
        /* Parameter validation */
 
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
        length =
            (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
        if (length > acpi_gbl_integer_byte_width) {
+
                /* Field is too large for an Integer, create a Buffer instead */
 
                buffer_desc = acpi_ut_create_buffer_object(length);
@@ -163,11 +164,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
+                         "FieldRead [TO]:   Obj %p, Type %X, Buf %p, ByteLen %X\n",
                          obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
                          (u32) length));
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
+                         "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
                          obj_desc->common_field.bit_length,
                          obj_desc->common_field.start_field_bit_offset,
                          obj_desc->common_field.base_byte_offset));
@@ -219,7 +220,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
        u8 locked;
        union acpi_operand_object *buffer_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc);
 
        /* Parameter validation */
 
@@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
            ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
 
        if (length < required_length) {
+
                /* We need to create a new buffer */
 
-               new_buffer = ACPI_MEM_CALLOCATE(required_length);
+               new_buffer = ACPI_ALLOCATE_ZEROED(required_length);
                if (!new_buffer) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -347,14 +349,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
+                         "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
                          source_desc,
                          acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
                                                (source_desc)),
                          ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
 
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
+                         "FieldWrite [TO]:   Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
                          obj_desc,
                          acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
                          ACPI_GET_OBJECT_TYPE(obj_desc),
@@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
        /* Free temporary buffer if we used one */
 
        if (new_buffer) {
-               ACPI_MEM_FREE(new_buffer);
+               ACPI_FREE(new_buffer);
        }
 
        return_ACPI_STATUS(status);
index bd1af35f7fcfc6497e1330d7092d58128f6eb9bc..051053f7cccb40c58931508c7347802cce084dfd 100644 (file)
@@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
        acpi_status status = AE_OK;
        union acpi_operand_object *rgn_desc;
 
-       ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset);
+       ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset);
 
        rgn_desc = obj_desc->common_field.region_obj;
 
@@ -112,7 +112,18 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
                }
        }
 
+       /* Exit if Address/Length have been disallowed by the host OS */
+
+       if (rgn_desc->common.flags & AOPOBJ_INVALID) {
+               return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
+       }
+
+       /*
+        * Exit now for SMBus address space, it has a non-linear address space
+        * and the request cannot be directly validated
+        */
        if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
+
                /* SMBus has a non-linear address space */
 
                return_ACPI_STATUS(AE_OK);
@@ -134,10 +145,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
         * length of one field datum (access width) must fit within the region.
         * (Region length is specified in bytes)
         */
-       if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
-                                      field_datum_byte_offset +
-                                      obj_desc->common_field.
-                                      access_byte_width)) {
+       if (rgn_desc->region.length <
+           (obj_desc->common_field.base_byte_offset +
+            field_datum_byte_offset +
+            obj_desc->common_field.access_byte_width)) {
                if (acpi_gbl_enable_interpreter_slack) {
                        /*
                         * Slack mode only:  We will go ahead and allow access to this
@@ -217,7 +228,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
        union acpi_operand_object *rgn_desc;
        acpi_physical_address address;
 
-       ACPI_FUNCTION_TRACE("ex_access_region");
+       ACPI_FUNCTION_TRACE(ex_access_region);
 
        /*
         * Ensure that the region operands are fully evaluated and verify
@@ -246,7 +257,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
-                             " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
+                             " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
                              acpi_ut_get_region_name(rgn_desc->region.
                                                      space_id),
                              rgn_desc->region.space_id,
@@ -352,7 +363,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
        acpi_status status;
        acpi_integer local_value;
 
-       ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset);
+       ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset);
 
        if (read_write == ACPI_READ) {
                if (!value) {
@@ -487,10 +498,11 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                }
 
                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                 "I/O to Data Register: value_ptr %p\n",
+                                 "I/O to Data Register: ValuePtr %p\n",
                                  value));
 
                if (read_write == ACPI_READ) {
+
                        /* Read the datum from the data_register */
 
                        status =
@@ -559,7 +571,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
        acpi_integer merged_value;
        acpi_integer current_value;
 
-       ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
+       ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask);
 
        /* Start with the new bits  */
 
@@ -568,6 +580,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
        /* If the mask is all ones, we don't need to worry about the update rule */
 
        if (mask != ACPI_INTEGER_MAX) {
+
                /* Decode the update rule */
 
                switch (obj_desc->common_field.
@@ -614,7 +627,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
                default:
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unknown update_rule value: %X",
+                                   "Unknown UpdateRule value: %X",
                                    (obj_desc->common_field.
                                     field_flags &
                                     AML_FIELD_UPDATE_RULE_MASK)));
@@ -623,7 +636,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
+                         "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
                          ACPI_FORMAT_UINT64(mask),
                          field_datum_byte_offset,
                          obj_desc->common_field.access_byte_width,
@@ -666,7 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
        u32 field_datum_count;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ex_extract_from_field");
+       ACPI_FUNCTION_TRACE(ex_extract_from_field);
 
        /* Validate target buffer and clear it */
 
@@ -704,6 +717,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
        /* Read the rest of the field */
 
        for (i = 1; i < field_datum_count; i++) {
+
                /* Get next input datum from the field */
 
                field_offset += obj_desc->common_field.access_byte_width;
@@ -771,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 {
        acpi_status status;
        acpi_integer mask;
+       acpi_integer width_mask;
        acpi_integer merged_datum;
        acpi_integer raw_datum = 0;
        u32 field_offset = 0;
@@ -780,7 +795,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
        u32 field_datum_count;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ex_insert_into_field");
+       ACPI_FUNCTION_TRACE(ex_insert_into_field);
 
        /* Validate input buffer */
 
@@ -795,15 +810,20 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 
        /* Compute the number of datums (access width data items) */
 
+       width_mask =
+           ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width);
        mask =
-           ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
-       datum_count =
-           ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
-                            obj_desc->common_field.access_bit_width);
-       field_datum_count =
-           ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
-                            obj_desc->common_field.start_field_bit_offset,
-                            obj_desc->common_field.access_bit_width);
+           width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field.
+                                             start_field_bit_offset);
+
+       datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
+                                      obj_desc->common_field.access_bit_width);
+
+       field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
+                                            obj_desc->common_field.
+                                            start_field_bit_offset,
+                                            obj_desc->common_field.
+                                            access_bit_width);
 
        /* Get initial Datum from the input buffer */
 
@@ -817,6 +837,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
        /* Write the entire field */
 
        for (i = 1; i < field_datum_count; i++) {
+
                /* Write merged datum to the target field */
 
                merged_datum &= mask;
@@ -833,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
                merged_datum = raw_datum >>
                    (obj_desc->common_field.access_bit_width -
                     obj_desc->common_field.start_field_bit_offset);
-               mask = ACPI_INTEGER_MAX;
+               mask = width_mask;
 
                if (i == datum_count) {
                        break;
index 48c18d29222a4c1891a8b3e55478d4304a92d2bb..bd98aab017cf577768ad09f41b0634a3f8d3dc7f 100644 (file)
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
        union acpi_operand_object *reference_obj;
        union acpi_operand_object *referenced_obj;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc);
 
        *return_desc = NULL;
 
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
        acpi_size length1;
        acpi_size new_length;
 
-       ACPI_FUNCTION_TRACE("ex_concat_template");
+       ACPI_FUNCTION_TRACE(ex_concat_template);
 
        /*
         * Find the end_tag descriptor in each resource template.
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
        char *new_buf;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_do_concatenate");
+       ACPI_FUNCTION_TRACE(ex_do_concatenate);
 
        /*
         * Convert the second operand if necessary.  The first operand
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
 
        case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
 
+               /*
+                * We need to check if the shiftcount is larger than the integer bit
+                * width since the behavior of this is not well-defined in the C language.
+                */
+               if (integer1 >= acpi_gbl_integer_bit_width) {
+                       return (0);
+               }
                return (integer0 << integer1);
 
        case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
 
+               /*
+                * We need to check if the shiftcount is larger than the integer bit
+                * width since the behavior of this is not well-defined in the C language.
+                */
+               if (integer1 >= acpi_gbl_integer_bit_width) {
+                       return (0);
+               }
                return (integer0 >> integer1);
 
        case AML_SUBTRACT_OP:   /* Subtract (Integer0, Integer1, Result) */
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
        acpi_status status = AE_OK;
        u8 local_result = FALSE;
 
-       ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
+       ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op);
 
        switch (opcode) {
        case AML_LAND_OP:       /* LAnd (Integer0, Integer1) */
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode,
        u8 local_result = FALSE;
        int compare;
 
-       ACPI_FUNCTION_TRACE("ex_do_logical_op");
+       ACPI_FUNCTION_TRACE(ex_do_logical_op);
 
        /*
         * Convert the second operand if necessary.  The first operand
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode,
                        /* Length and all bytes must be equal */
 
                        if ((length0 == length1) && (compare == 0)) {
+
                                /* Length and all bytes match ==> TRUE */
 
                                local_result = TRUE;
index f843b22e20b965101fb676d2ddedc31f54e1f87e..93098d68cadfdd784f45b62c72673df967799fa8 100644 (file)
@@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
  *
  * RETURN:      None
  *
- * DESCRIPTION: Remove a mutex from the "acquired_mutex" list
+ * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
  *
  ******************************************************************************/
 
@@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk
+ * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
  *
  ******************************************************************************/
 
@@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc);
 
        if (!obj_desc) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
         */
        if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
                ACPI_ERROR((AE_INFO,
-                           "Cannot acquire Mutex [%4.4s], incorrect sync_level",
+                           "Cannot acquire Mutex [%4.4s], incorrect SyncLevel",
                            acpi_ut_get_node_name(obj_desc->mutex.node)));
                return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
        }
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
        /* Support for multiple acquires by the owning thread */
 
        if (obj_desc->mutex.owner_thread) {
+
                /* Special case for Global Lock, allow all threads */
 
                if ((obj_desc->mutex.owner_thread->thread_id ==
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
 
        status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
        if (ACPI_FAILURE(status)) {
+
                /* Includes failure from a timeout on time_desc */
 
                return_ACPI_STATUS(status);
@@ -232,7 +234,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_release_mutex");
+       ACPI_FUNCTION_TRACE(ex_release_mutex);
 
        if (!obj_desc) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -277,7 +279,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
         */
        if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
                ACPI_ERROR((AE_INFO,
-                           "Cannot release Mutex [%4.4s], incorrect sync_level",
+                           "Cannot release Mutex [%4.4s], incorrect SyncLevel",
                            acpi_ut_get_node_name(obj_desc->mutex.node)));
                return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
        }
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
 
        obj_desc->mutex.acquisition_depth--;
        if (obj_desc->mutex.acquisition_depth != 0) {
+
                /* Just decrement the depth and return */
 
                return_ACPI_STATUS(AE_OK);
index 054fe5e1a3142982d10339b76d7247c16430b1d2..d3d70364626ccf26732fa2355027bd9347beb558 100644 (file)
@@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
        char *name_string;
        u32 size_needed;
 
-       ACPI_FUNCTION_TRACE("ex_allocate_name_string");
+       ACPI_FUNCTION_TRACE(ex_allocate_name_string);
 
        /*
         * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
         * This may actually be somewhat longer than needed.
         */
        if (prefix_count == ACPI_UINT32_MAX) {
+
                /* Special case for root */
 
                size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
@@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
         * Allocate a buffer for the name.
         * This buffer must be deleted by the caller!
         */
-       name_string = ACPI_MEM_ALLOCATE(size_needed);
+       name_string = ACPI_ALLOCATE(size_needed);
        if (!name_string) {
                ACPI_ERROR((AE_INFO,
                            "Could not allocate size %d", size_needed));
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
        /* Set up Dual or Multi prefixes if needed */
 
        if (num_name_segs > 2) {
+
                /* Set up multi prefixes   */
 
                *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
                *temp_ptr++ = (char)num_name_segs;
        } else if (2 == num_name_segs) {
+
                /* Set up dual prefixes */
 
                *temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
        u32 index;
        char char_buf[5];
 
-       ACPI_FUNCTION_TRACE("ex_name_segment");
+       ACPI_FUNCTION_TRACE(ex_name_segment);
 
        /*
         * If first character is a digit, then we know that we aren't looking at a
@@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 
        for (index = 0;
             (index < ACPI_NAME_SIZE)
-            && (acpi_ut_valid_acpi_character(*aml_address)); index++) {
+            && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
                char_buf[index] = *aml_address++;
                ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
        }
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
        /* Valid name segment  */
 
        if (index == 4) {
+
                /* Found 4 valid characters */
 
                char_buf[4] = '\0';
@@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type,
        u32 prefix_count = 0;
        u8 has_prefix = FALSE;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address);
+       ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address);
 
        if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
            ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
            ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
+
                /* Disallow prefixes for types associated with field_unit names */
 
                name_string = acpi_ex_allocate_name_string(0, 1);
@@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
                case AML_ROOT_PREFIX:
 
                        ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
-                                         "root_prefix(\\) at %p\n",
+                                         "RootPrefix(\\) at %p\n",
                                          aml_address));
 
                        /*
@@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
 
                        do {
                                ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
-                                                 "parent_prefix (^) at %p\n",
+                                                 "ParentPrefix (^) at %p\n",
                                                  aml_address));
 
                                aml_address++;
@@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
                case AML_DUAL_NAME_PREFIX:
 
                        ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
-                                         "dual_name_prefix at %p\n",
+                                         "DualNamePrefix at %p\n",
                                          aml_address));
 
                        aml_address++;
@@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
                case AML_MULTI_NAME_PREFIX_OP:
 
                        ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
-                                         "multi_name_prefix at %p\n",
+                                         "MultiNamePrefix at %p\n",
                                          aml_address));
 
                        /* Fetch count of segments remaining in name path */
@@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
 
                        if (prefix_count == ACPI_UINT32_MAX) {
                                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                                 "name_seg is \"\\\" followed by NULL\n"));
+                                                 "NameSeg is \"\\\" followed by NULL\n"));
                        }
 
                        /* Consume the NULL byte */
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
        }
 
        if (AE_CTRL_PENDING == status && has_prefix) {
+
                /* Ran out of segments after processing a prefix */
 
                ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string));
@@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
 
        if (ACPI_FAILURE(status)) {
                if (name_string) {
-                       ACPI_MEM_FREE(name_string);
+                       ACPI_FREE(name_string);
                }
                return_ACPI_STATUS(status);
        }
index 23d0823bcd5e69df8a8f88c78d639f57e3bfead5..6374d8be88e0a5feb21d1fe2f73e100f915e6647 100644 (file)
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        union acpi_operand_object *return_desc = NULL;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
        union acpi_operand_object **operand = &walk_state->operands[0];
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        union acpi_operand_object **operand = &walk_state->operands[0];
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
        acpi_integer power_of_ten;
        acpi_integer digit;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* Since the bit position is one-based, subtract from 33 (65) */
 
-                       return_desc->integer.value = temp32 == 0 ? 0 :
-                           (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+                       return_desc->integer.value =
+                           temp32 ==
+                           0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
                        break;
 
                case AML_FROM_BCD_OP:   /* from_bcd (BCDValue, Result) */
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                        for (i = 0;
                             (i < acpi_gbl_integer_nybble_width) && (digit > 0);
                             i++) {
+
                                /* Get the least significant 4-bit BCD digit */
 
                                temp32 = ((u32) digit) & 0xF;
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_string(operand[0], &return_desc,
                                                   ACPI_EXPLICIT_CONVERT_DECIMAL);
                if (return_desc == operand[0]) {
+
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_string(operand[0], &return_desc,
                                                   ACPI_EXPLICIT_CONVERT_HEX);
                if (return_desc == operand[0]) {
+
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
                status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
                if (return_desc == operand[0]) {
+
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                status = acpi_ex_convert_to_integer(operand[0], &return_desc,
                                                    ACPI_ANY_BASE);
                if (return_desc == operand[0]) {
+
                        /* No conversion performed, add ref to handle return value */
                        acpi_ut_add_reference(return_desc);
                }
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
        }
 
        if (ACPI_SUCCESS(status)) {
+
                /* Store the return value computed above into the target object */
 
                status = acpi_ex_store(return_desc, operand[1], walk_state);
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 
       cleanup:
 
-       if (!walk_state->result_obj) {
-               walk_state->result_obj = return_desc;
-       }
-
        /* Delete return object on error */
 
        if (ACPI_FAILURE(status)) {
                acpi_ut_remove_reference(return_desc);
        }
 
+       /* Save return object on success */
+
+       else if (!walk_state->result_obj) {
+               walk_state->result_obj = return_desc;
+       }
+
        return_ACPI_STATUS(status);
 }
 
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
        u32 type;
        acpi_integer value;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                temp_desc = operand[0];
                if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
                    ACPI_DESC_TYPE_OPERAND) {
+
                        /* Internal reference object - prevent deletion */
 
                        acpi_ut_add_reference(temp_desc);
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
+
                /* Allocate a descriptor to hold the type. */
 
                return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                /* Check for a method local or argument, or standalone String */
 
-               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
+               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
                    ACPI_DESC_TYPE_NAMED) {
+                       temp_desc =
+                           acpi_ns_get_attached_object((struct
+                                                        acpi_namespace_node *)
+                                                       operand[0]);
+                       if (temp_desc
+                           &&
+                           ((ACPI_GET_OBJECT_TYPE(temp_desc) ==
+                             ACPI_TYPE_STRING)
+                            || (ACPI_GET_OBJECT_TYPE(temp_desc) ==
+                                ACPI_TYPE_LOCAL_REFERENCE))) {
+                               operand[0] = temp_desc;
+                               acpi_ut_add_reference(temp_desc);
+                       } else {
+                               status = AE_AML_OPERAND_TYPE;
+                               goto cleanup;
+                       }
+               } else {
                        switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
                        case ACPI_TYPE_LOCAL_REFERENCE:
                                /*
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                break;
 
                        case ACPI_TYPE_STRING:
+                               break;
 
+                       default:
+                               status = AE_AML_OPERAND_TYPE;
+                               goto cleanup;
+                       }
+               }
+
+               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
+                   ACPI_DESC_TYPE_NAMED) {
+                       if (ACPI_GET_OBJECT_TYPE(operand[0]) ==
+                           ACPI_TYPE_STRING) {
                                /*
                                 * This is a deref_of (String). The string is a reference
                                 * to a named ACPI object.
                                 *
                                 * 1) Find the owning Node
-                                * 2) Dereference the node to an actual object.  Could be a
+                                * 2) Dereference the node to an actual object. Could be a
                                 *    Field, so we need to resolve the node to a value.
                                 */
                                status =
-                                   acpi_ns_get_node_by_path(operand[0]->string.
-                                                            pointer,
-                                                            walk_state->
-                                                            scope_info->scope.
-                                                            node,
-                                                            ACPI_NS_SEARCH_PARENT,
-                                                            ACPI_CAST_INDIRECT_PTR
-                                                            (struct
-                                                             acpi_namespace_node,
-                                                             &return_desc));
+                                   acpi_ns_get_node(walk_state->scope_info->
+                                                    scope.node,
+                                                    operand[0]->string.pointer,
+                                                    ACPI_NS_SEARCH_PARENT,
+                                                    ACPI_CAST_INDIRECT_PTR
+                                                    (struct
+                                                     acpi_namespace_node,
+                                                     &return_desc));
                                if (ACPI_FAILURE(status)) {
                                        goto cleanup;
                                }
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                     (struct acpi_namespace_node, &return_desc),
                                     walk_state);
                                goto cleanup;
-
-                       default:
-
-                               status = AE_AML_OPERAND_TYPE;
-                               goto cleanup;
                        }
                }
 
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                                acpi_ut_add_reference
                                                    (return_desc);
                                        }
-
                                        break;
 
                                default:
 
                                        ACPI_ERROR((AE_INFO,
-                                                   "Unknown Index target_type %X in obj %p",
+                                                   "Unknown Index TargetType %X in obj %p",
                                                    operand[0]->reference.
                                                    target_type, operand[0]));
                                        status = AE_AML_OPERAND_TYPE;
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                                if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
                                    ACPI_DESC_TYPE_NAMED) {
-
                                        return_desc =
                                            acpi_ns_get_attached_object((struct
                                                                         acpi_namespace_node
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown opcode in ref(%p) - %X",
+                                           "Unknown opcode in reference(%p) - %X",
                                            operand[0],
                                            operand[0]->reference.opcode));
 
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                acpi_ut_remove_reference(return_desc);
        }
 
-       walk_state->result_obj = return_desc;
+       /* Save return object on success */
+
+       else {
+               walk_state->result_obj = return_desc;
+       }
+
        return_ACPI_STATUS(status);
 }
index e263a5ddd405b8fe29418338e51a3cb3212a6f39..7d2cbc113160f77a2f56dd77d242bb159227d1a5 100644 (file)
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
        u32 value;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the opcode */
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
 #ifdef ACPI_GPE_NOTIFY_CHECK
                /*
                 * GPE method wake/notify check.  Here, we want to ensure that we
-                * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx
+                * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
                 * GPE method during system runtime.  If we do, the GPE is marked
                 * as "wake-only" and disabled.
                 *
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
                            acpi_ev_check_for_wake_only_gpe(walk_state->
                                                            gpe_event_info);
                        if (ACPI_FAILURE(status)) {
+
                                /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
 
                                return_ACPI_STATUS(AE_OK)
@@ -185,7 +186,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
        union acpi_operand_object *return_desc2 = NULL;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
        acpi_ut_remove_reference(return_desc2);
 
        if (ACPI_FAILURE(status)) {
+
                /* Delete the return object */
 
                acpi_ut_remove_reference(return_desc1);
@@ -281,12 +283,13 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        acpi_size length;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
 
        if (walk_state->op_info->flags & AML_MATH) {
+
                /* All simple math opcodes (add, etc.) */
 
                return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
                        goto cleanup;
                }
 
+               /* Initialize the Index reference object */
+
                index = operand[1]->integer.value;
+               return_desc->reference.offset = (u32) index;
+               return_desc->reference.opcode = AML_INDEX_OP;
 
-               /* At this point, the Source operand is a Package, Buffer, or String */
+               /*
+                * At this point, the Source operand is a String, Buffer, or Package.
+                * Verify that the index is within range.
+                */
+               switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
+               case ACPI_TYPE_STRING:
 
-               if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
-                       /* Object to be indexed is a Package */
+                       if (index >= operand[0]->string.length) {
+                               status = AE_AML_STRING_LIMIT;
+                       }
+
+                       return_desc->reference.target_type =
+                           ACPI_TYPE_BUFFER_FIELD;
+                       break;
+
+               case ACPI_TYPE_BUFFER:
+
+                       if (index >= operand[0]->buffer.length) {
+                               status = AE_AML_BUFFER_LIMIT;
+                       }
+
+                       return_desc->reference.target_type =
+                           ACPI_TYPE_BUFFER_FIELD;
+                       break;
+
+               case ACPI_TYPE_PACKAGE:
 
                        if (index >= operand[0]->package.count) {
-                               ACPI_ERROR((AE_INFO,
-                                           "Index value (%X%8.8X) beyond package end (%X)",
-                                           ACPI_FORMAT_UINT64(index),
-                                           operand[0]->package.count));
                                status = AE_AML_PACKAGE_LIMIT;
-                               goto cleanup;
                        }
 
                        return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
-                       return_desc->reference.object = operand[0];
                        return_desc->reference.where =
                            &operand[0]->package.elements[index];
-               } else {
-                       /* Object to be indexed is a Buffer/String */
+                       break;
 
-                       if (index >= operand[0]->buffer.length) {
-                               ACPI_ERROR((AE_INFO,
-                                           "Index value (%X%8.8X) beyond end of buffer (%X)",
-                                           ACPI_FORMAT_UINT64(index),
-                                           operand[0]->buffer.length));
-                               status = AE_AML_BUFFER_LIMIT;
-                               goto cleanup;
-                       }
+               default:
 
-                       return_desc->reference.target_type =
-                           ACPI_TYPE_BUFFER_FIELD;
-                       return_desc->reference.object = operand[0];
+                       status = AE_AML_INTERNAL;
+                       goto cleanup;
+               }
+
+               /* Failure means that the Index was beyond the end of the object */
+
+               if (ACPI_FAILURE(status)) {
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "Index (%X%8.8X) is beyond end of object",
+                                       ACPI_FORMAT_UINT64(index)));
+                       goto cleanup;
                }
 
                /*
-                * Add a reference to the target package/buffer/string for the life
-                * of the index.
+                * Save the target object and add a reference to it for the life
+                * of the index
                 */
+               return_desc->reference.object = operand[0];
                acpi_ut_add_reference(operand[0]);
 
-               /* Complete the Index reference object */
-
-               return_desc->reference.opcode = AML_INDEX_OP;
-               return_desc->reference.offset = (u32) index;
-
                /* Store the reference to the Target */
 
                status = acpi_ex_store(return_desc, operand[2], walk_state);
@@ -495,7 +514,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        u8 logical_result = FALSE;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Create the internal return object */
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
        /* Execute the Opcode */
 
        if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
+
                /* logical_op (Operand0, Operand1) */
 
                status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
                                                       value, &logical_result);
                goto store_logical_result;
        } else if (walk_state->op_info->flags & AML_LOGICAL) {
+
                /* logical_op (Operand0, Operand1) */
 
                status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
index 6a3a883cb8a3b2a24bba6369b608a92cdec659b3..e2d945dfd5098b4015c652c3b36180e1020b7501 100644 (file)
@@ -88,20 +88,19 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
        struct acpi_signal_fatal_info *fatal;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
        case AML_FATAL_OP:      /* Fatal (fatal_type fatal_code fatal_arg) */
 
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+                                 "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
                                  (u32) operand[0]->integer.value,
                                  (u32) operand[1]->integer.value,
                                  (u32) operand[2]->integer.value));
 
-               fatal =
-                   ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
+               fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
                if (fatal) {
                        fatal->type = (u32) operand[0]->integer.value;
                        fatal->code = (u32) operand[1]->integer.value;
@@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
 
                /* Might return while OS is shutting down, just continue */
 
-               ACPI_MEM_FREE(fatal);
+               ACPI_FREE(fatal);
                break;
 
        default:
@@ -151,7 +150,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
        acpi_integer index;
        acpi_size length;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
@@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* Always allocate a new buffer for the String */
 
-                       buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1);
+                       buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);
                        if (!buffer) {
                                status = AE_NO_MEMORY;
                                goto cleanup;
@@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
                        /* If the requested length is zero, don't allocate a buffer */
 
                        if (length > 0) {
+
                                /* Allocate a new buffer for the Buffer */
 
-                               buffer = ACPI_MEM_CALLOCATE(length);
+                               buffer = ACPI_ALLOCATE_ZEROED(length);
                                if (!buffer) {
                                        status = AE_NO_MEMORY;
                                        goto cleanup;
@@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
                }
 
                if (buffer) {
+
                        /* We have a buffer, copy the portion requested */
 
                        ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
index e043d924444f9ad07c17de9016ac8492f16f997b..f0c0ba6eb408999f0a66b4ca3b46b9f3697a8a55 100644 (file)
@@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
        acpi_integer index;
        union acpi_operand_object *this_element;
 
-       ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
+       ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R,
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
                 * match was found.
                 */
                for (; index < operand[0]->package.count; index++) {
+
                        /* Get the current package element */
 
                        this_element = operand[0]->package.elements[index];
index 7719ae5d4f16a012b97b48244992518fdc7aa3ca..44d064f427b907d0b67f6a80f77779c008dbb88e 100644 (file)
@@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
        u32 minimum_accesses = 0xFFFFFFFF;
        u32 accesses;
 
-       ACPI_FUNCTION_TRACE("ex_generate_access");
+       ACPI_FUNCTION_TRACE(ex_generate_access);
 
        /* Round Field start offset and length to "minimal" byte boundaries */
 
@@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
                        accesses = field_end_offset - field_start_offset;
 
                        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                         "access_width %d end is within region\n",
+                                         "AccessWidth %d end is within region\n",
                                          access_byte_width));
 
                        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
@@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset,
                        }
                } else {
                        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                         "access_width %d end is NOT within region\n",
+                                         "AccessWidth %d end is NOT within region\n",
                                          access_byte_width));
                        if (access_byte_width == 1) {
                                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
@@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
        u32 byte_alignment;
        u32 bit_length;
 
-       ACPI_FUNCTION_TRACE("ex_decode_field_access");
+       ACPI_FUNCTION_TRACE(ex_decode_field_access);
 
        access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
 
@@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
        u32 byte_alignment;
        u32 nearest_byte_address;
 
-       ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
+       ACPI_FUNCTION_TRACE(ex_prep_common_field_object);
 
        /*
         * Note: the structure being initialized is the
@@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
        u32 type;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_prep_field_value");
+       ACPI_FUNCTION_TRACE(ex_prep_field_value);
 
        /* Parameter validation */
 
        if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
                if (!info->region_node) {
-                       ACPI_ERROR((AE_INFO, "Null region_node"));
+                       ACPI_ERROR((AE_INFO, "Null RegionNode"));
                        return_ACPI_STATUS(AE_AML_NO_OPERAND);
                }
 
@@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                acpi_ut_add_reference(obj_desc->field.region_obj);
 
                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                 "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
+                                 "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
                                  obj_desc->field.start_field_bit_offset,
                                  obj_desc->field.base_byte_offset,
                                  obj_desc->field.access_byte_width,
@@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
 
                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                 "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
+                                 "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n",
                                  obj_desc->bank_field.start_field_bit_offset,
                                  obj_desc->bank_field.base_byte_offset,
                                  obj_desc->field.access_byte_width,
@@ -519,16 +519,29 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                acpi_ut_add_reference(obj_desc->index_field.index_obj);
 
                /*
+                * April 2006: Changed to match MS behavior
+                *
                 * The value written to the Index register is the byte offset of the
-                * target field
-                * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position)
+                * target field in units of the granularity of the index_field
+                *
+                * Previously, the value was calculated as an index in terms of the
+                * width of the Data register, as below:
+                *
+                *      obj_desc->index_field.Value = (u32)
+                *          (Info->field_bit_position / ACPI_MUL_8 (
+                *              obj_desc->Field.access_byte_width));
+                *
+                * February 2006: Tried value as a byte offset:
+                *      obj_desc->index_field.Value = (u32)
+                *          ACPI_DIV_8 (Info->field_bit_position);
                 */
-               obj_desc->index_field.value = (u32)
-                   (info->field_bit_position /
-                    ACPI_MUL_8(obj_desc->field.access_byte_width));
+               obj_desc->index_field.value =
+                   (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position),
+                                         obj_desc->index_field.
+                                         access_byte_width);
 
                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                                 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
+                                 "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
                                  obj_desc->index_field.start_field_bit_offset,
                                  obj_desc->index_field.base_byte_offset,
                                  obj_desc->index_field.value,
@@ -550,7 +563,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                                       acpi_ns_get_type(info->field_node));
 
        ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
-                         "Set named_obj %p [%4.4s], obj_desc %p\n",
+                         "Set NamedObj %p [%4.4s], ObjDesc %p\n",
                          info->field_node,
                          acpi_ut_get_node_name(info->field_node), obj_desc));
 
index 6a4cfdff606d14e97ec93b7bcced12c2f01f6b19..3cc97ba48b364262ccc47fe0a11bfa9ee7bf0345 100644 (file)
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function,
        u32 remainder;
 #endif
 
-       ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
+       ACPI_FUNCTION_TRACE(ex_system_memory_space_handler);
 
        /* Validate and translate the bit width */
 
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                break;
 
        default:
-               ACPI_ERROR((AE_INFO, "Invalid system_memory width %d",
+               ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d",
                            bit_width));
                return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                 * Delete the existing mapping and create a new one.
                 */
                if (mem_info->mapped_length) {
+
                        /* Valid mapping, delete it */
 
                        acpi_os_unmap_memory(mem_info->mapped_logical_address,
@@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function,
             (acpi_integer) mem_info->mapped_physical_address);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "system_memory %d (%d width) Address=%8.8X%8.8X\n",
-                         function, bit_width, ACPI_FORMAT_UINT64(address)));
+                         "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /*
         * Perform the memory read or write
@@ -283,11 +284,11 @@ acpi_ex_system_io_space_handler(u32 function,
        acpi_status status = AE_OK;
        u32 value32;
 
-       ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
+       ACPI_FUNCTION_TRACE(ex_system_io_space_handler);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "system_iO %d (%d width) Address=%8.8X%8.8X\n",
-                         function, bit_width, ACPI_FORMAT_UINT64(address)));
+                         "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /* Decode the function parameter */
 
@@ -342,7 +343,7 @@ acpi_ex_pci_config_space_handler(u32 function,
        struct acpi_pci_id *pci_id;
        u16 pci_register;
 
-       ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
+       ACPI_FUNCTION_TRACE(ex_pci_config_space_handler);
 
        /*
         *  The arguments to acpi_os(Read|Write)pci_configuration are:
@@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 function,
        pci_register = (u16) (u32) address;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+                         "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
                          function, bit_width, pci_id->segment, pci_id->bus,
                          pci_id->device, pci_id->function, pci_register));
 
@@ -414,7 +415,7 @@ acpi_ex_cmos_space_handler(u32 function,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
+       ACPI_FUNCTION_TRACE(ex_cmos_space_handler);
 
        return_ACPI_STATUS(status);
 }
@@ -446,7 +447,7 @@ acpi_ex_pci_bar_space_handler(u32 function,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
+       ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler);
 
        return_ACPI_STATUS(status);
 }
@@ -476,23 +477,16 @@ acpi_ex_data_table_space_handler(u32 function,
                                 acpi_integer * value,
                                 void *handler_context, void *region_context)
 {
-       acpi_status status = AE_OK;
-       u32 byte_width = ACPI_DIV_8(bit_width);
-       u32 i;
-       char *logical_addr_ptr;
-
-       ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
-
-       logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
+       ACPI_FUNCTION_TRACE(ex_data_table_space_handler);
 
        /* Perform the memory read or write */
 
        switch (function) {
        case ACPI_READ:
 
-               for (i = 0; i < byte_width; i++) {
-                       ((char *)value)[i] = logical_addr_ptr[i];
-               }
+               ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
+                           ACPI_PHYSADDR_TO_PTR(address),
+                           ACPI_DIV_8(bit_width));
                break;
 
        case ACPI_WRITE:
@@ -501,5 +495,5 @@ acpi_ex_data_table_space_handler(u32 function,
                return_ACPI_STATUS(AE_SUPPORT);
        }
 
-       return_ACPI_STATUS(status);
+       return_ACPI_STATUS(AE_OK);
 }
index 01b26c80d22b84e6e1b2bdc124951e8053367234..3089b05a13687553258c5c0bf8d2288b313ee0b7 100644 (file)
@@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
        struct acpi_namespace_node *node;
        acpi_object_type entry_type;
 
-       ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
+       ACPI_FUNCTION_TRACE(ex_resolve_node_to_value);
 
        /*
         * The stack pointer points to a struct acpi_namespace_node (Node).  Get the
@@ -97,12 +97,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
        source_desc = acpi_ns_get_attached_object(node);
        entry_type = acpi_ns_get_type((acpi_handle) node);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
                          node, source_desc,
                          acpi_ut_get_type_name(entry_type)));
 
        if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
            (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
+
                /* There is always exactly one level of indirection */
 
                node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
@@ -113,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
        /*
         * Several object types require no further processing:
-        * 1) Devices rarely have an attached object, return the Node
+        * 1) Device/Thermal objects don't have a "real" subobject, return the Node
         * 2) Method locals and arguments have a pseudo-Node
         */
-       if (entry_type == ACPI_TYPE_DEVICE ||
+       if ((entry_type == ACPI_TYPE_DEVICE) ||
+           (entry_type == ACPI_TYPE_THERMAL) ||
            (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
                return_ACPI_STATUS(AE_OK);
        }
@@ -141,6 +143,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
                status = acpi_ds_get_package_arguments(source_desc);
                if (ACPI_SUCCESS(status)) {
+
                        /* Return an additional reference to the object */
 
                        obj_desc = source_desc;
@@ -158,6 +161,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
                status = acpi_ds_get_buffer_arguments(source_desc);
                if (ACPI_SUCCESS(status)) {
+
                        /* Return an additional reference to the object */
 
                        obj_desc = source_desc;
@@ -199,7 +203,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "field_read Node=%p source_desc=%p Type=%X\n",
+                                 "FieldRead Node=%p SourceDesc=%p Type=%X\n",
                                  node, source_desc, entry_type));
 
                status =
@@ -213,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
        case ACPI_TYPE_METHOD:
        case ACPI_TYPE_POWER:
        case ACPI_TYPE_PROCESSOR:
-       case ACPI_TYPE_THERMAL:
        case ACPI_TYPE_EVENT:
        case ACPI_TYPE_REGION:
 
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
                        /* This is a ddb_handle */
                        /* Return an additional reference to the object */
 
+               case AML_REF_OF_OP:
+
                        obj_desc = source_desc;
                        acpi_ut_add_reference(obj_desc);
                        break;
index 1deed492fe88c865cd3505f4afa0a7279f60f6d7..6499de8780173f44e19a41ef7bf2ac9fb30d9531 100644 (file)
@@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
+       ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr);
 
        if (!stack_ptr || !*stack_ptr) {
                ACPI_ERROR((AE_INFO, "Internal - null pointer"));
@@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        union acpi_operand_object *obj_desc;
        u16 opcode;
 
-       ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
+       ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
 
        stack_desc = *stack_ptr;
 
@@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        }
 
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                         "[Arg/Local %X] value_obj is %p\n",
+                                         "[Arg/Local %X] ValueObj is %p\n",
                                          stack_desc->reference.offset,
                                          obj_desc));
 
@@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                                /* Invalid reference object */
 
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown target_type %X in Index/Reference obj %p",
+                                           "Unknown TargetType %X in Index/Reference obj %p",
                                            stack_desc->reference.target_type,
                                            stack_desc));
                                status = AE_AML_INTERNAL;
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 
                case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
 
-                       /* Get the object pointed to by the namespace node */
+                       /* Dereference the name */
+
+                       if ((stack_desc->reference.node->type ==
+                            ACPI_TYPE_DEVICE)
+                           || (stack_desc->reference.node->type ==
+                               ACPI_TYPE_THERMAL)) {
+
+                               /* These node types do not have 'real' subobjects */
+
+                               *stack_ptr = (void *)stack_desc->reference.node;
+                       } else {
+                               /* Get the object pointed to by the namespace node */
+
+                               *stack_ptr =
+                                   (stack_desc->reference.node)->object;
+                               acpi_ut_add_reference(*stack_ptr);
+                       }
 
-                       *stack_ptr = (stack_desc->reference.node)->object;
-                       acpi_ut_add_reference(*stack_ptr);
                        acpi_ut_remove_reference(stack_desc);
                        break;
 
@@ -293,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "field_read source_desc=%p Type=%X\n",
+                                 "FieldRead SourceDesc=%p Type=%X\n",
                                  stack_desc,
                                  ACPI_GET_OBJECT_TYPE(stack_desc)));
 
@@ -337,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
        acpi_object_type type;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
+       ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple);
 
        /* Operand can be either a namespace node or an operand descriptor */
 
@@ -382,10 +396,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
        while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
                switch (obj_desc->reference.opcode) {
                case AML_REF_OF_OP:
+               case AML_INT_NAMEPATH_OP:
 
                        /* Dereference the reference pointer */
 
-                       node = obj_desc->reference.object;
+                       if (obj_desc->reference.opcode == AML_REF_OF_OP) {
+                               node = obj_desc->reference.object;
+                       } else {        /* AML_INT_NAMEPATH_OP */
+
+                               node = obj_desc->reference.node;
+                       }
 
                        /* All "References" point to a NS node */
 
@@ -401,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
 
                        obj_desc = acpi_ns_get_attached_object(node);
                        if (!obj_desc) {
+
                                /* No object, use the NS node type */
 
                                type = acpi_ns_get_type(node);
@@ -432,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                         */
                        obj_desc = *(obj_desc->reference.where);
                        if (!obj_desc) {
+
                                /* NULL package elements are allowed */
 
                                type = 0;       /* Uninitialized */
@@ -439,39 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_INT_NAMEPATH_OP:
-
-                       /* Dereference the reference pointer */
-
-                       node = obj_desc->reference.node;
-
-                       /* All "References" point to a NS node */
-
-                       if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
-                           ACPI_DESC_TYPE_NAMED) {
-                               ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
-                                           node,
-                                           acpi_ut_get_descriptor_name(node)));
-                               return_ACPI_STATUS(AE_AML_INTERNAL);
-                       }
-
-                       /* Get the attached object */
-
-                       obj_desc = acpi_ns_get_attached_object(node);
-                       if (!obj_desc) {
-                               /* No object, use the NS node type */
-
-                               type = acpi_ns_get_type(node);
-                               goto exit;
-                       }
-
-                       /* Check for circular references */
-
-                       if (obj_desc == operand) {
-                               return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
-                       }
-                       break;
-
                case AML_LOCAL_OP:
                case AML_ARG_OP:
 
@@ -513,7 +502,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
 
                case AML_DEBUG_OP:
 
-                       /* The Debug Object is of type "debug_object" */
+                       /* The Debug Object is of type "DebugObject" */
 
                        type = ACPI_TYPE_DEBUG_OBJECT;
                        goto exit;
index a1c000f5a4157799744c9723fccb0906c65527e4..4c93d0972333535ba31a9a7fe4c552724dfbf3c3 100644 (file)
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
        ACPI_FUNCTION_ENTRY();
 
        if (type_needed == ACPI_TYPE_ANY) {
+
                /* All types OK, so we don't perform any typechecks */
 
                return (AE_OK);
@@ -143,7 +144,7 @@ acpi_ex_resolve_operands(u16 opcode,
        acpi_object_type type_needed;
        u16 target_op = 0;
 
-       ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
+       ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode);
 
        op_info = acpi_ps_get_opcode_info(opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
@@ -158,7 +159,7 @@ acpi_ex_resolve_operands(u16 opcode,
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "Opcode %X [%s] required_operand_types=%8.8X\n",
+                         "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
                          opcode, op_info->name, arg_types));
 
        /*
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode,
                        }
 
                        if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
+
                                /* Decode the Reference */
 
                                op_info = acpi_ps_get_opcode_info(opcode);
@@ -247,7 +249,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                                        ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
                                                                ((ACPI_DB_EXEC,
-                                                                 "Operand is a Reference, ref_opcode [%s]\n",
+                                                                 "Operand is a Reference, RefOpcode [%s]\n",
                                                                  (acpi_ps_get_opcode_info
                                                                   (obj_desc->
                                                                    reference.
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode,
                        }
 
                        if (obj_desc->reference.opcode == AML_NAME_OP) {
+
                                /* Convert a named reference to the actual named object */
 
                                temp_node = obj_desc->reference.object;
@@ -623,7 +626,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Needed [Region/region_field], found [%s] %p",
+                                           "Needed [Region/RegionField], found [%s] %p",
                                            acpi_ut_get_object_type_name
                                            (obj_desc), obj_desc));
 
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode,
                                }
 
                                if (target_op == AML_DEBUG_OP) {
+
                                        /* Allow store of any object to the Debug object */
 
                                        break;
index 3f020c0e2b95b6c7a67cdd321b637aa0ea31d1bc..0456405ba0198a36a7505d0e22b14b4b9a396867 100644 (file)
@@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
                              level, " "));
@@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
        acpi_status status = AE_OK;
        union acpi_operand_object *ref_desc = dest_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc);
 
        /* Validate parameters */
 
@@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
 
                ACPI_DUMP_STACK_ENTRY(source_desc);
                ACPI_DUMP_STACK_ENTRY(dest_desc);
-               ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
+               ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore",
                                   2,
                                   "Target is not a Reference or Constant object");
 
@@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
        u8 value = 0;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ex_store_object_to_index");
+       ACPI_FUNCTION_TRACE(ex_store_object_to_index);
 
        /*
         * Destination must be a reference pointer, and
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
                }
 
                if (obj_desc) {
+
                        /* Decrement reference count by the ref count of the parent package */
 
                        for (i = 0; i < ((union acpi_operand_object *)
@@ -502,8 +503,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
                break;
 
        default:
-               ACPI_ERROR((AE_INFO,
-                           "Target is not a Package or buffer_field"));
+               ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField"));
                status = AE_AML_OPERAND_TYPE;
                break;
        }
@@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
        union acpi_operand_object *new_desc;
        acpi_object_type target_type;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc);
 
        /* Get current type of the node, and object attached to Node */
 
@@ -572,6 +572,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
        /* If no implicit conversion, drop into the default case below */
 
        if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
+
                /* Force execution of default (no implicit conversion) */
 
                target_type = ACPI_TYPE_ANY;
index 42967baf760de53ba7a5214739910e2a460dc74b..591aaf0e18b3e0b0d5f58d73934f34427a4381dd 100644 (file)
@@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
        union acpi_operand_object *source_desc = *source_desc_ptr;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_resolve_object");
+       ACPI_FUNCTION_TRACE(ex_resolve_object);
 
        /* Ensure we have a Target that can be stored to */
 
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
                 */
                if (ACPI_GET_OBJECT_TYPE(source_desc) ==
                    ACPI_TYPE_LOCAL_REFERENCE) {
+
                        /* Resolve a reference object first */
 
                        status =
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
                    !((ACPI_GET_OBJECT_TYPE(source_desc) ==
                       ACPI_TYPE_LOCAL_REFERENCE)
                      && (source_desc->reference.opcode == AML_LOAD_OP))) {
+
                        /* Conversion successful but still not a valid type */
 
                        ACPI_ERROR((AE_INFO,
@@ -199,7 +201,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
        union acpi_operand_object *actual_src_desc;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc);
 
        actual_src_desc = source_desc;
        if (!dest_desc) {
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
        }
 
        if (actual_src_desc != source_desc) {
+
                /* Delete the intermediate (temporary) source object */
 
                acpi_ut_remove_reference(actual_src_desc);
index 6ab70708775007347a24cf236b0e494629993cea..99ebe5adfcda3b585c0eca2c141bc26cfa28d322 100644 (file)
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
        u32 length;
        u8 *buffer;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc);
 
        /* We know that source_desc is a buffer by now */
 
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
         */
        if ((target_desc->buffer.length == 0) ||
            (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
-               target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length);
+               target_desc->buffer.pointer = ACPI_ALLOCATE(length);
                if (!target_desc->buffer.pointer) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
        /* Copy source buffer to target buffer */
 
        if (length <= target_desc->buffer.length) {
+
                /* Clear existing buffer and copy in the new one */
 
                ACPI_MEMSET(target_desc->buffer.pointer, 0,
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
                 * NOTE: ACPI versions up to 3.0 specified that the buffer must be
                 * truncated if the string is smaller than the buffer.  However, "other"
                 * implementations of ACPI never did this and thus became the defacto
-                * standard. ACPi 3.0_a changes this behavior such that the buffer
+                * standard. ACPI 3.0_a changes this behavior such that the buffer
                 * is no longer truncated.
                 */
 
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
                 * copy must not truncate the original buffer.
                 */
                if (original_src_type == ACPI_TYPE_STRING) {
+
                        /* Set the new length of the target */
 
                        target_desc->buffer.length = length;
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
        u32 length;
        u8 *buffer;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc);
 
        /* We know that source_desc is a string by now */
 
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
                 */
                if (target_desc->string.pointer &&
                    (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+
                        /* Only free if not a pointer into the DSDT */
 
-                       ACPI_MEM_FREE(target_desc->string.pointer);
+                       ACPI_FREE(target_desc->string.pointer);
                }
 
-               target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size)
-                                                                length + 1);
+               target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size)
+                                                                  length + 1);
                if (!target_desc->string.pointer) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
index ea9144f42e1f98f2b4a1d37143cfb09fe8ae060c..52beee3674a0c66d68f1eec0e63b99fc0cb9c3a5 100644 (file)
@@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
        acpi_status status;
        acpi_status status2;
 
-       ACPI_FUNCTION_TRACE("ex_system_wait_semaphore");
+       ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
 
        status = acpi_os_wait_semaphore(semaphore, 1, 0);
        if (ACPI_SUCCESS(status)) {
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
        }
 
        if (status == AE_TIME) {
+
                /* We must wait, so unlock the interpreter */
 
                acpi_ex_exit_interpreter();
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
 
                status2 = acpi_ex_enter_interpreter();
                if (ACPI_FAILURE(status2)) {
+
                        /* Report fatal error, could not acquire interpreter */
 
                        return_ACPI_STATUS(status2);
@@ -191,7 +193,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc);
 
        if (!obj_desc) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -229,7 +231,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_system_release_mutex");
+       ACPI_FUNCTION_TRACE(ex_system_release_mutex);
 
        if (!obj_desc) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -263,7 +265,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_system_signal_event");
+       ACPI_FUNCTION_TRACE(ex_system_signal_event);
 
        if (obj_desc) {
                status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
@@ -293,7 +295,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ex_system_wait_event");
+       ACPI_FUNCTION_TRACE(ex_system_wait_event);
 
        if (obj_desc) {
                status =
index f73a61aeb7eca52736f3eb9e71c9ab8e6e1e35ec..982c8b65876f33d562294f60160564eb3f5a4f00 100644 (file)
@@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_enter_interpreter");
+       ACPI_FUNCTION_TRACE(ex_enter_interpreter);
 
-       status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
        }
@@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_exit_interpreter");
+       ACPI_FUNCTION_TRACE(ex_exit_interpreter);
 
-       status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
+       status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
        if (ACPI_FAILURE(status)) {
                ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
        }
@@ -189,11 +189,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
        u8 locked = FALSE;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_acquire_global_lock");
+       ACPI_FUNCTION_TRACE(ex_acquire_global_lock);
 
        /* Only attempt lock if the always_lock bit is set */
 
        if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
+
                /* We should attempt to get the lock, wait forever */
 
                status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
@@ -225,15 +226,17 @@ void acpi_ex_release_global_lock(u8 locked_by_me)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_release_global_lock");
+       ACPI_FUNCTION_TRACE(ex_release_global_lock);
 
        /* Only attempt unlock if the caller locked it */
 
        if (locked_by_me) {
+
                /* OK, now release the lock */
 
                status = acpi_ev_release_global_lock();
                if (ACPI_FAILURE(status)) {
+
                        /* Report the error, but there isn't much else we can do */
 
                        ACPI_EXCEPTION((AE_INFO, status,
@@ -263,7 +266,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
        u32 num_digits;
        acpi_integer current_value;
 
-       ACPI_FUNCTION_TRACE("ex_digits_needed");
+       ACPI_FUNCTION_TRACE(ex_digits_needed);
 
        /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
 
index ea2f13271ff19c069589858865127c425f1097e4..de50fab2a91066f2c23afe2087a1bbc02ab0b9a2 100644 (file)
@@ -63,7 +63,7 @@ acpi_status acpi_hw_initialize(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_initialize");
+       ACPI_FUNCTION_TRACE(hw_initialize);
 
        /* We must have the ACPI tables by the time we get here */
 
@@ -100,7 +100,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
        acpi_status status;
        u32 retry;
 
-       ACPI_FUNCTION_TRACE("hw_set_mode");
+       ACPI_FUNCTION_TRACE(hw_set_mode);
 
        /*
         * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
@@ -198,7 +198,7 @@ u32 acpi_hw_get_mode(void)
        acpi_status status;
        u32 value;
 
-       ACPI_FUNCTION_TRACE("hw_get_mode");
+       ACPI_FUNCTION_TRACE(hw_get_mode);
 
        /*
         * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
index d84942d22dd549269b7d87dfdfc5e417e664c375..608a3a60ee1132000bf77d6bc6569646e272bdb6 100644 (file)
@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Disable all GPEs in this register */
 
                status = acpi_hw_low_level_write(8, 0x00,
@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
+
                /* Clear status on all GPEs in this register */
 
                status = acpi_hw_low_level_write(8, 0xFF,
@@ -368,7 +370,7 @@ acpi_status acpi_hw_disable_all_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
+       ACPI_FUNCTION_TRACE(hw_disable_all_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
        status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
@@ -391,7 +393,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
+       ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
        return_ACPI_STATUS(status);
@@ -413,7 +415,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
+       ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes);
 
        status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
        return_ACPI_STATUS(status);
index e1fe75498415c6eaffbc634d3529665d5fad83ca..ae142de19507059639b49b3f2471f664c98d31a6 100644 (file)
@@ -43,8 +43,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
@@ -63,23 +61,21 @@ ACPI_MODULE_NAME("hwregs")
  * DESCRIPTION: Clears all fixed and general purpose status bits
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
 acpi_status acpi_hw_clear_acpi_status(u32 flags)
 {
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
-       ACPI_FUNCTION_TRACE("hw_clear_acpi_status");
+       ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
 
        ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
                          ACPI_BITMASK_ALL_FIXED_STATUS,
                          (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
+       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
 
        status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
                                        ACPI_REGISTER_PM1_STATUS,
@@ -104,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
        status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
 
       unlock_and_exit:
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
+       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        return_ACPI_STATUS(status);
 }
 
@@ -129,10 +123,9 @@ acpi_status
 acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
 {
        acpi_status status = AE_OK;
-       struct acpi_parameter_info info;
-       char *sleep_state_name;
+       struct acpi_evaluate_info *info;
 
-       ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data");
+       ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data);
 
        /* Validate parameters */
 
@@ -140,34 +133,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /* Evaluate the namespace object containing the values for this state */
+       /* Allocate the evaluation information block */
+
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
 
-       info.parameters = NULL;
-       info.return_object = NULL;
-       sleep_state_name =
+       info->pathname =
            ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
 
-       status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
+       /* Evaluate the namespace object containing the values for this state */
+
+       status = acpi_ns_evaluate(info);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "%s while evaluating sleep_state [%s]\n",
+                                 "%s while evaluating SleepState [%s]\n",
                                  acpi_format_exception(status),
-                                 sleep_state_name));
+                                 info->pathname));
 
-               return_ACPI_STATUS(status);
+               goto cleanup;
        }
 
        /* Must have a return object */
 
-       if (!info.return_object) {
+       if (!info->return_object) {
                ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
-                           sleep_state_name));
+                           info->pathname));
                status = AE_NOT_EXIST;
        }
 
        /* It must be of type Package */
 
-       else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) {
+       else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) {
                ACPI_ERROR((AE_INFO,
                            "Sleep State return object is not a Package"));
                status = AE_AML_OPERAND_TYPE;
@@ -180,7 +178,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
         * by BIOS vendors seems to be to have 2 or more elements, at least
         * one per sleep type (A/B).
         */
-       else if (info.return_object->package.count < 2) {
+       else if (info->return_object->package.count < 2) {
                ACPI_ERROR((AE_INFO,
                            "Sleep State return package does not have at least two elements"));
                status = AE_AML_NO_OPERAND;
@@ -188,39 +186,42 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
 
        /* The first two elements must both be of type Integer */
 
-       else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0])
+       else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0])
                  != ACPI_TYPE_INTEGER) ||
-                (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
+                (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1])
                  != ACPI_TYPE_INTEGER)) {
                ACPI_ERROR((AE_INFO,
                            "Sleep State return package elements are not both Integers (%s, %s)",
-                           acpi_ut_get_object_type_name(info.return_object->
+                           acpi_ut_get_object_type_name(info->return_object->
                                                         package.elements[0]),
-                           acpi_ut_get_object_type_name(info.return_object->
+                           acpi_ut_get_object_type_name(info->return_object->
                                                         package.elements[1])));
                status = AE_AML_OPERAND_TYPE;
        } else {
                /* Valid _Sx_ package size, type, and value */
 
                *sleep_type_a = (u8)
-                   (info.return_object->package.elements[0])->integer.value;
+                   (info->return_object->package.elements[0])->integer.value;
                *sleep_type_b = (u8)
-                   (info.return_object->package.elements[1])->integer.value;
+                   (info->return_object->package.elements[1])->integer.value;
        }
 
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status,
-                               "While evaluating sleep_state [%s], bad Sleep object %p type %s",
-                               sleep_state_name, info.return_object,
-                               acpi_ut_get_object_type_name(info.
+                               "While evaluating SleepState [%s], bad Sleep object %p type %s",
+                               info->pathname, info->return_object,
+                               acpi_ut_get_object_type_name(info->
                                                             return_object)));
        }
 
-       acpi_ut_remove_reference(info.return_object);
+       acpi_ut_remove_reference(info->return_object);
+
+      cleanup:
+       ACPI_FREE(info);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_sleep_type_data);
+ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data)
 
 /*******************************************************************************
  *
@@ -233,13 +234,12 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
  * DESCRIPTION: Map register_id into a register bitmask.
  *
  ******************************************************************************/
-
 struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
 {
        ACPI_FUNCTION_ENTRY();
 
        if (register_id > ACPI_BITREG_MAX) {
-               ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X",
+               ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X",
                            register_id));
                return (NULL);
        }
@@ -260,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
  *
  * DESCRIPTION: ACPI bit_register read function.
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
 
 acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
@@ -268,7 +270,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
        struct acpi_bit_register_info *bit_reg_info;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_get_register");
+       ACPI_FUNCTION_TRACE(acpi_get_register);
 
        /* Get the info structure corresponding to the requested ACPI Register */
 
@@ -277,24 +279,14 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
-
        /* Read from the register */
 
-       status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+       status = acpi_hw_register_read(ACPI_MTX_LOCK,
                                       bit_reg_info->parent_register,
                                       &register_value);
 
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
-
        if (ACPI_SUCCESS(status)) {
+
                /* Normalize the value that was read */
 
                register_value =
@@ -311,7 +303,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_register);
+ACPI_EXPORT_SYMBOL(acpi_get_register)
 
 /*******************************************************************************
  *
@@ -326,31 +318,28 @@ EXPORT_SYMBOL(acpi_get_register);
  *
  * DESCRIPTION: ACPI Bit Register write function.
  *
+ * NOTE: TBD: Flags parameter is obsolete, to be removed
+ *
  ******************************************************************************/
-
 acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 {
        u32 register_value = 0;
        struct acpi_bit_register_info *bit_reg_info;
        acpi_status status;
+       acpi_cpu_flags lock_flags;
 
-       ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id);
+       ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id);
 
        /* Get the info structure corresponding to the requested ACPI Register */
 
        bit_reg_info = acpi_hw_get_bit_register_info(register_id);
        if (!bit_reg_info) {
-               ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X",
+               ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X",
                            register_id));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-       }
+       lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
 
        /* Always do a register read first so we can insert the new bits  */
 
@@ -458,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 
       unlock_and_exit:
 
-       if (flags & ACPI_MTX_LOCK) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
-       }
+       acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
 
        /* Normalize the value that was read */
 
@@ -474,7 +461,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_set_register);
+ACPI_EXPORT_SYMBOL(acpi_set_register)
 
 /******************************************************************************
  *
@@ -490,21 +477,18 @@ EXPORT_SYMBOL(acpi_set_register);
  *              given offset.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 {
        u32 value1 = 0;
        u32 value2 = 0;
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
-       ACPI_FUNCTION_TRACE("hw_register_read");
+       ACPI_FUNCTION_TRACE(hw_register_read);
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
+               lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
        }
 
        switch (register_id) {
@@ -582,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 
       unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
+               acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        }
 
        if (ACPI_SUCCESS(status)) {
@@ -610,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 {
        acpi_status status;
+       acpi_cpu_flags lock_flags = 0;
 
-       ACPI_FUNCTION_TRACE("hw_register_write");
+       ACPI_FUNCTION_TRACE(hw_register_write);
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
+               lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
        }
 
        switch (register_id) {
@@ -707,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 
       unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
+               acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
        }
 
        return_ACPI_STATUS(status);
@@ -733,7 +715,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
        u64 address;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("hw_low_level_read");
+       ACPI_FUNCTION_NAME(hw_low_level_read);
 
        /*
         * Must have a valid pointer to a GAS structure, and
@@ -805,7 +787,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
        u64 address;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("hw_low_level_write");
+       ACPI_FUNCTION_NAME(hw_low_level_write);
 
        /*
         * Must have a valid pointer to a GAS structure, and
index 89269272fd621d7e4d4f6054448617b8173422d8..8bb43cae60c2e160037b31559270d1922d61ed99 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -64,7 +63,7 @@ acpi_status
 acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
 {
 
-       ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector");
+       ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
        /* Set the vector */
 
@@ -79,6 +78,8 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
        return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_firmware_waking_vector
@@ -92,13 +93,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
  * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
  *
  ******************************************************************************/
-
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
 acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
 {
 
-       ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector");
+       ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector);
 
        if (!physical_address) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -118,6 +118,8 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
 
        return_ACPI_STATUS(AE_OK);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector)
 #endif
 
 /*******************************************************************************
@@ -134,14 +136,13 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
  *              various OS-specific tasks between the two steps.
  *
  ******************************************************************************/
-
 acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
 {
        acpi_status status;
        struct acpi_object_list arg_list;
        union acpi_object arg;
 
-       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep");
+       ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep);
 
        /*
         * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
@@ -206,6 +207,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
        return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state
@@ -218,7 +221,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
-
 acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
 {
        u32 PM1Acontrol;
@@ -228,7 +230,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
        u32 in_value;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state");
+       ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
 
        if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
            (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
@@ -378,7 +380,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
        return_ACPI_STATUS(AE_OK);
 }
 
-EXPORT_SYMBOL(acpi_enter_sleep_state);
+ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
 
 /*******************************************************************************
  *
@@ -392,13 +394,12 @@ EXPORT_SYMBOL(acpi_enter_sleep_state);
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
-
 acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
 {
        u32 in_value;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios");
+       ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios);
 
        status =
            acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
@@ -443,7 +444,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
        return_ACPI_STATUS(AE_OK);
 }
 
-EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
+ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
 
 /*******************************************************************************
  *
@@ -457,7 +458,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
  *              Called with interrupts ENABLED.
  *
  ******************************************************************************/
-
 acpi_status acpi_leave_sleep_state(u8 sleep_state)
 {
        struct acpi_object_list arg_list;
@@ -468,7 +468,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
        u32 PM1Acontrol;
        u32 PM1Bcontrol;
 
-       ACPI_FUNCTION_TRACE("acpi_leave_sleep_state");
+       ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
 
        /*
         * Set SLP_TYPE and SLP_EN to state S0.
@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
                                               ACPI_REGISTER_PM1_CONTROL,
                                               &PM1Acontrol);
                if (ACPI_SUCCESS(status)) {
+
                        /* Clear SLP_EN and SLP_TYP fields */
 
                        PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
@@ -583,3 +584,5 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
 
        return_ACPI_STATUS(status);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state)
index fc10b7cb456f1327935b9054bc821873f181367a..c4ec47c939fde51a08975c567742afe9230b23a2 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
@@ -61,13 +60,13 @@ ACPI_MODULE_NAME("hwtimer")
  ******************************************************************************/
 acpi_status acpi_get_timer_resolution(u32 * resolution)
 {
-       ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
+       ACPI_FUNCTION_TRACE(acpi_get_timer_resolution);
 
        if (!resolution) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (0 == acpi_gbl_FADT->tmr_val_ext) {
+       if (acpi_gbl_FADT->tmr_val_ext == 0) {
                *resolution = 24;
        } else {
                *resolution = 32;
@@ -76,6 +75,8 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
        return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution)
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_get_timer
@@ -87,12 +88,11 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
  * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks).
  *
  ******************************************************************************/
-
 acpi_status acpi_get_timer(u32 * ticks)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_get_timer");
+       ACPI_FUNCTION_TRACE(acpi_get_timer);
 
        if (!ticks) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_timer);
+ACPI_EXPORT_SYMBOL(acpi_get_timer)
 
 /******************************************************************************
  *
@@ -133,7 +133,6 @@ EXPORT_SYMBOL(acpi_get_timer);
  *              2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 {
@@ -141,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
        u32 delta_ticks;
        acpi_integer quotient;
 
-       ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
+       ACPI_FUNCTION_TRACE(acpi_get_timer_duration);
 
        if (!time_elapsed) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -154,7 +153,8 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
        if (start_ticks < end_ticks) {
                delta_ticks = end_ticks - start_ticks;
        } else if (start_ticks > end_ticks) {
-               if (0 == acpi_gbl_FADT->tmr_val_ext) {
+               if (acpi_gbl_FADT->tmr_val_ext == 0) {
+
                        /* 24-bit Timer */
 
                        delta_ticks =
@@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_timer_duration);
+ACPI_EXPORT_SYMBOL(acpi_get_timer_duration)
index 2e2e4051dfa7abb0180023313b21303e248ac67a..c25b2b92edcf1e8a0281d12568301d360213fb6b 100644 (file)
@@ -723,6 +723,8 @@ get_parms(char *config_record,
                goto do_fail;
        count = tmp1 - tmp;
        *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!*action_handle)
+               goto do_fail;
        strncpy(*action_handle, tmp, count);
        *(*action_handle + count) = 0;
 
index 468244147ec1f7f422ee6d5bfe7fb7d510c602eb..d51d68f5dd8ddd66ab21e2ef5d082adaf5d7fff0 100644 (file)
@@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard")
 #define ACPI_MB_HID2                   "PNP0C02"
 /**
  * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
- * Doesn't care about the failure of 'request_region', since other may reserve 
+ * Doesn't care about the failure of 'request_region', since other may reserve
  * the io ports as well
  */
 #define IS_RESERVED_ADDR(base, len) \
@@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard")
 /*
  * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
  * the io ports if they really know they can use it, while
- * still preventing hotplug PCI devices from using it. 
+ * still preventing hotplug PCI devices from using it.
  */
 static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
 {
@@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboard_driver2 = {
                },
 };
 
+static void __init acpi_request_region (struct acpi_generic_address *addr,
+       unsigned int length, char *desc)
+{
+       if (!addr->address || !length)
+               return;
+
+       if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO)
+               request_region(addr->address, length, desc);
+       else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+               request_mem_region(addr->address, length, desc);
+}
+
 static void __init acpi_reserve_resources(void)
 {
-       if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-               request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
-                              acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
+       acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk,
+                              acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK");
 
-       if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-               request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
-                              acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
+       acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk,
+                              acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK");
 
-       if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-               request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
-                              acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
+       acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk,
+                              acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK");
 
-       if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-               request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
-                              acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
+       acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk,
+                              acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK");
 
-       if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
-               request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
+       if (acpi_gbl_FADT->pm_tm_len == 4)
+               acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR");
 
-       if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
-               request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
-                              acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
+       acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk,
+                              acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK");
 
        /* Length of GPE blocks must be a non-negative multiple of 2 */
 
-       if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
-           !(acpi_gbl_FADT->gpe0_blk_len & 0x1))
-               request_region(acpi_gbl_FADT->xgpe0_blk.address,
-                              acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
+       if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
+               acpi_request_region(&acpi_gbl_FADT->xgpe0_blk,
+                              acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK");
 
-       if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
-           !(acpi_gbl_FADT->gpe1_blk_len & 0x1))
-               request_region(acpi_gbl_FADT->xgpe1_blk.address,
-                              acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
+       if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
+               acpi_request_region(&acpi_gbl_FADT->xgpe1_blk,
+                              acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK");
 }
 
 static int __init acpi_motherboard_init(void)
 {
        acpi_bus_register_driver(&acpi_motherboard_driver1);
        acpi_bus_register_driver(&acpi_motherboard_driver2);
-       /* 
+       /*
         * Guarantee motherboard IO reservation first
         * This module must run after scan.c
         */
index 1149bc18fb359759ed84a70585a886adb0ad416c..48fadade52e2b17bbd55777fd30204bb2168548d 100644 (file)
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void)
        union acpi_operand_object *obj_desc;
        acpi_string val = NULL;
 
-       ACPI_FUNCTION_TRACE("ns_root_initialize");
+       ACPI_FUNCTION_TRACE(ns_root_initialize);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void)
                          "Entering predefined entries into namespace\n"));
 
        for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
+
                /* _OSI is optional for now, will be permanent later */
 
                if (!ACPI_STRCMP(init_val->name, "_OSI")
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 #if defined (ACPI_ASL_COMPILER)
 
-                               /* save the parameter count for the i_aSL compiler */
+                               /* Save the parameter count for the i_aSL compiler */
 
                                new_node->value = obj_desc->method.param_count;
 #else
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void)
        /* Save a handle to "_GPE", it is always present */
 
        if (ACPI_SUCCESS(status)) {
-               status =
-                   acpi_ns_get_node_by_path("\\_GPE", NULL,
-                                            ACPI_NS_NO_UPSEARCH,
-                                            &acpi_gbl_fadt_gpe_device);
+               status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
+                                         &acpi_gbl_fadt_gpe_device);
        }
 
        return_ACPI_STATUS(status);
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
        acpi_object_type type_to_check_for;
        acpi_object_type this_search_type;
        u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
-       u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
-                                   ACPI_NS_SEARCH_PARENT);
+       u32 local_flags;
 
-       ACPI_FUNCTION_TRACE("ns_lookup");
+       ACPI_FUNCTION_TRACE(ns_lookup);
 
        if (!return_node) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       acpi_gbl_ns_lookup_count++;
+       local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
        *return_node = ACPI_ENTRY_NOT_FOUND;
+       acpi_gbl_ns_lookup_count++;
 
        if (!acpi_gbl_root_node) {
                return_ACPI_STATUS(AE_NO_NAMESPACE);
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
 
-               /*
-                * This node might not be a actual "scope" node (such as a
-                * Device/Method, etc.)  It could be a Package or other object node.
-                * Backup up the tree to find the containing scope node.
-                */
-               while (!acpi_ns_opens_scope(prefix_node->type) &&
-                      prefix_node->type != ACPI_TYPE_ANY) {
-                       prefix_node = acpi_ns_get_parent_node(prefix_node);
+               if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
+                       /*
+                        * This node might not be a actual "scope" node (such as a
+                        * Device/Method, etc.)  It could be a Package or other object node.
+                        * Backup up the tree to find the containing scope node.
+                        */
+                       while (!acpi_ns_opens_scope(prefix_node->type) &&
+                              prefix_node->type != ACPI_TYPE_ANY) {
+                               prefix_node =
+                                   acpi_ns_get_parent_node(prefix_node);
+                       }
                }
        }
 
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
         * Begin examination of the actual pathname
         */
        if (!pathname) {
+
                /* A Null name_path is allowed and refers to the root */
 
                num_segments = 0;
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                 * to the current scope).
                 */
                if (*path == (u8) AML_ROOT_PREFIX) {
+
                        /* Pathname is fully qualified, start from the root */
 
                        this_node = acpi_gbl_root_node;
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                        this_node = prefix_node;
                        num_carats = 0;
                        while (*path == (u8) AML_PARENT_PREFIX) {
+
                                /* Name is fully qualified, no search rules apply */
 
                                search_parent_flag = ACPI_NS_NO_UPSEARCH;
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                                num_carats++;
                                this_node = acpi_ns_get_parent_node(this_node);
                                if (!this_node) {
+
                                        /* Current scope has no parent scope */
 
                                        ACPI_ERROR((AE_INFO,
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                                             &this_node);
                if (ACPI_FAILURE(status)) {
                        if (status == AE_NOT_FOUND) {
+
                                /* Name not found in ACPI namespace */
 
                                ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                    (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
                    (this_node->type != ACPI_TYPE_ANY) &&
                    (this_node->type != type_to_check_for)) {
+
                        /* Complain about a type mismatch */
 
                        ACPI_WARNING((AE_INFO,
-                                     "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)",
+                                     "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
                                      ACPI_CAST_PTR(char, &simple_name),
                                      acpi_ut_get_type_name(this_node->type),
                                      acpi_ut_get_type_name
index 9b871f38b61b81ff2480c951aae6095d6a13e1fd..dc3f0739a46b3aee1c4208cb7f9e46a57ff82a89 100644 (file)
@@ -47,9 +47,6 @@
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsalloc")
 
-/* Local prototypes */
-static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_create_node
@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
  * DESCRIPTION: Create a namespace node
  *
  ******************************************************************************/
-
 struct acpi_namespace_node *acpi_ns_create_node(u32 name)
 {
        struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("ns_create_node");
+       ACPI_FUNCTION_TRACE(ns_create_node);
 
-       node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
+       node = acpi_os_acquire_object(acpi_gbl_namespace_cache);
        if (!node) {
                return_PTR(NULL);
        }
@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
        ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
 
        node->name.integer = name;
-       node->reference_count = 1;
        ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
-
        return_PTR(node);
 }
 
@@ -100,7 +94,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
        struct acpi_namespace_node *prev_node;
        struct acpi_namespace_node *next_node;
 
-       ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
+       ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node);
 
        parent_node = acpi_ns_get_parent_node(node);
 
@@ -115,6 +109,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
        }
 
        if (prev_node) {
+
                /* Node is not first child, unlink it */
 
                prev_node->peer = next_node->peer;
@@ -125,6 +120,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
                /* Node is first child (has no previous peer) */
 
                if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
+
                        /* No peers at all */
 
                        parent_node->child = NULL;
@@ -137,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
        ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
 
        /*
-        * Detach an object if there is one then delete the node
+        * Detach an object if there is one, then delete the node
         */
        acpi_ns_detach_object(node);
-       ACPI_MEM_FREE(node);
+       (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
        return_VOID;
 }
 
@@ -171,7 +167,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
        acpi_owner_id owner_id = 0;
        struct acpi_namespace_node *child_node;
 
-       ACPI_FUNCTION_TRACE("ns_install_node");
+       ACPI_FUNCTION_TRACE(ns_install_node);
 
        /*
         * Get the owner ID from the Walk state
@@ -216,14 +212,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
                          acpi_ut_get_type_name(parent_node->type),
                          parent_node));
 
-       /*
-        * Increment the reference count(s) of all parents up to
-        * the root!
-        */
-       while ((node = acpi_ns_get_parent_node(node)) != NULL) {
-               node->reference_count++;
-       }
-
        return_VOID;
 }
 
@@ -244,10 +232,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
 {
        struct acpi_namespace_node *child_node;
        struct acpi_namespace_node *next_node;
-       struct acpi_namespace_node *node;
        u8 flags;
 
-       ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
+       ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node);
 
        if (!parent_node) {
                return_VOID;
@@ -264,6 +251,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
         * Deallocate all children at this level
         */
        do {
+
                /* Get the things we need */
 
                next_node = child_node->peer;
@@ -289,26 +277,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
                 */
                acpi_ns_detach_object(child_node);
 
-               /*
-                * Decrement the reference count(s) of all parents up to
-                * the root! (counts were incremented when the node was created)
-                */
-               node = child_node;
-               while ((node = acpi_ns_get_parent_node(node)) != NULL) {
-                       node->reference_count--;
-               }
-
-               /* There should be only one reference remaining on this node */
-
-               if (child_node->reference_count != 1) {
-                       ACPI_WARNING((AE_INFO,
-                                     "Existing references (%d) on node being deleted (%p)",
-                                     child_node->reference_count, child_node));
-               }
-
                /* Now we can delete the node */
 
-               ACPI_MEM_FREE(child_node);
+               (void)acpi_os_release_object(acpi_gbl_namespace_cache,
+                                            child_node);
 
                /* And move on to the next child in the list */
 
@@ -341,7 +313,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
        struct acpi_namespace_node *child_node = NULL;
        u32 level = 1;
 
-       ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
+       ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree);
 
        if (!parent_node) {
                return_VOID;
@@ -352,11 +324,14 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
         * to where we started.
         */
        while (level > 0) {
+
                /* Get the next node in this scope (NULL if none) */
 
-               child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
-                                                  child_node);
+               child_node =
+                   acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+                                         child_node);
                if (child_node) {
+
                        /* Found a child node - detach any attached object */
 
                        acpi_ns_detach_object(child_node);
@@ -399,55 +374,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
        return_VOID;
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_remove_reference
- *
- * PARAMETERS:  Node           - Named node whose reference count is to be
- *                               decremented
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Remove a Node reference.  Decrements the reference count
- *              of all parent Nodes up to the root.  Any node along
- *              the way that reaches zero references is freed.
- *
- ******************************************************************************/
-
-static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
-{
-       struct acpi_namespace_node *parent_node;
-       struct acpi_namespace_node *this_node;
-
-       ACPI_FUNCTION_ENTRY();
-
-       /*
-        * Decrement the reference count(s) of this node and all
-        * nodes up to the root,  Delete anything with zero remaining references.
-        */
-       this_node = node;
-       while (this_node) {
-               /* Prepare to move up to parent */
-
-               parent_node = acpi_ns_get_parent_node(this_node);
-
-               /* Decrement the reference count on this node */
-
-               this_node->reference_count--;
-
-               /* Delete the node if no more references */
-
-               if (!this_node->reference_count) {
-                       /* Delete all children and delete the node */
-
-                       acpi_ns_delete_children(this_node);
-                       acpi_ns_delete_node(this_node);
-               }
-
-               this_node = parent_node;
-       }
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_namespace_by_owner
@@ -469,15 +395,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
        u32 level;
        struct acpi_namespace_node *parent_node;
 
-       ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
+       ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id);
 
        if (owner_id == 0) {
                return_VOID;
        }
 
+       deletion_node = NULL;
        parent_node = acpi_gbl_root_node;
        child_node = NULL;
-       deletion_node = NULL;
        level = 1;
 
        /*
@@ -494,12 +420,14 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
                                          child_node);
 
                if (deletion_node) {
-                       acpi_ns_remove_reference(deletion_node);
+                       acpi_ns_delete_children(deletion_node);
+                       acpi_ns_delete_node(deletion_node);
                        deletion_node = NULL;
                }
 
                if (child_node) {
                        if (child_node->owner_id == owner_id) {
+
                                /* Found a matching child node - detach any attached object */
 
                                acpi_ns_detach_object(child_node);
index a2807317a84b0295a514f9bbfbd12d071fa73ae6..d72df66aa96533605b94e54344be46603ebd0abb 100644 (file)
@@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 {
        acpi_native_uint i;
 
-       ACPI_FUNCTION_NAME("ns_print_pathname");
+       ACPI_FUNCTION_NAME(ns_print_pathname);
 
        if (!(acpi_dbg_level & ACPI_LV_NAMES)
            || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
@@ -123,7 +123,7 @@ void
 acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
 {
 
-       ACPI_FUNCTION_TRACE("ns_dump_pathname");
+       ACPI_FUNCTION_TRACE(ns_dump_pathname);
 
        /* Do this only if the requested debug level and component are enabled */
 
@@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
        u32 dbg_level;
        u32 i;
 
-       ACPI_FUNCTION_NAME("ns_dump_one_object");
+       ACPI_FUNCTION_NAME(ns_dump_one_object);
 
        /* Is output enabled? */
 
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
        }
 
        if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
+
                /* Indent the object according to the level */
 
                acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
@@ -203,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                }
 
                if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
+                       this_node->name.integer =
+                           acpi_ut_repair_name(this_node->name.integer);
+
                        ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
                                      this_node->name.integer));
                }
@@ -226,6 +230,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
        case ACPI_DISPLAY_SUMMARY:
 
                if (!obj_desc) {
+
                        /* No attached object, we are done */
 
                        acpi_os_printf("\n");
@@ -419,6 +424,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
 
                acpi_os_printf("O:%p", obj_desc);
                if (!obj_desc) {
+
                        /* No attached object, we are done */
 
                        acpi_os_printf("\n");
@@ -669,7 +675,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
 {
        acpi_handle search_handle = search_base;
 
-       ACPI_FUNCTION_TRACE("ns_dump_tables");
+       ACPI_FUNCTION_TRACE(ns_dump_tables);
 
        if (!acpi_gbl_root_node) {
                /*
@@ -682,6 +688,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
        }
 
        if (ACPI_NS_ALL == search_base) {
+
                /* Entire namespace */
 
                search_handle = acpi_gbl_root_node;
index aff899a935e3a9529ff33f4044c8d12223d7f199..c6bf5d30fca34c3e9199ae66c926dcdd0905ca26 100644 (file)
@@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
        acpi_status status;
        u32 i;
 
-       ACPI_FUNCTION_NAME("ns_dump_one_device");
+       ACPI_FUNCTION_NAME(ns_dump_one_device);
 
        status =
            acpi_ns_dump_one_object(obj_handle, level, context, return_value);
@@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
                                      info->hardware_id.value,
                                      ACPI_FORMAT_UINT64(info->address),
                                      info->current_status));
-               ACPI_MEM_FREE(info);
+               ACPI_FREE(info);
        }
 
        return (status);
@@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void)
        acpi_handle sys_bus_handle;
        acpi_status status;
 
-       ACPI_FUNCTION_NAME("ns_dump_root_devices");
+       ACPI_FUNCTION_NAME(ns_dump_root_devices);
 
        /* Only dump the table if tracing is enabled */
 
index 19d7b94d40c3844573599ea342de5c25ce40cdb2..4b0a4a8c9843ce76a3a852440881a603a2606517 100644 (file)
@@ -1,7 +1,6 @@
 /*******************************************************************************
  *
- * Module Name: nseval - Object evaluation interfaces -- includes control
- *                       method lookup and execution.
+ * Module Name: nseval - Object evaluation, includes control method execution
  *
  ******************************************************************************/
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nseval")
 
-/* Local prototypes */
-static acpi_status
-acpi_ns_execute_control_method(struct acpi_parameter_info *info);
-
-static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info);
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_evaluate_relative
- *
- * PARAMETERS:  Pathname        - Name of method to execute, If NULL, the
- *                                handle is the object to execute
- *              Info            - Method info block, contains:
- *                  return_object   - Where to put method's return value (if
- *                                    any).  If NULL, no value is returned.
- *                  Params          - List of parameters to pass to the method,
- *                                    terminated by NULL.  Params itself may be
- *                                    NULL if no parameters are being passed.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Evaluate the object or find and execute the requested method
- *
- * MUTEX:       Locks Namespace
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
-{
-       acpi_status status;
-       struct acpi_namespace_node *node = NULL;
-       union acpi_generic_state *scope_info;
-       char *internal_path = NULL;
-
-       ACPI_FUNCTION_TRACE("ns_evaluate_relative");
-
-       /*
-        * Must have a valid object handle
-        */
-       if (!info || !info->node) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
-
-       /* Build an internal name string for the method */
-
-       status = acpi_ns_internalize_name(pathname, &internal_path);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       scope_info = acpi_ut_create_generic_state();
-       if (!scope_info) {
-               goto cleanup1;
-       }
-
-       /* Get the prefix handle and Node */
-
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               goto cleanup;
-       }
-
-       info->node = acpi_ns_map_handle_to_node(info->node);
-       if (!info->node) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-               status = AE_BAD_PARAMETER;
-               goto cleanup;
-       }
-
-       /* Lookup the name in the namespace */
-
-       scope_info->scope.node = info->node;
-       status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY,
-                               ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-                               &node);
-
-       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-
-       if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
-                                 pathname, acpi_format_exception(status)));
-               goto cleanup;
-       }
-
-       /*
-        * Now that we have a handle to the object, we can attempt to evaluate it.
-        */
-       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-                         pathname, node, acpi_ns_get_attached_object(node)));
-
-       info->node = node;
-       status = acpi_ns_evaluate_by_handle(info);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                         "*** Completed eval of object %s ***\n", pathname));
-
-      cleanup:
-       acpi_ut_delete_generic_state(scope_info);
-
-      cleanup1:
-       ACPI_MEM_FREE(internal_path);
-       return_ACPI_STATUS(status);
-}
-
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_evaluate_by_name
+ * FUNCTION:    acpi_ns_evaluate
  *
- * PARAMETERS:  Pathname        - Fully qualified pathname to the object
- *              Info                - Method info block, contains:
- *                  return_object   - Where to put method's return value (if
- *                                    any).  If NULL, no value is returned.
- *                  Params          - List of parameters to pass to the method,
- *                                    terminated by NULL.  Params itself may be
- *                                    NULL if no parameters are being passed.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Evaluate the object or rind and execute the requested method
- *              passing the given parameters
- *
- * MUTEX:       Locks Namespace
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
-{
-       acpi_status status;
-       char *internal_path = NULL;
-
-       ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
-
-       /* Build an internal name string for the method */
-
-       status = acpi_ns_internalize_name(pathname, &internal_path);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               goto cleanup;
-       }
-
-       /* Lookup the name in the namespace */
-
-       status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY,
-                               ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-                               &info->node);
-
-       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-
-       if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                                 "Object at [%s] was not found, status=%.4X\n",
-                                 pathname, status));
-               goto cleanup;
-       }
-
-       /*
-        * Now that we have a handle to the object, we can attempt to evaluate it.
-        */
-       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-                         pathname, info->node,
-                         acpi_ns_get_attached_object(info->node)));
-
-       status = acpi_ns_evaluate_by_handle(info);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                         "*** Completed eval of object %s ***\n", pathname));
-
-      cleanup:
-
-       /* Cleanup */
-
-       if (internal_path) {
-               ACPI_MEM_FREE(internal_path);
-       }
-
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_evaluate_by_handle
- *
- * PARAMETERS:  Info            - Method info block, contains:
- *                  Node            - Method/Object Node to execute
+ * PARAMETERS:  Info            - Evaluation info block, contains:
+ *                  prefix_node     - Prefix or Method/Object Node to execute
+ *                  Pathname        - Name of method to execute, If NULL, the
+ *                                    Node is the object to execute
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
@@ -248,29 +65,21 @@ acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
  *                  parameter_type  - Type of Parameter list
  *                  return_object   - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
+ *                  Flags           - ACPI_IGNORE_RETURN_VALUE to delete return
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Evaluate object or execute the requested method passing the
- *              given parameters
+ * DESCRIPTION: Execute a control method or return the current value of an
+ *              ACPI namespace object.
  *
- * MUTEX:       Locks Namespace
+ * MUTEX:       Locks interpreter
  *
  ******************************************************************************/
-
-acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
+acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
-
-       /* Check if namespace has been initialized */
-
-       if (!acpi_gbl_root_node) {
-               return_ACPI_STATUS(AE_NO_NAMESPACE);
-       }
-
-       /* Parameter Validation */
+       ACPI_FUNCTION_TRACE(ns_evaluate);
 
        if (!info) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -280,202 +89,120 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
 
        info->return_object = NULL;
 
-       /* Get the prefix handle and Node */
-
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       /*
+        * Get the actual namespace node for the target object. Handles these cases:
+        *
+        * 1) Null node, Pathname (absolute path)
+        * 2) Node, Pathname (path relative to Node)
+        * 3) Node, Null Pathname
+        */
+       status = acpi_ns_get_node(info->prefix_node, info->pathname,
+                                 ACPI_NS_NO_UPSEARCH, &info->resolved_node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       info->node = acpi_ns_map_handle_to_node(info->node);
-       if (!info->node) {
-               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
-
        /*
         * For a method alias, we must grab the actual method node so that proper
         * scoping context will be established before execution.
         */
-       if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-               info->node =
+       if (acpi_ns_get_type(info->resolved_node) ==
+           ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+               info->resolved_node =
                    ACPI_CAST_PTR(struct acpi_namespace_node,
-                                 info->node->object);
+                                 info->resolved_node->object);
        }
 
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname,
+                         info->resolved_node,
+                         acpi_ns_get_attached_object(info->resolved_node)));
+
        /*
         * Two major cases here:
-        * 1) The object is an actual control method -- execute it.
-        * 2) The object is not a method -- just return it's current value
         *
-        * In both cases, the namespace is unlocked by the acpi_ns* procedure
+        * 1) The object is a control method -- execute it
+        * 2) The object is not a method -- just return it's current value
         */
-       if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) {
-               /*
-                * Case 1) We have an actual control method to execute
-                */
-               status = acpi_ns_execute_control_method(info);
-       } else {
+       if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) {
                /*
-                * Case 2) Object is NOT a method, just return its current value
+                * 1) Object is a control method - execute it
                 */
-               status = acpi_ns_get_object_value(info);
-       }
-
-       /*
-        * Check if there is a return value on the stack that must be dealt with
-        */
-       if (status == AE_CTRL_RETURN_VALUE) {
-               /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
-
-               status = AE_OK;
-       }
-
-       /*
-        * Namespace was unlocked by the handling acpi_ns* function, so we
-        * just return
-        */
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_execute_control_method
- *
- * PARAMETERS:  Info            - Method info block, contains:
- *                  Node            - Method Node to execute
- *                  obj_desc        - Method object
- *                  Parameters      - List of parameters to pass to the method,
- *                                    terminated by NULL. Params itself may be
- *                                    NULL if no parameters are being passed.
- *                  return_object   - Where to put method's return value (if
- *                                    any). If NULL, no value is returned.
- *                  parameter_type  - Type of Parameter list
- *                  return_object   - Where to put method's return value (if
- *                                    any). If NULL, no value is returned.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute the requested method passing the given parameters
- *
- * MUTEX:       Assumes namespace is locked
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ns_execute_control_method(struct acpi_parameter_info *info)
-{
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE("ns_execute_control_method");
-
-       /* Verify that there is a method associated with this object */
-
-       info->obj_desc = acpi_ns_get_attached_object(info->node);
-       if (!info->obj_desc) {
-               ACPI_ERROR((AE_INFO, "No attached method object"));
 
-               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-               return_ACPI_STATUS(AE_NULL_OBJECT);
-       }
-
-       ACPI_DUMP_PATHNAME(info->node, "Execute Method:",
-                          ACPI_LV_INFO, _COMPONENT);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
-                         info->obj_desc->method.aml_start + 1,
-                         info->obj_desc->method.aml_length - 1));
-
-       /*
-        * Unlock the namespace before execution.  This allows namespace access
-        * via the external Acpi* interfaces while a method is being executed.
-        * However, any namespace deletion must acquire both the namespace and
-        * interpreter locks to ensure that no thread is using the portion of the
-        * namespace that is being deleted.
-        */
-       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
+               /* Verify that there is a method object associated with this node */
 
-       /*
-        * Execute the method via the interpreter.  The interpreter is locked
-        * here before calling into the AML parser
-        */
-       status = acpi_ex_enter_interpreter();
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
+               info->obj_desc =
+                   acpi_ns_get_attached_object(info->resolved_node);
+               if (!info->obj_desc) {
+                       ACPI_ERROR((AE_INFO,
+                                   "Control method has no attached sub-object"));
+                       return_ACPI_STATUS(AE_NULL_OBJECT);
+               }
 
-       status = acpi_ps_execute_method(info);
-       acpi_ex_exit_interpreter();
+               ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:",
+                                  ACPI_LV_INFO, _COMPONENT);
 
-       return_ACPI_STATUS(status);
-}
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Method at AML address %p Length %X\n",
+                                 info->obj_desc->method.aml_start + 1,
+                                 info->obj_desc->method.aml_length - 1));
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_get_object_value
- *
- * PARAMETERS:  Info            - Method info block, contains:
- *                  Node            - Object's NS node
- *                  return_object   - Where to put object value (if
- *                                    any). If NULL, no value is returned.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Return the current value of the object
- *
- * MUTEX:       Assumes namespace is locked, leaves namespace unlocked
- *
- ******************************************************************************/
+               /*
+                * Any namespace deletion must acquire both the namespace and
+                * interpreter locks to ensure that no thread is using the portion of
+                * the namespace that is being deleted.
+                *
+                * Execute the method via the interpreter. The interpreter is locked
+                * here before calling into the AML parser
+                */
+               status = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
 
-static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
-{
-       acpi_status status = AE_OK;
-       struct acpi_namespace_node *resolved_node = info->node;
+               status = acpi_ps_execute_method(info);
+               acpi_ex_exit_interpreter();
+       } else {
+               /*
+                * 2) Object is not a method, return its current value
+                */
 
-       ACPI_FUNCTION_TRACE("ns_get_object_value");
+               /*
+                * Objects require additional resolution steps (e.g., the Node may be
+                * a field that must be read, etc.) -- we can't just grab the object
+                * out of the node.
+                *
+                * Use resolve_node_to_value() to get the associated value.
+                *
+                * NOTE: we can get away with passing in NULL for a walk state because
+                * resolved_node is guaranteed to not be a reference to either a method
+                * local or a method argument (because this interface is never called
+                * from a running method.)
+                *
+                * Even though we do not directly invoke the interpreter for object
+                * resolution, we must lock it because we could access an opregion.
+                * The opregion access code assumes that the interpreter is locked.
+                */
+               status = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
 
-       /*
-        * Objects require additional resolution steps (e.g., the Node may be a
-        * field that must be read, etc.) -- we can't just grab the object out of
-        * the node.
-        */
+               /* Function has a strange interface */
 
-       /*
-        * Use resolve_node_to_value() to get the associated value. This call always
-        * deletes obj_desc (allocated above).
-        *
-        * NOTE: we can get away with passing in NULL for a walk state because
-        * obj_desc is guaranteed to not be a reference to either a method local or
-        * a method argument (because this interface can only be called from the
-        * acpi_evaluate external interface, never called from a running method.)
-        *
-        * Even though we do not directly invoke the interpreter for this, we must
-        * enter it because we could access an opregion. The opregion access code
-        * assumes that the interpreter is locked.
-        *
-        * We must release the namespace lock before entering the intepreter.
-        */
-       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
+               status =
+                   acpi_ex_resolve_node_to_value(&info->resolved_node, NULL);
+               acpi_ex_exit_interpreter();
 
-       status = acpi_ex_enter_interpreter();
-       if (ACPI_SUCCESS(status)) {
-               status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
                /*
                 * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
                 * in resolved_node.
                 */
-               acpi_ex_exit_interpreter();
-
                if (ACPI_SUCCESS(status)) {
                        status = AE_CTRL_RETURN_VALUE;
-                       info->return_object = ACPI_CAST_PTR
-                           (union acpi_operand_object, resolved_node);
+                       info->return_object =
+                           ACPI_CAST_PTR(union acpi_operand_object,
+                                         info->resolved_node);
+
                        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                                          "Returning object %p [%s]\n",
                                          info->return_object,
@@ -484,7 +211,30 @@ static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
                }
        }
 
-       /* Namespace is unlocked */
+       /*
+        * Check if there is a return value that must be dealt with
+        */
+       if (status == AE_CTRL_RETURN_VALUE) {
+
+               /* If caller does not want the return value, delete it */
 
+               if (info->flags & ACPI_IGNORE_RETURN_VALUE) {
+                       acpi_ut_remove_reference(info->return_object);
+                       info->return_object = NULL;
+               }
+
+               /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
+
+               status = AE_OK;
+       }
+
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "*** Completed evaluation of object %s ***\n",
+                         info->pathname));
+
+       /*
+        * Namespace was unlocked by the handling acpi_ns* function, so we
+        * just return
+        */
        return_ACPI_STATUS(status);
 }
index 9f929e479fd835b66183d7ab5478f768893acfce..aec8488c001951b514b290784883e4e045ca7d72 100644 (file)
@@ -58,6 +58,10 @@ static acpi_status
 acpi_ns_init_one_device(acpi_handle obj_handle,
                        u32 nesting_level, void *context, void **return_value);
 
+static acpi_status
+acpi_ns_find_ini_methods(acpi_handle obj_handle,
+                        u32 nesting_level, void *context, void **return_value);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_initialize_objects
@@ -76,7 +80,7 @@ acpi_status acpi_ns_initialize_objects(void)
        acpi_status status;
        struct acpi_init_walk_info info;
 
-       ACPI_FUNCTION_TRACE("ns_initialize_objects");
+       ACPI_FUNCTION_TRACE(ns_initialize_objects);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
                          "**** Starting initialization of namespace objects ****\n"));
@@ -93,7 +97,7 @@ acpi_status acpi_ns_initialize_objects(void)
                                     ACPI_UINT32_MAX, acpi_ns_init_one_object,
                                     &info, NULL);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
+               ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
@@ -133,7 +137,7 @@ acpi_status acpi_ns_initialize_devices(void)
        acpi_status status;
        struct acpi_device_walk_info info;
 
-       ACPI_FUNCTION_TRACE("ns_initialize_devices");
+       ACPI_FUNCTION_TRACE(ns_initialize_devices);
 
        /* Init counters */
 
@@ -142,30 +146,46 @@ acpi_status acpi_ns_initialize_devices(void)
        info.num_INI = 0;
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-                             "Executing all Device _STA and_INI methods:"));
+                             "Initializing Device/Processor/Thermal objects by executing _INI methods:"));
+
+       /* Tree analysis: find all subtrees that contain _INI methods */
 
-       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+                                       ACPI_UINT32_MAX, FALSE,
+                                       acpi_ns_find_ini_methods, &info, NULL);
        if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+               goto error_exit;
        }
 
-       /* Walk namespace for all objects */
+       /* Allocate the evaluation information block */
+
+       info.evaluate_info =
+           ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info.evaluate_info) {
+               status = AE_NO_MEMORY;
+               goto error_exit;
+       }
+
+       /* Walk namespace to execute all _INIs on present devices */
 
        status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                                       ACPI_UINT32_MAX, TRUE,
+                                       ACPI_UINT32_MAX, FALSE,
                                        acpi_ns_init_one_device, &info, NULL);
 
-       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-
+       ACPI_FREE(info.evaluate_info);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
+               goto error_exit;
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-                             "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n",
-                             info.device_count, info.num_STA, info.num_INI));
+                             "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n",
+                             info.num_INI, info.num_STA, info.device_count));
 
        return_ACPI_STATUS(status);
+
+      error_exit:
+       ACPI_EXCEPTION((AE_INFO, status, "During device initialization"));
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -200,7 +220,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
            (struct acpi_namespace_node *)obj_handle;
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_NAME("ns_init_one_object");
+       ACPI_FUNCTION_NAME(ns_init_one_object);
 
        info->object_count++;
 
@@ -309,6 +329,72 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
        return (AE_OK);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_find_ini_methods
+ *
+ * PARAMETERS:  acpi_walk_callback
+ *
+ * RETURN:      acpi_status
+ *
+ * DESCRIPTION: Called during namespace walk. Finds objects named _INI under
+ *              device/processor/thermal objects, and marks the entire subtree
+ *              with a SUBTREE_HAS_INI flag. This flag is used during the
+ *              subsequent device initialization walk to avoid entire subtrees
+ *              that do not contain an _INI.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_find_ini_methods(acpi_handle obj_handle,
+                        u32 nesting_level, void *context, void **return_value)
+{
+       struct acpi_device_walk_info *info =
+           ACPI_CAST_PTR(struct acpi_device_walk_info, context);
+       struct acpi_namespace_node *node;
+       struct acpi_namespace_node *parent_node;
+
+       /* Keep count of device/processor/thermal objects */
+
+       node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
+       if ((node->type == ACPI_TYPE_DEVICE) ||
+           (node->type == ACPI_TYPE_PROCESSOR) ||
+           (node->type == ACPI_TYPE_THERMAL)) {
+               info->device_count++;
+               return (AE_OK);
+       }
+
+       /* We are only looking for methods named _INI */
+
+       if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) {
+               return (AE_OK);
+       }
+
+       /*
+        * The only _INI methods that we care about are those that are
+        * present under Device, Processor, and Thermal objects.
+        */
+       parent_node = acpi_ns_get_parent_node(node);
+       switch (parent_node->type) {
+       case ACPI_TYPE_DEVICE:
+       case ACPI_TYPE_PROCESSOR:
+       case ACPI_TYPE_THERMAL:
+
+               /* Mark parent and bubble up the INI present flag to the root */
+
+               while (parent_node) {
+                       parent_node->flags |= ANOBJ_SUBTREE_HAS_INI;
+                       parent_node = acpi_ns_get_parent_node(parent_node);
+               }
+               break;
+
+       default:
+               break;
+       }
+
+       return (AE_OK);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_init_one_device
@@ -327,119 +413,165 @@ static acpi_status
 acpi_ns_init_one_device(acpi_handle obj_handle,
                        u32 nesting_level, void *context, void **return_value)
 {
-       struct acpi_device_walk_info *info =
-           (struct acpi_device_walk_info *)context;
-       struct acpi_parameter_info pinfo;
+       struct acpi_device_walk_info *walk_info =
+           ACPI_CAST_PTR(struct acpi_device_walk_info, context);
+       struct acpi_evaluate_info *info = walk_info->evaluate_info;
        u32 flags;
        acpi_status status;
-       struct acpi_namespace_node *ini_node;
        struct acpi_namespace_node *device_node;
 
-       ACPI_FUNCTION_TRACE("ns_init_one_device");
+       ACPI_FUNCTION_TRACE(ns_init_one_device);
 
-       device_node = acpi_ns_map_handle_to_node(obj_handle);
-       if (!device_node) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
+       /* We are interested in Devices, Processors and thermal_zones only */
 
-       /*
-        * We will run _STA/_INI on Devices, Processors and thermal_zones only
-        */
+       device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
        if ((device_node->type != ACPI_TYPE_DEVICE) &&
            (device_node->type != ACPI_TYPE_PROCESSOR) &&
            (device_node->type != ACPI_TYPE_THERMAL)) {
                return_ACPI_STATUS(AE_OK);
        }
 
-       if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
-           (!(acpi_dbg_level & ACPI_LV_INFO))) {
-               ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
-       }
-
-       info->device_count++;
-
        /*
-        * Check if the _INI method exists for this device -
-        * if _INI does not exist, there is no need to run _STA
-        * No _INI means device requires no initialization
+        * Because of an earlier namespace analysis, all subtrees that contain an
+        * _INI method are tagged.
+        *
+        * If this device subtree does not contain any _INI methods, we
+        * can exit now and stop traversing this entire subtree.
         */
-       status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI),
-                                    device_node, ACPI_TYPE_METHOD, &ini_node);
-       if (ACPI_FAILURE(status)) {
-               /* No _INI method found - move on to next device */
-
-               return_ACPI_STATUS(AE_OK);
+       if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) {
+               return_ACPI_STATUS(AE_CTRL_DEPTH);
        }
 
        /*
-        * Run _STA to determine if we can run _INI on the device -
-        * the device must be present before _INI can be run.
-        * However, _STA is not required - assume device present if no _STA
+        * Run _STA to determine if this device is present and functioning. We
+        * must know this information for two important reasons (from ACPI spec):
+        *
+        * 1) We can only run _INI if the device is present.
+        * 2) We must abort the device tree walk on this subtree if the device is
+        *    not present and is not functional (we will not examine the children)
+        *
+        * The _STA method is not required to be present under the device, we
+        * assume the device is present if _STA does not exist.
         */
-       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
-                                                     device_node,
-                                                     METHOD_NAME__STA));
-
-       pinfo.node = device_node;
-       pinfo.parameters = NULL;
-       pinfo.parameter_type = ACPI_PARAM_ARGS;
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                       (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA));
 
-       status = acpi_ut_execute_STA(pinfo.node, &flags);
+       status = acpi_ut_execute_STA(device_node, &flags);
        if (ACPI_FAILURE(status)) {
+
                /* Ignore error and move on to next device */
 
                return_ACPI_STATUS(AE_OK);
        }
 
+       /*
+        * Flags == -1 means that _STA was not found. In this case, we assume that
+        * the device is both present and functional.
+        *
+        * From the ACPI spec, description of _STA:
+        *
+        * "If a device object (including the processor object) does not have an
+        * _STA object, then OSPM assumes that all of the above bits are set (in
+        * other words, the device is present, ..., and functioning)"
+        */
        if (flags != ACPI_UINT32_MAX) {
-               info->num_STA++;
+               walk_info->num_STA++;
        }
 
+       /*
+        * Examine the PRESENT and FUNCTIONING status bits
+        *
+        * Note: ACPI spec does not seem to specify behavior for the present but
+        * not functioning case, so we assume functioning if present.
+        */
        if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
-               /* Don't look at children of a not present device */
 
-               return_ACPI_STATUS(AE_CTRL_DEPTH);
+               /* Device is not present, we must examine the Functioning bit */
+
+               if (flags & ACPI_STA_DEVICE_FUNCTIONING) {
+                       /*
+                        * Device is not present but is "functioning". In this case,
+                        * we will not run _INI, but we continue to examine the children
+                        * of this device.
+                        *
+                        * From the ACPI spec, description of _STA: (Note - no mention
+                        * of whether to run _INI or not on the device in question)
+                        *
+                        * "_STA may return bit 0 clear (not present) with bit 3 set
+                        * (device is functional). This case is used to indicate a valid
+                        * device for which no device driver should be loaded (for example,
+                        * a bridge device.) Children of this device may be present and
+                        * valid. OSPM should continue enumeration below a device whose
+                        * _STA returns this bit combination"
+                        */
+                       return_ACPI_STATUS(AE_OK);
+               } else {
+                       /*
+                        * Device is not present and is not functioning. We must abort the
+                        * walk of this subtree immediately -- don't look at the children
+                        * of such a device.
+                        *
+                        * From the ACPI spec, description of _INI:
+                        *
+                        * "If the _STA method indicates that the device is not present,
+                        * OSPM will not run the _INI and will not examine the children
+                        * of the device for _INI methods"
+                        */
+                       return_ACPI_STATUS(AE_CTRL_DEPTH);
+               }
        }
 
        /*
-        * The device is present and _INI exists. Run the _INI method.
-        * (We already have the _INI node from above)
+        * The device is present or is assumed present if no _STA exists.
+        * Run the _INI if it exists (not required to exist)
+        *
+        * Note: We know there is an _INI within this subtree, but it may not be
+        * under this particular device, it may be lower in the branch.
         */
-       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
-                                                     pinfo.node,
-                                                     METHOD_NAME__INI));
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                       (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
+
+       info->prefix_node = device_node;
+       info->pathname = METHOD_NAME__INI;
+       info->parameters = NULL;
+       info->parameter_type = ACPI_PARAM_ARGS;
+       info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+       status = acpi_ns_evaluate(info);
+       if (ACPI_SUCCESS(status)) {
+               walk_info->num_INI++;
+
+               if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
+                   (!(acpi_dbg_level & ACPI_LV_INFO))) {
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
+               }
+       }
+#ifdef ACPI_DEBUG_OUTPUT
+       else if (status != AE_NOT_FOUND) {
 
-       pinfo.node = ini_node;
-       status = acpi_ns_evaluate_by_handle(&pinfo);
-       if (ACPI_FAILURE(status)) {
                /* Ignore error and move on to next device */
 
-#ifdef ACPI_DEBUG_OUTPUT
-               char *scope_name = acpi_ns_get_external_pathname(ini_node);
-
-               ACPI_WARNING((AE_INFO, "%s._INI failed: %s",
-                             scope_name, acpi_format_exception(status)));
+               char *scope_name =
+                   acpi_ns_get_external_pathname(info->resolved_node);
 
-               ACPI_MEM_FREE(scope_name);
+               ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
+                               scope_name));
+               ACPI_FREE(scope_name);
+       }
 #endif
-       } else {
-               /* Delete any return object (especially if implicit_return is enabled) */
 
-               if (pinfo.return_object) {
-                       acpi_ut_remove_reference(pinfo.return_object);
-               }
+       /* Ignore errors from above */
 
-               /* Count of successful INIs */
-
-               info->num_INI++;
-       }
+       status = AE_OK;
 
+       /*
+        * The _INI method has been run if present; call the Global Initialization
+        * Handler for this device.
+        */
        if (acpi_gbl_init_handler) {
-               /* External initialization handler is present, call it */
-
                status =
-                   acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
+                   acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI);
        }
 
-       return_ACPI_STATUS(AE_OK);
+       return_ACPI_STATUS(status);
 }
index 4e0b0524c18831590c0513c16066ca6486671a64..fe75d888e1838693146718488305f530c1ef449d 100644 (file)
@@ -77,13 +77,14 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ns_load_table");
+       ACPI_FUNCTION_TRACE(ns_load_table);
 
        /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
 
        if (!
            (acpi_gbl_table_data[table_desc->type].
             flags & ACPI_TABLE_EXECUTABLE)) {
+
                /* Just ignore this table */
 
                return_ACPI_STATUS(AE_OK);
@@ -168,7 +169,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
        acpi_status status;
        struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_TRACE("ns_load_table_by_type");
+       ACPI_FUNCTION_TRACE(ns_load_table_by_type);
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
        if (ACPI_FAILURE(status)) {
@@ -180,11 +181,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
         * DSDT (one), SSDT/PSDT (multiple)
         */
        switch (table_type) {
-       case ACPI_TABLE_DSDT:
+       case ACPI_TABLE_ID_DSDT:
 
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
 
-               table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
+               table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next;
 
                /* If table already loaded into namespace, just return */
 
@@ -200,8 +201,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
                }
                break;
 
-       case ACPI_TABLE_SSDT:
-       case ACPI_TABLE_PSDT:
+       case ACPI_TABLE_ID_SSDT:
+       case ACPI_TABLE_ID_PSDT:
 
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "Namespace load: %d SSDT or PSDTs\n",
@@ -258,7 +259,7 @@ acpi_status acpi_ns_load_namespace(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_load_name_space");
+       ACPI_FUNCTION_TRACE(acpi_load_name_space);
 
        /* There must be at least a DSDT installed */
 
@@ -271,15 +272,15 @@ acpi_status acpi_ns_load_namespace(void)
         * Load the namespace.  The DSDT is required,
         * but the SSDT and PSDT tables are optional.
         */
-       status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
+       status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
        /* Ignore exceptions from these */
 
-       (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
-       (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
+       (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT);
+       (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT);
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
                              "ACPI Namespace successfully loaded at root %p\n",
@@ -314,7 +315,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
        acpi_handle dummy;
        u32 level;
 
-       ACPI_FUNCTION_TRACE("ns_delete_subtree");
+       ACPI_FUNCTION_TRACE(ns_delete_subtree);
 
        parent_handle = start_handle;
        child_handle = NULL;
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
         * to where we started.
         */
        while (level > 0) {
+
                /* Attempt to get the next object in this scope */
 
                status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
                /* Did we get a new object? */
 
                if (ACPI_SUCCESS(status)) {
+
                        /* Check if this object has any children */
 
                        if (ACPI_SUCCESS
@@ -392,7 +395,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ns_unload_name_space");
+       ACPI_FUNCTION_TRACE(ns_unload_name_space);
 
        /* Parameter validation */
 
index 639f653b4b6baadb5e34f3731a001de20fa6334c..97b8332c97469c90a25dbc403e3bd098ce4bae9c 100644 (file)
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsnames")
 
-/* Local prototypes */
-static void
-acpi_ns_build_external_path(struct acpi_namespace_node *node,
-                           acpi_size size, char *name_buffer);
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_build_external_path
@@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
  * DESCRIPTION: Generate a full pathaname
  *
  ******************************************************************************/
-
-static void
+void
 acpi_ns_build_external_path(struct acpi_namespace_node *node,
                            acpi_size size, char *name_buffer)
 {
@@ -138,7 +132,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
        char *name_buffer;
        acpi_size size;
 
-       ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
+       ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node);
 
        /* Calculate required buffer size based on depth below root */
 
@@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
        /* Allocate a buffer to be returned to caller */
 
-       name_buffer = ACPI_MEM_CALLOCATE(size);
+       name_buffer = ACPI_ALLOCATE_ZEROED(size);
        if (!name_buffer) {
                ACPI_ERROR((AE_INFO, "Allocation failure"));
                return_PTR(NULL);
@@ -219,7 +213,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
        struct acpi_namespace_node *node;
        acpi_size required_size;
 
-       ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
+       ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle);
 
        node = acpi_ns_map_handle_to_node(target_handle);
        if (!node) {
index 10ae6292bca4d521d14a8319dc86991636f1c2bb..aabe8794b908bd5ff91b55043cb4ee3c97be9689 100644 (file)
@@ -76,19 +76,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
        union acpi_operand_object *last_obj_desc;
        acpi_object_type object_type = ACPI_TYPE_ANY;
 
-       ACPI_FUNCTION_TRACE("ns_attach_object");
+       ACPI_FUNCTION_TRACE(ns_attach_object);
 
        /*
         * Parameter validation
         */
        if (!node) {
+
                /* Invalid handle */
 
-               ACPI_ERROR((AE_INFO, "Null named_obj handle"));
+               ACPI_ERROR((AE_INFO, "Null NamedObj handle"));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (!object && (ACPI_TYPE_ANY != type)) {
+
                /* Null object */
 
                ACPI_ERROR((AE_INFO,
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
        }
 
        if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
+
                /* Not a name handle */
 
                ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]",
@@ -108,7 +111,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
 
        if (node->object == object) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "Obj %p already installed in name_obj %p\n",
+                                 "Obj %p already installed in NameObj %p\n",
                                  object, node));
 
                return_ACPI_STATUS(AE_OK);
@@ -201,7 +204,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
 {
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE("ns_detach_object");
+       ACPI_FUNCTION_TRACE(ns_detach_object);
 
        obj_desc = node->object;
 
@@ -252,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
                                                       acpi_namespace_node
                                                       *node)
 {
-       ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
+       ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node);
 
        if (!node) {
                ACPI_WARNING((AE_INFO, "Null Node ptr"));
@@ -287,7 +290,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union
                                                        acpi_operand_object
                                                        *obj_desc)
 {
-       ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc);
 
        if ((!obj_desc) ||
            (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
index 232be4303653282761958b66d6f24db05a91043d..155505a4ef69fbfffab6d63b8679ccbfff528605 100644 (file)
@@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse")
  *
  ******************************************************************************/
 acpi_status
-acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
+acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc)
 {
        union acpi_parse_object *parse_root;
        acpi_status status;
        struct acpi_walk_state *walk_state;
 
-       ACPI_FUNCTION_TRACE("ns_one_complete_parse");
+       ACPI_FUNCTION_TRACE(ns_one_complete_parse);
 
        /* Create and init a Root Node */
 
@@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ns_parse_table");
+       ACPI_FUNCTION_TRACE(ns_parse_table);
 
        /*
         * AML Parse, pass 1
index d64b78952f24c5b585010fc11efc0c34c4e37b2e..500e2bbcfaf72647690f831504dec96bc6766435 100644 (file)
@@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name,
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_search_node
+ * FUNCTION:    acpi_ns_search_one_scope
  *
  * PARAMETERS:  target_name     - Ascii ACPI name to search for
- *              Node            - Starting node where search will begin
+ *              parent_node     - Starting node where search will begin
  *              Type            - Object type to match
  *              return_node     - Where the matched Named obj is returned
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Search a single level of the namespace.  Performs a
+ * DESCRIPTION: Search a single level of the namespace. Performs a
  *              simple search of the specified level, and does not add
  *              entries or search parents.
  *
@@ -75,35 +75,40 @@ acpi_ns_search_parent_tree(u32 target_name,
  *
  *      All namespace searching is linear in this implementation, but
  *      could be easily modified to support any improved search
- *      algorithm.  However, the linear search was chosen for simplicity
+ *      algorithm. However, the linear search was chosen for simplicity
  *      and because the trees are small and the other interpreter
  *      execution overhead is relatively high.
  *
+ *      Note: CPU execution analysis has shown that the AML interpreter spends
+ *      a very small percentage of its time searching the namespace. Therefore,
+ *      the linear search seems to be sufficient, as there would seem to be
+ *      little value in improving the search.
+ *
  ******************************************************************************/
 
 acpi_status
-acpi_ns_search_node(u32 target_name,
-                   struct acpi_namespace_node *node,
-                   acpi_object_type type,
-                   struct acpi_namespace_node **return_node)
+acpi_ns_search_one_scope(u32 target_name,
+                        struct acpi_namespace_node *parent_node,
+                        acpi_object_type type,
+                        struct acpi_namespace_node **return_node)
 {
-       struct acpi_namespace_node *next_node;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("ns_search_node");
+       ACPI_FUNCTION_TRACE(ns_search_one_scope);
 
 #ifdef ACPI_DEBUG_OUTPUT
        if (ACPI_LV_NAMES & acpi_dbg_level) {
                char *scope_name;
 
-               scope_name = acpi_ns_get_external_pathname(node);
+               scope_name = acpi_ns_get_external_pathname(parent_node);
                if (scope_name) {
                        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                                          "Searching %s (%p) For [%4.4s] (%s)\n",
-                                         scope_name, node, ACPI_CAST_PTR(char,
-                                                                         &target_name),
+                                         scope_name, parent_node,
+                                         ACPI_CAST_PTR(char, &target_name),
                                          acpi_ut_get_type_name(type)));
 
-                       ACPI_MEM_FREE(scope_name);
+                       ACPI_FREE(scope_name);
                }
        }
 #endif
@@ -112,32 +117,33 @@ acpi_ns_search_node(u32 target_name,
         * Search for name at this namespace level, which is to say that we
         * must search for the name among the children of this object
         */
-       next_node = node->child;
-       while (next_node) {
+       node = parent_node->child;
+       while (node) {
+
                /* Check for match against the name */
 
-               if (next_node->name.integer == target_name) {
+               if (node->name.integer == target_name) {
+
                        /* Resolve a control method alias if any */
 
-                       if (acpi_ns_get_type(next_node) ==
+                       if (acpi_ns_get_type(node) ==
                            ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-                               next_node =
+                               node =
                                    ACPI_CAST_PTR(struct acpi_namespace_node,
-                                                 next_node->object);
+                                                 node->object);
                        }
 
-                       /*
-                        * Found matching entry.
-                        */
+                       /* Found matching entry */
+
                        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                                          "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
                                          ACPI_CAST_PTR(char, &target_name),
-                                         acpi_ut_get_type_name(next_node->
-                                                               type),
-                                         next_node,
-                                         acpi_ut_get_node_name(node), node));
+                                         acpi_ut_get_type_name(node->type),
+                                         node,
+                                         acpi_ut_get_node_name(parent_node),
+                                         parent_node));
 
-                       *return_node = next_node;
+                       *return_node = node;
                        return_ACPI_STATUS(AE_OK);
                }
 
@@ -145,7 +151,8 @@ acpi_ns_search_node(u32 target_name,
                 * The last entry in the list points back to the parent,
                 * so a flag is used to indicate the end-of-list
                 */
-               if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
+               if (node->flags & ANOBJ_END_OF_PEER_LIST) {
+
                        /* Searched entire list, we are done */
 
                        break;
@@ -153,7 +160,7 @@ acpi_ns_search_node(u32 target_name,
 
                /* Didn't match name, move on to the next peer object */
 
-               next_node = next_node->peer;
+               node = node->peer;
        }
 
        /* Searched entire namespace level, not found */
@@ -162,7 +169,8 @@ acpi_ns_search_node(u32 target_name,
                          "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
                          ACPI_CAST_PTR(char, &target_name),
                          acpi_ut_get_type_name(type),
-                         acpi_ut_get_node_name(node), node, node->child));
+                         acpi_ut_get_node_name(parent_node), parent_node,
+                         parent_node->child));
 
        return_ACPI_STATUS(AE_NOT_FOUND);
 }
@@ -179,14 +187,14 @@ acpi_ns_search_node(u32 target_name,
  * RETURN:      Status
  *
  * DESCRIPTION: Called when a name has not been found in the current namespace
- *              level.  Before adding it or giving up, ACPI scope rules require
+ *              level. Before adding it or giving up, ACPI scope rules require
  *              searching enclosing scopes in cases identified by acpi_ns_local().
  *
  *              "A name is located by finding the matching name in the current
  *              name space, and then in the parent name space. If the parent
  *              name space does not contain the name, the search continues
  *              recursively until either the name is found or the name space
- *              does not have a parent (the root of the name space).  This
+ *              does not have a parent (the root of the name space). This
  *              indicates that the name is not found" (From ACPI Specification,
  *              section 5.3)
  *
@@ -201,7 +209,7 @@ acpi_ns_search_parent_tree(u32 target_name,
        acpi_status status;
        struct acpi_namespace_node *parent_node;
 
-       ACPI_FUNCTION_TRACE("ns_search_parent_tree");
+       ACPI_FUNCTION_TRACE(ns_search_parent_tree);
 
        parent_node = acpi_ns_get_parent_node(node);
 
@@ -235,20 +243,19 @@ acpi_ns_search_parent_tree(u32 target_name,
         */
        while (parent_node) {
                /*
-                * Search parent scope.  Use TYPE_ANY because we don't care about the
+                * Search parent scope. Use TYPE_ANY because we don't care about the
                 * object type at this point, we only care about the existence of
-                * the actual name we are searching for.  Typechecking comes later.
+                * the actual name we are searching for. Typechecking comes later.
                 */
-               status = acpi_ns_search_node(target_name, parent_node,
+               status =
+                   acpi_ns_search_one_scope(target_name, parent_node,
                                             ACPI_TYPE_ANY, return_node);
                if (ACPI_SUCCESS(status)) {
                        return_ACPI_STATUS(status);
                }
 
-               /*
-                * Not found here, go up another level
-                * (until we reach the root)
-                */
+               /* Not found here, go up another level (until we reach the root) */
+
                parent_node = acpi_ns_get_parent_node(parent_node);
        }
 
@@ -273,7 +280,7 @@ acpi_ns_search_parent_tree(u32 target_name,
  * RETURN:      Status
  *
  * DESCRIPTION: Search for a name segment in a single namespace level,
- *              optionally adding it if it is not found.  If the passed
+ *              optionally adding it if it is not found. If the passed
  *              Type is not Any and the type previously stored in the
  *              entry was Any (i.e. unknown), update the stored type.
  *
@@ -293,29 +300,46 @@ acpi_ns_search_and_enter(u32 target_name,
        acpi_status status;
        struct acpi_namespace_node *new_node;
 
-       ACPI_FUNCTION_TRACE("ns_search_and_enter");
+       ACPI_FUNCTION_TRACE(ns_search_and_enter);
 
        /* Parameter validation */
 
        if (!node || !target_name || !return_node) {
                ACPI_ERROR((AE_INFO,
-                           "Null param: Node %p Name %X return_node %p",
+                           "Null parameter: Node %p Name %X ReturnNode %p",
                            node, target_name, return_node));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /* Name must consist of printable characters */
-
+       /*
+        * Name must consist of valid ACPI characters. We will repair the name if
+        * necessary because we don't want to abort because of this, but we want
+        * all namespace names to be printable. A warning message is appropriate.
+        *
+        * This issue came up because there are in fact machines that exhibit
+        * this problem, and we want to be able to enable ACPI support for them,
+        * even though there are a few bad names.
+        */
        if (!acpi_ut_valid_acpi_name(target_name)) {
-               ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X",
-                           target_name));
-               return_ACPI_STATUS(AE_BAD_CHARACTER);
+               target_name = acpi_ut_repair_name(target_name);
+
+               /* Report warning only if in strict mode or debug mode */
+
+               if (!acpi_gbl_enable_interpreter_slack) {
+                       ACPI_WARNING((AE_INFO,
+                                     "Found bad character(s) in name, repaired: [%4.4s]\n",
+                                     ACPI_CAST_PTR(char, &target_name)));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                         "Found bad character(s) in name, repaired: [%4.4s]\n",
+                                         ACPI_CAST_PTR(char, &target_name)));
+               }
        }
 
        /* Try to find the name in the namespace level specified by the caller */
 
        *return_node = ACPI_ENTRY_NOT_FOUND;
-       status = acpi_ns_search_node(target_name, node, type, return_node);
+       status = acpi_ns_search_one_scope(target_name, node, type, return_node);
        if (status != AE_NOT_FOUND) {
                /*
                 * If we found it AND the request specifies that a find is an error,
@@ -325,18 +349,16 @@ acpi_ns_search_and_enter(u32 target_name,
                        status = AE_ALREADY_EXISTS;
                }
 
-               /*
-                * Either found it or there was an error
-                * -- finished either way
-                */
+               /* Either found it or there was an error: finished either way */
+
                return_ACPI_STATUS(status);
        }
 
        /*
-        * The name was not found.  If we are NOT performing the first pass
+        * The name was not found. If we are NOT performing the first pass
         * (name entry) of loading the namespace, search the parent tree (all the
         * way to the root if necessary.) We don't want to perform the parent
-        * search when the namespace is actually being loaded.  We want to perform
+        * search when the namespace is actually being loaded. We want to perform
         * the search when namespace references are being resolved (load pass 2)
         * and during the execution phase.
         */
@@ -354,9 +376,8 @@ acpi_ns_search_and_enter(u32 target_name,
                }
        }
 
-       /*
-        * In execute mode, just search, never add names.  Exit now.
-        */
+       /* In execute mode, just search, never add names. Exit now */
+
        if (interpreter_mode == ACPI_IMODE_EXECUTE) {
                ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                                  "%4.4s Not found in %p [Not adding]\n",
@@ -371,11 +392,18 @@ acpi_ns_search_and_enter(u32 target_name,
        if (!new_node) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
+#ifdef ACPI_ASL_COMPILER
+       /*
+        * Node is an object defined by an External() statement
+        */
+       if (flags & ACPI_NS_EXTERNAL) {
+               new_node->flags |= ANOBJ_IS_EXTERNAL;
+       }
+#endif
 
        /* Install the new object into the parent's list of children */
 
        acpi_ns_install_node(walk_state, node, new_node, type);
        *return_node = new_node;
-
        return_ACPI_STATUS(AE_OK);
 }
index 3e7cad549a38739cf5ad752513e3f45e0735ce7a..aa4e799d9a8c3123e297e9195c50749086b07906 100644 (file)
@@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name,
                     char *internal_name, acpi_status lookup_status)
 {
        acpi_status status;
+       u32 bad_name;
        char *name = NULL;
 
-       acpi_ut_report_error(module_name, line_number);
+       acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
 
        if (lookup_status == AE_BAD_CHARACTER) {
+
                /* There is a non-ascii character in the name */
 
-               acpi_os_printf("[0x%4.4X] (NON-ASCII)",
-                              *(ACPI_CAST_PTR(u32, internal_name)));
+               ACPI_MOVE_32_TO_32(&bad_name, internal_name);
+               acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
        } else {
                /* Convert path to external format */
 
@@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name,
                }
 
                if (name) {
-                       ACPI_MEM_FREE(name);
+                       ACPI_FREE(name);
                }
        }
 
@@ -137,11 +139,12 @@ acpi_ns_report_method_error(char *module_name,
        acpi_status status;
        struct acpi_namespace_node *node = prefix_node;
 
-       acpi_ut_report_error(module_name, line_number);
+       acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
 
        if (path) {
-               status = acpi_ns_get_node_by_path(path, prefix_node,
-                                                 ACPI_NS_NO_UPSEARCH, &node);
+               status =
+                   acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
+                                    &node);
                if (ACPI_FAILURE(status)) {
                        acpi_os_printf("[Could not get node by pathname]");
                }
@@ -185,7 +188,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
                }
 
                acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
-               ACPI_MEM_FREE(buffer.pointer);
+               ACPI_FREE(buffer.pointer);
        }
 }
 
@@ -239,7 +242,7 @@ static u8 acpi_ns_valid_path_separator(char sep)
 
 acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 {
-       ACPI_FUNCTION_TRACE("ns_get_type");
+       ACPI_FUNCTION_TRACE(ns_get_type);
 
        if (!node) {
                ACPI_WARNING((AE_INFO, "Null Node parameter"));
@@ -264,9 +267,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 
 u32 acpi_ns_local(acpi_object_type type)
 {
-       ACPI_FUNCTION_TRACE("ns_local");
+       ACPI_FUNCTION_TRACE(ns_local);
 
        if (!acpi_ut_valid_object_type(type)) {
+
                /* Type code out of range  */
 
                ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
@@ -363,7 +367,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
        char *result = NULL;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ns_build_internal_name");
+       ACPI_FUNCTION_TRACE(ns_build_internal_name);
 
        /* Setup the correct prefixes, counts, and pointers */
 
@@ -411,6 +415,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
                for (i = 0; i < ACPI_NAME_SIZE; i++) {
                        if (acpi_ns_valid_path_separator(*external_name) ||
                            (*external_name == 0)) {
+
                                /* Pad the segment with underscore(s) if segment is short */
 
                                result[i] = '_';
@@ -473,7 +478,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
        struct acpi_namestring_info info;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ns_internalize_name");
+       ACPI_FUNCTION_TRACE(ns_internalize_name);
 
        if ((!external_name) || (*external_name == 0) || (!converted_name)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -486,7 +491,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
 
        /* We need a segment to store the internal  name */
 
-       internal_name = ACPI_MEM_CALLOCATE(info.length);
+       internal_name = ACPI_ALLOCATE_ZEROED(info.length);
        if (!internal_name) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -496,7 +501,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
        info.internal_name = internal_name;
        status = acpi_ns_build_internal_name(&info);
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(internal_name);
+               ACPI_FREE(internal_name);
                return_ACPI_STATUS(status);
        }
 
@@ -533,7 +538,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
        acpi_native_uint i = 0;
        acpi_native_uint j = 0;
 
-       ACPI_FUNCTION_TRACE("ns_externalize_name");
+       ACPI_FUNCTION_TRACE(ns_externalize_name);
 
        if (!internal_name_length || !internal_name || !converted_name) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -628,7 +633,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
        /*
         * Build converted_name
         */
-       *converted_name = ACPI_MEM_CALLOCATE(required_length);
+       *converted_name = ACPI_ALLOCATE_ZEROED(required_length);
        if (!(*converted_name)) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -681,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
        ACPI_FUNCTION_ENTRY();
 
        /*
-        * Simple implementation.
+        * Simple implementation
         */
-       if (!handle) {
-               return (NULL);
-       }
-
-       if (handle == ACPI_ROOT_OBJECT) {
+       if ((!handle) || (handle == ACPI_ROOT_OBJECT)) {
                return (acpi_gbl_root_node);
        }
 
@@ -697,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
                return (NULL);
        }
 
-       return ((struct acpi_namespace_node *)handle);
+       return (ACPI_CAST_PTR(struct acpi_namespace_node, handle));
 }
 
 /*******************************************************************************
@@ -752,7 +753,7 @@ void acpi_ns_terminate(void)
 {
        union acpi_operand_object *obj_desc;
 
-       ACPI_FUNCTION_TRACE("ns_terminate");
+       ACPI_FUNCTION_TRACE(ns_terminate);
 
        /*
         * 1) Free the entire namespace -- all nodes and objects
@@ -792,9 +793,10 @@ void acpi_ns_terminate(void)
 
 u32 acpi_ns_opens_scope(acpi_object_type type)
 {
-       ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
+       ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type));
 
        if (!acpi_ut_valid_object_type(type)) {
+
                /* type code out of range  */
 
                ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
@@ -806,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_get_node_by_path
+ * FUNCTION:    acpi_ns_get_node
  *
  * PARAMETERS:  *Pathname   - Name to be found, in external (ASL) format. The
  *                            \ (backslash) and ^ (carat) prefixes, and the
  *                            . (period) to separate segments are supported.
- *              start_node  - Root of subtree to be searched, or NS_ALL for the
+ *              prefix_node  - Root of subtree to be searched, or NS_ALL for the
  *                            root of the name space.  If Name is fully
  *                            qualified (first s8 is '\'), the passed value
  *                            of Scope will not be accessed.
@@ -827,23 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_node_by_path(char *pathname,
-                        struct acpi_namespace_node *start_node,
-                        u32 flags, struct acpi_namespace_node **return_node)
+acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
+                char *pathname,
+                u32 flags, struct acpi_namespace_node **return_node)
 {
        union acpi_generic_state scope_info;
        acpi_status status;
-       char *internal_path = NULL;
-
-       ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
+       char *internal_path;
 
-       if (pathname) {
-               /* Convert path to internal representation */
+       ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname);
 
-               status = acpi_ns_internalize_name(pathname, &internal_path);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
+       if (!pathname) {
+               *return_node = prefix_node;
+               if (!prefix_node) {
+                       *return_node = acpi_gbl_root_node;
                }
+               return_ACPI_STATUS(AE_OK);
+       }
+
+       /* Convert path to internal representation */
+
+       status = acpi_ns_internalize_name(pathname, &internal_path);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Must lock namespace during lookup */
@@ -855,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname,
 
        /* Setup lookup scope (search starting point) */
 
-       scope_info.scope.node = start_node;
+       scope_info.scope.node = prefix_node;
 
        /* Lookup the name in the namespace */
 
-       status = acpi_ns_lookup(&scope_info, internal_path,
-                               ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                               (flags | ACPI_NS_DONT_OPEN_SCOPE),
-                               NULL, return_node);
+       status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY,
+                               ACPI_IMODE_EXECUTE,
+                               (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL,
+                               return_node);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
-                                 internal_path,
-                                 acpi_format_exception(status)));
+                                 pathname, acpi_format_exception(status)));
        }
 
        (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
       cleanup:
-       if (internal_path) {
-               ACPI_MEM_FREE(internal_path);
-       }
+       ACPI_FREE(internal_path);
        return_ACPI_STATUS(status);
 }
 
@@ -960,9 +965,10 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
 {
        struct acpi_namespace_node *parent_node;
 
-       ACPI_FUNCTION_TRACE("ns_find_parent_name");
+       ACPI_FUNCTION_TRACE(ns_find_parent_name);
 
        if (child_node) {
+
                /* Valid entry.  Get the parent Node */
 
                parent_node = acpi_ns_get_parent_node(child_node);
index fcab1e784b8173072ae496e55203a92db9969b43..c8f6bef16ed05a1fcc3e1128162624a69041107e 100644 (file)
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
        ACPI_FUNCTION_ENTRY();
 
        if (!child_node) {
+
                /* It's really the parent's _scope_ that we want */
 
                if (parent_node->child) {
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
        /* If any type is OK, we are done */
 
        if (type == ACPI_TYPE_ANY) {
+
                /* next_node is NULL if we are at the end-of-list */
 
                return (next_node);
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
        /* Must search for the node -- but within this scope only */
 
        while (next_node) {
+
                /* If type matches, we are done */
 
                if (next_node->type == type) {
@@ -161,7 +164,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
        acpi_object_type child_type;
        u32 level;
 
-       ACPI_FUNCTION_TRACE("ns_walk_namespace");
+       ACPI_FUNCTION_TRACE(ns_walk_namespace);
 
        /* Special case for the namespace Root Node */
 
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
         * bubbled up to (and passed) the original parent handle (start_entry)
         */
        while (level > 0) {
+
                /* Get the next node in this scope.  Null if not found */
 
                status = AE_OK;
index a95f636dc35d454e16865732cff8e4c57ab3731f..6d9bd45af30a6c95b997978d6d6d02e68b0fcc3c 100644 (file)
@@ -42,8 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
@@ -51,6 +49,7 @@
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsxfeval")
 
+#ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
  * FUNCTION:    acpi_evaluate_object_typed
@@ -71,18 +70,17 @@ ACPI_MODULE_NAME("nsxfeval")
  *              be valid (non-null)
  *
  ******************************************************************************/
-#ifdef ACPI_FUTURE_USAGE
 acpi_status
 acpi_evaluate_object_typed(acpi_handle handle,
                           acpi_string pathname,
-                          struct acpi_object_list *external_params,
-                          struct acpi_buffer *return_buffer,
+                          struct acpi_object_list * external_params,
+                          struct acpi_buffer * return_buffer,
                           acpi_object_type return_type)
 {
        acpi_status status;
        u8 must_free = FALSE;
 
-       ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
+       ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed);
 
        /* Return buffer must be valid */
 
@@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
        }
 
        if (return_buffer->length == 0) {
+
                /* Error because caller specifically asked for a return value */
 
                ACPI_ERROR((AE_INFO, "No return value"));
@@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
                    acpi_ut_get_type_name(return_type)));
 
        if (must_free) {
+
                /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
 
                acpi_os_free(return_buffer->pointer);
@@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle handle,
        return_buffer->length = 0;
        return_ACPI_STATUS(AE_TYPE);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle handle,
  *              be valid (non-null)
  *
  ******************************************************************************/
-
 acpi_status
 acpi_evaluate_object(acpi_handle handle,
                     acpi_string pathname,
@@ -170,51 +171,61 @@ acpi_evaluate_object(acpi_handle handle,
 {
        acpi_status status;
        acpi_status status2;
-       struct acpi_parameter_info info;
+       struct acpi_evaluate_info *info;
        acpi_size buffer_space_needed;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("acpi_evaluate_object");
+       ACPI_FUNCTION_TRACE(acpi_evaluate_object);
 
-       info.node = handle;
-       info.parameters = NULL;
-       info.return_object = NULL;
-       info.parameter_type = ACPI_PARAM_ARGS;
+       /* Allocate and initialize the evaluation information block */
+
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       info->pathname = pathname;
+       info->parameter_type = ACPI_PARAM_ARGS;
+
+       /* Convert and validate the device handle */
+
+       info->prefix_node = acpi_ns_map_handle_to_node(handle);
+       if (!info->prefix_node) {
+               status = AE_BAD_PARAMETER;
+               goto cleanup;
+       }
 
        /*
-        * If there are parameters to be passed to the object
-        * (which must be a control method), the external objects
-        * must be converted to internal objects
+        * If there are parameters to be passed to a control method, the external
+        * objects must all be converted to internal objects
         */
        if (external_params && external_params->count) {
                /*
                 * Allocate a new parameter block for the internal objects
                 * Add 1 to count to allow for null terminated internal list
                 */
-               info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
-                                                     external_params->count +
-                                                     1) * sizeof(void *));
-               if (!info.parameters) {
-                       return_ACPI_STATUS(AE_NO_MEMORY);
+               info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
+                                                        external_params->
+                                                        count +
+                                                        1) * sizeof(void *));
+               if (!info->parameters) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
                }
 
-               /*
-                * Convert each external object in the list to an
-                * internal object
-                */
+               /* Convert each external object in the list to an internal object */
+
                for (i = 0; i < external_params->count; i++) {
                        status =
                            acpi_ut_copy_eobject_to_iobject(&external_params->
                                                            pointer[i],
-                                                           &info.
+                                                           &info->
                                                            parameters[i]);
                        if (ACPI_FAILURE(status)) {
-                               acpi_ut_delete_internal_object_list(info.
-                                                                   parameters);
-                               return_ACPI_STATUS(status);
+                               goto cleanup;
                        }
                }
-               info.parameters[external_params->count] = NULL;
+               info->parameters[external_params->count] = NULL;
        }
 
        /*
@@ -224,43 +235,31 @@ acpi_evaluate_object(acpi_handle handle,
         * 3) Valid handle
         */
        if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
-               /*
-                *  The path is fully qualified, just evaluate by name
-                */
-               status = acpi_ns_evaluate_by_name(pathname, &info);
+
+               /* The path is fully qualified, just evaluate by name */
+
+               info->prefix_node = NULL;
+               status = acpi_ns_evaluate(info);
        } else if (!handle) {
                /*
-                * A handle is optional iff a fully qualified pathname
-                * is specified.  Since we've already handled fully
-                * qualified names above, this is an error
+                * A handle is optional iff a fully qualified pathname is specified.
+                * Since we've already handled fully qualified names above, this is
+                * an error
                 */
                if (!pathname) {
-                       ACPI_ERROR((AE_INFO,
-                                   "Both Handle and Pathname are NULL"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Both Handle and Pathname are NULL"));
                } else {
-                       ACPI_ERROR((AE_INFO,
-                                   "Handle is NULL and Pathname is relative"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Null Handle with relative pathname [%s]",
+                                         pathname));
                }
 
                status = AE_BAD_PARAMETER;
        } else {
-               /*
-                * We get here if we have a handle -- and if we have a
-                * pathname it is relative.  The handle will be validated
-                * in the lower procedures
-                */
-               if (!pathname) {
-                       /*
-                        * The null pathname case means the handle is for
-                        * the actual object to be evaluated
-                        */
-                       status = acpi_ns_evaluate_by_handle(&info);
-               } else {
-                       /*
-                        * Both a Handle and a relative Pathname
-                        */
-                       status = acpi_ns_evaluate_relative(pathname, &info);
-               }
+               /* We have a namespace a node and a possible relative path */
+
+               status = acpi_ns_evaluate(info);
        }
 
        /*
@@ -268,10 +267,10 @@ acpi_evaluate_object(acpi_handle handle,
         * copy the return value to an external object.
         */
        if (return_buffer) {
-               if (!info.return_object) {
+               if (!info->return_object) {
                        return_buffer->length = 0;
                } else {
-                       if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
+                       if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
                            ACPI_DESC_TYPE_NAMED) {
                                /*
                                 * If we received a NS Node as a return object, this means that
@@ -282,19 +281,19 @@ acpi_evaluate_object(acpi_handle handle,
                                 * support for various types at a later date if necessary.
                                 */
                                status = AE_TYPE;
-                               info.return_object = NULL;      /* No need to delete a NS Node */
+                               info->return_object = NULL;     /* No need to delete a NS Node */
                                return_buffer->length = 0;
                        }
 
                        if (ACPI_SUCCESS(status)) {
-                               /*
-                                * Find out how large a buffer is needed
-                                * to contain the returned object
-                                */
+
+                               /* Get the size of the returned object */
+
                                status =
-                                   acpi_ut_get_object_size(info.return_object,
+                                   acpi_ut_get_object_size(info->return_object,
                                                            &buffer_space_needed);
                                if (ACPI_SUCCESS(status)) {
+
                                        /* Validate/Allocate/Clear caller buffer */
 
                                        status =
@@ -303,7 +302,8 @@ acpi_evaluate_object(acpi_handle handle,
                                             buffer_space_needed);
                                        if (ACPI_FAILURE(status)) {
                                                /*
-                                                * Caller's buffer is too small or a new one can't be allocated
+                                                * Caller's buffer is too small or a new one can't
+                                                * be allocated
                                                 */
                                                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                                                  "Needed buffer size %X, %s\n",
@@ -312,12 +312,11 @@ acpi_evaluate_object(acpi_handle handle,
                                                                  acpi_format_exception
                                                                  (status)));
                                        } else {
-                                               /*
-                                                *  We have enough space for the object, build it
-                                                */
+                                               /* We have enough space for the object, build it */
+
                                                status =
                                                    acpi_ut_copy_iobject_to_eobject
-                                                   (info.return_object,
+                                                   (info->return_object,
                                                     return_buffer);
                                        }
                                }
@@ -325,35 +324,37 @@ acpi_evaluate_object(acpi_handle handle,
                }
        }
 
-       if (info.return_object) {
+       if (info->return_object) {
                /*
-                * Delete the internal return object.  NOTE: Interpreter
-                * must be locked to avoid race condition.
+                * Delete the internal return object. NOTE: Interpreter must be
+                * locked to avoid race condition.
                 */
                status2 = acpi_ex_enter_interpreter();
                if (ACPI_SUCCESS(status2)) {
-                       /*
-                        * Delete the internal return object. (Or at least
-                        * decrement the reference count by one)
-                        */
-                       acpi_ut_remove_reference(info.return_object);
+
+                       /* Remove one reference on the return object (should delete it) */
+
+                       acpi_ut_remove_reference(info->return_object);
                        acpi_ex_exit_interpreter();
                }
        }
 
-       /*
-        * Free the input parameter list (if we created one),
-        */
-       if (info.parameters) {
+      cleanup:
+
+       /* Free the input parameter list (if we created one) */
+
+       if (info->parameters) {
+
                /* Free the allocated parameter block */
 
-               acpi_ut_delete_internal_object_list(info.parameters);
+               acpi_ut_delete_internal_object_list(info->parameters);
        }
 
+       ACPI_FREE(info);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_evaluate_object);
+ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
 
 /*******************************************************************************
  *
@@ -384,7 +385,6 @@ EXPORT_SYMBOL(acpi_evaluate_object);
  *              function, etc.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_walk_namespace(acpi_object_type type,
                    acpi_handle start_object,
@@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_walk_namespace");
+       ACPI_FUNCTION_TRACE(acpi_walk_namespace);
 
        /* Parameter validation */
 
@@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_walk_namespace);
+ACPI_EXPORT_SYMBOL(acpi_walk_namespace)
 
 /*******************************************************************************
  *
@@ -436,7 +436,6 @@ EXPORT_SYMBOL(acpi_walk_namespace);
  *              on that.
  *
  ******************************************************************************/
-
 static acpi_status
 acpi_ns_get_device_callback(acpi_handle obj_handle,
                            u32 nesting_level,
@@ -473,6 +472,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
        }
 
        if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
+
                /* Don't examine children of the device if not present */
 
                return (AE_CTRL_DEPTH);
@@ -489,6 +489,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                }
 
                if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
+
                        /* Get the list of Compatible IDs */
 
                        status = acpi_ut_execute_CID(node, &cid);
@@ -505,11 +506,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                                                 sizeof(struct
                                                        acpi_compatible_id)) !=
                                    0) {
-                                       ACPI_MEM_FREE(cid);
+                                       ACPI_FREE(cid);
                                        return (AE_OK);
                                }
                        }
-                       ACPI_MEM_FREE(cid);
+                       ACPI_FREE(cid);
                }
        }
 
@@ -551,7 +552,7 @@ acpi_get_devices(char *HID,
        acpi_status status;
        struct acpi_get_devices_info info;
 
-       ACPI_FUNCTION_TRACE("acpi_get_devices");
+       ACPI_FUNCTION_TRACE(acpi_get_devices);
 
        /* Parameter validation */
 
@@ -563,9 +564,9 @@ acpi_get_devices(char *HID,
         * We're going to call their callback from OUR callback, so we need
         * to know what it is, and their context parameter.
         */
+       info.hid = HID;
        info.context = context;
        info.user_function = user_function;
-       info.hid = HID;
 
        /*
         * Lock the namespace around the walk.
@@ -578,9 +579,8 @@ acpi_get_devices(char *HID,
                return_ACPI_STATUS(status);
        }
 
-       status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
-                                       ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                                       ACPI_NS_WALK_UNLOCK,
+       status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+                                       ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
                                        acpi_ns_get_device_callback, &info,
                                        return_value);
 
@@ -588,7 +588,7 @@ acpi_get_devices(char *HID,
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_devices);
+ACPI_EXPORT_SYMBOL(acpi_get_devices)
 
 /*******************************************************************************
  *
@@ -603,7 +603,6 @@ EXPORT_SYMBOL(acpi_get_devices);
  * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_attach_data(acpi_handle obj_handle,
                 acpi_object_handler handler, void *data)
@@ -637,6 +636,8 @@ acpi_attach_data(acpi_handle obj_handle,
        return (status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_attach_data)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_detach_data
@@ -649,7 +650,6 @@ acpi_attach_data(acpi_handle obj_handle,
  * DESCRIPTION: Remove data that was previously attached to a node.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
 {
@@ -682,6 +682,8 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
        return (status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_detach_data)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_data
@@ -695,7 +697,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
  * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
 {
@@ -727,3 +728,5 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
        (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_get_data)
index 8cd8675a47c0403c765c640f7b021b43fa89327a..978213a6c19f23063c47e37073ba7b5b401a166d 100644 (file)
@@ -42,8 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
@@ -114,9 +112,8 @@ acpi_get_handle(acpi_handle parent,
        /*
         *  Find the Node and convert to a handle
         */
-       status =
-           acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
-                                    &node);
+       status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH,
+                                 &node);
 
        *ret_handle = NULL;
        if (ACPI_SUCCESS(status)) {
@@ -126,7 +123,7 @@ acpi_get_handle(acpi_handle parent,
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_handle);
+ACPI_EXPORT_SYMBOL(acpi_get_handle)
 
 /******************************************************************************
  *
@@ -143,7 +140,6 @@ EXPORT_SYMBOL(acpi_get_handle);
  *              complementary functions.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
 {
@@ -162,6 +158,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
        }
 
        if (name_type == ACPI_FULL_PATHNAME) {
+
                /* Get the full pathname (From the namespace root) */
 
                status = acpi_ns_handle_to_pathname(handle, buffer);
@@ -203,7 +200,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_name);
+ACPI_EXPORT_SYMBOL(acpi_get_name)
 
 /******************************************************************************
  *
@@ -219,7 +216,6 @@ EXPORT_SYMBOL(acpi_get_name);
  *              control methods (Such as in the case of a device.)
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
 {
@@ -241,7 +237,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
                return (status);
        }
 
-       info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info));
        if (!info) {
                return (AE_NO_MEMORY);
        }
@@ -345,11 +341,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
        }
 
       cleanup:
-       ACPI_MEM_FREE(info);
+       ACPI_FREE(info);
        if (cid_list) {
-               ACPI_MEM_FREE(cid_list);
+               ACPI_FREE(cid_list);
        }
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_object_info);
+ACPI_EXPORT_SYMBOL(acpi_get_object_info)
index a0332595677a9dbb51093443de445781ce43f1f8..a163e1d3708d1a2ba96f3149aed56e1ca1da2eb6 100644 (file)
@@ -42,8 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
@@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_type);
+ACPI_EXPORT_SYMBOL(acpi_get_type)
 
 /*******************************************************************************
  *
@@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type);
  *              Handle.
  *
  ******************************************************************************/
-
 acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 {
        struct acpi_namespace_node *node;
@@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_parent);
+ACPI_EXPORT_SYMBOL(acpi_get_parent)
 
 /*******************************************************************************
  *
@@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent);
  *              Scope is returned.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_next_object(acpi_object_type type,
                     acpi_handle parent,
@@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type type,
        /* If null handle, use the parent */
 
        if (!child) {
+
                /* Start search at the beginning of the specified scope */
 
                parent_node = acpi_ns_map_handle_to_node(parent);
@@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type type,
        return (status);
 }
 
-EXPORT_SYMBOL(acpi_get_next_object);
+ACPI_EXPORT_SYMBOL(acpi_get_next_object)
index 13b5fd5854a80bd9f92d1eb8e90764a3fe8f6d5a..1bb558adee66cbf90fa930ce93165d6a1d99ba6f 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/delay.h>
 #include <linux/workqueue.h>
 #include <linux/nmi.h>
+#include <linux/kthread.h>
 #include <acpi/acpi.h>
 #include <asm/io.h>
 #include <acpi/acpi_bus.h>
@@ -600,23 +601,41 @@ static void acpi_os_execute_deferred(void *context)
        return_VOID;
 }
 
-acpi_status
-acpi_os_queue_for_execution(u32 priority,
+static int acpi_os_execute_thread(void *context)
+{
+       struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context;
+       if (dpc) {
+               dpc->function(dpc->context);
+               kfree(dpc);
+       }
+       do_exit(0);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_execute
+ *
+ * PARAMETERS:  Type               - Type of the callback
+ *              Function           - Function to be executed
+ *              Context            - Function parameters
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Depending on type, either queues function for deferred execution or
+ *              immediately executes function on a separate thread.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_execute(acpi_execute_type type,
                            acpi_osd_exec_callback function, void *context)
 {
        acpi_status status = AE_OK;
        struct acpi_os_dpc *dpc;
        struct work_struct *task;
-
-       ACPI_FUNCTION_TRACE("os_queue_for_execution");
-
-       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "Scheduling function [%p(%p)] for deferred execution.\n",
-                         function, context));
+       struct task_struct *p;
 
        if (!function)
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-
+               return AE_BAD_PARAMETER;
        /*
         * Allocate/initialize DPC structure.  Note that this memory will be
         * freed by the callee.  The kernel handles the tq_struct list  in a
@@ -627,30 +646,37 @@ acpi_os_queue_for_execution(u32 priority,
         * We can save time and code by allocating the DPC and tq_structs
         * from the same memory.
         */
-
-       dpc =
-           kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
-                   GFP_ATOMIC);
+       if (type == OSL_NOTIFY_HANDLER) {
+               dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL);
+       } else {
+               dpc = kmalloc(sizeof(struct acpi_os_dpc) +
+                               sizeof(struct work_struct), GFP_ATOMIC);
+       }
        if (!dpc)
-               return_ACPI_STATUS(AE_NO_MEMORY);
-
+               return AE_NO_MEMORY;
        dpc->function = function;
        dpc->context = context;
 
-       task = (void *)(dpc + 1);
-       INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
-
-       if (!queue_work(kacpid_wq, task)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Call to queue_work() failed.\n"));
-               kfree(dpc);
-               status = AE_ERROR;
+       if (type == OSL_NOTIFY_HANDLER) {
+               p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify");
+               if (!IS_ERR(p)) {
+                       wake_up_process(p);
+               } else {
+                       status = AE_NO_MEMORY;
+                       kfree(dpc);
+               }
+       } else {
+               task = (void *)(dpc + 1);
+               INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
+               if (!queue_work(kacpid_wq, task)) {
+                       status = AE_ERROR;
+                       kfree(dpc);
+               }
        }
-
-       return_ACPI_STATUS(status);
+       return status;
 }
 
-EXPORT_SYMBOL(acpi_os_queue_for_execution);
+EXPORT_SYMBOL(acpi_os_execute);
 
 void acpi_os_wait_events_complete(void *context)
 {
@@ -769,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
                          handle, units, timeout));
 
-       if (in_atomic())
-               timeout = 0;
-
        switch (timeout) {
                /*
                 * No Wait:
@@ -896,14 +919,6 @@ u8 acpi_os_writable(void *ptr, acpi_size len)
 }
 #endif
 
-u32 acpi_os_get_thread_id(void)
-{
-       if (!in_atomic())
-               return current->pid;
-
-       return 0;
-}
-
 acpi_status acpi_os_signal(u32 function, void *info)
 {
        switch (function) {
@@ -1050,12 +1065,12 @@ void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags)
  *
  * FUNCTION:    acpi_os_create_cache
  *
- * PARAMETERS:  CacheName       - Ascii name for the cache
- *              ObjectSize      - Size of each cached object
- *              MaxDepth        - Maximum depth of the cache (in objects)
- *              ReturnCache     - Where the new cache object is returned
+ * PARAMETERS:  name      - Ascii name for the cache
+ *              size      - Size of each cached object
+ *              depth     - Maximum depth of the cache (in objects) <ignored>
+ *              cache     - Where the new cache object is returned
  *
- * RETURN:      Status
+ * RETURN:      status
  *
  * DESCRIPTION: Create a cache object
  *
@@ -1065,7 +1080,10 @@ acpi_status
 acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
 {
        *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL);
-       return AE_OK;
+       if (cache == NULL)
+               return AE_ERROR;
+       else
+               return AE_OK;
 }
 
 /*******************************************************************************
@@ -1134,16 +1152,63 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
- *              the object is allocated.
+ * DESCRIPTION: Return a zero-filled object.
  *
  ******************************************************************************/
 
 void *acpi_os_acquire_object(acpi_cache_t * cache)
 {
-       void *object = kmem_cache_alloc(cache, GFP_KERNEL);
+       void *object = kmem_cache_zalloc(cache, GFP_KERNEL);
        WARN_ON(!object);
        return object;
 }
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_os_validate_interface
+ *
+ * PARAMETERS:  interface           - Requested interface to be validated
+ *
+ * RETURN:      AE_OK if interface is supported, AE_SUPPORT otherwise
+ *
+ * DESCRIPTION: Match an interface string to the interfaces supported by the
+ *              host. Strings originate from an AML call to the _OSI method.
+ *
+ *****************************************************************************/
+
+acpi_status
+acpi_os_validate_interface (char *interface)
+{
+
+    return AE_SUPPORT;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_os_validate_address
+ *
+ * PARAMETERS:  space_id             - ACPI space ID
+ *              address             - Physical address
+ *              length              - Address length
+ *
+ * RETURN:      AE_OK if address/length is valid for the space_id. Otherwise,
+ *              should return AE_AML_ILLEGAL_ADDRESS.
+ *
+ * DESCRIPTION: Validate a system address via the host OS. Used to validate
+ *              the addresses accessed by AML operation regions.
+ *
+ *****************************************************************************/
+
+acpi_status
+acpi_os_validate_address (
+    u8                   space_id,
+    acpi_physical_address   address,
+    acpi_size               length)
+{
+
+    return AE_OK;
+}
+
+
 #endif
index de573be52718f611459ff1212f539547a3b295a0..bf88e076c3e9c66d3ea2c6375731e060665522d8 100644 (file)
@@ -79,7 +79,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
        acpi_native_uint byte_count;
        u8 byte_zero_mask = 0x3F;       /* Default [0:5] */
 
-       ACPI_FUNCTION_TRACE("ps_get_next_package_length");
+       ACPI_FUNCTION_TRACE(ps_get_next_package_length);
 
        /*
         * Byte 0 bits [6:7] contain the number of additional bytes
@@ -128,7 +128,7 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
        u8 *start = parser_state->aml;
        u32 package_length;
 
-       ACPI_FUNCTION_TRACE("ps_get_next_package_end");
+       ACPI_FUNCTION_TRACE(ps_get_next_package_end);
 
        /* Function below updates parser_state->Aml */
 
@@ -157,7 +157,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
        u8 *start = parser_state->aml;
        u8 *end = parser_state->aml;
 
-       ACPI_FUNCTION_TRACE("ps_get_next_namestring");
+       ACPI_FUNCTION_TRACE(ps_get_next_namestring);
 
        /* Point past any namestring prefix characters (backslash or carat) */
 
@@ -237,7 +237,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
        struct acpi_namespace_node *node;
        union acpi_generic_state scope_info;
 
-       ACPI_FUNCTION_TRACE("ps_get_next_namepath");
+       ACPI_FUNCTION_TRACE(ps_get_next_namepath);
 
        path = acpi_ps_get_next_namestring(parser_state);
        acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
         */
        if (ACPI_SUCCESS(status) &&
            possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
+
                /* This name is actually a control method invocation */
 
                method_desc = acpi_ns_get_attached_object(node);
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
         * some not_found cases are allowed
         */
        if (status == AE_NOT_FOUND) {
+
                /* 1) not_found is ok during load pass 1/2 (allow forward references) */
 
                if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
 
                if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
                    ACPI_PARSE_EXECUTE) {
+
                        /* Report a control method execution error */
 
                        status = acpi_ds_method_error(status, walk_state);
@@ -388,7 +391,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
        u16 opcode;
        u8 *aml = parser_state->aml;
 
-       ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
+       ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type);
 
        switch (arg_type) {
        case ARGP_BYTEDATA:
@@ -453,7 +456,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
 
        default:
 
-               ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type));
+               ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type));
                return_VOID;
        }
 
@@ -484,7 +487,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
        u16 opcode;
        u32 name;
 
-       ACPI_FUNCTION_TRACE("ps_get_next_field");
+       ACPI_FUNCTION_TRACE(ps_get_next_field);
 
        /* Determine field type */
 
@@ -590,7 +593,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
        u32 subop;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
+       ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state);
 
        switch (arg_type) {
        case ARGP_BYTEDATA:
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
        case ARGP_FIELDLIST:
 
                if (parser_state->aml < parser_state->pkg_end) {
+
                        /* Non-empty list */
 
                        while (parser_state->aml < parser_state->pkg_end) {
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
        case ARGP_BYTELIST:
 
                if (parser_state->aml < parser_state->pkg_end) {
+
                        /* Non-empty list */
 
                        arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
                if (subop == 0 ||
                    acpi_ps_is_leading_char(subop) ||
                    acpi_ps_is_prefix_char(subop)) {
+
                        /* null_name or name_string */
 
                        arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
        case ARGP_OBJLIST:
 
                if (parser_state->aml < parser_state->pkg_end) {
+
                        /* Non-empty list of variable arguments, nothing returned */
 
                        walk_state->arg_count = ACPI_VAR_ARGS;
@@ -711,7 +718,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
 
        default:
 
-               ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type));
+               ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type));
                status = AE_AML_OPERAND_TYPE;
                break;
        }
index 00b072e15d1921ef9f5e6bb86e7b13d0aaadcae9..e1541db3753a75a41a813171d741d3329a73a114 100644 (file)
@@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
        struct acpi_parse_state *parser_state;
        u8 *aml_op_start = NULL;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state);
+       ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state);
 
        if (walk_state->descending_callback == NULL) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
 #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
 
        if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
+
                /* We are restarting a preempted control method */
 
                if (acpi_ps_has_completed_scope(parser_state)) {
@@ -128,7 +129,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
 
                                        }
                                        ACPI_EXCEPTION((AE_INFO, status,
-                                                       "get_predicate Failed"));
+                                                       "GetPredicate Failed"));
                                        return_ACPI_STATUS(status);
                                }
 
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
                                          "Popped scope, Op=%p\n", op));
                } else if (walk_state->prev_op) {
+
                        /* We were in the middle of an op */
 
                        op = walk_state->prev_op;
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
        while ((parser_state->aml < parser_state->aml_end) || (op)) {
                aml_op_start = parser_state->aml;
                if (!op) {
+
                        /* Get the next opcode from the AML stream */
 
                        walk_state->aml_offset =
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                        /* Create Op structure and append to parent's argument list */
 
                        if (walk_state->op_info->flags & AML_NAMED) {
+
                                /* Allocate a new pre_op if necessary */
 
                                if (!pre_op) {
@@ -371,7 +375,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
 
                        if (walk_state->op_info) {
                                ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                                                 "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
+                                                 "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
                                                  (u32) op->common.aml_opcode,
                                                  walk_state->op_info->name, op,
                                                  parser_state->aml,
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                /* Are there any arguments that must be processed? */
 
                if (walk_state->arg_types) {
+
                        /* Get arguments */
 
                        switch (op->common.aml_opcode) {
@@ -742,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                                        if (ACPI_FAILURE(status2)) {
                                                return_ACPI_STATUS(status2);
                                        }
+
+                                       status2 =
+                                           acpi_ds_result_stack_pop
+                                           (walk_state);
+                                       if (ACPI_FAILURE(status2)) {
+                                               return_ACPI_STATUS(status2);
+                                       }
+
+                                       acpi_ut_delete_generic_state
+                                           (acpi_ut_pop_generic_state
+                                            (&walk_state->control_state));
                                }
+
                                acpi_ps_pop_scope(parser_state, &op,
                                                  &walk_state->arg_types,
                                                  &walk_state->arg_count);
@@ -762,6 +779,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                                                return_ACPI_STATUS(status2);
                                        }
                                }
+
                                acpi_ps_pop_scope(parser_state, &op,
                                                  &walk_state->arg_types,
                                                  &walk_state->arg_count);
@@ -853,6 +871,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
                                }
 
                                else if (ACPI_FAILURE(status)) {
+
                                        /* First error is most important */
 
                                        (void)
index 11d6351ab8b288ed2d428e8677e2d017465adda2..4bd25e32769f7443235d7831dbbb3aef1317f061 100644 (file)
@@ -725,12 +725,13 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
 
 const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
-       ACPI_FUNCTION_NAME("ps_get_opcode_info");
+       ACPI_FUNCTION_NAME(ps_get_opcode_info);
 
        /*
         * Detect normal 8-bit opcode or extended 16-bit opcode
         */
        if (!(opcode & 0xFF00)) {
+
                /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
 
                return (&acpi_gbl_aml_op_info
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 
        if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
            (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
+
                /* Valid extended (16-bit) opcode */
 
                return (&acpi_gbl_aml_op_info
@@ -779,7 +781,7 @@ char *acpi_ps_get_opcode_name(u16 opcode)
        return (op->name);
 
 #else
-       return ("AE_NOT_CONFIGURED");
+       return ("OpcodeName unavailable");
 
 #endif
 }
index a9f3229f4106f2750a21e5e7c59255405eabc35f..7ee2f2e7752515154e6c7bf2339af7bacc6c71ae 100644 (file)
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
        opcode = (u16) ACPI_GET8(aml);
 
        if (opcode == AML_EXTENDED_OP_PREFIX) {
+
                /* Extended opcode, get the second opcode byte */
 
                aml++;
@@ -137,7 +138,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        const struct acpi_opcode_info *parent_info;
        union acpi_parse_object *replacement_op = NULL;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
+       ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
 
        /* Check for null Op, can happen if AML code is corrupt */
 
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        if (op->common.parent) {
                prev = op->common.parent->common.value.arg;
                if (!prev) {
+
                        /* Nothing more to do */
 
                        goto cleanup;
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                /* We must unlink this op from the parent tree */
 
                if (prev == op) {
+
                        /* This op is the first in the list */
 
                        if (replacement_op) {
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 
                else
                        while (prev) {
+
                                /* Traverse all siblings in the parent's argument list */
 
                                next = prev->common.next;
@@ -329,7 +333,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
        struct acpi_parse_state *parser_state = &walk_state->parser_state;
        acpi_status status = AE_CTRL_PENDING;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
+       ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op);
 
        switch (callback_status) {
        case AE_CTRL_TERMINATE:
@@ -449,10 +453,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
        struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
        struct acpi_walk_state *previous_walk_state;
 
-       ACPI_FUNCTION_TRACE("ps_parse_aml");
+       ACPI_FUNCTION_TRACE(ps_parse_aml);
 
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "Entered with walk_state=%p Aml=%p size=%X\n",
+                         "Entered with WalkState=%p Aml=%p size=%X\n",
                          walk_state, walk_state->parser_state.aml,
                          walk_state->parser_state.aml_size));
 
@@ -460,6 +464,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 
        thread = acpi_ut_create_thread_state();
        if (!thread) {
+               acpi_ds_delete_walk_state(walk_state);
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
@@ -510,6 +515,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                } else if (status == AE_CTRL_TERMINATE) {
                        status = AE_OK;
                } else if ((status != AE_OK) && (walk_state->method_desc)) {
+
                        /* Either the method parse or actual execution failed */
 
                        ACPI_ERROR_METHOD("Method parse/execution failed",
@@ -550,20 +556,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                 */
                if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
                     ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
-                       if (walk_state->method_desc) {
-                               /* Decrement the thread count on the method parse tree */
-
-                               if (walk_state->method_desc->method.
-                                   thread_count) {
-                                       walk_state->method_desc->method.
-                                           thread_count--;
-                               } else {
-                                       ACPI_ERROR((AE_INFO,
-                                                   "Invalid zero thread count in method"));
-                               }
-                       }
-
-                       acpi_ds_terminate_control_method(walk_state);
+                       acpi_ds_terminate_control_method(walk_state->
+                                                        method_desc,
+                                                        walk_state);
                }
 
                /* Delete this walk state and all linked control states */
@@ -572,7 +567,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                previous_walk_state = walk_state;
 
                ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                                 "return_value=%p, implicit_value=%p State=%p\n",
+                                 "ReturnValue=%p, ImplicitValue=%p State=%p\n",
                                  walk_state->return_desc,
                                  walk_state->implicit_return_obj, walk_state));
 
@@ -633,12 +628,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                        }
                } else {
                        if (previous_walk_state->return_desc) {
+
                                /* Caller doesn't want it, must delete it */
 
                                acpi_ut_remove_reference(previous_walk_state->
                                                         return_desc);
                        }
                        if (previous_walk_state->implicit_return_obj) {
+
                                /* Caller doesn't want it, must delete it */
 
                                acpi_ut_remove_reference(previous_walk_state->
index bc6047caccd9befcbb105ed748804f05607f5fd5..a3e0314de24d5443a4d7aa0d583409663b3102b1 100644 (file)
@@ -106,14 +106,14 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state,
 {
        union acpi_generic_state *scope;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op);
+       ACPI_FUNCTION_TRACE_PTR(ps_init_scope, root_op);
 
        scope = acpi_ut_create_generic_state();
        if (!scope) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
+       scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
        scope->parse_scope.op = root_op;
        scope->parse_scope.arg_count = ACPI_VAR_ARGS;
        scope->parse_scope.arg_end = parser_state->aml_end;
@@ -147,14 +147,14 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
 {
        union acpi_generic_state *scope;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op);
+       ACPI_FUNCTION_TRACE_PTR(ps_push_scope, op);
 
        scope = acpi_ut_create_generic_state();
        if (!scope) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
+       scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE;
        scope->parse_scope.op = op;
        scope->parse_scope.arg_list = remaining_args;
        scope->parse_scope.arg_count = arg_count;
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
        acpi_ut_push_generic_state(&parser_state->scope, scope);
 
        if (arg_count == ACPI_VAR_ARGS) {
+
                /* Multiple arguments */
 
                scope->parse_scope.arg_end = parser_state->pkg_end;
@@ -199,14 +200,14 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
 {
        union acpi_generic_state *scope = parser_state->scope;
 
-       ACPI_FUNCTION_TRACE("ps_pop_scope");
+       ACPI_FUNCTION_TRACE(ps_pop_scope);
 
        /* Only pop the scope if there is in fact a next scope */
 
        if (scope->common.next) {
                scope = acpi_ut_pop_generic_state(&parser_state->scope);
 
-               /* return to parsing previous op */
+               /* Return to parsing previous op */
 
                *op = scope->parse_scope.op;
                *arg_list = scope->parse_scope.arg_list;
@@ -217,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
 
                acpi_ut_delete_generic_state(scope);
        } else {
-               /* empty parse stack, prepare to fetch next opcode */
+               /* Empty parse stack, prepare to fetch next opcode */
 
                *op = NULL;
                *arg_list = 0;
@@ -246,7 +247,7 @@ void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state)
 {
        union acpi_generic_state *scope;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state);
+       ACPI_FUNCTION_TRACE_PTR(ps_cleanup_scope, parser_state);
 
        if (!parser_state) {
                return_VOID;
index dd6f16726fc437abab328359d315cc365ee146e1..0015717ef096b64417a0166573922a28232d3b7d 100644 (file)
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
 
        op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
+
                /* Invalid opcode or ASCII character */
 
                return (NULL);
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
        /* Check if this opcode requires argument sub-objects */
 
        if (!(op_info->flags & AML_HAS_ARGS)) {
+
                /* Has no linked argument objects */
 
                return (NULL);
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
 
        op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
+
                /* Invalid opcode */
 
                ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
        /* Check if this opcode requires argument sub-objects */
 
        if (!(op_info->flags & AML_HAS_ARGS)) {
+
                /* Has no linked argument objects */
 
                return;
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
        /* Append the argument to the linked argument list */
 
        if (op->common.value.arg) {
+
                /* Append to existing argument list */
 
                prev_arg = op->common.value.arg;
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
                }
 
                if (arg == origin) {
+
                        /* Reached parent of origin, end search */
 
                        return (NULL);
                }
 
                if (parent->common.next) {
+
                        /* Found sibling of parent */
 
                        return (parent->common.next);
@@ -299,5 +306,4 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
        return (child);
 }
 #endif
-
 #endif                         /*  ACPI_FUTURE_USAGE  */
index 3e07cb9cb7487f6940324c1b218ebbf6d9bfa761..182474ae8ce9ed4f00e649b9781ad19477646722 100644 (file)
@@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
 {
        ACPI_FUNCTION_ENTRY();
 
-       op->common.data_type = ACPI_DESC_TYPE_PARSER;
+       op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
        op->common.aml_opcode = opcode;
 
        ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
        /* Allocate the minimum required size object */
 
        if (flags == ACPI_PARSEOP_GENERIC) {
+
                /* The generic op (default) is by far the most common (16 to 1) */
 
                op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
@@ -171,7 +172,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
 
 void acpi_ps_free_op(union acpi_parse_object *op)
 {
-       ACPI_FUNCTION_NAME("ps_free_op");
+       ACPI_FUNCTION_NAME(ps_free_op);
 
        if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n",
index 06f05bfd761262c6f1776b25b3329b65b958c1b5..a84a547a0f1b469706cff58935750ed4ec05db56 100644 (file)
@@ -64,18 +64,21 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
        union acpi_parse_object *next = NULL;
        union acpi_parse_object *parent = NULL;
 
-       ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root);
+       ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root);
 
        /* Visit all nodes in the subtree */
 
        while (op) {
+
                /* Check if we are not ascending */
 
                if (op != parent) {
+
                        /* Look for an argument or child of the current op */
 
                        next = acpi_ps_get_arg(op, 0);
                        if (next) {
+
                                /* Still going downward in tree (Op is not completed yet) */
 
                                op = next;
index 2dd48cbb7c0299c66e0606d8a8da9687eb35aa5c..5d996c1140af39ac64b1e30d2a8ba711a7a34f23 100644 (file)
 ACPI_MODULE_NAME("psxface")
 
 /* Local Prototypes */
-static void acpi_ps_start_trace(struct acpi_parameter_info *info);
+static void acpi_ps_start_trace(struct acpi_evaluate_info *info);
 
-static void acpi_ps_stop_trace(struct acpi_parameter_info *info);
+static void acpi_ps_stop_trace(struct acpi_evaluate_info *info);
 
-static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
+static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info);
 
 static void
-acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
+acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
 
 /*******************************************************************************
  *
@@ -113,7 +113,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
  *
  ******************************************************************************/
 
-static void acpi_ps_start_trace(struct acpi_parameter_info *info)
+static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
 {
        acpi_status status;
 
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info)
        }
 
        if ((!acpi_gbl_trace_method_name) ||
-           (acpi_gbl_trace_method_name != info->node->name.integer)) {
+           (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) {
                goto exit;
        }
 
@@ -158,7 +158,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info)
  *
  ******************************************************************************/
 
-static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
+static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
 {
        acpi_status status;
 
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
        }
 
        if ((!acpi_gbl_trace_method_name) ||
-           (acpi_gbl_trace_method_name != info->node->name.integer)) {
+           (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) {
                goto exit;
        }
 
@@ -212,22 +212,23 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
  *
  ******************************************************************************/
 
-acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
+acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ps_execute_method");
+       ACPI_FUNCTION_TRACE(ps_execute_method);
 
        /* Validate the Info and method Node */
 
-       if (!info || !info->node) {
+       if (!info || !info->resolved_node) {
                return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
        /* Init for new method, wait on concurrency semaphore */
 
        status =
-           acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
+           acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc,
+                                          NULL);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -248,7 +249,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
                          "**** Begin Method Parse **** Entry=%p obj=%p\n",
-                         info->node, info->obj_desc));
+                         info->resolved_node, info->obj_desc));
 
        info->pass_number = 1;
        status = acpi_ps_execute_pass(info);
@@ -261,7 +262,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
                          "**** Begin Method Execution **** Entry=%p obj=%p\n",
-                         info->node, info->obj_desc));
+                         info->resolved_node, info->obj_desc));
 
        info->pass_number = 3;
        status = acpi_ps_execute_pass(info);
@@ -286,8 +287,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
         * a control exception code
         */
        if (info->return_object) {
-               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                                 "Method returned obj_desc=%p\n",
+               ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
                                  info->return_object));
                ACPI_DUMP_STACK_ENTRY(info->return_object);
 
@@ -301,7 +301,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
  *
  * FUNCTION:    acpi_ps_update_parameter_list
  *
- * PARAMETERS:  Info            - See struct acpi_parameter_info
+ * PARAMETERS:  Info            - See struct acpi_evaluate_info
  *                                (Used: parameter_type and Parameters)
  *              Action          - Add or Remove reference
  *
@@ -312,14 +312,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
  ******************************************************************************/
 
 static void
-acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
+acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action)
 {
        acpi_native_uint i;
 
        if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
+
                /* Update reference count for each parameter */
 
                for (i = 0; info->parameters[i]; i++) {
+
                        /* Ignore errors, just do them all */
 
                        (void)acpi_ut_update_object_reference(info->
@@ -333,7 +335,7 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
  *
  * FUNCTION:    acpi_ps_execute_pass
  *
- * PARAMETERS:  Info            - See struct acpi_parameter_info
+ * PARAMETERS:  Info            - See struct acpi_evaluate_info
  *                                (Used: pass_number, Node, and obj_desc)
  *
  * RETURN:      Status
@@ -342,13 +344,13 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
  *
  ******************************************************************************/
 
-static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
+static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info)
 {
        acpi_status status;
        union acpi_parse_object *op;
        struct acpi_walk_state *walk_state;
 
-       ACPI_FUNCTION_TRACE("ps_execute_pass");
+       ACPI_FUNCTION_TRACE(ps_execute_pass);
 
        /* Create and init a Root Node */
 
@@ -367,7 +369,7 @@ static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
                goto cleanup;
        }
 
-       status = acpi_ds_init_aml_walk(walk_state, op, info->node,
+       status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
                                       info->obj_desc->method.aml_start,
                                       info->obj_desc->method.aml_length,
                                       info->pass_number == 1 ? NULL : info,
index 713b763884a95d61afd37e9dc79ed28be70fd6e3..a1b46fb41c803373f82020da6869a3a9e7b8c566 100644 (file)
@@ -388,7 +388,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
 
 /* Use the acpiid in MADT to map cpus in case of SMP */
 #ifndef CONFIG_SMP
-#define convert_acpiid_to_cpu(acpi_id) (0xff)
+#define convert_acpiid_to_cpu(acpi_id) (-1)
 #else
 
 #ifdef CONFIG_IA64
@@ -401,7 +401,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device)
 #define ARCH_BAD_APICID                (0xff)
 #endif
 
-static u8 convert_acpiid_to_cpu(u8 acpi_id)
+static int convert_acpiid_to_cpu(u8 acpi_id)
 {
        u16 apic_id;
        int i;
@@ -427,7 +427,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
        acpi_status status = 0;
        union acpi_object object = { 0 };
        struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
-       u8 cpu_index;
+       int cpu_index;
        static int cpu0_initialized;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_info");
@@ -473,7 +473,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
        cpu_index = convert_acpiid_to_cpu(pr->acpi_id);
 
        /* Handle UP system running SMP kernel, with no LAPIC in MADT */
-       if (!cpu0_initialized && (cpu_index == 0xff) &&
+       if (!cpu0_initialized && (cpu_index == -1) &&
            (num_online_cpus() == 1)) {
                cpu_index = 0;
        }
@@ -487,7 +487,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr)
         *  less than the max # of CPUs. They should be ignored _iff
         *  they are physically not present.
         */
-       if (cpu_index >= NR_CPUS) {
+       if (cpu_index == -1) {
                if (ACPI_FAILURE
                    (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -558,8 +558,8 @@ static int acpi_processor_start(struct acpi_device *device)
         */
        if (processor_device_array[pr->id] != NULL &&
            processor_device_array[pr->id] != (void *)device) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id"
-                       "for the processor\n"));
+               printk(KERN_WARNING "BIOS reported wrong ACPI id"
+                       "for the processor\n");
                return_VALUE(-ENODEV);
        }
        processor_device_array[pr->id] = (void *)device;
index abbdb37a7f5f37e062f58800318d66b67a37c5d1..f36db22ce1aeb9b745ee815f6266779f31e98945 100644 (file)
@@ -577,6 +577,8 @@ acpi_processor_register_performance(struct acpi_processor_performance
                return_VALUE(-EBUSY);
        }
 
+       WARN_ON(!performance);
+
        pr->performance = performance;
 
        if (acpi_processor_get_performance_info(pr)) {
@@ -609,7 +611,8 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
                return_VOID;
        }
 
-       kfree(pr->performance->states);
+       if (pr->performance)
+               kfree(pr->performance->states);
        pr->performance = NULL;
 
        acpi_cpufreq_remove_file(pr);
index 4038dbfa63a0c1b88de380d9a80b326dfd24c39c..cf87b0230026db03f58fc2c5885cb8ceaa3ce2fa 100644 (file)
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
        ACPI_FUNCTION_ENTRY();
 
        for (bits_set = 0; bit_field; bits_set++) {
+
                /* Zero the least significant bit that is set */
 
                bit_field &= (bit_field - 1);
@@ -154,15 +155,18 @@ acpi_rs_stream_option_length(u32 resource_length,
         * length, minus one byte for the resource_source_index itself.
         */
        if (resource_length > minimum_aml_resource_length) {
+
                /* Compute the length of the optional string */
 
                string_length =
                    resource_length - minimum_aml_resource_length - 1;
        }
 
-       /* Round up length to 32 bits for internal structure alignment */
-
-       return (ACPI_ROUND_UP_to_32_bITS(string_length));
+       /*
+        * Round the length up to a multiple of the native word in order to
+        * guarantee that the entire resource descriptor is native word aligned
+        */
+       return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length));
 }
 
 /*******************************************************************************
@@ -186,11 +190,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
        acpi_size aml_size_needed = 0;
        acpi_rs_length total_size;
 
-       ACPI_FUNCTION_TRACE("rs_get_aml_length");
+       ACPI_FUNCTION_TRACE(rs_get_aml_length);
 
        /* Traverse entire list of internal resource descriptors */
 
        while (resource) {
+
                /* Validate the descriptor type */
 
                if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -214,6 +219,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
                         * is a Large Resource data type.
                         */
                        if (resource->data.vendor.byte_length > 7) {
+
                                /* Base size of a Large resource descriptor */
 
                                total_size =
@@ -332,20 +338,22 @@ acpi_rs_get_list_length(u8 * aml_buffer,
        acpi_status status;
        u8 *end_aml;
        u8 *buffer;
-       u32 buffer_size = 0;
+       u32 buffer_size;
        u16 temp16;
        u16 resource_length;
        u32 extra_struct_bytes;
        u8 resource_index;
        u8 minimum_aml_resource_length;
 
-       ACPI_FUNCTION_TRACE("rs_get_list_length");
+       ACPI_FUNCTION_TRACE(rs_get_list_length);
 
+       *size_needed = 0;
        end_aml = aml_buffer + aml_buffer_length;
 
        /* Walk the list of AML resource descriptors */
 
        while (aml_buffer < end_aml) {
+
                /* Validate the Resource Type and Resource Length */
 
                status = acpi_ut_validate_resource(aml_buffer, &resource_index);
@@ -386,35 +394,28 @@ acpi_rs_get_list_length(u8 * aml_buffer,
                        break;
 
                case ACPI_RESOURCE_NAME_VENDOR_SMALL:
+               case ACPI_RESOURCE_NAME_VENDOR_LARGE:
                        /*
                         * Vendor Resource:
-                        * Ensure a 32-bit boundary for the structure
+                        * Get the number of vendor data bytes
                         */
-                       extra_struct_bytes =
-                           ACPI_ROUND_UP_to_32_bITS(resource_length);
+                       extra_struct_bytes = resource_length;
                        break;
 
                case ACPI_RESOURCE_NAME_END_TAG:
                        /*
-                        * End Tag: This is the normal exit, add size of end_tag
+                        * End Tag:
+                        * This is the normal exit, add size of end_tag
                         */
-                       *size_needed = buffer_size + ACPI_RS_SIZE_MIN;
+                       *size_needed += ACPI_RS_SIZE_MIN;
                        return_ACPI_STATUS(AE_OK);
 
-               case ACPI_RESOURCE_NAME_VENDOR_LARGE:
-                       /*
-                        * Vendor Resource:
-                        * Add vendor data and ensure a 32-bit boundary for the structure
-                        */
-                       extra_struct_bytes =
-                           ACPI_ROUND_UP_to_32_bITS(resource_length);
-                       break;
-
                case ACPI_RESOURCE_NAME_ADDRESS32:
                case ACPI_RESOURCE_NAME_ADDRESS16:
+               case ACPI_RESOURCE_NAME_ADDRESS64:
                        /*
-                        * 32-Bit or 16-bit Address Resource:
-                        * Add the size of any optional data (resource_source)
+                        * Address Resource:
+                        * Add the size of the optional resource_source
                         */
                        extra_struct_bytes =
                            acpi_rs_stream_option_length(resource_length,
@@ -423,50 +424,46 @@ acpi_rs_get_list_length(u8 * aml_buffer,
 
                case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
                        /*
-                        * Extended IRQ:
-                        * Point past the interrupt_vector_flags to get the
-                        * interrupt_table_length.
+                        * Extended IRQ Resource:
+                        * Using the interrupt_table_length, add 4 bytes for each additional
+                        * interrupt. Note: at least one interrupt is required and is
+                        * included in the minimum descriptor size (reason for the -1)
                         */
-                       buffer++;
+                       extra_struct_bytes = (buffer[1] - 1) * sizeof(u32);
 
-                       extra_struct_bytes =
-                           /*
-                            * Add 4 bytes for each additional interrupt. Note: at
-                            * least one interrupt is required and is included in
-                            * the minimum descriptor size
-                            */
-                           ((*buffer - 1) * sizeof(u32)) +
-                           /* Add the size of any optional data (resource_source) */
+                       /* Add the size of the optional resource_source */
+
+                       extra_struct_bytes +=
                            acpi_rs_stream_option_length(resource_length -
                                                         extra_struct_bytes,
                                                         minimum_aml_resource_length);
                        break;
 
-               case ACPI_RESOURCE_NAME_ADDRESS64:
-                       /*
-                        * 64-Bit Address Resource:
-                        * Add the size of any optional data (resource_source)
-                        * Ensure a 64-bit boundary for the structure
-                        */
-                       extra_struct_bytes =
-                           ACPI_ROUND_UP_to_64_bITS
-                           (acpi_rs_stream_option_length
-                            (resource_length, minimum_aml_resource_length));
-                       break;
-
                default:
                        break;
                }
 
-               /* Update the required buffer size for the internal descriptor structs */
+               /*
+                * Update the required buffer size for the internal descriptor structs
+                *
+                * Important: Round the size up for the appropriate alignment. This
+                * is a requirement on IA64.
+                */
+               buffer_size = acpi_gbl_resource_struct_sizes[resource_index] +
+                   extra_struct_bytes;
+               buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size);
 
-               temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] +
-                               extra_struct_bytes);
-               buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16);
+               *size_needed += buffer_size;
+
+               ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+                                 "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+                                 acpi_ut_get_resource_type(aml_buffer),
+                                 acpi_ut_get_descriptor_length(aml_buffer),
+                                 buffer_size));
 
                /*
-                * Point to the next resource within the stream
-                * using the size of the header plus the length contained in the header
+                * Point to the next resource within the AML stream using the length
+                * contained in the resource descriptor header
                 */
                aml_buffer += acpi_ut_get_descriptor_length(aml_buffer);
        }
@@ -506,7 +503,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
        u8 name_found;
        u32 table_index;
 
-       ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length");
+       ACPI_FUNCTION_TRACE(rs_get_pci_routing_table_length);
 
        number_of_elements = package_object->package.count;
 
@@ -523,6 +520,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
        top_object_list = package_object->package.elements;
 
        for (index = 0; index < number_of_elements; index++) {
+
                /* Dereference the sub-package */
 
                package_element = *top_object_list;
@@ -581,7 +579,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
 
                /* Round up the size since each element must be aligned */
 
-               temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed);
+               temp_size_needed = ACPI_ROUND_UP_TO_64BIT(temp_size_needed);
 
                /* Point to the next union acpi_operand_object */
 
@@ -589,7 +587,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
        }
 
        /*
-        * Adding an extra element to the end of the list, essentially a
+        * Add an extra element to the end of the list, essentially a
         * NULL terminator
         */
        *buffer_size_needed =
index 8c128dea325294e2591e1a96a934a9208022b60e..008058acdd39cb0143883d9be1e2454a4fb5b3da 100644 (file)
@@ -75,10 +75,11 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
        u8 *aml_start;
        acpi_size list_size_needed = 0;
        u32 aml_buffer_length;
+       void *resource;
 
-       ACPI_FUNCTION_TRACE("rs_create_resource_list");
+       ACPI_FUNCTION_TRACE(rs_create_resource_list);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer));
 
        /* Params already validated, so we don't re-validate here */
 
@@ -92,7 +93,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
        status = acpi_rs_get_list_length(aml_start, aml_buffer_length,
                                         &list_size_needed);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
                          status, (u32) list_size_needed));
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
@@ -107,13 +108,15 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
 
        /* Do the conversion */
 
-       status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length,
-                                                 output_buffer->pointer);
+       resource = output_buffer->pointer;
+       status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length,
+                                           acpi_rs_convert_aml_to_resources,
+                                           &resource);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
                          output_buffer->pointer, (u32) output_buffer->length));
        return_ACPI_STATUS(AE_OK);
 }
@@ -155,7 +158,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
        acpi_status status;
        struct acpi_buffer path_buffer;
 
-       ACPI_FUNCTION_TRACE("rs_create_pci_routing_table");
+       ACPI_FUNCTION_TRACE(rs_create_pci_routing_table);
 
        /* Params already validated, so we don't re-validate here */
 
@@ -167,7 +170,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n",
                          (u32) buffer_size_needed));
 
        /* Validate/Allocate/Clear caller buffer */
@@ -332,7 +335,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                /* Now align the current length */
 
                user_prt->length =
-                   (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length);
+                   (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length);
 
                /* 4) Fourth subobject: Dereference the PRT.source_index */
 
@@ -341,7 +344,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                        user_prt->source_index = (u32) obj_desc->integer.value;
                } else {
                        ACPI_ERROR((AE_INFO,
-                                   "(PRT[%X].source_index) Need Integer, found %s",
+                                   "(PRT[%X].SourceIndex) Need Integer, found %s",
                                    index,
                                    acpi_ut_get_object_type_name(obj_desc)));
                        return_ACPI_STATUS(AE_BAD_DATA);
@@ -352,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                top_object_list++;
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
                          output_buffer->pointer, (u32) output_buffer->length));
        return_ACPI_STATUS(AE_OK);
 }
@@ -382,9 +385,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
        acpi_status status;
        acpi_size aml_size_needed = 0;
 
-       ACPI_FUNCTION_TRACE("rs_create_aml_resources");
+       ACPI_FUNCTION_TRACE(rs_create_aml_resources);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
                          linked_list_buffer));
 
        /*
@@ -395,7 +398,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
         */
        status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
                          (u32) aml_size_needed,
                          acpi_format_exception(status)));
        if (ACPI_FAILURE(status)) {
@@ -419,7 +422,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
                return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
                          output_buffer->pointer, (u32) output_buffer->length));
        return_ACPI_STATUS(AE_OK);
 }
index e7de061cf883b36b080665cefb15883466248c37..9c99a723a860da348f507e162404eca9fe8ed693 100644 (file)
@@ -91,11 +91,11 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
 struct acpi_rsdump_info acpi_rs_dump_irq[6] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
-        acpi_gbl_HEdecode},
+        acpi_gbl_he_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
-        acpi_gbl_LLdecode},
+        acpi_gbl_ll_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
-        acpi_gbl_SHRdecode},
+        acpi_gbl_shr_decode},
        {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
         "Interrupt Count", NULL},
        {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
@@ -105,11 +105,11 @@ struct acpi_rsdump_info acpi_rs_dump_irq[6] = {
 struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
        {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
-        acpi_gbl_TYPdecode},
+        acpi_gbl_typ_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
-        acpi_gbl_BMdecode},
+        acpi_gbl_bm_decode},
        {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
-        acpi_gbl_SIZdecode},
+        acpi_gbl_siz_decode},
        {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
         NULL},
        {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
@@ -158,7 +158,7 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
 };
 
 struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
-       {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag",
+       {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
         NULL}
 };
 
@@ -166,7 +166,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
         "24-Bit Memory Range", NULL},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
-        "Write Protect", acpi_gbl_RWdecode},
+        "Write Protect", acpi_gbl_rw_decode},
        {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
         NULL},
        {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
@@ -181,7 +181,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
         "32-Bit Memory Range", NULL},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
-        "Write Protect", acpi_gbl_RWdecode},
+        "Write Protect", acpi_gbl_rw_decode},
        {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
         NULL},
        {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
@@ -196,7 +196,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
         "32-Bit Fixed Memory Range", NULL},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
-        "Write Protect", acpi_gbl_RWdecode},
+        "Write Protect", acpi_gbl_rw_decode},
        {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
         NULL},
        {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
@@ -278,11 +278,11 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
         "Type", acpi_gbl_consume_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
-        "Triggering", acpi_gbl_HEdecode},
+        "Triggering", acpi_gbl_he_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
-        acpi_gbl_LLdecode},
+        acpi_gbl_ll_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
-        acpi_gbl_SHRdecode},
+        acpi_gbl_shr_decode},
        {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
         NULL},
        {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
@@ -314,7 +314,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
         "Consumer/Producer", acpi_gbl_consume_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
-        acpi_gbl_DECdecode},
+        acpi_gbl_dec_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
         "Min Relocatability", acpi_gbl_min_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
@@ -325,24 +325,24 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
        {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
         "Resource Type", (void *)"Memory Range"},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
-        "Write Protect", acpi_gbl_RWdecode},
+        "Write Protect", acpi_gbl_rw_decode},
        {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
-        "Caching", acpi_gbl_MEMdecode},
+        "Caching", acpi_gbl_mem_decode},
        {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
-        "Range Type", acpi_gbl_MTPdecode},
+        "Range Type", acpi_gbl_mtp_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
-        "Translation", acpi_gbl_TTPdecode}
+        "Translation", acpi_gbl_ttp_decode}
 };
 
 static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
        {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
         "Resource Type", (void *)"I/O Range"},
        {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
-        "Range Type", acpi_gbl_RNGdecode},
+        "Range Type", acpi_gbl_rng_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
-        "Translation", acpi_gbl_TTPdecode},
+        "Translation", acpi_gbl_ttp_decode},
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
-        "Translation Type", acpi_gbl_TRSdecode}
+        "Translation Type", acpi_gbl_trs_decode}
 };
 
 /*
index d9ae64b77bd9f6490cbff2af7606fa07e26e8b08..9e7ae2f8a1d3993a03ad9576e6126c3a171de63f 100644 (file)
@@ -141,6 +141,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = {
        acpi_rs_dump_generic_reg,       /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
 };
 #endif
+
 #endif /* ACPI_FUTURE_USAGE */
 /*
  * Base sizes for external AML resource descriptors, indexed by internal type.
index 1434e786477e82de414ebab1afdadd20daee6c00..29423ce030caa66a89ab99668987abe223913ea3 100644 (file)
@@ -51,76 +51,62 @@ ACPI_MODULE_NAME("rslist")
  *
  * FUNCTION:    acpi_rs_convert_aml_to_resources
  *
- * PARAMETERS:  Aml                 - Pointer to the resource byte stream
- *              aml_length          - Length of Aml
- *              output_buffer       - Pointer to the buffer that will
- *                                    contain the output structures
+ * PARAMETERS:  acpi_walk_aml_callback
+ *              resource_ptr            - Pointer to the buffer that will
+ *                                        contain the output structures
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Takes the resource byte stream and parses it, creating a
- *              linked list of resources in the caller's output buffer
+ * DESCRIPTION: Convert an AML resource to an internal representation of the
+ *              resource that is aligned and easier to access.
  *
  ******************************************************************************/
 acpi_status
-acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
+acpi_rs_convert_aml_to_resources(u8 * aml,
+                                u32 length,
+                                u32 offset, u8 resource_index, void **context)
 {
-       struct acpi_resource *resource = (void *)output_buffer;
+       struct acpi_resource **resource_ptr =
+           ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context);
+       struct acpi_resource *resource;
        acpi_status status;
-       u8 resource_index;
-       u8 *end_aml;
-
-       ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources");
-
-       end_aml = aml + aml_length;
-
-       /* Loop until end-of-buffer or an end_tag is found */
-
-       while (aml < end_aml) {
-               /* Validate the Resource Type and Resource Length */
-
-               status = acpi_ut_validate_resource(aml, &resource_index);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
 
-               /* Convert the AML byte stream resource to a local resource struct */
-
-               status =
-                   acpi_rs_convert_aml_to_resource(resource,
-                                                   ACPI_CAST_PTR(union
-                                                                 aml_resource,
-                                                                 aml),
-                                                   acpi_gbl_get_resource_dispatch
-                                                   [resource_index]);
-               if (ACPI_FAILURE(status)) {
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "Could not convert AML resource (Type %X)",
-                                       *aml));
-                       return_ACPI_STATUS(status);
-               }
+       ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources);
 
-               /* Normal exit on completion of an end_tag resource descriptor */
-
-               if (acpi_ut_get_resource_type(aml) ==
-                   ACPI_RESOURCE_NAME_END_TAG) {
-                       return_ACPI_STATUS(AE_OK);
-               }
-
-               /* Point to the next input AML resource */
-
-               aml += acpi_ut_get_descriptor_length(aml);
-
-               /* Point to the next structure in the output buffer */
+       /*
+        * Check that the input buffer and all subsequent pointers into it
+        * are aligned on a native word boundary. Most important on IA64
+        */
+       resource = *resource_ptr;
+       if (ACPI_IS_MISALIGNED(resource)) {
+               ACPI_WARNING((AE_INFO,
+                             "Misaligned resource pointer %p", resource));
+       }
 
-               resource =
-                   ACPI_ADD_PTR(struct acpi_resource, resource,
-                                resource->length);
+       /* Convert the AML byte stream resource to a local resource struct */
+
+       status =
+           acpi_rs_convert_aml_to_resource(resource,
+                                           ACPI_CAST_PTR(union aml_resource,
+                                                         aml),
+                                           acpi_gbl_get_resource_dispatch
+                                           [resource_index]);
+       if (ACPI_FAILURE(status)) {
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "Could not convert AML resource (Type %X)",
+                               *aml));
+               return_ACPI_STATUS(status);
        }
 
-       /* Did not find an end_tag resource descriptor */
+       ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
+                         "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+                         acpi_ut_get_resource_type(aml), length,
+                         resource->length));
 
-       return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+       /* Point to the next structure in the output buffer */
+
+       *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length);
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
@@ -150,11 +136,12 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
        u8 *end_aml = output_buffer + aml_size_needed;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml");
+       ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml);
 
        /* Walk the resource descriptor list, convert each descriptor */
 
        while (aml < end_aml) {
+
                /* Validate the (internal) Resource Type */
 
                if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -191,6 +178,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
                /* Check for end-of-list, normal exit */
 
                if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
+
                        /* An End Tag indicates the end of the input Resource Template */
 
                        return_ACPI_STATUS(AE_OK);
index ed866cf1c6d23c7f7ede4a11fb366ec64ecc9824..faf6e106b78502bbd7a9c648cdbcabb0711bb95c 100644 (file)
@@ -81,9 +81,10 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
        u16 item_count = 0;
        u16 temp16 = 0;
 
-       ACPI_FUNCTION_TRACE("rs_get_resource");
+       ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource);
 
        if (((acpi_native_uint) resource) & 0x3) {
+
                /* Each internal resource struct is expected to be 32-bit aligned */
 
                ACPI_WARNING((AE_INFO,
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
 
       exit:
        if (!flags_mode) {
-               /* Round the resource struct length up to the next 32-bit boundary */
 
-               resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length);
+               /* Round the resource struct length up to the next boundary (32 or 64) */
+
+               resource->length =
+                   (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length);
        }
        return_ACPI_STATUS(AE_OK);
 }
@@ -329,7 +332,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
        u16 temp16 = 0;
        u16 item_count = 0;
 
-       ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml");
+       ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml);
 
        /*
         * First table entry must be ACPI_RSC_INITxxx and must contain the
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
 
 resource->data.extended_irq.interrupt_count = temp8;
 if (temp8 < 1) {
+
        /* Must have at least one IRQ */
 
        return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
index 25b5aedd661201eb7d6573d758d380e993025d1e..a9cbee8e8b44c3a12145c6be17ed36657e9ba1a5 100644 (file)
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
        /* Length is stored differently for large and small descriptors */
 
        if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
+
                /* Large descriptor -- bytes 1-2 contain the 16-bit length */
 
                ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
@@ -298,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destination, char *source)
  *              string_ptr          - (optional) where to store the actual
  *                                    resource_source string
  *
- * RETURN:      Length of the string plus NULL terminator, rounded up to 32 bit
+ * RETURN:      Length of the string plus NULL terminator, rounded up to native
+ *              word boundary
  *
  * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor
  *              to an internal resource descriptor
@@ -328,6 +330,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
         * we add 1 to the minimum length.
         */
        if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
+
                /* Get the resource_source_index */
 
                resource_source->index = aml_resource_source[0];
@@ -344,23 +347,26 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
                }
 
                /*
-                * In order for the struct_size to fall on a 32-bit boundary, calculate
-                * the length of the string (+1 for the NULL terminator) and expand the
-                * struct_size to the next 32-bit boundary.
+                * In order for the Resource length to be a multiple of the native
+                * word, calculate the length of the string (+1 for NULL terminator)
+                * and expand to the next word multiple.
                 *
                 * Zero the entire area of the buffer.
                 */
                total_length =
-                   ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
-                                            ((char *)&aml_resource_source[1]) +
-                                            1);
+                   (u32)
+                   ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
+                   1;
+               total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
+
                ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
 
                /* Copy the resource_source string to the destination */
 
                resource_source->string_length =
                    acpi_rs_strcpy(resource_source->string_ptr,
-                                  (char *)&aml_resource_source[1]);
+                                  ACPI_CAST_PTR(char,
+                                                &aml_resource_source[1]));
 
                return ((acpi_rs_length) total_length);
        }
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
        /* Non-zero string length indicates presence of a resource_source */
 
        if (resource_source->string_length) {
+
                /* Point to the end of the AML descriptor */
 
                aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
 
                /* Copy the resource_source string */
 
-               ACPI_STRCPY((char *)&aml_resource_source[1],
+               ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
                            resource_source->string_ptr);
 
                /*
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml,
  *
  * FUNCTION:    acpi_rs_get_prt_method_data
  *
- * PARAMETERS:  Handle          - a handle to the containing object
- *              ret_buffer      - a pointer to a buffer structure for the
- *                                  results
+ * PARAMETERS:  Node            - Device node
+ *              ret_buffer      - Pointer to a buffer structure for the
+ *                                results
  *
  * RETURN:      Status
  *
@@ -450,18 +457,19 @@ acpi_rs_set_resource_source(union aml_resource * aml,
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
+acpi_rs_get_prt_method_data(struct acpi_namespace_node * node,
+                           struct acpi_buffer * ret_buffer)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("rs_get_prt_method_data");
+       ACPI_FUNCTION_TRACE(rs_get_prt_method_data);
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT,
+       status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT,
                                         ACPI_BTYPE_PACKAGE, &obj_desc);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
@@ -483,9 +491,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
  *
  * FUNCTION:    acpi_rs_get_crs_method_data
  *
- * PARAMETERS:  Handle          - a handle to the containing object
- *              ret_buffer      - a pointer to a buffer structure for the
- *                                  results
+ * PARAMETERS:  Node            - Device node
+ *              ret_buffer      - Pointer to a buffer structure for the
+ *                                results
  *
  * RETURN:      Status
  *
@@ -498,18 +506,19 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
+acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("rs_get_crs_method_data");
+       ACPI_FUNCTION_TRACE(rs_get_crs_method_data);
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS,
+       status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS,
                                         ACPI_BTYPE_BUFFER, &obj_desc);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
@@ -522,7 +531,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
         */
        status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
 
-       /* on exit, we must delete the object returned by evaluate_object */
+       /* On exit, we must delete the object returned by evaluate_object */
 
        acpi_ut_remove_reference(obj_desc);
        return_ACPI_STATUS(status);
@@ -532,9 +541,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
  *
  * FUNCTION:    acpi_rs_get_prs_method_data
  *
- * PARAMETERS:  Handle          - a handle to the containing object
- *              ret_buffer      - a pointer to a buffer structure for the
- *                                  results
+ * PARAMETERS:  Node            - Device node
+ *              ret_buffer      - Pointer to a buffer structure for the
+ *                                results
  *
  * RETURN:      Status
  *
@@ -548,18 +557,19 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
+acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("rs_get_prs_method_data");
+       ACPI_FUNCTION_TRACE(rs_get_prs_method_data);
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS,
+       status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS,
                                         ACPI_BTYPE_BUFFER, &obj_desc);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
@@ -572,7 +582,7 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
         */
        status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
 
-       /* on exit, we must delete the object returned by evaluate_object */
+       /* On exit, we must delete the object returned by evaluate_object */
 
        acpi_ut_remove_reference(obj_desc);
        return_ACPI_STATUS(status);
@@ -583,10 +593,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
  *
  * FUNCTION:    acpi_rs_get_method_data
  *
- * PARAMETERS:  Handle          - a handle to the containing object
+ * PARAMETERS:  Handle          - Handle to the containing object
  *              Path            - Path to method, relative to Handle
- *              ret_buffer      - a pointer to a buffer structure for the
- *                                  results
+ *              ret_buffer      - Pointer to a buffer structure for the
+ *                                results
  *
  * RETURN:      Status
  *
@@ -605,7 +615,7 @@ acpi_rs_get_method_data(acpi_handle handle,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("rs_get_method_data");
+       ACPI_FUNCTION_TRACE(rs_get_method_data);
 
        /* Parameters guaranteed valid by caller */
 
@@ -634,9 +644,9 @@ acpi_rs_get_method_data(acpi_handle handle,
  *
  * FUNCTION:    acpi_rs_set_srs_method_data
  *
- * PARAMETERS:  Handle          - a handle to the containing object
- *              in_buffer       - a pointer to a buffer structure of the
- *                                  parameter
+ * PARAMETERS:  Node            - Device node
+ *              in_buffer       - Pointer to a buffer structure of the
+ *                                parameter
  *
  * RETURN:      Status
  *
@@ -646,23 +656,37 @@ acpi_rs_get_method_data(acpi_handle handle,
  *              If the function fails an appropriate status will be returned
  *              and the contents of the callers buffer is undefined.
  *
+ * Note: Parameters guaranteed valid by caller
+ *
  ******************************************************************************/
 
 acpi_status
-acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
+acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *in_buffer)
 {
-       struct acpi_parameter_info info;
-       union acpi_operand_object *params[2];
+       struct acpi_evaluate_info *info;
+       union acpi_operand_object *args[2];
        acpi_status status;
        struct acpi_buffer buffer;
 
-       ACPI_FUNCTION_TRACE("rs_set_srs_method_data");
+       ACPI_FUNCTION_TRACE(rs_set_srs_method_data);
 
-       /* Parameters guaranteed valid by caller */
+       /* Allocate and initialize the evaluation information block */
+
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       info->prefix_node = node;
+       info->pathname = METHOD_NAME__SRS;
+       info->parameters = args;
+       info->parameter_type = ACPI_PARAM_ARGS;
+       info->flags = ACPI_IGNORE_RETURN_VALUE;
 
        /*
         * The in_buffer parameter will point to a linked list of
-        * resource parameters.  It needs to be formatted into a
+        * resource parameters. It needs to be formatted into a
         * byte stream to be sent in as an input parameter to _SRS
         *
         * Convert the linked list into a byte stream
@@ -670,41 +694,36 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
        buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
        status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
        if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
+               goto cleanup;
        }
 
-       /* Init the param object */
+       /* Create and initialize the method parameter object */
 
-       params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
-       if (!params[0]) {
-               acpi_os_free(buffer.pointer);
-               return_ACPI_STATUS(AE_NO_MEMORY);
+       args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
+       if (!args[0]) {
+               /*
+                * Must free the buffer allocated above (otherwise it is freed
+                * later)
+                */
+               ACPI_FREE(buffer.pointer);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
-       /* Set up the parameter object */
-
-       params[0]->buffer.length = (u32) buffer.length;
-       params[0]->buffer.pointer = buffer.pointer;
-       params[0]->common.flags = AOPOBJ_DATA_VALID;
-       params[1] = NULL;
-
-       info.node = handle;
-       info.parameters = params;
-       info.parameter_type = ACPI_PARAM_ARGS;
+       args[0]->buffer.length = (u32) buffer.length;
+       args[0]->buffer.pointer = buffer.pointer;
+       args[0]->common.flags = AOPOBJ_DATA_VALID;
+       args[1] = NULL;
 
-       /* Execute the method, no return value */
+       /* Execute the method, no return value is expected */
 
-       status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
-       if (ACPI_SUCCESS(status)) {
-               /* Delete any return object (especially if implicit_return is enabled) */
+       status = acpi_ns_evaluate(info);
 
-               if (info.return_object) {
-                       acpi_ut_remove_reference(info.return_object);
-               }
-       }
+       /* Clean up and return the status from acpi_ns_evaluate */
 
-       /* Clean up and return the status from acpi_ns_evaluate_relative */
+       acpi_ut_remove_reference(args[0]);
 
-       acpi_ut_remove_reference(params[0]);
+      cleanup:
+       ACPI_FREE(info);
        return_ACPI_STATUS(status);
 }
index 88b67077aeeb12cf1a1cd1f85db6be9daaef0526..1999e2ab7daad1971559302ae9e0e05b21c33e3e 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
+#include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
 ACPI_MODULE_NAME("rsxface")
@@ -68,312 +67,262 @@ ACPI_MODULE_NAME("rsxface")
 static acpi_status
 acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context);
 
+static acpi_status
+acpi_rs_validate_parameters(acpi_handle device_handle,
+                           struct acpi_buffer *buffer,
+                           struct acpi_namespace_node **return_node);
+
 /*******************************************************************************
  *
- * FUNCTION:    acpi_get_irq_routing_table
+ * FUNCTION:    acpi_rs_validate_parameters
  *
- * PARAMETERS:  device_handle   - a handle to the Bus device we are querying
- *              ret_buffer      - a pointer to a buffer to receive the
- *                                current resources for the device
+ * PARAMETERS:  device_handle   - Handle to a device
+ *              Buffer          - Pointer to a data buffer
+ *              return_node     - Pointer to where the device node is returned
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to get the IRQ routing table for a
- *              specific bus.  The caller must first acquire a handle for the
- *              desired bus.  The routine table is placed in the buffer pointed
- *              to by the ret_buffer variable parameter.
- *
- *              If the function fails an appropriate status will be returned
- *              and the value of ret_buffer is undefined.
- *
- *              This function attempts to execute the _PRT method contained in
- *              the object indicated by the passed device_handle.
+ * DESCRIPTION: Common parameter validation for resource interfaces
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_irq_routing_table(acpi_handle device_handle,
-                          struct acpi_buffer *ret_buffer)
+static acpi_status
+acpi_rs_validate_parameters(acpi_handle device_handle,
+                           struct acpi_buffer *buffer,
+                           struct acpi_namespace_node **return_node)
 {
        acpi_status status;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table ");
+       ACPI_FUNCTION_TRACE(rs_validate_parameters);
 
        /*
-        * Must have a valid handle and buffer, So we have to have a handle
-        * and a return buffer structure, and if there is a non-zero buffer length
-        * we also need a valid pointer in the buffer. If it's a zero buffer length,
-        * we'll be returning the needed buffer size, so keep going.
+        * Must have a valid handle to an ACPI device
         */
        if (!device_handle) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer(ret_buffer);
+       node = acpi_ns_map_handle_to_node(device_handle);
+       if (!node) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       if (node->type != ACPI_TYPE_DEVICE) {
+               return_ACPI_STATUS(AE_TYPE);
+       }
+
+       /*
+        * Validate the user buffer object
+        *
+        * if there is a non-zero buffer length we also need a valid pointer in
+        * the buffer. If it's a zero buffer length, we'll be returning the
+        * needed buffer size (later), so keep going.
+        */
+       status = acpi_ut_validate_buffer(buffer);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_prt_method_data(device_handle, ret_buffer);
-       return_ACPI_STATUS(status);
+       *return_node = node;
+       return_ACPI_STATUS(AE_OK);
 }
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_get_current_resources
+ * FUNCTION:    acpi_get_irq_routing_table
  *
- * PARAMETERS:  device_handle   - a handle to the device object for the
- *                                device we are querying
- *              ret_buffer      - a pointer to a buffer to receive the
+ * PARAMETERS:  device_handle   - Handle to the Bus device we are querying
+ *              ret_buffer      - Pointer to a buffer to receive the
  *                                current resources for the device
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to get the current resources for a
- *              specific device.  The caller must first acquire a handle for
- *              the desired device.  The resource data is placed in the buffer
- *              pointed to by the ret_buffer variable parameter.
+ * DESCRIPTION: This function is called to get the IRQ routing table for a
+ *              specific bus. The caller must first acquire a handle for the
+ *              desired bus. The routine table is placed in the buffer pointed
+ *              to by the ret_buffer variable parameter.
  *
  *              If the function fails an appropriate status will be returned
  *              and the value of ret_buffer is undefined.
  *
- *              This function attempts to execute the _CRS method contained in
+ *              This function attempts to execute the _PRT method contained in
  *              the object indicated by the passed device_handle.
  *
  ******************************************************************************/
 
 acpi_status
-acpi_get_current_resources(acpi_handle device_handle,
+acpi_get_irq_routing_table(acpi_handle device_handle,
                           struct acpi_buffer *ret_buffer)
 {
        acpi_status status;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("acpi_get_current_resources");
+       ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table);
 
-       /*
-        * Must have a valid handle and buffer, So we have to have a handle
-        * and a return buffer structure, and if there is a non-zero buffer length
-        * we also need a valid pointer in the buffer. If it's a zero buffer length,
-        * we'll be returning the needed buffer size, so keep going.
-        */
-       if (!device_handle) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
+       /* Validate parameters then dispatch to internal routine */
 
-       status = acpi_ut_validate_buffer(ret_buffer);
+       status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_crs_method_data(device_handle, ret_buffer);
+       status = acpi_rs_get_prt_method_data(node, ret_buffer);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_current_resources);
+ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_get_possible_resources
+ * FUNCTION:    acpi_get_current_resources
  *
- * PARAMETERS:  device_handle   - a handle to the device object for the
+ * PARAMETERS:  device_handle   - Handle to the device object for the
  *                                device we are querying
- *              ret_buffer      - a pointer to a buffer to receive the
- *                                resources for the device
+ *              ret_buffer      - Pointer to a buffer to receive the
+ *                                current resources for the device
  *
  * RETURN:      Status
  *
- * DESCRIPTION: This function is called to get a list of the possible resources
- *              for a specific device.  The caller must first acquire a handle
- *              for the desired device.  The resource data is placed in the
- *              buffer pointed to by the ret_buffer variable.
+ * DESCRIPTION: This function is called to get the current resources for a
+ *              specific device. The caller must first acquire a handle for
+ *              the desired device. The resource data is placed in the buffer
+ *              pointed to by the ret_buffer variable parameter.
  *
  *              If the function fails an appropriate status will be returned
  *              and the value of ret_buffer is undefined.
  *
+ *              This function attempts to execute the _CRS method contained in
+ *              the object indicated by the passed device_handle.
+ *
  ******************************************************************************/
-
-#ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_possible_resources(acpi_handle device_handle,
-                           struct acpi_buffer *ret_buffer)
+acpi_get_current_resources(acpi_handle device_handle,
+                          struct acpi_buffer *ret_buffer)
 {
        acpi_status status;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("acpi_get_possible_resources");
+       ACPI_FUNCTION_TRACE(acpi_get_current_resources);
 
-       /*
-        * Must have a valid handle and buffer, So we have to have a handle
-        * and a return buffer structure, and if there is a non-zero buffer length
-        * we also need a valid pointer in the buffer. If it's a zero buffer length,
-        * we'll be returning the needed buffer size, so keep going.
-        */
-       if (!device_handle) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
+       /* Validate parameters then dispatch to internal routine */
 
-       status = acpi_ut_validate_buffer(ret_buffer);
+       status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_prs_method_data(device_handle, ret_buffer);
+       status = acpi_rs_get_crs_method_data(node, ret_buffer);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_possible_resources);
-#endif                         /*  ACPI_FUTURE_USAGE  */
+ACPI_EXPORT_SYMBOL(acpi_get_current_resources)
 
+#ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
- * FUNCTION:    acpi_walk_resources
+ * FUNCTION:    acpi_get_possible_resources
  *
  * PARAMETERS:  device_handle   - Handle to the device object for the
  *                                device we are querying
- *              Name            - Method name of the resources we want
- *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
- *              user_function   - Called for each resource
- *              Context         - Passed to user_function
+ *              ret_buffer      - Pointer to a buffer to receive the
+ *                                resources for the device
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Retrieves the current or possible resource list for the
- *              specified device.  The user_function is called once for
- *              each resource in the list.
+ * DESCRIPTION: This function is called to get a list of the possible resources
+ *              for a specific device. The caller must first acquire a handle
+ *              for the desired device. The resource data is placed in the
+ *              buffer pointed to by the ret_buffer variable.
+ *
+ *              If the function fails an appropriate status will be returned
+ *              and the value of ret_buffer is undefined.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_walk_resources(acpi_handle device_handle,
-                   char *name,
-                   ACPI_WALK_RESOURCE_CALLBACK user_function, void *context)
+acpi_get_possible_resources(acpi_handle device_handle,
+                           struct acpi_buffer *ret_buffer)
 {
        acpi_status status;
-       struct acpi_buffer buffer;
-       struct acpi_resource *resource;
-       struct acpi_resource *resource_end;
-
-       ACPI_FUNCTION_TRACE("acpi_walk_resources");
-
-       /* Parameter validation */
+       struct acpi_namespace_node *node;
 
-       if (!device_handle || !user_function || !name ||
-           (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) &&
-            ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
-       }
+       ACPI_FUNCTION_TRACE(acpi_get_possible_resources);
 
-       /* Get the _CRS or _PRS resource list */
+       /* Validate parameters then dispatch to internal routine */
 
-       buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_rs_get_method_data(device_handle, name, &buffer);
+       status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       /* Buffer now contains the resource list */
-
-       resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer);
-       resource_end =
-           ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length);
-
-       /* Walk the resource list until the end_tag is found (or buffer end) */
-
-       while (resource < resource_end) {
-               /* Sanity check the resource */
-
-               if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
-                       status = AE_AML_INVALID_RESOURCE_TYPE;
-                       break;
-               }
-
-               /* Invoke the user function, abort on any error returned */
-
-               status = user_function(resource, context);
-               if (ACPI_FAILURE(status)) {
-                       if (status == AE_CTRL_TERMINATE) {
-                               /* This is an OK termination by the user function */
-
-                               status = AE_OK;
-                       }
-                       break;
-               }
-
-               /* end_tag indicates end-of-list */
-
-               if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
-                       break;
-               }
-
-               /* Get the next resource descriptor */
-
-               resource =
-                   ACPI_ADD_PTR(struct acpi_resource, resource,
-                                resource->length);
-       }
-
-       ACPI_MEM_FREE(buffer.pointer);
+       status = acpi_rs_get_prs_method_data(node, ret_buffer);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_walk_resources);
+ACPI_EXPORT_SYMBOL(acpi_get_possible_resources)
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_set_current_resources
  *
- * PARAMETERS:  device_handle   - a handle to the device object for the
- *                                device we are changing the resources of
- *              in_buffer       - a pointer to a buffer containing the
+ * PARAMETERS:  device_handle   - Handle to the device object for the
+ *                                device we are setting resources
+ *              in_buffer       - Pointer to a buffer containing the
  *                                resources to be set for the device
  *
  * RETURN:      Status
  *
  * DESCRIPTION: This function is called to set the current resources for a
- *              specific device.  The caller must first acquire a handle for
- *              the desired device.  The resource data is passed to the routine
+ *              specific device. The caller must first acquire a handle for
+ *              the desired device. The resource data is passed to the routine
  *              the buffer pointed to by the in_buffer variable.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_set_current_resources(acpi_handle device_handle,
                           struct acpi_buffer *in_buffer)
 {
        acpi_status status;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE("acpi_set_current_resources");
+       ACPI_FUNCTION_TRACE(acpi_set_current_resources);
 
-       /* Must have a valid handle and buffer */
+       /* Validate the buffer, don't allow zero length */
 
-       if ((!device_handle) ||
-           (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) {
+       if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_rs_set_srs_method_data(device_handle, in_buffer);
+       /* Validate parameters then dispatch to internal routine */
+
+       status = acpi_rs_validate_parameters(device_handle, in_buffer, &node);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_rs_set_srs_method_data(node, in_buffer);
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_set_current_resources);
+ACPI_EXPORT_SYMBOL(acpi_set_current_resources)
 
 /******************************************************************************
  *
  * FUNCTION:    acpi_resource_to_address64
  *
- * PARAMETERS:  Resource                - Pointer to a resource
- *              Out                     - Pointer to the users's return
- *                                        buffer (a struct
- *                                        struct acpi_resource_address64)
+ * PARAMETERS:  Resource        - Pointer to a resource
+ *              Out             - Pointer to the users's return buffer
+ *                                (a struct acpi_resource_address64)
  *
  * RETURN:      Status
  *
  * DESCRIPTION: If the resource is an address16, address32, or address64,
- *              copy it to the address64 return buffer.  This saves the
+ *              copy it to the address64 return buffer. This saves the
  *              caller from having to duplicate code for different-sized
  *              addresses.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_resource_to_address64(struct acpi_resource *resource,
                           struct acpi_resource_address64 *out)
@@ -415,18 +364,18 @@ acpi_resource_to_address64(struct acpi_resource *resource,
        return (AE_OK);
 }
 
-EXPORT_SYMBOL(acpi_resource_to_address64);
+ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_vendor_resource
  *
- * PARAMETERS:  device_handle       - Handle for the parent device object
- *              Name                - Method name for the parent resource
- *                                    (METHOD_NAME__CRS or METHOD_NAME__PRS)
- *              Uuid                - Pointer to the UUID to be matched.
- *                                    includes both subtype and 16-byte UUID
- *              ret_buffer          - Where the vendor resource is returned
+ * PARAMETERS:  device_handle   - Handle for the parent device object
+ *              Name            - Method name for the parent resource
+ *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ *              Uuid            - Pointer to the UUID to be matched.
+ *                                includes both subtype and 16-byte UUID
+ *              ret_buffer      - Where the vendor resource is returned
  *
  * RETURN:      Status
  *
@@ -435,7 +384,6 @@ EXPORT_SYMBOL(acpi_resource_to_address64);
  *              UUID subtype. Returns a struct acpi_resource of type Vendor.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_vendor_resource(acpi_handle device_handle,
                         char *name,
@@ -467,18 +415,19 @@ acpi_get_vendor_resource(acpi_handle device_handle,
        return (info.status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_match_vendor_resource
  *
- * PARAMETERS:  ACPI_WALK_RESOURCE_CALLBACK
+ * PARAMETERS:  acpi_walk_resource_callback
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
  *
  ******************************************************************************/
-
 static acpi_status
 acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 {
@@ -526,3 +475,101 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
        info->status = AE_OK;
        return (AE_CTRL_TERMINATE);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_walk_resources
+ *
+ * PARAMETERS:  device_handle   - Handle to the device object for the
+ *                                device we are querying
+ *              Name            - Method name of the resources we want
+ *                                (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ *              user_function   - Called for each resource
+ *              Context         - Passed to user_function
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ *              specified device. The user_function is called once for
+ *              each resource in the list.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_walk_resources(acpi_handle device_handle,
+                   char *name,
+                   acpi_walk_resource_callback user_function, void *context)
+{
+       acpi_status status;
+       struct acpi_buffer buffer;
+       struct acpi_resource *resource;
+       struct acpi_resource *resource_end;
+
+       ACPI_FUNCTION_TRACE(acpi_walk_resources);
+
+       /* Parameter validation */
+
+       if (!device_handle || !user_function || !name ||
+           (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
+            !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       /* Get the _CRS or _PRS resource list */
+
+       buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+       status = acpi_rs_get_method_data(device_handle, name, &buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       /* Buffer now contains the resource list */
+
+       resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer);
+       resource_end =
+           ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length);
+
+       /* Walk the resource list until the end_tag is found (or buffer end) */
+
+       while (resource < resource_end) {
+
+               /* Sanity check the resource */
+
+               if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
+                       status = AE_AML_INVALID_RESOURCE_TYPE;
+                       break;
+               }
+
+               /* Invoke the user function, abort on any error returned */
+
+               status = user_function(resource, context);
+               if (ACPI_FAILURE(status)) {
+                       if (status == AE_CTRL_TERMINATE) {
+
+                               /* This is an OK termination by the user function */
+
+                               status = AE_OK;
+                       }
+                       break;
+               }
+
+               /* end_tag indicates end-of-list */
+
+               if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
+                       break;
+               }
+
+               /* Get the next resource descriptor */
+
+               resource =
+                   ACPI_ADD_PTR(struct acpi_resource, resource,
+                                resource->length);
+       }
+
+       ACPI_FREE(buffer.pointer);
+       return_ACPI_STATUS(status);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_walk_resources)
index a0ab828b2cc5fc589335fe9ffe1c1462985288eb..fc676ac0e3edbbce6c71e0a1964c7ddccd42a7b0 100644 (file)
@@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device,
        create_sysfs_device_files(device);
 }
 
-static int acpi_device_unregister(struct acpi_device *device, int type)
+static void acpi_device_unregister(struct acpi_device *device, int type)
 {
        spin_lock(&acpi_device_lock);
        if (device->parent) {
@@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type)
        acpi_detach_data(device->handle, acpi_bus_data_handler);
        remove_sysfs_device_files(device);
        kobject_unregister(&device->kobj);
-       return 0;
 }
 
 void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
@@ -234,12 +233,9 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
 
 int acpi_match_ids(struct acpi_device *device, char *ids)
 {
-       int error = 0;
-       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
-
        if (device->flags.hardware_id)
                if (strstr(ids, device->pnp.hardware_id))
-                       goto Done;
+                       return 0;
 
        if (device->flags.compatible_ids) {
                struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
@@ -248,15 +244,10 @@ int acpi_match_ids(struct acpi_device *device, char *ids)
                /* compare multiple _CID entries against driver ids */
                for (i = 0; i < cid_list->count; i++) {
                        if (strstr(ids, cid_list->id[i].value))
-                               goto Done;
+                               return 0;
                }
        }
-       error = -ENOENT;
-
-      Done:
-       if (buffer.pointer)
-               acpi_os_free(buffer.pointer);
-       return error;
+       return -ENOENT;
 }
 
 static acpi_status
@@ -441,10 +432,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)
        islockable = device->flags.lockable;
        handle = device->handle;
 
-       if (type == ACPI_TYPE_PROCESSOR)
-               result = acpi_bus_trim(device, 0);
-       else
-               result = acpi_bus_trim(device, 1);
+       result = acpi_bus_trim(device, 1);
 
        if (!result)
                result = acpi_eject_operation(handle, islockable);
@@ -548,10 +536,9 @@ static int acpi_start_single_object(struct acpi_device *device)
        return_VALUE(result);
 }
 
-static int acpi_driver_attach(struct acpi_driver *drv)
+static void acpi_driver_attach(struct acpi_driver *drv)
 {
        struct list_head *node, *next;
-       int count = 0;
 
        ACPI_FUNCTION_TRACE("acpi_driver_attach");
 
@@ -568,7 +555,6 @@ static int acpi_driver_attach(struct acpi_driver *drv)
                        if (!acpi_bus_driver_init(dev, drv)) {
                                acpi_start_single_object(dev);
                                atomic_inc(&drv->references);
-                               count++;
                                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                                  "Found driver [%s] for device [%s]\n",
                                                  drv->name, dev->pnp.bus_id));
@@ -577,10 +563,9 @@ static int acpi_driver_attach(struct acpi_driver *drv)
                spin_lock(&acpi_device_lock);
        }
        spin_unlock(&acpi_device_lock);
-       return_VALUE(count);
 }
 
-static int acpi_driver_detach(struct acpi_driver *drv)
+static void acpi_driver_detach(struct acpi_driver *drv)
 {
        struct list_head *node, *next;
 
@@ -602,7 +587,6 @@ static int acpi_driver_detach(struct acpi_driver *drv)
                }
        }
        spin_unlock(&acpi_device_lock);
-       return_VALUE(0);
 }
 
 /**
@@ -610,28 +594,22 @@ static int acpi_driver_detach(struct acpi_driver *drv)
  * @driver: driver being registered
  *
  * Registers a driver with the ACPI bus.  Searches the namespace for all
- * devices that match the driver's criteria and binds.  Returns the
- * number of devices that were claimed by the driver, or a negative
- * error status for failure.
+ * devices that match the driver's criteria and binds.  Returns zero for
+ * success or a negative error status for failure.
  */
 int acpi_bus_register_driver(struct acpi_driver *driver)
 {
-       int count;
-
        ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
 
        if (acpi_disabled)
                return_VALUE(-ENODEV);
 
-       if (!driver)
-               return_VALUE(-EINVAL);
-
        spin_lock(&acpi_device_lock);
        list_add_tail(&driver->node, &acpi_bus_drivers);
        spin_unlock(&acpi_device_lock);
-       count = acpi_driver_attach(driver);
+       acpi_driver_attach(driver);
 
-       return_VALUE(count);
+       return_VALUE(0);
 }
 
 EXPORT_SYMBOL(acpi_bus_register_driver);
@@ -643,23 +621,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
  * Unregisters a driver with the ACPI bus.  Searches the namespace for all
  * devices that match the driver's criteria and unbinds.
  */
-int acpi_bus_unregister_driver(struct acpi_driver *driver)
+void acpi_bus_unregister_driver(struct acpi_driver *driver)
 {
-       int error = 0;
-
-       ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
-
-       if (driver) {
-               acpi_driver_detach(driver);
+       acpi_driver_detach(driver);
 
-               if (!atomic_read(&driver->references)) {
-                       spin_lock(&acpi_device_lock);
-                       list_del_init(&driver->node);
-                       spin_unlock(&acpi_device_lock);
-               }
-       } else
-               error = -EINVAL;
-       return_VALUE(error);
+       if (!atomic_read(&driver->references)) {
+               spin_lock(&acpi_device_lock);
+               list_del_init(&driver->node);
+               spin_unlock(&acpi_device_lock);
+       }
+       return;
 }
 
 EXPORT_SYMBOL(acpi_bus_unregister_driver);
index 85df0ceda2a901277f49108b3cd292c8b980ce8e..af1dbabaf0b1d299277fe65727eed95778751c1d 100644 (file)
@@ -155,7 +155,6 @@ static int __init acpi_wakeup_device_init(void)
 
        if (acpi_disabled)
                return 0;
-       printk("ACPI wakeup devices: \n");
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
@@ -174,10 +173,8 @@ static int __init acpi_wakeup_device_init(void)
                        dev->wakeup.state.enabled = 1;
                        spin_lock(&acpi_device_lock);
                }
-               printk("%4s ", dev->pnp.bus_id);
        }
        spin_unlock(&acpi_device_lock);
-       printk("\n");
 
        return 0;
 }
index e4308c7a6743ba54766cac05669db2e9fd2e8c64..a934ac42178d44d39e8891733b655c4648c92335 100644 (file)
@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system")
 #define ACPI_SYSTEM_FILE_EVENT         "event"
 #define ACPI_SYSTEM_FILE_DSDT          "dsdt"
 #define ACPI_SYSTEM_FILE_FADT          "fadt"
-extern FADT_DESCRIPTOR acpi_fadt;
+extern struct fadt_descriptor acpi_fadt;
 
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
@@ -82,7 +82,7 @@ acpi_system_read_dsdt(struct file *file,
 
        ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
 
-       status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt);
+       status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
@@ -110,7 +110,7 @@ acpi_system_read_fadt(struct file *file,
 
        ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
 
-       status = acpi_get_table(ACPI_TABLE_FADT, 1, &fadt);
+       status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
index 7f37c7cc5ef1e2aa836d4f5705b599a89156542a..ed5e8816d83d4c5e9fe03ce20cd754dc1de97739 100644 (file)
@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id,
 
        /* Map the DSDT header via the pointer in the FADT */
        if (id == ACPI_DSDT) {
-               struct fadt_descriptor_rev2 *fadt =
-                   (struct fadt_descriptor_rev2 *)*header;
+               struct fadt_descriptor *fadt =
+                   (struct fadt_descriptor *)*header;
 
                if (fadt->revision == 3 && fadt->Xdsdt) {
                        *header = (void *)__acpi_map_table(fadt->Xdsdt,
index 03b37d2223bce30edea4c3aae5020404f2028bc3..d697fcb35d521e3757ff8632c709a2c3bb448523 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
@@ -56,15 +54,15 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
                             acpi_physical_address address);
 
 static void
-acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
+acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
                      struct fadt_descriptor_rev1 *original_fadt);
 
 static void
-acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
-                     struct fadt_descriptor_rev2 *original_fadt);
+acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
+                     struct fadt_descriptor *original_fadt);
 
 u8 acpi_fadt_is_v1;
-EXPORT_SYMBOL(acpi_fadt_is_v1);
+ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1)
 
 /*******************************************************************************
  *
@@ -122,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
 {
        acpi_size table_size;
        u32 i;
-       XSDT_DESCRIPTOR *new_table;
+       struct xsdt_descriptor *new_table;
 
        ACPI_FUNCTION_ENTRY();
 
@@ -133,7 +131,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
 
        /* Allocate an XSDT */
 
-       new_table = ACPI_MEM_CALLOCATE(table_size);
+       new_table = ACPI_ALLOCATE_ZEROED(table_size);
        if (!new_table) {
                return (AE_NO_MEMORY);
        }
@@ -147,17 +145,18 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
        /* Copy the table pointers */
 
        for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
+
                /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
 
                if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                        ACPI_STORE_ADDRESS(new_table->table_offset_entry[i],
                                           (ACPI_CAST_PTR
-                                           (struct rsdt_descriptor_rev1,
+                                           (struct rsdt_descriptor,
                                             table_info->pointer))->
                                           table_offset_entry[i]);
                } else {
                        new_table->table_offset_entry[i] =
-                           (ACPI_CAST_PTR(XSDT_DESCRIPTOR,
+                           (ACPI_CAST_PTR(struct xsdt_descriptor,
                                           table_info->pointer))->
                            table_offset_entry[i];
                }
@@ -219,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
  ******************************************************************************/
 
 static void
-acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
+acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt,
                      struct fadt_descriptor_rev1 *original_fadt)
 {
 
@@ -365,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
  ******************************************************************************/
 
 static void
-acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
-                     struct fadt_descriptor_rev2 *original_fadt)
+acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt,
+                     struct fadt_descriptor *original_fadt)
 {
 
        /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
 
-       ACPI_MEMCPY(local_fadt, original_fadt,
-                   sizeof(struct fadt_descriptor_rev2));
+       ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor));
 
        /*
         * "X" fields are optional extensions to the original V1.0 fields, so
@@ -491,10 +489,10 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
 
 acpi_status acpi_tb_convert_table_fadt(void)
 {
-       struct fadt_descriptor_rev2 *local_fadt;
+       struct fadt_descriptor *local_fadt;
        struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_TRACE("tb_convert_table_fadt");
+       ACPI_FUNCTION_TRACE(tb_convert_table_fadt);
 
        /*
         * acpi_gbl_FADT is valid. Validate the FADT length. The table must be
@@ -508,13 +506,14 @@ acpi_status acpi_tb_convert_table_fadt(void)
 
        /* Allocate buffer for the ACPI 2.0(+) FADT */
 
-       local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2));
+       local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor));
        if (!local_fadt) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
-               if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
+               if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) {
+
                        /* Length is too short to be a V2.0 table */
 
                        ACPI_WARNING((AE_INFO,
@@ -538,11 +537,11 @@ acpi_status acpi_tb_convert_table_fadt(void)
        /* Global FADT pointer will point to the new common V2.0 FADT */
 
        acpi_gbl_FADT = local_fadt;
-       acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR);
+       acpi_gbl_FADT->length = sizeof(struct fadt_descriptor);
 
        /* Free the original table */
 
-       table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next;
+       table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_FADT].next;
        acpi_tb_delete_single_table(table_desc);
 
        /* Install the new table */
@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
        table_desc->pointer =
            ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT);
        table_desc->allocation = ACPI_MEM_ALLOCATED;
-       table_desc->length = sizeof(struct fadt_descriptor_rev2);
+       table_desc->length = sizeof(struct fadt_descriptor);
 
        /* Dump the entire FADT */
 
@@ -580,7 +579,7 @@ acpi_status acpi_tb_convert_table_fadt(void)
 acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
 {
 
-       ACPI_FUNCTION_TRACE("tb_build_common_facs");
+       ACPI_FUNCTION_TRACE(tb_build_common_facs);
 
        /* Absolute minimum length is 24, but the ACPI spec says 64 */
 
@@ -603,6 +602,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
        if ((acpi_gbl_RSDP->revision < 2) ||
            (acpi_gbl_FACS->length < 32) ||
            (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
+
                /* ACPI 1.0 FACS or short table or optional X_ field is zero */
 
                acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64,
index 09b4ee6dfd60a6e96e7aa2f1a50ba6c4cbabe47a..99eacceff56384c83710e848c8715e3d242953fe 100644 (file)
@@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address,
        acpi_status status;
        struct acpi_table_header header;
 
-       ACPI_FUNCTION_TRACE("tb_get_table");
+       ACPI_FUNCTION_TRACE(tb_get_table);
 
        /* Get the header in order to get signature and table size */
 
@@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address,
        acpi_status status = AE_OK;
        struct acpi_table_header *header = NULL;
 
-       ACPI_FUNCTION_TRACE("tb_get_table_header");
+       ACPI_FUNCTION_TRACE(tb_get_table_header);
 
        /*
         * Flags contains the current processor mode (Virtual or Physical
@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address,
                                            sizeof(struct acpi_table_header),
                                            (void *)&header);
                if (ACPI_FAILURE(status)) {
+                       ACPI_ERROR((AE_INFO,
+                                   "Could not map memory at %8.8X%8.8X for table header",
+                                   ACPI_FORMAT_UINT64(address->pointer.
+                                                      physical)));
                        return_ACPI_STATUS(status);
                }
 
@@ -198,7 +202,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("tb_get_table_body");
+       ACPI_FUNCTION_TRACE(tb_get_table_body);
 
        if (!table_info || !address) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address,
 
        status = acpi_tb_table_override(header, table_info);
        if (ACPI_SUCCESS(status)) {
+
                /* Table was overridden by the host OS */
 
                return_ACPI_STATUS(status);
@@ -241,7 +246,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
        acpi_status status;
        struct acpi_pointer address;
 
-       ACPI_FUNCTION_TRACE("tb_table_override");
+       ACPI_FUNCTION_TRACE(tb_table_override);
 
        /*
         * The OSL will examine the header and decide whether to override this
@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
         */
        status = acpi_os_table_override(header, &new_table);
        if (ACPI_FAILURE(status)) {
+
                /* Some severe error from the OSL, but we basically ignore it */
 
                ACPI_EXCEPTION((AE_INFO, status,
@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header,
        }
 
        if (!new_table) {
+
                /* No table override */
 
                return_ACPI_STATUS(AE_NO_ACPI_TABLES);
@@ -311,7 +318,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
        u8 allocation;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("tb_get_this_table");
+       ACPI_FUNCTION_TRACE(tb_get_this_table);
 
        /*
         * Flags contains the current processor mode (Virtual or Physical
@@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
 
                /* Pointer matches processor mode, copy the table to a new buffer */
 
-               full_table = ACPI_MEM_ALLOCATE(header->length);
+               full_table = ACPI_ALLOCATE(header->length);
                if (!full_table) {
                        ACPI_ERROR((AE_INFO,
                                    "Could not allocate table memory for [%4.4s] length %X",
@@ -376,11 +383,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
         * Validate checksum for _most_ tables,
         * even the ones whose signature we don't recognize
         */
-       if (table_info->type != ACPI_TABLE_FACS) {
+       if (table_info->type != ACPI_TABLE_ID_FACS) {
                status = acpi_tb_verify_table_checksum(full_table);
 
 #if (!ACPI_CHECKSUM_ABORT)
                if (ACPI_FAILURE(status)) {
+
                        /* Ignore the error if configuration says so */
 
                        status = AE_OK;
@@ -409,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
  *
  * PARAMETERS:  table_type      - one of the defined table types
  *              Instance        - Which table of this type
- *              table_ptr_loc   - pointer to location to place the pointer for
+ *              return_table    - pointer to location to place the pointer for
  *                                return
  *
  * RETURN:      Status
@@ -420,57 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address,
 
 acpi_status
 acpi_tb_get_table_ptr(acpi_table_type table_type,
-                     u32 instance, struct acpi_table_header **table_ptr_loc)
+                     u32 instance, struct acpi_table_header **return_table)
 {
        struct acpi_table_desc *table_desc;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("tb_get_table_ptr");
-
-       if (!acpi_gbl_DSDT) {
-               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
-       }
+       ACPI_FUNCTION_TRACE(tb_get_table_ptr);
 
-       if (table_type > ACPI_TABLE_MAX) {
+       if (table_type > ACPI_TABLE_ID_MAX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /*
-        * For all table types (Single/Multiple), the first
-        * instance is always in the list head.
-        */
-       if (instance == 1) {
-               /* Get the first */
-
-               *table_ptr_loc = NULL;
-               if (acpi_gbl_table_lists[table_type].next) {
-                       *table_ptr_loc =
-                           acpi_gbl_table_lists[table_type].next->pointer;
-               }
-               return_ACPI_STATUS(AE_OK);
-       }
-
-       /* Check for instance out of range */
+       /* Check for instance out of range of the current table count */
 
        if (instance > acpi_gbl_table_lists[table_type].count) {
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       /* Walk the list to get the desired table
-        * Since the if (Instance == 1) check above checked for the
-        * first table, setting table_desc equal to the .Next member
-        * is actually pointing to the second table.  Therefore, we
-        * need to walk from the 2nd table until we reach the Instance
-        * that the user is looking for and return its table pointer.
+       /*
+        * Walk the list to get the desired table
+        * Note: Instance is one-based
         */
        table_desc = acpi_gbl_table_lists[table_type].next;
-       for (i = 2; i < instance; i++) {
+       for (i = 1; i < instance; i++) {
                table_desc = table_desc->next;
        }
 
        /* We are now pointing to the requested table's descriptor */
 
-       *table_ptr_loc = table_desc->pointer;
-
+       *return_table = table_desc->pointer;
        return_ACPI_STATUS(AE_OK);
 }
index 134e5dce0bc172d03cf3d788cebb2cf4daa65a80..ad982112e4c6877889b42412218750cd4b03c28a 100644 (file)
@@ -77,7 +77,7 @@ acpi_tb_get_primary_table(struct acpi_pointer *address,
        acpi_status status;
        struct acpi_table_header header;
 
-       ACPI_FUNCTION_TRACE("tb_get_primary_table");
+       ACPI_FUNCTION_TRACE(tb_get_primary_table);
 
        /* Ignore a NULL address in the RSDT */
 
@@ -140,7 +140,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address,
        acpi_status status;
        struct acpi_table_header header;
 
-       ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature);
+       ACPI_FUNCTION_TRACE_STR(tb_get_secondary_table, signature);
 
        /* Get the header in order to match the signature */
 
@@ -151,7 +151,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address,
 
        /* Signature must match request */
 
-       if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) {
+       if (!ACPI_COMPARE_NAME(header.signature, signature)) {
                ACPI_ERROR((AE_INFO,
                            "Incorrect table signature - wanted [%s] found [%4.4s]",
                            signature, header.signature));
@@ -207,7 +207,7 @@ acpi_status acpi_tb_get_required_tables(void)
        struct acpi_table_desc table_info;
        struct acpi_pointer address;
 
-       ACPI_FUNCTION_TRACE("tb_get_required_tables");
+       ACPI_FUNCTION_TRACE(tb_get_required_tables);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
                          acpi_gbl_rsdt_table_count));
@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void)
         * any SSDTs.
         */
        for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
+
                /* Get the table address from the common internal XSDT */
 
                address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i];
@@ -305,6 +306,6 @@ acpi_status acpi_tb_get_required_tables(void)
 
        /* Always delete the RSDP mapping, we are done with it */
 
-       acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP);
+       acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_RSDP);
        return_ACPI_STATUS(status);
 }
index 7ffd0fddb4e55d1c7d75a192979d0657352915fc..7ca2df75bb11909522f6388628f8a1fb8febefdc 100644 (file)
@@ -73,17 +73,18 @@ acpi_tb_match_signature(char *signature,
 {
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("tb_match_signature");
+       ACPI_FUNCTION_TRACE(tb_match_signature);
 
        /* Search for a signature match among the known table types */
 
-       for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
+       for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
                if (!(acpi_gbl_table_data[i].flags & search_type)) {
                        continue;
                }
 
                if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
                                  acpi_gbl_table_data[i].sig_length)) {
+
                        /* Found a signature match, return index if requested */
 
                        if (table_info) {
@@ -122,7 +123,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("tb_install_table");
+       ACPI_FUNCTION_TRACE(tb_install_table);
 
        /* Lock tables while installing */
 
@@ -187,7 +188,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
        struct acpi_table_header *table_header;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("tb_recognize_table");
+       ACPI_FUNCTION_TRACE(tb_recognize_table);
 
        /* Ensure that we have a valid table pointer */
 
@@ -218,7 +219,6 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
        /* Return the table type and length via the info struct */
 
        table_info->length = (acpi_size) table_header->length;
-
        return_ACPI_STATUS(status);
 }
 
@@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
        struct acpi_table_desc *table_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type);
+       ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type);
 
        /* Allocate a descriptor for this table */
 
-       table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc));
+       table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc));
        if (!table_desc) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
                 * at this location, so return an error.
                 */
                if (list_head->next) {
-                       ACPI_MEM_FREE(table_desc);
+                       ACPI_FREE(table_desc);
                        return_ACPI_STATUS(AE_ALREADY_EXISTS);
                }
 
@@ -312,15 +312,14 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
 
        /* Finish initialization of the table descriptor */
 
+       table_desc->loaded_into_namespace = FALSE;
        table_desc->type = (u8) table_type;
        table_desc->pointer = table_info->pointer;
        table_desc->length = table_info->length;
        table_desc->allocation = table_info->allocation;
        table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
-           table_desc->aml_length = (u32) (table_desc->length -
-                                           (u32) sizeof(struct
-                                                        acpi_table_header));
-       table_desc->loaded_into_namespace = FALSE;
+           table_desc->aml_length = (u32)
+           (table_desc->length - (u32) sizeof(struct acpi_table_header));
 
        /*
         * Set the appropriate global pointer (if there is one) to point to the
@@ -335,7 +334,6 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type,
 
        table_info->owner_id = table_desc->owner_id;
        table_info->installed_desc = table_desc;
-
        return_ACPI_STATUS(AE_OK);
 }
 
@@ -359,7 +357,7 @@ void acpi_tb_delete_all_tables(void)
         * Free memory allocated for ACPI tables
         * Memory can either be mapped or allocated
         */
-       for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) {
+       for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) {
                acpi_tb_delete_tables_by_type(type);
        }
 }
@@ -383,9 +381,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type)
        u32 count;
        u32 i;
 
-       ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type);
+       ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type);
 
-       if (type > ACPI_TABLE_MAX) {
+       if (type > ACPI_TABLE_ID_MAX) {
                return_VOID;
        }
 
@@ -396,28 +394,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type)
        /* Clear the appropriate "typed" global table pointer */
 
        switch (type) {
-       case ACPI_TABLE_RSDP:
+       case ACPI_TABLE_ID_RSDP:
                acpi_gbl_RSDP = NULL;
                break;
 
-       case ACPI_TABLE_DSDT:
+       case ACPI_TABLE_ID_DSDT:
                acpi_gbl_DSDT = NULL;
                break;
 
-       case ACPI_TABLE_FADT:
+       case ACPI_TABLE_ID_FADT:
                acpi_gbl_FADT = NULL;
                break;
 
-       case ACPI_TABLE_FACS:
+       case ACPI_TABLE_ID_FACS:
                acpi_gbl_FACS = NULL;
                break;
 
-       case ACPI_TABLE_XSDT:
+       case ACPI_TABLE_ID_XSDT:
                acpi_gbl_XSDT = NULL;
                break;
 
-       case ACPI_TABLE_SSDT:
-       case ACPI_TABLE_PSDT:
+       case ACPI_TABLE_ID_SSDT:
+       case ACPI_TABLE_ID_PSDT:
        default:
                break;
        }
@@ -471,7 +469,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc)
 
        case ACPI_MEM_ALLOCATED:
 
-               ACPI_MEM_FREE(table_desc->pointer);
+               ACPI_FREE(table_desc->pointer);
                break;
 
        case ACPI_MEM_MAPPED:
@@ -503,7 +501,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
 {
        struct acpi_table_desc *next_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc);
+       ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc);
 
        if (!table_desc) {
                return_PTR(NULL);
@@ -530,7 +528,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
        /* Free the table descriptor */
 
        next_desc = table_desc->next;
-       ACPI_MEM_FREE(table_desc);
+       ACPI_FREE(table_desc);
 
        /* Return pointer to the next descriptor */
 
index 4d308220225d216b8786f32d35ab34b83a4f6b59..abcb08c2592ae3f5ca128dfb4d60debd6f76ac9a 100644 (file)
@@ -64,7 +64,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
        acpi_status status;
        struct rsdp_descriptor *rsdp;
 
-       ACPI_FUNCTION_TRACE("tb_verify_rsdp");
+       ACPI_FUNCTION_TRACE(tb_verify_rsdp);
 
        switch (address->pointer_type) {
        case ACPI_LOGICAL_POINTER:
@@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
                 */
                status = acpi_os_map_memory(address->pointer.physical,
                                            sizeof(struct rsdp_descriptor),
-                                           (void *)&rsdp);
+                                           ACPI_CAST_PTR(void, &rsdp));
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
@@ -95,15 +95,20 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
                goto cleanup;
        }
 
-       /* The RSDP supplied is OK */
+       /* RSDP is ok. Init the table info */
 
        table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp);
        table_info.length = sizeof(struct rsdp_descriptor);
-       table_info.allocation = ACPI_MEM_MAPPED;
+
+       if (address->pointer_type == ACPI_PHYSICAL_POINTER) {
+               table_info.allocation = ACPI_MEM_MAPPED;
+       } else {
+               table_info.allocation = ACPI_MEM_NOT_ALLOCATED;
+       }
 
        /* Save the table pointers and allocation info */
 
-       status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info);
+       status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_RSDP, &table_info);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
@@ -174,22 +179,20 @@ void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address)
 
 acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
 {
-       int no_match;
+       char *signature;
 
        ACPI_FUNCTION_ENTRY();
 
-       /*
-        * Search for appropriate signature, RSDT or XSDT
-        */
+       /* Search for appropriate signature, RSDT or XSDT */
+
        if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
-               no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG,
-                                       sizeof(RSDT_SIG) - 1);
+               signature = RSDT_SIG;
        } else {
-               no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG,
-                                       sizeof(XSDT_SIG) - 1);
+               signature = XSDT_SIG;
        }
 
-       if (no_match) {
+       if (!ACPI_COMPARE_NAME(table_ptr->signature, signature)) {
+
                /* Invalid RSDT or XSDT signature */
 
                ACPI_ERROR((AE_INFO,
@@ -198,10 +201,8 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
                ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20);
 
                ACPI_ERROR((AE_INFO,
-                           "RSDT/XSDT signature at %X (%p) is invalid",
-                           acpi_gbl_RSDP->rsdt_physical_address,
-                           (void *)(acpi_native_uint) acpi_gbl_RSDP->
-                           rsdt_physical_address));
+                           "RSDT/XSDT signature at %X is invalid",
+                           acpi_gbl_RSDP->rsdt_physical_address));
 
                if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                        ACPI_ERROR((AE_INFO, "Looking for RSDT"));
@@ -234,13 +235,13 @@ acpi_status acpi_tb_get_table_rsdt(void)
        acpi_status status;
        struct acpi_pointer address;
 
-       ACPI_FUNCTION_TRACE("tb_get_table_rsdt");
+       ACPI_FUNCTION_TRACE(tb_get_table_rsdt);
 
        /* Get the RSDT/XSDT via the RSDP */
 
        acpi_tb_get_rsdt_address(&address);
 
-       table_info.type = ACPI_TABLE_XSDT;
+       table_info.type = ACPI_TABLE_ID_XSDT;
        status = acpi_tb_get_table(&address, &table_info);
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status,
@@ -274,12 +275,13 @@ acpi_status acpi_tb_get_table_rsdt(void)
 
        /* Save the table pointers and allocation info */
 
-       status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info);
+       status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
-       acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer);
+       acpi_gbl_XSDT =
+           ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
        return_ACPI_STATUS(status);
index bc571592f087e784d93cca093e9a1f50472a0322..209a401801e3aba9ad3715247c9efe0cc58ca59c 100644 (file)
@@ -71,7 +71,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
 {
        struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_TRACE("tb_is_table_installed");
+       ACPI_FUNCTION_TRACE(tb_is_table_installed);
 
        /* Get the list descriptor and first table descriptor */
 
@@ -96,10 +96,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
                    (!ACPI_MEMCMP
                     (table_desc->pointer, new_table_desc->pointer,
                      new_table_desc->pointer->length))) {
+
                        /* Match: this table is already installed */
 
                        ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
-                                         "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
+                                         "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n",
                                          new_table_desc->pointer->signature,
                                          new_table_desc->pointer->revision,
                                          new_table_desc->pointer->
@@ -159,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
        ACPI_MOVE_32_TO_32(&signature, table_header->signature);
        if (!acpi_ut_valid_acpi_name(signature)) {
-               ACPI_ERROR((AE_INFO,
-                           "Table signature at %p [%p] has invalid characters",
-                           table_header, &signature));
-
-               ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]",
-                             ACPI_CAST_PTR(char, &signature)));
+               ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X",
+                           signature));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
@@ -175,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
        if (table_header->length < sizeof(struct acpi_table_header)) {
                ACPI_ERROR((AE_INFO,
-                           "Invalid length in table header %p name %4.4s",
-                           table_header, (char *)&signature));
-
-               ACPI_WARNING((AE_INFO,
-                             "Invalid table header length (0x%X) found",
-                             (u32) table_header->length));
+                           "Invalid length 0x%X in table with signature %4.4s",
+                           (u32) table_header->length,
+                           ACPI_CAST_PTR(char, &signature)));
 
                ACPI_DUMP_BUFFER(table_header,
                                 sizeof(struct acpi_table_header));
@@ -192,72 +186,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_tb_verify_table_checksum
+ * FUNCTION:    acpi_tb_sum_table
  *
- * PARAMETERS:  *table_header           - ACPI table to verify
+ * PARAMETERS:  Buffer              - Buffer to sum
+ *              Length              - Size of the buffer
  *
- * RETURN:      8 bit checksum of table
+ * RETURN:      8 bit sum of buffer
  *
- * DESCRIPTION: Does an 8 bit checksum of table and returns status.  A correct
- *              table should have a checksum of 0.
+ * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it.
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
+u8 acpi_tb_sum_table(void *buffer, u32 length)
+{
+       acpi_native_uint i;
+       u8 sum = 0;
+
+       if (!buffer || !length) {
+               return (0);
+       }
+
+       for (i = 0; i < length; i++) {
+               sum = (u8) (sum + ((u8 *) buffer)[i]);
+       }
+       return (sum);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_generate_checksum
+ *
+ * PARAMETERS:  Table               - Pointer to a valid ACPI table (with a
+ *                                    standard ACPI header)
+ *
+ * RETURN:      8 bit checksum of buffer
+ *
+ * DESCRIPTION: Computes an 8 bit checksum of the table.
+ *
+ ******************************************************************************/
+
+u8 acpi_tb_generate_checksum(struct acpi_table_header * table)
 {
        u8 checksum;
-       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("tb_verify_table_checksum");
+       /* Sum the entire table as-is */
 
-       /* Compute the checksum on the table */
+       checksum = acpi_tb_sum_table(table, table->length);
 
-       checksum =
-           acpi_tb_generate_checksum(table_header, table_header->length);
+       /* Subtract off the existing checksum value in the table */
 
-       /* Return the appropriate exception */
+       checksum = (u8) (checksum - table->checksum);
 
-       if (checksum) {
-               ACPI_WARNING((AE_INFO,
-                             "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)",
-                             table_header->signature,
-                             (u32) table_header->checksum, (u32) checksum));
+       /* Compute the final checksum */
 
-               status = AE_BAD_CHECKSUM;
-       }
-       return_ACPI_STATUS(status);
+       checksum = (u8) (0 - checksum);
+       return (checksum);
 }
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_tb_generate_checksum
+ * FUNCTION:    acpi_tb_set_checksum
  *
- * PARAMETERS:  Buffer              - Buffer to checksum
- *              Length              - Size of the buffer
+ * PARAMETERS:  Table               - Pointer to a valid ACPI table (with a
+ *                                    standard ACPI header)
  *
- * RETURN:      8 bit checksum of buffer
+ * RETURN:      None. Sets the table checksum field
  *
- * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
+ * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the
+ *              checksum into the table header.
  *
  ******************************************************************************/
 
-u8 acpi_tb_generate_checksum(void *buffer, u32 length)
+void acpi_tb_set_checksum(struct acpi_table_header *table)
 {
-       u8 *end_buffer;
-       u8 *rover;
-       u8 sum = 0;
 
-       if (buffer && length) {
-               /*  Buffer and Length are valid   */
+       table->checksum = acpi_tb_generate_checksum(table);
+}
 
-               end_buffer = ACPI_ADD_PTR(u8, buffer, length);
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_verify_table_checksum
+ *
+ * PARAMETERS:  *table_header           - ACPI table to verify
+ *
+ * RETURN:      8 bit checksum of table
+ *
+ * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares
+ *              it to the existing checksum value.
+ *
+ ******************************************************************************/
 
-               for (rover = buffer; rover < end_buffer; rover++) {
-                       sum = (u8) (sum + *rover);
-               }
+acpi_status
+acpi_tb_verify_table_checksum(struct acpi_table_header *table_header)
+{
+       u8 checksum;
+
+       ACPI_FUNCTION_TRACE(tb_verify_table_checksum);
+
+       /* Compute the checksum on the table */
+
+       checksum = acpi_tb_generate_checksum(table_header);
+
+       /* Checksum ok? */
+
+       if (checksum == table_header->checksum) {
+               return_ACPI_STATUS(AE_OK);
        }
-       return (sum);
+
+       ACPI_WARNING((AE_INFO,
+                     "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X",
+                     table_header->signature, table_header->checksum,
+                     checksum));
+
+       return_ACPI_STATUS(AE_BAD_CHECKSUM);
 }
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
@@ -276,12 +317,12 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length)
 
 acpi_status
 acpi_tb_handle_to_object(u16 table_id,
-                        struct acpi_table_desc ** return_table_desc)
+                        struct acpi_table_desc **return_table_desc)
 {
        u32 i;
        struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_NAME("tb_handle_to_object");
+       ACPI_FUNCTION_NAME(tb_handle_to_object);
 
        for (i = 0; i < ACPI_TABLE_MAX; i++) {
                table_desc = acpi_gbl_table_lists[i].next;
@@ -295,7 +336,7 @@ acpi_tb_handle_to_object(u16 table_id,
                }
        }
 
-       ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id));
+       ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id));
        return (AE_BAD_PARAMETER);
 }
 #endif
index 9fe53c9d5b9ad4a78f30af8bfcd1cd35d1e30e8d..4e91f29848156d56ce70ac69dce507036bb746ed 100644 (file)
@@ -42,8 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/actables.h>
@@ -68,7 +66,7 @@ acpi_status acpi_load_tables(void)
        struct acpi_pointer rsdp_address;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_load_tables");
+       ACPI_FUNCTION_TRACE(acpi_load_tables);
 
        /* Get the RSDP */
 
@@ -123,6 +121,8 @@ acpi_status acpi_load_tables(void)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_load_tables)
+
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -139,14 +139,13 @@ acpi_status acpi_load_tables(void)
  *              is determined that the table is invalid, the call will fail.
  *
  ******************************************************************************/
-
 acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
 {
        acpi_status status;
        struct acpi_table_desc table_info;
        struct acpi_pointer address;
 
-       ACPI_FUNCTION_TRACE("acpi_load_table");
+       ACPI_FUNCTION_TRACE(acpi_load_table);
 
        if (!table_ptr) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -174,6 +173,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
        status = acpi_tb_install_table(&table_info);
        if (ACPI_FAILURE(status)) {
                if (status == AE_ALREADY_EXISTS) {
+
                        /* Table already exists, no error */
 
                        status = AE_OK;
@@ -188,12 +188,12 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
        /* Convert the table to common format if necessary */
 
        switch (table_info.type) {
-       case ACPI_TABLE_FADT:
+       case ACPI_TABLE_ID_FADT:
 
                status = acpi_tb_convert_table_fadt();
                break;
 
-       case ACPI_TABLE_FACS:
+       case ACPI_TABLE_ID_FACS:
 
                status = acpi_tb_build_common_facs(&table_info);
                break;
@@ -208,6 +208,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
        }
 
        if (ACPI_FAILURE(status)) {
+
                /* Uninstall table and free the buffer */
 
                (void)acpi_tb_uninstall_table(table_info.installed_desc);
@@ -216,6 +217,8 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_load_table)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_unload_table
@@ -227,16 +230,15 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
  * DESCRIPTION: This routine is used to force the unload of a table
  *
  ******************************************************************************/
-
 acpi_status acpi_unload_table(acpi_table_type table_type)
 {
        struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_TRACE("acpi_unload_table");
+       ACPI_FUNCTION_TRACE(acpi_unload_table);
 
        /* Parameter validation */
 
-       if (table_type > ACPI_TABLE_MAX) {
+       if (table_type > ACPI_TABLE_ID_MAX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -261,6 +263,8 @@ acpi_status acpi_unload_table(acpi_table_type table_type)
        return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_unload_table)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_table_header
@@ -281,7 +285,6 @@ acpi_status acpi_unload_table(acpi_table_type table_type)
  *              have a standard header and is fixed length.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_table_header(acpi_table_type table_type,
                      u32 instance, struct acpi_table_header *out_table_header)
@@ -289,16 +292,16 @@ acpi_get_table_header(acpi_table_type table_type,
        struct acpi_table_header *tbl_ptr;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_get_table_header");
+       ACPI_FUNCTION_TRACE(acpi_get_table_header);
 
        if ((instance == 0) ||
-           (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) {
+           (table_type == ACPI_TABLE_ID_RSDP) || (!out_table_header)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Check the table type and instance */
 
-       if ((table_type > ACPI_TABLE_MAX) ||
+       if ((table_type > ACPI_TABLE_ID_MAX) ||
            (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
             instance > 1)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -325,6 +328,7 @@ acpi_get_table_header(acpi_table_type table_type,
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_get_table_header)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
@@ -349,7 +353,6 @@ acpi_get_table_header(acpi_table_type table_type,
  *              a complete table including the header.
  *
  ******************************************************************************/
-
 acpi_status
 acpi_get_table(acpi_table_type table_type,
               u32 instance, struct acpi_buffer *ret_buffer)
@@ -358,7 +361,7 @@ acpi_get_table(acpi_table_type table_type,
        acpi_status status;
        acpi_size table_length;
 
-       ACPI_FUNCTION_TRACE("acpi_get_table");
+       ACPI_FUNCTION_TRACE(acpi_get_table);
 
        /* Parameter validation */
 
@@ -373,7 +376,7 @@ acpi_get_table(acpi_table_type table_type,
 
        /* Check the table type and instance */
 
-       if ((table_type > ACPI_TABLE_MAX) ||
+       if ((table_type > ACPI_TABLE_ID_MAX) ||
            (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
             instance > 1)) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -396,7 +399,8 @@ acpi_get_table(acpi_table_type table_type,
 
        /* Get the table length */
 
-       if (table_type == ACPI_TABLE_RSDP) {
+       if (table_type == ACPI_TABLE_ID_RSDP) {
+
                /* RSD PTR is the only "table" without a header */
 
                table_length = sizeof(struct rsdp_descriptor);
@@ -417,4 +421,4 @@ acpi_get_table(acpi_table_type table_type,
        return_ACPI_STATUS(AE_OK);
 }
 
-EXPORT_SYMBOL(acpi_get_table);
+ACPI_EXPORT_SYMBOL(acpi_get_table)
index a62db6af83c9139ad8ab02871862db6eeef9af90..da2648bbdbc013ea1de77775cf37e26671120ced 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
@@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
         *  The signature and checksum must both be correct
         */
        if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) {
+
                /* Nope, BAD Signature */
 
                return (AE_BAD_SIGNATURE);
@@ -82,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
 
        /* Check the standard checksum */
 
-       if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+       if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
                return (AE_BAD_CHECKSUM);
        }
 
        /* Check extended checksum if table version >= 2 */
 
        if ((rsdp->revision >= 2) &&
-           (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) !=
-            0)) {
+           (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) {
                return (AE_BAD_CHECKSUM);
        }
 
@@ -121,7 +119,7 @@ acpi_tb_find_table(char *signature,
        acpi_status status;
        struct acpi_table_header *table;
 
-       ACPI_FUNCTION_TRACE("tb_find_table");
+       ACPI_FUNCTION_TRACE(tb_find_table);
 
        /* Validate string lengths */
 
@@ -131,7 +129,7 @@ acpi_tb_find_table(char *signature,
                return_ACPI_STATUS(AE_AML_STRING_LIMIT);
        }
 
-       if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) {
+       if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) {
                /*
                 * The DSDT pointer is contained in the FADT, not the RSDT.
                 * This code should suffice, because the only code that would perform
@@ -156,10 +154,12 @@ acpi_tb_find_table(char *signature,
 
        /* Check oem_id and oem_table_id */
 
-       if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id,
-                                      sizeof(table->oem_id))) ||
-           (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id,
-                                            sizeof(table->oem_table_id)))) {
+       if ((oem_id[0] &&
+            ACPI_STRNCMP(oem_id, table->oem_id,
+                         sizeof(table->oem_id))) ||
+           (oem_table_id[0] &&
+            ACPI_STRNCMP(oem_table_id, table->oem_table_id,
+                         sizeof(table->oem_table_id)))) {
                return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND);
        }
 
@@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature,
        u32 i;
        u32 j;
 
-       ACPI_FUNCTION_TRACE("acpi_get_firmware_table");
+       ACPI_FUNCTION_TRACE(acpi_get_firmware_table);
 
        /*
         * Ensure that at least the table manager is initialized.  We don't
@@ -217,6 +217,7 @@ acpi_get_firmware_table(acpi_string signature,
        /* Ensure that we have a RSDP */
 
        if (!acpi_gbl_RSDP) {
+
                /* Get the RSDP */
 
                status = acpi_os_get_root_pointer(flags, &address);
@@ -261,7 +262,7 @@ acpi_get_firmware_table(acpi_string signature,
 
        /* Get and validate the RSDT */
 
-       rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc));
+       rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc));
        if (!rsdt_info) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -278,13 +279,13 @@ acpi_get_firmware_table(acpi_string signature,
 
        /* Allocate a scratch table header and table descriptor */
 
-       header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header));
+       header = ACPI_ALLOCATE(sizeof(struct acpi_table_header));
        if (!header) {
                status = AE_NO_MEMORY;
                goto cleanup;
        }
 
-       table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc));
+       table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc));
        if (!table_info) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -308,12 +309,12 @@ acpi_get_firmware_table(acpi_string signature,
                if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
                        address.pointer.value =
                            (ACPI_CAST_PTR
-                            (RSDT_DESCRIPTOR,
+                            (struct rsdt_descriptor,
                              rsdt_info->pointer))->table_offset_entry[i];
                } else {
                        address.pointer.value =
                            (ACPI_CAST_PTR
-                            (XSDT_DESCRIPTOR,
+                            (struct xsdt_descriptor,
                              rsdt_info->pointer))->table_offset_entry[i];
                }
 
@@ -326,11 +327,13 @@ acpi_get_firmware_table(acpi_string signature,
 
                /* Compare table signatures and table instance */
 
-               if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) {
+               if (ACPI_COMPARE_NAME(header->signature, signature)) {
+
                        /* An instance of the table was found */
 
                        j++;
                        if (j >= instance) {
+
                                /* Found the correct instance, get the entire table */
 
                                status =
@@ -355,23 +358,21 @@ acpi_get_firmware_table(acpi_string signature,
                acpi_os_unmap_memory(rsdt_info->pointer,
                                     (acpi_size) rsdt_info->pointer->length);
        }
-       ACPI_MEM_FREE(rsdt_info);
+       ACPI_FREE(rsdt_info);
 
        if (header) {
-               ACPI_MEM_FREE(header);
+               ACPI_FREE(header);
        }
        if (table_info) {
-               ACPI_MEM_FREE(table_info);
+               ACPI_FREE(table_info);
        }
        return_ACPI_STATUS(status);
 }
 
-EXPORT_SYMBOL(acpi_get_firmware_table);
+ACPI_EXPORT_SYMBOL(acpi_get_firmware_table)
 
 /* TBD: Move to a new file */
-
 #if ACPI_MACHINE_WIDTH != 16
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_find_root_pointer
@@ -384,13 +385,12 @@ EXPORT_SYMBOL(acpi_get_firmware_table);
  * DESCRIPTION: Find the RSDP
  *
  ******************************************************************************/
-
 acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address)
 {
        struct acpi_table_desc table_info;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_find_root_pointer");
+       ACPI_FUNCTION_TRACE(acpi_find_root_pointer);
 
        /* Get the RSDP */
 
@@ -407,6 +407,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address)
        return_ACPI_STATUS(AE_OK);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_find_root_pointer)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_scan_memory_for_rsdp
@@ -419,14 +421,13 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address)
  * DESCRIPTION: Search a block of memory for the RSDP signature
  *
  ******************************************************************************/
-
 static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
 {
        acpi_status status;
        u8 *mem_rover;
        u8 *end_address;
 
-       ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp");
+       ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp);
 
        end_address = start_address + length;
 
@@ -434,12 +435,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
 
        for (mem_rover = start_address; mem_rover < end_address;
             mem_rover += ACPI_RSDP_SCAN_STEP) {
+
                /* The RSDP signature and checksum must both be correct */
 
                status =
                    acpi_tb_validate_rsdp(ACPI_CAST_PTR
                                          (struct rsdp_descriptor, mem_rover));
                if (ACPI_SUCCESS(status)) {
+
                        /* Sig and checksum valid, we have found a real RSDP */
 
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -469,10 +472,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
  *
  * RETURN:      Status, RSDP physical address
  *
- * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor
+ * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor
  *              pointer structure.  If it is found, set *RSDP to point to it.
  *
- *              NOTE1: The RSDp must be either in the first 1_k of the Extended
+ *              NOTE1: The RSDP must be either in the first 1_k of the Extended
  *              BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
  *              Only a 32-bit physical address is necessary.
  *
@@ -489,12 +492,13 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
        u32 physical_address;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("tb_find_rsdp");
+       ACPI_FUNCTION_TRACE(tb_find_rsdp);
 
        /*
         * Scan supports either logical addressing or physical addressing
         */
        if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
+
                /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
 
                status = acpi_os_map_memory((acpi_physical_address)
@@ -521,7 +525,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
 
                if (physical_address > 0x400) {
                        /*
-                        * 1b) Search EBDA paragraphs (EBDa is required to be a
+                        * 1b) Search EBDA paragraphs (EBDA is required to be a
                         *     minimum of 1_k length)
                         */
                        status = acpi_os_map_memory((acpi_physical_address)
@@ -542,10 +546,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
                        acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
 
                        if (mem_rover) {
+
                                /* Return the physical address */
 
                                physical_address +=
-                                   ACPI_PTR_DIFF(mem_rover, table_ptr);
+                                   (u32) ACPI_PTR_DIFF(mem_rover, table_ptr);
 
                                table_info->physical_address =
                                    (acpi_physical_address) physical_address;
@@ -576,11 +581,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
                acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
 
                if (mem_rover) {
+
                        /* Return the physical address */
 
-                       physical_address =
-                           ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover,
-                                                                    table_ptr);
+                       physical_address = (u32)
+                           (ACPI_HI_RSDP_WINDOW_BASE +
+                            ACPI_PTR_DIFF(mem_rover, table_ptr));
 
                        table_info->physical_address =
                            (acpi_physical_address) physical_address;
@@ -601,7 +607,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
 
                if (physical_address > 0x400) {
                        /*
-                        * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
+                        * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of
                         *     1_k length)
                         */
                        mem_rover =
@@ -609,6 +615,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
                                                         (physical_address),
                                                         ACPI_EBDA_WINDOW_SIZE);
                        if (mem_rover) {
+
                                /* Return the physical address */
 
                                table_info->physical_address =
@@ -624,6 +631,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
                                                 (ACPI_HI_RSDP_WINDOW_BASE),
                                                 ACPI_HI_RSDP_WINDOW_SIZE);
                if (mem_rover) {
+
                        /* Found it, return the physical address */
 
                        table_info->physical_address =
index 82389b1781300ccd606916600f839b9544010b9b..f003763de7bbb684ffa9b59f08d89975f2b9ada2 100644 (file)
@@ -684,8 +684,7 @@ static void acpi_thermal_run(unsigned long data)
 {
        struct acpi_thermal *tz = (struct acpi_thermal *)data;
        if (!tz->zombie)
-               acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
-                                           acpi_thermal_check, (void *)data);
+               acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data);
 }
 
 static void acpi_thermal_check(void *data)
@@ -942,8 +941,10 @@ acpi_thermal_write_trip_points(struct file *file,
        memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
 
        active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
-       if (!active)
+       if (!active) {
+               kfree(limit_string);
                return_VALUE(-ENOMEM);
+       }
 
        if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
index 03b0044974c22b3846472167e1e11768fc362aac..7940fc1bd69ef88a1900ea903647f26531c49264 100644 (file)
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utalloc")
 
-/* Local prototypes */
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
-
-static acpi_status
-acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
-                        acpi_size size,
-                        u8 alloc_type, u32 component, char *module, u32 line);
-
-static acpi_status
-acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
-                         u32 component, char *module, u32 line);
-
-static acpi_status
-acpi_ut_create_list(char *list_name,
-                   u16 object_size, struct acpi_memory_list **return_cache);
-#endif
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_caches
@@ -75,33 +57,23 @@ acpi_ut_create_list(char *list_name,
  * DESCRIPTION: Create all local caches
  *
  ******************************************************************************/
-
 acpi_status acpi_ut_create_caches(void)
 {
        acpi_status status;
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
-       /* Memory allocation lists */
-
-       status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
-       if (ACPI_FAILURE(status)) {
-               return (status);
-       }
+       /* Object Caches, for frequently used objects */
 
        status =
-           acpi_ut_create_list("Acpi-Namespace",
-                               sizeof(struct acpi_namespace_node),
-                               &acpi_gbl_ns_node_list);
+           acpi_os_create_cache("Acpi-Namespace",
+                                sizeof(struct acpi_namespace_node),
+                                ACPI_MAX_NAMESPACE_CACHE_DEPTH,
+                                &acpi_gbl_namespace_cache);
        if (ACPI_FAILURE(status)) {
                return (status);
        }
-#endif
-
-       /* Object Caches, for frequently used objects */
 
        status =
-           acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state),
+           acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state),
                                 ACPI_MAX_STATE_CACHE_DEPTH,
                                 &acpi_gbl_state_cache);
        if (ACPI_FAILURE(status)) {
@@ -109,7 +81,7 @@ acpi_status acpi_ut_create_caches(void)
        }
 
        status =
-           acpi_os_create_cache("acpi_parse",
+           acpi_os_create_cache("Acpi-Parse",
                                 sizeof(struct acpi_parse_obj_common),
                                 ACPI_MAX_PARSE_CACHE_DEPTH,
                                 &acpi_gbl_ps_node_cache);
@@ -118,7 +90,7 @@ acpi_status acpi_ut_create_caches(void)
        }
 
        status =
-           acpi_os_create_cache("acpi_parse_ext",
+           acpi_os_create_cache("Acpi-ParseExt",
                                 sizeof(struct acpi_parse_obj_named),
                                 ACPI_MAX_EXTPARSE_CACHE_DEPTH,
                                 &acpi_gbl_ps_node_ext_cache);
@@ -127,7 +99,7 @@ acpi_status acpi_ut_create_caches(void)
        }
 
        status =
-           acpi_os_create_cache("acpi_operand",
+           acpi_os_create_cache("Acpi-Operand",
                                 sizeof(union acpi_operand_object),
                                 ACPI_MAX_OBJECT_CACHE_DEPTH,
                                 &acpi_gbl_operand_cache);
@@ -135,6 +107,24 @@ acpi_status acpi_ut_create_caches(void)
                return (status);
        }
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+       /* Memory allocation lists */
+
+       status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       status =
+           acpi_ut_create_list("Acpi-Namespace",
+                               sizeof(struct acpi_namespace_node),
+                               &acpi_gbl_ns_node_list);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+#endif
+
        return (AE_OK);
 }
 
@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void)
 acpi_status acpi_ut_delete_caches(void)
 {
 
+       (void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
+       acpi_gbl_namespace_cache = NULL;
+
        (void)acpi_os_delete_cache(acpi_gbl_state_cache);
        acpi_gbl_state_cache = NULL;
 
@@ -165,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void)
        (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache);
        acpi_gbl_ps_node_ext_cache = NULL;
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+       /* Debug only - display leftover memory allocation, if any */
+
+       acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
+
+       /* Free memory lists */
+
+       acpi_os_free(acpi_gbl_global_list);
+       acpi_gbl_global_list = NULL;
+
+       acpi_os_free(acpi_gbl_ns_node_list);
+       acpi_gbl_ns_node_list = NULL;
+#endif
+
        return (AE_OK);
 }
 
@@ -252,7 +260,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
 
                /* Allocate a new buffer with local interface to allow tracking */
 
-               buffer->pointer = ACPI_MEM_CALLOCATE(required_length);
+               buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length);
                if (!buffer->pointer) {
                        return (AE_NO_MEMORY);
                }
@@ -288,7 +296,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
  *
  * RETURN:      Address of the allocated memory on success, NULL on failure.
  *
- * DESCRIPTION: The subsystem's equivalent of malloc.
+ * DESCRIPTION: Subsystem equivalent of malloc.
  *
  ******************************************************************************/
 
@@ -296,23 +304,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
 {
        void *allocation;
 
-       ACPI_FUNCTION_TRACE_U32("ut_allocate", size);
+       ACPI_FUNCTION_TRACE_U32(ut_allocate, size);
 
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               ACPI_ERROR((module, line,
-                           "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
+               ACPI_WARNING((module, line,
+                             "Attempt to allocate zero bytes, allocating 1 byte"));
                size = 1;
        }
 
        allocation = acpi_os_allocate(size);
        if (!allocation) {
+
                /* Report allocation error */
 
-               ACPI_ERROR((module, line,
-                           "ut_allocate: Could not allocate size %X",
-                           (u32) size));
+               ACPI_WARNING((module, line,
+                             "Could not allocate size %X", (u32) size));
 
                return_PTR(NULL);
        }
@@ -322,7 +330,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_callocate
+ * FUNCTION:    acpi_ut_allocate_zeroed
  *
  * PARAMETERS:  Size                - Size of the allocation
  *              Component           - Component type of caller
@@ -331,542 +339,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
  *
  * RETURN:      Address of the allocated memory on success, NULL on failure.
  *
- * DESCRIPTION: Subsystem equivalent of calloc.
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
  *
  ******************************************************************************/
 
-void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
+void *acpi_ut_allocate_zeroed(acpi_size size,
+                             u32 component, char *module, u32 line)
 {
        void *allocation;
 
-       ACPI_FUNCTION_TRACE_U32("ut_callocate", size);
-
-       /* Check for an inadvertent size of zero bytes */
-
-       if (!size) {
-               ACPI_ERROR((module, line,
-                           "Attempt to allocate zero bytes, allocating 1 byte"));
-               size = 1;
-       }
-
-       allocation = acpi_os_allocate(size);
-       if (!allocation) {
-               /* Report allocation error */
-
-               ACPI_ERROR((module, line,
-                           "Could not allocate size %X", (u32) size));
-               return_PTR(NULL);
-       }
-
-       /* Clear the memory block */
-
-       ACPI_MEMSET(allocation, 0, size);
-       return_PTR(allocation);
-}
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-/*
- * These procedures are used for tracking memory leaks in the subsystem, and
- * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
- *
- * Each memory allocation is tracked via a doubly linked list.  Each
- * element contains the caller's component, module name, function name, and
- * line number.  acpi_ut_allocate and acpi_ut_callocate call
- * acpi_ut_track_allocation to add an element to the list; deletion
- * occurs in the body of acpi_ut_free.
- */
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_list
- *
- * PARAMETERS:  cache_name      - Ascii name for the cache
- *              object_size     - Size of each cached object
- *              return_cache    - Where the new cache object is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a local memory list for tracking purposed
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_create_list(char *list_name,
-                   u16 object_size, struct acpi_memory_list **return_cache)
-{
-       struct acpi_memory_list *cache;
-
-       cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
-       if (!cache) {
-               return (AE_NO_MEMORY);
-       }
-
-       ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
-
-       cache->list_name = list_name;
-       cache->object_size = object_size;
-
-       *return_cache = cache;
-       return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_allocate_and_track
- *
- * PARAMETERS:  Size                - Size of the allocation
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *
- ******************************************************************************/
-
-void *acpi_ut_allocate_and_track(acpi_size size,
-                                u32 component, char *module, u32 line)
-{
-       struct acpi_debug_mem_block *allocation;
-       acpi_status status;
-
-       allocation =
-           acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
-                            component, module, line);
-       if (!allocation) {
-               return (NULL);
-       }
-
-       status = acpi_ut_track_allocation(allocation, size,
-                                         ACPI_MEM_MALLOC, component, module,
-                                         line);
-       if (ACPI_FAILURE(status)) {
-               acpi_os_free(allocation);
-               return (NULL);
-       }
-
-       acpi_gbl_global_list->total_allocated++;
-       acpi_gbl_global_list->current_total_size += (u32) size;
-
-       return ((void *)&allocation->user_space);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_callocate_and_track
- *
- * PARAMETERS:  Size                - Size of the allocation
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc.
- *
- ******************************************************************************/
-
-void *acpi_ut_callocate_and_track(acpi_size size,
-                                 u32 component, char *module, u32 line)
-{
-       struct acpi_debug_mem_block *allocation;
-       acpi_status status;
-
-       allocation =
-           acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
-                             component, module, line);
-       if (!allocation) {
-               /* Report allocation error */
-
-               ACPI_ERROR((module, line,
-                           "Could not allocate size %X", (u32) size));
-               return (NULL);
-       }
-
-       status = acpi_ut_track_allocation(allocation, size,
-                                         ACPI_MEM_CALLOC, component, module,
-                                         line);
-       if (ACPI_FAILURE(status)) {
-               acpi_os_free(allocation);
-               return (NULL);
-       }
-
-       acpi_gbl_global_list->total_allocated++;
-       acpi_gbl_global_list->current_total_size += (u32) size;
-
-       return ((void *)&allocation->user_space);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_free_and_track
- *
- * PARAMETERS:  Allocation          - Address of the memory to deallocate
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      None
- *
- * DESCRIPTION: Frees the memory at Allocation
- *
- ******************************************************************************/
-
-void
-acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
-{
-       struct acpi_debug_mem_block *debug_block;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
-
-       if (NULL == allocation) {
-               ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
-
-               return_VOID;
-       }
-
-       debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
-                                   (((char *)allocation) -
-                                    sizeof(struct acpi_debug_mem_header)));
-
-       acpi_gbl_global_list->total_freed++;
-       acpi_gbl_global_list->current_total_size -= debug_block->size;
-
-       status = acpi_ut_remove_allocation(debug_block,
-                                          component, module, line);
-       if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
-       }
-
-       acpi_os_free(debug_block);
-       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
-       return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_find_allocation
- *
- * PARAMETERS:  Allocation              - Address of allocated memory
- *
- * RETURN:      A list element if found; NULL otherwise.
- *
- * DESCRIPTION: Searches for an element in the global allocation tracking list.
- *
- ******************************************************************************/
-
-static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation)
-{
-       struct acpi_debug_mem_block *element;
-
        ACPI_FUNCTION_ENTRY();
 
-       element = acpi_gbl_global_list->list_head;
-
-       /* Search for the address. */
-
-       while (element) {
-               if (element == allocation) {
-                       return (element);
-               }
-
-               element = element->next;
-       }
-
-       return (NULL);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_track_allocation
- *
- * PARAMETERS:  Allocation          - Address of allocated memory
- *              Size                - Size of the allocation
- *              alloc_type          - MEM_MALLOC or MEM_CALLOC
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Inserts an element into the global allocation tracking list.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
-                        acpi_size size,
-                        u8 alloc_type, u32 component, char *module, u32 line)
-{
-       struct acpi_memory_list *mem_list;
-       struct acpi_debug_mem_block *element;
-       acpi_status status = AE_OK;
-
-       ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation);
-
-       mem_list = acpi_gbl_global_list;
-       status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       /*
-        * Search list for this address to make sure it is not already on the list.
-        * This will catch several kinds of problems.
-        */
-       element = acpi_ut_find_allocation(allocation);
-       if (element) {
-               ACPI_ERROR((AE_INFO,
-                           "ut_track_allocation: Allocation already present in list! (%p)",
-                           allocation));
-
-               ACPI_ERROR((AE_INFO, "Element %p Address %p",
-                           element, allocation));
-
-               goto unlock_and_exit;
-       }
-
-       /* Fill in the instance data. */
-
-       allocation->size = (u32) size;
-       allocation->alloc_type = alloc_type;
-       allocation->component = component;
-       allocation->line = line;
-
-       ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
-       allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
-
-       /* Insert at list head */
-
-       if (mem_list->list_head) {
-               ((struct acpi_debug_mem_block *)(mem_list->list_head))->
-                   previous = allocation;
-       }
-
-       allocation->next = mem_list->list_head;
-       allocation->previous = NULL;
-
-       mem_list->list_head = allocation;
-
-      unlock_and_exit:
-       status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_remove_allocation
- *
- * PARAMETERS:  Allocation          - Address of allocated memory
- *              Component           - Component type of caller
- *              Module              - Source file name of caller
- *              Line                - Line number of caller
- *
- * RETURN:
- *
- * DESCRIPTION: Deletes an element from the global allocation tracking list.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
-                         u32 component, char *module, u32 line)
-{
-       struct acpi_memory_list *mem_list;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE("ut_remove_allocation");
-
-       mem_list = acpi_gbl_global_list;
-       if (NULL == mem_list->list_head) {
-               /* No allocations! */
-
-               ACPI_ERROR((module, line,
-                           "Empty allocation list, nothing to free!"));
-
-               return_ACPI_STATUS(AE_OK);
-       }
-
-       status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       /* Unlink */
-
-       if (allocation->previous) {
-               (allocation->previous)->next = allocation->next;
-       } else {
-               mem_list->list_head = allocation->next;
-       }
-
-       if (allocation->next) {
-               (allocation->next)->previous = allocation->previous;
-       }
-
-       /* Mark the segment as deleted */
-
-       ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
-
-       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
-                         allocation->size));
+       allocation = acpi_ut_allocate(size, component, module, line);
+       if (allocation) {
 
-       status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_dump_allocation_info
- *
- * PARAMETERS:
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print some info about the outstanding allocations.
- *
- ******************************************************************************/
+               /* Clear the memory block */
 
-#ifdef ACPI_FUTURE_USAGE
-void acpi_ut_dump_allocation_info(void)
-{
-/*
-       struct acpi_memory_list         *mem_list;
-*/
-
-       ACPI_FUNCTION_TRACE("ut_dump_allocation_info");
-
-/*
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Current allocations",
-                         mem_list->current_count,
-                         ROUND_UP_TO_1K (mem_list->current_size)));
-
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
-                         mem_list->max_concurrent_count,
-                         ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
-
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
-                         running_object_count,
-                         ROUND_UP_TO_1K (running_object_size)));
-
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
-                         running_alloc_count,
-                         ROUND_UP_TO_1K (running_alloc_size)));
-
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Current Nodes",
-                         acpi_gbl_current_node_count,
-                         ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
-
-       ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
-                         ("%30s: %4d (%3d Kb)\n", "Max Nodes",
-                         acpi_gbl_max_concurrent_node_count,
-                         ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
-                                        sizeof (struct acpi_namespace_node)))));
-*/
-       return_VOID;
-}
-#endif                         /*  ACPI_FUTURE_USAGE  */
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_dump_allocations
- *
- * PARAMETERS:  Component           - Component(s) to dump info for.
- *              Module              - Module to dump info for.  NULL means all.
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print a list of all outstanding allocations.
- *
- ******************************************************************************/
-
-void acpi_ut_dump_allocations(u32 component, char *module)
-{
-       struct acpi_debug_mem_block *element;
-       union acpi_descriptor *descriptor;
-       u32 num_outstanding = 0;
-
-       ACPI_FUNCTION_TRACE("ut_dump_allocations");
-
-       /*
-        * Walk the allocation list.
-        */
-       if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
-               return;
+               ACPI_MEMSET(allocation, 0, size);
        }
 
-       element = acpi_gbl_global_list->list_head;
-       while (element) {
-               if ((element->component & component) &&
-                   ((module == NULL)
-                    || (0 == ACPI_STRCMP(module, element->module)))) {
-                       /* Ignore allocated objects that are in a cache */
-
-                       descriptor =
-                           ACPI_CAST_PTR(union acpi_descriptor,
-                                         &element->user_space);
-                       if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
-                               acpi_os_printf("%p Len %04X %9.9s-%d [%s] ",
-                                              descriptor, element->size,
-                                              element->module, element->line,
-                                              acpi_ut_get_descriptor_name
-                                              (descriptor));
-
-                               /* Most of the elements will be Operand objects. */
-
-                               switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) {
-                               case ACPI_DESC_TYPE_OPERAND:
-                                       acpi_os_printf("%12.12s R%hd",
-                                                      acpi_ut_get_type_name
-                                                      (descriptor->object.
-                                                       common.type),
-                                                      descriptor->object.
-                                                      common.reference_count);
-                                       break;
-
-                               case ACPI_DESC_TYPE_PARSER:
-                                       acpi_os_printf("aml_opcode %04hX",
-                                                      descriptor->op.asl.
-                                                      aml_opcode);
-                                       break;
-
-                               case ACPI_DESC_TYPE_NAMED:
-                                       acpi_os_printf("%4.4s",
-                                                      acpi_ut_get_node_name
-                                                      (&descriptor->node));
-                                       break;
-
-                               default:
-                                       break;
-                               }
-
-                               acpi_os_printf("\n");
-                               num_outstanding++;
-                       }
-               }
-               element = element->next;
-       }
-
-       (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
-
-       /* Print summary */
-
-       if (!num_outstanding) {
-               ACPI_INFO((AE_INFO, "No outstanding allocations"));
-       } else {
-               ACPI_ERROR((AE_INFO,
-                           "%d(%X) Outstanding allocations",
-                           num_outstanding, num_outstanding));
-       }
-
-       return_VOID;
+       return (allocation);
 }
-
-#endif                         /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
index 2177cb1ef2c43708c8af51e520bbdc8ad3e8a49f..56270a30718ae8b968430a527a20efc3b4087676 100644 (file)
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
        /* Walk the list of objects in this cache */
 
        while (cache->list_head) {
+
                /* Delete and unlink one cached state object */
 
                next = *(ACPI_CAST_INDIRECT_PTR(char,
                                                &(((char *)cache->
                                                   list_head)[cache->
                                                              link_offset])));
-               ACPI_MEM_FREE(cache->list_head);
+               ACPI_FREE(cache->list_head);
 
                cache->list_head = next;
                cache->current_depth--;
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
        /* If cache is full, just free this object */
 
        if (cache->current_depth >= cache->max_depth) {
-               ACPI_MEM_FREE(object);
+               ACPI_FREE(object);
                ACPI_MEM_TRACKING(cache->total_freed++);
        }
 
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
        acpi_status status;
        void *object;
 
-       ACPI_FUNCTION_NAME("os_acquire_object");
+       ACPI_FUNCTION_NAME(os_acquire_object);
 
        if (!cache) {
                return (NULL);
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
        /* Check the cache first */
 
        if (cache->list_head) {
+
                /* There is an object available, use it */
 
                object = cache->list_head;
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
                cache->current_depth--;
 
                ACPI_MEM_TRACKING(cache->hits++);
-               ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                                   "Object %p from %s cache\n",
-                                                   object, cache->list_name)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Object %p from %s cache\n", object,
+                                 cache->list_name));
 
                status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
                if (ACPI_FAILURE(status)) {
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
 
                ACPI_MEM_TRACKING(cache->total_allocated++);
 
-               /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+               /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
 
                status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
                if (ACPI_FAILURE(status)) {
                        return (NULL);
                }
 
-               object = ACPI_MEM_CALLOCATE(cache->object_size);
+               object = ACPI_ALLOCATE_ZEROED(cache->object_size);
                if (!object) {
                        return (NULL);
                }
index df2d32096b72363e6a46301b41bdec19ae85c3b5..5e1a80d1bc369a280837a257c420b0e324e2b07d 100644 (file)
@@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple");
+       ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple);
 
        *buffer_space_used = 0;
 
@@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
        acpi_status status;
        struct acpi_pkg_info info;
 
-       ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage");
+       ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage);
 
        /*
         * First package at head of the buffer
@@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject");
+       ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
 
        if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
                /*
@@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
 {
        union acpi_operand_object *internal_object;
 
-       ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple");
+       ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple);
 
        /*
         * Simple types supported are: String, Buffer, Integer
@@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
        case ACPI_TYPE_STRING:
 
                internal_object->string.pointer =
-                   ACPI_MEM_CALLOCATE((acpi_size) external_object->string.
-                                      length + 1);
+                   ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string.
+                                        length + 1);
                if (!internal_object->string.pointer) {
                        goto error_exit;
                }
@@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
        case ACPI_TYPE_BUFFER:
 
                internal_object->buffer.pointer =
-                   ACPI_MEM_CALLOCATE(external_object->buffer.length);
+                   ACPI_ALLOCATE_ZEROED(external_object->buffer.length);
                if (!internal_object->buffer.pointer) {
                        goto error_exit;
                }
@@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object,
        union acpi_operand_object *this_internal_obj;
        union acpi_object *this_external_obj;
 
-       ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage");
+       ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
 
        /*
         * First package at head of the buffer
@@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject");
+       ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
 
        if (external_object->type == ACPI_TYPE_PACKAGE) {
                /*
@@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
                if ((source_desc->buffer.pointer) &&
                    (source_desc->buffer.length)) {
                        dest_desc->buffer.pointer =
-                           ACPI_MEM_ALLOCATE(source_desc->buffer.length);
+                           ACPI_ALLOCATE(source_desc->buffer.length);
                        if (!dest_desc->buffer.pointer) {
                                return (AE_NO_MEMORY);
                        }
@@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
                 */
                if (source_desc->string.pointer) {
                        dest_desc->string.pointer =
-                           ACPI_MEM_ALLOCATE((acpi_size) source_desc->string.
-                                             length + 1);
+                           ACPI_ALLOCATE((acpi_size) source_desc->string.
+                                         length + 1);
                        if (!dest_desc->string.pointer) {
                                return (AE_NO_MEMORY);
                        }
@@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
                /*
                 * Create the object array
                 */
-               target_object->package.elements =
-                   ACPI_MEM_CALLOCATE(((acpi_size) source_object->package.
-                                       count + 1) * sizeof(void *));
+               target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *));
                if (!target_object->package.elements) {
                        status = AE_NO_MEMORY;
                        goto error_exit;
@@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage");
+       ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
 
        dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj);
        dest_obj->common.flags = source_obj->common.flags;
@@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
        /*
         * Create the object array and walk the source package tree
         */
-       dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size)
-                                                        source_obj->package.
-                                                        count +
-                                                        1) * sizeof(void *));
+       dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
+                                                          source_obj->package.
+                                                          count +
+                                                          1) * sizeof(void *));
        if (!dest_obj->package.elements) {
                ACPI_ERROR((AE_INFO, "Package allocation failure"));
                return_ACPI_STATUS(AE_NO_MEMORY);
@@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
                                           acpi_ut_copy_ielement_to_ielement,
                                           walk_state);
        if (ACPI_FAILURE(status)) {
+
                /* On failure, delete the destination package object */
 
                acpi_ut_remove_reference(dest_obj);
@@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject");
+       ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
 
        /* Create the top level object */
 
index 35f3d581e0346f1df55bd9a0f4db512bd3408033..5ec1cfcc611d2bc2203d2ccc9b1dc7f7dfc36442 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_UTILITIES
@@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
        /* All Function names are longer than 4 chars, check is safe */
 
        if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
+
                /* This is the case where the original source has not been modified */
 
                return (function_name + 4);
        }
 
        if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
+
                /* This is the case where the source has been 'linuxized' */
 
                return (function_name + 5);
@@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
                    const char *function_name,
                    char *module_name, u32 component_id, char *format, ...)
 {
-       u32 thread_id;
+       acpi_thread_id thread_id;
        va_list args;
 
        /*
@@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level,
         * Thread tracking and context switch notification
         */
        thread_id = acpi_os_get_thread_id();
-
        if (thread_id != acpi_gbl_prev_thread_id) {
                if (ACPI_LV_THREADS & acpi_dbg_level) {
                        acpi_os_printf
@@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
        acpi_os_vprintf(format, args);
 }
 
-EXPORT_SYMBOL(acpi_ut_debug_print);
+ACPI_EXPORT_SYMBOL(acpi_ut_debug_print)
 
 /*******************************************************************************
  *
@@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
  *              debug_print so that the same macros can be used.
  *
  ******************************************************************************/
-
 void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print_raw(u32 requested_debug_level,
                        u32 line_number,
@@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level,
        acpi_os_vprintf(format, args);
 }
 
-EXPORT_SYMBOL(acpi_ut_debug_print_raw);
+ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw)
 
 /*******************************************************************************
  *
@@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
  *              set in debug_level
  *
  ******************************************************************************/
-
 void
 acpi_ut_trace(u32 line_number,
              const char *function_name, char *module_name, u32 component_id)
@@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number,
                            component_id, "%s\n", acpi_gbl_fn_entry_str);
 }
 
-EXPORT_SYMBOL(acpi_ut_trace);
+ACPI_EXPORT_SYMBOL(acpi_ut_trace)
 
 /*******************************************************************************
  *
@@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace);
  *              set in debug_level
  *
  ******************************************************************************/
-
 void
 acpi_ut_trace_ptr(u32 line_number,
                  const char *function_name,
@@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number,
        acpi_gbl_nesting_level--;
 }
 
-EXPORT_SYMBOL(acpi_ut_exit);
+ACPI_EXPORT_SYMBOL(acpi_ut_exit)
 
 /*******************************************************************************
  *
@@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit);
  *              set in debug_level. Prints exit status also.
  *
  ******************************************************************************/
-
 void
 acpi_ut_status_exit(u32 line_number,
                    const char *function_name,
@@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number,
        acpi_gbl_nesting_level--;
 }
 
-EXPORT_SYMBOL(acpi_ut_status_exit);
+ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
 
 /*******************************************************************************
  *
@@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
  *              set in debug_level. Prints exit value also.
  *
  ******************************************************************************/
-
 void
 acpi_ut_value_exit(u32 line_number,
                   const char *function_name,
@@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number,
        acpi_gbl_nesting_level--;
 }
 
-EXPORT_SYMBOL(acpi_ut_value_exit);
+ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
 
 /*******************************************************************************
  *
@@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
  *              set in debug_level. Prints exit value also.
  *
  ******************************************************************************/
-
 void
 acpi_ut_ptr_exit(u32 line_number,
                 const char *function_name,
@@ -524,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number,
  *
  ******************************************************************************/
 
-void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
+void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
 {
        acpi_native_uint i = 0;
        acpi_native_uint j;
        u32 temp32;
        u8 buf_char;
 
-       /* Only dump the buffer if tracing is enabled */
-
-       if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
-             (component_id & acpi_dbg_layer))) {
-               return;
-       }
-
        if ((count < 4) || (count & 0x01)) {
                display = DB_BYTE_DISPLAY;
        }
@@ -545,6 +531,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
        /* Nasty little dump buffer routine! */
 
        while (i < count) {
+
                /* Print current offset */
 
                acpi_os_printf("%6.4X: ", (u32) i);
@@ -553,6 +540,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
 
                for (j = 0; j < 16;) {
                        if (i + j >= count) {
+
                                /* Dump fill spaces */
 
                                acpi_os_printf("%*s", ((display * 2) + 1), " ");
@@ -561,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
                        }
 
                        switch (display) {
+                       case DB_BYTE_DISPLAY:
                        default:        /* Default is BYTE display */
 
                                acpi_os_printf("%02X ", buffer[i + j]);
@@ -618,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
 
        return;
 }
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_dump_buffer
+ *
+ * PARAMETERS:  Buffer              - Buffer to dump
+ *              Count               - Amount to dump, in bytes
+ *              Display             - BYTE, WORD, DWORD, or QWORD display
+ *              component_iD        - Caller's component ID
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ******************************************************************************/
+
+void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
+{
+
+       /* Only dump the buffer if tracing is enabled */
+
+       if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
+             (component_id & acpi_dbg_layer))) {
+               return;
+       }
+
+       acpi_ut_dump_buffer2(buffer, count, display);
+}
index 1db9695b002927d9efb311bfe2b18626e769c455..67b9f325c6fae9036628c863a97b80bf8ddda66f 100644 (file)
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
        union acpi_operand_object *second_desc;
        union acpi_operand_object *next_desc;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
 
        if (!object) {
                return_VOID;
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                /* Free the actual string buffer */
 
                if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
+
                        /* But only if it is NOT a pointer into an ACPI table */
 
                        obj_pointer = object->string.pointer;
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                /* Free the actual buffer */
 
                if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
+
                        /* But only if it is NOT a pointer into an ACPI table */
 
                        obj_pointer = object->buffer.pointer;
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                         */
                        handler_desc = object->region.handler;
                        if (handler_desc) {
-                               if (handler_desc->address_space.
-                                   hflags &
+                               if (handler_desc->address_space.handler_flags &
                                    ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
-                                       obj_pointer =
-                                           second_desc->extra.region_context;
+
+                                       /* Deactivate region and free region context */
+
+                                       if (handler_desc->address_space.setup) {
+                                               (void)handler_desc->
+                                                   address_space.setup(object,
+                                                                       ACPI_REGION_DEACTIVATE,
+                                                                       handler_desc->
+                                                                       address_space.
+                                                                       context,
+                                                                       &second_desc->
+                                                                       extra.
+                                                                       region_context);
+                                       }
                                }
 
                                acpi_ut_remove_reference(handler_desc);
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
        if (obj_pointer) {
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
                                  "Deleting Object Subptr %p\n", obj_pointer));
-               ACPI_MEM_FREE(obj_pointer);
+               ACPI_FREE(obj_pointer);
        }
 
        /* Now the object can be safely deleted */
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
 {
        union acpi_operand_object **internal_obj;
 
-       ACPI_FUNCTION_TRACE("ut_delete_internal_object_list");
+       ACPI_FUNCTION_TRACE(ut_delete_internal_object_list);
 
        /* Walk the null-terminated internal list */
 
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
 
        /* Free the combined parameter pointer list and object array */
 
-       ACPI_MEM_FREE(obj_list);
+       ACPI_FREE(obj_list);
        return_VOID;
 }
 
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
        u16 count;
        u16 new_count;
 
-       ACPI_FUNCTION_NAME("ut_update_ref_count");
+       ACPI_FUNCTION_NAME(ut_update_ref_count);
 
        if (!object) {
                return;
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
        new_count = count;
 
        /*
-        * Perform the reference count action
-        * (increment, decrement, or force delete)
+        * Perform the reference count action (increment, decrement, force delete)
         */
        switch (action) {
-
        case REF_INCREMENT:
 
                new_count++;
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
                if (new_count == 0) {
                        acpi_ut_delete_internal_obj(object);
                }
-
                break;
 
        case REF_FORCE_DELETE:
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
         * (A deleted object will have a huge reference count)
         */
        if (count > ACPI_MAX_REFERENCE_COUNT) {
-
                ACPI_WARNING((AE_INFO,
-                             "Large Reference Count (%X) in object %p",
-                             count, object));
+                             "Large Reference Count (%X) in object %p", count,
+                             object));
        }
-
-       return;
 }
 
 /*******************************************************************************
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
  ******************************************************************************/
 
 acpi_status
-acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
+acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
 {
        acpi_status status = AE_OK;
        union acpi_generic_state *state_list = NULL;
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
        union acpi_generic_state *state;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object);
 
        while (object) {
+
                /* Make sure that this isn't a namespace handle */
 
                if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
 
                case ACPI_TYPE_REGION:
                default:
-                       break;  /* No subobjects */
+                       break;  /* No subobjects for all other types */
                }
 
                /*
-                * Now we can update the count in the main object.  This can only
+                * Now we can update the count in the main object. This can only
                 * happen after we update the sub-objects in case this causes the
                 * main object to be deleted.
                 */
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
 void acpi_ut_add_reference(union acpi_operand_object *object)
 {
 
-       ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object);
 
        /* Ensure that we have a valid object */
 
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object)
 void acpi_ut_remove_reference(union acpi_operand_object *object)
 {
 
-       ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object);
 
        /*
-        * Allow a NULL pointer to be passed in, just ignore it.  This saves
-        * each caller from having to check.  Also, ignore NS nodes.
+        * Allow a NULL pointer to be passed in, just ignore it. This saves
+        * each caller from having to check. Also, ignore NS nodes.
         *
         */
        if (!object ||
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
 
        /*
         * Decrement the reference count, and only actually delete the object
-        * if the reference count becomes 0.  (Must also decrement the ref count
+        * if the reference count becomes 0. (Must also decrement the ref count
         * of all subobjects!)
         */
        (void)acpi_ut_update_object_reference(object, REF_DECREMENT);
index 106cc97cb4af9c21815d13741bb4108cabdfad35..d6d7121583c0e96af0bee2f7222d4ab136e5ff28 100644 (file)
@@ -56,6 +56,34 @@ static acpi_status
 acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
                          struct acpi_compatible_id *one_cid);
 
+/*
+ * Strings supported by the _OSI predefined (internal) method.
+ */
+static const char *acpi_interfaces_supported[] = {
+       /* Operating System Vendor Strings */
+
+       "Linux",
+       "Windows 2000",
+       "Windows 2001",
+       "Windows 2001 SP0",
+       "Windows 2001 SP1",
+       "Windows 2001 SP2",
+       "Windows 2001 SP3",
+       "Windows 2001 SP4",
+       "Windows 2001.1",
+       "Windows 2001.1 SP1",   /* Added 03/2006 */
+       "Windows 2006",         /* Added 03/2006 */
+
+       /* Feature Group Strings */
+
+       "Extended Address Space Descriptor"
+           /*
+            * All "optional" feature group strings (features that are implemented
+            * by the host) should be implemented in the host version of
+            * acpi_os_validate_interface and should not be added here.
+            */
+};
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_osi_implementation
@@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Implementation of _OSI predefined control method
- *              Supported = _OSI (String)
+ * DESCRIPTION: Implementation of the _OSI predefined control method
  *
  ******************************************************************************/
 
 acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
 {
+       acpi_status status;
        union acpi_operand_object *string_desc;
        union acpi_operand_object *return_desc;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ut_osi_implementation");
+       ACPI_FUNCTION_TRACE(ut_osi_implementation);
 
        /* Validate the string input argument */
 
@@ -84,28 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
                return_ACPI_STATUS(AE_TYPE);
        }
 
-       /* Create a return object (Default value = 0) */
+       /* Create a return object */
 
        return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!return_desc) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       /* Compare input string to table of supported strings */
+       /* Default return value is SUPPORTED */
+
+       return_desc->integer.value = ACPI_UINT32_MAX;
+       walk_state->return_desc = return_desc;
+
+       /* Compare input string to static table of supported interfaces */
 
-       for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
-               if (!ACPI_STRCMP(string_desc->string.pointer,
-                                ACPI_CAST_PTR(char,
-                                              acpi_gbl_valid_osi_strings[i])))
-               {
-                       /* This string is supported */
+       for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
+               if (!ACPI_STRCMP
+                   (string_desc->string.pointer,
+                    acpi_interfaces_supported[i])) {
 
-                       return_desc->integer.value = 0xFFFFFFFF;
-                       break;
+                       /* The interface is supported */
+
+                       return_ACPI_STATUS(AE_CTRL_TERMINATE);
                }
        }
 
-       walk_state->return_desc = return_desc;
+       /*
+        * Did not match the string in the static table, call the host OSL to
+        * check for a match with one of the optional strings (such as
+        * "Module Device", "3.0 Thermal Model", etc.)
+        */
+       status = acpi_os_validate_interface(string_desc->string.pointer);
+       if (ACPI_SUCCESS(status)) {
+
+               /* The interface is supported */
+
+               return_ACPI_STATUS(AE_CTRL_TERMINATE);
+       }
+
+       /* The interface is not supported */
+
+       return_desc->integer.value = 0;
        return_ACPI_STATUS(AE_CTRL_TERMINATE);
 }
 
@@ -134,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
                        u32 expected_return_btypes,
                        union acpi_operand_object **return_desc)
 {
-       struct acpi_parameter_info info;
+       struct acpi_evaluate_info *info;
        acpi_status status;
        u32 return_btype;
 
-       ACPI_FUNCTION_TRACE("ut_evaluate_object");
+       ACPI_FUNCTION_TRACE(ut_evaluate_object);
 
-       info.node = prefix_node;
-       info.parameters = NULL;
-       info.parameter_type = ACPI_PARAM_ARGS;
+       /* Allocate the evaluation information block */
+
+       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       info->prefix_node = prefix_node;
+       info->pathname = path;
+       info->parameter_type = ACPI_PARAM_ARGS;
 
        /* Evaluate the object/method */
 
-       status = acpi_ns_evaluate_relative(path, &info);
+       status = acpi_ns_evaluate(info);
        if (ACPI_FAILURE(status)) {
                if (status == AE_NOT_FOUND) {
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -158,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
                                          prefix_node, path, status);
                }
 
-               return_ACPI_STATUS(status);
+               goto cleanup;
        }
 
        /* Did we get a return object? */
 
-       if (!info.return_object) {
+       if (!info->return_object) {
                if (expected_return_btypes) {
                        ACPI_ERROR_METHOD("No object was returned from",
                                          prefix_node, path, AE_NOT_EXIST);
 
-                       return_ACPI_STATUS(AE_NOT_EXIST);
+                       status = AE_NOT_EXIST;
                }
 
-               return_ACPI_STATUS(AE_OK);
+               goto cleanup;
        }
 
        /* Map the return object type to the bitmapped type */
 
-       switch (ACPI_GET_OBJECT_TYPE(info.return_object)) {
+       switch (ACPI_GET_OBJECT_TYPE(info->return_object)) {
        case ACPI_TYPE_INTEGER:
                return_btype = ACPI_BTYPE_INTEGER;
                break;
@@ -204,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
                 * happen frequently if the "implicit return" feature is enabled.
                 * Just delete the return object and return AE_OK.
                 */
-               acpi_ut_remove_reference(info.return_object);
-               return_ACPI_STATUS(AE_OK);
+               acpi_ut_remove_reference(info->return_object);
+               goto cleanup;
        }
 
        /* Is the return object one of the expected types? */
@@ -217,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
                ACPI_ERROR((AE_INFO,
                            "Type returned from %s was incorrect: %s, expected Btypes: %X",
                            path,
-                           acpi_ut_get_object_type_name(info.return_object),
+                           acpi_ut_get_object_type_name(info->return_object),
                            expected_return_btypes));
 
                /* On error exit, we must delete the return object */
 
-               acpi_ut_remove_reference(info.return_object);
-               return_ACPI_STATUS(AE_TYPE);
+               acpi_ut_remove_reference(info->return_object);
+               status = AE_TYPE;
+               goto cleanup;
        }
 
        /* Object type is OK, return it */
 
-       *return_desc = info.return_object;
-       return_ACPI_STATUS(AE_OK);
+       *return_desc = info->return_object;
+
+      cleanup:
+       ACPI_FREE(info);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -257,7 +315,7 @@ acpi_ut_evaluate_numeric_object(char *object_name,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object");
+       ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object);
 
        status = acpi_ut_evaluate_object(device_node, object_name,
                                         ACPI_BTYPE_INTEGER, &obj_desc);
@@ -333,7 +391,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_execute_HID");
+       ACPI_FUNCTION_TRACE(ut_execute_HID);
 
        status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
                                         ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
@@ -343,6 +401,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
        }
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
+
                /* Convert the Numeric HID to string */
 
                acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
@@ -436,7 +495,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
        struct acpi_compatible_id_list *cid_list;
        acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE("ut_execute_CID");
+       ACPI_FUNCTION_TRACE(ut_execute_CID);
 
        /* Evaluate the _CID method for this device */
 
@@ -459,7 +518,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
        size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
                sizeof(struct acpi_compatible_id_list));
 
-       cid_list = ACPI_MEM_CALLOCATE((acpi_size) size);
+       cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
        if (!cid_list) {
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
@@ -479,6 +538,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
        /* The _CID object can be either a single CID or a package (list) of CIDs */
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
+
                /* Translate each package element */
 
                for (i = 0; i < count; i++) {
@@ -499,7 +559,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
        /* Cleanup on error */
 
        if (ACPI_FAILURE(status)) {
-               ACPI_MEM_FREE(cid_list);
+               ACPI_FREE(cid_list);
        } else {
                *return_cid_list = cid_list;
        }
@@ -533,7 +593,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_execute_UID");
+       ACPI_FUNCTION_TRACE(ut_execute_UID);
 
        status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
                                         ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
@@ -543,6 +603,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
        }
 
        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
+
                /* Convert the Numeric UID to string */
 
                acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
@@ -582,7 +643,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
        union acpi_operand_object *obj_desc;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_execute_STA");
+       ACPI_FUNCTION_TRACE(ut_execute_STA);
 
        status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
                                         ACPI_BTYPE_INTEGER, &obj_desc);
@@ -632,7 +693,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
        acpi_status status;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ut_execute_Sxds");
+       ACPI_FUNCTION_TRACE(ut_execute_sxds);
 
        for (i = 0; i < 4; i++) {
                highest[i] = 0xFF;
index ffd13383a325ecae8ed8ae884187860b6566ce33..e5999c65c0b8c851fc021e39650c0de01854a74d 100644 (file)
@@ -43,7 +43,6 @@
 
 #define DEFINE_ACPI_GLOBALS
 
-#include <linux/module.h>
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
@@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_status status)
        }
 
        if (!exception) {
+
                /* Exception code was not recognized */
 
                ACPI_ERROR((AE_INFO,
@@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_status status)
 
 /* Debug switch - level and trace mask */
 u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
-EXPORT_SYMBOL(acpi_dbg_level);
 
 /* Debug switch - layer (component) mask */
 
 u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
-EXPORT_SYMBOL(acpi_dbg_layer);
 u32 acpi_gbl_nesting_level = 0;
 
 /* Debugger globals */
@@ -183,28 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = {
        "_S4D"
 };
 
-/*
- * Strings supported by the _OSI predefined (internal) method.
- * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
- */
-const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
-       /* Operating System Vendor Strings */
-
-       "Linux",
-       "Windows 2000",
-       "Windows 2001",
-       "Windows 2001.1",
-       "Windows 2001 SP0",
-       "Windows 2001 SP1",
-       "Windows 2001 SP2",
-       "Windows 2001 SP3",
-       "Windows 2001 SP4",
-
-       /* Feature Group Strings */
-
-       "Extended Address Space Descriptor"
-};
-
 /*******************************************************************************
  *
  * Namespace globals
@@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
  *
  ******************************************************************************/
 
-struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
+struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
 
-struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = {
+struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = {
        /***********    Name,   Signature, Global typed pointer     Signature size,      Type                  How many allowed?,    Contains valid AML? */
 
        /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
@@ -467,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
 /* Region type decoding */
 
 const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
-/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
        "SystemMemory",
        "SystemIO",
        "PCI_Config",
@@ -476,16 +451,15 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
        "CMOS",
        "PCIBARTarget",
        "DataTable"
-/*! [End] no source code translation !*/
 };
 
 char *acpi_ut_get_region_name(u8 space_id)
 {
 
        if (space_id >= ACPI_USER_REGION_BEGIN) {
-               return ("user_defined_region");
+               return ("UserDefinedRegion");
        } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
-               return ("invalid_space_id");
+               return ("InvalidSpaceId");
        }
 
        return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
@@ -506,20 +480,18 @@ char *acpi_ut_get_region_name(u8 space_id)
 /* Event type decoding */
 
 static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
-/*! [Begin] no source code translation (keep these strings as-is) */
        "PM_Timer",
        "GlobalLock",
        "PowerButton",
        "SleepButton",
        "RealTimeClock",
-/*! [End] no source code translation !*/
 };
 
 char *acpi_ut_get_event_name(u32 event_id)
 {
 
        if (event_id > ACPI_EVENT_MAX) {
-               return ("invalid_event_iD");
+               return ("InvalidEventID");
        }
 
        return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
@@ -550,7 +522,6 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
 /* Printable names of the ACPI object types */
 
 static const char *acpi_gbl_ns_type_names[] = {
-/*! [Begin] no source code translation (keep these strings as-is) */
        /* 00 */ "Untyped",
        /* 01 */ "Integer",
        /* 02 */ "String",
@@ -582,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = {
        /* 28 */ "Extra",
        /* 29 */ "Data",
        /* 30 */ "Invalid"
-/*! [End] no source code translation !*/
 };
 
 char *acpi_ut_get_type_name(acpi_object_type type)
@@ -635,14 +605,14 @@ char *acpi_ut_get_node_name(void *object)
 
        /* Descriptor must be a namespace node */
 
-       if (node->descriptor != ACPI_DESC_TYPE_NAMED) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
                return ("####");
        }
 
        /* Name must be a valid ACPI name */
 
        if (!acpi_ut_valid_acpi_name(node->name.integer)) {
-               return ("????");
+               node->name.integer = acpi_ut_repair_name(node->name.integer);
        }
 
        /* Return the name */
@@ -665,7 +635,6 @@ char *acpi_ut_get_node_name(void *object)
 /* Printable names of object descriptor types */
 
 static const char *acpi_gbl_desc_type_names[] = {
-/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
        /* 00 */ "Invalid",
        /* 01 */ "Cached",
        /* 02 */ "State-Generic",
@@ -682,7 +651,6 @@ static const char *acpi_gbl_desc_type_names[] = {
        /* 13 */ "Parser",
        /* 14 */ "Operand",
        /* 15 */ "Node"
-/*! [End] no source code translation !*/
 };
 
 char *acpi_ut_get_descriptor_name(void *object)
@@ -723,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object)
 char *acpi_ut_get_mutex_name(u32 mutex_id)
 {
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return ("Invalid Mutex ID");
        }
 
@@ -747,6 +715,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
 {
 
        if (type > ACPI_TYPE_LOCAL_MAX) {
+
                /* Note: Assumes all TYPEs are contiguous (external/local) */
 
                return (FALSE);
@@ -773,7 +742,7 @@ void acpi_ut_init_globals(void)
        acpi_status status;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ut_init_globals");
+       ACPI_FUNCTION_TRACE(ut_init_globals);
 
        /* Create all memory caches */
 
@@ -784,14 +753,14 @@ void acpi_ut_init_globals(void)
 
        /* ACPI table structure */
 
-       for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
+       for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
                acpi_gbl_table_lists[i].next = NULL;
                acpi_gbl_table_lists[i].count = 0;
        }
 
        /* Mutex locked flags */
 
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                acpi_gbl_mutex_info[i].mutex = NULL;
                acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
                acpi_gbl_mutex_info[i].use_count = 0;
@@ -856,7 +825,7 @@ void acpi_ut_init_globals(void)
 
        acpi_gbl_root_node = NULL;
        acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
-       acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
+       acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
        acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
        acpi_gbl_root_node_struct.child = NULL;
        acpi_gbl_root_node_struct.peer = NULL;
@@ -869,3 +838,6 @@ void acpi_ut_init_globals(void)
 
        return_VOID;
 }
+
+ACPI_EXPORT_SYMBOL(acpi_dbg_level)
+ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
index ba771b4f39bcde6b64b005705bf4ab4f628d9f8b..ff76055eb7d61a3e1b999b60e19d2de2507a1d23 100644 (file)
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit")
 
 /* Local prototypes */
 static void
-acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset);
+acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset);
 
 static void acpi_ut_terminate(void);
 
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void);
  ******************************************************************************/
 
 static void
-acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
+acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
 {
 
        ACPI_WARNING((AE_INFO,
                      "Invalid FADT value %s=%X at offset %X FADT=%p",
-                     register_name, value, (u32) offset, acpi_gbl_FADT));
+                     register_name, value, offset, acpi_gbl_FADT));
 }
 
 /******************************************************************************
@@ -176,7 +176,7 @@ static void acpi_ut_terminate(void)
        struct acpi_gpe_xrupt_info *gpe_xrupt_info;
        struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
 
-       ACPI_FUNCTION_TRACE("ut_terminate");
+       ACPI_FUNCTION_TRACE(ut_terminate);
 
        /* Free global tables, etc. */
        /* Free global GPE blocks and related info structures */
@@ -186,14 +186,14 @@ static void acpi_ut_terminate(void)
                gpe_block = gpe_xrupt_info->gpe_block_list_head;
                while (gpe_block) {
                        next_gpe_block = gpe_block->next;
-                       ACPI_MEM_FREE(gpe_block->event_info);
-                       ACPI_MEM_FREE(gpe_block->register_info);
-                       ACPI_MEM_FREE(gpe_block);
+                       ACPI_FREE(gpe_block->event_info);
+                       ACPI_FREE(gpe_block->register_info);
+                       ACPI_FREE(gpe_block);
 
                        gpe_block = next_gpe_block;
                }
                next_gpe_xrupt_info = gpe_xrupt_info->next;
-               ACPI_MEM_FREE(gpe_xrupt_info);
+               ACPI_FREE(gpe_xrupt_info);
                gpe_xrupt_info = next_gpe_xrupt_info;
        }
 
@@ -216,7 +216,7 @@ static void acpi_ut_terminate(void)
 void acpi_ut_subsystem_shutdown(void)
 {
 
-       ACPI_FUNCTION_TRACE("ut_subsystem_shutdown");
+       ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
 
        /* Just exit if subsystem is already shutdown */
 
@@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void)
        /* Subsystem appears active, go ahead and shut it down */
 
        acpi_gbl_shutdown = TRUE;
+       acpi_gbl_startup_flags = 0;
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
 
        /* Close the acpi_event Handling */
@@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void)
        /* Purge the local caches */
 
        (void)acpi_ut_delete_caches();
-
-       /* Debug only - display leftover memory allocation, if any */
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-       acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
-#endif
-
        return_VOID;
 }
index 4a3360484e7201077cee7ad777ac897398b9edf1..19d74bedce27485cc519d3168801cdaa63e0aa1b 100644 (file)
@@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend,
        union uint64_overlay quotient;
        u32 remainder32;
 
-       ACPI_FUNCTION_TRACE("ut_short_divide");
+       ACPI_FUNCTION_TRACE(ut_short_divide);
 
        /* Always check for a zero divisor */
 
@@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend,
        union uint64_overlay partial2;
        union uint64_overlay partial3;
 
-       ACPI_FUNCTION_TRACE("ut_divide");
+       ACPI_FUNCTION_TRACE(ut_divide);
 
        /* Always check for a zero divisor */
 
@@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend,
                     acpi_integer * out_quotient, u32 * out_remainder)
 {
 
-       ACPI_FUNCTION_TRACE("ut_short_divide");
+       ACPI_FUNCTION_TRACE(ut_short_divide);
 
        /* Always check for a zero divisor */
 
@@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend,
               acpi_integer in_divisor,
               acpi_integer * out_quotient, acpi_integer * out_remainder)
 {
-       ACPI_FUNCTION_TRACE("ut_divide");
+       ACPI_FUNCTION_TRACE(ut_divide);
 
        /* Always check for a zero divisor */
 
index 7364f5f8c9cd63556e80c5da13022620d46b11ac..5c75d35ad1cd8a96c4d428051164482ea3512912 100644 (file)
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utmisc")
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_is_aml_table
+ *
+ * PARAMETERS:  Table               - An ACPI table
+ *
+ * RETURN:      TRUE if table contains executable AML; FALSE otherwise
+ *
+ * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
+ *              Currently, these are DSDT,SSDT,PSDT. All other table types are
+ *              data tables that do not contain AML code.
+ *
+ ******************************************************************************/
+u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
+{
+
+       /* Ignore tables that contain AML */
+
+       if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
+           ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
+           ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) {
+               return (TRUE);
+       }
+
+       return (FALSE);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_allocate_owner_id
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc")
  *              when the method exits or the table is unloaded.
  *
  ******************************************************************************/
+
 acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
 {
        acpi_native_uint i;
@@ -67,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
        acpi_native_uint k;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_allocate_owner_id");
+       ACPI_FUNCTION_TRACE(ut_allocate_owner_id);
 
        /* Guard against multiple allocations of ID to the same location */
 
@@ -97,6 +125,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
 
                for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
                        if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
+
                                /* There are no free IDs in this mask */
 
                                break;
@@ -123,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
                                    (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
 
                                ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
-                                                 "Allocated owner_id: %2.2X\n",
+                                                 "Allocated OwnerId: %2.2X\n",
                                                  (unsigned int)*owner_id));
                                goto exit;
                        }
@@ -144,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
         */
        status = AE_OWNER_ID_LIMIT;
        ACPI_ERROR((AE_INFO,
-                   "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT"));
+                   "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
 
       exit:
        (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -172,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
        acpi_native_uint index;
        u32 bit;
 
-       ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id);
+       ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id);
 
        /* Always clear the input owner_id (zero is an invalid ID) */
 
@@ -181,7 +210,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
        /* Zero is not a valid owner_iD */
 
        if (owner_id == 0) {
-               ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id));
+               ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id));
                return_VOID;
        }
 
@@ -207,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
                acpi_gbl_owner_id_mask[index] ^= bit;
        } else {
                ACPI_ERROR((AE_INFO,
-                           "Release of non-allocated owner_id: %2.2X",
+                           "Release of non-allocated OwnerId: %2.2X",
                            owner_id + 1));
        }
 
@@ -273,6 +302,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
 
        acpi_os_printf("\"");
        for (i = 0; string[i] && (i < max_length); i++) {
+
                /* Escape sequences */
 
                switch (string[i]) {
@@ -461,10 +491,45 @@ acpi_ut_display_init_pathname(u8 type,
        }
        acpi_os_printf("\n");
 
-       ACPI_MEM_FREE(buffer.pointer);
+       ACPI_FREE(buffer.pointer);
 }
 #endif
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_valid_acpi_char
+ *
+ * PARAMETERS:  Char            - The character to be examined
+ *
+ * RETURN:      TRUE if the character is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:
+ *              1) Upper case alpha
+ *              2) numeric
+ *              3) underscore
+ *
+ *              We allow a '!' as the last character because of the ASF! table
+ *
+ ******************************************************************************/
+
+u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position)
+{
+
+       if (!((character >= 'A' && character <= 'Z') ||
+             (character >= '0' && character <= '9') || (character == '_'))) {
+
+               /* Allow a '!' in the last position */
+
+               if (character == '!' && position == 3) {
+                       return (TRUE);
+               }
+
+               return (FALSE);
+       }
+
+       return (TRUE);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_acpi_name
@@ -482,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type,
 
 u8 acpi_ut_valid_acpi_name(u32 name)
 {
-       char *name_ptr = (char *)&name;
-       char character;
        acpi_native_uint i;
 
        ACPI_FUNCTION_ENTRY();
 
        for (i = 0; i < ACPI_NAME_SIZE; i++) {
-               character = *name_ptr;
-               name_ptr++;
-
-               if (!((character == '_') ||
-                     (character >= 'A' && character <= 'Z') ||
-                     (character >= '0' && character <= '9'))) {
+               if (!acpi_ut_valid_acpi_char
+                   ((ACPI_CAST_PTR(char, &name))[i], i)) {
                        return (FALSE);
                }
        }
@@ -504,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_valid_acpi_character
+ * FUNCTION:    acpi_ut_repair_name
  *
- * PARAMETERS:  Character           - The character to be examined
+ * PARAMETERS:  Name            - The ACPI name to be repaired
  *
- * RETURN:      1 if Character may appear in a name, else 0
+ * RETURN:      Repaired version of the name
  *
- * DESCRIPTION: Check for a printable character
+ * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
+ *              return the new name.
  *
  ******************************************************************************/
 
-u8 acpi_ut_valid_acpi_character(char character)
+acpi_name acpi_ut_repair_name(acpi_name name)
 {
+       char *name_ptr = ACPI_CAST_PTR(char, &name);
+       char new_name[ACPI_NAME_SIZE];
+       acpi_native_uint i;
 
-       ACPI_FUNCTION_ENTRY();
+       for (i = 0; i < ACPI_NAME_SIZE; i++) {
+               new_name[i] = name_ptr[i];
 
-       return ((u8) ((character == '_') ||
-                     (character >= 'A' && character <= 'Z') ||
-                     (character >= '0' && character <= '9')));
+               /*
+                * Replace a bad character with something printable, yet technically
+                * still invalid. This prevents any collisions with existing "good"
+                * names in the namespace.
+                */
+               if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) {
+                       new_name[i] = '*';
+               }
+       }
+
+       return (*ACPI_CAST_PTR(u32, new_name));
 }
 
 /*******************************************************************************
@@ -529,7 +601,8 @@ u8 acpi_ut_valid_acpi_character(char character)
  * FUNCTION:    acpi_ut_strtoul64
  *
  * PARAMETERS:  String          - Null terminated string
- *              Base            - Radix of the string: 10, 16, or ACPI_ANY_BASE
+ *              Base            - Radix of the string: 16 or ACPI_ANY_BASE;
+ *                                ACPI_ANY_BASE means 'in behalf of to_integer'
  *              ret_integer     - Where the converted integer is returned
  *
  * RETURN:      Status and Converted value
@@ -545,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
        u32 this_digit = 0;
        acpi_integer return_value = 0;
        acpi_integer quotient;
+       acpi_integer dividend;
+       u32 to_integer_op = (base == ACPI_ANY_BASE);
+       u32 mode32 = (acpi_gbl_integer_byte_width == 4);
+       u8 valid_digits = 0;
+       u8 sign_of0x = 0;
+       u8 term = 0;
 
-       ACPI_FUNCTION_TRACE("ut_stroul64");
-
-       if ((!string) || !(*string)) {
-               goto error_exit;
-       }
+       ACPI_FUNCTION_TRACE(ut_stroul64);
 
        switch (base) {
        case ACPI_ANY_BASE:
-       case 10:
        case 16:
                break;
 
@@ -563,76 +637,110 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
+       if (!string) {
+               goto error_exit;
+       }
+
        /* Skip over any white space in the buffer */
 
-       while (ACPI_IS_SPACE(*string) || *string == '\t') {
+       while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
                string++;
        }
 
-       /*
-        * If the input parameter Base is zero, then we need to
-        * determine if it is decimal or hexadecimal:
-        */
-       if (base == 0) {
+       if (to_integer_op) {
+               /*
+                * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
+                * We need to determine if it is decimal or hexadecimal.
+                */
                if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
+                       sign_of0x = 1;
                        base = 16;
+
+                       /* Skip over the leading '0x' */
                        string += 2;
                } else {
                        base = 10;
                }
        }
 
-       /*
-        * For hexadecimal base, skip over the leading
-        * 0 or 0x, if they are present.
-        */
-       if ((base == 16) &&
-           (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
-               string += 2;
+       /* Any string left? Check that '0x' is not followed by white space. */
+
+       if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
+               if (to_integer_op) {
+                       goto error_exit;
+               } else {
+                       goto all_done;
+               }
        }
 
-       /* Any string left? */
+       dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
 
-       if (!(*string)) {
-               goto error_exit;
-       }
+       /* At least one character in the string here */
 
        /* Main loop: convert the string to a 64-bit integer */
 
        while (*string) {
                if (ACPI_IS_DIGIT(*string)) {
+
                        /* Convert ASCII 0-9 to Decimal value */
 
                        this_digit = ((u8) * string) - '0';
-               } else {
-                       if (base == 10) {
-                               /* Digit is out of range */
+               } else if (base == 10) {
 
-                               goto error_exit;
-                       }
+                       /* Digit is out of range; possible in to_integer case only */
 
+                       term = 1;
+               } else {
                        this_digit = (u8) ACPI_TOUPPER(*string);
                        if (ACPI_IS_XDIGIT((char)this_digit)) {
+
                                /* Convert ASCII Hex char to value */
 
                                this_digit = this_digit - 'A' + 10;
                        } else {
-                               /*
-                                * We allow non-hex chars, just stop now, same as end-of-string.
-                                * See ACPI spec, string-to-integer conversion.
-                                */
+                               term = 1;
+                       }
+               }
+
+               if (term) {
+                       if (to_integer_op) {
+                               goto error_exit;
+                       } else {
                                break;
                        }
+               } else if ((valid_digits == 0) && (this_digit == 0)
+                          && !sign_of0x) {
+
+                       /* Skip zeros */
+                       string++;
+                       continue;
+               }
+
+               valid_digits++;
+
+               if (sign_of0x
+                   && ((valid_digits > 16)
+                       || ((valid_digits > 8) && mode32))) {
+                       /*
+                        * This is to_integer operation case.
+                        * No any restrictions for string-to-integer conversion,
+                        * see ACPI spec.
+                        */
+                       goto error_exit;
                }
 
                /* Divide the digit into the correct position */
 
                (void)
-                   acpi_ut_short_divide((ACPI_INTEGER_MAX -
-                                         (acpi_integer) this_digit), base,
-                                        &quotient, NULL);
+                   acpi_ut_short_divide((dividend - (acpi_integer) this_digit),
+                                        base, &quotient, NULL);
+
                if (return_value > quotient) {
-                       goto error_exit;
+                       if (to_integer_op) {
+                               goto error_exit;
+                       } else {
+                               break;
+                       }
                }
 
                return_value *= base;
@@ -642,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
 
        /* All done, normal exit */
 
+      all_done:
+
        *ret_integer = return_value;
        return_ACPI_STATUS(AE_OK);
 
@@ -719,7 +829,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
        u32 this_index;
        union acpi_operand_object *this_source_obj;
 
-       ACPI_FUNCTION_TRACE("ut_walk_package_tree");
+       ACPI_FUNCTION_TRACE(ut_walk_package_tree);
 
        state = acpi_ut_create_pkg_state(source_object, target_object, 0);
        if (!state) {
@@ -727,6 +837,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
        }
 
        while (state) {
+
                /* Get one element of the package */
 
                this_index = state->pkg.index;
@@ -812,31 +923,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
        return_ACPI_STATUS(AE_AML_INTERNAL);
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_generate_checksum
- *
- * PARAMETERS:  Buffer          - Buffer to be scanned
- *              Length          - number of bytes to examine
- *
- * RETURN:      The generated checksum
- *
- * DESCRIPTION: Generate a checksum on a raw buffer
- *
- ******************************************************************************/
-
-u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
-{
-       u32 i;
-       signed char sum = 0;
-
-       for (i = 0; i < length; i++) {
-               sum = (signed char)(sum + buffer[i]);
-       }
-
-       return ((u8) (0 - sum));
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_error, acpi_ut_warning, acpi_ut_info
@@ -900,36 +986,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
        acpi_os_vprintf(format, args);
        acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
 }
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_report_error, Warning, Info
- *
- * PARAMETERS:  module_name         - Caller's module name (for error output)
- *              line_number         - Caller's line number (for error output)
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message
- *
- * Note: Legacy only, should be removed when no longer used by drivers.
- *
- ******************************************************************************/
-
-void acpi_ut_report_error(char *module_name, u32 line_number)
-{
-
-       acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
-}
-
-void acpi_ut_report_warning(char *module_name, u32 line_number)
-{
-
-       acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
-}
-
-void acpi_ut_report_info(char *module_name, u32 line_number)
-{
-
-       acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
-}
index 45a7244df924c8ac774bef892f77b7196b898ede..25eb34369afa22738ee48f8d11826ecf55068088 100644 (file)
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void)
        u32 i;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ut_mutex_initialize");
+       ACPI_FUNCTION_TRACE(ut_mutex_initialize);
 
        /*
         * Create each of the predefined mutex objects
         */
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                status = acpi_ut_create_mutex(i);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
        }
 
+       /* Create the spinlocks for use at interrupt level */
+
        status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
        return_ACPI_STATUS(status);
 }
 
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void)
 {
        u32 i;
 
-       ACPI_FUNCTION_TRACE("ut_mutex_terminate");
+       ACPI_FUNCTION_TRACE(ut_mutex_terminate);
 
        /*
         * Delete each predefined mutex object
         */
-       for (i = 0; i < NUM_MUTEX; i++) {
+       for (i = 0; i < ACPI_NUM_MUTEX; i++) {
                (void)acpi_ut_delete_mutex(i);
        }
 
+       /* Delete the spinlocks */
+
        acpi_os_delete_lock(acpi_gbl_gpe_lock);
+       acpi_os_delete_lock(acpi_gbl_hardware_lock);
        return_VOID;
 }
 
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id);
+       ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id);
+       ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
 acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
 {
        acpi_status status;
-       u32 this_thread_id;
+       acpi_thread_id this_thread_id;
 
-       ACPI_FUNCTION_NAME("ut_acquire_mutex");
+       ACPI_FUNCTION_NAME(ut_acquire_mutex);
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return (AE_BAD_PARAMETER);
        }
 
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
                 * the mutex ordering rule.  This indicates a coding error somewhere in
                 * the ACPI subsystem code.
                 */
-               for (i = mutex_id; i < MAX_MUTEX; i++) {
+               for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
                        if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
                                if (i == mutex_id) {
                                        ACPI_ERROR((AE_INFO,
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
 acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
 {
        acpi_status status;
-       u32 this_thread_id;
+       acpi_thread_id this_thread_id;
 
-       ACPI_FUNCTION_NAME("ut_release_mutex");
+       ACPI_FUNCTION_NAME(ut_release_mutex);
 
        this_thread_id = acpi_os_get_thread_id();
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
                          "Thread %X releasing Mutex [%s]\n", this_thread_id,
                          acpi_ut_get_mutex_name(mutex_id)));
 
-       if (mutex_id > MAX_MUTEX) {
+       if (mutex_id > ACPI_MAX_MUTEX) {
                return (AE_BAD_PARAMETER);
        }
 
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
                 * ordering rule.  This indicates a coding error somewhere in
                 * the ACPI subsystem code.
                 */
-               for (i = mutex_id; i < MAX_MUTEX; i++) {
+               for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
                        if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
                                if (i == mutex_id) {
                                        continue;
index 7ee2d1d980719e40cf8115064e26401b7f228029..ba7d8ac702df959f7198038182f94af09efba3a6 100644 (file)
@@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
        union acpi_operand_object *object;
        union acpi_operand_object *second_object;
 
-       ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg",
+       ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
                                acpi_ut_get_type_name(type));
 
        /* Allocate the raw object descriptor */
@@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
        union acpi_operand_object *buffer_desc;
        u8 *buffer = NULL;
 
-       ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size);
+       ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size);
 
        /* Create a new Buffer object */
 
@@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
        /* Create an actual buffer only if size > 0 */
 
        if (buffer_size > 0) {
+
                /* Allocate the actual buffer */
 
-               buffer = ACPI_MEM_CALLOCATE(buffer_size);
+               buffer = ACPI_ALLOCATE_ZEROED(buffer_size);
                if (!buffer) {
                        ACPI_ERROR((AE_INFO, "Could not allocate size %X",
                                    (u32) buffer_size));
@@ -214,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
        union acpi_operand_object *string_desc;
        char *string;
 
-       ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size);
+       ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
 
        /* Create a new String object */
 
@@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
         * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
         * NOTE: Zero-length strings are NULL terminated
         */
-       string = ACPI_MEM_CALLOCATE(string_size + 1);
+       string = ACPI_ALLOCATE_ZEROED(string_size + 1);
        if (!string) {
                ACPI_ERROR((AE_INFO, "Could not allocate size %X",
                            (u32) string_size));
@@ -260,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
 u8 acpi_ut_valid_internal_object(void *object)
 {
 
-       ACPI_FUNCTION_NAME("ut_valid_internal_object");
+       ACPI_FUNCTION_NAME(ut_valid_internal_object);
 
        /* Check for a null pointer */
 
@@ -308,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
 {
        union acpi_operand_object *object;
 
-       ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg");
+       ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
 
        object = acpi_os_acquire_object(acpi_gbl_operand_cache);
        if (!object) {
@@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
        }
 
        /* Mark the descriptor type */
+
        memset(object, 0, sizeof(union acpi_operand_object));
        ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
 
@@ -342,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
 
 void acpi_ut_delete_object_desc(union acpi_operand_object *object)
 {
-       ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
 
        /* Object must be an union acpi_operand_object    */
 
@@ -381,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
        acpi_size length;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object);
+       ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
 
        /*
         * Handle a null object (Could be a uninitialized package
@@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
        length = sizeof(union acpi_object);
 
        if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
+
                /* Object is a named object (reference), just return the length */
 
                *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
@@ -559,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
        acpi_status status;
        struct acpi_pkg_info info;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object);
+       ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
 
        info.length = 0;
        info.object_space = 0;
index 16461317113f09aec13c26401e27e7491742e848..5a2de92831d317c5b04cc9138d37512c29539ecd 100644 (file)
 #include <acpi/amlresrc.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-ACPI_MODULE_NAME("utmisc")
+ACPI_MODULE_NAME("utresrc")
 
 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
 /*
  * Strings used to decode resource descriptors.
  * Used by both the disasssembler and the debugger resource dump routines
  */
-const char *acpi_gbl_BMdecode[2] = {
-       "not_bus_master",
-       "bus_master"
+const char *acpi_gbl_bm_decode[] = {
+       "NotBusMaster",
+       "BusMaster"
 };
 
-const char *acpi_gbl_config_decode[4] = {
+const char *acpi_gbl_config_decode[] = {
        "0 - Good Configuration",
        "1 - Acceptable Configuration",
        "2 - Suboptimal Configuration",
        "3 - ***Invalid Configuration***",
 };
 
-const char *acpi_gbl_consume_decode[2] = {
-       "resource_producer",
-       "resource_consumer"
+const char *acpi_gbl_consume_decode[] = {
+       "ResourceProducer",
+       "ResourceConsumer"
 };
 
-const char *acpi_gbl_DECdecode[2] = {
-       "pos_decode",
-       "sub_decode"
+const char *acpi_gbl_dec_decode[] = {
+       "PosDecode",
+       "SubDecode"
 };
 
-const char *acpi_gbl_HEdecode[2] = {
+const char *acpi_gbl_he_decode[] = {
        "Level",
        "Edge"
 };
 
-const char *acpi_gbl_io_decode[2] = {
+const char *acpi_gbl_io_decode[] = {
        "Decode10",
        "Decode16"
 };
 
-const char *acpi_gbl_LLdecode[2] = {
-       "active_high",
-       "active_low"
+const char *acpi_gbl_ll_decode[] = {
+       "ActiveHigh",
+       "ActiveLow"
 };
 
-const char *acpi_gbl_max_decode[2] = {
-       "max_not_fixed",
-       "max_fixed"
+const char *acpi_gbl_max_decode[] = {
+       "MaxNotFixed",
+       "MaxFixed"
 };
 
-const char *acpi_gbl_MEMdecode[4] = {
-       "non_cacheable",
+const char *acpi_gbl_mem_decode[] = {
+       "NonCacheable",
        "Cacheable",
-       "write_combining",
+       "WriteCombining",
        "Prefetchable"
 };
 
-const char *acpi_gbl_min_decode[2] = {
-       "min_not_fixed",
-       "min_fixed"
+const char *acpi_gbl_min_decode[] = {
+       "MinNotFixed",
+       "MinFixed"
 };
 
-const char *acpi_gbl_MTPdecode[4] = {
-       "address_range_memory",
-       "address_range_reserved",
-       "address_range_aCPI",
-       "address_range_nVS"
+const char *acpi_gbl_mtp_decode[] = {
+       "AddressRangeMemory",
+       "AddressRangeReserved",
+       "AddressRangeACPI",
+       "AddressRangeNVS"
 };
 
-const char *acpi_gbl_RNGdecode[4] = {
-       "invalid_ranges",
-       "non_iSAonly_ranges",
-       "ISAonly_ranges",
-       "entire_range"
+const char *acpi_gbl_rng_decode[] = {
+       "InvalidRanges",
+       "NonISAOnlyRanges",
+       "ISAOnlyRanges",
+       "EntireRange"
 };
 
-const char *acpi_gbl_RWdecode[2] = {
-       "read_only",
-       "read_write"
+const char *acpi_gbl_rw_decode[] = {
+       "ReadOnly",
+       "ReadWrite"
 };
 
-const char *acpi_gbl_SHRdecode[2] = {
+const char *acpi_gbl_shr_decode[] = {
        "Exclusive",
        "Shared"
 };
 
-const char *acpi_gbl_SIZdecode[4] = {
+const char *acpi_gbl_siz_decode[] = {
        "Transfer8",
        "Transfer8_16",
        "Transfer16",
-       "invalid_size"
+       "InvalidSize"
 };
 
-const char *acpi_gbl_TRSdecode[2] = {
-       "dense_translation",
-       "sparse_translation"
+const char *acpi_gbl_trs_decode[] = {
+       "DenseTranslation",
+       "SparseTranslation"
 };
 
-const char *acpi_gbl_TTPdecode[2] = {
-       "type_static",
-       "type_translation"
+const char *acpi_gbl_ttp_decode[] = {
+       "TypeStatic",
+       "TypeTranslation"
 };
 
-const char *acpi_gbl_TYPdecode[4] = {
+const char *acpi_gbl_typ_decode[] = {
        "Compatibility",
-       "type_a",
-       "type_b",
-       "type_f"
+       "TypeA",
+       "TypeB",
+       "TypeF"
 };
 
 #endif
@@ -238,6 +238,104 @@ static const u8 acpi_gbl_resource_types[] = {
        ACPI_FIXED_LENGTH
 };
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_walk_aml_resources
+ *
+ * PARAMETERS:  Aml             - Pointer to the raw AML resource template
+ *              aml_length      - Length of the entire template
+ *              user_function   - Called once for each descriptor found. If
+ *                                NULL, a pointer to the end_tag is returned
+ *              Context         - Passed to user_function
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Walk a raw AML resource list(buffer). User function called
+ *              once for each resource found.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ut_walk_aml_resources(u8 * aml,
+                          acpi_size aml_length,
+                          acpi_walk_aml_callback user_function, void **context)
+{
+       acpi_status status;
+       u8 *end_aml;
+       u8 resource_index;
+       u32 length;
+       u32 offset = 0;
+
+       ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
+
+       /* The absolute minimum resource template is one end_tag descriptor */
+
+       if (aml_length < sizeof(struct aml_resource_end_tag)) {
+               return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+       }
+
+       /* Point to the end of the resource template buffer */
+
+       end_aml = aml + aml_length;
+
+       /* Walk the byte list, abort on any invalid descriptor type or length */
+
+       while (aml < end_aml) {
+
+               /* Validate the Resource Type and Resource Length */
+
+               status = acpi_ut_validate_resource(aml, &resource_index);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
+
+               /* Get the length of this descriptor */
+
+               length = acpi_ut_get_descriptor_length(aml);
+
+               /* Invoke the user function */
+
+               if (user_function) {
+                       status =
+                           user_function(aml, length, offset, resource_index,
+                                         context);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+               }
+
+               /* An end_tag descriptor terminates this resource template */
+
+               if (acpi_ut_get_resource_type(aml) ==
+                   ACPI_RESOURCE_NAME_END_TAG) {
+                       /*
+                        * There must be at least one more byte in the buffer for
+                        * the 2nd byte of the end_tag
+                        */
+                       if ((aml + 1) >= end_aml) {
+                               return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+                       }
+
+                       /* Return the pointer to the end_tag if requested */
+
+                       if (!user_function) {
+                               *context = aml;
+                       }
+
+                       /* Normal exit */
+
+                       return_ACPI_STATUS(AE_OK);
+               }
+
+               aml += length;
+               offset += length;
+       }
+
+       /* Did not find an end_tag descriptor */
+
+       return (AE_AML_NO_RESOURCE_END_TAG);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_validate_resource
@@ -273,6 +371,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
         * Examine the large/small bit in the resource header
         */
        if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
+
                /* Verify the large resource type (name) against the max */
 
                if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
@@ -376,6 +475,7 @@ u8 acpi_ut_get_resource_type(void *aml)
         * Examine the large/small bit in the resource header
         */
        if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
+
                /* Large Resource Type -- bits 6:0 contain the name */
 
                return (ACPI_GET8(aml));
@@ -411,6 +511,7 @@ u16 acpi_ut_get_resource_length(void *aml)
         * Examine the large/small bit in the resource header
         */
        if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
+
                /* Large Resource type -- bytes 1-2 contain the 16-bit length */
 
                ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
@@ -495,60 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
                             u8 ** end_tag)
 {
        acpi_status status;
-       u8 *aml;
-       u8 *end_aml;
-
-       ACPI_FUNCTION_TRACE("ut_get_resource_end_tag");
 
-       /* Get start and end pointers */
-
-       aml = obj_desc->buffer.pointer;
-       end_aml = aml + obj_desc->buffer.length;
+       ACPI_FUNCTION_TRACE(ut_get_resource_end_tag);
 
        /* Allow a buffer length of zero */
 
        if (!obj_desc->buffer.length) {
-               *end_tag = aml;
+               *end_tag = obj_desc->buffer.pointer;
                return_ACPI_STATUS(AE_OK);
        }
 
-       /* Walk the resource template, one descriptor per iteration */
-
-       while (aml < end_aml) {
-               /* Validate the Resource Type and Resource Length */
-
-               status = acpi_ut_validate_resource(aml, NULL);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
-               }
-
-               /* end_tag resource indicates the end of the resource template */
-
-               if (acpi_ut_get_resource_type(aml) ==
-                   ACPI_RESOURCE_NAME_END_TAG) {
-                       /*
-                        * There must be at least one more byte in the buffer for
-                        * the 2nd byte of the end_tag
-                        */
-                       if ((aml + 1) >= end_aml) {
-                               return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
-                       }
-
-                       /* Return the pointer to the end_tag */
-
-                       *end_tag = aml;
-                       return_ACPI_STATUS(AE_OK);
-               }
-
-               /*
-                * Point to the next resource descriptor in the AML buffer. The
-                * descriptor length is guaranteed to be non-zero by resource
-                * validation above.
-                */
-               aml += acpi_ut_get_descriptor_length(aml);
-       }
+       /* Validate the template and get a pointer to the end_tag */
 
-       /* Did not find an end_tag resource descriptor */
+       status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
+                                           obj_desc->buffer.length, NULL,
+                                           (void **)end_tag);
 
-       return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+       return_ACPI_STATUS(status);
 }
index 4b134a72290711b81753003c81c30ed170386abb..0f5c5bb5deff29dd1e53a23153a8fa03f81055d5 100644 (file)
@@ -96,7 +96,7 @@ void
 acpi_ut_push_generic_state(union acpi_generic_state **list_head,
                           union acpi_generic_state *state)
 {
-       ACPI_FUNCTION_TRACE("ut_push_generic_state");
+       ACPI_FUNCTION_TRACE(ut_push_generic_state);
 
        /* Push the state object onto the front of the list (stack) */
 
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE("ut_pop_generic_state");
+       ACPI_FUNCTION_TRACE(ut_pop_generic_state);
 
        /* Remove the state object at the head of the list (stack) */
 
        state = *list_head;
        if (state) {
+
                /* Update the list head */
 
                *list_head = state->common.next;
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
 
        state = acpi_os_acquire_object(acpi_gbl_state_cache);
        if (state) {
+
                /* Initialize */
                memset(state, 0, sizeof(union acpi_generic_state));
-               state->common.data_type = ACPI_DESC_TYPE_STATE;
+               state->common.descriptor_type = ACPI_DESC_TYPE_STATE;
        }
 
        return (state);
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE("ut_create_thread_state");
+       ACPI_FUNCTION_TRACE(ut_create_thread_state);
 
        /* Create the generic state object */
 
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
 
        /* Init fields specific to the update struct */
 
-       state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD;
+       state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
        state->thread.thread_id = acpi_os_get_thread_id();
 
        return_PTR((struct acpi_thread_state *)state);
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object);
+       ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object);
 
        /* Create the generic state object */
 
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
 
        /* Init fields specific to the update struct */
 
-       state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE;
+       state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
        state->update.object = object;
        state->update.value = action;
 
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object);
+       ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object);
 
        /* Create the generic state object */
 
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
 
        /* Init fields specific to the update struct */
 
-       state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE;
+       state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
        state->pkg.source_object = (union acpi_operand_object *)internal_object;
        state->pkg.dest_object = external_object;
        state->pkg.index = index;
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
 {
        union acpi_generic_state *state;
 
-       ACPI_FUNCTION_TRACE("ut_create_control_state");
+       ACPI_FUNCTION_TRACE(ut_create_control_state);
 
        /* Create the generic state object */
 
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
 
        /* Init fields specific to the control struct */
 
-       state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
+       state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
        state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
 
        return_PTR(state);
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Put a state object back into the global state cache.  The object
- *              is not actually freed at this time.
+ * DESCRIPTION: Release a state object to the state cache. NULL state objects
+ *              are ignored.
  *
  ******************************************************************************/
 
 void acpi_ut_delete_generic_state(union acpi_generic_state *state)
 {
-       ACPI_FUNCTION_TRACE("ut_delete_generic_state");
+       ACPI_FUNCTION_TRACE(ut_delete_generic_state);
+
+       /* Ignore null state */
 
-       (void)acpi_os_release_object(acpi_gbl_state_cache, state);
+       if (state) {
+               (void)acpi_os_release_object(acpi_gbl_state_cache, state);
+       }
        return_VOID;
 }
index 308a960871be8a7a919fe1e070cda35d2abfd5ec..3538f69c82a1cac6de72067d5659cdfaaaa00fa1 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <linux/module.h>
-
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
@@ -67,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_initialize_subsystem");
+       ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
 
        ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
 
@@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable_subsystem
@@ -121,12 +121,11 @@ acpi_status acpi_initialize_subsystem(void)
  *              Puts system into ACPI mode if it isn't already.
  *
  ******************************************************************************/
-
 acpi_status acpi_enable_subsystem(u32 flags)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_enable_subsystem");
+       ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
 
        /*
         * We must initialize the hardware before we can enable ACPI.
@@ -152,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
 
                status = acpi_enable();
                if (ACPI_FAILURE(status)) {
-                       ACPI_WARNING((AE_INFO, "acpi_enable failed"));
+                       ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
                        return_ACPI_STATUS(status);
                }
        }
@@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_initialize_objects
@@ -241,12 +242,11 @@ acpi_status acpi_enable_subsystem(u32 flags)
  *              objects and executing AML code for Regions, buffers, etc.
  *
  ******************************************************************************/
-
 acpi_status acpi_initialize_objects(u32 flags)
 {
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE("acpi_initialize_objects");
+       ACPI_FUNCTION_TRACE(acpi_initialize_objects);
 
        /*
         * Run all _REG methods
@@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags)
         */
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "[Init] Executing _REG op_region methods\n"));
+                                 "[Init] Executing _REG OpRegion methods\n"));
 
                status = acpi_ev_initialize_op_regions();
                if (ACPI_FAILURE(status)) {
@@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_terminate
@@ -316,12 +318,11 @@ acpi_status acpi_initialize_objects(u32 flags)
  * DESCRIPTION: Shutdown the ACPI subsystem.  Release all resources.
  *
  ******************************************************************************/
-
 acpi_status acpi_terminate(void)
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_terminate");
+       ACPI_FUNCTION_TRACE(acpi_terminate);
 
        /* Terminate the AML Debugger if present */
 
@@ -348,6 +349,8 @@ acpi_status acpi_terminate(void)
        return_ACPI_STATUS(status);
 }
 
+ACPI_EXPORT_SYMBOL(acpi_terminate)
+
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -362,7 +365,6 @@ acpi_status acpi_terminate(void)
  *              initialized successfully.
  *
  ******************************************************************************/
-
 acpi_status acpi_subsystem_status(void)
 {
 
@@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void)
        }
 }
 
+ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_system_info
@@ -390,14 +394,13 @@ acpi_status acpi_subsystem_status(void)
  *              and the value of out_buffer is undefined.
  *
  ******************************************************************************/
-
 acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
 {
        struct acpi_system_info *info_ptr;
        acpi_status status;
        u32 i;
 
-       ACPI_FUNCTION_TRACE("acpi_get_system_info");
+       ACPI_FUNCTION_TRACE(acpi_get_system_info);
 
        /* Parameter validation */
 
@@ -448,15 +451,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
 
        /* Current status of the ACPI tables, per table type */
 
-       info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES;
-       for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
+       info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1;
+       for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
                info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
        }
 
        return_ACPI_STATUS(AE_OK);
 }
 
-EXPORT_SYMBOL(acpi_get_system_info);
+ACPI_EXPORT_SYMBOL(acpi_get_system_info)
 
 /*****************************************************************************
  *
@@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info);
  * TBD: When a second function is added, must save the Function also.
  *
  ****************************************************************************/
-
 acpi_status
 acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
 {
@@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
        return AE_OK;
 }
 
+ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
 #endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*****************************************************************************
@@ -502,10 +505,9 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
  * DESCRIPTION: Empty all caches (delete the cached objects)
  *
  ****************************************************************************/
-
 acpi_status acpi_purge_cached_objects(void)
 {
-       ACPI_FUNCTION_TRACE("acpi_purge_cached_objects");
+       ACPI_FUNCTION_TRACE(acpi_purge_cached_objects);
 
        (void)acpi_os_purge_cache(acpi_gbl_state_cache);
        (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
@@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void)
        (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
        return_ACPI_STATUS(AE_OK);
 }
+
+ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)
index bd4887518373e2a2111cf9f2af755519d749361d..86531ab4ee5517dcf86676641fcae415cad4f980 100644 (file)
@@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
        if (!ACPI_SUCCESS(status))
                return_VALUE(status);
        obj = (union acpi_object *)buffer.pointer;
-       if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) {
+       if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n"));
                status = -EFAULT;
                goto err;
@@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
                              struct acpi_video_bus *video)
 {
        unsigned long device_id;
-       int status, result;
+       int status;
        struct acpi_video_device *data;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
@@ -1346,8 +1346,11 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
                if (ACPI_FAILURE(status)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                          "Error installing notify handler\n"));
-                       result = -ENODEV;
-                       goto end;
+                       if(data->brightness)
+                               kfree(data->brightness->levels);
+                       kfree(data->brightness);
+                       kfree(data);
+                       return -ENODEV;
                }
 
                down(&video->sem);
@@ -1359,7 +1362,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
                return_VALUE(0);
        }
 
-      end:
        return_VALUE(-ENOENT);
 }
 
@@ -1643,8 +1645,9 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
                        printk(KERN_WARNING PREFIX
                               "hhuuhhuu bug in acpi video driver.\n");
 
+               if (data->brightness);
+                       kfree(data->brightness->levels);
                kfree(data->brightness);
-
                kfree(data);
        }
 
@@ -1785,6 +1788,10 @@ static int acpi_video_bus_add(struct acpi_device *device)
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "Error installing notify handler\n"));
+               acpi_video_bus_stop_devices(video);
+               acpi_video_bus_put_devices(video);
+               kfree(video->attached_array);
+               acpi_video_bus_remove_fs(device);
                result = -ENODEV;
                goto end;
        }
@@ -1796,10 +1803,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
               video->flags.post ? "yes" : "no");
 
       end:
-       if (result) {
-               acpi_video_bus_remove_fs(device);
+       if (result)
                kfree(video);
-       }
 
        return_VALUE(result);
 }
index 472318205236162eaca67da28be8b3ece20b50bc..0c99ae6a340728bb55efc503aca6b9bb92e26860 100644 (file)
@@ -86,18 +86,9 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count)
 static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);
 
 static void  fw_class_dev_release(struct class_device *class_dev);
-int firmware_class_uevent(struct class_device *dev, char **envp,
-                          int num_envp, char *buffer, int buffer_size);
 
-static struct class firmware_class = {
-       .name           = "firmware",
-       .uevent = firmware_class_uevent,
-       .release        = fw_class_dev_release,
-};
-
-int
-firmware_class_uevent(struct class_device *class_dev, char **envp,
-                      int num_envp, char *buffer, int buffer_size)
+static int firmware_class_uevent(struct class_device *class_dev, char **envp,
+                                int num_envp, char *buffer, int buffer_size)
 {
        struct firmware_priv *fw_priv = class_get_devdata(class_dev);
        int i = 0, len = 0;
@@ -116,6 +107,12 @@ firmware_class_uevent(struct class_device *class_dev, char **envp,
        return 0;
 }
 
+static struct class firmware_class = {
+       .name           = "firmware",
+       .uevent         = firmware_class_uevent,
+       .release        = fw_class_dev_release,
+};
+
 static ssize_t
 firmware_loading_show(struct class_device *class_dev, char *buf)
 {
@@ -493,25 +490,6 @@ release_firmware(const struct firmware *fw)
        }
 }
 
-/**
- * register_firmware: - provide a firmware image for later usage
- * @name: name of firmware image file
- * @data: buffer pointer for the firmware image
- * @size: size of the data buffer area
- *
- *     Make sure that @data will be available by requesting firmware @name.
- *
- *     Note: This will not be possible until some kind of persistence
- *     is available.
- **/
-void
-register_firmware(const char *name, const u8 *data, size_t size)
-{
-       /* This is meaningless without firmware caching, so until we
-        * decide if firmware caching is reasonable just leave it as a
-        * noop */
-}
-
 /* Async support */
 struct firmware_work {
        struct work_struct work;
@@ -630,4 +608,3 @@ module_exit(firmware_class_exit);
 EXPORT_SYMBOL(release_firmware);
 EXPORT_SYMBOL(request_firmware);
 EXPORT_SYMBOL(request_firmware_nowait);
-EXPORT_SYMBOL(register_firmware);
index 662209d3f42d6a551c7001ab5adb62406abfcfb0..2a769cc6f5f9f8181580b6657c0d0625e9c937dd 100644 (file)
@@ -8,7 +8,6 @@
  *
  */
 
-#include <linux/vt_kern.h>
 #include <linux/device.h>
 #include <linux/kallsyms.h>
 #include <linux/pm.h>
@@ -66,6 +65,7 @@ int suspend_device(struct device * dev, pm_message_t state)
        return error;
 }
 
+
 /**
  *     device_suspend - Save state and stop all devices in system.
  *     @state:         Power state to put each device in.
@@ -85,9 +85,6 @@ int device_suspend(pm_message_t state)
 {
        int error = 0;
 
-       if (!is_console_suspend_safe())
-               return -EINVAL;
-
        down(&dpm_sem);
        down(&dpm_list_sem);
        while (!list_empty(&dpm_active) && error == 0) {
index f73446f580dff85b4f074393cdff8cac422fe801..c688c25992e44b0a914624735c448e7e7abb1429 100644 (file)
@@ -536,6 +536,9 @@ static void ub_cleanup(struct ub_dev *sc)
                kfree(lun);
        }
 
+       usb_set_intfdata(sc->intf, NULL);
+       usb_put_intf(sc->intf);
+       usb_put_dev(sc->dev);
        kfree(sc);
 }
 
@@ -2221,7 +2224,12 @@ static int ub_probe(struct usb_interface *intf,
        // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
        usb_set_intfdata(intf, sc);
        usb_get_dev(sc->dev);
-       // usb_get_intf(sc->intf);      /* Do we need this? */
+       /*
+        * Since we give the interface struct to the block level through
+        * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent
+        * oopses on close after a disconnect (kernels 2.6.16 and up).
+        */
+       usb_get_intf(sc->intf);
 
        snprintf(sc->name, 12, DRV_NAME "(%d.%d)",
            sc->dev->bus->busnum, sc->dev->devnum);
@@ -2286,7 +2294,7 @@ static int ub_probe(struct usb_interface *intf,
 
 err_dev_desc:
        usb_set_intfdata(intf, NULL);
-       // usb_put_intf(sc->intf);
+       usb_put_intf(sc->intf);
        usb_put_dev(sc->dev);
        kfree(sc);
 err_core:
@@ -2461,12 +2469,6 @@ static void ub_disconnect(struct usb_interface *intf)
         * and no URBs left in transit.
         */
 
-       usb_set_intfdata(intf, NULL);
-       // usb_put_intf(sc->intf);
-       sc->intf = NULL;
-       usb_put_dev(sc->dev);
-       sc->dev = NULL;
-
        ub_put(sc);
 }
 
index 402296670d3a555acfecbe66ceff162edb887e99..78d928f9d9f1abaa3c3a0b46e7deb69cd9f65a16 100644 (file)
@@ -291,7 +291,7 @@ config SX
 
 config RIO
        tristate "Specialix RIO system support"
-       depends on SERIAL_NONSTANDARD && !64BIT
+       depends on SERIAL_NONSTANDARD
        help
          This is a driver for the Specialix RIO, a smart serial card which
          drives an outboard box that can support up to 128 ports.  Product
index f5b01c6d498e10c66efa1becb1cb06a9cd0fd265..fb919bfb2824ef715ddde72f7be31ce048c23e32 100644 (file)
@@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC)          += n_hdlc.o
 obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
 obj-$(CONFIG_SX)               += sx.o generic_serial.o
 obj-$(CONFIG_RIO)              += rio/ generic_serial.o
-obj-$(CONFIG_HVC_DRIVER)       += hvc_console.o
 obj-$(CONFIG_HVC_CONSOLE)      += hvc_vio.o hvsi.o
 obj-$(CONFIG_HVC_RTAS)         += hvc_rtas.o
+obj-$(CONFIG_HVC_DRIVER)       += hvc_console.o
 obj-$(CONFIG_RAW_DRIVER)       += raw.o
 obj-$(CONFIG_SGI_SNSC)         += snsc.o snsc_event.o
 obj-$(CONFIG_MMTIMER)          += mmtimer.o
index 0b9cf9c59a213af2aa42f3f9eec0332ee823520f..7c88c060a9e6b3ab908660b6676aef4423488a35 100644 (file)
@@ -86,7 +86,7 @@ config AGP_NVIDIA
 
 config AGP_SIS
        tristate "SiS chipset support"
-       depends on AGP && X86_32
+       depends on AGP
        help
          This option gives you AGP support for the GLX component of
          X on Silicon Integrated Systems [SiS] chipsets.
index 36517d4d1ad9da6fdd80dd2f1180a7269abd7437..ac3c33a2e37d7b7ed7d1b3da0c7428f0e448dec8 100644 (file)
@@ -617,6 +617,9 @@ static int agp_amd64_resume(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
+       if (pdev->vendor == PCI_VENDOR_ID_NVIDIA)
+               nforce3_agp_init(pdev);
+
        return amd_8151_configure();
 }
 
index 8c4c6ef748ecea4358ea4ed5efac137003c1f714..907fb66ec4a98f12212b181099e39700eb797513 100644 (file)
@@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret)
                        info = buffer.pointer;
                        info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0';
                        match = (strcmp(info->hardware_id.value, "HWP0001") == 0);
-                       ACPI_MEM_FREE(info);
+                       kfree(info);
                        if (match) {
                                status = hp_acpi_csr_space(handle, &sba_hpa, &length);
                                if (ACPI_SUCCESS(status))
index 97b0a890ba7f828310342e585e866af36e101136..b8ec25d174787d56c4df0d07294a76f7a4328ff5 100644 (file)
@@ -345,6 +345,12 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
                .chipset_name   = "PT880",
        },
 
+       /* PT880 Ultra */
+       {
+               .device_id      = PCI_DEVICE_ID_VIA_PT880ULTRA,
+               .chipset_name   = "PT880 Ultra",
+       },
+
        /* PT890 */
        {
                .device_id      = PCI_DEVICE_ID_VIA_8783_0,
@@ -511,6 +517,7 @@ static struct pci_device_id agp_via_pci_table[] = {
        ID(PCI_DEVICE_ID_VIA_8763_0),
        ID(PCI_DEVICE_ID_VIA_8378_0),
        ID(PCI_DEVICE_ID_VIA_PT880),
+       ID(PCI_DEVICE_ID_VIA_PT880ULTRA),
        ID(PCI_DEVICE_ID_VIA_8783_0),
        ID(PCI_DEVICE_ID_VIA_PX8X0_0),
        ID(PCI_DEVICE_ID_VIA_3269_0),
index ef140ebde117339ab7c99120df2837f9499aadf7..07473cd84121b54c66fc47d7776d4d64d6eb02bf 100644 (file)
@@ -925,11 +925,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
        status = acpi_resource_to_address64(res, &addr);
 
        if (ACPI_SUCCESS(status)) {
-               unsigned long size;
-
-               size = addr.maximum - addr.minimum + 1;
                hdp->hd_phys_address = addr.minimum;
-               hdp->hd_address = ioremap(addr.minimum, size);
+               hdp->hd_address = ioremap(addr.minimum, addr.address_length);
 
                if (hpet_is_known(hdp)) {
                        printk(KERN_DEBUG "%s: 0x%lx is busy\n",
index b36eef0e9d199ff2751ddba5b77d812bacf489cb..02a7dd7a8a55571cbf261e63a9dcdf3cf7fbb969 100644 (file)
@@ -1184,20 +1184,20 @@ static void port_outl(struct si_sm_io *io, unsigned int offset,
 static void port_cleanup(struct smi_info *info)
 {
        unsigned int addr = info->io.addr_data;
-       int          mapsize;
+       int          idx;
 
        if (addr) {
-               mapsize = ((info->io_size * info->io.regspacing)
-                          - (info->io.regspacing - info->io.regsize));
-
-               release_region (addr, mapsize);
+               for (idx = 0; idx < info->io_size; idx++) {
+                       release_region(addr + idx * info->io.regspacing,
+                                      info->io.regsize);
+               }
        }
 }
 
 static int port_setup(struct smi_info *info)
 {
        unsigned int addr = info->io.addr_data;
-       int          mapsize;
+       int          idx;
 
        if (!addr)
                return -ENODEV;
@@ -1225,16 +1225,22 @@ static int port_setup(struct smi_info *info)
                return -EINVAL;
        }
 
-       /* Calculate the total amount of memory to claim.  This is an
-        * unusual looking calculation, but it avoids claiming any
-        * more memory than it has to.  It will claim everything
-        * between the first address to the end of the last full
-        * register. */
-       mapsize = ((info->io_size * info->io.regspacing)
-                  - (info->io.regspacing - info->io.regsize));
-
-       if (request_region(addr, mapsize, DEVICE_NAME) == NULL)
-               return -EIO;
+       /* Some BIOSes reserve disjoint I/O regions in their ACPI
+        * tables.  This causes problems when trying to register the
+        * entire I/O region.  Therefore we must register each I/O
+        * port separately.
+        */
+       for (idx = 0; idx < info->io_size; idx++) {
+               if (request_region(addr + idx * info->io.regspacing,
+                                  info->io.regsize, DEVICE_NAME) == NULL) {
+                       /* Undo allocations */
+                       while (idx--) {
+                               release_region(addr + idx * info->io.regspacing,
+                                              info->io.regsize);
+                       }
+                       return -EIO;
+               }
+       }
        return 0;
 }
 
index ede365d05387087ba4110a9f97fc74ba6c1971ef..b9371d5bf7906b48d4b340c5a8756c3fa132f516 100644 (file)
@@ -1384,8 +1384,10 @@ do_it_again:
                 * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
                 * we won't get any more characters.
                 */
-               if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE)
+               if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
+                       n_tty_set_room(tty);
                        check_unthrottle(tty);
+               }
 
                if (b - buf >= minimum)
                        break;
index 128b2632512d07f693d5925ce97791943cf9e3dd..eab5394da66647fe3f86f6d836646cf144f6db79 100644 (file)
@@ -149,7 +149,7 @@ struct cm4000_dev {
 #define        ZERO_DEV(dev)                                           \
        memset(&dev->atr_csum,0,                                \
                sizeof(struct cm4000_dev) -                     \
-               /*link*/ sizeof(struct pcmcia_device) -         \
+               /*link*/ sizeof(struct pcmcia_device *) -       \
                /*node*/ sizeof(dev_node_t) -                   \
                /*atr*/ MAX_ATR*sizeof(char) -                  \
                /*rbuf*/ 512*sizeof(char) -                     \
index 3ec73d1a279abf0b23e9676bb21ddaef54cd3cef..179cdbea712bc829467ae54b60a6e80fd3b2c4c3 100644 (file)
 #ifndef __rio_host_h__
 #define __rio_host_h__
 
-#ifdef SCCS_LABELS
-#ifndef lint
-static char *_host_h_sccs_ = "@(#)host.h       1.2";
-#endif
-#endif
-
 /*
 ** the host structure - one per host card in the system.
 */
@@ -77,9 +71,6 @@ struct Host {
 #define RC_STARTUP            1
 #define RC_RUNNING            2
 #define RC_STUFFED            3
-#define RC_SOMETHING          4
-#define RC_SOMETHING_NEW      5
-#define RC_SOMETHING_ELSE     6
 #define RC_READY              7
 #define RUN_STATE             7
 /*
index acda9326c2efa900a04636ccbd1c128a364e71bf..290143addd34cc8be99c1dbf5252746c48e3f5bc 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/slab.h>
 #include <linux/termios.h>
 #include <linux/serial.h>
+#include <linux/vmalloc.h>
 #include <asm/semaphore.h>
 #include <linux/generic_serial.h>
 #include <linux/errno.h>
index d31aba62bb7f362d87d8e38961f0abc2ba197abc..75b2557c37ec77c83cabb51ce01e9afcc5bccb00 100644 (file)
@@ -1394,14 +1394,17 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
                return RIO_FAIL;
        }
 
-       if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) {
-               rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum);
+       if ((PortP->InUse == (typeof(PortP->InUse))-1) ||
+                       !(CmdBlkP = RIOGetCmdBlk())) {
+               rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block "
+                       "for command %d on port %d\n", Cmd, PortP->PortNum);
                return RIO_FAIL;
        }
 
-       rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse);
+       rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n",
+                       CmdBlkP, PortP->InUse);
 
-       PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
+       PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];
 
        CmdBlkP->Packet.src_unit = 0;
        if (PortP->SecondBlock)
@@ -1425,38 +1428,46 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
 
        switch (Cmd) {
        case MEMDUMP:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p "
+                               "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
                PktCmdP->SubCommand = MEMDUMP;
                PktCmdP->SubAddr = SubCmd.Addr;
                break;
        case FCLOSE:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n",
+                               CmdBlkP);
                break;
        case READ_REGISTER:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) "
+                               "command blk %p\n", (int) SubCmd.Addr, CmdBlkP);
                PktCmdP->SubCommand = READ_REGISTER;
                PktCmdP->SubAddr = SubCmd.Addr;
                break;
        case RESUME:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n",
+                               CmdBlkP);
                break;
        case RFLUSH:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n",
+                               CmdBlkP);
                CmdBlkP->PostFuncP = RIORFlushEnable;
                break;
        case SUSPEND:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n",
+                               CmdBlkP);
                break;
 
        case MGET:
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n",
+                               CmdBlkP);
                break;
 
        case MSET:
        case MBIC:
        case MBIS:
                CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
-               rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP);
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command "
+                               "blk %p\n", CmdBlkP);
                break;
 
        case WFLUSH:
@@ -1465,12 +1476,14 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
                 ** allowed then we should not bother sending any more to the
                 ** RTA.
                 */
-               if ((int) ((char) PortP->WflushFlag) == (int) -1) {
-                       rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!");
+               if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, "
+                                       "WflushFlag about to wrap!");
                        RIOFreeCmdBlk(CmdBlkP);
                        return (RIO_FAIL);
                } else {
-                       rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP);
+                       rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command "
+                                       "blk %p\n", CmdBlkP);
                        CmdBlkP->PostFuncP = RIOWFlushMark;
                }
                break;
index 14b83fae75c8ed1abc890615337e546decfa7850..e8af5b30519e39e64381c58e1a0e709a67340cbe 100644 (file)
 #ifndef        __rioioctl_h__
 #define        __rioioctl_h__
 
-#ifdef SCCS_LABELS
-static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h       1.2";
-#endif
-
 /*
 ** RIO device driver - user ioctls and associated structures.
 */
@@ -44,55 +40,13 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h    1.2";
 struct portStats {
        int port;
        int gather;
-       ulong txchars;
-       ulong rxchars;
-       ulong opens;
-       ulong closes;
-       ulong ioctls;
+       unsigned long txchars;
+       unsigned long rxchars;
+       unsigned long opens;
+       unsigned long closes;
+       unsigned long ioctls;
 };
 
-
-#define rIOC   ('r'<<8)
-#define        TCRIOSTATE      (rIOC | 1)
-#define        TCRIOXPON       (rIOC | 2)
-#define        TCRIOXPOFF      (rIOC | 3)
-#define        TCRIOXPCPS      (rIOC | 4)
-#define        TCRIOXPRINT     (rIOC | 5)
-#define TCRIOIXANYON   (rIOC | 6)
-#define        TCRIOIXANYOFF   (rIOC | 7)
-#define TCRIOIXONON    (rIOC | 8)
-#define        TCRIOIXONOFF    (rIOC | 9)
-#define        TCRIOMBIS       (rIOC | 10)
-#define        TCRIOMBIC       (rIOC | 11)
-#define        TCRIOTRIAD      (rIOC | 12)
-#define TCRIOTSTATE    (rIOC | 13)
-
-/*
-** 15.10.1998 ARG - ESIL 0761 part fix
-** Add RIO ioctls for manipulating RTS and CTS flow control, (as LynxOS
-** appears to not support hardware flow control).
-*/
-#define TCRIOCTSFLOWEN (rIOC | 14)     /* enable CTS flow control */
-#define TCRIOCTSFLOWDIS        (rIOC | 15)     /* disable CTS flow control */
-#define TCRIORTSFLOWEN (rIOC | 16)     /* enable RTS flow control */
-#define TCRIORTSFLOWDIS        (rIOC | 17)     /* disable RTS flow control */
-
-/*
-** 09.12.1998 ARG - ESIL 0776 part fix
-** Definition for 'RIOC' also appears in daemon.h, so we'd better do a
-** #ifndef here first.
-** 'RIO_QUICK_CHECK' also #define'd here as this ioctl is now
-** allowed to be used by customers.
-**
-** 05.02.1999 ARG -
-** This is what I've decied to do with ioctls etc., which are intended to be
-** invoked from users applications :
-** Anything that needs to be defined here will be removed from daemon.h, that
-** way it won't end up having to be defined/maintained in two places. The only
-** consequence of this is that this file should now be #include'd by daemon.h
-**
-** 'stats' ioctls now #define'd here as they are to be used by customers.
-*/
 #define        RIOC    ('R'<<8)|('i'<<16)|('o'<<24)
 
 #define        RIO_QUICK_CHECK         (RIOC | 105)
index a90f5d97df35dc8c262145efe0187085a6bd2009..43dfd8689dce31a0b8230c12c3ad922763cc4f77 100644 (file)
@@ -512,7 +512,7 @@ static struct sonypi_device {
 
 #ifdef CONFIG_ACPI
 static struct acpi_device *sonypi_acpi_device;
-static int acpi_enabled;
+static int acpi_driver_registered;
 #endif
 
 static int sonypi_ec_write(u8 addr, u8 value)
@@ -869,7 +869,7 @@ found:
                sonypi_report_input_event(event);
 
 #ifdef CONFIG_ACPI
-       if (acpi_enabled)
+       if (sonypi_acpi_device)
                acpi_bus_generate_event(sonypi_acpi_device, 1, event);
 #endif
 
@@ -1551,8 +1551,8 @@ static int __init sonypi_init(void)
                goto err_free_device;
 
 #ifdef CONFIG_ACPI
-       if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0)
-               acpi_enabled = 1;
+       if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0)
+               acpi_driver_registered = 1;
 #endif
 
        return 0;
@@ -1567,7 +1567,7 @@ static int __init sonypi_init(void)
 static void __exit sonypi_exit(void)
 {
 #ifdef CONFIG_ACPI
-       if (acpi_enabled)
+       if (acpi_driver_registered)
                acpi_bus_unregister_driver(&sonypi_acpi_driver);
 #endif
        platform_device_unregister(sonypi_platform_device);
index 1efde3b27619b4113ca95ee1ca3116f6409b0ca2..fe00c7dfb649bf054376aa30522cb6c1ed2098e7 100644 (file)
@@ -22,7 +22,7 @@ config TCG_TPM
 
 config TCG_TIS
        tristate "TPM Interface Specification 1.2 Interface"
-       depends on TCG_TPM
+       depends on TCG_TPM && PNPACPI
        ---help---
          If you have a TPM security chip that is compliant with the
          TCG TIS 1.2 TPM specification say Yes and it will be accessible
index 54a4c804e25f30fc38eed78e5a4b32d2e07f1bc9..050ced247f68018224addcc572e7faa7f6f47fec 100644 (file)
@@ -140,7 +140,7 @@ extern int tpm_pm_resume(struct device *);
 extern struct dentry ** tpm_bios_log_setup(char *);
 extern void tpm_bios_log_teardown(struct dentry **);
 #else
-static inline struct dentry* tpm_bios_log_setup(char *name)
+static inline struct dentry ** tpm_bios_log_setup(char *name)
 {
        return NULL;
 }
index e45f0d3d12de5427cf708585d08e3c615d8e087e..a611972024e65942edb58b23d8d176ec6ae456cb 100644 (file)
@@ -105,6 +105,12 @@ static const char* tcpa_event_type_strings[] = {
        "Non-Host Info"
 };
 
+struct tcpa_pc_event {
+       u32 event_id;
+       u32 event_size;
+       u8 event_data[0];
+};
+
 enum tcpa_pc_event_ids {
        SMBIOS = 1,
        BIS_CERT,
@@ -114,14 +120,15 @@ enum tcpa_pc_event_ids {
        NVRAM,
        OPTION_ROM_EXEC,
        OPTION_ROM_CONFIG,
-       OPTION_ROM_MICROCODE,
+       OPTION_ROM_MICROCODE = 10,
        S_CRTM_VERSION,
        S_CRTM_CONTENTS,
        POST_CONTENTS,
+       HOST_TABLE_OF_DEVICES,
 };
 
 static const char* tcpa_pc_event_id_strings[] = {
-       ""
+       "",
        "SMBIOS",
        "BIS Certificate",
        "POST BIOS ",
@@ -130,11 +137,12 @@ static const char* tcpa_pc_event_id_strings[] = {
        "NVRAM",
        "Option ROM",
        "Option ROM config",
-       "Option ROM microcode",
+       "",
+       "Option ROM microcode ",
        "S-CRTM Version",
-       "S-CRTM Contents",
-       "S-CRTM POST Contents",
-       "POST Contents",
+       "S-CRTM Contents ",
+       "POST Contents ",
+       "Table of Devices",
 };
 
 /* returns pointer to start of pos. entry of tcg log */
@@ -206,7 +214,7 @@ static int get_event_name(char *dest, struct tcpa_event *event,
        const char *name = "";
        char data[40] = "";
        int i, n_len = 0, d_len = 0;
-       u32 event_id;
+       struct tcpa_pc_event *pc_event;
 
        switch(event->event_type) {
        case PREBOOT:
@@ -235,31 +243,32 @@ static int get_event_name(char *dest, struct tcpa_event *event,
                }
                break;
        case EVENT_TAG:
-               event_id = be32_to_cpu(*((u32 *)event_entry));
+               pc_event = (struct tcpa_pc_event *)event_entry;
 
                /* ToDo Row data -> Base64 */
 
-               switch (event_id) {
+               switch (pc_event->event_id) {
                case SMBIOS:
                case BIS_CERT:
                case CMOS:
                case NVRAM:
                case OPTION_ROM_EXEC:
                case OPTION_ROM_CONFIG:
-               case OPTION_ROM_MICROCODE:
                case S_CRTM_VERSION:
-               case S_CRTM_CONTENTS:
-               case POST_CONTENTS:
-                       name = tcpa_pc_event_id_strings[event_id];
+                       name = tcpa_pc_event_id_strings[pc_event->event_id];
                        n_len = strlen(name);
                        break;
+               /* hash data */
                case POST_BIOS_ROM:
                case ESCD:
-                       name = tcpa_pc_event_id_strings[event_id];
+               case OPTION_ROM_MICROCODE:
+               case S_CRTM_CONTENTS:
+               case POST_CONTENTS:
+                       name = tcpa_pc_event_id_strings[pc_event->event_id];
                        n_len = strlen(name);
                        for (i = 0; i < 20; i++)
-                               d_len += sprintf(data, "%02x",
-                                               event_entry[8 + i]);
+                               d_len += sprintf(&data[2*i], "%02x",
+                                               pc_event->event_data[i]);
                        break;
                default:
                        break;
@@ -275,53 +284,13 @@ static int get_event_name(char *dest, struct tcpa_event *event,
 
 static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
 {
+       struct tcpa_event *event = v;
+       char *data = v;
+       int i;
 
-       char *eventname;
-       char data[4];
-       u32 help;
-       int i, len;
-       struct tcpa_event *event = (struct tcpa_event *) v;
-       unsigned char *event_entry =
-           (unsigned char *) (v + sizeof(struct tcpa_event));
-
-       eventname = kmalloc(MAX_TEXT_EVENT, GFP_KERNEL);
-       if (!eventname) {
-               printk(KERN_ERR "%s: ERROR - No Memory for event name\n ",
-                      __func__);
-               return -ENOMEM;
-       }
-
-       /* 1st: PCR used is in little-endian format (4 bytes) */
-       help = le32_to_cpu(event->pcr_index);
-       memcpy(data, &help, 4);
-       for (i = 0; i < 4; i++)
-               seq_putc(m, data[i]);
-
-       /* 2nd: SHA1 (20 bytes) */
-       for (i = 0; i < 20; i++)
-               seq_putc(m, event->pcr_value[i]);
-
-       /* 3rd: event type identifier (4 bytes) */
-       help = le32_to_cpu(event->event_type);
-       memcpy(data, &help, 4);
-       for (i = 0; i < 4; i++)
+       for (i = 0; i < sizeof(struct tcpa_event) + event->event_size; i++)
                seq_putc(m, data[i]);
 
-       len = 0;
-
-       len += get_event_name(eventname, event, event_entry);
-
-       /* 4th:  filename <= 255 + \'0' delimiter */
-       if (len > TCG_EVENT_NAME_LEN_MAX)
-               len = TCG_EVENT_NAME_LEN_MAX;
-
-       for (i = 0; i < len; i++)
-               seq_putc(m, eventname[i]);
-
-       /* 5th: delimiter */
-       seq_putc(m, '\0');
-
-       kfree(eventname);
        return 0;
 }
 
index b9cae9a238bb651d7814740b013ae39899d9f727..8ea70625f7ea08bbf2714933cf2e58acd1da44bf 100644 (file)
@@ -55,7 +55,7 @@ enum tis_int_flags {
 };
 
 enum tis_defaults {
-       TIS_MEM_BASE = 0xFED4000,
+       TIS_MEM_BASE = 0xFED40000,
        TIS_MEM_LEN = 0x5000,
        TIS_SHORT_TIMEOUT = 750,        /* ms */
        TIS_LONG_TIMEOUT = 2000,        /* 2 sec */
@@ -457,10 +457,6 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
        }
 
        vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
-       if ((vendor & 0xFFFF) == 0xFFFF) {
-               rc = -ENODEV;
-               goto out_err;
-       }
 
        /* Default timeouts */
        chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
index f07637a8f88fd038bac53f44c7181ea901c2ec51..a88b94a82b140f42b24d68409f651392805e0465 100644 (file)
@@ -398,7 +398,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty,
        while (unlikely(size > copied));
        return copied;
 }
-EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags);
+EXPORT_SYMBOL(tty_insert_flip_string_flags);
 
 void tty_schedule_flip(struct tty_struct *tty)
 {
index acc5d47844eb49a53578f688949f04e039c04962..6c94879e0b99b6f6a369d69a188b347436abe550 100644 (file)
@@ -3238,14 +3238,6 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org)
        }
 }
 
-int is_console_suspend_safe(void)
-{
-       /* It is unsafe to suspend devices while X has control of the
-        * hardware. Make sure we are running on a kernel-controlled console.
-        */
-       return vc_cons[fg_console].d->vc_mode == KD_TEXT;
-}
-
 /*
  *     Visible symbols for modules
  */
index a13395e2c372a9b27355040c9c94eae21040992b..fa2ba9ebe42aacf3478212143547c460d877402e 100644 (file)
  *     82801E   (C-ICH)  : document number 273599-001, 273645-002,
  *     82801EB  (ICH5)   : document number 252516-001, 252517-003,
  *     82801ER  (ICH5R)  : document number 252516-001, 252517-003,
- *     82801FB  (ICH6)   : document number 301473-002, 301474-007,
- *     82801FR  (ICH6R)  : document number 301473-002, 301474-007,
- *     82801FBM (ICH6-M) : document number 301473-002, 301474-007,
- *     82801FW  (ICH6W)  : document number 301473-001, 301474-007,
- *     82801FRW (ICH6RW) : document number 301473-001, 301474-007
  *
  *  20000710 Nils Faerber
  *     Initial Version 0.01
  *  20050807 Wim Van Sebroeck <wim@iguana.be>
  *     0.08 Make sure that the watchdog is only "armed" when started.
  *          (Kernel Bug 4251)
+ *  20060416 Wim Van Sebroeck <wim@iguana.be>
+ *     0.09 Remove support for the ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW and
+ *          ICH7 chipsets. (See Kernel Bug 6031 - other code will support these
+ *          chipsets)
  */
 
 /*
@@ -90,7 +89,7 @@
 #include "i8xx_tco.h"
 
 /* Module and version information */
-#define TCO_VERSION "0.08"
+#define TCO_VERSION "0.09"
 #define TCO_MODULE_NAME "i8xx TCO timer"
 #define TCO_DRIVER_NAME   TCO_MODULE_NAME ", v" TCO_VERSION
 #define PFX TCO_MODULE_NAME ": "
@@ -391,11 +390,6 @@ static struct pci_device_id i8xx_tco_pci_tbl[] = {
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12,  PCI_ANY_ID, PCI_ANY_ID, },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0,    PCI_ANY_ID, PCI_ANY_ID, },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,   PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0,      PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,      PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2,      PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0,      PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1,      PCI_ANY_ID, PCI_ANY_ID, },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1,       PCI_ANY_ID, PCI_ANY_ID, },
        { 0, },                 /* End of list */
 };
index 9dc54736e4eb627d5e843bda4e2bc2a243aa0840..1ea04e9b2b0b0938cfc2cbfa04b2eed12b4da01b 100644 (file)
@@ -423,6 +423,12 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
        if (tmr_atboot && started == 0) {
                printk(KERN_INFO PFX "Starting Watchdog Timer\n");
                s3c2410wdt_start();
+       } else if (!tmr_atboot) {
+               /* if we're not enabling the watchdog, then ensure it is
+                * disabled if it has been left running from the bootloader
+                * or other source */
+
+               s3c2410wdt_stop();
        }
 
        return 0;
index 515ce757204996c188589e74ce29341f8b41ab76..20b88f9b7be20d9081c58a72e217a89a394661f2 100644 (file)
@@ -377,7 +377,7 @@ static int __init sc1200wdt_init(void)
 {
        int ret;
 
-       printk(banner);
+       printk("%s\n", banner);
 
        spin_lock_init(&sc1200wdt_lock);
        sema_init(&open_sem, 1);
index 8bd305e47f0d1d87ce5718a04a6812865b6841a0..766cc969c4d0c784abd0ef926363f2c37c7d735f 100644 (file)
@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
 
                outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
                outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
+
+               /* Reset the status register */
+               outb(0, ACBST);
                return;
        }
 
@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
        timeout = jiffies + POLL_TIMEOUT;
        while (time_before(jiffies, timeout)) {
                status = inb(ACBST);
+
+               /* Reset the status register to avoid the hang */
+               outb(0, ACBST);
+
                if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) {
                        scx200_acb_machine(iface, status);
                        return;
@@ -415,7 +422,6 @@ static int  __init scx200_acb_create(const char *text, int base, int index)
        struct scx200_acb_iface *iface;
        struct i2c_adapter *adapter;
        int rc;
-       char description[64];
 
        iface = kzalloc(sizeof(*iface), GFP_KERNEL);
        if (!iface) {
@@ -434,10 +440,7 @@ static int  __init scx200_acb_create(const char *text, int base, int index)
 
        mutex_init(&iface->mutex);
 
-       snprintf(description, sizeof(description), "%s ACCESS.bus [%s]",
-                text, adapter->name);
-
-       if (request_region(base, 8, description) == 0) {
+       if (!request_region(base, 8, adapter->name)) {
                printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
                        base, base + 8-1);
                rc = -EBUSY;
@@ -488,7 +491,7 @@ static struct pci_device_id divil_pci[] = {
 
 #define MSR_LBAR_SMB           0x5140000B
 
-static int scx200_add_cs553x(void)
+static __init int scx200_add_cs553x(void)
 {
        u32     low, hi;
        u32     smb_base;
@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void)
        } else if (pci_dev_present(divil_pci))
                rc = scx200_add_cs553x();
 
+       /* If at least one bus was created, init must succeed */
+       if (scx200_acb_list)
+               return 0;
        return rc;
 }
 
index 4961f1e764a755bf4729951b7447620dea02d04f..602797a4420877f6fc74e659a05b4c50be8d54d6 100644 (file)
@@ -392,6 +392,7 @@ static struct pcmcia_device_id ide_ids[] = {
        PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
        PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae),
        PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178),
+       PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
        PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
        PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2      ", 0x547e66dc, 0x8671043b),
        PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
index 43b96e298363ac9d441235206c33020ab133269a..27c9eb989a9a087196804e1de14aed5a1e7a2d3a 100644 (file)
@@ -345,17 +345,17 @@ sgiioc4_resetproc(ide_drive_t * drive)
 static u8
 sgiioc4_INB(unsigned long port)
 {
-       u8 reg = (u8) inb(port);
+       u8 reg = (u8) readb((void __iomem *) port);
 
        if ((port & 0xFFF) == 0x11C) {  /* Status register of IOC4 */
                if (reg & 0x51) {       /* Not busy...check for interrupt */
                        unsigned long other_ir = port - 0x110;
-                       unsigned int intr_reg = (u32) inl(other_ir);
+                       unsigned int intr_reg = (u32) readl((void __iomem *) other_ir);
 
                        /* Clear the Interrupt, Error bits on the IOC4 */
                        if (intr_reg & 0x03) {
-                               outl(0x03, other_ir);
-                               intr_reg = (u32) inl(other_ir);
+                               writel(0x03, (void __iomem *) other_ir);
+                               intr_reg = (u32) readl((void __iomem *) other_ir);
                        }
                }
        }
@@ -606,6 +606,12 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
        hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off;
        hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq;
        hwif->ide_dma_timeout = &__ide_dma_timeout;
+
+       /*
+        * The IOC4 uses MMIO rather than Port IO.
+        * It also needs special workarounds for INB.
+        */
+       default_hwif_mmiops(hwif);
        hwif->INB = &sgiioc4_INB;
 }
 
@@ -743,6 +749,6 @@ ioc4_ide_exit(void)
 module_init(ioc4_ide_init);
 module_exit(ioc4_ide_exit);
 
-MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)");
+MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon");
 MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card");
 MODULE_LICENSE("GPL");
index 78e30f80367129e34fa983fb97fd091acc8d6bf1..ffca8b63ee79af28a1363df86c359fbcde1e12ef 100644 (file)
@@ -553,6 +553,8 @@ pmac_ide_init_hwif_ports(hw_regs_t *hw,
 
        if (irq != NULL)
                *irq = pmac_ide[ix].irq;
+
+       hw->dev = &pmac_ide[ix].mdev->ofdev.dev;
 }
 
 #define PMAC_IDE_REG(x) ((void __iomem *)(IDE_DATA_REG+(x)))
index 19222878aae92943f5528d09e67582a517048024..11f13778f13915e35bea6075dae7676e717952f9 100644 (file)
@@ -553,7 +553,7 @@ static void ohci_initialize(struct ti_ohci *ohci)
         * register content.
         * To actually enable physical responses is the job of our interrupt
         * handler which programs the physical request filter. */
-       reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000);
+       reg_write(ohci, OHCI1394_PhyUpperBound, 0x01000000);
 
        DBGMSG("physUpperBoundOffset=%08x",
               reg_read(ohci, OHCI1394_PhyUpperBound));
index f4206604db0378fb33fda046cb403f4a346cdb45..5413dc43b9f1b2eb5bda4f976434535e91af3e1e 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/string.h>
+#include <linux/stringify.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/fs.h>
@@ -117,7 +118,8 @@ MODULE_PARM_DESC(serialize_io, "Serialize I/O coming from scsi drivers (default
  */
 static int max_sectors = SBP2_MAX_SECTORS;
 module_param(max_sectors, int, 0444);
-MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = 255)");
+MODULE_PARM_DESC(max_sectors, "Change max sectors per I/O supported (default = "
+                __stringify(SBP2_MAX_SECTORS) ")");
 
 /*
  * Exclusive login to sbp2 device? In most cases, the sbp2 driver should
@@ -135,18 +137,45 @@ module_param(exclusive_login, int, 0644);
 MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device (default = 1)");
 
 /*
- * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on
- * if your sbp2 device is not properly handling the SCSI inquiry command.
- * This hack makes the inquiry look more like a typical MS Windows inquiry
- * by enforcing 36 byte inquiry and avoiding access to mode_sense page 8.
+ * If any of the following workarounds is required for your device to work,
+ * please submit the kernel messages logged by sbp2 to the linux1394-devel
+ * mailing list.
  *
- * If force_inquiry_hack=1 is required for your device to work,
- * please submit the logged sbp2_firmware_revision value of this device to
- * the linux1394-devel mailing list.
+ * - 128kB max transfer
+ *   Limit transfer size. Necessary for some old bridges.
+ *
+ * - 36 byte inquiry
+ *   When scsi_mod probes the device, let the inquiry command look like that
+ *   from MS Windows.
+ *
+ * - skip mode page 8
+ *   Suppress sending of mode_sense for mode page 8 if the device pretends to
+ *   support the SCSI Primary Block commands instead of Reduced Block Commands.
+ *
+ * - fix capacity
+ *   Tell sd_mod to correct the last sector number reported by read_capacity.
+ *   Avoids access beyond actual disk limits on devices with an off-by-one bug.
+ *   Don't use this with devices which don't have this bug.
+ *
+ * - override internal blacklist
+ *   Instead of adding to the built-in blacklist, use only the workarounds
+ *   specified in the module load parameter.
+ *   Useful if a blacklist entry interfered with a non-broken device.
  */
+static int sbp2_default_workarounds;
+module_param_named(workarounds, sbp2_default_workarounds, int, 0644);
+MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
+       ", 128kB max transfer = " __stringify(SBP2_WORKAROUND_128K_MAX_TRANS)
+       ", 36 byte inquiry = "    __stringify(SBP2_WORKAROUND_INQUIRY_36)
+       ", skip mode page 8 = "   __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
+       ", fix capacity = "       __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
+       ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
+       ", or a combination)");
+
+/* legacy parameter */
 static int force_inquiry_hack;
 module_param(force_inquiry_hack, int, 0644);
-MODULE_PARM_DESC(force_inquiry_hack, "Force SCSI inquiry hack (default = 0)");
+MODULE_PARM_DESC(force_inquiry_hack, "Deprecated, use 'workarounds'");
 
 /*
  * Export information about protocols/devices supported by this driver.
@@ -266,14 +295,55 @@ static struct hpsb_protocol_driver sbp2_driver = {
 };
 
 /*
- * List of device firmwares that require the inquiry hack.
- * Yields a few false positives but did not break other devices so far.
+ * List of devices with known bugs.
+ *
+ * The firmware_revision field, masked with 0xffff00, is the best indicator
+ * for the type of bridge chip of a device.  It yields a few false positives
+ * but this did not break correctly behaving devices so far.
  */
-static u32 sbp2_broken_inquiry_list[] = {
-       0x00002800,     /* Stefan Richter <stefanr@s5r6.in-berlin.de> */
-                       /* DViCO Momobay CX-1 */
-       0x00000200      /* Andreas Plesch <plesch@fas.harvard.edu> */
-                       /* QPS Fire DVDBurner */
+static const struct {
+       u32 firmware_revision;
+       u32 model_id;
+       unsigned workarounds;
+} sbp2_workarounds_table[] = {
+       /* TSB42AA9 */ {
+               .firmware_revision      = 0x002800,
+               .workarounds            = SBP2_WORKAROUND_INQUIRY_36 |
+                                         SBP2_WORKAROUND_MODE_SENSE_8,
+       },
+       /* Initio bridges, actually only needed for some older ones */ {
+               .firmware_revision      = 0x000200,
+               .workarounds            = SBP2_WORKAROUND_INQUIRY_36,
+       },
+       /* Symbios bridge */ {
+               .firmware_revision      = 0xa0b800,
+               .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
+       },
+       /*
+        * Note about the following Apple iPod blacklist entries:
+        *
+        * There are iPods (2nd gen, 3rd gen) with model_id==0.  Since our
+        * matching logic treats 0 as a wildcard, we cannot match this ID
+        * without rewriting the matching routine.  Fortunately these iPods
+        * do not feature the read_capacity bug according to one report.
+        * Read_capacity behaviour as well as model_id could change due to
+        * Apple-supplied firmware updates though.
+        */
+       /* iPod 4th generation */ {
+               .firmware_revision      = 0x0a2700,
+               .model_id               = 0x000021,
+               .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
+       },
+       /* iPod mini */ {
+               .firmware_revision      = 0x0a2700,
+               .model_id               = 0x000023,
+               .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
+       },
+       /* iPod Photo */ {
+               .firmware_revision      = 0x0a2700,
+               .model_id               = 0x00007e,
+               .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
+       }
 };
 
 /**************************************
@@ -765,12 +835,17 @@ static struct scsi_id_instance_data *sbp2_alloc_device(struct unit_directory *ud
 
        /* Register the status FIFO address range. We could use the same FIFO
         * for targets at different nodes. However we need different FIFOs per
-        * target in order to support multi-unit devices. */
+        * target in order to support multi-unit devices.
+        * The FIFO is located out of the local host controller's physical range
+        * but, if possible, within the posted write area. Status writes will
+        * then be performed as unified transactions. This slightly reduces
+        * bandwidth usage, and some Prolific based devices seem to require it.
+        */
        scsi_id->status_fifo_addr = hpsb_allocate_and_register_addrspace(
                        &sbp2_highlevel, ud->ne->host, &sbp2_ops,
                        sizeof(struct sbp2_status_block), sizeof(quadlet_t),
-                       ~0ULL, ~0ULL);
-       if (!scsi_id->status_fifo_addr) {
+                       0x010000000000ULL, CSR1212_ALL_SPACE_END);
+       if (scsi_id->status_fifo_addr == ~0ULL) {
                SBP2_ERR("failed to allocate status FIFO address range");
                goto failed_alloc;
        }
@@ -1450,7 +1525,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
        struct csr1212_dentry *dentry;
        u64 management_agent_addr;
        u32 command_set_spec_id, command_set, unit_characteristics,
-           firmware_revision, workarounds;
+           firmware_revision;
+       unsigned workarounds;
        int i;
 
        SBP2_DEBUG_ENTER();
@@ -1506,12 +1582,8 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
                case SBP2_FIRMWARE_REVISION_KEY:
                        /* Firmware revision */
                        firmware_revision = kv->value.immediate;
-                       if (force_inquiry_hack)
-                               SBP2_INFO("sbp2_firmware_revision = %x",
-                                         (unsigned int)firmware_revision);
-                       else
-                               SBP2_DEBUG("sbp2_firmware_revision = %x",
-                                          (unsigned int)firmware_revision);
+                       SBP2_DEBUG("sbp2_firmware_revision = %x",
+                                  (unsigned int)firmware_revision);
                        break;
 
                default:
@@ -1519,41 +1591,44 @@ static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
                }
        }
 
-       /* This is the start of our broken device checking. We try to hack
-        * around oddities and known defects.  */
-       workarounds = 0x0;
+       workarounds = sbp2_default_workarounds;
+       if (force_inquiry_hack) {
+               SBP2_WARN("force_inquiry_hack is deprecated. "
+                         "Use parameter 'workarounds' instead.");
+               workarounds |= SBP2_WORKAROUND_INQUIRY_36;
+       }
 
-       /* If the vendor id is 0xa0b8 (Symbios vendor id), then we have a
-        * bridge with 128KB max transfer size limitation. For sanity, we
-        * only voice this when the current max_sectors setting
-        * exceeds the 128k limit. By default, that is not the case.
-        *
-        * It would be really nice if we could detect this before the scsi
-        * host gets initialized. That way we can down-force the
-        * max_sectors to account for it. That is not currently
-        * possible.  */
-       if ((firmware_revision & 0xffff00) ==
-                       SBP2_128KB_BROKEN_FIRMWARE &&
-                       (max_sectors * 512) > (128*1024)) {
-               SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.",
-                               NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid));
-               SBP2_WARN("WARNING: Current max_sectors setting is larger than 128KB (%d sectors)!",
-                               max_sectors);
-               workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER;
-       }
-
-       /* Check for a blacklisted set of devices that require us to force
-        * a 36 byte host inquiry. This can be overriden as a module param
-        * (to force all hosts).  */
-       for (i = 0; i < ARRAY_SIZE(sbp2_broken_inquiry_list); i++) {
-               if ((firmware_revision & 0xffff00) ==
-                               sbp2_broken_inquiry_list[i]) {
-                       SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround",
-                                       NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid));
-                       workarounds |= SBP2_BREAKAGE_INQUIRY_HACK;
-                       break; /* No need to continue. */
+       if (!(workarounds & SBP2_WORKAROUND_OVERRIDE))
+               for (i = 0; i < ARRAY_SIZE(sbp2_workarounds_table); i++) {
+                       if (sbp2_workarounds_table[i].firmware_revision &&
+                           sbp2_workarounds_table[i].firmware_revision !=
+                           (firmware_revision & 0xffff00))
+                               continue;
+                       if (sbp2_workarounds_table[i].model_id &&
+                           sbp2_workarounds_table[i].model_id != ud->model_id)
+                               continue;
+                       workarounds |= sbp2_workarounds_table[i].workarounds;
+                       break;
                }
-       }
+
+       if (workarounds)
+               SBP2_INFO("Workarounds for node " NODE_BUS_FMT ": 0x%x "
+                         "(firmware_revision 0x%06x, vendor_id 0x%06x,"
+                         " model_id 0x%06x)",
+                         NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),
+                         workarounds, firmware_revision,
+                         ud->vendor_id ? ud->vendor_id : ud->ne->vendor_id,
+                         ud->model_id);
+
+       /* We would need one SCSI host template for each target to adjust
+        * max_sectors on the fly, therefore warn only. */
+       if (workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&
+           (max_sectors * 512) > (128 * 1024))
+               SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB "
+                         "max transfer size. WARNING: Current max_sectors "
+                         "setting is larger than 128KB (%d sectors)",
+                         NODE_BUS_ARGS(ud->ne->host, ud->ne->nodeid),
+                         max_sectors);
 
        /* If this is a logical unit directory entry, process the parent
         * to get the values. */
@@ -2447,19 +2522,25 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
 
        scsi_id->sdev = sdev;
 
-       if (force_inquiry_hack ||
-           scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) {
+       if (scsi_id->workarounds & SBP2_WORKAROUND_INQUIRY_36)
                sdev->inquiry_len = 36;
-               sdev->skip_ms_page_8 = 1;
-       }
        return 0;
 }
 
 static int sbp2scsi_slave_configure(struct scsi_device *sdev)
 {
+       struct scsi_id_instance_data *scsi_id =
+               (struct scsi_id_instance_data *)sdev->host->hostdata[0];
+
        blk_queue_dma_alignment(sdev->request_queue, (512 - 1));
        sdev->use_10_for_rw = 1;
        sdev->use_10_for_ms = 1;
+
+       if (sdev->type == TYPE_DISK &&
+           scsi_id->workarounds & SBP2_WORKAROUND_MODE_SENSE_8)
+               sdev->skip_ms_page_8 = 1;
+       if (scsi_id->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
+               sdev->fix_capacity = 1;
        return 0;
 }
 
@@ -2603,7 +2684,9 @@ static int sbp2_module_init(void)
                scsi_driver_template.cmd_per_lun = 1;
        }
 
-       /* Set max sectors (module load option). Default is 255 sectors. */
+       if (sbp2_default_workarounds & SBP2_WORKAROUND_128K_MAX_TRANS &&
+           (max_sectors * 512) > (128 * 1024))
+               max_sectors = 128 * 1024 / 512;
        scsi_driver_template.max_sectors = max_sectors;
 
        /* Register our high level driver with 1394 stack */
index e2d357a9ea3a46d9f3a13328f1f3a3f1b3412149..f4ccc9d0fba4106d6a8da4e6f886b45f3172993f 100644 (file)
@@ -226,11 +226,6 @@ struct sbp2_status_block {
 #define SBP2_UNIT_SPEC_ID_ENTRY                                        0x0000609e
 #define SBP2_SW_VERSION_ENTRY                                  0x00010483
 
-/*
- * Other misc defines
- */
-#define SBP2_128KB_BROKEN_FIRMWARE                             0xa0b800
-
 /*
  * SCSI specific stuff
  */
@@ -239,6 +234,13 @@ struct sbp2_status_block {
 #define SBP2_MAX_SECTORS               255     /* Max sectors supported */
 #define SBP2_MAX_CMDS                  8       /* This should be safe */
 
+/* Flags for detected oddities and brokeness */
+#define SBP2_WORKAROUND_128K_MAX_TRANS 0x1
+#define SBP2_WORKAROUND_INQUIRY_36     0x2
+#define SBP2_WORKAROUND_MODE_SENSE_8   0x4
+#define SBP2_WORKAROUND_FIX_CAPACITY   0x8
+#define SBP2_WORKAROUND_OVERRIDE       0x100
+
 /* This is the two dma types we use for cmd_dma below */
 enum cmd_dma_types {
        CMD_DMA_NONE,
@@ -268,10 +270,6 @@ struct sbp2_command_info {
 
 };
 
-/* A list of flags for detected oddities and brokeness. */
-#define SBP2_BREAKAGE_128K_MAX_TRANSFER                0x1
-#define SBP2_BREAKAGE_INQUIRY_HACK             0x2
-
 struct sbp2scsi_host_info;
 
 /*
@@ -345,7 +343,7 @@ struct scsi_id_instance_data {
        struct Scsi_Host *scsi_host;
 
        /* Device specific workarounds/brokeness */
-       u32 workarounds;
+       unsigned workarounds;
 };
 
 /* Sbp2 host data structure (one per IEEE1394 host) */
index 7cfedb8d9bcd963dc81a04ad11eac0322f30eee8..86fee43502cd2a977030d48fad69810fc7f0ac0f 100644 (file)
@@ -34,6 +34,8 @@
  *
  * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $
  */
+
+#include <linux/completion.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/idr.h>
@@ -122,7 +124,7 @@ struct cm_id_private {
        struct rb_node service_node;
        struct rb_node sidr_id_node;
        spinlock_t lock;        /* Do not acquire inside cm.lock */
-       wait_queue_head_t wait;
+       struct completion comp;
        atomic_t refcount;
 
        struct ib_mad_send_buf *msg;
@@ -159,7 +161,7 @@ static void cm_work_handler(void *data);
 static inline void cm_deref_id(struct cm_id_private *cm_id_priv)
 {
        if (atomic_dec_and_test(&cm_id_priv->refcount))
-               wake_up(&cm_id_priv->wait);
+               complete(&cm_id_priv->comp);
 }
 
 static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
@@ -559,7 +561,7 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
                goto error;
 
        spin_lock_init(&cm_id_priv->lock);
-       init_waitqueue_head(&cm_id_priv->wait);
+       init_completion(&cm_id_priv->comp);
        INIT_LIST_HEAD(&cm_id_priv->work_list);
        atomic_set(&cm_id_priv->work_count, -1);
        atomic_set(&cm_id_priv->refcount, 1);
@@ -724,8 +726,8 @@ retest:
        }
 
        cm_free_id(cm_id->local_id);
-       atomic_dec(&cm_id_priv->refcount);
-       wait_event(cm_id_priv->wait, !atomic_read(&cm_id_priv->refcount));
+       cm_deref_id(cm_id_priv);
+       wait_for_completion(&cm_id_priv->comp);
        while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
                cm_free_work(work);
        if (cm_id_priv->private_data && cm_id_priv->private_data_len)
index 469b6923a2e2e0a2c59b388d8f93fedc2e961fac..5ad41a64314cd5b050f67dd4980c6ba0264419a4 100644 (file)
@@ -352,7 +352,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
        INIT_WORK(&mad_agent_priv->local_work, local_completions,
                   mad_agent_priv);
        atomic_set(&mad_agent_priv->refcount, 1);
-       init_waitqueue_head(&mad_agent_priv->wait);
+       init_completion(&mad_agent_priv->comp);
 
        return &mad_agent_priv->agent;
 
@@ -467,7 +467,7 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
        mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp;
        mad_snoop_priv->agent.port_num = port_num;
        mad_snoop_priv->mad_snoop_flags = mad_snoop_flags;
-       init_waitqueue_head(&mad_snoop_priv->wait);
+       init_completion(&mad_snoop_priv->comp);
        mad_snoop_priv->snoop_index = register_snoop_agent(
                                                &port_priv->qp_info[qpn],
                                                mad_snoop_priv);
@@ -486,6 +486,18 @@ error1:
 }
 EXPORT_SYMBOL(ib_register_mad_snoop);
 
+static inline void deref_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
+{
+       if (atomic_dec_and_test(&mad_agent_priv->refcount))
+               complete(&mad_agent_priv->comp);
+}
+
+static inline void deref_snoop_agent(struct ib_mad_snoop_private *mad_snoop_priv)
+{
+       if (atomic_dec_and_test(&mad_snoop_priv->refcount))
+               complete(&mad_snoop_priv->comp);
+}
+
 static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
 {
        struct ib_mad_port_private *port_priv;
@@ -509,9 +521,8 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
        flush_workqueue(port_priv->wq);
        ib_cancel_rmpp_recvs(mad_agent_priv);
 
-       atomic_dec(&mad_agent_priv->refcount);
-       wait_event(mad_agent_priv->wait,
-                  !atomic_read(&mad_agent_priv->refcount));
+       deref_mad_agent(mad_agent_priv);
+       wait_for_completion(&mad_agent_priv->comp);
 
        kfree(mad_agent_priv->reg_req);
        ib_dereg_mr(mad_agent_priv->agent.mr);
@@ -529,9 +540,8 @@ static void unregister_mad_snoop(struct ib_mad_snoop_private *mad_snoop_priv)
        atomic_dec(&qp_info->snoop_count);
        spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
 
-       atomic_dec(&mad_snoop_priv->refcount);
-       wait_event(mad_snoop_priv->wait,
-                  !atomic_read(&mad_snoop_priv->refcount));
+       deref_snoop_agent(mad_snoop_priv);
+       wait_for_completion(&mad_snoop_priv->comp);
 
        kfree(mad_snoop_priv);
 }
@@ -600,8 +610,7 @@ static void snoop_send(struct ib_mad_qp_info *qp_info,
                spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
                mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent,
                                                    send_buf, mad_send_wc);
-               if (atomic_dec_and_test(&mad_snoop_priv->refcount))
-                       wake_up(&mad_snoop_priv->wait);
+               deref_snoop_agent(mad_snoop_priv);
                spin_lock_irqsave(&qp_info->snoop_lock, flags);
        }
        spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
@@ -626,8 +635,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info,
                spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
                mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent,
                                                   mad_recv_wc);
-               if (atomic_dec_and_test(&mad_snoop_priv->refcount))
-                       wake_up(&mad_snoop_priv->wait);
+               deref_snoop_agent(mad_snoop_priv);
                spin_lock_irqsave(&qp_info->snoop_lock, flags);
        }
        spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
@@ -968,8 +976,7 @@ void ib_free_send_mad(struct ib_mad_send_buf *send_buf)
 
        free_send_rmpp_list(mad_send_wr);
        kfree(send_buf->mad);
-       if (atomic_dec_and_test(&mad_agent_priv->refcount))
-               wake_up(&mad_agent_priv->wait);
+       deref_mad_agent(mad_agent_priv);
 }
 EXPORT_SYMBOL(ib_free_send_mad);
 
@@ -1757,8 +1764,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
                mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv,
                                                      mad_recv_wc);
                if (!mad_recv_wc) {
-                       if (atomic_dec_and_test(&mad_agent_priv->refcount))
-                               wake_up(&mad_agent_priv->wait);
+                       deref_mad_agent(mad_agent_priv);
                        return;
                }
        }
@@ -1770,8 +1776,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
                if (!mad_send_wr) {
                        spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
                        ib_free_recv_mad(mad_recv_wc);
-                       if (atomic_dec_and_test(&mad_agent_priv->refcount))
-                               wake_up(&mad_agent_priv->wait);
+                       deref_mad_agent(mad_agent_priv);
                        return;
                }
                ib_mark_mad_done(mad_send_wr);
@@ -1790,8 +1795,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
        } else {
                mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent,
                                                   mad_recv_wc);
-               if (atomic_dec_and_test(&mad_agent_priv->refcount))
-                       wake_up(&mad_agent_priv->wait);
+               deref_mad_agent(mad_agent_priv);
        }
 }
 
@@ -2021,8 +2025,7 @@ void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
                                                   mad_send_wc);
 
        /* Release reference on agent taken when sending */
-       if (atomic_dec_and_test(&mad_agent_priv->refcount))
-               wake_up(&mad_agent_priv->wait);
+       deref_mad_agent(mad_agent_priv);
        return;
 done:
        spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
index 6c9c133d71ef465ca1c7df621b1773cd3bdaa5cb..b4fa28d3160fc5abd2dc076e92bfb2f81928fb62 100644 (file)
@@ -37,6 +37,7 @@
 #ifndef __IB_MAD_PRIV_H__
 #define __IB_MAD_PRIV_H__
 
+#include <linux/completion.h>
 #include <linux/pci.h>
 #include <linux/kthread.h>
 #include <linux/workqueue.h>
@@ -108,7 +109,7 @@ struct ib_mad_agent_private {
        struct list_head rmpp_list;
 
        atomic_t refcount;
-       wait_queue_head_t wait;
+       struct completion comp;
 };
 
 struct ib_mad_snoop_private {
@@ -117,7 +118,7 @@ struct ib_mad_snoop_private {
        int snoop_index;
        int mad_snoop_flags;
        atomic_t refcount;
-       wait_queue_head_t wait;
+       struct completion comp;
 };
 
 struct ib_mad_send_wr_private {
index dfd4e588ce031ec8f5edb092f20fddfbc6d322bb..d4704e054e30746cdb5a377c1fa31ffddbdabafd 100644 (file)
@@ -49,7 +49,7 @@ struct mad_rmpp_recv {
        struct list_head list;
        struct work_struct timeout_work;
        struct work_struct cleanup_work;
-       wait_queue_head_t wait;
+       struct completion comp;
        enum rmpp_state state;
        spinlock_t lock;
        atomic_t refcount;
@@ -69,10 +69,16 @@ struct mad_rmpp_recv {
        u8 method;
 };
 
+static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
+{
+       if (atomic_dec_and_test(&rmpp_recv->refcount))
+               complete(&rmpp_recv->comp);
+}
+
 static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
 {
-       atomic_dec(&rmpp_recv->refcount);
-       wait_event(rmpp_recv->wait, !atomic_read(&rmpp_recv->refcount));
+       deref_rmpp_recv(rmpp_recv);
+       wait_for_completion(&rmpp_recv->comp);
        ib_destroy_ah(rmpp_recv->ah);
        kfree(rmpp_recv);
 }
@@ -253,7 +259,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent,
                goto error;
 
        rmpp_recv->agent = agent;
-       init_waitqueue_head(&rmpp_recv->wait);
+       init_completion(&rmpp_recv->comp);
        INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv);
        INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv);
        spin_lock_init(&rmpp_recv->lock);
@@ -279,12 +285,6 @@ error:     kfree(rmpp_recv);
        return NULL;
 }
 
-static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
-{
-       if (atomic_dec_and_test(&rmpp_recv->refcount))
-               wake_up(&rmpp_recv->wait);
-}
-
 static struct mad_rmpp_recv *
 find_rmpp_recv(struct ib_mad_agent_private *agent,
               struct ib_mad_recv_wc *mad_recv_wc)
index f6a05965a4e8ab79c3529fa71884c792ea8e8c4e..9164a09b6ccd1d0aeea7153d29c8307e3c5903ca 100644 (file)
@@ -32,6 +32,8 @@
  *
  * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $
  */
+
+#include <linux/completion.h>
 #include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/module.h>
@@ -72,7 +74,7 @@ struct ib_ucm_file {
 
 struct ib_ucm_context {
        int                 id;
-       wait_queue_head_t   wait;
+       struct completion   comp;
        atomic_t            ref;
        int                 events_reported;
 
@@ -138,7 +140,7 @@ static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id)
 static void ib_ucm_ctx_put(struct ib_ucm_context *ctx)
 {
        if (atomic_dec_and_test(&ctx->ref))
-               wake_up(&ctx->wait);
+               complete(&ctx->comp);
 }
 
 static inline int ib_ucm_new_cm_id(int event)
@@ -178,7 +180,7 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
                return NULL;
 
        atomic_set(&ctx->ref, 1);
-       init_waitqueue_head(&ctx->wait);
+       init_completion(&ctx->comp);
        ctx->file = file;
        INIT_LIST_HEAD(&ctx->events);
 
@@ -586,8 +588,8 @@ static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file,
        if (IS_ERR(ctx))
                return PTR_ERR(ctx);
 
-       atomic_dec(&ctx->ref);
-       wait_event(ctx->wait, !atomic_read(&ctx->ref));
+       ib_ucm_ctx_put(ctx);
+       wait_for_completion(&ctx->comp);
 
        /* No new events will be generated after destroying the cm_id. */
        ib_destroy_cm_id(ctx->cm_id);
index 36a32c315668cebbc7e34be30704b0c4851bcf66..efe147dbeb42137e695298e19c525e1acf027a07 100644 (file)
@@ -211,8 +211,10 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem)
         */
 
        work = kmalloc(sizeof *work, GFP_KERNEL);
-       if (!work)
+       if (!work) {
+               mmput(mm);
                return;
+       }
 
        INIT_WORK(&work->work, ib_umem_account, work);
        work->mm   = mm;
index 398add4d4cb1f4a7a5d0a7923b8bf6ce23bc8da5..dddcdae736ac89151d659a65e8521e98523890fb 100644 (file)
@@ -116,10 +116,9 @@ static int __devinit ipath_init_one(struct pci_dev *,
 #define PCI_DEVICE_ID_INFINIPATH_PE800 0x10
 
 static const struct pci_device_id ipath_pci_tbl[] = {
-       {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE,
-                   PCI_DEVICE_ID_INFINIPATH_HT)},
-       {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE,
-                   PCI_DEVICE_ID_INFINIPATH_PE800)},
+       { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) },
+       { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) },
+       { 0, }
 };
 
 MODULE_DEVICE_TABLE(pci, ipath_pci_tbl);
@@ -1906,19 +1905,19 @@ static void __exit infinipath_cleanup(void)
                        } else
                                ipath_dbg("irq is 0, not doing free_irq "
                                          "for unit %u\n", dd->ipath_unit);
-                       dd->pcidev = NULL;
-               }
 
-               /*
-                * we check for NULL here, because it's outside the kregbase
-                * check, and we need to call it after the free_irq.  Thus
-                * it's possible that the function pointers were never
-                * initialized.
-                */
-               if (dd->ipath_f_cleanup)
-                       /* clean up chip-specific stuff */
-                       dd->ipath_f_cleanup(dd);
+                       /*
+                        * we check for NULL here, because it's outside
+                        * the kregbase check, and we need to call it
+                        * after the free_irq.  Thus it's possible that
+                        * the function pointers were never initialized.
+                        */
+                       if (dd->ipath_f_cleanup)
+                               /* clean up chip-specific stuff */
+                               dd->ipath_f_cleanup(dd);
 
+                       dd->pcidev = NULL;
+               }
                spin_lock_irqsave(&ipath_devs_lock, flags);
        }
 
index f11a900e8cd7dcd41ce421cb4b78050d6fd10c53..a2f1ceafcca9f67360d1187b8c58e9e5a813f3a0 100644 (file)
@@ -505,11 +505,10 @@ static u8 flash_csum(struct ipath_flash *ifp, int adjust)
  * ipath_get_guid - get the GUID from the i2c device
  * @dd: the infinipath device
  *
- * When we add the multi-chip support, we will probably have to add
- * the ability to use the number of guids field, and get the guid from
- * the first chip's flash, to use for all of them.
+ * We have the capability to use the ipath_nguid field, and get
+ * the guid from the first chip's flash, to use for all of them.
  */
-void ipath_get_guid(struct ipath_devdata *dd)
+void ipath_get_eeprom_info(struct ipath_devdata *dd)
 {
        void *buf;
        struct ipath_flash *ifp;
index c347191f02bf67ba7fa520e6b29e1e23d4ef8fea..ada267e41f6c749901b53f898a9c39df891c7061 100644 (file)
@@ -139,7 +139,7 @@ static int ipath_get_base_info(struct ipath_portdata *pd,
        kinfo->spi_piosize = dd->ipath_ibmaxlen;
        kinfo->spi_mtu = dd->ipath_ibmaxlen;    /* maxlen, not ibmtu */
        kinfo->spi_port = pd->port_port;
-       kinfo->spi_sw_version = IPATH_USER_SWVERSION;
+       kinfo->spi_sw_version = IPATH_KERN_SWVERSION;
        kinfo->spi_hw_version = dd->ipath_revision;
 
        if (copy_to_user(ubase, kinfo, sizeof(*kinfo)))
@@ -1224,6 +1224,10 @@ static unsigned int ipath_poll(struct file *fp,
 
        if (tail == head) {
                set_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag);
+               if(dd->ipath_rhdrhead_intr_off) /* arm rcv interrupt */
+                       (void)ipath_write_ureg(dd, ur_rcvhdrhead,
+                                              dd->ipath_rhdrhead_intr_off
+                                              | head, pd->port_port);
                poll_wait(fp, &pd->port_wait, pt);
 
                if (test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) {
index 4652435998f35fde8020b1ceb3e124ff320d4cf8..fac0a2b74de2e3d08d054322157b773bc5b79967 100644 (file)
@@ -607,7 +607,12 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name,
        case 4:         /* Ponderosa is one of the bringup boards */
                n = "Ponderosa";
                break;
-       case 5:         /* HT-460 original production board */
+       case 5:
+               /*
+                * HT-460 original production board; two production levels, with
+                * different serial number ranges.   See ipath_ht_early_init() for
+                * case where we enable IPATH_GPIO_INTR for later serial # range.
+                */
                n = "InfiniPath_HT-460";
                break;
        case 6:
@@ -642,7 +647,7 @@ static int ipath_ht_boardname(struct ipath_devdata *dd, char *name,
        if (n)
                snprintf(name, namelen, "%s", n);
 
-       if (dd->ipath_majrev != 3 || dd->ipath_minrev != 2) {
+       if (dd->ipath_majrev != 3 || (dd->ipath_minrev < 2 || dd->ipath_minrev > 3)) {
                /*
                 * This version of the driver only supports the HT-400
                 * Rev 3.2
@@ -1520,6 +1525,18 @@ static int ipath_ht_early_init(struct ipath_devdata *dd)
         */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
                         INFINIPATH_S_ABORT);
+
+       ipath_get_eeprom_info(dd);
+       if(dd->ipath_boardrev == 5 && dd->ipath_serial[0] == '1' &&
+               dd->ipath_serial[1] == '2' && dd->ipath_serial[2] == '8') {
+               /*
+                * Later production HT-460 has same changes as HT-465, so
+                * can use GPIO interrupts.  They have serial #'s starting
+                * with 128, rather than 112.
+                */
+               dd->ipath_flags |= IPATH_GPIO_INTR;
+               dd->ipath_flags &= ~IPATH_POLL_RX_INTR;
+       }
        return 0;
 }
 
index 16f640e1c16e2bbd3638f6b8250f42c0f7cbfdc9..dc83250d26a6a1dc3bf31f92385be816b6b7aca4 100644 (file)
@@ -879,7 +879,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
 
 done:
        if (!ret) {
-               ipath_get_guid(dd);
                *dd->ipath_statusp |= IPATH_STATUS_CHIP_PRESENT;
                if (!dd->ipath_f_intrsetup(dd)) {
                        /* now we can enable all interrupts from the chip */
index e6507f8115bc65b042bdb3f7596934b8560fb1f4..5d92d57b6f5479310a8206812d6d2516e526f71b 100644 (file)
@@ -650,7 +650,7 @@ u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32 *);
 void ipath_init_pe800_funcs(struct ipath_devdata *);
 /* init HT-400-specific func */
 void ipath_init_ht400_funcs(struct ipath_devdata *);
-void ipath_get_guid(struct ipath_devdata *);
+void ipath_get_eeprom_info(struct ipath_devdata *);
 u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg);
 
 /*
index aa33b0e9f2f6330aeba82f2ad85d4621b940aecd..5ae8761f9dd2e8b3ed5dc86430ac9617c251aab9 100644 (file)
@@ -136,9 +136,7 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge,
                ret = 1;
                goto bail;
        }
-       spin_lock(&rkt->lock);
        mr = rkt->table[(sge->lkey >> (32 - ib_ipath_lkey_table_size))];
-       spin_unlock(&rkt->lock);
        if (unlikely(mr == NULL || mr->lkey != sge->lkey)) {
                ret = 0;
                goto bail;
@@ -184,8 +182,6 @@ bail:
  * @acc: access flags
  *
  * Return 1 if successful, otherwise 0.
- *
- * The QP r_rq.lock should be held.
  */
 int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
                  u32 len, u64 vaddr, u32 rkey, int acc)
@@ -196,9 +192,7 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
        size_t off;
        int ret;
 
-       spin_lock(&rkt->lock);
        mr = rkt->table[(rkey >> (32 - ib_ipath_lkey_table_size))];
-       spin_unlock(&rkt->lock);
        if (unlikely(mr == NULL || mr->lkey != rkey)) {
                ret = 0;
                goto bail;
index 9cb5258ffed95330f9f739100840c139588c3d33..9ec4ac77b87f88df622d5b1d3bc3acf421d3c9b1 100644 (file)
@@ -872,12 +872,13 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss,
                update_sge(ss, len);
                length -= len;
        }
+       /* Update address before sending packet. */
+       update_sge(ss, length);
        /* must flush early everything before trigger word */
        ipath_flush_wc();
        __raw_writel(last, piobuf);
        /* be sure trigger word is written */
        ipath_flush_wc();
-       update_sge(ss, length);
 }
 
 /**
@@ -943,17 +944,18 @@ int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords,
        if (likely(ss->num_sge == 1 && len <= ss->sge.length &&
                   !((unsigned long)ss->sge.vaddr & (sizeof(u32) - 1)))) {
                u32 w;
+               u32 *addr = (u32 *) ss->sge.vaddr;
 
+               /* Update address before sending packet. */
+               update_sge(ss, len);
                /* Need to round up for the last dword in the packet. */
                w = (len + 3) >> 2;
-               __iowrite32_copy(piobuf, ss->sge.vaddr, w - 1);
+               __iowrite32_copy(piobuf, addr, w - 1);
                /* must flush early everything before trigger word */
                ipath_flush_wc();
-               __raw_writel(((u32 *) ss->sge.vaddr)[w - 1],
-                            piobuf + w - 1);
+               __raw_writel(addr[w - 1], piobuf + w - 1);
                /* be sure trigger word is written */
                ipath_flush_wc();
-               update_sge(ss, len);
                ret = 0;
                goto bail;
        }
index 6318067ab5ec751dd755108c7750bcfc89402e53..02e8c75b24f6d175ebde6b42a52da54429d0459b 100644 (file)
@@ -1180,6 +1180,8 @@ static int ipath_pe_early_init(struct ipath_devdata *dd)
         */
        dd->ipath_rhdrhead_intr_off = 1ULL<<32;
 
+       ipath_get_eeprom_info(dd);
+
        return 0;
 }
 
index 18890716db1ed3bf5812968d8945f71905cdfd3a..9f8855d970c87483d0f16faf358630e4bb73068f 100644 (file)
@@ -375,10 +375,10 @@ static void ipath_error_qp(struct ipath_qp *qp)
 
        spin_lock(&dev->pending_lock);
        /* XXX What if its already removed by the timeout code? */
-       if (qp->timerwait.next != LIST_POISON1)
-               list_del(&qp->timerwait);
-       if (qp->piowait.next != LIST_POISON1)
-               list_del(&qp->piowait);
+       if (!list_empty(&qp->timerwait))
+               list_del_init(&qp->timerwait);
+       if (!list_empty(&qp->piowait))
+               list_del_init(&qp->piowait);
        spin_unlock(&dev->pending_lock);
 
        wc.status = IB_WC_WR_FLUSH_ERR;
@@ -427,6 +427,7 @@ static void ipath_error_qp(struct ipath_qp *qp)
 int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                    int attr_mask)
 {
+       struct ipath_ibdev *dev = to_idev(ibqp->device);
        struct ipath_qp *qp = to_iqp(ibqp);
        enum ib_qp_state cur_state, new_state;
        unsigned long flags;
@@ -443,6 +444,19 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                                attr_mask))
                goto inval;
 
+       if (attr_mask & IB_QP_AV)
+               if (attr->ah_attr.dlid == 0 ||
+                   attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE)
+                       goto inval;
+
+       if (attr_mask & IB_QP_PKEY_INDEX)
+               if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd))
+                       goto inval;
+
+       if (attr_mask & IB_QP_MIN_RNR_TIMER)
+               if (attr->min_rnr_timer > 31)
+                       goto inval;
+
        switch (new_state) {
        case IB_QPS_RESET:
                ipath_reset_qp(qp);
@@ -457,13 +471,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
        }
 
-       if (attr_mask & IB_QP_PKEY_INDEX) {
-               struct ipath_ibdev *dev = to_idev(ibqp->device);
-
-               if (attr->pkey_index >= ipath_layer_get_npkeys(dev->dd))
-                       goto inval;
+       if (attr_mask & IB_QP_PKEY_INDEX)
                qp->s_pkey_index = attr->pkey_index;
-       }
 
        if (attr_mask & IB_QP_DEST_QPN)
                qp->remote_qpn = attr->dest_qp_num;
@@ -479,12 +488,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
        if (attr_mask & IB_QP_ACCESS_FLAGS)
                qp->qp_access_flags = attr->qp_access_flags;
 
-       if (attr_mask & IB_QP_AV) {
-               if (attr->ah_attr.dlid == 0 ||
-                   attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE)
-                       goto inval;
+       if (attr_mask & IB_QP_AV)
                qp->remote_ah_attr = attr->ah_attr;
-       }
 
        if (attr_mask & IB_QP_PATH_MTU)
                qp->path_mtu = attr->path_mtu;
@@ -499,11 +504,8 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                qp->s_rnr_retry_cnt = qp->s_rnr_retry;
        }
 
-       if (attr_mask & IB_QP_MIN_RNR_TIMER) {
-               if (attr->min_rnr_timer > 31)
-                       goto inval;
+       if (attr_mask & IB_QP_MIN_RNR_TIMER)
                qp->s_min_rnr_timer = attr->min_rnr_timer;
-       }
 
        if (attr_mask & IB_QP_QKEY)
                qp->qkey = attr->qkey;
@@ -710,10 +712,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
                             init_attr->qp_type == IB_QPT_RC ?
                             ipath_do_rc_send : ipath_do_uc_send,
                             (unsigned long)qp);
-               qp->piowait.next = LIST_POISON1;
-               qp->piowait.prev = LIST_POISON2;
-               qp->timerwait.next = LIST_POISON1;
-               qp->timerwait.prev = LIST_POISON2;
+               INIT_LIST_HEAD(&qp->piowait);
+               INIT_LIST_HEAD(&qp->timerwait);
                qp->state = IB_QPS_RESET;
                qp->s_wq = swq;
                qp->s_size = init_attr->cap.max_send_wr + 1;
@@ -734,7 +734,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
                ipath_reset_qp(qp);
 
                /* Tell the core driver that the kernel SMA is present. */
-               if (qp->ibqp.qp_type == IB_QPT_SMI)
+               if (init_attr->qp_type == IB_QPT_SMI)
                        ipath_layer_set_verbs_flags(dev->dd,
                                                    IPATH_VERBS_KERNEL_SMA);
                break;
@@ -783,10 +783,10 @@ int ipath_destroy_qp(struct ib_qp *ibqp)
 
        /* Make sure the QP isn't on the timeout list. */
        spin_lock_irqsave(&dev->pending_lock, flags);
-       if (qp->timerwait.next != LIST_POISON1)
-               list_del(&qp->timerwait);
-       if (qp->piowait.next != LIST_POISON1)
-               list_del(&qp->piowait);
+       if (!list_empty(&qp->timerwait))
+               list_del_init(&qp->timerwait);
+       if (!list_empty(&qp->piowait))
+               list_del_init(&qp->piowait);
        spin_unlock_irqrestore(&dev->pending_lock, flags);
 
        /*
@@ -855,10 +855,10 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
 
        spin_lock(&dev->pending_lock);
        /* XXX What if its already removed by the timeout code? */
-       if (qp->timerwait.next != LIST_POISON1)
-               list_del(&qp->timerwait);
-       if (qp->piowait.next != LIST_POISON1)
-               list_del(&qp->piowait);
+       if (!list_empty(&qp->timerwait))
+               list_del_init(&qp->timerwait);
+       if (!list_empty(&qp->piowait))
+               list_del_init(&qp->piowait);
        spin_unlock(&dev->pending_lock);
 
        ipath_cq_enter(to_icq(qp->ibqp.send_cq), wc, 1);
index a4055ca0061427ed7b658b657af110e6cc2cc138..493b1821a93426e8b69e09c54e1e4277edeba410 100644 (file)
@@ -57,7 +57,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
        qp->s_len = wqe->length - len;
        dev = to_idev(qp->ibqp.device);
        spin_lock(&dev->pending_lock);
-       if (qp->timerwait.next == LIST_POISON1)
+       if (list_empty(&qp->timerwait))
                list_add_tail(&qp->timerwait,
                              &dev->pending[dev->pending_index]);
        spin_unlock(&dev->pending_lock);
@@ -356,7 +356,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp,
                if ((int)(qp->s_psn - qp->s_next_psn) > 0)
                        qp->s_next_psn = qp->s_psn;
                spin_lock(&dev->pending_lock);
-               if (qp->timerwait.next == LIST_POISON1)
+               if (list_empty(&qp->timerwait))
                        list_add_tail(&qp->timerwait,
                                      &dev->pending[dev->pending_index]);
                spin_unlock(&dev->pending_lock);
@@ -726,8 +726,8 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc)
         */
        dev = to_idev(qp->ibqp.device);
        spin_lock(&dev->pending_lock);
-       if (qp->timerwait.next != LIST_POISON1)
-               list_del(&qp->timerwait);
+       if (!list_empty(&qp->timerwait))
+               list_del_init(&qp->timerwait);
        spin_unlock(&dev->pending_lock);
 
        if (wqe->wr.opcode == IB_WR_RDMA_READ)
@@ -886,8 +886,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
         * just won't find anything to restart if we ACK everything.
         */
        spin_lock(&dev->pending_lock);
-       if (qp->timerwait.next != LIST_POISON1)
-               list_del(&qp->timerwait);
+       if (!list_empty(&qp->timerwait))
+               list_del_init(&qp->timerwait);
        spin_unlock(&dev->pending_lock);
 
        /*
@@ -1194,8 +1194,7 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
                     IB_WR_RDMA_READ))
                goto ack_done;
        spin_lock(&dev->pending_lock);
-       if (qp->s_rnr_timeout == 0 &&
-           qp->timerwait.next != LIST_POISON1)
+       if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait))
                list_move_tail(&qp->timerwait,
                               &dev->pending[dev->pending_index]);
        spin_unlock(&dev->pending_lock);
index eb81424b3c5bb9bcb112e392d10c58a78f2530a2..d38f4f3cfd1dd291dd33e17d3780fc9b7ed1d17e 100644 (file)
@@ -435,7 +435,7 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev)
        unsigned long flags;
 
        spin_lock_irqsave(&dev->pending_lock, flags);
-       if (qp->piowait.next == LIST_POISON1)
+       if (list_empty(&qp->piowait))
                list_add_tail(&qp->piowait, &dev->piowait);
        spin_unlock_irqrestore(&dev->pending_lock, flags);
        /*
index cb9e387c301f2b15320d19f1e79e9522ce40b72d..28fdbdaa789db8acecceb4d72192cd3a5aea19bd 100644 (file)
@@ -464,7 +464,7 @@ static void ipath_ib_timer(void *arg)
        last = &dev->pending[dev->pending_index];
        while (!list_empty(last)) {
                qp = list_entry(last->next, struct ipath_qp, timerwait);
-               list_del(&qp->timerwait);
+               list_del_init(&qp->timerwait);
                qp->timer_next = resend;
                resend = qp;
                atomic_inc(&qp->refcount);
@@ -474,7 +474,7 @@ static void ipath_ib_timer(void *arg)
                qp = list_entry(last->next, struct ipath_qp, timerwait);
                if (--qp->s_rnr_timeout == 0) {
                        do {
-                               list_del(&qp->timerwait);
+                               list_del_init(&qp->timerwait);
                                tasklet_hi_schedule(&qp->s_task);
                                if (list_empty(last))
                                        break;
@@ -554,7 +554,7 @@ static int ipath_ib_piobufavail(void *arg)
        while (!list_empty(&dev->piowait)) {
                qp = list_entry(dev->piowait.next, struct ipath_qp,
                                piowait);
-               list_del(&qp->piowait);
+               list_del_init(&qp->piowait);
                tasklet_hi_schedule(&qp->s_task);
        }
        spin_unlock_irqrestore(&dev->pending_lock, flags);
@@ -951,6 +951,7 @@ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd)
        idev->dd = dd;
 
        strlcpy(dev->name, "ipath%d", IB_DEVICE_NAME_MAX);
+       dev->owner = THIS_MODULE;
        dev->node_guid = ipath_layer_get_guid(dd);
        dev->uverbs_abi_ver = IPATH_UVERBS_ABI_VERSION;
        dev->uverbs_cmd_mask =
index 1985b5dfa481bdb91efaf5611bba73f83de3a1b1..798e13e14faf826695d8b64a0493a5580e24bd73 100644 (file)
@@ -182,7 +182,7 @@ struct mthca_cmd_context {
        u8                status;
 };
 
-static int fw_cmd_doorbell = 1;
+static int fw_cmd_doorbell = 0;
 module_param(fw_cmd_doorbell, int, 0644);
 MODULE_PARM_DESC(fw_cmd_doorbell, "post FW commands through doorbell page if nonzero "
                 "(and supported by FW)");
index 19765f6f8d5868eca6845d2319819bccdf181e64..07c13be07a4a5da858a975fe6d11059b0da3a35b 100644 (file)
@@ -1727,23 +1727,7 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
 
        ind = qp->rq.next_ind;
 
-       for (nreq = 0; wr; ++nreq, wr = wr->next) {
-               if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
-                       nreq = 0;
-
-                       doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
-                       doorbell[1] = cpu_to_be32(qp->qpn << 8);
-
-                       wmb();
-
-                       mthca_write64(doorbell,
-                                     dev->kar + MTHCA_RECEIVE_DOORBELL,
-                                     MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
-
-                       qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
-                       size0 = 0;
-               }
-
+       for (nreq = 0; wr; wr = wr->next) {
                if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
                        mthca_err(dev, "RQ %06x full (%u head, %u tail,"
                                        " %d max, %d nreq)\n", qp->qpn,
@@ -1797,6 +1781,23 @@ int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
                ++ind;
                if (unlikely(ind >= qp->rq.max))
                        ind -= qp->rq.max;
+
+               ++nreq;
+               if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
+                       nreq = 0;
+
+                       doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
+                       doorbell[1] = cpu_to_be32(qp->qpn << 8);
+
+                       wmb();
+
+                       mthca_write64(doorbell,
+                                     dev->kar + MTHCA_RECEIVE_DOORBELL,
+                                     MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+
+                       qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
+                       size0 = 0;
+               }
        }
 
 out:
index 1ea433291fa71883e06fa0743c3f9fd443fe55bd..b292fefa3b411924ea29d693da19f75bf5187ffd 100644 (file)
@@ -490,26 +490,7 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
 
        first_ind = srq->first_free;
 
-       for (nreq = 0; wr; ++nreq, wr = wr->next) {
-               if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
-                       nreq = 0;
-
-                       doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift);
-                       doorbell[1] = cpu_to_be32(srq->srqn << 8);
-
-                       /*
-                        * Make sure that descriptors are written
-                        * before doorbell is rung.
-                        */
-                       wmb();
-
-                       mthca_write64(doorbell,
-                                     dev->kar + MTHCA_RECEIVE_DOORBELL,
-                                     MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
-
-                       first_ind = srq->first_free;
-               }
-
+       for (nreq = 0; wr; wr = wr->next) {
                ind = srq->first_free;
 
                if (ind < 0) {
@@ -569,6 +550,26 @@ int mthca_tavor_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
 
                srq->wrid[ind]  = wr->wr_id;
                srq->first_free = next_ind;
+
+               ++nreq;
+               if (unlikely(nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB)) {
+                       nreq = 0;
+
+                       doorbell[0] = cpu_to_be32(first_ind << srq->wqe_shift);
+                       doorbell[1] = cpu_to_be32(srq->srqn << 8);
+
+                       /*
+                        * Make sure that descriptors are written
+                        * before doorbell is rung.
+                        */
+                       wmb();
+
+                       mthca_write64(doorbell,
+                                     dev->kar + MTHCA_RECEIVE_DOORBELL,
+                                     MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+
+                       first_ind = srq->first_free;
+               }
        }
 
        if (likely(nreq)) {
index a54da42849ae1e9e19d3335326be70fe3c44880b..8406839b91cf3879bff26215f08cd9addc7ab312 100644 (file)
@@ -275,6 +275,7 @@ static void ipoib_ib_handle_wc(struct net_device *dev,
                spin_lock_irqsave(&priv->tx_lock, flags);
                ++priv->tx_tail;
                if (netif_queue_stopped(dev) &&
+                   test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags) &&
                    priv->tx_head - priv->tx_tail <= ipoib_sendq_size >> 1)
                        netif_wake_queue(dev);
                spin_unlock_irqrestore(&priv->tx_lock, flags);
index c32ce4348e1b817fd59c4c9425a07ca853881a49..9cbdffa08dc2bca6da821638efc0078b24792374 100644 (file)
@@ -340,7 +340,10 @@ static void srp_disconnect_target(struct srp_target_port *target)
        /* XXX should send SRP_I_LOGOUT request */
 
        init_completion(&target->done);
-       ib_send_cm_dreq(target->cm_id, NULL, 0);
+       if (ib_send_cm_dreq(target->cm_id, NULL, 0)) {
+               printk(KERN_DEBUG PFX "Sending CM DREQ failed\n");
+               return;
+       }
        wait_for_completion(&target->done);
 }
 
@@ -351,7 +354,6 @@ static void srp_remove_work(void *target_ptr)
        spin_lock_irq(target->scsi_host->host_lock);
        if (target->state != SRP_TARGET_DEAD) {
                spin_unlock_irq(target->scsi_host->host_lock);
-               scsi_host_put(target->scsi_host);
                return;
        }
        target->state = SRP_TARGET_REMOVED;
@@ -365,8 +367,6 @@ static void srp_remove_work(void *target_ptr)
        ib_destroy_cm_id(target->cm_id);
        srp_free_target_ib(target);
        scsi_host_put(target->scsi_host);
-       /* And another put to really free the target port... */
-       scsi_host_put(target->scsi_host);
 }
 
 static int srp_connect_target(struct srp_target_port *target)
@@ -1241,7 +1241,7 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
        list_for_each_entry_safe(req, tmp, &target->req_queue, list)
                if (req->scmnd->device == scmnd->device) {
                        req->scmnd->result = DID_RESET << 16;
-                       scmnd->scsi_done(scmnd);
+                       req->scmnd->scsi_done(req->scmnd);
                        srp_remove_req(target, req);
                }
 
index 2b2ec1057deeff1c9fc40f963da81cbbd7267de5..95c0de7964a0803f788764a7426cb66b75f79867 100644 (file)
@@ -589,7 +589,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
        struct sw *sw;
        struct input_dev *input_dev;
        int i, j, k, l;
-       int err;
+       int err = 0;
        unsigned char *buf = NULL;      /* [SW_LENGTH] */
        unsigned char *idbuf = NULL;    /* [SW_LENGTH] */
        unsigned char m = 1;
@@ -776,7 +776,10 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
                        goto fail4;
        }
 
-       return 0;
+ out:  kfree(buf);
+       kfree(idbuf);
+
+       return err;
 
  fail4:        input_free_device(sw->dev[i]);
  fail3:        while (--i >= 0)
@@ -784,9 +787,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
  fail2:        gameport_close(gameport);
  fail1:        gameport_set_drvdata(gameport, NULL);
        kfree(sw);
-       kfree(buf);
-       kfree(idbuf);
-       return err;
+       goto out;
 }
 
 static void sw_disconnect(struct gameport *gameport)
index 96c6bf77248ae7a67dc134ccfffb7f8465ffd974..1f0e720267d75312c0a52eaa44b5e5764eaf53ce 100644 (file)
@@ -245,9 +245,9 @@ static void corgikbd_hinge_timer(unsigned long data)
                if (hinge_count >= HINGE_STABLE_COUNT) {
                        spin_lock_irqsave(&corgikbd_data->lock, flags);
 
-                       input_report_switch(corgikbd_data->input, SW_0, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0));
-                       input_report_switch(corgikbd_data->input, SW_1, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0));
-                       input_report_switch(corgikbd_data->input, SW_2, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0));
+                       input_report_switch(corgikbd_data->input, SW_LID, ((sharpsl_hinge_state & CORGI_SCP_SWA) != 0));
+                       input_report_switch(corgikbd_data->input, SW_TABLET_MODE, ((sharpsl_hinge_state & CORGI_SCP_SWB) != 0));
+                       input_report_switch(corgikbd_data->input, SW_HEADPHONE_INSERT, (READ_GPIO_BIT(CORGI_GPIO_AK_INT) != 0));
                        input_sync(corgikbd_data->input);
 
                        spin_unlock_irqrestore(&corgikbd_data->lock, flags);
@@ -340,9 +340,9 @@ static int __init corgikbd_probe(struct platform_device *pdev)
        for (i = 0; i < ARRAY_SIZE(corgikbd_keycode); i++)
                set_bit(corgikbd->keycode[i], input_dev->keybit);
        clear_bit(0, input_dev->keybit);
-       set_bit(SW_0, input_dev->swbit);
-       set_bit(SW_1, input_dev->swbit);
-       set_bit(SW_2, input_dev->swbit);
+       set_bit(SW_LID, input_dev->swbit);
+       set_bit(SW_TABLET_MODE, input_dev->swbit);
+       set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
 
        input_register_device(corgikbd->input);
 
index 1d238a9d52d68532d4d29e31f00d6e2be9ab6539..c5d03fb77bcb9a364ca16ea075d469425c671950 100644 (file)
@@ -299,9 +299,9 @@ static void spitzkbd_hinge_timer(unsigned long data)
        if (hinge_count >= HINGE_STABLE_COUNT) {
                spin_lock_irqsave(&spitzkbd_data->lock, flags);
 
-               input_report_switch(spitzkbd_data->input, SW_0, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
-               input_report_switch(spitzkbd_data->input, SW_1, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
-               input_report_switch(spitzkbd_data->input, SW_2, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0));
+               input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
+               input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
+               input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0));
                input_sync(spitzkbd_data->input);
 
                spin_unlock_irqrestore(&spitzkbd_data->lock, flags);
@@ -398,9 +398,9 @@ static int __init spitzkbd_probe(struct platform_device *dev)
        for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
                set_bit(spitzkbd->keycode[i], input_dev->keybit);
        clear_bit(0, input_dev->keybit);
-       set_bit(SW_0, input_dev->swbit);
-       set_bit(SW_1, input_dev->swbit);
-       set_bit(SW_2, input_dev->swbit);
+       set_bit(SW_LID, input_dev->swbit);
+       set_bit(SW_TABLET_MODE, input_dev->swbit);
+       set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
 
        input_register_device(input_dev);
 
index 36cd2e07fce8bf6be22b476a462ac375d698a1b5..e4e5be111c960b67834e2742a9475bbd73b2d42f 100644 (file)
@@ -318,6 +318,16 @@ static struct key_entry keymap_acer_travelmate_240[] = {
        { KE_END, 0 }
 };
 
+static struct key_entry keymap_aopen_1559as[] = {
+       { KE_KEY,  0x01, KEY_HELP },
+       { KE_KEY,  0x06, KEY_PROG3 },
+       { KE_KEY,  0x11, KEY_PROG1 },
+       { KE_KEY,  0x12, KEY_PROG2 },
+       { KE_WIFI, 0x30, 0 },
+       { KE_KEY,  0x31, KEY_MAIL },
+       { KE_KEY,  0x36, KEY_WWW },
+};
+
 /*
  * If your machine is not here (which is currently rather likely), please send
  * a list of buttons and their key codes (reported when loading this module
@@ -369,6 +379,15 @@ static struct dmi_system_id dmi_ids[] = {
                },
                .driver_data = keymap_acer_travelmate_240
        },
+        {
+               .callback = dmi_matched,
+               .ident = "AOpen 1559AS",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "E2U"),
+                       DMI_MATCH(DMI_BOARD_NAME, "E2U"),
+               },
+               .driver_data = keymap_aopen_1559as
+       },
        { NULL, }
 };
 
index 2141501e9f2e498246df66233623490ade12494a..a0e2e797c6d5a6c9e3cceeb6659a9299630c5af5 100644 (file)
@@ -100,8 +100,8 @@ static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
        }
 
        if (priv->i->flags & ALPS_OLDPROTO) {
-               left = packet[2] & 0x08;
-               right = packet[2] & 0x10;
+               left = packet[2] & 0x10;
+               right = packet[2] & 0x08;
                middle = 0;
                x = packet[1] | ((packet[0] & 0x07) << 7);
                y = packet[4] | ((packet[3] & 0x07) << 7);
index 5ccc3ef3b89e84fe4d246a7a3fc6fd6d0b943394..c14395ba798005d31a14b7c3c0e135548ed4c03d 100644 (file)
 #include "lifebook.h"
 
 static struct dmi_system_id lifebook_dmi_table[] = {
+       {
+               .ident = "LifeBook B",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
+               },
+       },
        {
                .ident = "Lifebook B",
                .matches = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
                },
        },
+       {
+               .ident = "Lifebook B213x/B2150",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
+               },
+       },
+       {
+               .ident = "Zephyr",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
+               },
+       },
+       {
+               .ident = "CF-18",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
+               },
+       },
        {
                .ident = "Lifebook B142",
                .matches = {
index 40333d61093c805383ed3f7ae245dfdd12a51f95..2f0d28840810aad3c4811d276aa1a0cb6ffb17b8 100644 (file)
@@ -19,6 +19,7 @@
 #define PS2PP_KIND_WHEEL       1
 #define PS2PP_KIND_MX          2
 #define PS2PP_KIND_TP3         3
+#define PS2PP_KIND_TRACKMAN    4
 
 /* Logitech mouse features */
 #define PS2PP_WHEEL            0x01
@@ -223,6 +224,7 @@ static struct ps2pp_info *get_model_info(unsigned char model)
                { 73,   0,                      PS2PP_SIDE_BTN },
                { 75,   PS2PP_KIND_WHEEL,       PS2PP_WHEEL },
                { 76,   PS2PP_KIND_WHEEL,       PS2PP_WHEEL },
+               { 79,   PS2PP_KIND_TRACKMAN,    PS2PP_WHEEL },          /* TrackMan with wheel */
                { 80,   PS2PP_KIND_WHEEL,       PS2PP_SIDE_BTN | PS2PP_WHEEL },
                { 81,   PS2PP_KIND_WHEEL,       PS2PP_WHEEL },
                { 83,   PS2PP_KIND_WHEEL,       PS2PP_WHEEL },
@@ -298,6 +300,10 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_inf
                        psmouse->name = "TouchPad 3";
                        break;
 
+               case PS2PP_KIND_TRACKMAN:
+                       psmouse->name = "TrackMan";
+                       break;
+
                default:
                        /*
                         * Set name to "Mouse" only when using PS2++,
index 1494175ac6fe43d0666e3cfed2426cfb0e622ed5..161afddd0f44396da88402f0af5bb2b9445f1a74 100644 (file)
 
 
 /*
- * This code has been tested on an ads7846 / N770 device.
+ * This code has been heavily tested on a Nokia 770, and lightly
+ * tested on other ads7846 devices (OSK/Mistral, Lubbock).
  * Support for ads7843 and ads7845 has only been stubbed in.
  *
- * Not yet done:  How accurate are the temperature and voltage
- * readings? (System-specific calibration should support
- * accuracy of 0.3 degrees C; otherwise it's 2.0 degrees.)
- *
  * IRQ handling needs a workaround because of a shortcoming in handling
  * edge triggered IRQs on some platforms like the OMAP1/2. These
  * platforms don't handle the ARM lazy IRQ disabling properly, thus we
@@ -248,10 +245,13 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
 
        if (req->msg.status)
                status = req->msg.status;
+
+       /* on-wire is a must-ignore bit, a BE12 value, then padding */
        sample = be16_to_cpu(req->sample);
-       sample = sample >> 4;
-       kfree(req);
+       sample = sample >> 3;
+       sample &= 0x0fff;
 
+       kfree(req);
        return status ? status : sample;
 }
 
@@ -336,13 +336,13 @@ static void ads7846_rx(void *ads)
        u16                     x, y, z1, z2;
        unsigned long           flags;
 
-       /* adjust:  12 bit samples (left aligned), built from
-        * two 8 bit values writen msb-first.
+       /* adjust:  on-wire is a must-ignore bit, a BE12 value, then padding;
+        * built from two 8 bit values written msb-first.
         */
-       x = be16_to_cpu(ts->tc.x) >> 4;
-       y = be16_to_cpu(ts->tc.y) >> 4;
-       z1 = be16_to_cpu(ts->tc.z1) >> 4;
-       z2 = be16_to_cpu(ts->tc.z2) >> 4;
+       x = (be16_to_cpu(ts->tc.x) >> 3) & 0x0fff;
+       y = (be16_to_cpu(ts->tc.y) >> 3) & 0x0fff;
+       z1 = (be16_to_cpu(ts->tc.z1) >> 3) & 0x0fff;
+       z2 = (be16_to_cpu(ts->tc.z2) >> 3) & 0x0fff;
 
        /* range filtering */
        if (x == MAX_12BIT)
@@ -420,7 +420,7 @@ static void ads7846_debounce(void *ads)
 
        m = &ts->msg[ts->msg_idx];
        t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
-       val = (*(u16 *)t->rx_buf) >> 3;
+       val = (be16_to_cpu(*(__be16 *)t->rx_buf) >> 3) & 0x0fff;
        if (!ts->read_cnt || (abs(ts->last_read - val) > ts->debounce_tol)) {
                /* Repeat it, if this was the first read or the read
                 * wasn't consistent enough. */
@@ -469,7 +469,7 @@ static void ads7846_timer(unsigned long handle)
        spin_lock_irq(&ts->lock);
 
        if (unlikely(ts->msg_idx && !ts->pendown)) {
-               /* measurment cycle ended */
+               /* measurement cycle ended */
                if (!device_suspended(&ts->spi->dev)) {
                        ts->irq_disabled = 0;
                        enable_irq(ts->spi->irq);
@@ -495,11 +495,10 @@ static irqreturn_t ads7846_irq(int irq, void *handle, struct pt_regs *regs)
        spin_lock_irqsave(&ts->lock, flags);
        if (likely(ts->get_pendown_state())) {
                if (!ts->irq_disabled) {
-                       /* REVISIT irq logic for many ARM chips has cloned a
-                        * bug wherein disabling an irq in its handler won't
-                        * work;(it's disabled lazily, and too late to work.
-                        * until all their irq logic is fixed, we must shadow
-                        * that state here.
+                       /* The ARM do_simple_IRQ() dispatcher doesn't act
+                        * like the other dispatchers:  it will report IRQs
+                        * even after they've been disabled.  We work around
+                        * that here.  (The "generic irq" framework may help...)
                         */
                        ts->irq_disabled = 1;
                        disable_irq(ts->spi->irq);
@@ -609,16 +608,20 @@ static int __devinit ads7846_probe(struct spi_device *spi)
                return -EINVAL;
        }
 
+       /* REVISIT when the irq can be triggered active-low, or if for some
+        * reason the touchscreen isn't hooked up, we don't need to access
+        * the pendown state.
+        */
        if (pdata->get_pendown_state == NULL) {
                dev_dbg(&spi->dev, "no get_pendown_state function?\n");
                return -EINVAL;
        }
 
-       /* We'd set the wordsize to 12 bits ... except that some controllers
-        * will then treat the 8 bit command words as 12 bits (and drop the
-        * four MSBs of the 12 bit result).  Result: inputs must be shifted
-        * to discard the four garbage LSBs.
+       /* We'd set TX wordsize 8 bits and RX wordsize to 13 bits ... except
+        * that even if the hardware can do that, the SPI controller driver
+        * may not.  So we stick to very-portable 8 bit words, both RX and TX.
         */
+       spi->bits_per_word = 8;
 
        ts = kzalloc(sizeof(struct ads7846), GFP_KERNEL);
        input_dev = input_allocate_device();
@@ -772,7 +775,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
 
        if (request_irq(spi->irq, ads7846_irq,
                        SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING,
-                       spi->dev.bus_id, ts)) {
+                       spi->dev.driver->name, ts)) {
                dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
                err = -EBUSY;
                goto err_free_mem;
index 9b493f0becc4d370541742a7fec7f4ef6aed43df..173c899a1fb40cb9eca8ff5b02844a95519b2527 100644 (file)
@@ -1499,7 +1499,6 @@ static int __init capi_init(void)
                printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
                return major_ret;
        }
-       capi_major = major_ret;
        capi_class = class_create(THIS_MODULE, "capi");
        if (IS_ERR(capi_class)) {
                unregister_chrdev(capi_major, "capi20");
index bfb73fd5077e85aa148a48dbbf5165f5185c5c19..d86ab68114b0c7848126661c2009816658093c9d 100644 (file)
@@ -710,8 +710,8 @@ static int gigaset_probe(struct usb_interface *interface,
        retval = -ENODEV; //FIXME
 
        /* See if the device offered us matches what we can accept */
-       if ((le16_to_cpu(udev->descriptor.idVendor  != USB_M105_VENDOR_ID)) ||
-           (le16_to_cpu(udev->descriptor.idProduct != USB_M105_PRODUCT_ID)))
+       if ((le16_to_cpu(udev->descriptor.idVendor)  != USB_M105_VENDOR_ID) ||
+           (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID))
                return -ENODEV;
 
        /* this starts to become ascii art... */
index 3585fb1f334460ae69a3c24e32c0ee03d52def49..2ac90242d263714b7d6108a9005982ef660c02d7 100644 (file)
@@ -2880,7 +2880,7 @@ isdn_tty_cmd_ATand(char **p, modem_info * info)
                        p[0]++;
                        i = 0;
                        while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) &&
-                              (i < ISDN_LMSNLEN))
+                              (i < ISDN_LMSNLEN - 1))
                                m->lmsn[i++] = *p[0]++;
                        m->lmsn[i] = '\0';
                        break;
index 3f5b647945426d5db0c1ffa7793b6fa8dc37e482..626506234b76ca62b29b34708e820f122470e2db 100644 (file)
@@ -4,8 +4,11 @@ menu "LED devices"
 config NEW_LEDS
        bool "LED Support"
        help
-         Say Y to enable Linux LED support.  This is not related to standard
-         keyboard LEDs which are controlled via the input system.
+         Say Y to enable Linux LED support.  This allows control of supported
+         LEDs from both userspace and optionally, by kernel events (triggers).
+
+         This is not related to standard keyboard LEDs which are controlled
+         via the input system.
 
 config LEDS_CLASS
        tristate "LED Class Support"
index b0b5d05fadd62a106c5e49f027608ad55fb093a4..c75d0ef1609cb900d0cc014620bccbe8fbff2e7c 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/sysdev.h>
 #include <linux/timer.h>
 #include <linux/err.h>
+#include <linux/ctype.h>
 #include <linux/leds.h>
 #include "leds.h"
 
@@ -43,9 +44,13 @@ static ssize_t led_brightness_store(struct class_device *dev,
        ssize_t ret = -EINVAL;
        char *after;
        unsigned long state = simple_strtoul(buf, &after, 10);
+       size_t count = after - buf;
 
-       if (after - buf > 0) {
-               ret = after - buf;
+       if (*after && isspace(*after))
+               count++;
+
+       if (count == size) {
+               ret = count;
                led_set_brightness(led_cdev, state);
        }
 
index f484b5d6dbf86494ad9eb0f3c07cd276743a30b9..fbf141ef46ec3488779a54c616cdff600f38890d 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/device.h>
 #include <linux/sysdev.h>
 #include <linux/timer.h>
+#include <linux/ctype.h>
 #include <linux/leds.h>
 #include "leds.h"
 
@@ -69,11 +70,15 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf,
        int ret = -EINVAL;
        char *after;
        unsigned long state = simple_strtoul(buf, &after, 10);
+       size_t count = after - buf;
 
-       if (after - buf > 0) {
+       if (*after && isspace(*after))
+               count++;
+
+       if (count == size) {
                timer_data->delay_on = state;
                mod_timer(&timer_data->timer, jiffies + 1);
-               ret = after - buf;
+               ret = count;
        }
 
        return ret;
@@ -97,11 +102,15 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf,
        int ret = -EINVAL;
        char *after;
        unsigned long state = simple_strtoul(buf, &after, 10);
+       size_t count = after - buf;
+
+       if (*after && isspace(*after))
+               count++;
 
-       if (after - buf > 0) {
+       if (count == size) {
                timer_data->delay_off = state;
                mod_timer(&timer_data->timer, jiffies + 1);
-               ret = after - buf;
+               ret = count;
        }
 
        return ret;
index d7316b829a62687a4c29372a893d2684121fb3a3..f19b874753a9c4aec3802b557ab05100f387ff61 100644 (file)
@@ -167,6 +167,15 @@ void md_new_event(mddev_t *mddev)
 }
 EXPORT_SYMBOL_GPL(md_new_event);
 
+/* Alternate version that can be called from interrupts
+ * when calling sysfs_notify isn't needed.
+ */
+void md_new_event_inintr(mddev_t *mddev)
+{
+       atomic_inc(&md_event_count);
+       wake_up(&md_event_waiters);
+}
+
 /*
  * Enables to iterate over all existing md arrays
  * all_mddevs_lock protects this list.
@@ -2252,7 +2261,7 @@ action_store(mddev_t *mddev, const char *page, size_t len)
        } else {
                if (cmd_match(page, "check"))
                        set_bit(MD_RECOVERY_CHECK, &mddev->recovery);
-               else if (cmd_match(page, "repair"))
+               else if (!cmd_match(page, "repair"))
                        return -EINVAL;
                set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
                set_bit(MD_RECOVERY_SYNC, &mddev->recovery);
@@ -4149,7 +4158,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev)
        set_bit(MD_RECOVERY_INTR, &mddev->recovery);
        set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
        md_wakeup_thread(mddev->thread);
-       md_new_event(mddev);
+       md_new_event_inintr(mddev);
 }
 
 /* seq_file implementation /proc/mdstat */
@@ -5028,8 +5037,10 @@ static int md_notify_reboot(struct notifier_block *this,
                printk(KERN_INFO "md: stopping all md devices.\n");
 
                ITERATE_MDDEV(mddev,tmp)
-                       if (mddev_trylock(mddev))
+                       if (mddev_trylock(mddev)) {
                                do_md_stop (mddev, 1);
+                               mddev_unlock(mddev);
+                       }
                /*
                 * certain more exotic SCSI devices are known to be
                 * volatile wrt too early system reboots. While the
index 678f4dbbea1d5c22082d13fb1afd321465b61f28..cb8c6317e4e5fc367c7098a87e310b5ed059f724 100644 (file)
@@ -331,13 +331,14 @@ static int raid0_run (mddev_t *mddev)
                goto out_free_conf;
        size = conf->strip_zone[cur].size;
 
-       for (i=0; i< nb_zone; i++) {
-               conf->hash_table[i] = conf->strip_zone + cur;
+       conf->hash_table[0] = conf->strip_zone + cur;
+       for (i=1; i< nb_zone; i++) {
                while (size <= conf->hash_spacing) {
                        cur++;
                        size += conf->strip_zone[cur].size;
                }
                size -= conf->hash_spacing;
+               conf->hash_table[i] = conf->strip_zone + cur;
        }
        if (conf->preshift) {
                conf->hash_spacing >>= conf->preshift;
index fffc711c260caec4dffb7e358ce98afc3f7bb902..344d83aae3ec3b5d6d7b4e9e41dee2f47d59e79f 100644 (file)
@@ -8,22 +8,54 @@ config VIDEO_DEV
        tristate "Video For Linux"
        ---help---
          Support for audio/video capture and overlay devices and FM radio
-         cards. The exact capabilities of each device vary. User tools for
-         this are available from
-         <ftp://ftp.uk.linux.org/pub/linux/video4linux/>.
+         cards. The exact capabilities of each device vary.
 
          This kernel includes support for the new Video for Linux Two API,
          (V4L2) as well as the original system. Drivers and applications
          need to be rewritten to use V4L2, but drivers for popular cards
          and applications for most video capture functions already exist.
 
-         Documentation for the original API is included in the file
-         <file:Documentation/video4linux/API.html>.  Documentation for V4L2 is
-         available on the web at <http://bytesex.org/v4l/>.
+         Additional info and docs are available on the web at
+         <http://linuxtv.org>
+
+         Documentation for V4L2 is also available on the web at
+         <http://bytesex.org/v4l/>.
 
          To compile this driver as a module, choose M here: the
          module will be called videodev.
 
+config VIDEO_V4L1
+       boolean "Enable Video For Linux API 1 (DEPRECATED)"
+       depends on VIDEO_DEV
+       select VIDEO_V4L1_COMPAT
+       default y
+       ---help---
+         Enables a compatibility API used by most V4L2 devices to allow
+         its usage with legacy applications that supports only V4L1 api.
+
+         If you are unsure as to whether this is required, answer Y.
+
+config VIDEO_V4L1_COMPAT
+       boolean "Enable Video For Linux API 1 compatible Layer"
+       depends on VIDEO_DEV
+       default y
+       ---help---
+         This api were developed to be used at Kernel 2.2 and 2.4, but
+         lacks support for several video standards. There are several
+         drivers at kernel that still depends on it.
+
+         Documentation for the original API is included in the file
+         <Documentation/video4linux/API.html>.
+
+         User tools for this are available from
+         <ftp://ftp.uk.linux.org/pub/linux/video4linux/>.
+
+         If you are unsure as to whether this is required, answer Y.
+
+config VIDEO_V4L2
+       tristate
+       default y
+
 source "drivers/media/video/Kconfig"
 
 source "drivers/media/radio/Kconfig"
@@ -65,4 +97,3 @@ config USB_DABUSB
          module will be called dabusb.
 
 endmenu
-
index 6a901a0268e174a6cdfde7a4b08aee76ff956fe6..1a04db4552da9dc2521867eaff7fd4c5666c7d89 100644 (file)
@@ -1,9 +1,10 @@
 config VIDEO_SAA7146
        tristate
-       select I2C
+       depends on I2C
 
 config VIDEO_SAA7146_VV
        tristate
+       select VIDEO_V4L2
        select VIDEO_BUF
        select VIDEO_VIDEOBUF
        select VIDEO_SAA7146
index 3f0ec6be03ae353811b264f83283e5f5a86721de..a97c8f5e9a5d1dc13f6414106e9f75cc7ab9cd09 100644 (file)
@@ -22,26 +22,26 @@ config DVB
 source "drivers/media/dvb/dvb-core/Kconfig"
 
 comment "Supported SAA7146 based PCI Adapters"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C
 source "drivers/media/dvb/ttpci/Kconfig"
 
 comment "Supported USB Adapters"
-       depends on DVB_CORE && USB
+       depends on DVB_CORE && USB && I2C
 source "drivers/media/dvb/dvb-usb/Kconfig"
 source "drivers/media/dvb/ttusb-budget/Kconfig"
 source "drivers/media/dvb/ttusb-dec/Kconfig"
 source "drivers/media/dvb/cinergyT2/Kconfig"
 
 comment "Supported FlexCopII (B2C2) Adapters"
-       depends on DVB_CORE && (PCI || USB)
+       depends on DVB_CORE && (PCI || USB) && I2C
 source "drivers/media/dvb/b2c2/Kconfig"
 
 comment "Supported BT878 Adapters"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C
 source "drivers/media/dvb/bt8xx/Kconfig"
 
 comment "Supported Pluto2 Adapters"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C
 source "drivers/media/dvb/pluto2/Kconfig"
 
 comment "Supported DVB Frontends"
index 2963605c0ecc236c3c95ea7f22595b4c095702a1..d7f1fd5b7b02a8c62c74d9867a3a228f24b46fda 100644 (file)
@@ -1,6 +1,6 @@
 config DVB_B2C2_FLEXCOP
        tristate "Technisat/B2C2 FlexCopII(b) and FlexCopIII adapters"
-       depends on DVB_CORE
+       depends on DVB_CORE && I2C
        select DVB_STV0299
        select DVB_MT352
        select DVB_MT312
@@ -16,7 +16,7 @@ config DVB_B2C2_FLEXCOP
 
 config DVB_B2C2_FLEXCOP_PCI
        tristate "Technisat/B2C2 Air/Sky/Cable2PC PCI"
-       depends on DVB_B2C2_FLEXCOP && PCI
+       depends on DVB_B2C2_FLEXCOP && PCI && I2C
        help
          Support for the Air/Sky/CableStar2 PCI card (DVB/ATSC) by Technisat/B2C2.
 
@@ -24,7 +24,7 @@ config DVB_B2C2_FLEXCOP_PCI
 
 config DVB_B2C2_FLEXCOP_USB
        tristate "Technisat/B2C2 Air/Sky/Cable2PC USB"
-       depends on DVB_B2C2_FLEXCOP && USB
+       depends on DVB_B2C2_FLEXCOP && USB && I2C
        help
          Support for the Air/Sky/Cable2PC USB1.1 box (DVB/ATSC) by Technisat/B2C2,
 
index 376ca48f1d1da61e843b6fb0aead0203bf926ea7..f394002118f81d48da7aca9846bc7271d4ea19e5 100644 (file)
@@ -1,12 +1,13 @@
 config DVB_BT8XX
        tristate "BT8xx based PCI cards"
-       depends on DVB_CORE && PCI && VIDEO_BT848
+       depends on DVB_CORE && PCI && I2C && VIDEO_BT848
        select DVB_MT352
        select DVB_SP887X
        select DVB_NXT6000
        select DVB_CX24110
        select DVB_OR51211
        select DVB_LGDT330X
+       select DVB_ZL10353
        select FW_LOADER
        help
          Support for PCI cards based on the Bt8xx PCI bridge. Examples are
index baa8227ef87c8d5e045f24ffb8defb011ef6cdaa..ccc7b2eb4a2d33a424e243612634928821c0e096 100644 (file)
@@ -115,7 +115,7 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
        return 0;
 }
 
-static struct bt878 __init *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
+static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev)
 {
        unsigned int card_nr;
 
@@ -709,7 +709,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
                }
 }
 
-static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
+static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
 {
        int result;
 
@@ -794,7 +794,7 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
        return 0;
 }
 
-static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
+static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub)
 {
        struct dvb_bt8xx_card *card;
        struct pci_dev* bttv_pci_dev;
index 71b575dc22bdb2fbfe7a21261da549ffaa8f2cb6..9325d039ea652c622071b04d8c31ed7e6ff473ef 100644 (file)
@@ -902,7 +902,10 @@ static int cinergyt2_probe (struct usb_interface *intf,
                return -ENOMEM;
        }
 
-       dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE);
+       if ((err = dvb_register_adapter(&cinergyt2->adapter, DRIVER_NAME, THIS_MODULE)) < 0) {
+               kfree(cinergyt2);
+               return err;
+       }
 
        cinergyt2->demux.priv = cinergyt2;
        cinergyt2->demux.filternum = 256;
index 4f8f257e67951f38c90b714dd9feadefb17bfadf..a051790161b095f674010e0e286c882f8df0b0a3 100644 (file)
@@ -106,6 +106,8 @@ struct dvb_frontend_private {
        unsigned long tune_mode_flags;
        unsigned int delay;
        unsigned int reinitialise;
+       int tone;
+       int voltage;
 
        /* swzigzag values */
        unsigned int state;
@@ -537,6 +539,12 @@ static int dvb_frontend_thread(void *data)
 
                if (fepriv->reinitialise) {
                        dvb_frontend_init(fe);
+                       if (fepriv->tone != -1) {
+                               fe->ops->set_tone(fe, fepriv->tone);
+                       }
+                       if (fepriv->voltage != -1) {
+                               fe->ops->set_voltage(fe, fepriv->voltage);
+                       }
                        fepriv->reinitialise = 0;
                }
 
@@ -788,6 +796,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
        case FE_SET_TONE:
                if (fe->ops->set_tone) {
                        err = fe->ops->set_tone(fe, (fe_sec_tone_mode_t) parg);
+                       fepriv->tone = (fe_sec_tone_mode_t) parg;
                        fepriv->state = FESTATE_DISEQC;
                        fepriv->status = 0;
                }
@@ -796,6 +805,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
        case FE_SET_VOLTAGE:
                if (fe->ops->set_voltage) {
                        err = fe->ops->set_voltage(fe, (fe_sec_voltage_t) parg);
+                       fepriv->voltage = (fe_sec_voltage_t) parg;
                        fepriv->state = FESTATE_DISEQC;
                        fepriv->status = 0;
                }
@@ -995,6 +1005,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
 
                /* normal tune mode when opened R/W */
                fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT;
+               fepriv->tone = -1;
+               fepriv->voltage = -1;
        }
 
        return ret;
index 96fe0ecae25089da66ee5bd4ca77dd4261dcdd34..3852430d0260e65fc5daf8045c07bd19031933e0 100644 (file)
@@ -219,8 +219,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
                return -ENOMEM;
        }
 
-       mutex_unlock(&dvbdev_register_lock);
-
        memcpy(dvbdev, template, sizeof(struct dvb_device));
        dvbdev->type = type;
        dvbdev->id = id;
@@ -231,6 +229,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
 
        list_add_tail (&dvbdev->list_head, &adap->device_list);
 
+       mutex_unlock(&dvbdev_register_lock);
+
        devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
                        S_IFCHR | S_IRUSR | S_IWUSR,
                        "dvb/adapter%d/%s%d", adap->num, dnames[type], id);
index d3df12039b066dcc4bf83a9dd174489baa1f9262..e388fb1567d6ec6d813158bc29516e07ecd8c496 100644 (file)
@@ -1,6 +1,6 @@
 config DVB_USB
        tristate "Support for various USB DVB devices"
-       depends on DVB_CORE && USB
+       depends on DVB_CORE && USB && I2C
        select FW_LOADER
        help
          By enabling this you will be able to choose the various supported
index 7edd6362b9cc677d414a34e21db232fd8e5e017a..1f0d3e995c8d67e64419b4493b56085719820204 100644 (file)
@@ -150,6 +150,15 @@ static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
                return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
 }
 
+static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
+{
+       u8 b = 0;
+       if (onoff)
+               return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
+       else
+               return 0;
+}
+
 static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
 {
        u8 buf[2] = { 0x03, 0x00 };
@@ -544,7 +553,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
        .size_of_priv     = sizeof(struct cxusb_state),
 
        .streaming_ctrl   = cxusb_streaming_ctrl,
-       .power_ctrl       = cxusb_power_ctrl,
+       .power_ctrl       = cxusb_bluebird_power_ctrl,
        .frontend_attach  = cxusb_lgdt3303_frontend_attach,
        .tuner_attach     = cxusb_lgh064f_tuner_attach,
 
@@ -589,7 +598,7 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
        .size_of_priv     = sizeof(struct cxusb_state),
 
        .streaming_ctrl   = cxusb_streaming_ctrl,
-       .power_ctrl       = cxusb_power_ctrl,
+       .power_ctrl       = cxusb_bluebird_power_ctrl,
        .frontend_attach  = cxusb_dee1601_frontend_attach,
        .tuner_attach     = cxusb_dee1601_tuner_attach,
 
@@ -638,7 +647,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
        .size_of_priv     = sizeof(struct cxusb_state),
 
        .streaming_ctrl   = cxusb_streaming_ctrl,
-       .power_ctrl       = cxusb_power_ctrl,
+       .power_ctrl       = cxusb_bluebird_power_ctrl,
        .frontend_attach  = cxusb_mt352_frontend_attach,
        .tuner_attach     = cxusb_lgz201_tuner_attach,
 
@@ -683,7 +692,7 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
        .size_of_priv     = sizeof(struct cxusb_state),
 
        .streaming_ctrl   = cxusb_streaming_ctrl,
-       .power_ctrl       = cxusb_power_ctrl,
+       .power_ctrl       = cxusb_bluebird_power_ctrl,
        .frontend_attach  = cxusb_mt352_frontend_attach,
        .tuner_attach     = cxusb_dtt7579_tuner_attach,
 
index d661c6f9cbe527cfc0138ea79f2fc12fe315e310..691dc840dcc06ee15ad125aec428c6093413ad66 100644 (file)
@@ -29,6 +29,9 @@
 #include "dvb_frontend.h"
 #include "cx24123.h"
 
+#define XTAL 10111000
+
+static int force_band;
 static int debug;
 #define dprintk(args...) \
        do { \
@@ -52,6 +55,7 @@ struct cx24123_state
        u32 VGAarg;
        u32 bandselectarg;
        u32 pllarg;
+       u32 FILTune;
 
        /* The Demod/Tuner can't easily provide these, we cache them */
        u32 currentfreq;
@@ -63,43 +67,33 @@ static struct
 {
        u32 symbolrate_low;
        u32 symbolrate_high;
-       u32 VCAslope;
-       u32 VCAoffset;
-       u32 VGA1offset;
-       u32 VGA2offset;
        u32 VCAprogdata;
        u32 VGAprogdata;
+       u32 FILTune;
 } cx24123_AGC_vals[] =
 {
        {
                .symbolrate_low         = 1000000,
                .symbolrate_high        = 4999999,
-               .VCAslope               = 0x07,
-               .VCAoffset              = 0x0f,
-               .VGA1offset             = 0x1f8,
-               .VGA2offset             = 0x1f8,
-               .VGAprogdata            = (2 << 18) | (0x1f8 << 9) | 0x1f8,
-               .VCAprogdata            = (4 << 18) | (0x07 << 9) | 0x07,
+               /* the specs recommend other values for VGA offsets,
+                  but tests show they are wrong */
+               .VGAprogdata            = (1 << 19) | (0x180 << 9) | 0x1e0,
+               .VCAprogdata            = (2 << 19) | (0x07 << 9) | 0x07,
+               .FILTune                = 0x27f /* 0.41 V */
        },
        {
                .symbolrate_low         =  5000000,
                .symbolrate_high        = 14999999,
-               .VCAslope               = 0x1f,
-               .VCAoffset              = 0x1f,
-               .VGA1offset             = 0x1e0,
-               .VGA2offset             = 0x180,
-               .VGAprogdata            = (2 << 18) | (0x180 << 9) | 0x1e0,
-               .VCAprogdata            = (4 << 18) | (0x07 << 9) | 0x1f,
+               .VGAprogdata            = (1 << 19) | (0x180 << 9) | 0x1e0,
+               .VCAprogdata            = (2 << 19) | (0x07 << 9) | 0x1f,
+               .FILTune                = 0x317 /* 0.90 V */
        },
        {
                .symbolrate_low         = 15000000,
                .symbolrate_high        = 45000000,
-               .VCAslope               = 0x3f,
-               .VCAoffset              = 0x3f,
-               .VGA1offset             = 0x180,
-               .VGA2offset             = 0x100,
-               .VGAprogdata            = (2 << 18) | (0x100 << 9) | 0x180,
-               .VCAprogdata            = (4 << 18) | (0x07 << 9) | 0x3f,
+               .VGAprogdata            = (1 << 19) | (0x100 << 9) | 0x180,
+               .VCAprogdata            = (2 << 19) | (0x07 << 9) | 0x3f,
+               .FILTune                = 0x145 /* 2.70 V */
        },
 };
 
@@ -112,91 +106,80 @@ static struct
 {
        u32 freq_low;
        u32 freq_high;
-       u32 bandselect;
        u32 VCOdivider;
-       u32 VCOnumber;
        u32 progdata;
 } cx24123_bandselect_vals[] =
 {
+       /* band 1 */
        {
                .freq_low       = 950000,
-               .freq_high      = 1018999,
-               .bandselect     = 0x40,
-               .VCOdivider     = 4,
-               .VCOnumber      = 7,
-               .progdata       = (0 << 18) | (0 << 9) | 0x40,
-       },
-       {
-               .freq_low       = 1019000,
                .freq_high      = 1074999,
-               .bandselect     = 0x80,
                .VCOdivider     = 4,
-               .VCOnumber      = 8,
-               .progdata       = (0 << 18) | (0 << 9) | 0x80,
+               .progdata       = (0 << 19) | (0 << 9) | 0x40,
        },
+
+       /* band 2 */
        {
                .freq_low       = 1075000,
-               .freq_high      = 1227999,
-               .bandselect     = 0x01,
-               .VCOdivider     = 2,
-               .VCOnumber      = 1,
-               .progdata       = (0 << 18) | (1 << 9) | 0x01,
+               .freq_high      = 1177999,
+               .VCOdivider     = 4,
+               .progdata       = (0 << 19) | (0 << 9) | 0x80,
        },
+
+       /* band 3 */
        {
-               .freq_low       = 1228000,
-               .freq_high      = 1349999,
-               .bandselect     = 0x02,
+               .freq_low       = 1178000,
+               .freq_high      = 1295999,
                .VCOdivider     = 2,
-               .VCOnumber      = 2,
-               .progdata       = (0 << 18) | (1 << 9) | 0x02,
+               .progdata       = (0 << 19) | (1 << 9) | 0x01,
        },
+
+       /* band 4 */
        {
-               .freq_low       = 1350000,
-               .freq_high      = 1481999,
-               .bandselect     = 0x04,
+               .freq_low       = 1296000,
+               .freq_high      = 1431999,
                .VCOdivider     = 2,
-               .VCOnumber      = 3,
-               .progdata       = (0 << 18) | (1 << 9) | 0x04,
+               .progdata       = (0 << 19) | (1 << 9) | 0x02,
        },
+
+       /* band 5 */
        {
-               .freq_low       = 1482000,
-               .freq_high      = 1595999,
-               .bandselect     = 0x08,
+               .freq_low       = 1432000,
+               .freq_high      = 1575999,
                .VCOdivider     = 2,
-               .VCOnumber      = 4,
-               .progdata       = (0 << 18) | (1 << 9) | 0x08,
+               .progdata       = (0 << 19) | (1 << 9) | 0x04,
        },
+
+       /* band 6 */
        {
-               .freq_low       = 1596000,
+               .freq_low       = 1576000,
                .freq_high      = 1717999,
-               .bandselect     = 0x10,
                .VCOdivider     = 2,
-               .VCOnumber      = 5,
-               .progdata       = (0 << 18) | (1 << 9) | 0x10,
+               .progdata       = (0 << 19) | (1 << 9) | 0x08,
        },
+
+       /* band 7 */
        {
                .freq_low       = 1718000,
                .freq_high      = 1855999,
-               .bandselect     = 0x20,
                .VCOdivider     = 2,
-               .VCOnumber      = 6,
-               .progdata       = (0 << 18) | (1 << 9) | 0x20,
+               .progdata       = (0 << 19) | (1 << 9) | 0x10,
        },
+
+       /* band 8 */
        {
                .freq_low       = 1856000,
                .freq_high      = 2035999,
-               .bandselect     = 0x40,
                .VCOdivider     = 2,
-               .VCOnumber      = 7,
-               .progdata       = (0 << 18) | (1 << 9) | 0x40,
+               .progdata       = (0 << 19) | (1 << 9) | 0x20,
        },
+
+       /* band 9 */
        {
                .freq_low       = 2036000,
-               .freq_high      = 2149999,
-               .bandselect     = 0x80,
+               .freq_high      = 2150000,
                .VCOdivider     = 2,
-               .VCOnumber      = 8,
-               .progdata       = (0 << 18) | (1 << 9) | 0x80,
+               .progdata       = (0 << 19) | (1 << 9) | 0x40,
        },
 };
 
@@ -207,49 +190,44 @@ static struct {
 {
        {0x00, 0x03}, /* Reset system */
        {0x00, 0x00}, /* Clear reset */
-       {0x01, 0x3b}, /* Apply sensible defaults, from an i2c sniffer */
-       {0x03, 0x07},
-       {0x04, 0x10},
-       {0x05, 0x04},
-       {0x06, 0x31},
-       {0x0d, 0x02},
-       {0x0e, 0x03},
-       {0x0f, 0xfe},
-       {0x10, 0x01},
-       {0x14, 0x01},
-       {0x15, 0x98},
-       {0x16, 0x00},
-       {0x17, 0x01},
-       {0x1b, 0x05},
-       {0x1c, 0x80},
-       {0x1d, 0x00},
-       {0x1e, 0x00},
-       {0x20, 0x41},
-       {0x21, 0x15},
-       {0x27, 0x14},
-       {0x28, 0x46},
-       {0x29, 0x00},
-       {0x2a, 0xb0},
-       {0x2b, 0x73},
-       {0x2c, 0x00},
+       {0x03, 0x07}, /* QPSK, DVB, Auto Acquisition (default) */
+       {0x04, 0x10}, /* MPEG */
+       {0x05, 0x04}, /* MPEG */
+       {0x06, 0x31}, /* MPEG (default) */
+       {0x0b, 0x00}, /* Freq search start point (default) */
+       {0x0c, 0x00}, /* Demodulator sample gain (default) */
+       {0x0d, 0x02}, /* Frequency search range = Fsymbol / 4 (default) */
+       {0x0e, 0x03}, /* Default non-inverted, FEC 3/4 (default) */
+       {0x0f, 0xfe}, /* FEC search mask (all supported codes) */
+       {0x10, 0x01}, /* Default search inversion, no repeat (default) */
+       {0x16, 0x00}, /* Enable reading of frequency */
+       {0x17, 0x01}, /* Enable EsNO Ready Counter */
+       {0x1c, 0x80}, /* Enable error counter */
+       {0x20, 0x00}, /* Tuner burst clock rate = 500KHz */
+       {0x21, 0x15}, /* Tuner burst mode, word length = 0x15 */
+       {0x28, 0x00}, /* Enable FILTERV with positive pol., DiSEqC 2.x off */
+       {0x29, 0x00}, /* DiSEqC LNB_DC off */
+       {0x2a, 0xb0}, /* DiSEqC Parameters (default) */
+       {0x2b, 0x73}, /* DiSEqC Tone Frequency (default) */
+       {0x2c, 0x00}, /* DiSEqC Message (0x2c - 0x31) */
        {0x2d, 0x00},
        {0x2e, 0x00},
        {0x2f, 0x00},
        {0x30, 0x00},
        {0x31, 0x00},
-       {0x32, 0x8c},
-       {0x33, 0x00},
+       {0x32, 0x8c}, /* DiSEqC Parameters (default) */
+       {0x33, 0x00}, /* Interrupts off (0x33 - 0x34) */
        {0x34, 0x00},
-       {0x35, 0x03},
-       {0x36, 0x02},
-       {0x37, 0x3a},
-       {0x3a, 0x00},   /* Enable AGC accumulator */
-       {0x44, 0x00},
-       {0x45, 0x00},
-       {0x46, 0x05},
-       {0x56, 0x41},
-       {0x57, 0xff},
-       {0x67, 0x83},
+       {0x35, 0x03}, /* DiSEqC Tone Amplitude (default) */
+       {0x36, 0x02}, /* DiSEqC Parameters (default) */
+       {0x37, 0x3a}, /* DiSEqC Parameters (default) */
+       {0x3a, 0x00}, /* Enable AGC accumulator (for signal strength) */
+       {0x44, 0x00}, /* Constellation (default) */
+       {0x45, 0x00}, /* Symbol count (default) */
+       {0x46, 0x0d}, /* Symbol rate estimator on (default) */
+       {0x56, 0x41}, /* Various (default) */
+       {0x57, 0xff}, /* Error Counter Window (default) */
+       {0x67, 0x83}, /* Non-DCII symbol clock */
 };
 
 static int cx24123_writereg(struct cx24123_state* state, int reg, int data)
@@ -258,6 +236,10 @@ static int cx24123_writereg(struct cx24123_state* state, int reg, int data)
        struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
        int err;
 
+       if (debug>1)
+               printk("cx24123: %s:  write reg 0x%02x, value 0x%02x\n",
+                                               __FUNCTION__,reg, data);
+
        if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
                printk("%s: writereg error(err == %i, reg == 0x%02x,"
                         " data == 0x%02x)\n", __FUNCTION__, err, reg, data);
@@ -274,6 +256,10 @@ static int cx24123_writelnbreg(struct cx24123_state* state, int reg, int data)
        struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = buf, .len = 2 };
        int err;
 
+       if (debug>1)
+               printk("cx24123: %s:  writeln addr=0x08, reg 0x%02x, value 0x%02x\n",
+                                               __FUNCTION__,reg, data);
+
        if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
                printk("%s: writelnbreg error (err == %i, reg == 0x%02x,"
                         " data == 0x%02x)\n", __FUNCTION__, err, reg, data);
@@ -303,6 +289,9 @@ static int cx24123_readreg(struct cx24123_state* state, u8 reg)
                return ret;
        }
 
+       if (debug>1)
+               printk("cx24123: read reg 0x%02x, value 0x%02x\n",reg, ret);
+
        return b1[0];
 }
 
@@ -313,17 +302,23 @@ static int cx24123_readlnbreg(struct cx24123_state* state, u8 reg)
 
 static int cx24123_set_inversion(struct cx24123_state* state, fe_spectral_inversion_t inversion)
 {
+       u8 nom_reg = cx24123_readreg(state, 0x0e);
+       u8 auto_reg = cx24123_readreg(state, 0x10);
+
        switch (inversion) {
        case INVERSION_OFF:
-               cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) & 0x7f);
-               cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
+               dprintk("%s:  inversion off\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg & ~0x80);
+               cx24123_writereg(state, 0x10, auto_reg | 0x80);
                break;
        case INVERSION_ON:
-               cx24123_writereg(state, 0x0e, cx24123_readreg(state, 0x0e) | 0x80);
-               cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) | 0x80);
+               dprintk("%s:  inversion on\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x80);
+               cx24123_writereg(state, 0x10, auto_reg | 0x80);
                break;
        case INVERSION_AUTO:
-               cx24123_writereg(state, 0x10, cx24123_readreg(state, 0x10) & 0x7f);
+               dprintk("%s:  inversion auto\n",__FUNCTION__);
+               cx24123_writereg(state, 0x10, auto_reg & ~0x80);
                break;
        default:
                return -EINVAL;
@@ -338,92 +333,191 @@ static int cx24123_get_inversion(struct cx24123_state* state, fe_spectral_invers
 
        val = cx24123_readreg(state, 0x1b) >> 7;
 
-       if (val == 0)
+       if (val == 0) {
+               dprintk("%s:  read inversion off\n",__FUNCTION__);
                *inversion = INVERSION_OFF;
-       else
+       } else {
+               dprintk("%s:  read inversion on\n",__FUNCTION__);
                *inversion = INVERSION_ON;
+       }
 
        return 0;
 }
 
 static int cx24123_set_fec(struct cx24123_state* state, fe_code_rate_t fec)
 {
+       u8 nom_reg = cx24123_readreg(state, 0x0e) & ~0x07;
+
        if ( (fec < FEC_NONE) || (fec > FEC_AUTO) )
                fec = FEC_AUTO;
 
-       /* Hardware has 5/11 and 3/5 but are never unused */
        switch (fec) {
-       case FEC_NONE:
-               return cx24123_writereg(state, 0x0f, 0x01);
        case FEC_1_2:
-               return cx24123_writereg(state, 0x0f, 0x02);
+               dprintk("%s:  set FEC to 1/2\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x01);
+               cx24123_writereg(state, 0x0f, 0x02);
+               break;
        case FEC_2_3:
-               return cx24123_writereg(state, 0x0f, 0x04);
+               dprintk("%s:  set FEC to 2/3\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x02);
+               cx24123_writereg(state, 0x0f, 0x04);
+               break;
        case FEC_3_4:
-               return cx24123_writereg(state, 0x0f, 0x08);
+               dprintk("%s:  set FEC to 3/4\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x03);
+               cx24123_writereg(state, 0x0f, 0x08);
+               break;
+       case FEC_4_5:
+               dprintk("%s:  set FEC to 4/5\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x04);
+               cx24123_writereg(state, 0x0f, 0x10);
+               break;
        case FEC_5_6:
-               return cx24123_writereg(state, 0x0f, 0x20);
+               dprintk("%s:  set FEC to 5/6\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x05);
+               cx24123_writereg(state, 0x0f, 0x20);
+               break;
+       case FEC_6_7:
+               dprintk("%s:  set FEC to 6/7\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x06);
+               cx24123_writereg(state, 0x0f, 0x40);
+               break;
        case FEC_7_8:
-               return cx24123_writereg(state, 0x0f, 0x80);
+               dprintk("%s:  set FEC to 7/8\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0e, nom_reg | 0x07);
+               cx24123_writereg(state, 0x0f, 0x80);
+               break;
        case FEC_AUTO:
-               return cx24123_writereg(state, 0x0f, 0xae);
+               dprintk("%s:  set FEC to auto\n",__FUNCTION__);
+               cx24123_writereg(state, 0x0f, 0xfe);
+               break;
        default:
                return -EOPNOTSUPP;
        }
+
+       return 0;
 }
 
 static int cx24123_get_fec(struct cx24123_state* state, fe_code_rate_t *fec)
 {
        int ret;
-       u8 val;
 
        ret = cx24123_readreg (state, 0x1b);
        if (ret < 0)
                return ret;
-       val = ret & 0x07;
-       switch (val) {
+       ret = ret & 0x07;
+
+       switch (ret) {
        case 1:
                *fec = FEC_1_2;
                break;
-       case 3:
+       case 2:
                *fec = FEC_2_3;
                break;
-       case 4:
+       case 3:
                *fec = FEC_3_4;
                break;
-       case 5:
+       case 4:
                *fec = FEC_4_5;
                break;
-       case 6:
+       case 5:
                *fec = FEC_5_6;
                break;
+       case 6:
+               *fec = FEC_6_7;
+               break;
        case 7:
                *fec = FEC_7_8;
                break;
-       case 2: /* *fec = FEC_3_5; break; */
-       case 0: /* *fec = FEC_5_11; break; */
-               *fec = FEC_AUTO;
-               break;
        default:
-               *fec = FEC_NONE; // can't happen
+               /* this can happen when there's no lock */
+               *fec = FEC_NONE;
        }
 
        return 0;
 }
 
-/* fixme: Symbol rates < 3MSps may not work because of precision loss */
+/* Approximation of closest integer of log2(a/b). It actually gives the
+   lowest integer i such that 2^i >= round(a/b) */
+static u32 cx24123_int_log2(u32 a, u32 b)
+{
+       u32 exp, nearest = 0;
+       u32 div = a / b;
+       if(a % b >= b / 2) ++div;
+       if(div < (1 << 31))
+       {
+               for(exp = 1; div > exp; nearest++)
+                       exp += exp;
+       }
+       return nearest;
+}
+
 static int cx24123_set_symbolrate(struct cx24123_state* state, u32 srate)
 {
-       u32 val;
+       u32 tmp, sample_rate, ratio, sample_gain;
+       u8 pll_mult;
+
+       /*  check if symbol rate is within limits */
+       if ((srate > state->ops.info.symbol_rate_max) ||
+           (srate < state->ops.info.symbol_rate_min))
+               return -EOPNOTSUPP;;
+
+       /* choose the sampling rate high enough for the required operation,
+          while optimizing the power consumed by the demodulator */
+       if (srate < (XTAL*2)/2)
+               pll_mult = 2;
+       else if (srate < (XTAL*3)/2)
+               pll_mult = 3;
+       else if (srate < (XTAL*4)/2)
+               pll_mult = 4;
+       else if (srate < (XTAL*5)/2)
+               pll_mult = 5;
+       else if (srate < (XTAL*6)/2)
+               pll_mult = 6;
+       else if (srate < (XTAL*7)/2)
+               pll_mult = 7;
+       else if (srate < (XTAL*8)/2)
+               pll_mult = 8;
+       else
+               pll_mult = 9;
+
+
+       sample_rate = pll_mult * XTAL;
+
+       /*
+           SYSSymbolRate[21:0] = (srate << 23) / sample_rate
+
+           We have to use 32 bit unsigned arithmetic without precision loss.
+           The maximum srate is 45000000 or 0x02AEA540. This number has
+           only 6 clear bits on top, hence we can shift it left only 6 bits
+           at a time. Borrowed from cx24110.c
+       */
+
+       tmp = srate << 6;
+       ratio = tmp / sample_rate;
+
+       tmp = (tmp % sample_rate) << 6;
+       ratio = (ratio << 6) + (tmp / sample_rate);
+
+       tmp = (tmp % sample_rate) << 6;
+       ratio = (ratio << 6) + (tmp / sample_rate);
+
+       tmp = (tmp % sample_rate) << 5;
+       ratio = (ratio << 5) + (tmp / sample_rate);
+
+
+       cx24123_writereg(state, 0x01, pll_mult * 6);
 
-       val = (srate / 1185) * 100;
+       cx24123_writereg(state, 0x08, (ratio >> 16) & 0x3f );
+       cx24123_writereg(state, 0x09, (ratio >>  8) & 0xff );
+       cx24123_writereg(state, 0x0a, (ratio      ) & 0xff );
 
-       /* Compensate for scaling up, by removing 17 symbols per 1Msps */
-       val = val - (17 * (srate / 1000000));
+       /* also set the demodulator sample gain */
+       sample_gain = cx24123_int_log2(sample_rate, srate);
+       tmp = cx24123_readreg(state, 0x0c) & ~0xe0;
+       cx24123_writereg(state, 0x0c, tmp | sample_gain << 5);
 
-       cx24123_writereg(state, 0x08, (val >> 16) & 0xff );
-       cx24123_writereg(state, 0x09, (val >>  8) & 0xff );
-       cx24123_writereg(state, 0x0a, (val      ) & 0xff );
+       dprintk("%s: srate=%d, ratio=0x%08x, sample_rate=%i sample_gain=%d\n", __FUNCTION__, srate, ratio, sample_rate, sample_gain);
 
        return 0;
 }
@@ -437,6 +531,9 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
        struct cx24123_state *state = fe->demodulator_priv;
        u32 ndiv = 0, adiv = 0, vco_div = 0;
        int i = 0;
+       int pump = 2;
+       int band = 0;
+       int num_bands = sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]);
 
        /* Defaults for low freq, low rate */
        state->VCAarg = cx24123_AGC_vals[0].VCAprogdata;
@@ -444,38 +541,49 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
        state->bandselectarg = cx24123_bandselect_vals[0].progdata;
        vco_div = cx24123_bandselect_vals[0].VCOdivider;
 
-       /* For the given symbolerate, determine the VCA and VGA programming bits */
+       /* For the given symbol rate, determine the VCA, VGA and FILTUNE programming bits */
        for (i = 0; i < sizeof(cx24123_AGC_vals) / sizeof(cx24123_AGC_vals[0]); i++)
        {
                if ((cx24123_AGC_vals[i].symbolrate_low <= p->u.qpsk.symbol_rate) &&
-                               (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) {
+                   (cx24123_AGC_vals[i].symbolrate_high >= p->u.qpsk.symbol_rate) ) {
                        state->VCAarg = cx24123_AGC_vals[i].VCAprogdata;
                        state->VGAarg = cx24123_AGC_vals[i].VGAprogdata;
+                       state->FILTune = cx24123_AGC_vals[i].FILTune;
                }
        }
 
-       /* For the given frequency, determine the bandselect programming bits */
-       for (i = 0; i < sizeof(cx24123_bandselect_vals) / sizeof(cx24123_bandselect_vals[0]); i++)
+       /* determine the band to use */
+       if(force_band < 1 || force_band > num_bands)
        {
-               if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) &&
-                               (cx24123_bandselect_vals[i].freq_high >= p->frequency) ) {
-                       state->bandselectarg = cx24123_bandselect_vals[i].progdata;
-                       vco_div = cx24123_bandselect_vals[i].VCOdivider;
+               for (i = 0; i < num_bands; i++)
+               {
+                       if ((cx24123_bandselect_vals[i].freq_low <= p->frequency) &&
+                           (cx24123_bandselect_vals[i].freq_high >= p->frequency) )
+                               band = i;
                }
        }
+       else
+               band = force_band - 1;
+
+       state->bandselectarg = cx24123_bandselect_vals[band].progdata;
+       vco_div = cx24123_bandselect_vals[band].VCOdivider;
+
+       /* determine the charge pump current */
+       if ( p->frequency < (cx24123_bandselect_vals[band].freq_low + cx24123_bandselect_vals[band].freq_high)/2 )
+               pump = 0x01;
+       else
+               pump = 0x02;
 
        /* Determine the N/A dividers for the requested lband freq (in kHz). */
-       /* Note: 10111 (kHz) is the Crystal Freq and divider of 10. */
-       ndiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) / 32) & 0x1ff;
-       adiv = ( ((p->frequency * vco_div) / (10111 / 10) / 2) % 32) & 0x1f;
+       /* Note: the reference divider R=10, frequency is in KHz, XTAL is in Hz */
+       ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff;
+       adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f;
 
        if (adiv == 0)
-               adiv++;
+               ndiv++;
 
-       /* determine the correct pll frequency values. */
-       /* Command 11, refdiv 11, cpump polarity 1, cpump current 3mA 10. */
-       state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (2 << 14);
-       state->pllarg |= (ndiv << 5) | adiv;
+       /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */
+       state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv;
 
        return 0;
 }
@@ -489,6 +597,8 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par
        struct cx24123_state *state = fe->demodulator_priv;
        unsigned long timeout;
 
+       dprintk("%s:  pll writereg called, data=0x%08x\n",__FUNCTION__,data);
+
        /* align the 21 bytes into to bit23 boundary */
        data = data << 3;
 
@@ -538,6 +648,9 @@ static int cx24123_pll_writereg(struct dvb_frontend* fe, struct dvb_frontend_par
 static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
 {
        struct cx24123_state *state = fe->demodulator_priv;
+       u8 val;
+
+       dprintk("frequency=%i\n", p->frequency);
 
        if (cx24123_pll_calculate(fe, p) != 0) {
                printk("%s: cx24123_pll_calcutate failed\n",__FUNCTION__);
@@ -552,6 +665,14 @@ static int cx24123_pll_tune(struct dvb_frontend* fe, struct dvb_frontend_paramet
        cx24123_pll_writereg(fe, p, state->bandselectarg);
        cx24123_pll_writereg(fe, p, state->pllarg);
 
+       /* set the FILTUNE voltage */
+       val = cx24123_readreg(state, 0x28) & ~0x3;
+       cx24123_writereg(state, 0x27, state->FILTune >> 2);
+       cx24123_writereg(state, 0x28, val | (state->FILTune & 0x3));
+
+       dprintk("%s:  pll tune VCA=%d, band=%d, pll=%d\n",__FUNCTION__,state->VCAarg,
+                       state->bandselectarg,state->pllarg);
+
        return 0;
 }
 
@@ -560,6 +681,8 @@ static int cx24123_initfe(struct dvb_frontend* fe)
        struct cx24123_state *state = fe->demodulator_priv;
        int i;
 
+       dprintk("%s:  init frontend\n",__FUNCTION__);
+
        /* Configure the demod to a good set of defaults */
        for (i = 0; i < sizeof(cx24123_regdata) / sizeof(cx24123_regdata[0]); i++)
                cx24123_writereg(state, cx24123_regdata[i].reg, cx24123_regdata[i].data);
@@ -587,10 +710,13 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
 
                switch (voltage) {
                case SEC_VOLTAGE_13:
+                       dprintk("%s:  isl6421 voltage = 13V\n",__FUNCTION__);
                        return cx24123_writelnbreg(state, 0x0, val & 0x32); /* V 13v */
                case SEC_VOLTAGE_18:
+                       dprintk("%s:  isl6421 voltage = 18V\n",__FUNCTION__);
                        return cx24123_writelnbreg(state, 0x0, val | 0x04); /* H 18v */
                case SEC_VOLTAGE_OFF:
+                       dprintk("%s:  isl5421 voltage off\n",__FUNCTION__);
                        return cx24123_writelnbreg(state, 0x0, val & 0x30);
                default:
                        return -EINVAL;
@@ -624,13 +750,93 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
        return 0;
 }
 
-static int cx24123_send_diseqc_msg(struct dvb_frontend* fe,
-                                  struct dvb_diseqc_master_cmd *cmd)
+/* wait for diseqc queue to become ready (or timeout) */
+static void cx24123_wait_for_diseqc(struct cx24123_state *state)
+{
+       unsigned long timeout = jiffies + msecs_to_jiffies(200);
+       while (!(cx24123_readreg(state, 0x29) & 0x40)) {
+               if(time_after(jiffies, timeout)) {
+                       printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__);
+                       break;
+               }
+               msleep(10);
+       }
+}
+
+static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
 {
-       /* fixme: Implement diseqc */
-       printk("%s: No support yet\n",__FUNCTION__);
+       struct cx24123_state *state = fe->demodulator_priv;
+       int i, val;
+
+       dprintk("%s:\n",__FUNCTION__);
+
+       /* check if continuous tone has been stopped */
+       if (state->config->use_isl6421)
+               val = cx24123_readlnbreg(state, 0x00) & 0x10;
+       else
+               val = cx24123_readreg(state, 0x29) & 0x10;
 
-       return -ENOTSUPP;
+
+       if (val) {
+               printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__);
+               return -ENOTSUPP;
+       }
+
+       /* wait for diseqc queue ready */
+       cx24123_wait_for_diseqc(state);
+
+       /* select tone mode */
+       cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8);
+
+       for (i = 0; i < cmd->msg_len; i++)
+               cx24123_writereg(state, 0x2C + i, cmd->msg[i]);
+
+       val = cx24123_readreg(state, 0x29);
+       cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));
+
+       /* wait for diseqc message to finish sending */
+       cx24123_wait_for_diseqc(state);
+
+       return 0;
+}
+
+static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
+{
+       struct cx24123_state *state = fe->demodulator_priv;
+       int val;
+
+       dprintk("%s:\n", __FUNCTION__);
+
+       /* check if continuous tone has been stoped */
+       if (state->config->use_isl6421)
+               val = cx24123_readlnbreg(state, 0x00) & 0x10;
+       else
+               val = cx24123_readreg(state, 0x29) & 0x10;
+
+
+       if (val) {
+               printk("%s: ERROR: attempt to send diseqc command before tone is off\n", __FUNCTION__);
+               return -ENOTSUPP;
+       }
+
+       cx24123_wait_for_diseqc(state);
+
+       /* select tone mode */
+       val = cx24123_readreg(state, 0x2a) & 0xf8;
+       cx24123_writereg(state, 0x2a, val | 0x04);
+
+       val = cx24123_readreg(state, 0x29);
+
+       if (burst == SEC_MINI_A)
+               cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x00));
+       else if (burst == SEC_MINI_B)
+               cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40 | 0x08));
+       else
+               return -EINVAL;
+
+       cx24123_wait_for_diseqc(state);
+
+       return 0;
 }
 
 static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status)
@@ -642,13 +848,15 @@ static int cx24123_read_status(struct dvb_frontend* fe, fe_status_t* status)
 
        *status = 0;
        if (lock & 0x01)
-               *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL;
+               *status |= FE_HAS_SIGNAL;
+       if (sync & 0x02)
+               *status |= FE_HAS_CARRIER;
        if (sync & 0x04)
                *status |= FE_HAS_VITERBI;
        if (sync & 0x08)
-               *status |= FE_HAS_CARRIER;
+               *status |= FE_HAS_SYNC;
        if (sync & 0x80)
-               *status |= FE_HAS_SYNC | FE_HAS_LOCK;
+               *status |= FE_HAS_LOCK;
 
        return 0;
 }
@@ -681,6 +889,8 @@ static int cx24123_read_ber(struct dvb_frontend* fe, u32* ber)
        else
                state->snr = 0;
 
+       dprintk("%s:  BER = %d, S/N index = %d\n",__FUNCTION__,state->lastber, state->snr);
+
        *ber = state->lastber;
 
        return 0;
@@ -691,6 +901,8 @@ static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_str
        struct cx24123_state *state = fe->demodulator_priv;
        *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */
 
+       dprintk("%s:  Signal strength = %d\n",__FUNCTION__,*signal_strength);
+
        return 0;
 }
 
@@ -699,6 +911,8 @@ static int cx24123_read_snr(struct dvb_frontend* fe, u16* snr)
        struct cx24123_state *state = fe->demodulator_priv;
        *snr = state->snr;
 
+       dprintk("%s:  read S/N index = %d\n",__FUNCTION__,*snr);
+
        return 0;
 }
 
@@ -707,6 +921,8 @@ static int cx24123_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
        struct cx24123_state *state = fe->demodulator_priv;
        *ucblocks = state->lastber;
 
+       dprintk("%s:  ucblocks (ber) = %d\n",__FUNCTION__,*ucblocks);
+
        return 0;
 }
 
@@ -714,6 +930,8 @@ static int cx24123_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
 {
        struct cx24123_state *state = fe->demodulator_priv;
 
+       dprintk("%s:  set_frontend\n",__FUNCTION__);
+
        if (state->config->set_ts_params)
                state->config->set_ts_params(fe, 0);
 
@@ -737,6 +955,8 @@ static int cx24123_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
 {
        struct cx24123_state *state = fe->demodulator_priv;
 
+       dprintk("%s:  get_frontend\n",__FUNCTION__);
+
        if (cx24123_get_inversion(state, &p->inversion) != 0) {
                printk("%s: Failed to get inversion status\n",__FUNCTION__);
                return -EREMOTEIO;
@@ -763,8 +983,10 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
 
                switch (tone) {
                case SEC_TONE_ON:
+                       dprintk("%s:  isl6421 sec tone on\n",__FUNCTION__);
                        return cx24123_writelnbreg(state, 0x0, val | 0x10);
                case SEC_TONE_OFF:
+                       dprintk("%s:  isl6421 sec tone off\n",__FUNCTION__);
                        return cx24123_writelnbreg(state, 0x0, val & 0x2f);
                default:
                        printk("%s: CASE reached default with tone=%d\n", __FUNCTION__, tone);
@@ -855,12 +1077,13 @@ static struct dvb_frontend_ops cx24123_ops = {
                .frequency_min = 950000,
                .frequency_max = 2150000,
                .frequency_stepsize = 1011, /* kHz for QPSK frontends */
-               .frequency_tolerance = 29500,
+               .frequency_tolerance = 5000,
                .symbol_rate_min = 1000000,
                .symbol_rate_max = 45000000,
                .caps = FE_CAN_INVERSION_AUTO |
                        FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
-                       FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
+                       FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 |
+                       FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
                        FE_CAN_QPSK | FE_CAN_RECOVER
        },
 
@@ -875,12 +1098,16 @@ static struct dvb_frontend_ops cx24123_ops = {
        .read_snr = cx24123_read_snr,
        .read_ucblocks = cx24123_read_ucblocks,
        .diseqc_send_master_cmd = cx24123_send_diseqc_msg,
+       .diseqc_send_burst = cx24123_diseqc_send_burst,
        .set_tone = cx24123_set_tone,
        .set_voltage = cx24123_set_voltage,
 };
 
 module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
+MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
+
+module_param(force_band, int, 0644);
+MODULE_PARM_DESC(force_band, "Force a specific band select (1-9, default:off).");
 
 MODULE_DESCRIPTION("DVB Frontend module for Conexant cx24123/cx24109 hardware");
 MODULE_AUTHOR("Steven Toth");
index b6e2c387a04cc06f05405871b088bfa78cce1ae6..791706ec1da39a5b4ca528a08162ee19f9f70a00 100644 (file)
@@ -235,8 +235,8 @@ struct dvb_pll_desc dvb_pll_tdvs_tua6034 = {
        .max   = 863000000,
        .count = 3,
        .entries = {
-               {  160000000, 44000000, 62500, 0xce, 0x01 },
-               {  455000000, 44000000, 62500, 0xce, 0x02 },
+               {  165000000, 44000000, 62500, 0xce, 0x01 },
+               {  450000000, 44000000, 62500, 0xce, 0x02 },
                {  999999999, 44000000, 62500, 0xce, 0x04 },
        },
 };
index 84f8f9f52869a778f797d7dc2bfffb73f61b52b1..7d8e6e87bdbb23e63b8ec06c55a6c2972457dcba 100644 (file)
@@ -1,7 +1,6 @@
 config DVB_PLUTO2
        tristate "Pluto2 cards"
-       depends on DVB_CORE && PCI
-       select I2C
+       depends on DVB_CORE && PCI && I2C
        select I2C_ALGOBIT
        select DVB_TDA1004X
        help
index 86ca84b2be6e1a9a88fb39d218142439db96cc73..ce6a9aaf937e9e0a7c8713f015c1ccd0dcf91325 100644 (file)
@@ -1,3 +1,3 @@
-obj-$(CONFIG_DVB_PLUTO2) = pluto2.o
+obj-$(CONFIG_DVB_PLUTO2) += pluto2.o
 
 EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
index 5b2aadb8385c2b92ee1d3b57145975fc185d848d..b5ac7dfde52f745aef95da9cc167d9b5562fee22 100644 (file)
@@ -1,8 +1,7 @@
 config DVB_AV7110
        tristate "AV7110 cards"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
        select FW_LOADER
-       select VIDEO_DEV
        select VIDEO_SAA7146_VV
        select DVB_VES1820
        select DVB_VES1X93
@@ -59,7 +58,7 @@ config DVB_AV7110_OSD
 
 config DVB_BUDGET
        tristate "Budget cards"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
        select VIDEO_SAA7146
        select DVB_STV0299
        select DVB_VES1X93
@@ -80,7 +79,7 @@ config DVB_BUDGET
 
 config DVB_BUDGET_CI
        tristate "Budget cards with onboard CI connector"
-       depends on DVB_CORE && PCI
+       depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
        select VIDEO_SAA7146
        select DVB_STV0297
        select DVB_STV0299
@@ -100,8 +99,7 @@ config DVB_BUDGET_CI
 
 config DVB_BUDGET_AV
        tristate "Budget cards with analog video inputs"
-       depends on DVB_CORE && PCI
-       select VIDEO_DEV
+       depends on DVB_CORE && PCI && I2C && VIDEO_V4L1
        select VIDEO_SAA7146_VV
        select DVB_STV0299
        select DVB_TDA1004X
@@ -119,7 +117,7 @@ config DVB_BUDGET_AV
 
 config DVB_BUDGET_PATCH
        tristate "AV7110 cards with Budget Patch"
-       depends on DVB_CORE && DVB_BUDGET
+       depends on DVB_CORE && DVB_BUDGET && VIDEO_V4L1
        select DVB_AV7110
        select DVB_STV0299
        select DVB_VES1X93
index 8efe3ce5f66c83edb9528ebc9421981d294234c3..8a7cd7d505cf533997dc76f2613f5e98a1d0c0d8 100644 (file)
@@ -1190,8 +1190,6 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
                                                SAA7146_HPS_SYNC_PORT_A);
 
                saa7113_setinput(budget_av, 0);
-       } else {
-               ciintf_init(budget_av);
        }
 
        /* fixme: find some sane values here... */
@@ -1211,6 +1209,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
        budget_av->budget.dvb_adapter.priv = budget_av;
        frontend_init(budget_av);
 
+       if (!budget_av->has_saa7113) {
+               ciintf_init(budget_av);
+       }
+
        return 0;
 }
 
index 5f91036f5b874af9a7bf4a80a841897d5a5a7ed3..e64a609cf4ff4825ac119047b3dd7cfddc7d7cdb 100644 (file)
@@ -71,6 +71,7 @@ struct budget_ci {
        struct tasklet_struct msp430_irq_tasklet;
        struct tasklet_struct ciintf_irq_tasklet;
        int slot_status;
+       int ci_irq;
        struct dvb_ca_en50221 ca;
        char ir_dev_name[50];
        u8 tuner_pll_address; /* used for philips_tdm1316l configs */
@@ -276,8 +277,10 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot)
        if (slot != 0)
                return -EINVAL;
 
-       // trigger on RISING edge during reset so we know when READY is re-asserted
-       saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
+       if (budget_ci->ci_irq) {
+               // trigger on RISING edge during reset so we know when READY is re-asserted
+               saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
+       }
        budget_ci->slot_status = SLOTSTATUS_RESET;
        ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0);
        msleep(1);
@@ -370,11 +373,50 @@ static void ciintf_interrupt(unsigned long data)
        }
 }
 
+static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open)
+{
+       struct budget_ci *budget_ci = (struct budget_ci *) ca->data;
+       unsigned int flags;
+
+       // ensure we don't get spurious IRQs during initialisation
+       if (!budget_ci->budget.ci_present)
+               return -EINVAL;
+
+       // read the CAM status
+       flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
+       if (flags & CICONTROL_CAMDETECT) {
+               // mark it as present if it wasn't before
+               if (budget_ci->slot_status & SLOTSTATUS_NONE) {
+                       budget_ci->slot_status = SLOTSTATUS_PRESENT;
+               }
+
+               // during a RESET, we check if we can read from IO memory to see when CAM is ready
+               if (budget_ci->slot_status & SLOTSTATUS_RESET) {
+                       if (ciintf_read_attribute_mem(ca, slot, 0) == 0x1d) {
+                               budget_ci->slot_status = SLOTSTATUS_READY;
+                       }
+               }
+       } else {
+               budget_ci->slot_status = SLOTSTATUS_NONE;
+       }
+
+       if (budget_ci->slot_status != SLOTSTATUS_NONE) {
+               if (budget_ci->slot_status & SLOTSTATUS_READY) {
+                       return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY;
+               }
+               return DVB_CA_EN50221_POLL_CAM_PRESENT;
+       }
+
+       return 0;
+}
+
 static int ciintf_init(struct budget_ci *budget_ci)
 {
        struct saa7146_dev *saa = budget_ci->budget.dev;
        int flags;
        int result;
+       int ci_version;
+       int ca_flags;
 
        memset(&budget_ci->ca, 0, sizeof(struct dvb_ca_en50221));
 
@@ -382,16 +424,29 @@ static int ciintf_init(struct budget_ci *budget_ci)
        saa7146_write(saa, MC1, saa7146_read(saa, MC1) | (0x800 << 16) | 0x800);
 
        // test if it is there
-       if ((ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0) & 0xa0) != 0xa0) {
+       ci_version = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CIVERSION, 1, 1, 0);
+       if ((ci_version & 0xa0) != 0xa0) {
                result = -ENODEV;
                goto error;
        }
+
        // determine whether a CAM is present or not
        flags = ttpci_budget_debiread(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 1, 0);
        budget_ci->slot_status = SLOTSTATUS_NONE;
        if (flags & CICONTROL_CAMDETECT)
                budget_ci->slot_status = SLOTSTATUS_PRESENT;
 
+       // version 0xa2 of the CI firmware doesn't generate interrupts
+       if (ci_version == 0xa2) {
+               ca_flags = 0;
+               budget_ci->ci_irq = 0;
+       } else {
+               ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE |
+                               DVB_CA_EN50221_FLAG_IRQ_FR |
+                               DVB_CA_EN50221_FLAG_IRQ_DA;
+               budget_ci->ci_irq = 1;
+       }
+
        // register CI interface
        budget_ci->ca.owner = THIS_MODULE;
        budget_ci->ca.read_attribute_mem = ciintf_read_attribute_mem;
@@ -401,23 +456,27 @@ static int ciintf_init(struct budget_ci *budget_ci)
        budget_ci->ca.slot_reset = ciintf_slot_reset;
        budget_ci->ca.slot_shutdown = ciintf_slot_shutdown;
        budget_ci->ca.slot_ts_enable = ciintf_slot_ts_enable;
+       budget_ci->ca.poll_slot_status = ciintf_poll_slot_status;
        budget_ci->ca.data = budget_ci;
        if ((result = dvb_ca_en50221_init(&budget_ci->budget.dvb_adapter,
                                          &budget_ci->ca,
-                                         DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE |
-                                         DVB_CA_EN50221_FLAG_IRQ_FR |
-                                         DVB_CA_EN50221_FLAG_IRQ_DA, 1)) != 0) {
+                                         ca_flags, 1)) != 0) {
                printk("budget_ci: CI interface detected, but initialisation failed.\n");
                goto error;
        }
+
        // Setup CI slot IRQ
-       tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci);
-       if (budget_ci->slot_status != SLOTSTATUS_NONE) {
-               saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO);
-       } else {
-               saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
+       if (budget_ci->ci_irq) {
+               tasklet_init(&budget_ci->ciintf_irq_tasklet, ciintf_interrupt, (unsigned long) budget_ci);
+               if (budget_ci->slot_status != SLOTSTATUS_NONE) {
+                       saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQLO);
+               } else {
+                       saa7146_setgpio(saa, 0, SAA7146_GPIO_IRQHI);
+               }
+               saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03);
        }
-       saa7146_write(saa, IER, saa7146_read(saa, IER) | MASK_03);
+
+       // enable interface
        ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
                               CICONTROL_RESET, 1, 0);
 
@@ -426,10 +485,12 @@ static int ciintf_init(struct budget_ci *budget_ci)
        budget_ci->budget.ci_present = 1;
 
        // forge a fake CI IRQ so the CAM state is setup correctly
-       flags = DVB_CA_EN50221_CAMCHANGE_REMOVED;
-       if (budget_ci->slot_status != SLOTSTATUS_NONE)
-               flags = DVB_CA_EN50221_CAMCHANGE_INSERTED;
-       dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags);
+       if (budget_ci->ci_irq) {
+               flags = DVB_CA_EN50221_CAMCHANGE_REMOVED;
+               if (budget_ci->slot_status != SLOTSTATUS_NONE)
+                       flags = DVB_CA_EN50221_CAMCHANGE_INSERTED;
+               dvb_ca_en50221_camchange_irq(&budget_ci->ca, 0, flags);
+       }
 
        return 0;
 
@@ -443,9 +504,13 @@ static void ciintf_deinit(struct budget_ci *budget_ci)
        struct saa7146_dev *saa = budget_ci->budget.dev;
 
        // disable CI interrupts
-       saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03);
-       saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT);
-       tasklet_kill(&budget_ci->ciintf_irq_tasklet);
+       if (budget_ci->ci_irq) {
+               saa7146_write(saa, IER, saa7146_read(saa, IER) & ~MASK_03);
+               saa7146_setgpio(saa, 0, SAA7146_GPIO_INPUT);
+               tasklet_kill(&budget_ci->ciintf_irq_tasklet);
+       }
+
+       // reset interface
        ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1, 0, 1, 0);
        msleep(1);
        ttpci_budget_debiwrite(&budget_ci->budget, DEBICICTL, DEBIADDR_CICONTROL, 1,
@@ -473,7 +538,7 @@ static void budget_ci_irq(struct saa7146_dev *dev, u32 * isr)
        if (*isr & MASK_10)
                ttpci_budget_irq10_handler(dev, isr);
 
-       if ((*isr & MASK_03) && (budget_ci->budget.ci_present))
+       if ((*isr & MASK_03) && (budget_ci->budget.ci_present) && (budget_ci->ci_irq))
                tasklet_schedule(&budget_ci->ciintf_irq_tasklet);
 }
 
index 248fdc7accfb123d52c37460cc057faec7e2ca52..6ceae38125c7546990623d62028e35c56750f4a1 100644 (file)
@@ -1507,7 +1507,11 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
 
        mutex_unlock(&ttusb->semi2c);
 
-       dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE);
+       if ((result = dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE)) < 0) {
+               ttusb_free_iso_urbs(ttusb);
+               kfree(ttusb);
+               return result;
+       }
        ttusb->adapter.priv = ttusb;
 
        /* i2c */
index d318be383de6a08d8301f2f4537a4d598f320597..3fff7576369323b5ff9bc3772408f595e32f0e58 100644 (file)
@@ -7,7 +7,7 @@ menu "Radio Adapters"
 
 config RADIO_CADET
        tristate "ADS Cadet AM/FM Tuner"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these AM/FM radio cards, and then
          fill in the port address below.
@@ -25,7 +25,7 @@ config RADIO_CADET
 
 config RADIO_RTRACK
        tristate "AIMSlab RadioTrack (aka RadioReveal) support"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards, and then fill
          in the port address below.
@@ -59,7 +59,7 @@ config RADIO_RTRACK_PORT
 
 config RADIO_RTRACK2
        tristate "AIMSlab RadioTrack II support"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have this FM radio card, and then fill in the
          port address below.
@@ -82,7 +82,7 @@ config RADIO_RTRACK2_PORT
 
 config RADIO_AZTECH
        tristate "Aztech/Packard Bell Radio"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards, and then fill
          in the port address below.
@@ -106,7 +106,7 @@ config RADIO_AZTECH_PORT
 
 config RADIO_GEMTEK
        tristate "GemTek Radio Card support"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have this FM radio card, and then fill in the
          port address below.
@@ -131,7 +131,7 @@ config RADIO_GEMTEK_PORT
 
 config RADIO_GEMTEK_PCI
        tristate "GemTek PCI Radio Card support"
-       depends on VIDEO_DEV && PCI
+       depends on VIDEO_V4L1 && PCI
        ---help---
          Choose Y here if you have this PCI FM radio card.
 
@@ -145,7 +145,7 @@ config RADIO_GEMTEK_PCI
 
 config RADIO_MAXIRADIO
        tristate "Guillemot MAXI Radio FM 2000 radio"
-       depends on VIDEO_DEV && PCI
+       depends on VIDEO_V4L1 && PCI
        ---help---
          Choose Y here if you have this radio card.  This card may also be
          found as Gemtek PCI FM.
@@ -160,7 +160,7 @@ config RADIO_MAXIRADIO
 
 config RADIO_MAESTRO
        tristate "Maestro on board radio"
-       depends on VIDEO_DEV
+       depends on VIDEO_V4L1
        ---help---
          Say Y here to directly support the on-board radio tuner on the
          Maestro 2 or 2E sound card.
@@ -175,7 +175,7 @@ config RADIO_MAESTRO
 
 config RADIO_MIROPCM20
        tristate "miroSOUND PCM20 radio"
-       depends on ISA && VIDEO_DEV && SOUND_ACI_MIXER
+       depends on ISA && VIDEO_V4L1 && SOUND_ACI_MIXER
        ---help---
          Choose Y here if you have this FM radio card. You also need to say Y
          to "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20 radio)" (in "Sound")
@@ -208,7 +208,7 @@ config RADIO_MIROPCM20_RDS
 
 config RADIO_SF16FMI
        tristate "SF16FMI Radio"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards.  If you
          compile the driver into the kernel and your card is not PnP one, you
@@ -225,7 +225,7 @@ config RADIO_SF16FMI
 
 config RADIO_SF16FMR2
        tristate "SF16FMR2 Radio"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards.
 
@@ -239,7 +239,7 @@ config RADIO_SF16FMR2
 
 config RADIO_TERRATEC
        tristate "TerraTec ActiveRadio ISA Standalone"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have this FM radio card, and then fill in the
          port address below. (TODO)
@@ -268,7 +268,7 @@ config RADIO_TERRATEC_PORT
 
 config RADIO_TRUST
        tristate "Trust FM radio card"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        help
          This is a driver for the Trust FM radio cards. Say Y if you have
          such a card and want to use it under Linux.
@@ -286,7 +286,7 @@ config RADIO_TRUST_PORT
 
 config RADIO_TYPHOON
        tristate "Typhoon Radio (a.k.a. EcoRadio)"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards, and then fill
          in the port address and the frequency used for muting below.
@@ -330,7 +330,7 @@ config RADIO_TYPHOON_MUTEFREQ
 
 config RADIO_ZOLTRIX
        tristate "Zoltrix Radio"
-       depends on ISA && VIDEO_DEV
+       depends on ISA && VIDEO_V4L1
        ---help---
          Choose Y here if you have one of these FM radio cards, and then fill
          in the port address below.
index 85888a8a93c9b1eb7250de3b3120689b1ded71a5..6b41970185610780327355a0f4d4af6f5a852e8e 100644 (file)
@@ -2,10 +2,10 @@
 # Multimedia Video device configuration
 #
 
-menu "Video For Linux"
+menu "Video Capture Adapters"
        depends on VIDEO_DEV
 
-comment "Video Adapters"
+comment "Video Capture Adapters"
 
 config VIDEO_ADV_DEBUG
        bool "Enable advanced debug functionality"
@@ -16,11 +16,23 @@ config VIDEO_ADV_DEBUG
          V4L devices.
          In doubt, say N.
 
+config VIDEO_VIVI
+       tristate "Virtual Video Driver"
+       depends on VIDEO_V4L2 && !SPARC32 && !SPARC64
+       select VIDEO_BUF
+       default n
+       ---help---
+         Enables a virtual video driver. This device shows a color bar
+         and a timestamp, as a real device would generate by using V4L2
+         api.
+         Say Y here if you want to test video apps or debug V4L devices.
+         In doubt, say N.
+
 source "drivers/media/video/bt8xx/Kconfig"
 
 config VIDEO_SAA6588
        tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards"
-       depends on VIDEO_DEV && I2C && VIDEO_BT848
+       depends on I2C && VIDEO_BT848
 
        help
          Support for  Radio Data System (RDS) decoder. This allows seeing
@@ -32,7 +44,7 @@ config VIDEO_SAA6588
 
 config VIDEO_PMS
        tristate "Mediavision Pro Movie Studio Video For Linux"
-       depends on VIDEO_DEV && ISA
+       depends on ISA && VIDEO_V4L1
        help
          Say Y if you have such a thing.
 
@@ -41,7 +53,7 @@ config VIDEO_PMS
 
 config VIDEO_PLANB
        tristate "PlanB Video-In on PowerMac"
-       depends on PPC_PMAC && VIDEO_DEV && BROKEN
+       depends on PPC_PMAC && VIDEO_V4L1 && BROKEN
        help
          PlanB is the V4L driver for the PowerMac 7x00/8x00 series video
          input hardware. If you want to experiment with this, say Y.
@@ -52,7 +64,7 @@ config VIDEO_PLANB
 
 config VIDEO_BWQCAM
        tristate "Quickcam BW Video For Linux"
-       depends on VIDEO_DEV && PARPORT
+       depends on PARPORT && VIDEO_V4L1
        help
          Say Y have if you the black and white version of the QuickCam
          camera. See the next option for the color version.
@@ -62,7 +74,7 @@ config VIDEO_BWQCAM
 
 config VIDEO_CQCAM
        tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)"
-       depends on EXPERIMENTAL && VIDEO_DEV && PARPORT
+       depends on EXPERIMENTAL && PARPORT && VIDEO_V4L1
        help
          This is the video4linux driver for the colour version of the
          Connectix QuickCam.  If you have one of these cameras, say Y here,
@@ -73,7 +85,7 @@ config VIDEO_CQCAM
 
 config VIDEO_W9966
        tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux"
-       depends on PARPORT_1284 && VIDEO_DEV && PARPORT
+       depends on PARPORT_1284 && PARPORT && VIDEO_V4L1
        help
          Video4linux driver for Winbond's w9966 based Webcams.
          Currently tested with the LifeView FlyCam Supra.
@@ -86,7 +98,7 @@ config VIDEO_W9966
 
 config VIDEO_CPIA
        tristate "CPiA Video For Linux"
-       depends on VIDEO_DEV
+       depends on VIDEO_V4L1
        ---help---
          This is the video4linux driver for cameras based on Vision's CPiA
          (Colour Processor Interface ASIC), such as the Creative Labs Video
@@ -123,7 +135,7 @@ source "drivers/media/video/cpia2/Kconfig"
 
 config VIDEO_SAA5246A
        tristate "SAA5246A, SAA5281 Teletext processor"
-       depends on VIDEO_DEV && I2C
+       depends on I2C && VIDEO_V4L1
        help
          Support for I2C bus based teletext using the SAA5246A or SAA5281
          chip. Useful only if you live in Europe.
@@ -150,7 +162,7 @@ config TUNER_3036
 
 config VIDEO_VINO
        tristate "SGI Vino Video For Linux (EXPERIMENTAL)"
-       depends on VIDEO_DEV && I2C && SGI_IP22 && EXPERIMENTAL
+       depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1
        select I2C_ALGO_SGI
        help
          Say Y here to build in support for the Vino video input system found
@@ -158,7 +170,7 @@ config VIDEO_VINO
 
 config VIDEO_STRADIS
        tristate "Stradis 4:2:2 MPEG-2 video driver  (EXPERIMENTAL)"
-       depends on EXPERIMENTAL && VIDEO_DEV && PCI
+       depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64
        help
          Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video
          driver for PCI.  There is a product page at
@@ -166,7 +178,7 @@ config VIDEO_STRADIS
 
 config VIDEO_ZORAN
        tristate "Zoran ZR36057/36067 Video For Linux"
-       depends on VIDEO_DEV && PCI && I2C_ALGOBIT
+       depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64
        help
          Say Y for support for MJPEG capture cards based on the Zoran
          36057/36067 PCI controller chipset. This includes the Iomega
@@ -214,7 +226,7 @@ config VIDEO_ZORAN_LML33R10
 
 config VIDEO_ZR36120
        tristate "Zoran ZR36120/36125 Video For Linux"
-       depends on VIDEO_DEV && PCI && I2C && BROKEN
+       depends on PCI && I2C && VIDEO_V4L1 && BROKEN
        help
          Support for ZR36120/ZR36125 based frame grabber/overlay boards.
          This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV,
@@ -226,7 +238,7 @@ config VIDEO_ZR36120
 
 config VIDEO_MEYE
        tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
-       depends on VIDEO_DEV && PCI && SONYPI
+       depends on PCI && SONYPI && VIDEO_V4L1
        ---help---
          This is the video4linux driver for the Motion Eye camera found
          in the Vaio Picturebook laptops. Please read the material in
@@ -242,7 +254,7 @@ source "drivers/media/video/saa7134/Kconfig"
 
 config VIDEO_MXB
        tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
-       depends on VIDEO_DEV && PCI
+       depends on PCI && VIDEO_V4L1
        select VIDEO_SAA7146_VV
        select VIDEO_TUNER
        ---help---
@@ -254,8 +266,9 @@ config VIDEO_MXB
 
 config VIDEO_DPC
        tristate "Philips-Semiconductors 'dpc7146 demonstration board'"
-       depends on VIDEO_DEV && PCI
+       depends on PCI && VIDEO_V4L1
        select VIDEO_SAA7146_VV
+       select VIDEO_V4L2
        ---help---
          This is a video4linux driver for the 'dpc7146 demonstration
          board' by Philips-Semiconductors. It's the reference design
@@ -268,8 +281,9 @@ config VIDEO_DPC
 
 config VIDEO_HEXIUM_ORION
        tristate "Hexium HV-PCI6 and Orion frame grabber"
-       depends on VIDEO_DEV && PCI
+       depends on PCI && VIDEO_V4L1
        select VIDEO_SAA7146_VV
+       select VIDEO_V4L2
        ---help---
          This is a video4linux driver for the Hexium HV-PCI6 and
          Orion frame grabber cards by Hexium.
@@ -279,8 +293,9 @@ config VIDEO_HEXIUM_ORION
 
 config VIDEO_HEXIUM_GEMINI
        tristate "Hexium Gemini frame grabber"
-       depends on VIDEO_DEV && PCI
+       depends on PCI && VIDEO_V4L1
        select VIDEO_SAA7146_VV
+       select VIDEO_V4L2
        ---help---
          This is a video4linux driver for the Hexium Gemini frame
          grabber card by Hexium. Please note that the Gemini Dual
@@ -293,7 +308,7 @@ source "drivers/media/video/cx88/Kconfig"
 
 config VIDEO_OVCAMCHIP
        tristate "OmniVision Camera Chip support"
-       depends on VIDEO_DEV && I2C
+       depends on I2C && VIDEO_V4L1
        ---help---
          Support for the OmniVision OV6xxx and OV7xxx series of camera chips.
          This driver is intended to be used with the ov511 and w9968cf USB
@@ -304,7 +319,7 @@ config VIDEO_OVCAMCHIP
 
 config VIDEO_M32R_AR
        tristate "AR devices"
-       depends on M32R
+       depends on M32R && VIDEO_V4L1
        ---help---
          This is a video4linux driver for the Renesas AR (Artificial Retina)
          camera module.
@@ -365,17 +380,17 @@ config VIDEO_WM8739
 source "drivers/media/video/cx25840/Kconfig"
 
 config VIDEO_SAA711X
-       tristate "Philips SAA7113/4/5 video decoders"
-       depends on VIDEO_DEV && I2C && EXPERIMENTAL
+       tristate "Philips SAA7113/4/5 video decoders (OBSOLETED)"
+       depends on VIDEO_V4L1 && I2C && EXPERIMENTAL
        ---help---
-         Support for the Philips SAA7113/4/5 video decoders.
+         Old support for the Philips SAA7113/4 video decoders.
 
          To compile this driver as a module, choose M here: the
          module will be called saa7115.
 
 config VIDEO_SAA7127
        tristate "Philips SAA7127/9 digital video encoders"
-       depends on VIDEO_DEV && I2C && EXPERIMENTAL
+       depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
        ---help---
          Support for the Philips SAA7127/9 digital video encoders.
 
@@ -384,7 +399,7 @@ config VIDEO_SAA7127
 
 config VIDEO_UPD64031A
        tristate "NEC Electronics uPD64031A Ghost Reduction"
-       depends on VIDEO_DEV && I2C && EXPERIMENTAL
+       depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
        ---help---
          Support for the NEC Electronics uPD64031A Ghost Reduction
          video chip. It is most often found in NTSC TV cards made for
@@ -396,7 +411,7 @@ config VIDEO_UPD64031A
 
 config VIDEO_UPD64083
        tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation"
-       depends on VIDEO_DEV && I2C && EXPERIMENTAL
+       depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
        ---help---
          Support for the NEC Electronics uPD64083 3-Dimensional Y/C
          separation video chip. It is used to improve the quality of
@@ -418,7 +433,7 @@ source "drivers/media/video/em28xx/Kconfig"
 
 config USB_DSBR
        tristate "D-Link USB FM radio support (EXPERIMENTAL)"
-       depends on USB && VIDEO_DEV && EXPERIMENTAL
+       depends on USB && VIDEO_V4L1 && EXPERIMENTAL
        ---help---
          Say Y here if you want to connect this type of radio to your
          computer's USB port. Note that the audio is not digital, and
@@ -434,7 +449,7 @@ source "drivers/media/video/et61x251/Kconfig"
 
 config USB_OV511
        tristate "USB OV511 Camera support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want to connect this type of camera to your
          computer's USB port. See <file:Documentation/video4linux/ov511.txt>
@@ -445,7 +460,7 @@ config USB_OV511
 
 config USB_SE401
        tristate "USB SE401 Camera support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want to connect this type of camera to your
          computer's USB port. See <file:Documentation/video4linux/se401.txt>
@@ -458,7 +473,7 @@ source "drivers/media/video/sn9c102/Kconfig"
 
 config USB_STV680
        tristate "USB STV680 (Pencam) Camera support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want to connect this type of camera to your
          computer's USB port. This includes the Pencam line of cameras.
@@ -470,7 +485,7 @@ config USB_STV680
 
 config USB_W9968CF
        tristate "USB W996[87]CF JPEG Dual Mode Camera support"
-       depends on USB && VIDEO_DEV && I2C
+       depends on USB && VIDEO_V4L1 && I2C
        select VIDEO_OVCAMCHIP
        ---help---
          Say Y here if you want support for cameras based on OV681 or
index b3ea2d63db9b04a5e7161a85f469711b4817cd16..e5bf2687b76de83f15508429f327ca0f3d4046df 100644 (file)
@@ -10,7 +10,11 @@ tuner-objs   :=      tuner-core.o tuner-types.o tuner-simple.o \
 
 msp3400-objs   :=      msp3400-driver.o msp3400-kthreads.o
 
-obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o
+obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o compat_ioctl32.o
+
+ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y)
+  obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o
+endif
 
 obj-$(CONFIG_VIDEO_BT848) += bt8xx/
 obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o
@@ -84,4 +88,8 @@ obj-$(CONFIG_USB_IBMCAM)        += usbvideo/
 obj-$(CONFIG_USB_KONICAWC)      += usbvideo/
 obj-$(CONFIG_USB_VICAM)         += usbvideo/
 
+obj-$(CONFIG_VIDEO_VIVI) += vivi.o
+
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
+extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT
+
index 085477c12612afe39f05cbda7f88e604096397f5..153f6a4a96c990c3a55de92e131774c5d51c8356 100644 (file)
@@ -1,6 +1,6 @@
 config VIDEO_BT848
        tristate "BT848 Video For Linux"
-       depends on VIDEO_DEV && PCI && I2C
+       depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2
        select I2C_ALGOBIT
        select FW_LOADER
        select VIDEO_BTCX
index db641a36b197afc10495f573bb9a9e20b17ad8c9..a096a03418aaf430dd7b83c1b130642cae4656f1 100644 (file)
@@ -8,5 +8,5 @@ bttv-objs      :=      bttv-driver.o bttv-cards.o bttv-if.o \
 
 obj-$(CONFIG_VIDEO_BT848) += bttv.o
 
-EXTRA_CFLAGS += -I$(src)/..
+EXTRA_CFLAGS += -Idrivers/media/video
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
index f209a749205104af0fb8276373d71c7b150bad32..2b64aa835b423663a203685b6c95a9fc94348fef 100644 (file)
@@ -2991,13 +2991,13 @@ void __devinit bttv_idcard(struct bttv *btv)
 
        if (UNSET != audiomux[0]) {
                gpiobits = 0;
-               for (i = 0; i < 5; i++) {
+               for (i = 0; i < 4; i++) {
                        bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
                        gpiobits |= audiomux[i];
                }
        } else {
                gpiobits = audioall;
-               for (i = 0; i < 5; i++) {
+               for (i = 0; i < 4; i++) {
                        bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
                }
        }
index 16323a5d68acc431095b14655d6a2c9aaf73dcea..afcfe71e37928ca7558a6dad33ef27dea609a0b4 100644 (file)
@@ -233,7 +233,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
                  const struct bttv_format *fmt, struct bttv_overlay *ov,
                  int skip_even, int skip_odd)
 {
-       int instructions,rc,line,maxy,start,end,skip,nskips;
+       int dwords,rc,line,maxy,start,end,skip,nskips;
        struct btcx_skiplist *skips;
        u32 *rp,ri,ra;
        u32 addr;
@@ -242,12 +242,12 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
        if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL)))
                return -ENOMEM;
 
-       /* estimate risc mem: worst case is (clip+1) * lines instructions
+       /* estimate risc mem: worst case is (1.5*clip+1) * lines instructions
           + sync + jump (all 2 dwords) */
-       instructions  = (ov->nclips + 1) *
-               ((skip_even || skip_odd) ? ov->w.height>>1 :  ov->w.height);
-       instructions += 2;
-       if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0) {
+       dwords  = (3 * ov->nclips + 2) *
+               ((skip_even || skip_odd) ? (ov->w.height+1)>>1 :  ov->w.height);
+       dwords += 4;
+       if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,dwords*4)) < 0) {
                kfree(skips);
                return rc;
        }
@@ -276,8 +276,6 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
                if (line > maxy)
                        btcx_calc_skips(line, ov->w.width, &maxy,
                                        skips, &nskips, ov->clips, ov->nclips);
-               else
-                       nskips = 0;
 
                /* write out risc code */
                for (start = 0, skip = 0; start < ov->w.width; start = end) {
index f59ced181c553a074da086ee4c630903c1d9879a..1958d4016ea15c4bb5b9e7faa59377fe80d9a4f6 100644 (file)
 
 #define FWDEV(x) &((x)->adapter->dev)
 
-static int fastfw = 1;
 static char *firmware = FWFILE;
 
-module_param(fastfw, bool, 0444);
 module_param(firmware, charp, 0444);
 
-MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]");
 MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]");
 
-static void set_i2c_delay(struct i2c_client *client, int delay)
-{
-       struct i2c_algo_bit_data *algod = client->adapter->algo_data;
-
-       /* We aren't guaranteed to be using algo_bit,
-        * so avoid the null pointer dereference
-        * and disable the 'fast firmware load' */
-       if (algod) {
-               algod->udelay = delay;
-       } else {
-               fastfw = 0;
-       }
-}
-
 static void start_fw_load(struct i2c_client *client)
 {
        /* DL_ADDR_LB=0 DL_ADDR_HB=0 */
@@ -71,16 +54,10 @@ static void start_fw_load(struct i2c_client *client)
        cx25840_write(client, 0x803, 0x0b);
        /* AUTO_INC_DIS=1 */
        cx25840_write(client, 0x000, 0x20);
-
-       if (fastfw)
-               set_i2c_delay(client, 3);
 }
 
 static void end_fw_load(struct i2c_client *client)
 {
-       if (fastfw)
-               set_i2c_delay(client, 10);
-
        /* AUTO_INC_DIS=0 */
        cx25840_write(client, 0x000, 0x00);
        /* DL_ENABLE=0 */
@@ -107,30 +84,8 @@ static int fw_write(struct i2c_client *client, u8 * data, int size)
        int sent;
 
        if ((sent = i2c_master_send(client, data, size)) < size) {
-
-               if (fastfw) {
-                       v4l_err(client, "333MHz i2c firmware load failed\n");
-                       fastfw = 0;
-                       set_i2c_delay(client, 10);
-
-                       if (sent > 2) {
-                               u16 dl_addr = cx25840_read(client, 0x801) << 8;
-                               dl_addr |= cx25840_read(client, 0x800);
-                               dl_addr -= sent - 2;
-                               cx25840_write(client, 0x801, dl_addr >> 8);
-                               cx25840_write(client, 0x800, dl_addr & 0xff);
-                       }
-
-                       if (i2c_master_send(client, data, size) < size) {
-                               v4l_err(client, "100MHz i2c firmware load failed\n");
-                               return -ENOSYS;
-                       }
-
-               } else {
-                       v4l_err(client, "firmware load i2c failure\n");
-                       return -ENOSYS;
-               }
-
+               v4l_err(client, "firmware load i2c failure\n");
+               return -ENOSYS;
        }
 
        return 0;
index c7042cf412318293c6f8f8b3e0064a53a9416839..f80154b87d22977d337e4d0159472ca8b074f899 100644 (file)
@@ -564,7 +564,7 @@ struct cx88_board cx88_boards[] = {
        },
        [CX88_BOARD_PCHDTV_HD3000] = {
                .name           = "pcHDTV HD3000 HDTV",
-               .tuner_type     = TUNER_THOMSON_DTT7610,
+               .tuner_type     = TUNER_THOMSON_DTT761X,
                .radio_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
index 2c3d9f1999be6e5884e912bad2476f8b99fec16a..e1092d5d4628de6d078971be4ca62ce1a92c4592 100644 (file)
@@ -146,9 +146,11 @@ int cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
                fields++;
 
        /* estimate risc mem: worst case is one write per page border +
-          one write per scan line + syncs + jump (all 2 dwords) */
-       instructions  = (bpl * lines * fields) / PAGE_SIZE + lines * fields;
-       instructions += 3 + 4;
+          one write per scan line + syncs + jump (all 2 dwords).  Padding
+          can cause next bpl to start close to a page border.  First DMA
+          region may be smaller than PAGE_SIZE */
+       instructions  = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines);
+       instructions += 2;
        if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
                return rc;
 
@@ -176,9 +178,11 @@ int cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
        int rc;
 
        /* estimate risc mem: worst case is one write per page border +
-          one write per scan line + syncs + jump (all 2 dwords) */
-       instructions  = (bpl * lines) / PAGE_SIZE + lines;
-       instructions += 3 + 4;
+          one write per scan line + syncs + jump (all 2 dwords).  Here
+          there is no padding and no sync.  First DMA region may be smaller
+          than PAGE_SIZE */
+       instructions  = 1 + (bpl * lines) / PAGE_SIZE + lines;
+       instructions += 1;
        if ((rc = btcx_riscmem_alloc(pci,risc,instructions*8)) < 0)
                return rc;
 
index f0ea9b5cdbc234c50bcd8bb9f93aaa7c3b42f904..3619a449aefd91899e9ed26453006b7f8c124b4d 100644 (file)
@@ -372,7 +372,7 @@ static int or51132_set_ts_param(struct dvb_frontend* fe,
 static struct or51132_config pchdtv_hd3000 = {
        .demod_address    = 0x15,
        .pll_address      = 0x61,
-       .pll_desc         = &dvb_pll_thomson_dtt7610,
+       .pll_desc         = &dvb_pll_thomson_dtt761x,
        .set_ts_params    = or51132_set_ts_param,
 };
 #endif
index 72a417b3174521e2f67aac7944274351052307e8..694d1d80ff3f2e16d1c6c78c6a9164b25faf72c5 100644 (file)
 #include "cx88.h"
 #include <media/v4l2-common.h>
 
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
 /* Include V4L1 specific functions. Should be removed soon */
 #include <linux/videodev.h>
+#endif
 
 MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
index 5a793ae7cc23d40c8bab720f45d57478e0a15f07..dfb15bfb83dcad2f03b47a521a10d26174ccdd22 100644 (file)
@@ -1,6 +1,6 @@
 config VIDEO_EM28XX
        tristate "Empia EM2800/2820/2840 USB video capture support"
-       depends on VIDEO_DEV && USB && I2C
+       depends on VIDEO_V4L1 && USB && I2C
        select VIDEO_BUF
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
index ddc92cbb5276b776c4ff21097c2c14111996568b..cf7cdf9ef6178e50f3cf1596bf65b856a5fa5df6 100644 (file)
@@ -1576,8 +1576,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
        errCode = em28xx_config(dev);
        if (errCode) {
                em28xx_errdev("error configuring device\n");
-               kfree(dev);
                em28xx_devused&=~(1<<dev->devno);
+               kfree(dev);
                return -ENOMEM;
        }
 
@@ -1603,8 +1603,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
        dev->vdev = video_device_alloc();
        if (NULL == dev->vdev) {
                em28xx_errdev("cannot allocate video_device.\n");
-               kfree(dev);
                em28xx_devused&=~(1<<dev->devno);
+               kfree(dev);
                return -ENOMEM;
        }
 
@@ -1612,8 +1612,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
        if (NULL == dev->vbi_dev) {
                em28xx_errdev("cannot allocate video_device.\n");
                kfree(dev->vdev);
-               kfree(dev);
                em28xx_devused&=~(1<<dev->devno);
+               kfree(dev);
                return -ENOMEM;
        }
 
@@ -1650,8 +1650,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
                mutex_unlock(&dev->lock);
                list_del(&dev->devlist);
                video_device_release(dev->vdev);
-               kfree(dev);
                em28xx_devused&=~(1<<dev->devno);
+               kfree(dev);
                return -ENODEV;
        }
 
@@ -1662,8 +1662,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
                list_del(&dev->devlist);
                video_device_release(dev->vbi_dev);
                video_device_release(dev->vdev);
-               kfree(dev);
                em28xx_devused&=~(1<<dev->devno);
+               kfree(dev);
                return -ENODEV;
        } else {
                printk("registered VBI\n");
index 6c43a90c6569f4d3856966294f19da110328d753..c6bff705688d0e02404b7730a972557042e67cd4 100644 (file)
@@ -1,6 +1,6 @@
 config USB_ET61X251
        tristate "USB ET61X[12]51 PC Camera Controller support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want support for cameras based on Etoms ET61X151
          or ET61X251 PC Camera Controllers.
index 86376556f108303019b7a20618c4d43b1e20053b..53cbc950f95c6a74066ba64c840b8fe28ac35b6e 100644 (file)
@@ -1,6 +1,6 @@
 config USB_PWC
        tristate "USB Philips Cameras"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y or M here if you want to use one of these Philips & OEM
          webcams:
index 8326684f49f3214003f7dbb18eff402c9f63ba59..33d60126c02499b27a29a4bfcd2628669c9f6ccc 100644 (file)
@@ -1,20 +1,3 @@
-ifneq ($(KERNELRELEASE),)
-
 pwc-objs       := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-timon.o pwc-kiara.o
 
 obj-$(CONFIG_USB_PWC) += pwc.o
-
-else
-
-KDIR := /lib/modules/$(shell uname -r)/build
-PWD := $(shell pwd)
-
-default:
-       $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
-
-endif
-
-clean:
-       rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c
-       rm -rf .tmp_versions
-
index 133f9e5252fec0f0646c3d1d34e2f92d85385199..c271e2e14105721e953da48d2dc2ad564370e27a 100644 (file)
@@ -142,6 +142,7 @@ struct i2c_reg_value {
 static const struct i2c_reg_value saa7129_init_config_extra[] = {
        { SAA7127_REG_OUTPUT_PORT_CONTROL,              0x38 },
        { SAA7127_REG_VTRIG,                            0xfa },
+       { 0, 0 }
 };
 
 static const struct i2c_reg_value saa7127_init_config_common[] = {
index e666a4465ca460fa7e510cdf899802670f2653c9..86eae3528330bb415316ffb6247de54d6fc0492a 100644 (file)
@@ -3504,6 +3504,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
                /* power-up tuner chip */
                saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00040000, 0x00040000);
                saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
+               break;
        case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
                /* this turns the remote control chip off to work around a bug in it */
                saa_writeb(SAA7134_GPIO_GPMODE1, 0x80);
index 13de05532e0ac7015ae7d5c98780d09a300070e9..f0c2111f14ad1f11c5bbe0575edd6aedd23420bd 100644 (file)
@@ -548,6 +548,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
                if (report & SAA7134_IRQ_REPORT_GPIO16) {
                        switch (dev->has_remote) {
                                case SAA7134_REMOTE_GPIO:
+                                       if (!dev->remote)
+                                               break;
                                        if  (dev->remote->mask_keydown & 0x10000) {
                                                saa7134_input_irq(dev);
                                        }
@@ -564,6 +566,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
                if (report & SAA7134_IRQ_REPORT_GPIO18) {
                        switch (dev->has_remote) {
                                case SAA7134_REMOTE_GPIO:
+                                       if (!dev->remote)
+                                               break;
                                        if ((dev->remote->mask_keydown & 0x40000) ||
                                            (dev->remote->mask_keyup & 0x40000)) {
                                                saa7134_input_irq(dev);
@@ -676,7 +680,7 @@ static int saa7134_hwinit2(struct saa7134_dev *dev)
                SAA7134_IRQ2_INTE_PE      |
                SAA7134_IRQ2_INTE_AR;
 
-       if (dev->has_remote == SAA7134_REMOTE_GPIO) {
+       if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {
                if (dev->remote->mask_keydown & 0x10000)
                        irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
                else if (dev->remote->mask_keydown & 0x40000)
index aeef80f88a6bb0076a1c7e23709b17b0f1420e09..e4156ec9c6d7ed4412b65aefbfa94ebffc4a1a3a 100644 (file)
 #include "saa7134.h"
 #include <media/v4l2-common.h>
 
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
 /* Include V4L1 specific functions. Should be removed soon */
 #include <linux/videodev.h>
+#endif
 
 /* ------------------------------------------------------------------ */
 
index 55f2bc11964ba33bf107d5af48152eddb6456ba5..cf552e6b8ecfb20ef5b7ed89b591afaeba7ccf18 100644 (file)
@@ -1,6 +1,6 @@
 config USB_SN9C102
        tristate "USB SN9C10x PC Camera Controller support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want support for cameras based on SONiX SN9C101,
          SN9C102 or SN9C103 PC Camera Controllers.
index 72e0f01db563597315d3811ef5854a46cde8b912..a1ae036b44ec9cd362d452697122f06e0db83dee 100644 (file)
@@ -877,8 +877,8 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = {
 /* ------------ TUNER_LG_TDVS_H062F - INFINEON ATSC ------------ */
 
 static struct tuner_range tuner_tua6034_ntsc_ranges[] = {
-       { 16 * 160.00 /*MHz*/, 0x8e, 0x01 },
-       { 16 * 455.00 /*MHz*/, 0x8e, 0x02 },
+       { 16 * 165.00 /*MHz*/, 0x8e, 0x01 },
+       { 16 * 450.00 /*MHz*/, 0x8e, 0x02 },
        { 16 * 999.99        , 0x8e, 0x04 },
 };
 
index 431c3e2f6c4274a81fe21c62ef232758c5220df5..b463e996961adbb5ee5b6c62db3a045402343adb 100644 (file)
@@ -218,7 +218,7 @@ hauppauge_tuner[] =
        /* 110-119 */
        { TUNER_ABSENT,        "Thompson DTT75105"},
        { TUNER_ABSENT,        "Conexant_CX24109"},
-       { TUNER_ABSENT,        "TCL M2523_5N_E"},
+       { TUNER_TCL_2002N,     "TCL M2523_5N_E"},
        { TUNER_ABSENT,        "TCL M2523_3DB_E"},
        { TUNER_ABSENT,        "Philips 8275A"},
        { TUNER_ABSENT,        "Microtune MT2060"},
index 08a5d20bb2c0dd3488a6e2330b93be1d31d6eb66..39269a2c5635912abcbc8b4f252a50d92a265887 100644 (file)
@@ -3,7 +3,7 @@ config VIDEO_USBVIDEO
 
 config USB_VICAM
        tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)"
-       depends on USB && VIDEO_DEV && EXPERIMENTAL
+       depends on USB && VIDEO_V4L1 && EXPERIMENTAL
        select VIDEO_USBVIDEO
        ---help---
          Say Y here if you have 3com homeconnect camera (vicam).
@@ -13,7 +13,7 @@ config USB_VICAM
 
 config USB_IBMCAM
        tristate "USB IBM (Xirlink) C-it Camera support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        select VIDEO_USBVIDEO
        ---help---
          Say Y here if you want to connect a IBM "C-It" camera, also known as
@@ -28,7 +28,7 @@ config USB_IBMCAM
 
 config USB_KONICAWC
        tristate "USB Konica Webcam support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        select VIDEO_USBVIDEO
        ---help---
          Say Y here if you want support for webcams based on a Konica
index 5e813404d06813a981e201a5db2e0e04a5a91244..779db26771c03b5cf4cb8223dbc3a615c2f3a2ab 100644 (file)
 #include <linux/random.h>
 #include <linux/version.h>
 #include <linux/videodev2.h>
+#include <linux/dma-mapping.h>
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+/* Include V4L1 specific functions. Should be removed soon */
+#include <linux/videodev.h>
+#endif
 #include <linux/interrupt.h>
 #include <media/video-buf.h>
 #include <media/v4l2-common.h>
index c3bf886b80cdb55ebe485b48ced9debf3ceafe8c..115833e4f4dd3b421832a0a1d81a8aabd39330ee 100644 (file)
@@ -1,6 +1,6 @@
 config USB_ZC0301
        tristate "USB ZC0301 Image Processor and Control Chip support"
-       depends on USB && VIDEO_DEV
+       depends on USB && VIDEO_V4L1
        ---help---
          Say Y here if you want support for cameras based on the ZC0301
          Image Processor and Control Chip.
index 9080853fe283554c986f6636b34ee3bc42008b43..a30084076ac8884168c444d04d9377a32238507d 100644 (file)
@@ -1605,6 +1605,21 @@ mpt_resume(struct pci_dev *pdev)
 }
 #endif
 
+static int
+mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase)
+{
+       if ((MptDriverClass[index] == MPTSPI_DRIVER &&
+            ioc->bus_type != SPI) ||
+           (MptDriverClass[index] == MPTFC_DRIVER &&
+            ioc->bus_type != FC) ||
+           (MptDriverClass[index] == MPTSAS_DRIVER &&
+            ioc->bus_type != SAS))
+               /* make sure we only call the relevant reset handler
+                * for the bus */
+               return 0;
+       return (MptResetHandlers[index])(ioc, reset_phase);
+}
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *     mpt_do_ioc_recovery - Initialize or recover MPT adapter.
@@ -1885,14 +1900,14 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                        if ((ret == 0) && MptResetHandlers[ii]) {
                                dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n",
                                                ioc->name, ii));
-                               rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET);
+                               rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET);
                                handlers++;
                        }
 
                        if (alt_ioc_ready && MptResetHandlers[ii]) {
                                drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n",
                                                ioc->name, ioc->alt_ioc->name, ii));
-                               rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET);
+                               rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET);
                                handlers++;
                        }
                }
@@ -3267,11 +3282,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                                if (MptResetHandlers[ii]) {
                                        dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n",
                                                        ioc->name, ii));
-                                       r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_PRE_RESET);
+                                       r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET);
                                        if (ioc->alt_ioc) {
                                                dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n",
                                                                ioc->name, ioc->alt_ioc->name, ii));
-                                               r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_PRE_RESET);
+                                               r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET);
                                        }
                                }
                        }
@@ -5706,11 +5721,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
                        if (MptResetHandlers[ii]) {
                                dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n",
                                                ioc->name, ii));
-                               r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_SETUP_RESET);
+                               r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET);
                                if (ioc->alt_ioc) {
                                        dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n",
                                                        ioc->name, ioc->alt_ioc->name, ii));
-                                       r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_SETUP_RESET);
+                                       r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
                                }
                        }
                }
index f2a4d382ea19e5403b2d2643b5a301476ae3f718..3201de053943c5c278d50e2164419e95b9a02bcf 100644 (file)
@@ -831,6 +831,7 @@ mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
        return rc;
 }
 
+#ifdef CONFIG_PM
 /*
  * spi module resume handler
  */
@@ -846,6 +847,7 @@ mptspi_resume(struct pci_dev *pdev)
 
        return rc;
 }
+#endif
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
index 5ea133c59afb3e7ab2788c2d68c1512723ddf5c6..7bd4d85d0b42db6af28def4072cbd11fbadbec86 100644 (file)
@@ -55,6 +55,7 @@ struct i2o_exec_wait {
        u32 m;                  /* message id */
        struct i2o_message *msg;        /* pointer to the reply message */
        struct list_head list;  /* node in global wait list */
+       spinlock_t lock;        /* lock before modifying */
 };
 
 /* Work struct needed to handle LCT NOTIFY replies */
@@ -87,6 +88,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void)
                return NULL;
 
        INIT_LIST_HEAD(&wait->list);
+       spin_lock_init(&wait->lock);
 
        return wait;
 };
@@ -125,6 +127,7 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
        DECLARE_WAIT_QUEUE_HEAD(wq);
        struct i2o_exec_wait *wait;
        static u32 tcntxt = 0x80000000;
+       long flags;
        int rc = 0;
 
        wait = i2o_exec_wait_alloc();
@@ -146,33 +149,28 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
        wait->tcntxt = tcntxt++;
        msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt);
 
+       wait->wq = &wq;
+       /*
+        * we add elements to the head, because if a entry in the list will
+        * never be removed, we have to iterate over it every time
+        */
+       list_add(&wait->list, &i2o_exec_wait_list);
+
        /*
         * Post the message to the controller. At some point later it will
         * return. If we time out before it returns then complete will be zero.
         */
        i2o_msg_post(c, msg);
 
-       if (!wait->complete) {
-               wait->wq = &wq;
-               /*
-                * we add elements add the head, because if a entry in the list
-                * will never be removed, we have to iterate over it every time
-                */
-               list_add(&wait->list, &i2o_exec_wait_list);
-
-               wait_event_interruptible_timeout(wq, wait->complete,
-                                                timeout * HZ);
+       wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ);
 
-               wait->wq = NULL;
-       }
+       spin_lock_irqsave(&wait->lock, flags);
 
-       barrier();
+       wait->wq = NULL;
 
-       if (wait->complete) {
+       if (wait->complete)
                rc = le32_to_cpu(wait->msg->body[0]) >> 24;
-               i2o_flush_reply(c, wait->m);
-               i2o_exec_wait_free(wait);
-       } else {
+       else {
                /*
                 * We cannot remove it now. This is important. When it does
                 * terminate (which it must do if the controller has not
@@ -186,6 +184,13 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
                rc = -ETIMEDOUT;
        }
 
+       spin_unlock_irqrestore(&wait->lock, flags);
+
+       if (rc != -ETIMEDOUT) {
+               i2o_flush_reply(c, wait->m);
+               i2o_exec_wait_free(wait);
+       }
+
        return rc;
 };
 
@@ -213,7 +218,6 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
 {
        struct i2o_exec_wait *wait, *tmp;
        unsigned long flags;
-       static spinlock_t lock = SPIN_LOCK_UNLOCKED;
        int rc = 1;
 
        /*
@@ -223,23 +227,24 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
         * already expired. Not much we can do about that except log it for
         * debug purposes, increase timeout, and recompile.
         */
-       spin_lock_irqsave(&lock, flags);
        list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) {
                if (wait->tcntxt == context) {
-                       list_del(&wait->list);
+                       spin_lock_irqsave(&wait->lock, flags);
 
-                       spin_unlock_irqrestore(&lock, flags);
+                       list_del(&wait->list);
 
                        wait->m = m;
                        wait->msg = msg;
                        wait->complete = 1;
 
-                       barrier();
-
-                       if (wait->wq) {
-                               wake_up_interruptible(wait->wq);
+                       if (wait->wq)
                                rc = 0;
-                       } else {
+                       else
+                               rc = -1;
+
+                       spin_unlock_irqrestore(&wait->lock, flags);
+
+                       if (rc) {
                                struct device *dev;
 
                                dev = &c->pdev->dev;
@@ -248,15 +253,13 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
                                         c->name);
                                i2o_dma_free(dev, &wait->dma);
                                i2o_exec_wait_free(wait);
-                               rc = -1;
-                       }
+                       } else
+                               wake_up_interruptible(wait->wq);
 
                        return rc;
                }
        }
 
-       spin_unlock_irqrestore(&lock, flags);
-
        osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name,
                 context);
 
@@ -322,14 +325,9 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL);
 static int i2o_exec_probe(struct device *dev)
 {
        struct i2o_device *i2o_dev = to_i2o_device(dev);
-       struct i2o_controller *c = i2o_dev->iop;
 
        i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);
 
-       c->exec = i2o_dev;
-
-       i2o_exec_lct_notify(c, c->lct->change_ind + 1);
-
        device_create_file(dev, &dev_attr_vendor_id);
        device_create_file(dev, &dev_attr_product_id);
 
@@ -523,6 +521,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
        struct device *dev;
        struct i2o_message *msg;
 
+       down(&c->lct_lock);
+
        dev = &c->pdev->dev;
 
        if (i2o_dma_realloc
@@ -545,6 +545,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
 
        i2o_msg_post(c, msg);
 
+       up(&c->lct_lock);
+
        return 0;
 };
 
index 49216744693651f41480872faf8cfeb339dc7ab8..febbdd4e0605ddeed250f534ebeda84ac77682ac 100644 (file)
@@ -804,8 +804,6 @@ void i2o_iop_remove(struct i2o_controller *c)
 
        /* Ask the IOP to switch to RESET state */
        i2o_iop_reset(c);
-
-       put_device(&c->device);
 }
 
 /**
@@ -1059,7 +1057,7 @@ struct i2o_controller *i2o_iop_alloc(void)
 
        snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name);
        if (i2o_pool_alloc
-           (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4,
+           (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32),
             I2O_MSG_INPOOL_MIN)) {
                kfree(c);
                return ERR_PTR(-ENOMEM);
index 003b077c2324c26861694ad5d22de06ede24faf2..45bcf098e762c500e3777facb3a85c8f841ab385 100644 (file)
@@ -84,7 +84,7 @@ config MMC_WBSD
 
 config MMC_AU1X
        tristate "Alchemy AU1XX0 MMC Card Interface support"
-       depends on SOC_AU1X00 && MMC
+       depends on MMC && SOC_AU1200
        help
          This selects the AMD Alchemy(R) Multimedia card interface.
          If you have a Alchemy platform with a MMC slot, say Y or M here.
index 914d62b2406411ca76f707c4ccf8d42a58d4f583..5dc4bee7abebfb9c8685e61306ae54bdff754060 100644 (file)
@@ -310,7 +310,7 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
                }
                else
                        data->bytes_xfered =
-                               (data->blocks * (1 << data->blksz_bits)) -
+                               (data->blocks * data->blksz) -
                                host->pio.len;
        }
 
@@ -575,7 +575,7 @@ static int
 au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
 {
 
-       int datalen = data->blocks * (1 << data->blksz_bits);
+       int datalen = data->blocks * data->blksz;
 
        if (dma != 0)
                host->flags |= HOST_F_DMA;
@@ -596,7 +596,7 @@ au1xmmc_prepare_data(struct au1xmmc_host *host, struct mmc_data *data)
        if (host->dma.len == 0)
                return MMC_ERR_TIMEOUT;
 
-       au_writel((1 << data->blksz_bits) - 1, HOST_BLKSIZE(host));
+       au_writel(data->blksz - 1, HOST_BLKSIZE(host));
 
        if (host->flags & HOST_F_DMA) {
                int i;
index 79358e223f5788fdd8dac33c24ce11170ec2ca5c..a4eb1d0e7a7169e381847c978c71b7bcb4dd72f1 100644 (file)
@@ -218,8 +218,10 @@ static int imxmci_busy_wait_for_status(struct imxmci_host *host,
        if(!loops)
                return 0;
 
-       dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n",
-               loops, where, *pstat, stat_mask);
+       /* The busy-wait is expected there for clock <8MHz due to SDHC hardware flaws */
+       if(!(stat_mask & STATUS_END_CMD_RESP) || (host->mmc->ios.clock>=8000000))
+               dev_info(mmc_dev(host->mmc), "busy wait for %d usec in %s, STATUS = 0x%x (0x%x)\n",
+                       loops, where, *pstat, stat_mask);
        return loops;
 }
 
@@ -333,6 +335,9 @@ static void imxmci_start_cmd(struct imxmci_host *host, struct mmc_command *cmd,
        WARN_ON(host->cmd != NULL);
        host->cmd = cmd;
 
+       /* Ensure, that clock are stopped else command programming and start fails */
+       imxmci_stop_clock(host);
+
        if (cmd->flags & MMC_RSP_BUSY)
                cmdat |= CMD_DAT_CONT_BUSY;
 
@@ -553,7 +558,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
        int trans_done = 0;
        unsigned int stat = *pstat;
 
-       if(host->actual_bus_width == MMC_BUS_WIDTH_4)
+       if(host->actual_bus_width != MMC_BUS_WIDTH_4)
                burst_len = 16;
        else
                burst_len = 64;
@@ -591,8 +596,7 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat)
                        stat = MMC_STATUS;
 
                        /* Flush extra bytes from FIFO */
-                       while(flush_len >= 2){
-                               flush_len -= 2;
+                       while(flush_len && !(stat & STATUS_DATA_TRANS_DONE)){
                                i = MMC_BUFFER_ACCESS;
                                stat = MMC_STATUS;
                                stat &= ~STATUS_CRC_READ_ERR; /* Stupid but required there */
@@ -746,10 +750,6 @@ static void imxmci_tasklet_fnc(unsigned long data)
                        data_dir_mask = STATUS_DATA_TRANS_DONE;
                }
 
-               imxmci_busy_wait_for_status(host, &stat,
-                               data_dir_mask,
-                               50, "imxmci_tasklet_fnc data");
-
                if(stat & data_dir_mask) {
                        clear_bit(IMXMCI_PEND_DMA_END_b, &host->pending_events);
                        imxmci_data_done(host, stat);
@@ -865,7 +865,11 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
                imxmci_stop_clock(host);
                MMC_CLK_RATE = (prescaler<<3) | clk;
-               imxmci_start_clock(host);
+               /*
+                * Under my understanding, clock should not be started there, because it would
+                * initiate SDHC sequencer and send last or random command into card
+                */
+               /*imxmci_start_clock(host);*/
 
                dev_dbg(mmc_dev(host->mmc), "MMC_CLK_RATE: 0x%08x\n", MMC_CLK_RATE);
        } else {
index 1ca2c8b9c9b552b488702753bfac8d5309a625c8..6201f3086a0226d1810aab52067d0a33e22206fe 100644 (file)
@@ -951,6 +951,7 @@ static void mmc_read_scrs(struct mmc_host *host)
                data.timeout_ns = card->csd.tacc_ns * 10;
                data.timeout_clks = card->csd.tacc_clks * 10;
                data.blksz_bits = 3;
+               data.blksz = 1 << 3;
                data.blocks = 1;
                data.flags = MMC_DATA_READ;
                data.sg = &sg;
index 06bd1f4cb9b1e34c71255ef2c2f6711d0dbbbfc1..587458b370b9a9d71c817d0375d140847f01c505 100644 (file)
@@ -175,6 +175,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                brq.data.timeout_ns = card->csd.tacc_ns * 10;
                brq.data.timeout_clks = card->csd.tacc_clks * 10;
                brq.data.blksz_bits = md->block_bits;
+               brq.data.blksz = 1 << md->block_bits;
                brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
                brq.stop.opcode = MMC_STOP_TRANSMISSION;
                brq.stop.arg = 0;
@@ -352,7 +353,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
                         */
                        printk(KERN_ERR "%s: unable to select block size for "
                                "writing (rb%u wb%u rp%u wp%u)\n",
-                               md->disk->disk_name,
+                               mmc_card_id(card),
                                1 << card->csd.read_blkbits,
                                1 << card->csd.write_blkbits,
                                card->csd.read_partial,
index f97b472085cbf2c39f3eb99b0b4fd38460aa2c8d..b49368fd96b82b051d59fe85ec00c9127ca05390 100644 (file)
@@ -119,7 +119,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
                nob = 0xffff;
 
        writel(nob, host->base + MMC_NOB);
-       writel(1 << data->blksz_bits, host->base + MMC_BLKLEN);
+       writel(data->blksz, host->base + MMC_BLKLEN);
 
        clks = (unsigned long long)data->timeout_ns * CLOCKRATE;
        do_div(clks, 1000000000UL);
@@ -283,7 +283,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
         * data blocks as being in error.
         */
        if (data->error == MMC_ERR_NONE)
-               data->bytes_xfered = data->blocks << data->blksz_bits;
+               data->bytes_xfered = data->blocks * data->blksz;
        else
                data->bytes_xfered = 0;
 
index 39b3d97f891ecf007185170121d0abda316e4a66..8167332d4013d3e7701f108d2aea0dcd241ea700 100644 (file)
@@ -662,14 +662,14 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
        unsigned long dmaflags;
 
        DBGF("blksz %04x blks %04x flags %08x\n",
-               1 << data->blksz_bits, data->blocks, data->flags);
+               data->blksz, data->blocks, data->flags);
        DBGF("tsac %d ms nsac %d clk\n",
                data->timeout_ns / 1000000, data->timeout_clks);
 
        /*
         * Calculate size.
         */
-       host->size = data->blocks << data->blksz_bits;
+       host->size = data->blocks * data->blksz;
 
        /*
         * Check timeout values for overflow.
@@ -696,12 +696,12 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
         * Two bytes are needed for each data line.
         */
        if (host->bus_width == MMC_BUS_WIDTH_1) {
-               blksize = (1 << data->blksz_bits) + 2;
+               blksize = data->blksz + 2;
 
                wbsd_write_index(host, WBSD_IDX_PBSMSB, (blksize >> 4) & 0xF0);
                wbsd_write_index(host, WBSD_IDX_PBSLSB, blksize & 0xFF);
        } else if (host->bus_width == MMC_BUS_WIDTH_4) {
-               blksize = (1 << data->blksz_bits) + 2 * 4;
+               blksize = data->blksz + 2 * 4;
 
                wbsd_write_index(host, WBSD_IDX_PBSMSB,
                        ((blksize >> 4) & 0xF0) | WBSD_DATA_WIDTH);
index 3d306681919e12bdc923ae95c1e282faa724dbad..d8233e0b789952c9047e2b7158e0f291b9efe772 100644 (file)
@@ -650,9 +650,11 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
 
        /* Hardware bug work-around, the chip is unable to do PCI DMA
           to/from anything above 1GB :-( */
-       if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
+       if (dma_mapping_error(mapping) ||
+               mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
                /* Sigh... */
-               pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
+               if (!dma_mapping_error(mapping))
+                       pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
                dev_kfree_skb_any(skb);
                skb = __dev_alloc_skb(RX_PKT_BUF_SZ,GFP_DMA);
                if (skb == NULL)
@@ -660,8 +662,10 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
                mapping = pci_map_single(bp->pdev, skb->data,
                                         RX_PKT_BUF_SZ,
                                         PCI_DMA_FROMDEVICE);
-               if (mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
-                       pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
+               if (dma_mapping_error(mapping) ||
+                       mapping + RX_PKT_BUF_SZ > B44_DMA_MASK) {
+                       if (!dma_mapping_error(mapping))
+                               pci_unmap_single(bp->pdev, mapping, RX_PKT_BUF_SZ,PCI_DMA_FROMDEVICE);
                        dev_kfree_skb_any(skb);
                        return -ENOMEM;
                }
@@ -967,9 +971,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
-       if (mapping + len > B44_DMA_MASK) {
+       if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) {
                /* Chip can't handle DMA to/from >1GB, use bounce buffer */
-               pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
+               if (!dma_mapping_error(mapping))
+                       pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE);
 
                bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ,
                                             GFP_ATOMIC|GFP_DMA);
@@ -978,8 +983,9 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
                mapping = pci_map_single(bp->pdev, bounce_skb->data,
                                         len, PCI_DMA_TODEVICE);
-               if (mapping + len > B44_DMA_MASK) {
-                       pci_unmap_single(bp->pdev, mapping,
+               if (dma_mapping_error(mapping) || mapping + len > B44_DMA_MASK) {
+                       if (!dma_mapping_error(mapping))
+                               pci_unmap_single(bp->pdev, mapping,
                                         len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_any(bounce_skb);
                        goto err_out;
@@ -1203,7 +1209,8 @@ static int b44_alloc_consistent(struct b44 *bp)
                                             DMA_TABLE_BYTES,
                                             DMA_BIDIRECTIONAL);
 
-               if (rx_ring_dma + size > B44_DMA_MASK) {
+               if (dma_mapping_error(rx_ring_dma) ||
+                       rx_ring_dma + size > B44_DMA_MASK) {
                        kfree(rx_ring);
                        goto out_err;
                }
@@ -1229,7 +1236,8 @@ static int b44_alloc_consistent(struct b44 *bp)
                                             DMA_TABLE_BYTES,
                                             DMA_TO_DEVICE);
 
-               if (tx_ring_dma + size > B44_DMA_MASK) {
+               if (dma_mapping_error(tx_ring_dma) ||
+                       tx_ring_dma + size > B44_DMA_MASK) {
                        kfree(tx_ring);
                        goto out_err;
                }
index 5ca99e26660af7f9b32f873e06bd3efd9ea4a313..54161aef3cac0cd763479a3a5bc9d7b00da1f83b 100644 (file)
@@ -55,8 +55,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.4.39"
-#define DRV_MODULE_RELDATE     "March 22, 2006"
+#define DRV_MODULE_VERSION     "1.4.40"
+#define DRV_MODULE_RELDATE     "May 22, 2006"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -2945,7 +2945,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
                int buf_size)
 {
        u32 written, offset32, len32;
-       u8 *buf, start[4], end[4];
+       u8 *buf, start[4], end[4], *flash_buffer = NULL;
        int rc = 0;
        int align_start, align_end;
 
@@ -2985,12 +2985,19 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
                memcpy(buf + align_start, data_buf, buf_size);
        }
 
+       if (bp->flash_info->buffered == 0) {
+               flash_buffer = kmalloc(264, GFP_KERNEL);
+               if (flash_buffer == NULL) {
+                       rc = -ENOMEM;
+                       goto nvram_write_end;
+               }
+       }
+
        written = 0;
        while ((written < len32) && (rc == 0)) {
                u32 page_start, page_end, data_start, data_end;
                u32 addr, cmd_flags;
                int i;
-               u8 flash_buffer[264];
 
                /* Find the page_start addr */
                page_start = offset32 + written;
@@ -3061,7 +3068,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
                }
 
                /* Loop to write the new data from data_start to data_end */
-               for (addr = data_start; addr < data_end; addr += 4, i++) {
+               for (addr = data_start; addr < data_end; addr += 4, i += 4) {
                        if ((addr == page_end - 4) ||
                                ((bp->flash_info->buffered) &&
                                 (addr == data_end - 4))) {
@@ -3109,6 +3116,9 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
        }
 
 nvram_write_end:
+       if (bp->flash_info->buffered == 0)
+               kfree(flash_buffer);
+
        if (align_start || align_end)
                kfree(buf);
        return rc;
index 1ddefd281213d613462f05a583795921d5d3acd4..038447fb5c5ee82ef17110189497e029c01d42fd 100644 (file)
@@ -53,6 +53,7 @@
 #define DRV_VERSION    "v1.17b"
 #define DRV_RELDATE    "2006/03/10"
 #include "dl2k.h"
+#include <linux/dma-mapping.h>
 
 static char version[] __devinitdata =
       KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; 
index ecccca35c6f4db1ba739224a6cdc978f7a2c82ad..d1c705b412c27209acc90761cafcade597e2fdd7 100644 (file)
@@ -870,13 +870,16 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
        *data = 0;
 
        /* Hook up test interrupt handler just for this test */
-       if (!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
+       if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name,
+                        netdev)) {
                shared_int = FALSE;
        } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ,
                              netdev->name, netdev)){
                *data = 1;
                return -1;
        }
+       DPRINTK(PROBE,INFO, "testing %s interrupt\n",
+               (shared_int ? "shared" : "unshared"));
 
        /* Disable all the interrupts */
        E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF);
index c99e87838f92913ce277c9a2494955551cb79f04..97e71a4fe8eb70e91db07df7e52432b1287aa17c 100644 (file)
@@ -220,6 +220,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter);
 static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
 static int e1000_resume(struct pci_dev *pdev);
 #endif
+static void e1000_shutdown(struct pci_dev *pdev);
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /* for netdump / net console */
@@ -235,8 +236,9 @@ static struct pci_driver e1000_driver = {
        /* Power Managment Hooks */
 #ifdef CONFIG_PM
        .suspend  = e1000_suspend,
-       .resume   = e1000_resume
+       .resume   = e1000_resume,
 #endif
+       .shutdown = e1000_shutdown
 };
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
@@ -3517,7 +3519,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
        buffer_info = &rx_ring->buffer_info[i];
 
        while (rx_desc->status & E1000_RXD_STAT_DD) {
-               struct sk_buff *skb, *next_skb;
+               struct sk_buff *skb;
                u8 status;
 #ifdef CONFIG_E1000_NAPI
                if (*work_done >= work_to_do)
@@ -3535,8 +3537,6 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
                prefetch(next_rxd);
 
                next_buffer = &rx_ring->buffer_info[i];
-               next_skb = next_buffer->skb;
-               prefetch(next_skb->data - NET_IP_ALIGN);
 
                cleaned = TRUE;
                cleaned_count++;
@@ -3666,7 +3666,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
        struct e1000_buffer *buffer_info, *next_buffer;
        struct e1000_ps_page *ps_page;
        struct e1000_ps_page_dma *ps_page_dma;
-       struct sk_buff *skb, *next_skb;
+       struct sk_buff *skb;
        unsigned int i, j;
        uint32_t length, staterr;
        int cleaned_count = 0;
@@ -3695,8 +3695,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
                prefetch(next_rxd);
 
                next_buffer = &rx_ring->buffer_info[i];
-               next_skb = next_buffer->skb;
-               prefetch(next_skb->data - NET_IP_ALIGN);
 
                cleaned = TRUE;
                cleaned_count++;
@@ -4611,6 +4609,12 @@ e1000_resume(struct pci_dev *pdev)
        return 0;
 }
 #endif
+
+static void e1000_shutdown(struct pci_dev *pdev)
+{
+       e1000_suspend(pdev, PMSG_SUSPEND);
+}
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /*
  * Polling 'interrupt' - used by things like netconsole to send skbs
index f7235c9bc42179a9b405ac43dcf2c3ec25fe58de..feb5b223cd60ed09e0dca642701d1d16f388fd49 100644 (file)
@@ -2615,6 +2615,18 @@ static int nv_nway_reset(struct net_device *dev)
        return ret;
 }
 
+#ifdef NETIF_F_TSO
+static int nv_set_tso(struct net_device *dev, u32 value)
+{
+       struct fe_priv *np = netdev_priv(dev);
+
+       if ((np->driver_data & DEV_HAS_CHECKSUM))
+               return ethtool_op_set_tso(dev, value);
+       else
+               return value ? -EOPNOTSUPP : 0;
+}
+#endif
+
 static struct ethtool_ops ops = {
        .get_drvinfo = nv_get_drvinfo,
        .get_link = ethtool_op_get_link,
@@ -2626,6 +2638,10 @@ static struct ethtool_ops ops = {
        .get_regs = nv_get_regs,
        .nway_reset = nv_nway_reset,
        .get_perm_addr = ethtool_op_get_perm_addr,
+#ifdef NETIF_F_TSO
+       .get_tso = ethtool_op_get_tso,
+       .set_tso = nv_set_tso
+#endif
 };
 
 static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
@@ -2891,78 +2907,6 @@ static int nv_open(struct net_device *dev)
                goto out_drain;
        }
 
-       if (np->msi_flags & NV_MSI_X_CAPABLE) {
-               for (i = 0; i < (np->msi_flags & NV_MSI_X_VECTORS_MASK); i++) {
-                       np->msi_x_entry[i].entry = i;
-               }
-               if ((ret = pci_enable_msix(np->pci_dev, np->msi_x_entry, (np->msi_flags & NV_MSI_X_VECTORS_MASK))) == 0) {
-                       np->msi_flags |= NV_MSI_X_ENABLED;
-                       if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) {
-                               /* Request irq for rx handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) {
-                                       printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);
-                                       pci_disable_msix(np->pci_dev);
-                                       np->msi_flags &= ~NV_MSI_X_ENABLED;
-                                       goto out_drain;
-                               }
-                               /* Request irq for tx handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) {
-                                       printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);
-                                       pci_disable_msix(np->pci_dev);
-                                       np->msi_flags &= ~NV_MSI_X_ENABLED;
-                                       goto out_drain;
-                               }
-                               /* Request irq for link and timer handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) {
-                                       printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);
-                                       pci_disable_msix(np->pci_dev);
-                                       np->msi_flags &= ~NV_MSI_X_ENABLED;
-                                       goto out_drain;
-                               }
-
-                               /* map interrupts to their respective vector */
-                               writel(0, base + NvRegMSIXMap0);
-                               writel(0, base + NvRegMSIXMap1);
-                               set_msix_vector_map(dev, NV_MSI_X_VECTOR_RX, NVREG_IRQ_RX_ALL);
-                               set_msix_vector_map(dev, NV_MSI_X_VECTOR_TX, NVREG_IRQ_TX_ALL);
-                               set_msix_vector_map(dev, NV_MSI_X_VECTOR_OTHER, NVREG_IRQ_OTHER);
-                       } else {
-                               /* Request irq for all interrupts */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) {
-                                       printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
-                                       pci_disable_msix(np->pci_dev);
-                                       np->msi_flags &= ~NV_MSI_X_ENABLED;
-                                       goto out_drain;
-                               }
-
-                               /* map interrupts to vector 0 */
-                               writel(0, base + NvRegMSIXMap0);
-                               writel(0, base + NvRegMSIXMap1);
-                       }
-               }
-       }
-       if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
-               if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
-                       np->msi_flags |= NV_MSI_ENABLED;
-                       if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) {
-                               printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
-                               pci_disable_msi(np->pci_dev);
-                               np->msi_flags &= ~NV_MSI_ENABLED;
-                               goto out_drain;
-                       }
-
-                       /* map interrupts to vector 0 */
-                       writel(0, base + NvRegMSIMap0);
-                       writel(0, base + NvRegMSIMap1);
-                       /* enable msi vector 0 */
-                       writel(NVREG_MSI_VECTOR_0_ENABLED, base + NvRegMSIIrqMask);
-               }
-       }
-       if (ret != 0) {
-               if (request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0)
-                       goto out_drain;
-       }
-
        /* ask for interrupts */
        nv_enable_hw_interrupts(dev, np->irqmask);
 
index 5e6d007529905744ce7e0f3d0e5a67b09aa469cc..cff8598aa8004e439564a9727d4495e1e3552012 100644 (file)
@@ -33,7 +33,7 @@ config DONGLE
 
 config ESI_DONGLE
        tristate "ESI JetEye PC dongle"
-       depends on DONGLE && IRDA
+       depends on IRTTY_SIR && DONGLE && IRDA
        help
          Say Y here if you want to build support for the Extended Systems
          JetEye PC dongle.  To compile it as a module, choose M here. The ESI
@@ -44,7 +44,7 @@ config ESI_DONGLE
 
 config ACTISYS_DONGLE
        tristate "ACTiSYS IR-220L and IR220L+ dongle"
-       depends on DONGLE && IRDA
+       depends on IRTTY_SIR && DONGLE && IRDA
        help
          Say Y here if you want to build support for the ACTiSYS IR-220L and
          IR220L+ dongles.  To compile it as a module, choose M here. The
@@ -55,7 +55,7 @@ config ACTISYS_DONGLE
 
 config TEKRAM_DONGLE
        tristate "Tekram IrMate 210B dongle"
-       depends on DONGLE && IRDA
+       depends on IRTTY_SIR && DONGLE && IRDA
        help
          Say Y here if you want to build support for the Tekram IrMate 210B
          dongle.  To compile it as a module, choose M here. The Tekram dongle
@@ -66,7 +66,7 @@ config TEKRAM_DONGLE
 
 config TOIM3232_DONGLE
        tristate "TOIM3232 IrDa dongle"
-       depends on DONGLE && IRDA
+       depends on IRTTY_SIR && DONGLE && IRDA
        help
          Say Y here if you want to build support for the Vishay/Temic
          TOIM3232 and TOIM4232 based dongles.
@@ -74,7 +74,7 @@ config TOIM3232_DONGLE
 
 config LITELINK_DONGLE
        tristate "Parallax LiteLink dongle"
-       depends on DONGLE && IRDA
+       depends on IRTTY_SIR && DONGLE && IRDA
        help
          Say Y here if you want to build support for the Parallax Litelink
          dongle.  To compile it as a module, choose M here.  The Parallax
@@ -85,7 +85,7 @@ config LITELINK_DONGLE
 
 config MA600_DONGLE
        tristate "Mobile Action MA600 dongle"
-       depends on DONGLE && IRDA && EXPERIMENTAL
+       depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL
        help
          Say Y here if you want to build support for the Mobile Action MA600
          dongle.  To compile it as a module, choose M here. The MA600 dongle
@@ -98,7 +98,7 @@ config MA600_DONGLE
 
 config GIRBIL_DONGLE
        tristate "Greenwich GIrBIL dongle"
-       depends on DONGLE && IRDA && EXPERIMENTAL
+       depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL
        help
          Say Y here if you want to build support for the Greenwich GIrBIL
          dongle.  If you want to compile it as a module, choose M here.
@@ -109,7 +109,7 @@ config GIRBIL_DONGLE
 
 config MCP2120_DONGLE
        tristate "Microchip MCP2120"
-       depends on DONGLE && IRDA && EXPERIMENTAL
+       depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL
        help
          Say Y here if you want to build support for the Microchip MCP2120
          dongle.  If you want to compile it as a module, choose M here.
@@ -123,7 +123,7 @@ config MCP2120_DONGLE
 
 config OLD_BELKIN_DONGLE
        tristate "Old Belkin dongle"
-       depends on DONGLE && IRDA && EXPERIMENTAL
+       depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL
        help
          Say Y here if you want to build support for the Adaptec Airport 1000
          and 2000 dongles.  If you want to compile it as a module, choose
@@ -132,7 +132,7 @@ config OLD_BELKIN_DONGLE
 
 config ACT200L_DONGLE
        tristate "ACTiSYS IR-200L dongle"
-       depends on DONGLE && IRDA && EXPERIMENTAL
+       depends on IRTTY_SIR && DONGLE && IRDA && EXPERIMENTAL
        help
          Say Y here if you want to build support for the ACTiSYS IR-200L
          dongle. If you want to compile it as a module, choose M here.
index 6f7dce8eba51c329dd7412334823131749ab6ac8..b67f586d7392ab199e29181517d18af00cc9a8e1 100644 (file)
@@ -149,6 +149,8 @@ static void enp2611_check_link_status(unsigned long __dummy)
                int status;
 
                dev = nds[i];
+               if (dev == NULL)
+                       continue;
 
                status = pm3386_is_link_up(i);
                if (status && !netif_carrier_ok(dev)) {
@@ -191,6 +193,7 @@ static void enp2611_set_port_admin_status(int port, int up)
 
 static int __init enp2611_init_module(void)
 { 
+       int ports;
        int i;
 
        if (!machine_is_enp2611())
@@ -199,7 +202,8 @@ static int __init enp2611_init_module(void)
        caleb_reset();
        pm3386_reset();
 
-       for (i = 0; i < 3; i++) {
+       ports = pm3386_port_count();
+       for (i = 0; i < ports; i++) {
                nds[i] = ixpdev_alloc(i, sizeof(struct enp2611_ixpdev_priv));
                if (nds[i] == NULL) {
                        while (--i >= 0)
@@ -215,9 +219,10 @@ static int __init enp2611_init_module(void)
 
        ixp2400_msf_init(&enp2611_msf_parameters);
 
-       if (ixpdev_init(3, nds, enp2611_set_port_admin_status)) {
-               for (i = 0; i < 3; i++)
-                       free_netdev(nds[i]);
+       if (ixpdev_init(ports, nds, enp2611_set_port_admin_status)) {
+               for (i = 0; i < ports; i++)
+                       if (nds[i])
+                               free_netdev(nds[i]);
                return -EINVAL;
        }
 
index 5c7ab7564053af12a291f2be7875329cb6ac6e1d..5224651c9aac30e3ab308286c7d01f93c987ee79 100644 (file)
@@ -86,40 +86,53 @@ static void pm3386_port_reg_write(int port, int _reg, int spacing, u16 value)
        pm3386_reg_write(port >> 1, reg, value);
 }
 
+int pm3386_secondary_present(void)
+{
+       return pm3386_reg_read(1, 0) == 0x3386;
+}
 
 void pm3386_reset(void)
 {
        u8 mac[3][6];
+       int secondary;
+
+       secondary = pm3386_secondary_present();
 
        /* Save programmed MAC addresses.  */
        pm3386_get_mac(0, mac[0]);
        pm3386_get_mac(1, mac[1]);
-       pm3386_get_mac(2, mac[2]);
+       if (secondary)
+               pm3386_get_mac(2, mac[2]);
 
        /* Assert analog and digital reset.  */
        pm3386_reg_write(0, 0x002, 0x0060);
-       pm3386_reg_write(1, 0x002, 0x0060);
+       if (secondary)
+               pm3386_reg_write(1, 0x002, 0x0060);
        mdelay(1);
 
        /* Deassert analog reset.  */
        pm3386_reg_write(0, 0x002, 0x0062);
-       pm3386_reg_write(1, 0x002, 0x0062);
+       if (secondary)
+               pm3386_reg_write(1, 0x002, 0x0062);
        mdelay(10);
 
        /* Deassert digital reset.  */
        pm3386_reg_write(0, 0x002, 0x0063);
-       pm3386_reg_write(1, 0x002, 0x0063);
+       if (secondary)
+               pm3386_reg_write(1, 0x002, 0x0063);
        mdelay(10);
 
        /* Restore programmed MAC addresses.  */
        pm3386_set_mac(0, mac[0]);
        pm3386_set_mac(1, mac[1]);
-       pm3386_set_mac(2, mac[2]);
+       if (secondary)
+               pm3386_set_mac(2, mac[2]);
 
        /* Disable carrier on all ports.  */
        pm3386_set_carrier(0, 0);
        pm3386_set_carrier(1, 0);
-       pm3386_set_carrier(2, 0);
+       if (secondary)
+               pm3386_set_carrier(2, 0);
 }
 
 static u16 swaph(u16 x)
@@ -127,6 +140,11 @@ static u16 swaph(u16 x)
        return ((x << 8) | (x >> 8)) & 0xffff;
 }
 
+int pm3386_port_count(void)
+{
+       return 2 + pm3386_secondary_present();
+}
+
 void pm3386_init_port(int port)
 {
        int pm = port >> 1;
index fe92bb056ac424c9279ca8501016d2f3452187c3..cc4183dca9116959be453b1354065719c850fe4a 100644 (file)
@@ -13,6 +13,7 @@
 #define __PM3386_H
 
 void pm3386_reset(void);
+int pm3386_port_count(void);
 void pm3386_init_port(int port);
 void pm3386_get_mac(int port, u8 *mac);
 void pm3386_set_mac(int port, u8 *mac);
index 66e74f7402610f5ac9ad769457f01b5254d1b27e..bf58db29e2ed6342bd707931ccd598a3c376b07c 100644 (file)
@@ -107,7 +107,7 @@ static int init_netconsole(void)
 
        if(!configured) {
                printk("netconsole: not configured, aborting\n");
-               return -EINVAL;
+               return 0;
        }
 
        if(netpoll_setup(&np))
index 448a09488529f59ca3727ce5d89c8ba3903d3c32..2ea66aca648b417ae0109ae132921965b9615eb9 100644 (file)
@@ -1691,17 +1691,6 @@ static void do_set_multicast_list(struct net_device *dev)
                memset(ei_local->mcfilter, 0xFF, 8);
        }
 
-       /* 
-        * DP8390 manuals don't specify any magic sequence for altering
-        * the multicast regs on an already running card. To be safe, we
-        * ensure multicast mode is off prior to loading up the new hash
-        * table. If this proves to be not enough, we can always resort
-        * to stopping the NIC, loading the table and then restarting.
-        */
-        
-       if (netif_running(dev))
-               outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
-
        outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
        for(i = 0; i < 8; i++) 
        {
@@ -1715,6 +1704,8 @@ static void do_set_multicast_list(struct net_device *dev)
                outb_p(E8390_RXCONFIG | 0x48, e8390_base + EN0_RXCR);
        else
                outb_p(E8390_RXCONFIG | 0x40, e8390_base + EN0_RXCR);
+
+       outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);
 }
 
 /*
index 4260c2128f4722c61cc267fc6a0290ebde330be9..a8f6bfc96fd28cbdd4cb75c0c60517fa54d84709 100644 (file)
@@ -1204,7 +1204,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt)
 
        dev->last_rx = jiffies;
        lp->linux_stats.rx_packets++;
-       lp->linux_stats.rx_bytes += skb->len;
+       lp->linux_stats.rx_bytes += pkt_len;
        outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */
        continue;
       } else {
index 07c31f19c6ba40d419b2d022d069af321130f73f..fc08c4af506ca8194b7f4d3854181fdc5eed43b4 100644 (file)
@@ -1774,8 +1774,6 @@ static int pcnet32_open(struct net_device *dev)
                lp->rx_dma_addr[i] = 0;
        }
 
-       pcnet32_free_ring(dev);
-
        /*
         * Switch back to 16bit mode to avoid problems with dumb
         * DOS packet driver after a warm reboot
index 475dc930380f63b6a1b0fd52b2532b43354798c5..0d101a18026a31b250a010bba4be28be45cab441 100644 (file)
@@ -861,6 +861,9 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
                 * give dev_queue_xmit something it can free.
                 */
                skb2 = skb_clone(skb, GFP_ATOMIC);
+
+               if (skb2 == NULL)
+                       goto abort;
        }
 
        ph = (struct pppoe_hdr *) skb_push(skb2, sizeof(struct pppoe_hdr));
index a70c2b0cc10425c9d0b23ffba57f2c7fa185a86c..5ca5a1b546a162ed23eaf2e422fd9db21eee2537 100644 (file)
@@ -78,8 +78,7 @@ static const struct pci_device_id skge_id_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) },
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) },
        { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), },
-       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },
-       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) },
+       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b01) },    /* DGE-530T */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) },
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */
        { PCI_DEVICE(PCI_VENDOR_ID_CNET, PCI_DEVICE_ID_CNET_GIGACARD) },
@@ -402,7 +401,7 @@ static int skge_set_ring_param(struct net_device *dev,
        int err;
 
        if (p->rx_pending == 0 || p->rx_pending > MAX_RX_RING_SIZE ||
-           p->tx_pending == 0 || p->tx_pending > MAX_TX_RING_SIZE)
+           p->tx_pending < MAX_SKB_FRAGS+1 || p->tx_pending > MAX_TX_RING_SIZE)
                return -EINVAL;
 
        skge->rx_ring.count = p->rx_pending;
@@ -2717,8 +2716,7 @@ static int skge_poll(struct net_device *dev, int *budget)
                if (control & BMU_OWN)
                        break;
 
-               skb = skge_rx_get(skge, e, control, rd->status,
-                                 le16_to_cpu(rd->csum2));
+               skb = skge_rx_get(skge, e, control, rd->status, rd->csum2);
                if (likely(skb)) {
                        dev->last_rx = jiffies;
                        netif_receive_skb(skb);
index ffd267fab21da998ed0a349716ba4594706b9aec..97fe95666f3b8bbe0a660b7bdc2187f954de1fd8 100644 (file)
@@ -51,7 +51,7 @@
 #include "sky2.h"
 
 #define DRV_NAME               "sky2"
-#define DRV_VERSION            "1.3"
+#define DRV_VERSION            "1.4"
 #define PFX                    DRV_NAME " "
 
 /*
@@ -105,6 +105,7 @@ MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)
 static const struct pci_device_id sky2_id_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
        { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
+       { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) },    /* DGE-560T */
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) },
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) },
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) },
@@ -186,12 +187,11 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
        return v;
 }
 
-static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
+static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
 {
        u16 power_control;
        u32 reg1;
        int vaux;
-       int ret = 0;
 
        pr_debug("sky2_set_power_state %d\n", state);
        sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
@@ -235,6 +235,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
                }
 
                if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
+                       sky2_write16(hw, B0_CTST, Y2_HW_WOL_ON);
                        sky2_pci_write32(hw, PCI_DEV_REG3, 0);
                        reg1 = sky2_pci_read32(hw, PCI_DEV_REG4);
                        reg1 &= P_ASPM_CONTROL_MSK;
@@ -273,12 +274,10 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
                break;
        default:
                printk(KERN_ERR PFX "Unknown power state %d\n", state);
-               ret = -1;
        }
 
        sky2_pci_write16(hw, hw->pm_cap + PCI_PM_CTRL, power_control);
        sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
-       return ret;
 }
 
 static void sky2_phy_reset(struct sky2_hw *hw, unsigned port)
@@ -306,7 +305,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
        u16 ctrl, ct1000, adv, pg, ledctrl, ledover;
 
        if (sky2->autoneg == AUTONEG_ENABLE &&
-           (hw->chip_id != CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
+           !(hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
                u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
 
                ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
@@ -977,6 +976,7 @@ static int sky2_rx_start(struct sky2_port *sky2)
        struct sky2_hw *hw = sky2->hw;
        unsigned rxq = rxqaddr[sky2->port];
        int i;
+       unsigned thresh;
 
        sky2->rx_put = sky2->rx_next = 0;
        sky2_qset(hw, rxq);
@@ -1001,9 +1001,21 @@ static int sky2_rx_start(struct sky2_port *sky2)
                sky2_rx_add(sky2, re->mapaddr);
        }
 
-       /* Truncate oversize frames */
-       sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), sky2->rx_bufsize - 8);
-       sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON);
+
+       /*
+        * The receiver hangs if it receives frames larger than the
+        * packet buffer. As a workaround, truncate oversize frames, but
+        * the register is limited to 9 bits, so if you do frames > 2052
+        * you better get the MTU right!
+        */
+       thresh = (sky2->rx_bufsize - 8) / sizeof(u32);
+       if (thresh > 0x1ff)
+               sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_OFF);
+       else {
+               sky2_write16(hw, SK_REG(sky2->port, RX_GMF_TR_THR), thresh);
+               sky2_write32(hw, SK_REG(sky2->port, RX_GMF_CTRL_T), RX_TRUNC_ON);
+       }
+
 
        /* Tell chip about available buffers */
        sky2_write16(hw, Y2_QADDR(rxq, PREF_UNIT_PUT_IDX), sky2->rx_put);
@@ -1020,7 +1032,25 @@ static int sky2_up(struct net_device *dev)
        struct sky2_hw *hw = sky2->hw;
        unsigned port = sky2->port;
        u32 ramsize, rxspace, imask;
-       int err = -ENOMEM;
+       int cap, err = -ENOMEM;
+       struct net_device *otherdev = hw->dev[sky2->port^1];
+
+       /*
+        * On dual port PCI-X card, there is an problem where status
+        * can be received out of order due to split transactions
+        */
+       if (otherdev && netif_running(otherdev) &&
+           (cap = pci_find_capability(hw->pdev, PCI_CAP_ID_PCIX))) {
+               struct sky2_port *osky2 = netdev_priv(otherdev);
+               u16 cmd;
+
+               cmd = sky2_pci_read16(hw, cap + PCI_X_CMD);
+               cmd &= ~PCI_X_CMD_MAX_SPLIT;
+               sky2_pci_write16(hw, cap + PCI_X_CMD, cmd);
+
+               sky2->rx_csum = 0;
+               osky2->rx_csum = 0;
+       }
 
        if (netif_msg_ifup(sky2))
                printk(KERN_INFO PFX "%s: enabling interface\n", dev->name);
@@ -1899,6 +1929,12 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
        }
 }
 
+/* Is status ring empty or is there more to do? */
+static inline int sky2_more_work(const struct sky2_hw *hw)
+{
+       return (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX));
+}
+
 /* Process status response ring */
 static int sky2_status_intr(struct sky2_hw *hw, int to_do)
 {
@@ -2125,6 +2161,13 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port,
 /* If idle then force a fake soft NAPI poll once a second
  * to work around cases where sharing an edge triggered interrupt.
  */
+static inline void sky2_idle_start(struct sky2_hw *hw)
+{
+       if (idle_timeout > 0)
+               mod_timer(&hw->idle_timer,
+                         jiffies + msecs_to_jiffies(idle_timeout));
+}
+
 static void sky2_idle(unsigned long arg)
 {
        struct sky2_hw *hw = (struct sky2_hw *) arg;
@@ -2144,6 +2187,9 @@ static int sky2_poll(struct net_device *dev0, int *budget)
        int work_done = 0;
        u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
 
+       if (!~status)
+               goto out;
+
        if (status & Y2_IS_HW_ERR)
                sky2_hw_intr(hw);
 
@@ -2171,19 +2217,19 @@ static int sky2_poll(struct net_device *dev0, int *budget)
        if (status & Y2_IS_CHK_TXA2)
                sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2);
 
-       if (status & Y2_IS_STAT_BMU)
-               sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
-
        work_done = sky2_status_intr(hw, work_limit);
        *budget -= work_done;
        dev0->quota -= work_done;
 
-       if (work_done >= work_limit)
-               return 1;
+       if (status & Y2_IS_STAT_BMU)
+               sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
 
+       if (sky2_more_work(hw))
+               return 1;
+out:
        netif_rx_complete(dev0);
 
-       status = sky2_read32(hw, B0_Y2_SP_LISR);
+       sky2_read32(hw, B0_Y2_SP_LISR);
        return 0;
 }
 
@@ -3067,12 +3113,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
        sky2->duplex = -1;
        sky2->speed = -1;
        sky2->advertising = sky2_supported_modes(hw);
-
-       /* Receive checksum disabled for Yukon XL
-        * because of observed problems with incorrect
-        * values when multiple packets are received in one interrupt
-        */
-       sky2->rx_csum = (hw->chip_id != CHIP_ID_YUKON_XL);
+       sky2->rx_csum = 1;
 
        spin_lock_init(&sky2->phy_lock);
        sky2->tx_pending = TX_DEF_PENDING;
@@ -3316,9 +3357,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
        sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
 
        setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
-       if (idle_timeout > 0)
-               mod_timer(&hw->idle_timer,
-                         jiffies + msecs_to_jiffies(idle_timeout));
+       sky2_idle_start(hw);
 
        pci_set_drvdata(pdev, hw);
 
@@ -3391,8 +3430,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct sky2_hw *hw = pci_get_drvdata(pdev);
        int i;
+       pci_power_t pstate = pci_choose_state(pdev, state);
+
+       if (!(pstate == PCI_D3hot || pstate == PCI_D3cold))
+               return -EINVAL;
+
+       del_timer_sync(&hw->idle_timer);
 
-       for (i = 0; i < 2; i++) {
+       for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
 
                if (dev) {
@@ -3404,7 +3449,10 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
                }
        }
 
-       return sky2_set_power_state(hw, pci_choose_state(pdev, state));
+       sky2_write32(hw, B0_IMSK, 0);
+       pci_save_state(pdev);
+       sky2_set_power_state(hw, pstate);
+       return 0;
 }
 
 static int sky2_resume(struct pci_dev *pdev)
@@ -3414,15 +3462,15 @@ static int sky2_resume(struct pci_dev *pdev)
 
        pci_restore_state(pdev);
        pci_enable_wake(pdev, PCI_D0, 0);
-       err = sky2_set_power_state(hw, PCI_D0);
-       if (err)
-               goto out;
+       sky2_set_power_state(hw, PCI_D0);
 
        err = sky2_reset(hw);
        if (err)
                goto out;
 
-       for (i = 0; i < 2; i++) {
+       sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
+
+       for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
                if (dev && netif_running(dev)) {
                        netif_device_attach(dev);
@@ -3431,10 +3479,12 @@ static int sky2_resume(struct pci_dev *pdev)
                                printk(KERN_ERR PFX "%s: could not up: %d\n",
                                       dev->name, err);
                                dev_close(dev);
-                               break;
+                               goto out;
                        }
                }
        }
+
+       sky2_idle_start(hw);
 out:
        return err;
 }
index 8012994c9b93213480ac4734d053abb84efdad9a..8a0bc5525f0a64e8024b58d550ed29c4357fc6f4 100644 (file)
@@ -214,6 +214,8 @@ enum csr_regs {
 enum {
        Y2_VMAIN_AVAIL  = 1<<17,/* VMAIN available (YUKON-2 only) */
        Y2_VAUX_AVAIL   = 1<<16,/* VAUX available (YUKON-2 only) */
+       Y2_HW_WOL_ON    = 1<<15,/* HW WOL On  (Yukon-EC Ultra A1 only) */
+       Y2_HW_WOL_OFF   = 1<<14,/* HW WOL On  (Yukon-EC Ultra A1 only) */
        Y2_ASF_ENABLE   = 1<<13,/* ASF Unit Enable (YUKON-2 only) */
        Y2_ASF_DISABLE  = 1<<12,/* ASF Unit Disable (YUKON-2 only) */
        Y2_CLK_RUN_ENA  = 1<<11,/* CLK_RUN Enable  (YUKON-2 only) */
index 2bd9592b75cdde117ff50f1df7c2137bd467c808..862c226dbbe24cb59326100cd9c1738d2d10aa0c 100644 (file)
@@ -69,8 +69,8 @@
 
 #define DRV_MODULE_NAME                "tg3"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "3.57"
-#define DRV_MODULE_RELDATE     "Apr 28, 2006"
+#define DRV_MODULE_VERSION     "3.59"
+#define DRV_MODULE_RELDATE     "June 8, 2006"
 
 #define TG3_DEF_MAC_MODE       0
 #define TG3_DEF_RX_MODE                0
@@ -4485,9 +4485,8 @@ static void tg3_disable_nvram_access(struct tg3 *tp)
 /* tp->lock is held. */
 static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
 {
-       if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X))
-               tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX,
-                             NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
+       tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX,
+                     NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
 
        if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
                switch (kind) {
@@ -4568,13 +4567,12 @@ static int tg3_chip_reset(struct tg3 *tp)
        void (*write_op)(struct tg3 *, u32, u32);
        int i;
 
-       if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
-               tg3_nvram_lock(tp);
-               /* No matching tg3_nvram_unlock() after this because
-                * chip reset below will undo the nvram lock.
-                */
-               tp->nvram_lock_cnt = 0;
-       }
+       tg3_nvram_lock(tp);
+
+       /* No matching tg3_nvram_unlock() after this because
+        * chip reset below will undo the nvram lock.
+        */
+       tp->nvram_lock_cnt = 0;
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
@@ -4727,20 +4725,25 @@ static int tg3_chip_reset(struct tg3 *tp)
                tw32_f(MAC_MODE, 0);
        udelay(40);
 
-       if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
-               /* Wait for firmware initialization to complete. */
-               for (i = 0; i < 100000; i++) {
-                       tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
-                       if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
-                               break;
-                       udelay(10);
-               }
-               if (i >= 100000) {
-                       printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, "
-                              "firmware will not restart magic=%08x\n",
-                              tp->dev->name, val);
-                       return -ENODEV;
-               }
+       /* Wait for firmware initialization to complete. */
+       for (i = 0; i < 100000; i++) {
+               tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
+               if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
+                       break;
+               udelay(10);
+       }
+
+       /* Chip might not be fitted with firmare.  Some Sun onboard
+        * parts are configured like that.  So don't signal the timeout
+        * of the above loop as an error, but do report the lack of
+        * running firmware once.
+        */
+       if (i >= 100000 &&
+           !(tp->tg3_flags2 & TG3_FLG2_NO_FWARE_REPORTED)) {
+               tp->tg3_flags2 |= TG3_FLG2_NO_FWARE_REPORTED;
+
+               printk(KERN_INFO PFX "%s: No firmware running.\n",
+                      tp->dev->name);
        }
 
        if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
@@ -6488,6 +6491,10 @@ static void tg3_periodic_fetch_stats(struct tg3 *tp)
        TG3_STAT_ADD32(&sp->rx_frame_too_long_errors, MAC_RX_STATS_FRAME_TOO_LONG);
        TG3_STAT_ADD32(&sp->rx_jabbers, MAC_RX_STATS_JABBERS);
        TG3_STAT_ADD32(&sp->rx_undersize_packets, MAC_RX_STATS_UNDERSIZE);
+
+       TG3_STAT_ADD32(&sp->rxbds_empty, RCVLPC_NO_RCV_BD_CNT);
+       TG3_STAT_ADD32(&sp->rx_discards, RCVLPC_IN_DISCARDS_CNT);
+       TG3_STAT_ADD32(&sp->rx_errors, RCVLPC_IN_ERRORS_CNT);
 }
 
 static void tg3_timer(unsigned long __opaque)
@@ -7653,21 +7660,23 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                cmd->supported |= (SUPPORTED_1000baseT_Half |
                                   SUPPORTED_1000baseT_Full);
 
-       if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES))
+       if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) {
                cmd->supported |= (SUPPORTED_100baseT_Half |
                                  SUPPORTED_100baseT_Full |
                                  SUPPORTED_10baseT_Half |
                                  SUPPORTED_10baseT_Full |
                                  SUPPORTED_MII);
-       else
+               cmd->port = PORT_TP;
+       } else {
                cmd->supported |= SUPPORTED_FIBRE;
+               cmd->port = PORT_FIBRE;
+       }
   
        cmd->advertising = tp->link_config.advertising;
        if (netif_running(dev)) {
                cmd->speed = tp->link_config.active_speed;
                cmd->duplex = tp->link_config.active_duplex;
        }
-       cmd->port = 0;
        cmd->phy_address = PHY_ADDR;
        cmd->transceiver = 0;
        cmd->autoneg = tp->link_config.autoneg;
@@ -9069,9 +9078,6 @@ static void __devinit tg3_nvram_init(struct tg3 *tp)
 {
        int j;
 
-       if (tp->tg3_flags2 & TG3_FLG2_SUN_570X)
-               return;
-
        tw32_f(GRC_EEPROM_ADDR,
             (EEPROM_ADDR_FSM_RESET |
              (EEPROM_DEFAULT_CLOCK_PERIOD <<
@@ -9204,11 +9210,6 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
 {
        int ret;
 
-       if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
-               printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 570X\n");
-               return -EINVAL;
-       }
-
        if (!(tp->tg3_flags & TG3_FLAG_NVRAM))
                return tg3_nvram_read_using_eeprom(tp, offset, val);
 
@@ -9441,11 +9442,6 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf)
 {
        int ret;
 
-       if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
-               printk(KERN_ERR PFX "Attempt to do nvram_write on Sun 570X\n");
-               return -EINVAL;
-       }
-
        if (tp->tg3_flags & TG3_FLAG_EEPROM_WRITE_PROT) {
                tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl &
                       ~GRC_LCLCTRL_GPIO_OUTPUT1);
@@ -9572,15 +9568,19 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
        pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
                               tp->misc_host_ctrl);
 
+       /* The memory arbiter has to be enabled in order for SRAM accesses
+        * to succeed.  Normally on powerup the tg3 chip firmware will make
+        * sure it is enabled, but other entities such as system netboot
+        * code might disable it.
+        */
+       val = tr32(MEMARB_MODE);
+       tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE);
+
        tp->phy_id = PHY_ID_INVALID;
        tp->led_ctrl = LED_CTRL_MODE_PHY_1;
 
-       /* Do not even try poking around in here on Sun parts.  */
-       if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
-               /* All SUN chips are built-in LOMs. */
-               tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
-               return;
-       }
+       /* Assume an onboard device by default.  */
+       tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
 
        tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
        if (val == NIC_SRAM_DATA_SIG_MAGIC) {
@@ -9680,6 +9680,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
 
                if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP)
                        tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
+               else
+                       tp->tg3_flags &= ~TG3_FLAG_EEPROM_WRITE_PROT;
 
                if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
                        tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
@@ -9828,16 +9830,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
        int i;
        u32 magic;
 
-       if (tp->tg3_flags2 & TG3_FLG2_SUN_570X) {
-               /* Sun decided not to put the necessary bits in the
-                * NVRAM of their onboard tg3 parts :(
-                */
-               strcpy(tp->board_part_number, "Sun 570X");
-               return;
-       }
-
        if (tg3_nvram_read_swab(tp, 0x0, &magic))
-               return;
+               goto out_not_found;
 
        if (magic == TG3_EEPROM_MAGIC) {
                for (i = 0; i < 256; i += 4) {
@@ -9868,6 +9862,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
                                        break;
                                msleep(1);
                        }
+                       if (!(tmp16 & 0x8000))
+                               goto out_not_found;
+
                        pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
                                              &tmp);
                        tmp = cpu_to_le32(tmp);
@@ -9959,37 +9956,6 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
        }
 }
 
-#ifdef CONFIG_SPARC64
-static int __devinit tg3_is_sun_570X(struct tg3 *tp)
-{
-       struct pci_dev *pdev = tp->pdev;
-       struct pcidev_cookie *pcp = pdev->sysdata;
-
-       if (pcp != NULL) {
-               int node = pcp->prom_node;
-               u32 venid;
-               int err;
-
-               err = prom_getproperty(node, "subsystem-vendor-id",
-                                      (char *) &venid, sizeof(venid));
-               if (err == 0 || err == -1)
-                       return 0;
-               if (venid == PCI_VENDOR_ID_SUN)
-                       return 1;
-
-               /* TG3 chips onboard the SunBlade-2500 don't have the
-                * subsystem-vendor-id set to PCI_VENDOR_ID_SUN but they
-                * are distinguishable from non-Sun variants by being
-                * named "network" by the firmware.  Non-Sun cards will
-                * show up as being named "ethernet".
-                */
-               if (!strcmp(pcp->prom_name, "network"))
-                       return 1;
-       }
-       return 0;
-}
-#endif
-
 static int __devinit tg3_get_invariants(struct tg3 *tp)
 {
        static struct pci_device_id write_reorder_chipsets[] = {
@@ -10006,11 +9972,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        u16 pci_cmd;
        int err;
 
-#ifdef CONFIG_SPARC64
-       if (tg3_is_sun_570X(tp))
-               tp->tg3_flags2 |= TG3_FLG2_SUN_570X;
-#endif
-
        /* Force memory write invalidate off.  If we leave it on,
         * then on 5700_BX chips we have to enable a workaround.
         * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary
@@ -10306,8 +10267,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
        if (tp->write32 == tg3_write_indirect_reg32 ||
            ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
             (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
-             GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)) ||
-           (tp->tg3_flags2 & TG3_FLG2_SUN_570X))
+             GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)))
                tp->tg3_flags |= TG3_FLAG_SRAM_USE_CONFIG;
 
        /* Get eeprom hw config before calling tg3_set_power_state().
@@ -10588,8 +10548,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
 #endif
 
        mac_offset = 0x7c;
-       if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
-            !(tp->tg3_flags & TG3_FLG2_SUN_570X)) ||
+       if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
            (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) {
                if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID)
                        mac_offset = 0xcc;
@@ -10616,8 +10575,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp)
        }
        if (!addr_ok) {
                /* Next, try NVRAM. */
-               if (!(tp->tg3_flags & TG3_FLG2_SUN_570X) &&
-                   !tg3_nvram_read(tp, mac_offset + 0, &hi) &&
+               if (!tg3_nvram_read(tp, mac_offset + 0, &hi) &&
                    !tg3_nvram_read(tp, mac_offset + 4, &lo)) {
                        dev->dev_addr[0] = ((hi >> 16) & 0xff);
                        dev->dev_addr[1] = ((hi >> 24) & 0xff);
index 0e29b885d449d7cafcdcbae7f8311b9df39796a6..ff0faab94bd52ce6ea2af167471b144ae7008f78 100644 (file)
@@ -2184,7 +2184,7 @@ struct tg3 {
 #define TG3_FLAG_INIT_COMPLETE         0x80000000
        u32                             tg3_flags2;
 #define TG3_FLG2_RESTART_TIMER         0x00000001
-#define TG3_FLG2_SUN_570X              0x00000002
+/*                                     0x00000002 available */
 #define TG3_FLG2_NO_ETH_WIRE_SPEED     0x00000004
 #define TG3_FLG2_IS_5788               0x00000008
 #define TG3_FLG2_MAX_RXPEND_64         0x00000010
@@ -2216,6 +2216,7 @@ struct tg3 {
 #define TG3_FLG2_HW_TSO                        (TG3_FLG2_HW_TSO_1 | TG3_FLG2_HW_TSO_2)
 #define TG3_FLG2_1SHOT_MSI             0x10000000
 #define TG3_FLG2_PHY_JITTER_BUG                0x20000000
+#define TG3_FLG2_NO_FWARE_REPORTED     0x40000000
 
        u32                             split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ                3
index ba05dedf29d3396fa08d30c15c240535e6d64b6d..136a70c4d5e4880c442cfd75bf5f6450a621cfb9 100644 (file)
@@ -850,7 +850,7 @@ static void init_rxtx_rings(struct net_device *dev)
                        break;
                skb->dev = dev;                 /* Mark as being used by this device. */
                np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data,
-                                       skb->len,PCI_DMA_FROMDEVICE);
+                                       np->rx_buf_sz,PCI_DMA_FROMDEVICE);
 
                np->rx_ring[i].buffer1 = np->rx_addr[i];
                np->rx_ring[i].status = DescOwn;
@@ -1316,7 +1316,7 @@ static int netdev_rx(struct net_device *dev)
                        skb->dev = dev;                 /* Mark as being used by this device. */
                        np->rx_addr[entry] = pci_map_single(np->pci_dev,
                                                        skb->data,
-                                                       skb->len, PCI_DMA_FROMDEVICE);
+                                                       np->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        np->rx_ring[entry].buffer1 = np->rx_addr[entry];
                }
                wmb();
index a6dc53b4250d83924fa388681697a948e582ade5..fdc21037f6dcf8204bf8950e7d294527312c1091 100644 (file)
@@ -491,8 +491,6 @@ struct rhine_private {
        u8 tx_thresh, rx_thresh;
 
        struct mii_if_info mii_if;
-       struct work_struct tx_timeout_task;
-       struct work_struct check_media_task;
        void __iomem *base;
 };
 
@@ -500,8 +498,6 @@ static int  mdio_read(struct net_device *dev, int phy_id, int location);
 static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
 static int  rhine_open(struct net_device *dev);
 static void rhine_tx_timeout(struct net_device *dev);
-static void rhine_tx_timeout_task(struct net_device *dev);
-static void rhine_check_media_task(struct net_device *dev);
 static int  rhine_start_tx(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
 static void rhine_tx(struct net_device *dev);
@@ -856,12 +852,6 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
        if (rp->quirks & rqRhineI)
                dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
 
-       INIT_WORK(&rp->tx_timeout_task,
-                 (void (*)(void *))rhine_tx_timeout_task, dev);
-
-       INIT_WORK(&rp->check_media_task,
-                 (void (*)(void *))rhine_check_media_task, dev);
-
        /* dev->name not defined before register_netdev()! */
        rc = register_netdev(dev);
        if (rc)
@@ -1108,11 +1098,6 @@ static void rhine_set_carrier(struct mii_if_info *mii)
                       netif_carrier_ok(mii->dev));
 }
 
-static void rhine_check_media_task(struct net_device *dev)
-{
-       rhine_check_media(dev, 0);
-}
-
 static void init_registers(struct net_device *dev)
 {
        struct rhine_private *rp = netdev_priv(dev);
@@ -1166,8 +1151,8 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks)
        if (quirks & rqRhineI) {
                iowrite8(0x01, ioaddr + MIIRegAddr);    // MII_BMSR
 
-               /* Do not call from ISR! */
-               msleep(1);
+               /* Can be called from ISR. Evil. */
+               mdelay(1);
 
                /* 0x80 must be set immediately before turning it off */
                iowrite8(0x80, ioaddr + MIICmd);
@@ -1255,16 +1240,6 @@ static int rhine_open(struct net_device *dev)
 }
 
 static void rhine_tx_timeout(struct net_device *dev)
-{
-       struct rhine_private *rp = netdev_priv(dev);
-
-       /*
-        * Move bulk of work outside of interrupt context
-        */
-       schedule_work(&rp->tx_timeout_task);
-}
-
-static void rhine_tx_timeout_task(struct net_device *dev)
 {
        struct rhine_private *rp = netdev_priv(dev);
        void __iomem *ioaddr = rp->base;
@@ -1677,7 +1652,7 @@ static void rhine_error(struct net_device *dev, int intr_status)
        spin_lock(&rp->lock);
 
        if (intr_status & IntrLinkChange)
-               schedule_work(&rp->check_media_task);
+               rhine_check_media(dev, 0);
        if (intr_status & IntrStatsMax) {
                rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
                rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
@@ -1927,9 +1902,6 @@ static int rhine_close(struct net_device *dev)
        spin_unlock_irq(&rp->lock);
 
        free_irq(rp->pdev->irq, dev);
-
-       flush_scheduled_work();
-
        free_rbufs(dev);
        free_tbufs(dev);
        free_ring(dev);
index 0e1ac338cac1a7283e46d4b7145ce7864550edfc..bed6823d980906908da6ecb1b608c7ec5fa32816 100644 (file)
@@ -1838,7 +1838,7 @@ struct net_device * __init arlan_probe(int unit)
 }
 
 #ifdef  MODULE
-int init_module(void)
+int __init init_module(void)
 {
        int i = 0;
 
@@ -1860,7 +1860,7 @@ int init_module(void)
 }
 
 
-void cleanup_module(void)
+void __exit cleanup_module(void)
 {
        int i = 0;
        struct net_device *dev;
index bbecba02e69775671187f84b9e19611f9c00fe19..d0318e525ba767d12016d429ab8ca967569ea57c 100644 (file)
@@ -624,25 +624,28 @@ err_destroy_tx0:
 static u16 generate_cookie(struct bcm43xx_dmaring *ring,
                           int slot)
 {
-       u16 cookie = 0x0000;
+       u16 cookie = 0xF000;
 
        /* Use the upper 4 bits of the cookie as
         * DMA controller ID and store the slot number
-        * in the lower 12 bits
+        * in the lower 12 bits.
+        * Note that the cookie must never be 0, as this
+        * is a special value used in RX path.
         */
        switch (ring->mmio_base) {
        default:
                assert(0);
        case BCM43xx_MMIO_DMA1_BASE:
+               cookie = 0xA000;
                break;
        case BCM43xx_MMIO_DMA2_BASE:
-               cookie = 0x1000;
+               cookie = 0xB000;
                break;
        case BCM43xx_MMIO_DMA3_BASE:
-               cookie = 0x2000;
+               cookie = 0xC000;
                break;
        case BCM43xx_MMIO_DMA4_BASE:
-               cookie = 0x3000;
+               cookie = 0xD000;
                break;
        }
        assert(((u16)slot & 0xF000) == 0x0000);
@@ -660,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm,
        struct bcm43xx_dmaring *ring = NULL;
 
        switch (cookie & 0xF000) {
-       case 0x0000:
+       case 0xA000:
                ring = dma->tx_ring0;
                break;
-       case 0x1000:
+       case 0xB000:
                ring = dma->tx_ring1;
                break;
-       case 0x2000:
+       case 0xC000:
                ring = dma->tx_ring2;
                break;
-       case 0x3000:
+       case 0xD000:
                ring = dma->tx_ring3;
                break;
        default:
@@ -839,8 +842,18 @@ static void dma_rx(struct bcm43xx_dmaring *ring,
                /* We received an xmit status. */
                struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data;
                struct bcm43xx_xmitstatus stat;
+               int i = 0;
 
                stat.cookie = le16_to_cpu(hw->cookie);
+               while (stat.cookie == 0) {
+                       if (unlikely(++i >= 10000)) {
+                               assert(0);
+                               break;
+                       }
+                       udelay(2);
+                       barrier();
+                       stat.cookie = le16_to_cpu(hw->cookie);
+               }
                stat.flags = hw->flags;
                stat.cnt1 = hw->cnt1;
                stat.cnt2 = hw->cnt2;
index e2982a83ae424c8f7ea999239f4f61f70da2bab2..7ed18cad29f75632b6408e72bd258ec25af05eb6 100644 (file)
@@ -3271,6 +3271,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
        bcm43xx_sysfs_register(bcm);
        //FIXME: check for bcm43xx_sysfs_register failure. This function is a bit messy regarding unwinding, though...
 
+       /*FIXME: This should be handled by softmac instead. */
+       schedule_work(&bcm->softmac->associnfo.work);
+
        assert(err == 0);
 out:
        return err;
@@ -3946,9 +3949,6 @@ static int bcm43xx_resume(struct pci_dev *pdev)
 
        netif_device_attach(net_dev);
        
-       /*FIXME: This should be handled by softmac instead. */
-       schedule_work(&bcm->softmac->associnfo.work);
-
        dprintk(KERN_INFO PFX "Device resumed.\n");
 
        return 0;
index 06523e2a8471f0be0a3fd5e2ef09625283667596..c2d0b09e0418e1955c452248bb65686d8ed0d70e 100644 (file)
@@ -812,7 +812,6 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
        if (datalen > IEEE80211_DATA_LEN + 12) {
                printk(KERN_DEBUG "%s: oversized monitor frame, "
                       "data length = %d\n", dev->name, datalen);
-               err = -EIO;
                stats->rx_length_errors++;
                goto update_stats;
        }
@@ -821,8 +820,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
        if (!skb) {
                printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n",
                       dev->name);
-               err = -ENOMEM;
-               goto drop;
+               goto update_stats;
        }
 
        /* Copy the 802.11 header to the skb */
index ff192e96268a1c69519a3c35aac6386bec35ed10..dade4b903579fe2d8f06f03cd3d9fe9c590d48fa 100644 (file)
@@ -4306,7 +4306,7 @@ out:
  * Insertion of the module
  * I'm now quite proud of the multi-device support.
  */
-int init_module(void)
+int __init init_module(void)
 {
        int ret = -EIO;         /* Return error if no cards found */
        int i;
index 6917c6cb091287a407a6274fa7ebdd382237bed5..c2ecae5ff0c17623917f0b365d7fd9e278be90a2 100644 (file)
@@ -33,13 +33,10 @@ acpi_query_osc (
        acpi_status             status;
        struct acpi_object_list input;
        union acpi_object       in_params[4];
-       struct acpi_buffer      output;
-       union acpi_object       out_obj;        
+       struct acpi_buffer      output = {ACPI_ALLOCATE_BUFFER, NULL};
+       union acpi_object       *out_obj;
        u32                     osc_dw0;
 
-       /* Setting up output buffer */
-       output.length = sizeof(out_obj) + 3*sizeof(u32);  
-       output.pointer = &out_obj;
        
        /* Setting up input parameters */
        input.count = 4;
@@ -61,12 +58,15 @@ acpi_query_osc (
                        "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
                return status;
        }
-       if (out_obj.type != ACPI_TYPE_BUFFER) {
+       out_obj = output.pointer;
+
+       if (out_obj->type != ACPI_TYPE_BUFFER) {
                printk(KERN_DEBUG  
                        "Evaluate _OSC returns wrong type\n");
-               return AE_TYPE;
+               status = AE_TYPE;
+               goto query_osc_out;
        }
-       osc_dw0 = *((u32 *) out_obj.buffer.pointer);
+       osc_dw0 = *((u32 *) out_obj->buffer.pointer);
        if (osc_dw0) {
                if (osc_dw0 & OSC_REQUEST_ERROR)
                        printk(KERN_DEBUG "_OSC request fails\n"); 
@@ -76,15 +76,21 @@ acpi_query_osc (
                        printk(KERN_DEBUG "_OSC invalid revision\n"); 
                if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) {
                        /* Update Global Control Set */
-                       global_ctrlsets = *((u32 *)(out_obj.buffer.pointer+8));
-                       return AE_OK;
+                       global_ctrlsets = *((u32 *)(out_obj->buffer.pointer+8));
+                       status = AE_OK;
+                       goto query_osc_out;
                }
-               return AE_ERROR;
+               status = AE_ERROR;
+               goto query_osc_out;
        }
 
        /* Update Global Control Set */
-       global_ctrlsets = *((u32 *)(out_obj.buffer.pointer + 8));
-       return AE_OK;
+       global_ctrlsets = *((u32 *)(out_obj->buffer.pointer + 8));
+       status = AE_OK;
+
+query_osc_out:
+       kfree(output.pointer);
+       return status;
 }
 
 
@@ -96,14 +102,10 @@ acpi_run_osc (
        acpi_status             status;
        struct acpi_object_list input;
        union acpi_object       in_params[4];
-       struct acpi_buffer      output;
-       union acpi_object       out_obj;        
+       struct acpi_buffer      output = {ACPI_ALLOCATE_BUFFER, NULL};
+       union acpi_object       *out_obj;
        u32                     osc_dw0;
 
-       /* Setting up output buffer */
-       output.length = sizeof(out_obj) + 3*sizeof(u32);  
-       output.pointer = &out_obj;
-       
        /* Setting up input parameters */
        input.count = 4;
        input.pointer = in_params;
@@ -124,12 +126,14 @@ acpi_run_osc (
                        "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
                return status;
        }
-       if (out_obj.type != ACPI_TYPE_BUFFER) {
+       out_obj = output.pointer;
+       if (out_obj->type != ACPI_TYPE_BUFFER) {
                printk(KERN_DEBUG  
                        "Evaluate _OSC returns wrong type\n");
-               return AE_TYPE;
+               status = AE_TYPE;
+               goto run_osc_out;
        }
-       osc_dw0 = *((u32 *) out_obj.buffer.pointer);
+       osc_dw0 = *((u32 *) out_obj->buffer.pointer);
        if (osc_dw0) {
                if (osc_dw0 & OSC_REQUEST_ERROR)
                        printk(KERN_DEBUG "_OSC request fails\n"); 
@@ -139,11 +143,17 @@ acpi_run_osc (
                        printk(KERN_DEBUG "_OSC invalid revision\n"); 
                if (osc_dw0 & OSC_CAPABILITIES_MASK_ERROR) {
                        printk(KERN_DEBUG "_OSC FW not grant req. control\n");
-                       return AE_SUPPORT;
+                       status = AE_SUPPORT;
+                       goto run_osc_out;
                }
-               return AE_ERROR;
+               status = AE_ERROR;
+               goto run_osc_out;
        }
-       return AE_OK;
+       status = AE_OK;
+
+run_osc_out:
+       kfree(output.pointer);
+       return status;
 }
 
 /**
index 1456759936c59410f0af1aaab1d91d81c4e5f34f..10e1a905c1444a8463b998e80e3930ff97034192 100644 (file)
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
  * Default resume method for devices that have no driver provided resume,
  * or not even a driver at all.
  */
-static void pci_default_resume(struct pci_dev *pci_dev)
+static int pci_default_resume(struct pci_dev *pci_dev)
 {
-       int retval;
+       int retval = 0;
 
        /* restore the PCI config space */
        pci_restore_state(pci_dev);
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev)
        /* if the device was busmaster before the suspend, make it busmaster again */
        if (pci_dev->is_busmaster)
                pci_set_master(pci_dev);
+
+       return retval;
 }
 
 static int pci_device_resume(struct device * dev)
 {
+       int error;
        struct pci_dev * pci_dev = to_pci_dev(dev);
        struct pci_driver * drv = pci_dev->driver;
 
        if (drv && drv->resume)
-               drv->resume(pci_dev);
+               error = drv->resume(pci_dev);
        else
-               pci_default_resume(pci_dev);
-       return 0;
+               error = pci_default_resume(pci_dev);
+       return error;
 }
 
 static void pci_device_shutdown(struct device *dev)
index 2329f941a0dcd11fa1f18c13f5129347c91581f7..12286275b1c81ce3029f3dbd3e9f8127e495c4ea 100644 (file)
@@ -461,9 +461,23 @@ int
 pci_restore_state(struct pci_dev *dev)
 {
        int i;
+       int val;
 
-       for (i = 0; i < 16; i++)
-               pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
+       /*
+        * The Base Address register should be programmed before the command
+        * register(s)
+        */
+       for (i = 15; i >= 0; i--) {
+               pci_read_config_dword(dev, i * 4, &val);
+               if (val != dev->saved_config_space[i]) {
+                       printk(KERN_DEBUG "PM: Writing back config space on "
+                               "device %s at offset %x (was %x, writing %x)\n",
+                               pci_name(dev), i,
+                               val, (int)dev->saved_config_space[i]);
+                       pci_write_config_dword(dev,i * 4,
+                               dev->saved_config_space[i]);
+               }
+       }
        pci_restore_msi_state(dev);
        pci_restore_msix_state(dev);
        return 0;
index 19e2b174d33cc777bf38d506bc82f96121d1fb1b..d378478612fb76d862b4b584aff1cc14b190f228 100644 (file)
@@ -634,6 +634,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4,     quirk_vi
  * non-x86 architectures (yes Via exists on PPC among other places),
  * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get
  * interrupts delivered properly.
+ *
+ * Some of the on-chip devices are actually '586 devices' so they are
+ * listed here.
  */
 static void quirk_via_irq(struct pci_dev *dev)
 {
@@ -648,6 +651,10 @@ static void quirk_via_irq(struct pci_dev *dev)
                pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
        }
 }
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq);
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
@@ -895,6 +902,7 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
 
+#ifndef CONFIG_ACPI_SLEEP
 /*
  * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
  * is not activated. The myth is that Asus said that they do not want the
@@ -906,8 +914,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
  * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 
  * becomes necessary to do this tweak in two steps -- I've chosen the Host
  * bridge as trigger.
+ *
+ * Actually, leaving it unhidden and not redoing the quirk over suspend2ram
+ * will cause thermal management to break down, and causing machine to
+ * overheat.
  */
-static int __initdata asus_hides_smbus = 0;
+static int __initdata asus_hides_smbus;
 
 static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
 {
@@ -1050,6 +1062,8 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,  PCI_DEVICE_ID_INTEL_ICH6_1,     asus_hides_smbus_lpc_ich6 );
 
+#endif
+
 /*
  * SiS 96x south bridge: BIOS typically hides SMBus device...
  */
index 48d3b3d30c2169231d6749f7478bab8a0d3b50b9..74b3124e8247e444fd2911eecfe0de1ca5597063 100644 (file)
@@ -1143,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
 {
        struct pcmcia_socket *s = pcmcia_get_socket(skt);
 
+       if (!s) {
+               printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \
+                       "failed, event 0x%x lost!\n", skt, event);
+               return -ENODEV;
+       }
+
        ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n",
               event, priority, skt);
 
index c53db7ceda5e2ab12770964dc18216fa819ab4c8..738b1ef595a3506fd595f9f742da4c6f966b7e47 100644 (file)
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file)
 
     if (!warning_printed) {
            printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl "
-                       "usage.\n");
+                       "usage from process: %s.\n", current->comm);
            printk(KERN_INFO "pcmcia: This interface will soon be removed from "
                        "the kernel; please expect breakage unless you upgrade "
                        "to new tools.\n");
@@ -601,8 +601,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
            ret = CS_BAD_ARGS;
        else {
            struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
-           ret = pccard_get_configuration_info(s, p_dev, &buf->config);
-           pcmcia_put_dev(p_dev);
+           if (p_dev == NULL)
+                   ret = CS_BAD_ARGS;
+           else {
+                   ret = pccard_get_configuration_info(s, p_dev, &buf->config);
+                   pcmcia_put_dev(p_dev);
+           }
        }
        break;
     case DS_GET_FIRST_TUPLE:
@@ -632,8 +636,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
                    ret = CS_BAD_ARGS;
            else {
                    struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
-                   ret = pccard_get_status(s, p_dev, &buf->status);
-                   pcmcia_put_dev(p_dev);
+                   if (p_dev == NULL)
+                           ret = CS_BAD_ARGS;
+                   else {
+                           ret = pccard_get_status(s, p_dev, &buf->status);
+                           pcmcia_put_dev(p_dev);
+                   }
            }
            break;
     case DS_VALIDATE_CIS:
@@ -665,9 +673,10 @@ static int ds_ioctl(struct inode * inode, struct file * file,
        if (!(buf->conf_reg.Function &&
             (buf->conf_reg.Function >= s->functions))) {
                struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function);
-               if (p_dev)
+               if (p_dev) {
                        ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg);
-               pcmcia_put_dev(p_dev);
+                       pcmcia_put_dev(p_dev);
+               }
        }
        break;
     case DS_GET_FIRST_REGION:
index 16d1ea7b0a18ae0edadea084b891ad3c2797711c..247ab837f841739f0982c51ecd937692d841f5ef 100644 (file)
@@ -589,7 +589,7 @@ static int pd6729_check_irq(int irq, int flags)
        return 0;
 }
 
-static u_int __init pd6729_isa_scan(void)
+static u_int __devinit pd6729_isa_scan(void)
 {
        u_int mask0, mask = 0;
        int i;
index 407b4eaddcbffe6202ae40623430f9f638b23cb2..3a4a644c26869bbf7b6ce10820fe65e0fb437c9c 100644 (file)
@@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity)
 {
        int flag;
        if (triggering == ACPI_LEVEL_SENSITIVE) {
-               if(polarity == ACPI_ACTIVE_LOW)
+               if (polarity == ACPI_ACTIVE_LOW)
                        flag = IORESOURCE_IRQ_LOWLEVEL;
                else
                        flag = IORESOURCE_IRQ_HIGHLEVEL;
        }
        else {
-               if(polarity == ACPI_ACTIVE_LOW)
+               if (polarity == ACPI_ACTIVE_LOW)
                        flag = IORESOURCE_IRQ_LOWEDGE;
                else
                        flag = IORESOURCE_IRQ_HIGHEDGE;
@@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
                *triggering = ACPI_LEVEL_SENSITIVE;
                *polarity = ACPI_ACTIVE_LOW;
                break;
-       case IORESOURCE_IRQ_HIGHLEVEL:  
+       case IORESOURCE_IRQ_HIGHLEVEL:
                *triggering = ACPI_LEVEL_SENSITIVE;
                *polarity = ACPI_ACTIVE_HIGH;
                break;
@@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
        int triggering, int polarity)
 {
        int i = 0;
@@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
 {
        int i = 0;
        while (i < PNP_MAX_DMA &&
@@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 }
 
 static void
-pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-       u32 io, u32 len)
+pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
+       u64 io, u64 len)
 {
        int i = 0;
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
 }
 
 static void
-pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
+pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
        u64 mem, u64 len)
 {
        int i = 0;
@@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
        }
 }
 
+static void
+pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
+       struct acpi_resource *res)
+{
+       struct acpi_resource_address64 addr, *p = &addr;
+       acpi_status status;
+
+       status = acpi_resource_to_address64(res, p);
+       if (!ACPI_SUCCESS(status)) {
+               pnp_warn("PnPACPI: failed to convert resource type %d",
+                       res->type);
+               return;
+       }
+
+       if (p->resource_type == ACPI_MEMORY_RANGE)
+               pnpacpi_parse_allocated_memresource(res_table,
+                               p->minimum, p->address_length);
+       else if (p->resource_type == ACPI_IO_RANGE)
+               pnpacpi_parse_allocated_ioresource(res_table,
+                               p->minimum, p->address_length);
+}
 
 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        void *data)
 {
-       struct pnp_resource_table * res_table = (struct pnp_resource_table *)data;
+       struct pnp_resource_table *res_table = (struct pnp_resource_table *)data;
        int i;
 
        switch (res->type) {
@@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
                                res->data.fixed_memory32.address_length);
                break;
        case ACPI_RESOURCE_TYPE_ADDRESS16:
-               pnpacpi_parse_allocated_memresource(res_table,
-                               res->data.address16.minimum,
-                               res->data.address16.address_length);
-               break;
        case ACPI_RESOURCE_TYPE_ADDRESS32:
-               pnpacpi_parse_allocated_memresource(res_table,
-                               res->data.address32.minimum,
-                               res->data.address32.address_length);
-               break;
        case ACPI_RESOURCE_TYPE_ADDRESS64:
-               pnpacpi_parse_allocated_memresource(res_table,
-               res->data.address64.minimum,
-               res->data.address64.address_length);
+               pnpacpi_parse_allocated_address_space(res_table, res);
                break;
 
        case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
@@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
                pnp_warn("PnPACPI: unknown resource type %d", res->type);
                return AE_ERROR;
        }
-                       
+
        return AE_OK;
 }
 
-acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res)
+acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res)
 {
        /* Blank the resource table values */
        pnp_init_resource_table(res);
@@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
                pnp_err("Invalid DMA transfer type");
        }
 
-       pnp_register_dma_resource(option,dma);
+       pnp_register_dma_resource(option, dma);
        return;
 }
 
-       
+
 static void pnpacpi_parse_irq_option(struct pnp_option *option,
        struct acpi_resource_irq *p)
 {
        int i;
-       struct pnp_irq * irq;
-       
+       struct pnp_irq *irq;
+
        if (p->interrupt_count == 0)
                return;
        irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
@@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
        struct acpi_resource_extended_irq *p)
 {
        int i;
-       struct pnp_irq * irq;
+       struct pnp_irq *irq;
 
        if (p->interrupt_count == 0)
                return;
@@ -368,7 +379,7 @@ static void
 pnpacpi_parse_port_option(struct pnp_option *option,
        struct acpi_resource_io *io)
 {
-       struct pnp_port * port;
+       struct pnp_port *port;
 
        if (io->address_length == 0)
                return;
@@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_option *option,
        port->size = io->address_length;
        port->flags = ACPI_DECODE_16 == io->io_decode ?
                PNP_PORT_FLAG_16BITADDR : 0;
-       pnp_register_port_resource(option,port);
+       pnp_register_port_resource(option, port);
        return;
 }
 
@@ -389,7 +400,7 @@ static void
 pnpacpi_parse_fixed_port_option(struct pnp_option *option,
        struct acpi_resource_fixed_io *io)
 {
-       struct pnp_port * port;
+       struct pnp_port *port;
 
        if (io->address_length == 0)
                return;
@@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
        port->size = io->address_length;
        port->align = 0;
        port->flags = PNP_PORT_FLAG_FIXED;
-       pnp_register_port_resource(option,port);
+       pnp_register_port_resource(option, port);
        return;
 }
 
@@ -408,7 +419,7 @@ static void
 pnpacpi_parse_mem24_option(struct pnp_option *option,
        struct acpi_resource_memory24 *p)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
 
        if (p->address_length == 0)
                return;
@@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
                        IORESOURCE_MEM_WRITEABLE : 0;
 
-       pnp_register_mem_resource(option,mem);
+       pnp_register_mem_resource(option, mem);
        return;
 }
 
@@ -431,7 +442,7 @@ static void
 pnpacpi_parse_mem32_option(struct pnp_option *option,
        struct acpi_resource_memory32 *p)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
 
        if (p->address_length == 0)
                return;
@@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
                        IORESOURCE_MEM_WRITEABLE : 0;
 
-       pnp_register_mem_resource(option,mem);
+       pnp_register_mem_resource(option, mem);
        return;
 }
 
@@ -454,7 +465,7 @@ static void
 pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
        struct acpi_resource_fixed_memory32 *p)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
 
        if (p->address_length == 0)
                return;
@@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
                        IORESOURCE_MEM_WRITEABLE : 0;
 
-       pnp_register_mem_resource(option,mem);
+       pnp_register_mem_resource(option, mem);
        return;
 }
 
@@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
 {
        struct acpi_resource_address64 addr, *p = &addr;
        acpi_status status;
-       struct pnp_mem * mem;
-       struct pnp_port * port;
+       struct pnp_mem *mem;
+       struct pnp_port *port;
 
        status = acpi_resource_to_address64(r, p);
        if (!ACPI_SUCCESS(status)) {
@@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
                mem->align = 0;
                mem->flags = (p->info.mem.write_protect ==
                    ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0;
-               pnp_register_mem_resource(option,mem);
+               pnp_register_mem_resource(option, mem);
        } else if (p->resource_type == ACPI_IO_RANGE) {
                port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
                if (!port)
@@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
                port->size = p->address_length;
                port->align = 0;
                port->flags = PNP_PORT_FLAG_FIXED;
-               pnp_register_port_resource(option,port);
+               pnp_register_port_resource(option, port);
        }
 }
 
@@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
                        break;
 
                case ACPI_RESOURCE_TYPE_DMA:
-                       pnpacpi_parse_dma_option(option, &res->data.dma);       
+                       pnpacpi_parse_dma_option(option, &res->data.dma);
                        break;
 
                case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
                                case ACPI_GOOD_CONFIGURATION:
                                        priority = PNP_RES_PRIORITY_PREFERRED;
                                        break;
-                                       
+
                                case ACPI_ACCEPTABLE_CONFIGURATION:
                                        priority = PNP_RES_PRIORITY_ACCEPTABLE;
                                        break;
@@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
                        option = pnp_register_dependent_option(dev, priority);
                        if (!option)
                                return AE_ERROR;
-                       parse_data->option = option;    
+                       parse_data->option = option;
                        break;
 
                case ACPI_RESOURCE_TYPE_END_DEPENDENT:
@@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
                        pnp_warn("PnPACPI: unknown resource type %d", res->type);
                        return AE_ERROR;
        }
-                       
+
        return AE_OK;
 }
 
@@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
        return status;
 }
 
-/*
- * Set resource
- */
-static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
-       void *data)
+static int pnpacpi_supported_resource(struct acpi_resource *res)
 {
-       int *res_cnt = (int *)data;
        switch (res->type) {
        case ACPI_RESOURCE_TYPE_IRQ:
        case ACPI_RESOURCE_TYPE_DMA:
@@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
        case ACPI_RESOURCE_TYPE_ADDRESS32:
        case ACPI_RESOURCE_TYPE_ADDRESS64:
        case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
-               (*res_cnt) ++;
-       case ACPI_RESOURCE_TYPE_START_DEPENDENT:
-       case ACPI_RESOURCE_TYPE_END_DEPENDENT:
-       case ACPI_RESOURCE_TYPE_VENDOR:
-       case ACPI_RESOURCE_TYPE_END_TAG:
-       case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
-       default:
-               return AE_OK;
+               return 1;
        }
-       return AE_OK;
+       return 0;
 }
 
-static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
+/*
+ * Set resource
+ */
+static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
        void *data)
 {
-       struct acpi_resource **resource = (struct acpi_resource **)data;        
-       switch (res->type) {
-       case ACPI_RESOURCE_TYPE_IRQ:
-       case ACPI_RESOURCE_TYPE_DMA:
-       case ACPI_RESOURCE_TYPE_IO:
-       case ACPI_RESOURCE_TYPE_FIXED_IO:
-       case ACPI_RESOURCE_TYPE_MEMORY24:
-       case ACPI_RESOURCE_TYPE_MEMORY32:
-       case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
-       case ACPI_RESOURCE_TYPE_ADDRESS16:
-       case ACPI_RESOURCE_TYPE_ADDRESS32:
-       case ACPI_RESOURCE_TYPE_ADDRESS64:
-       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+       int *res_cnt = (int *)data;
+
+       if (pnpacpi_supported_resource(res))
+               (*res_cnt)++;
+       return AE_OK;
+}
+
+static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
+{
+       struct acpi_resource **resource = (struct acpi_resource **)data;
+
+       if (pnpacpi_supported_resource(res)) {
                (*resource)->type = res->type;
+               (*resource)->length = sizeof(struct acpi_resource);
                (*resource)++;
-       case ACPI_RESOURCE_TYPE_START_DEPENDENT:
-       case ACPI_RESOURCE_TYPE_END_DEPENDENT:
-       case ACPI_RESOURCE_TYPE_VENDOR:
-       case ACPI_RESOURCE_TYPE_END_TAG:
-       case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
-       default:
-               return AE_OK;
        }
 
        return AE_OK;
@@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource,
        struct resource *p)
 {
        int triggering, polarity;
-       
-       decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
-               &polarity);
-       resource->type = ACPI_RESOURCE_TYPE_IRQ;
-       resource->length = sizeof(struct acpi_resource);
+
+       decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity);
        resource->data.irq.triggering = triggering;
        resource->data.irq.polarity = polarity;
        if (triggering == ACPI_EDGE_SENSITIVE)
@@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
        struct resource *p)
 {
        int triggering, polarity;
-       
-       decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
-               &polarity);
-       resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
-       resource->length = sizeof(struct acpi_resource);
+
+       decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity);
        resource->data.extended_irq.producer_consumer = ACPI_CONSUMER;
        resource->data.extended_irq.triggering = triggering;
        resource->data.extended_irq.polarity = polarity;
@@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
 static void pnpacpi_encode_dma(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_DMA;
-       resource->length = sizeof(struct acpi_resource);
        /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
        if (p->flags & IORESOURCE_DMA_COMPATIBLE)
                resource->data.dma.type = ACPI_COMPATIBILITY;
@@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
 static void pnpacpi_encode_io(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_IO;
-       resource->length = sizeof(struct acpi_resource);
        /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */
        resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)?
                ACPI_DECODE_16 : ACPI_DECODE_10;
@@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acpi_resource *resource,
 static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
-       resource->length = sizeof(struct acpi_resource);
        resource->data.fixed_io.address = p->start;
        resource->data.fixed_io.address_length = p->end - p->start + 1;
 }
@@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
 static void pnpacpi_encode_mem24(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
-       resource->length = sizeof(struct acpi_resource);
        /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
        resource->data.memory24.write_protect =
                (p->flags & IORESOURCE_MEM_WRITEABLE) ?
@@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource,
 static void pnpacpi_encode_mem32(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
-       resource->length = sizeof(struct acpi_resource);
        resource->data.memory32.write_protect =
                (p->flags & IORESOURCE_MEM_WRITEABLE) ?
                ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
@@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource,
 static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
        struct resource *p)
 {
-       resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
-       resource->length = sizeof(struct acpi_resource);
        resource->data.fixed_memory32.write_protect =
                (p->flags & IORESOURCE_MEM_WRITEABLE) ?
                ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
@@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
                        pnp_dbg("Encode dma");
                        pnpacpi_encode_dma(resource,
                                &res_table->dma_resource[dma]);
-                       dma ++;
+                       dma++;
                        break;
                case ACPI_RESOURCE_TYPE_IO:
                        pnp_dbg("Encode io");
                        pnpacpi_encode_io(resource,
                                &res_table->port_resource[port]);
-                       port ++;
+                       port++;
                        break;
                case ACPI_RESOURCE_TYPE_FIXED_IO:
                        pnp_dbg("Encode fixed io");
                        pnpacpi_encode_fixed_io(resource,
                                &res_table->port_resource[port]);
-                       port ++;
+                       port++;
                        break;
                case ACPI_RESOURCE_TYPE_MEMORY24:
                        pnp_dbg("Encode mem24");
                        pnpacpi_encode_mem24(resource,
                                &res_table->mem_resource[mem]);
-                       mem ++;
+                       mem++;
                        break;
                case ACPI_RESOURCE_TYPE_MEMORY32:
                        pnp_dbg("Encode mem32");
                        pnpacpi_encode_mem32(resource,
                                &res_table->mem_resource[mem]);
-                       mem ++;
+                       mem++;
                        break;
                case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
                        pnp_dbg("Encode fixed mem32");
                        pnpacpi_encode_fixed_mem32(resource,
                                &res_table->mem_resource[mem]);
-                       mem ++;
+                       mem++;
                        break;
                case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                        pnp_dbg("Encode ext irq");
@@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
                        pnp_warn("unknown resource type %d", resource->type);
                        return -EINVAL;
                }
-               resource ++;
-               i ++;
+               resource++;
+               i++;
        }
        return 0;
 }
index 6c9ad92747fddd2c35061c5e49a4bcc1ad04e2cd..2011567005f99a55b5072b1b7600fc616a1bd5a7 100644 (file)
@@ -141,13 +141,13 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
        /* try the driver's ioctl interface */
        if (ops->ioctl) {
                err = ops->ioctl(class_dev->dev, cmd, arg);
-               if (err != -EINVAL)
+               if (err != -ENOIOCTLCMD)
                        return err;
        }
 
        /* if the driver does not provide the ioctl interface
         * or if that particular ioctl was not implemented
-        * (-EINVAL), we will try to emulate here.
+        * (-ENOIOCTLCMD), we will try to emulate here.
         */
 
        switch (cmd) {
@@ -233,7 +233,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
                break;
 
        default:
-               err = -EINVAL;
+               err = -ENOTTY;
                break;
        }
 
index f6e7ee04f3dc634002383f84438db3ad937b91c5..8c0d1a6739adb23012a1c92bf9a102898b9a94cf 100644 (file)
@@ -48,33 +48,33 @@ static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
        struct platform_device *pdev = to_platform_device(dev);
        struct m48t86_ops *ops = pdev->dev.platform_data;
 
-       reg = ops->readb(M48T86_REG_B);
+       reg = ops->readbyte(M48T86_REG_B);
 
        if (reg & M48T86_REG_B_DM) {
                /* data (binary) mode */
-               tm->tm_sec      = ops->readb(M48T86_REG_SEC);
-               tm->tm_min      = ops->readb(M48T86_REG_MIN);
-               tm->tm_hour     = ops->readb(M48T86_REG_HOUR) & 0x3F;
-               tm->tm_mday     = ops->readb(M48T86_REG_DOM);
+               tm->tm_sec      = ops->readbyte(M48T86_REG_SEC);
+               tm->tm_min      = ops->readbyte(M48T86_REG_MIN);
+               tm->tm_hour     = ops->readbyte(M48T86_REG_HOUR) & 0x3F;
+               tm->tm_mday     = ops->readbyte(M48T86_REG_DOM);
                /* tm_mon is 0-11 */
-               tm->tm_mon      = ops->readb(M48T86_REG_MONTH) - 1;
-               tm->tm_year     = ops->readb(M48T86_REG_YEAR) + 100;
-               tm->tm_wday     = ops->readb(M48T86_REG_DOW);
+               tm->tm_mon      = ops->readbyte(M48T86_REG_MONTH) - 1;
+               tm->tm_year     = ops->readbyte(M48T86_REG_YEAR) + 100;
+               tm->tm_wday     = ops->readbyte(M48T86_REG_DOW);
        } else {
                /* bcd mode */
-               tm->tm_sec      = BCD2BIN(ops->readb(M48T86_REG_SEC));
-               tm->tm_min      = BCD2BIN(ops->readb(M48T86_REG_MIN));
-               tm->tm_hour     = BCD2BIN(ops->readb(M48T86_REG_HOUR) & 0x3F);
-               tm->tm_mday     = BCD2BIN(ops->readb(M48T86_REG_DOM));
+               tm->tm_sec      = BCD2BIN(ops->readbyte(M48T86_REG_SEC));
+               tm->tm_min      = BCD2BIN(ops->readbyte(M48T86_REG_MIN));
+               tm->tm_hour     = BCD2BIN(ops->readbyte(M48T86_REG_HOUR) & 0x3F);
+               tm->tm_mday     = BCD2BIN(ops->readbyte(M48T86_REG_DOM));
                /* tm_mon is 0-11 */
-               tm->tm_mon      = BCD2BIN(ops->readb(M48T86_REG_MONTH)) - 1;
-               tm->tm_year     = BCD2BIN(ops->readb(M48T86_REG_YEAR)) + 100;
-               tm->tm_wday     = BCD2BIN(ops->readb(M48T86_REG_DOW));
+               tm->tm_mon      = BCD2BIN(ops->readbyte(M48T86_REG_MONTH)) - 1;
+               tm->tm_year     = BCD2BIN(ops->readbyte(M48T86_REG_YEAR)) + 100;
+               tm->tm_wday     = BCD2BIN(ops->readbyte(M48T86_REG_DOW));
        }
 
        /* correct the hour if the clock is in 12h mode */
        if (!(reg & M48T86_REG_B_H24))
-               if (ops->readb(M48T86_REG_HOUR) & 0x80)
+               if (ops->readbyte(M48T86_REG_HOUR) & 0x80)
                        tm->tm_hour += 12;
 
        return 0;
@@ -86,35 +86,35 @@ static int m48t86_rtc_set_time(struct device *dev, struct rtc_time *tm)
        struct platform_device *pdev = to_platform_device(dev);
        struct m48t86_ops *ops = pdev->dev.platform_data;
 
-       reg = ops->readb(M48T86_REG_B);
+       reg = ops->readbyte(M48T86_REG_B);
 
        /* update flag and 24h mode */
        reg |= M48T86_REG_B_SET | M48T86_REG_B_H24;
-       ops->writeb(reg, M48T86_REG_B);
+       ops->writebyte(reg, M48T86_REG_B);
 
        if (reg & M48T86_REG_B_DM) {
                /* data (binary) mode */
-               ops->writeb(tm->tm_sec, M48T86_REG_SEC);
-               ops->writeb(tm->tm_min, M48T86_REG_MIN);
-               ops->writeb(tm->tm_hour, M48T86_REG_HOUR);
-               ops->writeb(tm->tm_mday, M48T86_REG_DOM);
-               ops->writeb(tm->tm_mon + 1, M48T86_REG_MONTH);
-               ops->writeb(tm->tm_year % 100, M48T86_REG_YEAR);
-               ops->writeb(tm->tm_wday, M48T86_REG_DOW);
+               ops->writebyte(tm->tm_sec, M48T86_REG_SEC);
+               ops->writebyte(tm->tm_min, M48T86_REG_MIN);
+               ops->writebyte(tm->tm_hour, M48T86_REG_HOUR);
+               ops->writebyte(tm->tm_mday, M48T86_REG_DOM);
+               ops->writebyte(tm->tm_mon + 1, M48T86_REG_MONTH);
+               ops->writebyte(tm->tm_year % 100, M48T86_REG_YEAR);
+               ops->writebyte(tm->tm_wday, M48T86_REG_DOW);
        } else {
                /* bcd mode */
-               ops->writeb(BIN2BCD(tm->tm_sec), M48T86_REG_SEC);
-               ops->writeb(BIN2BCD(tm->tm_min), M48T86_REG_MIN);
-               ops->writeb(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR);
-               ops->writeb(BIN2BCD(tm->tm_mday), M48T86_REG_DOM);
-               ops->writeb(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH);
-               ops->writeb(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR);
-               ops->writeb(BIN2BCD(tm->tm_wday), M48T86_REG_DOW);
+               ops->writebyte(BIN2BCD(tm->tm_sec), M48T86_REG_SEC);
+               ops->writebyte(BIN2BCD(tm->tm_min), M48T86_REG_MIN);
+               ops->writebyte(BIN2BCD(tm->tm_hour), M48T86_REG_HOUR);
+               ops->writebyte(BIN2BCD(tm->tm_mday), M48T86_REG_DOM);
+               ops->writebyte(BIN2BCD(tm->tm_mon + 1), M48T86_REG_MONTH);
+               ops->writebyte(BIN2BCD(tm->tm_year % 100), M48T86_REG_YEAR);
+               ops->writebyte(BIN2BCD(tm->tm_wday), M48T86_REG_DOW);
        }
 
        /* update ended */
        reg &= ~M48T86_REG_B_SET;
-       ops->writeb(reg, M48T86_REG_B);
+       ops->writebyte(reg, M48T86_REG_B);
 
        return 0;
 }
@@ -125,12 +125,12 @@ static int m48t86_rtc_proc(struct device *dev, struct seq_file *seq)
        struct platform_device *pdev = to_platform_device(dev);
        struct m48t86_ops *ops = pdev->dev.platform_data;
 
-       reg = ops->readb(M48T86_REG_B);
+       reg = ops->readbyte(M48T86_REG_B);
 
        seq_printf(seq, "mode\t\t: %s\n",
                 (reg & M48T86_REG_B_DM) ? "binary" : "bcd");
 
-       reg = ops->readb(M48T86_REG_D);
+       reg = ops->readbyte(M48T86_REG_D);
 
        seq_printf(seq, "battery\t\t: %s\n",
                 (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted");
@@ -157,7 +157,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev)
        platform_set_drvdata(dev, rtc);
 
        /* read battery status */
-       reg = ops->readb(M48T86_REG_D);
+       reg = ops->readbyte(M48T86_REG_D);
        dev_info(&dev->dev, "battery %s\n",
                (reg & M48T86_REG_D_VRT) ? "ok" : "exhausted");
 
index 2bc8aad47219180f58799a4b89523a9cf8298234..a997529f8926e24e0d3161acabb4c30215c2d21f 100644 (file)
@@ -247,7 +247,7 @@ static int sa1100_rtc_ioctl(struct device *dev, unsigned int cmd,
                rtc_freq = arg;
                return 0;
        }
-       return -EINVAL;
+       return -ENOIOCTLCMD;
 }
 
 static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
index e1f7e8e86daffee9f96737442ef9d840904f6a0e..e1fa5fe7901f900167b448997cb4f4373a85e892 100644 (file)
@@ -71,7 +71,7 @@ static int test_rtc_ioctl(struct device *dev, unsigned int cmd,
                return 0;
 
        default:
-               return -EINVAL;
+               return -ENOIOCTLCMD;
        }
 }
 
index 4d49fd501198fee4b8d1d0080c829935a80f50d2..277596c302e30426262db9392be87355cfeb7114 100644 (file)
@@ -270,7 +270,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long
                epoch = arg;
                break;
        default:
-               return -EINVAL;
+               return -ENOIOCTLCMD;
        }
 
        return 0;
index 74a257b23383abb94c8d1e011e896e97a50c1265..e210f89a24499c65f9bedea44df54d3e299c96d4 100644 (file)
@@ -45,11 +45,11 @@ struct pgid {
        union {
                __u8 fc;        /* SPID function code */
                struct path_state ps;   /* SNID path state */
-       } inf;
+       } __attribute__ ((packed)) inf;
        union {
                __u32 cpu_addr  : 16;   /* CPU address */
                struct extended_cssid ext_cssid;
-       } pgid_high;
+       } __attribute__ ((packed)) pgid_high;
        __u32 cpu_id    : 24;   /* CPU identification */
        __u32 cpu_model : 16;   /* CPU model */
        __u32 tod_high;         /* high word TOD clock */
index 180b3bf8b90ded2eeef4f004fb8d5e4926299076..49ec562d7f60b7d9d5d3c7658851394c11020d8d 100644 (file)
@@ -749,7 +749,7 @@ ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event)
                        /* Unit check but no sense data. Need basic sense. */
                        if (ccw_device_do_sense(cdev, irb) != 0)
                                goto call_handler_unsol;
-                       memcpy(irb, &cdev->private->irb, sizeof(struct irb));
+                       memcpy(&cdev->private->irb, irb, sizeof(struct irb));
                        cdev->private->state = DEV_STATE_W4SENSE;
                        cdev->private->intparm = 0;
                        return;
index af9f212314b3a3c00cf5e298daba5f95d9b1acce..fe986af884f8413287082736f94de62b25ee9152 100644 (file)
@@ -1486,13 +1486,13 @@ ch_action_iofatal(fsm_instance * fi, int event, void *arg)
        }
 }
 
-static void 
+static void
 ch_action_reinit(fsm_instance *fi, int event, void *arg)
 {
        struct channel *ch = (struct channel *)arg;
        struct net_device *dev = ch->netdev;
        struct ctc_priv *privptr = dev->priv;
+
        DBF_TEXT(trace, 4, __FUNCTION__);
        ch_action_iofatal(fi, event, arg);
        fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev);
@@ -1624,7 +1624,7 @@ less_than(char *id1, char *id2)
        }
        dev1 = simple_strtoul(id1, &id1, 16);
        dev2 = simple_strtoul(id2, &id2, 16);
-       
+
        return (dev1 < dev2);
 }
 
@@ -1895,7 +1895,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
                            irb->scsw.dstat);
                return;
        }
-       
+
        priv = ((struct ccwgroup_device *)cdev->dev.driver_data)
                ->dev.driver_data;
 
@@ -1909,7 +1909,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
                           "device %s\n", cdev->dev.bus_id);
                return;
        }
-       
+
        dev = (struct net_device *) (ch->netdev);
        if (dev == NULL) {
                ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n",
@@ -2008,12 +2008,12 @@ dev_action_stop(fsm_instance * fi, int event, void *arg)
                fsm_event(ch->fsm, CH_EVENT_STOP, ch);
        }
 }
-static void 
+static void
 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, 3, __FUNCTION__);
        ctc_pr_debug("%s: Restarting\n", dev->name);
        dev_action_stop(fi, event, arg);
@@ -2193,7 +2193,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
 
        DBF_TEXT(trace, 5, __FUNCTION__);
        /* we need to acquire the lock for testing the state
-        * otherwise we can have an IRQ changing the state to 
+        * otherwise we can have an IRQ changing the state to
         * TXIDLE after the test but before acquiring the lock.
         */
        spin_lock_irqsave(&ch->collect_lock, saveflags);
@@ -2393,7 +2393,7 @@ ctc_tx(struct sk_buff *skb, struct net_device * dev)
 
        /**
         * If channels are not running, try to restart them
-        * and throw away packet. 
+        * and throw away packet.
         */
        if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) {
                fsm_event(privptr->fsm, DEV_EVENT_START, dev);
@@ -2738,7 +2738,7 @@ ctc_remove_files(struct device *dev)
 /**
  * Add ctc specific attributes.
  * Add ctc private data.
- * 
+ *
  * @param cgdev pointer to ccwgroup_device just added
  *
  * @returns 0 on success, !0 on failure.
@@ -2869,7 +2869,7 @@ ctc_new_device(struct ccwgroup_device *cgdev)
        DBF_TEXT(setup, 3, buffer);
 
        type = get_channel_type(&cgdev->cdev[0]->id);
-       
+
        snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id);
        snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id);
 
@@ -2907,7 +2907,7 @@ ctc_new_device(struct ccwgroup_device *cgdev)
                    channel_get(type, direction == READ ? read_id : write_id,
                                direction);
                if (privptr->channel[direction] == NULL) {
-                       if (direction == WRITE) 
+                       if (direction == WRITE)
                                channel_free(privptr->channel[READ]);
 
                        ctc_free_netdevice(dev, 1);
@@ -2955,7 +2955,7 @@ ctc_shutdown_device(struct ccwgroup_device *cgdev)
 {
        struct ctc_priv *priv;
        struct net_device *ndev;
-               
+
        DBF_TEXT(setup, 3, __FUNCTION__);
        pr_debug("%s() called\n", __FUNCTION__);
 
index 5cdcdbf92962ee89e8be5534ed5d5152f7a5a9a3..af54d1de07bfb8786f93c5af83efd4f7b286d88c 100644 (file)
@@ -130,7 +130,7 @@ ctc_tty_readmodem(ctc_tty_info *info)
        if ((tty = info->tty)) {
                if (info->mcr & UART_MCR_RTS) {
                        struct sk_buff *skb;
-                       
+
                        if ((skb = skb_dequeue(&info->rx_queue))) {
                                int len = skb->len;
                                tty_insert_flip_string(tty, skb->data, len);
@@ -328,7 +328,7 @@ ctc_tty_inject(ctc_tty_info *info, char c)
 {
        int skb_res;
        struct sk_buff *skb;
-       
+
        DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_shuttingdown)
                return;
@@ -497,7 +497,7 @@ ctc_tty_write(struct tty_struct *tty, const u_char * buf, int count)
                c = (count < CTC_TTY_XMIT_SIZE) ? count : CTC_TTY_XMIT_SIZE;
                if (c <= 0)
                        break;
-               
+
                skb_res = info->netdev->hard_header_len + sizeof(info->mcr) +
                        + sizeof(__u32);
                skb = dev_alloc_skb(skb_res + c);
@@ -828,7 +828,7 @@ ctc_tty_block_til_ready(struct tty_struct *tty, struct file *filp, ctc_tty_info
        if (tty_hung_up_p(filp) ||
            (info->flags & CTC_ASYNC_CLOSING)) {
                if (info->flags & CTC_ASYNC_CLOSING)
-                       wait_event(info->close_wait, 
+                       wait_event(info->close_wait,
                                   !(info->flags & CTC_ASYNC_CLOSING));
 #ifdef MODEM_DO_RESTART
                if (info->flags & CTC_ASYNC_HUP_NOTIFY)
@@ -1247,7 +1247,7 @@ ctc_tty_unregister_netdev(struct net_device *dev) {
 void
 ctc_tty_cleanup(void) {
        unsigned long saveflags;
-       
+
        DBF_TEXT(trace, 2, __FUNCTION__);
        spin_lock_irqsave(&ctc_tty_lock, saveflags);
        ctc_tty_shuttingdown = 1;
index b12533104c1ff5b38242791d22d0e94c0f0293de..e965f03a7291659a8384998e57eb30748a9b422a 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-\f
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/err.h>
@@ -77,7 +77,7 @@ group_write(struct device_driver *drv, const char *buf, size_t count)
                int len;
 
                if (!(end = strchr(start, delim[i])))
-                       return count;
+                       return -EINVAL;
                len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start + 1);
                strlcpy (bus_ids[i], start, len);
                argv[i] = bus_ids[i];
@@ -94,7 +94,7 @@ static DRIVER_ATTR(group, 0200, NULL, group_write);
 
 /* Register-unregister for ctc&lcs */
 int
-register_cu3088_discipline(struct ccwgroup_driver *dcp) 
+register_cu3088_discipline(struct ccwgroup_driver *dcp)
 {
        int rc;
 
@@ -109,7 +109,7 @@ register_cu3088_discipline(struct ccwgroup_driver *dcp)
        rc = driver_create_file(&dcp->driver, &driver_attr_group);
        if (rc)
                ccwgroup_driver_unregister(dcp);
-               
+
        return rc;
 
 }
@@ -137,7 +137,7 @@ static int __init
 cu3088_init (void)
 {
        int rc;
-       
+
        cu3088_root_dev = s390_root_dev_register("cu3088");
        if (IS_ERR(cu3088_root_dev))
                return PTR_ERR(cu3088_root_dev);
index 6190be9dca991b7502aa9e60761b459014fa3ae2..e0c7deb9883189f012d0b27d67c83db08317b01e 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * IUCV network driver
  *
  * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
@@ -28,7 +28,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-\f
+
 /* #define DEBUG */
 
 #include <linux/module.h>
@@ -81,7 +81,7 @@ iucv_bus_match (struct device *dev, struct device_driver *drv)
 struct bus_type iucv_bus = {
        .name = "iucv",
        .match = iucv_bus_match,
-};     
+};
 
 struct device *iucv_root;
 
@@ -297,7 +297,7 @@ MODULE_LICENSE("GPL");
 /*
  * Debugging stuff
  *******************************************************************************/
-\f
+
 
 #ifdef DEBUG
 static int debuglevel = 0;
@@ -344,7 +344,7 @@ do { \
 /*
  * Internal functions
  *******************************************************************************/
-\f
+
 /**
  * print start banner
  */
@@ -810,7 +810,7 @@ iucv_register_program (__u8 pgmname[16],
                        sizeof (new_handler->id.userid));
                EBC_TOUPPER (new_handler->id.userid,
                             sizeof (new_handler->id.userid));
-               
+
                if (pgmmask) {
                        memcpy (new_handler->id.mask, pgmmask,
                                sizeof (new_handler->id.mask));
@@ -1229,7 +1229,7 @@ iucv_purge (__u16 pathid, __u32 msgid, __u32 srccls, __u32 *audit)
                /* parm->ipaudit has only 3 bytes */
                *audit >>= 8;
        }
-       
+
        release_param(parm);
 
        iucv_debug(1, "b2f0_result = %ld", b2f0_result);
@@ -2330,14 +2330,14 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                                        temp_buff1[j] &= (h->id.mask)[j];
                                        temp_buff2[j] &= (h->id.mask)[j];
                                }
-                               
+
                                iucv_dumpit("temp_buff1:",
                                            temp_buff1, sizeof(temp_buff1));
                                iucv_dumpit("temp_buff2",
                                            temp_buff2, sizeof(temp_buff2));
-                               
+
                                if (!memcmp (temp_buff1, temp_buff2, 24)) {
-                                       
+
                                        iucv_debug(2,
                                                   "found a matching handler");
                                        break;
@@ -2368,7 +2368,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                        } else
                                iucv_sever(int_buf->ippathid, no_listener);
                        break;
-                       
+
                case 0x02:              /*connection complete */
                        if (messagesDisabled) {
                            iucv_setmask(~0);
@@ -2387,7 +2387,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                        } else
                                iucv_sever(int_buf->ippathid, no_listener);
                        break;
-                       
+
                case 0x03:              /* connection severed */
                        if (messagesDisabled) {
                            iucv_setmask(~0);
@@ -2398,13 +2398,13 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                                        interrupt->ConnectionSevered(
                                                (iucv_ConnectionSevered *)int_buf,
                                                h->pgm_data);
-                               
+
                                else
                                        iucv_sever (int_buf->ippathid, no_listener);
                        } else
                                iucv_sever(int_buf->ippathid, no_listener);
                        break;
-                       
+
                case 0x04:              /* connection quiesced */
                        if (messagesDisabled) {
                            iucv_setmask(~0);
@@ -2420,7 +2420,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                                                   "ConnectionQuiesced not called");
                        }
                        break;
-                       
+
                case 0x05:              /* connection resumed */
                        if (messagesDisabled) {
                            iucv_setmask(~0);
@@ -2436,7 +2436,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                                                   "ConnectionResumed not called");
                        }
                        break;
-                       
+
                case 0x06:              /* priority message complete */
                case 0x07:              /* nonpriority message complete */
                        if (h) {
@@ -2449,7 +2449,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                                                   "MessageComplete not called");
                        }
                        break;
-                       
+
                case 0x08:              /* priority message pending  */
                case 0x09:              /* nonpriority message pending  */
                        if (h) {
@@ -2467,7 +2467,7 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
                               __FUNCTION__);
                        break;
        }                       /* end switch */
-       
+
        iucv_debug(2, "exiting pathid %d, type %02X",
                 int_buf->ippathid, int_buf->iptype);
 
index 0c4644d3d2f35e76a3529284b9a9b0aeceaf7b06..5b6b1b7241c96452345694a7b76d98dd69150a8b 100644 (file)
@@ -4,7 +4,7 @@
  *
  *  S390 version
  *    Copyright (C) 2000 IBM Corporation
- *    Author(s):Alan Altmark (Alan_Altmark@us.ibm.com) 
+ *    Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
  *             Xenia Tkatschow (xenia@us.ibm.com)
  *
  *
  * CP Programming Services book, also available on the web
  * thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
  *
- *      Definition of Return Codes                                    
- *      -All positive return codes including zero are reflected back  
- *       from CP except for iucv_register_program. The definition of each 
- *       return code can be found in CP Programming Services book.    
- *       Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760          
- *      - Return Code of:         
- *             (-EINVAL) Invalid value       
- *             (-ENOMEM) storage allocation failed              
+ *      Definition of Return Codes
+ *      -All positive return codes including zero are reflected back
+ *       from CP except for iucv_register_program. The definition of each
+ *       return code can be found in CP Programming Services book.
+ *       Also available on the web thru www.ibm.com/s390/vm/pubs, manual # SC24-5760
+ *      - Return Code of:
+ *             (-EINVAL) Invalid value
+ *             (-ENOMEM) storage allocation failed
  *     pgmask defined in iucv_register_program will be set depending on input
- *     paramters. 
- *     
+ *     paramters.
+ *
  */
 
 #include <linux/types.h>
@@ -124,13 +124,13 @@ iucv_hex_dump(unsigned char *buf, size_t len)
 #define iucv_handle_t void *
 
 /* flags1:
- * All flags are defined in the field IPFLAGS1 of each function   
- * and can be found in CP Programming Services.                  
- * IPLOCAL  - Indicates the connect can only be satisfied on the 
- *            local system                                       
- * IPPRTY   - Indicates a priority message                       
- * IPQUSCE  - Indicates you do not want to receive messages on a 
- *            path until an iucv_resume is issued                
+ * All flags are defined in the field IPFLAGS1 of each function
+ * and can be found in CP Programming Services.
+ * IPLOCAL  - Indicates the connect can only be satisfied on the
+ *            local system
+ * IPPRTY   - Indicates a priority message
+ * IPQUSCE  - Indicates you do not want to receive messages on a
+ *            path until an iucv_resume is issued
  * IPRMDATA - Indicates that the message is in the parameter list
  */
 #define IPLOCAL        0x01
@@ -154,14 +154,14 @@ iucv_hex_dump(unsigned char *buf, size_t len)
 #define AllInterrupts                                    0xf8
 /*
  * Mapping of external interrupt buffers should be used with the corresponding
- * interrupt types.                  
- * Names: iucv_ConnectionPending    ->  connection pending 
+ * interrupt types.
+ * Names: iucv_ConnectionPending    ->  connection pending
  *        iucv_ConnectionComplete   ->  connection complete
- *        iucv_ConnectionSevered    ->  connection severed 
- *        iucv_ConnectionQuiesced   ->  connection quiesced 
- *        iucv_ConnectionResumed    ->  connection resumed 
- *        iucv_MessagePending       ->  message pending    
- *        iucv_MessageComplete      ->  message complete   
+ *        iucv_ConnectionSevered    ->  connection severed
+ *        iucv_ConnectionQuiesced   ->  connection quiesced
+ *        iucv_ConnectionResumed    ->  connection resumed
+ *        iucv_MessagePending       ->  message pending
+ *        iucv_MessageComplete      ->  message complete
  */
 typedef struct {
        u16 ippathid;
@@ -260,16 +260,16 @@ typedef struct {
        uchar res2[3];
 } iucv_MessageComplete;
 
-/* 
- * iucv_interrupt_ops_t: Is a vector of functions that handle 
- * IUCV interrupts.                                          
- * Parameter list:                                           
- *         eib - is a pointer to a 40-byte area described    
- *               with one of the structures above.           
- *         pgm_data - this data is strictly for the          
- *                    interrupt handler that is passed by    
- *                    the application. This may be an address 
- *                    or token.                              
+/*
+ * iucv_interrupt_ops_t: Is a vector of functions that handle
+ * IUCV interrupts.
+ * Parameter list:
+ *         eib - is a pointer to a 40-byte area described
+ *               with one of the structures above.
+ *         pgm_data - this data is strictly for the
+ *                    interrupt handler that is passed by
+ *                    the application. This may be an address
+ *                    or token.
 */
 typedef struct {
        void (*ConnectionPending) (iucv_ConnectionPending * eib,
@@ -287,8 +287,8 @@ typedef struct {
 } iucv_interrupt_ops_t;
 
 /*
- *iucv_array_t : Defines buffer array.                      
- * Inside the array may be 31- bit addresses and 31-bit lengths. 
+ *iucv_array_t : Defines buffer array.
+ * Inside the array may be 31- bit addresses and 31-bit lengths.
 */
 typedef struct {
        u32 address;
@@ -299,19 +299,19 @@ extern struct bus_type iucv_bus;
 extern struct device *iucv_root;
 
 /*   -prototypes-    */
-/*                                                                
- * Name: iucv_register_program                                    
- * Purpose: Registers an application with IUCV                    
- * Input: prmname - user identification                           
+/*
+ * Name: iucv_register_program
+ * Purpose: Registers an application with IUCV
+ * Input: prmname - user identification
  *        userid  - machine identification
  *        pgmmask - indicates which bits in the prmname and userid combined will be
  *                 used to determine who is given control
- *        ops     - address of vector of interrupt handlers       
- *        pgm_data- application data passed to interrupt handlers 
- * Output: NA                                                     
- * Return: address of handler                                     
+ *        ops     - address of vector of interrupt handlers
+ *        pgm_data- application data passed to interrupt handlers
+ * Output: NA
+ * Return: address of handler
  *         (0) - Error occurred, registration not completed.
- * NOTE: Exact cause of failure will be recorded in syslog.                        
+ * NOTE: Exact cause of failure will be recorded in syslog.
 */
 iucv_handle_t iucv_register_program (uchar pgmname[16],
                                     uchar userid[8],
@@ -319,13 +319,13 @@ iucv_handle_t iucv_register_program (uchar pgmname[16],
                                     iucv_interrupt_ops_t * ops,
                                     void *pgm_data);
 
-/*                                                
- * Name: iucv_unregister_program                  
- * Purpose: Unregister application with IUCV      
- * Input: address of handler                      
- * Output: NA                                     
- * Return: (0) - Normal return                    
- *         (-EINVAL) - Internal error, wild pointer     
+/*
+ * Name: iucv_unregister_program
+ * Purpose: Unregister application with IUCV
+ * Input: address of handler
+ * Output: NA
+ * Return: (0) - Normal return
+ *         (-EINVAL) - Internal error, wild pointer
 */
 int iucv_unregister_program (iucv_handle_t handle);
 
@@ -333,7 +333,7 @@ int iucv_unregister_program (iucv_handle_t handle);
  * Name: iucv_accept
  * Purpose: This function is issued after the user receives a Connection Pending external
  *          interrupt and now wishes to complete the IUCV communication path.
- * Input:  pathid - u16 , Path identification number   
+ * Input:  pathid - u16 , Path identification number
  *         msglim_reqstd - u16, The number of outstanding messages requested.
  *         user_data - uchar[16], Data specified by the iucv_connect function.
  *        flags1 - int, Contains options for this path.
@@ -358,34 +358,34 @@ int iucv_accept (u16 pathid,
                 void *pgm_data, int *flags1_out, u16 * msglim);
 
 /*
- * Name: iucv_connect                                         
+ * Name: iucv_connect
  * Purpose: This function establishes an IUCV path. Although the connect may complete
- *         successfully, you are not able to use the path until you receive an IUCV 
- *          Connection Complete external interrupt.            
- * Input: pathid - u16 *, Path identification number          
- *        msglim_reqstd - u16, Number of outstanding messages requested       
- *        user_data - uchar[16], 16-byte user data                    
+ *         successfully, you are not able to use the path until you receive an IUCV
+ *          Connection Complete external interrupt.
+ * Input: pathid - u16 *, Path identification number
+ *        msglim_reqstd - u16, Number of outstanding messages requested
+ *        user_data - uchar[16], 16-byte user data
  *       userid - uchar[8], User identification
- *        system_name - uchar[8], 8-byte identifying the system name 
+ *        system_name - uchar[8], 8-byte identifying the system name
  *       flags1 - int, Contains options for this path.
  *          -IPPRTY -   0x20, Specifies if you want to send priority message.
  *          -IPRMDATA - 0x80, Specifies whether your program can handle a message
  *              in  the parameter list.
- *          -IPQUSCE -  0x40, Specifies whether you want to quiesce the path being      
+ *          -IPQUSCE -  0x40, Specifies whether you want to quiesce the path being
  *             established.
- *          -IPLOCAL -  0X01, Allows an application to force the partner to be on 
+ *          -IPLOCAL -  0X01, Allows an application to force the partner to be on
  *             the local system. If local is specified then target class cannot be
- *             specified.                       
+ *             specified.
  *        flags1_out - int * Contains information about the path
  *           - IPPRTY - 0x20, Indicates you may send priority messages.
  *        msglim - * u16, Number of outstanding messages
- *        handle - iucv_handle_t, Address of handler                         
- *        pgm_data - void *, Application data passed to interrupt handlers              
+ *        handle - iucv_handle_t, Address of handler
+ *        pgm_data - void *, Application data passed to interrupt handlers
  * Output: return code from CP IUCV call
  *         rc - return code from iucv_declare_buffer
- *         -EINVAL - Invalid handle passed by application 
- *         -EINVAL - Pathid address is NULL 
- *         add_pathid_result - Return code from internal function add_pathid         
+ *         -EINVAL - Invalid handle passed by application
+ *         -EINVAL - Pathid address is NULL
+ *         add_pathid_result - Return code from internal function add_pathid
 */
 int
     iucv_connect (u16 * pathid,
@@ -397,16 +397,16 @@ int
                  int *flags1_out,
                  u16 * msglim, iucv_handle_t handle, void *pgm_data);
 
-/*                                                                     
- * Name: iucv_purge                                                    
- * Purpose: This function cancels a message that you have sent.        
- * Input: pathid - Path identification number.                          
+/*
+ * Name: iucv_purge
+ * Purpose: This function cancels a message that you have sent.
+ * Input: pathid - Path identification number.
  *        msgid - Specifies the message ID of the message to be purged.
- *        srccls - Specifies the source message class.                  
- * Output: audit - Contains information about asynchronous error       
- *                 that may have affected the normal completion        
- *                 of this message.                                    
- * Return: Return code from CP IUCV call.                           
+ *        srccls - Specifies the source message class.
+ * Output: audit - Contains information about asynchronous error
+ *                 that may have affected the normal completion
+ *                 of this message.
+ * Return: Return code from CP IUCV call.
 */
 int iucv_purge (u16 pathid, u32 msgid, u32 srccls, __u32 *audit);
 /*
@@ -426,38 +426,38 @@ ulong iucv_query_maxconn (void);
  */
 ulong iucv_query_bufsize (void);
 
-/*                                                                     
- * Name: iucv_quiesce                                                  
- * Purpose: This function temporarily suspends incoming messages on an 
- *          IUCV path. You can later reactivate the path by invoking   
- *          the iucv_resume function.                                  
- * Input: pathid - Path identification number                          
- *        user_data  - 16-bytes of user data                           
- * Output: NA                                                          
- * Return: Return code from CP IUCV call.                           
+/*
+ * Name: iucv_quiesce
+ * Purpose: This function temporarily suspends incoming messages on an
+ *          IUCV path. You can later reactivate the path by invoking
+ *          the iucv_resume function.
+ * Input: pathid - Path identification number
+ *        user_data  - 16-bytes of user data
+ * Output: NA
+ * Return: Return code from CP IUCV call.
 */
 int iucv_quiesce (u16 pathid, uchar user_data[16]);
 
-/*                                                                     
- * Name: iucv_receive                                                  
- * Purpose: This function receives messages that are being sent to you 
+/*
+ * Name: iucv_receive
+ * Purpose: This function receives messages that are being sent to you
  *          over established paths. Data will be returned in buffer for length of
  *          buflen.
- * Input: 
- *       pathid - Path identification number.                          
- *       buffer - Address of buffer to receive.                        
- *       buflen - Length of buffer to receive.                         
- *       msgid - Specifies the message ID.          
- *       trgcls - Specifies target class.                       
- * Output: 
+ * Input:
+ *       pathid - Path identification number.
+ *       buffer - Address of buffer to receive.
+ *       buflen - Length of buffer to receive.
+ *       msgid - Specifies the message ID.
+ *       trgcls - Specifies target class.
+ * Output:
  *      flags1_out: int *, Contains information about this path.
  *         IPNORPY - 0x10 Specifies this is a one-way message and no reply is
- *        expected.      
- *         IPPRTY  - 0x20 Specifies if you want to send priority message.       
+ *        expected.
+ *         IPPRTY  - 0x20 Specifies if you want to send priority message.
  *         IPRMDATA - 0x80 specifies the data is contained in the parameter list
  *       residual_buffer - address of buffer updated by the number
  *                         of bytes you have received.
- *       residual_length -      
+ *       residual_length -
  *              Contains one of the following values, if the receive buffer is:
  *               The same length as the message, this field is zero.
  *               Longer than the message, this field contains the number of
@@ -466,8 +466,8 @@ int iucv_quiesce (u16 pathid, uchar user_data[16]);
  *                count (that is, the number of bytes remaining in the
  *                message that does not fit into the buffer. In this
  *                case b2f0_result = 5.
- * Return: Return code from CP IUCV call.                           
- *         (-EINVAL) - buffer address is pointing to NULL                   
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - buffer address is pointing to NULL
 */
 int iucv_receive (u16 pathid,
                  u32 msgid,
@@ -477,16 +477,16 @@ int iucv_receive (u16 pathid,
                  int *flags1_out,
                  ulong * residual_buffer, ulong * residual_length);
 
- /*                                                                     
-  * Name: iucv_receive_array                                            
-  * Purpose: This function receives messages that are being sent to you 
+ /*
+  * Name: iucv_receive_array
+  * Purpose: This function receives messages that are being sent to you
   *          over established paths. Data will be returned in first buffer for
   *          length of first buffer.
-  * Input: pathid - Path identification number.                          
+  * Input: pathid - Path identification number.
   *        msgid - specifies the message ID.
   *        trgcls - Specifies target class.
-  *        buffer - Address of array of buffers.                         
-  *        buflen - Total length of buffers.                             
+  *        buffer - Address of array of buffers.
+  *        buflen - Total length of buffers.
   * Output:
   *        flags1_out: int *, Contains information about this path.
   *          IPNORPY - 0x10 Specifies this is a one-way message and no reply is
@@ -504,8 +504,8 @@ int iucv_receive (u16 pathid,
   *                count (that is, the number of bytes remaining in the
   *                message that does not fit into the buffer. In this
   *                case b2f0_result = 5.
-  * Return: Return code from CP IUCV call.                           
-  *         (-EINVAL) - Buffer address is NULL.       
+  * Return: Return code from CP IUCV call.
+  *         (-EINVAL) - Buffer address is NULL.
   */
 int iucv_receive_array (u16 pathid,
                        u32 msgid,
@@ -515,44 +515,44 @@ int iucv_receive_array (u16 pathid,
                        int *flags1_out,
                        ulong * residual_buffer, ulong * residual_length);
 
-/*                                                                       
- * Name: iucv_reject                                                     
- * Purpose: The reject function refuses a specified message. Between the 
- *          time you are notified of a message and the time that you     
- *          complete the message, the message may be rejected.           
- * Input: pathid - Path identification number.                            
- *        msgid - Specifies the message ID.                   
- *        trgcls - Specifies target class.                                
- * Output: NA                                                            
- * Return: Return code from CP IUCV call.                             
+/*
+ * Name: iucv_reject
+ * Purpose: The reject function refuses a specified message. Between the
+ *          time you are notified of a message and the time that you
+ *          complete the message, the message may be rejected.
+ * Input: pathid - Path identification number.
+ *        msgid - Specifies the message ID.
+ *        trgcls - Specifies target class.
+ * Output: NA
+ * Return: Return code from CP IUCV call.
 */
 int iucv_reject (u16 pathid, u32 msgid, u32 trgcls);
 
-/*                                                                     
- * Name: iucv_reply                                                    
- * Purpose: This function responds to the two-way messages that you    
- *          receive. You must identify completely the message to       
- *          which you wish to reply. ie, pathid, msgid, and trgcls.    
- * Input: pathid - Path identification number.                          
- *        msgid - Specifies the message ID.                
- *        trgcls - Specifies target class.                              
+/*
+ * Name: iucv_reply
+ * Purpose: This function responds to the two-way messages that you
+ *          receive. You must identify completely the message to
+ *          which you wish to reply. ie, pathid, msgid, and trgcls.
+ * Input: pathid - Path identification number.
+ *        msgid - Specifies the message ID.
+ *        trgcls - Specifies target class.
  *        flags1 - Option for path.
- *          IPPRTY- 0x20, Specifies if you want to send priority message.        
- *        buffer - Address of reply buffer.                             
- *        buflen - Length of reply buffer.                              
- * Output: residual_buffer - Address of buffer updated by the number 
- *                    of bytes you have moved.              
+ *          IPPRTY- 0x20, Specifies if you want to send priority message.
+ *        buffer - Address of reply buffer.
+ *        buflen - Length of reply buffer.
+ * Output: residual_buffer - Address of buffer updated by the number
+ *                    of bytes you have moved.
  *         residual_length - Contains one of the following values:
  *             If the answer buffer is the same length as the reply, this field
  *              contains zero.
  *             If the answer buffer is longer than the reply, this field contains
- *              the number of bytes remaining in the buffer.  
+ *              the number of bytes remaining in the buffer.
  *             If the answer buffer is shorter than the reply, this field contains
  *              a residual count (that is, the number of bytes remianing in the
  *              reply that does not fit into the buffer. In this
  *               case b2f0_result = 5.
- * Return: Return code from CP IUCV call.                           
- *         (-EINVAL) - Buffer address is NULL.                               
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_reply (u16 pathid,
                u32 msgid,
@@ -561,20 +561,20 @@ int iucv_reply (u16 pathid,
                void *buffer, ulong buflen, ulong * residual_buffer,
                ulong * residual_length);
 
-/*                                                                       
- * Name: iucv_reply_array                                                
- * Purpose: This function responds to the two-way messages that you      
- *          receive. You must identify completely the message to         
- *          which you wish to reply. ie, pathid, msgid, and trgcls.      
- *          The array identifies a list of addresses and lengths of      
- *          discontiguous buffers that contains the reply data.          
- * Input: pathid - Path identification number                            
- *        msgid - Specifies the message ID. 
- *        trgcls - Specifies target class.                                
+/*
+ * Name: iucv_reply_array
+ * Purpose: This function responds to the two-way messages that you
+ *          receive. You must identify completely the message to
+ *          which you wish to reply. ie, pathid, msgid, and trgcls.
+ *          The array identifies a list of addresses and lengths of
+ *          discontiguous buffers that contains the reply data.
+ * Input: pathid - Path identification number
+ *        msgid - Specifies the message ID.
+ *        trgcls - Specifies target class.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20, Specifies if you want to send priority message.
- *        buffer - Address of array of reply buffers.                     
- *        buflen - Total length of reply buffers.                         
+ *        buffer - Address of array of reply buffers.
+ *        buflen - Total length of reply buffers.
  * Output: residual_buffer - Address of buffer which IUCV is currently working on.
  *         residual_length - Contains one of the following values:
  *              If the answer buffer is the same length as the reply, this field
@@ -585,8 +585,8 @@ int iucv_reply (u16 pathid,
  *               a residual count (that is, the number of bytes remianing in the
  *               reply that does not fit into the buffer. In this
  *               case b2f0_result = 5.
- * Return: Return code from CP IUCV call.                             
- *         (-EINVAL) - Buffer address is NULL.              
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_reply_array (u16 pathid,
                      u32 msgid,
@@ -596,77 +596,77 @@ int iucv_reply_array (u16 pathid,
                      ulong buflen, ulong * residual_address,
                      ulong * residual_length);
 
-/*                                                                  
- * Name: iucv_reply_prmmsg                                          
- * Purpose: This function responds to the two-way messages that you 
- *          receive. You must identify completely the message to    
- *          which you wish to reply. ie, pathid, msgid, and trgcls. 
- *          Prmmsg signifies the data is moved into the             
- *          parameter list.                                         
- * Input: pathid - Path identification number.                       
- *        msgid - Specifies the message ID.              
- *        trgcls - Specifies target class.                           
+/*
+ * Name: iucv_reply_prmmsg
+ * Purpose: This function responds to the two-way messages that you
+ *          receive. You must identify completely the message to
+ *          which you wish to reply. ie, pathid, msgid, and trgcls.
+ *          Prmmsg signifies the data is moved into the
+ *          parameter list.
+ * Input: pathid - Path identification number.
+ *        msgid - Specifies the message ID.
+ *        trgcls - Specifies target class.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 Specifies if you want to send priority message.
- *        prmmsg - 8-bytes of data to be placed into the parameter.  
- *                 list.                                            
- * Output: NA                                                       
- * Return: Return code from CP IUCV call.                        
+ *        prmmsg - 8-bytes of data to be placed into the parameter.
+ *                 list.
+ * Output: NA
+ * Return: Return code from CP IUCV call.
 */
 int iucv_reply_prmmsg (u16 pathid,
                       u32 msgid, u32 trgcls, int flags1, uchar prmmsg[8]);
 
-/*                                                                     
- * Name: iucv_resume                                                   
- * Purpose: This function restores communications over a quiesced path 
- * Input: pathid - Path identification number.                          
- *        user_data  - 16-bytes of user data.                           
- * Output: NA                                                          
- * Return: Return code from CP IUCV call.                           
+/*
+ * Name: iucv_resume
+ * Purpose: This function restores communications over a quiesced path
+ * Input: pathid - Path identification number.
+ *        user_data  - 16-bytes of user data.
+ * Output: NA
+ * Return: Return code from CP IUCV call.
 */
 int iucv_resume (u16 pathid, uchar user_data[16]);
 
-/*                                                                   
- * Name: iucv_send                                                   
- * Purpose: This function transmits data to another application.     
- *          Data to be transmitted is in a buffer and this is a      
- *          one-way message and the receiver will not reply to the   
- *          message.                                                 
- * Input: pathid - Path identification number.                        
- *        trgcls - Specifies target class.                            
- *        srccls - Specifies the source message class.                
- *        msgtag - Specifies a tag to be associated with the message. 
+/*
+ * Name: iucv_send
+ * Purpose: This function transmits data to another application.
+ *          Data to be transmitted is in a buffer and this is a
+ *          one-way message and the receiver will not reply to the
+ *          message.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag to be associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 Specifies if you want to send priority message.
- *        buffer - Address of send buffer.                            
- *        buflen - Length of send buffer.                             
- * Output: msgid - Specifies the message ID.                         
- * Return: Return code from CP IUCV call.                         
- *         (-EINVAL) - Buffer address is NULL.                             
+ *        buffer - Address of send buffer.
+ *        buflen - Length of send buffer.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_send (u16 pathid,
               u32 * msgid,
               u32 trgcls,
               u32 srccls, u32 msgtag, int flags1, void *buffer, ulong buflen);
 
-/*                                                                   
- * Name: iucv_send_array                                             
- * Purpose: This function transmits data to another application.     
- *          The contents of buffer is the address of the array of    
- *          addresses and lengths of discontiguous buffers that hold 
- *          the message text. This is a one-way message and the      
- *          receiver will not reply to the message.                  
- * Input: pathid - Path identification number.                        
- *        trgcls - Specifies target class.                            
- *        srccls - Specifies the source message class.                
+/*
+ * Name: iucv_send_array
+ * Purpose: This function transmits data to another application.
+ *          The contents of buffer is the address of the array of
+ *          addresses and lengths of discontiguous buffers that hold
+ *          the message text. This is a one-way message and the
+ *          receiver will not reply to the message.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
  *        msgtag - Specifies a tag to be associated witht the message.
  *        flags1 - Option for path.
- *          IPPRTY- specifies if you want to send priority message. 
- *        buffer - Address of array of send buffers.                  
- *        buflen - Total length of send buffers.                      
- * Output: msgid - Specifies the message ID.                         
- * Return: Return code from CP IUCV call.                         
- *         (-EINVAL) - Buffer address is NULL.                             
+ *          IPPRTY- specifies if you want to send priority message.
+ *        buffer - Address of array of send buffers.
+ *        buflen - Total length of send buffers.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_send_array (u16 pathid,
                     u32 * msgid,
@@ -675,48 +675,48 @@ int iucv_send_array (u16 pathid,
                     u32 msgtag,
                     int flags1, iucv_array_t * buffer, ulong buflen);
 
-/*                                                                     
- * Name: iucv_send_prmmsg                                              
- * Purpose: This function transmits data to another application.       
- *          Prmmsg specifies that the 8-bytes of data are to be moved  
- *          into the parameter list. This is a one-way message and the 
- *          receiver will not reply to the message.                    
- * Input: pathid - Path identification number.                          
- *        trgcls - Specifies target class.                              
- *        srccls - Specifies the source message class.                  
- *        msgtag - Specifies a tag to be associated with the message.   
+/*
+ * Name: iucv_send_prmmsg
+ * Purpose: This function transmits data to another application.
+ *          Prmmsg specifies that the 8-bytes of data are to be moved
+ *          into the parameter list. This is a one-way message and the
+ *          receiver will not reply to the message.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag to be associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 specifies if you want to send priority message.
- *        prmmsg - 8-bytes of data to be placed into parameter list.    
- * Output: msgid - Specifies the message ID.                           
- * Return: Return code from CP IUCV call.                           
+ *        prmmsg - 8-bytes of data to be placed into parameter list.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
 */
 int iucv_send_prmmsg (u16 pathid,
                      u32 * msgid,
                      u32 trgcls,
                      u32 srccls, u32 msgtag, int flags1, uchar prmmsg[8]);
 
-/*                                                                
- * Name: iucv_send2way                                            
- * Purpose: This function transmits data to another application.  
- *          Data to be transmitted is in a buffer. The receiver   
- *          of the send is expected to reply to the message and   
- *          a buffer is provided into which IUCV moves the reply  
- *          to this message.                                      
- * Input: pathid - Path identification number.                     
- *        trgcls - Specifies target class.                         
- *        srccls - Specifies the source message class.             
- *        msgtag - Specifies a tag associated with the message.    
+/*
+ * Name: iucv_send2way
+ * Purpose: This function transmits data to another application.
+ *          Data to be transmitted is in a buffer. The receiver
+ *          of the send is expected to reply to the message and
+ *          a buffer is provided into which IUCV moves the reply
+ *          to this message.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 Specifies if you want to send priority message.
- *        buffer - Address of send buffer.                         
- *        buflen - Length of send buffer.                          
- *        ansbuf - Address of buffer into which IUCV moves the reply of 
- *                 this message.        
- *        anslen - Address of length of buffer.          
- * Output: msgid - Specifies the message ID.                      
- * Return: Return code from CP IUCV call.                      
- *         (-EINVAL) - Buffer or ansbuf address is NULL.    
+ *        buffer - Address of send buffer.
+ *        buflen - Length of send buffer.
+ *        ansbuf - Address of buffer into which IUCV moves the reply of
+ *                 this message.
+ *        anslen - Address of length of buffer.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer or ansbuf address is NULL.
 */
 int iucv_send2way (u16 pathid,
                   u32 * msgid,
@@ -726,28 +726,28 @@ int iucv_send2way (u16 pathid,
                   int flags1,
                   void *buffer, ulong buflen, void *ansbuf, ulong anslen);
 
-/*                                                                    
- * Name: iucv_send2way_array                                          
- * Purpose: This function transmits data to another application.      
- *          The contents of buffer is the address of the array of     
- *          addresses and lengths of discontiguous buffers that hold  
- *          the message text. The receiver of the send is expected to 
- *          reply to the message and a buffer is provided into which  
- *          IUCV moves the reply to this message.                     
- * Input: pathid - Path identification number.                         
- *        trgcls - Specifies target class.                             
- *        srccls - Specifies the source message class.                 
- *        msgtag - Specifies a tag to be associated with the message.   
+/*
+ * Name: iucv_send2way_array
+ * Purpose: This function transmits data to another application.
+ *          The contents of buffer is the address of the array of
+ *          addresses and lengths of discontiguous buffers that hold
+ *          the message text. The receiver of the send is expected to
+ *          reply to the message and a buffer is provided into which
+ *          IUCV moves the reply to this message.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag to be associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 Specifies if you want to send priority message.
- *        buffer - Sddress of array of send buffers.                   
- *        buflen - Total length of send buffers.                       
- *        ansbuf - Address of array of buffer into which IUCV moves the reply            
- *                 of this message.                         
- *        anslen - Address of length reply buffers.              
- * Output: msgid - Specifies the message ID.                          
- * Return: Return code from CP IUCV call.                          
- *         (-EINVAL) - Buffer address is NULL.                              
+ *        buffer - Sddress of array of send buffers.
+ *        buflen - Total length of send buffers.
+ *        ansbuf - Address of array of buffer into which IUCV moves the reply
+ *                 of this message.
+ *        anslen - Address of length reply buffers.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_send2way_array (u16 pathid,
                         u32 * msgid,
@@ -758,27 +758,27 @@ int iucv_send2way_array (u16 pathid,
                         iucv_array_t * buffer,
                         ulong buflen, iucv_array_t * ansbuf, ulong anslen);
 
-/*                                                                     
- * Name: iucv_send2way_prmmsg                                          
- * Purpose: This function transmits data to another application.       
- *          Prmmsg specifies that the 8-bytes of data are to be moved  
- *          into the parameter list. This is a two-way message and the 
- *          receiver of the message is expected to reply. A buffer     
- *          is provided into which IUCV moves the reply to this        
- *          message.                                                   
- * Input: pathid - Rath identification number.                          
- *        trgcls - Specifies target class.                              
- *        srccls - Specifies the source message class.                  
- *        msgtag - Specifies a tag to be associated with the message.   
+/*
+ * Name: iucv_send2way_prmmsg
+ * Purpose: This function transmits data to another application.
+ *          Prmmsg specifies that the 8-bytes of data are to be moved
+ *          into the parameter list. This is a two-way message and the
+ *          receiver of the message is expected to reply. A buffer
+ *          is provided into which IUCV moves the reply to this
+ *          message.
+ * Input: pathid - Rath identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag to be associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 Specifies if you want to send priority message.
- *        prmmsg - 8-bytes of data to be placed in parameter list.      
- *        ansbuf - Address of buffer into which IUCV moves the reply of    
+ *        prmmsg - 8-bytes of data to be placed in parameter list.
+ *        ansbuf - Address of buffer into which IUCV moves the reply of
  *                 this message.
- *        anslen - Address of length of buffer.               
- * Output: msgid - Specifies the message ID.                           
- * Return: Return code from CP IUCV call.                           
- *         (-EINVAL) - Buffer address is NULL.         
+ *        anslen - Address of length of buffer.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Buffer address is NULL.
 */
 int iucv_send2way_prmmsg (u16 pathid,
                          u32 * msgid,
@@ -788,29 +788,29 @@ int iucv_send2way_prmmsg (u16 pathid,
                          ulong flags1,
                          uchar prmmsg[8], void *ansbuf, ulong anslen);
 
-/*                                                                      
- * Name: iucv_send2way_prmmsg_array                                     
- * Purpose: This function transmits data to another application.        
- *          Prmmsg specifies that the 8-bytes of data are to be moved   
- *          into the parameter list. This is a two-way message and the  
- *          receiver of the message is expected to reply. A buffer      
- *          is provided into which IUCV moves the reply to this         
- *          message. The contents of ansbuf is the address of the       
- *          array of addresses and lengths of discontiguous buffers     
- *          that contain the reply.                                     
- * Input: pathid - Path identification number.                           
- *        trgcls - Specifies target class.                               
- *        srccls - Specifies the source message class.                   
- *        msgtag - Specifies a tag to be associated with the message.    
+/*
+ * Name: iucv_send2way_prmmsg_array
+ * Purpose: This function transmits data to another application.
+ *          Prmmsg specifies that the 8-bytes of data are to be moved
+ *          into the parameter list. This is a two-way message and the
+ *          receiver of the message is expected to reply. A buffer
+ *          is provided into which IUCV moves the reply to this
+ *          message. The contents of ansbuf is the address of the
+ *          array of addresses and lengths of discontiguous buffers
+ *          that contain the reply.
+ * Input: pathid - Path identification number.
+ *        trgcls - Specifies target class.
+ *        srccls - Specifies the source message class.
+ *        msgtag - Specifies a tag to be associated with the message.
  *        flags1 - Option for path.
  *          IPPRTY- 0x20 specifies if you want to send priority message.
- *        prmmsg - 8-bytes of data to be placed into the parameter list. 
+ *        prmmsg - 8-bytes of data to be placed into the parameter list.
  *        ansbuf - Address of array of buffer into which IUCV moves the reply
- *                 of this message.  
- *        anslen - Address of length of reply buffers.                
- * Output: msgid - Specifies the message ID.      
- * Return: Return code from CP IUCV call.      
- *         (-EINVAL) - Ansbuf address is NULL.          
+ *                 of this message.
+ *        anslen - Address of length of reply buffers.
+ * Output: msgid - Specifies the message ID.
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Ansbuf address is NULL.
 */
 int iucv_send2way_prmmsg_array (u16 pathid,
                                u32 * msgid,
@@ -821,29 +821,29 @@ int iucv_send2way_prmmsg_array (u16 pathid,
                                uchar prmmsg[8],
                                iucv_array_t * ansbuf, ulong anslen);
 
-/*                                                                   
- * Name: iucv_setmask                                                
- * Purpose: This function enables or disables the following IUCV     
- *          external interruptions: Nonpriority and priority message 
- *          interrupts, nonpriority and priority reply interrupts.   
+/*
+ * Name: iucv_setmask
+ * Purpose: This function enables or disables the following IUCV
+ *          external interruptions: Nonpriority and priority message
+ *          interrupts, nonpriority and priority reply interrupts.
  * Input: SetMaskFlag - options for interrupts
- *           0x80 - Nonpriority_MessagePendingInterruptsFlag         
- *           0x40 - Priority_MessagePendingInterruptsFlag            
- *           0x20 - Nonpriority_MessageCompletionInterruptsFlag      
- *           0x10 - Priority_MessageCompletionInterruptsFlag         
+ *           0x80 - Nonpriority_MessagePendingInterruptsFlag
+ *           0x40 - Priority_MessagePendingInterruptsFlag
+ *           0x20 - Nonpriority_MessageCompletionInterruptsFlag
+ *           0x10 - Priority_MessageCompletionInterruptsFlag
  *           0x08 - IUCVControlInterruptsFlag
- * Output: NA                                                        
- * Return: Return code from CP IUCV call.                         
+ * Output: NA
+ * Return: Return code from CP IUCV call.
 */
 int iucv_setmask (int SetMaskFlag);
 
-/*                                                  
- * Name: iucv_sever                                 
- * Purpose: This function terminates an IUCV path.  
- * Input: pathid - Path identification number.       
- *        user_data - 16-bytes of user data.         
- * Output: NA       
- * Return: Return code from CP IUCV call.                                
- *         (-EINVAL) - Interal error, wild pointer.       
+/*
+ * Name: iucv_sever
+ * Purpose: This function terminates an IUCV path.
+ * Input: pathid - Path identification number.
+ *        user_data - 16-bytes of user data.
+ * Output: NA
+ * Return: Return code from CP IUCV call.
+ *         (-EINVAL) - Interal error, wild pointer.
 */
 int iucv_sever (u16 pathid, uchar user_data[16]);
index 5d6b7a57b02f16e81bb1a343480e64e3ff464d5d..f94419b334f7c064c840c831adf9c77eac15e82d 100644 (file)
@@ -68,6 +68,7 @@ static void lcs_tasklet(unsigned long);
 static void lcs_start_kernel_thread(struct lcs_card *card);
 static void lcs_get_frames_cb(struct lcs_channel *, struct lcs_buffer *);
 static int lcs_send_delipm(struct lcs_card *, struct lcs_ipm_list *);
+static int lcs_recovery(void *ptr);
 
 /**
  * Debug Facility Stuff
@@ -429,12 +430,6 @@ lcs_setup_card(struct lcs_card *card)
        card->tx_buffer = NULL;
        card->tx_emitted = 0;
 
-       /* Initialize kernel thread task used for LGW commands. */
-       INIT_WORK(&card->kernel_thread_starter,
-                 (void *)lcs_start_kernel_thread,card);
-       card->thread_start_mask = 0;
-       card->thread_allowed_mask = 0;
-       card->thread_running_mask = 0;
        init_waitqueue_head(&card->wait_q);
        spin_lock_init(&card->lock);
        spin_lock_init(&card->ipm_lock);
@@ -675,8 +670,9 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
        int index, rc;
 
        LCS_DBF_TEXT(5, trace, "rdybuff");
-       BUG_ON(buffer->state != BUF_STATE_LOCKED &&
-               buffer->state != BUF_STATE_PROCESSED);
+       if (buffer->state != BUF_STATE_LOCKED &&
+           buffer->state != BUF_STATE_PROCESSED)
+               BUG();
        spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
        buffer->state = BUF_STATE_READY;
        index = buffer - channel->iob;
@@ -700,7 +696,8 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
        int index, prev, next;
 
        LCS_DBF_TEXT(5, trace, "prcsbuff");
-       BUG_ON(buffer->state != BUF_STATE_READY);
+       if (buffer->state != BUF_STATE_READY)
+               BUG();
        buffer->state = BUF_STATE_PROCESSED;
        index = buffer - channel->iob;
        prev = (index - 1) & (LCS_NUM_BUFFS - 1);
@@ -732,8 +729,9 @@ lcs_release_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
        unsigned long flags;
 
        LCS_DBF_TEXT(5, trace, "relbuff");
-       BUG_ON(buffer->state != BUF_STATE_LOCKED &&
-               buffer->state != BUF_STATE_PROCESSED);
+       if (buffer->state != BUF_STATE_LOCKED &&
+           buffer->state != BUF_STATE_PROCESSED)
+               BUG();
        spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
        buffer->state = BUF_STATE_EMPTY;
        spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
@@ -1147,8 +1145,6 @@ list_modified:
                list_add_tail(&ipm->list, &card->ipm_list);
        }
        spin_unlock_irqrestore(&card->ipm_lock, flags);
-       if (card->state == DEV_STATE_UP)
-               netif_wake_queue(card->dev);
 }
 
 /**
@@ -1231,17 +1227,17 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev)
                if (ipm != NULL)
                        continue;       /* Address already in list. */
                ipm = (struct lcs_ipm_list *)
-                       kmalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC);
+                       kzalloc(sizeof(struct lcs_ipm_list), GFP_ATOMIC);
                if (ipm == NULL) {
                        PRINT_INFO("Not enough memory to add "
                                   "new multicast entry!\n");
                        break;
                }
-               memset(ipm, 0, sizeof(struct lcs_ipm_list));
                memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH);
                ipm->ipm.ip_addr = im4->multiaddr;
                ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED;
                spin_lock_irqsave(&card->ipm_lock, flags);
+               LCS_DBF_HEX(2,trace,&ipm->ipm.ip_addr,4);
                list_add(&ipm->list, &card->ipm_list);
                spin_unlock_irqrestore(&card->ipm_lock, flags);
        }
@@ -1269,7 +1265,15 @@ lcs_register_mc_addresses(void *data)
        read_unlock(&in4_dev->mc_list_lock);
        in_dev_put(in4_dev);
 
+       netif_carrier_off(card->dev);
+       netif_tx_disable(card->dev);
+       wait_event(card->write.wait_q,
+                       (card->write.state != CH_STATE_RUNNING));
        lcs_fix_multicast_list(card);
+       if (card->state == DEV_STATE_UP) {
+               netif_carrier_on(card->dev);
+               netif_wake_queue(card->dev);
+       }
 out:
        lcs_clear_thread_running_bit(card, LCS_SET_MC_THREAD);
        return 0;
@@ -1286,7 +1290,7 @@ lcs_set_multicast_list(struct net_device *dev)
         LCS_DBF_TEXT(4, trace, "setmulti");
         card = (struct lcs_card *) dev->priv;
 
-        if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD)) 
+        if (!lcs_set_thread_start_bit(card, LCS_SET_MC_THREAD))
                schedule_work(&card->kernel_thread_starter);
 }
 
@@ -1318,6 +1322,53 @@ lcs_check_irb_error(struct ccw_device *cdev, struct irb *irb)
        return PTR_ERR(irb);
 }
 
+static int
+lcs_get_problem(struct ccw_device *cdev, struct irb *irb)
+{
+       int dstat, cstat;
+       char *sense;
+
+       sense = (char *) irb->ecw;
+       cstat = irb->scsw.cstat;
+       dstat = irb->scsw.dstat;
+
+       if (cstat & (SCHN_STAT_CHN_CTRL_CHK | SCHN_STAT_INTF_CTRL_CHK |
+                    SCHN_STAT_CHN_DATA_CHK | SCHN_STAT_CHAIN_CHECK |
+                    SCHN_STAT_PROT_CHECK   | SCHN_STAT_PROG_CHECK)) {
+               LCS_DBF_TEXT(2, trace, "CGENCHK");
+               return 1;
+       }
+       if (dstat & DEV_STAT_UNIT_CHECK) {
+               if (sense[LCS_SENSE_BYTE_1] &
+                   LCS_SENSE_RESETTING_EVENT) {
+                       LCS_DBF_TEXT(2, trace, "REVIND");
+                       return 1;
+               }
+               if (sense[LCS_SENSE_BYTE_0] &
+                   LCS_SENSE_CMD_REJECT) {
+                       LCS_DBF_TEXT(2, trace, "CMDREJ");
+                       return 0;
+               }
+               if ((!sense[LCS_SENSE_BYTE_0]) &&
+                   (!sense[LCS_SENSE_BYTE_1]) &&
+                   (!sense[LCS_SENSE_BYTE_2]) &&
+                   (!sense[LCS_SENSE_BYTE_3])) {
+                       LCS_DBF_TEXT(2, trace, "ZEROSEN");
+                       return 0;
+               }
+               LCS_DBF_TEXT(2, trace, "DGENCHK");
+               return 1;
+       }
+       return 0;
+}
+
+void
+lcs_schedule_recovery(struct lcs_card *card)
+{
+       LCS_DBF_TEXT(2, trace, "startrec");
+       if (!lcs_set_thread_start_bit(card, LCS_RECOVERY_THREAD))
+               schedule_work(&card->kernel_thread_starter);
+}
 
 /**
  * IRQ Handler for LCS channels
@@ -1327,7 +1378,8 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
 {
        struct lcs_card *card;
        struct lcs_channel *channel;
-       int index;
+       int rc, index;
+       int cstat, dstat;
 
        if (lcs_check_irb_error(cdev, irb))
                return;
@@ -1338,17 +1390,30 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
        else
                channel = &card->write;
 
+       cstat = irb->scsw.cstat;
+       dstat = irb->scsw.dstat;
        LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id);
        LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.cstat, irb->scsw.dstat);
        LCS_DBF_TEXT_(5, trace, "%4x%4x",irb->scsw.fctl, irb->scsw.actl);
 
+       /* Check for channel and device errors presented */
+       rc = lcs_get_problem(cdev, irb);
+       if (rc || (dstat & DEV_STAT_UNIT_EXCEP)) {
+               PRINT_WARN("check on device %s, dstat=0x%X, cstat=0x%X \n",
+                           cdev->dev.bus_id, dstat, cstat);
+               if (rc) {
+                       lcs_schedule_recovery(card);
+                       wake_up(&card->wait_q);
+                       return;
+               }
+       }
        /* How far in the ccw chain have we processed? */
        if ((channel->state != CH_STATE_INIT) &&
            (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) {
-               index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) 
+               index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa)
                        - channel->ccws;
                if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) ||
-                   (irb->scsw.cstat | SCHN_STAT_PCI))
+                   (irb->scsw.cstat & SCHN_STAT_PCI))
                        /* Bloody io subsystem tells us lies about cpa... */
                        index = (index - 1) & (LCS_NUM_BUFFS - 1);
                while (channel->io_idx != index) {
@@ -1367,7 +1432,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
        else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED)
                /* CCW execution stopped on a suspend bit. */
                channel->state = CH_STATE_SUSPENDED;
-
        if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) {
                if (irb->scsw.cc != 0) {
                        ccw_device_halt(channel->ccwdev, (addr_t) channel);
@@ -1376,7 +1440,6 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
                /* The channel has been stopped by halt_IO. */
                channel->state = CH_STATE_HALTED;
        }
-
        if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) {
                channel->state = CH_STATE_CLEARED;
        }
@@ -1452,7 +1515,7 @@ lcs_txbuffer_cb(struct lcs_channel *channel, struct lcs_buffer *buffer)
        lcs_release_buffer(channel, buffer);
        card = (struct lcs_card *)
                ((char *) channel - offsetof(struct lcs_card, write));
-       if (netif_queue_stopped(card->dev))
+       if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev))
                netif_wake_queue(card->dev);
        spin_lock(&card->lock);
        card->tx_emitted--;
@@ -1488,6 +1551,10 @@ __lcs_start_xmit(struct lcs_card *card, struct sk_buff *skb,
                card->stats.tx_carrier_errors++;
                return 0;
        }
+       if (skb->protocol == htons(ETH_P_IPV6)) {
+               dev_kfree_skb(skb);
+               return 0;
+       }
        netif_stop_queue(card->dev);
        spin_lock(&card->lock);
        if (card->tx_buffer != NULL &&
@@ -1632,30 +1699,6 @@ lcs_detect(struct lcs_card *card)
        return rc;
 }
 
-/**
- * reset card
- */
-static int
-lcs_resetcard(struct lcs_card *card)
-{
-       int retries;
-
-       LCS_DBF_TEXT(2, trace, "rescard");
-       for (retries = 0; retries < 10; retries++) {
-               if (lcs_detect(card) == 0) {
-                       netif_wake_queue(card->dev);
-                       card->state = DEV_STATE_UP;
-                       PRINT_INFO("LCS device %s successfully restarted!\n",
-                                  card->dev->name);
-                       return 0;
-               }
-               msleep(3000);
-       }
-       PRINT_ERR("Error in Reseting LCS card!\n");
-       return -EIO;
-}
-
-
 /**
  * LCS Stop card
  */
@@ -1679,111 +1722,6 @@ lcs_stopcard(struct lcs_card *card)
        return rc;
 }
 
-/**
- * LGW initiated commands
- */
-static int
-lcs_lgw_startlan_thread(void *data)
-{
-       struct lcs_card *card;
-
-       card = (struct lcs_card *) data;
-       daemonize("lgwstpln");
-
-       if (!lcs_do_run_thread(card, LCS_STARTLAN_THREAD))
-               return 0;
-       LCS_DBF_TEXT(4, trace, "lgwstpln");
-       if (card->dev)
-               netif_stop_queue(card->dev);
-       if (lcs_startlan(card) == 0) {
-               netif_wake_queue(card->dev);
-               card->state = DEV_STATE_UP;
-               PRINT_INFO("LCS Startlan for device %s succeeded!\n",
-                          card->dev->name);
-
-       } else
-               PRINT_ERR("LCS Startlan for device %s failed!\n",
-                         card->dev->name);
-       lcs_clear_thread_running_bit(card, LCS_STARTLAN_THREAD);
-       return 0;
-}
-
-/**
- * Send startup command initiated by Lan Gateway
- */
-static int
-lcs_lgw_startup_thread(void *data)
-{
-       int rc;
-
-       struct lcs_card *card;
-
-       card = (struct lcs_card *) data;
-       daemonize("lgwstaln");
-
-       if (!lcs_do_run_thread(card, LCS_STARTUP_THREAD))
-               return 0;
-       LCS_DBF_TEXT(4, trace, "lgwstaln");
-       if (card->dev)
-               netif_stop_queue(card->dev);
-       rc = lcs_send_startup(card, LCS_INITIATOR_LGW);
-       if (rc != 0) {
-               PRINT_ERR("Startup for LCS device %s initiated " \
-                         "by LGW failed!\nReseting card ...\n",
-                         card->dev->name);
-               /* do a card reset */
-               rc = lcs_resetcard(card);
-               if (rc == 0)
-                       goto Done;
-       }
-       rc = lcs_startlan(card);
-       if (rc == 0) {
-               netif_wake_queue(card->dev);
-               card->state = DEV_STATE_UP;
-       }
-Done:
-       if (rc == 0)
-               PRINT_INFO("LCS Startup for device %s succeeded!\n",
-                          card->dev->name);
-       else
-               PRINT_ERR("LCS Startup for device %s failed!\n",
-                         card->dev->name);
-       lcs_clear_thread_running_bit(card, LCS_STARTUP_THREAD);
-       return 0;
-}
-
-
-/**
- * send stoplan command initiated by Lan Gateway
- */
-static int
-lcs_lgw_stoplan_thread(void *data)
-{
-       struct lcs_card *card;
-       int rc;
-
-       card = (struct lcs_card *) data;
-       daemonize("lgwstop");
-
-       if (!lcs_do_run_thread(card, LCS_STOPLAN_THREAD))
-               return 0;
-       LCS_DBF_TEXT(4, trace, "lgwstop");
-       if (card->dev)
-               netif_stop_queue(card->dev);
-       if (lcs_send_stoplan(card, LCS_INITIATOR_LGW) == 0)
-               PRINT_INFO("Stoplan for %s initiated by LGW succeeded!\n",
-                          card->dev->name);
-       else
-               PRINT_ERR("Stoplan %s initiated by LGW failed!\n",
-                         card->dev->name);
-       /*Try to reset the card, stop it on failure */
-        rc = lcs_resetcard(card);
-        if (rc != 0)
-                rc = lcs_stopcard(card);
-       lcs_clear_thread_running_bit(card, LCS_STOPLAN_THREAD);
-        return rc;
-}
-
 /**
  * Kernel Thread helper functions for LGW initiated commands
  */
@@ -1791,15 +1729,12 @@ static void
 lcs_start_kernel_thread(struct lcs_card *card)
 {
        LCS_DBF_TEXT(5, trace, "krnthrd");
-       if (lcs_do_start_thread(card, LCS_STARTUP_THREAD))
-               kernel_thread(lcs_lgw_startup_thread, (void *) card, SIGCHLD);
-       if (lcs_do_start_thread(card, LCS_STARTLAN_THREAD))
-               kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD);
-       if (lcs_do_start_thread(card, LCS_STOPLAN_THREAD))
-               kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD);
+       if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD))
+               kernel_thread(lcs_recovery, (void *) card, SIGCHLD);
 #ifdef CONFIG_IP_MULTICAST
        if (lcs_do_start_thread(card, LCS_SET_MC_THREAD))
-               kernel_thread(lcs_register_mc_addresses, (void *) card, SIGCHLD);
+               kernel_thread(lcs_register_mc_addresses,
+                               (void *) card, SIGCHLD);
 #endif
 }
 
@@ -1813,19 +1748,14 @@ lcs_get_control(struct lcs_card *card, struct lcs_cmd *cmd)
        if (cmd->initiator == LCS_INITIATOR_LGW) {
                switch(cmd->cmd_code) {
                case LCS_CMD_STARTUP:
-                       if (!lcs_set_thread_start_bit(card,
-                                                     LCS_STARTUP_THREAD))
-                               schedule_work(&card->kernel_thread_starter);
-                       break;
                case LCS_CMD_STARTLAN:
-                       if (!lcs_set_thread_start_bit(card,
-                                                     LCS_STARTLAN_THREAD))
-                               schedule_work(&card->kernel_thread_starter);
+                       lcs_schedule_recovery(card);
                        break;
                case LCS_CMD_STOPLAN:
-                       if (!lcs_set_thread_start_bit(card,
-                                                     LCS_STOPLAN_THREAD))
-                               schedule_work(&card->kernel_thread_starter);
+                       PRINT_WARN("Stoplan for %s initiated by LGW.\n",
+                                       card->dev->name);
+                       if (card->dev)
+                               netif_carrier_off(card->dev);
                        break;
                default:
                        PRINT_INFO("UNRECOGNIZED LGW COMMAND\n");
@@ -1941,8 +1871,11 @@ lcs_stop_device(struct net_device *dev)
 
        LCS_DBF_TEXT(2, trace, "stopdev");
        card   = (struct lcs_card *) dev->priv;
-       netif_stop_queue(dev);
+       netif_carrier_off(dev);
+       netif_tx_disable(dev);
        dev->flags &= ~IFF_UP;
+       wait_event(card->write.wait_q,
+               (card->write.state != CH_STATE_RUNNING));
        rc = lcs_stopcard(card);
        if (rc)
                PRINT_ERR("Try it again!\n ");
@@ -1968,6 +1901,7 @@ lcs_open_device(struct net_device *dev)
 
        } else {
                dev->flags |= IFF_UP;
+               netif_carrier_on(dev);
                netif_wake_queue(dev);
                card->state = DEV_STATE_UP;
        }
@@ -2059,10 +1993,31 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char
 
 DEVICE_ATTR(lancmd_timeout, 0644, lcs_timeout_show, lcs_timeout_store);
 
+static ssize_t
+lcs_dev_recover_store(struct device *dev, struct device_attribute *attr,
+                     const char *buf, size_t count)
+{
+       struct lcs_card *card = dev->driver_data;
+       char *tmp;
+       int i;
+
+       if (!card)
+               return -EINVAL;
+       if (card->state != DEV_STATE_UP)
+               return -EPERM;
+       i = simple_strtoul(buf, &tmp, 16);
+       if (i == 1)
+               lcs_schedule_recovery(card);
+       return count;
+}
+
+static DEVICE_ATTR(recover, 0200, NULL, lcs_dev_recover_store);
+
 static struct attribute * lcs_attrs[] = {
        &dev_attr_portno.attr,
        &dev_attr_type.attr,
        &dev_attr_lancmd_timeout.attr,
+       &dev_attr_recover.attr,
        NULL,
 };
 
@@ -2099,6 +2054,12 @@ lcs_probe_device(struct ccwgroup_device *ccwgdev)
        ccwgdev->dev.driver_data = card;
        ccwgdev->cdev[0]->handler = lcs_irq;
        ccwgdev->cdev[1]->handler = lcs_irq;
+       card->gdev = ccwgdev;
+       INIT_WORK(&card->kernel_thread_starter,
+                 (void *) lcs_start_kernel_thread, card);
+       card->thread_start_mask = 0;
+       card->thread_allowed_mask = 0;
+       card->thread_running_mask = 0;
         return 0;
 }
 
@@ -2200,6 +2161,7 @@ netdev_out:
        if (recover_state == DEV_STATE_RECOVER) {
                lcs_set_multicast_list(card->dev);
                card->dev->flags |= IFF_UP;
+               netif_carrier_on(card->dev);
                netif_wake_queue(card->dev);
                card->state = DEV_STATE_UP;
        } else {
@@ -2229,7 +2191,7 @@ out:
  * lcs_shutdown_device, called when setting the group device offline.
  */
 static int
-lcs_shutdown_device(struct ccwgroup_device *ccwgdev)
+__lcs_shutdown_device(struct ccwgroup_device *ccwgdev, int recovery_mode)
 {
        struct lcs_card *card;
        enum lcs_dev_states recover_state;
@@ -2239,9 +2201,11 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev)
        card = (struct lcs_card *)ccwgdev->dev.driver_data;
        if (!card)
                return -ENODEV;
-       lcs_set_allowed_threads(card, 0);
-       if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD))
-               return -ERESTARTSYS;
+       if (recovery_mode == 0) {
+               lcs_set_allowed_threads(card, 0);
+               if (lcs_wait_for_threads(card, LCS_SET_MC_THREAD))
+                       return -ERESTARTSYS;
+       }
        LCS_DBF_HEX(3, setup, &card, sizeof(void*));
        recover_state = card->state;
 
@@ -2256,6 +2220,43 @@ lcs_shutdown_device(struct ccwgroup_device *ccwgdev)
        return 0;
 }
 
+static int
+lcs_shutdown_device(struct ccwgroup_device *ccwgdev)
+{
+       return __lcs_shutdown_device(ccwgdev, 0);
+}
+
+/**
+ * drive lcs recovery after startup and startlan initiated by Lan Gateway
+ */
+static int
+lcs_recovery(void *ptr)
+{
+       struct lcs_card *card;
+       struct ccwgroup_device *gdev;
+        int rc;
+
+       card = (struct lcs_card *) ptr;
+       daemonize("lcs_recover");
+
+       LCS_DBF_TEXT(4, trace, "recover1");
+       if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD))
+               return 0;
+       LCS_DBF_TEXT(4, trace, "recover2");
+       gdev = card->gdev;
+       PRINT_WARN("Recovery of device %s started...\n", gdev->dev.bus_id);
+       rc = __lcs_shutdown_device(gdev, 1);
+       rc = lcs_new_device(gdev);
+       if (!rc)
+               PRINT_INFO("Device %s successfully recovered!\n",
+                               card->dev->name);
+       else
+               PRINT_INFO("Device %s could not be recovered!\n",
+                               card->dev->name);
+       lcs_clear_thread_running_bit(card, LCS_RECOVERY_THREAD);
+       return 0;
+}
+
 /**
  * lcs_remove_device, free buffers and card
  */
index 2fad5e40c2e4e7d19ee567ccb28a4fbcd682878c..93143932983b4be1be7ed814147c4d26acbaf376 100644 (file)
@@ -73,13 +73,17 @@ do {                                       \
 /**
  * LCS sense byte definitions
  */
+#define LCS_SENSE_BYTE_0               0
+#define LCS_SENSE_BYTE_1               1
+#define LCS_SENSE_BYTE_2               2
+#define LCS_SENSE_BYTE_3               3
 #define LCS_SENSE_INTERFACE_DISCONNECT 0x01
 #define LCS_SENSE_EQUIPMENT_CHECK      0x10
 #define LCS_SENSE_BUS_OUT_CHECK                0x20
 #define LCS_SENSE_INTERVENTION_REQUIRED 0x40
 #define LCS_SENSE_CMD_REJECT           0x80
-#define LCS_SENSE_RESETTING_EVENT      0x0080
-#define LCS_SENSE_DEVICE_ONLINE                0x0020
+#define LCS_SENSE_RESETTING_EVENT      0x80
+#define LCS_SENSE_DEVICE_ONLINE                0x20
 
 /**
  * LCS packet type definitions
@@ -152,10 +156,9 @@ enum lcs_dev_states {
 
 enum lcs_threads {
        LCS_SET_MC_THREAD       = 1,
-       LCS_STARTLAN_THREAD     = 2,
-       LCS_STOPLAN_THREAD      = 4,
-       LCS_STARTUP_THREAD      = 8,
+       LCS_RECOVERY_THREAD     = 2,
 };
+
 /**
  * LCS struct declarations
  */
@@ -286,6 +289,7 @@ struct lcs_card {
        struct net_device_stats stats;
        unsigned short (*lan_type_trans)(struct sk_buff *skb,
                                         struct net_device *dev);
+       struct ccwgroup_device *gdev;
        struct lcs_channel read;
        struct lcs_channel write;
        struct lcs_buffer *tx_buffer;
index 260a93c8c442b6a882a520e07a4a13820bf97806..b452cc1afd550a5c7c24ed4bde87db498539952c 100644 (file)
@@ -30,7 +30,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-\f
+
 #undef DEBUG
 
 #include <linux/module.h>
@@ -65,7 +65,7 @@ MODULE_AUTHOR
     ("(C) 2001 IBM Corporation by Fritz Elfert (felfert@millenux.com)");
 MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver");
 
-\f
+
 #define PRINTK_HEADER " iucv: "       /* for debugging */
 
 static struct device_driver netiucv_driver = {
@@ -202,7 +202,7 @@ netiucv_printname(char *name)
        *p = '\0';
        return tmp;
 }
-\f
+
 /**
  * States of the interface statemachine.
  */
@@ -244,7 +244,7 @@ static const char *dev_event_names[] = {
        "Connection up",
        "Connection down",
 };
-\f
+
 /**
  * Events of the connection statemachine
  */
@@ -364,7 +364,7 @@ static const char *conn_state_names[] = {
        "Connect error",
 };
 
-\f
+
 /**
  * Debug Facility Stuff
  */
@@ -516,7 +516,7 @@ static void
 fsm_action_nop(fsm_instance *fi, int event, void *arg)
 {
 }
-\f
+
 /**
  * Actions of the connection statemachine
  *****************************************************************************/
@@ -993,7 +993,7 @@ static const fsm_node conn_fsm[] = {
 
 static const int CONN_FSM_LEN = sizeof(conn_fsm) / sizeof(fsm_node);
 
-\f
+
 /**
  * Actions for interface - statemachine.
  *****************************************************************************/
@@ -1182,7 +1182,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
 
                fsm_newstate(conn->fsm, CONN_STATE_TX);
                conn->prof.send_stamp = xtime;
-               
+
                rc = iucv_send(conn->pathid, NULL, 0, 0, 1 /* single_flag */,
                        0, nskb->data, nskb->len);
                               /* Shut up, gcc! nskb is always below 2G. */
@@ -1220,7 +1220,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
 
        return rc;
 }
-\f
+
 /**
  * Interface API for upper network layers
  *****************************************************************************/
@@ -1291,7 +1291,7 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
 
        /**
         * If connection is not running, try to restart it
-        * and throw away packet. 
+        * and throw away packet.
         */
        if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) {
                fsm_event(privptr->fsm, DEV_EVENT_START, dev);
@@ -1538,7 +1538,7 @@ static ssize_t
 maxcq_write (struct device *dev, struct device_attribute *attr, 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;
@@ -1559,7 +1559,7 @@ static ssize_t
 sdoio_write (struct device *dev, struct device_attribute *attr, 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;
@@ -1580,7 +1580,7 @@ static ssize_t
 mdoio_write (struct device *dev, struct device_attribute *attr, 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;
@@ -1601,7 +1601,7 @@ static ssize_t
 txlen_write (struct device *dev, struct device_attribute *attr, 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;
@@ -1622,7 +1622,7 @@ static ssize_t
 txtime_write (struct device *dev, struct device_attribute *attr, 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;
@@ -2000,7 +2000,7 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)
        }
 
        PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username));
-       
+
        return count;
 
 out_free_ndev:
@@ -2099,7 +2099,7 @@ static int __init
 netiucv_init(void)
 {
        int ret;
-       
+
        ret = iucv_register_dbf_views();
        if (ret) {
                PRINT_WARN("netiucv_init failed, "
@@ -2128,7 +2128,7 @@ netiucv_init(void)
        }
        return ret;
 }
-       
+
 module_init(netiucv_init);
 module_exit(netiucv_exit);
 MODULE_LICENSE("GPL");
index 4df0fcd7b10b18a092aaeba16d6e1f80b120b9e4..619f4a0c7160d5692d09ede8b3b705a6d74790c8 100644 (file)
@@ -376,7 +376,7 @@ struct qeth_hdr_osn {
        __u8 reserved3[18];
        __u32 ccid;
 } __attribute__ ((packed));
-                                           
+
 struct qeth_hdr {
        union {
                struct qeth_hdr_layer2 l2;
@@ -825,7 +825,7 @@ struct qeth_card {
        int use_hard_stop;
        int (*orig_hard_header)(struct sk_buff *,struct net_device *,
                                unsigned short,void *,void *,unsigned);
-       struct qeth_osn_info osn_info; 
+       struct qeth_osn_info osn_info;
 };
 
 struct qeth_card_list_struct {
@@ -944,7 +944,7 @@ qeth_get_netdev_flags(struct qeth_card *card)
                return 0;
        switch (card->info.type) {
        case QETH_CARD_TYPE_IQD:
-       case QETH_CARD_TYPE_OSN:        
+       case QETH_CARD_TYPE_OSN:
                return IFF_NOARP;
 #ifdef CONFIG_QETH_IPV6
        default:
@@ -981,7 +981,7 @@ static inline int
 qeth_get_max_mtu_for_card(int cardtype)
 {
        switch (cardtype) {
-               
+
        case QETH_CARD_TYPE_UNKNOWN:
        case QETH_CARD_TYPE_OSAE:
        case QETH_CARD_TYPE_OSN:
@@ -1097,9 +1097,9 @@ qeth_string_to_ipaddr4(const char *buf, __u8 *addr)
        int count = 0, rc = 0;
        int in[4];
 
-       rc = sscanf(buf, "%d.%d.%d.%d%n", 
+       rc = sscanf(buf, "%d.%d.%d.%d%n",
                    &in[0], &in[1], &in[2], &in[3], &count);
-       if (rc != 4  || count
+       if (rc != 4  || count<=0)
                return -EINVAL;
        for (count = 0; count < 4; count++) {
                if (in[count] > 255)
@@ -1131,7 +1131,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
 
        cnt = out = found = save_cnt = num2 = 0;
         end = start = (char *) buf;
-       in = (__u16 *) addr;    
+       in = (__u16 *) addr;
        memset(in, 0, 16);
         while (end) {
                 end = strchr(end,':');
@@ -1139,7 +1139,7 @@ qeth_string_to_ipaddr6(const char *buf, __u8 *addr)
                         end = (char *)buf + (strlen(buf));
                         out = 1;
                 }
-                if ((end - start)) { 
+                if ((end - start)) {
                         memset(num, 0, 5);
                         memcpy(num, start, end - start);
                        if (!qeth_isxdigit(num))
@@ -1241,5 +1241,5 @@ qeth_osn_register(unsigned char *read_dev_no,
 
 extern void
 qeth_osn_deregister(struct net_device *);
-               
+
 #endif /* __QETH_H__ */
index 44e226f211e7b1cb2ab7baf182230720242f65c9..0bab60a203094239b6e4893533aa473f4b3d269e 100644 (file)
@@ -81,7 +81,7 @@ void
 qeth_eddp_buf_release_contexts(struct qeth_qdio_out_buffer *buf)
 {
        struct qeth_eddp_context_reference *ref;
-       
+
        QETH_DBF_TEXT(trace, 6, "eddprctx");
        while (!list_empty(&buf->ctx_list)){
                ref = list_entry(buf->ctx_list.next,
@@ -135,7 +135,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue,
                                           "buffer!\n");
                                goto out;
                        }
-               }               
+               }
                /* check if the whole next skb fits into current buffer */
                if ((QETH_MAX_BUFFER_ELEMENTS(queue->card) -
                                        buf->next_element_to_fill)
@@ -148,7 +148,7 @@ qeth_eddp_fill_buffer(struct qeth_qdio_out_q *queue,
                         * and increment ctx's refcnt */
                        must_refcnt = 1;
                        continue;
-               }       
+               }
                if (must_refcnt){
                        must_refcnt = 0;
                        if (qeth_eddp_buf_ref_context(buf, ctx)){
@@ -266,7 +266,7 @@ qeth_eddp_copy_data_tcp(char *dst, struct qeth_eddp_data *eddp, int len,
        int left_in_frag;
        int copy_len;
        u8 *src;
-       
+
        QETH_DBF_TEXT(trace, 5, "eddpcdtc");
        if (skb_shinfo(eddp->skb)->nr_frags == 0) {
                memcpy(dst, eddp->skb->data + eddp->skb_offset, len);
@@ -408,7 +408,7 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
        struct tcphdr *tcph;
        int data_len;
        u32 hcsum;
-       
+
        QETH_DBF_TEXT(trace, 5, "eddpftcp");
        eddp->skb_offset = sizeof(struct qeth_hdr) + eddp->nhl + eddp->thl;
        if (eddp->qh.hdr.l2.id == QETH_HEADER_TYPE_LAYER2) {
@@ -465,13 +465,13 @@ __qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                eddp->th.tcp.h.seq += data_len;
        }
 }
-                          
+
 static inline int
 qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
                           struct sk_buff *skb, struct qeth_hdr *qhdr)
 {
        struct qeth_eddp_data *eddp = NULL;
-       
+
        QETH_DBF_TEXT(trace, 5, "eddpficx");
        /* create our segmentation headers and copy original headers */
        if (skb->protocol == ETH_P_IP)
@@ -512,7 +512,7 @@ qeth_eddp_calc_num_pages(struct qeth_eddp_context *ctx, struct sk_buff *skb,
                         int hdr_len)
 {
        int skbs_per_page;
-       
+
        QETH_DBF_TEXT(trace, 5, "eddpcanp");
        /* can we put multiple skbs in one page? */
        skbs_per_page = PAGE_SIZE / (skb_shinfo(skb)->tso_size + hdr_len);
@@ -588,7 +588,7 @@ qeth_eddp_create_context_tcp(struct qeth_card *card, struct sk_buff *skb,
                             struct qeth_hdr *qhdr)
 {
        struct qeth_eddp_context *ctx = NULL;
-       
+
        QETH_DBF_TEXT(trace, 5, "creddpct");
        if (skb->protocol == ETH_P_IP)
                ctx = qeth_eddp_create_context_generic(card, skb,
index e422b41c656e26ba11185c225f350c0113d9cd38..61faf05517d63bdb3071856e0383c485c4148858 100644 (file)
@@ -42,7 +42,7 @@ qeth_create_device_attributes_osn(struct device *dev);
 
 extern void
 qeth_remove_device_attributes_osn(struct device *dev);
-                   
+
 extern int
 qeth_create_driver_attributes(void);
 
index cb14642d97aa8300a12e37238933b91271077d9c..9e671a48cd2f1368460bc49935e5905a0c86f7f6 100644 (file)
@@ -513,7 +513,7 @@ __qeth_set_offline(struct ccwgroup_device *cgdev, int recovery_mode)
 
        QETH_DBF_TEXT(setup, 3, "setoffl");
        QETH_DBF_HEX(setup, 3, &card, sizeof(void *));
-       
+
        if (card->dev && netif_carrier_ok(card->dev))
                netif_carrier_off(card->dev);
        recover_flag = card->state;
@@ -604,13 +604,13 @@ __qeth_ref_ip_on_card(struct qeth_card *card, struct qeth_ipaddr *todo,
        list_for_each_entry(addr, &card->ip_list, entry) {
                if (card->options.layer2) {
                        if ((addr->type == todo->type) &&
-                           (memcmp(&addr->mac, &todo->mac, 
+                           (memcmp(&addr->mac, &todo->mac,
                                    OSA_ADDR_LEN) == 0)) {
                                found = 1;
                                break;
                        }
                        continue;
-               } 
+               }
                if ((addr->proto     == QETH_PROT_IPV4)  &&
                    (todo->proto     == QETH_PROT_IPV4)  &&
                    (addr->type      == todo->type)      &&
@@ -694,13 +694,13 @@ __qeth_insert_ip_todo(struct qeth_card *card, struct qeth_ipaddr *addr, int add)
                if (card->options.layer2) {
                        if ((tmp->type  == addr->type)  &&
                            (tmp->is_multicast == addr->is_multicast) &&
-                           (memcmp(&tmp->mac, &addr->mac, 
+                           (memcmp(&tmp->mac, &addr->mac,
                                    OSA_ADDR_LEN) == 0)) {
                                found = 1;
                                break;
                        }
                        continue;
-               }        
+               }
                if ((tmp->proto        == QETH_PROT_IPV4)     &&
                    (addr->proto       == QETH_PROT_IPV4)     &&
                    (tmp->type         == addr->type)         &&
@@ -1173,7 +1173,7 @@ qeth_determine_card_type(struct qeth_card *card)
                                           "due to hardware limitations!\n");
                                card->qdio.no_out_queues = 1;
                                card->qdio.default_out_queue = 0;
-                       } 
+                       }
                        return 0;
                }
                i++;
@@ -1198,7 +1198,7 @@ qeth_probe_device(struct ccwgroup_device *gdev)
                return -ENODEV;
 
        QETH_DBF_TEXT_(setup, 2, "%s", gdev->dev.bus_id);
-       
+
        card = qeth_alloc_card();
        if (!card) {
                put_device(dev);
@@ -1220,7 +1220,7 @@ qeth_probe_device(struct ccwgroup_device *gdev)
                put_device(dev);
                qeth_free_card(card);
                return rc;
-       }                           
+       }
        if ((rc = qeth_setup_card(card))){
                QETH_DBF_TEXT_(setup, 2, "2err%d", rc);
                put_device(dev);
@@ -1843,7 +1843,7 @@ struct qeth_cmd_buffer *iob)
               &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH);
        QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN);
 }
-                                                   
+
 static int
 qeth_send_control_data(struct qeth_card *card, int len,
                       struct qeth_cmd_buffer *iob,
@@ -1937,7 +1937,7 @@ qeth_osn_send_control_data(struct qeth_card *card, int len,
                wake_up(&card->wait_q);
        }
        return rc;
-}                                      
+}
 
 static inline void
 qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
@@ -1966,7 +1966,7 @@ qeth_osn_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
        memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2);
        return qeth_osn_send_control_data(card, s1, iob);
 }
-                                                           
+
 static int
 qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
                  int (*reply_cb)
@@ -2579,7 +2579,7 @@ qeth_process_inbound_buffer(struct qeth_card *card,
                skb->dev = card->dev;
                if (hdr->hdr.l2.id == QETH_HEADER_TYPE_LAYER2)
                        vlan_tag = qeth_layer2_rebuild_skb(card, skb, hdr);
-               else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3)     
+               else if (hdr->hdr.l3.id == QETH_HEADER_TYPE_LAYER3)
                        qeth_rebuild_skb(card, skb, hdr);
                else { /*in case of OSN*/
                        skb_push(skb, sizeof(struct qeth_hdr));
@@ -2763,7 +2763,7 @@ qeth_qdio_input_handler(struct ccw_device * ccwdev, unsigned int status,
                index = i % QDIO_MAX_BUFFERS_PER_Q;
                buffer = &card->qdio.in_q->bufs[index];
                if (!((status & QDIO_STATUS_LOOK_FOR_ERROR) &&
-                     qeth_check_qdio_errors(buffer->buffer, 
+                     qeth_check_qdio_errors(buffer->buffer,
                                             qdio_err, siga_err,"qinerr")))
                        qeth_process_inbound_buffer(card, buffer, index);
                /* clear buffer and give back to hardware */
@@ -3187,7 +3187,7 @@ qeth_alloc_qdio_buffers(struct qeth_card *card)
        if (card->qdio.state == QETH_QDIO_ALLOCATED)
                return 0;
 
-       card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q), 
+       card->qdio.in_q = kmalloc(sizeof(struct qeth_qdio_q),
                                  GFP_KERNEL|GFP_DMA);
        if (!card->qdio.in_q)
                return - ENOMEM;
@@ -3476,7 +3476,7 @@ qeth_halt_channels(struct qeth_card *card)
        rc3 = qeth_halt_channel(&card->data);
        if (rc1)
                return rc1;
-       if (rc2) 
+       if (rc2)
                return rc2;
        return rc3;
 }
@@ -3491,7 +3491,7 @@ qeth_clear_channels(struct qeth_card *card)
        rc3 = qeth_clear_channel(&card->data);
        if (rc1)
                return rc1;
-       if (rc2) 
+       if (rc2)
                return rc2;
        return rc3;
 }
@@ -3798,10 +3798,10 @@ qeth_open(struct net_device *dev)
                QETH_DBF_TEXT(trace,4,"nomacadr");
                return -EPERM;
        }
-       card->dev->flags |= IFF_UP;
-       netif_start_queue(dev);
        card->data.state = CH_STATE_UP;
        card->state = CARD_STATE_UP;
+       card->dev->flags |= IFF_UP;
+       netif_start_queue(dev);
 
        if (!card->lan_online && netif_carrier_ok(dev))
                netif_carrier_off(dev);
@@ -3817,7 +3817,7 @@ qeth_stop(struct net_device *dev)
 
        card = (struct qeth_card *) dev->priv;
 
-       netif_stop_queue(dev);
+       netif_tx_disable(dev);
        card->dev->flags &= ~IFF_UP;
        if (card->state == CARD_STATE_UP)
                card->state = CARD_STATE_SOFTSETUP;
@@ -3958,7 +3958,7 @@ qeth_prepare_skb(struct qeth_card *card, struct sk_buff **skb,
 #endif
        *hdr = (struct qeth_hdr *)
                qeth_push_skb(card, skb, sizeof(struct qeth_hdr));
-       if (hdr == NULL)
+       if (*hdr == NULL)
                return -EINVAL;
        return 0;
 }
@@ -4098,7 +4098,7 @@ qeth_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
                }
        } else { /* passthrough */
                 if((skb->dev->type == ARPHRD_IEEE802_TR) &&
-                   !memcmp(skb->data + sizeof(struct qeth_hdr) + 
+                   !memcmp(skb->data + sizeof(struct qeth_hdr) +
                    sizeof(__u16), skb->dev->broadcast, 6)) {
                        hdr->hdr.l3.flags = QETH_CAST_BROADCAST |
                                                QETH_HDR_PASSTHRU;
@@ -4385,7 +4385,7 @@ out:
 }
 
 static inline int
-qeth_get_elements_no(struct qeth_card *card, void *hdr, 
+qeth_get_elements_no(struct qeth_card *card, void *hdr,
                     struct sk_buff *skb, int elems)
 {
        int elements_needed = 0;
@@ -4416,6 +4416,8 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
        enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO;
        struct qeth_eddp_context *ctx = NULL;
        int tx_bytes = skb->len;
+       unsigned short nr_frags = skb_shinfo(skb)->nr_frags;
+       unsigned short tso_size = skb_shinfo(skb)->tso_size;
        int rc;
 
        QETH_DBF_TEXT(trace, 6, "sendpkt");
@@ -4441,7 +4443,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
                return 0;
        }
        cast_type = qeth_get_cast_type(card, skb);
-       if ((cast_type == RTN_BROADCAST) && 
+       if ((cast_type == RTN_BROADCAST) &&
            (card->info.broadcast_capable == 0)){
                card->stats.tx_dropped++;
                card->stats.tx_errors++;
@@ -4463,7 +4465,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
                        card->stats.tx_errors++;
                        dev_kfree_skb_any(skb);
                        return NETDEV_TX_OK;
-               } 
+               }
                elements_needed++;
        } else {
                if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))) {
@@ -4498,16 +4500,16 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
                card->stats.tx_packets++;
                card->stats.tx_bytes += tx_bytes;
 #ifdef CONFIG_QETH_PERF_STATS
-               if (skb_shinfo(skb)->tso_size &&
+               if (tso_size &&
                   !(large_send == QETH_LARGE_SEND_NO)) {
-                       card->perf_stats.large_send_bytes += skb->len;
+                       card->perf_stats.large_send_bytes += tx_bytes;
                        card->perf_stats.large_send_cnt++;
                }
-               if (skb_shinfo(skb)->nr_frags > 0){
+               if (nr_frags > 0){
                        card->perf_stats.sg_skbs_sent++;
                        /* nr_frags + skb->data */
                        card->perf_stats.sg_frags_sent +=
-                               skb_shinfo(skb)->nr_frags + 1;
+                               nr_frags + 1;
                }
 #endif /* CONFIG_QETH_PERF_STATS */
        }
@@ -5373,7 +5375,7 @@ qeth_layer2_send_setdelvlan_cb(struct qeth_card *card,
         cmd = (struct qeth_ipa_cmd *) data;
         if (cmd->hdr.return_code) {
                PRINT_ERR("Error in processing VLAN %i on %s: 0x%x. "
-                         "Continuing\n",cmd->data.setdelvlan.vlan_id, 
+                         "Continuing\n",cmd->data.setdelvlan.vlan_id,
                          QETH_CARD_IFNAME(card), cmd->hdr.return_code);
                QETH_DBF_TEXT_(trace, 2, "L2VL%4x", cmd->hdr.command);
                QETH_DBF_TEXT_(trace, 2, "L2%s", CARD_BUS_ID(card));
@@ -5393,7 +5395,7 @@ qeth_layer2_send_setdelvlan(struct qeth_card *card, __u16 i,
        iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4);
        cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
         cmd->data.setdelvlan.vlan_id = i;
-       return qeth_send_ipa_cmd(card, iob, 
+       return qeth_send_ipa_cmd(card, iob,
                                 qeth_layer2_send_setdelvlan_cb, NULL);
 }
 
@@ -5457,7 +5459,7 @@ qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
  * Examine hardware response to SET_PROMISC_MODE
  */
 static int
-qeth_setadp_promisc_mode_cb(struct qeth_card *card, 
+qeth_setadp_promisc_mode_cb(struct qeth_card *card,
                            struct qeth_reply *reply,
                            unsigned long data)
 {
@@ -5468,10 +5470,10 @@ qeth_setadp_promisc_mode_cb(struct qeth_card *card,
 
        cmd = (struct qeth_ipa_cmd *) data;
        setparms = &(cmd->data.setadapterparms);
-       
+
         qeth_default_setadapterparms_cb(card, reply, (unsigned long)cmd);
-       if (cmd->hdr.return_code) { 
-               QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code);      
+       if (cmd->hdr.return_code) {
+               QETH_DBF_TEXT_(trace,4,"prmrc%2.2x",cmd->hdr.return_code);
                setparms->data.mode = SET_PROMISC_MODE_OFF;
        }
        card->info.promisc_mode = setparms->data.mode;
@@ -5517,7 +5519,7 @@ qeth_set_multicast_list(struct net_device *dev)
 
        if (card->info.type == QETH_CARD_TYPE_OSN)
                return ;
-        
+
        QETH_DBF_TEXT(trace, 3, "setmulti");
        qeth_delete_mc_addresses(card);
        if (card->options.layer2) {
@@ -5575,7 +5577,7 @@ qeth_osn_assist(struct net_device *dev,
        struct qeth_cmd_buffer *iob;
        struct qeth_card *card;
        int rc;
-       
+
        QETH_DBF_TEXT(trace, 2, "osnsdmc");
        if (!dev)
                return -ENODEV;
@@ -5654,7 +5656,7 @@ qeth_osn_deregister(struct net_device * dev)
        card->osn_info.data_cb = NULL;
        return;
 }
-                                          
+
 static void
 qeth_delete_mc_addresses(struct qeth_card *card)
 {
@@ -5818,7 +5820,7 @@ qeth_add_multicast_ipv6(struct qeth_card *card)
        struct inet6_dev *in6_dev;
 
        QETH_DBF_TEXT(trace,4,"chkmcv6");
-       if (!qeth_is_supported(card, IPA_IPV6)) 
+       if (!qeth_is_supported(card, IPA_IPV6))
                return ;
        in6_dev = in6_dev_get(card->dev);
        if (in6_dev == NULL)
@@ -6359,12 +6361,9 @@ qeth_netdev_init(struct net_device *dev)
        dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid;
        dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid;
 #endif
-       dev->hard_header = card->orig_hard_header;
        if (qeth_get_netdev_flags(card) & IFF_NOARP) {
                dev->rebuild_header = NULL;
                dev->hard_header = NULL;
-               if (card->options.fake_ll)
-                       dev->hard_header = qeth_fake_header;
                dev->header_cache_update = NULL;
                dev->hard_header_cache = NULL;
        }
@@ -6373,6 +6372,9 @@ qeth_netdev_init(struct net_device *dev)
        if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD))
                card->dev->dev_id = card->info.unique_id & 0xffff;
 #endif
+       if (card->options.fake_ll &&
+               (qeth_get_netdev_flags(card) & IFF_NOARP))
+                       dev->hard_header = qeth_fake_header;
        dev->hard_header_parse = NULL;
        dev->set_mac_address = qeth_layer2_set_mac_address;
        dev->flags |= qeth_get_netdev_flags(card);
@@ -6477,6 +6479,9 @@ retry:
        /*network device will be recovered*/
        if (card->dev) {
                card->dev->hard_header = card->orig_hard_header;
+               if (card->options.fake_ll &&
+                   (qeth_get_netdev_flags(card) & IFF_NOARP))
+                       card->dev->hard_header = qeth_fake_header;
                return 0;
        }
        /* at first set_online allocate netdev */
@@ -6584,7 +6589,7 @@ qeth_setadpparms_change_macaddr_cb(struct qeth_card *card,
 
        cmd = (struct qeth_ipa_cmd *) data;
        if (!card->options.layer2 || card->info.guestlan ||
-           !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) {    
+           !(card->info.mac_bits & QETH_LAYER2_MAC_READ)) {
                memcpy(card->dev->dev_addr,
                       &cmd->data.setadapterparms.data.change_addr.addr,
                       OSA_ADDR_LEN);
@@ -7031,14 +7036,12 @@ qeth_softsetup_ipv6(struct qeth_card *card)
 
        QETH_DBF_TEXT(trace,3,"softipv6");
 
-       netif_stop_queue(card->dev);
        rc = qeth_send_startlan(card, QETH_PROT_IPV6);
        if (rc) {
                PRINT_ERR("IPv6 startlan failed on %s\n",
                          QETH_CARD_IFNAME(card));
                return rc;
        }
-       netif_wake_queue(card->dev);
        rc = qeth_query_ipassists(card,QETH_PROT_IPV6);
        if (rc) {
                PRINT_ERR("IPv6 query ipassist failed on %s\n",
@@ -7352,7 +7355,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type)
                card->options.large_send = type;
                return 0;
        }
-       netif_stop_queue(card->dev);
+       if (card->state == CARD_STATE_UP)
+               netif_tx_disable(card->dev);
        card->options.large_send = type;
        switch (card->options.large_send) {
        case QETH_LARGE_SEND_EDDP:
@@ -7374,7 +7378,8 @@ qeth_set_large_send(struct qeth_card *card, enum qeth_large_send_types type)
                card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG);
                break;
        }
-       netif_wake_queue(card->dev);
+       if (card->state == CARD_STATE_UP)
+               netif_wake_queue(card->dev);
        return rc;
 }
 
@@ -7427,7 +7432,7 @@ qeth_softsetup_card(struct qeth_card *card)
        if ((rc = qeth_setrouting_v6(card)))
                QETH_DBF_TEXT_(setup, 2, "5err%d", rc);
 out:
-       netif_stop_queue(card->dev);
+       netif_tx_disable(card->dev);
        return 0;
 }
 
@@ -7567,7 +7572,7 @@ qeth_stop_card(struct qeth_card *card, int recovery_mode)
        if (card->read.state == CH_STATE_UP &&
            card->write.state == CH_STATE_UP &&
            (card->state == CARD_STATE_UP)) {
-               if (recovery_mode && 
+               if (recovery_mode &&
                    card->info.type != QETH_CARD_TYPE_OSN) {
                        qeth_stop(card->dev);
                } else {
@@ -7736,10 +7741,8 @@ static int
 qeth_register_netdev(struct qeth_card *card)
 {
        QETH_DBF_TEXT(setup, 3, "regnetd");
-       if (card->dev->reg_state != NETREG_UNINITIALIZED) {
-               qeth_netdev_init(card->dev);
+       if (card->dev->reg_state != NETREG_UNINITIALIZED)
                return 0;
-       }
        /* sysfs magic */
        SET_NETDEV_DEV(card->dev, &card->gdev->dev);
        return register_netdev(card->dev);
@@ -7750,7 +7753,7 @@ qeth_start_again(struct qeth_card *card, int recovery_mode)
 {
        QETH_DBF_TEXT(setup ,2, "startag");
 
-       if (recovery_mode && 
+       if (recovery_mode &&
            card->info.type != QETH_CARD_TYPE_OSN) {
                qeth_open(card->dev);
        } else {
index 011c41041029addb84d96eb478bd533780f261e2..0477c47471c5a7ccb60c00bbd4179ee73a5f47c6 100644 (file)
@@ -445,7 +445,7 @@ enum qeth_ipa_arp_return_codes {
 /* Helper functions */
 #define IS_IPA_REPLY(cmd) ((cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST) || \
                           (cmd->hdr.initiator == IPA_CMD_INITIATOR_OSA_REPLY))
-       
+
 /*****************************************************************************/
 /* END OF   IP Assist related definitions                                    */
 /*****************************************************************************/
@@ -490,7 +490,7 @@ extern unsigned char ULP_ENABLE[];
 /* Layer 2 defintions */
 #define QETH_PROT_LAYER2 0x08
 #define QETH_PROT_TCPIP  0x03
-#define QETH_PROT_OSN2   0x0a     
+#define QETH_PROT_OSN2   0x0a
 #define QETH_ULP_ENABLE_PROT_TYPE(buffer) (buffer+0x50)
 #define QETH_IPA_CMD_PROT_TYPE(buffer) (buffer+0x19)
 
index 360d782c7adacbc22e5fa074e6306dcde29fd810..66f2da14e6e3a0bd2bbd5250a9b25efa585637b2 100644 (file)
@@ -36,7 +36,7 @@ qeth_procfile_seq_start(struct seq_file *s, loff_t *offset)
 {
        struct device *dev = NULL;
        loff_t nr = 0;
-       
+
        down_read(&qeth_ccwgroup_driver.driver.bus->subsys.rwsem);
        if (*offset == 0)
                return SEQ_START_TOKEN;
@@ -60,8 +60,8 @@ static void *
 qeth_procfile_seq_next(struct seq_file *s, void *it, loff_t *offset)
 {
        struct device *prev, *next;
-       
-       if (it == SEQ_START_TOKEN) 
+
+       if (it == SEQ_START_TOKEN)
                prev = NULL;
        else
                prev = (struct device *) it;
@@ -180,7 +180,7 @@ qeth_perf_procfile_seq_show(struct seq_file *s, void *it)
        struct device *device;
        struct qeth_card *card;
 
-       
+
        if (it == SEQ_START_TOKEN)
                return 0;
 
index 882d419e41603ed065dd319ae190527821ab1a52..185a9cfbcbdc76cff6128a60f1be96fb4bf6d743 100644 (file)
@@ -785,7 +785,7 @@ qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, con
        }
        if (card->options.large_send == type)
                return count;
-       if ((rc = qeth_set_large_send(card, type)))     
+       if ((rc = qeth_set_large_send(card, type)))
                return rc;
        return count;
 }
@@ -1682,7 +1682,7 @@ qeth_create_device_attributes(struct device *dev)
        if (card->info.type == QETH_CARD_TYPE_OSN)
                return sysfs_create_group(&dev->kobj,
                                          &qeth_osn_device_attr_group);
-       
+
        if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group)))
                return ret;
        if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){
@@ -1713,7 +1713,7 @@ qeth_remove_device_attributes(struct device *dev)
        if (card->info.type == QETH_CARD_TYPE_OSN)
                return sysfs_remove_group(&dev->kobj,
                                          &qeth_osn_device_attr_group);
-                     
+
        sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
        sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
        sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
index 1286ddea450b9e5b83d7642e9caed26c9817bc16..24ef40ca956276158d6852d72aff055cc0d26a46 100644 (file)
@@ -117,11 +117,11 @@ __qeth_fill_buffer_frag(struct sk_buff *skb, struct qdio_buffer *buffer,
        int fragno;
        unsigned long addr;
        int element, cnt, dlen;
-       
+
        fragno = skb_shinfo(skb)->nr_frags;
        element = *next_element_to_fill;
        dlen = 0;
-       
+
        if (is_tso)
                buffer->element[element].flags =
                        SBAL_FLAGS_MIDDLE_FRAG;
index 383a95f34a0da4e8adec682df992786d572efe27..239e108b8ed1e16cb45d51fa89591418a5410bac 100644 (file)
@@ -392,13 +392,16 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
                        return -ENOMEM;
                }
 
-               prom_getproperty(op.op_nodeid, str, tmp, len);
-
-               tmp[len] = '\0';
+               cnt = prom_getproperty(op.op_nodeid, str, tmp, len);
+               if (cnt <= 0) {
+                       error = -EINVAL;
+               } else {
+                       tmp[len] = '\0';
 
-               if (__copy_to_user(argp, &op, sizeof(op)) != 0
-                   || copy_to_user(op.op_buf, tmp, len) != 0)
-                       error = -EFAULT;
+                       if (__copy_to_user(argp, &op, sizeof(op)) != 0 ||
+                           copy_to_user(op.op_buf, tmp, len) != 0)
+                               error = -EFAULT;
+               }
 
                kfree(tmp);
                kfree(str);
index bd147207f25d4ea8b216102f260b95911938e0d3..b046ffa22101ccb3c8cbc9c6d6453abd8ef20e4d 100644 (file)
@@ -864,6 +864,9 @@ static unsigned int ata_id_xfermask(const u16 *id)
 /**
  *     ata_port_queue_task - Queue port_task
  *     @ap: The ata_port to queue port_task for
+ *     @fn: workqueue function to be scheduled
+ *     @data: data value to pass to workqueue function
+ *     @delay: delay time for workqueue function
  *
  *     Schedule @fn(@data) for execution after @delay jiffies using
  *     port_task.  There is one port_task per port and it's the
@@ -2739,6 +2742,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_port *ap,
  *     ata_dev_init_params - Issue INIT DEV PARAMS command
  *     @ap: Port associated with device @dev
  *     @dev: Device to which command will be sent
+ *     @heads: Number of heads (taskfile parameter)
+ *     @sectors: Number of sectors (taskfile parameter)
  *
  *     LOCKING:
  *     Kernel thread context (may sleep)
@@ -3638,6 +3643,8 @@ static void ata_pio_block(struct ata_port *ap)
 
                ata_pio_sector(qc);
        }
+
+       ata_altstatus(ap); /* flush */
 }
 
 static void ata_pio_error(struct ata_port *ap)
@@ -3754,11 +3761,14 @@ static void atapi_packet_task(void *_data)
                spin_lock_irqsave(&ap->host_set->lock, flags);
                ap->flags &= ~ATA_FLAG_NOINTR;
                ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);
+               ata_altstatus(ap); /* flush */
+
                if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
                        ap->ops->bmdma_start(qc);       /* initiate bmdma */
                spin_unlock_irqrestore(&ap->host_set->lock, flags);
        } else {
                ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);
+               ata_altstatus(ap); /* flush */
 
                /* PIO commands are handled by polling */
                ap->hsm_task_state = HSM_ST;
@@ -4287,6 +4297,7 @@ static int ata_start_drive(struct ata_port *ap, struct ata_device *dev)
 int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
 {
        if (ap->flags & ATA_FLAG_SUSPENDED) {
+               ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 200000);
                ap->flags &= ~ATA_FLAG_SUSPENDED;
                ata_set_mode(ap);
        }
@@ -4302,6 +4313,7 @@ int ata_device_resume(struct ata_port *ap, struct ata_device *dev)
  *     ata_device_suspend - prepare a device for suspend
  *     @ap: port the device is connected to
  *     @dev: the device to suspend
+ *     @state: target power management state
  *
  *     Flush the cache on the drive, if appropriate, then issue a
  *     standbynow command.
index fee843fab1c7d5a0760285f9b4472da260efb8b7..108910f512e477c14bc083c8922b31c1b1640e82 100644 (file)
@@ -982,6 +982,12 @@ static int device_check(ppa_struct *dev)
        return -ENODEV;
 }
 
+static int ppa_adjust_queue(struct scsi_device *device)
+{
+       blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
+       return 0;
+}
+
 static struct scsi_host_template ppa_template = {
        .module                 = THIS_MODULE,
        .proc_name              = "ppa",
@@ -997,6 +1003,7 @@ static struct scsi_host_template ppa_template = {
        .cmd_per_lun            = 1,
        .use_clustering         = ENABLE_CLUSTERING,
        .can_queue              = 1,
+       .slave_alloc            = ppa_adjust_queue,
 };
 
 /***************************************************************************
index d5fdcb9a88425fb3edac03a867a3cce74dd5fb34..f16f92a6ec0fe468da2c87363227015e0f27a061 100644 (file)
@@ -37,7 +37,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "sata_mv"
-#define DRV_VERSION    "0.6"
+#define DRV_VERSION    "0.7"
 
 enum {
        /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -50,6 +50,12 @@ enum {
 
        MV_PCI_REG_BASE         = 0,
        MV_IRQ_COAL_REG_BASE    = 0x18000,      /* 6xxx part only */
+       MV_IRQ_COAL_CAUSE               = (MV_IRQ_COAL_REG_BASE + 0x08),
+       MV_IRQ_COAL_CAUSE_LO            = (MV_IRQ_COAL_REG_BASE + 0x88),
+       MV_IRQ_COAL_CAUSE_HI            = (MV_IRQ_COAL_REG_BASE + 0x8c),
+       MV_IRQ_COAL_THRESHOLD           = (MV_IRQ_COAL_REG_BASE + 0xcc),
+       MV_IRQ_COAL_TIME_THRESHOLD      = (MV_IRQ_COAL_REG_BASE + 0xd0),
+
        MV_SATAHC0_REG_BASE     = 0x20000,
        MV_FLASH_CTL            = 0x1046c,
        MV_GPIO_PORT_CTL        = 0x104f0,
@@ -302,9 +308,6 @@ struct mv_port_priv {
        dma_addr_t              crpb_dma;
        struct mv_sg            *sg_tbl;
        dma_addr_t              sg_tbl_dma;
-
-       unsigned                req_producer;           /* cp of req_in_ptr */
-       unsigned                rsp_consumer;           /* cp of rsp_out_ptr */
        u32                     pp_flags;
 };
 
@@ -937,8 +940,6 @@ static int mv_port_start(struct ata_port *ap)
        writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK,
                 port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
-       pp->req_producer = pp->rsp_consumer = 0;
-
        /* Don't turn on EDMA here...do it before DMA commands only.  Else
         * we'll be unable to send non-data, PIO, etc due to restricted access
         * to shadow regs.
@@ -1022,16 +1023,16 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
        }
 }
 
-static inline unsigned mv_inc_q_index(unsigned *index)
+static inline unsigned mv_inc_q_index(unsigned index)
 {
-       *index = (*index + 1) & MV_MAX_Q_DEPTH_MASK;
-       return *index;
+       return (index + 1) & MV_MAX_Q_DEPTH_MASK;
 }
 
 static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last)
 {
-       *cmdw = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
+       u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
                (last ? CRQB_CMD_LAST : 0);
+       *cmdw = cpu_to_le16(tmp);
 }
 
 /**
@@ -1053,15 +1054,11 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
        u16 *cw;
        struct ata_taskfile *tf;
        u16 flags = 0;
+       unsigned in_index;
 
        if (ATA_PROT_DMA != qc->tf.protocol)
                return;
 
-       /* the req producer index should be the same as we remember it */
-       WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
-                 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               pp->req_producer);
-
        /* Fill in command request block
         */
        if (!(qc->tf.flags & ATA_TFLAG_WRITE))
@@ -1069,13 +1066,17 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
        WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);
        flags |= qc->tag << CRQB_TAG_SHIFT;
 
-       pp->crqb[pp->req_producer].sg_addr =
+       /* get current queue index from hardware */
+       in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS)
+                       >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
+
+       pp->crqb[in_index].sg_addr =
                cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);
-       pp->crqb[pp->req_producer].sg_addr_hi =
+       pp->crqb[in_index].sg_addr_hi =
                cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);
-       pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags);
+       pp->crqb[in_index].ctrl_flags = cpu_to_le16(flags);
 
-       cw = &pp->crqb[pp->req_producer].ata_cmd[0];
+       cw = &pp->crqb[in_index].ata_cmd[0];
        tf = &qc->tf;
 
        /* Sadly, the CRQB cannot accomodate all registers--there are
@@ -1144,16 +1145,12 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
        struct mv_port_priv *pp = ap->private_data;
        struct mv_crqb_iie *crqb;
        struct ata_taskfile *tf;
+       unsigned in_index;
        u32 flags = 0;
 
        if (ATA_PROT_DMA != qc->tf.protocol)
                return;
 
-       /* the req producer index should be the same as we remember it */
-       WARN_ON(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >>
-                 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               pp->req_producer);
-
        /* Fill in Gen IIE command request block
         */
        if (!(qc->tf.flags & ATA_TFLAG_WRITE))
@@ -1162,7 +1159,11 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
        WARN_ON(MV_MAX_Q_DEPTH <= qc->tag);
        flags |= qc->tag << CRQB_TAG_SHIFT;
 
-       crqb = (struct mv_crqb_iie *) &pp->crqb[pp->req_producer];
+       /* get current queue index from hardware */
+       in_index = (readl(mv_ap_base(ap) + EDMA_REQ_Q_IN_PTR_OFS)
+                       >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
+
+       crqb = (struct mv_crqb_iie *) &pp->crqb[in_index];
        crqb->addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff);
        crqb->addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16);
        crqb->flags = cpu_to_le32(flags);
@@ -1210,6 +1211,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
 {
        void __iomem *port_mmio = mv_ap_base(qc->ap);
        struct mv_port_priv *pp = qc->ap->private_data;
+       unsigned in_index;
        u32 in_ptr;
 
        if (ATA_PROT_DMA != qc->tf.protocol) {
@@ -1221,23 +1223,20 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
                return ata_qc_issue_prot(qc);
        }
 
-       in_ptr = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
+       in_ptr   = readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
+       in_index = (in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
 
-       /* the req producer index should be the same as we remember it */
-       WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               pp->req_producer);
        /* until we do queuing, the queue should be empty at this point */
-       WARN_ON(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >>
-                 EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));
+       WARN_ON(in_index != ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS)
+               >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));
 
-       mv_inc_q_index(&pp->req_producer);      /* now incr producer index */
+       in_index = mv_inc_q_index(in_index);    /* now incr producer index */
 
        mv_start_dma(port_mmio, pp);
 
        /* and write the request in pointer to kick the EDMA to life */
        in_ptr &= EDMA_REQ_Q_BASE_LO_MASK;
-       in_ptr |= pp->req_producer << EDMA_REQ_Q_PTR_SHIFT;
+       in_ptr |= in_index << EDMA_REQ_Q_PTR_SHIFT;
        writelfl(in_ptr, port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
 
        return 0;
@@ -1260,28 +1259,26 @@ static u8 mv_get_crpb_status(struct ata_port *ap)
 {
        void __iomem *port_mmio = mv_ap_base(ap);
        struct mv_port_priv *pp = ap->private_data;
+       unsigned out_index;
        u32 out_ptr;
        u8 ata_status;
 
-       out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
-
-       /* the response consumer index should be the same as we remember it */
-       WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               pp->rsp_consumer);
+       out_ptr   = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
+       out_index = (out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK;
 
-       ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT;
+       ata_status = le16_to_cpu(pp->crpb[out_index].flags)
+                                       >> CRPB_FLAG_STATUS_SHIFT;
 
        /* increment our consumer index... */
-       pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);
+       out_index = mv_inc_q_index(out_index);
 
        /* and, until we do NCQ, there should only be 1 CRPB waiting */
-       WARN_ON(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >>
-                 EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
-               pp->rsp_consumer);
+       WARN_ON(out_index != ((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS)
+               >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK));
 
        /* write out our inc'd consumer index so EDMA knows we're caught up */
        out_ptr &= EDMA_RSP_Q_BASE_LO_MASK;
-       out_ptr |= pp->rsp_consumer << EDMA_RSP_Q_PTR_SHIFT;
+       out_ptr |= out_index << EDMA_RSP_Q_PTR_SHIFT;
        writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
        /* Return ATA status register for completed CRPB */
@@ -1291,6 +1288,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap)
 /**
  *      mv_err_intr - Handle error interrupts on the port
  *      @ap: ATA channel to manipulate
+ *      @reset_allowed: bool: 0 == don't trigger from reset here
  *
  *      In most cases, just clear the interrupt and move on.  However,
  *      some cases require an eDMA reset, which is done right before
@@ -1301,7 +1299,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap)
  *      LOCKING:
  *      Inherited from caller.
  */
-static void mv_err_intr(struct ata_port *ap)
+static void mv_err_intr(struct ata_port *ap, int reset_allowed)
 {
        void __iomem *port_mmio = mv_ap_base(ap);
        u32 edma_err_cause, serr = 0;
@@ -1323,9 +1321,8 @@ static void mv_err_intr(struct ata_port *ap)
        writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
 
        /* check for fatal here and recover if needed */
-       if (EDMA_ERR_FATAL & edma_err_cause) {
+       if (reset_allowed && (EDMA_ERR_FATAL & edma_err_cause))
                mv_stop_and_reset(ap);
-       }
 }
 
 /**
@@ -1374,12 +1371,12 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
                struct ata_port *ap = host_set->ports[port];
                struct mv_port_priv *pp = ap->private_data;
 
-               hard_port = port & MV_PORT_MASK;        /* range 0-3 */
+               hard_port = mv_hardport_from_port(port); /* range 0..3 */
                handled = 0;    /* ensure ata_status is set if handled++ */
 
                /* Note that DEV_IRQ might happen spuriously during EDMA,
-                * and should be ignored in such cases.  We could mask it,
-                * but it's pretty rare and may not be worth the overhead.
+                * and should be ignored in such cases.
+                * The cause of this is still under investigation.
                 */ 
                if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
                        /* EDMA: check for response queue interrupt */
@@ -1393,6 +1390,11 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
                                ata_status = readb((void __iomem *)
                                           ap->ioaddr.status_addr);
                                handled = 1;
+                               /* ignore spurious intr if drive still BUSY */
+                               if (ata_status & ATA_BUSY) {
+                                       ata_status = 0;
+                                       handled = 0;
+                               }
                        }
                }
 
@@ -1406,7 +1408,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
                        shift++;        /* skip bit 8 in the HC Main IRQ reg */
                }
                if ((PORT0_ERR << shift) & relevant) {
-                       mv_err_intr(ap);
+                       mv_err_intr(ap, 1);
                        err_mask |= AC_ERR_OTHER;
                        handled = 1;
                }
@@ -1448,6 +1450,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
        struct ata_host_set *host_set = dev_instance;
        unsigned int hc, handled = 0, n_hcs;
        void __iomem *mmio = host_set->mmio_base;
+       struct mv_host_priv *hpriv;
        u32 irq_stat;
 
        irq_stat = readl(mmio + HC_MAIN_IRQ_CAUSE_OFS);
@@ -1469,6 +1472,17 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
                        handled++;
                }
        }
+
+       hpriv = host_set->private_data;
+       if (IS_60XX(hpriv)) {
+               /* deal with the interrupt coalescing bits */
+               if (irq_stat & (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE)) {
+                       writelfl(0, mmio + MV_IRQ_COAL_CAUSE_LO);
+                       writelfl(0, mmio + MV_IRQ_COAL_CAUSE_HI);
+                       writelfl(0, mmio + MV_IRQ_COAL_CAUSE);
+               }
+       }
+
        if (PCI_ERR & irq_stat) {
                printk(KERN_ERR DRV_NAME ": PCI ERROR; PCI IRQ cause=0x%08x\n",
                       readl(mmio + PCI_IRQ_CAUSE_OFS));
@@ -1867,7 +1881,8 @@ static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio,
 
        if (IS_60XX(hpriv)) {
                u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);
-               ifctl |= (1 << 12) | (1 << 7);
+               ifctl |= (1 << 7);              /* enable gen2i speed */
+               ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */
                writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);
        }
 
@@ -2020,6 +2035,7 @@ static void mv_phy_reset(struct ata_port *ap)
 static void mv_eng_timeout(struct ata_port *ap)
 {
        struct ata_queued_cmd *qc;
+       unsigned long flags;
 
        printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id);
        DPRINTK("All regs @ start of eng_timeout\n");
@@ -2031,11 +2047,16 @@ static void mv_eng_timeout(struct ata_port *ap)
               ap->host_set->mmio_base, ap, qc, qc->scsicmd,
               &qc->scsicmd->cmnd);
 
-       mv_err_intr(ap);
+       spin_lock_irqsave(&ap->host_set->lock, flags);
+       mv_err_intr(ap, 0);
        mv_stop_and_reset(ap);
+       spin_unlock_irqrestore(&ap->host_set->lock, flags);
 
-       qc->err_mask |= AC_ERR_TIMEOUT;
-       ata_eh_qc_complete(qc);
+       WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));
+       if (qc->flags & ATA_QCFLAG_ACTIVE) {
+               qc->err_mask |= AC_ERR_TIMEOUT;
+               ata_eh_qc_complete(qc);
+       }
 }
 
 /**
@@ -2229,7 +2250,8 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent,
                        void __iomem *port_mmio = mv_port_base(mmio, port);
 
                        u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL);
-                       ifctl |= (1 << 12);
+                       ifctl |= (1 << 7);              /* enable gen2i speed */
+                       ifctl = (ifctl & 0xfff) | 0x9b1000; /* from chip spec */
                        writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL);
                }
 
@@ -2330,6 +2352,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (rc) {
                return rc;
        }
+       pci_set_master(pdev);
 
        rc = pci_request_regions(pdev, DRV_NAME);
        if (rc) {
index f7264fd611c2226bc71e6d8e552478a8eaaf2748..cb9082fd7e2fd7ff2afaec77e0f36fbbdf8c430b 100644 (file)
@@ -454,7 +454,7 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
         */
        msleep(10);
 
-       prb->ctrl = PRB_CTRL_SRST;
+       prb->ctrl = cpu_to_le16(PRB_CTRL_SRST);
        prb->fis[1] = 0; /* no PM yet */
 
        writel((u32)paddr, port + PORT_CMD_ACTIVATE);
@@ -551,9 +551,9 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
 
                if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) {
                        if (qc->tf.flags & ATA_TFLAG_WRITE)
-                               prb->ctrl = PRB_CTRL_PACKET_WRITE;
+                               prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_WRITE);
                        else
-                               prb->ctrl = PRB_CTRL_PACKET_READ;
+                               prb->ctrl = cpu_to_le16(PRB_CTRL_PACKET_READ);
                } else
                        prb->ctrl = 0;
 
index 941c1e15c8992cfe19a3fdeb2deddbc424afafa7..62f8cb7b3d2bac60319fd7b9017537345b445c0f 100644 (file)
@@ -165,6 +165,7 @@ static struct {
        {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
        {"HP", "C1557A", NULL, BLIST_FORCELUN},
        {"HP", "C3323-300", "4269", BLIST_NOTQ},
+       {"HP", "C5713A", NULL, BLIST_NOREPORTLUN},
        {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN},
        {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
        {"IBM", "2105", NULL, BLIST_RETRY_HWERROR},
index 764a8b375ead1005ff2a49e130f1f80418748be7..faee4757c03adb712363eb09527c5af357c0bef3 100644 (file)
@@ -367,7 +367,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
                           int nsegs, unsigned bufflen, gfp_t gfp)
 {
        struct request_queue *q = rq->q;
-       int nr_pages = (bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
+       int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
        unsigned int data_len = 0, len, bytes, off;
        struct page *page;
        struct bio *bio = NULL;
index 8b6d65e21bae3a23ac362d65ac9b95d57732b6f3..f3b16066387cf210ddc4b37246558ef18e8c92a8 100644 (file)
@@ -955,7 +955,8 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
        list_for_each_entry(rphy, &sas_host->rphy_list, list) {
                struct sas_phy *parent = dev_to_phy(rphy->dev.parent);
 
-               if (rphy->scsi_target_id == -1)
+               if (rphy->identify.device_type != SAS_END_DEVICE ||
+                   rphy->scsi_target_id == -1)
                        continue;
 
                if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) &&
@@ -977,7 +978,6 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
 #define SETUP_TEMPLATE(attrb, field, perm, test)                               \
        i->private_##attrb[count] = class_device_attr_##field;          \
        i->private_##attrb[count].attr.mode = perm;                     \
-       i->private_##attrb[count].store = NULL;                         \
        i->attrb[count] = &i->private_##attrb[count];                   \
        if (test)                                                       \
                count++
index d40e7c871c363274ec739314cb159aee32c3bd8a..56cb4900611659380e20cace52d1c395a714656f 100644 (file)
@@ -4054,7 +4054,7 @@ static int st_probe(struct device *dev)
        }
 
        sdev_printk(KERN_WARNING, SDp,
-                   "Attached scsi tape %s", tape_name(tpnt));
+                   "Attached scsi tape %s\n", tape_name(tpnt));
        printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n",
               tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
               queue_dma_alignment(SDp->request_queue) + 1);
index 969f949004318b1080f16643fd0b07d41f280d53..5cba59ad7dc5a38eff874cbc735ec140bdb2829c 100644 (file)
@@ -1164,14 +1164,16 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
        struct fs_uart_platform_info *pdata;
        struct platform_device* pdev = early_uart_get_pdev(co->index);
 
-       port =
-           (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]];
-       pinfo = (struct uart_cpm_port *)port;
        if (!pdev) {
                pr_info("cpm_uart: console: compat mode\n");
                /* compatibility - will be cleaned up */
                cpm_uart_init_portdesc();
+       }
 
+       port =
+           (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]];
+       pinfo = (struct uart_cpm_port *)port;
+       if (!pdev) {
                if (pinfo->set_lineif)
                        pinfo->set_lineif(pinfo);
        } else {
index 4b2de08f46d0ef7f58462e3144326743c3a6390f..cdba128250a96e5f2f98a07c5dcbf2318c65ff92 100644 (file)
@@ -213,7 +213,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
            L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize);
        if (is_con) {
                mem_addr = alloc_bootmem(memsz);
-               dma_addr = mem_addr;
+               dma_addr = virt_to_bus(mem_addr);
        }
        else
                mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr,
index aeb8153ccf2466eae358d0610af4a61300ce4c8d..17839e753e4cfb1fb550832d8613b0ec579c83ef 100644 (file)
@@ -1907,9 +1907,12 @@ uart_set_options(struct uart_port *port, struct console *co,
 static void uart_change_pm(struct uart_state *state, int pm_state)
 {
        struct uart_port *port = state->port;
-       if (port->ops->pm)
-               port->ops->pm(port, pm_state, state->pm_state);
-       state->pm_state = pm_state;
+
+       if (state->pm_state != pm_state) {
+               if (port->ops->pm)
+                       port->ops->pm(port, pm_state, state->pm_state);
+               state->pm_state = pm_state;
+       }
 }
 
 int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
index 1c4396c2962d0de28ce661921655bd76d2c49820..2b4f96541b8e6a10f25a717c8909a742a0576515 100644 (file)
@@ -1730,3 +1730,4 @@ static void __exit sunsu_exit(void)
 
 module_init(sunsu_probe);
 module_exit(sunsu_exit);
+MODULE_LICENSE("GPL");
index 7a75faeb0526d6f89c37dbe854c52b5cddd5ebeb..23334c8bc4c75e5c29fcf2415267d3c00397425c 100644 (file)
@@ -75,11 +75,45 @@ config SPI_BUTTERFLY
          inexpensive battery powered microcontroller evaluation board.
          This same cable can be used to flash new firmware.
 
+config SPI_MPC83xx
+       tristate "Freescale MPC83xx SPI controller"
+       depends on SPI_MASTER && PPC_83xx && EXPERIMENTAL
+       select SPI_BITBANG
+       help
+         This enables using the Freescale MPC83xx SPI controller in master
+         mode.
+
+         Note, this driver uniquely supports the SPI controller on the MPC83xx
+         family of PowerPC processors.  The MPC83xx uses a simple set of shift
+         registers for data (opposed to the CPM based descriptor model).
+
+config SPI_PXA2XX
+       tristate "PXA2xx SSP SPI master"
+       depends on SPI_MASTER && ARCH_PXA && EXPERIMENTAL
+       help
+         This enables using a PXA2xx SSP port as a SPI master controller.
+         The driver can be configured to use any SSP port and additional
+         documentation can be found a Documentation/spi/pxa2xx.
+
+config SPI_S3C24XX_GPIO
+       tristate "Samsung S3C24XX series SPI by GPIO"
+       depends on SPI_MASTER && ARCH_S3C2410 && SPI_BITBANG && EXPERIMENTAL
+       help
+         SPI driver for Samsung S3C24XX series ARM SoCs using
+         GPIO lines to provide the SPI bus. This can be used where
+         the inbuilt hardware cannot provide the transfer mode, or
+         where the board is using non hardware connected pins.
 #
 # Add new SPI master controllers in alphabetical order above this line
 #
 
 
+config SPI_S3C24XX
+       tristate "Samsung S3C24XX series SPI"
+       depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL
+       help
+         SPI driver for Samsung S3C24XX series ARM SoCs
+
 #
 # There are lots of SPI device types, with sensors and memory
 # being probably the most widely used ones.
index c2c87e845abf8d71f3742f29fc16b664d2493d09..8f4cb67997b32afcc5207b49fb7ae2dfcb2654eb 100644 (file)
@@ -13,6 +13,10 @@ obj-$(CONFIG_SPI_MASTER)             += spi.o
 # SPI master controller drivers (bus)
 obj-$(CONFIG_SPI_BITBANG)              += spi_bitbang.o
 obj-$(CONFIG_SPI_BUTTERFLY)            += spi_butterfly.o
+obj-$(CONFIG_SPI_PXA2XX)               += pxa2xx_spi.o
+obj-$(CONFIG_SPI_MPC83xx)              += spi_mpc83xx.o
+obj-$(CONFIG_SPI_S3C24XX_GPIO)         += spi_s3c24xx_gpio.o
+obj-$(CONFIG_SPI_S3C24XX)              += spi_s3c24xx.o
 #      ... add above this line ...
 
 # SPI protocol drivers (device/link on bus)
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
new file mode 100644 (file)
index 0000000..29aec77
--- /dev/null
@@ -0,0 +1,1486 @@
+/*
+ * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/ioport.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include <linux/spi/spi.h>
+#include <linux/workqueue.h>
+#include <linux/errno.h>
+#include <linux/delay.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/hardware.h>
+#include <asm/delay.h>
+#include <asm/dma.h>
+
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/pxa2xx_spi.h>
+
+MODULE_AUTHOR("Stephen Street");
+MODULE_DESCRIPTION("PXA2xx SSP SPI Contoller");
+MODULE_LICENSE("GPL");
+
+#define MAX_BUSES 3
+
+#define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)
+#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)
+#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0)
+
+#define DEFINE_SSP_REG(reg, off) \
+static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); } \
+static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); }
+
+DEFINE_SSP_REG(SSCR0, 0x00)
+DEFINE_SSP_REG(SSCR1, 0x04)
+DEFINE_SSP_REG(SSSR, 0x08)
+DEFINE_SSP_REG(SSITR, 0x0c)
+DEFINE_SSP_REG(SSDR, 0x10)
+DEFINE_SSP_REG(SSTO, 0x28)
+DEFINE_SSP_REG(SSPSP, 0x2c)
+
+#define START_STATE ((void*)0)
+#define RUNNING_STATE ((void*)1)
+#define DONE_STATE ((void*)2)
+#define ERROR_STATE ((void*)-1)
+
+#define QUEUE_RUNNING 0
+#define QUEUE_STOPPED 1
+
+struct driver_data {
+       /* Driver model hookup */
+       struct platform_device *pdev;
+
+       /* SPI framework hookup */
+       enum pxa_ssp_type ssp_type;
+       struct spi_master *master;
+
+       /* PXA hookup */
+       struct pxa2xx_spi_master *master_info;
+
+       /* DMA setup stuff */
+       int rx_channel;
+       int tx_channel;
+       u32 *null_dma_buf;
+
+       /* SSP register addresses */
+       void *ioaddr;
+       u32 ssdr_physical;
+
+       /* SSP masks*/
+       u32 dma_cr1;
+       u32 int_cr1;
+       u32 clear_sr;
+       u32 mask_sr;
+
+       /* Driver message queue */
+       struct workqueue_struct *workqueue;
+       struct work_struct pump_messages;
+       spinlock_t lock;
+       struct list_head queue;
+       int busy;
+       int run;
+
+       /* Message Transfer pump */
+       struct tasklet_struct pump_transfers;
+
+       /* Current message transfer state info */
+       struct spi_message* cur_msg;
+       struct spi_transfer* cur_transfer;
+       struct chip_data *cur_chip;
+       size_t len;
+       void *tx;
+       void *tx_end;
+       void *rx;
+       void *rx_end;
+       int dma_mapped;
+       dma_addr_t rx_dma;
+       dma_addr_t tx_dma;
+       size_t rx_map_len;
+       size_t tx_map_len;
+       u8 n_bytes;
+       u32 dma_width;
+       int cs_change;
+       void (*write)(struct driver_data *drv_data);
+       void (*read)(struct driver_data *drv_data);
+       irqreturn_t (*transfer_handler)(struct driver_data *drv_data);
+       void (*cs_control)(u32 command);
+};
+
+struct chip_data {
+       u32 cr0;
+       u32 cr1;
+       u32 to;
+       u32 psp;
+       u32 timeout;
+       u8 n_bytes;
+       u32 dma_width;
+       u32 dma_burst_size;
+       u32 threshold;
+       u32 dma_threshold;
+       u8 enable_dma;
+       u8 bits_per_word;
+       u32 speed_hz;
+       void (*write)(struct driver_data *drv_data);
+       void (*read)(struct driver_data *drv_data);
+       void (*cs_control)(u32 command);
+};
+
+static void pump_messages(void *data);
+
+static int flush(struct driver_data *drv_data)
+{
+       unsigned long limit = loops_per_jiffy << 1;
+
+       void *reg = drv_data->ioaddr;
+
+       do {
+               while (read_SSSR(reg) & SSSR_RNE) {
+                       read_SSDR(reg);
+               }
+       } while ((read_SSSR(reg) & SSSR_BSY) && limit--);
+       write_SSSR(SSSR_ROR, reg);
+
+       return limit;
+}
+
+static void restore_state(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       /* Clear status and disable clock */
+       write_SSSR(drv_data->clear_sr, reg);
+       write_SSCR0(drv_data->cur_chip->cr0 & ~SSCR0_SSE, reg);
+
+       /* Load the registers */
+       write_SSCR1(drv_data->cur_chip->cr1, reg);
+       write_SSCR0(drv_data->cur_chip->cr0, reg);
+       if (drv_data->ssp_type != PXA25x_SSP) {
+               write_SSTO(0, reg);
+               write_SSPSP(drv_data->cur_chip->psp, reg);
+       }
+}
+
+static void null_cs_control(u32 command)
+{
+}
+
+static void null_writer(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+       u8 n_bytes = drv_data->n_bytes;
+
+       while ((read_SSSR(reg) & SSSR_TNF)
+                       && (drv_data->tx < drv_data->tx_end)) {
+               write_SSDR(0, reg);
+               drv_data->tx += n_bytes;
+       }
+}
+
+static void null_reader(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+       u8 n_bytes = drv_data->n_bytes;
+
+       while ((read_SSSR(reg) & SSSR_RNE)
+                       && (drv_data->rx < drv_data->rx_end)) {
+               read_SSDR(reg);
+               drv_data->rx += n_bytes;
+       }
+}
+
+static void u8_writer(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_TNF)
+                       && (drv_data->tx < drv_data->tx_end)) {
+               write_SSDR(*(u8 *)(drv_data->tx), reg);
+               ++drv_data->tx;
+       }
+}
+
+static void u8_reader(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_RNE)
+                       && (drv_data->rx < drv_data->rx_end)) {
+               *(u8 *)(drv_data->rx) = read_SSDR(reg);
+               ++drv_data->rx;
+       }
+}
+
+static void u16_writer(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_TNF)
+                       && (drv_data->tx < drv_data->tx_end)) {
+               write_SSDR(*(u16 *)(drv_data->tx), reg);
+               drv_data->tx += 2;
+       }
+}
+
+static void u16_reader(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_RNE)
+                       && (drv_data->rx < drv_data->rx_end)) {
+               *(u16 *)(drv_data->rx) = read_SSDR(reg);
+               drv_data->rx += 2;
+       }
+}
+static void u32_writer(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_TNF)
+                       && (drv_data->tx < drv_data->tx_end)) {
+               write_SSDR(*(u32 *)(drv_data->tx), reg);
+               drv_data->tx += 4;
+       }
+}
+
+static void u32_reader(struct driver_data *drv_data)
+{
+       void *reg = drv_data->ioaddr;
+
+       while ((read_SSSR(reg) & SSSR_RNE)
+                       && (drv_data->rx < drv_data->rx_end)) {
+               *(u32 *)(drv_data->rx) = read_SSDR(reg);
+               drv_data->rx += 4;
+       }
+}
+
+static void *next_transfer(struct driver_data *drv_data)
+{
+       struct spi_message *msg = drv_data->cur_msg;
+       struct spi_transfer *trans = drv_data->cur_transfer;
+
+       /* Move to next transfer */
+       if (trans->transfer_list.next != &msg->transfers) {
+               drv_data->cur_transfer =
+                       list_entry(trans->transfer_list.next,
+                                       struct spi_transfer,
+                                       transfer_list);
+               return RUNNING_STATE;
+       } else
+               return DONE_STATE;
+}
+
+static int map_dma_buffers(struct driver_data *drv_data)
+{
+       struct spi_message *msg = drv_data->cur_msg;
+       struct device *dev = &msg->spi->dev;
+
+       if (!drv_data->cur_chip->enable_dma)
+               return 0;
+
+       if (msg->is_dma_mapped)
+               return  drv_data->rx_dma && drv_data->tx_dma;
+
+       if (!IS_DMA_ALIGNED(drv_data->rx) || !IS_DMA_ALIGNED(drv_data->tx))
+               return 0;
+
+       /* Modify setup if rx buffer is null */
+       if (drv_data->rx == NULL) {
+               *drv_data->null_dma_buf = 0;
+               drv_data->rx = drv_data->null_dma_buf;
+               drv_data->rx_map_len = 4;
+       } else
+               drv_data->rx_map_len = drv_data->len;
+
+
+       /* Modify setup if tx buffer is null */
+       if (drv_data->tx == NULL) {
+               *drv_data->null_dma_buf = 0;
+               drv_data->tx = drv_data->null_dma_buf;
+               drv_data->tx_map_len = 4;
+       } else
+               drv_data->tx_map_len = drv_data->len;
+
+       /* Stream map the rx buffer */
+       drv_data->rx_dma = dma_map_single(dev, drv_data->rx,
+                                               drv_data->rx_map_len,
+                                               DMA_FROM_DEVICE);
+       if (dma_mapping_error(drv_data->rx_dma))
+               return 0;
+
+       /* Stream map the tx buffer */
+       drv_data->tx_dma = dma_map_single(dev, drv_data->tx,
+                                               drv_data->tx_map_len,
+                                               DMA_TO_DEVICE);
+
+       if (dma_mapping_error(drv_data->tx_dma)) {
+               dma_unmap_single(dev, drv_data->rx_dma,
+                                       drv_data->rx_map_len, DMA_FROM_DEVICE);
+               return 0;
+       }
+
+       return 1;
+}
+
+static void unmap_dma_buffers(struct driver_data *drv_data)
+{
+       struct device *dev;
+
+       if (!drv_data->dma_mapped)
+               return;
+
+       if (!drv_data->cur_msg->is_dma_mapped) {
+               dev = &drv_data->cur_msg->spi->dev;
+               dma_unmap_single(dev, drv_data->rx_dma,
+                                       drv_data->rx_map_len, DMA_FROM_DEVICE);
+               dma_unmap_single(dev, drv_data->tx_dma,
+                                       drv_data->tx_map_len, DMA_TO_DEVICE);
+       }
+
+       drv_data->dma_mapped = 0;
+}
+
+/* caller already set message->status; dma and pio irqs are blocked */
+static void giveback(struct driver_data *drv_data)
+{
+       struct spi_transfer* last_transfer;
+       unsigned long flags;
+       struct spi_message *msg;
+
+       spin_lock_irqsave(&drv_data->lock, flags);
+       msg = drv_data->cur_msg;
+       drv_data->cur_msg = NULL;
+       drv_data->cur_transfer = NULL;
+       drv_data->cur_chip = NULL;
+       queue_work(drv_data->workqueue, &drv_data->pump_messages);
+       spin_unlock_irqrestore(&drv_data->lock, flags);
+
+       last_transfer = list_entry(msg->transfers.prev,
+                                       struct spi_transfer,
+                                       transfer_list);
+
+       if (!last_transfer->cs_change)
+               drv_data->cs_control(PXA2XX_CS_DEASSERT);
+
+       msg->state = NULL;
+       if (msg->complete)
+               msg->complete(msg->context);
+}
+
+static int wait_ssp_rx_stall(void *ioaddr)
+{
+       unsigned long limit = loops_per_jiffy << 1;
+
+       while ((read_SSSR(ioaddr) & SSSR_BSY) && limit--)
+               cpu_relax();
+
+       return limit;
+}
+
+static int wait_dma_channel_stop(int channel)
+{
+       unsigned long limit = loops_per_jiffy << 1;
+
+       while (!(DCSR(channel) & DCSR_STOPSTATE) && limit--)
+               cpu_relax();
+
+       return limit;
+}
+
+static void dma_handler(int channel, void *data, struct pt_regs *regs)
+{
+       struct driver_data *drv_data = data;
+       struct spi_message *msg = drv_data->cur_msg;
+       void *reg = drv_data->ioaddr;
+       u32 irq_status = DCSR(channel) & DMA_INT_MASK;
+       u32 trailing_sssr = 0;
+
+       if (irq_status & DCSR_BUSERR) {
+
+               /* Disable interrupts, clear status and reset DMA */
+               write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);
+               write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(0, reg);
+               write_SSSR(drv_data->clear_sr, reg);
+               DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
+               DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;
+
+               if (flush(drv_data) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                                       "dma_handler: flush fail\n");
+
+               unmap_dma_buffers(drv_data);
+
+               if (channel == drv_data->tx_channel)
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_handler: bad bus address on "
+                               "tx channel %d, source %x target = %x\n",
+                               channel, DSADR(channel), DTADR(channel));
+               else
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_handler: bad bus address on "
+                               "rx channel %d, source %x target = %x\n",
+                               channel, DSADR(channel), DTADR(channel));
+
+               msg->state = ERROR_STATE;
+               tasklet_schedule(&drv_data->pump_transfers);
+       }
+
+       /* PXA255x_SSP has no timeout interrupt, wait for tailing bytes */
+       if ((drv_data->ssp_type == PXA25x_SSP)
+               && (channel == drv_data->tx_channel)
+               && (irq_status & DCSR_ENDINTR)) {
+
+               /* Wait for rx to stall */
+               if (wait_ssp_rx_stall(drv_data->ioaddr) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_handler: ssp rx stall failed\n");
+
+               /* Clear and disable interrupts on SSP and DMA channels*/
+               write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);
+               write_SSSR(drv_data->clear_sr, reg);
+               DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;
+               DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
+               if (wait_dma_channel_stop(drv_data->rx_channel) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_handler: dma rx channel stop failed\n");
+
+               unmap_dma_buffers(drv_data);
+
+               /* Read trailing bytes */
+               /* Calculate number of trailing bytes, read them */
+               trailing_sssr = read_SSSR(reg);
+               if ((trailing_sssr & 0xf008) != 0xf000) {
+                       drv_data->rx = drv_data->rx_end -
+                                       (((trailing_sssr >> 12) & 0x0f) + 1);
+                       drv_data->read(drv_data);
+               }
+               msg->actual_length += drv_data->len;
+
+               /* Release chip select if requested, transfer delays are
+                * handled in pump_transfers */
+               if (drv_data->cs_change)
+                       drv_data->cs_control(PXA2XX_CS_DEASSERT);
+
+               /* Move to next transfer */
+               msg->state = next_transfer(drv_data);
+
+               /* Schedule transfer tasklet */
+               tasklet_schedule(&drv_data->pump_transfers);
+       }
+}
+
+static irqreturn_t dma_transfer(struct driver_data *drv_data)
+{
+       u32 irq_status;
+       u32 trailing_sssr = 0;
+       struct spi_message *msg = drv_data->cur_msg;
+       void *reg = drv_data->ioaddr;
+
+       irq_status = read_SSSR(reg) & drv_data->mask_sr;
+       if (irq_status & SSSR_ROR) {
+               /* Clear and disable interrupts on SSP and DMA channels*/
+               write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);
+               write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(0, reg);
+               write_SSSR(drv_data->clear_sr, reg);
+               DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;
+               DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
+               unmap_dma_buffers(drv_data);
+
+               if (flush(drv_data) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                                       "dma_transfer: flush fail\n");
+
+               dev_warn(&drv_data->pdev->dev, "dma_transfer: fifo overun\n");
+
+               drv_data->cur_msg->state = ERROR_STATE;
+               tasklet_schedule(&drv_data->pump_transfers);
+
+               return IRQ_HANDLED;
+       }
+
+       /* Check for false positive timeout */
+       if ((irq_status & SSSR_TINT) && DCSR(drv_data->tx_channel) & DCSR_RUN) {
+               write_SSSR(SSSR_TINT, reg);
+               return IRQ_HANDLED;
+       }
+
+       if (irq_status & SSSR_TINT || drv_data->rx == drv_data->rx_end) {
+
+               /* Clear and disable interrupts on SSP and DMA channels*/
+               write_SSCR1(read_SSCR1(reg) & ~drv_data->dma_cr1, reg);
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(0, reg);
+               write_SSSR(drv_data->clear_sr, reg);
+               DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;
+               DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
+
+               if (wait_dma_channel_stop(drv_data->rx_channel) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_transfer: dma rx channel stop failed\n");
+
+               if (wait_ssp_rx_stall(drv_data->ioaddr) == 0)
+                       dev_err(&drv_data->pdev->dev,
+                               "dma_transfer: ssp rx stall failed\n");
+
+               unmap_dma_buffers(drv_data);
+
+               /* Calculate number of trailing bytes, read them */
+               trailing_sssr = read_SSSR(reg);
+               if ((trailing_sssr & 0xf008) != 0xf000) {
+                       drv_data->rx = drv_data->rx_end -
+                                       (((trailing_sssr >> 12) & 0x0f) + 1);
+                       drv_data->read(drv_data);
+               }
+               msg->actual_length += drv_data->len;
+
+               /* Release chip select if requested, transfer delays are
+                * handled in pump_transfers */
+               if (drv_data->cs_change)
+                       drv_data->cs_control(PXA2XX_CS_DEASSERT);
+
+               /* Move to next transfer */
+               msg->state = next_transfer(drv_data);
+
+               /* Schedule transfer tasklet */
+               tasklet_schedule(&drv_data->pump_transfers);
+
+               return IRQ_HANDLED;
+       }
+
+       /* Opps problem detected */
+       return IRQ_NONE;
+}
+
+static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
+{
+       struct spi_message *msg = drv_data->cur_msg;
+       void *reg = drv_data->ioaddr;
+       unsigned long limit = loops_per_jiffy << 1;
+       u32 irq_status;
+       u32 irq_mask = (read_SSCR1(reg) & SSCR1_TIE) ?
+                       drv_data->mask_sr : drv_data->mask_sr & ~SSSR_TFS;
+
+       while ((irq_status = read_SSSR(reg) & irq_mask)) {
+
+               if (irq_status & SSSR_ROR) {
+
+                       /* Clear and disable interrupts */
+                       write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);
+                       write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
+                       if (drv_data->ssp_type != PXA25x_SSP)
+                               write_SSTO(0, reg);
+                       write_SSSR(drv_data->clear_sr, reg);
+
+                       if (flush(drv_data) == 0)
+                               dev_err(&drv_data->pdev->dev,
+                                       "interrupt_transfer: flush fail\n");
+
+                       /* Stop the SSP */
+
+                       dev_warn(&drv_data->pdev->dev,
+                                       "interrupt_transfer: fifo overun\n");
+
+                       msg->state = ERROR_STATE;
+                       tasklet_schedule(&drv_data->pump_transfers);
+
+                       return IRQ_HANDLED;
+               }
+
+               /* Look for false positive timeout */
+               if ((irq_status & SSSR_TINT)
+                               && (drv_data->rx < drv_data->rx_end))
+                       write_SSSR(SSSR_TINT, reg);
+
+               /* Pump data */
+               drv_data->read(drv_data);
+               drv_data->write(drv_data);
+
+               if (drv_data->tx == drv_data->tx_end) {
+                       /* Disable tx interrupt */
+                       write_SSCR1(read_SSCR1(reg) & ~SSCR1_TIE, reg);
+                       irq_mask = drv_data->mask_sr & ~SSSR_TFS;
+
+                       /* PXA25x_SSP has no timeout, read trailing bytes */
+                       if (drv_data->ssp_type == PXA25x_SSP) {
+                               while ((read_SSSR(reg) & SSSR_BSY) && limit--)
+                                       drv_data->read(drv_data);
+
+                               if (limit == 0)
+                                       dev_err(&drv_data->pdev->dev,
+                                               "interrupt_transfer: "
+                                               "trailing byte read failed\n");
+                       }
+               }
+
+               if ((irq_status & SSSR_TINT)
+                               || (drv_data->rx == drv_data->rx_end)) {
+
+                       /* Clear timeout */
+                       write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
+                       if (drv_data->ssp_type != PXA25x_SSP)
+                               write_SSTO(0, reg);
+                       write_SSSR(drv_data->clear_sr, reg);
+
+                       /* Update total byte transfered */
+                       msg->actual_length += drv_data->len;
+
+                       /* Release chip select if requested, transfer delays are
+                        * handled in pump_transfers */
+                       if (drv_data->cs_change)
+                               drv_data->cs_control(PXA2XX_CS_DEASSERT);
+
+                       /* Move to next transfer */
+                       msg->state = next_transfer(drv_data);
+
+                       /* Schedule transfer tasklet */
+                       tasklet_schedule(&drv_data->pump_transfers);
+               }
+       }
+
+       /* We did something */
+       return IRQ_HANDLED;
+}
+
+static irqreturn_t ssp_int(int irq, void *dev_id, struct pt_regs *regs)
+{
+       struct driver_data *drv_data = (struct driver_data *)dev_id;
+       void *reg = drv_data->ioaddr;
+
+       if (!drv_data->cur_msg) {
+
+               write_SSCR0(read_SSCR0(reg) & ~SSCR0_SSE, reg);
+               write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(0, reg);
+               write_SSSR(drv_data->clear_sr, reg);
+
+               dev_err(&drv_data->pdev->dev, "bad message state "
+                               "in interrupt handler");
+
+               /* Never fail */
+               return IRQ_HANDLED;
+       }
+
+       return drv_data->transfer_handler(drv_data);
+}
+
+static void pump_transfers(unsigned long data)
+{
+       struct driver_data *drv_data = (struct driver_data *)data;
+       struct spi_message *message = NULL;
+       struct spi_transfer *transfer = NULL;
+       struct spi_transfer *previous = NULL;
+       struct chip_data *chip = NULL;
+       void *reg = drv_data->ioaddr;
+       u32 clk_div = 0;
+       u8 bits = 0;
+       u32 speed = 0;
+       u32 cr0;
+
+       /* Get current state information */
+       message = drv_data->cur_msg;
+       transfer = drv_data->cur_transfer;
+       chip = drv_data->cur_chip;
+
+       /* Handle for abort */
+       if (message->state == ERROR_STATE) {
+               message->status = -EIO;
+               giveback(drv_data);
+               return;
+       }
+
+       /* Handle end of message */
+       if (message->state == DONE_STATE) {
+               message->status = 0;
+               giveback(drv_data);
+               return;
+       }
+
+       /* Delay if requested at end of transfer*/
+       if (message->state == RUNNING_STATE) {
+               previous = list_entry(transfer->transfer_list.prev,
+                                       struct spi_transfer,
+                                       transfer_list);
+               if (previous->delay_usecs)
+                       udelay(previous->delay_usecs);
+       }
+
+       /* Setup the transfer state based on the type of transfer */
+       if (flush(drv_data) == 0) {
+               dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n");
+               message->status = -EIO;
+               giveback(drv_data);
+               return;
+       }
+       drv_data->n_bytes = chip->n_bytes;
+       drv_data->dma_width = chip->dma_width;
+       drv_data->cs_control = chip->cs_control;
+       drv_data->tx = (void *)transfer->tx_buf;
+       drv_data->tx_end = drv_data->tx + transfer->len;
+       drv_data->rx = transfer->rx_buf;
+       drv_data->rx_end = drv_data->rx + transfer->len;
+       drv_data->rx_dma = transfer->rx_dma;
+       drv_data->tx_dma = transfer->tx_dma;
+       drv_data->len = transfer->len;
+       drv_data->write = drv_data->tx ? chip->write : null_writer;
+       drv_data->read = drv_data->rx ? chip->read : null_reader;
+       drv_data->cs_change = transfer->cs_change;
+
+       /* Change speed and bit per word on a per transfer */
+       if (transfer->speed_hz || transfer->bits_per_word) {
+
+               /* Disable clock */
+               write_SSCR0(chip->cr0 & ~SSCR0_SSE, reg);
+               cr0 = chip->cr0;
+               bits = chip->bits_per_word;
+               speed = chip->speed_hz;
+
+               if (transfer->speed_hz)
+                       speed = transfer->speed_hz;
+
+               if (transfer->bits_per_word)
+                       bits = transfer->bits_per_word;
+
+               if (reg == SSP1_VIRT)
+                       clk_div = SSP1_SerClkDiv(speed);
+               else if (reg == SSP2_VIRT)
+                       clk_div = SSP2_SerClkDiv(speed);
+               else if (reg == SSP3_VIRT)
+                       clk_div = SSP3_SerClkDiv(speed);
+
+               if (bits <= 8) {
+                       drv_data->n_bytes = 1;
+                       drv_data->dma_width = DCMD_WIDTH1;
+                       drv_data->read = drv_data->read != null_reader ?
+                                               u8_reader : null_reader;
+                       drv_data->write = drv_data->write != null_writer ?
+                                               u8_writer : null_writer;
+               } else if (bits <= 16) {
+                       drv_data->n_bytes = 2;
+                       drv_data->dma_width = DCMD_WIDTH2;
+                       drv_data->read = drv_data->read != null_reader ?
+                                               u16_reader : null_reader;
+                       drv_data->write = drv_data->write != null_writer ?
+                                               u16_writer : null_writer;
+               } else if (bits <= 32) {
+                       drv_data->n_bytes = 4;
+                       drv_data->dma_width = DCMD_WIDTH4;
+                       drv_data->read = drv_data->read != null_reader ?
+                                               u32_reader : null_reader;
+                       drv_data->write = drv_data->write != null_writer ?
+                                               u32_writer : null_writer;
+               }
+
+               cr0 = clk_div
+                       | SSCR0_Motorola
+                       | SSCR0_DataSize(bits > 16 ? bits - 16 : bits)
+                       | SSCR0_SSE
+                       | (bits > 16 ? SSCR0_EDSS : 0);
+
+               /* Start it back up */
+               write_SSCR0(cr0, reg);
+       }
+
+       message->state = RUNNING_STATE;
+
+       /* Try to map dma buffer and do a dma transfer if successful */
+       if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) {
+
+               /* Ensure we have the correct interrupt handler */
+               drv_data->transfer_handler = dma_transfer;
+
+               /* Setup rx DMA Channel */
+               DCSR(drv_data->rx_channel) = RESET_DMA_CHANNEL;
+               DSADR(drv_data->rx_channel) = drv_data->ssdr_physical;
+               DTADR(drv_data->rx_channel) = drv_data->rx_dma;
+               if (drv_data->rx == drv_data->null_dma_buf)
+                       /* No target address increment */
+                       DCMD(drv_data->rx_channel) = DCMD_FLOWSRC
+                                                       | drv_data->dma_width
+                                                       | chip->dma_burst_size
+                                                       | drv_data->len;
+               else
+                       DCMD(drv_data->rx_channel) = DCMD_INCTRGADDR
+                                                       | DCMD_FLOWSRC
+                                                       | drv_data->dma_width
+                                                       | chip->dma_burst_size
+                                                       | drv_data->len;
+
+               /* Setup tx DMA Channel */
+               DCSR(drv_data->tx_channel) = RESET_DMA_CHANNEL;
+               DSADR(drv_data->tx_channel) = drv_data->tx_dma;
+               DTADR(drv_data->tx_channel) = drv_data->ssdr_physical;
+               if (drv_data->tx == drv_data->null_dma_buf)
+                       /* No source address increment */
+                       DCMD(drv_data->tx_channel) = DCMD_FLOWTRG
+                                                       | drv_data->dma_width
+                                                       | chip->dma_burst_size
+                                                       | drv_data->len;
+               else
+                       DCMD(drv_data->tx_channel) = DCMD_INCSRCADDR
+                                                       | DCMD_FLOWTRG
+                                                       | drv_data->dma_width
+                                                       | chip->dma_burst_size
+                                                       | drv_data->len;
+
+               /* Enable dma end irqs on SSP to detect end of transfer */
+               if (drv_data->ssp_type == PXA25x_SSP)
+                       DCMD(drv_data->tx_channel) |= DCMD_ENDIRQEN;
+
+               /* Fix me, need to handle cs polarity */
+               drv_data->cs_control(PXA2XX_CS_ASSERT);
+
+               /* Go baby, go */
+               write_SSSR(drv_data->clear_sr, reg);
+               DCSR(drv_data->rx_channel) |= DCSR_RUN;
+               DCSR(drv_data->tx_channel) |= DCSR_RUN;
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(chip->timeout, reg);
+               write_SSCR1(chip->cr1
+                               | chip->dma_threshold
+                               | drv_data->dma_cr1,
+                               reg);
+       } else {
+               /* Ensure we have the correct interrupt handler */
+               drv_data->transfer_handler = interrupt_transfer;
+
+               /* Fix me, need to handle cs polarity */
+               drv_data->cs_control(PXA2XX_CS_ASSERT);
+
+               /* Go baby, go */
+               write_SSSR(drv_data->clear_sr, reg);
+               if (drv_data->ssp_type != PXA25x_SSP)
+                       write_SSTO(chip->timeout, reg);
+               write_SSCR1(chip->cr1
+                               | chip->threshold
+                               | drv_data->int_cr1,
+                               reg);
+       }
+}
+
+static void pump_messages(void *data)
+{
+       struct driver_data *drv_data = data;
+       unsigned long flags;
+
+       /* Lock queue and check for queue work */
+       spin_lock_irqsave(&drv_data->lock, flags);
+       if (list_empty(&drv_data->queue) || drv_data->run == QUEUE_STOPPED) {
+               drv_data->busy = 0;
+               spin_unlock_irqrestore(&drv_data->lock, flags);
+               return;
+       }
+
+       /* Make sure we are not already running a message */
+       if (drv_data->cur_msg) {
+               spin_unlock_irqrestore(&drv_data->lock, flags);
+               return;
+       }
+
+       /* Extract head of queue */
+       drv_data->cur_msg = list_entry(drv_data->queue.next,
+                                       struct spi_message, queue);
+       list_del_init(&drv_data->cur_msg->queue);
+
+       /* Initial message state*/
+       drv_data->cur_msg->state = START_STATE;
+       drv_data->cur_transfer = list_entry(drv_data->cur_msg->transfers.next,
+                                               struct spi_transfer,
+                                               transfer_list);
+
+       /* Setup the SSP using the per chip configuration */
+       drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi);
+       restore_state(drv_data);
+
+       /* Mark as busy and launch transfers */
+       tasklet_schedule(&drv_data->pump_transfers);
+
+       drv_data->busy = 1;
+       spin_unlock_irqrestore(&drv_data->lock, flags);
+}
+
+static int transfer(struct spi_device *spi, struct spi_message *msg)
+{
+       struct driver_data *drv_data = spi_master_get_devdata(spi->master);
+       unsigned long flags;
+
+       spin_lock_irqsave(&drv_data->lock, flags);
+
+       if (drv_data->run == QUEUE_STOPPED) {
+               spin_unlock_irqrestore(&drv_data->lock, flags);
+               return -ESHUTDOWN;
+       }
+
+       msg->actual_length = 0;
+       msg->status = -EINPROGRESS;
+       msg->state = START_STATE;
+
+       list_add_tail(&msg->queue, &drv_data->queue);
+
+       if (drv_data->run == QUEUE_RUNNING && !drv_data->busy)
+               queue_work(drv_data->workqueue, &drv_data->pump_messages);
+
+       spin_unlock_irqrestore(&drv_data->lock, flags);
+
+       return 0;
+}
+
+static int setup(struct spi_device *spi)
+{
+       struct pxa2xx_spi_chip *chip_info = NULL;
+       struct chip_data *chip;
+       struct driver_data *drv_data = spi_master_get_devdata(spi->master);
+       unsigned int clk_div;
+
+       if (!spi->bits_per_word)
+               spi->bits_per_word = 8;
+
+       if (drv_data->ssp_type != PXA25x_SSP
+                       && (spi->bits_per_word < 4 || spi->bits_per_word > 32))
+               return -EINVAL;
+       else if (spi->bits_per_word < 4 || spi->bits_per_word > 16)
+               return -EINVAL;
+
+       /* Only alloc (or use chip_info) on first setup */
+       chip = spi_get_ctldata(spi);
+       if (chip == NULL) {
+               chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
+               if (!chip)
+                       return -ENOMEM;
+
+               chip->cs_control = null_cs_control;
+               chip->enable_dma = 0;
+               chip->timeout = SSP_TIMEOUT(1000);
+               chip->threshold = SSCR1_RxTresh(1) | SSCR1_TxTresh(1);
+               chip->dma_burst_size = drv_data->master_info->enable_dma ?
+                                       DCMD_BURST8 : 0;
+
+               chip_info = spi->controller_data;
+       }
+
+       /* chip_info isn't always needed */
+       if (chip_info) {
+               if (chip_info->cs_control)
+                       chip->cs_control = chip_info->cs_control;
+
+               chip->timeout = SSP_TIMEOUT(chip_info->timeout_microsecs);
+
+               chip->threshold = SSCR1_RxTresh(chip_info->rx_threshold)
+                                       | SSCR1_TxTresh(chip_info->tx_threshold);
+
+               chip->enable_dma = chip_info->dma_burst_size != 0
+                                       && drv_data->master_info->enable_dma;
+               chip->dma_threshold = 0;
+
+               if (chip->enable_dma) {
+                       if (chip_info->dma_burst_size <= 8) {
+                               chip->dma_threshold = SSCR1_RxTresh(8)
+                                                       | SSCR1_TxTresh(8);
+                               chip->dma_burst_size = DCMD_BURST8;
+                       } else if (chip_info->dma_burst_size <= 16) {
+                               chip->dma_threshold = SSCR1_RxTresh(16)
+                                                       | SSCR1_TxTresh(16);
+                               chip->dma_burst_size = DCMD_BURST16;
+                       } else {
+                               chip->dma_threshold = SSCR1_RxTresh(32)
+                                                       | SSCR1_TxTresh(32);
+                               chip->dma_burst_size = DCMD_BURST32;
+                       }
+               }
+
+
+               if (chip_info->enable_loopback)
+                       chip->cr1 = SSCR1_LBM;
+       }
+
+       if (drv_data->ioaddr == SSP1_VIRT)
+               clk_div = SSP1_SerClkDiv(spi->max_speed_hz);
+       else if (drv_data->ioaddr == SSP2_VIRT)
+               clk_div = SSP2_SerClkDiv(spi->max_speed_hz);
+       else if (drv_data->ioaddr == SSP3_VIRT)
+               clk_div = SSP3_SerClkDiv(spi->max_speed_hz);
+       else
+               return -ENODEV;
+       chip->speed_hz = spi->max_speed_hz;
+
+       chip->cr0 = clk_div
+                       | SSCR0_Motorola
+                       | SSCR0_DataSize(spi->bits_per_word > 16 ?
+                               spi->bits_per_word - 16 : spi->bits_per_word)
+                       | SSCR0_SSE
+                       | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0);
+       chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4)
+                       | (((spi->mode & SPI_CPOL) != 0) << 3);
+
+       /* NOTE:  PXA25x_SSP _could_ use external clocking ... */
+       if (drv_data->ssp_type != PXA25x_SSP)
+               dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n",
+                               spi->bits_per_word,
+                               (CLOCK_SPEED_HZ)
+                                       / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),
+                               spi->mode & 0x3);
+       else
+               dev_dbg(&spi->dev, "%d bits/word, %d Hz, mode %d\n",
+                               spi->bits_per_word,
+                               (CLOCK_SPEED_HZ/2)
+                                       / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)),
+                               spi->mode & 0x3);
+
+       if (spi->bits_per_word <= 8) {
+               chip->n_bytes = 1;
+               chip->dma_width = DCMD_WIDTH1;
+               chip->read = u8_reader;
+               chip->write = u8_writer;
+       } else if (spi->bits_per_word <= 16) {
+               chip->n_bytes = 2;
+               chip->dma_width = DCMD_WIDTH2;
+               chip->read = u16_reader;
+               chip->write = u16_writer;
+       } else if (spi->bits_per_word <= 32) {
+               chip->cr0 |= SSCR0_EDSS;
+               chip->n_bytes = 4;
+               chip->dma_width = DCMD_WIDTH4;
+               chip->read = u32_reader;
+               chip->write = u32_writer;
+       } else {
+               dev_err(&spi->dev, "invalid wordsize\n");
+               kfree(chip);
+               return -ENODEV;
+       }
+       chip->bits_per_word = spi->bits_per_word;
+
+       spi_set_ctldata(spi, chip);
+
+       return 0;
+}
+
+static void cleanup(const struct spi_device *spi)
+{
+       struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
+
+       kfree(chip);
+}
+
+static int init_queue(struct driver_data *drv_data)
+{
+       INIT_LIST_HEAD(&drv_data->queue);
+       spin_lock_init(&drv_data->lock);
+
+       drv_data->run = QUEUE_STOPPED;
+       drv_data->busy = 0;
+
+       tasklet_init(&drv_data->pump_transfers,
+                       pump_transfers, (unsigned long)drv_data);
+
+       INIT_WORK(&drv_data->pump_messages, pump_messages, drv_data);
+       drv_data->workqueue = create_singlethread_workqueue(
+                                       drv_data->master->cdev.dev->bus_id);
+       if (drv_data->workqueue == NULL)
+               return -EBUSY;
+
+       return 0;
+}
+
+static int start_queue(struct driver_data *drv_data)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&drv_data->lock, flags);
+
+       if (drv_data->run == QUEUE_RUNNING || drv_data->busy) {
+               spin_unlock_irqrestore(&drv_data->lock, flags);
+               return -EBUSY;
+       }
+
+       drv_data->run = QUEUE_RUNNING;
+       drv_data->cur_msg = NULL;
+       drv_data->cur_transfer = NULL;
+       drv_data->cur_chip = NULL;
+       spin_unlock_irqrestore(&drv_data->lock, flags);
+
+       queue_work(drv_data->workqueue, &drv_data->pump_messages);
+
+       return 0;
+}
+
+static int stop_queue(struct driver_data *drv_data)
+{
+       unsigned long flags;
+       unsigned limit = 500;
+       int status = 0;
+
+       spin_lock_irqsave(&drv_data->lock, flags);
+
+       /* This is a bit lame, but is optimized for the common execution path.
+        * A wait_queue on the drv_data->busy could be used, but then the common
+        * execution path (pump_messages) would be required to call wake_up or
+        * friends on every SPI message. Do this instead */
+       drv_data->run = QUEUE_STOPPED;
+       while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) {
+               spin_unlock_irqrestore(&drv_data->lock, flags);
+               msleep(10);
+               spin_lock_irqsave(&drv_data->lock, flags);
+       }
+
+       if (!list_empty(&drv_data->queue) || drv_data->busy)
+               status = -EBUSY;
+
+       spin_unlock_irqrestore(&drv_data->lock, flags);
+
+       return status;
+}
+
+static int destroy_queue(struct driver_data *drv_data)
+{
+       int status;
+
+       status = stop_queue(drv_data);
+       if (status != 0)
+               return status;
+
+       destroy_workqueue(drv_data->workqueue);
+
+       return 0;
+}
+
+static int pxa2xx_spi_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct pxa2xx_spi_master *platform_info;
+       struct spi_master *master;
+       struct driver_data *drv_data = 0;
+       struct resource *memory_resource;
+       int irq;
+       int status = 0;
+
+       platform_info = dev->platform_data;
+
+       if (platform_info->ssp_type == SSP_UNDEFINED) {
+               dev_err(&pdev->dev, "undefined SSP\n");
+               return -ENODEV;
+       }
+
+       /* Allocate master with space for drv_data and null dma buffer */
+       master = spi_alloc_master(dev, sizeof(struct driver_data) + 16);
+       if (!master) {
+               dev_err(&pdev->dev, "can not alloc spi_master\n");
+               return -ENOMEM;
+       }
+       drv_data = spi_master_get_devdata(master);
+       drv_data->master = master;
+       drv_data->master_info = platform_info;
+       drv_data->pdev = pdev;
+
+       master->bus_num = pdev->id;
+       master->num_chipselect = platform_info->num_chipselect;
+       master->cleanup = cleanup;
+       master->setup = setup;
+       master->transfer = transfer;
+
+       drv_data->ssp_type = platform_info->ssp_type;
+       drv_data->null_dma_buf = (u32 *)ALIGN((u32)(drv_data +
+                                               sizeof(struct driver_data)), 8);
+
+       /* Setup register addresses */
+       memory_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!memory_resource) {
+               dev_err(&pdev->dev, "memory resources not defined\n");
+               status = -ENODEV;
+               goto out_error_master_alloc;
+       }
+
+       drv_data->ioaddr = (void *)io_p2v((unsigned long)(memory_resource->start));
+       drv_data->ssdr_physical = memory_resource->start + 0x00000010;
+       if (platform_info->ssp_type == PXA25x_SSP) {
+               drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE;
+               drv_data->dma_cr1 = 0;
+               drv_data->clear_sr = SSSR_ROR;
+               drv_data->mask_sr = SSSR_RFS | SSSR_TFS | SSSR_ROR;
+       } else {
+               drv_data->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE;
+               drv_data->dma_cr1 = SSCR1_TSRE | SSCR1_RSRE | SSCR1_TINTE;
+               drv_data->clear_sr = SSSR_ROR | SSSR_TINT;
+               drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR;
+       }
+
+       /* Attach to IRQ */
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_err(&pdev->dev, "irq resource not defined\n");
+               status = -ENODEV;
+               goto out_error_master_alloc;
+       }
+
+       status = request_irq(irq, ssp_int, 0, dev->bus_id, drv_data);
+       if (status < 0) {
+               dev_err(&pdev->dev, "can not get IRQ\n");
+               goto out_error_master_alloc;
+       }
+
+       /* Setup DMA if requested */
+       drv_data->tx_channel = -1;
+       drv_data->rx_channel = -1;
+       if (platform_info->enable_dma) {
+
+               /* Get two DMA channels (rx and tx) */
+               drv_data->rx_channel = pxa_request_dma("pxa2xx_spi_ssp_rx",
+                                                       DMA_PRIO_HIGH,
+                                                       dma_handler,
+                                                       drv_data);
+               if (drv_data->rx_channel < 0) {
+                       dev_err(dev, "problem (%d) requesting rx channel\n",
+                               drv_data->rx_channel);
+                       status = -ENODEV;
+                       goto out_error_irq_alloc;
+               }
+               drv_data->tx_channel = pxa_request_dma("pxa2xx_spi_ssp_tx",
+                                                       DMA_PRIO_MEDIUM,
+                                                       dma_handler,
+                                                       drv_data);
+               if (drv_data->tx_channel < 0) {
+                       dev_err(dev, "problem (%d) requesting tx channel\n",
+                               drv_data->tx_channel);
+                       status = -ENODEV;
+                       goto out_error_dma_alloc;
+               }
+
+               if (drv_data->ioaddr == SSP1_VIRT) {
+                               DRCMRRXSSDR = DRCMR_MAPVLD
+                                               | drv_data->rx_channel;
+                               DRCMRTXSSDR = DRCMR_MAPVLD
+                                               | drv_data->tx_channel;
+               } else if (drv_data->ioaddr == SSP2_VIRT) {
+                               DRCMRRXSS2DR = DRCMR_MAPVLD
+                                               | drv_data->rx_channel;
+                               DRCMRTXSS2DR = DRCMR_MAPVLD
+                                               | drv_data->tx_channel;
+               } else if (drv_data->ioaddr == SSP3_VIRT) {
+                               DRCMRRXSS3DR = DRCMR_MAPVLD
+                                               | drv_data->rx_channel;
+                               DRCMRTXSS3DR = DRCMR_MAPVLD
+                                               | drv_data->tx_channel;
+               } else {
+                       dev_err(dev, "bad SSP type\n");
+                       goto out_error_dma_alloc;
+               }
+       }
+
+       /* Enable SOC clock */
+       pxa_set_cken(platform_info->clock_enable, 1);
+
+       /* Load default SSP configuration */
+       write_SSCR0(0, drv_data->ioaddr);
+       write_SSCR1(SSCR1_RxTresh(4) | SSCR1_TxTresh(12), drv_data->ioaddr);
+       write_SSCR0(SSCR0_SerClkDiv(2)
+                       | SSCR0_Motorola
+                       | SSCR0_DataSize(8),
+                       drv_data->ioaddr);
+       if (drv_data->ssp_type != PXA25x_SSP)
+               write_SSTO(0, drv_data->ioaddr);
+       write_SSPSP(0, drv_data->ioaddr);
+
+       /* Initial and start queue */
+       status = init_queue(drv_data);
+       if (status != 0) {
+               dev_err(&pdev->dev, "problem initializing queue\n");
+               goto out_error_clock_enabled;
+       }
+       status = start_queue(drv_data);
+       if (status != 0) {
+               dev_err(&pdev->dev, "problem starting queue\n");
+               goto out_error_clock_enabled;
+       }
+
+       /* Register with the SPI framework */
+       platform_set_drvdata(pdev, drv_data);
+       status = spi_register_master(master);
+       if (status != 0) {
+               dev_err(&pdev->dev, "problem registering spi master\n");
+               goto out_error_queue_alloc;
+       }
+
+       return status;
+
+out_error_queue_alloc:
+       destroy_queue(drv_data);
+
+out_error_clock_enabled:
+       pxa_set_cken(platform_info->clock_enable, 0);
+
+out_error_dma_alloc:
+       if (drv_data->tx_channel != -1)
+               pxa_free_dma(drv_data->tx_channel);
+       if (drv_data->rx_channel != -1)
+               pxa_free_dma(drv_data->rx_channel);
+
+out_error_irq_alloc:
+       free_irq(irq, drv_data);
+
+out_error_master_alloc:
+       spi_master_put(master);
+       return status;
+}
+
+static int pxa2xx_spi_remove(struct platform_device *pdev)
+{
+       struct driver_data *drv_data = platform_get_drvdata(pdev);
+       int irq;
+       int status = 0;
+
+       if (!drv_data)
+               return 0;
+
+       /* Remove the queue */
+       status = destroy_queue(drv_data);
+       if (status != 0)
+               return status;
+
+       /* Disable the SSP at the peripheral and SOC level */
+       write_SSCR0(0, drv_data->ioaddr);
+       pxa_set_cken(drv_data->master_info->clock_enable, 0);
+
+       /* Release DMA */
+       if (drv_data->master_info->enable_dma) {
+               if (drv_data->ioaddr == SSP1_VIRT) {
+                       DRCMRRXSSDR = 0;
+                       DRCMRTXSSDR = 0;
+               } else if (drv_data->ioaddr == SSP2_VIRT) {
+                       DRCMRRXSS2DR = 0;
+                       DRCMRTXSS2DR = 0;
+               } else if (drv_data->ioaddr == SSP3_VIRT) {
+                       DRCMRRXSS3DR = 0;
+                       DRCMRTXSS3DR = 0;
+               }
+               pxa_free_dma(drv_data->tx_channel);
+               pxa_free_dma(drv_data->rx_channel);
+       }
+
+       /* Release IRQ */
+       irq = platform_get_irq(pdev, 0);
+       if (irq >= 0)
+               free_irq(irq, drv_data);
+
+       /* Disconnect from the SPI framework */
+       spi_unregister_master(drv_data->master);
+
+       /* Prevent double remove */
+       platform_set_drvdata(pdev, NULL);
+
+       return 0;
+}
+
+static void pxa2xx_spi_shutdown(struct platform_device *pdev)
+{
+       int status = 0;
+
+       if ((status = pxa2xx_spi_remove(pdev)) != 0)
+               dev_err(&pdev->dev, "shutdown failed with %d\n", status);
+}
+
+#ifdef CONFIG_PM
+static int suspend_devices(struct device *dev, void *pm_message)
+{
+       pm_message_t *state = pm_message;
+
+       if (dev->power.power_state.event != state->event) {
+               dev_warn(dev, "pm state does not match request\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+static int pxa2xx_spi_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct driver_data *drv_data = platform_get_drvdata(pdev);
+       int status = 0;
+
+       /* Check all childern for current power state */
+       if (device_for_each_child(&pdev->dev, &state, suspend_devices) != 0) {
+               dev_warn(&pdev->dev, "suspend aborted\n");
+               return -1;
+       }
+
+       status = stop_queue(drv_data);
+       if (status != 0)
+               return status;
+       write_SSCR0(0, drv_data->ioaddr);
+       pxa_set_cken(drv_data->master_info->clock_enable, 0);
+
+       return 0;
+}
+
+static int pxa2xx_spi_resume(struct platform_device *pdev)
+{
+       struct driver_data *drv_data = platform_get_drvdata(pdev);
+       int status = 0;
+
+       /* Enable the SSP clock */
+       pxa_set_cken(drv_data->master_info->clock_enable, 1);
+
+       /* Start the queue running */
+       status = start_queue(drv_data);
+       if (status != 0) {
+               dev_err(&pdev->dev, "problem starting queue (%d)\n", status);
+               return status;
+       }
+
+       return 0;
+}
+#else
+#define pxa2xx_spi_suspend NULL
+#define pxa2xx_spi_resume NULL
+#endif /* CONFIG_PM */
+
+static struct platform_driver driver = {
+       .driver = {
+               .name = "pxa2xx-spi",
+               .bus = &platform_bus_type,
+               .owner = THIS_MODULE,
+       },
+       .probe = pxa2xx_spi_probe,
+       .remove = __devexit_p(pxa2xx_spi_remove),
+       .shutdown = pxa2xx_spi_shutdown,
+       .suspend = pxa2xx_spi_suspend,
+       .resume = pxa2xx_spi_resume,
+};
+
+static int __init pxa2xx_spi_init(void)
+{
+       platform_driver_register(&driver);
+
+       return 0;
+}
+module_init(pxa2xx_spi_init);
+
+static void __exit pxa2xx_spi_exit(void)
+{
+       platform_driver_unregister(&driver);
+}
+module_exit(pxa2xx_spi_exit);
index 94f5e8ed83a7a8427105201aaa81f14ff5c710c7..1cea4a6799fe66c3e6fd94eaf56b3ed52b13e2cb 100644 (file)
@@ -338,18 +338,18 @@ static struct class spi_master_class = {
  * spi_alloc_master - allocate SPI master controller
  * @dev: the controller, possibly using the platform_bus
  * @size: how much driver-private data to preallocate; the pointer to this
- *     memory is in the class_data field of the returned class_device,
+ *     memory is in the class_data field of the returned class_device,
  *     accessible with spi_master_get_devdata().
  *
  * This call is used only by SPI master controller drivers, which are the
  * only ones directly touching chip registers.  It's how they allocate
- * an spi_master structure, prior to calling spi_add_master().
+ * an spi_master structure, prior to calling spi_register_master().
  *
  * This must be called from context that can sleep.  It returns the SPI
  * master structure on success, else NULL.
  *
  * The caller is responsible for assigning the bus number and initializing
- * the master's methods before calling spi_add_master(); and (after errors
+ * the master's methods before calling spi_register_master(); and (after errors
  * adding the device) calling spi_master_put() to prevent a memory leak.
  */
 struct spi_master * __init_or_module
@@ -395,7 +395,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
 int __init_or_module
 spi_register_master(struct spi_master *master)
 {
-       static atomic_t         dyn_bus_id = ATOMIC_INIT(0);
+       static atomic_t         dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
        struct device           *dev = master->cdev.dev;
        int                     status = -ENODEV;
        int                     dynamic = 0;
@@ -404,7 +404,7 @@ spi_register_master(struct spi_master *master)
                return -ENODEV;
 
        /* convention:  dynamically assigned bus IDs count down from the max */
-       if (master->bus_num == 0) {
+       if (master->bus_num < 0) {
                master->bus_num = atomic_dec_return(&dyn_bus_id);
                dynamic = 1;
        }
@@ -522,7 +522,8 @@ int spi_sync(struct spi_device *spi, struct spi_message *message)
 }
 EXPORT_SYMBOL_GPL(spi_sync);
 
-#define        SPI_BUFSIZ      (SMP_CACHE_BYTES)
+/* portable code must never pass more than 32 bytes */
+#define        SPI_BUFSIZ      max(32,SMP_CACHE_BYTES)
 
 static u8      *buf;
 
index f037e5593269e8a79f700e7acf917919e0b13762..dd2f950b21a734ca753a48ddf55fdd31d1b573bc 100644 (file)
@@ -138,6 +138,45 @@ static unsigned bitbang_txrx_32(
        return t->len - count;
 }
 
+int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct spi_bitbang_cs   *cs = spi->controller_state;
+       u8                      bits_per_word;
+       u32                     hz;
+
+       if (t) {
+               bits_per_word = t->bits_per_word;
+               hz = t->speed_hz;
+       } else {
+               bits_per_word = 0;
+               hz = 0;
+       }
+
+       /* spi_transfer level calls that work per-word */
+       if (!bits_per_word)
+               bits_per_word = spi->bits_per_word;
+       if (bits_per_word <= 8)
+               cs->txrx_bufs = bitbang_txrx_8;
+       else if (bits_per_word <= 16)
+               cs->txrx_bufs = bitbang_txrx_16;
+       else if (bits_per_word <= 32)
+               cs->txrx_bufs = bitbang_txrx_32;
+       else
+               return -EINVAL;
+
+       /* nsecs = (clock period)/2 */
+       if (!hz)
+               hz = spi->max_speed_hz;
+       if (hz) {
+               cs->nsecs = (1000000000/2) / hz;
+               if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000))
+                       return -EINVAL;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(spi_bitbang_setup_transfer);
+
 /**
  * spi_bitbang_setup - default setup for per-word I/O loops
  */
@@ -145,8 +184,16 @@ int spi_bitbang_setup(struct spi_device *spi)
 {
        struct spi_bitbang_cs   *cs = spi->controller_state;
        struct spi_bitbang      *bitbang;
+       int                     retval;
 
-       if (!spi->max_speed_hz)
+       bitbang = spi_master_get_devdata(spi->master);
+
+       /* REVISIT: some systems will want to support devices using lsb-first
+        * bit encodings on the wire.  In pure software that would be trivial,
+        * just bitbang_txrx_le_cphaX() routines shifting the other way, and
+        * some hardware controllers also have this support.
+        */
+       if ((spi->mode & SPI_LSB_FIRST) != 0)
                return -EINVAL;
 
        if (!cs) {
@@ -155,32 +202,20 @@ int spi_bitbang_setup(struct spi_device *spi)
                        return -ENOMEM;
                spi->controller_state = cs;
        }
-       bitbang = spi_master_get_devdata(spi->master);
 
        if (!spi->bits_per_word)
                spi->bits_per_word = 8;
 
-       /* spi_transfer level calls that work per-word */
-       if (spi->bits_per_word <= 8)
-               cs->txrx_bufs = bitbang_txrx_8;
-       else if (spi->bits_per_word <= 16)
-               cs->txrx_bufs = bitbang_txrx_16;
-       else if (spi->bits_per_word <= 32)
-               cs->txrx_bufs = bitbang_txrx_32;
-       else
-               return -EINVAL;
-
        /* per-word shift register access, in hardware or bitbanging */
        cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)];
        if (!cs->txrx_word)
                return -EINVAL;
 
-       /* nsecs = (clock period)/2 */
-       cs->nsecs = (1000000000/2) / (spi->max_speed_hz);
-       if (cs->nsecs > MAX_UDELAY_MS * 1000)
-               return -EINVAL;
+       retval = spi_bitbang_setup_transfer(spi, NULL);
+       if (retval < 0)
+               return retval;
 
-       dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",
+       dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n",
                        __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA),
                        spi->bits_per_word, 2 * cs->nsecs);
 
@@ -246,6 +281,8 @@ static void bitbang_work(void *_bitbang)
                unsigned                tmp;
                unsigned                cs_change;
                int                     status;
+               int                     (*setup_transfer)(struct spi_device *,
+                                               struct spi_transfer *);
 
                m = container_of(bitbang->queue.next, struct spi_message,
                                queue);
@@ -262,6 +299,7 @@ static void bitbang_work(void *_bitbang)
                tmp = 0;
                cs_change = 1;
                status = 0;
+               setup_transfer = NULL;
 
                list_for_each_entry (t, &m->transfers, transfer_list) {
                        if (bitbang->shutdown) {
@@ -269,6 +307,20 @@ static void bitbang_work(void *_bitbang)
                                break;
                        }
 
+                       /* override or restore speed and wordsize */
+                       if (t->speed_hz || t->bits_per_word) {
+                               setup_transfer = bitbang->setup_transfer;
+                               if (!setup_transfer) {
+                                       status = -ENOPROTOOPT;
+                                       break;
+                               }
+                       }
+                       if (setup_transfer) {
+                               status = setup_transfer(spi, t);
+                               if (status < 0)
+                                       break;
+                       }
+
                        /* set up default clock polarity, and activate chip;
                         * this implicitly updates clock and spi modes as
                         * previously recorded for this device via setup().
@@ -325,6 +377,10 @@ static void bitbang_work(void *_bitbang)
                m->status = status;
                m->complete(m->context);
 
+               /* restore speed and wordsize */
+               if (setup_transfer)
+                       setup_transfer(spi, NULL);
+
                /* normally deactivate chipselect ... unless no error and
                 * cs_change has hinted that the next message will probably
                 * be for this chip too.
@@ -348,6 +404,7 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
 {
        struct spi_bitbang      *bitbang;
        unsigned long           flags;
+       int                     status = 0;
 
        m->actual_length = 0;
        m->status = -EINPROGRESS;
@@ -357,11 +414,15 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
                return -ESHUTDOWN;
 
        spin_lock_irqsave(&bitbang->lock, flags);
-       list_add_tail(&m->queue, &bitbang->queue);
-       queue_work(bitbang->workqueue, &bitbang->work);
+       if (!spi->max_speed_hz)
+               status = -ENETDOWN;
+       else {
+               list_add_tail(&m->queue, &bitbang->queue);
+               queue_work(bitbang->workqueue, &bitbang->work);
+       }
        spin_unlock_irqrestore(&bitbang->lock, flags);
 
-       return 0;
+       return status;
 }
 EXPORT_SYMBOL_GPL(spi_bitbang_transfer);
 
@@ -406,6 +467,9 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
                bitbang->use_dma = 0;
                bitbang->txrx_bufs = spi_bitbang_bufs;
                if (!bitbang->master->setup) {
+                       if (!bitbang->setup_transfer)
+                               bitbang->setup_transfer =
+                                        spi_bitbang_setup_transfer;
                        bitbang->master->setup = spi_bitbang_setup;
                        bitbang->master->cleanup = spi_bitbang_cleanup;
                }
index ff9e5faa4dc9f369ec30e829279646547f1fba73..a006a1ee27acb6f4ca59f4a89693673650a84e86 100644 (file)
@@ -321,6 +321,7 @@ static void butterfly_attach(struct parport *p)
         * (firmware resets at45, acts as spi slave) or neither (we ignore
         * both, AVR uses AT45).  Here we expect firmware for the first option.
         */
+
        pp->info[0].max_speed_hz = 15 * 1000 * 1000;
        strcpy(pp->info[0].modalias, "mtd_dataflash");
        pp->info[0].platform_data = &flash;
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
new file mode 100644 (file)
index 0000000..5d92a7e
--- /dev/null
@@ -0,0 +1,483 @@
+/*
+ * MPC83xx SPI controller driver.
+ *
+ * Maintainer: Kumar Gala
+ *
+ * Copyright (C) 2006 Polycom, 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/module.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/completion.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/device.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
+#include <linux/platform_device.h>
+#include <linux/fsl_devices.h>
+
+#include <asm/irq.h>
+#include <asm/io.h>
+
+/* SPI Controller registers */
+struct mpc83xx_spi_reg {
+       u8 res1[0x20];
+       __be32 mode;
+       __be32 event;
+       __be32 mask;
+       __be32 command;
+       __be32 transmit;
+       __be32 receive;
+};
+
+/* SPI Controller mode register definitions */
+#define        SPMODE_CI_INACTIVEHIGH  (1 << 29)
+#define        SPMODE_CP_BEGIN_EDGECLK (1 << 28)
+#define        SPMODE_DIV16            (1 << 27)
+#define        SPMODE_REV              (1 << 26)
+#define        SPMODE_MS               (1 << 25)
+#define        SPMODE_ENABLE           (1 << 24)
+#define        SPMODE_LEN(x)           ((x) << 20)
+#define        SPMODE_PM(x)            ((x) << 16)
+
+/*
+ * Default for SPI Mode:
+ *     SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk
+ */
+#define        SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \
+                        SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf))
+
+/* SPIE register values */
+#define        SPIE_NE         0x00000200      /* Not empty */
+#define        SPIE_NF         0x00000100      /* Not full */
+
+/* SPIM register values */
+#define        SPIM_NE         0x00000200      /* Not empty */
+#define        SPIM_NF         0x00000100      /* Not full */
+
+/* SPI Controller driver's private data. */
+struct mpc83xx_spi {
+       /* bitbang has to be first */
+       struct spi_bitbang bitbang;
+       struct completion done;
+
+       struct mpc83xx_spi_reg __iomem *base;
+
+       /* rx & tx bufs from the spi_transfer */
+       const void *tx;
+       void *rx;
+
+       /* functions to deal with different sized buffers */
+       void (*get_rx) (u32 rx_data, struct mpc83xx_spi *);
+       u32(*get_tx) (struct mpc83xx_spi *);
+
+       unsigned int count;
+       u32 irq;
+
+       unsigned nsecs;         /* (clock cycle time)/2 */
+
+       u32 sysclk;
+       void (*activate_cs) (u8 cs, u8 polarity);
+       void (*deactivate_cs) (u8 cs, u8 polarity);
+};
+
+static inline void mpc83xx_spi_write_reg(__be32 __iomem * reg, u32 val)
+{
+       out_be32(reg, val);
+}
+
+static inline u32 mpc83xx_spi_read_reg(__be32 __iomem * reg)
+{
+       return in_be32(reg);
+}
+
+#define MPC83XX_SPI_RX_BUF(type)                                         \
+void mpc83xx_spi_rx_buf_##type(u32 data, struct mpc83xx_spi *mpc83xx_spi) \
+{                                                                        \
+       type * rx = mpc83xx_spi->rx;                                      \
+       *rx++ = (type)data;                                               \
+       mpc83xx_spi->rx = rx;                                             \
+}
+
+#define MPC83XX_SPI_TX_BUF(type)                               \
+u32 mpc83xx_spi_tx_buf_##type(struct mpc83xx_spi *mpc83xx_spi) \
+{                                                              \
+       u32 data;                                               \
+       const type * tx = mpc83xx_spi->tx;                      \
+       data = *tx++;                                           \
+       mpc83xx_spi->tx = tx;                                   \
+       return data;                                            \
+}
+
+MPC83XX_SPI_RX_BUF(u8)
+MPC83XX_SPI_RX_BUF(u16)
+MPC83XX_SPI_RX_BUF(u32)
+MPC83XX_SPI_TX_BUF(u8)
+MPC83XX_SPI_TX_BUF(u16)
+MPC83XX_SPI_TX_BUF(u32)
+
+static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
+{
+       struct mpc83xx_spi *mpc83xx_spi;
+       u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0;
+
+       mpc83xx_spi = spi_master_get_devdata(spi->master);
+
+       if (value == BITBANG_CS_INACTIVE) {
+               if (mpc83xx_spi->deactivate_cs)
+                       mpc83xx_spi->deactivate_cs(spi->chip_select, pol);
+       }
+
+       if (value == BITBANG_CS_ACTIVE) {
+               u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
+               u32 len = spi->bits_per_word;
+               if (len == 32)
+                       len = 0;
+               else
+                       len = len - 1;
+
+               /* mask out bits we are going to set */
+               regval &= ~0x38ff0000;
+
+               if (spi->mode & SPI_CPHA)
+                       regval |= SPMODE_CP_BEGIN_EDGECLK;
+               if (spi->mode & SPI_CPOL)
+                       regval |= SPMODE_CI_INACTIVEHIGH;
+
+               regval |= SPMODE_LEN(len);
+
+               if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) {
+                       u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64);
+                       regval |= SPMODE_PM(pm) | SPMODE_DIV16;
+               } else {
+                       u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4);
+                       regval |= SPMODE_PM(pm);
+               }
+
+               mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
+               if (mpc83xx_spi->activate_cs)
+                       mpc83xx_spi->activate_cs(spi->chip_select, pol);
+       }
+}
+
+static
+int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct mpc83xx_spi *mpc83xx_spi;
+       u32 regval;
+       u8 bits_per_word;
+       u32 hz;
+
+       mpc83xx_spi = spi_master_get_devdata(spi->master);
+
+       if (t) {
+               bits_per_word = t->bits_per_word;
+               hz = t->speed_hz;
+       } else {
+               bits_per_word = 0;
+               hz = 0;
+       }
+
+       /* spi_transfer level calls that work per-word */
+       if (!bits_per_word)
+               bits_per_word = spi->bits_per_word;
+
+       /* Make sure its a bit width we support [4..16, 32] */
+       if ((bits_per_word < 4)
+           || ((bits_per_word > 16) && (bits_per_word != 32)))
+               return -EINVAL;
+
+       if (bits_per_word <= 8) {
+               mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
+               mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
+       } else if (bits_per_word <= 16) {
+               mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u16;
+               mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u16;
+       } else if (bits_per_word <= 32) {
+               mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u32;
+               mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u32;
+       } else
+               return -EINVAL;
+
+       /* nsecs = (clock period)/2 */
+       if (!hz)
+               hz = spi->max_speed_hz;
+       mpc83xx_spi->nsecs = (1000000000 / 2) / hz;
+       if (mpc83xx_spi->nsecs > MAX_UDELAY_MS * 1000)
+               return -EINVAL;
+
+       if (bits_per_word == 32)
+               bits_per_word = 0;
+       else
+               bits_per_word = bits_per_word - 1;
+
+       regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
+
+       /* Mask out bits_per_wordgth */
+       regval &= 0xff0fffff;
+       regval |= SPMODE_LEN(bits_per_word);
+
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
+
+       return 0;
+}
+
+static int mpc83xx_spi_setup(struct spi_device *spi)
+{
+       struct spi_bitbang *bitbang;
+       struct mpc83xx_spi *mpc83xx_spi;
+       int retval;
+
+       if (!spi->max_speed_hz)
+               return -EINVAL;
+
+       bitbang = spi_master_get_devdata(spi->master);
+       mpc83xx_spi = spi_master_get_devdata(spi->master);
+
+       if (!spi->bits_per_word)
+               spi->bits_per_word = 8;
+
+       retval = mpc83xx_spi_setup_transfer(spi, NULL);
+       if (retval < 0)
+               return retval;
+
+       dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec\n",
+               __FUNCTION__, spi->mode & (SPI_CPOL | SPI_CPHA),
+               spi->bits_per_word, 2 * mpc83xx_spi->nsecs);
+
+       /* NOTE we _need_ to call chipselect() early, ideally with adapter
+        * setup, unless the hardware defaults cooperate to avoid confusion
+        * between normal (active low) and inverted chipselects.
+        */
+
+       /* deselect chip (low or high) */
+       spin_lock(&bitbang->lock);
+       if (!bitbang->busy) {
+               bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
+               ndelay(mpc83xx_spi->nsecs);
+       }
+       spin_unlock(&bitbang->lock);
+
+       return 0;
+}
+
+static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct mpc83xx_spi *mpc83xx_spi;
+       u32 word;
+
+       mpc83xx_spi = spi_master_get_devdata(spi->master);
+
+       mpc83xx_spi->tx = t->tx_buf;
+       mpc83xx_spi->rx = t->rx_buf;
+       mpc83xx_spi->count = t->len;
+       INIT_COMPLETION(mpc83xx_spi->done);
+
+       /* enable rx ints */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, SPIM_NE);
+
+       /* transmit word */
+       word = mpc83xx_spi->get_tx(mpc83xx_spi);
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit, word);
+
+       wait_for_completion(&mpc83xx_spi->done);
+
+       /* disable rx ints */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
+
+       return t->len - mpc83xx_spi->count;
+}
+
+irqreturn_t mpc83xx_spi_irq(s32 irq, void *context_data,
+                           struct pt_regs * ptregs)
+{
+       struct mpc83xx_spi *mpc83xx_spi = context_data;
+       u32 event;
+       irqreturn_t ret = IRQ_NONE;
+
+       /* Get interrupt events(tx/rx) */
+       event = mpc83xx_spi_read_reg(&mpc83xx_spi->base->event);
+
+       /* We need handle RX first */
+       if (event & SPIE_NE) {
+               u32 rx_data = mpc83xx_spi_read_reg(&mpc83xx_spi->base->receive);
+
+               if (mpc83xx_spi->rx)
+                       mpc83xx_spi->get_rx(rx_data, mpc83xx_spi);
+
+               ret = IRQ_HANDLED;
+       }
+
+       if ((event & SPIE_NF) == 0)
+               /* spin until TX is done */
+               while (((event =
+                        mpc83xx_spi_read_reg(&mpc83xx_spi->base->event)) &
+                                               SPIE_NF) == 0)
+                        cpu_relax();
+
+       mpc83xx_spi->count -= 1;
+       if (mpc83xx_spi->count) {
+               if (mpc83xx_spi->tx) {
+                       u32 word = mpc83xx_spi->get_tx(mpc83xx_spi);
+                       mpc83xx_spi_write_reg(&mpc83xx_spi->base->transmit,
+                                             word);
+               }
+       } else {
+               complete(&mpc83xx_spi->done);
+       }
+
+       /* Clear the events */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, event);
+
+       return ret;
+}
+
+static int __init mpc83xx_spi_probe(struct platform_device *dev)
+{
+       struct spi_master *master;
+       struct mpc83xx_spi *mpc83xx_spi;
+       struct fsl_spi_platform_data *pdata;
+       struct resource *r;
+       u32 regval;
+       int ret = 0;
+
+       /* Get resources(memory, IRQ) associated with the device */
+       master = spi_alloc_master(&dev->dev, sizeof(struct mpc83xx_spi));
+
+       if (master == NULL) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       platform_set_drvdata(dev, master);
+       pdata = dev->dev.platform_data;
+
+       if (pdata == NULL) {
+               ret = -ENODEV;
+               goto free_master;
+       }
+
+       r = platform_get_resource(dev, IORESOURCE_MEM, 0);
+       if (r == NULL) {
+               ret = -ENODEV;
+               goto free_master;
+       }
+
+       mpc83xx_spi = spi_master_get_devdata(master);
+       mpc83xx_spi->bitbang.master = spi_master_get(master);
+       mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
+       mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
+       mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
+       mpc83xx_spi->sysclk = pdata->sysclk;
+       mpc83xx_spi->activate_cs = pdata->activate_cs;
+       mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
+       mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
+       mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
+
+       mpc83xx_spi->bitbang.master->setup = mpc83xx_spi_setup;
+       init_completion(&mpc83xx_spi->done);
+
+       mpc83xx_spi->base = ioremap(r->start, r->end - r->start + 1);
+       if (mpc83xx_spi->base == NULL) {
+               ret = -ENOMEM;
+               goto put_master;
+       }
+
+       mpc83xx_spi->irq = platform_get_irq(dev, 0);
+
+       if (mpc83xx_spi->irq < 0) {
+               ret = -ENXIO;
+               goto unmap_io;
+       }
+
+       /* Register for SPI Interrupt */
+       ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq,
+                         0, "mpc83xx_spi", mpc83xx_spi);
+
+       if (ret != 0)
+               goto unmap_io;
+
+       master->bus_num = pdata->bus_num;
+       master->num_chipselect = pdata->max_chipselect;
+
+       /* SPI controller initializations */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mask, 0);
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->command, 0);
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->event, 0xffffffff);
+
+       /* Enable SPI interface */
+       regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
+
+       ret = spi_bitbang_start(&mpc83xx_spi->bitbang);
+
+       if (ret != 0)
+               goto free_irq;
+
+       printk(KERN_INFO
+              "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",
+              dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq);
+
+       return ret;
+
+free_irq:
+       free_irq(mpc83xx_spi->irq, mpc83xx_spi);
+unmap_io:
+       iounmap(mpc83xx_spi->base);
+put_master:
+       spi_master_put(master);
+free_master:
+       kfree(master);
+err:
+       return ret;
+}
+
+static int __devexit mpc83xx_spi_remove(struct platform_device *dev)
+{
+       struct mpc83xx_spi *mpc83xx_spi;
+       struct spi_master *master;
+
+       master = platform_get_drvdata(dev);
+       mpc83xx_spi = spi_master_get_devdata(master);
+
+       spi_bitbang_stop(&mpc83xx_spi->bitbang);
+       free_irq(mpc83xx_spi->irq, mpc83xx_spi);
+       iounmap(mpc83xx_spi->base);
+       spi_master_put(mpc83xx_spi->bitbang.master);
+
+       return 0;
+}
+
+static struct platform_driver mpc83xx_spi_driver = {
+       .probe = mpc83xx_spi_probe,
+       .remove = __devexit_p(mpc83xx_spi_remove),
+       .driver = {
+                  .name = "mpc83xx_spi",
+       },
+};
+
+static int __init mpc83xx_spi_init(void)
+{
+       return platform_driver_register(&mpc83xx_spi_driver);
+}
+
+static void __exit mpc83xx_spi_exit(void)
+{
+       platform_driver_unregister(&mpc83xx_spi_driver);
+}
+
+module_init(mpc83xx_spi_init);
+module_exit(mpc83xx_spi_exit);
+
+MODULE_AUTHOR("Kumar Gala");
+MODULE_DESCRIPTION("Simple MPC83xx SPI Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
new file mode 100644 (file)
index 0000000..5fc1456
--- /dev/null
@@ -0,0 +1,453 @@
+/* linux/drivers/spi/spi_s3c24xx.c
+ *
+ * Copyright (c) 2006 Ben Dooks
+ * Copyright (c) 2006 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+*/
+
+
+//#define DEBUG
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <linux/workqueue.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/clk.h>
+#include <linux/platform_device.h>
+
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
+
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/hardware.h>
+
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/regs-spi.h>
+#include <asm/arch/spi.h>
+
+struct s3c24xx_spi {
+       /* bitbang has to be first */
+       struct spi_bitbang       bitbang;
+       struct completion        done;
+
+       void __iomem            *regs;
+       int                      irq;
+       int                      len;
+       int                      count;
+
+       /* data buffers */
+       const unsigned char     *tx;
+       unsigned char           *rx;
+
+       struct clk              *clk;
+       struct resource         *ioarea;
+       struct spi_master       *master;
+       struct spi_device       *curdev;
+       struct device           *dev;
+       struct s3c2410_spi_info *pdata;
+};
+
+#define SPCON_DEFAULT (S3C2410_SPCON_MSTR | S3C2410_SPCON_SMOD_INT)
+#define SPPIN_DEFAULT (S3C2410_SPPIN_KEEP)
+
+static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
+{
+       return spi_master_get_devdata(sdev->master);
+}
+
+static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
+{
+       struct s3c24xx_spi *hw = to_hw(spi);
+       unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
+       unsigned int spcon;
+
+       switch (value) {
+       case BITBANG_CS_INACTIVE:
+               if (hw->pdata->set_cs)
+                       hw->pdata->set_cs(hw->pdata, value, cspol);
+               else
+                       s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);
+               break;
+
+       case BITBANG_CS_ACTIVE:
+               spcon = readb(hw->regs + S3C2410_SPCON);
+
+               if (spi->mode & SPI_CPHA)
+                       spcon |= S3C2410_SPCON_CPHA_FMTB;
+               else
+                       spcon &= ~S3C2410_SPCON_CPHA_FMTB;
+
+               if (spi->mode & SPI_CPOL)
+                       spcon |= S3C2410_SPCON_CPOL_HIGH;
+               else
+                       spcon &= ~S3C2410_SPCON_CPOL_HIGH;
+
+               spcon |= S3C2410_SPCON_ENSCK;
+
+               /* write new configration */
+
+               writeb(spcon, hw->regs + S3C2410_SPCON);
+
+               if (hw->pdata->set_cs)
+                       hw->pdata->set_cs(hw->pdata, value, cspol);
+               else
+                       s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);
+
+               break;
+
+       }
+}
+
+static int s3c24xx_spi_setupxfer(struct spi_device *spi,
+                                struct spi_transfer *t)
+{
+       struct s3c24xx_spi *hw = to_hw(spi);
+       unsigned int bpw;
+       unsigned int hz;
+       unsigned int div;
+
+       bpw = t ? t->bits_per_word : spi->bits_per_word;
+       hz  = t ? t->speed_hz : spi->max_speed_hz;
+
+       if (bpw != 8) {
+               dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);
+               return -EINVAL;
+       }
+
+       div = clk_get_rate(hw->clk) / hz;
+
+       /* is clk = pclk / (2 * (pre+1)), or is it
+        *    clk = (pclk * 2) / ( pre + 1) */
+
+       div = (div / 2) - 1;
+
+       if (div < 0)
+               div = 1;
+
+       if (div > 255)
+               div = 255;
+
+       dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz);
+       writeb(div, hw->regs + S3C2410_SPPRE);
+
+       spin_lock(&hw->bitbang.lock);
+       if (!hw->bitbang.busy) {
+               hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);
+               /* need to ndelay for 0.5 clocktick ? */
+       }
+       spin_unlock(&hw->bitbang.lock);
+
+       return 0;
+}
+
+static int s3c24xx_spi_setup(struct spi_device *spi)
+{
+       int ret;
+
+       if (!spi->bits_per_word)
+               spi->bits_per_word = 8;
+
+       if ((spi->mode & SPI_LSB_FIRST) != 0)
+               return -EINVAL;
+
+       ret = s3c24xx_spi_setupxfer(spi, NULL);
+       if (ret < 0) {
+               dev_err(&spi->dev, "setupxfer returned %d\n", ret);
+               return ret;
+       }
+
+       dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n",
+               __FUNCTION__, spi->mode, spi->bits_per_word,
+               spi->max_speed_hz);
+
+       return 0;
+}
+
+static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
+{
+       return hw->tx ? hw->tx[count] : 0xff;
+}
+
+static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
+{
+       struct s3c24xx_spi *hw = to_hw(spi);
+
+       dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",
+               t->tx_buf, t->rx_buf, t->len);
+
+       hw->tx = t->tx_buf;
+       hw->rx = t->rx_buf;
+       hw->len = t->len;
+       hw->count = 0;
+
+       /* send the first byte */
+       writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
+       wait_for_completion(&hw->done);
+
+       return hw->count;
+}
+
+static irqreturn_t s3c24xx_spi_irq(int irq, void *dev, struct pt_regs *regs)
+{
+       struct s3c24xx_spi *hw = dev;
+       unsigned int spsta = readb(hw->regs + S3C2410_SPSTA);
+       unsigned int count = hw->count;
+
+       if (spsta & S3C2410_SPSTA_DCOL) {
+               dev_dbg(hw->dev, "data-collision\n");
+               complete(&hw->done);
+               goto irq_done;
+       }
+
+       if (!(spsta & S3C2410_SPSTA_READY)) {
+               dev_dbg(hw->dev, "spi not ready for tx?\n");
+               complete(&hw->done);
+               goto irq_done;
+       }
+
+       hw->count++;
+
+       if (hw->rx)
+               hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
+
+       count++;
+
+       if (count < hw->len)
+               writeb(hw_txbyte(hw, count), hw->regs + S3C2410_SPTDAT);
+       else
+               complete(&hw->done);
+
+ irq_done:
+       return IRQ_HANDLED;
+}
+
+static int s3c24xx_spi_probe(struct platform_device *pdev)
+{
+       struct s3c24xx_spi *hw;
+       struct spi_master *master;
+       struct spi_board_info *bi;
+       struct resource *res;
+       int err = 0;
+       int i;
+
+       master = spi_alloc_master(&pdev->dev, sizeof(struct s3c24xx_spi));
+       if (master == NULL) {
+               dev_err(&pdev->dev, "No memory for spi_master\n");
+               err = -ENOMEM;
+               goto err_nomem;
+       }
+
+       hw = spi_master_get_devdata(master);
+       memset(hw, 0, sizeof(struct s3c24xx_spi));
+
+       hw->master = spi_master_get(master);
+       hw->pdata = pdev->dev.platform_data;
+       hw->dev = &pdev->dev;
+
+       if (hw->pdata == NULL) {
+               dev_err(&pdev->dev, "No platform data supplied\n");
+               err = -ENOENT;
+               goto err_no_pdata;
+       }
+
+       platform_set_drvdata(pdev, hw);
+       init_completion(&hw->done);
+
+       /* setup the state for the bitbang driver */
+
+       hw->bitbang.master         = hw->master;
+       hw->bitbang.setup_transfer = s3c24xx_spi_setupxfer;
+       hw->bitbang.chipselect     = s3c24xx_spi_chipsel;
+       hw->bitbang.txrx_bufs      = s3c24xx_spi_txrx;
+       hw->bitbang.master->setup  = s3c24xx_spi_setup;
+
+       dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
+
+       /* find and map our resources */
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
+               err = -ENOENT;
+               goto err_no_iores;
+       }
+
+       hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1,
+                                       pdev->name);
+
+       if (hw->ioarea == NULL) {
+               dev_err(&pdev->dev, "Cannot reserve region\n");
+               err = -ENXIO;
+               goto err_no_iores;
+       }
+
+       hw->regs = ioremap(res->start, (res->end - res->start)+1);
+       if (hw->regs == NULL) {
+               dev_err(&pdev->dev, "Cannot map IO\n");
+               err = -ENXIO;
+               goto err_no_iomap;
+       }
+
+       hw->irq = platform_get_irq(pdev, 0);
+       if (hw->irq < 0) {
+               dev_err(&pdev->dev, "No IRQ specified\n");
+               err = -ENOENT;
+               goto err_no_irq;
+       }
+
+       err = request_irq(hw->irq, s3c24xx_spi_irq, 0, pdev->name, hw);
+       if (err) {
+               dev_err(&pdev->dev, "Cannot claim IRQ\n");
+               goto err_no_irq;
+       }
+
+       hw->clk = clk_get(&pdev->dev, "spi");
+       if (IS_ERR(hw->clk)) {
+               dev_err(&pdev->dev, "No clock for device\n");
+               err = PTR_ERR(hw->clk);
+               goto err_no_clk;
+       }
+
+       /* for the moment, permanently enable the clock */
+
+       clk_enable(hw->clk);
+
+       /* program defaults into the registers */
+
+       writeb(0xff, hw->regs + S3C2410_SPPRE);
+       writeb(SPPIN_DEFAULT, hw->regs + S3C2410_SPPIN);
+       writeb(SPCON_DEFAULT, hw->regs + S3C2410_SPCON);
+
+       /* setup any gpio we can */
+
+       if (!hw->pdata->set_cs) {
+               s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
+               s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
+       }
+
+       /* register our spi controller */
+
+       err = spi_bitbang_start(&hw->bitbang);
+       if (err) {
+               dev_err(&pdev->dev, "Failed to register SPI master\n");
+               goto err_register;
+       }
+
+       dev_dbg(hw->dev, "shutdown=%d\n", hw->bitbang.shutdown);
+
+       /* register all the devices associated */
+
+       bi = &hw->pdata->board_info[0];
+       for (i = 0; i < hw->pdata->board_size; i++, bi++) {
+               dev_info(hw->dev, "registering %s\n", bi->modalias);
+
+               bi->controller_data = hw;
+               spi_new_device(master, bi);
+       }
+
+       return 0;
+
+ err_register:
+       clk_disable(hw->clk);
+       clk_put(hw->clk);
+
+ err_no_clk:
+       free_irq(hw->irq, hw);
+
+ err_no_irq:
+       iounmap(hw->regs);
+
+ err_no_iomap:
+       release_resource(hw->ioarea);
+       kfree(hw->ioarea);
+
+ err_no_iores:
+ err_no_pdata:
+       spi_master_put(hw->master);;
+
+ err_nomem:
+       return err;
+}
+
+static int s3c24xx_spi_remove(struct platform_device *dev)
+{
+       struct s3c24xx_spi *hw = platform_get_drvdata(dev);
+
+       platform_set_drvdata(dev, NULL);
+
+       spi_unregister_master(hw->master);
+
+       clk_disable(hw->clk);
+       clk_put(hw->clk);
+
+       free_irq(hw->irq, hw);
+       iounmap(hw->regs);
+
+       release_resource(hw->ioarea);
+       kfree(hw->ioarea);
+
+       spi_master_put(hw->master);
+       return 0;
+}
+
+
+#ifdef CONFIG_PM
+
+static int s3c24xx_spi_suspend(struct platform_device *pdev, pm_message_t msg)
+{
+       struct s3c24xx_spi *hw = platform_get_drvdata(pdev);
+
+       clk_disable(hw->clk);
+       return 0;
+}
+
+static int s3c24xx_spi_resume(struct platform_device *pdev)
+{
+       struct s3c24xx_spi *hw = platform_get_drvdata(pdev);
+
+       clk_enable(hw->clk);
+       return 0;
+}
+
+#else
+#define s3c24xx_spi_suspend NULL
+#define s3c24xx_spi_resume  NULL
+#endif
+
+static struct platform_driver s3c24xx_spidrv = {
+       .probe          = s3c24xx_spi_probe,
+       .remove         = s3c24xx_spi_remove,
+       .suspend        = s3c24xx_spi_suspend,
+       .resume         = s3c24xx_spi_resume,
+       .driver         = {
+               .name   = "s3c2410-spi",
+               .owner  = THIS_MODULE,
+       },
+};
+
+static int __init s3c24xx_spi_init(void)
+{
+        return platform_driver_register(&s3c24xx_spidrv);
+}
+
+static void __exit s3c24xx_spi_exit(void)
+{
+        platform_driver_unregister(&s3c24xx_spidrv);
+}
+
+module_init(s3c24xx_spi_init);
+module_exit(s3c24xx_spi_exit);
+
+MODULE_DESCRIPTION("S3C24XX SPI Driver");
+MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
new file mode 100644 (file)
index 0000000..aacdceb
--- /dev/null
@@ -0,0 +1,188 @@
+/* linux/drivers/spi/spi_s3c24xx_gpio.c
+ *
+ * Copyright (c) 2006 Ben Dooks
+ * Copyright (c) 2006 Simtec Electronics
+ *
+ * S3C24XX GPIO based SPI driver
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/spinlock.h>
+#include <linux/platform_device.h>
+
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
+
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/spi-gpio.h>
+#include <asm/arch/hardware.h>
+
+struct s3c2410_spigpio {
+       struct spi_bitbang               bitbang;
+
+       struct s3c2410_spigpio_info     *info;
+       struct platform_device          *dev;
+};
+
+static inline struct s3c2410_spigpio *spidev_to_sg(struct spi_device *spi)
+{
+       return spi->controller_data;
+}
+
+static inline void setsck(struct spi_device *dev, int on)
+{
+       struct s3c2410_spigpio *sg = spidev_to_sg(dev);
+       s3c2410_gpio_setpin(sg->info->pin_clk, on ? 1 : 0);
+}
+
+static inline void setmosi(struct spi_device *dev, int on)
+{
+       struct s3c2410_spigpio *sg = spidev_to_sg(dev);
+       s3c2410_gpio_setpin(sg->info->pin_mosi, on ? 1 : 0);
+}
+
+static inline u32 getmiso(struct spi_device *dev)
+{
+       struct s3c2410_spigpio *sg = spidev_to_sg(dev);
+       return s3c2410_gpio_getpin(sg->info->pin_miso) ? 1 : 0;
+}
+
+#define spidelay(x) ndelay(x)
+
+#define        EXPAND_BITBANG_TXRX
+#include <linux/spi/spi_bitbang.h>
+
+
+static u32 s3c2410_spigpio_txrx_mode0(struct spi_device *spi,
+                                     unsigned nsecs, u32 word, u8 bits)
+{
+       return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
+}
+
+static u32 s3c2410_spigpio_txrx_mode1(struct spi_device *spi,
+                                     unsigned nsecs, u32 word, u8 bits)
+{
+       return bitbang_txrx_be_cpha1(spi, nsecs, 0, word, bits);
+}
+
+static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)
+{
+       struct s3c2410_spigpio *sg = spidev_to_sg(dev);
+
+       if (sg->info && sg->info->chip_select)
+               (sg->info->chip_select)(sg->info, value);
+}
+
+static int s3c2410_spigpio_probe(struct platform_device *dev)
+{
+       struct spi_master       *master;
+       struct s3c2410_spigpio  *sp;
+       int ret;
+       int i;
+
+       master = spi_alloc_master(&dev->dev, sizeof(struct s3c2410_spigpio));
+       if (master == NULL) {
+               dev_err(&dev->dev, "failed to allocate spi master\n");
+               ret = -ENOMEM;
+               goto err;
+       }
+
+       sp = spi_master_get_devdata(master);
+
+       platform_set_drvdata(dev, sp);
+
+       /* copy in the plkatform data */
+       sp->info = dev->dev.platform_data;
+
+       /* setup spi bitbang adaptor */
+       sp->bitbang.master = spi_master_get(master);
+       sp->bitbang.chipselect = s3c2410_spigpio_chipselect;
+
+       sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0;
+       sp->bitbang.txrx_word[SPI_MODE_1] = s3c2410_spigpio_txrx_mode1;
+
+       /* set state of spi pins */
+       s3c2410_gpio_setpin(sp->info->pin_clk, 0);
+       s3c2410_gpio_setpin(sp->info->pin_mosi, 0);
+
+       s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT);
+       s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT);
+       s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT);
+
+       ret = spi_bitbang_start(&sp->bitbang);
+       if (ret)
+               goto err_no_bitbang;
+
+       /* register the chips to go with the board */
+
+       for (i = 0; i < sp->info->board_size; i++) {
+               dev_info(&dev->dev, "registering %p: %s\n",
+                        &sp->info->board_info[i],
+                        sp->info->board_info[i].modalias);
+
+               sp->info->board_info[i].controller_data = sp;
+               spi_new_device(master, sp->info->board_info + i);
+       }
+
+       return 0;
+
+ err_no_bitbang:
+       spi_master_put(sp->bitbang.master);
+ err:
+       return ret;
+
+}
+
+static int s3c2410_spigpio_remove(struct platform_device *dev)
+{
+       struct s3c2410_spigpio *sp = platform_get_drvdata(dev);
+
+       spi_bitbang_stop(&sp->bitbang);
+       spi_master_put(sp->bitbang.master);
+
+       return 0;
+}
+
+/* all gpio should be held over suspend/resume, so we should
+ * not need to deal with this
+*/
+
+#define s3c2410_spigpio_suspend NULL
+#define s3c2410_spigpio_resume NULL
+
+
+static struct platform_driver s3c2410_spigpio_drv = {
+       .probe          = s3c2410_spigpio_probe,
+        .remove                = s3c2410_spigpio_remove,
+        .suspend       = s3c2410_spigpio_suspend,
+        .resume                = s3c2410_spigpio_resume,
+        .driver                = {
+               .name   = "s3c24xx-spi-gpio",
+               .owner  = THIS_MODULE,
+        },
+};
+
+static int __init s3c2410_spigpio_init(void)
+{
+        return platform_driver_register(&s3c2410_spigpio_drv);
+}
+
+static void __exit s3c2410_spigpio_exit(void)
+{
+        platform_driver_unregister(&s3c2410_spigpio_drv);
+}
+
+module_init(s3c2410_spigpio_init);
+module_exit(s3c2410_spigpio_exit);
+
+MODULE_DESCRIPTION("S3C24XX SPI Driver");
+MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
+MODULE_LICENSE("GPL");
index 7860c8a5800d5a184adc8abea047dbef16c37b89..956b7a1e8af98c0a37056f280c371b6dd785a5dd 100644 (file)
@@ -69,7 +69,7 @@ static const char speedtch_driver_name[] = "speedtch";
 #define RESUBMIT_DELAY         1000    /* milliseconds */
 
 #define DEFAULT_BULK_ALTSETTING        1
-#define DEFAULT_ISOC_ALTSETTING        2
+#define DEFAULT_ISOC_ALTSETTING        3
 #define DEFAULT_DL_512_FIRST   0
 #define DEFAULT_ENABLE_ISOC    0
 #define DEFAULT_SW_BUFFERING   0
index c1211fc037d997b8a30cee323ded090d72d9da63..546249843b8e5fe3613ada68e512484d5382d73b 100644 (file)
@@ -99,11 +99,11 @@ static const char usbatm_driver_name[] = "usbatm";
 
 #define UDSL_MAX_RCV_URBS              16
 #define UDSL_MAX_SND_URBS              16
-#define UDSL_MAX_BUF_SIZE              64 * 1024       /* bytes */
+#define UDSL_MAX_BUF_SIZE              65536
 #define UDSL_DEFAULT_RCV_URBS          4
 #define UDSL_DEFAULT_SND_URBS          4
-#define UDSL_DEFAULT_RCV_BUF_SIZE      64 * ATM_CELL_SIZE      /* bytes */
-#define UDSL_DEFAULT_SND_BUF_SIZE      64 * ATM_CELL_SIZE      /* bytes */
+#define UDSL_DEFAULT_RCV_BUF_SIZE      3392    /* 64 * ATM_CELL_SIZE */
+#define UDSL_DEFAULT_SND_BUF_SIZE      3392    /* 64 * ATM_CELL_SIZE */
 
 #define ATM_CELL_HEADER                        (ATM_CELL_SIZE - ATM_CELL_PAYLOAD)
 
@@ -135,7 +135,7 @@ MODULE_PARM_DESC(rcv_buf_bytes,
 module_param(snd_buf_bytes, uint, S_IRUGO);
 MODULE_PARM_DESC(snd_buf_bytes,
                 "Size of the buffers used for transmission, in bytes (range: 1-"
-                __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: "
+                __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: "
                 __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")");
 
 
index fbd938d4ea589cc9d558d1f41cae0fad0dccd18b..e2e00ba4e1e6dd5b20aff7dda22316cd02a39e97 100644 (file)
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd,
                        USB_SPEED_FULL;
        hcd->self.root_hub = rhdev;
 
+       /* wakeup flag init defaults to "everything works" for root hubs,
+        * but drivers can override it in reset() if needed, along with
+        * recording the overall controller's system wakeup capability.
+        */
+       device_init_wakeup(&rhdev->dev, 1);
+
        /* "reset" is misnamed; its role is now one-time init. the controller
         * should already have been reset (and boot firmware kicked off etc).
         */
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
                goto err_hcd_driver_setup;
        }
 
-       /* wakeup flag init is in transition; for now we can't rely on PCI to
-        * initialize these bits properly, so we let reset() override it.
-        * This init should _precede_ the reset() once PCI behaves.
-        */
-       device_init_wakeup(&rhdev->dev,
-                       device_can_wakeup(hcd->self.controller));
-
        /* NOTE: root hub and controller capabilities may not be the same */
        if (device_can_wakeup(hcd->self.controller)
                        && device_can_wakeup(&hcd->self.root_hub->dev))
index 0c87f73f29332d9bbf71e688b97acaa5ac4a668f..90b8d43c6b339eb233045dc8d550176ea67192f6 100644 (file)
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n)
 static int choose_configuration(struct usb_device *udev)
 {
        int i;
-       u16 devstatus;
-       int bus_powered;
        int num_configs;
        struct usb_host_config *c, *best;
 
-       /* If this fails, assume the device is bus-powered */
-       devstatus = 0;
-       usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
-       le16_to_cpus(&devstatus);
-       bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
-       dev_dbg(&udev->dev, "device is %s-powered\n",
-                       bus_powered ? "bus" : "self");
-
        best = NULL;
        c = udev->config;
        num_configs = udev->descriptor.bNumConfigurations;
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
                 * similar errors in their descriptors.  If the next test
                 * were allowed to execute, such configurations would always
                 * be rejected and the devices would not work as expected.
+                * In the meantime, we run the risk of selecting a config
+                * that requires external power at a time when that power
+                * isn't available.  It seems to be the lesser of two evils.
+                *
+                * Bugzilla #6448 reports a device that appears to crash
+                * when it receives a GET_DEVICE_STATUS request!  We don't
+                * have any other way to tell whether a device is self-powered,
+                * but since we don't use that information anywhere but here,
+                * the call has been removed.
+                *
+                * Maybe the GET_DEVICE_STATUS call and the test below can
+                * be reinstated when device firmwares become more reliable.
+                * Don't hold your breath.
                 */
 #if 0
                /* Rule out self-powered configs for a bus-powered device */
index 544f7589912f714337cae4832a6478fd5fc50160..73f5a379d9b332a37e73b100862ad3c817e0df9e 100644 (file)
@@ -863,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci)
                i = ohci->num_ports;
                while (i--)
                        ohci_writel (ohci, RH_PS_PSS,
-                               &ohci->regs->roothub.portstatus [temp]);
+                               &ohci->regs->roothub.portstatus [i]);
                ohci_dbg (ohci, "restart complete\n");
        }
        return 0;
index acde8868da21f959cf36a9ea28df3901434ade18..fafe7c1265b31f9e719dadc9a7fbb3bebefbc89d 100644 (file)
@@ -185,6 +185,9 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
        /* Select Power Management Mode */
        pxa27x_ohci_select_pmm(inf->port_mode);
 
+       if (inf->power_budget)
+               hcd->power_budget = inf->power_budget;
+
        ohci_hcd_init(hcd_to_ohci(hcd));
 
        retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT);
index f419bd82ab7f5bd00fc78979c4e56369d4de77f1..435273e7c85cb5912ec9cc22ded58dec3b6e76aa 100644 (file)
@@ -1557,6 +1557,9 @@ void hid_init_reports(struct hid_device *hid)
 #define USB_VENDOR_ID_HP               0x03f0
 #define USB_DEVICE_ID_HP_USBHUB_KB     0x020c
 
+#define USB_VENDOR_ID_IBM              0x04b3
+#define USB_DEVICE_ID_IBM_USBHUB_KB    0x3005
+
 #define USB_VENDOR_ID_CREATIVELABS     0x062a
 #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201
 
@@ -1681,6 +1684,7 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET},
        { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_USBHUB_KB, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET },
index 6dd6666961787434653fcde4add8eb0e25bb2ab0..c4670e1d46545f12cdfe0ef9cdd89c106d1ca594 100644 (file)
@@ -317,6 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
                                }
 
                                schedule();
+                               set_current_state(TASK_INTERRUPTIBLE);
                        }
 
                        set_current_state(TASK_RUNNING);
index 3824df33094e237d10a26058ebb91945f7ba2bad..1fd9cb85f4ca3aa9014e542d0a517d508dcad1e6 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb.h>
+#include <linux/delay.h>
 
 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev)
 
        /* De-assert reset (let the CPU run) */
        err = emi26_set_reset(dev,0);
+       msleep(250);    /* let device settle */
 
        /* 2. We upload the FPGA firmware into the EMI
         * Note: collect up to 1023 (yes!) bytes and send them with
@@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev)
                        goto wraperr;
                }
        }
+       msleep(250);    /* let device settle */
 
        /* De-assert reset (let the CPU run) */
        err = emi26_set_reset(dev,0);
@@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev)
                err("%s - error loading firmware: error = %d", __FUNCTION__, err);
                goto wraperr;
        }
+       msleep(250);    /* let device settle */
 
        /* return 1 to fail the driver inialization
         * and give real driver change to load */
index 52fea2e08db87358f0d1073dfba5e2bc555b323b..fe351371f274e11e6b576dcce1a671cd2b8ef0f8 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <linux/delay.h>
 
 #define MAX_INTEL_HEX_RECORD_LENGTH 16
 typedef struct _INTEL_HEX_RECORD
@@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev)
 
        /* De-assert reset (let the CPU run) */
        err = emi62_set_reset(dev,0);
+       msleep(250);    /* let device settle */
 
        /* 2. We upload the FPGA firmware into the EMI
         * Note: collect up to 1023 (yes!) bytes and send them with
@@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev)
                err("%s - error loading firmware: error = %d", __FUNCTION__, err);
                goto wraperr;
        }
+       msleep(250);    /* let device settle */
 
        /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
 
@@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev)
                err("%s - error loading firmware: error = %d", __FUNCTION__, err);
                goto wraperr;
        }
+       msleep(250);    /* let device settle */
 
        kfree(buf);
 
index 2deb4c01539e8466ef97766e408ff0b6689e71b5..7683926a1b6f19c5fae68caa07a6727691acfc17 100644 (file)
@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
        set_register(pegasus, PhyCtrl, (indx | PHY_READ));
        for (i = 0; i < REG_TIMEOUT; i++) {
                ret = get_registers(pegasus, PhyCtrl, 1, data);
+               if (ret == -ESHUTDOWN)
+                       goto fail;
                if (data[0] & PHY_DONE)
                        break;
        }
@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
                *regd = le16_to_cpu(regdi);
                return ret;
        }
+fail:
        if (netif_msg_drv(pegasus))
                dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
 
@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
        set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
        for (i = 0; i < REG_TIMEOUT; i++) {
                ret = get_registers(pegasus, PhyCtrl, 1, data);
+               if (ret == -ESHUTDOWN)
+                       goto fail;
                if (data[0] & PHY_DONE)
                        break;
        }
        if (i < REG_TIMEOUT)
                return ret;
 
+fail:
        if (netif_msg_drv(pegasus))
                dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
        return -ETIMEDOUT;
@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
                ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
                if (tmp & EPROM_DONE)
                        break;
+               if (ret == -ESHUTDOWN)
+                       goto fail;
        }
        if (i < REG_TIMEOUT) {
                ret = get_registers(pegasus, EpromData, 2, &retdatai);
@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
                return ret;
        }
 
+fail:
        if (netif_msg_drv(pegasus))
                dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
        return -ETIMEDOUT;
@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
 
        for (i = 0; i < REG_TIMEOUT; i++) {
                ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
+               if (ret == -ESHUTDOWN)
+                       goto fail;
                if (tmp & EPROM_DONE)
                        break;
        }
        disable_eprom_write(pegasus);
        if (i < REG_TIMEOUT)
                return ret;
+fail:
        if (netif_msg_drv(pegasus))
                dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
        return -ETIMEDOUT;
@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
        struct pegasus *pegasus = usb_get_intfdata(intf);
        
        netif_device_detach (pegasus->net);
+       cancel_delayed_work(&pegasus->carrier_check);
        if (netif_running(pegasus->net)) {
-               cancel_delayed_work(&pegasus->carrier_check);
-
                usb_kill_urb(pegasus->rx_urb);
                usb_kill_urb(pegasus->intr_urb);
        }
@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf)
                pegasus->intr_urb->status = 0;
                pegasus->intr_urb->actual_length = 0;
                intr_callback(pegasus->intr_urb, NULL);
-
-               queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
-                                       CARRIER_CHECK_DELAY);
        }
+       queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
+                               CARRIER_CHECK_DELAY);
        return 0;
 }
 
index f96b73f54bf1cdb7d4840d7b3c1c0600c8e4d6a0..5c60be521561a5fdeed21d5bd4df5a37b5a9ee9b 100644 (file)
@@ -71,6 +71,16 @@ config USB_SERIAL_ANYDATA
          To compile this driver as a module, choose M here: the
          module will be called anydata.
 
+config USB_SERIAL_ARK3116
+       tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)"
+       depends on USB_SERIAL && EXPERIMENTAL
+       help
+         Say Y here if you want to use a ARK Micro 3116 USB to Serial
+         device.
+
+         To compile this driver as a module, choose M here: the
+         module will be called ark3116
+
 config USB_SERIAL_BELKIN
        tristate "USB Belkin and Peracom Single Port Serial Driver"
        depends on USB_SERIAL
index 93c21245b1af713d52974d7eec80097073f52ee1..5a0960fc9d3e3facbfce9e90a0175e0fa25e4e46 100644 (file)
@@ -13,6 +13,7 @@ usbserial-objs        := usb-serial.o generic.o bus.o $(usbserial-obj-y)
 
 obj-$(CONFIG_USB_SERIAL_AIRPRIME)              += airprime.o
 obj-$(CONFIG_USB_SERIAL_ANYDATA)               += anydata.o
+obj-$(CONFIG_USB_SERIAL_ARK3116)               += ark3116.o
 obj-$(CONFIG_USB_SERIAL_BELKIN)                        += belkin_sa.o
 obj-$(CONFIG_USB_SERIAL_CP2101)                        += cp2101.o
 obj-$(CONFIG_USB_SERIAL_CYBERJACK)             += cyberjack.o
index dbf1f063098c58f7c6424bff49e4d8e56a34034b..694b205f9b736e90f42e995b9d90de1a2d5bc72a 100644 (file)
@@ -18,6 +18,7 @@
 static struct usb_device_id id_table [] = {
        { USB_DEVICE(0xf3d, 0x0112) },  /* AirPrime CDMA Wireless PC Card */
        { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
+       { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */
        { },
 };
 MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
new file mode 100644 (file)
index 0000000..8dec796
--- /dev/null
@@ -0,0 +1,465 @@
+/*
+ * ark3116
+ * - implements a driver for the arkmicro ark3116 chipset (vendor=0x6547,
+ *   productid=0x0232) (used in a datacable called KQ-U8A)
+ *
+ * - based on code by krisfx -> thanks !!
+ *   (see http://www.linuxquestions.org/questions/showthread.php?p=2184457#post2184457)
+ *
+ *  - based on logs created by usbsnoopy
+ *
+ *  Author   : Simon Schulz [ark3116_driver<AT>auctionant.de]
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/tty.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include "usb-serial.h"
+
+
+static int debug;
+
+static struct usb_device_id id_table [] = {
+       { USB_DEVICE(0x6547, 0x0232) },
+       { },
+};
+MODULE_DEVICE_TABLE(usb, id_table);
+
+struct ark3116_private {
+       spinlock_t lock;
+       u8 termios_initialized;
+};
+
+static inline void ARK3116_SND(struct usb_serial *serial, int seq,
+                              __u8 request, __u8 requesttype,
+                              __u16 value, __u16 index)
+{
+       int result;
+       result = usb_control_msg(serial->dev,
+                                usb_sndctrlpipe(serial->dev,0),
+                                request, requesttype, value, index,
+                                NULL,0x00, 1000);
+       dbg("%03d > ok",seq);
+}
+
+static inline void ARK3116_RCV(struct usb_serial *serial, int seq,
+                              __u8 request, __u8 requesttype,
+                              __u16 value, __u16 index, __u8 expected,
+                              char *buf)
+{
+       int result;
+       result = usb_control_msg(serial->dev,
+                             usb_rcvctrlpipe(serial->dev,0),
+                             request, requesttype, value, index,
+                             buf, 0x0000001, 1000);
+       if (result)
+               dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]);
+       else
+               dbg("%03d < 0 bytes", seq);
+}
+
+
+static inline void ARK3116_RCV_QUIET(struct usb_serial *serial,
+                                    __u8 request, __u8 requesttype,
+                                    __u16 value, __u16 index, char *buf)
+{
+       usb_control_msg(serial->dev,
+                       usb_rcvctrlpipe(serial->dev,0),
+                       request, requesttype, value, index,
+                       buf, 0x0000001, 1000);
+}
+
+
+static int ark3116_attach(struct usb_serial *serial)
+{
+       char *buf;
+       struct ark3116_private *priv;
+       int i;
+
+       for (i = 0; i < serial->num_ports; ++i) {
+               priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL);
+               if (!priv)
+                       goto cleanup;
+               memset (priv, 0x00, sizeof (struct ark3116_private));
+               spin_lock_init(&priv->lock);
+
+               usb_set_serial_port_data(serial->port[i], priv);
+       }
+
+       buf = kmalloc(1, GFP_KERNEL);
+       if (!buf) {
+               dbg("error kmalloc -> out of mem ?");
+               goto cleanup;
+       }
+
+       /* 3 */
+       ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002);
+       ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001);
+       ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008);
+       ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B);
+
+       /* <-- seq7 */
+       ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf);
+       ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003);
+       ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000);
+       ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001);
+       ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003);
+
+       /* <-- seq12 */
+       ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
+       ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004);
+
+       /* 14 */
+       ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
+       ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004);
+
+       /* 16 */
+       ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
+       /* --> seq17 */
+       ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004);
+
+       /* <-- seq18 */
+       ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf);
+
+       /* --> seq19 */
+       ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004);
+
+
+       /* <-- seq20 */
+       /* seems like serial port status info (RTS, CTS,...) */
+       /* returns modem control line status ?! */
+       ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf);
+
+       /* set 9600 baud & do some init ?! */
+       ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003);
+       ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000);
+       ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001);
+       ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003);
+       ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf);
+       ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003);
+       ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf);
+       ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003);
+
+       kfree(buf);
+       return(0);
+
+cleanup:
+       for (--i; i>=0; --i)
+               usb_set_serial_port_data(serial->port[i], NULL);
+       return -ENOMEM;
+}
+
+static void ark3116_set_termios(struct usb_serial_port *port,
+                               struct termios *old_termios)
+{
+       struct usb_serial *serial = port->serial;
+       struct ark3116_private *priv = usb_get_serial_port_data(port);
+       unsigned int cflag = port->tty->termios->c_cflag;
+       unsigned long flags;
+       int baud;
+       int ark3116_baud;
+       char *buf;
+       char config;
+
+       config = 0;
+
+       dbg("%s - port %d", __FUNCTION__, port->number);
+
+       if ((!port->tty) || (!port->tty->termios)) {
+               dbg("%s - no tty structures", __FUNCTION__);
+               return;
+       }
+
+       spin_lock_irqsave(&priv->lock, flags);
+       if (!priv->termios_initialized) {
+               *(port->tty->termios) = tty_std_termios;
+               port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+               priv->termios_initialized = 1;
+       }
+       spin_unlock_irqrestore(&priv->lock, flags);
+
+       cflag = port->tty->termios->c_cflag;
+
+       /* check that they really want us to change something: */
+       if (old_termios) {
+               if ((cflag == old_termios->c_cflag) &&
+                   (RELEVANT_IFLAG(port->tty->termios->c_iflag) ==
+                    RELEVANT_IFLAG(old_termios->c_iflag))) {
+                       dbg("%s - nothing to change...", __FUNCTION__);
+                       return;
+               }
+       }
+
+       buf = kmalloc(1, GFP_KERNEL);
+       if (!buf) {
+               dbg("error kmalloc");
+               return;
+       }
+
+       /* set data bit count (8/7/6/5) */
+       if (cflag & CSIZE){
+               switch (cflag & CSIZE){
+               case CS5:
+                       config |= 0x00;
+                       dbg("setting CS5");
+                       break;
+               case CS6:
+                       config |= 0x01;
+                       dbg("setting CS6");
+                       break;
+               case CS7:
+                       config |= 0x02;
+                       dbg("setting CS7");
+                       break;
+               default:
+                       err ("CSIZE was set but not CS5-CS8, using CS8!");
+               case CS8:
+                       config |= 0x03;
+                       dbg("setting CS8");
+                       break;
+               }
+       }
+
+       /* set parity (NONE,EVEN,ODD) */
+       if (cflag & PARENB){
+               if (cflag & PARODD) {
+                       config |= 0x08;
+                       dbg("setting parity to ODD");
+               } else {
+                       config |= 0x18;
+                       dbg("setting parity to EVEN");
+               }
+       } else {
+               dbg("setting parity to NONE");
+       }
+
+       /* SET STOPBIT (1/2) */
+       if (cflag & CSTOPB) {
+               config |= 0x04;
+               dbg ("setting 2 stop bits");
+       } else {
+               dbg ("setting 1 stop bit");
+       }
+
+
+       /* set baudrate: */
+       baud = 0;
+       switch (cflag & CBAUD){
+               case B0:
+                       err("can't set 0baud, using 9600 instead");
+                       break;
+               case B75:       baud = 75;      break;
+               case B150:      baud = 150;     break;
+               case B300:      baud = 300;     break;
+               case B600:      baud = 600;     break;
+               case B1200:     baud = 1200;    break;
+               case B1800:     baud = 1800;    break;
+               case B2400:     baud = 2400;    break;
+               case B4800:     baud = 4800;    break;
+               case B9600:     baud = 9600;    break;
+               case B19200:    baud = 19200;   break;
+               case B38400:    baud = 38400;   break;
+               case B57600:    baud = 57600;   break;
+               case B115200:   baud = 115200;  break;
+               case B230400:   baud = 230400;  break;
+               case B460800:   baud = 460800;  break;
+               default:
+                       dbg("does not support the baudrate requested (fix it)");
+                       break;
+       }
+
+       /* set 9600 as default (if given baudrate is invalid for example) */
+       if (baud == 0)
+               baud = 9600;
+
+       /*
+        * found by try'n'error, be careful, maybe there are other options
+        * for multiplicator etc!
+        */
+       if (baud == 460800)
+               /* strange, for 460800 the formula is wrong
+                * (dont use round(), then 9600baud is wrong) */
+               ark3116_baud = 7;
+       else
+               ark3116_baud = 3000000 / baud;
+
+       /* ? */
+       ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf);
+       /* offset = buf[0]; */
+       /* offset = 0x03; */
+       /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */
+
+
+       /* set baudrate */
+       dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud);
+       ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003);
+       ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF)   ,0x0000);
+       ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001);
+       ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003);
+
+       /* ? */
+       ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf);
+       ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003);
+
+       /* set data bit count, stop bit count & parity: */
+       dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config);
+       ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf);
+       ARK3116_SND(serial,154,0xFE,0x40,config,0x0003);
+
+       if (cflag & CRTSCTS)
+               dbg("CRTSCTS not supported by chipset ?!");
+
+       /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */
+
+       kfree(buf);
+       return;
+}
+
+static int ark3116_open(struct usb_serial_port *port, struct file *filp)
+{
+       struct termios tmp_termios;
+       struct usb_serial *serial = port->serial;
+       char *buf;
+       int result = 0;
+
+       dbg("%s -  port %d", __FUNCTION__, port->number);
+
+       buf = kmalloc(1, GFP_KERNEL);
+       if (!buf) {
+               dbg("error kmalloc -> out of mem ?");
+               return -ENOMEM;
+       }
+
+       result = usb_serial_generic_open(port, filp);
+       if (result)
+               return result;
+
+       /* open */
+       ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf);
+
+       ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003);
+       ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000);
+       ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001);
+       ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003);
+
+       ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf);
+       ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004);
+
+       ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf);
+       ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004);
+
+       ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
+
+       ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004);
+
+       ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf);
+
+       ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004);
+
+       /* returns different values (control lines ?!) */
+       ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf);
+
+       /* initialise termios: */
+       if (port->tty)
+               ark3116_set_termios(port, &tmp_termios);
+
+       kfree(buf);
+
+       return result;
+
+}
+
+static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
+                        unsigned int cmd, unsigned long arg)
+{
+       dbg("ioctl not supported yet...");
+       return -ENOIOCTLCMD;
+}
+
+static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file)
+{
+       struct usb_serial *serial = port->serial;
+       char *buf;
+       char temp;
+
+       /* seems like serial port status info (RTS, CTS,...) is stored
+        * in reg(?) 0x0006
+        * pcb connection point 11 = GND -> sets bit4 of response
+        * pcb connection point  7 = GND -> sets bit6 of response
+        */
+
+       buf = kmalloc(1, GFP_KERNEL);
+       if (!buf) {
+               dbg("error kmalloc");
+               return -ENOMEM;
+       }
+
+       /* read register: */
+       ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf);
+       temp = buf[0];
+       kfree(buf);
+
+       /* i do not really know if bit4=CTS and bit6=DSR... was just a
+        * quick guess !!
+        */
+       return  (temp & (1<<4) ? TIOCM_CTS : 0) |
+               (temp & (1<<6) ? TIOCM_DSR : 0);
+}
+
+static struct usb_driver ark3116_driver = {
+       .name =         "ark3116",
+       .probe =        usb_serial_probe,
+       .disconnect =   usb_serial_disconnect,
+       .id_table =     id_table,
+};
+
+static struct usb_serial_driver ark3116_device = {
+       .driver = {
+               .owner =        THIS_MODULE,
+               .name =         "ark3116",
+       },
+       .id_table =             id_table,
+       .num_interrupt_in =     1,
+       .num_bulk_in =          1,
+       .num_bulk_out =         1,
+       .num_ports =            1,
+       .attach =               ark3116_attach,
+       .set_termios =          ark3116_set_termios,
+       .ioctl =                ark3116_ioctl,
+       .tiocmget =             ark3116_tiocmget,
+       .open =                 ark3116_open,
+};
+
+static int __init ark3116_init(void)
+{
+       int retval;
+
+       retval = usb_serial_register(&ark3116_device);
+       if (retval)
+               return retval;
+       retval = usb_register(&ark3116_driver);
+       if (retval)
+               usb_serial_deregister(&ark3116_device);
+       return retval;
+}
+
+static void __exit ark3116_exit(void)
+{
+       usb_deregister(&ark3116_driver);
+       usb_serial_deregister(&ark3116_device);
+}
+
+module_init(ark3116_init);
+module_exit(ark3116_exit);
+MODULE_LICENSE("GPL");
+
+module_param(debug, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, "Debug enabled or not");
+
index 82151207d814674d38de9c5f94323e006b6b50aa..986d7622273d319e1ae4178aada87170fe246918 100644 (file)
@@ -307,6 +307,7 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
 
 
 static struct usb_device_id id_table_combined [] = {
+       { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
@@ -498,6 +499,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
        { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) },
        { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
        { },                                    /* Optional parameter entry */
        { }                                     /* Terminating entry */
 };
index 2c55a5ea9c992adcb94db8f58cd82b6813d44e5b..d69a917e768f2e445851b7fea27442c3e023e48d 100644 (file)
 #define FTDI_NF_RIC_PID        0x0001  /* Product Id */
 
 
+/* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */
+#define FTDI_ACTZWAVE_PID      0xF2D0
+
+
 /* www.irtrans.de device */
 #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */
 
 #define PAPOUCH_VID                    0x5050  /* Vendor ID */
 #define PAPOUCH_TMU_PID                        0x0400  /* TMU USB Thermometer */
 
+/*
+ * ACG Identification Technologies GmbH products (http://www.acg.de/).
+ * Submitted by anton -at- goto10 -dot- org.
+ */
+#define FTDI_ACG_HFDUAL_PID            0xDD20  /* HF Dual ISO Reader (RFID) */
 
 /* Commands */
 #define FTDI_SIO_RESET                 0 /* Reset the port */
index 476cda107f4fa8bcf0ef2fe53a04d9f37f4a698d..c62cc2876519629a6bd39e8b6284b84a51d201ab 100644 (file)
@@ -138,6 +138,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp)
 
        return result;
 }
+EXPORT_SYMBOL_GPL(usb_serial_generic_open);
 
 static void generic_cleanup (struct usb_serial_port *port)
 {
index 4d40704dea2cf157d30673bdbae47f27844dc201..238033a87092fc841c7c6ac225ff921ec381139a 100644 (file)
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
                return (0);
        }
 
-       spin_lock(&port->lock);
-       if (port->write_urb_busy) {
-               spin_unlock(&port->lock);
+       spin_lock(&wport->lock);
+       if (wport->write_urb_busy) {
+               spin_unlock(&wport->lock);
                dbg("%s - already writing", __FUNCTION__);
                return 0;
        }
-       port->write_urb_busy = 1;
-       spin_unlock(&port->lock);
+       wport->write_urb_busy = 1;
+       spin_unlock(&wport->lock);
 
        count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
 
@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
        wport->write_urb->dev = serial->dev;
        result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
        if (result) {
-               port->write_urb_busy = 0;
+               wport->write_urb_busy = 0;
                err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
        } else
                result = count;
index 071f86a59c086222ecf89c8705080b064b4d8fdc..9c36f0ece20ff6b43631e860621198f694400d5f 100644 (file)
@@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
 
        portNumber = tty->index - serial->minor;
        port = serial->port[portNumber];
-       if (!port)
-               return -ENODEV;
+       if (!port) {
+               retval = -ENODEV;
+               goto bailout_kref_put;
+       }
 
-       if (mutex_lock_interruptible(&port->mutex))
-               return -ERESTARTSYS;
+       if (mutex_lock_interruptible(&port->mutex)) {
+               retval = -ERESTARTSYS;
+               goto bailout_kref_put;
+       }
         
        ++port->open_count;
 
@@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
                 * safe because we are called with BKL held */
                if (!try_module_get(serial->type->driver.owner)) {
                        retval = -ENODEV;
-                       goto bailout_kref_put;
+                       goto bailout_mutex_unlock;
                }
 
                /* only call the device specific open if this 
@@ -224,10 +228,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
 
 bailout_module_put:
        module_put(serial->type->driver.owner);
-bailout_kref_put:
-       kref_put(&serial->kref, destroy_serial);
+bailout_mutex_unlock:
        port->open_count = 0;
        mutex_unlock(&port->mutex);
+bailout_kref_put:
+       kref_put(&serial->kref, destroy_serial);
        return retval;
 }
 
index 3d04b2def0f165d5ab7cbc2afadace2fa7896eb8..789450bb0bc9c020aec0320bf6125a85417a7bb5 100644 (file)
@@ -214,10 +214,13 @@ int au1100fb_setmode(struct au1100fb_device *fbdev)
  */
 int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi)
 {
-       struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
-       u32 *palette = fbdev->regs->lcd_pallettebase;
+       struct au1100fb_device *fbdev;
+       u32 *palette;
        u32 value;
 
+       fbdev = to_au1100fb_device(fbi);
+       palette = fbdev->regs->lcd_pallettebase;
+
        if (regno > (AU1100_LCD_NBR_PALETTE_ENTRIES - 1))
                return -EINVAL;
 
@@ -316,9 +319,11 @@ int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
  */
 int au1100fb_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi)
 {
-       struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
+       struct au1100fb_device *fbdev;
        int dy;
 
+       fbdev = to_au1100fb_device(fbi);
+
        print_dbg("fb_pan_display %p %p", var, fbi);
 
        if (!var || !fbdev) {
@@ -382,10 +387,12 @@ void au1100fb_fb_rotate(struct fb_info *fbi, int angle)
  */
 int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
 {
-       struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
+       struct au1100fb_device *fbdev;
        unsigned int len;
        unsigned long start=0, off;
 
+       fbdev = to_au1100fb_device(fbi);
+
        if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
                return -EINVAL;
        }
@@ -467,7 +474,7 @@ int au1100fb_drv_probe(struct device *dev)
 
        if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len,
                                DRIVER_NAME)) {
-               print_err("fail to lock memory region at 0x%08x",
+               print_err("fail to lock memory region at 0x%08lx",
                                au1100fb_fix.mmio_start);
                return -EBUSY;
        }
@@ -595,13 +602,13 @@ int au1100fb_drv_remove(struct device *dev)
        return 0;
 }
 
-int au1100fb_drv_suspend(struct device *dev, u32 state, u32 level)
+int au1100fb_drv_suspend(struct device *dev, pm_message_t state)
 {
        /* TODO */
        return 0;
 }
 
-int au1100fb_drv_resume(struct device *dev, u32 level)
+int au1100fb_drv_resume(struct device *dev)
 {
        /* TODO */
        return 0;
index 334b1db1bd7cc42f52e3a5c3353dd28b7b1c032d..27597c576eff3f4cb0a116dee1d682f8ce4f9383 100644 (file)
@@ -29,12 +29,15 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
 
 static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc = -ENXIO, power;
+       int rc = -ENXIO;
        char *endp;
        struct backlight_device *bd = to_backlight_device(cdev);
+       int power = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       power = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&bd->sem);
@@ -65,12 +68,15 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
 
 static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc = -ENXIO, brightness;
+       int rc = -ENXIO;
        char *endp;
        struct backlight_device *bd = to_backlight_device(cdev);
+       int brightness = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       brightness = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&bd->sem);
index 86908a60c630d9624fab519c24d1ab0f28091e3b..bc8ab005a3fb174a9eecc050a76301469ed2916f 100644 (file)
@@ -31,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
 
 static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, power;
+       int rc = -ENXIO;
        char *endp;
        struct lcd_device *ld = to_lcd_device(cdev);
+       int power = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       power = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&ld->sem);
@@ -44,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
                pr_debug("lcd: set power to %d\n", power);
                ld->props->set_power(ld, power);
                rc = count;
-       } else
-               rc = -ENXIO;
+       }
        up(&ld->sem);
 
        return rc;
@@ -53,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
 
 static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct lcd_device *ld = to_lcd_device(cdev);
 
        down(&ld->sem);
        if (likely(ld->props && ld->props->get_contrast))
                rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));
-       else
-               rc = -ENXIO;
        up(&ld->sem);
 
        return rc;
@@ -68,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
 
 static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, contrast;
+       int rc = -ENXIO;
        char *endp;
        struct lcd_device *ld = to_lcd_device(cdev);
+       int contrast = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       contrast = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&ld->sem);
@@ -81,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
                pr_debug("lcd: set contrast to %d\n", contrast);
                ld->props->set_contrast(ld, contrast);
                rc = count;
-       } else
-               rc = -ENXIO;
+       }
        up(&ld->sem);
 
        return rc;
@@ -90,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
 
 static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct lcd_device *ld = to_lcd_device(cdev);
 
        down(&ld->sem);
        if (likely(ld->props))
                rc = sprintf(buf, "%d\n", ld->props->max_contrast);
-       else
-               rc = -ENXIO;
        up(&ld->sem);
 
        return rc;
index ca020719d20b14959b3d1daa31d4e1c91742df2e..47ba1a79adcd350e6487b42d1d5e6b1a4e1b6c7a 100644 (file)
@@ -1745,7 +1745,7 @@ static int fbcon_scroll(struct vc_data *vc, int t, int b, int dir,
                                        fbcon_redraw_move(vc, p, 0, t, count);
                                ypan_up_redraw(vc, t, count);
                                if (vc->vc_rows - b > 0)
-                                       fbcon_redraw_move(vc, p, b - count,
+                                       fbcon_redraw_move(vc, p, b,
                                                          vc->vc_rows - b, b);
                        } else
                                fbcon_redraw_move(vc, p, t + count, b - t - count, t);
@@ -2631,7 +2631,7 @@ static int fbcon_scrolldelta(struct vc_data *vc, int lines)
                                        scr_memcpyw((u16 *) q, (u16 *) p,
                                                    vc->vc_size_row);
                                }
-                               softback_in = p;
+                               softback_in = softback_curr = p;
                                update_region(vc, vc->vc_origin,
                                              logo_lines * vc->vc_cols);
                        }
index 788297e9d59e16eef99a896ba4d63927f2d2f70b..44aa2ffff973e52b7f438fdef634d3cc5c0b6f7d 100644 (file)
@@ -76,8 +76,8 @@
  *
  * Experiment with v_offset to find out which works best for you.
  */
-static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */
-static u32 voffset          __initdata = 0;
+static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */
+static u32 voffset          __devinitdata;
 
 static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor);
 static int  __devinit i810fb_init_pci (struct pci_dev *dev,
index 8073a73f6f350804abeacd00d5e132284d073ac1..440272ad10e725a206e58491e0e6b1bf96a1d5a8 100644 (file)
@@ -316,14 +316,24 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
                case M_PIXEL_PLL_B:
                case M_PIXEL_PLL_C:
                        {
-                               u_int8_t tmp;
+                               u_int8_t tmp, xpwrctrl;
                                unsigned long flags;
                                
                                matroxfb_DAC_lock_irqsave(flags);
+
+                               xpwrctrl = matroxfb_DAC_in(PMINFO M1064_XPWRCTRL);
+                               matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl & ~M1064_XPWRCTRL_PANELPDN);
+                               mga_outb(M_SEQ_INDEX, M_SEQ1);
+                               mga_outb(M_SEQ_DATA, mga_inb(M_SEQ_DATA) | M_SEQ1_SCROFF);
                                tmp = matroxfb_DAC_in(PMINFO M1064_XPIXCLKCTRL);
+                               tmp |= M1064_XPIXCLKCTRL_DIS;
                                if (!(tmp & M1064_XPIXCLKCTRL_PLL_UP)) {
-                                       matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp | M1064_XPIXCLKCTRL_PLL_UP);
+                                       tmp |= M1064_XPIXCLKCTRL_PLL_UP;
                                }
+                               matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
+                               matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0);
+                               matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl);
+
                                matroxfb_DAC_unlock_irqrestore(flags);
                        }
                        {
@@ -418,6 +428,15 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
                                   frequency to higher - with <= lowest wins, while
                                   with < highest one wins */
                                if (delta <= deltaarray[idx-1]) {
+                                       /* all else being equal except VCO,
+                                        * choose VCO not near (within 1/16th or so) VCOmin
+                                        * (freqs near VCOmin aren't as stable)
+                                        */
+                                       if (delta == deltaarray[idx-1]
+                                           && vco != g450_mnp2vco(PMINFO mnparray[idx-1])
+                                           && vco < (pi->vcomin * 17 / 16)) {
+                                               break;
+                                       }
                                        mnparray[idx] = mnparray[idx-1];
                                        deltaarray[idx] = deltaarray[idx-1];
                                } else {
index 2e7238aa243209dfe74072c4c608149eafbb0405..56513a5d220b03d44531c2b677441bd3f3b2380a 100644 (file)
@@ -40,6 +40,7 @@ void DAC1064_global_restore(WPMINFO2);
 #define M1064_XCURCOL1RED      0x0C
 #define M1064_XCURCOL1GREEN    0x0D
 #define M1064_XCURCOL1BLUE     0x0E
+#define M1064_XDVICLKCTRL      0x0F
 #define M1064_XCURCOL2RED      0x10
 #define M1064_XCURCOL2GREEN    0x11
 #define M1064_XCURCOL2BLUE     0x12
@@ -144,6 +145,7 @@ void DAC1064_global_restore(WPMINFO2);
 #define M1064_XVIDPLLN         0x8F
 
 #define M1064_XPWRCTRL         0xA0
+#define     M1064_XPWRCTRL_PANELPDN    0x04
 
 #define M1064_XPANMODE         0xA2
 
index 3a3e1804c56a507a23b320527d9c7373e4ca1266..b71737178d0d9bcbbfc328d62e88aae7433dbc7c 100644 (file)
@@ -672,6 +672,8 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
 
 #define M_SEQ_INDEX    0x1FC4
 #define M_SEQ_DATA     0x1FC5
+#define     M_SEQ1             0x01
+#define        M_SEQ1_SCROFF           0x20
 
 #define M_MISC_REG_READ        0x1FCC
 
index 743e7ad26acc3299f32e5903b9c4bc474a249fcb..f85421bf7cb5365319d8de5076a5dbed38fe4cfb 100644 (file)
@@ -55,7 +55,7 @@ static struct fb_var_screeninfo maxinefb_defined = {
 };
 
 static struct fb_fix_screeninfo maxinefb_fix = {
-       .id =           "Maxine onboard graphics 1024x768x8",
+       .id =           "Maxine",
        .smem_len =     (1024*768),
        .type =         FB_TYPE_PACKED_PIXELS,
        .visual =       FB_VISUAL_PSEUDOCOLOR,
@@ -107,8 +107,6 @@ static int maxinefb_setcolreg(unsigned regno, unsigned red, unsigned green,
 
 static struct fb_ops maxinefb_ops = {
        .owner          = THIS_MODULE,
-       .fb_get_fix     = gen_get_fix,
-       .fb_get_var     = gen_get_var,
        .fb_setcolreg   = maxinefb_setcolreg,
        .fb_fillrect    = cfb_fillrect,
        .fb_copyarea    = cfb_copyarea,
index 71742ba150c44f12a4abb3b4ce45c15fcc15e775..6f2617820a4ef3ad001bad832978ea55ad379774 100644 (file)
@@ -98,23 +98,20 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
 static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
        struct v9fs_fcall *rc, int err)
 {
-       int fid;
+       int fid, id;
        struct v9fs_session_info *v9ses;
 
-       if (err)
-               return;
-
+       id = 0;
        fid = tc->params.tclunk.fid;
-       kfree(tc);
-
-       if (!rc)
-               return;
-
-       v9ses = a;
-       if (rc->id == RCLUNK)
-               v9fs_put_idpool(fid, &v9ses->fidpool);
+       if (rc)
+               id = rc->id;
 
+       kfree(tc);
        kfree(rc);
+       if (id == RCLUNK) {
+               v9ses = a;
+               v9fs_put_idpool(fid, &v9ses->fidpool);
+       }
 }
 
 /**
index 3e5b124a72123d4c50a99c44351d87a0a21d5388..f4407eb276c7cfa7d350061792b08e0393d4ae3b 100644 (file)
@@ -50,15 +50,23 @@ enum {
        Wpending = 8,           /* can write */
 };
 
+enum {
+       None,
+       Flushing,
+       Flushed,
+};
+
 struct v9fs_mux_poll_task;
 
 struct v9fs_req {
+       spinlock_t lock;
        int tag;
        struct v9fs_fcall *tcall;
        struct v9fs_fcall *rcall;
        int err;
        v9fs_mux_req_callback cb;
        void *cba;
+       int flush;
        struct list_head req_list;
 };
 
@@ -96,8 +104,8 @@ struct v9fs_mux_poll_task {
 
 struct v9fs_mux_rpc {
        struct v9fs_mux_data *m;
-       struct v9fs_req *req;
        int err;
+       struct v9fs_fcall *tcall;
        struct v9fs_fcall *rcall;
        wait_queue_head_t wqueue;
 };
@@ -524,10 +532,9 @@ again:
 
 static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req)
 {
-       int ecode, tag;
+       int ecode;
        struct v9fs_str *ename;
 
-       tag = req->tag;
        if (!req->err && req->rcall->id == RERROR) {
                ecode = req->rcall->params.rerror.errno;
                ename = &req->rcall->params.rerror.error;
@@ -553,23 +560,6 @@ static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req)
                if (!req->err)
                        req->err = -EIO;
        }
-
-       if (req->err == ERREQFLUSH)
-               return;
-
-       if (req->cb) {
-               dprintk(DEBUG_MUX, "calling callback tcall %p rcall %p\n",
-                       req->tcall, req->rcall);
-
-               (*req->cb) (req->cba, req->tcall, req->rcall, req->err);
-               req->cb = NULL;
-       } else
-               kfree(req->rcall);
-
-       v9fs_mux_put_tag(m, tag);
-
-       wake_up(&m->equeue);
-       kfree(req);
 }
 
 /**
@@ -669,17 +659,26 @@ static void v9fs_read_work(void *a)
                list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) {
                        if (rreq->tag == rcall->tag) {
                                req = rreq;
-                               req->rcall = rcall;
-                               list_del(&req->req_list);
-                               spin_unlock(&m->lock);
-                               process_request(m, req);
+                               if (req->flush != Flushing)
+                                       list_del(&req->req_list);
                                break;
                        }
-
                }
+               spin_unlock(&m->lock);
 
-               if (!req) {
-                       spin_unlock(&m->lock);
+               if (req) {
+                       req->rcall = rcall;
+                       process_request(m, req);
+
+                       if (req->flush != Flushing) {
+                               if (req->cb)
+                                       (*req->cb) (req, req->cba);
+                               else
+                                       kfree(req->rcall);
+
+                               wake_up(&m->equeue);
+                       }
+               } else {
                        if (err >= 0 && rcall->id != RFLUSH)
                                dprintk(DEBUG_ERROR,
                                        "unexpected response mux %p id %d tag %d\n",
@@ -746,7 +745,6 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
                return ERR_PTR(-ENOMEM);
 
        v9fs_set_tag(tc, n);
-
        if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
                char buf[150];
 
@@ -754,12 +752,14 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
                printk(KERN_NOTICE "<<< %p %s\n", m, buf);
        }
 
+       spin_lock_init(&req->lock);
        req->tag = n;
        req->tcall = tc;
        req->rcall = NULL;
        req->err = 0;
        req->cb = cb;
        req->cba = cba;
+       req->flush = None;
 
        spin_lock(&m->lock);
        list_add_tail(&req->req_list, &m->unsent_req_list);
@@ -776,72 +776,108 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
        return req;
 }
 
-static void v9fs_mux_flush_cb(void *a, struct v9fs_fcall *tc,
-                             struct v9fs_fcall *rc, int err)
+static void v9fs_mux_free_request(struct v9fs_mux_data *m, struct v9fs_req *req)
+{
+       v9fs_mux_put_tag(m, req->tag);
+       kfree(req);
+}
+
+static void v9fs_mux_flush_cb(struct v9fs_req *freq, void *a)
 {
        v9fs_mux_req_callback cb;
        int tag;
        struct v9fs_mux_data *m;
-       struct v9fs_req *req, *rptr;
+       struct v9fs_req *req, *rreq, *rptr;
 
        m = a;
-       dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m, tc,
-               rc, err, tc->params.tflush.oldtag);
+       dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m,
+               freq->tcall, freq->rcall, freq->err,
+               freq->tcall->params.tflush.oldtag);
 
        spin_lock(&m->lock);
        cb = NULL;
-       tag = tc->params.tflush.oldtag;
-       list_for_each_entry_safe(req, rptr, &m->req_list, req_list) {
-               if (req->tag == tag) {
+       tag = freq->tcall->params.tflush.oldtag;
+       req = NULL;
+       list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) {
+               if (rreq->tag == tag) {
+                       req = rreq;
                        list_del(&req->req_list);
-                       if (req->cb) {
-                               cb = req->cb;
-                               req->cb = NULL;
-                               spin_unlock(&m->lock);
-                               (*cb) (req->cba, req->tcall, req->rcall,
-                                      req->err);
-                       }
-                       kfree(req);
-                       wake_up(&m->equeue);
                        break;
                }
        }
+       spin_unlock(&m->lock);
 
-       if (!cb)
-               spin_unlock(&m->lock);
+       if (req) {
+               spin_lock(&req->lock);
+               req->flush = Flushed;
+               spin_unlock(&req->lock);
+
+               if (req->cb)
+                       (*req->cb) (req, req->cba);
+               else
+                       kfree(req->rcall);
+
+               wake_up(&m->equeue);
+       }
 
-       v9fs_mux_put_tag(m, tag);
-       kfree(tc);
-       kfree(rc);
+       kfree(freq->tcall);
+       kfree(freq->rcall);
+       v9fs_mux_free_request(m, freq);
 }
 
-static void
+static int
 v9fs_mux_flush_request(struct v9fs_mux_data *m, struct v9fs_req *req)
 {
        struct v9fs_fcall *fc;
+       struct v9fs_req *rreq, *rptr;
 
        dprintk(DEBUG_MUX, "mux %p req %p tag %d\n", m, req, req->tag);
 
+       /* if a response was received for a request, do nothing */
+       spin_lock(&req->lock);
+       if (req->rcall || req->err) {
+               spin_unlock(&req->lock);
+               dprintk(DEBUG_MUX, "mux %p req %p response already received\n", m, req);
+               return 0;
+       }
+
+       req->flush = Flushing;
+       spin_unlock(&req->lock);
+
+       spin_lock(&m->lock);
+       /* if the request is not sent yet, just remove it from the list */
+       list_for_each_entry_safe(rreq, rptr, &m->unsent_req_list, req_list) {
+               if (rreq->tag == req->tag) {
+                       dprintk(DEBUG_MUX, "mux %p req %p request is not sent yet\n", m, req);
+                       list_del(&rreq->req_list);
+                       req->flush = Flushed;
+                       spin_unlock(&m->lock);
+                       if (req->cb)
+                               (*req->cb) (req, req->cba);
+                       return 0;
+               }
+       }
+       spin_unlock(&m->lock);
+
+       clear_thread_flag(TIF_SIGPENDING);
        fc = v9fs_create_tflush(req->tag);
        v9fs_send_request(m, fc, v9fs_mux_flush_cb, m);
+       return 1;
 }
 
 static void
-v9fs_mux_rpc_cb(void *a, struct v9fs_fcall *tc, struct v9fs_fcall *rc, int err)
+v9fs_mux_rpc_cb(struct v9fs_req *req, void *a)
 {
        struct v9fs_mux_rpc *r;
 
-       if (err == ERREQFLUSH) {
-               kfree(rc);
-               dprintk(DEBUG_MUX, "err req flush\n");
-               return;
-       }
-
+       dprintk(DEBUG_MUX, "req %p r %p\n", req, a);
        r = a;
-       dprintk(DEBUG_MUX, "mux %p req %p tc %p rc %p err %d\n", r->m, r->req,
-               tc, rc, err);
-       r->rcall = rc;
-       r->err = err;
+       r->rcall = req->rcall;
+       r->err = req->err;
+
+       if (req->flush!=None && !req->err)
+               r->err = -ERESTARTSYS;
+
        wake_up(&r->wqueue);
 }
 
@@ -856,12 +892,13 @@ int
 v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc,
             struct v9fs_fcall **rc)
 {
-       int err;
+       int err, sigpending;
        unsigned long flags;
        struct v9fs_req *req;
        struct v9fs_mux_rpc r;
 
        r.err = 0;
+       r.tcall = tc;
        r.rcall = NULL;
        r.m = m;
        init_waitqueue_head(&r.wqueue);
@@ -869,48 +906,50 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc,
        if (rc)
                *rc = NULL;
 
+       sigpending = 0;
+       if (signal_pending(current)) {
+               sigpending = 1;
+               clear_thread_flag(TIF_SIGPENDING);
+       }
+
        req = v9fs_send_request(m, tc, v9fs_mux_rpc_cb, &r);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                dprintk(DEBUG_MUX, "error %d\n", err);
-               return PTR_ERR(req);
+               return err;
        }
 
-       r.req = req;
-       dprintk(DEBUG_MUX, "mux %p tc %p tag %d rpc %p req %p\n", m, tc,
-               req->tag, &r, req);
        err = wait_event_interruptible(r.wqueue, r.rcall != NULL || r.err < 0);
        if (r.err < 0)
                err = r.err;
 
        if (err == -ERESTARTSYS && m->trans->status == Connected && m->err == 0) {
-               spin_lock(&m->lock);
-               req->tcall = NULL;
-               req->err = ERREQFLUSH;
-               spin_unlock(&m->lock);
+               if (v9fs_mux_flush_request(m, req)) {
+                       /* wait until we get response of the flush message */
+                       do {
+                               clear_thread_flag(TIF_SIGPENDING);
+                               err = wait_event_interruptible(r.wqueue,
+                                       r.rcall || r.err);
+                       } while (!r.rcall && !r.err && err==-ERESTARTSYS &&
+                               m->trans->status==Connected && !m->err);
+               }
+               sigpending = 1;
+       }
 
-               clear_thread_flag(TIF_SIGPENDING);
-               v9fs_mux_flush_request(m, req);
+       if (sigpending) {
                spin_lock_irqsave(&current->sighand->siglock, flags);
                recalc_sigpending();
                spin_unlock_irqrestore(&current->sighand->siglock, flags);
        }
 
-       if (!err) {
-               if (r.rcall)
-                       dprintk(DEBUG_MUX, "got response id %d tag %d\n",
-                               r.rcall->id, r.rcall->tag);
-
-               if (rc)
-                       *rc = r.rcall;
-               else
-                       kfree(r.rcall);
-       } else {
+       if (rc)
+               *rc = r.rcall;
+       else
                kfree(r.rcall);
-               dprintk(DEBUG_MUX, "got error %d\n", err);
-               if (err > 0)
-                       err = -EIO;
-       }
+
+       v9fs_mux_free_request(m, req);
+       if (err > 0)
+               err = -EIO;
 
        return err;
 }
@@ -951,12 +990,15 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err)
        struct v9fs_req *req, *rtmp;
        LIST_HEAD(cancel_list);
 
-       dprintk(DEBUG_MUX, "mux %p err %d\n", m, err);
+       dprintk(DEBUG_ERROR, "mux %p err %d\n", m, err);
        m->err = err;
        spin_lock(&m->lock);
        list_for_each_entry_safe(req, rtmp, &m->req_list, req_list) {
                list_move(&req->req_list, &cancel_list);
        }
+       list_for_each_entry_safe(req, rtmp, &m->unsent_req_list, req_list) {
+               list_move(&req->req_list, &cancel_list);
+       }
        spin_unlock(&m->lock);
 
        list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) {
@@ -965,11 +1007,9 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err)
                        req->err = err;
 
                if (req->cb)
-                       (*req->cb) (req->cba, req->tcall, req->rcall, req->err);
+                       (*req->cb) (req, req->cba);
                else
                        kfree(req->rcall);
-
-               kfree(req);
        }
 
        wake_up(&m->equeue);
index e90bfd32ea42335ebd411e0d82423b34a38e5d0d..fb10c50186a11b6bb23323d845f918d535936a3c 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 struct v9fs_mux_data;
+struct v9fs_req;
 
 /**
  * v9fs_mux_req_callback - callback function that is called when the
@@ -36,8 +37,7 @@ struct v9fs_mux_data;
  * @rc - response call
  * @err - error code (non-zero if error occured)
  */
-typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc,
-       struct v9fs_fcall *rc, int err);
+typedef void (*v9fs_mux_req_callback)(struct v9fs_req *req, void *a);
 
 int v9fs_mux_global_init(void);
 void v9fs_mux_global_exit(void);
index 083dcfcd158e1cd3df4e445fdecabdd3c286f8eb..1a8e46084f0e1b25f14dc12417429dd79e94529f 100644 (file)
@@ -72,11 +72,17 @@ int v9fs_file_open(struct inode *inode, struct file *file)
                return -ENOSPC;
        }
 
-       err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
+       err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall);
        if (err < 0) {
                dprintk(DEBUG_ERROR, "rewalk didn't work\n");
-               goto put_fid;
+               if (fcall && fcall->id == RWALK)
+                       goto clunk_fid;
+               else {
+                       v9fs_put_idpool(fid, &v9ses->fidpool);
+                       goto free_fcall;
+               }
        }
+       kfree(fcall);
 
        /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
        /* translate open mode appropriately */
@@ -109,8 +115,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 clunk_fid:
        v9fs_t_clunk(v9ses, fid);
 
-put_fid:
-       v9fs_put_idpool(fid, &v9ses->fidpool);
+free_fcall:
        kfree(fcall);
 
        return err;
index 133db366d30659aad05be2c18a383e5722eb1f71..2cb87ba4b1c1fa76ab685d213ae6e0f33a53dcf8 100644 (file)
@@ -270,7 +270,10 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm,
        err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
        if (err < 0) {
                PRINT_FCALL_ERROR("clone error", fcall);
-               goto put_fid;
+               if (fcall && fcall->id == RWALK)
+                       goto clunk_fid;
+               else
+                       goto put_fid;
        }
        kfree(fcall);
 
@@ -322,6 +325,9 @@ v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
                &fcall);
 
        if (err < 0) {
+               if (fcall && fcall->id == RWALK)
+                       goto clunk_fid;
+
                PRINT_FCALL_ERROR("walk error", fcall);
                v9fs_put_idpool(nfid, &v9ses->fidpool);
                goto error;
@@ -640,19 +646,26 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        }
 
        result = v9fs_t_walk(v9ses, dirfidnum, newfid,
-               (char *)dentry->d_name.name, NULL);
+               (char *)dentry->d_name.name, &fcall);
+
        if (result < 0) {
-               v9fs_put_idpool(newfid, &v9ses->fidpool);
+               if (fcall && fcall->id == RWALK)
+                       v9fs_t_clunk(v9ses, newfid);
+               else
+                       v9fs_put_idpool(newfid, &v9ses->fidpool);
+
                if (result == -ENOENT) {
                        d_add(dentry, NULL);
                        dprintk(DEBUG_VFS,
                                "Return negative dentry %p count %d\n",
                                dentry, atomic_read(&dentry->d_count));
+                       kfree(fcall);
                        return NULL;
                }
                dprintk(DEBUG_ERROR, "walk error:%d\n", result);
                goto FreeFcall;
        }
+       kfree(fcall);
 
        result = v9fs_t_stat(v9ses, newfid, &fcall);
        if (result < 0) {
index 83bf478e786b3f64f1d5a90826f5d92622077950..078d3d1191a511f3ad88ac0167142fda8c10c5a9 100644 (file)
@@ -45,6 +45,7 @@ obj-$(CONFIG_DNOTIFY)         += dnotify.o
 obj-$(CONFIG_PROC_FS)          += proc/
 obj-y                          += partitions/
 obj-$(CONFIG_SYSFS)            += sysfs/
+obj-$(CONFIG_CONFIGFS_FS)      += configfs/
 obj-y                          += devpts/
 
 obj-$(CONFIG_PROFILING)                += dcookies.o
@@ -100,5 +101,4 @@ obj-$(CONFIG_BEFS_FS)               += befs/
 obj-$(CONFIG_HOSTFS)           += hostfs/
 obj-$(CONFIG_HPPFS)            += hppfs/
 obj-$(CONFIG_DEBUG_FS)         += debugfs/
-obj-$(CONFIG_CONFIGFS_FS)      += configfs/
 obj-$(CONFIG_OCFS2_FS)         += ocfs2/
index d4c2d636c479dc2aaaa986656a8659424aac56a6..a42143ca01698e1ba64769d5d9eb1bc0aa095320 100644 (file)
@@ -416,10 +416,9 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        return retval;
        }
 
-       retval = -EIO;
        bh = affs_bread(sb, old_dentry->d_inode->i_ino);
        if (!bh)
-               goto done;
+               return -EIO;
 
        /* Remove header from its parent directory. */
        affs_lock_dir(old_dir);
index 57c4903614e58c29a2eae1462f1f46c1ca8083ec..d6603d02304ceed0d0a1c0e6c80e497bcaf58394 100644 (file)
@@ -74,8 +74,8 @@ struct autofs_wait_queue {
        struct autofs_wait_queue *next;
        autofs_wqt_t wait_queue_token;
        /* We use the following to see what we are waiting for */
-       int hash;
-       int len;
+       unsigned int hash;
+       unsigned int len;
        char *name;
        u32 dev;
        u64 ino;
@@ -85,7 +85,6 @@ struct autofs_wait_queue {
        pid_t tgid;
        /* This is for status reporting upon return */
        int status;
-       atomic_t notify;
        atomic_t wait_ctr;
 };
 
index 84e030c8ddd0f99047473308afc4d26f555e2c14..5100f984783faa123caabf76ad97e1718bdea70e 100644 (file)
@@ -327,6 +327,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
 static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
        struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+       struct autofs_info *ino = autofs4_dentry_ino(dentry);
        int oz_mode = autofs4_oz_mode(sbi);
        unsigned int lookup_type;
        int status;
@@ -340,13 +341,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
        if (oz_mode || !lookup_type)
                goto done;
 
-       /*
-        * If a request is pending wait for it.
-        * If it's a mount then it won't be expired till at least
-        * a liitle later and if it's an expire then we might need
-        * to mount it again.
-        */
-       if (autofs4_ispending(dentry)) {
+       /* If an expire request is pending wait for it. */
+       if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
                DPRINTK("waiting for active request %p name=%.*s",
                        dentry, dentry->d_name.len, dentry->d_name.name);
 
index 142ab6aa2aa1516e6480d24c0ce3830b19852107..ce103e7b0bc360f684a2556c55ea9ed8be0e38f2 100644 (file)
@@ -189,14 +189,30 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
        return len;
 }
 
+static struct autofs_wait_queue *
+autofs4_find_wait(struct autofs_sb_info *sbi,
+                 char *name, unsigned int hash, unsigned int len)
+{
+       struct autofs_wait_queue *wq;
+
+       for (wq = sbi->queues; wq; wq = wq->next) {
+               if (wq->hash == hash &&
+                   wq->len == len &&
+                   wq->name && !memcmp(wq->name, name, len))
+                       break;
+       }
+       return wq;
+}
+
 int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
                enum autofs_notify notify)
 {
+       struct autofs_info *ino;
        struct autofs_wait_queue *wq;
        char *name;
        unsigned int len = 0;
        unsigned int hash = 0;
-       int status;
+       int status, type;
 
        /* In catatonic mode, we don't wait for nobody */
        if (sbi->catatonic)
@@ -223,21 +239,41 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
                return -EINTR;
        }
 
-       for (wq = sbi->queues ; wq ; wq = wq->next) {
-               if (wq->hash == dentry->d_name.hash &&
-                   wq->len == len &&
-                   wq->name && !memcmp(wq->name, name, len))
-                       break;
-       }
+       wq = autofs4_find_wait(sbi, name, hash, len);
+       ino = autofs4_dentry_ino(dentry);
+       if (!wq && ino && notify == NFY_NONE) {
+               /*
+                * Either we've betean the pending expire to post it's
+                * wait or it finished while we waited on the mutex.
+                * So we need to wait till either, the wait appears
+                * or the expire finishes.
+                */
+
+               while (ino->flags & AUTOFS_INF_EXPIRING) {
+                       mutex_unlock(&sbi->wq_mutex);
+                       schedule_timeout_interruptible(HZ/10);
+                       if (mutex_lock_interruptible(&sbi->wq_mutex)) {
+                               kfree(name);
+                               return -EINTR;
+                       }
+                       wq = autofs4_find_wait(sbi, name, hash, len);
+                       if (wq)
+                               break;
+               }
 
-       if (!wq) {
-               /* Can't wait for an expire if there's no mount */
-               if (notify == NFY_NONE && !d_mountpoint(dentry)) {
+               /*
+                * Not ideal but the status has already gone. Of the two
+                * cases where we wait on NFY_NONE neither depend on the
+                * return status of the wait.
+                */
+               if (!wq) {
                        kfree(name);
                        mutex_unlock(&sbi->wq_mutex);
-                       return -ENOENT;
+                       return 0;
                }
+       }
 
+       if (!wq) {
                /* Create a new wait queue */
                wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
                if (!wq) {
@@ -263,20 +299,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
                wq->tgid = current->tgid;
                wq->status = -EINTR; /* Status return if interrupted */
                atomic_set(&wq->wait_ctr, 2);
-               atomic_set(&wq->notify, 1);
-               mutex_unlock(&sbi->wq_mutex);
-       } else {
-               atomic_inc(&wq->wait_ctr);
                mutex_unlock(&sbi->wq_mutex);
-               kfree(name);
-               DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
-                       (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
-       }
-
-       if (notify != NFY_NONE && atomic_read(&wq->notify)) {
-               int type;
-
-               atomic_dec(&wq->notify);
 
                if (sbi->version < 5) {
                        if (notify == NFY_MOUNT)
@@ -299,6 +322,12 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 
                /* autofs4_notify_daemon() may block */
                autofs4_notify_daemon(sbi, wq, type);
+       } else {
+               atomic_inc(&wq->wait_ctr);
+               mutex_unlock(&sbi->wq_mutex);
+               kfree(name);
+               DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
+                       (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
        }
 
        /* wq->name is NULL if and only if the lock is already released */
index 69f44dcdb0b4c92f504e118a4eae080528cf68b0..b1c902e319c13dfc82200753f54b4f99102dfb51 100644 (file)
@@ -428,7 +428,6 @@ static int load_flat_file(struct linux_binprm * bprm,
        loff_t fpos;
        unsigned long start_code, end_code;
        int ret;
-       int exec_fileno;
 
        hdr = ((struct flat_hdr *) bprm->buf);          /* exec-header */
        inode = bprm->file->f_dentry->d_inode;
@@ -502,21 +501,12 @@ static int load_flat_file(struct linux_binprm * bprm,
                goto err;
        }
 
-       /* check file descriptor */
-       exec_fileno = get_unused_fd();
-       if (exec_fileno < 0) {
-               ret = -EMFILE;
-               goto err;
-       }
-       get_file(bprm->file);
-       fd_install(exec_fileno, bprm->file);
-
        /* Flush all traces of the currently running executable */
        if (id == 0) {
                result = flush_old_exec(bprm);
                if (result) {
                        ret = result;
-                       goto err_close;
+                       goto err;
                }
 
                /* OK, This is the point of no return */
@@ -548,7 +538,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                                textpos = (unsigned long) -ENOMEM;
                        printk("Unable to mmap process text, errno %d\n", (int)-textpos);
                        ret = textpos;
-                       goto err_close;
+                       goto err;
                }
 
                down_write(&current->mm->mmap_sem);
@@ -564,7 +554,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                                        (int)-datapos);
                        do_munmap(current->mm, textpos, text_len);
                        ret = realdatastart;
-                       goto err_close;
+                       goto err;
                }
                datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long);
 
@@ -587,7 +577,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        do_munmap(current->mm, textpos, text_len);
                        do_munmap(current->mm, realdatastart, data_len + extra);
                        ret = result;
-                       goto err_close;
+                       goto err;
                }
 
                reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len));
@@ -606,7 +596,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        printk("Unable to allocate RAM for process text/data, errno %d\n",
                                        (int)-textpos);
                        ret = textpos;
-                       goto err_close;
+                       goto err;
                }
 
                realdatastart = textpos + ntohl(hdr->data_start);
@@ -652,7 +642,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        do_munmap(current->mm, textpos, text_len + data_len + extra +
                                MAX_SHARED_LIBS * sizeof(unsigned long));
                        ret = result;
-                       goto err_close;
+                       goto err;
                }
        }
 
@@ -717,7 +707,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                                addr = calc_reloc(*rp, libinfo, id, 0);
                                if (addr == RELOC_FAILED) {
                                        ret = -ENOEXEC;
-                                       goto err_close;
+                                       goto err;
                                }
                                *rp = addr;
                        }
@@ -747,7 +737,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                        rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1);
                        if (rp == (unsigned long *)RELOC_FAILED) {
                                ret = -ENOEXEC;
-                               goto err_close;
+                               goto err;
                        }
 
                        /* Get the pointer's value.  */
@@ -762,7 +752,7 @@ static int load_flat_file(struct linux_binprm * bprm,
                                addr = calc_reloc(addr, libinfo, id, 0);
                                if (addr == RELOC_FAILED) {
                                        ret = -ENOEXEC;
-                                       goto err_close;
+                                       goto err;
                                }
 
                                /* Write back the relocated pointer.  */
@@ -783,8 +773,6 @@ static int load_flat_file(struct linux_binprm * bprm,
                        stack_len);
 
        return 0;
-err_close:
-       sys_close(exec_fileno);
 err:
        return ret;
 }
index eb8fbc53f2cd73273c8639c4dcb0648b30d15f70..098c12b2d60a9d8028a6a8fbdb2b03ecca84e3ba 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1116,6 +1116,9 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors)
        bp->bio1.bi_io_vec = &bp->bv1;
        bp->bio2.bi_io_vec = &bp->bv2;
 
+       bp->bio1.bi_max_vecs = 1;
+       bp->bio2.bi_max_vecs = 1;
+
        bp->bio1.bi_end_io = bio_pair_end_1;
        bp->bio2.bi_end_io = bio_pair_end_2;
 
index 1a27ecb46c9a71d7458b9119b345a8a4f6ec104c..7271bb0257f64f149d1fd3f9857416c1513787ae 100644 (file)
@@ -1,3 +1,10 @@
+Version 1.43
+------------
+POSIX locking to servers which support CIFS POSIX Extensions
+(disabled by default controlled by proc/fs/cifs/Experimental).
+Handle conversion of long share names (especially Asian languages)
+to Unicode during mount. 
+
 Version 1.42
 ------------
 Fix slow oplock break when mounted to different servers at the same time and
index 4e829dc672a645622c078466244a71d611c1e8c9..c98755dca868743c25822124c1bc06d8b225a9ed 100644 (file)
@@ -99,5 +99,5 @@ extern ssize_t        cifs_getxattr(struct dentry *, const char *, void *, size_t);
 extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
 extern int cifs_ioctl (struct inode * inode, struct file * filep,
                       unsigned int command, unsigned long arg);
-#define CIFS_VERSION   "1.42"
+#define CIFS_VERSION   "1.43"
 #endif                         /* _CIFSFS_H */
index 2879ba343ca7acf5a4c4372c16a6ef3a7237ad9e..310ea2f0e0bfd27d6eacd91ffe0f695a0ca89322 100644 (file)
@@ -267,7 +267,7 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
                        const int waitFlag);
 extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
                        const __u16 smb_file_id, const int get_flag,
-                       const __u64 len, const __u64 offset
+                       const __u64 len, struct file_lock *
                        const __u16 lock_type, const int waitFlag);
 extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon);
 extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses);
index fd36892eda55a282fc207842e0ff62787c746703..925881e00ff210e08822cc456337be1734f801d8 100644 (file)
@@ -1355,7 +1355,8 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
 int
 CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
                const __u16 smb_file_id, const int get_flag, const __u64 len,
-               const __u64 lkoffset, const __u16 lock_type, const int waitFlag)
+               struct file_lock *pLockData, const __u16 lock_type, 
+               const int waitFlag)
 {
        struct smb_com_transaction2_sfi_req *pSMB  = NULL;
        struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
@@ -1366,6 +1367,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
        __u16 params, param_offset, offset, byte_count, count;
 
        cFYI(1, ("Posix Lock"));
+
+       if(pLockData == NULL)
+               return EINVAL;
+
        rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
 
        if (rc)
@@ -1404,10 +1409,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
 
        parm_data->lock_type = cpu_to_le16(lock_type);
        if(waitFlag)
-               parm_data->lock_flags = 1;
+               parm_data->lock_flags = cpu_to_le16(1);
        parm_data->pid = cpu_to_le32(current->tgid);
-       parm_data->start = lkoffset;
-       parm_data->length = len;  /* normalize negative numbers */
+       parm_data->start = cpu_to_le64(pLockData->fl_start);
+       parm_data->length = cpu_to_le64(len);  /* normalize negative numbers */
 
        pSMB->DataOffset = cpu_to_le16(offset);
        pSMB->Fid = smb_file_id;
@@ -1419,8 +1424,33 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
        if (rc) {
                cFYI(1, ("Send error in Posix Lock = %d", rc));
-       }
+       } else if (get_flag) {
+               /* lock structure can be returned on get */
+               __u16 data_offset;
+               __u16 data_count;
+               rc = validate_t2((struct smb_t2_rsp *)pSMBr);
 
+               if (rc || (pSMBr->ByteCount < sizeof(struct cifs_posix_lock))) {
+                       rc = -EIO;      /* bad smb */
+                       goto plk_err_exit;
+               }
+               if(pLockData == NULL) {
+                       rc = -EINVAL;
+                       goto plk_err_exit;
+               }
+               data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
+               data_count  = le16_to_cpu(pSMBr->t2.DataCount);
+               if(data_count < sizeof(struct cifs_posix_lock)) {
+                       rc = -EIO;
+                       goto plk_err_exit;
+               }
+               parm_data = (struct cifs_posix_lock *)
+                       ((char *)&pSMBr->hdr.Protocol + data_offset);
+               if(parm_data->lock_type == cpu_to_le16(CIFS_UNLCK))
+                       pLockData->fl_type = F_UNLCK;
+       }
+plk_err_exit:
        if (pSMB)
                cifs_small_buf_release(pSMB);
 
index d2ec806a4f32b516cc7a320b39fb3974bc5dd2e2..bae1479318d10fc6fd34a141a564aeb49252ba80 100644 (file)
@@ -2148,6 +2148,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
 /* We look for obvious messed up bcc or strings in response so we do not go off
    the end since (at least) WIN2K and Windows XP have a major bug in not null
    terminating last Unicode string in response  */
+                               if(ses->serverOS)
+                                       kfree(ses->serverOS);
                                ses->serverOS = kzalloc(2 * (len + 1), GFP_KERNEL);
                                if(ses->serverOS == NULL)
                                        goto sesssetup_nomem;
@@ -2160,6 +2162,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                if (remaining_words > 0) {
                                        len = UniStrnlen((wchar_t *)bcc_ptr,
                                                         remaining_words-1);
+                                       if(ses->serverNOS)
+                                               kfree(ses->serverNOS);
                                        ses->serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL);
                                        if(ses->serverNOS == NULL)
                                                goto sesssetup_nomem;
@@ -2177,6 +2181,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                        if (remaining_words > 0) {
                                                len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
           /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain =
                                                    kzalloc(2*(len+1),GFP_KERNEL);
                                                if(ses->serverDomain == NULL)
@@ -2187,15 +2193,22 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                ses->serverDomain[2*len] = 0;
                                                ses->serverDomain[1+(2*len)] = 0;
                                        } /* else no more room so create dummy domain string */
-                                       else
+                                       else {
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain = 
                                                        kzalloc(2, GFP_KERNEL);
+                                       }
                                } else {        /* no room so create dummy domain and NOS string */
                                        /* if these kcallocs fail not much we
                                           can do, but better to not fail the
                                           sesssetup itself */
+                                       if(ses->serverDomain)
+                                               kfree(ses->serverDomain);
                                        ses->serverDomain =
                                            kzalloc(2, GFP_KERNEL);
+                                       if(ses->serverNOS)
+                                               kfree(ses->serverNOS);
                                        ses->serverNOS =
                                            kzalloc(2, GFP_KERNEL);
                                }
@@ -2204,6 +2217,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                if (((long) bcc_ptr + len) - (long)
                                    pByteArea(smb_buffer_response)
                                            <= BCC(smb_buffer_response)) {
+                                       if(ses->serverOS)
+                                               kfree(ses->serverOS);
                                        ses->serverOS = kzalloc(len + 1,GFP_KERNEL);
                                        if(ses->serverOS == NULL)
                                                goto sesssetup_nomem;
@@ -2214,6 +2229,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                        bcc_ptr++;
 
                                        len = strnlen(bcc_ptr, 1024);
+                                       if(ses->serverNOS)
+                                               kfree(ses->serverNOS);
                                        ses->serverNOS = kzalloc(len + 1,GFP_KERNEL);
                                        if(ses->serverNOS == NULL)
                                                goto sesssetup_nomem;
@@ -2223,6 +2240,8 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                        bcc_ptr++;
 
                                        len = strnlen(bcc_ptr, 1024);
+                                       if(ses->serverDomain)
+                                               kfree(ses->serverDomain);
                                        ses->serverDomain = kzalloc(len + 1,GFP_KERNEL);
                                        if(ses->serverDomain == NULL)
                                                goto sesssetup_nomem;
@@ -2427,6 +2446,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
 /* We look for obvious messed up bcc or strings in response so we do not go off
    the end since (at least) WIN2K and Windows XP have a major bug in not null
    terminating last Unicode string in response  */
+                                       if(ses->serverOS)
+                                               kfree(ses->serverOS);
                                        ses->serverOS =
                                            kzalloc(2 * (len + 1), GFP_KERNEL);
                                        cifs_strfromUCS_le(ses->serverOS,
@@ -2441,6 +2462,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                len = UniStrnlen((wchar_t *)bcc_ptr,
                                                                 remaining_words
                                                                 - 1);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS =
                                                    kzalloc(2 * (len + 1),
                                                            GFP_KERNEL);
@@ -2454,7 +2477,9 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                remaining_words -= len + 1;
                                                if (remaining_words > 0) {
                                                        len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); 
-                            /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
+                     /* last string not null terminated (e.g.Windows XP/2000) */
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL);
                                                        cifs_strfromUCS_le(ses->serverDomain,
                                                             (__le16 *)bcc_ptr, 
@@ -2463,11 +2488,18 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                        ses->serverDomain[2*len] = 0;
                                                        ses->serverDomain[1+(2*len)] = 0;
                                                } /* else no more room so create dummy domain string */
-                                               else
+                                               else {
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain =
                                                            kzalloc(2,GFP_KERNEL);
-                                       } else {        /* no room so create dummy domain and NOS string */
+                                               }
+                                       } else {/* no room use dummy domain&NOS */
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain = kzalloc(2, GFP_KERNEL);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS = kzalloc(2, GFP_KERNEL);
                                        }
                                } else {        /* ASCII */
@@ -2476,6 +2508,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                        if (((long) bcc_ptr + len) - (long)
                                            pByteArea(smb_buffer_response)
                                            <= BCC(smb_buffer_response)) {
+                                               if(ses->serverOS)
+                                                       kfree(ses->serverOS);
                                                ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
                                                strncpy(ses->serverOS, bcc_ptr, len);
 
@@ -2484,6 +2518,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS = kzalloc(len + 1,GFP_KERNEL);
                                                strncpy(ses->serverNOS, bcc_ptr, len);
                                                bcc_ptr += len;
@@ -2491,6 +2527,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain = kzalloc(len + 1, GFP_KERNEL);
                                                strncpy(ses->serverDomain, bcc_ptr, len);
                                                bcc_ptr += len;
@@ -2728,6 +2766,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
 /* We look for obvious messed up bcc or strings in response so we do not go off
    the end since (at least) WIN2K and Windows XP have a major bug in not null
    terminating last Unicode string in response  */
+                                       if(ses->serverOS)
+                                               kfree(ses->serverOS);
                                        ses->serverOS =
                                            kzalloc(2 * (len + 1), GFP_KERNEL);
                                        cifs_strfromUCS_le(ses->serverOS,
@@ -2743,6 +2783,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                                                 bcc_ptr,
                                                                 remaining_words
                                                                 - 1);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS =
                                                    kzalloc(2 * (len + 1),
                                                            GFP_KERNEL);
@@ -2760,6 +2802,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                                if (remaining_words > 0) {
                                                        len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); 
            /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain =
                                                            kzalloc(2 *
                                                                    (len +
@@ -2777,13 +2821,20 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                                                [1 + (2 * len)]
                                                            = 0;
                                                } /* else no more room so create dummy domain string */
-                                               else
+                                               else {
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain =
                                                            kzalloc(2,
                                                                    GFP_KERNEL);
+                                               }
                                        } else {        /* no room so create dummy domain and NOS string */
+                                               if(ses->serverDomain);
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain =
                                                    kzalloc(2, GFP_KERNEL);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS =
                                                    kzalloc(2, GFP_KERNEL);
                                        }
@@ -2792,6 +2843,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                        if (((long) bcc_ptr + len) - (long)
                                            pByteArea(smb_buffer_response)
                                            <= BCC(smb_buffer_response)) {
+                                               if(ses->serverOS)
+                                                       kfree(ses->serverOS);
                                                ses->serverOS =
                                                    kzalloc(len + 1,
                                                            GFP_KERNEL);
@@ -2803,6 +2856,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS =
                                                    kzalloc(len + 1,
                                                            GFP_KERNEL);
@@ -2812,6 +2867,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain =
                                                    kzalloc(len + 1,
                                                            GFP_KERNEL);
@@ -3116,6 +3173,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
 /* We look for obvious messed up bcc or strings in response so we do not go off
   the end since (at least) WIN2K and Windows XP have a major bug in not null
   terminating last Unicode string in response  */
+                                       if(ses->serverOS)
+                                               kfree(ses->serverOS);
                                        ses->serverOS =
                                            kzalloc(2 * (len + 1), GFP_KERNEL);
                                        cifs_strfromUCS_le(ses->serverOS,
@@ -3131,6 +3190,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                                 bcc_ptr,
                                                                 remaining_words
                                                                 - 1);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS =
                                                    kzalloc(2 * (len + 1),
                                                            GFP_KERNEL);
@@ -3147,6 +3208,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                if (remaining_words > 0) {
                                                        len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); 
      /* last string not always null terminated (e.g. for Windows XP & 2000) */
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain =
                                                            kzalloc(2 *
                                                                    (len +
@@ -3172,10 +3235,17 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                                          len)]
                                                            = 0;
                                                } /* else no more room so create dummy domain string */
-                                               else
+                                               else {
+                                                       if(ses->serverDomain)
+                                                               kfree(ses->serverDomain);
                                                        ses->serverDomain = kzalloc(2,GFP_KERNEL);
+                                               }
                                        } else {  /* no room so create dummy domain and NOS string */
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain = kzalloc(2, GFP_KERNEL);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS = kzalloc(2, GFP_KERNEL);
                                        }
                                } else {        /* ASCII */
@@ -3183,6 +3253,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                        if (((long) bcc_ptr + len) - 
                         (long) pByteArea(smb_buffer_response) 
                             <= BCC(smb_buffer_response)) {
+                                               if(ses->serverOS)
+                                                       kfree(ses->serverOS);
                                                ses->serverOS = kzalloc(len + 1,GFP_KERNEL);
                                                strncpy(ses->serverOS,bcc_ptr, len);
 
@@ -3191,6 +3263,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverNOS)
+                                                       kfree(ses->serverNOS);
                                                ses->serverNOS = kzalloc(len+1,GFP_KERNEL);
                                                strncpy(ses->serverNOS, bcc_ptr, len);  
                                                bcc_ptr += len;
@@ -3198,6 +3272,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
                                                bcc_ptr++;
 
                                                len = strnlen(bcc_ptr, 1024);
+                                               if(ses->serverDomain)
+                                                       kfree(ses->serverDomain);
                                                ses->serverDomain = kzalloc(len+1,GFP_KERNEL);
                                                strncpy(ses->serverDomain, bcc_ptr, len);
                                                bcc_ptr += len;
@@ -3282,7 +3358,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
                bcc_ptr++; /* align */
        }
 
-       if(ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
+       if(ses->server->secMode & 
+                       (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
                smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
 
        if (ses->capabilities & CAP_STATUS32) {
@@ -3294,8 +3371,10 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
        if (ses->capabilities & CAP_UNICODE) {
                smb_buffer->Flags2 |= SMBFLG2_UNICODE;
                length =
-                   cifs_strtoUCS((__le16 *) bcc_ptr, tree, 100, nls_codepage);
-               bcc_ptr += 2 * length;  /* convert num of 16 bit words to bytes */
+                   cifs_strtoUCS((__le16 *) bcc_ptr, tree, 
+                       6 /* max utf8 char length in bytes */ * 
+                       (/* server len*/ + 256 /* share len */), nls_codepage);
+               bcc_ptr += 2 * length;  /* convert num 16 bit words to bytes */
                bcc_ptr += 2;   /* skip trailing null */
        } else {                /* ASCII */
                strcpy(bcc_ptr, tree);
index e152bf6afa60fadc91c2080231858d9b5653f0fb..e2b4ce1dad6680cc54d8af516e7cf876533361fd 100644 (file)
@@ -84,6 +84,8 @@ static inline int cifs_get_disposition(unsigned int flags)
                return FILE_OVERWRITE_IF;
        else if ((flags & O_CREAT) == O_CREAT)
                return FILE_OPEN_IF;
+       else if ((flags & O_TRUNC) == O_TRUNC)
+               return FILE_OVERWRITE;
        else
                return FILE_OPEN;
 }
@@ -656,7 +658,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
                        else
                                posix_lock_type = CIFS_WRLCK;
                        rc = CIFSSMBPosixLock(xid, pTcon, netfid, 1 /* get */,
-                                       length, pfLock->fl_start,
+                                       length, pfLock,
                                        posix_lock_type, wait_flag);
                        FreeXid(xid);
                        return rc;
@@ -704,7 +706,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
                        return -EOPNOTSUPP;
                }
                rc = CIFSSMBPosixLock(xid, pTcon, netfid, 0 /* set */,
-                                     length, pfLock->fl_start,
+                                     length, pfLock,
                                      posix_lock_type, wait_flag);
        } else
                rc = CIFSSMBLock(xid, pTcon, netfid, length, pfLock->fl_start,
@@ -904,8 +906,10 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
                                if (rc != 0)
                                        break;
                        }
-                       if(experimEnabled || (pTcon->ses->server->secMode & 
-                        (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) {
+                       if(experimEnabled || (pTcon->ses->server &&
+                               ((pTcon->ses->server->secMode & 
+                               (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
+                               == 0))) {
                                struct kvec iov[2];
                                unsigned int len;
 
index 970888aad84383d6d708d347593e461165b4d2a1..b1f64786a613e598b5b5a06684f58d5cea8c0d5c 100644 (file)
@@ -1913,7 +1913,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
        }
 
        if (sigmask) {
-               if (sigsetsize |= sizeof(compat_sigset_t))
+               if (sigsetsize != sizeof(compat_sigset_t))
                        return -EINVAL;
                if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
                        return -EFAULT;
@@ -2030,109 +2030,115 @@ union compat_nfsctl_res {
        struct knfsd_fh         cr32_getfs;
 };
 
-static int compat_nfs_svc_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+static int compat_nfs_svc_trans(struct nfsctl_arg *karg,
+                               struct compat_nfsctl_arg __user *arg)
 {
-       int err;
-
-       err = access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc));
-       err |= get_user(karg->ca_version, &arg->ca32_version);
-       err |= __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port);
-       err |= __get_user(karg->ca_svc.svc_nthreads, &arg->ca32_svc.svc32_nthreads);
-       return (err) ? -EFAULT : 0;
+       if (!access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc)) ||
+               get_user(karg->ca_version, &arg->ca32_version) ||
+               __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port) ||
+               __get_user(karg->ca_svc.svc_nthreads,
+                               &arg->ca32_svc.svc32_nthreads))
+               return -EFAULT;
+       return 0;
 }
 
-static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
-{
-       int err;
-
-       err = access_ok(VERIFY_READ, &arg->ca32_client, sizeof(arg->ca32_client));
-       err |= get_user(karg->ca_version, &arg->ca32_version);
-       err |= __copy_from_user(&karg->ca_client.cl_ident[0],
-                         &arg->ca32_client.cl32_ident[0],
-                         NFSCLNT_IDMAX);
-       err |= __get_user(karg->ca_client.cl_naddr, &arg->ca32_client.cl32_naddr);
-       err |= __copy_from_user(&karg->ca_client.cl_addrlist[0],
-                         &arg->ca32_client.cl32_addrlist[0],
-                         (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-       err |= __get_user(karg->ca_client.cl_fhkeytype,
-                     &arg->ca32_client.cl32_fhkeytype);
-       err |= __get_user(karg->ca_client.cl_fhkeylen,
-                     &arg->ca32_client.cl32_fhkeylen);
-       err |= __copy_from_user(&karg->ca_client.cl_fhkey[0],
-                         &arg->ca32_client.cl32_fhkey[0],
-                         NFSCLNT_KEYMAX);
+static int compat_nfs_clnt_trans(struct nfsctl_arg *karg,
+                               struct compat_nfsctl_arg __user *arg)
+{
+       if (!access_ok(VERIFY_READ, &arg->ca32_client,
+                       sizeof(arg->ca32_client)) ||
+               get_user(karg->ca_version, &arg->ca32_version) ||
+               __copy_from_user(&karg->ca_client.cl_ident[0],
+                               &arg->ca32_client.cl32_ident[0],
+                               NFSCLNT_IDMAX) ||
+               __get_user(karg->ca_client.cl_naddr,
+                               &arg->ca32_client.cl32_naddr) ||
+               __copy_from_user(&karg->ca_client.cl_addrlist[0],
+                               &arg->ca32_client.cl32_addrlist[0],
+                               (sizeof(struct in_addr) * NFSCLNT_ADDRMAX)) ||
+               __get_user(karg->ca_client.cl_fhkeytype,
+                               &arg->ca32_client.cl32_fhkeytype) ||
+               __get_user(karg->ca_client.cl_fhkeylen,
+                               &arg->ca32_client.cl32_fhkeylen) ||
+               __copy_from_user(&karg->ca_client.cl_fhkey[0],
+                               &arg->ca32_client.cl32_fhkey[0],
+                               NFSCLNT_KEYMAX))
+               return -EFAULT;
 
-       return (err) ? -EFAULT : 0;
+       return 0;
 }
 
-static int compat_nfs_exp_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
-{
-       int err;
-
-       err = access_ok(VERIFY_READ, &arg->ca32_export, sizeof(arg->ca32_export));
-       err |= get_user(karg->ca_version, &arg->ca32_version);
-       err |= __copy_from_user(&karg->ca_export.ex_client[0],
-                         &arg->ca32_export.ex32_client[0],
-                         NFSCLNT_IDMAX);
-       err |= __copy_from_user(&karg->ca_export.ex_path[0],
-                         &arg->ca32_export.ex32_path[0],
-                         NFS_MAXPATHLEN);
-       err |= __get_user(karg->ca_export.ex_dev,
-                     &arg->ca32_export.ex32_dev);
-       err |= __get_user(karg->ca_export.ex_ino,
-                     &arg->ca32_export.ex32_ino);
-       err |= __get_user(karg->ca_export.ex_flags,
-                     &arg->ca32_export.ex32_flags);
-       err |= __get_user(karg->ca_export.ex_anon_uid,
-                     &arg->ca32_export.ex32_anon_uid);
-       err |= __get_user(karg->ca_export.ex_anon_gid,
-                     &arg->ca32_export.ex32_anon_gid);
+static int compat_nfs_exp_trans(struct nfsctl_arg *karg,
+                               struct compat_nfsctl_arg __user *arg)
+{
+       if (!access_ok(VERIFY_READ, &arg->ca32_export,
+                               sizeof(arg->ca32_export)) ||
+               get_user(karg->ca_version, &arg->ca32_version) ||
+               __copy_from_user(&karg->ca_export.ex_client[0],
+                               &arg->ca32_export.ex32_client[0],
+                               NFSCLNT_IDMAX) ||
+               __copy_from_user(&karg->ca_export.ex_path[0],
+                               &arg->ca32_export.ex32_path[0],
+                               NFS_MAXPATHLEN) ||
+               __get_user(karg->ca_export.ex_dev,
+                               &arg->ca32_export.ex32_dev) ||
+               __get_user(karg->ca_export.ex_ino,
+                               &arg->ca32_export.ex32_ino) ||
+               __get_user(karg->ca_export.ex_flags,
+                               &arg->ca32_export.ex32_flags) ||
+               __get_user(karg->ca_export.ex_anon_uid,
+                               &arg->ca32_export.ex32_anon_uid) ||
+               __get_user(karg->ca_export.ex_anon_gid,
+                               &arg->ca32_export.ex32_anon_gid))
+               return -EFAULT;
        SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid);
        SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid);
 
-       return (err) ? -EFAULT : 0;
+       return 0;
 }
 
-static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
-{
-       int err;
-
-       err = access_ok(VERIFY_READ, &arg->ca32_getfd, sizeof(arg->ca32_getfd));
-       err |= get_user(karg->ca_version, &arg->ca32_version);
-       err |= __copy_from_user(&karg->ca_getfd.gd_addr,
-                         &arg->ca32_getfd.gd32_addr,
-                         (sizeof(struct sockaddr)));
-       err |= __copy_from_user(&karg->ca_getfd.gd_path,
-                         &arg->ca32_getfd.gd32_path,
-                         (NFS_MAXPATHLEN+1));
-       err |= __get_user(karg->ca_getfd.gd_version,
-                     &arg->ca32_getfd.gd32_version);
+static int compat_nfs_getfd_trans(struct nfsctl_arg *karg,
+                               struct compat_nfsctl_arg __user *arg)
+{
+       if (!access_ok(VERIFY_READ, &arg->ca32_getfd,
+                       sizeof(arg->ca32_getfd)) ||
+               get_user(karg->ca_version, &arg->ca32_version) ||
+               __copy_from_user(&karg->ca_getfd.gd_addr,
+                               &arg->ca32_getfd.gd32_addr,
+                               (sizeof(struct sockaddr))) ||
+               __copy_from_user(&karg->ca_getfd.gd_path,
+                               &arg->ca32_getfd.gd32_path,
+                               (NFS_MAXPATHLEN+1)) ||
+               __get_user(karg->ca_getfd.gd_version,
+                               &arg->ca32_getfd.gd32_version))
+               return -EFAULT;
 
-       return (err) ? -EFAULT : 0;
+       return 0;
 }
 
-static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+static int compat_nfs_getfs_trans(struct nfsctl_arg *karg,
+                               struct compat_nfsctl_arg __user *arg)
 {
-       int err;
-
-       err = access_ok(VERIFY_READ, &arg->ca32_getfs, sizeof(arg->ca32_getfs));
-       err |= get_user(karg->ca_version, &arg->ca32_version);
-       err |= __copy_from_user(&karg->ca_getfs.gd_addr,
-                         &arg->ca32_getfs.gd32_addr,
-                         (sizeof(struct sockaddr)));
-       err |= __copy_from_user(&karg->ca_getfs.gd_path,
-                         &arg->ca32_getfs.gd32_path,
-                         (NFS_MAXPATHLEN+1));
-       err |= __get_user(karg->ca_getfs.gd_maxlen,
-                     &arg->ca32_getfs.gd32_maxlen);
+       if (!access_ok(VERIFY_READ,&arg->ca32_getfs,sizeof(arg->ca32_getfs)) ||
+               get_user(karg->ca_version, &arg->ca32_version) ||
+               __copy_from_user(&karg->ca_getfs.gd_addr,
+                               &arg->ca32_getfs.gd32_addr,
+                               (sizeof(struct sockaddr))) ||
+               __copy_from_user(&karg->ca_getfs.gd_path,
+                               &arg->ca32_getfs.gd32_path,
+                               (NFS_MAXPATHLEN+1)) ||
+               __get_user(karg->ca_getfs.gd_maxlen,
+                               &arg->ca32_getfs.gd32_maxlen))
+               return -EFAULT;
 
-       return (err) ? -EFAULT : 0;
+       return 0;
 }
 
 /* This really doesn't need translations, we are only passing
  * back a union which contains opaque nfs file handle data.
  */
-static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsctl_res __user *res)
+static int compat_nfs_getfh_res_trans(union nfsctl_res *kres,
+                               union compat_nfsctl_res __user *res)
 {
        int err;
 
@@ -2141,8 +2147,9 @@ static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsct
        return (err) ? -EFAULT : 0;
 }
 
-asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user *arg,
-                                       union compat_nfsctl_res __user *res)
+asmlinkage long compat_sys_nfsservctl(int cmd,
+                               struct compat_nfsctl_arg __user *arg,
+                               union compat_nfsctl_res __user *res)
 {
        struct nfsctl_arg *karg;
        union nfsctl_res *kres;
index 5638c8f9362f9222419e1cff3f80e50dca646abc..5f952187fc53575795358785cdb586bd7093b8c9 100644 (file)
@@ -505,13 +505,15 @@ static int populate_groups(struct config_group *group)
        int i;
 
        if (group->default_groups) {
-               /* FYI, we're faking mkdir here
+               /*
+                * FYI, we're faking mkdir here
                 * I'm not sure we need this semaphore, as we're called
                 * from our parent's mkdir.  That holds our parent's
                 * i_mutex, so afaik lookup cannot continue through our
                 * parent to find us, let alone mess with our tree.
                 * That said, taking our i_mutex is closer to mkdir
-                * emulation, and shouldn't hurt. */
+                * emulation, and shouldn't hurt.
+                */
                mutex_lock(&dentry->d_inode->i_mutex);
 
                for (i = 0; group->default_groups[i]; i++) {
@@ -546,20 +548,34 @@ static void unlink_obj(struct config_item *item)
 
                item->ci_group = NULL;
                item->ci_parent = NULL;
+
+               /* Drop the reference for ci_entry */
                config_item_put(item);
 
+               /* Drop the reference for ci_parent */
                config_group_put(group);
        }
 }
 
 static void link_obj(struct config_item *parent_item, struct config_item *item)
 {
-       /* Parent seems redundant with group, but it makes certain
-        * traversals much nicer. */
+       /*
+        * Parent seems redundant with group, but it makes certain
+        * traversals much nicer.
+        */
        item->ci_parent = parent_item;
+
+       /*
+        * We hold a reference on the parent for the child's ci_parent
+        * link.
+        */
        item->ci_group = config_group_get(to_config_group(parent_item));
        list_add_tail(&item->ci_entry, &item->ci_group->cg_children);
 
+       /*
+        * We hold a reference on the child for ci_entry on the parent's
+        * cg_children
+        */
        config_item_get(item);
 }
 
@@ -684,6 +700,10 @@ static void client_drop_item(struct config_item *parent_item,
        type = parent_item->ci_type;
        BUG_ON(!type);
 
+       /*
+        * If ->drop_item() exists, it is responsible for the
+        * config_item_put().
+        */
        if (type->ct_group_ops && type->ct_group_ops->drop_item)
                type->ct_group_ops->drop_item(to_config_group(parent_item),
                                                item);
@@ -694,23 +714,28 @@ static void client_drop_item(struct config_item *parent_item,
 
 static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
-       int ret;
+       int ret, module_got = 0;
        struct config_group *group;
        struct config_item *item;
        struct config_item *parent_item;
        struct configfs_subsystem *subsys;
        struct configfs_dirent *sd;
        struct config_item_type *type;
-       struct module *owner;
+       struct module *owner = NULL;
        char *name;
 
-       if (dentry->d_parent == configfs_sb->s_root)
-               return -EPERM;
+       if (dentry->d_parent == configfs_sb->s_root) {
+               ret = -EPERM;
+               goto out;
+       }
 
        sd = dentry->d_parent->d_fsdata;
-       if (!(sd->s_type & CONFIGFS_USET_DIR))
-               return -EPERM;
+       if (!(sd->s_type & CONFIGFS_USET_DIR)) {
+               ret = -EPERM;
+               goto out;
+       }
 
+       /* Get a working ref for the duration of this function */
        parent_item = configfs_get_config_item(dentry->d_parent);
        type = parent_item->ci_type;
        subsys = to_config_group(parent_item)->cg_subsys;
@@ -719,15 +744,16 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
        if (!type || !type->ct_group_ops ||
            (!type->ct_group_ops->make_group &&
             !type->ct_group_ops->make_item)) {
-               config_item_put(parent_item);
-               return -EPERM;  /* What lack-of-mkdir returns */
+               ret = -EPERM;  /* Lack-of-mkdir returns -EPERM */
+               goto out_put;
        }
 
        name = kmalloc(dentry->d_name.len + 1, GFP_KERNEL);
        if (!name) {
-               config_item_put(parent_item);
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto out_put;
        }
+
        snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);
 
        down(&subsys->su_sem);
@@ -748,40 +774,67 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        kfree(name);
        if (!item) {
-               config_item_put(parent_item);
-               return -ENOMEM;
+               /*
+                * If item == NULL, then link_obj() was never called.
+                * There are no extra references to clean up.
+                */
+               ret = -ENOMEM;
+               goto out_put;
        }
 
-       ret = -EINVAL;
+       /*
+        * link_obj() has been called (via link_group() for groups).
+        * From here on out, errors must clean that up.
+        */
+
        type = item->ci_type;
-       if (type) {
-               owner = type->ct_owner;
-               if (try_module_get(owner)) {
-                       if (group) {
-                               ret = configfs_attach_group(parent_item,
-                                                           item,
-                                                           dentry);
-                       } else {
-                               ret = configfs_attach_item(parent_item,
-                                                          item,
-                                                          dentry);
-                       }
+       if (!type) {
+               ret = -EINVAL;
+               goto out_unlink;
+       }
 
-                       if (ret) {
-                               down(&subsys->su_sem);
-                               if (group)
-                                       unlink_group(group);
-                               else
-                                       unlink_obj(item);
-                               client_drop_item(parent_item, item);
-                               up(&subsys->su_sem);
+       owner = type->ct_owner;
+       if (!try_module_get(owner)) {
+               ret = -EINVAL;
+               goto out_unlink;
+       }
 
-                               config_item_put(parent_item);
-                               module_put(owner);
-                       }
-               }
+       /*
+        * I hate doing it this way, but if there is
+        * an error,  module_put() probably should
+        * happen after any cleanup.
+        */
+       module_got = 1;
+
+       if (group)
+               ret = configfs_attach_group(parent_item, item, dentry);
+       else
+               ret = configfs_attach_item(parent_item, item, dentry);
+
+out_unlink:
+       if (ret) {
+               /* Tear down everything we built up */
+               down(&subsys->su_sem);
+               if (group)
+                       unlink_group(group);
+               else
+                       unlink_obj(item);
+               client_drop_item(parent_item, item);
+               up(&subsys->su_sem);
+
+               if (module_got)
+                       module_put(owner);
        }
 
+out_put:
+       /*
+        * link_obj()/link_group() took a reference from child->parent,
+        * so the parent is safely pinned.  We can drop our working
+        * reference.
+        */
+       config_item_put(parent_item);
+
+out:
        return ret;
 }
 
@@ -801,6 +854,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
        if (sd->s_type & CONFIGFS_USET_DEFAULT)
                return -EPERM;
 
+       /* Get a working ref until we have the child */
        parent_item = configfs_get_config_item(dentry->d_parent);
        subsys = to_config_group(parent_item)->cg_subsys;
        BUG_ON(!subsys);
@@ -817,6 +871,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
                return ret;
        }
 
+       /* Get a working ref for the duration of this function */
        item = configfs_get_config_item(dentry);
 
        /* Drop reference from above, item already holds one. */
index 85d166cdcae4908e8916b4e66a1dd30722b00f1c..b55b4ea9a67675a92377ffeb4a12ab9542ed8ca6 100644 (file)
@@ -67,12 +67,13 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
 static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
                         int mode, dev_t dev)
 {
-       struct inode *inode = debugfs_get_inode(dir->i_sb, mode, dev);
+       struct inode *inode;
        int error = -EPERM;
 
        if (dentry->d_inode)
                return -EEXIST;
 
+       inode = debugfs_get_inode(dir->i_sb, mode, dev);
        if (inode) {
                d_instantiate(dentry, inode);
                dget(dentry);
index b06b54f1bbbbda611e39252d2df5a86b6afaa3c8..4c39009350f3e59529363108800c003de2e2d2d0 100644 (file)
@@ -102,7 +102,7 @@ find_exported_dentry(struct super_block *sb, void *obj, void *parent,
                if (acceptable(context, result))
                        return result;
                if (S_ISDIR(result->d_inode->i_mode)) {
-                       /* there is no other dentry, so fail */
+                       err = -EACCES;
                        goto err_result;
                }
 
index 8aac5334680d18603b987cd1afb759d1b59cf574..34b39e9a1e5a01588db869c02c85f2407d12221a 100644 (file)
@@ -767,7 +767,6 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
        if (input->group != sbi->s_groups_count) {
                ext3_warning(sb, __FUNCTION__,
                             "multiple resizers run on filesystem!");
-               unlock_super(sb);
                err = -EBUSY;
                goto exit_journal;
        }
index 1f50302849c53ce8c674fd71416777713de9009b..732ec4bd5774507f8c06c6e05cc90d4d2004a84b 100644 (file)
@@ -848,7 +848,11 @@ static int inotify_release(struct inode *ignored, struct file *file)
                inode = watch->inode;
                mutex_lock(&inode->inotify_mutex);
                mutex_lock(&dev->mutex);
-               remove_watch_no_event(watch, dev);
+
+               /* make sure we didn't race with another list removal */
+               if (likely(idr_find(&dev->idr, watch->wd)))
+                       remove_watch_no_event(watch, dev);
+
                mutex_unlock(&dev->mutex);
                mutex_unlock(&inode->inotify_mutex);
                put_inotify_watch(watch);
@@ -890,8 +894,7 @@ static int inotify_ignore(struct inotify_device *dev, s32 wd)
        mutex_lock(&dev->mutex);
 
        /* make sure that we did not race */
-       watch = idr_find(&dev->idr, wd);
-       if (likely(watch))
+       if (likely(idr_find(&dev->idr, wd) == watch))
                remove_watch(watch, dev);
 
        mutex_unlock(&dev->mutex);
index d4d0c41490cddad3a99c89727dd848a405693520..1d46677afd172b5742a4ccd2472b4d59f82a2800 100644 (file)
@@ -438,7 +438,8 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
        if (c->mtd->point) {
                err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer);
                if (!err && retlen < tn->csize) {
-                       JFFS2_WARNING("MTD point returned len too short: %u instead of %u.\n", retlen, tn->csize);
+                       JFFS2_WARNING("MTD point returned len too short: %zu "
+                                       "instead of %u.\n", retlen, tn->csize);
                        c->mtd->unpoint(c->mtd, buffer, ofs, len);
                } else if (err)
                        JFFS2_WARNING("MTD point failed: error code %d.\n", err);
@@ -461,7 +462,8 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
                }
 
                if (retlen != len) {
-                       JFFS2_ERROR("short read at %#08x: %d instead of %d.\n", ofs, retlen, len);
+                       JFFS2_ERROR("short read at %#08x: %zd instead of %d.\n",
+                                       ofs, retlen, len);
                        err = -EIO;
                        goto free_out;
                }
index f28696f235c4be9932a8da84807cc2033e11a3dc..2b220dd6b4e7290976dc3e37765eeb6d9ec08a5e 100644 (file)
@@ -542,7 +542,7 @@ add_failed:
 static int metapage_releasepage(struct page *page, gfp_t gfp_mask)
 {
        struct metapage *mp;
-       int busy = 0;
+       int ret = 1;
        unsigned int offset;
 
        for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
@@ -552,30 +552,20 @@ static int metapage_releasepage(struct page *page, gfp_t gfp_mask)
                        continue;
 
                jfs_info("metapage_releasepage: mp = 0x%p", mp);
-               if (mp->count || mp->nohomeok) {
+               if (mp->count || mp->nohomeok ||
+                   test_bit(META_dirty, &mp->flag)) {
                        jfs_info("count = %ld, nohomeok = %d", mp->count,
                                 mp->nohomeok);
-                       busy = 1;
+                       ret = 0;
                        continue;
                }
-               wait_on_page_writeback(page);
-               //WARN_ON(test_bit(META_dirty, &mp->flag));
-               if (test_bit(META_dirty, &mp->flag)) {
-                       dump_mem("dirty mp in metapage_releasepage", mp,
-                                sizeof(struct metapage));
-                       dump_mem("page", page, sizeof(struct page));
-                       dump_stack();
-               }
                if (mp->lsn)
                        remove_from_logsync(mp);
                remove_metapage(page, mp);
                INCREMENT(mpStat.pagefree);
                free_metapage(mp);
        }
-       if (busy)
-               return -1;
-
-       return 0;
+       return ret;
 }
 
 static void metapage_invalidatepage(struct page *page, unsigned long offset)
index 6f99c0a6f83629fbaa3eaaaf853fb6b7b9a9cfcc..ab61a8b548292c025c86a4ba87db4dcab08015d8 100644 (file)
@@ -755,6 +755,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
        if (request->fl_type == F_UNLCK)
                goto out;
 
+       error = -ENOMEM;
        new_fl = locks_alloc_lock();
        if (new_fl == NULL)
                goto out;
@@ -781,6 +782,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
        locks_copy_lock(new_fl, request);
        locks_insert_lock(&inode->i_flock, new_fl);
        new_fl = NULL;
+       error = 0;
 
 out:
        unlock_kernel();
index 96723ae83c89d5283b335320b7b4315145a02d6b..d6e2ee251736b4eb9bc692e4f0057af5633942c7 100644 (file)
@@ -1080,8 +1080,8 @@ static int fastcall do_path_lookup(int dfd, const char *name,
        nd->flags = flags;
        nd->depth = 0;
 
-       read_lock(&current->fs->lock);
        if (*name=='/') {
+               read_lock(&current->fs->lock);
                if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
                        nd->mnt = mntget(current->fs->altrootmnt);
                        nd->dentry = dget(current->fs->altroot);
@@ -1092,33 +1092,35 @@ static int fastcall do_path_lookup(int dfd, const char *name,
                }
                nd->mnt = mntget(current->fs->rootmnt);
                nd->dentry = dget(current->fs->root);
+               read_unlock(&current->fs->lock);
        } else if (dfd == AT_FDCWD) {
+               read_lock(&current->fs->lock);
                nd->mnt = mntget(current->fs->pwdmnt);
                nd->dentry = dget(current->fs->pwd);
+               read_unlock(&current->fs->lock);
        } else {
                struct dentry *dentry;
 
                file = fget_light(dfd, &fput_needed);
                retval = -EBADF;
                if (!file)
-                       goto unlock_fail;
+                       goto out_fail;
 
                dentry = file->f_dentry;
 
                retval = -ENOTDIR;
                if (!S_ISDIR(dentry->d_inode->i_mode))
-                       goto fput_unlock_fail;
+                       goto fput_fail;
 
                retval = file_permission(file, MAY_EXEC);
                if (retval)
-                       goto fput_unlock_fail;
+                       goto fput_fail;
 
                nd->mnt = mntget(file->f_vfsmnt);
                nd->dentry = dget(dentry);
 
                fput_light(file, fput_needed);
        }
-       read_unlock(&current->fs->lock);
        current->total_link_count = 0;
        retval = link_path_walk(name, nd);
 out:
@@ -1127,13 +1129,12 @@ out:
                                nd->dentry->d_inode))
                audit_inode(name, nd->dentry->d_inode, flags);
        }
+out_fail:
        return retval;
 
-fput_unlock_fail:
+fput_fail:
        fput_light(file, fput_needed);
-unlock_fail:
-       read_unlock(&current->fs->lock);
-       return retval;
+       goto out_fail;
 }
 
 int fastcall path_lookup(const char *name, unsigned int flags,
index 2c5f1f80bdc28b868cb81aabecdae71bc9c6b480..bf478addb852b70c1ec036e33100f93031c5dc6b 100644 (file)
@@ -899,13 +899,11 @@ static int do_change_type(struct nameidata *nd, int flag)
 /*
  * do loopback mount.
  */
-static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags, int mnt_flags)
+static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
 {
        struct nameidata old_nd;
        struct vfsmount *mnt = NULL;
-       int recurse = flags & MS_REC;
        int err = mount_is_safe(nd);
-
        if (err)
                return err;
        if (!old_name || !*old_name)
@@ -939,7 +937,6 @@ static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags
                spin_unlock(&vfsmount_lock);
                release_mounts(&umount_list);
        }
-       mnt->mnt_flags = mnt_flags;
 
 out:
        up_write(&namespace_sem);
@@ -1353,7 +1350,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
                retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
                                    data_page);
        else if (flags & MS_BIND)
-               retval = do_loopback(&nd, dev_name, flags, mnt_flags);
+               retval = do_loopback(&nd, dev_name, flags & MS_REC);
        else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
                retval = do_change_type(&nd, flags);
        else if (flags & MS_MOVE)
index 4e0578121d9a621f0d36737582140e4573c464db..3eec30000f3fb3955e029283e8a26bee184b66ba 100644 (file)
@@ -1066,9 +1066,11 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
                rv = nfserr_perm;
        else if (IS_ERR(exp))
                rv = nfserrno(PTR_ERR(exp));
-       else
+       else {
                rv = fh_compose(fhp, exp,
                                fsid_key->ek_dentry, NULL);
+               exp_put(exp);
+       }
        cache_put(&fsid_key->h, &svc_expkey_cache);
        return rv;
 }
index 6aa92d0e68764a7b4ef0ab7de0f34003570f71f8..1d65f13f458c402c608cc3ca0b94bbf1c7e9806c 100644 (file)
@@ -1922,11 +1922,10 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
                value = kmalloc(size, GFP_KERNEL);
                if (!value)
                        return -ENOMEM;
-               size = posix_acl_to_xattr(acl, value, size);
-               if (size < 0) {
-                       error = size;
+               error = posix_acl_to_xattr(acl, value, size);
+               if (error < 0)
                        goto getout;
-               }
+               size = error;
        } else
                size = 0;
 
index 0d858d0b25be70f496e1fb0ec863ec4778ae3c57..47152bf9a7f26cdfb82cd02240e5546ba3e47485 100644 (file)
@@ -276,13 +276,29 @@ static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
        return ret;
 }
 
+/* This can also be called from ocfs2_write_zero_page() which has done
+ * it's own cluster locking. */
+int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,
+                              unsigned from, unsigned to)
+{
+       int ret;
+
+       down_read(&OCFS2_I(inode)->ip_alloc_sem);
+
+       ret = block_prepare_write(page, from, to, ocfs2_get_block);
+
+       up_read(&OCFS2_I(inode)->ip_alloc_sem);
+
+       return ret;
+}
+
 /*
  * ocfs2_prepare_write() can be an outer-most ocfs2 call when it is called
  * from loopback.  It must be able to perform its own locking around
  * ocfs2_get_block().
  */
-int ocfs2_prepare_write(struct file *file, struct page *page,
-                       unsigned from, unsigned to)
+static int ocfs2_prepare_write(struct file *file, struct page *page,
+                              unsigned from, unsigned to)
 {
        struct inode *inode = page->mapping->host;
        int ret;
@@ -295,11 +311,7 @@ int ocfs2_prepare_write(struct file *file, struct page *page,
                goto out;
        }
 
-       down_read(&OCFS2_I(inode)->ip_alloc_sem);
-
-       ret = block_prepare_write(page, from, to, ocfs2_get_block);
-
-       up_read(&OCFS2_I(inode)->ip_alloc_sem);
+       ret = ocfs2_prepare_write_nolock(inode, page, from, to);
 
        ocfs2_meta_unlock(inode, 0);
 out:
@@ -625,11 +637,31 @@ static ssize_t ocfs2_direct_IO(int rw,
        int ret;
 
        mlog_entry_void();
+
+       /*
+        * We get PR data locks even for O_DIRECT.  This allows
+        * concurrent O_DIRECT I/O but doesn't let O_DIRECT with
+        * extending and buffered zeroing writes race.  If they did
+        * race then the buffered zeroing could be written back after
+        * the O_DIRECT I/O.  It's one thing to tell people not to mix
+        * buffered and O_DIRECT writes, but expecting them to
+        * understand that file extension is also an implicit buffered
+        * write is too much.  By getting the PR we force writeback of
+        * the buffered zeroing before proceeding.
+        */
+       ret = ocfs2_data_lock(inode, 0);
+       if (ret < 0) {
+               mlog_errno(ret);
+               goto out;
+       }
+       ocfs2_data_unlock(inode, 0);
+
        ret = blockdev_direct_IO_no_locking(rw, iocb, inode,
                                            inode->i_sb->s_bdev, iov, offset,
                                            nr_segs, 
                                            ocfs2_direct_IO_get_blocks,
                                            ocfs2_dio_end_io);
+out:
        mlog_exit(ret);
        return ret;
 }
index d40456d509a00e8ddecac4e28a26d1482140f23f..e88c3f0b8fa9f3bfc5078f992360cd3cbea8f69c 100644 (file)
@@ -22,8 +22,8 @@
 #ifndef OCFS2_AOPS_H
 #define OCFS2_AOPS_H
 
-int ocfs2_prepare_write(struct file *file, struct page *page,
-                       unsigned from, unsigned to);
+int ocfs2_prepare_write_nolock(struct inode *inode, struct page *page,
+                              unsigned from, unsigned to);
 
 struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode,
                                                         struct page *page,
index 4601fc256f111254e41d124d08e95f216357b11e..1a5c69071df642afbe99a04ed348b33c955c9861 100644 (file)
@@ -569,7 +569,7 @@ static int ocfs2_extent_map_insert(struct inode *inode,
 
        ret = -ENOMEM;
        ctxt.new_ent = kmem_cache_alloc(ocfs2_em_ent_cachep,
-                                       GFP_KERNEL);
+                                       GFP_NOFS);
        if (!ctxt.new_ent) {
                mlog_errno(ret);
                return ret;
@@ -583,14 +583,14 @@ static int ocfs2_extent_map_insert(struct inode *inode,
                if (ctxt.need_left && !ctxt.left_ent) {
                        ctxt.left_ent =
                                kmem_cache_alloc(ocfs2_em_ent_cachep,
-                                                GFP_KERNEL);
+                                                GFP_NOFS);
                        if (!ctxt.left_ent)
                                break;
                }
                if (ctxt.need_right && !ctxt.right_ent) {
                        ctxt.right_ent =
                                kmem_cache_alloc(ocfs2_em_ent_cachep,
-                                                GFP_KERNEL);
+                                                GFP_NOFS);
                        if (!ctxt.right_ent)
                                break;
                }
index 581eb451a41a36796a2a2d55b7463028d4dae10e..a9559c874530ebee3e5ccacefbccc03058af3ca7 100644 (file)
@@ -613,7 +613,8 @@ leave:
 
 /* Some parts of this taken from generic_cont_expand, which turned out
  * to be too fragile to do exactly what we need without us having to
- * worry about recursive locking in ->commit_write(). */
+ * worry about recursive locking in ->prepare_write() and
+ * ->commit_write(). */
 static int ocfs2_write_zero_page(struct inode *inode,
                                 u64 size)
 {
@@ -641,7 +642,7 @@ static int ocfs2_write_zero_page(struct inode *inode,
                goto out;
        }
 
-       ret = ocfs2_prepare_write(NULL, page, offset, offset);
+       ret = ocfs2_prepare_write_nolock(inode, page, offset, offset);
        if (ret < 0) {
                mlog_errno(ret);
                goto out_unlock;
@@ -695,13 +696,26 @@ out:
        return ret;
 }
 
+/* 
+ * A tail_to_skip value > 0 indicates that we're being called from
+ * ocfs2_file_aio_write(). This has the following implications:
+ *
+ * - we don't want to update i_size
+ * - di_bh will be NULL, which is fine because it's only used in the
+ *   case where we want to update i_size.
+ * - ocfs2_zero_extend() will then only be filling the hole created
+ *   between i_size and the start of the write.
+ */
 static int ocfs2_extend_file(struct inode *inode,
                             struct buffer_head *di_bh,
-                            u64 new_i_size)
+                            u64 new_i_size,
+                            size_t tail_to_skip)
 {
        int ret = 0;
        u32 clusters_to_add;
 
+       BUG_ON(!tail_to_skip && !di_bh);
+
        /* setattr sometimes calls us like this. */
        if (new_i_size == 0)
                goto out;
@@ -714,27 +728,44 @@ static int ocfs2_extend_file(struct inode *inode,
                OCFS2_I(inode)->ip_clusters;
 
        if (clusters_to_add) {
-               ret = ocfs2_extend_allocation(inode, clusters_to_add);
+               /* 
+                * protect the pages that ocfs2_zero_extend is going to
+                * be pulling into the page cache.. we do this before the
+                * metadata extend so that we don't get into the situation
+                * where we've extended the metadata but can't get the data
+                * lock to zero.
+                */
+               ret = ocfs2_data_lock(inode, 1);
                if (ret < 0) {
                        mlog_errno(ret);
                        goto out;
                }
 
-               ret = ocfs2_zero_extend(inode, new_i_size);
+               ret = ocfs2_extend_allocation(inode, clusters_to_add);
                if (ret < 0) {
                        mlog_errno(ret);
-                       goto out;
+                       goto out_unlock;
                }
-       } 
 
-       /* No allocation required, we just use this helper to
-        * do a trivial update of i_size. */
-       ret = ocfs2_simple_size_update(inode, di_bh, new_i_size);
-       if (ret < 0) {
-               mlog_errno(ret);
-               goto out;
+               ret = ocfs2_zero_extend(inode, (u64)new_i_size - tail_to_skip);
+               if (ret < 0) {
+                       mlog_errno(ret);
+                       goto out_unlock;
+               }
+       }
+
+       if (!tail_to_skip) {
+               /* We're being called from ocfs2_setattr() which wants
+                * us to update i_size */
+               ret = ocfs2_simple_size_update(inode, di_bh, new_i_size);
+               if (ret < 0)
+                       mlog_errno(ret);
        }
 
+out_unlock:
+       if (clusters_to_add) /* this is the only case in which we lock */
+               ocfs2_data_unlock(inode, 1);
+
 out:
        return ret;
 }
@@ -793,7 +824,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
                if (i_size_read(inode) > attr->ia_size)
                        status = ocfs2_truncate_file(inode, bh, attr->ia_size);
                else
-                       status = ocfs2_extend_file(inode, bh, attr->ia_size);
+                       status = ocfs2_extend_file(inode, bh, attr->ia_size, 0);
                if (status < 0) {
                        if (status != -ENOSPC)
                                mlog_errno(status);
@@ -1049,21 +1080,12 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
                if (!clusters)
                        break;
 
-               ret = ocfs2_extend_allocation(inode, clusters);
+               ret = ocfs2_extend_file(inode, NULL, newsize, count);
                if (ret < 0) {
                        if (ret != -ENOSPC)
                                mlog_errno(ret);
                        goto out;
                }
-
-               /* Fill any holes which would've been created by this
-                * write. If we're O_APPEND, this will wind up
-                * (correctly) being a noop. */
-               ret = ocfs2_zero_extend(inode, (u64) newsize - count);
-               if (ret < 0) {
-                       mlog_errno(ret);
-                       goto out;
-               }
                break;
        }
 
@@ -1146,6 +1168,22 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
                ocfs2_iocb_set_rw_locked(iocb);
        }
 
+       /*
+        * We're fine letting folks race truncates and extending
+        * writes with read across the cluster, just like they can
+        * locally. Hence no rw_lock during read.
+        * 
+        * Take and drop the meta data lock to update inode fields
+        * like i_size. This allows the checks down below
+        * generic_file_aio_read() a chance of actually working. 
+        */
+       ret = ocfs2_meta_lock(inode, NULL, NULL, 0);
+       if (ret < 0) {
+               mlog_errno(ret);
+               goto bail;
+       }
+       ocfs2_meta_unlock(inode, 0);
+
        ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos);
        if (ret == -EINVAL)
                mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
index 6a610ae5358394710688e518d022f25e85a51b41..eebc3cfa6be8c89dd5a55a8910ad4b1f3c9d2827 100644 (file)
@@ -117,7 +117,7 @@ struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
 {
        struct ocfs2_journal_handle *retval = NULL;
 
-       retval = kcalloc(1, sizeof(*retval), GFP_KERNEL);
+       retval = kcalloc(1, sizeof(*retval), GFP_NOFS);
        if (!retval) {
                mlog(ML_ERROR, "Failed to allocate memory for journal "
                     "handle!\n");
@@ -870,9 +870,11 @@ static int ocfs2_force_read_journal(struct inode *inode)
                if (p_blocks > CONCURRENT_JOURNAL_FILL)
                        p_blocks = CONCURRENT_JOURNAL_FILL;
 
+               /* We are reading journal data which should not
+                * be put in the uptodate cache */
                status = ocfs2_read_blocks(OCFS2_SB(inode->i_sb),
                                           p_blkno, p_blocks, bhs, 0,
-                                          inode);
+                                          NULL);
                if (status < 0) {
                        mlog_errno(status);
                        goto bail;
@@ -982,7 +984,7 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal,
 {
        struct ocfs2_la_recovery_item *item;
 
-       item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_KERNEL);
+       item = kmalloc(sizeof(struct ocfs2_la_recovery_item), GFP_NOFS);
        if (!item) {
                /* Though we wish to avoid it, we are in fact safe in
                 * skipping local alloc cleanup as fsck.ocfs2 is more
index 04a684dfdd96be735036db62b4c67a1a7cb65197..b8a00a79332676dd8956a10180926a2b580a7213 100644 (file)
@@ -337,7 +337,7 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_inode_info *oi,
             (unsigned long long)oi->ip_blkno,
             (unsigned long long)block, expand_tree);
 
-       new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_KERNEL);
+       new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS);
        if (!new) {
                mlog_errno(-ENOMEM);
                return;
@@ -349,7 +349,7 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_inode_info *oi,
                 * has no way of tracking that. */
                for(i = 0; i < OCFS2_INODE_MAX_CACHE_ARRAY; i++) {
                        tree[i] = kmem_cache_alloc(ocfs2_uptodate_cachep,
-                                                  GFP_KERNEL);
+                                                  GFP_NOFS);
                        if (!tree[i]) {
                                mlog_errno(-ENOMEM);
                                goto out_free;
index 53049a20419768b3c00eea23fb6acf4ff4c71c0a..ee42765a8553e9c5ed51e47805f9bd1440679399 100644 (file)
@@ -586,7 +586,7 @@ static struct ocfs2_net_wait_ctxt *ocfs2_new_net_wait_ctxt(unsigned int response
 {
        struct ocfs2_net_wait_ctxt *w;
 
-       w = kcalloc(1, sizeof(*w), GFP_KERNEL);
+       w = kcalloc(1, sizeof(*w), GFP_NOFS);
        if (!w) {
                mlog_errno(-ENOMEM);
                goto bail;
@@ -749,7 +749,7 @@ static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb,
 
        BUG_ON(!ocfs2_is_valid_vote_request(type));
 
-       request = kcalloc(1, sizeof(*request), GFP_KERNEL);
+       request = kcalloc(1, sizeof(*request), GFP_NOFS);
        if (!request) {
                mlog_errno(-ENOMEM);
        } else {
@@ -1129,7 +1129,7 @@ static int ocfs2_handle_vote_message(struct o2net_msg *msg,
        struct ocfs2_super *osb = data;
        struct ocfs2_vote_work *work;
 
-       work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_KERNEL);
+       work = kmalloc(sizeof(struct ocfs2_vote_work), GFP_NOFS);
        if (!work) {
                status = -ENOMEM;
                mlog_errno(status);
index 53ec28c367770d5704ecdb24f7549470cb0ccf6a..317b7c7f38a73aac8cc8f3edc463919dabb2f947 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -1124,7 +1124,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
        prevent_tail_call(ret);
        return ret;
 }
-EXPORT_SYMBOL_GPL(sys_openat);
 
 #ifndef __alpha__
 
index 45ae7dd3c650399baafe5c8d20cc3b6734181d7a..7ef1f094de911998a88fe76bda393f136d60ec3c 100644 (file)
@@ -533,6 +533,7 @@ void del_gendisk(struct gendisk *disk)
 
        devfs_remove_disk(disk);
 
+       kobject_uevent(&disk->kobj, KOBJ_REMOVE);
        if (disk->holder_dir)
                kobject_unregister(disk->holder_dir);
        if (disk->slave_dir)
@@ -545,7 +546,7 @@ void del_gendisk(struct gendisk *disk)
                        kfree(disk_name);
                }
                put_device(disk->driverfs_dev);
+               disk->driverfs_dev = NULL;
        }
-       kobject_uevent(&disk->kobj, KOBJ_REMOVE);
        kobject_del(&disk->kobj);
 }
index 34c7a11d91f0ebbb29854a0116d8c558825fbbbc..70d9c5a37f5a3c6f7d5cad12e7bad8e1d2e21136 100644 (file)
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
        if (dentry->d_name.len > SMB_MAXNAMELEN)
                goto out;
 
+       /* Do not allow lookup of names with backslashes in */
+       error = -EINVAL;
+       if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
+               goto out;
+
        lock_kernel();
        error = smb_proc_getattr(dentry, &finfo);
 #ifdef SMBFS_PARANOIA
index c71c375863cc473a254462d8187365cecb302367..c71dd2760d3254da61b60a06ea2a9732837ea072 100644 (file)
@@ -339,9 +339,11 @@ int smb_add_request(struct smb_request *req)
                /*
                 * On timeout or on interrupt we want to try and remove the
                 * request from the recvq/xmitq.
+                * First check if the request is still part of a queue. (May
+                * have been removed by some error condition)
                 */
                smb_lock_server(server);
-               if (!(req->rq_flags & SMB_REQ_RECEIVED)) {
+               if (!list_empty(&req->rq_queue)) {
                        list_del_init(&req->rq_queue);
                        smb_rput(req);
                }
index e27dc8f299722f690d042adf47ae4ea3a54e94ef..b9beceb33141706bbf755792299d113b8dccd11e 100644 (file)
@@ -63,7 +63,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20060127
+#define ACPI_CA_VERSION                 0x20060608
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
@@ -81,6 +81,7 @@
 #define ACPI_MAX_PARSE_CACHE_DEPTH      96     /* Parse tree objects */
 #define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96     /* Parse tree objects */
 #define ACPI_MAX_OBJECT_CACHE_DEPTH     96     /* Interpreter operand objects */
+#define ACPI_MAX_NAMESPACE_CACHE_DEPTH  96     /* Namespace objects */
 
 /*
  * Should the subsystem abort the loading of an ACPI table if the
 
 #define ACPI_MAX_SEMAPHORE_COUNT        256
 
-/* Max reference count (for debug only) */
+/* Maximum object reference count (detects object deletion issues) */
 
-#define ACPI_MAX_REFERENCE_COUNT        0x400
+#define ACPI_MAX_REFERENCE_COUNT        0x800
 
 /* Size of cached memory mapping for system memory operation region */
 
 
 /* Array sizes.  Used for range checking also */
 
-#define ACPI_NUM_ACCESS_TYPES           6
-#define ACPI_NUM_UPDATE_RULES           3
-#define ACPI_NUM_LOCK_RULES             2
-#define ACPI_NUM_MATCH_OPS              6
-#define ACPI_NUM_OPCODES                256
-#define ACPI_NUM_FIELD_NAMES            2
+#define ACPI_MAX_MATCH_OPCODE           5
 
 /* RSDP checksums */
 
 
 #define ACPI_SMBUS_BUFFER_SIZE          34
 
-/* Number of strings associated with the _OSI reserved method */
-
-#define ACPI_NUM_OSI_STRINGS            10
-
 /******************************************************************************
  *
  * ACPI AML Debugger
index 11a8fe39cb044d0d1090d331dd6acfb904bf9628..9a7d6921f53424098322b2df79d6ba9b468f90bf 100644 (file)
 #define BLOCK_PAREN             1
 #define BLOCK_BRACE             2
 #define BLOCK_COMMA_LIST        4
+#define ACPI_DEFAULT_RESNAME    *(u32 *) "__RD"
 
 struct acpi_external_list {
        char *path;
+       char *internal_path;
        struct acpi_external_list *next;
+       u32 value;
+       u16 length;
+       u8 type;
 };
 
 extern struct acpi_external_list *acpi_gbl_external_list;
 
-/* Strings used for decoding flags to ASL keywords */
+typedef const struct acpi_dmtable_info {
+       u8 opcode;
+       u8 offset;
+       char *name;
+
+} acpi_dmtable_info;
+
+/*
+ * Values for Opcode above.
+ * Note: 0-7 must not change, used as a flag shift value
+ */
+#define ACPI_DMT_FLAG0                  0
+#define ACPI_DMT_FLAG1                  1
+#define ACPI_DMT_FLAG2                  2
+#define ACPI_DMT_FLAG3                  3
+#define ACPI_DMT_FLAG4                  4
+#define ACPI_DMT_FLAG5                  5
+#define ACPI_DMT_FLAG6                  6
+#define ACPI_DMT_FLAG7                  7
+#define ACPI_DMT_FLAGS0                 8
+#define ACPI_DMT_FLAGS2                 9
+#define ACPI_DMT_UINT8                  10
+#define ACPI_DMT_UINT16                 11
+#define ACPI_DMT_UINT24                 12
+#define ACPI_DMT_UINT32                 13
+#define ACPI_DMT_UINT56                 14
+#define ACPI_DMT_UINT64                 15
+#define ACPI_DMT_STRING                 16
+#define ACPI_DMT_NAME4                  17
+#define ACPI_DMT_NAME6                  18
+#define ACPI_DMT_NAME8                  19
+#define ACPI_DMT_CHKSUM                 20
+#define ACPI_DMT_SPACEID                21
+#define ACPI_DMT_GAS                    22
+#define ACPI_DMT_MADT                   23
+#define ACPI_DMT_SRAT                   24
+#define ACPI_DMT_EXIT                   25
 
-extern const char *acpi_gbl_word_decode[4];
-extern const char *acpi_gbl_irq_decode[2];
-extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
-extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
-extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
-extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
+typedef
+void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
+
+struct acpi_dmtable_data {
+       char *signature;
+       struct acpi_dmtable_info *table_info;
+       ACPI_TABLE_HANDLER table_handler;
+};
 
 struct acpi_op_walk_info {
        u32 level;
+       u32 last_level;
+       u32 count;
        u32 bit_offset;
+       u32 flags;
        struct acpi_walk_state *walk_state;
 };
 
@@ -77,6 +123,100 @@ typedef
 acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
                                 u32 level, void *context);
 
+struct acpi_resource_tag {
+       u32 bit_index;
+       char *tag;
+};
+
+/* Strings used for decoding flags to ASL keywords */
+
+extern const char *acpi_gbl_word_decode[];
+extern const char *acpi_gbl_irq_decode[];
+extern const char *acpi_gbl_lock_rule[];
+extern const char *acpi_gbl_access_types[];
+extern const char *acpi_gbl_update_rules[];
+extern const char *acpi_gbl_match_ops[];
+
+extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
+extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
+extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
+extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
+extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
+extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
+extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
+extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
+extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
+extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
+extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
+extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
+extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
+extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
+extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
+extern struct acpi_dmtable_info acpi_dm_table_info_header[];
+extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
+extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
+extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
+extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
+extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
+extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
+extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
+extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
+extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
+extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
+extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
+extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
+extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
+extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
+
+/*
+ * dmtable
+ */
+void acpi_dm_dump_data_table(struct acpi_table_header *table);
+
+void
+acpi_dm_dump_table(u32 table_length,
+                  u32 table_offset,
+                  void *table,
+                  u32 sub_table_length, struct acpi_dmtable_info *info);
+
+void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
+
+void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
+
+/*
+ * dmtbdump
+ */
+void acpi_dm_dump_asf(struct acpi_table_header *table);
+
+void acpi_dm_dump_cpep(struct acpi_table_header *table);
+
+void acpi_dm_dump_fadt(struct acpi_table_header *table);
+
+void acpi_dm_dump_srat(struct acpi_table_header *table);
+
+void acpi_dm_dump_mcfg(struct acpi_table_header *table);
+
+void acpi_dm_dump_madt(struct acpi_table_header *table);
+
+u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
+
+void acpi_dm_dump_rsdt(struct acpi_table_header *table);
+
+void acpi_dm_dump_slit(struct acpi_table_header *table);
+
+void acpi_dm_dump_xsdt(struct acpi_table_header *table);
+
 /*
  * dmwalk
  */
@@ -84,6 +224,11 @@ void
 acpi_dm_disassemble(struct acpi_walk_state *walk_state,
                    union acpi_parse_object *origin, u32 num_opcodes);
 
+void
+acpi_dm_walk_parse_tree(union acpi_parse_object *op,
+                       asl_walk_callback descending_callback,
+                       asl_walk_callback ascending_callback, void *context);
+
 /*
  * dmopcode
  */
@@ -166,6 +311,7 @@ void acpi_dm_dump_integer64(u64 value, char *name);
 
 void
 acpi_dm_resource_template(struct acpi_op_walk_info *info,
+                         union acpi_parse_object *op,
                          u8 * byte_data, u32 byte_count);
 
 u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
@@ -176,6 +322,8 @@ void acpi_dm_bit_list(u16 mask);
 
 void acpi_dm_decode_attribute(u8 attribute);
 
+void acpi_dm_descriptor_name(void);
+
 /*
  * dmresrcl
  */
@@ -248,6 +396,15 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource,
 /*
  * dmutils
  */
-void acpi_dm_add_to_external_list(char *path);
+void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
+
+/*
+ * dmrestag
+ */
+void acpi_dm_find_resources(union acpi_parse_object *root);
+
+void
+acpi_dm_check_resource_reference(union acpi_parse_object *op,
+                                struct acpi_walk_state *walk_state);
 
 #endif                         /* __ACDISASM_H__ */
index c41a926ff3172f7d21af597ef6f4e3fc5f5b77f7..288f84903af76634e292d7d71615c5c3acbc0db6 100644 (file)
@@ -194,7 +194,9 @@ acpi_status
 acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
                               union acpi_operand_object *return_desc);
 
-void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state);
+void
+acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
+                                struct acpi_walk_state *walk_state);
 
 acpi_status
 acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
@@ -302,7 +304,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
                      struct acpi_namespace_node *method_node,
                      u8 * aml_start,
                      u32 aml_length,
-                     struct acpi_parameter_info *info, u8 pass_number);
+                     struct acpi_evaluate_info *info, u8 pass_number);
 
 acpi_status
 acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
index f2717be4fe0dc46c81d554df326168d07e857db0..234142828e1a7fb44dcdea286dda62f162292a16 100644 (file)
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
  */
 u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
 
-acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback);
+acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback);
 
 acpi_status
 acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
@@ -138,7 +138,7 @@ acpi_status
 acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
                               u32 function,
                               acpi_physical_address address,
-                              u32 bit_width, void *value);
+                              u32 bit_width, acpi_integer * value);
 
 acpi_status
 acpi_ev_attach_region(union acpi_operand_object *handler_obj,
index dc768aa580e461346bcb0c83ab7e2ce5b75658ee..797ca1ea5214612ab8bb2c593f11441eac7b38f3 100644 (file)
 #define AE_AML_BAD_RESOURCE_VALUE       (acpi_status) (0x001F | AE_CODE_AML)
 #define AE_AML_CIRCULAR_REFERENCE       (acpi_status) (0x0020 | AE_CODE_AML)
 #define AE_AML_BAD_RESOURCE_LENGTH      (acpi_status) (0x0021 | AE_CODE_AML)
+#define AE_AML_ILLEGAL_ADDRESS          (acpi_status) (0x0022 | AE_CODE_AML)
 
-#define AE_CODE_AML_MAX                 0x0021
+#define AE_CODE_AML_MAX                 0x0022
 
 /*
  * Internal exceptions used for control
@@ -275,7 +276,8 @@ char const *acpi_gbl_exception_names_aml[] = {
        "AE_AML_NO_RESOURCE_END_TAG",
        "AE_AML_BAD_RESOURCE_VALUE",
        "AE_AML_CIRCULAR_REFERENCE",
-       "AE_AML_BAD_RESOURCE_LENGTH"
+       "AE_AML_BAD_RESOURCE_LENGTH",
+       "AE_AML_ILLEGAL_ADDRESS"
 };
 
 char const *acpi_gbl_exception_names_ctrl[] = {
index 734cc77bf2c7ae885e82209b14c85d40cab6d04d..14531d48f6b63e48bd3c873741b3ccd5e99fed9f 100644 (file)
@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
  * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
  * 4) Allow ANY object type to be a source operand for the Store() operator
  * 5) Allow unresolved references (invalid target name) in package objects
+ * 6) Enable warning messages for behavior that is not ACPI spec compliant
  */
 ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
 
@@ -114,7 +115,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
  * Automatically serialize ALL control methods? Default is FALSE, meaning
  * to use the Serialized/not_serialized method flags on a per method basis.
  * Only change this if the ASL code is poorly written and cannot handle
- * reentrancy even though methods are marked "not_serialized".
+ * reentrancy even though methods are marked "NotSerialized".
  */
 ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
 
@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
 ACPI_EXTERN u32 acpi_gbl_table_flags;
 ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
 ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
+ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
+ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
 ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
-ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
+ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
 ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
 /*
  * Since there may be multiple SSDTs and PSDTs, a single pointer is not
@@ -177,15 +178,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
 /*
  * ACPI Table info arrays
  */
-extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
-extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
+extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
+extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
 
 /*
  * Predefined mutex objects.  This array contains the
  * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
  * (The table maps local handles to the real OS handles)
  */
-ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
+ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
 
 /*****************************************************************************
  *
@@ -203,6 +204,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
 
 /* Object caches */
 
+ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
 ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
 ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
 ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
@@ -244,7 +246,6 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
 extern const char *acpi_gbl_highest_dstate_names[4];
 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
-extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
 
 /*****************************************************************************
  *
@@ -289,14 +290,6 @@ ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
 
 ACPI_EXTERN u8 acpi_gbl_cm_single_step;
 
-/*****************************************************************************
- *
- * Parser globals
- *
- ****************************************************************************/
-
-ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
-
 /*****************************************************************************
  *
  * Hardware globals
@@ -321,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler
 ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
 ACPI_EXTERN struct acpi_gpe_block_info
     *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
+
+/* Spinlocks */
+
 ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
+ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock;
 
 /*****************************************************************************
  *
index 8361820d297088dbd887bd66278e105b1b445740..1eeca7adca9535c0549e94a13cca4f2362f9b91e 100644 (file)
 #ifndef __ACLOCAL_H__
 #define __ACLOCAL_H__
 
+/* acpisrc:struct_defs -- for acpisrc conversion */
+
 #define ACPI_WAIT_FOREVER               0xFFFF /* u16, as per ACPI spec */
+#define ACPI_INFINITE_CONCURRENCY       0xFF
 
 typedef void *acpi_mutex;
 typedef u32 acpi_mutex_handle;
@@ -69,52 +72,55 @@ union acpi_parse_object;
  * Predefined handles for the mutex objects used within the subsystem
  * All mutex objects are automatically created by acpi_ut_mutex_initialize.
  *
- * The acquire/release ordering protocol is implied via this list.  Mutexes
+ * The acquire/release ordering protocol is implied via this list. Mutexes
  * with a lower value must be acquired before mutexes with a higher value.
  *
- * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also!
+ * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
+ * table below also!
  */
-#define ACPI_MTX_EXECUTE                0
-#define ACPI_MTX_INTERPRETER            1
-#define ACPI_MTX_PARSER                 2
-#define ACPI_MTX_DISPATCHER             3
-#define ACPI_MTX_TABLES                 4
-#define ACPI_MTX_OP_REGIONS             5
-#define ACPI_MTX_NAMESPACE              6
-#define ACPI_MTX_EVENTS                 7
-#define ACPI_MTX_HARDWARE               8
-#define ACPI_MTX_CACHES                 9
-#define ACPI_MTX_MEMORY                 10
-#define ACPI_MTX_DEBUG_CMD_COMPLETE     11
-#define ACPI_MTX_DEBUG_CMD_READY        12
-
-#define MAX_MUTEX                       12
-#define NUM_MUTEX                       MAX_MUTEX+1
+#define ACPI_MTX_INTERPRETER            0      /* AML Interpreter, main lock */
+#define ACPI_MTX_CONTROL_METHOD         1      /* Control method termination [TBD: may no longer be necessary] */
+#define ACPI_MTX_TABLES                 2      /* Data for ACPI tables */
+#define ACPI_MTX_NAMESPACE              3      /* ACPI Namespace */
+#define ACPI_MTX_EVENTS                 4      /* Data for ACPI events */
+#define ACPI_MTX_CACHES                 5      /* Internal caches, general purposes */
+#define ACPI_MTX_MEMORY                 6      /* Debug memory tracking lists */
+#define ACPI_MTX_DEBUG_CMD_COMPLETE     7      /* AML debugger */
+#define ACPI_MTX_DEBUG_CMD_READY        8      /* AML debugger */
+
+#define ACPI_MAX_MUTEX                  8
+#define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
 
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 #ifdef DEFINE_ACPI_GLOBALS
 
-/* Names for the mutexes used in the subsystem */
+/* Debug names for the mutexes above */
 
-static char *acpi_gbl_mutex_names[] = {
-       "ACPI_MTX_Execute",
+static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
        "ACPI_MTX_Interpreter",
-       "ACPI_MTX_Parser",
-       "ACPI_MTX_Dispatcher",
+       "ACPI_MTX_Method",
        "ACPI_MTX_Tables",
-       "ACPI_MTX_op_regions",
        "ACPI_MTX_Namespace",
        "ACPI_MTX_Events",
-       "ACPI_MTX_Hardware",
        "ACPI_MTX_Caches",
        "ACPI_MTX_Memory",
-       "ACPI_MTX_debug_cmd_complete",
-       "ACPI_MTX_debug_cmd_ready",
+       "ACPI_MTX_DebugCmdComplete",
+       "ACPI_MTX_DebugCmdReady"
 };
 
 #endif
 #endif
 
+/*
+ * Predefined handles for spinlocks used within the subsystem.
+ * These spinlocks are created by acpi_ut_mutex_initialize
+ */
+#define ACPI_LOCK_GPES                  0
+#define ACPI_LOCK_HARDWARE              1
+
+#define ACPI_MAX_LOCK                   1
+#define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
+
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
 typedef u8 acpi_owner_id;
@@ -129,7 +135,7 @@ typedef u8 acpi_owner_id;
 struct acpi_mutex_info {
        acpi_mutex mutex;
        u32 use_count;
-       u32 thread_id;
+       acpi_thread_id thread_id;
 };
 
 /* Lock flag parameter for various interfaces */
@@ -144,6 +150,8 @@ struct acpi_mutex_info {
 #define ACPI_FIELD_DWORD_GRANULARITY    4
 #define ACPI_FIELD_QWORD_GRANULARITY    8
 
+#define ACPI_ENTRY_NOT_FOUND            NULL
+
 /*****************************************************************************
  *
  * Namespace typedefs and structs
@@ -158,49 +166,55 @@ typedef enum {
        ACPI_IMODE_EXECUTE = 0x0E
 } acpi_interpreter_mode;
 
-/*
- * The Node describes a named object that appears in the AML
- * An acpi_node is used to store Nodes.
- *
- * data_type is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
- */
 union acpi_name_union {
        u32 integer;
        char ascii[4];
 };
 
+/*
+ * The Namespace Node describes a named object that appears in the AML.
+ * descriptor_type is used to differentiate between internal descriptors.
+ *
+ * The node is optimized for both 32-bit and 64-bit platforms:
+ * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
+ *
+ * Note: The descriptor_type and Type fields must appear in the identical
+ * position in both the struct acpi_namespace_node and union acpi_operand_object
+ * structures.
+ */
 struct acpi_namespace_node {
-       u8 descriptor;          /* Used to differentiate object descriptor types */
-       u8 type;                /* Type associated with this name */
-       u16 reference_count;    /* Current count of references and children */
+       union acpi_operand_object *object;      /* Interpreter object */
+       u8 descriptor_type;     /* Differentiate object descriptor types */
+       u8 type;                /* ACPI Type associated with this name */
+       u8 flags;               /* Miscellaneous flags */
+       acpi_owner_id owner_id; /* Node creator */
        union acpi_name_union name;     /* ACPI Name, always 4 chars per ACPI spec */
-       union acpi_operand_object *object;      /* Pointer to attached ACPI object (optional) */
        struct acpi_namespace_node *child;      /* First child */
-       struct acpi_namespace_node *peer;       /* Next peer */
-       u8 owner_id;            /* Who created this node */
-       u8 flags;
-
-       /* Fields used by the ASL compiler only */
+       struct acpi_namespace_node *peer;       /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
 
-#ifdef ACPI_ASL_COMPILER
-       u32 value;
+       /*
+        * The following fields are used by the ASL compiler and disassembler only
+        */
+#ifdef ACPI_LARGE_NAMESPACE_NODE
        union acpi_parse_object *op;
+       u32 value;
+       u32 length;
 #endif
 };
 
-#define ACPI_ENTRY_NOT_FOUND            NULL
+/* Namespace Node flags */
 
-/* Node flags */
+#define ANOBJ_END_OF_PEER_LIST          0x01   /* End-of-list, Peer field points to parent */
+#define ANOBJ_DATA_WIDTH_32             0x02   /* Parent table uses 32-bit math */
+#define ANOBJ_METHOD_ARG                0x04   /* Node is a method argument */
+#define ANOBJ_METHOD_LOCAL              0x08   /* Node is a method local */
+#define ANOBJ_SUBTREE_HAS_INI           0x10   /* Used to optimize device initialization */
 
-#define ANOBJ_RESERVED                  0x01
-#define ANOBJ_END_OF_PEER_LIST          0x02
-#define ANOBJ_DATA_WIDTH_32             0x04   /* Parent table is 64-bits */
-#define ANOBJ_METHOD_ARG                0x08
-#define ANOBJ_METHOD_LOCAL              0x10
-#define ANOBJ_METHOD_NO_RETVAL          0x20
-#define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
-#define ANOBJ_IS_BIT_OFFSET             0x80
+#define ANOBJ_IS_EXTERNAL               0x08   /* i_aSL only: This object created via External() */
+#define ANOBJ_METHOD_NO_RETVAL          0x10   /* i_aSL only: Method has no return value */
+#define ANOBJ_METHOD_SOME_NO_RETVAL     0x20   /* i_aSL only: Method has at least one return value */
+#define ANOBJ_IS_BIT_OFFSET             0x40   /* i_aSL only: Reference is a bit offset */
+#define ANOBJ_IS_REFERENCED             0x80   /* i_aSL only: Object was referenced */
 
 /*
  * ACPI Table Descriptor.  One per ACPI table
@@ -212,8 +226,8 @@ struct acpi_table_desc {
        struct acpi_table_header *pointer;
        u8 *aml_start;
        u64 physical_address;
-       u32 aml_length;
        acpi_size length;
+       u32 aml_length;
        acpi_owner_id owner_id;
        u8 type;
        u8 allocation;
@@ -276,6 +290,9 @@ struct acpi_create_field_info {
        u8 field_type;
 };
 
+typedef
+acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
+
 /*
  * Bitmapped ACPI types.  Used internally only
  */
@@ -377,7 +394,7 @@ struct acpi_gpe_walk_info {
        struct acpi_gpe_block_info *gpe_block;
 };
 
-typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info *
+typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
                                         gpe_xrupt_info,
                                         struct acpi_gpe_block_info *
                                         gpe_block);
@@ -416,13 +433,14 @@ struct acpi_field_info {
 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
 
-#define ACPI_STATE_COMMON   /* Two 32-bit fields and a pointer */\
-       u8                                  data_type;  /* To differentiate various internal objs */\
-       u8                                  flags;      \
-       u16                                 value;      \
-       u16                                 state;      \
-       u16                                 reserved;   \
-       void                                *next;
+#define ACPI_STATE_COMMON \
+       void                            *next; \
+       u8                              descriptor_type; /* To differentiate various internal objs */\
+       u8                              flags; \
+       u16                             value; \
+       u16                             state;
+
+       /* There are 2 bytes available here until the next natural alignment boundary */
 
 struct acpi_common_state {
 ACPI_STATE_COMMON};
@@ -438,12 +456,12 @@ struct acpi_update_state {
  * Pkg state - used to traverse nested package structures
  */
 struct acpi_pkg_state {
-       ACPI_STATE_COMMON union acpi_operand_object *source_object;
+       ACPI_STATE_COMMON u16 index;
+       union acpi_operand_object *source_object;
        union acpi_operand_object *dest_object;
        struct acpi_walk_state *walk_state;
        void *this_target_obj;
        u32 num_packages;
-       u16 index;
 };
 
 /*
@@ -451,10 +469,10 @@ struct acpi_pkg_state {
  * Allows nesting of these constructs
  */
 struct acpi_control_state {
-       ACPI_STATE_COMMON union acpi_parse_object *predicate_op;
+       ACPI_STATE_COMMON u16 opcode;
+       union acpi_parse_object *predicate_op;
        u8 *aml_predicate_start;        /* Start of if/while predicate */
        u8 *package_end;        /* End of if/while block */
-       u16 opcode;
 };
 
 /*
@@ -465,11 +483,11 @@ struct acpi_scope_state {
 };
 
 struct acpi_pscope_state {
-       ACPI_STATE_COMMON union acpi_parse_object *op;  /* Current op being parsed */
+       ACPI_STATE_COMMON u32 arg_count;        /* Number of fixed arguments */
+       union acpi_parse_object *op;    /* Current op being parsed */
        u8 *arg_end;            /* Current argument end */
        u8 *pkg_end;            /* Current package end */
        u32 arg_list;           /* Next argument to parse */
-       u32 arg_count;          /* Number of fixed arguments */
 };
 
 /*
@@ -477,10 +495,10 @@ struct acpi_pscope_state {
  * states are created when there are nested control methods executing.
  */
 struct acpi_thread_state {
-       ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list;      /* Head of list of walk_states for this thread */
+       ACPI_STATE_COMMON u8 current_sync_level;        /* Mutex Sync (nested acquire) level */
+       struct acpi_walk_state *walk_state_list;        /* Head of list of walk_states for this thread */
        union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
-       u32 thread_id;          /* Running thread ID */
-       u8 current_sync_level;  /* Mutex Sync (nested acquire) level */
+       acpi_thread_id thread_id;       /* Running thread ID */
 };
 
 /*
@@ -488,10 +506,9 @@ struct acpi_thread_state {
  * AML arguments
  */
 struct acpi_result_values {
-       ACPI_STATE_COMMON
-           union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
-       u8 num_results;
+       ACPI_STATE_COMMON u8 num_results;
        u8 last_insert;
+       union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
 };
 
 typedef
@@ -546,7 +563,7 @@ struct acpi_opcode_info {
 #endif
        u32 parse_args;         /* Grammar/Parse time arguments */
        u32 runtime_args;       /* Interpret time arguments */
-       u32 flags;              /* Misc flags */
+       u16 flags;              /* Misc flags */
        u8 object_type;         /* Corresponding internal object type */
        u8 class;               /* Opcode class */
        u8 type;                /* Opcode type */
@@ -563,29 +580,31 @@ union acpi_parse_value {
 };
 
 #define ACPI_PARSE_COMMON \
-       u8                                  data_type;      /* To differentiate various internal objs */\
-       u8                                  flags;          /* Type of Op */\
-       u16                                 aml_opcode;     /* AML opcode */\
-       u32                                 aml_offset;     /* Offset of declaration in AML */\
-       union acpi_parse_object             *parent;        /* Parent op */\
-       union acpi_parse_object             *next;          /* Next op */\
+       union acpi_parse_object         *parent;        /* Parent op */\
+       u8                              descriptor_type; /* To differentiate various internal objs */\
+       u8                              flags;          /* Type of Op */\
+       u16                             aml_opcode;     /* AML opcode */\
+       u32                             aml_offset;     /* Offset of declaration in AML */\
+       union acpi_parse_object         *next;          /* Next op */\
+       struct acpi_namespace_node      *node;          /* For use by interpreter */\
+       union acpi_parse_value          value;          /* Value or args associated with the opcode */\
        ACPI_DISASM_ONLY_MEMBERS (\
-       u8                                  disasm_flags;   /* Used during AML disassembly */\
-       u8                                  disasm_opcode;  /* Subtype used for disassembly */\
-       char                                aml_op_name[16]) /* Op name (debug only) */\
-                          /* NON-DEBUG members below: */\
-       struct acpi_namespace_node          *node;          /* For use by interpreter */\
-       union acpi_parse_value              value;      /* Value or args associated with the opcode */
-
-#define ACPI_DASM_BUFFER        0x00
-#define ACPI_DASM_RESOURCE      0x01
-#define ACPI_DASM_STRING        0x02
-#define ACPI_DASM_UNICODE       0x03
-#define ACPI_DASM_EISAID        0x04
-#define ACPI_DASM_MATCHOP       0x05
+       u8                              disasm_flags;   /* Used during AML disassembly */\
+       u8                              disasm_opcode;  /* Subtype used for disassembly */\
+       char                            aml_op_name[16])        /* Op name (debug only) */
+
+#define ACPI_DASM_BUFFER                0x00
+#define ACPI_DASM_RESOURCE              0x01
+#define ACPI_DASM_STRING                0x02
+#define ACPI_DASM_UNICODE               0x03
+#define ACPI_DASM_EISAID                0x04
+#define ACPI_DASM_MATCHOP               0x05
+#define ACPI_DASM_LNOT_PREFIX           0x06
+#define ACPI_DASM_LNOT_SUFFIX           0x07
+#define ACPI_DASM_IGNORE                0x08
 
 /*
- * generic operation (for example:  If, While, Store)
+ * Generic operation (for example:  If, While, Store)
  */
 struct acpi_parse_obj_common {
 ACPI_PARSE_COMMON};
@@ -601,7 +620,7 @@ struct acpi_parse_obj_named {
        u32 name;               /* 4-byte name or zero if no name */
 };
 
-/* The parse node is the fundamental element of the parse tree */
+/* This version is used by the i_aSL compiler only */
 
 #define ACPI_MAX_PARSEOP_NAME   20
 
@@ -643,7 +662,6 @@ union acpi_parse_object {
  * method.
  */
 struct acpi_parse_state {
-       u32 aml_size;
        u8 *aml_start;          /* First AML byte */
        u8 *aml;                /* Next AML byte */
        u8 *aml_end;            /* (last + 1) AML byte */
@@ -653,22 +671,23 @@ struct acpi_parse_state {
        struct acpi_namespace_node *start_node;
        union acpi_generic_state *scope;        /* Current scope */
        union acpi_parse_object *start_scope;
+       u32 aml_size;
 };
 
 /* Parse object flags */
 
-#define ACPI_PARSEOP_GENERIC                    0x01
-#define ACPI_PARSEOP_NAMED                      0x02
-#define ACPI_PARSEOP_DEFERRED                   0x04
-#define ACPI_PARSEOP_BYTELIST                   0x08
-#define ACPI_PARSEOP_IN_CACHE                   0x80
+#define ACPI_PARSEOP_GENERIC            0x01
+#define ACPI_PARSEOP_NAMED              0x02
+#define ACPI_PARSEOP_DEFERRED           0x04
+#define ACPI_PARSEOP_BYTELIST           0x08
+#define ACPI_PARSEOP_IN_CACHE           0x80
 
 /* Parse object disasm_flags */
 
-#define ACPI_PARSEOP_IGNORE                     0x01
-#define ACPI_PARSEOP_PARAMLIST                  0x02
-#define ACPI_PARSEOP_EMPTY_TERMLIST             0x04
-#define ACPI_PARSEOP_SPECIAL                    0x10
+#define ACPI_PARSEOP_IGNORE             0x01
+#define ACPI_PARSEOP_PARAMLIST          0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
+#define ACPI_PARSEOP_SPECIAL            0x10
 
 /*****************************************************************************
  *
@@ -676,8 +695,8 @@ struct acpi_parse_state {
  *
  ****************************************************************************/
 
-#define PCI_ROOT_HID_STRING         "PNP0A03"
-#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
+#define PCI_ROOT_HID_STRING             "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
 
 struct acpi_bit_register_info {
        u8 parent_register;
@@ -710,13 +729,14 @@ struct acpi_bit_register_info {
 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000 /* ACPI 3.0 */
 #define ACPI_BITMASK_WAKE_STATUS                0x8000
 
-#define ACPI_BITMASK_ALL_FIXED_STATUS           (ACPI_BITMASK_TIMER_STATUS          | \
-                        ACPI_BITMASK_BUS_MASTER_STATUS     | \
-                        ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
-                        ACPI_BITMASK_POWER_BUTTON_STATUS   | \
-                        ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
-                        ACPI_BITMASK_RT_CLOCK_STATUS       | \
-                        ACPI_BITMASK_WAKE_STATUS)
+#define ACPI_BITMASK_ALL_FIXED_STATUS           (\
+       ACPI_BITMASK_TIMER_STATUS          | \
+       ACPI_BITMASK_BUS_MASTER_STATUS     | \
+       ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
+       ACPI_BITMASK_POWER_BUTTON_STATUS   | \
+       ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
+       ACPI_BITMASK_RT_CLOCK_STATUS       | \
+       ACPI_BITMASK_WAKE_STATUS)
 
 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
@@ -820,7 +840,7 @@ struct acpi_bit_register_info {
  *
  ****************************************************************************/
 
-#define ACPI_ASCII_ZERO                         0x30
+#define ACPI_ASCII_ZERO                 0x30
 
 /*****************************************************************************
  *
@@ -842,9 +862,9 @@ struct acpi_integrity_info {
        u32 objects;
 };
 
-#define ACPI_DB_REDIRECTABLE_OUTPUT  0x01
-#define ACPI_DB_CONSOLE_OUTPUT       0x02
-#define ACPI_DB_DUPLICATE_OUTPUT     0x03
+#define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
+#define ACPI_DB_CONSOLE_OUTPUT          0x02
+#define ACPI_DB_DUPLICATE_OUTPUT        0x03
 
 /*****************************************************************************
  *
@@ -854,18 +874,18 @@ struct acpi_integrity_info {
 
 /* Entry for a memory allocation (debug only) */
 
-#define ACPI_MEM_MALLOC                      0
-#define ACPI_MEM_CALLOC                      1
-#define ACPI_MAX_MODULE_NAME                 16
+#define ACPI_MEM_MALLOC                 0
+#define ACPI_MEM_CALLOC                 1
+#define ACPI_MAX_MODULE_NAME            16
 
 #define ACPI_COMMON_DEBUG_MEM_HEADER \
-       struct acpi_debug_mem_block         *previous; \
-       struct acpi_debug_mem_block         *next; \
-       u32                                 size; \
-       u32                                 component; \
-       u32                                 line; \
-       char                                module[ACPI_MAX_MODULE_NAME]; \
-       u8                                  alloc_type;
+       struct acpi_debug_mem_block     *previous; \
+       struct acpi_debug_mem_block     *next; \
+       u32                             size; \
+       u32                             component; \
+       u32                             line; \
+       char                            module[ACPI_MAX_MODULE_NAME]; \
+       u8                              alloc_type;
 
 struct acpi_debug_mem_header {
 ACPI_COMMON_DEBUG_MEM_HEADER};
index f2be2a881730ca349440304d23aff3594101a281..38f9aa4bef00468d8771fcd8221260186f873fb1 100644 (file)
 #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
 #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
 
+/* Size calculation */
+
+#define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
+
 #if ACPI_MACHINE_WIDTH == 16
 
 /*
  * printf() format helpers
  */
 
-/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */
+/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
 
 #define ACPI_FORMAT_UINT64(i)           ACPI_HIDWORD(i),ACPI_LODWORD(i)
 
 #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i)
 #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p,(void *) NULL)
 #define ACPI_OFFSET(d,f)                (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
-#define ACPI_FADT_OFFSET(f)             ACPI_OFFSET (FADT_DESCRIPTOR, f)
 
 #if ACPI_MACHINE_WIDTH == 16
 #define ACPI_STORE_POINTER(d,s)         ACPI_MOVE_32_TO_32(d,s)
 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
 #endif
 
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
+#else
+#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
+#endif
+
 /*
  * Macros for moving data around to/from buffers that are possibly unaligned.
  * If the hardware supports the transfer of unaligned data, just do the store.
 /*
  * Rounding macros (Power of two boundaries only)
  */
-#define ACPI_ROUND_DOWN(value,boundary)      (((acpi_native_uint)(value)) & \
+#define ACPI_ROUND_DOWN(value,boundary)     (((acpi_native_uint)(value)) & \
                                                                                                (~(((acpi_native_uint) boundary)-1)))
 
-#define ACPI_ROUND_UP(value,boundary)        ((((acpi_native_uint)(value)) + \
+#define ACPI_ROUND_UP(value,boundary)       ((((acpi_native_uint)(value)) + \
                                                                                                (((acpi_native_uint) boundary)-1)) & \
                                                                                                (~(((acpi_native_uint) boundary)-1)))
 
-#define ACPI_ROUND_DOWN_TO_32_BITS(a)        ACPI_ROUND_DOWN(a,4)
-#define ACPI_ROUND_DOWN_TO_64_BITS(a)        ACPI_ROUND_DOWN(a,8)
-#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a)    ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+/* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */
+
+#define ACPI_ROUND_DOWN_TO_32BIT(a)         ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64BIT(a)         ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a)   ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint))
 
-#define ACPI_ROUND_UP_to_32_bITS(a)          ACPI_ROUND_UP(a,4)
-#define ACPI_ROUND_UP_to_64_bITS(a)          ACPI_ROUND_UP(a,8)
-#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)      ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_UP_TO_32BIT(a)           ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_TO_64BIT(a)           ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a)     ACPI_ROUND_UP(a,sizeof(acpi_native_uint))
 
-#define ACPI_ROUND_BITS_UP_TO_BYTES(a)       ACPI_DIV_8((a) + 7)
-#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a)     ACPI_DIV_8((a))
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a)      ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a)    ACPI_DIV_8((a))
 
-#define ACPI_ROUND_UP_TO_1K(a)               (((a) + 1023) >> 10)
+#define ACPI_ROUND_UP_TO_1K(a)              (((a) + 1023) >> 10)
 
 /* Generic (non-power-of-two) rounding */
 
-#define ACPI_ROUND_UP_TO(value,boundary)     (((value) + ((boundary)-1)) / (boundary))
+#define ACPI_ROUND_UP_TO(value,boundary)    (((value) + ((boundary)-1)) / (boundary))
+
+#define ACPI_IS_MISALIGNED(value)           (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1))
 
 /*
  * Bitmask creation
  * MASK_BITS_ABOVE creates a mask starting AT the position and above
  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
  */
-#define ACPI_MASK_BITS_ABOVE(position)       (~((ACPI_INTEGER_MAX) << ((u32) (position))))
-#define ACPI_MASK_BITS_BELOW(position)       ((ACPI_INTEGER_MAX) << ((u32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_INTEGER_MAX) << ((u32) (position))))
+#define ACPI_MASK_BITS_BELOW(position)      ((ACPI_INTEGER_MAX) << ((u32) (position)))
 
-#define ACPI_IS_OCTAL_DIGIT(d)               (((char)(d) >= '0') && ((char)(d) <= '7'))
+#define ACPI_IS_OCTAL_DIGIT(d)              (((char)(d) >= '0') && ((char)(d) <= '7'))
 
 /* Bitfields within ACPI registers */
 
  *
  * The "Descriptor" field is the first field in both structures.
  */
-#define ACPI_GET_DESCRIPTOR_TYPE(d)     (((union acpi_descriptor *)(void *)(d))->descriptor_id)
-#define ACPI_SET_DESCRIPTOR_TYPE(d,t)   (((union acpi_descriptor *)(void *)(d))->descriptor_id = t)
+#define ACPI_GET_DESCRIPTOR_TYPE(d)     (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t)   (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
 
 /* Macro to test the object type */
 
 #define ACPI_ERROR(plist)
 #define ACPI_ERROR_NAMESPACE(s,e)
 #define ACPI_ERROR_METHOD(s,n,p,e)
-
 #endif
 
 /*
 #define ACPI_GET_FUNCTION_NAME          _acpi_function_name
 /*
  * The Name parameter should be the procedure name as a quoted string.
- * This is declared as a local string ("my_function_name") so that it can
+ * This is declared as a local string ("MyFunctionName") so that it can
  * be also used by the function exit macros below.
  * Note: (const char) is used to be compatible with the debug interfaces
  * and macros such as __FUNCTION__.
  */
-#define ACPI_FUNCTION_NAME(name)        const char *_acpi_function_name = name;
+#define ACPI_FUNCTION_NAME(name)        const char *_acpi_function_name = #name;
 
 #else
 /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
 #endif
 
 #define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
-                                                                         acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
+                         acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
 #define ACPI_FUNCTION_TRACE_PTR(a,b)    ACPI_FUNCTION_NAME(a) \
-                                                                                       acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
+                                          acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
 #define ACPI_FUNCTION_TRACE_U32(a,b)    ACPI_FUNCTION_NAME(a) \
-                                                                                       acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
+                                                        acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
 #define ACPI_FUNCTION_TRACE_STR(a,b)    ACPI_FUNCTION_NAME(a) \
-                                                                                       acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
+                                                                         acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
 
 #define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
 
  * WARNING: These macros include a return statement.  This is usually considered
  * bad form, but having a separate exit macro is very ugly and difficult to maintain.
  * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_acpi_function_name" is defined.
+ * so that "_AcpiFunctionName" is defined.
  *
  * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
  * about these constructs.
 #define ACPI_DUMP_STACK_ENTRY(a)
 #define ACPI_DUMP_OPERANDS(a,b,c,d,e)
 #define ACPI_DUMP_ENTRY(a,b)
+#define ACPI_DUMP_TABLES(a,b)
 #define ACPI_DUMP_PATHNAME(a,b,c,d)
 #define ACPI_DUMP_RESOURCE_LIST(a)
 #define ACPI_DUMP_BUFFER(a,b)
 
 /* Memory allocation */
 
-#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
-#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
-#define ACPI_MEM_FREE(a)                acpi_os_free(a)
+#define ACPI_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_ALLOCATE_ZEROED(a)     acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_FREE(a)                acpi_os_free(a)
 #define ACPI_MEM_TRACKING(a)
 
 #else
 
 /* Memory allocation */
 
-#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
-#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
-#define ACPI_MEM_FREE(a)                acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
-#define ACPI_MEM_TRACKING(a)            a
+#define ACPI_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_ALLOCATE_ZEROED(a)     acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_FREE(a)                acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_TRACKING(a)        a
 
 #endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
index b667a804fc8af143124d0d6f1592b9e90994792e..83b52f9f899a64f598c7f7ec4369f3e98eb9f460 100644 (file)
@@ -63,6 +63,8 @@
 #define ACPI_NS_DONT_OPEN_SCOPE     0x02
 #define ACPI_NS_NO_PEER_SEARCH      0x04
 #define ACPI_NS_ERROR_IF_FOUND      0x08
+#define ACPI_NS_PREFIX_IS_SCOPE     0x10
+#define ACPI_NS_EXTERNAL            0x20
 
 #define ACPI_NS_WALK_UNLOCK         TRUE
 #define ACPI_NS_WALK_NO_UNLOCK      FALSE
@@ -171,19 +173,17 @@ acpi_ns_dump_objects(acpi_object_type type,
 /*
  * nseval - Namespace evaluation functions
  */
-acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info);
-
-acpi_status
-acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info);
-
-acpi_status
-acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info);
+acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 
 /*
  * nsnames - Name and Scope manipulation
  */
 u32 acpi_ns_opens_scope(acpi_object_type type);
 
+void
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+                           acpi_size size, char *name_buffer);
+
 char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
 
 char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
@@ -196,9 +196,9 @@ u8
 acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
 
 acpi_status
-acpi_ns_get_node_by_path(char *external_pathname,
-                        struct acpi_namespace_node *in_prefix_node,
-                        u32 flags, struct acpi_namespace_node **out_node);
+acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
+                char *external_pathname,
+                u32 flags, struct acpi_namespace_node **out_node);
 
 acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
 
@@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name,
                         u32 flags, struct acpi_namespace_node **ret_node);
 
 acpi_status
-acpi_ns_search_node(u32 entry_name,
-                   struct acpi_namespace_node *node,
-                   acpi_object_type type,
-                   struct acpi_namespace_node **ret_node);
+acpi_ns_search_one_scope(u32 entry_name,
+                        struct acpi_namespace_node *node,
+                        acpi_object_type type,
+                        struct acpi_namespace_node **ret_node);
 
 void
 acpi_ns_install_node(struct acpi_walk_state *walk_state,
index d130cfed8d5553714fc51bcf3a691588903d15dc..1747d94084d824308614a9c3fb3a6eeaef1db659 100644 (file)
@@ -1,7 +1,7 @@
 
 /******************************************************************************
  *
- * Name: acobject.h - Definition of union acpi_operand_object    (Internal object only)
+ * Name: acobject.h - Definition of union acpi_operand_object  (Internal object only)
  *
  *****************************************************************************/
 
 #ifndef _ACOBJECT_H
 #define _ACOBJECT_H
 
+/* acpisrc:struct_defs -- for acpisrc conversion */
+
 /*
- * The union acpi_operand_object    is used to pass AML operands from the dispatcher
+ * The union acpi_operand_object is used to pass AML operands from the dispatcher
  * to the interpreter, and to keep track of the various handlers such as
- * address space handlers and notify handlers.  The object is a constant
+ * address space handlers and notify handlers. The object is a constant
  * size in order to allow it to be cached and reused.
  */
 
 /*
  * Common area for all objects.
  *
- * data_type is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
+ * descriptor_type is used to differentiate between internal descriptors, and
+ * must be in the same place across all descriptors
+ *
+ * Note: The descriptor_type and Type fields must appear in the identical
+ * position in both the struct acpi_namespace_node and union acpi_operand_object
+ * structures.
  */
-#define ACPI_OBJECT_COMMON_HEADER   /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
-       u8                                      descriptor;         /* To differentiate various internal objs */\
-       u8                                      type;               /* acpi_object_type */\
-       u16                                     reference_count;    /* For object deletion management */\
-       union acpi_operand_object               *next_object;       /* Objects linked to parent NS node */\
-       u8                                      flags;
-
-/* Values for flag byte above */
+#define ACPI_OBJECT_COMMON_HEADER \
+       union acpi_operand_object       *next_object;       /* Objects linked to parent NS node */\
+       u8                              descriptor_type;    /* To differentiate various internal objs */\
+       u8                              type;               /* acpi_object_type */\
+       u16                             reference_count;    /* For object deletion management */\
+       u8                              flags;
+       /*
+        * Note: There are 3 bytes available here before the
+        * next natural alignment boundary (for both 32/64 cases)
+        */
+
+/* Values for Flag byte above */
 
 #define AOPOBJ_AML_CONSTANT         0x01
 #define AOPOBJ_STATIC_POINTER       0x02
 #define AOPOBJ_OBJECT_INITIALIZED   0x08
 #define AOPOBJ_SETUP_COMPLETE       0x10
 #define AOPOBJ_SINGLE_DATUM         0x20
-
-/*
- * Common bitfield for the field objects
- * "Field Datum"  -- a datum from the actual field object
- * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
- */
-#define ACPI_COMMON_FIELD_INFO      /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
-       u8                                      field_flags;        /* Access, update, and lock bits */\
-       u8                                      attribute;          /* From access_as keyword */\
-       u8                                      access_byte_width;  /* Read/Write size in bytes */\
-       u32                                     bit_length;         /* Length of field in bits */\
-       u32                                     base_byte_offset;   /* Byte offset within containing object */\
-       u8                                      start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
-       u8                                      access_bit_width;   /* Read/Write size in bits (8-64) */\
-       u32                                     value;              /* Value to store into the Bank or Index register */\
-       struct acpi_namespace_node              *node;  /* Link back to parent node */
-
-/*
- * Fields common to both Strings and Buffers
- */
-#define ACPI_COMMON_BUFFER_INFO \
-       u32                                     length;
-
-/*
- * Common fields for objects that support ASL notifications
- */
-#define ACPI_COMMON_NOTIFY_INFO \
-       union acpi_operand_object               *system_notify;     /* Handler for system notifies */\
-       union acpi_operand_object               *device_notify;     /* Handler for driver notifies */\
-       union acpi_operand_object               *handler;       /* Handler for Address space */
+#define AOPOBJ_INVALID              0x40       /* Used if host OS won't allow an op_region address */
 
 /******************************************************************************
  *
@@ -125,25 +106,31 @@ struct acpi_object_integer {
 
 /*
  * Note: The String and Buffer object must be identical through the Pointer
- * element.  There is code that depends on this.
+ * and length elements.  There is code that depends on this.
+ *
+ * Fields common to both Strings and Buffers
  */
+#define ACPI_COMMON_BUFFER_INFO(_type) \
+       _type                           *pointer; \
+       u32                             length;
+
 struct acpi_object_string {    /* Null terminated, ASCII characters only */
-       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer;        /* String in AML stream or allocated string */
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
 };
 
 struct acpi_object_buffer {
-       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */
-       struct acpi_namespace_node *node;       /* Link back to parent node */
-       u8 *aml_start;
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8)   /* Buffer in AML stream or allocated buffer */
        u32 aml_length;
+       u8 *aml_start;
+       struct acpi_namespace_node *node;       /* Link back to parent node */
 };
 
 struct acpi_object_package {
-       ACPI_OBJECT_COMMON_HEADER u32 count;    /* # of elements in package */
-       u32 aml_length;
-       u8 *aml_start;
-       struct acpi_namespace_node *node;       /* Link back to parent node */
+       ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node;     /* Link back to parent node */
        union acpi_operand_object **elements;   /* Array of pointers to acpi_objects */
+       u8 *aml_start;
+       u32 aml_length;
+       u32 count;              /* # of elements in package */
 };
 
 /******************************************************************************
@@ -156,23 +143,6 @@ struct acpi_object_event {
        ACPI_OBJECT_COMMON_HEADER void *semaphore;
 };
 
-#define ACPI_INFINITE_CONCURRENCY   0xFF
-
-typedef
-acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
-
-struct acpi_object_method {
-       ACPI_OBJECT_COMMON_HEADER u8 method_flags;
-       u8 param_count;
-       u32 aml_length;
-       void *semaphore;
-       u8 *aml_start;
-       ACPI_INTERNAL_METHOD implementation;
-       u8 concurrency;
-       u8 thread_count;
-       acpi_owner_id owner_id;
-};
-
 struct acpi_object_mutex {
        ACPI_OBJECT_COMMON_HEADER u8 sync_level;        /* 0-15, specified in Mutex() call */
        u16 acquisition_depth;  /* Allow multiple Acquires, same thread */
@@ -186,11 +156,23 @@ struct acpi_object_mutex {
 
 struct acpi_object_region {
        ACPI_OBJECT_COMMON_HEADER u8 space_id;
-       union acpi_operand_object *handler;     /* Handler for region access */
        struct acpi_namespace_node *node;       /* Containing namespace node */
+       union acpi_operand_object *handler;     /* Handler for region access */
        union acpi_operand_object *next;
-       u32 length;
        acpi_physical_address address;
+       u32 length;
+};
+
+struct acpi_object_method {
+       ACPI_OBJECT_COMMON_HEADER u8 method_flags;
+       u8 param_count;
+       u8 concurrency;
+       void *semaphore;
+       u8 *aml_start;
+       ACPI_INTERNAL_METHOD implementation;
+       u32 aml_length;
+       u8 thread_count;
+       acpi_owner_id owner_id;
 };
 
 /******************************************************************************
@@ -199,6 +181,14 @@ struct acpi_object_region {
  *
  *****************************************************************************/
 
+/*
+ * Common fields for objects that support ASL notifications
+ */
+#define ACPI_COMMON_NOTIFY_INFO \
+       union acpi_operand_object       *system_notify;     /* Handler for system notifies */\
+       union acpi_operand_object       *device_notify;     /* Handler for driver notifies */\
+       union acpi_operand_object       *handler;       /* Handler for Address space */
+
 struct acpi_object_notify_common {     /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
 ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
 
@@ -213,9 +203,9 @@ struct acpi_object_power_resource {
 };
 
 struct acpi_object_processor {
-       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id;
-       u32 length;
-       acpi_io_address address;
+       ACPI_OBJECT_COMMON_HEADER u8 proc_id;
+       u8 length;
+        ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
 };
 
 struct acpi_object_thermal_zone {
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
  *
  *****************************************************************************/
 
+/*
+ * Common bitfield for the field objects
+ * "Field Datum"  -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ */
+#define ACPI_COMMON_FIELD_INFO \
+       u8                              field_flags;        /* Access, update, and lock bits */\
+       u8                              attribute;          /* From access_as keyword */\
+       u8                              access_byte_width;  /* Read/Write size in bytes */\
+       struct acpi_namespace_node      *node;              /* Link back to parent node */\
+       u32                             bit_length;         /* Length of field in bits */\
+       u32                             base_byte_offset;   /* Byte offset within containing object */\
+       u32                             value;              /* Value to store into the Bank or Index register */\
+       u8                              start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
+       u8                              access_bit_width;       /* Read/Write size in bits (8-64) */
+
 struct acpi_object_field_common {      /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
-       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */
-       /* (REGION/BANK fields only) */
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
 };
 
 struct acpi_object_region_field {
@@ -244,7 +249,7 @@ struct acpi_object_bank_field {
 struct acpi_object_index_field {
        ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
            /*
-            * No "region_obj" pointer needed since the Index and Data registers
+            * No "RegionObj" pointer needed since the Index and Data registers
             * are each field definitions unto themselves.
             */
        union acpi_operand_object *index_obj;   /* Index register */
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler {
        void *context;
 };
 
-/* Flags for address handler */
-
-#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x1
-
 struct acpi_object_addr_handler {
        ACPI_OBJECT_COMMON_HEADER u8 space_id;
-       u16 hflags;
+       u8 handler_flags;
        acpi_adr_space_handler handler;
        struct acpi_namespace_node *node;       /* Parent device */
        void *context;
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler {
        union acpi_operand_object *next;
 };
 
+/* Flags for address handler (handler_flags) */
+
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x01
+
 /******************************************************************************
  *
  * Special internal objects
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler {
 struct acpi_object_reference {
        ACPI_OBJECT_COMMON_HEADER u8 target_type;       /* Used for index_op */
        u16 opcode;
-       u32 offset;             /* Used for arg_op, local_op, and index_op */
-       void *object;           /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object  */
+       void *object;           /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
        struct acpi_namespace_node *node;
        union acpi_operand_object **where;
+       u32 offset;             /* Used for arg_op, local_op, and index_op */
 };
 
 /*
@@ -311,12 +316,10 @@ struct acpi_object_reference {
  * Currently: Region and field_unit types
  */
 struct acpi_object_extra {
-       ACPI_OBJECT_COMMON_HEADER u8 byte_fill1;
-       u16 word_fill1;
-       u32 aml_length;
-       u8 *aml_start;
-       struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
+       ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG;       /* _REG method for this region (if any) */
        void *region_context;   /* Region-specific data */
+       u8 *aml_start;
+       u32 aml_length;
 };
 
 /* Additional data that can be attached to namespace nodes */
@@ -391,8 +394,13 @@ union acpi_operand_object {
 #define ACPI_DESC_TYPE_NAMED            0x0F
 #define ACPI_DESC_TYPE_MAX              0x0F
 
+struct acpi_common_descriptor {
+       void *common_pointer;
+       u8 descriptor_type;     /* To differentiate various internal objs */
+};
+
 union acpi_descriptor {
-       u8 descriptor_id;       /* To differentiate various internal objs */
+       struct acpi_common_descriptor common;
        union acpi_operand_object object;
        struct acpi_namespace_node node;
        union acpi_parse_object op;
index e6d78bd9e90ab29fe778b9cc262d0827cf664384..7659a46bc432e85f1742b708a0c817a21a890d48 100644 (file)
@@ -94,7 +94,7 @@
 #define ARGP_CONCAT_RES_OP              ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_TARGET)
 #define ARGP_COND_REF_OF_OP             ARGP_LIST2 (ARGP_SUPERNAME,  ARGP_SUPERNAME)
 #define ARGP_CONTINUE_OP                ARG_NONE
-#define ARGP_COPY_OP                    ARGP_LIST2 (ARGP_SUPERNAME,  ARGP_SIMPLENAME)
+#define ARGP_COPY_OP                    ARGP_LIST2 (ARGP_TERMARG,    ARGP_SIMPLENAME)
 #define ARGP_CREATE_BIT_FIELD_OP        ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
 #define ARGP_CREATE_BYTE_FIELD_OP       ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
 #define ARGP_CREATE_DWORD_FIELD_OP      ARGP_LIST3 (ARGP_TERMARG,    ARGP_TERMARG,       ARGP_NAME)
index 7785d481dc3ea43f8a503bf3de8e8a9925d35612..8d5039d0b430187c403d13b862d8419580a99b2c 100644 (file)
@@ -50,7 +50,7 @@
  * component basis and a per-exception-type basis.
  */
 
-/* Component IDs are used in the global "debug_layer" */
+/* Component IDs are used in the global "DebugLayer" */
 
 #define ACPI_UTILITIES              0x00000001
 #define ACPI_HARDWARE               0x00000002
 #define ACPI_LV_INTERRUPTS          0x08000000
 #define ACPI_LV_VERBOSITY3          0x0F000000 | ACPI_LV_VERBOSITY2
 
-/* Exceptionally verbose output -- also used in the global "debug_level" */
+/* Exceptionally verbose output -- also used in the global "DebugLevel"  */
 
 #define ACPI_LV_AML_DISASSEMBLE     0x10000000
 #define ACPI_LV_VERBOSE_INFO        0x20000000
  */
 #define ACPI_DEBUG_LEVEL(dl)        (u32) dl,ACPI_DEBUG_PARAMETERS
 
-/* Exception level -- used in the global "debug_level" */
+/* Exception level -- used in the global "DebugLevel" */
 
 #define ACPI_DB_INIT                ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
 #define ACPI_DB_DEBUG_OBJECT        ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
 
 /*
  * These two levels are essentially obsolete, all instances in the
- * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING
+ * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
  * (Kept here because some drivers may still use them)
  */
 #define ACPI_DB_ERROR               ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
 #define ACPI_DB_WARN                ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
 
-/* Trace level -- also used in the global "debug_level" */
+/* Trace level -- also used in the global "DebugLevel" */
 
 #define ACPI_DB_INIT_NAMES          ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
 #define ACPI_DB_THREADS             ACPI_DEBUG_LEVEL (ACPI_LV_THREADS)
index 5a1ff484af3393c41c0e6d8f58e2d52215a0ab5e..9d49d3c41cd924ed6c768cd3701e5da3a4d73232 100644 (file)
@@ -46,7 +46,7 @@
 
 #define OP_HAS_RETURN_VALUE             1
 
-/* variable # arguments */
+/* Variable number of arguments. This field must be 32 bits */
 
 #define ACPI_VAR_ARGS                   ACPI_UINT32_MAX
 
@@ -71,7 +71,7 @@
 /*
  * psxface - Parser external interfaces
  */
-acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info);
+acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
 
 /*
  * psargs - Parse AML opcode arguments
index 6dca3d542080a36e7ec745387f43aa5f98a71289..8c7590fdd822531d7d1fd62f55397578350171b5 100644 (file)
@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle,
 
 #define ACPI_BUS_FILE_ROOT     "acpi"
 extern struct proc_dir_entry *acpi_root_dir;
-extern FADT_DESCRIPTOR acpi_fadt;
+extern struct fadt_descriptor acpi_fadt;
 
 enum acpi_bus_removal_type {
        ACPI_BUS_REMOVAL_NORMAL = 0,
@@ -327,7 +327,7 @@ int acpi_bus_set_power(acpi_handle handle, int state);
 int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
 int acpi_bus_receive_event(struct acpi_bus_event *event);
 int acpi_bus_register_driver(struct acpi_driver *driver);
-int acpi_bus_unregister_driver(struct acpi_driver *driver);
+void acpi_bus_unregister_driver(struct acpi_driver *driver);
 int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
                 acpi_handle handle, int type);
 int acpi_bus_trim(struct acpi_device *start, int rmdevice);
index 970e9a6372c390d56b1dc67ed01df14a0508998e..8f473c83b7c4a974684a923eae415ef4e39c9fb2 100644 (file)
 #include "platform/acenv.h"
 #include "actypes.h"
 
-/* Priorities for acpi_os_queue_for_execution */
+/* Types for acpi_os_execute */
 
-#define OSD_PRIORITY_GPE            1
-#define OSD_PRIORITY_HIGH           2
-#define OSD_PRIORITY_MED            3
-#define OSD_PRIORITY_LO             4
+typedef enum {
+       OSL_GLOBAL_LOCK_HANDLER,
+       OSL_NOTIFY_HANDLER,
+       OSL_GPE_HANDLER,
+       OSL_DEBUGGER_THREAD,
+       OSL_EC_POLL_HANDLER,
+       OSL_EC_BURST_HANDLER
+} acpi_execute_type;
 
 #define ACPI_NO_UNIT_LIMIT          ((u32) -1)
 #define ACPI_MUTEX_SEM              1
@@ -161,13 +165,11 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
 /*
  * Threads and Scheduling
  */
-u32 acpi_os_get_thread_id(void);
+acpi_thread_id acpi_os_get_thread_id(void);
 
 acpi_status
-acpi_os_queue_for_execution(u32 priority,
-                           acpi_osd_exec_callback function, void *context);
-
-void acpi_os_wait_events_complete(void *context);
+acpi_os_execute(acpi_execute_type type,
+               acpi_osd_exec_callback function, void *context);
 
 void acpi_os_wait_events_complete(void *context);
 
@@ -214,6 +216,12 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
 /*
  * Miscellaneous
  */
+acpi_status acpi_os_validate_interface(char *interface);
+
+acpi_status
+acpi_os_validate_address(u8 space_id,
+                        acpi_physical_address address, acpi_size length);
+
 u8 acpi_os_readable(void *pointer, acpi_size length);
 
 #ifdef ACPI_FUTURE_USAGE
@@ -255,11 +263,4 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
-/*
- * Debug
- */
-void
-acpi_os_dbg_assert(void *failed_assertion,
-                  void *file_name, u32 line_number, char *message);
-
 #endif                         /* __ACPIOSXF_H__ */
index 66cf2ecef57a1264959c09aef7844f8ffed8a68a..049e9aa1b8678e827b201ebc9eb22cf269dc11d6 100644 (file)
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
  * Resource interfaces
  */
 typedef
-acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource,
+acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
                                           void *context);
 
 acpi_status
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle,
 acpi_status
 acpi_walk_resources(acpi_handle device_handle,
                    char *name,
-                   ACPI_WALK_RESOURCE_CALLBACK user_function, void *context);
+                   acpi_walk_resource_callback user_function, void *context);
 
 acpi_status
 acpi_set_current_resources(acpi_handle device_handle,
index fa02e8083381b61d9c60b17b6d233b57eb5154da..ad11fc13fbefc933c7184c9a1b970682ee8c8559 100644 (file)
@@ -164,23 +164,26 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 /*
  * rsutils
  */
+
 acpi_status
-acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
+acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
+acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer);
 
-#ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
-#endif                         /* ACPI_FUTURE_USAGE */
+acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer);
 
 acpi_status
 acpi_rs_get_method_data(acpi_handle handle,
                        char *path, struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
+acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer);
 
 /*
  * rscalc
@@ -198,8 +201,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
                                     acpi_size * buffer_size_needed);
 
 acpi_status
-acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
-                                u32 aml_buffer_length, u8 * output_buffer);
+acpi_rs_convert_aml_to_resources(u8 * aml,
+                                u32 length,
+                                u32 offset, u8 resource_index, void **context);
 
 acpi_status
 acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
index d8c1c2cdac0cf6db3dc1b92c3c33840fa9f89540..5e8095f0f78f882ff62df22e6c75d587cdeb6a2f 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACSTRUCT_H__
 #define __ACSTRUCT_H__
 
+/* acpisrc:struct_defs -- for acpisrc conversion */
+
 /*****************************************************************************
  *
  * Tree walking typedefs and structs
  ****************************************************************************/
 
 /*
- * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
- * the tree (for whatever reason), and for control method execution.
+ * Walk state - current state of a parse tree walk.  Used for both a leisurely
+ * stroll through the tree (for whatever reason), and for control method
+ * execution.
  */
 #define ACPI_NEXT_OP_DOWNWARD       1
 #define ACPI_NEXT_OP_UPWARD         2
 
+/*
+ * Groups of definitions for walk_type used for different implementations of
+ * walkers (never simultaneously) - flags for interpreter:
+ */
 #define ACPI_WALK_NON_METHOD        0
-#define ACPI_WALK_METHOD            1
-#define ACPI_WALK_METHOD_RESTART    2
-#define ACPI_WALK_CONST_REQUIRED    3
-#define ACPI_WALK_CONST_OPTIONAL    4
+#define ACPI_WALK_METHOD            0x01
+#define ACPI_WALK_METHOD_RESTART    0x02
+
+/* Flags for i_aSL compiler only */
+
+#define ACPI_WALK_CONST_REQUIRED    0x10
+#define ACPI_WALK_CONST_OPTIONAL    0x20
 
 struct acpi_walk_state {
-       u8 data_type;           /* To differentiate various internal objs MUST BE FIRST! */
+       struct acpi_walk_state *next;   /* Next walk_state in list */
+       u8 descriptor_type;     /* To differentiate various internal objs */
        u8 walk_type;
-       acpi_owner_id owner_id; /* Owner of objects created during the walk */
-       u8 last_predicate;      /* Result of last predicate */
-       u8 current_result;      /* */
+       u16 opcode;             /* Current AML opcode */
        u8 next_op_info;        /* Info about next_op */
        u8 num_operands;        /* Stack pointer for Operands[] array */
+       acpi_owner_id owner_id; /* Owner of objects created during the walk */
+       u8 last_predicate;      /* Result of last predicate */
+       u8 current_result;
        u8 return_used;
-       u16 opcode;             /* Current AML opcode */
        u8 scope_depth;
        u8 pass_number;         /* Parse pass during table load */
-       u32 arg_count;          /* push for fixed or var args */
        u32 aml_offset;
        u32 arg_types;
        u32 method_breakpoint;  /* For single stepping */
        u32 user_breakpoint;    /* User AML breakpoint */
        u32 parse_flags;
+
+       struct acpi_parse_state parser_state;   /* Current state of parser */
        u32 prev_arg_types;
+       u32 arg_count;          /* push for fixed or var args */
 
-       u8 *aml_last_while;
        struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS];     /* Control method arguments */
+       struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS];     /* Control method locals */
+       union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+       union acpi_operand_object **params;
+
+       u8 *aml_last_while;
        union acpi_operand_object **caller_return_desc;
        union acpi_generic_state *control_state;        /* List of control states (nested IFs) */
        struct acpi_namespace_node *deferred_node;      /* Used when executing deferred opcodes */
        struct acpi_gpe_event_info *gpe_event_info;     /* Info for GPE (_Lxx/_Exx methods only */
        union acpi_operand_object *implicit_return_obj;
-       struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS];     /* Control method locals */
        struct acpi_namespace_node *method_call_node;   /* Called method Node */
        union acpi_parse_object *method_call_op;        /* method_call Op if running a method */
        union acpi_operand_object *method_desc; /* Method descriptor if running a method */
        struct acpi_namespace_node *method_node;        /* Method node if running a method. */
        union acpi_parse_object *op;    /* Current parser op */
-       union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
        const struct acpi_opcode_info *op_info; /* Info on current opcode */
        union acpi_parse_object *origin;        /* Start of walk [Obsolete] */
-       union acpi_operand_object **params;
-       struct acpi_parse_state parser_state;   /* Current state of parser */
        union acpi_operand_object *result_obj;
        union acpi_generic_state *results;      /* Stack of accumulated results */
        union acpi_operand_object *return_desc; /* Return object, if any */
        union acpi_generic_state *scope_info;   /* Stack of nested scopes */
-
        union acpi_parse_object *prev_op;       /* Last op that was processed */
        union acpi_parse_object *next_op;       /* next op to be processed */
+       struct acpi_thread_state *thread;
        acpi_parse_downwards descending_callback;
        acpi_parse_upwards ascending_callback;
-       struct acpi_thread_state *thread;
-       struct acpi_walk_state *next;   /* Next walk_state in list */
 };
 
 /* Info used by acpi_ps_init_objects */
@@ -131,32 +142,6 @@ struct acpi_init_walk_info {
        struct acpi_table_desc *table_desc;
 };
 
-/* Info used by acpi_ns_initialize_devices */
-
-struct acpi_device_walk_info {
-       u16 device_count;
-       u16 num_STA;
-       u16 num_INI;
-       struct acpi_table_desc *table_desc;
-};
-
-/* TBD: [Restructure] Merge with struct above */
-
-struct acpi_walk_info {
-       u32 debug_level;
-       u32 count;
-       acpi_owner_id owner_id;
-       u8 display_type;
-};
-
-/* Display Types */
-
-#define ACPI_DISPLAY_SUMMARY    (u8) 0
-#define ACPI_DISPLAY_OBJECTS    (u8) 1
-#define ACPI_DISPLAY_MASK       (u8) 1
-
-#define ACPI_DISPLAY_SHORT      (u8) 2
-
 struct acpi_get_devices_info {
        acpi_walk_callback user_function;
        void *context;
@@ -189,16 +174,21 @@ union acpi_aml_operands {
        } mid;
 };
 
-/* Internal method parameter list */
-
-struct acpi_parameter_info {
-       struct acpi_namespace_node *node;
+/*
+ * Structure used to pass object evaluation parameters.
+ * Purpose is to reduce CPU stack use.
+ */
+struct acpi_evaluate_info {
+       struct acpi_namespace_node *prefix_node;
+       char *pathname;
        union acpi_operand_object *obj_desc;
        union acpi_operand_object **parameters;
+       struct acpi_namespace_node *resolved_node;
        union acpi_operand_object *return_object;
        u8 pass_number;
        u8 parameter_type;
        u8 return_object_type;
+       u8 flags;
 };
 
 /* Types for parameter_type above */
@@ -206,4 +196,35 @@ struct acpi_parameter_info {
 #define ACPI_PARAM_ARGS                 0
 #define ACPI_PARAM_GPE                  1
 
+/* Values for Flags above */
+
+#define ACPI_IGNORE_RETURN_VALUE        1
+
+/* Info used by acpi_ns_initialize_devices */
+
+struct acpi_device_walk_info {
+       u16 device_count;
+       u16 num_STA;
+       u16 num_INI;
+       struct acpi_table_desc *table_desc;
+       struct acpi_evaluate_info *evaluate_info;
+};
+
+/* TBD: [Restructure] Merge with struct above */
+
+struct acpi_walk_info {
+       u32 debug_level;
+       u32 count;
+       acpi_owner_id owner_id;
+       u8 display_type;
+};
+
+/* Display Types */
+
+#define ACPI_DISPLAY_SUMMARY        (u8) 0
+#define ACPI_DISPLAY_OBJECTS        (u8) 1
+#define ACPI_DISPLAY_MASK           (u8) 1
+
+#define ACPI_DISPLAY_SHORT          (u8) 2
+
 #endif
index 30a47542e1c8ed109407d4771dd5969a3047f508..4dbaf02fe526685d7def74b211db037c565674a1 100644 (file)
@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
 acpi_status
 acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
 
-u8 acpi_tb_generate_checksum(void *buffer, u32 length);
+u8 acpi_tb_sum_table(void *buffer, u32 length);
+
+u8 acpi_tb_generate_checksum(struct acpi_table_header *table);
+
+void acpi_tb_set_checksum(struct acpi_table_header *table);
 
 acpi_status
 acpi_tb_validate_table_header(struct acpi_table_header *table_header);
index ed53f842dad48fe95785dc700b2d9960d5292667..b125ceed9cb7696b20e9db6b5fb035f308f636d2 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Name: actbl.h - Table data structures defined in ACPI specification
+ * Name: actbl.h - Basic ACPI Table Definitions
  *
  *****************************************************************************/
 
 #define __ACTBL_H__
 
 /*
- * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
- * This is the only type that is even remotely portable. Anything else is not
- * portable, so do not use any other bitfield types.
- */
-
-/*
- *  Values for description table header signatures
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
  */
-#define RSDP_NAME               "RSDP"
-#define RSDP_SIG                "RSD PTR "     /* RSDT Pointer signature */
-#define APIC_SIG                "APIC" /* Multiple APIC Description Table */
 #define DSDT_SIG                "DSDT" /* Differentiated System Description Table */
 #define FADT_SIG                "FACP" /* Fixed ACPI Description Table */
 #define FACS_SIG                "FACS" /* Firmware ACPI Control Structure */
 #define PSDT_SIG                "PSDT" /* Persistent System Description Table */
+#define RSDP_SIG                "RSD PTR "     /* Root System Description Pointer */
 #define RSDT_SIG                "RSDT" /* Root System Description Table */
 #define XSDT_SIG                "XSDT" /* Extended  System Description Table */
 #define SSDT_SIG                "SSDT" /* Secondary System Description Table */
-#define SBST_SIG                "SBST" /* Smart Battery Specification Table */
-#define SPIC_SIG                "SPIC" /* IOSAPIC table */
-#define BOOT_SIG                "BOOT" /* Boot table */
-
-#define GL_OWNED                0x02   /* Ownership of global lock is bit 1 */
+#define RSDP_NAME               "RSDP"
 
 /*
- * Common table types.  The base code can remain
- * constant if the underlying tables are changed
+ * All tables and structures must be byte-packed to match the ACPI
+ * specification, since the tables are provided by the system BIOS
  */
-#define RSDT_DESCRIPTOR         struct rsdt_descriptor_rev2
-#define XSDT_DESCRIPTOR         struct xsdt_descriptor_rev2
-#define FACS_DESCRIPTOR         struct facs_descriptor_rev2
-#define FADT_DESCRIPTOR         struct fadt_descriptor_rev2
-
 #pragma pack(1)
 
 /*
- * ACPI Version-independent tables
+ * These are the ACPI tables that are directly consumed by the subsystem.
+ *
+ * The RSDP and FACS do not use the common ACPI table header. All other ACPI
+ * tables use the header.
  *
- * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
- * are in separate files.
+ * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
  */
-struct rsdp_descriptor {       /* Root System Descriptor Pointer */
-       char signature[8];      /* ACPI signature, contains "RSD PTR " */
-       u8 checksum;            /* ACPI 1.0 checksum */
-       char oem_id[6];         /* OEM identification */
-       u8 revision;            /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
-       u32 rsdt_physical_address;      /* 32-bit physical address of the RSDT */
-       u32 length;             /* XSDT Length in bytes, including header */
-       u64 xsdt_physical_address;      /* 64-bit physical address of the XSDT */
-       u8 extended_checksum;   /* Checksum of entire table (ACPI 2.0) */
-       char reserved[3];       /* Reserved, must be zero */
-};
 
-struct acpi_common_facs {      /* Common FACS for internal use */
-       u32 *global_lock;
-       u64 *firmware_waking_vector;
-       u8 vector_width;
-};
+/*******************************************************************************
+ *
+ * ACPI Table Header. This common header is used by all tables except the
+ * RSDP and FACS. The define is used for direct inclusion of header into
+ * other ACPI tables
+ *
+ ******************************************************************************/
 
-#define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
+#define ACPI_TABLE_HEADER_DEF \
        char                            signature[4];           /* ASCII table signature */\
        u32                             length;                 /* Length of table in bytes, including this header */\
        u8                              revision;               /* ACPI Specification minor version # */\
@@ -112,153 +91,238 @@ struct acpi_common_facs {        /* Common FACS for internal use */
        char                            oem_id[6];              /* ASCII OEM identification */\
        char                            oem_table_id[8];        /* ASCII OEM table identification */\
        u32                             oem_revision;           /* OEM revision number */\
-       char                            asl_compiler_id [4];    /* ASCII ASL compiler vendor ID */\
+       char                            asl_compiler_id[4];     /* ASCII ASL compiler vendor ID */\
        u32                             asl_compiler_revision;  /* ASL compiler version */
 
-struct acpi_table_header {     /* ACPI common table header */
+struct acpi_table_header {
 ACPI_TABLE_HEADER_DEF};
 
 /*
- * MADT values and structures
+ * GAS - Generic Address Structure (ACPI 2.0+)
  */
+struct acpi_generic_address {
+       u8 address_space_id;    /* Address space where struct or register exists */
+       u8 register_bit_width;  /* Size in bits of given register */
+       u8 register_bit_offset; /* Bit offset within the register */
+       u8 access_width;        /* Minimum Access size (ACPI 3.0) */
+       u64 address;            /* 64-bit address of struct or register */
+};
 
-/* Values for MADT PCATCompat */
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
+
+struct rsdp_descriptor {
+       char signature[8];      /* ACPI signature, contains "RSD PTR " */
+       u8 checksum;            /* ACPI 1.0 checksum */
+       char oem_id[6];         /* OEM identification */
+       u8 revision;            /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+       u32 rsdt_physical_address;      /* 32-bit physical address of the RSDT */
+       u32 length;             /* Table length in bytes, including header (ACPI 2.0+) */
+       u64 xsdt_physical_address;      /* 64-bit physical address of the XSDT (ACPI 2.0+) */
+       u8 extended_checksum;   /* Checksum of entire table (ACPI 2.0+) */
+       u8 reserved[3];         /* Reserved, must be zero */
+};
 
-#define DUAL_PIC                0
-#define MULTIPLE_APIC           1
+#define ACPI_RSDP_REV0_SIZE     20     /* Size of original ACPI 1.0 RSDP */
 
-/* Master MADT */
+/*******************************************************************************
+ *
+ * RSDT/XSDT - Root System Description Tables
+ *
+ ******************************************************************************/
 
-struct multiple_apic_table {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       u32 local_apic_address; /* Physical address of local APIC */
+struct rsdt_descriptor {
+       ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1];        /* Array of pointers to ACPI tables */
+};
+
+struct xsdt_descriptor {
+       ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1];        /* Array of pointers to ACPI tables */
+};
+
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure (FACS)
+ *
+ ******************************************************************************/
+
+struct facs_descriptor {
+       char signature[4];      /* ASCII table signature */
+       u32 length;             /* Length of structure, in bytes */
+       u32 hardware_signature; /* Hardware configuration signature */
+       u32 firmware_waking_vector;     /* 32-bit physical address of the Firmware Waking Vector */
+       u32 global_lock;        /* Global Lock for shared hardware resources */
 
        /* Flags (32 bits) */
 
-       u8 PCATcompat:1;        /* 00:    System also has dual 8259s */
+       u8 S4bios_f:1;          /* 00:    S4BIOS support is present */
         u8:7;                  /* 01-07: Reserved, must be zero */
        u8 reserved1[3];        /* 08-31: Reserved, must be zero */
-};
 
-/* Values for Type in APIC_HEADER_DEF */
+       u64 xfirmware_waking_vector;    /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
+       u8 version;             /* Version of this table (ACPI 2.0+) */
+       u8 reserved[31];        /* Reserved, must be zero */
+};
 
-#define APIC_PROCESSOR          0
-#define APIC_IO                 1
-#define APIC_XRUPT_OVERRIDE     2
-#define APIC_NMI                3
-#define APIC_LOCAL_NMI          4
-#define APIC_ADDRESS_OVERRIDE   5
-#define APIC_IO_SAPIC           6
-#define APIC_LOCAL_SAPIC        7
-#define APIC_XRUPT_SOURCE       8
-#define APIC_RESERVED           9      /* 9 and greater are reserved */
+#define ACPI_GLOCK_PENDING      0x01   /* 00: Pending global lock ownership */
+#define ACPI_GLOCK_OWNED        0x02   /* 01: Global lock is owned */
 
 /*
- * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
+ * Common FACS - This is a version-independent FACS structure used for internal use only
  */
-#define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
-       u8                              type; \
-       u8                              length;
-
-struct apic_header {
-APIC_HEADER_DEF};
-
-/* Values for MPS INTI flags */
-
-#define POLARITY_CONFORMS       0
-#define POLARITY_ACTIVE_HIGH    1
-#define POLARITY_RESERVED       2
-#define POLARITY_ACTIVE_LOW     3
-
-#define TRIGGER_CONFORMS        0
-#define TRIGGER_EDGE            1
-#define TRIGGER_RESERVED        2
-#define TRIGGER_LEVEL           3
-
-/* Common flag definitions (16 bits each) */
-
-#define MPS_INTI_FLAGS \
-       u8                              polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
-       u8                              trigger_mode    : 2;    /* 02-03: Trigger mode of APIC input signals */\
-       u8                                              : 4;    /* 04-07: Reserved, must be zero */\
-       u8                              reserved1;      /* 08-15: Reserved, must be zero */
-
-#define LOCAL_APIC_FLAGS \
-       u8                              processor_enabled: 1;   /* 00:    Processor is usable if set */\
-       u8                                              : 7;    /* 01-07: Reserved, must be zero */\
-       u8                              reserved2;      /* 08-15: Reserved, must be zero */
-
-/* Sub-structures for MADT */
-
-struct madt_processor_apic {
-       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
-       u8 local_apic_id;       /* Processor's local APIC id */
- LOCAL_APIC_FLAGS};
-
-struct madt_io_apic {
-       APIC_HEADER_DEF u8 io_apic_id;  /* I/O APIC ID */
-       u8 reserved;            /* Reserved - must be zero */
-       u32 address;            /* APIC physical address */
-       u32 interrupt;          /* Global system interrupt where INTI
-                                * lines start */
+struct acpi_common_facs {
+       u32 *global_lock;
+       u64 *firmware_waking_vector;
+       u8 vector_width;
 };
 
-struct madt_interrupt_override {
-       APIC_HEADER_DEF u8 bus; /* 0 - ISA */
-       u8 source;              /* Interrupt source (IRQ) */
-       u32 interrupt;          /* Global system interrupt */
- MPS_INTI_FLAGS};
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature "FACP")
+ *
+ ******************************************************************************/
+
+/* Fields common to all versions of the FADT */
+
+#define ACPI_FADT_COMMON \
+       ACPI_TABLE_HEADER_DEF \
+       u32                             V1_firmware_ctrl;   /* 32-bit physical address of FACS */ \
+       u32                             V1_dsdt;            /* 32-bit physical address of DSDT */ \
+       u8                              reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/ \
+       u8                              prefer_PM_profile;  /* Conveys preferred power management profile to OSPM. */ \
+       u16                             sci_int;            /* System vector of SCI interrupt */ \
+       u32                             smi_cmd;            /* Port address of SMI command port */ \
+       u8                              acpi_enable;        /* Value to write to smi_cmd to enable ACPI */ \
+       u8                              acpi_disable;       /* Value to write to smi_cmd to disable ACPI */ \
+       u8                              S4bios_req;         /* Value to write to SMI CMD to enter S4BIOS state */ \
+       u8                              pstate_cnt;         /* Processor performance state control*/ \
+       u32                             V1_pm1a_evt_blk;    /* Port address of Power Mgt 1a Event Reg Blk */ \
+       u32                             V1_pm1b_evt_blk;    /* Port address of Power Mgt 1b Event Reg Blk */ \
+       u32                             V1_pm1a_cnt_blk;    /* Port address of Power Mgt 1a Control Reg Blk */ \
+       u32                             V1_pm1b_cnt_blk;    /* Port address of Power Mgt 1b Control Reg Blk */ \
+       u32                             V1_pm2_cnt_blk;     /* Port address of Power Mgt 2 Control Reg Blk */ \
+       u32                             V1_pm_tmr_blk;      /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
+       u32                             V1_gpe0_blk;        /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
+       u32                             V1_gpe1_blk;        /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
+       u8                              pm1_evt_len;        /* Byte Length of ports at pm1_x_evt_blk */ \
+       u8                              pm1_cnt_len;        /* Byte Length of ports at pm1_x_cnt_blk */ \
+       u8                              pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */ \
+       u8                              pm_tm_len;          /* Byte Length of ports at pm_tm_blk */ \
+       u8                              gpe0_blk_len;       /* Byte Length of ports at gpe0_blk */ \
+       u8                              gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */ \
+       u8                              gpe1_base;          /* Offset in gpe model where gpe1 events start */ \
+       u8                              cst_cnt;            /* Support for the _CST object and C States change notification.*/ \
+       u16                             plvl2_lat;          /* Worst case HW latency to enter/exit C2 state */ \
+       u16                             plvl3_lat;          /* Worst case HW latency to enter/exit C3 state */ \
+       u16                             flush_size;         /* Processor's memory cache line width, in bytes */ \
+       u16                             flush_stride;       /* Number of flush strides that need to be read */ \
+       u8                              duty_offset;        /* Processor's duty cycle index in processor's P_CNT reg*/ \
+       u8                              duty_width;         /* Processor's duty cycle value bit width in P_CNT register.*/ \
+       u8                              day_alrm;           /* Index to day-of-month alarm in RTC CMOS RAM */ \
+       u8                              mon_alrm;           /* Index to month-of-year alarm in RTC CMOS RAM */ \
+       u8                              century;            /* Index to century in RTC CMOS RAM */ \
+       u16                             iapc_boot_arch;     /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \
+       u8                              reserved2;          /* Reserved, must be zero */
 
-struct madt_nmi_source {
-       APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt;   /* Global system interrupt */
+/*
+ * ACPI 2.0+ FADT
+ */
+struct fadt_descriptor {
+       ACPI_FADT_COMMON
+           /* Flags (32 bits) */
+       u8 wb_invd:1;           /* 00:    The wbinvd instruction works properly */
+       u8 wb_invd_flush:1;     /* 01:    The wbinvd flushes but does not invalidate */
+       u8 proc_c1:1;           /* 02:    All processors support C1 state */
+       u8 plvl2_up:1;          /* 03:    C2 state works on MP system */
+       u8 pwr_button:1;        /* 04:    Power button is handled as a generic feature */
+       u8 sleep_button:1;      /* 05:    Sleep button is handled as a generic feature, or not present */
+       u8 fixed_rTC:1;         /* 06:    RTC wakeup stat not in fixed register space */
+       u8 rtcs4:1;             /* 07:    RTC wakeup stat not possible from S4 */
+       u8 tmr_val_ext:1;       /* 08:    tmr_val is 32 bits 0=24-bits */
+       u8 dock_cap:1;          /* 09:    Docking supported */
+       u8 reset_reg_sup:1;     /* 10:    System reset via the FADT RESET_REG supported */
+       u8 sealed_case:1;       /* 11:    No internal expansion capabilities and case is sealed */
+       u8 headless:1;          /* 12:    No local video capabilities or local input devices */
+       u8 cpu_sw_sleep:1;      /* 13:    Must execute native instruction after writing SLP_TYPx register */
+
+       u8 pci_exp_wak:1;       /* 14:    System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+       u8 use_platform_clock:1;        /* 15:    OSPM should use platform-provided timer (ACPI 3.0) */
+       u8 S4rtc_sts_valid:1;   /* 16:    Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+       u8 remote_power_on_capable:1;   /* 17:    System is compatible with remote power on (ACPI 3.0) */
+       u8 force_apic_cluster_model:1;  /* 18:    All local APICs must use cluster model (ACPI 3.0) */
+       u8 force_apic_physical_destination_mode:1;      /* 19:   All local x_aPICs must use physical dest mode (ACPI 3.0) */
+        u8:4;                  /* 20-23: Reserved, must be zero */
+       u8 reserved3;           /* 24-31: Reserved, must be zero */
+
+       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
+       u8 reset_value;         /* Value to write to the reset_register port to reset the system */
+       u8 reserved4[3];        /* These three bytes must be zero */
+       u64 xfirmware_ctrl;     /* 64-bit physical address of FACS */
+       u64 Xdsdt;              /* 64-bit physical address of DSDT */
+       struct acpi_generic_address xpm1a_evt_blk;      /* Extended Power Mgt 1a acpi_event Reg Blk address */
+       struct acpi_generic_address xpm1b_evt_blk;      /* Extended Power Mgt 1b acpi_event Reg Blk address */
+       struct acpi_generic_address xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
+       struct acpi_generic_address xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
+       struct acpi_generic_address xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
+       struct acpi_generic_address xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
+       struct acpi_generic_address xgpe0_blk;  /* Extended General Purpose acpi_event 0 Reg Blk address */
+       struct acpi_generic_address xgpe1_blk;  /* Extended General Purpose acpi_event 1 Reg Blk address */
 };
 
-struct madt_local_apic_nmi {
-       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
-       MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */
+/*
+ * "Down-revved" ACPI 2.0 FADT descriptor
+ * Defined here to allow compiler to generate the length of the struct
+ */
+struct fadt_descriptor_rev2_minus {
+       ACPI_FADT_COMMON u32 flags;
+       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
+       u8 reset_value;         /* Value to write to the reset_register port to reset the system. */
+       u8 reserved7[3];        /* Reserved, must be zero */
 };
 
-struct madt_address_override {
-       APIC_HEADER_DEF u16 reserved;   /* Reserved, must be zero */
-       u64 address;            /* APIC physical address */
+/*
+ * ACPI 1.0 FADT
+ * Defined here to allow compiler to generate the length of the struct
+ */
+struct fadt_descriptor_rev1 {
+       ACPI_FADT_COMMON u32 flags;
 };
 
-struct madt_io_sapic {
-       APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
-       u8 reserved;            /* Reserved, must be zero */
-       u32 interrupt_base;     /* Glocal interrupt for SAPIC start */
-       u64 address;            /* SAPIC physical address */
-};
+/* FADT: Prefered Power Management Profiles */
 
-struct madt_local_sapic {
-       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
-       u8 local_sapic_id;      /* SAPIC ID */
-       u8 local_sapic_eid;     /* SAPIC EID */
-       u8 reserved[3];         /* Reserved, must be zero */
-        LOCAL_APIC_FLAGS u32 processor_uID;    /* Numeric UID - ACPI 3.0 */
-       char processor_uIDstring[1];    /* String UID  - ACPI 3.0 */
-};
+#define PM_UNSPECIFIED                  0
+#define PM_DESKTOP                      1
+#define PM_MOBILE                       2
+#define PM_WORKSTATION                  3
+#define PM_ENTERPRISE_SERVER            4
+#define PM_SOHO_SERVER                  5
+#define PM_APPLIANCE_PC                 6
 
-struct madt_interrupt_source {
-       APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type;       /* 1=PMI, 2=INIT, 3=corrected */
-       u8 processor_id;        /* Processor ID */
-       u8 processor_eid;       /* Processor EID */
-       u8 io_sapic_vector;     /* Vector value for PMI interrupts */
-       u32 interrupt;          /* Global system interrupt */
-       u32 flags;              /* Interrupt Source Flags */
-};
+/* FADT: Boot Arch Flags */
 
-/*
- * Smart Battery
- */
-struct smart_battery_table {
-       ACPI_TABLE_HEADER_DEF u32 warning_level;
-       u32 low_level;
-       u32 critical_level;
-};
+#define BAF_LEGACY_DEVICES              0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER    0x0002
+
+#define FADT2_REVISION_ID               3
+#define FADT2_MINUS_REVISION_ID         2
+
+/* Reset to default packing */
 
 #pragma pack()
 
+/*
+ * This macro is temporary until the table bitfield flag definitions
+ * are removed and replaced by a Flags field.
+ */
+#define ACPI_FLAG_OFFSET(d,f,o)         (u8) (ACPI_OFFSET (d,f) + \
+                         sizeof(((d *)0)->f) + o)
+/*
+ * Get the remaining ACPI tables
+ */
+#include "actbl1.h"
+
 /*
  * ACPI Table information.  We save the table address, length,
  * and type of memory allocation (mapped or allocated) for each
@@ -290,27 +354,17 @@ struct acpi_table_support {
        u8 flags;
 };
 
-/*
- * Get the ACPI version-specific tables
- */
-#include "actbl1.h"            /* Acpi 1.0 table definitions */
-#include "actbl2.h"            /* Acpi 2.0 table definitions */
-
 extern u8 acpi_fadt_is_v1;     /* is set to 1 if FADT is revision 1,
                                 * needed for certain workarounds */
+/* Macros used to generate offsets to specific table fields */
 
-#pragma pack(1)
-/*
- * High performance timer
- */
-struct hpet_table {
-       ACPI_TABLE_HEADER_DEF u32 hardware_id;
-       struct acpi_generic_address base_address;
-       u8 hpet_number;
-       u16 clock_tick;
-       u8 attributes;
-};
+#define ACPI_FACS_OFFSET(f)             (u8) ACPI_OFFSET (struct facs_descriptor,f)
+#define ACPI_FADT_OFFSET(f)             (u8) ACPI_OFFSET (struct fadt_descriptor, f)
+#define ACPI_GAS_OFFSET(f)              (u8) ACPI_OFFSET (struct acpi_generic_address,f)
+#define ACPI_HDR_OFFSET(f)              (u8) ACPI_OFFSET (struct acpi_table_header,f)
+#define ACPI_RSDP_OFFSET(f)             (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
 
-#pragma pack()
+#define ACPI_FADT_FLAG_OFFSET(f,o)      ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o)
+#define ACPI_FACS_FLAG_OFFSET(f,o)      ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
 
 #endif                         /* __ACTBL_H__ */
index cd428d57add0fc3731494759ae94802405155134..745a6445a4f919cb237a0b3e9761a121729966f9 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Name: actbl1.h - ACPI 1.0 tables
+ * Name: actbl1.h - Additional ACPI table definitions
  *
  *****************************************************************************/
 
 #ifndef __ACTBL1_H__
 #define __ACTBL1_H__
 
+/*******************************************************************************
+ *
+ * Additional ACPI Tables
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ ******************************************************************************/
+
+/*
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
+ */
+#define ACPI_SIG_ASF            "ASF!" /* Alert Standard Format table */
+#define ACPI_SIG_BOOT           "BOOT" /* Simple Boot Flag Table */
+#define ACPI_SIG_CPEP           "CPEP" /* Corrected Platform Error Polling table */
+#define ACPI_SIG_DBGP           "DBGP" /* Debug Port table */
+#define ACPI_SIG_ECDT           "ECDT" /* Embedded Controller Boot Resources Table */
+#define ACPI_SIG_HPET           "HPET" /* High Precision Event Timer table */
+#define ACPI_SIG_MADT           "APIC" /* Multiple APIC Description Table */
+#define ACPI_SIG_MCFG           "MCFG" /* PCI Memory Mapped Configuration table */
+#define ACPI_SIG_SBST           "SBST" /* Smart Battery Specification Table */
+#define ACPI_SIG_SLIT           "SLIT" /* System Locality Distance Information Table */
+#define ACPI_SIG_SPCR           "SPCR" /* Serial Port Console Redirection table */
+#define ACPI_SIG_SPMI           "SPMI" /* Server Platform Management Interface table */
+#define ACPI_SIG_SRAT           "SRAT" /* System Resource Affinity Table */
+#define ACPI_SIG_TCPA           "TCPA" /* Trusted Computing Platform Alliance table */
+#define ACPI_SIG_WDRT           "WDRT" /* Watchdog Resource Table */
+
+/* Legacy names */
+
+#define APIC_SIG                "APIC" /* Multiple APIC Description Table */
+#define BOOT_SIG                "BOOT" /* Simple Boot Flag Table */
+#define SBST_SIG                "SBST" /* Smart Battery Specification Table */
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
 #pragma pack(1)
 
 /*
- * ACPI 1.0 Root System Description Table (RSDT)
+ * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
  */
-struct rsdt_descriptor_rev1 {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       u32 table_offset_entry[1];      /* Array of pointers to ACPI tables */
-};
+
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ ******************************************************************************/
+
+struct acpi_table_asf {
+ACPI_TABLE_HEADER_DEF};
+
+#define ACPI_ASF_HEADER_DEF \
+       u8                              type; \
+       u8                              reserved; \
+       u16                             length;
+
+struct acpi_asf_header {
+ACPI_ASF_HEADER_DEF};
+
+/* Values for Type field */
+
+#define ASF_INFO                0
+#define ASF_ALERT               1
+#define ASF_CONTROL             2
+#define ASF_BOOT                3
+#define ASF_ADDRESS             4
+#define ASF_RESERVED            5
 
 /*
- * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ * ASF subtables
  */
-struct facs_descriptor_rev1 {
-       char signature[4];      /* ASCII table signature */
-       u32 length;             /* Length of structure in bytes */
-       u32 hardware_signature; /* Hardware configuration signature */
-       u32 firmware_waking_vector;     /* ACPI OS waking vector */
-       u32 global_lock;        /* Global Lock */
+
+/* 0: ASF Information */
+
+struct acpi_asf_info {
+       ACPI_ASF_HEADER_DEF u8 min_reset_value;
+       u8 min_poll_interval;
+       u16 system_id;
+       u32 mfg_id;
+       u8 flags;
+       u8 reserved2[3];
+};
+
+/* 1: ASF Alerts */
+
+struct acpi_asf_alert {
+       ACPI_ASF_HEADER_DEF u8 assert_mask;
+       u8 deassert_mask;
+       u8 alerts;
+       u8 data_length;
+       u8 array[1];
+};
+
+/* 2: ASF Remote Control */
+
+struct acpi_asf_remote {
+       ACPI_ASF_HEADER_DEF u8 controls;
+       u8 data_length;
+       u16 reserved2;
+       u8 array[1];
+};
+
+/* 3: ASF RMCP Boot Options */
+
+struct acpi_asf_rmcp {
+       ACPI_ASF_HEADER_DEF u8 capabilities[7];
+       u8 completion_code;
+       u32 enterprise_id;
+       u8 command;
+       u16 parameter;
+       u16 boot_options;
+       u16 oem_parameters;
+};
+
+/* 4: ASF Address */
+
+struct acpi_asf_address {
+       ACPI_ASF_HEADER_DEF u8 eprom_address;
+       u8 devices;
+       u8 smbus_addresses[1];
+};
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+struct acpi_table_boot {
+       ACPI_TABLE_HEADER_DEF u8 cmos_index;    /* Index in CMOS RAM for the boot register */
+       u8 reserved[3];
+};
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+struct acpi_table_cpep {
+       ACPI_TABLE_HEADER_DEF u64 reserved;
+};
+
+/* Subtable */
+
+struct acpi_cpep_polling {
+       u8 type;
+       u8 length;
+       u8 processor_id;        /* Processor ID */
+       u8 processor_eid;       /* Processor EID */
+       u32 polling_interval;   /* Polling interval (msec) */
+};
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port table
+ *
+ ******************************************************************************/
+
+struct acpi_table_dbgp {
+       ACPI_TABLE_HEADER_DEF u8 interface_type;        /* 0=full 16550, 1=subset of 16550 */
+       u8 reserved[3];
+       struct acpi_generic_address debug_port;
+};
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+struct ec_boot_resources {
+       ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control;   /* Address of EC command/status register */
+       struct acpi_generic_address ec_data;    /* Address of EC data register */
+       u32 uid;                /* Unique ID - must be same as the EC _UID method */
+       u8 gpe_bit;             /* The GPE for the EC */
+       u8 ec_id[1];            /* Full namepath of the EC in the ACPI namespace */
+};
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+struct acpi_hpet_table {
+       ACPI_TABLE_HEADER_DEF u32 hardware_id;  /* Hardware ID of event timer block */
+       struct acpi_generic_address base_address;       /* Address of event timer block */
+       u8 hpet_number;         /* HPET sequence number */
+       u16 clock_tick;         /* Main counter min tick, periodic mode */
+       u8 attributes;
+};
+
+#if 0                          /* HPET flags to be converted to macros */
+struct {                       /* Flags (8 bits) */
+       u8 page_protect:1;      /* 00:    No page protection */
+       u8 page_protect4:1;     /* 01:    4_kB page protected */
+       u8 page_protect64:1;    /* 02:    64_kB page protected */
+        u8:5;                  /* 03-07: Reserved, must be zero */
+} flags;
+#endif
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table
+ *
+ ******************************************************************************/
+
+struct multiple_apic_table {
+       ACPI_TABLE_HEADER_DEF u32 local_apic_address;   /* Physical address of local APIC */
 
        /* Flags (32 bits) */
 
-       u8 S4bios_f:1;          /* 00:    S4BIOS support is present */
+       u8 PCATcompat:1;        /* 00:    System also has dual 8259s */
         u8:7;                  /* 01-07: Reserved, must be zero */
        u8 reserved1[3];        /* 08-31: Reserved, must be zero */
-
-       u8 reserved2[40];       /* Reserved, must be zero */
 };
 
+/* Values for MADT PCATCompat */
+
+#define DUAL_PIC                0
+#define MULTIPLE_APIC           1
+
+/* Common MADT Sub-table header */
+
+#define APIC_HEADER_DEF \
+       u8                              type; \
+       u8                              length;
+
+struct apic_header {
+APIC_HEADER_DEF};
+
+/* Values for Type in struct apic_header */
+
+#define APIC_PROCESSOR          0
+#define APIC_IO                 1
+#define APIC_XRUPT_OVERRIDE     2
+#define APIC_NMI                3
+#define APIC_LOCAL_NMI          4
+#define APIC_ADDRESS_OVERRIDE   5
+#define APIC_IO_SAPIC           6
+#define APIC_LOCAL_SAPIC        7
+#define APIC_XRUPT_SOURCE       8
+#define APIC_RESERVED           9      /* 9 and greater are reserved */
+
+/* Flag definitions for MADT sub-tables */
+
+#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \
+       u8                              polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
+       u8                              trigger_mode    : 2;    /* 02-03: Trigger mode of APIC input signals */\
+       u8                                              : 4;    /* 04-07: Reserved, must be zero */\
+       u8                              reserved1;      /* 08-15: Reserved, must be zero */
+
+#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \
+       u8                              processor_enabled: 1;   /* 00:    Processor is usable if set */\
+       u8                                              : 7;    /* 01-07: Reserved, must be zero */\
+       u8                              reserved2[3];   /* 08-31: Reserved, must be zero */
+
+/* Values for MPS INTI flags */
+
+#define POLARITY_CONFORMS       0
+#define POLARITY_ACTIVE_HIGH    1
+#define POLARITY_RESERVED       2
+#define POLARITY_ACTIVE_LOW     3
+
+#define TRIGGER_CONFORMS        0
+#define TRIGGER_EDGE            1
+#define TRIGGER_RESERVED        2
+#define TRIGGER_LEVEL           3
+
 /*
- * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ * MADT Sub-tables, correspond to Type in struct apic_header
  */
-struct fadt_descriptor_rev1 {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       u32 firmware_ctrl;      /* Physical address of FACS */
-       u32 dsdt;               /* Physical address of DSDT */
-       u8 model;               /* System Interrupt Model */
-       u8 reserved1;           /* Reserved, must be zero */
-       u16 sci_int;            /* System vector of SCI interrupt */
-       u32 smi_cmd;            /* Port address of SMI command port */
-       u8 acpi_enable;         /* Value to write to smi_cmd to enable ACPI */
-       u8 acpi_disable;        /* Value to write to smi_cmd to disable ACPI */
-       u8 S4bios_req;          /* Value to write to SMI CMD to enter S4BIOS state */
-       u8 reserved2;           /* Reserved, must be zero */
-       u32 pm1a_evt_blk;       /* Port address of Power Mgt 1a acpi_event Reg Blk */
-       u32 pm1b_evt_blk;       /* Port address of Power Mgt 1b acpi_event Reg Blk */
-       u32 pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
-       u32 pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
-       u32 pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
-       u32 pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
-       u32 gpe0_blk;           /* Port addr of General Purpose acpi_event 0 Reg Blk */
-       u32 gpe1_blk;           /* Port addr of General Purpose acpi_event 1 Reg Blk */
-       u8 pm1_evt_len;         /* Byte length of ports at pm1_x_evt_blk */
-       u8 pm1_cnt_len;         /* Byte length of ports at pm1_x_cnt_blk */
-       u8 pm2_cnt_len;         /* Byte Length of ports at pm2_cnt_blk */
-       u8 pm_tm_len;           /* Byte Length of ports at pm_tm_blk */
-       u8 gpe0_blk_len;        /* Byte Length of ports at gpe0_blk */
-       u8 gpe1_blk_len;        /* Byte Length of ports at gpe1_blk */
-       u8 gpe1_base;           /* Offset in gpe model where gpe1 events start */
-       u8 reserved3;           /* Reserved, must be zero */
-       u16 plvl2_lat;          /* Worst case HW latency to enter/exit C2 state */
-       u16 plvl3_lat;          /* Worst case HW latency to enter/exit C3 state */
-       u16 flush_size;         /* Size of area read to flush caches */
-       u16 flush_stride;       /* Stride used in flushing caches */
-       u8 duty_offset;         /* Bit location of duty cycle field in p_cnt reg */
-       u8 duty_width;          /* Bit width of duty cycle field in p_cnt reg */
-       u8 day_alrm;            /* Index to day-of-month alarm in RTC CMOS RAM */
-       u8 mon_alrm;            /* Index to month-of-year alarm in RTC CMOS RAM */
-       u8 century;             /* Index to century in RTC CMOS RAM */
-       u8 reserved4[3];        /* Reserved, must be zero */
+
+/* 0: processor APIC */
+
+struct madt_processor_apic {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       u8 local_apic_id;       /* Processor's local APIC id */
+ ACPI_MADT_LFLAGS};
+
+/* 1: IO APIC */
+
+struct madt_io_apic {
+       APIC_HEADER_DEF u8 io_apic_id;  /* I/O APIC ID */
+       u8 reserved;            /* Reserved - must be zero */
+       u32 address;            /* APIC physical address */
+       u32 interrupt;          /* Global system interrupt where INTI lines start */
+};
+
+/* 2: Interrupt Override */
+
+struct madt_interrupt_override {
+       APIC_HEADER_DEF u8 bus; /* 0 - ISA */
+       u8 source;              /* Interrupt source (IRQ) */
+       u32 interrupt;          /* Global system interrupt */
+ ACPI_MADT_IFLAGS};
+
+/* 3: NMI Sources */
+
+struct madt_nmi_source {
+       APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */
+};
+
+/* 4: Local APIC NMI */
+
+struct madt_local_apic_nmi {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       ACPI_MADT_IFLAGS u8 lint;       /* LINTn to which NMI is connected */
+};
+
+/* 5: Address Override */
+
+struct madt_address_override {
+       APIC_HEADER_DEF u16 reserved;   /* Reserved, must be zero */
+       u64 address;            /* APIC physical address */
+};
+
+/* 6: I/O Sapic */
+
+struct madt_io_sapic {
+       APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
+       u8 reserved;            /* Reserved, must be zero */
+       u32 interrupt_base;     /* Glocal interrupt for SAPIC start */
+       u64 address;            /* SAPIC physical address */
+};
+
+/* 7: Local Sapic */
+
+struct madt_local_sapic {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       u8 local_sapic_id;      /* SAPIC ID */
+       u8 local_sapic_eid;     /* SAPIC EID */
+       u8 reserved[3];         /* Reserved, must be zero */
+        ACPI_MADT_LFLAGS u32 processor_uID;    /* Numeric UID - ACPI 3.0 */
+       char processor_uIDstring[1];    /* String UID  - ACPI 3.0 */
+};
+
+/* 8: Platform Interrupt Source */
+
+struct madt_interrupt_source {
+       APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type;     /* 1=PMI, 2=INIT, 3=corrected */
+       u8 processor_id;        /* Processor ID */
+       u8 processor_eid;       /* Processor EID */
+       u8 io_sapic_vector;     /* Vector value for PMI interrupts */
+       u32 interrupt;          /* Global system interrupt */
+       u32 flags;              /* Interrupt Source Flags */
+};
+
+#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+struct acpi_table_mcfg {
+       ACPI_TABLE_HEADER_DEF u8 reserved[8];
+};
+
+struct acpi_mcfg_allocation {
+       u64 base_address;       /* Base address, processor-relative */
+       u16 pci_segment;        /* PCI segment group number */
+       u8 start_bus_number;    /* Starting PCI Bus number */
+       u8 end_bus_number;      /* Final PCI Bus number */
+       u32 reserved;
+};
+#endif
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+
+struct smart_battery_table {
+       ACPI_TABLE_HEADER_DEF u32 warning_level;
+       u32 low_level;
+       u32 critical_level;
+};
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Distance Information Table
+ *
+ ******************************************************************************/
+
+struct system_locality_info {
+       ACPI_TABLE_HEADER_DEF u64 locality_count;
+       u8 entry[1][1];
+};
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+struct acpi_table_spcr {
+       ACPI_TABLE_HEADER_DEF u8 interface_type;        /* 0=full 16550, 1=subset of 16550 */
+       u8 reserved[3];
+       struct acpi_generic_address serial_port;
+       u8 interrupt_type;
+       u8 pc_interrupt;
+       u32 interrupt;
+       u8 baud_rate;
+       u8 parity;
+       u8 stop_bits;
+       u8 flow_control;
+       u8 terminal_type;
+       u8 reserved2;
+       u16 pci_device_id;
+       u16 pci_vendor_id;
+       u8 pci_bus;
+       u8 pci_device;
+       u8 pci_function;
+       u32 pci_flags;
+       u8 pci_segment;
+       u32 reserved3;
+};
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+struct acpi_table_spmi {
+       ACPI_TABLE_HEADER_DEF u8 reserved;
+       u8 interface_type;
+       u16 spec_revision;      /* Version of IPMI */
+       u8 interrupt_type;
+       u8 gpe_number;          /* GPE assigned */
+       u8 reserved2;
+       u8 pci_device_flag;
+       u32 interrupt;
+       struct acpi_generic_address ipmi_register;
+       u8 pci_segment;
+       u8 pci_bus;
+       u8 pci_device;
+       u8 pci_function;
+};
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table
+ *
+ ******************************************************************************/
+
+struct system_resource_affinity {
+       ACPI_TABLE_HEADER_DEF u32 reserved1;    /* Must be value '1' */
+       u64 reserved2;          /* Reserved, must be zero */
+};
+
+/* SRAT common sub-table header */
+
+#define SRAT_SUBTABLE_HEADER \
+       u8                              type; \
+       u8                              length;
+
+/* Values for Type above */
+
+#define SRAT_CPU_AFFINITY       0
+#define SRAT_MEMORY_AFFINITY    1
+#define SRAT_RESERVED           2
+
+/* SRAT sub-tables */
+
+struct static_resource_alloc {
+       SRAT_SUBTABLE_HEADER u8 proximity_domain_lo;
+       u8 apic_id;
+
+       /* Flags (32 bits) */
+
+       u8 enabled:1;           /* 00:    Use affinity structure */
+        u8:7;                  /* 01-07: Reserved, must be zero */
+       u8 reserved3[3];        /* 08-31: Reserved, must be zero */
+
+       u8 local_sapic_eid;
+       u8 proximity_domain_hi[3];
+       u32 reserved4;          /* Reserved, must be zero */
+};
+
+struct memory_affinity {
+       SRAT_SUBTABLE_HEADER u32 proximity_domain;
+       u16 reserved3;
+       u64 base_address;
+       u64 address_length;
+       u32 reserved4;
 
        /* Flags (32 bits) */
 
-       u8 wb_invd:1;           /* 00:    The wbinvd instruction works properly */
-       u8 wb_invd_flush:1;     /* 01:    The wbinvd flushes but does not invalidate */
-       u8 proc_c1:1;           /* 02:    All processors support C1 state */
-       u8 plvl2_up:1;          /* 03:    C2 state works on MP system */
-       u8 pwr_button:1;        /* 04:    Power button is handled as a generic feature */
-       u8 sleep_button:1;      /* 05:    Sleep button is handled as a generic feature, or not present */
-       u8 fixed_rTC:1;         /* 06:    RTC wakeup stat not in fixed register space */
-       u8 rtcs4:1;             /* 07:    RTC wakeup stat not possible from S4 */
-       u8 tmr_val_ext:1;       /* 08:    tmr_val width is 32 bits (0 = 24 bits) */
-        u8:7;                  /* 09-15: Reserved, must be zero */
-       u8 reserved5[2];        /* 16-31: Reserved, must be zero */
+       u8 enabled:1;           /* 00:    Use affinity structure */
+       u8 hot_pluggable:1;     /* 01:    Memory region is hot pluggable */
+       u8 non_volatile:1;      /* 02:    Memory is non-volatile */
+        u8:5;                  /* 03-07: Reserved, must be zero */
+       u8 reserved5[3];        /* 08-31: Reserved, must be zero */
+
+       u64 reserved6;          /* Reserved, must be zero */
+};
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+struct acpi_table_tcpa {
+       ACPI_TABLE_HEADER_DEF u16 reserved;
+       u32 max_log_length;     /* Maximum length for the event log area */
+       u64 log_address;        /* Address of the event log area */
 };
 
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+struct acpi_table_wdrt {
+       ACPI_TABLE_HEADER_DEF u32 header_length;        /* Watchdog Header Length */
+       u8 pci_segment;         /* PCI Segment number */
+       u8 pci_bus;             /* PCI Bus number */
+       u8 pci_device;          /* PCI Device number */
+       u8 pci_function;        /* PCI Function number */
+       u32 timer_period;       /* Period of one timer count (msec) */
+       u32 max_count;          /* Maximum counter value supported */
+       u32 min_count;          /* Minimum counter value */
+       u8 flags;
+       u8 reserved[3];
+       u32 entries;            /* Number of watchdog entries that follow */
+};
+
+#if 0                          /* Flags, will be converted to macros */
+u8 enabled:1;                  /* 00:    Timer enabled */
+u8:6;                          /* 01-06: Reserved */
+u8 sleep_stop:1;               /* 07:    Timer stopped in sleep state */
+#endif
+
+/* Macros used to generate offsets to specific table fields */
+
+#define ACPI_ASF0_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_asf_info,f)
+#define ACPI_ASF1_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
+#define ACPI_ASF2_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
+#define ACPI_ASF3_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
+#define ACPI_ASF4_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_asf_address,f)
+#define ACPI_BOOT_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_boot,f)
+#define ACPI_CPEP_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
+#define ACPI_CPEP0_OFFSET(f)            (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
+#define ACPI_DBGP_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
+#define ACPI_ECDT_OFFSET(f)             (u8) ACPI_OFFSET (struct ec_boot_resources,f)
+#define ACPI_HPET_OFFSET(f)             (u8) ACPI_OFFSET (struct hpet_table,f)
+#define ACPI_MADT_OFFSET(f)             (u8) ACPI_OFFSET (struct multiple_apic_table,f)
+#define ACPI_MADT0_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_processor_apic,f)
+#define ACPI_MADT1_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_io_apic,f)
+#define ACPI_MADT2_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
+#define ACPI_MADT3_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_nmi_source,f)
+#define ACPI_MADT4_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
+#define ACPI_MADT5_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_address_override,f)
+#define ACPI_MADT6_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_io_sapic,f)
+#define ACPI_MADT7_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_local_sapic,f)
+#define ACPI_MADT8_OFFSET(f)            (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
+#define ACPI_MADTH_OFFSET(f)            (u8) ACPI_OFFSET (struct apic_header,f)
+#define ACPI_MCFG_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
+#define ACPI_MCFG0_OFFSET(f)            (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
+#define ACPI_SBST_OFFSET(f)             (u8) ACPI_OFFSET (struct smart_battery_table,f)
+#define ACPI_SLIT_OFFSET(f)             (u8) ACPI_OFFSET (struct system_locality_info,f)
+#define ACPI_SPCR_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
+#define ACPI_SPMI_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
+#define ACPI_SRAT_OFFSET(f)             (u8) ACPI_OFFSET (struct system_resource_affinity,f)
+#define ACPI_SRAT0_OFFSET(f)            (u8) ACPI_OFFSET (struct static_resource_alloc,f)
+#define ACPI_SRAT1_OFFSET(f)            (u8) ACPI_OFFSET (struct memory_affinity,f)
+#define ACPI_TCPA_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
+#define ACPI_WDRT_OFFSET(f)             (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
+
+#define ACPI_HPET_FLAG_OFFSET(f,o)      ACPI_FLAG_OFFSET (struct hpet_table,f,o)
+#define ACPI_SRAT0_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
+#define ACPI_SRAT1_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
+#define ACPI_MADT_FLAG_OFFSET(f,o)      ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
+#define ACPI_MADT0_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
+#define ACPI_MADT2_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
+#define ACPI_MADT3_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
+#define ACPI_MADT4_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
+#define ACPI_MADT7_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
+#define ACPI_MADT8_FLAG_OFFSET(f,o)     ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
+
+/* Reset to default packing */
+
 #pragma pack()
 
 #endif                         /* __ACTBL1_H__ */
index dfc7ac1094bbb9b504d9e8af2d9ce0ec228ae1a3..67efe6cad27bf39cb562e076e7ed2284872ddfab 100644 (file)
 #ifndef __ACTBL2_H__
 #define __ACTBL2_H__
 
-/*
- * Prefered Power Management Profiles
- */
-#define PM_UNSPECIFIED                  0
-#define PM_DESKTOP                      1
-#define PM_MOBILE                       2
-#define PM_WORKSTATION                  3
-#define PM_ENTERPRISE_SERVER            4
-#define PM_SOHO_SERVER                  5
-#define PM_APPLIANCE_PC                 6
-
-/*
- * ACPI Boot Arch Flags
- */
-#define BAF_LEGACY_DEVICES              0x0001
-#define BAF_8042_KEYBOARD_CONTROLLER    0x0002
-
-#define FADT2_REVISION_ID               3
-#define FADT2_MINUS_REVISION_ID         2
-
-#pragma pack(1)
-
-/*
- * ACPI 2.0 Root System Description Table (RSDT)
- */
-struct rsdt_descriptor_rev2 {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       u32 table_offset_entry[1];      /* Array of pointers to ACPI tables */
-};
-
-/*
- * ACPI 2.0 Extended System Description Table (XSDT)
- */
-struct xsdt_descriptor_rev2 {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       u64 table_offset_entry[1];      /* Array of pointers to ACPI tables */
-};
-
-/*
- * ACPI 2.0 Firmware ACPI Control Structure (FACS)
- */
-struct facs_descriptor_rev2 {
-       char signature[4];      /* ASCII table signature */
-       u32 length;             /* Length of structure, in bytes */
-       u32 hardware_signature; /* Hardware configuration signature */
-       u32 firmware_waking_vector;     /* 32-bit physical address of the Firmware Waking Vector. */
-       u32 global_lock;        /* Global Lock used to synchronize access to shared hardware resources */
-
-       /* Flags (32 bits) */
-
-       u8 S4bios_f:1;          /* 00:    S4BIOS support is present */
-        u8:7;                  /* 01-07: Reserved, must be zero */
-       u8 reserved1[3];        /* 08-31: Reserved, must be zero */
-
-       u64 xfirmware_waking_vector;    /* 64-bit physical address of the Firmware Waking Vector. */
-       u8 version;             /* Version of this table */
-       u8 reserved3[31];       /* Reserved, must be zero */
-};
-
-/*
- * ACPI 2.0+ Generic Address Structure (GAS)
- */
-struct acpi_generic_address {
-       u8 address_space_id;    /* Address space where struct or register exists. */
-       u8 register_bit_width;  /* Size in bits of given register */
-       u8 register_bit_offset; /* Bit offset within the register */
-       u8 access_width;        /* Minimum Access size (ACPI 3.0) */
-       u64 address;            /* 64-bit address of struct or register */
-};
-
-#define FADT_REV2_COMMON \
-       u32                             V1_firmware_ctrl;   /* 32-bit physical address of FACS */ \
-       u32                             V1_dsdt;            /* 32-bit physical address of DSDT */ \
-       u8                              reserved1;          /* System Interrupt Model isn't used in ACPI 2.0*/ \
-       u8                              prefer_PM_profile;  /* Conveys preferred power management profile to OSPM. */ \
-       u16                             sci_int;            /* System vector of SCI interrupt */ \
-       u32                             smi_cmd;            /* Port address of SMI command port */ \
-       u8                              acpi_enable;        /* Value to write to smi_cmd to enable ACPI */ \
-       u8                              acpi_disable;       /* Value to write to smi_cmd to disable ACPI */ \
-       u8                              S4bios_req;         /* Value to write to SMI CMD to enter S4BIOS state */ \
-       u8                              pstate_cnt;         /* Processor performance state control*/ \
-       u32                             V1_pm1a_evt_blk;    /* Port address of Power Mgt 1a acpi_event Reg Blk */ \
-       u32                             V1_pm1b_evt_blk;    /* Port address of Power Mgt 1b acpi_event Reg Blk */ \
-       u32                             V1_pm1a_cnt_blk;    /* Port address of Power Mgt 1a Control Reg Blk */ \
-       u32                             V1_pm1b_cnt_blk;    /* Port address of Power Mgt 1b Control Reg Blk */ \
-       u32                             V1_pm2_cnt_blk;     /* Port address of Power Mgt 2 Control Reg Blk */ \
-       u32                             V1_pm_tmr_blk;      /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
-       u32                             V1_gpe0_blk;        /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
-       u32                             V1_gpe1_blk;        /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
-       u8                              pm1_evt_len;        /* Byte length of ports at pm1_x_evt_blk */ \
-       u8                              pm1_cnt_len;        /* Byte length of ports at pm1_x_cnt_blk */ \
-       u8                              pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */ \
-       u8                              pm_tm_len;          /* Byte Length of ports at pm_tm_blk */ \
-       u8                              gpe0_blk_len;       /* Byte Length of ports at gpe0_blk */ \
-       u8                              gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */ \
-       u8                              gpe1_base;          /* Offset in gpe model where gpe1 events start */ \
-       u8                              cst_cnt;            /* Support for the _CST object and C States change notification.*/ \
-       u16                             plvl2_lat;          /* Worst case HW latency to enter/exit C2 state */ \
-       u16                             plvl3_lat;          /* Worst case HW latency to enter/exit C3 state */ \
-       u16                             flush_size;         /* Number of flush strides that need to be read */ \
-       u16                             flush_stride;       /* Processor's memory cache line width, in bytes */ \
-       u8                              duty_offset;        /* Processor's duty cycle index in processor's P_CNT reg*/ \
-       u8                              duty_width;         /* Processor's duty cycle value bit width in P_CNT register.*/ \
-       u8                              day_alrm;           /* Index to day-of-month alarm in RTC CMOS RAM */ \
-       u8                              mon_alrm;           /* Index to month-of-year alarm in RTC CMOS RAM */ \
-       u8                              century;            /* Index to century in RTC CMOS RAM */ \
-       u16                             iapc_boot_arch;     /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
-
-/*
- * ACPI 2.0+ Fixed ACPI Description Table (FADT)
- */
-struct fadt_descriptor_rev2 {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       FADT_REV2_COMMON u8 reserved2;  /* Reserved, must be zero */
-
-       /* Flags (32 bits) */
-
-       u8 wb_invd:1;           /* 00:    The wbinvd instruction works properly */
-       u8 wb_invd_flush:1;     /* 01:    The wbinvd flushes but does not invalidate */
-       u8 proc_c1:1;           /* 02:    All processors support C1 state */
-       u8 plvl2_up:1;          /* 03:    C2 state works on MP system */
-       u8 pwr_button:1;        /* 04:    Power button is handled as a generic feature */
-       u8 sleep_button:1;      /* 05:    Sleep button is handled as a generic feature, or not present */
-       u8 fixed_rTC:1;         /* 06:    RTC wakeup stat not in fixed register space */
-       u8 rtcs4:1;             /* 07:    RTC wakeup stat not possible from S4 */
-       u8 tmr_val_ext:1;       /* 08:    tmr_val is 32 bits 0=24-bits */
-       u8 dock_cap:1;          /* 09:    Docking supported */
-       u8 reset_reg_sup:1;     /* 10:    System reset via the FADT RESET_REG supported */
-       u8 sealed_case:1;       /* 11:    No internal expansion capabilities and case is sealed */
-       u8 headless:1;          /* 12:    No local video capabilities or local input devices */
-       u8 cpu_sw_sleep:1;      /* 13:    Must execute native instruction after writing SLP_TYPx register */
-
-       u8 pci_exp_wak:1;       /* 14:    System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
-       u8 use_platform_clock:1;        /* 15:    OSPM should use platform-provided timer (ACPI 3.0) */
-       u8 S4rtc_sts_valid:1;   /* 16:    Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
-       u8 remote_power_on_capable:1;   /* 17:    System is compatible with remote power on (ACPI 3.0) */
-       u8 force_apic_cluster_model:1;  /* 18:    All local APICs must use cluster model (ACPI 3.0) */
-       u8 force_apic_physical_destination_mode:1;      /* 19:   all local x_aPICs must use physical dest mode (ACPI 3.0) */
-        u8:4;                  /* 20-23: Reserved, must be zero */
-       u8 reserved3;           /* 24-31: Reserved, must be zero */
-
-       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
-       u8 reset_value;         /* Value to write to the reset_register port to reset the system */
-       u8 reserved4[3];        /* These three bytes must be zero */
-       u64 xfirmware_ctrl;     /* 64-bit physical address of FACS */
-       u64 Xdsdt;              /* 64-bit physical address of DSDT */
-       struct acpi_generic_address xpm1a_evt_blk;      /* Extended Power Mgt 1a acpi_event Reg Blk address */
-       struct acpi_generic_address xpm1b_evt_blk;      /* Extended Power Mgt 1b acpi_event Reg Blk address */
-       struct acpi_generic_address xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
-       struct acpi_generic_address xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
-       struct acpi_generic_address xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
-       struct acpi_generic_address xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
-       struct acpi_generic_address xgpe0_blk;  /* Extended General Purpose acpi_event 0 Reg Blk address */
-       struct acpi_generic_address xgpe1_blk;  /* Extended General Purpose acpi_event 1 Reg Blk address */
-};
-
-/* "Down-revved" ACPI 2.0 FADT descriptor */
-
-struct fadt_descriptor_rev2_minus {
-       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
-       FADT_REV2_COMMON u8 reserved2;  /* Reserved, must be zero */
-       u32 flags;
-       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
-       u8 reset_value;         /* Value to write to the reset_register port to reset the system. */
-       u8 reserved7[3];        /* Reserved, must be zero */
-};
-
-/* ECDT - Embedded Controller Boot Resources Table */
-
-struct ec_boot_resources {
-       ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control;   /* Address of EC command/status register */
-       struct acpi_generic_address ec_data;    /* Address of EC data register */
-       u32 uid;                /* Unique ID - must be same as the EC _UID method */
-       u8 gpe_bit;             /* The GPE for the EC */
-       u8 ec_id[1];            /* Full namepath of the EC in the ACPI namespace */
-};
-
-/* SRAT - System Resource Affinity Table */
-
-struct static_resource_alloc {
-       u8 type;
-       u8 length;
-       u8 proximity_domain_lo;
-       u8 apic_id;
-
-       /* Flags (32 bits) */
-
-       u8 enabled:1;           /* 00:    Use affinity structure */
-        u8:7;                  /* 01-07: Reserved, must be zero */
-       u8 reserved3[3];        /* 08-31: Reserved, must be zero */
-
-       u8 local_sapic_eid;
-       u8 proximity_domain_hi[3];
-       u32 reserved4;          /* Reserved, must be zero */
-};
-
-struct memory_affinity {
-       u8 type;
-       u8 length;
-       u32 proximity_domain;
-       u16 reserved3;
-       u64 base_address;
-       u64 address_length;
-       u32 reserved4;
-
-       /* Flags (32 bits) */
-
-       u8 enabled:1;           /* 00:    Use affinity structure */
-       u8 hot_pluggable:1;     /* 01:    Memory region is hot pluggable */
-       u8 non_volatile:1;      /* 02:    Memory is non-volatile */
-        u8:5;                  /* 03-07: Reserved, must be zero */
-       u8 reserved5[3];        /* 08-31: Reserved, must be zero */
-
-       u64 reserved6;          /* Reserved, must be zero */
-};
-
-struct system_resource_affinity {
-       ACPI_TABLE_HEADER_DEF u32 reserved1;    /* Must be value '1' */
-       u64 reserved2;          /* Reserved, must be zero */
-};
-
-/* SLIT - System Locality Distance Information Table */
-
-struct system_locality_info {
-       ACPI_TABLE_HEADER_DEF u64 locality_count;
-       u8 entry[1][1];
-};
-
-#pragma pack()
+/* Code moved to both actbl.h and actbl1.h */
 
 #endif                         /* __ACTBL2_H__ */
index 7ca89cde706eaf301f214453d7d01594e0ddecec..77cf1236b05ac5fe45ddb2851e7c9a936ecd9db8 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTYPES_H__
 #define __ACTYPES_H__
 
+/* acpisrc:struct_defs -- for acpisrc conversion */
+
 /*
  * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
  * and must be either 16, 32, or 64
@@ -154,7 +156,6 @@ typedef u64 acpi_physical_address;
 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
 
-#define ALIGNED_ADDRESS_BOUNDARY        0x00000008
 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
 
 /*
@@ -195,8 +196,6 @@ typedef u64 acpi_physical_address;
 #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
 
-#define ALIGNED_ADDRESS_BOUNDARY        0x00000004
-
 /*******************************************************************************
  *
  * Types specific to 16-bit targets
@@ -223,7 +222,6 @@ typedef char *acpi_physical_address;
 #define ACPI_MAX_PTR                    ACPI_UINT16_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT16_MAX
 
-#define ALIGNED_ADDRESS_BOUNDARY        0x00000002
 #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
 
 /* 64-bit integers cannot be supported */
@@ -254,7 +252,7 @@ typedef acpi_native_uint acpi_size;
 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
 
 #ifndef acpi_uintptr_t
-#define acpi_uintptr_t                          void *
+#define acpi_uintptr_t                  void *
 #endif
 
 /*
@@ -263,7 +261,7 @@ typedef acpi_native_uint acpi_size;
  * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
  */
 #ifndef acpi_cache_t
-#define acpi_cache_t                            struct acpi_memory_list
+#define acpi_cache_t                    struct acpi_memory_list
 #endif
 
 /*
@@ -271,7 +269,7 @@ typedef acpi_native_uint acpi_size;
  * lock and unlock OSL interfaces.
  */
 #ifndef acpi_cpu_flags
-#define acpi_cpu_flags                          acpi_native_uint
+#define acpi_cpu_flags                  acpi_native_uint
 #endif
 
 /*
@@ -292,6 +290,21 @@ typedef acpi_native_uint acpi_size;
 #define ACPI_UNUSED_VAR
 #endif
 
+/*
+ * All ACPICA functions that are available to the rest of the kernel are
+ * tagged with this macro which can be defined as appropriate for the host.
+ */
+#ifndef ACPI_EXPORT_SYMBOL
+#define ACPI_EXPORT_SYMBOL(symbol)
+#endif
+
+/*
+ * thread_id is returned by acpi_os_get_thread_id.
+ */
+#ifndef acpi_thread_id
+#define acpi_thread_id                  acpi_native_uint
+#endif
+
 /*******************************************************************************
  *
  * Independent types
@@ -477,15 +490,15 @@ typedef u64 acpi_integer;
  */
 typedef u32 acpi_table_type;
 
-#define ACPI_TABLE_RSDP                 (acpi_table_type) 0
-#define ACPI_TABLE_DSDT                 (acpi_table_type) 1
-#define ACPI_TABLE_FADT                 (acpi_table_type) 2
-#define ACPI_TABLE_FACS                 (acpi_table_type) 3
-#define ACPI_TABLE_PSDT                 (acpi_table_type) 4
-#define ACPI_TABLE_SSDT                 (acpi_table_type) 5
-#define ACPI_TABLE_XSDT                 (acpi_table_type) 6
-#define ACPI_TABLE_MAX                  6
-#define NUM_ACPI_TABLE_TYPES            (ACPI_TABLE_MAX+1)
+#define ACPI_TABLE_ID_RSDP              (acpi_table_type) 0
+#define ACPI_TABLE_ID_DSDT              (acpi_table_type) 1
+#define ACPI_TABLE_ID_FADT              (acpi_table_type) 2
+#define ACPI_TABLE_ID_FACS              (acpi_table_type) 3
+#define ACPI_TABLE_ID_PSDT              (acpi_table_type) 4
+#define ACPI_TABLE_ID_SSDT              (acpi_table_type) 5
+#define ACPI_TABLE_ID_XSDT              (acpi_table_type) 6
+#define ACPI_TABLE_ID_MAX               6
+#define ACPI_NUM_TABLE_TYPES            (ACPI_TABLE_ID_MAX+1)
 
 /*
  * Types associated with ACPI names and objects.  The first group of
@@ -816,7 +829,7 @@ struct acpi_system_info {
        u32 debug_level;
        u32 debug_layer;
        u32 num_table_types;
-       struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES];
+       struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1];
 };
 
 /*
@@ -858,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
                                      void *handler_context,
                                      void *region_context);
 
-#define ACPI_DEFAULT_HANDLER        NULL
+#define ACPI_DEFAULT_HANDLER            NULL
 
 typedef
 acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
@@ -911,12 +924,13 @@ struct acpi_compatible_id_list {
 #define ACPI_STA_DEVICE_PRESENT         0x01
 #define ACPI_STA_DEVICE_ENABLED         0x02
 #define ACPI_STA_DEVICE_UI              0x04
-#define ACPI_STA_DEVICE_OK              0x08
+#define ACPI_STA_DEVICE_FUNCTIONING     0x08
+#define ACPI_STA_DEVICE_OK              0x08   /* Synonym */
 #define ACPI_STA_BATTERY_PRESENT        0x10
 
 #define ACPI_COMMON_OBJ_INFO \
-       acpi_object_type                    type;           /* ACPI object type */ \
-       acpi_name                           name        /* ACPI object Name */
+       acpi_object_type                type;           /* ACPI object type */ \
+       acpi_name                       name    /* ACPI object Name */
 
 struct acpi_obj_info_header {
        ACPI_COMMON_OBJ_INFO;
@@ -957,7 +971,7 @@ struct acpi_mem_space_context {
  * Definitions for Resource Attributes
  */
 typedef u16 acpi_rs_length;    /* Resource Length field is fixed at 16 bits */
-typedef u32 acpi_rsdesc_size;  /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */
+typedef u32 acpi_rsdesc_size;  /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
 
 /*
  *  Memory Attributes
@@ -972,8 +986,8 @@ typedef u32 acpi_rsdesc_size;       /* Max Resource Descriptor size is (length+3) = (6
 
 /*
  *  IO Attributes
- *  The ISA Io ranges are:     n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh.
- *  The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh.
+ *  The ISA IO ranges are:     n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
+ *  The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
  */
 #define ACPI_NON_ISA_ONLY_RANGES        (u8) 0x01
 #define ACPI_ISA_ONLY_RANGES            (u8) 0x02
@@ -1171,12 +1185,12 @@ struct acpi_resource_source {
 /* Fields common to all address descriptors, 16/32/64 bit */
 
 #define ACPI_RESOURCE_ADDRESS_COMMON \
-       u8                                  resource_type; \
-       u8                                  producer_consumer; \
-       u8                                  decode; \
-       u8                                  min_address_fixed; \
-       u8                                  max_address_fixed; \
-       union acpi_resource_attribute       info;
+       u8                              resource_type; \
+       u8                              producer_consumer; \
+       u8                              decode; \
+       u8                              min_address_fixed; \
+       u8                              max_address_fixed; \
+       union acpi_resource_attribute   info;
 
 struct acpi_resource_address {
 ACPI_RESOURCE_ADDRESS_COMMON};
@@ -1297,16 +1311,6 @@ struct acpi_resource {
 
 #define ACPI_NEXT_RESOURCE(res)             (struct acpi_resource *)((u8 *) res + res->length)
 
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#define ACPI_ALIGN_RESOURCE_SIZE(length)    (length)
-#else
-#define ACPI_ALIGN_RESOURCE_SIZE(length)    ACPI_ROUND_UP_TO_NATIVE_WORD(length)
-#endif
-
-/*
- * END: of definitions for Resource Attributes
- */
-
 struct acpi_pci_routing_table {
        u32 length;
        u32 pin;
@@ -1315,8 +1319,4 @@ struct acpi_pci_routing_table {
        char source[4];         /* pad to 64 bits so sizeof() works in all cases */
 };
 
-/*
- * END: of definitions for PCI Routing tables
- */
-
 #endif                         /* __ACTYPES_H__ */
index 0927765df6aa065d173d7267c3b5ec274396d0c3..ba039ea1a057ab8e39ab5844c34f75b31131d15d 100644 (file)
@@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[];
 
 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
 
-extern const char *acpi_gbl_BMdecode[2];
-extern const char *acpi_gbl_config_decode[4];
-extern const char *acpi_gbl_consume_decode[2];
-extern const char *acpi_gbl_DECdecode[2];
-extern const char *acpi_gbl_HEdecode[2];
-extern const char *acpi_gbl_io_decode[2];
-extern const char *acpi_gbl_LLdecode[2];
-extern const char *acpi_gbl_max_decode[2];
-extern const char *acpi_gbl_MEMdecode[4];
-extern const char *acpi_gbl_min_decode[2];
-extern const char *acpi_gbl_MTPdecode[4];
-extern const char *acpi_gbl_RNGdecode[4];
-extern const char *acpi_gbl_RWdecode[2];
-extern const char *acpi_gbl_SHRdecode[2];
-extern const char *acpi_gbl_SIZdecode[4];
-extern const char *acpi_gbl_TRSdecode[2];
-extern const char *acpi_gbl_TTPdecode[2];
-extern const char *acpi_gbl_TYPdecode[4];
+extern const char *acpi_gbl_bm_decode[];
+extern const char *acpi_gbl_config_decode[];
+extern const char *acpi_gbl_consume_decode[];
+extern const char *acpi_gbl_dec_decode[];
+extern const char *acpi_gbl_he_decode[];
+extern const char *acpi_gbl_io_decode[];
+extern const char *acpi_gbl_ll_decode[];
+extern const char *acpi_gbl_max_decode[];
+extern const char *acpi_gbl_mem_decode[];
+extern const char *acpi_gbl_min_decode[];
+extern const char *acpi_gbl_mtp_decode[];
+extern const char *acpi_gbl_rng_decode[];
+extern const char *acpi_gbl_rw_decode[];
+extern const char *acpi_gbl_shr_decode[];
+extern const char *acpi_gbl_siz_decode[];
+extern const char *acpi_gbl_trs_decode[];
+extern const char *acpi_gbl_ttp_decode[];
+extern const char *acpi_gbl_typ_decode[];
 #endif
 
 /* Types for Resource descriptor entries */
@@ -77,6 +77,12 @@ extern const char *acpi_gbl_TYPdecode[4];
 #define ACPI_VARIABLE_LENGTH            2
 #define ACPI_SMALL_VARIABLE_LENGTH      3
 
+typedef
+acpi_status(*acpi_walk_aml_callback) (u8 * aml,
+                                     u32 length,
+                                     u32 offset,
+                                     u8 resource_index, void **context);
+
 typedef
 acpi_status(*acpi_pkg_callback) (u8 object_type,
                                 union acpi_operand_object * source_object,
@@ -277,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number,
 
 void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
 
+void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
+
 void acpi_ut_report_error(char *module_name, u32 line_number);
 
 void acpi_ut_report_info(char *module_name, u32 line_number);
@@ -445,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
 /*
  * utmisc
  */
+u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
+
 acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
 
 void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
@@ -460,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length);
 
 u8 acpi_ut_valid_acpi_name(u32 name);
 
-u8 acpi_ut_valid_acpi_character(char character);
+acpi_name acpi_ut_repair_name(acpi_name name);
+
+u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position);
 
 acpi_status
 acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
@@ -469,6 +481,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
 
 #define ACPI_ANY_BASE        0
 
+u32 acpi_ut_dword_byte_swap(u32 value);
+
+void acpi_ut_set_integer_width(u8 revision);
+
+#ifdef ACPI_DEBUG_OUTPUT
+void
+acpi_ut_display_init_pathname(u8 type,
+                             struct acpi_namespace_node *obj_handle,
+                             char *path);
+#endif
+
+/*
+ * utresrc
+ */
+acpi_status
+acpi_ut_walk_aml_resources(u8 * aml,
+                          acpi_size aml_length,
+                          acpi_walk_aml_callback user_function, void **context);
+
 acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
 
 u32 acpi_ut_get_descriptor_length(void *aml);
@@ -483,20 +514,6 @@ acpi_status
 acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
                             u8 ** end_tag);
 
-u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
-
-u32 acpi_ut_dword_byte_swap(u32 value);
-
-void acpi_ut_set_integer_width(u8 revision);
-
-#ifdef ACPI_DEBUG_OUTPUT
-void
-acpi_ut_display_init_pathname(u8 type,
-                             struct acpi_namespace_node *obj_handle,
-                             char *path);
-
-#endif
-
 /*
  * utmutex - mutex support
  */
@@ -523,14 +540,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
 
 void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
 
-void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line);
+void *acpi_ut_allocate_zeroed(acpi_size size,
+                             u32 component, char *module, u32 line);
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 void *acpi_ut_allocate_and_track(acpi_size size,
                                 u32 component, char *module, u32 line);
 
-void *acpi_ut_callocate_and_track(acpi_size size,
-                                 u32 component, char *module, u32 line);
+void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
+                                       u32 component, char *module, u32 line);
 
 void
 acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
@@ -540,6 +558,11 @@ void acpi_ut_dump_allocation_info(void);
 #endif                         /* ACPI_FUTURE_USAGE */
 
 void acpi_ut_dump_allocations(u32 component, char *module);
+
+acpi_status
+acpi_ut_create_list(char *list_name,
+                   u16 object_size, struct acpi_memory_list **return_cache);
+
 #endif
 
 #endif                         /* _ACUTILS_H */
index 37964a59aef8796daaebf354e5bd0472860ba7a6..cf18426a87b113e22925f687b987987df55b3473 100644 (file)
 #define AML_BANK_FIELD_OP           (u16) 0x5b87
 #define AML_DATA_REGION_OP          (u16) 0x5b88       /* ACPI 2.0 */
 
-/* Bogus opcodes (they are actually two separate opcodes) */
-
+/*
+ * Combination opcodes (actually two one-byte opcodes)
+ * Used by the disassembler and i_aSL compiler
+ */
 #define AML_LGREATEREQUAL_OP        (u16) 0x9295
 #define AML_LLESSEQUAL_OP           (u16) 0x9294
 #define AML_LNOTEQUAL_OP            (u16) 0x9293
index fb4735315ad3e977ff008fd56f988de2fc8ba7d8..be03818af9d19731dec2aa280b8b38ace1526cb8 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
+/* acpisrc:struct_defs -- for acpisrc conversion */
+
 #ifndef __AMLRESRC_H
 #define __AMLRESRC_H
 
-#define ASL_RESNAME_ADDRESS                     "_ADR"
-#define ASL_RESNAME_ALIGNMENT                   "_ALN"
-#define ASL_RESNAME_ADDRESSSPACE                "_ASI"
-#define ASL_RESNAME_ACCESSSIZE                  "_ASZ"
-#define ASL_RESNAME_TYPESPECIFICATTRIBUTES      "_ATT"
-#define ASL_RESNAME_BASEADDRESS                 "_BAS"
-#define ASL_RESNAME_BUSMASTER                   "_BM_" /* Master(1), Slave(0) */
-#define ASL_RESNAME_DECODE                      "_DEC"
-#define ASL_RESNAME_DMA                         "_DMA"
-#define ASL_RESNAME_DMATYPE                     "_TYP" /* Compatible(0), A(1), B(2), F(3) */
-#define ASL_RESNAME_GRANULARITY                 "_GRA"
-#define ASL_RESNAME_INTERRUPT                   "_INT"
-#define ASL_RESNAME_INTERRUPTLEVEL              "_LL_" /* active_lo(1), active_hi(0) */
-#define ASL_RESNAME_INTERRUPTSHARE              "_SHR" /* Shareable(1), no_share(0) */
-#define ASL_RESNAME_INTERRUPTTYPE               "_HE_" /* Edge(1), Level(0) */
-#define ASL_RESNAME_LENGTH                      "_LEN"
-#define ASL_RESNAME_MEMATTRIBUTES               "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
-#define ASL_RESNAME_MEMTYPE                     "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
-#define ASL_RESNAME_MAXADDR                     "_MAX"
-#define ASL_RESNAME_MINADDR                     "_MIN"
-#define ASL_RESNAME_MAXTYPE                     "_MAF"
-#define ASL_RESNAME_MINTYPE                     "_MIF"
-#define ASL_RESNAME_REGISTERBITOFFSET           "_RBO"
-#define ASL_RESNAME_REGISTERBITWIDTH            "_RBW"
-#define ASL_RESNAME_RANGETYPE                   "_RNG"
-#define ASL_RESNAME_READWRITETYPE               "_RW_" /* read_only(0), Writeable (1) */
-#define ASL_RESNAME_TRANSLATION                 "_TRA"
-#define ASL_RESNAME_TRANSTYPE                   "_TRS" /* Sparse(1), Dense(0) */
-#define ASL_RESNAME_TYPE                        "_TTP" /* Translation(1), Static (0) */
-#define ASL_RESNAME_XFERTYPE                    "_SIz" /* 8(0), 8_and16(1), 16(2) */
+/*
+ * Resource descriptor tags, as defined in the ACPI specification.
+ * Used to symbolically reference fields within a descriptor.
+ */
+#define ACPI_RESTAG_ADDRESS                     "_ADR"
+#define ACPI_RESTAG_ALIGNMENT                   "_ALN"
+#define ACPI_RESTAG_ADDRESSSPACE                "_ASI"
+#define ACPI_RESTAG_ACCESSSIZE                  "_ASZ"
+#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES      "_ATT"
+#define ACPI_RESTAG_BASEADDRESS                 "_BAS"
+#define ACPI_RESTAG_BUSMASTER                   "_BM_" /* Master(1), Slave(0) */
+#define ACPI_RESTAG_DECODE                      "_DEC"
+#define ACPI_RESTAG_DMA                         "_DMA"
+#define ACPI_RESTAG_DMATYPE                     "_TYP" /* Compatible(0), A(1), B(2), F(3) */
+#define ACPI_RESTAG_GRANULARITY                 "_GRA"
+#define ACPI_RESTAG_INTERRUPT                   "_INT"
+#define ACPI_RESTAG_INTERRUPTLEVEL              "_LL_" /* active_lo(1), active_hi(0) */
+#define ACPI_RESTAG_INTERRUPTSHARE              "_SHR" /* Shareable(1), no_share(0) */
+#define ACPI_RESTAG_INTERRUPTTYPE               "_HE_" /* Edge(1), Level(0) */
+#define ACPI_RESTAG_LENGTH                      "_LEN"
+#define ACPI_RESTAG_MEMATTRIBUTES               "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ACPI_RESTAG_MEMTYPE                     "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ACPI_RESTAG_MAXADDR                     "_MAX"
+#define ACPI_RESTAG_MINADDR                     "_MIN"
+#define ACPI_RESTAG_MAXTYPE                     "_MAF"
+#define ACPI_RESTAG_MINTYPE                     "_MIF"
+#define ACPI_RESTAG_REGISTERBITOFFSET           "_RBO"
+#define ACPI_RESTAG_REGISTERBITWIDTH            "_RBW"
+#define ACPI_RESTAG_RANGETYPE                   "_RNG"
+#define ACPI_RESTAG_READWRITETYPE               "_RW_" /* read_only(0), Writeable (1) */
+#define ACPI_RESTAG_TRANSLATION                 "_TRA"
+#define ACPI_RESTAG_TRANSTYPE                   "_TRS" /* Sparse(1), Dense(0) */
+#define ACPI_RESTAG_TYPE                        "_TTP" /* Translation(1), Static (0) */
+#define ACPI_RESTAG_XFERTYPE                    "_SIZ" /* 8(0), 8_and16(1), 16(2) */
 
 /* Default sizes for "small" resource descriptors */
 
@@ -109,7 +115,7 @@ struct asl_resource_node {
  * SMALL descriptors
  */
 #define AML_RESOURCE_SMALL_HEADER_COMMON \
-       u8                                  descriptor_type;
+       u8                              descriptor_type;
 
 struct aml_resource_small_header {
 AML_RESOURCE_SMALL_HEADER_COMMON};
@@ -162,8 +168,8 @@ struct aml_resource_end_tag {
  * LARGE descriptors
  */
 #define AML_RESOURCE_LARGE_HEADER_COMMON \
-       u8                                  descriptor_type;\
-       u16                                 resource_length;
+       u8                              descriptor_type;\
+       u16                             resource_length;
 
 struct aml_resource_large_header {
 AML_RESOURCE_LARGE_HEADER_COMMON};
@@ -194,9 +200,9 @@ struct aml_resource_fixed_memory32 {
 };
 
 #define AML_RESOURCE_ADDRESS_COMMON \
-       u8                                  resource_type; \
-       u8                                  flags; \
-       u8                                  specific_flags;
+       u8                              resource_type; \
+       u8                              flags; \
+       u8                              specific_flags;
 
 struct aml_resource_address {
 AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
@@ -266,6 +272,7 @@ struct aml_resource_generic_register {
 union aml_resource {
        /* Descriptor headers */
 
+       u8 descriptor_type;
        struct aml_resource_small_header small_header;
        struct aml_resource_large_header large_header;
 
@@ -296,9 +303,9 @@ union aml_resource {
        /* Utility overlays */
 
        struct aml_resource_address address;
-       u32 u32_item;
-       u16 u16_item;
-       u8 U8item;
+       u32 dword_item;
+       u16 word_item;
+       u8 byte_item;
 };
 
 #endif
index 223ec6467108f918f4071ac454f1eceb8ece10de..453a469fd397b9a8073037d25ddfd2761c218c29 100644 (file)
  */
 
 #ifdef ACPI_LIBRARY
+/*
+ * Note: The non-debug version of the acpi_library does not contain any
+ * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
+ */
 #define ACPI_USE_LOCAL_CACHE
 #endif
 
-#ifdef ACPI_DUMP_APP
-#ifndef MSDOS
+#ifdef ACPI_ASL_COMPILER
 #define ACPI_DEBUG_OUTPUT
-#endif
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
-#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
 #endif
 
 #ifdef ACPI_EXEC_APP
 #undef DEBUGGER_THREADING
 #define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
-#define ACPI_DEBUG_OUTPUT
+#define ACPI_FULL_DEBUG
 #define ACPI_APPLICATION
 #define ACPI_DEBUGGER
-#define ACPI_DISASSEMBLER
 #define ACPI_MUTEX_DEBUG
+#define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 
-#ifdef ACPI_ASL_COMPILER
+#ifdef ACPI_DASM_APP
+#ifndef MSDOS
 #define ACPI_DEBUG_OUTPUT
+#endif
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
-#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
 #endif
 
 #ifdef ACPI_APPLICATION
 #define ACPI_USE_LOCAL_CACHE
 #endif
 
+#ifdef ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_DISASSEMBLER
+#endif
+
 /*
  * Environment configuration.  The purpose of this file is to interface to the
  * local generation environment.
 #elif defined(MSDOS)           /* Must appear after WIN32 and WIN64 check */
 #include "acdos16.h"
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include "acfreebsd.h"
 
 #elif defined(__NetBSD__)
 
 #endif
 
-/*
- * Memory allocation tracking.  Used only if
- * 1) This is the debug version
- * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
- */
-#ifdef ACPI_DEBUG_OUTPUT
-#if ACPI_MACHINE_WIDTH != 16
-#define ACPI_DBG_TRACK_ALLOCATIONS
-#endif
-#endif
-
 /*! [End] no source code translation !*/
 
 /*
@@ -271,8 +274,8 @@ typedef char *va_list;
 /*
  * Storage alignment properties
  */
-#define  _AUPBND                (sizeof (acpi_native_uint) - 1)
-#define  _ADNBND                (sizeof (acpi_native_uint) - 1)
+#define  _AUPBND                (sizeof (acpi_native_int) - 1)
+#define  _ADNBND                (sizeof (acpi_native_int) - 1)
 
 /*
  * Variable argument list macro definitions
index 2e6d54569ee8adcd7296737a8264ca35b9f3a13d..b5655a665ba8c9d8c5f93c90aa5ba9cbd3900f23 100644 (file)
 #include <linux/config.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/ctype.h>
 #include <asm/system.h>
 #include <asm/atomic.h>
 #include <asm/div64.h>
 #include <asm/acpi.h>
+#include <linux/slab.h>
 
-#define strtoul simple_strtoul
-
-#define ACPI_MACHINE_WIDTH  BITS_PER_LONG
+/* Host-dependent types and defines */
 
-/* Type(s) for the OSL */
-
-#ifdef ACPI_USE_LOCAL_CACHE
-#define acpi_cache_t   struct acpi_memory_list
-#else
-#include <linux/slab.h>
-#define acpi_cache_t   kmem_cache_t
-#endif
+#define ACPI_MACHINE_WIDTH          BITS_PER_LONG
+#define acpi_cache_t                        kmem_cache_t
+#define ACPI_EXPORT_SYMBOL(symbol)  EXPORT_SYMBOL(symbol);
+#define strtoul                     simple_strtoul
 
 /* Full namespace pathname length limit - arbitrary */
-
 #define ACPI_PATHNAME_MAX              256
 
 #else                          /* !__KERNEL__ */
 
 #define acpi_cpu_flags unsigned long
 
+#define acpi_thread_id u32
+
+static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; }
+
 #endif                         /* __ACLINUX_H__ */
index 9950706abdf8289f0d2815dd45102aa787016038..e1432102be05a55a150c0726d8ea55dec123d356 100644 (file)
@@ -45,10 +45,8 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
 #define hard_smp_processor_id()        __hard_smp_processor_id()
 #define raw_smp_processor_id() (current_thread_info()->cpu)
 
-extern cpumask_t cpu_present_mask;
-extern cpumask_t cpu_online_map;
 extern int smp_num_cpus;
-#define cpu_possible_map       cpu_present_mask
+#define cpu_possible_map       cpu_present_map
 
 int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, cpumask_t cpu);
 
index f4837fa29420428a5b4c70c7b360b467bd49fae0..5541101b58aef8c962ebc416539daefe12cc3fd8 100644 (file)
@@ -148,6 +148,7 @@ struct termios {
 #define HUPCL  00040000
 
 #define CLOCAL 00100000
+#define CMSPAR   010000000000          /* mark or space (stick) parity */
 #define CRTSCTS          020000000000          /* flow control */
 
 /* c_lflag bits */
index 6e19f46d54d1c2aaf947aca24fdc01c4569390fc..c85fc06a043c10dc00392d72b3ef726aa40eece9 100644 (file)
@@ -49,7 +49,7 @@ static inline int __ixp23xx_arch_is_coherent(void)
 {
        extern unsigned int processor_id;
 
-       if (((processor_id & 15) >= 2) || machine_is_roadrunner())
+       if (((processor_id & 15) >= 4) || machine_is_roadrunner())
                return 1;
 
        return 0;
index 238c595d97ea79760d151e453da1869ad99c4dcc..b1008a9d23e5a8aea54870ff13eccb6604370161 100644 (file)
@@ -28,7 +28,7 @@
 #define UARTDR                 0x00    /* Tx/Rx data */
 #define RXSTAT                 0x04    /* Rx status */
 #define H_UBRLCR               0x08    /* mode register high */
-#define M_UBRLCR               0x0C    /* mode reg mid (MSB of buad)*/
+#define M_UBRLCR               0x0C    /* mode reg mid (MSB of baud)*/
 #define L_UBRLCR               0x10    /* mode reg low (LSB of baud)*/
 #define UARTCON                        0x14    /* control register */
 #define UARTFLG                        0x18    /* flag register */
index 9fcd40aee3e3027a929b03e2aa0c24f6e00ebd8d..04be2a088639df302ac0bed781027f6ec2f828c2 100644 (file)
@@ -6,7 +6,7 @@
  * Changelog:
  *  05-01-2000 SJH     Created
  *  05-13-2000 SJH     Filled in function bodies
- *  07-26-2000 SJH     Removed hard coded buad rate
+ *  07-26-2000 SJH     Removed hard coded baud rate
  */
 
 #include <asm/hardware.h>
index 7da89569061eb025163eff9745437971c6459743..e848a47128cdd42b3a9bed8b48b3fc316ff1d2d4 100644 (file)
@@ -11,6 +11,8 @@ struct pxaohci_platform_data {
 #define PMM_NPS_MODE           1
 #define PMM_GLOBAL_MODE        2
 #define PMM_PERPORT_MODE       3
+
+       int power_budget;
 };
 
 extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
diff --git a/include/asm-arm/arch-pxa/pxa2xx_spi.h b/include/asm-arm/arch-pxa/pxa2xx_spi.h
new file mode 100644 (file)
index 0000000..915590c
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef PXA2XX_SPI_H_
+#define PXA2XX_SPI_H_
+
+#define PXA2XX_CS_ASSERT (0x01)
+#define PXA2XX_CS_DEASSERT (0x02)
+
+#if defined(CONFIG_PXA25x)
+#define CLOCK_SPEED_HZ 3686400
+#define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/2/(x+1))<<8)&0x0000ff00)
+#define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)
+#define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)
+#define SSP_TIMEOUT_SCALE (2712)
+#elif defined(CONFIG_PXA27x)
+#define CLOCK_SPEED_HZ 13000000
+#define SSP1_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)
+#define SSP2_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)
+#define SSP3_SerClkDiv(x) (((CLOCK_SPEED_HZ/(x+1))<<8)&0x000fff00)
+#define SSP_TIMEOUT_SCALE (769)
+#endif
+
+#define SSP_TIMEOUT(x) ((x*10000)/SSP_TIMEOUT_SCALE)
+#define SSP1_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(1)))))
+#define SSP2_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(2)))))
+#define SSP3_VIRT ((void *)(io_p2v(__PREG(SSCR0_P(3)))))
+
+enum pxa_ssp_type {
+       SSP_UNDEFINED = 0,
+       PXA25x_SSP,  /* pxa 210, 250, 255, 26x */
+       PXA25x_NSSP, /* pxa 255, 26x (including ASSP) */
+       PXA27x_SSP,
+};
+
+/* device.platform_data for SSP controller devices */
+struct pxa2xx_spi_master {
+       enum pxa_ssp_type ssp_type;
+       u32 clock_enable;
+       u16 num_chipselect;
+       u8 enable_dma;
+};
+
+/* spi_board_info.controller_data for SPI slave devices,
+ * copied to spi_device.platform_data ... mostly for dma tuning
+ */
+struct pxa2xx_spi_chip {
+       u8 tx_threshold;
+       u8 rx_threshold;
+       u8 dma_burst_size;
+       u32 timeout_microsecs;
+       u8 enable_loopback;
+       void (*cs_control)(u32 command);
+};
+
+#endif /*PXA2XX_SPI_H_*/
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
new file mode 100644 (file)
index 0000000..258c00b
--- /dev/null
@@ -0,0 +1,31 @@
+/* linux/include/asm-arm/arch-s3c2410/spi.h
+ *
+ * Copyright (c) 2006 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - SPI Controller platfrom_device info
+ *
+ * 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_SPIGPIO_H
+#define __ASM_ARCH_SPIGPIO_H __FILE__
+
+struct s3c2410_spigpio_info;
+struct spi_board_info;
+
+struct s3c2410_spigpio_info {
+       unsigned long            pin_clk;
+       unsigned long            pin_mosi;
+       unsigned long            pin_miso;
+
+       unsigned long            board_size;
+       struct spi_board_info   *board_info;
+
+       void (*chip_select)(struct s3c2410_spigpio_info *spi, int cs);
+};
+
+
+#endif /* __ASM_ARCH_SPIGPIO_H */
diff --git a/include/asm-arm/arch-s3c2410/spi.h b/include/asm-arm/arch-s3c2410/spi.h
new file mode 100644 (file)
index 0000000..4029a1a
--- /dev/null
@@ -0,0 +1,29 @@
+/* linux/include/asm-arm/arch-s3c2410/spi.h
+ *
+ * Copyright (c) 2006 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C2410 - SPI Controller platform_device info
+ *
+ * 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_SPI_H
+#define __ASM_ARCH_SPI_H __FILE__
+
+struct s3c2410_spi_info;
+struct spi_board_info;
+
+struct s3c2410_spi_info {
+       unsigned long            pin_cs;        /* simple gpio cs */
+
+       unsigned long            board_size;
+       struct spi_board_info   *board_info;
+
+       void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
+};
+
+
+#endif /* __ASM_ARCH_SPI_H */
index a9c75b2c314f588bc279e9b59f8de3e72408cad8..842526055225a02e88a7cc9d8ed34a8c49ef8c21 100644 (file)
@@ -45,8 +45,6 @@ extern unsigned int elf_hwcap;
 
 #endif /* __ASSEMBLY__ */
 
-#define PROC_INFO_SZ   48
-
 #define HWCAP_SWP      1
 #define HWCAP_HALF     2
 #define HWCAP_THUMB    4
index 43ad4e55878c7961a535e6ce427b842adecb2372..406ca97a8ab29f99d381565ab3c9b745c1f147a3 100644 (file)
@@ -142,6 +142,9 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
        : "cc");
 }
 
+/* write_can_lock - would write_trylock() succeed? */
+#define __raw_write_can_lock(x)                ((x)->lock == 0x80000000)
+
 /*
  * Read locks are a bit more hairy:
  *  - Exclusively load the lock value.
@@ -198,4 +201,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
 
 #define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
 
+/* read_can_lock - would read_trylock() succeed? */
+#define __raw_read_can_lock(x)         ((x)->lock < 0x80000000)
+
 #endif /* __ASM_SPINLOCK_H */
index 95b3abf4851bb9cc70596edd3a239076910939ee..7c9568d30307ff46ffafec33122de19d4f4f9e29 100644 (file)
@@ -127,6 +127,12 @@ static inline int cpu_is_xsc3(void)
 }
 #endif
 
+#if !defined(CONFIG_CPU_XSCALE) && !defined(CONFIG_CPU_XSC3)
+#define        cpu_is_xscale() 0
+#else
+#define        cpu_is_xscale() 1
+#endif
+
 #define set_cr(x)                                      \
        __asm__ __volatile__(                           \
        "mcr    p15, 0, %0, c1, c0, 0   @ set CR"       \
index 358e4d309ceb179776f2a7036dabce02cdfad1d2..c2059a3a06216cb936a163255501e20d464c6b21 100644 (file)
@@ -159,17 +159,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 #define lazy_mmu_prot_update(pte)      do { } while (0)
 #endif
 
-#ifndef __HAVE_ARCH_MULTIPLE_ZERO_PAGE
+#ifndef __HAVE_ARCH_MOVE_PTE
 #define move_pte(pte, prot, old_addr, new_addr)        (pte)
-#else
-#define move_pte(pte, prot, old_addr, new_addr)                                \
-({                                                                     \
-       pte_t newpte = (pte);                                           \
-       if (pte_present(pte) && pfn_valid(pte_pfn(pte)) &&              \
-                       pte_page(pte) == ZERO_PAGE(old_addr))           \
-               newpte = mk_pte(ZERO_PAGE(new_addr), (prot));           \
-       newpte;                                                         \
-})
 #endif
 
 /*
index 5e4a35af292174423801800207463fc2a65dc326..9f6995341fdc9067b9005a1034531e35cdfa5c94 100644 (file)
  */
 #define u32 unsigned int
 
-#define lapic ((volatile struct local_apic *)APIC_BASE)
 
 struct local_apic {
 
index 42520cc84b0f7d5074cb8e9fa6d08580b23099c4..1386af1cb7d9f08153a028f2392d636015cc3568 100644 (file)
 #if defined (CONFIG_CPU_R4300)                                         \
     || defined (CONFIG_CPU_R4X00)                                      \
     || defined (CONFIG_CPU_R5000)                                      \
+    || defined (CONFIG_CPU_RM7000)                                     \
     || defined (CONFIG_CPU_NEVADA)                                     \
     || defined (CONFIG_CPU_TX49XX)                                     \
     || defined (CONFIG_CPU_MIPS64)
index 818b9a97e214280c0c6a93af52699028e32a95bb..dff2a0a52f8f300e6979b79a2848c88c71b42cd6 100644 (file)
@@ -51,6 +51,7 @@
 #define PRID_IMP_R4300         0x0b00
 #define PRID_IMP_VR41XX                0x0c00
 #define PRID_IMP_R12000                0x0e00
+#define PRID_IMP_R14000                0x0f00
 #define PRID_IMP_R8000         0x1000
 #define PRID_IMP_PR4450                0x1200
 #define PRID_IMP_R4600         0x2000
@@ -87,6 +88,7 @@
 #define PRID_IMP_24K           0x9300
 #define PRID_IMP_34K           0x9500
 #define PRID_IMP_24KE          0x9600
+#define PRID_IMP_74K           0x9700
 
 /*
  * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
 #define CPU_34K                        60
 #define CPU_PR4450             61
 #define CPU_SB1A               62
-#define CPU_LAST               62
+#define CPU_74K                        63
+#define CPU_R14000             64
+#define CPU_LAST               64
 
 /*
  * ISA Level encodings
index 64dd45150f64f69e38c7116a28a05a0c508015ae..928f30f8c45cd6cfe405743d2faf388da033f1d1 100644 (file)
@@ -19,20 +19,22 @@ static inline void __delay(unsigned long loops)
 {
        if (sizeof(long) == 4)
                __asm__ __volatile__ (
-               ".set\tnoreorder\n"
-               "1:\tbnez\t%0,1b\n\t"
-               "subu\t%0,1\n\t"
-               ".set\treorder"
+               "       .set    noreorder                               \n"
+               "       .align  3                                       \n"
+               "1:     bnez    %0, 1b                                  \n"
+               "       subu    %0, 1                                   \n"
+               "       .set    reorder                                 \n"
                : "=r" (loops)
                : "0" (loops));
        else if (sizeof(long) == 8)
                __asm__ __volatile__ (
-               ".set\tnoreorder\n"
-               "1:\tbnez\t%0,1b\n\t"
-               "dsubu\t%0,1\n\t"
-               ".set\treorder"
-               :"=r" (loops)
-               :"0" (loops));
+               "       .set    noreorder                               \n"
+               "       .align  3                                       \n"
+               "1:     bnez    %0, 1b                                  \n"
+               "       dsubu   %0, 1                                   \n"
+               "       .set    reorder                                 \n"
+               : "=r" (loops)
+               : "0" (loops));
 }
 
 
index a554089991f26ce3407da2e1d26b9904dd025800..12d118f1bc9c7768d3a2e14b9ed0458e5569feb6 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/futex.h>
 #include <asm/errno.h>
 #include <asm/uaccess.h>
+#include <asm/war.h>
 
 #ifdef CONFIG_SMP
 #define __FUTEX_SMP_SYNC "     sync                                    \n"
 
 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)             \
 {                                                                      \
-       __asm__ __volatile__(                                           \
-       "       .set    push                                    \n"     \
-       "       .set    noat                                    \n"     \
-       "       .set    mips3                                   \n"     \
-       "1:     ll      %1, (%3)        # __futex_atomic_op1    \n"     \
-       "       .set    mips0                                   \n"     \
-       "       " insn  "                                       \n"     \
-       "       .set    mips3                                   \n"     \
-       "2:     sc      $1, (%3)                                \n"     \
-       "       beqzl   $1, 1b                                  \n"     \
-       __FUTEX_SMP_SYNC                                                \
-       "3:                                                     \n"     \
-       "       .set    pop                                     \n"     \
-       "       .set    mips0                                   \n"     \
-       "       .section .fixup,\"ax\"                          \n"     \
-       "4:     li      %0, %5                                  \n"     \
-       "       j       2b                                      \n"     \
-       "       .previous                                       \n"     \
-       "       .section __ex_table,\"a\"                       \n"     \
-       "       "__UA_ADDR "\t1b, 4b                            \n"     \
-       "       "__UA_ADDR "\t2b, 4b                            \n"     \
-       "       .previous                                       \n"     \
-       : "=r" (ret), "=r" (oldval)                                     \
-       : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT));           \
+       if (cpu_has_llsc && R10000_LLSC_WAR) {                          \
+               __asm__ __volatile__(                                   \
+               "       .set    push                            \n"     \
+               "       .set    noat                            \n"     \
+               "       .set    mips3                           \n"     \
+               "1:     ll      %1, (%3)        # __futex_atomic_op     \n" \
+               "       .set    mips0                           \n"     \
+               "       " insn  "                               \n"     \
+               "       .set    mips3                           \n"     \
+               "2:     sc      $1, (%3)                        \n"     \
+               "       beqzl   $1, 1b                          \n"     \
+               __FUTEX_SMP_SYNC                                        \
+               "3:                                             \n"     \
+               "       .set    pop                             \n"     \
+               "       .set    mips0                           \n"     \
+               "       .section .fixup,\"ax\"                  \n"     \
+               "4:     li      %0, %5                          \n"     \
+               "       j       2b                              \n"     \
+               "       .previous                               \n"     \
+               "       .section __ex_table,\"a\"               \n"     \
+               "       "__UA_ADDR "\t1b, 4b                    \n"     \
+               "       "__UA_ADDR "\t2b, 4b                    \n"     \
+               "       .previous                               \n"     \
+               : "=r" (ret), "=r" (oldval)                             \
+               : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT));   \
+       } else if (cpu_has_llsc) {                                      \
+               __asm__ __volatile__(                                   \
+               "       .set    push                            \n"     \
+               "       .set    noat                            \n"     \
+               "       .set    mips3                           \n"     \
+               "1:     ll      %1, (%3)        # __futex_atomic_op     \n" \
+               "       .set    mips0                           \n"     \
+               "       " insn  "                               \n"     \
+               "       .set    mips3                           \n"     \
+               "2:     sc      $1, (%3)                        \n"     \
+               "       beqz    $1, 1b                          \n"     \
+               __FUTEX_SMP_SYNC                                        \
+               "3:                                             \n"     \
+               "       .set    pop                             \n"     \
+               "       .set    mips0                           \n"     \
+               "       .section .fixup,\"ax\"                  \n"     \
+               "4:     li      %0, %5                          \n"     \
+               "       j       2b                              \n"     \
+               "       .previous                               \n"     \
+               "       .section __ex_table,\"a\"               \n"     \
+               "       "__UA_ADDR "\t1b, 4b                    \n"     \
+               "       "__UA_ADDR "\t2b, 4b                    \n"     \
+               "       .previous                               \n"     \
+               : "=r" (ret), "=r" (oldval)                             \
+               : "0" (0), "r" (uaddr), "Jr" (oparg), "i" (-EFAULT));   \
+       } else                                                          \
+               ret = -ENOSYS;                                          \
 }
 
 static inline int
@@ -102,7 +131,69 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
 static inline int
 futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
 {
-       return -ENOSYS;
+       int retval;
+
+       if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
+               return -EFAULT;
+
+       if (cpu_has_llsc && R10000_LLSC_WAR) {
+               __asm__ __volatile__(
+               "# futex_atomic_cmpxchg_inatomic                        \n"
+               "       .set    push                                    \n"
+               "       .set    noat                                    \n"
+               "       .set    mips3                                   \n"
+               "1:     ll      %0, %2                                  \n"
+               "       bne     %0, %z3, 3f                             \n"
+               "       .set    mips0                                   \n"
+               "       move    $1, %z4                                 \n"
+               "       .set    mips3                                   \n"
+               "2:     sc      $1, %1                                  \n"
+               "       beqzl   $1, 1b                                  \n"
+               __FUTEX_SMP_SYNC
+               "3:                                                     \n"
+               "       .set    pop                                     \n"
+               "       .section .fixup,\"ax\"                          \n"
+               "4:     li      %0, %5                                  \n"
+               "       j       3b                                      \n"
+               "       .previous                                       \n"
+               "       .section __ex_table,\"a\"                       \n"
+               "       "__UA_ADDR "\t1b, 4b                            \n"
+               "       "__UA_ADDR "\t2b, 4b                            \n"
+               "       .previous                                       \n"
+               : "=&r" (retval), "=R" (*uaddr)
+               : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
+               : "memory");
+       } else if (cpu_has_llsc) {
+               __asm__ __volatile__(
+               "# futex_atomic_cmpxchg_inatomic                        \n"
+               "       .set    push                                    \n"
+               "       .set    noat                                    \n"
+               "       .set    mips3                                   \n"
+               "1:     ll      %0, %2                                  \n"
+               "       bne     %0, %z3, 3f                             \n"
+               "       .set    mips0                                   \n"
+               "       move    $1, %z4                                 \n"
+               "       .set    mips3                                   \n"
+               "2:     sc      $1, %1                                  \n"
+               "       beqz    $1, 1b                                  \n"
+               __FUTEX_SMP_SYNC
+               "3:                                                     \n"
+               "       .set    pop                                     \n"
+               "       .section .fixup,\"ax\"                          \n"
+               "4:     li      %0, %5                                  \n"
+               "       j       3b                                      \n"
+               "       .previous                                       \n"
+               "       .section __ex_table,\"a\"                       \n"
+               "       "__UA_ADDR "\t1b, 4b                            \n"
+               "       "__UA_ADDR "\t2b, 4b                            \n"
+               "       .previous                                       \n"
+               : "=&r" (retval), "=R" (*uaddr)
+               : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
+               : "memory");
+       } else
+               return -ENOSYS;
+
+       return retval;
 }
 
 #endif
index e0745f4ff6240292f0cdb510534bb67aee2157b7..1ed8d0f62577d4e01246d2834e2da4fed935ac85 100644 (file)
@@ -6,6 +6,7 @@
  * for more details.
  *
  * Copyright (C) 1996, 2000 by Ralf Baechle
+ * Copyright (C) 2006 by Thiemo Seufer
  */
 #ifndef _ASM_INST_H
 #define _ASM_INST_H
@@ -21,14 +22,14 @@ enum major_op {
        cop0_op, cop1_op, cop2_op, cop1x_op,
        beql_op, bnel_op, blezl_op, bgtzl_op,
        daddi_op, daddiu_op, ldl_op, ldr_op,
-       major_1c_op, jalx_op, major_1e_op, major_1f_op,
+       spec2_op, jalx_op, mdmx_op, spec3_op,
        lb_op, lh_op, lwl_op, lw_op,
        lbu_op, lhu_op, lwr_op, lwu_op,
        sb_op, sh_op, swl_op, sw_op,
        sdl_op, sdr_op, swr_op, cache_op,
        ll_op, lwc1_op, lwc2_op, pref_op,
        lld_op, ldc1_op, ldc2_op, ld_op,
-       sc_op, swc1_op, swc2_op, rdhwr_op,
+       sc_op, swc1_op, swc2_op, major_3b_op,
        scd_op, sdc1_op, sdc2_op, sd_op
 };
 
@@ -37,7 +38,7 @@ enum major_op {
  */
 enum spec_op {
        sll_op, movc_op, srl_op, sra_op,
-       sllv_op, srlv_op, srav_op, spec1_unused_op, /* Opcode 0x07 is unused */
+       sllv_op, pmon_op, srlv_op, srav_op,
        jr_op, jalr_op, movz_op, movn_op,
        syscall_op, break_op, spim_op, sync_op,
        mfhi_op, mthi_op, mflo_op, mtlo_op,
@@ -54,6 +55,28 @@ enum spec_op {
        dsll32_op, spec8_unused_op, dsrl32_op, dsra32_op
 };
 
+/*
+ * func field of spec2 opcode.
+ */
+enum spec2_op {
+       madd_op, maddu_op, mul_op, spec2_3_unused_op,
+       msub_op, msubu_op, /* more unused ops */
+       clz_op = 0x20, clo_op,
+       dclz_op = 0x24, dclo_op,
+       sdbpp_op = 0x3f
+};
+
+/*
+ * func field of spec3 opcode.
+ */
+enum spec3_op {
+       ext_op, dextm_op, dextu_op, dext_op,
+       ins_op, dinsm_op, dinsu_op, dins_op,
+       bshfl_op = 0x20,
+       dbshfl_op = 0x24,
+       rdhwr_op = 0x3f
+};
+
 /*
  * rt field of bcond opcodes.
  */
@@ -151,8 +174,8 @@ enum cop1x_func {
  * func field for mad opcodes (MIPS IV).
  */
 enum mad_func {
-       madd_op      = 0x08, msub_op      = 0x0a,
-       nmadd_op     = 0x0c, nmsub_op     = 0x0e
+       madd_fp_op      = 0x08, msub_fp_op      = 0x0a,
+       nmadd_fp_op     = 0x0c, nmsub_fp_op     = 0x0e
 };
 
 /*
index a2ef579f6b1a26d8e87d3b5c19b405629dfe0b29..5af7517fce8a8a83cd426013633e59221a88b6ef 100644 (file)
 #define ST0_DL                 (_ULCAST_(1) << 24)
 
 /*
- * Enable the MIPS DSP ASE
+ * Enable the MIPS MDMX and DSP ASEs
  */
 #define ST0_MX                 0x01000000
 
index a1eab136ff6c7963a6dc2dde3b996db13e70bcda..4035ec79ecd494415bceccdc32f91d31e388aee6 100644 (file)
@@ -139,9 +139,11 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 
+#ifndef CONFIG_SPARSEMEM
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 #define pfn_valid(pfn)         ((pfn) < max_mapnr)
 #endif
+#endif
 
 #define virt_to_page(kaddr)    pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
index 4d6bc45df5947280ed1e88d17fc3ae66685fecde..087c20769256ec877c823b3a0ea421d2e8e5ca03 100644 (file)
@@ -177,48 +177,67 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
        ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
 
 /*
- * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset
- * into this range:
+ * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
  */
-#define PTE_FILE_MAX_BITS      27
+#define PTE_FILE_MAX_BITS      28
 
-#define pte_to_pgoff(_pte) \
-       ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 ))
+#define pte_to_pgoff(_pte)     ((((_pte).pte >> 1 ) & 0x07) | \
+                                (((_pte).pte >> 2 ) & 0x38) | \
+                                (((_pte).pte >> 10) <<  6 ))
 
-#define pgoff_to_pte(off) \
-       ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE })
+#define pgoff_to_pte(off)      ((pte_t) { (((off) & 0x07) << 1 ) | \
+                                          (((off) & 0x38) << 2 ) | \
+                                          (((off) >>  6 ) << 10) | \
+                                          _PAGE_FILE })
 
 #else
 
 /* Swap entries must have VALID and GLOBAL bits cleared. */
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
+#define __swp_type(x)          (((x).val >> 2) & 0x1f)
+#define __swp_offset(x)         ((x).val >> 7)
+#define __swp_entry(type,offset)       \
+               ((swp_entry_t)  { ((type) << 2) | ((offset) << 7) })
+#else
 #define __swp_type(x)          (((x).val >> 8) & 0x1f)
-#define __swp_offset(x)                ((x).val >> 13)
+#define __swp_offset(x)         ((x).val >> 13)
 #define __swp_entry(type,offset)       \
-               ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
+               ((swp_entry_t)  { ((type) << 8) | ((offset) << 13) })
+#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
 
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
 /*
- * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset
- * into this range:
+ * Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
  */
-#define PTE_FILE_MAX_BITS      27
+#define PTE_FILE_MAX_BITS      30
 
-#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
-       /* fixme */
-#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
-#define pgoff_to_pte(off) \
-       ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
+#define pte_to_pgoff(_pte)     ((_pte).pte_high >> 2)
+#define pgoff_to_pte(off)      ((pte_t) { _PAGE_FILE, (off) << 2 })
 
 #else
-#define pte_to_pgoff(_pte) \
-       ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))
+/*
+ * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range:
+ */
+#define PTE_FILE_MAX_BITS      28
+
+#define pte_to_pgoff(_pte)     ((((_pte).pte >> 1) & 0x7) | \
+                                (((_pte).pte >> 2) & 0x8) | \
+                                (((_pte).pte >> 8) <<  4))
 
-#define pgoff_to_pte(off) \
-       ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
+#define pgoff_to_pte(off)      ((pte_t) { (((off) & 0x7) << 1) | \
+                                          (((off) & 0x8) << 2) | \
+                                          (((off) >>  4) << 8) | \
+                                          _PAGE_FILE })
 #endif
 
 #endif
 
+#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
+#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
+#define __swp_entry_to_pte(x)  ((pte_t) { 0, (x).val })
+#else
 #define __pte_to_swp_entry(pte)        ((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)  ((pte_t) { (x).val })
+#endif
 
 #endif /* _ASM_PGTABLE_32_H */
index 82166b254b2704d649dc27f1acb725ba07dadf38..2faf5c9ff127dc3e669483c2c578146fc96ffc4f 100644 (file)
@@ -224,15 +224,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
 #define __swp_entry_to_pte(x)  ((pte_t) { (x).val })
 
 /*
- * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset
- * into this range:
+ * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
+ * make things easier, and only use the upper 56 bits for the page offset...
  */
-#define PTE_FILE_MAX_BITS      32
+#define PTE_FILE_MAX_BITS      56
 
-#define pte_to_pgoff(_pte) \
-       ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 ))
-
-#define pgoff_to_pte(off) \
-       ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
+#define pte_to_pgoff(_pte)     ((_pte).pte >> 8)
+#define pgoff_to_pte(off)      ((pte_t) { ((off) << 8) | _PAGE_FILE })
 
 #endif /* _ASM_PGTABLE_64_H */
index 702a28fa7a3489d01c2ff986c7dfd0adefebe0bc..d0af2a3b0152f2c7d2eadae2a1f1c4b6076fa5ac 100644 (file)
@@ -70,7 +70,15 @@ extern unsigned long zero_page_mask;
 #define ZERO_PAGE(vaddr) \
        (virt_to_page(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))
 
-#define __HAVE_ARCH_MULTIPLE_ZERO_PAGE
+#define __HAVE_ARCH_MOVE_PTE
+#define move_pte(pte, prot, old_addr, new_addr)                                \
+({                                                                     \
+       pte_t newpte = (pte);                                           \
+       if (pte_present(pte) && pfn_valid(pte_pfn(pte)) &&              \
+                       pte_page(pte) == ZERO_PAGE(old_addr))           \
+               newpte = mk_pte(ZERO_PAGE(new_addr), (prot));           \
+       newpte;                                                         \
+})
 
 extern void paging_init(void);
 
@@ -82,10 +90,11 @@ extern void paging_init(void);
 #define pmd_page(pmd)          (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
 #define pmd_page_kernel(pmd)   pmd_val(pmd)
 
-#define pte_none(pte)          (!(pte_val(pte) & ~_PAGE_GLOBAL))
-#define pte_present(pte)       (pte_val(pte) & _PAGE_PRESENT)
-
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
+
+#define pte_none(pte)          (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
+#define pte_present(pte)       ((pte).pte_low & _PAGE_PRESENT)
+
 static inline void set_pte(pte_t *ptep, pte_t pte)
 {
        ptep->pte_high = pte.pte_high;
@@ -93,27 +102,35 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
        ptep->pte_low = pte.pte_low;
        //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low);
 
-       if (pte_val(pte) & _PAGE_GLOBAL) {
+       if (pte.pte_low & _PAGE_GLOBAL) {
                pte_t *buddy = ptep_buddy(ptep);
                /*
                 * Make sure the buddy is global too (if it's !none,
                 * it better already be global)
                 */
-               if (pte_none(*buddy))
-                       buddy->pte_low |= _PAGE_GLOBAL;
+               if (pte_none(*buddy)) {
+                       buddy->pte_low  |= _PAGE_GLOBAL;
+                       buddy->pte_high |= _PAGE_GLOBAL;
+               }
        }
 }
 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
 static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
+       pte_t null = __pte(0);
+
        /* Preserve global status for the pair */
-       if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
-               set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
-       else
-               set_pte_at(mm, addr, ptep, __pte(0));
+       if (ptep_buddy(ptep)->pte_low & _PAGE_GLOBAL)
+               null.pte_low = null.pte_high = _PAGE_GLOBAL;
+
+       set_pte_at(mm, addr, ptep, null);
 }
 #else
+
+#define pte_none(pte)          (!(pte_val(pte) & ~_PAGE_GLOBAL))
+#define pte_present(pte)       (pte_val(pte) & _PAGE_PRESENT)
+
 /*
  * Certain architectures need to do special things when pte's
  * within a page table are directly modified.  Thus, the following
@@ -174,75 +191,76 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  */
 static inline int pte_user(pte_t pte)  { BUG(); return 0; }
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
-static inline int pte_read(pte_t pte)  { return (pte).pte_low & _PAGE_READ; }
-static inline int pte_write(pte_t pte) { return (pte).pte_low & _PAGE_WRITE; }
-static inline int pte_dirty(pte_t pte) { return (pte).pte_low & _PAGE_MODIFIED; }
-static inline int pte_young(pte_t pte) { return (pte).pte_low & _PAGE_ACCESSED; }
-static inline int pte_file(pte_t pte)  { return (pte).pte_low & _PAGE_FILE; }
+static inline int pte_read(pte_t pte)  { return pte.pte_low & _PAGE_READ; }
+static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
+static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
+static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
+static inline int pte_file(pte_t pte)  { return pte.pte_low & _PAGE_FILE; }
+
 static inline pte_t pte_wrprotect(pte_t pte)
 {
-       (pte).pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
-       (pte).pte_high &= ~_PAGE_SILENT_WRITE;
+       pte.pte_low  &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
+       pte.pte_high &= ~_PAGE_SILENT_WRITE;
        return pte;
 }
 
 static inline pte_t pte_rdprotect(pte_t pte)
 {
-       (pte).pte_low &= ~(_PAGE_READ | _PAGE_SILENT_READ);
-       (pte).pte_high &= ~_PAGE_SILENT_READ;
+       pte.pte_low  &= ~(_PAGE_READ | _PAGE_SILENT_READ);
+       pte.pte_high &= ~_PAGE_SILENT_READ;
        return pte;
 }
 
 static inline pte_t pte_mkclean(pte_t pte)
 {
-       (pte).pte_low &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE);
-       (pte).pte_high &= ~_PAGE_SILENT_WRITE;
+       pte.pte_low  &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
+       pte.pte_high &= ~_PAGE_SILENT_WRITE;
        return pte;
 }
 
 static inline pte_t pte_mkold(pte_t pte)
 {
-       (pte).pte_low &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
-       (pte).pte_high &= ~_PAGE_SILENT_READ;
+       pte.pte_low  &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ);
+       pte.pte_high &= ~_PAGE_SILENT_READ;
        return pte;
 }
 
 static inline pte_t pte_mkwrite(pte_t pte)
 {
-       (pte).pte_low |= _PAGE_WRITE;
-       if ((pte).pte_low & _PAGE_MODIFIED) {
-               (pte).pte_low |= _PAGE_SILENT_WRITE;
-               (pte).pte_high |= _PAGE_SILENT_WRITE;
+       pte.pte_low |= _PAGE_WRITE;
+       if (pte.pte_low & _PAGE_MODIFIED) {
+               pte.pte_low  |= _PAGE_SILENT_WRITE;
+               pte.pte_high |= _PAGE_SILENT_WRITE;
        }
        return pte;
 }
 
 static inline pte_t pte_mkread(pte_t pte)
 {
-       (pte).pte_low |= _PAGE_READ;
-       if ((pte).pte_low & _PAGE_ACCESSED) {
-               (pte).pte_low |= _PAGE_SILENT_READ;
-               (pte).pte_high |= _PAGE_SILENT_READ;
+       pte.pte_low |= _PAGE_READ;
+       if (pte.pte_low & _PAGE_ACCESSED) {
+               pte.pte_low  |= _PAGE_SILENT_READ;
+               pte.pte_high |= _PAGE_SILENT_READ;
        }
        return pte;
 }
 
 static inline pte_t pte_mkdirty(pte_t pte)
 {
-       (pte).pte_low |= _PAGE_MODIFIED;
-       if ((pte).pte_low & _PAGE_WRITE) {
-               (pte).pte_low |= _PAGE_SILENT_WRITE;
-               (pte).pte_high |= _PAGE_SILENT_WRITE;
+       pte.pte_low |= _PAGE_MODIFIED;
+       if (pte.pte_low & _PAGE_WRITE) {
+               pte.pte_low  |= _PAGE_SILENT_WRITE;
+               pte.pte_high |= _PAGE_SILENT_WRITE;
        }
        return pte;
 }
 
 static inline pte_t pte_mkyoung(pte_t pte)
 {
-       (pte).pte_low |= _PAGE_ACCESSED;
-       if ((pte).pte_low & _PAGE_READ)
-               (pte).pte_low |= _PAGE_SILENT_READ;
-               (pte).pte_high |= _PAGE_SILENT_READ;
+       pte.pte_low |= _PAGE_ACCESSED;
+       if (pte.pte_low & _PAGE_READ)
+               pte.pte_low  |= _PAGE_SILENT_READ;
+               pte.pte_high |= _PAGE_SILENT_READ;
        return pte;
 }
 #else
@@ -335,8 +353,9 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
-       pte.pte_low &= _PAGE_CHG_MASK;
-       pte.pte_low |= pgprot_val(newprot);
+       pte.pte_low  &= _PAGE_CHG_MASK;
+       pte.pte_high &= ~0x3f;
+       pte.pte_low  |= pgprot_val(newprot);
        pte.pte_high |= pgprot_val(newprot) & 0x3f;
        return pte;
 }
index 8edabb0be23f64f8cb576178fde9c2643b93e12b..cefa657dd04a86268923122e5bb8fce3ec1fa480 100644 (file)
@@ -55,8 +55,14 @@ struct sigcontext {
 struct sigcontext {
        unsigned long   sc_regs[32];
        unsigned long   sc_fpregs[32];
-       unsigned long   sc_hi[4];
-       unsigned long   sc_lo[4];
+       unsigned long   sc_mdhi;
+       unsigned long   sc_hi1;
+       unsigned long   sc_hi2;
+       unsigned long   sc_hi3;
+       unsigned long   sc_mdlo;
+       unsigned long   sc_lo1;
+       unsigned long   sc_lo2;
+       unsigned long   sc_lo3;
        unsigned long   sc_pc;
        unsigned int    sc_fpc_csr;
        unsigned int    sc_used_math;
index 75c6fe7c212682390e3e29c6f6ab0ba55e362552..e14e4b69de21d1a3a21838cfa79ed2e7696ecf2e 100644 (file)
@@ -48,7 +48,6 @@ extern struct call_data_struct *call_data;
 #define SMP_CALL_FUNCTION      0x2
 
 extern cpumask_t phys_cpu_present_map;
-extern cpumask_t cpu_online_map;
 #define cpu_possible_map       phys_cpu_present_map
 
 extern cpumask_t cpu_callout_map;
@@ -86,9 +85,9 @@ extern void prom_init_secondary(void);
 extern void plat_smp_setup(void);
 
 /*
- * Called after init_IRQ but before __cpu_up.
+ * Called in smp_prepare_cpus.
  */
-extern void prom_prepare_cpus(unsigned int max_cpus);
+extern void plat_prepare_cpus(unsigned int max_cpus);
 
 /*
  * Last chance for the board code to finish SMP initialization before
diff --git a/include/asm-mips/sparsemem.h b/include/asm-mips/sparsemem.h
new file mode 100644 (file)
index 0000000..795ac6c
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _MIPS_SPARSEMEM_H
+#define _MIPS_SPARSEMEM_H
+#ifdef CONFIG_SPARSEMEM
+
+/*
+ * SECTION_SIZE_BITS           2^N: how big each section will be
+ * MAX_PHYSMEM_BITS            2^N: how much memory we can have in that space
+ */
+#define SECTION_SIZE_BITS       28
+#define MAX_PHYSMEM_BITS        35
+
+#endif /* CONFIG_SPARSEMEM */
+#endif /* _MIPS_SPARSEMEM_H */
+
index ebf6055481dcb0f4547ecd5c9f1d6e7c1afea896..6d533b07aaf52daa3e1911df34fffcc6bf788d4d 100644 (file)
@@ -153,6 +153,7 @@ struct termios {
 #define HUPCL  00040000
 
 #define CLOCAL 00100000
+#define CMSPAR   010000000000          /* mark or space (stick) parity */
 #define CRTSCTS          020000000000          /* flow control */
 
 /* c_lflag bits */
index 908acb44cb8a11919637ea95673fba336557290b..edde2462bf52d59709e4c1cf6ffd1e61205707a6 100644 (file)
 #define __NR_readlinkat                296
 #define __NR_fchmodat          297
 #define __NR_faccessat         298
+#define __NR_get_robust_list   299
+#define __NR_set_robust_list   300
 
-#define __NR_syscalls          299
+#define __NR_syscalls          301
 
 #ifdef __KERNEL__
 #define __NR__exit __NR_exit
index 40c25e166a9b91ffcf2a6fbd549c1892c303405b..1802775568b9904a6c8b5eddd811b908d3f4f0a3 100644 (file)
 #define __futex_atomic_fixup \
                     ".section __ex_table,\"a\"\n"                      \
                     "   .align 4\n"                                    \
-                    "   .long  0b,2b,1b,2b\n"                          \
+                    "   .long  0b,4b,2b,4b,3b,4b\n"                    \
                     ".previous"
 #else /* __s390x__ */
 #define __futex_atomic_fixup \
                     ".section __ex_table,\"a\"\n"                      \
                     "   .align 8\n"                                    \
-                    "   .quad  0b,2b,1b,2b\n"                          \
+                    "   .quad  0b,4b,2b,4b,3b,4b\n"                    \
                     ".previous"
 #endif /* __s390x__ */
 
 #define __futex_atomic_op(insn, ret, oldval, newval, uaddr, oparg)     \
-       asm volatile("   l   %1,0(%6)\n"                                \
-                    "0: " insn                                         \
-                    "   cs  %1,%2,0(%6)\n"                             \
-                    "1: jl  0b\n"                                      \
+       asm volatile("   sacf 256\n"                                    \
+                    "0: l   %1,0(%6)\n"                                \
+                    "1: " insn                                         \
+                    "2: cs  %1,%2,0(%6)\n"                             \
+                    "3: jl  1b\n"                                      \
                     "   lhi %0,0\n"                                    \
-                    "2:\n"                                             \
+                    "4: sacf 0\n"                                      \
                     __futex_atomic_fixup                               \
                     : "=d" (ret), "=&d" (oldval), "=&d" (newval),      \
                       "=m" (*uaddr)                                    \
index db0606c1abd4fbf56c938905790f8785a904c364..bea7279042872672c7bc3904cb9e1000a8eb41a8 100644 (file)
@@ -98,8 +98,8 @@
 #define __LC_KERNEL_ASCE               0xD58
 #define __LC_USER_ASCE                 0xD60
 #define __LC_PANIC_STACK                0xD68
-#define __LC_CPUID                      0xD90
-#define __LC_CPUADDR                    0xD98
+#define __LC_CPUID                     0xD80
+#define __LC_CPUADDR                   0xD88
 #define __LC_IPLDEV                     0xDB8
 #define __LC_JIFFY_TIMER               0xDC0
 #define __LC_CURRENT                   0xDD8
index 657d582e8149504e331e65dc7e30cf85aceb7117..41c2792ff6b04cd9d0be3d98c774549113ba2552 100644 (file)
 #define __NR_pselect6          301
 #define __NR_ppoll             302
 #define __NR_unshare           303
+#define __NR_set_robust_list   304
+#define __NR_get_robust_list   305
+#define __NR_splice            306
+#define __NR_sync_file_range   307
+#define __NR_tee               308
+#define __NR_vmsplice          309
 
-#define NR_syscalls 304
+#define NR_syscalls 310
 
 /* 
  * There are some system calls that are not present on 64 bit, some
index f5611a721fbd6e5024d172faaffd4e0ee3a5fc28..45a576507785df07ed0969b9e97b1eb5248f391c 100644 (file)
 #define __NR_pselect6          297
 #define __NR_ppoll             298
 #define __NR_unshare           299
+#define __NR_set_robust_list   300
+#define __NR_get_robust_list   301
 
-/* WARNING: You MAY NOT add syscall numbers larger than 299, since
+/* WARNING: You MAY NOT add syscall numbers larger than 301, since
  *          all of the syscall tables in the Sparc kernel are
- *          sized to have 299 entries (starting at zero).  Therefore
- *          find a free slot in the 0-299 range.
+ *          sized to have 301 entries (starting at zero).  Therefore
+ *          find a free slot in the 0-301 range.
  */
 
 #define _syscall0(type,name) \
index c7d5804ba76df1a1e458746cea57a828cbe93ac2..a8d39f23d43b7755023541770b35e3fa1e2c88b2 100644 (file)
@@ -4,7 +4,146 @@
 #include <linux/config.h>
 
 #ifdef CONFIG_PCI
-#include <asm-generic/dma-mapping.h>
+
+/* we implement the API below in terms of the existing PCI one,
+ * so include it */
+#include <linux/pci.h>
+/* need struct page definitions */
+#include <linux/mm.h>
+
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_dma_supported(to_pci_dev(dev), mask);
+}
+
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
+}
+
+static inline void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+                  gfp_t flag)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag);
+}
+
+static inline void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+                   dma_addr_t dma_handle)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
+}
+
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *cpu_addr, size_t size,
+              enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
+}
+
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+                enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
+}
+
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+            unsigned long offset, size_t size,
+            enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
+}
+
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+              enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
+}
+
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+          enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
+}
+
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+            enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
+}
+
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
+                       enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
+                                   size, (int)direction);
+}
+
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
+                          enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
+                                      size, (int)direction);
+}
+
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+                   enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
+                      enum dma_data_direction direction)
+{
+       BUG_ON(dev->bus != &pci_bus_type);
+
+       pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
+}
+
+static inline int
+dma_mapping_error(dma_addr_t dma_addr)
+{
+       return pci_dma_mapping_error(dma_addr);
+}
+
 #else
 
 struct device;
index 7c5a589ea437a62e082a0808c99c3e15719b101e..e1ea67bc32f22f515db611a2874358679932133a 100644 (file)
@@ -42,7 +42,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
 struct pci_dev;
 
 struct pci_iommu_ops {
-       void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *);
+       void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *, gfp_t);
        void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t);
        dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int);
        void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int);
@@ -59,7 +59,7 @@ extern struct pci_iommu_ops *pci_iommu_ops;
  */
 static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
 {
-       return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle);
+       return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle, GFP_ATOMIC);
 }
 
 /* Free and unmap a consistent DMA buffer.
index c44e7466534e9dab3f4d1cd3c5936cec1b45a80b..cd464f469a2c2b27fe5d157e684e30b2b4fbf051 100644 (file)
@@ -689,6 +689,23 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *p
 #define pte_clear(mm,addr,ptep)                \
        set_pte_at((mm), (addr), (ptep), __pte(0UL))
 
+#ifdef DCACHE_ALIASING_POSSIBLE
+#define __HAVE_ARCH_MOVE_PTE
+#define move_pte(pte, prot, old_addr, new_addr)                                \
+({                                                                     \
+       pte_t newpte = (pte);                                           \
+       if (tlb_type != hypervisor && pte_present(pte)) {               \
+               unsigned long this_pfn = pte_pfn(pte);                  \
+                                                                       \
+               if (pfn_valid(this_pfn) &&                              \
+                   (((old_addr) ^ (new_addr)) & (1 << 13)))            \
+                       flush_dcache_page_all(current->mm,              \
+                                             pfn_to_page(this_pfn));   \
+       }                                                               \
+       newpte;                                                         \
+})
+#endif
+
 extern pgd_t swapper_pg_dir[2048];
 extern pmd_t swapper_low_pmd_dir[2048];
 
index 68705748bec0f164b52a2bebc83b8c265fbe1d73..998ef4ab0e068fbcf564f4b0fbdf05a2744f3663 100644 (file)
 #define __NR_pselect6          297
 #define __NR_ppoll             298
 #define __NR_unshare           299
+#define __NR_set_robust_list   300
+#define __NR_get_robust_list   301
 
-/* WARNING: You MAY NOT add syscall numbers larger than 299, since
+/* WARNING: You MAY NOT add syscall numbers larger than 301, since
  *          all of the syscall tables in the Sparc kernel are
- *          sized to have 299 entries (starting at zero).  Therefore
- *          find a free slot in the 0-299 range.
+ *          sized to have 301 entries (starting at zero).  Therefore
+ *          find a free slot in the 0-301 range.
  */
 
 #define _syscall0(type,name) \
diff --git a/include/asm-um/irqflags.h b/include/asm-um/irqflags.h
new file mode 100644 (file)
index 0000000..659b9ab
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __UM_IRQFLAGS_H
+#define __UM_IRQFLAGS_H
+
+/* Empty for now */
+
+#endif
index bea5a015f6674b4102030cf81de18813a07e2883..16c734af9193c8442fbed9ff7d561420ec8157ec 100644 (file)
 
 #define __get_user(x, ptr) \
 ({ \
-       const __typeof__(ptr) __private_ptr = ptr;      \
+       const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \
        __typeof__(x) __private_val;                    \
        int __private_ret = -EFAULT;                    \
        (x) = (__typeof__(*(__private_ptr)))0;                          \
-       if (__copy_from_user((void *) &__private_val, (__private_ptr),  \
+       if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\
                             sizeof(*(__private_ptr))) == 0) {          \
                (x) = (__typeof__(*(__private_ptr))) __private_val;     \
                __private_ret = 0;                                      \
@@ -62,7 +62,7 @@
 
 #define __put_user(x, ptr) \
 ({ \
-        __typeof__(ptr) __private_ptr = ptr; \
+        __typeof__(*(ptr)) __user *__private_ptr = ptr; \
         __typeof__(*(__private_ptr)) __private_val; \
         int __private_ret = -EFAULT; \
         __private_val = (__typeof__(*(__private_ptr))) (x); \
index aa1c7b2e438cb36d3c9756b153d37a04c2570e9a..2c95a319c0566463df1d3a800c094564f87d0d1f 100644 (file)
@@ -162,6 +162,8 @@ extern int acpi_pci_disabled;
 
 extern u8 x86_acpiid_to_apicid[];
 
+#define ARCH_HAS_POWER_INIT 1
+
 extern int acpi_skip_timer_override;
 
 #endif /*__KERNEL__*/
index 5a48e9bcf218ac05bcf1dd77821b93e1cb348321..1dd40067c67c41b18e92298787cbd219bea8bee7 100644 (file)
  */
 #define u32 unsigned int
 
-#define lapic ((volatile struct local_apic *)APIC_BASE)
-
 struct local_apic {
 
 /*000*/        struct { u32 __reserved[4]; } __reserved_01;
index c98633af07d26abb0ee6776f90c6eef7dd60008f..b4f8f4a41a6e93fbebddbd3a399b1c932dd23387 100644 (file)
@@ -159,7 +159,7 @@ extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
 
 /* 1GB for 64bit, 8MB for 32bit */
-#define STACK_RND_MASK (is_compat_task() ? 0x7ff : 0x3fffff)
+#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
 
 #endif
 
index ad133fcfb239ddbf16e6961e88f47161e8d1447e..1713ace808bfb4d581ccfff53aa4b0c42ebfa9ef 100644 (file)
@@ -21,7 +21,7 @@ typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
 typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *);
 typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
 
-typedef int (elevator_init_fn) (request_queue_t *, elevator_t *);
+typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *);
 typedef void (elevator_exit_fn) (elevator_t *);
 
 struct elevator_ops
index 2d716080be4af7bd98fad2a5a45cd4b884812cd0..33d8f2087b6ea92557c6497a605e3f925e7700e4 100644 (file)
@@ -19,5 +19,4 @@ int request_firmware_nowait(
        void (*cont)(const struct firmware *fw, void *context));
 
 void release_firmware(const struct firmware *fw);
-void register_firmware(const char *name, const u8 *data, size_t size);
 #endif
index 3de2bfb2410ffcdc0449a7b5cbe5d1eee1dc54a2..f813bc8266aa592455caba8d264b90419544c5cc 100644 (file)
@@ -213,6 +213,10 @@ extern int dir_notify_enable;
 #define FIBMAP    _IO(0x00,1)  /* bmap access */
 #define FIGETBSZ   _IO(0x00,2) /* get the block size used for bmap */
 
+#define SYNC_FILE_RANGE_WAIT_BEFORE    1
+#define SYNC_FILE_RANGE_WRITE          2
+#define SYNC_FILE_RANGE_WAIT_AFTER     4
+
 #ifdef __KERNEL__
 
 #include <linux/linkage.h>
@@ -758,9 +762,6 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
 extern int fcntl_getlease(struct file *filp);
 
 /* fs/sync.c */
-#define SYNC_FILE_RANGE_WAIT_BEFORE    1
-#define SYNC_FILE_RANGE_WRITE          2
-#define SYNC_FILE_RANGE_WAIT_AFTER     4
 extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
                        unsigned int flags);
 
index a3a0e078f79d61b9eff557494f06e095ce09bc2c..16fbe59edeb1853958afacdfee91981195adf124 100644 (file)
@@ -110,5 +110,16 @@ struct fsl_usb2_platform_data {
 #define FSL_USB2_PORT0_ENABLED 0x00000001
 #define FSL_USB2_PORT1_ENABLED 0x00000002
 
+struct fsl_spi_platform_data {
+       u32     initial_spmode; /* initial SPMODE value */
+       u16     bus_num;
+
+       /* board specific information */
+       u16     max_chipselect;
+       void    (*activate_cs)(u8 cs, u8 polarity);
+       void    (*deactivate_cs)(u8 cs, u8 polarity);
+       u32     sysclk;
+};
+
 #endif                         /* _FSL_DEVICE_H_ */
 #endif                         /* __KERNEL__ */
index dd7d627bf66f306b4ee9401f06ed4fb574896a85..c115e9e840b4e051b7b573a37c27bfc4564ad504 100644 (file)
@@ -1114,8 +1114,11 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)
 
        mmsg->mfa = readl(c->in_port);
        if (unlikely(mmsg->mfa >= c->in_queue.len)) {
+               u32 mfa = mmsg->mfa;
+
                mempool_free(mmsg, c->in_msg.mempool);
-               if(mmsg->mfa == I2O_QUEUE_EMPTY)
+
+               if (mfa == I2O_QUEUE_EMPTY)
                        return ERR_PTR(-EBUSY);
                return ERR_PTR(-EFAULT);
        }
index 50e338d2ffda9cb5a835d67849e38ae0ceba1647..ce1a756c4c30ba260b316c750178fb51aaf69f0c 100644 (file)
@@ -345,6 +345,8 @@ struct input_absinfo {
 #define KEY_SAVE               234
 #define KEY_DOCUMENTS          235
 
+#define KEY_BATTERY            236
+
 #define KEY_UNKNOWN            240
 
 #define BTN_MISC               0x100
@@ -577,14 +579,9 @@ struct input_absinfo {
  * Switch events
  */
 
-#define SW_0                   0x00
-#define SW_1                   0x01
-#define SW_2                   0x02
-#define SW_3                   0x03
-#define SW_4                   0x04
-#define SW_5                   0x05
-#define SW_6                   0x06
-#define SW_7                   0x07
+#define SW_LID                 0x00  /* set = lid shut */
+#define SW_TABLET_MODE         0x01  /* set = tablet mode */
+#define SW_HEADPHONE_INSERT    0x02  /* set = inserted */
 #define SW_MAX                 0x0f
 
 /*
index e1bd0842f6a13e71ad0b781d4a5bdf6605986fbe..f4fc576ed4c40c6d28dd940a869801a138a0a5e6 100644 (file)
@@ -124,6 +124,7 @@ extern int get_option(char **str, int *pint);
 extern char *get_options(const char *str, int nints, int *ints);
 extern unsigned long long memparse(char *ptr, char **retptr);
 
+extern int core_kernel_text(unsigned long addr);
 extern int __kernel_text_address(unsigned long addr);
 extern int kernel_text_address(unsigned long addr);
 extern int session_of_pgrp(int pgrp);
index 9065199319d033cc0560c1f91305930980827039..915d6b4f0f89689a81d749b6a87b5b2c0ea2d432 100644 (file)
@@ -11,6 +11,6 @@
 
 struct m48t86_ops
 {
-       void (*writeb)(unsigned char value, unsigned long addr);
-       unsigned char (*readb)(unsigned long addr);
+       void (*writebyte)(unsigned char value, unsigned long addr);
+       unsigned char (*readbyte)(unsigned long addr);
 };
index 6a7621b2b12b0061c9edc3daf3a8dbede1a1451c..f5fdca1d67e6fbab0fc5ff7785b8fec0547be76b 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/nodemask.h>
 
 struct vm_area_struct;
+struct mm_struct;
 
 #ifdef CONFIG_NUMA
 
index bdc556d884989c9e51f6c46b915f4efb146e162b..03a14a30c46a1230d57443007783e466b519450b 100644 (file)
@@ -69,6 +69,7 @@ struct mmc_data {
        unsigned int            timeout_ns;     /* data timeout (in ns, max 80ms) */
        unsigned int            timeout_clks;   /* data timeout (in clocks) */
        unsigned int            blksz_bits;     /* data block size */
+       unsigned int            blksz;          /* data block size */
        unsigned int            blocks;         /* number of blocks */
        unsigned int            error;          /* data error */
        unsigned int            flags;
index b5c21122c2996bcee2a449188748f35e561ca0c9..2d8337150493a9ffe7eb9060b6ee84c5a3c45fb1 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/seqlock.h>
 #include <linux/nodemask.h>
 #include <asm/atomic.h>
+#include <asm/page.h>
 
 /* Free memory management - zoned buddy allocator.  */
 #ifndef CONFIG_FORCE_MAX_ZONEORDER
@@ -22,6 +23,7 @@
 #else
 #define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
 #endif
+#define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
 
 struct free_area {
        struct list_head        free_list;
index 4877e35ae2028b97fe58b7756b52196c2d44ce8e..936ef82ed76a6f21cf07b0132da3a12efc748cb9 100644 (file)
@@ -50,7 +50,7 @@
 extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
 extern acpi_status pci_osc_support_set(u32 flags);
 #else
-#if !defined(acpi_status)
+#if !defined(AE_ERROR)
 typedef u32            acpi_status;
 #define AE_ERROR       (acpi_status) (0x0001)
 #endif    
index d6fe048376ab02010a1709b6dcce4e94f4b70601..590dc6dca3157d1f3cc96c708576325e6fc5e088 100644 (file)
 #define PCI_DEVICE_ID_VIA_8380_0       0x0204
 #define PCI_DEVICE_ID_VIA_3238_0       0x0238
 #define PCI_DEVICE_ID_VIA_PT880                0x0258
+#define PCI_DEVICE_ID_VIA_PT880ULTRA   0x0308
 #define PCI_DEVICE_ID_VIA_PX8X0_0      0x0259
 #define PCI_DEVICE_ID_VIA_3269_0       0x0269
 #define PCI_DEVICE_ID_VIA_K8T800PRO_0  0x0282
index 5673008b61e11ae127608228fdbe6eacd9cec27d..970284f571a6d522f60362c0f585ba7d837b1cb2 100644 (file)
@@ -132,6 +132,7 @@ static inline void rcu_bh_qsctr_inc(int cpu)
 }
 
 extern int rcu_pending(int cpu);
+extern int rcu_needs_cpu(int cpu);
 
 /**
  * rcu_read_lock - mark the beginning of an RCU read-side critical section.
index 3af03b19c9830275c77ef99f98c6a22e76a79a7f..2d985d59c7b86759663761c3ec333ec196730026 100644 (file)
@@ -150,6 +150,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 
 extern void kfree(const void *);
 extern unsigned int ksize(const void *);
+extern int slab_is_available(void);
 
 #ifdef CONFIG_NUMA
 extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
index b05f1463a2676de35237dda137772ad70dc1c93d..e928c0dcc29755d31c2ba5b7f1d96b1f3ac50b1e 100644 (file)
@@ -31,18 +31,23 @@ extern struct bus_type spi_bus_type;
  * @master: SPI controller used with the device.
  * @max_speed_hz: Maximum clock rate to be used with this chip
  *     (on this board); may be changed by the device's driver.
+ *     The spi_transfer.speed_hz can override this for each transfer.
  * @chip-select: Chipselect, distinguishing chips handled by "master".
  * @mode: The spi mode defines how data is clocked out and in.
  *     This may be changed by the device's driver.
+ *     The "active low" default for chipselect mode can be overridden,
+ *     as can the "MSB first" default for each word in a transfer.
  * @bits_per_word: Data transfers involve one or more words; word sizes
- *     like eight or 12 bits are common.  In-memory wordsizes are
+ *     like eight or 12 bits are common.  In-memory wordsizes are
  *     powers of two bytes (e.g. 20 bit samples use 32 bits).
- *     This may be changed by the device's driver.
+ *     This may be changed by the device's driver, or left at the
+ *     default (0) indicating protocol words are eight bit bytes.
+ *     The spi_transfer.bits_per_word can override this for each transfer.
  * @irq: Negative, or the number passed to request_irq() to receive
- *     interrupts from this device.
+ *     interrupts from this device.
  * @controller_state: Controller's runtime state
  * @controller_data: Board-specific definitions for controller, such as
- *     FIFO initialization parameters; from board_info.controller_data
+ *     FIFO initialization parameters; from board_info.controller_data
  *
  * An spi_device is used to interchange data between an SPI slave
  * (usually a discrete chip) and CPU memory.
@@ -65,6 +70,7 @@ struct spi_device {
 #define        SPI_MODE_2      (SPI_CPOL|0)
 #define        SPI_MODE_3      (SPI_CPOL|SPI_CPHA)
 #define        SPI_CS_HIGH     0x04                    /* chipselect active high? */
+#define        SPI_LSB_FIRST   0x08                    /* per-word bits-on-wire */
        u8                      bits_per_word;
        int                     irq;
        void                    *controller_state;
@@ -73,7 +79,6 @@ struct spi_device {
 
        // likely need more hooks for more protocol options affecting how
        // the controller talks to each chip, like:
-       //  - bit order (default is wordwise msb-first)
        //  - memory packing (12 bit samples into low bits, others zeroed)
        //  - priority
        //  - drop chipselect after each word
@@ -143,13 +148,13 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
  * struct spi_master - interface to SPI master controller
  * @cdev: class interface to this driver
  * @bus_num: board-specific (and often SOC-specific) identifier for a
- *     given SPI controller.
+ *     given SPI controller.
  * @num_chipselect: chipselects are used to distinguish individual
- *     SPI slaves, and are numbered from zero to num_chipselects.
- *     each slave has a chipselect signal, but it's common that not
- *     every chipselect is connected to a slave.
+ *     SPI slaves, and are numbered from zero to num_chipselects.
+ *     each slave has a chipselect signal, but it's common that not
+ *     every chipselect is connected to a slave.
  * @setup: updates the device mode and clocking records used by a
- *     device's SPI controller; protocol code may call this.
+ *     device's SPI controller; protocol code may call this.
  * @transfer: adds a message to the controller's transfer queue.
  * @cleanup: frees controller-specific state
  *
@@ -167,13 +172,13 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
 struct spi_master {
        struct class_device     cdev;
 
-       /* other than zero (== assign one dynamically), bus_num is fully
+       /* other than negative (== assign one dynamically), bus_num is fully
         * board-specific.  usually that simplifies to being SOC-specific.
-        * example:  one SOC has three SPI controllers, numbered 1..3,
+        * example:  one SOC has three SPI controllers, numbered 0..2,
         * and one board's schematics might show it using SPI-2.  software
         * would normally use bus_num=2 for that controller.
         */
-       u16                     bus_num;
+       s16                     bus_num;
 
        /* chipselects will be integral to many controllers; some others
         * might use board-specific GPIOs.
@@ -268,10 +273,14 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
  * @tx_dma: DMA address of tx_buf, if spi_message.is_dma_mapped
  * @rx_dma: DMA address of rx_buf, if spi_message.is_dma_mapped
  * @len: size of rx and tx buffers (in bytes)
+ * @speed_hz: Select a speed other then the device default for this
+ *      transfer. If 0 the default (from spi_device) is used.
+ * @bits_per_word: select a bits_per_word other then the device default
+ *      for this transfer. If 0 the default (from spi_device) is used.
  * @cs_change: affects chipselect after this transfer completes
  * @delay_usecs: microseconds to delay after this transfer before
- *     (optionally) changing the chipselect status, then starting
- *     the next transfer or completing this spi_message.
+ *     (optionally) changing the chipselect status, then starting
+ *     the next transfer or completing this spi_message.
  * @transfer_list: transfers are sequenced through spi_message.transfers
  *
  * SPI transfers always write the same number of bytes as they read.
@@ -322,7 +331,9 @@ struct spi_transfer {
        dma_addr_t      rx_dma;
 
        unsigned        cs_change:1;
+       u8              bits_per_word;
        u16             delay_usecs;
+       u32             speed_hz;
 
        struct list_head transfer_list;
 };
@@ -356,7 +367,7 @@ struct spi_transfer {
  * and its transfers, ignore them until its completion callback.
  */
 struct spi_message {
-       struct list_head        transfers;
+       struct list_head        transfers;
 
        struct spi_device       *spi;
 
@@ -374,7 +385,7 @@ struct spi_message {
         */
 
        /* completion is reported through a callback */
-       void                    (*complete)(void *context);
+       void                    (*complete)(void *context);
        void                    *context;
        unsigned                actual_length;
        int                     status;
index c961fe9bf3eb48f3576035a7ec62bc5c743bc008..16ce178f54d7a0de40a69ebabfdddc488f4039fa 100644 (file)
@@ -30,6 +30,12 @@ struct spi_bitbang {
 
        struct spi_master       *master;
 
+       /* setup_transfer() changes clock and/or wordsize to match settings
+        * for this transfer; zeroes restore defaults from spi_device.
+        */
+       int     (*setup_transfer)(struct spi_device *spi,
+                       struct spi_transfer *t);
+
        void    (*chipselect)(struct spi_device *spi, int is_on);
 #define        BITBANG_CS_ACTIVE       1       /* normally nCS, active low */
 #define        BITBANG_CS_INACTIVE     0
@@ -51,6 +57,8 @@ struct spi_bitbang {
 extern int spi_bitbang_setup(struct spi_device *spi);
 extern void spi_bitbang_cleanup(const struct spi_device *spi);
 extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
+extern int spi_bitbang_setup_transfer(struct spi_device *spi,
+                                     struct spi_transfer *t);
 
 /* start or stop queue processing */
 extern int spi_bitbang_start(struct spi_bitbang *spi);
index 5b1fdf1cff4f057a67eb1c81e487acad031a89b2..f03c247193022ae3ec7ee7457db7ce3f44cbce80 100644 (file)
@@ -296,7 +296,7 @@ static inline void disable_swap_token(void)
 #define read_swap_cache_async(swp,vma,addr)    NULL
 #define lookup_swap_cache(swp)                 NULL
 #define valid_swaphandles(swp, off)            0
-#define can_share_swap_page(p)                 0
+#define can_share_swap_page(p)                 (page_mapcount(p) == 1)
 #define move_to_swap_cache(p, swp)             1
 #define move_from_swap_cache(p, i, m)          1
 #define __delete_from_swap_cache(p)            /*NOTHING*/
index 3996960fc5654e3da43c6b53259101f893bddd2f..60d49e5456e79c273e6732d1fcf0b15dce1159f4 100644 (file)
@@ -52,6 +52,7 @@ struct utimbuf;
 struct mq_attr;
 struct compat_stat;
 struct compat_timeval;
+struct robust_list_head;
 
 #include <linux/config.h>
 #include <linux/types.h>
@@ -581,5 +582,10 @@ asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
 
 asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
                                        unsigned int flags);
+asmlinkage long sys_get_robust_list(int pid,
+                                   struct robust_list_head __user **head_ptr,
+                                   size_t __user *len_ptr);
+asmlinkage long sys_set_robust_list(struct robust_list_head __user *head,
+                                   size_t len);
 
 #endif
index d7670ec1ec1e1dfc2c348179f92c17e8dac81d9a..ad7fa9c86c1008157211021ce5f23829368d6ff0 100644 (file)
@@ -1141,8 +1141,13 @@ extern char *v4l2_type_names[];
 /*  Compatibility layer interface  --  v4l1-compat module */
 typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
                           unsigned int cmd, void *arg);
+
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
 int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
                               int cmd, void *arg, v4l2_kioctl driver_ioctl);
+#else
+#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
+#endif
 
 /* 32 Bits compatibility layer for 64 bits processors */
 extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
index 530ae3f4248ccb6afb3dfe84cee7c1264e32ca38..fab5aed8ca315cc71217dae905e2dda1ac598201 100644 (file)
@@ -73,11 +73,6 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
 int vt_waitactive(int vt);
 void change_console(struct vc_data *new_vc);
 void reset_vc(struct vc_data *vc);
-#ifdef CONFIG_VT
-int is_console_suspend_safe(void);
-#else
-static inline int is_console_suspend_safe(void) { return 1; }
-#endif
 
 /*
  * vc_screen.c shares this temporary buffer with the console write code so that
index 8662b8f43df5d6dc009f068b4b127f6a86589b69..e65cbedb6abcec07e08caedce8ed7785fabcce57 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <linux/config.h>
 
+struct sock;
+
 #if defined(CONFIG_COMPAT)
 
 #include <linux/compat.h>
@@ -23,7 +25,6 @@ struct compat_cmsghdr {
        compat_int_t    cmsg_type;
 };
 
-struct sock;
 extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
 
 #else /* defined(CONFIG_COMPAT) */
index 86aefb1fda5e0bba0f24210eb9864b63801fe913..c0c895d379ba1b10ed5a7b39e8c4da3405aea23e 100644 (file)
@@ -112,7 +112,7 @@ struct lsap_cb {
 
        struct timer_list watchdog_timer;
 
-       IRLMP_STATE     lsap_state;  /* Connection state */
+       LSAP_STATE      lsap_state;  /* Connection state */
        notify_t        notify;      /* Indication/Confirm entry points */
        struct qos_info qos;         /* QoS for this connection */
 
index b0666d66293fd545f63163bc54350c0ca6ac1204..4901ee446879e59795f0df8d57a1c18ce9c7ce92 100644 (file)
@@ -211,6 +211,7 @@ struct neigh_table
 #define NEIGH_UPDATE_F_ADMIN                   0x80000000
 
 extern void                    neigh_table_init(struct neigh_table *tbl);
+extern void                    neigh_table_init_no_netlink(struct neigh_table *tbl);
 extern int                     neigh_table_clear(struct neigh_table *tbl);
 extern struct neighbour *      neigh_lookup(struct neigh_table *tbl,
                                             const void *pkey,
index 34a1a09e5aeff93927fb058be18e79e6afbf32df..807d6f1ef4b505bd302de0281aee75fc71a2b50a 100644 (file)
@@ -99,6 +99,7 @@ typedef enum {
        SCTP_CMD_DEL_NON_PRIMARY, /* Removes non-primary peer transports. */
        SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */
        SCTP_CMD_FORCE_PRIM_RETRAN,  /* Forces retrans. over primary path. */
+       SCTP_CMD_SET_SK_ERR,     /* Set sk_err */
        SCTP_CMD_LAST
 } sctp_verb_t;
 
index e673b2c984e931c9a80d7c5e677bfdc1984fa4c3..aa6033ca7cd859d3614406a54b0d4885e79a94dc 100644 (file)
@@ -461,12 +461,12 @@ static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu)
  * there is room for a param header too.
  */
 #define sctp_walk_params(pos, chunk, member)\
-_sctp_walk_params((pos), (chunk), WORD_ROUND(ntohs((chunk)->chunk_hdr.length)), member)
+_sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
 
 #define _sctp_walk_params(pos, chunk, end, member)\
 for (pos.v = chunk->member;\
      pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\
-     pos.v <= (void *)chunk + end - WORD_ROUND(ntohs(pos.p->length)) &&\
+     pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
      ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\
      pos.v += WORD_ROUND(ntohs(pos.p->length)))
 
@@ -477,7 +477,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
 for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
            sizeof(sctp_chunkhdr_t));\
      (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\
-     (void *)err <= (void *)chunk_hdr + end - WORD_ROUND(ntohs(err->length)) &&\
+     (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
      ntohs(err->length) >= sizeof(sctp_errhdr_t); \
      err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length))))
 
index adb7cad3e6eec17165efdf88acf1f0f936fc4c9d..f4b7b9d278cd3bf040cdac1a1ee123401549f103 100644 (file)
@@ -310,6 +310,11 @@ retry:
 
                panic("VFS: Unable to mount root fs on %s", b);
        }
+
+       printk("No filesystem could mount root, tried: ");
+       for (p = fs_names; *p; p += strlen(p)+1)
+               printk(" %s", p);
+       printk("\n");
        panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
 out:
        putname(fs_names);
index 679d870d991b760438a95d133c9684b9f381eb0d..f81cfa40a719858a003ab50448f3d0925005d5ff 100644 (file)
@@ -26,10 +26,12 @@ static void __init free(void *where)
 
 /* link hash */
 
+#define N_ALIGN(len) ((((len) + 1) & ~3) + 2)
+
 static __initdata struct hash {
        int ino, minor, major;
        struct hash *next;
-       char *name;
+       char name[N_ALIGN(PATH_MAX)];
 } *head[32];
 
 static inline int hash(int major, int minor, int ino)
@@ -57,7 +59,7 @@ static char __init *find_link(int major, int minor, int ino, char *name)
        q->ino = ino;
        q->minor = minor;
        q->major = major;
-       q->name = name;
+       strcpy(q->name, name);
        q->next = NULL;
        *p = q;
        return NULL;
@@ -133,8 +135,6 @@ static inline void eat(unsigned n)
        count -= n;
 }
 
-#define N_ALIGN(len) ((((len) + 1) & ~3) + 2)
-
 static __initdata char *collected;
 static __initdata int remains;
 static __initdata char *collect;
index 72248d1b9e3f7a18198796ad1134c9abb2fd4b4e..ab81fdd4572bb4b65dad432d69f58f222d3f1aee 100644 (file)
@@ -2231,19 +2231,25 @@ static const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs)
  * So only GFP_KERNEL allocations, if all nodes in the cpuset are
  * short of memory, might require taking the callback_mutex mutex.
  *
- * The first loop over the zonelist in mm/page_alloc.c:__alloc_pages()
- * calls here with __GFP_HARDWALL always set in gfp_mask, enforcing
- * hardwall cpusets - no allocation on a node outside the cpuset is
- * allowed (unless in interrupt, of course).
- *
- * The second loop doesn't even call here for GFP_ATOMIC requests
- * (if the __alloc_pages() local variable 'wait' is set).  That check
- * and the checks below have the combined affect in the second loop of
- * the __alloc_pages() routine that:
+ * The first call here from mm/page_alloc:get_page_from_freelist()
+ * has __GFP_HARDWALL set in gfp_mask, enforcing hardwall cpusets, so
+ * no allocation on a node outside the cpuset is allowed (unless in
+ * interrupt, of course).
+ *
+ * The second pass through get_page_from_freelist() doesn't even call
+ * here for GFP_ATOMIC calls.  For those calls, the __alloc_pages()
+ * variable 'wait' is not set, and the bit ALLOC_CPUSET is not set
+ * in alloc_flags.  That logic and the checks below have the combined
+ * affect that:
  *     in_interrupt - any node ok (current task context irrelevant)
  *     GFP_ATOMIC   - any node ok
  *     GFP_KERNEL   - any node in enclosing mem_exclusive cpuset ok
  *     GFP_USER     - only nodes in current tasks mems allowed ok.
+ *
+ * Rule:
+ *    Don't call cpuset_zone_allowed() if you can't sleep, unless you
+ *    pass in the __GFP_HARDWALL flag set in gfp_flag, which disables
+ *    the code that might scan up ancestor cpusets and sleep.
  **/
 
 int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
@@ -2255,6 +2261,7 @@ int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
        if (in_interrupt())
                return 1;
        node = z->zone_pgdat->node_id;
+       might_sleep_if(!(gfp_mask & __GFP_HARDWALL));
        if (node_isset(node, current->mems_allowed))
                return 1;
        if (gfp_mask & __GFP_HARDWALL)  /* If hardwall request, stop here */
index 7501b531ceedab97f969402822be75d6819b042f..7fe2628553172eadc0d49a3cbaf9d779b80b5a7c 100644 (file)
@@ -40,7 +40,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
        return e;
 }
 
-static int core_kernel_text(unsigned long addr)
+int core_kernel_text(unsigned long addr)
 {
        if (addr >= (unsigned long)_stext &&
            addr <= (unsigned long)_etext)
index b7f0388bd71c80d32eb29f79b0c0319705a8bd7c..01fa2ae98a8571d7e2d7a4e71c03a423792a0d67 100644 (file)
@@ -456,6 +456,7 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(hrtimer_start);
 
 /**
  * hrtimer_try_to_cancel - try to deactivate a timer
@@ -484,6 +485,7 @@ int hrtimer_try_to_cancel(struct hrtimer *timer)
        return ret;
 
 }
+EXPORT_SYMBOL_GPL(hrtimer_try_to_cancel);
 
 /**
  * hrtimer_cancel - cancel a timer and wait for the handler to finish.
@@ -504,6 +506,7 @@ int hrtimer_cancel(struct hrtimer *timer)
                cpu_relax();
        }
 }
+EXPORT_SYMBOL_GPL(hrtimer_cancel);
 
 /**
  * hrtimer_get_remaining - get remaining time for the timer
@@ -522,6 +525,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
 
        return rem;
 }
+EXPORT_SYMBOL_GPL(hrtimer_get_remaining);
 
 #ifdef CONFIG_NO_IDLE_HZ
 /**
@@ -580,6 +584,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
        timer->base = &bases[clock_id];
        timer->node.rb_parent = HRTIMER_INACTIVE;
 }
+EXPORT_SYMBOL_GPL(hrtimer_init);
 
 /**
  * hrtimer_get_res - get the timer resolution for a clock
@@ -599,6 +604,7 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(hrtimer_get_res);
 
 /*
  * Expire the per base hrtimer-queue:
index d24deb0dbbc9488e91ba855342399c22c3f9d309..bbe04862e1b09113dd12dd49749f551cd9fbeecf 100644 (file)
@@ -705,14 +705,14 @@ EXPORT_SYMBOL(__symbol_put);
 
 void symbol_put_addr(void *addr)
 {
-       unsigned long flags;
+       struct module *modaddr;
 
-       spin_lock_irqsave(&modlist_lock, flags);
-       if (!kernel_text_address((unsigned long)addr))
-               BUG();
+       if (core_kernel_text((unsigned long)addr))
+               return;
 
-       module_put(module_text_address((unsigned long)addr));
-       spin_unlock_irqrestore(&modlist_lock, flags);
+       if (!(modaddr = module_text_address((unsigned long)addr)))
+               BUG();
+       module_put(modaddr);
 }
 EXPORT_SYMBOL_GPL(symbol_put_addr);
 
index 6d32ff26f9484190f4588107277d08f7dee40909..2058f88c7bbb3d9c9d0c7e195f3d67f25d8f64ed 100644 (file)
@@ -479,12 +479,31 @@ static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp)
        return 0;
 }
 
+/*
+ * Check to see if there is any immediate RCU-related work to be done
+ * by the current CPU, returning 1 if so.  This function is part of the
+ * RCU implementation; it is -not- an exported member of the RCU API.
+ */
 int rcu_pending(int cpu)
 {
        return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||
                __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
 }
 
+/*
+ * Check to see if any future RCU-related work will need to be done
+ * by the current CPU, even if none need be done immediately, returning
+ * 1 if so.  This function is part of the RCU implementation; it is -not-
+ * an exported member of the RCU API.
+ */
+int rcu_needs_cpu(int cpu)
+{
+       struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
+       struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);
+
+       return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));
+}
+
 void rcu_check_callbacks(int cpu, int user)
 {
        if (user || 
index 4c64f85698aee2205c442f3fec09d18a3db5d4a3..c13f1bd2df7d3cd483c47fd76a8163d90ed3cd44 100644 (file)
@@ -664,48 +664,6 @@ static int effective_prio(task_t *p)
        return prio;
 }
 
-/*
- * We place interactive tasks back into the active array, if possible.
- *
- * To guarantee that this does not starve expired tasks we ignore the
- * interactivity of a task if the first expired task had to wait more
- * than a 'reasonable' amount of time. This deadline timeout is
- * load-dependent, as the frequency of array switched decreases with
- * increasing number of running tasks. We also ignore the interactivity
- * if a better static_prio task has expired, and switch periodically
- * regardless, to ensure that highly interactive tasks do not starve
- * the less fortunate for unreasonably long periods.
- */
-static inline int expired_starving(runqueue_t *rq)
-{
-       int limit;
-
-       /*
-        * Arrays were recently switched, all is well
-        */
-       if (!rq->expired_timestamp)
-               return 0;
-
-       limit = STARVATION_LIMIT * rq->nr_running;
-
-       /*
-        * It's time to switch arrays
-        */
-       if (jiffies - rq->expired_timestamp >= limit)
-               return 1;
-
-       /*
-        * There's a better selection in the expired array
-        */
-       if (rq->curr->static_prio > rq->best_expired_prio)
-               return 1;
-
-       /*
-        * All is well
-        */
-       return 0;
-}
-
 /*
  * __activate_task - move a task to the runqueue.
  */
@@ -713,7 +671,7 @@ static void __activate_task(task_t *p, runqueue_t *rq)
 {
        prio_array_t *target = rq->active;
 
-       if (unlikely(batch_task(p) || (expired_starving(rq) && !rt_task(p))))
+       if (batch_task(p))
                target = rq->expired;
        enqueue_task(p, target);
        rq->nr_running++;
@@ -2531,6 +2489,22 @@ unsigned long long current_sched_time(const task_t *tsk)
        return ns;
 }
 
+/*
+ * We place interactive tasks back into the active array, if possible.
+ *
+ * To guarantee that this does not starve expired tasks we ignore the
+ * interactivity of a task if the first expired task had to wait more
+ * than a 'reasonable' amount of time. This deadline timeout is
+ * load-dependent, as the frequency of array switched decreases with
+ * increasing number of running tasks. We also ignore the interactivity
+ * if a better static_prio task has expired:
+ */
+#define EXPIRED_STARVING(rq) \
+       ((STARVATION_LIMIT && ((rq)->expired_timestamp && \
+               (jiffies - (rq)->expired_timestamp >= \
+                       STARVATION_LIMIT * ((rq)->nr_running) + 1))) || \
+                       ((rq)->curr->static_prio > (rq)->best_expired_prio))
+
 /*
  * Account user cpu time to a process.
  * @p: the process that the cpu time gets accounted to
@@ -2666,7 +2640,7 @@ void scheduler_tick(void)
 
                if (!rq->expired_timestamp)
                        rq->expired_timestamp = jiffies;
-               if (!TASK_INTERACTIVE(p) || expired_starving(rq)) {
+               if (!TASK_INTERACTIVE(p) || EXPIRED_STARVING(rq)) {
                        enqueue_task(p, rq->expired);
                        if (p->static_prio < rq->best_expired_prio)
                                rq->best_expired_prio = p->static_prio;
index 67eaf0f54096f87162a96daad0b50df11fe5653f..9e49deed468cd8b2e63f2033d2971d961edeb110 100644 (file)
@@ -541,6 +541,22 @@ found:
        }
        spin_unlock(&base->lock);
 
+       /*
+        * It can happen that other CPUs service timer IRQs and increment
+        * jiffies, but we have not yet got a local timer tick to process
+        * the timer wheels.  In that case, the expiry time can be before
+        * jiffies, but since the high-resolution timer here is relative to
+        * jiffies, the default expression when high-resolution timers are
+        * not active,
+        *
+        *   time_before(MAX_JIFFY_OFFSET + jiffies, expires)
+        *
+        * would falsely evaluate to true.  If that is the case, just
+        * return jiffies so that we can immediately fire the local timer
+        */
+       if (time_before(expires, jiffies))
+               return jiffies;
+
        if (time_before(hr_expires, expires))
                return hr_expires;
 
index 6ecc180beb7145c5c649f36bc2b7961eab7af13e..ccb0c1fdf1b5de0c6beeb37f53c36f0430ba70da 100644 (file)
@@ -189,7 +189,7 @@ config FRAME_POINTER
 config UNWIND_INFO
        bool "Compile the kernel with frame unwind information"
        depends on !IA64
-       depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || SPARC64 || V850)
+       depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || V850)
        help
          If you say Y here the resulting kernel image will be slightly larger
          but not slower, and it will give very useful debugging information.
index b46350c278370b3ea799fdd5e220befbb7b83a83..687ab418d292b15084d8a97be48f6003b0d0e315 100644 (file)
@@ -198,14 +198,14 @@ int kobject_add(struct kobject * kobj)
 
                /* be noisy on error issues */
                if (error == -EEXIST)
-                       printk("kobject_add failed for %s with -EEXIST, "
+                       pr_debug("kobject_add failed for %s with -EEXIST, "
                               "don't try to register things with the "
                               "same name in the same directory.\n",
                               kobject_name(kobj));
                else
-                       printk("kobject_add failed for %s (%d)\n",
+                       pr_debug("kobject_add failed for %s (%d)\n",
                               kobject_name(kobj), error);
-               dump_stack();
+               /* dump_stack(); */
        }
 
        return error;
index 1ae2b2cc3a54148a72489416829cf36a26abd81b..70df5c0d957e482f8055fc2ecc596fc173a11a61 100644 (file)
@@ -91,8 +91,8 @@ static void grow_zone_span(struct zone *zone,
        if (start_pfn < zone->zone_start_pfn)
                zone->zone_start_pfn = start_pfn;
 
-       if (end_pfn > old_zone_end_pfn)
-               zone->spanned_pages = end_pfn - zone->zone_start_pfn;
+       zone->spanned_pages = max(old_zone_end_pfn, end_pfn) -
+                               zone->zone_start_pfn;
 
        zone_span_writeunlock(zone);
 }
@@ -106,8 +106,8 @@ static void grow_pgdat_span(struct pglist_data *pgdat,
        if (start_pfn < pgdat->node_start_pfn)
                pgdat->node_start_pfn = start_pfn;
 
-       if (end_pfn > old_pgdat_end_pfn)
-               pgdat->node_spanned_pages = end_pfn - pgdat->node_start_pfn;
+       pgdat->node_spanned_pages = max(old_pgdat_end_pfn, end_pfn) -
+                                       pgdat->node_start_pfn;
 }
 
 int online_pages(unsigned long pfn, unsigned long nr_pages)
index ea77c999047ec634746d3b6457724bcb7c5eac5c..253a450c400df06898de5d864ff2c8863c560043 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/mempolicy.h>
 
 #include <asm/tlbflush.h>
+#include <asm/div64.h>
 #include "internal.h"
 
 /*
@@ -950,7 +951,7 @@ restart:
                goto got_pg;
 
        do {
-               if (cpuset_zone_allowed(*z, gfp_mask))
+               if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL))
                        wakeup_kswapd(*z, order);
        } while (*(++z));
 
@@ -969,7 +970,8 @@ restart:
                alloc_flags |= ALLOC_HARDER;
        if (gfp_mask & __GFP_HIGH)
                alloc_flags |= ALLOC_HIGH;
-       alloc_flags |= ALLOC_CPUSET;
+       if (wait)
+               alloc_flags |= ALLOC_CPUSET;
 
        /*
         * Go through the zonelist again. Let __GFP_HIGH and allocations
@@ -2123,14 +2125,22 @@ static void __init alloc_node_mem_map(struct pglist_data *pgdat)
 #ifdef CONFIG_FLAT_NODE_MEM_MAP
        /* ia64 gets its own node_mem_map, before this, without bootmem */
        if (!pgdat->node_mem_map) {
-               unsigned long size;
+               unsigned long size, start, end;
                struct page *map;
 
-               size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
+               /*
+                * The zone's endpoints aren't required to be MAX_ORDER
+                * aligned but the node_mem_map endpoints must be in order
+                * for the buddy allocator to function correctly.
+                */
+               start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
+               end = pgdat->node_start_pfn + pgdat->node_spanned_pages;
+               end = ALIGN(end, MAX_ORDER_NR_PAGES);
+               size =  (end - start) * sizeof(struct page);
                map = alloc_remap(pgdat->node_id, size);
                if (!map)
                        map = alloc_bootmem_node(pgdat, size);
-               pgdat->node_mem_map = map;
+               pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);
        }
 #ifdef CONFIG_FLATMEM
        /*
@@ -2566,9 +2576,11 @@ void setup_per_zone_pages_min(void)
        }
 
        for_each_zone(zone) {
-               unsigned long tmp;
+               u64 tmp;
+
                spin_lock_irqsave(&zone->lru_lock, flags);
-               tmp = (pages_min * zone->present_pages) / lowmem_pages;
+               tmp = (u64)pages_min * zone->present_pages;
+               do_div(tmp, lowmem_pages);
                if (is_highmem(zone)) {
                        /*
                         * __GFP_HIGH and PF_MEMALLOC allocations usually don't
@@ -2595,8 +2607,8 @@ void setup_per_zone_pages_min(void)
                        zone->pages_min = tmp;
                }
 
-               zone->pages_low   = zone->pages_min + tmp / 4;
-               zone->pages_high  = zone->pages_min + tmp / 2;
+               zone->pages_low   = zone->pages_min + (tmp >> 2);
+               zone->pages_high  = zone->pages_min + (tmp >> 1);
                spin_unlock_irqrestore(&zone->lru_lock, flags);
        }
 
index 4c5e68e4e9aed7fcf6b31a88d240046ffeb0f899..1e43c8a865ba76924170f34471f32ad5a3cbdfdb 100644 (file)
@@ -1780,6 +1780,7 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
        if (!simple_empty(dentry))
                return -ENOTEMPTY;
 
+       dentry->d_inode->i_nlink--;
        dir->i_nlink--;
        return shmem_unlink(dir, dentry);
 }
@@ -2102,6 +2103,7 @@ static int shmem_fill_super(struct super_block *sb,
        sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
        sb->s_magic = TMPFS_MAGIC;
        sb->s_op = &shmem_ops;
+       sb->s_time_gran = 1;
 
        inode = shmem_get_inode(sb, S_IFDIR | mode, 0);
        if (!inode)
index c32af7e7581ef0ff11ef112f94b6a84da50cafc4..f1b644eb39d816b3865400caf8d589d458756a17 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -207,11 +207,6 @@ typedef unsigned int kmem_bufctl_t;
 #define        BUFCTL_ACTIVE   (((kmem_bufctl_t)(~0U))-2)
 #define        SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-3)
 
-/* Max number of objs-per-slab for caches which use off-slab slabs.
- * Needed to avoid a possible looping condition in cache_grow().
- */
-static unsigned long offslab_limit;
-
 /*
  * struct slab
  *
@@ -700,6 +695,14 @@ static enum {
        FULL
 } g_cpucache_up;
 
+/*
+ * used by boot code to determine if it can use slab based allocator
+ */
+int slab_is_available(void)
+{
+       return g_cpucache_up == FULL;
+}
+
 static DEFINE_PER_CPU(struct work_struct, reap_work);
 
 static void free_block(struct kmem_cache *cachep, void **objpp, int len,
@@ -1348,12 +1351,6 @@ void __init kmem_cache_init(void)
                                        NULL, NULL);
                }
 
-               /* Inc off-slab bufctl limit until the ceiling is hit. */
-               if (!(OFF_SLAB(sizes->cs_cachep))) {
-                       offslab_limit = sizes->cs_size - sizeof(struct slab);
-                       offslab_limit /= sizeof(kmem_bufctl_t);
-               }
-
                sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
                                        sizes->cs_size,
                                        ARCH_KMALLOC_MINALIGN,
@@ -1772,6 +1769,7 @@ static void set_up_list3s(struct kmem_cache *cachep, int index)
 static size_t calculate_slab_order(struct kmem_cache *cachep,
                        size_t size, size_t align, unsigned long flags)
 {
+       unsigned long offslab_limit;
        size_t left_over = 0;
        int gfporder;
 
@@ -1783,9 +1781,18 @@ static size_t calculate_slab_order(struct kmem_cache *cachep,
                if (!num)
                        continue;
 
-               /* More than offslab_limit objects will cause problems */
-               if ((flags & CFLGS_OFF_SLAB) && num > offslab_limit)
-                       break;
+               if (flags & CFLGS_OFF_SLAB) {
+                       /*
+                        * Max number of objs-per-slab for caches which
+                        * use off-slab slabs. Needed to avoid a possible
+                        * looping condition in cache_grow().
+                        */
+                       offslab_limit = size - sizeof(struct slab);
+                       offslab_limit /= sizeof(kmem_bufctl_t);
+
+                       if (num > offslab_limit)
+                               break;
+               }
 
                /* Found something acceptable - save it away */
                cachep->num = num;
@@ -2192,11 +2199,14 @@ static void drain_cpu_caches(struct kmem_cache *cachep)
        check_irq_on();
        for_each_online_node(node) {
                l3 = cachep->nodelists[node];
-               if (l3) {
+               if (l3 && l3->alien)
+                       drain_alien_cache(cachep, l3->alien);
+       }
+
+       for_each_online_node(node) {
+               l3 = cachep->nodelists[node];
+               if (l3)
                        drain_array(cachep, l3, l3->shared, 1, node);
-                       if (l3->alien)
-                               drain_alien_cache(cachep, l3->alien);
-               }
        }
 }
 
index d7c32de99ee8c49d0e850a06084d5efe508a7625..100040c0dfb6c8e674dada0ed8eb471820e2f75b 100644 (file)
@@ -32,7 +32,7 @@ static struct mem_section *sparse_index_alloc(int nid)
        unsigned long array_size = SECTIONS_PER_ROOT *
                                   sizeof(struct mem_section);
 
-       if (system_state == SYSTEM_RUNNING)
+       if (slab_is_available())
                section = kmalloc_node(array_size, GFP_KERNEL, nid);
        else
                section = alloc_bootmem_node(NODE_DATA(nid), array_size);
@@ -87,11 +87,8 @@ int __section_nr(struct mem_section* ms)
        unsigned long root_nr;
        struct mem_section* root;
 
-       for (root_nr = 0;
-            root_nr < NR_MEM_SECTIONS;
-            root_nr += SECTIONS_PER_ROOT) {
-               root = __nr_to_section(root_nr);
-
+       for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
+               root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
                if (!root)
                        continue;
 
index 4649a63a8cb6f9c3892e92538b394f754295a90e..440a733fe2e9ea3d1374d4fd72e7bba60e268e05 100644 (file)
@@ -1061,7 +1061,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, unsigned long nr_pages,
 loop_again:
        total_scanned = 0;
        nr_reclaimed = 0;
-       sc.may_writepage = !laptop_mode,
+       sc.may_writepage = !laptop_mode;
        sc.nr_mapped = read_page_state(nr_mapped);
 
        inc_page_state(pageoutrun);
index afd8385c0c9c319bff792f714cc3326881db95d9..e9dc803f2fe0a67de78c4219227f4876352cd89a 100644 (file)
@@ -643,6 +643,5 @@ static int __init rif_init(void)
 
 module_init(rif_init);
 
-EXPORT_SYMBOL(tr_source_route);
 EXPORT_SYMBOL(tr_type_trans);
 EXPORT_SYMBOL(alloc_trdev);
index 1a786bfaa416c8d6972ef974dd31577caf14cc9e..72d8529826646e35018514046c3afac4197885a8 100644 (file)
@@ -963,7 +963,7 @@ static struct file_operations arp_seq_fops = {
 static int __init atm_clip_init(void)
 {
        struct proc_dir_entry *p;
-       neigh_table_init(&clip_tbl);
+       neigh_table_init_no_netlink(&clip_tbl);
 
        clip_tbl_hook = &clip_tbl;
        register_atm_ioctl(&clip_ioctl_ops);
index 22d806cf40caf86d694eb05f2794bc1454c5ee19..12da21afb9ca636bbd438be992cacfa5722b2524 100644 (file)
@@ -55,7 +55,7 @@ static int __init br_init(void)
 
 static void __exit br_deinit(void)
 {
-       llc_sap_close(br_stp_sap);
+       rcu_assign_pointer(br_stp_sap->rcv_func, NULL);
 
 #ifdef CONFIG_BRIDGE_NETFILTER
        br_netfilter_fini();
@@ -67,6 +67,7 @@ static void __exit br_deinit(void)
 
        synchronize_net();
 
+       llc_sap_put(br_stp_sap);
        br_fdb_get_hook = NULL;
        br_fdb_put_hook = NULL;
 
index ad1c7af65ec8dcb944b59d2310df3c9ec539805d..f5d47bf4f9675cac0b7ead68f1c25f92ba5f785c 100644 (file)
@@ -300,25 +300,20 @@ int br_add_bridge(const char *name)
        rtnl_lock();
        if (strchr(dev->name, '%')) {
                ret = dev_alloc_name(dev, dev->name);
-               if (ret < 0)
-                       goto err1;
+               if (ret < 0) {
+                       free_netdev(dev);
+                       goto out;
+               }
        }
 
        ret = register_netdevice(dev);
        if (ret)
-               goto err2;
+               goto out;
 
        ret = br_sysfs_addbr(dev);
        if (ret)
-               goto err3;
-       rtnl_unlock();
-       return 0;
-
- err3:
-       unregister_netdev(dev);
- err2:
-       free_netdev(dev);
- err1:
+               unregister_netdevice(dev);
+ out:
        rtnl_unlock();
        return ret;
 }
index d159c92cca84a0482757c5d58f12bd73a193adfa..466ed3440b7446b3c6d976963b3056eb7f6dc9f5 100644 (file)
@@ -168,7 +168,7 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
 
        if (info->bitmask & EBT_LOG_NFLOG)
                nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
-                             info->prefix);
+                             "%s", info->prefix);
        else
                ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
                               info->prefix);
index 2dce673a039b6f4f71888e4780678b35924e7d3e..4fba549caf29911c42f7674310fa35aaa993a36c 100644 (file)
  *             sure which should go first, but I bet it won't make much
  *             difference if we are running VLANs.  The good news is that
  *             this protocol won't be in the list unless compiled in, so
- *             the average user (w/out VLANs) will not be adversly affected.
+ *             the average user (w/out VLANs) will not be adversely affected.
  *             --BLG
  *
  *             0800    IP
@@ -149,7 +149,7 @@ static struct list_head ptype_base[16];     /* 16 way hashed list */
 static struct list_head ptype_all;             /* Taps */
 
 /*
- * The @dev_base list is protected by @dev_base_lock and the rtln
+ * The @dev_base list is protected by @dev_base_lock and the rtnl
  * semaphore.
  *
  * Pure readers hold dev_base_lock for reading.
@@ -641,10 +641,12 @@ int dev_valid_name(const char *name)
  *     @name: name format string
  *
  *     Passed a format string - eg "lt%d" it will try and find a suitable
- *     id. Not efficient for many devices, not called a lot. The caller
- *     must hold the dev_base or rtnl lock while allocating the name and
- *     adding the device in order to avoid duplicates. Returns the number
- *     of the unit assigned or a negative errno code.
+ *     id. It scans list of devices to build up a free map, then chooses
+ *     the first empty slot. The caller must hold the dev_base or rtnl lock
+ *     while allocating the name and adding the device in order to avoid
+ *     duplicates.
+ *     Limited to bits_per_byte * page size devices (ie 32K on most platforms).
+ *     Returns the number of the unit assigned or a negative errno code.
  */
 
 int dev_alloc_name(struct net_device *dev, const char *name)
@@ -744,7 +746,7 @@ int dev_change_name(struct net_device *dev, char *newname)
 }
 
 /**
- *     netdev_features_change - device changes fatures
+ *     netdev_features_change - device changes features
  *     @dev: device to cause notification
  *
  *     Called to indicate a device has changed features.
@@ -2196,7 +2198,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
  *     @dev: device
  *     @inc: modifier
  *
- *     Add or remove promsicuity from a device. While the count in the device
+ *     Add or remove promiscuity from a device. While the count in the device
  *     remains above zero the interface remains promiscuous. Once it hits zero
  *     the device reverts back to normal filtering operation. A negative inc
  *     value is used to drop promiscuity on the device.
@@ -3122,7 +3124,7 @@ EXPORT_SYMBOL(alloc_netdev);
 void free_netdev(struct net_device *dev)
 {
 #ifdef CONFIG_SYSFS
-       /*  Compatiablity with error handling in drivers */
+       /*  Compatibility with error handling in drivers */
        if (dev->reg_state == NETREG_UNINITIALIZED) {
                kfree((char *)dev - dev->padded);
                return;
index 4cf878efdb49eb9fc7d02b7b41f83601ab29d079..50a8c73caf972ae64b963a02322f801669d77eaf 100644 (file)
@@ -1326,8 +1326,7 @@ void neigh_parms_destroy(struct neigh_parms *parms)
        kfree(parms);
 }
 
-
-void neigh_table_init(struct neigh_table *tbl)
+void neigh_table_init_no_netlink(struct neigh_table *tbl)
 {
        unsigned long now = jiffies;
        unsigned long phsize;
@@ -1383,10 +1382,27 @@ void neigh_table_init(struct neigh_table *tbl)
 
        tbl->last_flush = now;
        tbl->last_rand  = now + tbl->parms.reachable_time * 20;
+}
+
+void neigh_table_init(struct neigh_table *tbl)
+{
+       struct neigh_table *tmp;
+
+       neigh_table_init_no_netlink(tbl);
        write_lock(&neigh_tbl_lock);
+       for (tmp = neigh_tables; tmp; tmp = tmp->next) {
+               if (tmp->family == tbl->family)
+                       break;
+       }
        tbl->next       = neigh_tables;
        neigh_tables    = tbl;
        write_unlock(&neigh_tbl_lock);
+
+       if (unlikely(tmp)) {
+               printk(KERN_ERR "NEIGH: Registering multiple tables for "
+                      "family %d\n", tbl->family);
+               dump_stack();
+       }
 }
 
 int neigh_table_clear(struct neigh_table *tbl)
@@ -2657,6 +2673,7 @@ EXPORT_SYMBOL(neigh_rand_reach_time);
 EXPORT_SYMBOL(neigh_resolve_output);
 EXPORT_SYMBOL(neigh_table_clear);
 EXPORT_SYMBOL(neigh_table_init);
+EXPORT_SYMBOL(neigh_table_init_no_netlink);
 EXPORT_SYMBOL(neigh_update);
 EXPORT_SYMBOL(neigh_update_hhs);
 EXPORT_SYMBOL(pneigh_enqueue);
index b5981e5f6b0021294d9c16d14f581964a9e93bc2..8c211c58893b2a6de115110743ed33a88befbe4d 100644 (file)
@@ -452,6 +452,7 @@ found:
                                              (unsigned long long)
                                              avr->dccpavr_ack_ackno);
                                dccp_ackvec_throw_record(av, avr);
+                               break;
                        }
                        /*
                         * If it wasn't received, continue scanning... we might
index 69b74a9a0fc3a3cb0908782fd77e14e3cc2a885e..7cef1d8ace2738145978eef5c1cbeae226656db0 100644 (file)
@@ -3,6 +3,5 @@
 #
 
 obj-y                                  += eth.o
-obj-$(CONFIG_SYSCTL)                   += sysctl_net_ether.o
 obj-$(subst m,y,$(CONFIG_IPX))         += pe2.o
 obj-$(subst m,y,$(CONFIG_ATALK))       += pe2.o
diff --git a/net/ethernet/sysctl_net_ether.c b/net/ethernet/sysctl_net_ether.c
deleted file mode 100644 (file)
index 66b39fc..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -*- linux-c -*-
- * sysctl_net_ether.c: sysctl interface to net Ethernet subsystem.
- *
- * Begun April 1, 1996, Mike Shaver.
- * Added /proc/sys/net/ether directory entry (empty =) ). [MS]
- */
-
-#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/if_ether.h>
-
-ctl_table ether_table[] = {
-       {0}
-};
index 0923add122b415b8000d46fbad28fcffe217e0cc..9f0bb529ab70af99e2c79ee61521d38d19f9e1e0 100644 (file)
@@ -116,6 +116,7 @@ sr_failed:
 
 too_many_hops:
         /* Tell the sender its packet died... */
+        IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
         icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
 drop:
        kfree_skb(skb);
index cd810f41af1a71db684a7787bde2bbc8e5d601f7..95278b22b669ab895903fe039fa3e7d2e1f56a25 100644 (file)
@@ -210,7 +210,7 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
            skb->h.icmph->code != ICMP_FRAG_NEEDED)
                return;
 
-       spi = ntohl(ntohs(ipch->cpi));
+       spi = htonl(ntohs(ipch->cpi));
        x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr,
                              spi, IPPROTO_COMP, AF_INET);
        if (!x)
index 3d560dec63ab5dacf2d848191bb62f0069276d7f..d4072533da218e66c8651e9495c50ea9a35a1445 100644 (file)
@@ -170,8 +170,8 @@ config IP_NF_PPTP
          Documentation/modules.txt.  If unsure, say `N'.
 
 config IP_NF_H323
-       tristate  'H.323 protocol support'
-       depends on IP_NF_CONNTRACK
+       tristate  'H.323 protocol support (EXPERIMENTAL)'
+       depends on IP_NF_CONNTRACK && EXPERIMENTAL
        help
          H.323 is a VoIP signalling protocol from ITU-T. As one of the most
          important VoIP protocols, it is widely used by voice hardware and
index c2d92f99a2b8b0b18bc1f17e1ec742a2c6051de5..d0d19192026d9eb2327cf68a47a4ba1b23dc7fe5 100644 (file)
@@ -948,7 +948,7 @@ static int do_add_counters(void __user *user, unsigned int len)
 
        write_lock_bh(&t->lock);
        private = t->private;
-       if (private->number != paddc->num_counters) {
+       if (private->number != tmp.num_counters) {
                ret = -EINVAL;
                goto unlock_up_free;
        }
index 979a2eac6f003101438ecd518b1c4d9c2c365bf8..a297da7bbef5dc735d1c68d57fe35b1db901d820 100644 (file)
@@ -1318,6 +1318,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
                        .tuple.dst.u.tcp.port;
                sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL]
                        .tuple.dst.ip;
+               memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
 
                DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n",
                       NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port));
index 355a53a5b6cddf81c5fa42257b3d6a611ab603d7..26dfecadb335681ef8c0b28d778d7ef3001c6a5d 100644 (file)
@@ -528,14 +528,15 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
 
                        /* Decode */
                        if ((err = (Decoders[son->type]) (bs, son, base,
-                                                         level + 1)) >
-                           H323_ERROR_STOP)
+                                                         level + 1)) <
+                           H323_ERROR_NONE)
                                return err;
 
                        bs->cur = beg + len;
                        bs->bit = 0;
                } else if ((err = (Decoders[son->type]) (bs, son, base,
-                                                        level + 1)))
+                                                        level + 1)) <
+                          H323_ERROR_NONE)
                        return err;
        }
 
@@ -554,7 +555,7 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
 
        /* Decode the extension components */
        for (opt = 0; opt < bmp2_len; opt++, i++, son++) {
-               if (son->attr & STOP) {
+               if (i < f->ub && son->attr & STOP) {
                        PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
                              son->name);
                        return H323_ERROR_STOP;
@@ -584,8 +585,8 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
                beg = bs->cur;
 
                if ((err = (Decoders[son->type]) (bs, son, base,
-                                                 level + 1)) >
-                   H323_ERROR_STOP)
+                                                 level + 1)) <
+                   H323_ERROR_NONE)
                        return err;
 
                bs->cur = beg + len;
@@ -660,18 +661,20 @@ int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level)
                                                          i <
                                                          effective_count ?
                                                          base : NULL,
-                                                         level + 1)) >
-                           H323_ERROR_STOP)
+                                                         level + 1)) <
+                           H323_ERROR_NONE)
                                return err;
 
                        bs->cur = beg + len;
                        bs->bit = 0;
                } else
-                   if ((err = (Decoders[son->type]) (bs, son,
-                                                     i < effective_count ?
-                                                     base : NULL,
-                                                     level + 1)))
-                       return err;
+                       if ((err = (Decoders[son->type]) (bs, son,
+                                                         i <
+                                                         effective_count ?
+                                                         base : NULL,
+                                                         level + 1)) <
+                           H323_ERROR_NONE)
+                               return err;
 
                if (base)
                        base += son->offset;
@@ -735,13 +738,14 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
                }
                beg = bs->cur;
 
-               if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) >
-                   H323_ERROR_STOP)
+               if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) <
+                   H323_ERROR_NONE)
                        return err;
 
                bs->cur = beg + len;
                bs->bit = 0;
-       } else if ((err = (Decoders[son->type]) (bs, son, base, level + 1)))
+       } else if ((err = (Decoders[son->type]) (bs, son, base, level + 1)) <
+                  H323_ERROR_NONE)
                return err;
 
        return H323_ERROR_NONE;
index 7d3ba4302e9e3ef0463c79d7e175eed53eb6e4d0..8ccfe17bb253353693bb745c5c9fceff8ffa7de1 100644 (file)
@@ -469,8 +469,8 @@ pptp_inbound_pkt(struct sk_buff **pskb,
                        DEBUGP("%s but no session\n", pptp_msg_name[msg]);
                        break;
                }
-               if (info->sstate != PPTP_CALL_IN_REP
-                   && info->sstate != PPTP_CALL_IN_CONF) {
+               if (info->cstate != PPTP_CALL_IN_REP
+                   && info->cstate != PPTP_CALL_IN_CONF) {
                        DEBUGP("%s but never sent IN_CALL_REPLY\n",
                                pptp_msg_name[msg]);
                        break;
index 6c4899d8046a5b3265555869e9c8528f3a5553c2..96ceabaec4027932854f46479b112d45a4ac53d6 100644 (file)
@@ -49,15 +49,15 @@ gre_in_range(const struct ip_conntrack_tuple *tuple,
             const union ip_conntrack_manip_proto *min,
             const union ip_conntrack_manip_proto *max)
 {
-       u_int32_t key;
+       __be16 key;
 
        if (maniptype == IP_NAT_MANIP_SRC)
                key = tuple->src.u.gre.key;
        else
                key = tuple->dst.u.gre.key;
 
-       return ntohl(key) >= ntohl(min->gre.key)
-               && ntohl(key) <= ntohl(max->gre.key);
+       return ntohs(key) >= ntohs(min->gre.key)
+               && ntohs(key) <= ntohs(max->gre.key);
 }
 
 /* generate unique tuple ... */
@@ -81,14 +81,14 @@ gre_unique_tuple(struct ip_conntrack_tuple *tuple,
                min = 1;
                range_size = 0xffff;
        } else {
-               min = ntohl(range->min.gre.key);
-               range_size = ntohl(range->max.gre.key) - min + 1;
+               min = ntohs(range->min.gre.key);
+               range_size = ntohs(range->max.gre.key) - min + 1;
        }
 
        DEBUGP("min = %u, range_size = %u\n", min, range_size); 
 
        for (i = 0; i < range_size; i++, key++) {
-               *keyptr = htonl(min + key % range_size);
+               *keyptr = htons(min + key % range_size);
                if (!ip_nat_used_tuple(tuple, conntrack))
                        return 1;
        }
index c622538455385d718f66e17e7f5c964d9404f723..c33244263b9035a688c73816487a89c4a5381d62 100644 (file)
@@ -768,6 +768,7 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                        len *= sizeof(unsigned long);
                        *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
                        if (*obj == NULL) {
+                               kfree(lp);
                                kfree(id);
                                if (net_ratelimit())
                                        printk("OOM in bsalg (%d)\n", __LINE__);
@@ -1003,12 +1004,12 @@ static unsigned char snmp_trap_decode(struct asn1_ctx *ctx,
                
        return 1;
 
+err_addr_free:
+       kfree((unsigned long *)trap->ip_address);
+
 err_id_free:
        kfree(trap->id);
 
-err_addr_free:
-       kfree((unsigned long *)trap->ip_address);
-       
        return 0;
 }
 
@@ -1126,11 +1127,10 @@ static int snmp_parse_mangle(unsigned char *msg,
                struct snmp_v1_trap trap;
                unsigned char ret = snmp_trap_decode(&ctx, &trap, map, check);
                
-               /* Discard trap allocations regardless */
-               kfree(trap.id);
-               kfree((unsigned long *)trap.ip_address);
-               
-               if (!ret)
+               if (ret) {
+                       kfree(trap.id);
+                       kfree((unsigned long *)trap.ip_address);
+               } else 
                        return ret;
                
        } else {
index 39fd4c2a2386248421a74795665bd50dda749293..b98f7b08b084586478ec431ec83485aa6118ff8c 100644 (file)
@@ -428,7 +428,7 @@ ipt_log_target(struct sk_buff **pskb,
 
        if (loginfo->logflags & IPT_LOG_NFLOG)
                nf_log_packet(PF_INET, hooknum, *pskb, in, out, &li,
-                             loginfo->prefix);
+                             "%s", loginfo->prefix);
        else
                ipt_log_packet(PF_INET, hooknum, *pskb, in, out, &li,
                               loginfo->prefix);
index 1438432857021b1ebd09486362cd9243f5f9554e..b847ee409efbb7146987f526998ccb8ea51422fe 100644 (file)
@@ -821,6 +821,7 @@ checkentry(const char *tablename,
        /* Create our proc 'status' entry. */
        curr_table->status_proc = create_proc_entry(curr_table->name, ip_list_perms, proc_net_ipt_recent);
        if (!curr_table->status_proc) {
+               vfree(hold);
                printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n");
                /* Destroy the created table */
                spin_lock_bh(&recent_lock);
@@ -845,7 +846,6 @@ checkentry(const char *tablename,
                spin_unlock_bh(&recent_lock);
                vfree(curr_table->time_info);
                vfree(curr_table->hash_table);
-               vfree(hold);
                vfree(curr_table->table);
                vfree(curr_table);
                return 0;
index 5bc9f64d7b5b06f9bf1d5a2d8c3923f6fdaccfb9..77d974443c7b6291e54ca4713945a0a53d582167 100644 (file)
@@ -348,6 +348,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len)
                        .tuple.dst.u.tcp.port;
                sin.sin_addr.s_addr = ct->tuplehash[IP_CT_DIR_ORIGINAL]
                        .tuple.dst.u3.ip;
+               memset(sin.sin_zero, 0, sizeof(sin.sin_zero));
 
                DEBUGP("SO_ORIGINAL_DST: %u.%u.%u.%u %u\n",
                       NIPQUAD(sin.sin_addr.s_addr), ntohs(sin.sin_port));
index b72fa55dfb84d114484bf6f7d1b4751449d9c4e3..ba7c63ca5bb10838f9e81a64b81cf9131be1a3f2 100644 (file)
@@ -135,7 +135,8 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
 
                /* Do additive increase */
                if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
-                       tp->snd_cwnd_cnt += ca->ai;
+                       /* cwnd = cwnd + a(w) / cwnd */
+                       tp->snd_cwnd_cnt += ca->ai + 1;
                        if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
                                tp->snd_cwnd_cnt -= tp->snd_cwnd;
                                tp->snd_cwnd++;
index 9f0cca4c4fae2021e52ee5655f9b89b9ade7f753..b5521a9d3dc1a3acbbbf35ca50b8425fb0f882ca 100644 (file)
@@ -1649,7 +1649,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_sock *tp)
         * Hence, we can detect timed out packets during fast
         * retransmit without falling to slow start.
         */
-       if (tcp_head_timedout(sk, tp)) {
+       if (!IsReno(tp) && tcp_head_timedout(sk, tp)) {
                struct sk_buff *skb;
 
                skb = tp->scoreboard_skb_hint ? tp->scoreboard_skb_hint
index 743016baa04867473a022008367aa05a61bac284..f33c9dddaa125b44a17291018867cd622838e3c8 100644 (file)
@@ -642,7 +642,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
  * eventually). The difference is that pulled data not copied, but
  * immediately discarded.
  */
-static unsigned char *__pskb_trim_head(struct sk_buff *skb, int len)
+static void __pskb_trim_head(struct sk_buff *skb, int len)
 {
        int i, k, eat;
 
@@ -667,7 +667,6 @@ static unsigned char *__pskb_trim_head(struct sk_buff *skb, int len)
        skb->tail = skb->data;
        skb->data_len -= len;
        skb->len = skb->data_len;
-       return skb->tail;
 }
 
 int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
@@ -676,12 +675,11 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
            pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
                return -ENOMEM;
 
-       if (len <= skb_headlen(skb)) {
+       /* If len == headlen, we avoid __skb_pull to preserve alignment. */
+       if (unlikely(len < skb_headlen(skb)))
                __skb_pull(skb, len);
-       } else {
-               if (__pskb_trim_head(skb, len-skb_headlen(skb)) == NULL)
-                       return -ENOMEM;
-       }
+       else
+               __pskb_trim_head(skb, len - skb_headlen(skb));
 
        TCP_SKB_CB(skb)->seq += len;
        skb->ip_summed = CHECKSUM_HW;
index f285bbf296e28d79099887afa2882be75ddf32bc..8604c747bca5fa3d1353159e906ddfcec0da1290 100644 (file)
@@ -221,7 +221,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
                        if (pskb_may_pull(skb, xprth + 4 - skb->data)) {
                                u16 *ipcomp_hdr = (u16 *)xprth;
 
-                               fl->fl_ipsec_spi = ntohl(ntohs(ipcomp_hdr[1]));
+                               fl->fl_ipsec_spi = htonl(ntohs(ipcomp_hdr[1]));
                        }
                        break;
                default:
index 05eb67def39f17e9c9b84d9270fdbe6fe1ee2a87..48636436028ab2b1ce1b1dfee0bce70b545e0799 100644 (file)
@@ -208,7 +208,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG)
                return;
 
-       spi = ntohl(ntohs(ipcomph->cpi));
+       spi = htonl(ntohs(ipcomph->cpi));
        x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, IPPROTO_COMP, AF_INET6);
        if (!x)
                return;
index 0a673038344fe30142e0d095f3f6bb5c6a8854a8..2e72f89a7019929f2da18cb74ef1ba26e9d1d74b 100644 (file)
@@ -1103,7 +1103,7 @@ do_add_counters(void __user *user, unsigned int len)
 
        write_lock_bh(&t->lock);
        private = t->private;
-       if (private->number != paddc->num_counters) {
+       if (private->number != tmp.num_counters) {
                ret = -EINVAL;
                goto unlock_up_free;
        }
index a96c0de14b00ed963b52a221cbaca428b46f483b..73c6300109d61d7243e89f5268d3d9fbe3ec3e30 100644 (file)
@@ -439,7 +439,7 @@ ip6t_log_target(struct sk_buff **pskb,
 
        if (loginfo->logflags & IP6T_LOG_NFLOG)
                nf_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,
-                             loginfo->prefix);
+                             "%s", loginfo->prefix);
        else
                ip6t_log_packet(PF_INET6, hooknum, *pskb, in, out, &li,
                                loginfo->prefix);
index 94dbdb8b458d01fa1dc85cd42da93e5d84b85024..4f6b84c8f4ab6567cc70301d7bdcc2460eabb38a 100644 (file)
@@ -40,7 +40,7 @@ match(const struct sk_buff *skb,
 
        memset(eui64, 0, sizeof(eui64));
 
-       if (eth_hdr(skb)->h_proto == ntohs(ETH_P_IPV6)) {
+       if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {
                if (skb->nh.ipv6h->version == 0x6) {
                        memcpy(eui64, eth_hdr(skb)->h_source, 3);
                        memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
index 0190e39096b978692349bd0dbd3e5271a828fab3..8a777932786d7d4c0975fd6941489039abad3d06 100644 (file)
@@ -280,10 +280,13 @@ static int inline rt6_check_neigh(struct rt6_info *rt)
 {
        struct neighbour *neigh = rt->rt6i_nexthop;
        int m = 0;
-       if (neigh) {
+       if (rt->rt6i_flags & RTF_NONEXTHOP ||
+           !(rt->rt6i_flags & RTF_GATEWAY))
+               m = 1;
+       else if (neigh) {
                read_lock_bh(&neigh->lock);
                if (neigh->nud_state & NUD_VALID)
-                       m = 1;
+                       m = 2;
                read_unlock_bh(&neigh->lock);
        }
        return m;
@@ -292,15 +295,18 @@ static int inline rt6_check_neigh(struct rt6_info *rt)
 static int rt6_score_route(struct rt6_info *rt, int oif,
                           int strict)
 {
-       int m = rt6_check_dev(rt, oif);
+       int m, n;
+               
+       m = rt6_check_dev(rt, oif);
        if (!m && (strict & RT6_SELECT_F_IFACE))
                return -1;
 #ifdef CONFIG_IPV6_ROUTER_PREF
        m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2;
 #endif
-       if (rt6_check_neigh(rt))
+       n = rt6_check_neigh(rt);
+       if (n > 1)
                m |= 16;
-       else if (strict & RT6_SELECT_F_REACHABLE)
+       else if (!n && strict & RT6_SELECT_F_REACHABLE)
                return -1;
        return m;
 }
index 2dbf134d5266068e633896e909a71d2f5572c8b4..811d998725bc6728bec208ad90ef81157f8235a0 100644 (file)
@@ -944,9 +944,9 @@ out:
        return rc;
 }
 
-static int ipx_map_frame_type(unsigned char type)
+static __be16 ipx_map_frame_type(unsigned char type)
 {
-       int rc = 0;
+       __be16 rc = 0;
 
        switch (type) {
        case IPX_FRAME_ETHERII: rc = htons(ETH_P_IPX);          break;
index 67774448efd966eb801dc822d0788e09a530be54..a394c6fe19a26839e07dbed3f7015224d03c1161 100644 (file)
@@ -119,7 +119,7 @@ out:
        return rc;
 }
 
-static int ipxrtr_delete(long net)
+static int ipxrtr_delete(__u32 net)
 {
        struct ipx_route *r, *tmp;
        int rc;
index 254f9074690011a66e0382fbef5f65892e81b32e..2d2e2b1919f40f70230c1527edbf8bb0c23d5fa4 100644 (file)
@@ -544,7 +544,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
 {
        struct sk_buff *tx_skb;
        int n;
-       __u32 tmp_be32, tmp_be16;
+       __u32 tmp_be32;
+       __be16 tmp_be16;
        __u8 *fp;
 
        IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
index 7029618f5719fa6659bd096c7d7a0345b29dff70..a16528657b4c6a0a7e584df36e051cdcff6706ec 100644 (file)
@@ -884,7 +884,8 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now)
        if (now) {
                /* Send down empty frame to trigger speed change */
                skb = dev_alloc_skb(0);
-               irlap_queue_xmit(self, skb);
+               if (skb)
+                       irlap_queue_xmit(self, skb);
        }
 }
 
index c60273cad778ed1c3cdc7eda166aafc6b21d9802..61cdda4e5d3ba8b25f02af19a7bbb634fc9a0d84 100644 (file)
@@ -321,7 +321,7 @@ static int
 nfulnl_set_flags(struct nfulnl_instance *inst, u_int16_t flags)
 {
        spin_lock_bh(&inst->lock);
-       inst->flags = ntohs(flags);
+       inst->flags = flags;
        spin_unlock_bh(&inst->lock);
 
        return 0;
@@ -902,7 +902,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
        if (nfula[NFULA_CFG_FLAGS-1]) {
                u_int16_t flags =
                        *(u_int16_t *)NFA_DATA(nfula[NFULA_CFG_FLAGS-1]);
-               nfulnl_set_flags(inst, ntohl(flags));
+               nfulnl_set_flags(inst, ntohs(flags));
        }
 
 out_put:
index 31eb83717c267a799b013f073cfe3e99301709d9..138ea92ed268457b99d9c6b44a1a9580cc7c016a 100644 (file)
@@ -193,8 +193,10 @@ static void dev_watchdog(unsigned long arg)
                    netif_running(dev) &&
                    netif_carrier_ok(dev)) {
                        if (netif_queue_stopped(dev) &&
-                           (jiffies - dev->trans_start) > dev->watchdog_timeo) {
-                               printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name);
+                           time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) {
+
+                               printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n",
+                                      dev->name);
                                dev->tx_timeout(dev);
                        }
                        if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo))
index d117ebc75cf87ce25aa8699f61b4338b12fc1053..1662f9cc869e0a1cd463b7f3575c0c243dfc4ded 100644 (file)
@@ -73,6 +73,8 @@ static struct sctp_association *__sctp_lookup_association(
                                        const union sctp_addr *peer,
                                        struct sctp_transport **pt);
 
+static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
+
 
 /* Calculate the SCTP checksum of an SCTP packet.  */
 static inline int sctp_rcv_checksum(struct sk_buff *skb)
@@ -186,7 +188,6 @@ int sctp_rcv(struct sk_buff *skb)
         */
        if (sk->sk_bound_dev_if && (sk->sk_bound_dev_if != af->skb_iif(skb)))
        {
-               sock_put(sk);
                if (asoc) {
                        sctp_association_put(asoc);
                        asoc = NULL;
@@ -197,7 +198,6 @@ int sctp_rcv(struct sk_buff *skb)
                sk = sctp_get_ctl_sock();
                ep = sctp_sk(sk)->ep;
                sctp_endpoint_hold(ep);
-               sock_hold(sk);
                rcvr = &ep->base;
        }
 
@@ -253,25 +253,18 @@ int sctp_rcv(struct sk_buff *skb)
         */
        sctp_bh_lock_sock(sk);
 
-       /* It is possible that the association could have moved to a different
-        * socket if it is peeled off. If so, update the sk.
-        */ 
-       if (sk != rcvr->sk) {
-               sctp_bh_lock_sock(rcvr->sk);
-               sctp_bh_unlock_sock(sk);
-               sk = rcvr->sk;
-       }
-
        if (sock_owned_by_user(sk))
-               sk_add_backlog(sk, skb);
+               sctp_add_backlog(sk, skb);
        else
-               sctp_backlog_rcv(sk, skb);
+               sctp_inq_push(&chunk->rcvr->inqueue, chunk);
 
-       /* Release the sock and the sock ref we took in the lookup calls.
-        * The asoc/ep ref will be released in sctp_backlog_rcv.
-        */
        sctp_bh_unlock_sock(sk);
-       sock_put(sk);
+
+       /* Release the asoc/ep ref we took in the lookup calls. */
+       if (asoc)
+               sctp_association_put(asoc);
+       else
+               sctp_endpoint_put(ep);
 
        return 0;
 
@@ -280,8 +273,7 @@ discard_it:
        return 0;
 
 discard_release:
-       /* Release any structures we may be holding. */
-       sock_put(sk);
+       /* Release the asoc/ep ref we took in the lookup calls. */
        if (asoc)
                sctp_association_put(asoc);
        else
@@ -290,56 +282,87 @@ discard_release:
        goto discard_it;
 }
 
-/* Handle second half of inbound skb processing.  If the sock was busy,
- * we may have need to delay processing until later when the sock is
- * released (on the backlog).   If not busy, we call this routine
- * directly from the bottom half.
+/* Process the backlog queue of the socket.  Every skb on
+ * the backlog holds a ref on an association or endpoint.
+ * We hold this ref throughout the state machine to make
+ * sure that the structure we need is still around.
  */
 int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 {
        struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
-       struct sctp_inq *inqueue = NULL;
+       struct sctp_inq *inqueue = &chunk->rcvr->inqueue;
        struct sctp_ep_common *rcvr = NULL;
+       int backloged = 0;
 
        rcvr = chunk->rcvr;
 
-       BUG_TRAP(rcvr->sk == sk);
-
-       if (rcvr->dead) {
-               sctp_chunk_free(chunk);
-       } else {
-               inqueue = &chunk->rcvr->inqueue;
-               sctp_inq_push(inqueue, chunk);
-       }
-
-       /* Release the asoc/ep ref we took in the lookup calls in sctp_rcv. */ 
-       if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
-               sctp_association_put(sctp_assoc(rcvr));
-       else
-               sctp_endpoint_put(sctp_ep(rcvr));
-  
+       /* If the rcvr is dead then the association or endpoint
+        * has been deleted and we can safely drop the chunk
+        * and refs that we are holding.
+        */
+       if (rcvr->dead) {
+               sctp_chunk_free(chunk);
+               goto done;
+       }
+
+       if (unlikely(rcvr->sk != sk)) {
+               /* In this case, the association moved from one socket to
+                * another.  We are currently sitting on the backlog of the
+                * old socket, so we need to move.
+                * However, since we are here in the process context we
+                * need to take make sure that the user doesn't own
+                * the new socket when we process the packet.
+                * If the new socket is user-owned, queue the chunk to the
+                * backlog of the new socket without dropping any refs.
+                * Otherwise, we can safely push the chunk on the inqueue.
+                */
+
+               sk = rcvr->sk;
+               sctp_bh_lock_sock(sk);
+
+               if (sock_owned_by_user(sk)) {
+                       sk_add_backlog(sk, skb);
+                       backloged = 1;
+               } else
+                       sctp_inq_push(inqueue, chunk);
+
+               sctp_bh_unlock_sock(sk);
+
+               /* If the chunk was backloged again, don't drop refs */
+               if (backloged)
+                       return 0;
+       } else {
+               sctp_inq_push(inqueue, chunk);
+       }
+
+done:
+       /* Release the refs we took in sctp_add_backlog */
+       if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
+               sctp_association_put(sctp_assoc(rcvr));
+       else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
+               sctp_endpoint_put(sctp_ep(rcvr));
+       else
+               BUG();
+
         return 0;
 }
 
-void sctp_backlog_migrate(struct sctp_association *assoc, 
-                         struct sock *oldsk, struct sock *newsk)
+static void sctp_add_backlog(struct sock *sk, struct sk_buff *skb)
 {
-       struct sk_buff *skb;
-       struct sctp_chunk *chunk;
+       struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
+       struct sctp_ep_common *rcvr = chunk->rcvr;
 
-       skb = oldsk->sk_backlog.head;
-       oldsk->sk_backlog.head = oldsk->sk_backlog.tail = NULL;
-       while (skb != NULL) {
-               struct sk_buff *next = skb->next;
-
-               chunk = SCTP_INPUT_CB(skb)->chunk;
-               skb->next = NULL;
-               if (&assoc->base == chunk->rcvr)
-                       sk_add_backlog(newsk, skb);
-               else
-                       sk_add_backlog(oldsk, skb);
-               skb = next;
-       }
+       /* Hold the assoc/ep while hanging on the backlog queue.
+        * This way, we know structures we need will not disappear from us
+        */
+       if (SCTP_EP_TYPE_ASSOCIATION == rcvr->type)
+               sctp_association_hold(sctp_assoc(rcvr));
+       else if (SCTP_EP_TYPE_SOCKET == rcvr->type)
+               sctp_endpoint_hold(sctp_ep(rcvr));
+       else
+               BUG();
+
+       sk_add_backlog(sk, skb);
 }
 
 /* Handle icmp frag needed error. */
@@ -412,7 +435,7 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
        union sctp_addr daddr;
        struct sctp_af *af;
        struct sock *sk = NULL;
-       struct sctp_association *asoc = NULL;
+       struct sctp_association *asoc;
        struct sctp_transport *transport = NULL;
 
        *app = NULL; *tpp = NULL;
@@ -453,7 +476,6 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *skb,
        return sk;
 
 out:
-       sock_put(sk);
        if (asoc)
                sctp_association_put(asoc);
        return NULL;
@@ -463,7 +485,6 @@ out:
 void sctp_err_finish(struct sock *sk, struct sctp_association *asoc)
 {
        sctp_bh_unlock_sock(sk);
-       sock_put(sk);
        if (asoc)
                sctp_association_put(asoc);
 }
@@ -490,7 +511,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
        int type = skb->h.icmph->type;
        int code = skb->h.icmph->code;
        struct sock *sk;
-       struct sctp_association *asoc;
+       struct sctp_association *asoc = NULL;
        struct sctp_transport *transport;
        struct inet_sock *inet;
        char *saveip, *savesctp;
@@ -716,7 +737,6 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l
 
 hit:
        sctp_endpoint_hold(ep);
-       sock_hold(epb->sk);
        read_unlock(&head->lock);
        return ep;
 }
@@ -818,7 +838,6 @@ static struct sctp_association *__sctp_lookup_association(
 hit:
        *pt = transport;
        sctp_association_hold(asoc);
-       sock_hold(epb->sk);
        read_unlock(&head->lock);
        return asoc;
 }
@@ -846,7 +865,6 @@ int sctp_has_association(const union sctp_addr *laddr,
        struct sctp_transport *transport;
 
        if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) {
-               sock_put(asoc->base.sk);
                sctp_association_put(asoc);
                return 1;
        }
index 8d1dc24bab4c1f1da541c760e13955ca54b77d29..c5beb2ad7ef7a442798a669faea2c393d5f422f8 100644 (file)
@@ -498,10 +498,6 @@ static void sctp_cmd_assoc_failed(sctp_cmd_seq_t *commands,
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
 
-       /* Set sk_err to ECONNRESET on a 1-1 style socket. */
-       if (!sctp_style(asoc->base.sk, UDP))
-               asoc->base.sk->sk_err = ECONNRESET; 
-
        /* SEND_FAILED sent later when cleaning up the association. */
        asoc->outqueue.error = error;
        sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
@@ -838,6 +834,15 @@ static void sctp_cmd_del_non_primary(struct sctp_association *asoc)
        return;
 }
 
+/* Helper function to set sk_err on a 1-1 style socket. */
+static void sctp_cmd_set_sk_err(struct sctp_association *asoc, int error)
+{
+       struct sock *sk = asoc->base.sk;
+
+       if (!sctp_style(sk, UDP))
+               sk->sk_err = error;
+}
+
 /* These three macros allow us to pull the debugging code out of the
  * main flow of sctp_do_sm() to keep attention focused on the real
  * functionality there.
@@ -1458,6 +1463,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
                        local_cork = 0;
                        asoc->peer.retran_path = t;
                        break;
+               case SCTP_CMD_SET_SK_ERR:
+                       sctp_cmd_set_sk_err(asoc, cmd->obj.error);
+                       break;
                default:
                        printk(KERN_WARNING "Impossible command: %u, %p\n",
                               cmd->verb, cmd->obj.ptr);
index 8cdba51ec0766a4d333ddc30e7ba4b756fe7802f..8bc279219a72ca3b8e4e107eaeba562e87a79e4a 100644 (file)
@@ -93,7 +93,7 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep,
 static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk);
 
 static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
-                                          __u16 error,
+                                          __u16 error, int sk_err,
                                           const struct sctp_association *asoc,
                                           struct sctp_transport *transport);
 
@@ -448,7 +448,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
        __u32 init_tag;
        struct sctp_chunk *err_chunk;
        struct sctp_packet *packet;
-       sctp_disposition_t ret;
+       __u16 error;
 
        if (!sctp_vtag_verify(chunk, asoc))
                return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -480,11 +480,9 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
                        goto nomem;
 
                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(SCTP_MIB_ABORTEDS);
-               sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
-               return SCTP_DISPOSITION_DELETE_TCB;
+               return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM,
+                                             ECONNREFUSED, asoc,
+                                             chunk->transport);
        }
 
        /* Verify the INIT chunk before processing it. */
@@ -511,27 +509,16 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
                                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                                SCTP_PACKET(packet));
                                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,
-                                               SCTP_NULL());
-                               return SCTP_DISPOSITION_CONSUME;
+                               error = SCTP_ERROR_INV_PARAM;
                        } else {
-                               sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
-                                               SCTP_STATE(SCTP_STATE_CLOSED));
-                               sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,
-                                               SCTP_NULL());
-                               return SCTP_DISPOSITION_NOMEM;
+                               error = SCTP_ERROR_NO_RESOURCE;
                        }
                } else {
-                       ret = sctp_sf_tabort_8_4_8(ep, asoc, type, arg,
-                                                  commands);
-                       sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
-                                       SCTP_STATE(SCTP_STATE_CLOSED));
-                       sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,
-                                       SCTP_NULL());
-                       return ret;
+                       sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
+                       error = SCTP_ERROR_INV_PARAM;
                }
+               return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED,
+                                               asoc, chunk->transport);
        }
 
        /* Tag the variable length parameters.  Note that we never
@@ -886,6 +873,8 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
        struct sctp_transport *transport = (struct sctp_transport *) arg;
 
        if (asoc->overall_error_count >= asoc->max_retrans) {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
@@ -1030,6 +1019,12 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
                                                  commands);
 
        hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
+       /* Make sure that the length of the parameter is what we expect */
+       if (ntohs(hbinfo->param_hdr.length) !=
+                                   sizeof(sctp_sender_hb_info_t)) {
+               return SCTP_DISPOSITION_DISCARD;
+       }
+
        from_addr = hbinfo->daddr;
        link = sctp_assoc_lookup_paddr(asoc, &from_addr);
 
@@ -2126,6 +2121,8 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep,
        int attempts = asoc->init_err_counter + 1;
 
        if (attempts > asoc->max_init_attempts) {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                                SCTP_U32(SCTP_ERROR_STALE_COOKIE));
                return SCTP_DISPOSITION_DELETE_TCB;
@@ -2262,6 +2259,7 @@ sctp_disposition_t sctp_sf_do_9_1_abort(const struct sctp_endpoint *ep,
        if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
                error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
 
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
        /* ASSOC_FAILED will DELETE_TCB. */
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(error));
        SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
@@ -2306,7 +2304,8 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(const struct sctp_endpoint *ep,
        if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
                error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
 
-       return sctp_stop_t1_and_abort(commands, error, asoc, chunk->transport);
+       return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED, asoc,
+                                     chunk->transport);
 }
 
 /*
@@ -2318,7 +2317,8 @@ sctp_disposition_t sctp_sf_cookie_wait_icmp_abort(const struct sctp_endpoint *ep
                                        void *arg,
                                        sctp_cmd_seq_t *commands)
 {
-       return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR, asoc,
+       return sctp_stop_t1_and_abort(commands, SCTP_ERROR_NO_ERROR,
+                                     ENOPROTOOPT, asoc,
                                      (struct sctp_transport *)arg);
 }
 
@@ -2343,7 +2343,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_abort(const struct sctp_endpoint *ep,
  * This is common code called by several sctp_sf_*_abort() functions above.
  */
 static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
-                                          __u16 error,
+                                          __u16 error, int sk_err,
                                           const struct sctp_association *asoc,
                                           struct sctp_transport *transport)
 {
@@ -2353,6 +2353,7 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
        SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
        sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(sk_err));
        /* CMD_INIT_FAILED will DELETE_TCB. */
        sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                        SCTP_U32(error));
@@ -3336,6 +3337,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
                sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ECONNABORTED));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_ASCONF_ACK));
                SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
@@ -3362,6 +3365,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
                 * 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_SET_SK_ERR,
+                               SCTP_ERROR(ECONNABORTED));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_ASCONF_ACK));
                SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
@@ -3714,9 +3719,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
        if (asoc->state <= SCTP_STATE_COOKIE_ECHOED) {
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ECONNREFUSED));
                sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                                SCTP_U32(SCTP_ERROR_PROTO_VIOLATION));
        } else {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ECONNABORTED));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_PROTO_VIOLATION));
                SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
@@ -4034,6 +4043,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort(
         * TCB.  This is a departure from our typical NOMEM handling.
         */
 
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                       SCTP_ERROR(ECONNABORTED));
        /* Delete the established association. */
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                        SCTP_U32(SCTP_ERROR_USER_ABORT));
@@ -4175,6 +4186,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort(
         * TCB.  This is a departure from our typical NOMEM handling.
         */
 
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                       SCTP_ERROR(ECONNREFUSED));
        /* Delete the established association. */
        sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                        SCTP_U32(SCTP_ERROR_USER_ABORT));
@@ -4543,6 +4556,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep,
        struct sctp_transport *transport = arg;
 
        if (asoc->overall_error_count >= asoc->max_retrans) {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
@@ -4662,6 +4677,8 @@ sctp_disposition_t sctp_sf_t1_init_timer_expire(const struct sctp_endpoint *ep,
                SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d"
                                  " max_init_attempts: %d\n",
                                  attempts, asoc->max_init_attempts);
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
                return SCTP_DISPOSITION_DELETE_TCB;
@@ -4711,6 +4728,8 @@ sctp_disposition_t sctp_sf_t1_cookie_timer_expire(const struct sctp_endpoint *ep
 
                sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
        } else {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
                return SCTP_DISPOSITION_DELETE_TCB;
@@ -4742,6 +4761,8 @@ sctp_disposition_t sctp_sf_t2_timer_expire(const struct sctp_endpoint *ep,
 
        SCTP_DEBUG_PRINTK("Timer T2 expired.\n");
        if (asoc->overall_error_count >= asoc->max_retrans) {
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                /* Note:  CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
@@ -4817,6 +4838,8 @@ sctp_disposition_t sctp_sf_t4_timer_expire(
        if (asoc->overall_error_count >= asoc->max_retrans) {
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
+               sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                               SCTP_ERROR(ETIMEDOUT));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
                SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
@@ -4870,6 +4893,8 @@ sctp_disposition_t sctp_sf_t5_timer_expire(const struct sctp_endpoint *ep,
                goto nomem;
 
        sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                       SCTP_ERROR(ETIMEDOUT));
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                        SCTP_U32(SCTP_ERROR_NO_ERROR));
 
@@ -5309,6 +5334,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
                 * 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_SET_SK_ERR,
+                               SCTP_ERROR(ECONNABORTED));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_DATA));
                SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
index b6e4b89539b3178216037c53350f5591dde8a1b6..174d4d35e951590d7bef5d10df113afe36f88ae6 100644 (file)
@@ -1057,6 +1057,7 @@ static int __sctp_connect(struct sock* sk,
        inet_sk(sk)->dport = htons(asoc->peer.port);
        af = sctp_get_af_specific(to.sa.sa_family);
        af->to_sk_daddr(&to, sk);
+       sk->sk_err = 0;
 
        timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK);
        err = sctp_wait_for_connect(asoc, &timeo);
@@ -1228,7 +1229,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
 
        ep = sctp_sk(sk)->ep;
 
-       /* Walk all associations on a socket, not on an endpoint.  */
+       /* Walk all associations on an endpoint.  */
        list_for_each_safe(pos, temp, &ep->asocs) {
                asoc = list_entry(pos, struct sctp_association, asocs);
 
@@ -1241,13 +1242,13 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
                        if (sctp_state(asoc, CLOSED)) {
                                sctp_unhash_established(asoc);
                                sctp_association_free(asoc);
+                               continue;
+                       }
+               }
 
-                       } else if (sock_flag(sk, SOCK_LINGER) &&
-                                  !sk->sk_lingertime)
-                               sctp_primitive_ABORT(asoc, NULL);
-                       else
-                               sctp_primitive_SHUTDOWN(asoc, NULL);
-               } else
+               if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)
+                       sctp_primitive_ABORT(asoc, NULL);
+               else
                        sctp_primitive_SHUTDOWN(asoc, NULL);
        }
 
@@ -5317,6 +5318,7 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
                 */
                sctp_release_sock(sk);
                current_timeo = schedule_timeout(current_timeo);
+               BUG_ON(sk != asoc->base.sk);
                sctp_lock_sock(sk);
 
                *timeo_p = current_timeo;
@@ -5604,12 +5606,14 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
         */
        newsp->type = type;
 
-       spin_lock_bh(&oldsk->sk_lock.slock);
-       /* Migrate the backlog from oldsk to newsk. */
-       sctp_backlog_migrate(assoc, oldsk, newsk);
-       /* Migrate the association to the new socket. */
+       /* Mark the new socket "in-use" by the user so that any packets
+        * that may arrive on the association after we've moved it are
+        * queued to the backlog.  This prevents a potential race between
+        * backlog processing on the old socket and new-packet processing
+        * on the new socket.
+        */
+       sctp_lock_sock(newsk);
        sctp_assoc_migrate(assoc, newsk);
-       spin_unlock_bh(&oldsk->sk_lock.slock);
 
        /* If the association on the newsk is already closed before accept()
         * is called, set RCV_SHUTDOWN flag.
@@ -5618,6 +5622,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
                newsk->sk_shutdown |= RCV_SHUTDOWN;
 
        newsk->sk_state = SCTP_SS_ESTABLISHED;
+       sctp_release_sock(newsk);
 }
 
 /* This proto struct describes the ULP interface for SCTP.  */
index 3ac4193a78edf2c0fcff4ae5257b50163c2a937f..7026b0866b7b0d50b0003b15bb14fde24a569a65 100644 (file)
@@ -159,6 +159,7 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail,
                detail->update(tmp, new);
        tmp->next = *head;
        *head = tmp;
+       detail->entries++;
        cache_get(tmp);
        is_new = cache_fresh_locked(tmp, new->expiry_time);
        cache_fresh_locked(old, 0);
index 55538f6b60ffc56648687f9f72fd7d0ebafe6af3..58a1b6b42dddba6c85c10330bacdb48f7438e4f4 100644 (file)
@@ -37,14 +37,6 @@ struct ctl_table net_table[] = {
                .mode           = 0555,
                .child          = core_table,
        },
-#ifdef CONFIG_NET
-       {
-               .ctl_name       = NET_ETHER,
-               .procname       = "ethernet",
-               .mode           = 0555,
-               .child          = ether_table,
-       },
-#endif
 #ifdef CONFIG_INET
        {
                .ctl_name       = NET_IPV4,
index b54971059f164136be5db7dbaea938548a4e4e15..891a6090cc099d2f88e15aa33ff68db982132d6e 100644 (file)
@@ -62,7 +62,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
        case IPPROTO_COMP:
                if (!pskb_may_pull(skb, sizeof(struct ip_comp_hdr)))
                        return -EINVAL;
-               *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
+               *spi = htonl(ntohs(*(u16*)(skb->h.raw + 2)));
                *seq = 0;
                return 0;
        default:
index 6d04504b2fc111a0bbd7ac8745fa9f96e008e72a..d0f86ed43f7a17156953d889df8cfa00f6013b04 100644 (file)
@@ -697,29 +697,79 @@ static void check_sec_ref(struct module *mod, const char *modname,
 
        /* Walk through all sections */
        for (i = 0; i < hdr->e_shnum; i++) {
-               Elf_Rela *rela;
-               Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset;
-               Elf_Rela *stop  = (void*)start + sechdrs[i].sh_size;
-               const char *name = secstrings + sechdrs[i].sh_name +
-                                               strlen(".rela");
+               const char *name = secstrings + sechdrs[i].sh_name;
+               const char *secname;
+               Elf_Rela r;
+               unsigned int r_sym;
                /* We want to process only relocation sections and not .init */
-               if (section_ref_ok(name) || (sechdrs[i].sh_type != SHT_RELA))
-                       continue;
+               if (sechdrs[i].sh_type == SHT_RELA) {
+                       Elf_Rela *rela;
+                       Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset;
+                       Elf_Rela *stop  = (void*)start + sechdrs[i].sh_size;
+                       name += strlen(".rela");
+                       if (section_ref_ok(name))
+                               continue;
 
-               for (rela = start; rela < stop; rela++) {
-                       Elf_Rela r;
-                       const char *secname;
-                       r.r_offset = TO_NATIVE(rela->r_offset);
-                       r.r_info   = TO_NATIVE(rela->r_info);
-                       r.r_addend = TO_NATIVE(rela->r_addend);
-                       sym = elf->symtab_start + ELF_R_SYM(r.r_info);
-                       /* Skip special sections */
-                       if (sym->st_shndx >= SHN_LORESERVE)
+                       for (rela = start; rela < stop; rela++) {
+                               r.r_offset = TO_NATIVE(rela->r_offset);
+#if KERNEL_ELFCLASS == ELFCLASS64
+                               if (hdr->e_machine == EM_MIPS) {
+                                       r_sym = ELF64_MIPS_R_SYM(rela->r_info);
+                                       r_sym = TO_NATIVE(r_sym);
+                               } else {
+                                       r.r_info = TO_NATIVE(rela->r_info);
+                                       r_sym = ELF_R_SYM(r.r_info);
+                               }
+#else
+                               r.r_info = TO_NATIVE(rela->r_info);
+                               r_sym = ELF_R_SYM(r.r_info);
+#endif
+                               r.r_addend = TO_NATIVE(rela->r_addend);
+                               sym = elf->symtab_start + r_sym;
+                               /* Skip special sections */
+                               if (sym->st_shndx >= SHN_LORESERVE)
+                                       continue;
+
+                               secname = secstrings +
+                                       sechdrs[sym->st_shndx].sh_name;
+                               if (section(secname))
+                                       warn_sec_mismatch(modname, name,
+                                                         elf, sym, r);
+                       }
+               } else if (sechdrs[i].sh_type == SHT_REL) {
+                       Elf_Rel *rel;
+                       Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset;
+                       Elf_Rel *stop  = (void*)start + sechdrs[i].sh_size;
+                       name += strlen(".rel");
+                       if (section_ref_ok(name))
                                continue;
 
-                       secname = secstrings + sechdrs[sym->st_shndx].sh_name;
-                       if (section(secname))
-                               warn_sec_mismatch(modname, name, elf, sym, r);
+                       for (rel = start; rel < stop; rel++) {
+                               r.r_offset = TO_NATIVE(rel->r_offset);
+#if KERNEL_ELFCLASS == ELFCLASS64
+                               if (hdr->e_machine == EM_MIPS) {
+                                       r_sym = ELF64_MIPS_R_SYM(rel->r_info);
+                                       r_sym = TO_NATIVE(r_sym);
+                               } else {
+                                       r.r_info = TO_NATIVE(rel->r_info);
+                                       r_sym = ELF_R_SYM(r.r_info);
+                               }
+#else
+                               r.r_info = TO_NATIVE(rel->r_info);
+                               r_sym = ELF_R_SYM(r.r_info);
+#endif
+                               r.r_addend = 0;
+                               sym = elf->symtab_start + r_sym;
+                               /* Skip special sections */
+                               if (sym->st_shndx >= SHN_LORESERVE)
+                                       continue;
+
+                               secname = secstrings +
+                                       sechdrs[sym->st_shndx].sh_name;
+                               if (section(secname))
+                                       warn_sec_mismatch(modname, name,
+                                                         elf, sym, r);
+                       }
                }
        }
 }
index b14255c72a375edcfe6da9f61589ba2e433deb94..861d866fcd8394bf2fdcec228fe8b7c81f145804 100644 (file)
@@ -21,6 +21,7 @@
 #define ELF_ST_BIND ELF32_ST_BIND
 #define ELF_ST_TYPE ELF32_ST_TYPE
 
+#define Elf_Rel     Elf32_Rel
 #define Elf_Rela    Elf32_Rela
 #define ELF_R_SYM   ELF32_R_SYM
 #define ELF_R_TYPE  ELF32_R_TYPE
 #define ELF_ST_BIND ELF64_ST_BIND
 #define ELF_ST_TYPE ELF64_ST_TYPE
 
+#define Elf_Rel     Elf64_Rel
 #define Elf_Rela    Elf64_Rela
 #define ELF_R_SYM   ELF64_R_SYM
 #define ELF_R_TYPE  ELF64_R_TYPE
 #endif
 
+/* The 64-bit MIPS ELF ABI uses an unusual reloc format. */
+typedef struct
+{
+       Elf32_Word    r_sym;    /* Symbol index */
+       unsigned char r_ssym;   /* Special symbol for 2nd relocation */
+       unsigned char r_type3;  /* 3rd relocation type */
+       unsigned char r_type2;  /* 2nd relocation type */
+       unsigned char r_type1;  /* 1st relocation type */
+} _Elf64_Mips_R_Info;
+
+typedef union
+{
+       Elf64_Xword             r_info_number;
+       _Elf64_Mips_R_Info      r_info_fields;
+} _Elf64_Mips_R_Info_union;
+
+#define ELF64_MIPS_R_SYM(i) \
+  ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
+
 #if KERNEL_ELFDATA != HOST_ELFDATA
 
 static inline void __endian(const void *src, void *dest, unsigned int size)
@@ -48,8 +69,6 @@ static inline void __endian(const void *src, void *dest, unsigned int size)
                ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
 }
 
-
-
 #define TO_NATIVE(x)                                           \
 ({                                                             \
        typeof(x) __x;                                          \
index d987048d3f330526b31185d5023ea8fd4c891027..90b4cdc0c94806ca1cba335aaa6213dc9012229a 100644 (file)
@@ -3231,7 +3231,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
                goto out;
 
        /* Handle mapped IPv4 packets arriving via IPv6 sockets */
-       if (family == PF_INET6 && skb->protocol == ntohs(ETH_P_IP))
+       if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
                family = PF_INET;
 
        read_lock_bh(&sk->sk_callback_lock);
@@ -4422,6 +4422,7 @@ void selinux_complete_init(void)
 
        /* Set up any superblocks initialized prior to the policy load. */
        printk(KERN_INFO "SELinux:  Setting up existing superblocks.\n");
+       spin_lock(&sb_lock);
        spin_lock(&sb_security_lock);
 next_sb:
        if (!list_empty(&superblock_security_head)) {
@@ -4430,19 +4431,20 @@ next_sb:
                                           struct superblock_security_struct,
                                           list);
                struct super_block *sb = sbsec->sb;
-               spin_lock(&sb_lock);
                sb->s_count++;
-               spin_unlock(&sb_lock);
                spin_unlock(&sb_security_lock);
+               spin_unlock(&sb_lock);
                down_read(&sb->s_umount);
                if (sb->s_root)
                        superblock_doinit(sb, NULL);
                drop_super(sb);
+               spin_lock(&sb_lock);
                spin_lock(&sb_security_lock);
                list_del_init(&sbsec->list);
                goto next_sb;
        }
        spin_unlock(&sb_security_lock);
+       spin_unlock(&sb_lock);
 }
 
 /* SELinux requires early initialization in order to label
index 7177e98df7f33a4e06b521fbb2bb987150838246..c284dbb8b8c02fbba51aa562d5e4fd4551e641f3 100644 (file)
@@ -594,6 +594,10 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
 
                        *scontext_len = strlen(initial_sid_to_string[sid]) + 1;
                        scontextp = kmalloc(*scontext_len,GFP_ATOMIC);
+                       if (!scontextp) {
+                               rc = -ENOMEM;
+                               goto out;
+                       }
                        strcpy(scontextp, initial_sid_to_string[sid]);
                        *scontext = scontextp;
                        goto out;
index da7ef26995c3d9ae3ea73e254d9bc8ef16666954..77b06009735df818253aa6a70b39392e476bfc80 100644 (file)
@@ -151,7 +151,7 @@ static struct pnp_device_id snd_mpu401_pnpids[] = {
 
 MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
 
-static int __init snd_mpu401_pnp(int dev, struct pnp_dev *device,
+static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device,
                                 const struct pnp_device_id *id)
 {
        if (!pnp_port_valid(device, 0) ||
index a36ec1daa5cb9e24dcb5e3d887d5d56936c13f2b..e6945db8ed1b8a2fcd4b877712b96db8ff791c98 100644 (file)
@@ -85,6 +85,8 @@
 #include <linux/pnp.h>
 #include <linux/isapnp.h>
 #include <linux/moduleparam.h>
+#include <linux/delay.h>
+
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <sound/core.h>
index 49796be955f32c69cb933f9657761ca3f32a1e28..e04fa49b0dc8e5509963e82ef6d4bc34692324d4 100644 (file)
@@ -2026,7 +2026,8 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback,
        if (irq > 0)
        {
                devc->dev_no = my_dev;
-               if (request_irq(devc->irq, adintr, 0, devc->name, (void *)my_dev) < 0)
+               if (request_irq(devc->irq, adintr, 0, devc->name,
+                               (void *)(long)my_dev) < 0)
                {
                        printk(KERN_WARNING "ad1848: Unable to allocate IRQ\n");
                        /* Don't free it either then.. */
@@ -2175,7 +2176,7 @@ void ad1848_unload(int io_base, int irq, int dma_playback, int dma_capture, int
                if (!share_dma)
                {
                        if (devc->irq > 0) /* There is no point in freeing irq, if it wasn't allocated */
-                               free_irq(devc->irq, (void *)devc->dev_no);
+                               free_irq(devc->irq, (void *)(long)devc->dev_no);
 
                        sound_free_dma(dma_playback);
 
@@ -2204,7 +2205,7 @@ irqreturn_t adintr(int irq, void *dev_id, struct pt_regs *dummy)
        unsigned char c930_stat = 0;
        int cnt = 0;
 
-       dev = (int)dev_id;
+       dev = (long)dev_id;
        devc = (ad1848_info *) audio_devs[dev]->devc;
 
 interrupt_again:               /* Jump back here if int status doesn't reset */
@@ -2900,7 +2901,8 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev
        return(dev);
 }
 
-static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_info *hw_config, int slot)
+static struct pnp_dev __init *ad1848_init_generic(struct pnp_card *bus,
+                               struct address_info *hw_config, int slot)
 {
 
        /* Configure Audio device */
index 7de079b202f214bd9dc9baf608a4131ba89d71c5..6e662ac009ae5f2ff04a08c8b86235be17da12ff 100644 (file)
@@ -960,7 +960,7 @@ static struct ac97_mixer_value_list mixer_defaults[] = {
 
 
 /* Installs the AC97 mixer into CARD.  */
-static int __init
+static int __devinit
 nm256_install_mixer (struct nm256_info *card)
 {
     int mixer;
@@ -995,7 +995,7 @@ nm256_install_mixer (struct nm256_info *card)
  * RAM.
  */
 
-static void __init
+static void __devinit
 nm256_peek_for_sig (struct nm256_info *card)
 {
     u32 port1offset 
@@ -1056,7 +1056,7 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
     card->playing  = 0;
     card->recording = 0;
     card->rev = rev;
-       spin_lock_init(&card->lock);
+    spin_lock_init(&card->lock);
 
     /* Init the memory port info.  */
     for (x = 0; x < 2; x++) {