]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'dock' into test
authorLen Brown <len.brown@intel.com>
Thu, 23 Oct 2008 03:25:26 +0000 (23:25 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 23 Oct 2008 03:25:26 +0000 (23:25 -0400)
Conflicts:
drivers/acpi/osl.c

Signed-off-by: Len Brown <len.brown@intel.com>
362 files changed:
Documentation/DMA-mapping.txt
Documentation/HOWTO
Documentation/SubmitChecklist
Documentation/cpu-freq/index.txt
Documentation/hwmon/adt7473
Documentation/hwmon/sysfs-interface
Documentation/ioctl/cdrom.txt
Documentation/kernel-parameters.txt
Documentation/laptops/acer-wmi.txt
Documentation/sysctl/kernel.txt
Documentation/usb/anchors.txt
Documentation/video4linux/CARDLIST.em28xx
Documentation/video4linux/gspca.txt
MAINTAINERS
Makefile
arch/arm/kernel/kgdb.c
arch/arm/mach-pxa/time.c
arch/arm/mach-sa1100/generic.c
arch/arm/mach-versatile/core.c
arch/ia64/include/asm/sections.h
arch/ia64/kernel/efi.c
arch/ia64/kernel/head.S
arch/ia64/kernel/setup.c
arch/ia64/kernel/vmlinux.lds.S
arch/ia64/mm/contig.c
arch/ia64/mm/discontig.c
arch/m32r/Kconfig
arch/m32r/kernel/entry.S
arch/m32r/kernel/head.S
arch/m32r/kernel/irq.c
arch/m32r/kernel/m32r_ksyms.c
arch/m32r/kernel/process.c
arch/m32r/kernel/smp.c
arch/m32r/kernel/time.c
arch/m32r/kernel/traps.c
arch/m32r/lib/delay.c
arch/mips/Kconfig
arch/mips/au1000/common/gpio.c
arch/mips/kernel/Makefile
arch/mips/kernel/cevt-r4k.c
arch/mips/kernel/cevt-smtc.c [new file with mode: 0644]
arch/mips/kernel/cpu-probe.c
arch/mips/kernel/entry.S
arch/mips/kernel/genex.S
arch/mips/kernel/head.S
arch/mips/kernel/kgdb.c
arch/mips/kernel/mips-mt-fpaff.c
arch/mips/kernel/process.c
arch/mips/kernel/ptrace.c
arch/mips/kernel/smtc.c
arch/mips/kernel/traps.c
arch/mips/mti-malta/Makefile
arch/mips/mti-malta/malta-smtc.c
arch/mips/pci/Makefile
arch/mips/pci/pci-bcm47xx.c [new file with mode: 0644]
arch/mips/pci/pci-ip27.c
arch/mips/sibyte/swarm/Makefile
arch/mips/sibyte/swarm/platform.c [new file with mode: 0644]
arch/mn10300/kernel/irq.c
arch/mn10300/kernel/time.c
arch/mn10300/unit-asb2303/unit-init.c
arch/mn10300/unit-asb2305/unit-init.c
arch/powerpc/boot/dts/holly.dts
arch/powerpc/kernel/idle.c
arch/powerpc/kernel/kgdb.c
arch/powerpc/platforms/fsl_uli1575.c
arch/s390/kernel/time.c
arch/s390/lib/delay.c
arch/sparc64/kernel/of_device.c
arch/sparc64/kernel/pci.c
arch/x86/Kconfig
arch/x86/boot/compressed/relocs.c
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/amd_iommu.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
arch/x86/kernel/cpu/mtrr/main.c
arch/x86/kernel/kgdb.c
arch/x86/kernel/pci-gart_64.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/vmi_32.c
arch/x86/kernel/vsmp_64.c
arch/x86/oprofile/nmi_int.c
drivers/accessibility/braille/braille_console.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/asus_acpi.c
drivers/acpi/bus.c
drivers/acpi/cm_sbs.c
drivers/acpi/debug.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/ec.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg2.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/fan.c
drivers/acpi/glue.c
drivers/acpi/namespace/Makefile
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nspredef.c [new file with mode: 0644]
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/osl.c
drivers/acpi/parser/psloop.c
drivers/acpi/parser/psparse.c
drivers/acpi/pci_link.c
drivers/acpi/power.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_throttling.c
drivers/acpi/reboot.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/scan.c
drivers/acpi/sleep/proc.c
drivers/acpi/system.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/thermal.c
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utxface.c
drivers/acpi/video.c
drivers/acpi/wmi.c
drivers/ata/sata_nv.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/btusb.c
drivers/char/tty_io.c
drivers/cpuidle/cpuidle.c
drivers/dma/dw_dmac.c
drivers/hwmon/abituguru3.c
drivers/hwmon/it87.c
drivers/i2c/busses/i2c-powermac.c
drivers/i2c/i2c-dev.c
drivers/ide/Kconfig
drivers/ide/ide-cd.c
drivers/ide/ide-dma.c
drivers/ide/ide-probe.c
drivers/ide/ide-tape.c
drivers/ide/mips/Makefile
drivers/ide/mips/swarm.c [deleted file]
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/input/mouse/bcm5974.c
drivers/input/touchscreen/jornada720_ts.c
drivers/leds/leds-fsg.c
drivers/leds/leds-pca955x.c
drivers/md/dm-mpath.c
drivers/md/dm.c
drivers/media/common/tuners/tuner-xc2028.h
drivers/media/dvb/b2c2/flexcop-fe-tuner.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/dvb/frontends/s5h1420.c
drivers/media/dvb/frontends/s5h1420.h
drivers/media/dvb/siano/sms-cards.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cafe_ccic.c
drivers/media/video/cpia2/cpia2_usb.c
drivers/media/video/cx18/cx18-cards.c
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-dvb.c
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/sonixb.c
drivers/media/video/gspca/sonixj.c
drivers/media/video/gspca/spca561.c
drivers/media/video/gspca/zc3xx.c
drivers/media/video/ov511.c
drivers/media/video/pvrusb2/pvrusb2-devattr.c
drivers/media/video/s2255drv.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/w9968cf.c
drivers/media/video/wm8739.c
drivers/media/video/zoran_card.c
drivers/media/video/zoran_driver.c
drivers/mfd/Kconfig
drivers/mfd/asic3.c
drivers/misc/Kconfig
drivers/misc/acer-wmi.c
drivers/misc/eeepc-laptop.c
drivers/mmc/host/atmel-mci.c
drivers/net/e1000e/e1000.h
drivers/net/e1000e/ethtool.c
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/netdev.c
drivers/net/e1000e/param.c
drivers/net/wireless/ath9k/core.c
drivers/net/wireless/ath9k/core.h
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/ath9k/xmit.c
drivers/net/wireless/zd1211rw/zd_usb.c
drivers/pci/pci-sysfs.c
drivers/pci/pcie/aspm.c
drivers/pci/search.c
drivers/pcmcia/ds.c
drivers/pnp/pnpacpi/core.c
drivers/rtc/rtc-dev.c
drivers/s390/cio/qdio_setup.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qlogicpti.c
drivers/scsi/scsi_lib.c
drivers/serial/atmel_serial.c
drivers/spi/orion_spi.c
drivers/spi/pxa2xx_spi.c
drivers/ssb/main.c
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/gadget/fsl_usb2_udc.c
drivers/usb/gadget/omap_udc.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-sched.c
drivers/usb/musb/Kconfig
drivers/usb/musb/musb_core.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/omap2430.h
drivers/usb/serial/cp2101.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/option.c
drivers/usb/serial/sierra.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/storage/Kconfig
drivers/usb/storage/Makefile
drivers/usb/storage/unusual_devs.h
drivers/usb/storage/usb.c
drivers/video/console/fbcon.c
drivers/video/console/fbcon.h
drivers/watchdog/geodewdt.c
drivers/watchdog/ibmasr.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/rc32434_wdt.c
drivers/watchdog/rdc321x_wdt.c
drivers/watchdog/wdt285.c
fs/9p/vfs_inode.c
fs/dcache.c
fs/exec.c
fs/inotify_user.c
fs/ramfs/file-nommu.c
fs/splice.c
fs/ubifs/debug.c
fs/ubifs/dir.c
fs/ubifs/find.c
fs/ubifs/gc.c
fs/ubifs/super.c
fs/ubifs/tnc.c
fs/xfs/xfs_inode.c
include/acpi/acconfig.h
include/acpi/acdebug.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acexcep.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acnamesp.h
include/acpi/acobject.h
include/acpi/acoutput.h
include/acpi/acpi_drivers.h
include/acpi/acpredef.h [new file with mode: 0644]
include/acpi/actbl1.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/platform/aclinux.h
include/asm-mips/cevt-r4k.h [new file with mode: 0644]
include/asm-mips/irqflags.h
include/asm-mips/mipsregs.h
include/asm-mips/pgtable-32.h
include/asm-mips/smtc.h
include/asm-mips/sn/mapped_kernel.h
include/asm-mips/stackframe.h
include/asm-x86/acpi.h
include/asm-x86/cpufeature.h
include/asm-x86/idle.h
include/asm-x86/kgdb.h
include/asm-x86/uaccess_64.h
include/linux/cnt32_to_63.h [moved from arch/arm/include/asm/cnt32_to_63.h with 87% similarity]
include/linux/hrtimer.h
include/linux/ide.h
include/linux/kernel.h
include/linux/pci.h
include/linux/ramfs.h
include/linux/smb.h
include/linux/stacktrace.h
include/net/9p/9p.h
include/net/9p/transport.h
include/net/sctp/sm.h
init/main.c
kernel/cgroup.c
kernel/exit.c
kernel/hrtimer.c
kernel/kexec.c
kernel/kgdb.c
kernel/posix-timers.c
kernel/sched.c
kernel/time/tick-broadcast.c
kernel/time/tick-common.c
kernel/time/tick-internal.h
kernel/time/tick-sched.c
kernel/trace/trace_sysprof.c
mm/memcontrol.c
mm/page_alloc.c
mm/page_isolation.c
mm/slob.c
mm/tiny-shmem.c
net/9p/client.c
net/9p/conv.c
net/9p/mod.c
net/9p/trans_fd.c
net/9p/trans_virtio.c
net/ax25/af_ax25.c
net/ax25/ax25_std_timer.c
net/core/dev.c
net/core/rtnetlink.c
net/ipv4/tcp_hybla.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv6/netfilter/ip6t_hbh.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/iucv/iucv.c
net/key/af_key.c
net/netrom/af_netrom.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/socket.c
net/xfrm/xfrm_output.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kernel-doc
scripts/mod/modpost.c
security/selinux/ss/services.c
sound/core/pcm.c
sound/core/pcm_native.c
sound/core/rawmidi.c
sound/pci/hda/patch_sigmatel.c
sound/ppc/awacs.c
sound/soc/at32/at32-pcm.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/wm8753.c

index b463ecd0c7cebf36f53104015afcbeeccf4b934d..c74fec8c2351168d1329c527183f3a975234030e 100644 (file)
@@ -740,7 +740,7 @@ failure can be determined by:
        dma_addr_t dma_handle;
 
        dma_handle = pci_map_single(pdev, addr, size, direction);
-       if (pci_dma_mapping_error(dma_handle)) {
+       if (pci_dma_mapping_error(pdev, dma_handle)) {
                /*
                 * reduce current DMA mapping usage,
                 * delay and try again later or
index c2371c5a98f99b5eaa785bd0affd6c40187e84e3..48a3955f05fcd9c5f7548aadf7557062f1aabdb1 100644 (file)
@@ -77,7 +77,8 @@ documentation files are also added which explain how to use the feature.
 When a kernel change causes the interface that the kernel exposes to
 userspace to change, it is recommended that you send the information or
 a patch to the manual pages explaining the change to the manual pages
-maintainer at mtk.manpages@gmail.com.
+maintainer at mtk.manpages@gmail.com, and CC the list
+linux-api@vger.kernel.org.
 
 Here is a list of files that are in the kernel source tree that are
 required reading:
index da10e0714241fbef07ac394a741e3276723591fb..21f0795af20f1a6a3c34569f10ac05d72e8b75b4 100644 (file)
@@ -67,6 +67,8 @@ kernel patches.
 
 19: All new userspace interfaces are documented in Documentation/ABI/.
     See Documentation/ABI/README for more information.
+    Patches that change userspace interfaces should be CCed to
+    linux-api@vger.kernel.org.
 
 20: Check that it all passes `make headers_check'.
 
index ffdb5323df378b84963e4f91cd1470ff17865b6d..3d0b915035b9f28fbcff7d83a91ef016d4d7b2ad 100644 (file)
@@ -35,11 +35,9 @@ Mailing List
 ------------
 There is a CPU frequency changing CVS commit and general list where
 you can report bugs, problems or submit patches. To post a message,
-send an email to cpufreq@lists.linux.org.uk, to subscribe go to
-http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the
-mailing list are available to subscribers at
-http://lists.linux.org.uk/mailman/private/cpufreq/.
-
+send an email to cpufreq@vger.kernel.org, to subscribe go to
+http://vger.kernel.org/vger-lists.html#cpufreq and follow the
+instructions there.
 
 Links
 -----
@@ -50,7 +48,7 @@ how to access the CVS repository:
 * http://cvs.arm.linux.org.uk/
 
 the CPUFreq Mailing list:
-* http://lists.linux.org.uk/mailman/listinfo/cpufreq
+* http://vger.kernel.org/vger-lists.html#cpufreq
 
 Clock and voltage scaling for the SA-1100:
 * http://www.lartmaker.nl/projects/scaling
index 2126de34c71161a3e6f22ddbfe082725b01cfc24..1cbf671822e23d063c648984c145149792978c62 100644 (file)
@@ -14,14 +14,14 @@ Description
 
 This driver implements support for the Analog Devices ADT7473 chip family.
 
-The LM85 uses the 2-wire interface compatible with the SMBUS 2.0
+The ADT7473 uses the 2-wire interface compatible with the SMBUS 2.0
 specification. Using an analog to digital converter it measures three (3)
-temperatures and two (2) voltages. It has three (3) 16-bit counters for
+temperatures and two (2) voltages. It has four (4) 16-bit counters for
 measuring fan speed. There are three (3) PWM outputs that can be used
 to control fan speed.
 
 A sophisticated control system for the PWM outputs is designed into the
-LM85 that allows fan speed to be adjusted automatically based on any of the
+ADT7473 that allows fan speed to be adjusted automatically based on any of the
 three temperature sensors. Each PWM output is individually adjustable and
 programmable. Once configured, the ADT7473 will adjust the PWM outputs in
 response to the measured temperatures without further host intervention.
@@ -46,14 +46,6 @@ from the raw value to get the temperature value.
 The Analog Devices datasheet is very detailed and describes a procedure for
 determining an optimal configuration for the automatic PWM control.
 
-Hardware Configurations
------------------------
-
-The ADT7473 chips have an optional SMBALERT output that can be used to
-signal the chipset in case a limit is exceeded or the temperature sensors
-fail. Individual sensor interrupts can be masked so they won't trigger
-SMBALERT. The SMBALERT output if configured replaces the PWM2 function.
-
 Configuration Notes
 -------------------
 
@@ -61,8 +53,8 @@ Besides standard interfaces driver adds the following:
 
 * PWM Control
 
-* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and
-* pwm#_auto_point2_pwm and pwm#_auto_point2_temp -
+* pwm#_auto_point1_pwm and temp#_auto_point1_temp and
+* pwm#_auto_point2_pwm and temp#_auto_point2_temp -
 
 point1: Set the pwm speed at a lower temperature bound.
 point2: Set the pwm speed at a higher temperature bound.
index 2d845730d4e0e81c65ff5ceb5299a79724daf62f..6dbfd5efd991de9f6a69eaa831d1a45634ba5979 100644 (file)
@@ -329,6 +329,10 @@ power[1-*]_average         Average power use
                                Unit: microWatt
                                RO
 
+power[1-*]_average_interval    Power use averaging interval
+                               Unit: milliseconds
+                               RW
+
 power[1-*]_average_highest     Historical average maximum power use
                                Unit: microWatt
                                RO
@@ -353,6 +357,14 @@ power[1-*]_reset_history   Reset input_highest, input_lowest,
                                average_highest and average_lowest.
                                WO
 
+**********
+* Energy *
+**********
+
+energy[1-*]_input              Cumulative energy use
+                               Unit: microJoule
+                               RO
+
 **********
 * Alarms *
 **********
index 62d4af44ec4a2e0a4987d48687dc0bd1d01dcbf0..59df81c8da2b86dd71394ccb85ab34bc1cba4595 100644 (file)
@@ -271,14 +271,14 @@ CDROMCLOSETRAY                    pendant of CDROMEJECT
 
        usage:
 
-         ioctl(fd, CDROMEJECT, 0);
+         ioctl(fd, CDROMCLOSETRAY, 0);
 
        inputs:         none
 
        outputs:        none
 
        error returns:
-         ENOSYS        cd drive not capable of ejecting
+         ENOSYS        cd drive not capable of closing the tray
          EBUSY         other processes are accessing drive, or door is locked
 
        notes:
index 1150444a21ab64140f13e706797f16664e28244f..99cf83fd69478aab1e675688cab2463d8815edc8 100644 (file)
@@ -217,20 +217,47 @@ and is between 256 and 4096 characters. It is defined in the file
        acpi.debug_level=       [HW,ACPI]
                        Format: <int>
                        Each bit of the <int> indicates an ACPI debug level,
-                       1: enable, 0: disable. It is useful for boot time
-                       debugging. After system has booted up, it can be set
-                       via /sys/module/acpi/parameters/debug_level.
-                       CONFIG_ACPI_DEBUG must be enabled for this to produce any output.
-                       Available bits (add the numbers together) to enable different
-                       debug output levels of the ACPI subsystem:
-                       0x01 error 0x02 warn 0x04 init 0x08 debug object
-                       0x10 info 0x20 init names 0x40 parse 0x80 load
-                       0x100 dispatch 0x200 execute 0x400 names 0x800 operation region
-                       0x1000 bfield 0x2000 tables 0x4000 values 0x8000 objects
-                       0x10000 resources 0x20000 user requests 0x40000 package.
-                       The number can be in decimal or prefixed with 0x in hex.
-                       Warning: Many of these options can produce a lot of
-                       output and make your system unusable. Be very careful.
+                       which corresponds to the level in an ACPI_DEBUG_PRINT
+                       statement.  After system has booted up, this mask
+                       can be set via /sys/module/acpi/parameters/debug_level.
+
+                       CONFIG_ACPI_DEBUG must be enabled for this to produce
+                       any output.  The number can be in decimal or prefixed
+                       with 0x in hex.  Some of these options produce so much
+                       output that the system is unusable.
+
+                       The following global components are defined by the
+                       ACPI CA:
+                              0x01 error
+                              0x02 warn
+                              0x04 init
+                              0x08 debug object
+                              0x10 info
+                              0x20 init names
+                              0x40 parse
+                              0x80 load
+                             0x100 dispatch
+                             0x200 execute
+                             0x400 names
+                             0x800 operation region
+                            0x1000 bfield
+                            0x2000 tables
+                            0x4000 values
+                            0x8000 objects
+                           0x10000 resources
+                           0x20000 user requests
+                           0x40000 package
+                       The number can be in decimal or prefixed with 0x in hex.
+                       Warning: Many of these options can produce a lot of
+                       output and make your system unusable. Be very careful.
+
+       acpi.power_nocheck=     [HW,ACPI]
+                       Format: 1/0 enable/disable the check of power state.
+                       On some bogus BIOS the _PSC object/_STA object of
+                       power resource can't return the correct device power
+                       state. In such case it is unneccessary to check its
+                       power state again in power transition.
+                       1 : disable the power state check
 
        acpi_pm_good    [X86-32,X86-64]
                        Override the pmtimer bug detection: force the kernel
index 69b5dd4e5a59bd74550397266122c465a8a12b5f..2b3a6b5260bfd64d37a86ca957cf69a6f25dda08 100644 (file)
@@ -1,7 +1,7 @@
 Acer Laptop WMI Extras Driver
 http://code.google.com/p/aceracpi
-Version 0.1
-9th February 2008
+Version 0.2
+18th August 2008
 
 Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk>
 
@@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to
 ever wish to remove the card, or swap it out at some point, please get in touch
 with me, as we may well be able to gain some data on wireless card detection.
 
-To read the status of the wireless radio (0=off, 1=on):
-cat /sys/devices/platform/acer-wmi/wireless
-
-To enable the wireless radio:
-echo 1 > /sys/devices/platform/acer-wmi/wireless
-
-To disable the wireless radio:
-echo 0 > /sys/devices/platform/acer-wmi/wireless
-
-To set the state of the wireless radio when loading acer-wmi, pass:
-wireless=X (where X is 0 or 1)
+The wireless radio is exposed through rfkill.
 
 Bluetooth
 *********
@@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth
 module off the internet that is compatible with your laptop and fit it, then
 it will work just fine with acer-wmi.
 
-To read the status of the bluetooth module (0=off, 1=on):
-cat /sys/devices/platform/acer-wmi/wireless
-
-To enable the bluetooth module:
-echo 1 > /sys/devices/platform/acer-wmi/bluetooth
-
-To disable the bluetooth module:
-echo 0 > /sys/devices/platform/acer-wmi/bluetooth
-
-To set the state of the bluetooth module when loading acer-wmi, pass:
-bluetooth=X (where X is 0 or 1)
+Bluetooth is exposed through rfkill.
 
 3G
 **
index 276a7e6378227b5931be236104509fe62da2d4ad..e1ff0d920a5ce48b2a05d8f71584668e2817cf49 100644 (file)
@@ -351,9 +351,10 @@ kernel.  This value defaults to SHMMAX.
 
 softlockup_thresh:
 
-This value can be used to lower the softlockup tolerance
-threshold. The default threshold is 10s.  If a cpu is locked up
-for 10s, the kernel complains.  Valid values are 1-60s.
+This value can be used to lower the softlockup tolerance threshold.  The
+default threshold is 60 seconds.  If a cpu is locked up for 60 seconds,
+the kernel complains.  Valid values are 1-60 seconds.  Setting this
+tunable to zero will disable the softlockup detection altogether.
 
 ==============================================================
 
index 7304bcf5a3062fd58e70cfce160d85cab0dff7d5..5e6b64c20d258dbadf9b46f72f8717779ea05a6c 100644 (file)
@@ -42,9 +42,21 @@ This function kills all URBs associated with an anchor. The URBs
 are called in the reverse temporal order they were submitted.
 This way no data can be reordered.
 
+usb_unlink_anchored_urbs()
+--------------------------
+
+This function unlinks all URBs associated with an anchor. The URBs
+are processed in the reverse temporal order they were submitted.
+This is similar to usb_kill_anchored_urbs(), but it will not sleep.
+Therefore no guarantee is made that the URBs have been unlinked when
+the call returns. They may be unlinked later but will be unlinked in
+finite time.
+
 usb_wait_anchor_empty_timeout()
 -------------------------------
 
 This function waits for all URBs associated with an anchor to finish
 or a timeout, whichever comes first. Its return value will tell you
 whether the timeout was reached.
+
+
index 89c7f32abf9f2d8a43f98dc892b8ca9b8bad9a24..53449cb99b17c71e3714949b090fd2252e7e4492 100644 (file)
@@ -46,7 +46,7 @@
  45 -> Pinnacle PCTV DVB-T                      (em2870)
  46 -> Compro, VideoMate U3                     (em2870)        [185b:2870]
  47 -> KWorld DVB-T 305U                        (em2880)        [eb1a:e305]
- 48 -> KWorld DVB-T 310U                        (em2880)
+ 48 -> KWorld DVB-T 310U                        (em2880)        [eb1a:e310]
  49 -> MSI DigiVox A/D                          (em2880)        [eb1a:e310]
  50 -> MSI DigiVox A/D II                       (em2880)        [eb1a:e320]
  51 -> Terratec Hybrid XS Secam                 (em2880)        [0ccd:004c]
index 0f03900c48fbceac0fe2caf9979c14fc3421fb0f..9a3e4d797fa858d0925e30d64be6c381fe6bae24 100644 (file)
@@ -190,6 +190,7 @@ pac7311             093a:260f       SnakeCam
 pac7311                093a:2621       PAC731x
 pac7311                093a:2624       PAC7302
 pac7311                093a:2626       Labtec 2200
+pac7311                093a:262a       Webcam 300k
 zc3xx          0ac8:0302       Z-star Vimicro zc0302
 vc032x         0ac8:0321       Vimicro generic vc0321
 vc032x         0ac8:0323       Vimicro Vc0323
index 7212af723147800c63e11791961a102afbf79e57..4b7d8f291cd4a043dff37ec9fd66b45269fcfc9f 100644 (file)
@@ -1198,9 +1198,7 @@ M:        hpa@zytor.com
 S:     Maintained
 
 CPUSETS
-P:     Paul Jackson
 P:     Paul Menage
-M:     pj@sgi.com
 M:     menage@google.com
 L:     linux-kernel@vger.kernel.org
 W:     http://www.bullopensource.org/cpuset/
@@ -1984,7 +1982,7 @@ S:        Maintained
 I2C/SMBUS STUB DRIVER
 P:     Mark M. Hoffman
 M:     mhoffman@lightlink.com
-L:     lm-sensors@lm-sensors.org
+L:     i2c@lm-sensors.org
 S:     Maintained
 
 I2C SUBSYSTEM
@@ -2706,6 +2704,7 @@ MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
 P:     Michael Kerrisk
 M:     mtk.manpages@gmail.com
 W:     http://www.kernel.org/doc/man-pages
+L:     linux-man@vger.kernel.org
 S:     Supported
 
 MARVELL LIBERTAS WIRELESS DRIVER
@@ -3726,7 +3725,7 @@ S:        Maintained
 SIS 96X I2C/SMBUS DRIVER
 P:     Mark M. Hoffman
 M:     mhoffman@lightlink.com
-L:     lm-sensors@lm-sensors.org
+L:     i2c@lm-sensors.org
 S:     Maintained
 
 SIS FRAMEBUFFER DRIVER
@@ -3833,11 +3832,12 @@ S:      Maintained
 
 SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT
 P:     Liam Girdwood
-M:     liam.girdwood@wolfsonmicro.com
+M:     lrg@slimlogic.co.uk
 P:     Mark Brown
 M:     broonie@opensource.wolfsonmicro.com
 T:     git opensource.wolfsonmicro.com/linux-2.6-asoc
 L:     alsa-devel@alsa-project.org (subscribers-only)
+W:     http://alsa-project.org/main/index.php/ASoC
 S:     Supported
 
 SPI SUBSYSTEM
index cab896a97296d05fad10524ce5b65782f9da622d..16e3fbb968a8966bc58570ca117349631e81f2d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 27
-EXTRAVERSION = -rc7
+EXTRAVERSION =
 NAME = Rotary Wombat
 
 # *DOCUMENTATION*
index aaffaecffcd13699dfd0cd51d2eaf61608e4a94d..ba8ccfede964d93a81c061633bd969916d85ebd5 100644 (file)
@@ -111,8 +111,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
        case 'D':
        case 'k':
        case 'c':
-               kgdb_contthread = NULL;
-
                /*
                 * Try to read optional parameter, pc unchanged if no parm.
                 * If this was a compiled breakpoint, we need to move
index 67e18509d7bfe6103b4d5062a307c0fe12c029e8..b0d6b32654cf622d13a9ac91073a2f1426381d97 100644 (file)
@@ -17,9 +17,9 @@
 #include <linux/interrupt.h>
 #include <linux/clockchips.h>
 #include <linux/sched.h>
+#include <linux/cnt32_to_63.h>
 
 #include <asm/div64.h>
-#include <asm/cnt32_to_63.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <mach/pxa-regs.h>
index 1362994c78aa1ede98cdc4661cb1cb56623378e0..b422526f6d8baa3fb504b23ddc24ffc57f41512e 100644 (file)
@@ -18,9 +18,9 @@
 #include <linux/ioport.h>
 #include <linux/sched.h>       /* just for sched_clock() - funny that */
 #include <linux/platform_device.h>
+#include <linux/cnt32_to_63.h>
 
 #include <asm/div64.h>
-#include <asm/cnt32_to_63.h>
 #include <mach/hardware.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
index d75e795c893e494b725f4ad177350651e32a60e6..b638f10411e8e27b573f926133e141922512204b 100644 (file)
@@ -28,8 +28,8 @@
 #include <linux/amba/clcd.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
+#include <linux/cnt32_to_63.h>
 
-#include <asm/cnt32_to_63.h>
 #include <asm/system.h>
 #include <mach/hardware.h>
 #include <asm/io.h>
index f6679989103689c24f01315b8f1e41c078b79ce2..1a873b36a4a1cd75f94bb196f1a7997d9ef621f3 100644 (file)
@@ -11,6 +11,9 @@
 #include <asm-generic/sections.h>
 
 extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
+#ifdef CONFIG_SMP
+extern char __cpu0_per_cpu[];
+#endif
 extern char __start___vtop_patchlist[], __end___vtop_patchlist[];
 extern char __start___rse_patchlist[], __end___rse_patchlist[];
 extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[];
index d45f215bc8fce2ee175d018c8298a506437eb0be..51b75cea701866629449f7945ddef10079faa7ab 100644 (file)
@@ -1232,9 +1232,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
                                if (md->attribute & EFI_MEMORY_WP) {
                                        name = "System ROM";
                                        flags |= IORESOURCE_READONLY;
-                               } else {
+                               } else if (md->attribute == EFI_MEMORY_UC)
+                                       name = "Uncached RAM";
+                               else
                                        name = "System RAM";
-                               }
                                break;
 
                        case EFI_ACPI_MEMORY_NVS:
index 8bdea8eb62e366abc0350bd53261146d445ab41a..66e491d8baac3130a4dd68581662395b94a951b4 100644 (file)
@@ -367,16 +367,17 @@ start_ap:
        ;;
 #else
 (isAP) br.few 2f
-       mov r20=r19
-       sub r19=r19,r18
+       movl r20=__cpu0_per_cpu
        ;;
        shr.u r18=r18,3
 1:
-       ld8 r21=[r20],8;;
-       st8[r19]=r21,8
+       ld8 r21=[r19],8;;
+       st8[r20]=r21,8
        adds r18=-1,r18;;
        cmp4.lt p7,p6=0,r18
 (p7)   br.cond.dptk.few 1b
+       mov r19=r20
+       ;;
 2:
 #endif
        tpa r19=r19
index c27d5b2c182b4c7edd4de5609ce2a2c856a55ddb..de636b215677e801c23076d74f6d5a2d29e68efb 100644 (file)
@@ -616,7 +616,9 @@ setup_arch (char **cmdline_p)
                ia64_mca_init();
 
        platform_setup(cmdline_p);
+#ifndef CONFIG_IA64_HP_SIM
        check_sal_cache_flush();
+#endif
        paging_init();
 }
 
index de71da811cd68de596ed1c88b0cdcb6b2a714c29..10a7d47e8510b47fc4ce18ef4a385718d269bb1e 100644 (file)
@@ -215,9 +215,6 @@ SECTIONS
   /* Per-cpu data: */
   percpu : { } :percpu
   . = ALIGN(PERCPU_PAGE_SIZE);
-#ifdef CONFIG_SMP
-  . = . + PERCPU_PAGE_SIZE;    /* cpu0 per-cpu space */
-#endif
   __phys_per_cpu_start = .;
   .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET)
        {
@@ -233,6 +230,11 @@ SECTIONS
   data : { } :data
   .data : AT(ADDR(.data) - LOAD_OFFSET)
        {
+#ifdef CONFIG_SMP
+  . = ALIGN(PERCPU_PAGE_SIZE);
+               __cpu0_per_cpu = .;
+  . = . + PERCPU_PAGE_SIZE;    /* cpu0 per-cpu space */
+#endif
                DATA_DATA
                *(.data1)
                *(.gnu.linkonce.d*)
index e566ff43884afcd97b17ff8bb71ebd95deda9ee6..0ee085efbe29eeedae56194dc1f167cf38d91ac6 100644 (file)
@@ -163,7 +163,7 @@ per_cpu_init (void)
         * get_zeroed_page().
         */
        if (first_time) {
-               void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE;
+               void *cpu0_data = __cpu0_per_cpu;
 
                first_time=0;
 
index 78026aabaa7f03671d8b62d304d28d02c3817746..d8c5fcd89e5bf4aa2fc07611708ff0c1c8a55b74 100644 (file)
@@ -144,7 +144,7 @@ static void *per_cpu_node_setup(void *cpu_data, int node)
 
        for_each_possible_early_cpu(cpu) {
                if (cpu == 0) {
-                       void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE;
+                       void *cpu0_data = __cpu0_per_cpu;
                        __per_cpu_offset[cpu] = (char*)cpu0_data -
                                __per_cpu_start;
                } else if (node == node_cpuid[cpu].nid) {
index a5f864c445b2fe1a28f511dd2c033e4430fc0814..f57113f1f892b091e7439ee18448459b6df25678 100644 (file)
@@ -216,10 +216,6 @@ config MEMORY_SIZE
        default "01000000" if PLAT_M32104UT
        default "00800000" if PLAT_OAKS32R
 
-config NOHIGHMEM
-       bool
-       default y
-
 config ARCH_DISCONTIGMEM_ENABLE
        bool "Internal RAM Support"
        depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104
@@ -410,11 +406,7 @@ config PCI_DIRECT
 source "drivers/pci/Kconfig"
 
 config ISA
-       bool "ISA support"
-       help
-         Find out whether you have ISA slots on your motherboard.  ISA is the
-         name of a bus system, i.e. the way the CPU talks to the other stuff
-         inside your box.  If you have ISA, say Y, otherwise N.
+       bool
 
 source "drivers/pcmcia/Kconfig"
 
index d4eaa2fd1818fea9b90e7c8bbdbe2bd7757ca99b..612d35b082a6826d59dda272612df7d295fa2e8c 100644 (file)
@@ -143,7 +143,7 @@ ret_from_intr:
        and3    r4, r4, #0x8000         ; check BSM bit
 #endif
        beqz    r4, resume_kernel
-ENTRY(resume_userspace)
+resume_userspace:
        DISABLE_INTERRUPTS(r4)          ; make sure we don't miss an interrupt
                                        ; setting need_resched or sigpending
                                        ; between sampling and the iret
index dab7436d7bbe85e2997c18b43b5082e4eece4255..40180778a5c723e069cfc96739a0600f10b6e02b 100644 (file)
@@ -29,7 +29,6 @@ __INITDATA
        .global _end
 ENTRY(stext)
 ENTRY(_stext)
-ENTRY(startup_32)
        /* Setup up the stack pointer */
        LDIMM   (r0, spi_stack_top)
        LDIMM   (r1, spu_stack_top)
index d0c5b0b7da2f0f571fa8e37c44b5f1a41ac5f363..2aeae4670098245f7072ca69b4e732955e4d25d5 100644 (file)
@@ -22,9 +22,6 @@
 #include <linux/module.h>
 #include <asm/uaccess.h>
 
-atomic_t irq_err_count;
-atomic_t irq_mis_count;
-
 /*
  * Generic, controller-independent functions:
  */
@@ -63,9 +60,6 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
 skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       } else if (i == NR_IRQS) {
-               seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
-               seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
        }
        return 0;
 }
index 16bcb189a38319c0831dc0dd6fc1fa505eedc64d..22624b51d4d3ecf3222ce82de0464719bb731d49 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/tlbflush.h>
+#include <asm/pgtable.h>
 
 /* platform dependent support */
 EXPORT_SYMBOL(boot_cpu_data);
@@ -65,6 +66,7 @@ EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 EXPORT_SYMBOL(strlen);
+EXPORT_SYMBOL(empty_zero_page);
 
 EXPORT_SYMBOL(_inb);
 EXPORT_SYMBOL(_inw);
index a689e2978b6e382bdad4f9fcd56fbf194a1ddb6f..5be4faaf5b1c49c03391bb298e6f83122d6d88ab 100644 (file)
@@ -35,8 +35,6 @@
 
 #include <linux/err.h>
 
-static int hlt_counter=0;
-
 /*
  * Return saved PC of a blocked thread.
  */
@@ -48,31 +46,16 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
 /*
  * Powermanagement idle function, if any..
  */
-void (*pm_idle)(void) = NULL;
-EXPORT_SYMBOL(pm_idle);
+static void (*pm_idle)(void) = NULL;
 
 void (*pm_power_off)(void) = NULL;
 EXPORT_SYMBOL(pm_power_off);
 
-void disable_hlt(void)
-{
-       hlt_counter++;
-}
-
-EXPORT_SYMBOL(disable_hlt);
-
-void enable_hlt(void)
-{
-       hlt_counter--;
-}
-
-EXPORT_SYMBOL(enable_hlt);
-
 /*
  * We use this is we don't have any better
  * idle routine..
  */
-void default_idle(void)
+static void default_idle(void)
 {
        /* M32R_FIXME: Please use "cpu_sleep" mode.  */
        cpu_relax();
@@ -260,15 +243,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
        return 0;
 }
 
-/*
- * Capture the user space registers if the task is not running (in user space)
- */
-int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
-{
-       /* M32R_FIXME */
-       return 1;
-}
-
 asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
        unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
        struct pt_regs regs)
index 7577f971ea4e3360d37ced6a7fa5f5ef1c401cec..929e5c9d3ad9c6467a5b28d24cd039a9597f1bc0 100644 (file)
@@ -84,7 +84,7 @@ void smp_send_timer(void);
 void smp_ipi_timer_interrupt(struct pt_regs *);
 void smp_local_timer_interrupt(void);
 
-void send_IPI_allbutself(int, int);
+static void send_IPI_allbutself(int, int);
 static void send_IPI_mask(cpumask_t, int, int);
 unsigned long send_IPI_mask_phys(cpumask_t, int, int);
 
@@ -722,7 +722,7 @@ void smp_local_timer_interrupt(void)
  * ---------- --- --------------------------------------------------------
  *
  *==========================================================================*/
-void send_IPI_allbutself(int ipi_num, int try)
+static void send_IPI_allbutself(int ipi_num, int try)
 {
        cpumask_t cpumask;
 
index 994cc15563558b03cd8c6aef4deff3d74424779a..6ea017727cced935c638a876dc193e7ef4e3288e 100644 (file)
@@ -34,7 +34,6 @@
 #include <asm/hw_irq.h>
 
 #ifdef CONFIG_SMP
-extern void send_IPI_allbutself(int, int);
 extern void smp_local_timer_interrupt(void);
 #endif
 
@@ -188,7 +187,7 @@ static long last_rtc_update = 0;
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
  */
-irqreturn_t timer_interrupt(int irq, void *dev_id)
+static irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
 #ifndef CONFIG_SMP
        profile_tick(CPU_PROFILING);
@@ -228,7 +227,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-struct irqaction irq0 = {
+static struct irqaction irq0 = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED,
        .mask = CPU_MASK_NONE,
index 46159a4e644b81f8bf0191641ac4fecfc58b0f82..03b14e55cd894791ab25e25fb5bfbc8827baf140 100644 (file)
@@ -61,7 +61,7 @@ extern unsigned long  eit_vector[];
        ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \
        + 0xff000000UL
 
-void   set_eit_vector_entries(void)
+static void set_eit_vector_entries(void)
 {
        extern void default_eit_handler(void);
        extern void system_call(void);
@@ -121,9 +121,9 @@ void __init trap_init(void)
        cpu_init();
 }
 
-int kstack_depth_to_print = 24;
+static int kstack_depth_to_print = 24;
 
-void show_trace(struct task_struct *task, unsigned long *stack)
+static void show_trace(struct task_struct *task, unsigned long *stack)
 {
        unsigned long addr;
 
@@ -224,7 +224,7 @@ bad:
        printk("\n");
 }
 
-DEFINE_SPINLOCK(die_lock);
+static DEFINE_SPINLOCK(die_lock);
 
 void die(const char * str, struct pt_regs * regs, long err)
 {
index 59bfc34e0d9f8aa86ded52d4145592af889aec1f..ced549be80f5e9055528918394caaeca6d04270f 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <linux/param.h>
+#include <linux/module.h>
 #ifdef CONFIG_SMP
 #include <linux/sched.h>
 #include <asm/current.h>
@@ -121,3 +122,4 @@ void __ndelay(unsigned long nsecs)
 {
        __const_udelay(nsecs * 0x00005);  /* 2**32 / 1000000000 (rounded up) */
 }
+EXPORT_SYMBOL(__ndelay);
index 49896a2a1d722e0760a866487f8b80b7d8af8fb0..1e06d233fa8310eaf77acfde003cbf8cd346fc54 100644 (file)
@@ -211,6 +211,7 @@ config MIPS_MALTA
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_MIPS_CMP if BROKEN  # because SYNC_R4K is broken
        select SYS_SUPPORTS_MULTITHREADING
        select SYS_SUPPORTS_SMARTMIPS
        help
@@ -1403,7 +1404,6 @@ config MIPS_MT_SMTC
        depends on CPU_MIPS32_R2
        #depends on CPU_MIPS64_R2               # once there is hardware ...
        depends on SYS_SUPPORTS_MULTITHREADING
-       select GENERIC_CLOCKEVENTS_BROADCAST
        select CPU_MIPSR2_IRQ_VI
        select CPU_MIPSR2_IRQ_EI
        select MIPS_MT
@@ -1451,32 +1451,17 @@ config MIPS_VPE_LOADER
          Includes a loader for loading an elf relocatable object
          onto another VPE and running it.
 
-config MIPS_MT_SMTC_INSTANT_REPLAY
-       bool "Low-latency Dispatch of Deferred SMTC IPIs"
-       depends on MIPS_MT_SMTC && !PREEMPT
-       default y
-       help
-         SMTC pseudo-interrupts between TCs are deferred and queued
-         if the target TC is interrupt-inhibited (IXMT). In the first
-         SMTC prototypes, these queued IPIs were serviced on return
-         to user mode, or on entry into the kernel idle loop. The
-         INSTANT_REPLAY option dispatches them as part of local_irq_restore()
-         processing, which adds runtime overhead (hence the option to turn
-         it off), but ensures that IPIs are handled promptly even under
-         heavy I/O interrupt load.
-
 config MIPS_MT_SMTC_IM_BACKSTOP
        bool "Use per-TC register bits as backstop for inhibited IM bits"
        depends on MIPS_MT_SMTC
-       default y
+       default n
        help
          To support multiple TC microthreads acting as "CPUs" within
          a VPE, VPE-wide interrupt mask bits must be specially manipulated
          during interrupt handling. To support legacy drivers and interrupt
          controller management code, SMTC has a "backstop" to track and
          if necessary restore the interrupt mask. This has some performance
-         impact on interrupt service overhead. Disable it only if you know
-         what you are doing.
+         impact on interrupt service overhead.
 
 config MIPS_MT_SMTC_IRQAFF
        bool "Support IRQ affinity API"
@@ -1486,10 +1471,8 @@ config MIPS_MT_SMTC_IRQAFF
          Enables SMP IRQ affinity API (/proc/irq/*/smp_affinity, etc.)
          for SMTC Linux kernel. Requires platform support, of which
          an example can be found in the MIPS kernel i8259 and Malta
-         platform code.  It is recommended that MIPS_MT_SMTC_INSTANT_REPLAY
-         be enabled if MIPS_MT_SMTC_IRQAFF is used. Adds overhead to
-         interrupt dispatch, and should be used only if you know what
-         you are doing.
+         platform code.  Adds some overhead to interrupt dispatch, and
+         should be used only if you know what you are doing.
 
 config MIPS_VPE_LOADER_TOM
        bool "Load VPE program into memory hidden from linux"
@@ -1517,6 +1500,18 @@ config MIPS_APSP_KSPD
          "exit" syscall notifying other kernel modules the SP program is
          exiting.  You probably want to say yes here.
 
+config MIPS_CMP
+       bool "MIPS CMP framework support"
+       depends on SYS_SUPPORTS_MIPS_CMP
+       select SYNC_R4K if BROKEN
+       select SYS_SUPPORTS_SMP
+       select SYS_SUPPORTS_SCHED_SMT if SMP
+       select WEAK_ORDERING
+       default n
+       help
+         This is a placeholder option for the GCMP work. It will need to
+         be handled differently...
+
 config SB1_PASS_1_WORKAROUNDS
        bool
        depends on CPU_SB1_PASS_1
@@ -1693,6 +1688,9 @@ config SMP
 config SMP_UP
        bool
 
+config SYS_SUPPORTS_MIPS_CMP
+       bool
+
 config SYS_SUPPORTS_SMP
        bool
 
@@ -1740,17 +1738,6 @@ config NR_CPUS
          performance should round up your number of processors to the next
          power of two.
 
-config MIPS_CMP
-       bool "MIPS CMP framework support"
-       depends on SMP
-       select SYNC_R4K
-       select SYS_SUPPORTS_SCHED_SMT
-       select WEAK_ORDERING
-       default n
-       help
-         This is a placeholder option for the GCMP work. It will need to
-         be handled differently...
-
 source "kernel/time/Kconfig"
 
 #
index b485d94ce8a5055d4e28b35f8dec1c7fc3b2af9e..e660ddd611c465dc6665ecf7d1346f82a5e77b98 100644 (file)
@@ -48,7 +48,7 @@ static void au1xxx_gpio2_write(unsigned gpio, int value)
 {
        gpio -= AU1XXX_GPIO_BASE;
 
-       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio);
+       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
 }
 
 static int au1xxx_gpio2_direction_input(unsigned gpio)
@@ -61,7 +61,8 @@ static int au1xxx_gpio2_direction_input(unsigned gpio)
 static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
 {
        gpio -= AU1XXX_GPIO_BASE;
-       gpio2->dir = (0x01 << gpio) | (value << gpio);
+       gpio2->dir |= 0x01 << gpio;
+       gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
        return 0;
 }
 
@@ -90,6 +91,7 @@ static int au1xxx_gpio1_direction_input(unsigned gpio)
 static int au1xxx_gpio1_direction_output(unsigned gpio, int value)
 {
        gpio1->trioutclr = (0x01 & gpio);
+       au1xxx_gpio1_write(gpio, value);
        return 0;
 }
 
index 706f9397479770265d69b0307df9d76ea3739178..25775cb54000dd3871673c512e43cf59398c6461 100644 (file)
@@ -10,6 +10,7 @@ obj-y         += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
 
 obj-$(CONFIG_CEVT_BCM1480)     += cevt-bcm1480.o
 obj-$(CONFIG_CEVT_R4K)         += cevt-r4k.o
+obj-$(CONFIG_MIPS_MT_SMTC)     += cevt-smtc.o
 obj-$(CONFIG_CEVT_DS1287)      += cevt-ds1287.o
 obj-$(CONFIG_CEVT_GT641XX)     += cevt-gt641xx.o
 obj-$(CONFIG_CEVT_SB1250)      += cevt-sb1250.o
index 24a2d907aa0de4c022c0d5e89227dceae2a8a572..4a4c59f2737a5d0bcdc8fc48f4f8e28ea217f528 100644 (file)
 
 #include <asm/smtc_ipi.h>
 #include <asm/time.h>
+#include <asm/cevt-r4k.h>
+
+/*
+ * The SMTC Kernel for the 34K, 1004K, et. al. replaces several
+ * of these routines with SMTC-specific variants.
+ */
+
+#ifndef CONFIG_MIPS_MT_SMTC
 
 static int mips_next_event(unsigned long delta,
                            struct clock_event_device *evt)
@@ -19,60 +27,27 @@ static int mips_next_event(unsigned long delta,
        unsigned int cnt;
        int res;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-       {
-       unsigned long flags, vpflags;
-       local_irq_save(flags);
-       vpflags = dvpe();
-#endif
        cnt = read_c0_count();
        cnt += delta;
        write_c0_compare(cnt);
        res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
-#ifdef CONFIG_MIPS_MT_SMTC
-       evpe(vpflags);
-       local_irq_restore(flags);
-       }
-#endif
        return res;
 }
 
-static void mips_set_mode(enum clock_event_mode mode,
-                          struct clock_event_device *evt)
+#endif /* CONFIG_MIPS_MT_SMTC */
+
+void mips_set_clock_mode(enum clock_event_mode mode,
+                               struct clock_event_device *evt)
 {
        /* Nothing to do ...  */
 }
 
-static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
-static int cp0_timer_irq_installed;
+DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
+int cp0_timer_irq_installed;
 
-/*
- * Timer ack for an R4k-compatible timer of a known frequency.
- */
-static void c0_timer_ack(void)
-{
-       write_c0_compare(read_c0_compare());
-}
+#ifndef CONFIG_MIPS_MT_SMTC
 
-/*
- * Possibly handle a performance counter interrupt.
- * Return true if the timer interrupt should not be checked
- */
-static inline int handle_perf_irq(int r2)
-{
-       /*
-        * The performance counter overflow interrupt may be shared with the
-        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
-        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
-        * and we can't reliably determine if a counter interrupt has also
-        * happened (!r2) then don't check for a timer interrupt.
-        */
-       return (cp0_perfcount_irq < 0) &&
-               perf_irq() == IRQ_HANDLED &&
-               !r2;
-}
-
-static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
+irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
 {
        const int r2 = cpu_has_mips_r2;
        struct clock_event_device *cd;
@@ -93,12 +68,8 @@ static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
         * interrupt.  Being the paranoiacs we are we check anyway.
         */
        if (!r2 || (read_c0_cause() & (1 << 30))) {
-               c0_timer_ack();
-#ifdef CONFIG_MIPS_MT_SMTC
-               if (cpu_data[cpu].vpe_id)
-                       goto out;
-               cpu = 0;
-#endif
+               /* Clear Count/Compare Interrupt */
+               write_c0_compare(read_c0_compare());
                cd = &per_cpu(mips_clockevent_device, cpu);
                cd->event_handler(cd);
        }
@@ -107,65 +78,16 @@ out:
        return IRQ_HANDLED;
 }
 
-static struct irqaction c0_compare_irqaction = {
+#endif /* Not CONFIG_MIPS_MT_SMTC */
+
+struct irqaction c0_compare_irqaction = {
        .handler = c0_compare_interrupt,
-#ifdef CONFIG_MIPS_MT_SMTC
-       .flags = IRQF_DISABLED,
-#else
        .flags = IRQF_DISABLED | IRQF_PERCPU,
-#endif
        .name = "timer",
 };
 
-#ifdef CONFIG_MIPS_MT_SMTC
-DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
-
-static void smtc_set_mode(enum clock_event_mode mode,
-                          struct clock_event_device *evt)
-{
-}
-
-static void mips_broadcast(cpumask_t mask)
-{
-       unsigned int cpu;
-
-       for_each_cpu_mask(cpu, mask)
-               smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
-}
-
-static void setup_smtc_dummy_clockevent_device(void)
-{
-       //uint64_t mips_freq = mips_hpt_^frequency;
-       unsigned int cpu = smp_processor_id();
-       struct clock_event_device *cd;
 
-       cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
-
-       cd->name                = "SMTC";
-       cd->features            = CLOCK_EVT_FEAT_DUMMY;
-
-       /* Calculate the min / max delta */
-       cd->mult        = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
-       cd->shift               = 0; //32;
-       cd->max_delta_ns        = 0; //clockevent_delta2ns(0x7fffffff, cd);
-       cd->min_delta_ns        = 0; //clockevent_delta2ns(0x30, cd);
-
-       cd->rating              = 200;
-       cd->irq                 = 17; //-1;
-//     if (cpu)
-//             cd->cpumask     = CPU_MASK_ALL; // cpumask_of_cpu(cpu);
-//     else
-               cd->cpumask     = cpumask_of_cpu(cpu);
-
-       cd->set_mode            = smtc_set_mode;
-
-       cd->broadcast           = mips_broadcast;
-
-       clockevents_register_device(cd);
-}
-#endif
-
-static void mips_event_handler(struct clock_event_device *dev)
+void mips_event_handler(struct clock_event_device *dev)
 {
 }
 
@@ -177,7 +99,23 @@ static int c0_compare_int_pending(void)
        return (read_c0_cause() >> cp0_compare_irq) & 0x100;
 }
 
-static int c0_compare_int_usable(void)
+/*
+ * Compare interrupt can be routed and latched outside the core,
+ * so a single execution hazard barrier may not be enough to give
+ * it time to clear as seen in the Cause register.  4 time the
+ * pipeline depth seems reasonably conservative, and empirically
+ * works better in configurations with high CPU/bus clock ratios.
+ */
+
+#define compare_change_hazard() \
+       do { \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+               irq_disable_hazard(); \
+       } while (0)
+
+int c0_compare_int_usable(void)
 {
        unsigned int delta;
        unsigned int cnt;
@@ -187,7 +125,7 @@ static int c0_compare_int_usable(void)
         */
        if (c0_compare_int_pending()) {
                write_c0_compare(read_c0_count());
-               irq_disable_hazard();
+               compare_change_hazard();
                if (c0_compare_int_pending())
                        return 0;
        }
@@ -196,7 +134,7 @@ static int c0_compare_int_usable(void)
                cnt = read_c0_count();
                cnt += delta;
                write_c0_compare(cnt);
-               irq_disable_hazard();
+               compare_change_hazard();
                if ((int)(read_c0_count() - cnt) < 0)
                    break;
                /* increase delta if the timer was already expired */
@@ -205,11 +143,12 @@ static int c0_compare_int_usable(void)
        while ((int)(read_c0_count() - cnt) <= 0)
                ;       /* Wait for expiry  */
 
+       compare_change_hazard();
        if (!c0_compare_int_pending())
                return 0;
 
        write_c0_compare(read_c0_count());
-       irq_disable_hazard();
+       compare_change_hazard();
        if (c0_compare_int_pending())
                return 0;
 
@@ -219,6 +158,8 @@ static int c0_compare_int_usable(void)
        return 1;
 }
 
+#ifndef CONFIG_MIPS_MT_SMTC
+
 int __cpuinit mips_clockevent_init(void)
 {
        uint64_t mips_freq = mips_hpt_frequency;
@@ -229,17 +170,6 @@ int __cpuinit mips_clockevent_init(void)
        if (!cpu_has_counter || !mips_hpt_frequency)
                return -ENXIO;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-       setup_smtc_dummy_clockevent_device();
-
-       /*
-        * On SMTC we only register VPE0's compare interrupt as clockevent
-        * device.
-        */
-       if (cpu)
-               return 0;
-#endif
-
        if (!c0_compare_int_usable())
                return -ENXIO;
 
@@ -265,13 +195,9 @@ int __cpuinit mips_clockevent_init(void)
 
        cd->rating              = 300;
        cd->irq                 = irq;
-#ifdef CONFIG_MIPS_MT_SMTC
-       cd->cpumask             = CPU_MASK_ALL;
-#else
        cd->cpumask             = cpumask_of_cpu(cpu);
-#endif
        cd->set_next_event      = mips_next_event;
-       cd->set_mode            = mips_set_mode;
+       cd->set_mode            = mips_set_clock_mode;
        cd->event_handler       = mips_event_handler;
 
        clockevents_register_device(cd);
@@ -281,12 +207,9 @@ int __cpuinit mips_clockevent_init(void)
 
        cp0_timer_irq_installed = 1;
 
-#ifdef CONFIG_MIPS_MT_SMTC
-#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
-       setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT);
-#else
        setup_irq(irq, &c0_compare_irqaction);
-#endif
 
        return 0;
 }
+
+#endif /* Not CONFIG_MIPS_MT_SMTC */
diff --git a/arch/mips/kernel/cevt-smtc.c b/arch/mips/kernel/cevt-smtc.c
new file mode 100644 (file)
index 0000000..5162fe4
--- /dev/null
@@ -0,0 +1,321 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2007 MIPS Technologies, Inc.
+ * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
+ * Copyright (C) 2008 Kevin D. Kissell, Paralogos sarl
+ */
+#include <linux/clockchips.h>
+#include <linux/interrupt.h>
+#include <linux/percpu.h>
+
+#include <asm/smtc_ipi.h>
+#include <asm/time.h>
+#include <asm/cevt-r4k.h>
+
+/*
+ * Variant clock event timer support for SMTC on MIPS 34K, 1004K
+ * or other MIPS MT cores.
+ *
+ * Notes on SMTC Support:
+ *
+ * SMTC has multiple microthread TCs pretending to be Linux CPUs.
+ * But there's only one Count/Compare pair per VPE, and Compare
+ * interrupts are taken opportunisitically by available TCs
+ * bound to the VPE with the Count register.  The new timer
+ * framework provides for global broadcasts, but we really
+ * want VPE-level multicasts for best behavior. So instead
+ * of invoking the high-level clock-event broadcast code,
+ * this version of SMTC support uses the historical SMTC
+ * multicast mechanisms "under the hood", appearing to the
+ * generic clock layer as if the interrupts are per-CPU.
+ *
+ * The approach taken here is to maintain a set of NR_CPUS
+ * virtual timers, and track which "CPU" needs to be alerted
+ * at each event.
+ *
+ * It's unlikely that we'll see a MIPS MT core with more than
+ * 2 VPEs, but we *know* that we won't need to handle more
+ * VPEs than we have "CPUs".  So NCPUs arrays of NCPUs elements
+ * is always going to be overkill, but always going to be enough.
+ */
+
+unsigned long smtc_nexttime[NR_CPUS][NR_CPUS];
+static int smtc_nextinvpe[NR_CPUS];
+
+/*
+ * Timestamps stored are absolute values to be programmed
+ * into Count register.  Valid timestamps will never be zero.
+ * If a Zero Count value is actually calculated, it is converted
+ * to be a 1, which will introduce 1 or two CPU cycles of error
+ * roughly once every four billion events, which at 1000 HZ means
+ * about once every 50 days.  If that's actually a problem, one
+ * could alternate squashing 0 to 1 and to -1.
+ */
+
+#define MAKEVALID(x) (((x) == 0L) ? 1L : (x))
+#define ISVALID(x) ((x) != 0L)
+
+/*
+ * Time comparison is subtle, as it's really truncated
+ * modular arithmetic.
+ */
+
+#define IS_SOONER(a, b, reference) \
+    (((a) - (unsigned long)(reference)) < ((b) - (unsigned long)(reference)))
+
+/*
+ * CATCHUP_INCREMENT, used when the function falls behind the counter.
+ * Could be an increasing function instead of a constant;
+ */
+
+#define CATCHUP_INCREMENT 64
+
+static int mips_next_event(unsigned long delta,
+                               struct clock_event_device *evt)
+{
+       unsigned long flags;
+       unsigned int mtflags;
+       unsigned long timestamp, reference, previous;
+       unsigned long nextcomp = 0L;
+       int vpe = current_cpu_data.vpe_id;
+       int cpu = smp_processor_id();
+       local_irq_save(flags);
+       mtflags = dmt();
+
+       /*
+        * Maintain the per-TC virtual timer
+        * and program the per-VPE shared Count register
+        * as appropriate here...
+        */
+       reference = (unsigned long)read_c0_count();
+       timestamp = MAKEVALID(reference + delta);
+       /*
+        * To really model the clock, we have to catch the case
+        * where the current next-in-VPE timestamp is the old
+        * timestamp for the calling CPE, but the new value is
+        * in fact later.  In that case, we have to do a full
+        * scan and discover the new next-in-VPE CPU id and
+        * timestamp.
+        */
+       previous = smtc_nexttime[vpe][cpu];
+       if (cpu == smtc_nextinvpe[vpe] && ISVALID(previous)
+           && IS_SOONER(previous, timestamp, reference)) {
+               int i;
+               int soonest = cpu;
+
+               /*
+                * Update timestamp array here, so that new
+                * value gets considered along with those of
+                * other virtual CPUs on the VPE.
+                */
+               smtc_nexttime[vpe][cpu] = timestamp;
+               for_each_online_cpu(i) {
+                       if (ISVALID(smtc_nexttime[vpe][i])
+                           && IS_SOONER(smtc_nexttime[vpe][i],
+                               smtc_nexttime[vpe][soonest], reference)) {
+                                   soonest = i;
+                       }
+               }
+               smtc_nextinvpe[vpe] = soonest;
+               nextcomp = smtc_nexttime[vpe][soonest];
+       /*
+        * Otherwise, we don't have to process the whole array rank,
+        * we just have to see if the event horizon has gotten closer.
+        */
+       } else {
+               if (!ISVALID(smtc_nexttime[vpe][smtc_nextinvpe[vpe]]) ||
+                   IS_SOONER(timestamp,
+                       smtc_nexttime[vpe][smtc_nextinvpe[vpe]], reference)) {
+                           smtc_nextinvpe[vpe] = cpu;
+                           nextcomp = timestamp;
+               }
+               /*
+                * Since next-in-VPE may me the same as the executing
+                * virtual CPU, we update the array *after* checking
+                * its value.
+                */
+               smtc_nexttime[vpe][cpu] = timestamp;
+       }
+
+       /*
+        * It may be that, in fact, we don't need to update Compare,
+        * but if we do, we want to make sure we didn't fall into
+        * a crack just behind Count.
+        */
+       if (ISVALID(nextcomp)) {
+               write_c0_compare(nextcomp);
+               ehb();
+               /*
+                * We never return an error, we just make sure
+                * that we trigger the handlers as quickly as
+                * we can if we fell behind.
+                */
+               while ((nextcomp - (unsigned long)read_c0_count())
+                       > (unsigned long)LONG_MAX) {
+                       nextcomp += CATCHUP_INCREMENT;
+                       write_c0_compare(nextcomp);
+                       ehb();
+               }
+       }
+       emt(mtflags);
+       local_irq_restore(flags);
+       return 0;
+}
+
+
+void smtc_distribute_timer(int vpe)
+{
+       unsigned long flags;
+       unsigned int mtflags;
+       int cpu;
+       struct clock_event_device *cd;
+       unsigned long nextstamp = 0L;
+       unsigned long reference;
+
+
+repeat:
+       for_each_online_cpu(cpu) {
+           /*
+            * Find virtual CPUs within the current VPE who have
+            * unserviced timer requests whose time is now past.
+            */
+           local_irq_save(flags);
+           mtflags = dmt();
+           if (cpu_data[cpu].vpe_id == vpe &&
+               ISVALID(smtc_nexttime[vpe][cpu])) {
+               reference = (unsigned long)read_c0_count();
+               if ((smtc_nexttime[vpe][cpu] - reference)
+                        > (unsigned long)LONG_MAX) {
+                           smtc_nexttime[vpe][cpu] = 0L;
+                           emt(mtflags);
+                           local_irq_restore(flags);
+                           /*
+                            * We don't send IPIs to ourself.
+                            */
+                           if (cpu != smp_processor_id()) {
+                               smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
+                           } else {
+                               cd = &per_cpu(mips_clockevent_device, cpu);
+                               cd->event_handler(cd);
+                           }
+               } else {
+                       /* Local to VPE but Valid Time not yet reached. */
+                       if (!ISVALID(nextstamp) ||
+                           IS_SOONER(smtc_nexttime[vpe][cpu], nextstamp,
+                           reference)) {
+                               smtc_nextinvpe[vpe] = cpu;
+                               nextstamp = smtc_nexttime[vpe][cpu];
+                       }
+                       emt(mtflags);
+                       local_irq_restore(flags);
+               }
+           } else {
+               emt(mtflags);
+               local_irq_restore(flags);
+
+           }
+       }
+       /* Reprogram for interrupt at next soonest timestamp for VPE */
+       if (ISVALID(nextstamp)) {
+               write_c0_compare(nextstamp);
+               ehb();
+               if ((nextstamp - (unsigned long)read_c0_count())
+                       > (unsigned long)LONG_MAX)
+                               goto repeat;
+       }
+}
+
+
+irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
+{
+       int cpu = smp_processor_id();
+
+       /* If we're running SMTC, we've got MIPS MT and therefore MIPS32R2 */
+       handle_perf_irq(1);
+
+       if (read_c0_cause() & (1 << 30)) {
+               /* Clear Count/Compare Interrupt */
+               write_c0_compare(read_c0_compare());
+               smtc_distribute_timer(cpu_data[cpu].vpe_id);
+       }
+       return IRQ_HANDLED;
+}
+
+
+int __cpuinit mips_clockevent_init(void)
+{
+       uint64_t mips_freq = mips_hpt_frequency;
+       unsigned int cpu = smp_processor_id();
+       struct clock_event_device *cd;
+       unsigned int irq;
+       int i;
+       int j;
+
+       if (!cpu_has_counter || !mips_hpt_frequency)
+               return -ENXIO;
+       if (cpu == 0) {
+               for (i = 0; i < num_possible_cpus(); i++) {
+                       smtc_nextinvpe[i] = 0;
+                       for (j = 0; j < num_possible_cpus(); j++)
+                               smtc_nexttime[i][j] = 0L;
+               }
+               /*
+                * SMTC also can't have the usablility test
+                * run by secondary TCs once Compare is in use.
+                */
+               if (!c0_compare_int_usable())
+                       return -ENXIO;
+       }
+
+       /*
+        * With vectored interrupts things are getting platform specific.
+        * get_c0_compare_int is a hook to allow a platform to return the
+        * interrupt number of it's liking.
+        */
+       irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
+       if (get_c0_compare_int)
+               irq = get_c0_compare_int();
+
+       cd = &per_cpu(mips_clockevent_device, cpu);
+
+       cd->name                = "MIPS";
+       cd->features            = CLOCK_EVT_FEAT_ONESHOT;
+
+       /* Calculate the min / max delta */
+       cd->mult        = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
+       cd->shift               = 32;
+       cd->max_delta_ns        = clockevent_delta2ns(0x7fffffff, cd);
+       cd->min_delta_ns        = clockevent_delta2ns(0x300, cd);
+
+       cd->rating              = 300;
+       cd->irq                 = irq;
+       cd->cpumask             = cpumask_of_cpu(cpu);
+       cd->set_next_event      = mips_next_event;
+       cd->set_mode            = mips_set_clock_mode;
+       cd->event_handler       = mips_event_handler;
+
+       clockevents_register_device(cd);
+
+       /*
+        * On SMTC we only want to do the data structure
+        * initialization and IRQ setup once.
+        */
+       if (cpu)
+               return 0;
+       /*
+        * And we need the hwmask associated with the c0_compare
+        * vector to be initialized.
+        */
+       irq_hwmask[irq] = (0x100 << cp0_compare_irq);
+       if (cp0_timer_irq_installed)
+               return 0;
+
+       cp0_timer_irq_installed = 1;
+
+       setup_irq(irq, &c0_compare_irqaction);
+
+       return 0;
+}
index 11c92dc53791bc2d6b62c727c09fe48cc032a7de..e621fda8ab37fad4847cb3a19ee238f415f82a91 100644 (file)
@@ -54,14 +54,18 @@ extern void r4k_wait(void);
  * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
  * using this version a gamble.
  */
-static void r4k_wait_irqoff(void)
+void r4k_wait_irqoff(void)
 {
        local_irq_disable();
        if (!need_resched())
-               __asm__("       .set    mips3           \n"
+               __asm__("       .set    push            \n"
+                       "       .set    mips3           \n"
                        "       wait                    \n"
-                       "       .set    mips0           \n");
+                       "       .set    pop             \n");
        local_irq_enable();
+       __asm__("       .globl __pastwait       \n"
+               "__pastwait:                    \n");
+       return;
 }
 
 /*
index e29598ae939d21b7d8e7442300a8741ce612f24a..ffa331029e086ce3720dc1ac9d60b936d68dba0a 100644 (file)
@@ -79,11 +79,6 @@ FEXPORT(syscall_exit)
 
 FEXPORT(restore_all)                   # restore full frame
 #ifdef CONFIG_MIPS_MT_SMTC
-/* Detect and execute deferred IPI "interrupts" */
-       LONG_L  s0, TI_REGS($28)
-       LONG_S  sp, TI_REGS($28)
-       jal     deferred_smtc_ipi
-       LONG_S  s0, TI_REGS($28)
 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
 /* Re-arm any temporarily masked interrupts not explicitly "acked" */
        mfc0    v0, CP0_TCSTATUS
@@ -112,6 +107,11 @@ FEXPORT(restore_all)                       # restore full frame
        xor     t0, t0, t3
        mtc0    t0, CP0_TCCONTEXT
 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
+/* Detect and execute deferred IPI "interrupts" */
+       LONG_L  s0, TI_REGS($28)
+       LONG_S  sp, TI_REGS($28)
+       jal     deferred_smtc_ipi
+       LONG_S  s0, TI_REGS($28)
 #endif /* CONFIG_MIPS_MT_SMTC */
        .set    noat
        RESTORE_TEMP
index f886dd7f708e1d13f833fce5db545b737f15e684..01dcbe38fa019dc20ac8d4999b818f62ec0ff970 100644 (file)
@@ -282,8 +282,8 @@ NESTED(except_vec_vi_handler, 0, sp)
        and     t0, a0, t1
 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
        mfc0    t2, CP0_TCCONTEXT
-       or      t0, t0, t2
-       mtc0    t0, CP0_TCCONTEXT
+       or      t2, t0, t2
+       mtc0    t2, CP0_TCCONTEXT
 #endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
        xor     t1, t1, t0
        mtc0    t1, CP0_STATUS
index 361364501d34926deea6d59456cce24f0674e538..492a0a8d70fbf9ddc6e695ae8250e562f03f0ab5 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/irqflags.h>
 #include <asm/regdef.h>
 #include <asm/page.h>
+#include <asm/pgtable-bits.h>
 #include <asm/mipsregs.h>
 #include <asm/stackframe.h>
 
index 8f6d58ede33cea5f42424fb27becd432e7b1f7b3..6e152c80cd4a5bb3d0a73816311a850181371b81 100644 (file)
@@ -236,8 +236,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
 
                atomic_set(&kgdb_cpu_doing_single_step, -1);
                if (remcom_in_buffer[0] == 's')
-                       if (kgdb_contthread)
-                               atomic_set(&kgdb_cpu_doing_single_step, cpu);
+                       atomic_set(&kgdb_cpu_doing_single_step, cpu);
 
                return 0;
        }
index df4d3f2f740c54fa73b413e8b8c8d91601b95c74..dc9eb72ed9de956164f557b0757496dae6638c2e 100644 (file)
@@ -159,7 +159,7 @@ __setup("fpaff=", fpaff_thresh);
 /*
  * FPU Use Factor empirically derived from experiments on 34K
  */
-#define FPUSEFACTOR 333
+#define FPUSEFACTOR 2000
 
 static __init int mt_fp_affinity_init(void)
 {
index ce7684335a415fb98de1781058d9db9f6d5271eb..22fc19bbe87f3744ee24ef7dbc81a315b293fc1d 100644 (file)
@@ -55,7 +55,7 @@ void __noreturn cpu_idle(void)
        while (1) {
                tick_nohz_stop_sched_tick(1);
                while (!need_resched()) {
-#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
+#ifdef CONFIG_MIPS_MT_SMTC
                        extern void smtc_idle_loop_hook(void);
 
                        smtc_idle_loop_hook();
@@ -145,19 +145,18 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         */
        p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
        childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
+
+#ifdef CONFIG_MIPS_MT_SMTC
+       /*
+        * SMTC restores TCStatus after Status, and the CU bits
+        * are aliased there.
+        */
+       childregs->cp0_tcstatus &= ~(ST0_CU2|ST0_CU1);
+#endif
        clear_tsk_thread_flag(p, TIF_USEDFPU);
 
 #ifdef CONFIG_MIPS_MT_FPAFF
        clear_tsk_thread_flag(p, TIF_FPUBOUND);
-
-       /*
-        * FPU affinity support is cleaner if we track the
-        * user-visible CPU affinity from the very beginning.
-        * The generic cpus_allowed mask will already have
-        * been copied from the parent before copy_thread
-        * is invoked.
-        */
-       p->thread.user_cpus_allowed = p->cpus_allowed;
 #endif /* CONFIG_MIPS_MT_FPAFF */
 
        if (clone_flags & CLONE_SETTLS)
index 35234b92b9a58f9d5c9e8a2063c292e35c3ac327..96ffc9c6d194d6ba5d2a8be948481652adbb34a2 100644 (file)
@@ -238,7 +238,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                case FPC_EIR: { /* implementation / version register */
                        unsigned int flags;
 #ifdef CONFIG_MIPS_MT_SMTC
-                       unsigned int irqflags;
+                       unsigned long irqflags;
                        unsigned int mtflags;
 #endif /* CONFIG_MIPS_MT_SMTC */
 
index a516286532ab092637cab432cd8742a0800e6fb0..897fb2b4751c95715af0b798d79db5cf899a5e5d 100644 (file)
@@ -1,4 +1,21 @@
-/* Copyright (C) 2004 Mips Technologies, Inc */
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Copyright (C) 2004 Mips Technologies, Inc
+ * Copyright (C) 2008 Kevin D. Kissell
+ */
 
 #include <linux/clockchips.h>
 #include <linux/kernel.h>
@@ -21,7 +38,6 @@
 #include <asm/time.h>
 #include <asm/addrspace.h>
 #include <asm/smtc.h>
-#include <asm/smtc_ipi.h>
 #include <asm/smtc_proc.h>
 
 /*
@@ -58,11 +74,6 @@ unsigned long irq_hwmask[NR_IRQS];
 
 asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
 
-/*
- * Clock interrupt "latch" buffers, per "CPU"
- */
-
-static atomic_t ipi_timer_latch[NR_CPUS];
 
 /*
  * Number of InterProcessor Interrupt (IPI) message buffers to allocate
@@ -70,7 +81,7 @@ static atomic_t ipi_timer_latch[NR_CPUS];
 
 #define IPIBUF_PER_CPU 4
 
-static struct smtc_ipi_q IPIQ[NR_CPUS];
+struct smtc_ipi_q IPIQ[NR_CPUS];
 static struct smtc_ipi_q freeIPIq;
 
 
@@ -282,7 +293,7 @@ static void smtc_configure_tlb(void)
  * phys_cpu_present_map and the logical/physical mappings.
  */
 
-int __init mipsmt_build_cpu_map(int start_cpu_slot)
+int __init smtc_build_cpu_map(int start_cpu_slot)
 {
        int i, ntcs;
 
@@ -325,7 +336,12 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
        write_tc_c0_tcstatus((read_tc_c0_tcstatus()
                        & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT))
                        | TCSTATUS_A);
-       write_tc_c0_tccontext(0);
+       /*
+        * TCContext gets an offset from the base of the IPIQ array
+        * to be used in low-level code to detect the presence of
+        * an active IPI queue
+        */
+       write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16);
        /* Bind tc to vpe */
        write_tc_c0_tcbind(vpe);
        /* In general, all TCs should have the same cpu_data indications */
@@ -336,10 +352,18 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
                cpu_data[cpu].options &= ~MIPS_CPU_FPU;
        cpu_data[cpu].vpe_id = vpe;
        cpu_data[cpu].tc_id = tc;
+       /* Multi-core SMTC hasn't been tested, but be prepared */
+       cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff;
 }
 
+/*
+ * Tweak to get Count registes in as close a sync as possible.
+ * Value seems good for 34K-class cores.
+ */
+
+#define CP0_SKEW 8
 
-void mipsmt_prepare_cpus(void)
+void smtc_prepare_cpus(int cpus)
 {
        int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu;
        unsigned long flags;
@@ -363,13 +387,13 @@ void mipsmt_prepare_cpus(void)
                IPIQ[i].head = IPIQ[i].tail = NULL;
                spin_lock_init(&IPIQ[i].lock);
                IPIQ[i].depth = 0;
-               atomic_set(&ipi_timer_latch[i], 0);
        }
 
        /* cpu_data index starts at zero */
        cpu = 0;
        cpu_data[cpu].vpe_id = 0;
        cpu_data[cpu].tc_id = 0;
+       cpu_data[cpu].core = (read_c0_ebase() >> 1) & 0xff;
        cpu++;
 
        /* Report on boot-time options */
@@ -484,7 +508,8 @@ void mipsmt_prepare_cpus(void)
                        write_vpe_c0_compare(0);
                        /* Propagate Config7 */
                        write_vpe_c0_config7(read_c0_config7());
-                       write_vpe_c0_count(read_c0_count());
+                       write_vpe_c0_count(read_c0_count() + CP0_SKEW);
+                       ehb();
                }
                /* enable multi-threading within VPE */
                write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE);
@@ -556,7 +581,7 @@ void mipsmt_prepare_cpus(void)
 void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
 {
        extern u32 kernelsp[NR_CPUS];
-       long flags;
+       unsigned long flags;
        int mtflags;
 
        LOCK_MT_PRA();
@@ -585,24 +610,22 @@ void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
 
 void smtc_init_secondary(void)
 {
-       /*
-        * Start timer on secondary VPEs if necessary.
-        * plat_timer_setup has already have been invoked by init/main
-        * on "boot" TC.  Like per_cpu_trap_init() hack, this assumes that
-        * SMTC init code assigns TCs consdecutively and in ascending order
-        * to across available VPEs.
-        */
-       if (((read_c0_tcbind() & TCBIND_CURTC) != 0) &&
-           ((read_c0_tcbind() & TCBIND_CURVPE)
-           != cpu_data[smp_processor_id() - 1].vpe_id)){
-               write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
-       }
-
        local_irq_enable();
 }
 
 void smtc_smp_finish(void)
 {
+       int cpu = smp_processor_id();
+
+       /*
+        * Lowest-numbered CPU per VPE starts a clock tick.
+        * Like per_cpu_trap_init() hack, this assumes that
+        * SMTC init code assigns TCs consdecutively and
+        * in ascending order across available VPEs.
+        */
+       if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id))
+               write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
+
        printk("TC %d going on-line as CPU %d\n",
                cpu_data[smp_processor_id()].tc_id, smp_processor_id());
 }
@@ -753,8 +776,10 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
 {
        int tcstatus;
        struct smtc_ipi *pipi;
-       long flags;
+       unsigned long flags;
        int mtflags;
+       unsigned long tcrestart;
+       extern void r4k_wait_irqoff(void), __pastwait(void);
 
        if (cpu == smp_processor_id()) {
                printk("Cannot Send IPI to self!\n");
@@ -771,8 +796,6 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
        pipi->arg = (void *)action;
        pipi->dest = cpu;
        if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
-               if (type == SMTC_CLOCK_TICK)
-                       atomic_inc(&ipi_timer_latch[cpu]);
                /* If not on same VPE, enqueue and send cross-VPE interrupt */
                smtc_ipi_nq(&IPIQ[cpu], pipi);
                LOCK_CORE_PRA();
@@ -800,22 +823,29 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
 
                if ((tcstatus & TCSTATUS_IXMT) != 0) {
                        /*
-                        * Spin-waiting here can deadlock,
-                        * so we queue the message for the target TC.
+                        * If we're in the the irq-off version of the wait
+                        * loop, we need to force exit from the wait and
+                        * do a direct post of the IPI.
+                        */
+                       if (cpu_wait == r4k_wait_irqoff) {
+                               tcrestart = read_tc_c0_tcrestart();
+                               if (tcrestart >= (unsigned long)r4k_wait_irqoff
+                                   && tcrestart < (unsigned long)__pastwait) {
+                                       write_tc_c0_tcrestart(__pastwait);
+                                       tcstatus &= ~TCSTATUS_IXMT;
+                                       write_tc_c0_tcstatus(tcstatus);
+                                       goto postdirect;
+                               }
+                       }
+                       /*
+                        * Otherwise we queue the message for the target TC
+                        * to pick up when he does a local_irq_restore()
                         */
                        write_tc_c0_tchalt(0);
                        UNLOCK_CORE_PRA();
-                       /* Try to reduce redundant timer interrupt messages */
-                       if (type == SMTC_CLOCK_TICK) {
-                           if (atomic_postincrement(&ipi_timer_latch[cpu])!=0){
-                               smtc_ipi_nq(&freeIPIq, pipi);
-                               return;
-                           }
-                       }
                        smtc_ipi_nq(&IPIQ[cpu], pipi);
                } else {
-                       if (type == SMTC_CLOCK_TICK)
-                               atomic_inc(&ipi_timer_latch[cpu]);
+postdirect:
                        post_direct_ipi(cpu, pipi);
                        write_tc_c0_tchalt(0);
                        UNLOCK_CORE_PRA();
@@ -883,7 +913,7 @@ static void ipi_call_interrupt(void)
        smp_call_function_interrupt();
 }
 
-DECLARE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
+DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
 
 void ipi_decode(struct smtc_ipi *pipi)
 {
@@ -891,20 +921,13 @@ void ipi_decode(struct smtc_ipi *pipi)
        struct clock_event_device *cd;
        void *arg_copy = pipi->arg;
        int type_copy = pipi->type;
-       int ticks;
-
        smtc_ipi_nq(&freeIPIq, pipi);
        switch (type_copy) {
        case SMTC_CLOCK_TICK:
                irq_enter();
                kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++;
-               cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
-               ticks = atomic_read(&ipi_timer_latch[cpu]);
-               atomic_sub(ticks, &ipi_timer_latch[cpu]);
-               while (ticks) {
-                       cd->event_handler(cd);
-                       ticks--;
-               }
+               cd = &per_cpu(mips_clockevent_device, cpu);
+               cd->event_handler(cd);
                irq_exit();
                break;
 
@@ -937,24 +960,48 @@ void ipi_decode(struct smtc_ipi *pipi)
        }
 }
 
+/*
+ * Similar to smtc_ipi_replay(), but invoked from context restore,
+ * so it reuses the current exception frame rather than set up a
+ * new one with self_ipi.
+ */
+
 void deferred_smtc_ipi(void)
 {
-       struct smtc_ipi *pipi;
-       unsigned long flags;
-/* DEBUG */
-       int q = smp_processor_id();
+       int cpu = smp_processor_id();
 
        /*
         * Test is not atomic, but much faster than a dequeue,
         * and the vast majority of invocations will have a null queue.
+        * If irq_disabled when this was called, then any IPIs queued
+        * after we test last will be taken on the next irq_enable/restore.
+        * If interrupts were enabled, then any IPIs added after the
+        * last test will be taken directly.
         */
-       if (IPIQ[q].head != NULL) {
-               while((pipi = smtc_ipi_dq(&IPIQ[q])) != NULL) {
-                       /* ipi_decode() should be called with interrupts off */
-                       local_irq_save(flags);
+
+       while (IPIQ[cpu].head != NULL) {
+               struct smtc_ipi_q *q = &IPIQ[cpu];
+               struct smtc_ipi *pipi;
+               unsigned long flags;
+
+               /*
+                * It may be possible we'll come in with interrupts
+                * already enabled.
+                */
+               local_irq_save(flags);
+
+               spin_lock(&q->lock);
+               pipi = __smtc_ipi_dq(q);
+               spin_unlock(&q->lock);
+               if (pipi != NULL)
                        ipi_decode(pipi);
-                       local_irq_restore(flags);
-               }
+               /*
+                * The use of the __raw_local restore isn't
+                * as obviously necessary here as in smtc_ipi_replay(),
+                * but it's more efficient, given that we're already
+                * running down the IPI queue.
+                */
+               __raw_local_irq_restore(flags);
        }
 }
 
@@ -975,7 +1022,7 @@ static irqreturn_t ipi_interrupt(int irq, void *dev_idm)
        struct smtc_ipi *pipi;
        unsigned long tcstatus;
        int sent;
-       long flags;
+       unsigned long flags;
        unsigned int mtflags;
        unsigned int vpflags;
 
@@ -1066,55 +1113,53 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe)
 
 /*
  * SMTC-specific hacks invoked from elsewhere in the kernel.
- *
- * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
- * called with interrupts disabled.  We do rely on interrupts being disabled
- * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
- * result in a recursive call to raw_local_irq_restore().
  */
 
-static void __smtc_ipi_replay(void)
+ /*
+  * smtc_ipi_replay is called from raw_local_irq_restore
+  */
+
+void smtc_ipi_replay(void)
 {
        unsigned int cpu = smp_processor_id();
 
        /*
         * To the extent that we've ever turned interrupts off,
         * we may have accumulated deferred IPIs.  This is subtle.
-        * If we use the smtc_ipi_qdepth() macro, we'll get an
-        * exact number - but we'll also disable interrupts
-        * and create a window of failure where a new IPI gets
-        * queued after we test the depth but before we re-enable
-        * interrupts. So long as IXMT never gets set, however,
         * we should be OK:  If we pick up something and dispatch
         * it here, that's great. If we see nothing, but concurrent
         * with this operation, another TC sends us an IPI, IXMT
         * is clear, and we'll handle it as a real pseudo-interrupt
-        * and not a pseudo-pseudo interrupt.
+        * and not a pseudo-pseudo interrupt.  The important thing
+        * is to do the last check for queued message *after* the
+        * re-enabling of interrupts.
         */
-       if (IPIQ[cpu].depth > 0) {
-               while (1) {
-                       struct smtc_ipi_q *q = &IPIQ[cpu];
-                       struct smtc_ipi *pipi;
-                       extern void self_ipi(struct smtc_ipi *);
-
-                       spin_lock(&q->lock);
-                       pipi = __smtc_ipi_dq(q);
-                       spin_unlock(&q->lock);
-                       if (!pipi)
-                               break;
+       while (IPIQ[cpu].head != NULL) {
+               struct smtc_ipi_q *q = &IPIQ[cpu];
+               struct smtc_ipi *pipi;
+               unsigned long flags;
+
+               /*
+                * It's just possible we'll come in with interrupts
+                * already enabled.
+                */
+               local_irq_save(flags);
+
+               spin_lock(&q->lock);
+               pipi = __smtc_ipi_dq(q);
+               spin_unlock(&q->lock);
+               /*
+                ** But use a raw restore here to avoid recursion.
+                */
+               __raw_local_irq_restore(flags);
 
+               if (pipi) {
                        self_ipi(pipi);
                        smtc_cpu_stats[cpu].selfipis++;
                }
        }
 }
 
-void smtc_ipi_replay(void)
-{
-       raw_local_irq_disable();
-       __smtc_ipi_replay();
-}
-
 EXPORT_SYMBOL(smtc_ipi_replay);
 
 void smtc_idle_loop_hook(void)
@@ -1193,40 +1238,13 @@ void smtc_idle_loop_hook(void)
                }
        }
 
-       /*
-        * Now that we limit outstanding timer IPIs, check for hung TC
-        */
-       for (tc = 0; tc < NR_CPUS; tc++) {
-               /* Don't check ourself - we'll dequeue IPIs just below */
-               if ((tc != smp_processor_id()) &&
-                   atomic_read(&ipi_timer_latch[tc]) > timerq_limit) {
-                   if (clock_hang_reported[tc] == 0) {
-                       pdb_msg += sprintf(pdb_msg,
-                               "TC %d looks hung with timer latch at %d\n",
-                               tc, atomic_read(&ipi_timer_latch[tc]));
-                       clock_hang_reported[tc]++;
-                       }
-               }
-       }
        emt(mtflags);
        local_irq_restore(flags);
        if (pdb_msg != &id_ho_db_msg[0])
                printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg);
 #endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
 
-       /*
-        * Replay any accumulated deferred IPIs. If "Instant Replay"
-        * is in use, there should never be any.
-        */
-#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
-       {
-               unsigned long flags;
-
-               local_irq_save(flags);
-               __smtc_ipi_replay();
-               local_irq_restore(flags);
-       }
-#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
+       smtc_ipi_replay();
 }
 
 void smtc_soft_dump(void)
@@ -1242,10 +1260,6 @@ void smtc_soft_dump(void)
                printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
        }
        smtc_ipi_qdump();
-       printk("Timer IPI Backlogs:\n");
-       for (i=0; i < NR_CPUS; i++) {
-               printk("%d: %d\n", i, atomic_read(&ipi_timer_latch[i]));
-       }
        printk("%d Recoveries of \"stolen\" FPU\n",
               atomic_read(&smtc_fpu_recoveries));
 }
index 5fd0cd020af58e3f2fa5c3753be3098e710ba109..b602ac6eb47d8a41454d0bd5e48b7931d6f4ee7f 100644 (file)
@@ -825,8 +825,10 @@ static void mt_ase_fp_affinity(void)
                if (cpus_intersects(current->cpus_allowed, mt_fpu_cpumask)) {
                        cpumask_t tmask;
 
-                       cpus_and(tmask, current->thread.user_cpus_allowed,
-                                mt_fpu_cpumask);
+                       current->thread.user_cpus_allowed
+                               = current->cpus_allowed;
+                       cpus_and(tmask, current->cpus_allowed,
+                               mt_fpu_cpumask);
                        set_cpus_allowed(current, tmask);
                        set_thread_flag(TIF_FPUBOUND);
                }
index 3b7dd722c32a68ff83881d3200e769660678b899..cef2db8d22253185d8d66402e4e300422fcd4645 100644 (file)
@@ -15,6 +15,6 @@ obj-$(CONFIG_EARLY_PRINTK)    += malta-console.o
 obj-$(CONFIG_PCI)              += malta-pci.o
 
 # FIXME FIXME FIXME
-obj-$(CONFIG_MIPS_MT_SMTC)     += malta_smtc.o
+obj-$(CONFIG_MIPS_MT_SMTC)     += malta-smtc.o
 
 EXTRA_CFLAGS += -Werror
index 5ea705e49454e3ce49b27fb6b2f80a9f796f6950..f84a46a8ae6e5261d0c8669b2726ed353cda7dc3 100644 (file)
@@ -84,12 +84,17 @@ static void msmtc_cpus_done(void)
 
 static void __init msmtc_smp_setup(void)
 {
-       mipsmt_build_cpu_map(0);
+       /*
+        * we won't get the definitive value until
+        * we've run smtc_prepare_cpus later, but
+        * we would appear to need an upper bound now.
+        */
+       smp_num_siblings = smtc_build_cpu_map(0);
 }
 
 static void __init msmtc_prepare_cpus(unsigned int max_cpus)
 {
-       mipsmt_prepare_cpus();
+       smtc_prepare_cpus(max_cpus);
 }
 
 struct plat_smp_ops msmtc_smp_ops = {
index 15e01aec37fdcab3e67e6e5d8390c925c138e20c..c8c32f417b6ce84c32087585456f6e78ae47e58b 100644 (file)
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927)      += ops-tx3927.o
 obj-$(CONFIG_PCI_VR41XX)       += ops-vr41xx.o pci-vr41xx.o
 obj-$(CONFIG_MARKEINS)         += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
 obj-$(CONFIG_PCI_TX4927)       += ops-tx4927.o
+obj-$(CONFIG_BCM47XX)          += pci-bcm47xx.o
 
 #
 # These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644 (file)
index 0000000..bea9b6c
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
+ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
+ *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
+ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  You should have received a copy of the  GNU General Public License along
+ *  with this program; if not, write  to the Free Software Foundation, Inc.,
+ *  675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+       return 0;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+       int res;
+       u8 slot, pin;
+
+       res = ssb_pcibios_plat_dev_init(dev);
+       if (res < 0) {
+               printk(KERN_ALERT "PCI: Failed to init device %s\n",
+                      pci_name(dev));
+               return res;
+       }
+
+       pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
+       slot = PCI_SLOT(dev->devfn);
+       res = ssb_pcibios_map_irq(dev, slot, pin);
+
+       /* IRQ-0 and IRQ-1 are software interrupts. */
+       if (res < 2) {
+               printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+                      pci_name(dev));
+               return res;
+       }
+
+       dev->irq = res;
+       return 0;
+}
+
index bd78368c82bf2001a035a54bb9ff94942ba4cbd0..f97ab14610129bca9c2b696de7bd59f0dcb8d8f6 100644 (file)
@@ -142,26 +142,48 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
  * on any one of the hubs connected to its xbow.
  */
 int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+       return 0;
+}
+
+/* Most MIPS systems have straight-forward swizzling needs.  */
+static inline u8 bridge_swizzle(u8 pin, u8 slot)
+{
+       return (((pin - 1) + slot) % 4) + 1;
+}
+
+static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
+{
+       while (dev->bus->parent) {
+               /* Move up the chain of bridges. */
+               dev = dev->bus->self;
+       }
+
+       return dev;
+}
+
+/* Do platform specific device initialization at pci_enable_device() time */
+int pcibios_plat_dev_init(struct pci_dev *dev)
 {
        struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
-       int irq = bc->pci_int[slot];
+       struct pci_dev *rdev = bridge_root_dev(dev);
+       int slot = PCI_SLOT(rdev->devfn);
+       int irq;
 
+       irq = bc->pci_int[slot];
        if (irq == -1) {
-               irq = bc->pci_int[slot] = request_bridge_irq(bc);
+               irq = request_bridge_irq(bc);
                if (irq < 0)
-                       panic("Can't allocate interrupt for PCI device %s\n",
-                             pci_name(dev));
+                       return irq;
+
+               bc->pci_int[slot] = irq;
        }
 
        irq_to_bridge[irq] = bc;
        irq_to_slot[irq] = slot;
 
-       return irq;
-}
+       dev->irq = irq;
 
-/* Do platform specific device initialization at pci_enable_device() time */
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
        return 0;
 }
 
index f18ba9201bbcd7eda4a1336c545694f84841abcd..7b45f199d92a2d897f56af13fc1b4b9504c306b1 100644 (file)
@@ -1,3 +1,4 @@
-obj-y                          := setup.o rtc_xicor1241.o rtc_m41t81.o
+obj-y                          := platform.o setup.o rtc_xicor1241.o \
+                                  rtc_m41t81.o
 
 obj-$(CONFIG_I2C_BOARDINFO)    += swarm-i2c.o
diff --git a/arch/mips/sibyte/swarm/platform.c b/arch/mips/sibyte/swarm/platform.c
new file mode 100644 (file)
index 0000000..54847fe
--- /dev/null
@@ -0,0 +1,85 @@
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+
+#include <asm/sibyte/board.h>
+#include <asm/sibyte/sb1250_genbus.h>
+#include <asm/sibyte/sb1250_regs.h>
+
+#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR)
+
+#define DRV_NAME       "pata-swarm"
+
+#define SWARM_IDE_SHIFT        5
+#define SWARM_IDE_BASE 0x1f0
+#define SWARM_IDE_CTRL 0x3f6
+
+static struct resource swarm_pata_resource[] = {
+       {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .name   = "Swarm GenBus IDE",
+               .flags  = IORESOURCE_IRQ,
+               .start  = K_INT_GB_IDE,
+               .end    = K_INT_GB_IDE,
+       },
+};
+
+static struct pata_platform_info pata_platform_data = {
+       .ioport_shift   = SWARM_IDE_SHIFT,
+};
+
+static struct platform_device swarm_pata_device = {
+       .name           = "pata_platform",
+       .id             = -1,
+       .resource       = swarm_pata_resource,
+       .num_resources  = ARRAY_SIZE(swarm_pata_resource),
+       .dev  = {
+               .platform_data          = &pata_platform_data,
+               .coherent_dma_mask      = ~0,   /* grumble */
+       },
+};
+
+static int __init swarm_pata_init(void)
+{
+       u8 __iomem *base;
+       phys_t offset, size;
+       struct resource *r;
+
+       if (!SIBYTE_HAVE_IDE)
+               return -ENODEV;
+
+       base = ioremap(A_IO_EXT_BASE, 0x800);
+       offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
+       size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
+       iounmap(base);
+
+       offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
+       size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
+       if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
+               pr_info(DRV_NAME ": PATA interface at GenBus disabled\n");
+
+               return -EBUSY;
+       }
+
+       pr_info(DRV_NAME ": PATA interface at GenBus slot %i\n", IDE_CS);
+
+       r = swarm_pata_resource;
+       r[0].start = offset + (SWARM_IDE_BASE << SWARM_IDE_SHIFT);
+       r[0].end   = offset + ((SWARM_IDE_BASE + 8) << SWARM_IDE_SHIFT) - 1;
+       r[1].start = offset + (SWARM_IDE_CTRL << SWARM_IDE_SHIFT);
+       r[1].end   = offset + ((SWARM_IDE_CTRL + 1) << SWARM_IDE_SHIFT) - 1;
+
+       return platform_device_register(&swarm_pata_device);
+}
+
+device_initcall(swarm_pata_init);
+
+#endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */
index 761c434a2488fb39cd515d5232b109ade7443084..56c64ccc9c21cd2ee530baab8f0b7fcfbea5ce7c 100644 (file)
@@ -20,22 +20,8 @@ EXPORT_SYMBOL(__mn10300_irq_enabled_epsw);
 atomic_t irq_err_count;
 
 /*
- * MN10300 INTC controller operations
+ * MN10300 interrupt controller operations
  */
-static void mn10300_cpupic_disable(unsigned int irq)
-{
-       u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT;
-       tmp = GxICR(irq);
-}
-
-static void mn10300_cpupic_enable(unsigned int irq)
-{
-       u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
-       tmp = GxICR(irq);
-}
-
 static void mn10300_cpupic_ack(unsigned int irq)
 {
        u16 tmp;
@@ -60,26 +46,54 @@ static void mn10300_cpupic_mask_ack(unsigned int irq)
 static void mn10300_cpupic_unmask(unsigned int irq)
 {
        u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
+       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
        tmp = GxICR(irq);
 }
 
-static void mn10300_cpupic_end(unsigned int irq)
+static void mn10300_cpupic_unmask_clear(unsigned int irq)
 {
+       /* the MN10300 PIC latches its interrupt request bit, even after the
+        * device has ceased to assert its interrupt line and the interrupt
+        * channel has been disabled in the PIC, so for level-triggered
+        * interrupts we need to clear the request bit when we re-enable */
        u16 tmp = GxICR(irq);
-       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
+       GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
        tmp = GxICR(irq);
 }
 
-static struct irq_chip mn10300_cpu_pic = {
-       .name           = "cpu",
-       .disable        = mn10300_cpupic_disable,
-       .enable         = mn10300_cpupic_enable,
+/*
+ * MN10300 PIC level-triggered IRQ handling.
+ *
+ * The PIC has no 'ACK' function per se.  It is possible to clear individual
+ * channel latches, but each latch relatches whether or not the channel is
+ * masked, so we need to clear the latch when we unmask the channel.
+ *
+ * Also for this reason, we don't supply an ack() op (it's unused anyway if
+ * mask_ack() is provided), and mask_ack() just masks.
+ */
+static struct irq_chip mn10300_cpu_pic_level = {
+       .name           = "cpu_l",
+       .disable        = mn10300_cpupic_mask,
+       .enable         = mn10300_cpupic_unmask_clear,
+       .ack            = NULL,
+       .mask           = mn10300_cpupic_mask,
+       .mask_ack       = mn10300_cpupic_mask,
+       .unmask         = mn10300_cpupic_unmask_clear,
+};
+
+/*
+ * MN10300 PIC edge-triggered IRQ handling.
+ *
+ * We use the latch clearing function of the PIC as the 'ACK' function.
+ */
+static struct irq_chip mn10300_cpu_pic_edge = {
+       .name           = "cpu_e",
+       .disable        = mn10300_cpupic_mask,
+       .enable         = mn10300_cpupic_unmask,
        .ack            = mn10300_cpupic_ack,
        .mask           = mn10300_cpupic_mask,
        .mask_ack       = mn10300_cpupic_mask_ack,
        .unmask         = mn10300_cpupic_unmask,
-       .end            = mn10300_cpupic_end,
 };
 
 /*
@@ -114,7 +128,8 @@ void set_intr_level(int irq, u16 level)
  */
 void set_intr_postackable(int irq)
 {
-       set_irq_handler(irq, handle_level_irq);
+       set_irq_chip_and_handler(irq, &mn10300_cpu_pic_level,
+                                handle_level_irq);
 }
 
 /*
@@ -126,8 +141,12 @@ void __init init_IRQ(void)
 
        for (irq = 0; irq < NR_IRQS; irq++)
                if (irq_desc[irq].chip == &no_irq_type)
-                       set_irq_chip_and_handler(irq, &mn10300_cpu_pic,
-                                                handle_edge_irq);
+                       /* due to the PIC latching interrupt requests, even
+                        * when the IRQ is disabled, IRQ_PENDING is superfluous
+                        * and we can use handle_level_irq() for edge-triggered
+                        * interrupts */
+                       set_irq_chip_and_handler(irq, &mn10300_cpu_pic_edge,
+                                                handle_level_irq);
        unit_init_IRQ();
 }
 
index babb7c2ac37701be5065da1e9cba3d1659cf636c..e4606586f94ce5e08d35720ca8b4f7512db4aa34 100644 (file)
@@ -1,6 +1,6 @@
 /* MN10300 Low level time management
  *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2007-2008 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells (dhowells@redhat.com)
  * - Derived from arch/i386/kernel/time.c
  *
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/profile.h>
+#include <linux/cnt32_to_63.h>
 #include <asm/irq.h>
 #include <asm/div64.h>
 #include <asm/processor.h>
@@ -40,27 +41,54 @@ static struct irqaction timer_irq = {
        .name           = "timer",
 };
 
+static unsigned long sched_clock_multiplier;
+
 /*
  * scheduler clock - returns current time in nanosec units.
  */
 unsigned long long sched_clock(void)
 {
        union {
-               unsigned long long l;
-               u32 w[2];
-       } quot;
+               unsigned long long ll;
+               unsigned l[2];
+       } tsc64, result;
+       unsigned long tsc, tmp;
+       unsigned product[3]; /* 96-bit intermediate value */
+
+       /* read the TSC value
+        */
+       tsc = 0 - get_cycles(); /* get_cycles() counts down */
 
-       quot.w[0] = mn10300_last_tsc - get_cycles();
-       quot.w[1] = 1000000000;
+       /* expand to 64-bits.
+        * - sched_clock() must be called once a minute or better or the
+        *   following will go horribly wrong - see cnt32_to_63()
+        */
+       tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL;
 
-       asm("mulu %2,%3,%0,%1"
-           : "=r"(quot.w[1]), "=r"(quot.w[0])
-           : "0"(quot.w[1]), "1"(quot.w[0])
+       /* scale the 64-bit TSC value to a nanosecond value via a 96-bit
+        * intermediate
+        */
+       asm("mulu       %2,%0,%3,%0     \n"     /* LSW * mult ->  0:%3:%0 */
+           "mulu       %2,%1,%2,%1     \n"     /* MSW * mult -> %2:%1:0 */
+           "add        %3,%1           \n"
+           "addc       0,%2            \n"     /* result in %2:%1:%0 */
+           : "=r"(product[0]), "=r"(product[1]), "=r"(product[2]), "=r"(tmp)
+           :  "0"(tsc64.l[0]),  "1"(tsc64.l[1]),  "2"(sched_clock_multiplier)
            : "cc");
 
-       do_div(quot.l, MN10300_TSCCLK);
+       result.l[0] = product[1] << 16 | product[0] >> 16;
+       result.l[1] = product[2] << 16 | product[1] >> 16;
 
-       return quot.l;
+       return result.ll;
+}
+
+/*
+ * initialise the scheduler clock
+ */
+static void __init mn10300_sched_clock_init(void)
+{
+       sched_clock_multiplier =
+               __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK);
 }
 
 /*
@@ -128,4 +156,6 @@ void __init time_init(void)
        /* start the watchdog timer */
        watchdog_go();
 #endif
+
+       mn10300_sched_clock_init();
 }
index 14b2c817cff8a83e04a6b85be9de5513e7146599..70e8cb4ea266153e0d0217933ff84e4f61bed7e1 100644 (file)
@@ -51,7 +51,7 @@ void __init unit_init_IRQ(void)
                switch (GET_XIRQ_TRIGGER(extnum)) {
                case XIRQ_TRIGGER_HILEVEL:
                case XIRQ_TRIGGER_LOWLEVEL:
-                       set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq);
+                       set_intr_postackable(XIRQ2IRQ(extnum));
                        break;
                default:
                        break;
index 6a352414a3584933b2192f5a391c337e0fddfd63..72812a9439ac0d26ea30f4cf2fc62099efc3735c 100644 (file)
@@ -52,7 +52,7 @@ void __init unit_init_IRQ(void)
                switch (GET_XIRQ_TRIGGER(extnum)) {
                case XIRQ_TRIGGER_HILEVEL:
                case XIRQ_TRIGGER_LOWLEVEL:
-                       set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq);
+                       set_intr_postackable(XIRQ2IRQ(extnum));
                        break;
                default:
                        break;
index f87fe7b9ced946e6e5a1ac699d97af48404397cb..c6e11ebecebbe46ccd57d2aaf0cc98c05b594c61 100644 (file)
                        reg = <0x00007400 0x00000400>;
                        big-endian;
                };
+       };
 
-               pci@1000 {
-                       device_type = "pci";
-                       compatible = "tsi109-pci", "tsi108-pci";
-                       #interrupt-cells = <1>;
-                       #size-cells = <2>;
-                       #address-cells = <3>;
-                       reg = <0x00001000 0x00001000>;
-                       bus-range = <0x0 0x0>;
-                       /*----------------------------------------------------+
-                       | PCI memory range.
-                       | 01 denotes I/O space
-                       | 02 denotes 32-bit memory space
-                       +----------------------------------------------------*/
-                       ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
-                                 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
-                       clock-frequency = <133333332>;
-                       interrupt-parent = <&MPIC>;
+       pci@c0001000 {
+               device_type = "pci";
+               compatible = "tsi109-pci", "tsi108-pci";
+               #interrupt-cells = <1>;
+               #size-cells = <2>;
+               #address-cells = <3>;
+               reg = <0xc0001000 0x00001000>;
+               bus-range = <0x0 0x0>;
+               /*----------------------------------------------------+
+               | PCI memory range.
+               | 01 denotes I/O space
+               | 02 denotes 32-bit memory space
+               +----------------------------------------------------*/
+               ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
+                         0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
+               clock-frequency = <133333332>;
+               interrupt-parent = <&MPIC>;
+               interrupts = <0x17 0x2>;
+               interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+               /*----------------------------------------------------+
+               | The INTA, INTB, INTC, INTD are shared.
+               +----------------------------------------------------*/
+               interrupt-map = <
+                       0x800 0x0 0x0 0x1 &RT0 0x24 0x0
+                       0x800 0x0 0x0 0x2 &RT0 0x25 0x0
+                       0x800 0x0 0x0 0x3 &RT0 0x26 0x0
+                       0x800 0x0 0x0 0x4 &RT0 0x27 0x0
+
+                       0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
+                       0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
+                       0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
+                       0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
+
+                       0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
+                       0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
+                       0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
+                       0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
+
+                       0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
+                       0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
+                       0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
+                       0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
+                       >;
+
+               RT0: router@1180 {
+                       device_type = "pic-router";
+                       interrupt-controller;
+                       big-endian;
+                       clock-frequency = <0>;
+                       #address-cells = <0>;
+                       #interrupt-cells = <2>;
                        interrupts = <0x17 0x2>;
-                       interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
-                       /*----------------------------------------------------+
-                       | The INTA, INTB, INTC, INTD are shared.
-                       +----------------------------------------------------*/
-                       interrupt-map = <
-                               0x800 0x0 0x0 0x1 &RT0 0x24 0x0
-                               0x800 0x0 0x0 0x2 &RT0 0x25 0x0
-                               0x800 0x0 0x0 0x3 &RT0 0x26 0x0
-                               0x800 0x0 0x0 0x4 &RT0 0x27 0x0
-
-                               0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
-                               0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
-                               0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
-                               0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
-
-                               0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
-                               0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
-                               0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
-                               0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
-
-                               0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
-                               0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
-                               0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
-                               0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
-                               >;
-
-                       RT0: router@1180 {
-                               device_type = "pic-router";
-                               interrupt-controller;
-                               big-endian;
-                               clock-frequency = <0>;
-                               #address-cells = <0>;
-                               #interrupt-cells = <2>;
-                               interrupts = <0x17 0x2>;
-                               interrupt-parent = <&MPIC>;
-                       };
+                       interrupt-parent = <&MPIC>;
                };
        };
 
index d308a9f70f1b81b970ef0f13df10454f0deee3d9..31982d05d81a8814d73dfc8b5a562cd90b66e5d3 100644 (file)
 #include <asm/smp.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
-/* this is used for software suspend, and that shuts down
- * CPUs even while the system is still booting... */
-#define cpu_should_die()       (cpu_is_offline(smp_processor_id()) && \
-                                  (system_state == SYSTEM_RUNNING     \
-                                || system_state == SYSTEM_BOOTING))
+#define cpu_should_die()       cpu_is_offline(smp_processor_id())
 #else
 #define cpu_should_die()       0
 #endif
index b4fdf2f2743ca6cb7497bba075f80b9b413d01dc..fe8f71dd0b3f1bd711ca4a480cdcdc2943007c9f 100644 (file)
@@ -347,9 +347,8 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
                        linux_regs->msr |= MSR_SE;
 #endif
                        kgdb_single_step = 1;
-                       if (kgdb_contthread)
-                               atomic_set(&kgdb_cpu_doing_single_step,
-                                          raw_smp_processor_id());
+                       atomic_set(&kgdb_cpu_doing_single_step,
+                                  raw_smp_processor_id());
                }
                return 0;
        }
index ef74a0763ec124a063c67992b99ac9e8f6d6f316..8c619963becceed0ac702c5b4662387adcbe720f 100644 (file)
@@ -219,11 +219,21 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
        int i;
        u8 *dummy;
        struct pci_bus *bus = dev->bus;
+       resource_size_t end = 0;
+
+       for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
+               unsigned long flags = pci_resource_flags(dev, i);
+               if ((flags & (IORESOURCE_MEM|IORESOURCE_PREFETCH)) == IORESOURCE_MEM)
+                       end = pci_resource_end(dev, i);
+       }
 
        for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
                if ((bus->resource[i]) &&
                        (bus->resource[i]->flags & IORESOURCE_MEM)) {
-                       dummy = ioremap(bus->resource[i]->end - 3, 0x4);
+                       if (bus->resource[i]->end == end)
+                               dummy = ioremap(bus->resource[i]->start, 0x4);
+                       else
+                               dummy = ioremap(bus->resource[i]->end - 3, 0x4);
                        if (dummy) {
                                in_8(dummy);
                                iounmap(dummy);
index ca114fe46ffbd5ed69033d37ebd13783c2f2a5f1..06acb1a18bbcb44458a8f04da85f00f54345ca1b 100644 (file)
@@ -169,6 +169,8 @@ void init_cpu_timer(void)
 
 static void clock_comparator_interrupt(__u16 code)
 {
+       if (S390_lowcore.clock_comparator == -1ULL)
+               set_clock_comparator(S390_lowcore.clock_comparator);
 }
 
 static void etr_timing_alert(struct etr_irq_parm *);
index fc6ab6094df811c4511b37ceb7d9783170d98e5a..0953cee05efc2d40cefcf8819c650de563462f6b 100644 (file)
@@ -1,14 +1,9 @@
 /*
- *  arch/s390/lib/delay.c
  *    Precise Delay Loops for S390
  *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Derived from "arch/i386/lib/delay.c"
- *    Copyright (C) 1993 Linus Torvalds
- *    Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *    Copyright IBM Corp. 1999,2008
+ *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
+ *              Heiko Carstens <heiko.carstens@de.ibm.com>,
  */
 
 #include <linux/sched.h>
@@ -29,30 +24,31 @@ void __delay(unsigned long loops)
        asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
 }
 
-/*
- * Waits for 'usecs' microseconds using the TOD clock comparator.
- */
-void __udelay(unsigned long usecs)
+static void __udelay_disabled(unsigned long usecs)
 {
-       u64 end, time, old_cc = 0;
-       unsigned long flags, cr0, mask, dummy;
-       int irq_context;
+       unsigned long mask, cr0, cr0_saved;
+       u64 clock_saved;
 
-       irq_context = in_interrupt();
-       if (!irq_context)
-               local_bh_disable();
-       local_irq_save(flags);
-       if (raw_irqs_disabled_flags(flags)) {
-               old_cc = local_tick_disable();
-               S390_lowcore.clock_comparator = -1ULL;
-               __ctl_store(cr0, 0, 0);
-               dummy = (cr0 & 0xffff00e0) | 0x00000800;
-               __ctl_load(dummy , 0, 0);
-               mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
-       } else
-               mask = psw_kernel_bits | PSW_MASK_WAIT |
-                       PSW_MASK_EXT | PSW_MASK_IO;
+       clock_saved = local_tick_disable();
+       set_clock_comparator(get_clock() + ((u64) usecs << 12));
+       __ctl_store(cr0_saved, 0, 0);
+       cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
+       __ctl_load(cr0 , 0, 0);
+       mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
+       trace_hardirqs_on();
+       __load_psw_mask(mask);
+       local_irq_disable();
+       __ctl_load(cr0_saved, 0, 0);
+       local_tick_enable(clock_saved);
+       set_clock_comparator(S390_lowcore.clock_comparator);
+}
 
+static void __udelay_enabled(unsigned long usecs)
+{
+       unsigned long mask;
+       u64 end, time;
+
+       mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
        end = get_clock() + ((u64) usecs << 12);
        do {
                time = end < S390_lowcore.clock_comparator ?
@@ -62,13 +58,37 @@ void __udelay(unsigned long usecs)
                __load_psw_mask(mask);
                local_irq_disable();
        } while (get_clock() < end);
+       set_clock_comparator(S390_lowcore.clock_comparator);
+}
 
-       if (raw_irqs_disabled_flags(flags)) {
-               __ctl_load(cr0, 0, 0);
-               local_tick_enable(old_cc);
+/*
+ * Waits for 'usecs' microseconds using the TOD clock comparator.
+ */
+void __udelay(unsigned long usecs)
+{
+       unsigned long flags;
+
+       preempt_disable();
+       local_irq_save(flags);
+       if (in_irq()) {
+               __udelay_disabled(usecs);
+               goto out;
+       }
+       if (in_softirq()) {
+               if (raw_irqs_disabled_flags(flags))
+                       __udelay_disabled(usecs);
+               else
+                       __udelay_enabled(usecs);
+               goto out;
        }
-       if (!irq_context)
+       if (raw_irqs_disabled_flags(flags)) {
+               local_bh_disable();
+               __udelay_disabled(usecs);
                _local_bh_enable();
-       set_clock_comparator(S390_lowcore.clock_comparator);
+               goto out;
+       }
+       __udelay_enabled(usecs);
+out:
        local_irq_restore(flags);
+       preempt_enable();
 }
index f845f150f565b26a019dea86afa7a6b9d2970ce7..100ebd527499991f39b094709fe597fa77f571f6 100644 (file)
@@ -169,7 +169,7 @@ static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long fla
 
 static int of_bus_pci_match(struct device_node *np)
 {
-       if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
+       if (!strcmp(np->name, "pci")) {
                const char *model = of_get_property(np, "model", NULL);
 
                if (model && !strcmp(model, "SUNW,simba"))
@@ -200,7 +200,7 @@ static int of_bus_simba_match(struct device_node *np)
        /* Treat PCI busses lacking ranges property just like
         * simba.
         */
-       if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
+       if (!strcmp(np->name, "pci")) {
                if (!of_find_property(np, "ranges", NULL))
                        return 1;
        }
@@ -429,7 +429,7 @@ static int __init use_1to1_mapping(struct device_node *pp)
         * it lacks a ranges property, and this will include
         * cases like Simba.
         */
-       if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex"))
+       if (!strcmp(pp->name, "pci"))
                return 0;
 
        return 1;
@@ -714,8 +714,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
                                break;
                        }
                } else {
-                       if (!strcmp(pp->type, "pci") ||
-                           !strcmp(pp->type, "pciex")) {
+                       if (!strcmp(pp->name, "pci")) {
                                unsigned int this_orig_irq = irq;
 
                                irq = pci_irq_swizzle(dp, pp, irq);
index 55096195458fa0d358364075c5c7f06617112a55..80dad76f8b81c24b55cc3d26177cae9b7fa7ca79 100644 (file)
@@ -425,7 +425,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
 
-       if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
+       if (!strcmp(node->name, "pci")) {
                /* a PCI-PCI bridge */
                dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
                dev->rom_base_reg = PCI_ROM_ADDRESS1;
index ed92864d1325c09092f3e8ed4918f26341f23161..f8caf040650ef0d45b72912de5d0fc3577c57b9e 100644 (file)
@@ -123,6 +123,9 @@ config GENERIC_TIME_VSYSCALL
 config ARCH_HAS_CPU_RELAX
        def_bool y
 
+config ARCH_HAS_DEFAULT_IDLE
+       def_bool y
+
 config ARCH_HAS_CACHE_LINE_SIZE
        def_bool y
 
index a1310c52fc0c6ac6bf97feb276700e9f0662793e..857e492c571e05ac7714d4b54144acc9560110e1 100644 (file)
@@ -492,7 +492,7 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
                        continue;
                }
                sh_symtab = sec_symtab->symtab;
-               sym_strtab = sec->link->strtab;
+               sym_strtab = sec_symtab->link->strtab;
                for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
                        Elf32_Rel *rel;
                        Elf32_Sym *sym;
index bfd10fd211cd30f4e0867c8bbfd8458461aec3c8..c102af85df9ca4443b9b4a12db8b77ceccf90a82 100644 (file)
@@ -1603,6 +1603,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
         * is not connected at all.  Force ignoring BIOS IRQ0 pin2
         * override in that cases.
         */
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP nx6115 laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6115"),
+                    },
+        },
        {
         .callback = dmi_ignore_irq0_timer_override,
         .ident = "HP NX6125 laptop",
@@ -1619,6 +1627,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
                     },
         },
+       {
+        .callback = dmi_ignore_irq0_timer_override,
+        .ident = "HP 6715b laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
+                    },
+        },
        {}
 };
 
index 69b4d060b21c4c32e8e40b45c9dc2171c1b56505..042fdc27bc925cd5719c73b443a39b5a3c1456d9 100644 (file)
@@ -101,10 +101,10 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
  */
 static int iommu_completion_wait(struct amd_iommu *iommu)
 {
-       int ret, ready = 0;
+       int ret = 0, ready = 0;
        unsigned status = 0;
        struct iommu_cmd cmd;
-       unsigned long i = 0;
+       unsigned long flags, i = 0;
 
        memset(&cmd, 0, sizeof(cmd));
        cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
@@ -112,10 +112,12 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 
        iommu->need_sync = 0;
 
-       ret = iommu_queue_command(iommu, &cmd);
+       spin_lock_irqsave(&iommu->lock, flags);
+
+       ret = __iommu_queue_command(iommu, &cmd);
 
        if (ret)
-               return ret;
+               goto out;
 
        while (!ready && (i < EXIT_LOOP_COUNT)) {
                ++i;
@@ -130,6 +132,8 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 
        if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit()))
                printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n");
+out:
+       spin_unlock_irqrestore(&iommu->lock, flags);
 
        return 0;
 }
@@ -140,6 +144,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
 static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
 {
        struct iommu_cmd cmd;
+       int ret;
 
        BUG_ON(iommu == NULL);
 
@@ -147,9 +152,11 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
        CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
        cmd.data[0] = devid;
 
+       ret = iommu_queue_command(iommu, &cmd);
+
        iommu->need_sync = 1;
 
-       return iommu_queue_command(iommu, &cmd);
+       return ret;
 }
 
 /*
@@ -159,6 +166,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
                u64 address, u16 domid, int pde, int s)
 {
        struct iommu_cmd cmd;
+       int ret;
 
        memset(&cmd, 0, sizeof(cmd));
        address &= PAGE_MASK;
@@ -171,9 +179,11 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
        if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
                cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
 
+       ret = iommu_queue_command(iommu, &cmd);
+
        iommu->need_sync = 1;
 
-       return iommu_queue_command(iommu, &cmd);
+       return ret;
 }
 
 /*
index 9ee24e6bc4b0e5a661c4ac3dd669c60bf1f82a45..732d1f4e10ee641020f9af9b1851be4e9bbad99e 100644 (file)
 #include <asm/uaccess.h>
 #include <asm/desc.h>
 #include <asm/i8253.h>
+#include <asm/olpc.h>
 #include <asm/paravirt.h>
 #include <asm/reboot.h>
 
@@ -2217,7 +2218,7 @@ static int __init apm_init(void)
 
        dmi_check_system(apm_dmi_table);
 
-       if (apm_info.bios.version == 0 || paravirt_enabled()) {
+       if (apm_info.bios.version == 0 || paravirt_enabled() || machine_is_olpc()) {
                printk(KERN_INFO "apm: BIOS not found.\n");
                return -ENODEV;
        }
index f1685fb91fbd313058b92af93ee055af160a2447..b8e05ee4f7361a1dc57ce28ff9d2e5e5526f776d 100644 (file)
@@ -171,7 +171,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
        }
 
        if (c->x86 != 0xF) {
-               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@lists.linux.org.uk>\n");
+               printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n");
                return 0;
        }
 
index 84bb395038d879823d5beb4e4bf2e181b8bd6b91..4e0c6abd7ca4d51bc5264b86b205fd016862c2f7 100644 (file)
@@ -45,7 +45,6 @@
 #endif
 
 #define PFX "powernow-k8: "
-#define BFX PFX "BIOS error: "
 #define VERSION "version 2.20.00"
 #include "powernow-k8.h"
 
@@ -536,35 +535,40 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8
 
        for (j = 0; j < data->numps; j++) {
                if (pst[j].vid > LEAST_VID) {
-                       printk(KERN_ERR PFX "vid %d invalid : 0x%x\n", j, pst[j].vid);
+                       printk(KERN_ERR FW_BUG PFX "vid %d invalid : 0x%x\n",
+                              j, pst[j].vid);
                        return -EINVAL;
                }
                if (pst[j].vid < data->rvo) {   /* vid + rvo >= 0 */
-                       printk(KERN_ERR BFX "0 vid exceeded with pstate %d\n", j);
+                       printk(KERN_ERR FW_BUG PFX "0 vid exceeded with pstate"
+                              " %d\n", j);
                        return -ENODEV;
                }
                if (pst[j].vid < maxvid + data->rvo) {  /* vid + rvo >= maxvid */
-                       printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j);
+                       printk(KERN_ERR FW_BUG PFX "maxvid exceeded with pstate"
+                              " %d\n", j);
                        return -ENODEV;
                }
                if (pst[j].fid > MAX_FID) {
-                       printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j);
+                       printk(KERN_ERR FW_BUG PFX "maxfid exceeded with pstate"
+                              " %d\n", j);
                        return -ENODEV;
                }
                if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
                        /* Only first fid is allowed to be in "low" range */
-                       printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid);
+                       printk(KERN_ERR FW_BUG PFX "two low fids - %d : "
+                              "0x%x\n", j, pst[j].fid);
                        return -EINVAL;
                }
                if (pst[j].fid < lastfid)
                        lastfid = pst[j].fid;
        }
        if (lastfid & 1) {
-               printk(KERN_ERR BFX "lastfid invalid\n");
+               printk(KERN_ERR FW_BUG PFX "lastfid invalid\n");
                return -EINVAL;
        }
        if (lastfid > LO_FID_TABLE_TOP)
-               printk(KERN_INFO BFX  "first fid not from lo freq table\n");
+               printk(KERN_INFO FW_BUG PFX  "first fid not from lo freq table\n");
 
        return 0;
 }
@@ -672,13 +676,13 @@ static int find_psb_table(struct powernow_k8_data *data)
 
                dprintk("table vers: 0x%x\n", psb->tableversion);
                if (psb->tableversion != PSB_VERSION_1_4) {
-                       printk(KERN_ERR BFX "PSB table is not v1.4\n");
+                       printk(KERN_ERR FW_BUG PFX "PSB table is not v1.4\n");
                        return -ENODEV;
                }
 
                dprintk("flags: 0x%x\n", psb->flags1);
                if (psb->flags1) {
-                       printk(KERN_ERR BFX "unknown flags\n");
+                       printk(KERN_ERR FW_BUG PFX "unknown flags\n");
                        return -ENODEV;
                }
 
@@ -705,7 +709,7 @@ static int find_psb_table(struct powernow_k8_data *data)
                        }
                }
                if (cpst != 1) {
-                       printk(KERN_ERR BFX "numpst must be 1\n");
+                       printk(KERN_ERR FW_BUG PFX "numpst must be 1\n");
                        return -ENODEV;
                }
 
@@ -1130,17 +1134,19 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
                               "ACPI Processor module before starting this "
                               "driver.\n");
 #else
-                       printk(KERN_ERR PFX "Your BIOS does not provide ACPI "
-                              "_PSS objects in a way that Linux understands. "
-                              "Please report this to the Linux ACPI maintainers"
-                              " and complain to your BIOS vendor.\n");
+                       printk(KERN_ERR FW_BUG PFX "Your BIOS does not provide"
+                              " ACPI _PSS objects in a way that Linux "
+                              "understands. Please report this to the Linux "
+                              "ACPI maintainers and complain to your BIOS "
+                              "vendor.\n");
 #endif
                        kfree(data);
                        return -ENODEV;
                }
                if (pol->cpu != 0) {
-                       printk(KERN_ERR PFX "No ACPI _PSS objects for CPU other than "
-                              "CPU0. Complain to your BIOS vendor.\n");
+                       printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
+                              "CPU other than CPU0. Complain to your BIOS "
+                              "vendor.\n");
                        kfree(data);
                        return -ENODEV;
                }
@@ -1193,7 +1199,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
 
        /* min/max the cpu is capable of */
        if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) {
-               printk(KERN_ERR PFX "invalid powernow_table\n");
+               printk(KERN_ERR FW_BUG PFX "invalid powernow_table\n");
                powernow_k8_cpu_exit_acpi(data);
                kfree(data->powernow_table);
                kfree(data);
index 15e13c01cc3621ce3d4d610ab34225437eb8f413..3b5f06423e7774f2801e31e811c631df90344e36 100644 (file)
@@ -26,7 +26,7 @@
 #include <asm/cpufeature.h>
 
 #define PFX            "speedstep-centrino: "
-#define MAINTAINER     "cpufreq@lists.linux.org.uk"
+#define MAINTAINER     "cpufreq@vger.kernel.org"
 
 #define dprintk(msg...) \
        cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg)
index b117d7f8a5640fe51091f46247671dff5d61524e..885c8265e6b5baf2178d3f8da74257635abf58d3 100644 (file)
@@ -834,7 +834,7 @@ static int __init enable_mtrr_cleanup_setup(char *str)
                enable_mtrr_cleanup = 1;
        return 0;
 }
-early_param("enble_mtrr_cleanup", enable_mtrr_cleanup_setup);
+early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup);
 
 struct var_mtrr_state {
        unsigned long   range_startk;
index f47f0eb886b8ddeab27ec8a8fd319801c45ef503..10435a120d2227bffd79a3df193f4238049ce2b0 100644 (file)
@@ -69,6 +69,9 @@ static int gdb_x86vector = -1;
  */
 void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        gdb_regs[GDB_AX]        = regs->ax;
        gdb_regs[GDB_BX]        = regs->bx;
        gdb_regs[GDB_CX]        = regs->cx;
@@ -76,9 +79,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        gdb_regs[GDB_SI]        = regs->si;
        gdb_regs[GDB_DI]        = regs->di;
        gdb_regs[GDB_BP]        = regs->bp;
-       gdb_regs[GDB_PS]        = regs->flags;
        gdb_regs[GDB_PC]        = regs->ip;
 #ifdef CONFIG_X86_32
+       gdb_regs[GDB_PS]        = regs->flags;
        gdb_regs[GDB_DS]        = regs->ds;
        gdb_regs[GDB_ES]        = regs->es;
        gdb_regs[GDB_CS]        = regs->cs;
@@ -94,6 +97,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        gdb_regs[GDB_R13]       = regs->r13;
        gdb_regs[GDB_R14]       = regs->r14;
        gdb_regs[GDB_R15]       = regs->r15;
+       gdb_regs32[GDB_PS]      = regs->flags;
+       gdb_regs32[GDB_CS]      = regs->cs;
+       gdb_regs32[GDB_SS]      = regs->ss;
 #endif
        gdb_regs[GDB_SP]        = regs->sp;
 }
@@ -112,6 +118,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
  */
 void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        gdb_regs[GDB_AX]        = 0;
        gdb_regs[GDB_BX]        = 0;
        gdb_regs[GDB_CX]        = 0;
@@ -129,8 +138,10 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
        gdb_regs[GDB_FS]        = 0xFFFF;
        gdb_regs[GDB_GS]        = 0xFFFF;
 #else
-       gdb_regs[GDB_PS]        = *(unsigned long *)(p->thread.sp + 8);
-       gdb_regs[GDB_PC]        = 0;
+       gdb_regs32[GDB_PS]      = *(unsigned long *)(p->thread.sp + 8);
+       gdb_regs32[GDB_CS]      = __KERNEL_CS;
+       gdb_regs32[GDB_SS]      = __KERNEL_DS;
+       gdb_regs[GDB_PC]        = p->thread.ip;
        gdb_regs[GDB_R8]        = 0;
        gdb_regs[GDB_R9]        = 0;
        gdb_regs[GDB_R10]       = 0;
@@ -153,6 +164,9 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
  */
 void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
 {
+#ifndef CONFIG_X86_32
+       u32 *gdb_regs32 = (u32 *)gdb_regs;
+#endif
        regs->ax                = gdb_regs[GDB_AX];
        regs->bx                = gdb_regs[GDB_BX];
        regs->cx                = gdb_regs[GDB_CX];
@@ -160,9 +174,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        regs->si                = gdb_regs[GDB_SI];
        regs->di                = gdb_regs[GDB_DI];
        regs->bp                = gdb_regs[GDB_BP];
-       regs->flags             = gdb_regs[GDB_PS];
        regs->ip                = gdb_regs[GDB_PC];
 #ifdef CONFIG_X86_32
+       regs->flags             = gdb_regs[GDB_PS];
        regs->ds                = gdb_regs[GDB_DS];
        regs->es                = gdb_regs[GDB_ES];
        regs->cs                = gdb_regs[GDB_CS];
@@ -175,6 +189,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
        regs->r13               = gdb_regs[GDB_R13];
        regs->r14               = gdb_regs[GDB_R14];
        regs->r15               = gdb_regs[GDB_R15];
+       regs->flags             = gdb_regs32[GDB_PS];
+       regs->cs                = gdb_regs32[GDB_CS];
+       regs->ss                = gdb_regs32[GDB_SS];
 #endif
 }
 
@@ -378,10 +395,8 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
                if (remcomInBuffer[0] == 's') {
                        linux_regs->flags |= X86_EFLAGS_TF;
                        kgdb_single_step = 1;
-                       if (kgdb_contthread) {
-                               atomic_set(&kgdb_cpu_doing_single_step,
-                                          raw_smp_processor_id());
-                       }
+                       atomic_set(&kgdb_cpu_doing_single_step,
+                                  raw_smp_processor_id());
                }
 
                get_debugreg(dr6, 6);
@@ -440,12 +455,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
                return NOTIFY_DONE;
 
        case DIE_NMI_IPI:
-               if (atomic_read(&kgdb_active) != -1) {
-                       /* KGDB CPU roundup */
-                       kgdb_nmicallback(raw_smp_processor_id(), regs);
-                       was_in_debug_nmi[raw_smp_processor_id()] = 1;
-                       touch_nmi_watchdog();
-               }
+               /* Just ignore, we will handle the roundup on DIE_NMI. */
                return NOTIFY_DONE;
 
        case DIE_NMIUNKNOWN:
@@ -466,9 +476,15 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
 
        case DIE_DEBUG:
                if (atomic_read(&kgdb_cpu_doing_single_step) ==
-                       raw_smp_processor_id() &&
-                       user_mode(regs))
-                       return single_step_cont(regs, args);
+                   raw_smp_processor_id()) {
+                       if (user_mode(regs))
+                               return single_step_cont(regs, args);
+                       break;
+               } else if (test_thread_flag(TIF_SINGLESTEP))
+                       /* This means a user thread is single stepping
+                        * a system call which should be ignored
+                        */
+                       return NOTIFY_DONE;
                /* fall through */
        default:
                if (user_mode(regs))
index 49285f8fd4d54005d5efb9a9fad6bc498420e6d6..be33a5442d8205f958a0eb2ed5121b020b3ff32b 100644 (file)
@@ -626,7 +626,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        struct pci_dev *dev;
        void *gatt;
        int i, error;
-       unsigned long start_pfn, end_pfn;
 
        printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
        aper_size = aper_base = info->aper_size = 0;
@@ -672,12 +671,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
        printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
               aper_base, aper_size>>10);
 
-       /* need to map that range */
-       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
-       if (end_pfn > max_low_pfn_mapped) {
-               start_pfn = (aper_base>>PAGE_SHIFT);
-               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
-       }
        return 0;
 
  nommu:
@@ -727,7 +720,8 @@ void __init gart_iommu_init(void)
 {
        struct agp_kern_info info;
        unsigned long iommu_start;
-       unsigned long aper_size;
+       unsigned long aper_base, aper_size;
+       unsigned long start_pfn, end_pfn;
        unsigned long scratch;
        long i;
 
@@ -765,8 +759,16 @@ void __init gart_iommu_init(void)
                return;
        }
 
+       /* need to map that range */
+       aper_size = info.aper_size << 20;
+       aper_base = info.aper_base;
+       end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
+       if (end_pfn > max_low_pfn_mapped) {
+               start_pfn = (aper_base>>PAGE_SHIFT);
+               init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
+       }
+
        printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
-       aper_size = info.aper_size * 1024 * 1024;
        iommu_size = check_iommu_size(info.aper_base, aper_size);
        iommu_pages = iommu_size >> PAGE_SHIFT;
 
index 7fc4d5b0a6a0f99a4d1d9c4df685a5a4d3a135bb..876e91890777ae9758e5efcb7dc72075a26e341e 100644 (file)
@@ -246,6 +246,14 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
        return 1;
 }
 
+static cpumask_t c1e_mask = CPU_MASK_NONE;
+static int c1e_detected;
+
+void c1e_remove_cpu(int cpu)
+{
+       cpu_clear(cpu, c1e_mask);
+}
+
 /*
  * C1E aware idle routine. We check for C1E active in the interrupt
  * pending message MSR. If we detect C1E, then we handle it the same
@@ -253,9 +261,6 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
  */
 static void c1e_idle(void)
 {
-       static cpumask_t c1e_mask = CPU_MASK_NONE;
-       static int c1e_detected;
-
        if (need_resched())
                return;
 
@@ -265,8 +270,10 @@ static void c1e_idle(void)
                rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
                if (lo & K8_INTP_C1E_ACTIVE_MASK) {
                        c1e_detected = 1;
-                       mark_tsc_unstable("TSC halt in C1E");
-                       printk(KERN_INFO "System has C1E enabled\n");
+                       if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
+                               mark_tsc_unstable("TSC halt in AMD C1E");
+                       printk(KERN_INFO "System has AMD C1E enabled\n");
+                       set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
                }
        }
 
index 3b7a1ddcc0bce7eca8c989906fa377d4f0322f50..31f40b24bf5d72f4d62c204307a1bd826c726c32 100644 (file)
@@ -55,6 +55,7 @@
 #include <asm/tlbflush.h>
 #include <asm/cpu.h>
 #include <asm/kdebug.h>
+#include <asm/idle.h>
 
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
@@ -88,6 +89,7 @@ static void cpu_exit_clear(void)
        cpu_clear(cpu, cpu_callin_map);
 
        numa_remove_cpu(cpu);
+       c1e_remove_cpu(cpu);
 }
 
 /* We don't actually take CPU down, just spin without interrupts. */
index 71553b664e2af8601361a9af3413599b752a3e5c..e12e0e4dd2566c2959623d4475053c5fcbcd65d3 100644 (file)
@@ -93,6 +93,8 @@ DECLARE_PER_CPU(int, cpu_state);
 static inline void play_dead(void)
 {
        idle_task_exit();
+       c1e_remove_cpu(raw_smp_processor_id());
+
        mb();
        /* Ack it */
        __get_cpu_var(cpu_state) = CPU_DEAD;
index 6ca515d6db543b9a7739b9f2f9ab39d181ed3f9b..edfb09f304795efea2858120d71533d1f20d5338 100644 (file)
@@ -235,7 +235,7 @@ static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
                                const void *desc)
 {
        u32 *ldt_entry = (u32 *)desc;
-       vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
+       vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
 }
 
 static void vmi_load_sp0(struct tss_struct *tss,
index 0c029e8959c7f7221d4687b8465812393e1faff0..7766d36983fcd7440f82435bcfbbcd37c1d80a6b 100644 (file)
@@ -61,7 +61,7 @@ static void vsmp_irq_enable(void)
        native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
 }
 
-static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf,
+static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf,
                                  unsigned long addr, unsigned len)
 {
        switch (type) {
index 0227694f7dab9b156350eaef0e90f79e8ec2ecc4..8a5f1614a3d57cde8d7495c1b71f8e8542e99c64 100644 (file)
@@ -295,10 +295,12 @@ static void nmi_cpu_shutdown(void *dummy)
 
 static void nmi_shutdown(void)
 {
-       struct op_msrs *msrs = &get_cpu_var(cpu_msrs);
+       struct op_msrs *msrs;
+
        nmi_enabled = 0;
        on_each_cpu(nmi_cpu_shutdown, NULL, 1);
        unregister_die_notifier(&profile_exceptions_nb);
+       msrs = &get_cpu_var(cpu_msrs);
        model->shutdown(msrs);
        free_msrs();
        put_cpu_var(cpu_msrs);
index 0a5f6b2114c592acb481641d0bbadebb7d06ae30..d672cfe7ca5960997949ebede8bda6cd1088bbb8 100644 (file)
@@ -376,6 +376,8 @@ int braille_register_console(struct console *console, int index,
        console->flags |= CON_ENABLED;
        console->index = index;
        braille_co = console;
+       register_keyboard_notifier(&keyboard_notifier_block);
+       register_vt_notifier(&vt_notifier_block);
        return 0;
 }
 
@@ -383,15 +385,8 @@ int braille_unregister_console(struct console *console)
 {
        if (braille_co != console)
                return -EINVAL;
+       unregister_keyboard_notifier(&keyboard_notifier_block);
+       unregister_vt_notifier(&vt_notifier_block);
        braille_co = NULL;
        return 0;
 }
-
-static int __init braille_init(void)
-{
-       register_keyboard_notifier(&keyboard_notifier_block);
-       register_vt_notifier(&vt_notifier_block);
-       return 0;
-}
-
-console_initcall(braille_init);
index 5f1127ad5a9538fde4cdaa8e4a6658f2880928a7..bbad9b6c2c887273a6e66d8e98a6028ee1fec297 100644 (file)
@@ -454,8 +454,8 @@ static int acpi_memory_device_start (struct acpi_device *device)
                /* call add_memory func */
                result = acpi_memory_enable_device(mem_device);
                if (result)
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error in acpi_memory_enable_device\n"));
+                       printk(KERN_ERR PREFIX
+                               "Error in acpi_memory_enable_device\n");
        }
        return result;
 }
index d3d0886d637f4f6e33e7a0f0ed54fe00560d2615..3f7adf683d4eb24ba267c6e50a525c2eb4085c70 100644 (file)
@@ -42,7 +42,7 @@
 
 #define ASUS_ACPI_VERSION "0.30"
 
-#define PROC_ASUS       "asus" //the directory
+#define PROC_ASUS       "asus" /* The directory */
 #define PROC_MLED       "mled"
 #define PROC_WLED       "wled"
 #define PROC_TLED       "tled"
 /*
  * Flags for hotk status
  */
-#define MLED_ON     0x01       //mail LED
-#define WLED_ON     0x02       //wireless LED
-#define TLED_ON     0x04       //touchpad LED
-#define BT_ON       0x08       //internal Bluetooth
+#define MLED_ON     0x01       /* Mail LED */
+#define WLED_ON     0x02       /* Wireless LED */
+#define TLED_ON     0x04       /* Touchpad LED */
+#define BT_ON       0x08       /* Internal Bluetooth */
 
 MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
 MODULE_DESCRIPTION(ACPI_HOTK_NAME);
@@ -82,28 +82,28 @@ MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus");
 module_param(asus_gid, uint, 0);
 MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus");
 
-/* For each model, all features implemented, 
+/* For each model, all features implemented,
  * those marked with R are relative to HOTK, A for absolute */
 struct model_data {
-       char *name;             //name of the laptop________________A
-       char *mt_mled;          //method to handle mled_____________R
-       char *mled_status;      //node to handle mled reading_______A
-       char *mt_wled;          //method to handle wled_____________R
-       char *wled_status;      //node to handle wled reading_______A
-       char *mt_tled;          //method to handle tled_____________R
-       char *tled_status;      //node to handle tled reading_______A
-       char *mt_ledd;          //method to handle LED display______R
-       char *mt_bt_switch;     //method to switch Bluetooth on/off_R
-       char *bt_status;        //no model currently supports this__?
-       char *mt_lcd_switch;    //method to turn LCD on/off_________A
-       char *lcd_status;       //node to read LCD panel state______A
-       char *brightness_up;    //method to set brightness up_______A
-       char *brightness_down;  //guess what ?______________________A
-       char *brightness_set;   //method to set absolute brightness_R
-       char *brightness_get;   //method to get absolute brightness_R
-       char *brightness_status;        //node to get brightness____________A
-       char *display_set;      //method to set video output________R
-       char *display_get;      //method to get video output________R
+       char *name;             /* name of the laptop________________A */
+       char *mt_mled;          /* method to handle mled_____________R */
+       char *mled_status;      /* node to handle mled reading_______A */
+       char *mt_wled;          /* method to handle wled_____________R */
+       char *wled_status;      /* node to handle wled reading_______A */
+       char *mt_tled;          /* method to handle tled_____________R */
+       char *tled_status;      /* node to handle tled reading_______A */
+       char *mt_ledd;          /* method to handle LED display______R */
+       char *mt_bt_switch;     /* method to switch Bluetooth on/off_R */
+       char *bt_status;        /* no model currently supports this__? */
+       char *mt_lcd_switch;    /* method to turn LCD on/off_________A */
+       char *lcd_status;       /* node to read LCD panel state______A */
+       char *brightness_up;    /* method to set brightness up_______A */
+       char *brightness_down;  /* method to set brightness down ____A */
+       char *brightness_set;   /* method to set absolute brightness_R */
+       char *brightness_get;   /* method to get absolute brightness_R */
+       char *brightness_status;/* node to get brightness____________A */
+       char *display_set;      /* method to set video output________R */
+       char *display_get;      /* method to get video output________R */
 };
 
 /*
@@ -111,41 +111,41 @@ struct model_data {
  * about the hotk device
  */
 struct asus_hotk {
-       struct acpi_device *device;     //the device we are in
-       acpi_handle handle;     //the handle of the hotk device
-       char status;            //status of the hotk, for LEDs, ...
-       u32 ledd_status;        //status of the LED display
-       struct model_data *methods;     //methods available on the laptop
-       u8 brightness;          //brightness level
+       struct acpi_device *device;     /* the device we are in */
+       acpi_handle handle;             /* the handle of the hotk device */
+       char status;                    /* status of the hotk, for LEDs */
+       u32 ledd_status;                /* status of the LED display */
+       struct model_data *methods;     /* methods available on the laptop */
+       u8 brightness;                  /* brightness level */
        enum {
-               A1x = 0,        //A1340D, A1300F
-               A2x,            //A2500H
-               A4G,            //A4700G
-               D1x,            //D1
-               L2D,            //L2000D
-               L3C,            //L3800C
-               L3D,            //L3400D
-               L3H,            //L3H, L2000E, L5D
-               L4R,            //L4500R
-               L5x,            //L5800C 
-               L8L,            //L8400L
-               M1A,            //M1300A
-               M2E,            //M2400E, L4400L
-               M6N,            //M6800N, W3400N
-               M6R,            //M6700R, A3000G
-               P30,            //Samsung P30
-               S1x,            //S1300A, but also L1400B and M2400A (L84F)
-               S2x,            //S200 (J1 reported), Victor MP-XP7210
-               W1N,            //W1000N
-               W5A,            //W5A
-               W3V,            //W3030V
-               xxN,            //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N
-               A4S,            //Z81sp
-               //(Centrino)
-               F3Sa,
+               A1x = 0,        /* A1340D, A1300F */
+               A2x,            /* A2500H */
+               A4G,            /* A4700G */
+               D1x,            /* D1 */
+               L2D,            /* L2000D */
+               L3C,            /* L3800C */
+               L3D,            /* L3400D */
+               L3H,            /* L3H, L2000E, L5D */
+               L4R,            /* L4500R */
+               L5x,            /* L5800C */
+               L8L,            /* L8400L */
+               M1A,            /* M1300A */
+               M2E,            /* M2400E, L4400L */
+               M6N,            /* M6800N, W3400N */
+               M6R,            /* M6700R, A3000G */
+               P30,            /* Samsung P30 */
+               S1x,            /* S1300A, but also L1400B and M2400A (L84F) */
+               S2x,            /* S200 (J1 reported), Victor MP-XP7210 */
+               W1N,            /* W1000N */
+               W5A,            /* W5A */
+               W3V,            /* W3030V */
+               xxN,            /* M2400N, M3700N, M5200N, M6800N,
+                                                        S1300N, S5200N*/
+               A4S,            /* Z81sp */
+               F3Sa,           /* (Centrino) */
                END_MODEL
-       } model;                //Models currently supported
-       u16 event_count[128];   //count for each event TODO make this better
+       } model;                /* Models currently supported */
+       u16 event_count[128];   /* Count for each event TODO make this better */
 };
 
 /* Here we go */
@@ -459,18 +459,18 @@ static struct acpi_driver asus_hotk_driver = {
                },
 };
 
-/* 
+/*
  * This function evaluates an ACPI method, given an int as parameter, the
  * method is searched within the scope of the handle, can be NULL. The output
  * of the method is written is output, which can also be NULL
  *
- * returns 1 if write is successful, 0 else. 
+ * returns 1 if write is successful, 0 else.
  */
 static int write_acpi_int(acpi_handle handle, const char *method, int val,
                          struct acpi_buffer *output)
 {
-       struct acpi_object_list params; //list of input parameters (an int here)
-       union acpi_object in_obj;       //the only param we use
+       struct acpi_object_list params; /* list of input parameters (int) */
+       union acpi_object in_obj;       /* the only param we use */
        acpi_status status;
 
        params.count = 1;
@@ -507,18 +507,18 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
 {
        int len = 0;
        int temp;
-       char buf[16];           //enough for all info
+       char buf[16];           /* enough for all info */
        /*
-        * We use the easy way, we don't care of off and count, so we don't set eof
-        * to 1
+        * We use the easy way, we don't care of off and count,
+        * so we don't set eof to 1
         */
 
        len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
        len += sprintf(page + len, "Model reference    : %s\n",
                       hotk->methods->name);
-       /* 
-        * The SFUN method probably allows the original driver to get the list 
-        * of features supported by a given model. For now, 0x0100 or 0x0800 
+       /*
+        * The SFUN method probably allows the original driver to get the list
+        * of features supported by a given model. For now, 0x0100 or 0x0800
         * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card.
         * The significance of others is yet to be found.
         */
@@ -528,7 +528,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
        /*
         * Another value for userspace: the ASYM method returns 0x02 for
         * battery low and 0x04 for battery critical, its readings tend to be
-        * more accurate than those provided by _BST. 
+        * more accurate than those provided by _BST.
         * Note: since not all the laptops provide this method, errors are
         * silently ignored.
         */
@@ -579,7 +579,7 @@ static int read_led(const char *ledname, int ledmask)
        return (hotk->status & ledmask) ? 1 : 0;
 }
 
-static int parse_arg(const char __user * buf, unsigned long count, int *val)
+static int parse_arg(const char __user *buf, unsigned long count, int *val)
 {
        char s[32];
        if (!count)
@@ -596,7 +596,7 @@ static int parse_arg(const char __user * buf, unsigned long count, int *val)
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char __user * buffer, unsigned long count,
+write_led(const char __user *buffer, unsigned long count,
          char *ledname, int ledmask, int invert)
 {
        int rv, value;
@@ -631,7 +631,7 @@ proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_mled(struct file *file, const char __user * buffer,
+proc_write_mled(struct file *file, const char __user *buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
@@ -648,7 +648,7 @@ proc_read_ledd(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_ledd(struct file *file, const char __user * buffer,
+proc_write_ledd(struct file *file, const char __user *buffer,
                unsigned long count, void *data)
 {
        int rv, value;
@@ -677,7 +677,7 @@ proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_wled(struct file *file, const char __user * buffer,
+proc_write_wled(struct file *file, const char __user *buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
@@ -694,10 +694,10 @@ proc_read_bluetooth(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_bluetooth(struct file *file, const char __user * buffer,
+proc_write_bluetooth(struct file *file, const char __user *buffer,
                     unsigned long count, void *data)
 {
-       /* Note: mt_bt_switch controls both internal Bluetooth adapter's 
+       /* Note: mt_bt_switch controls both internal Bluetooth adapter's
           presence and its LED */
        return write_led(buffer, count, hotk->methods->mt_bt_switch, BT_ON, 0);
 }
@@ -714,7 +714,7 @@ proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_tled(struct file *file, const char __user * buffer,
+proc_write_tled(struct file *file, const char __user *buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
@@ -734,7 +734,7 @@ static int get_lcd_state(void)
 
                input.count = 2;
                input.pointer = mt_params;
-               /* Note: the following values are partly guessed up, but 
+               /* Note: the following values are partly guessed up, but
                   otherwise they seem to work */
                mt_params[0].type = ACPI_TYPE_INTEGER;
                mt_params[0].integer.value = 0x02;
@@ -796,12 +796,13 @@ static int set_lcd_state(int value)
                            acpi_evaluate_object(NULL,
                                                 hotk->methods->mt_lcd_switch,
                                                 NULL, NULL);
-               } else {        /* L3H and the like have to be handled differently */
+               } else {
+                       /* L3H and the like must be handled differently */
                        if (!write_acpi_int
                            (hotk->handle, hotk->methods->mt_lcd_switch, 0x07,
                             NULL))
                                status = AE_ERROR;
-                       /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, 
+                       /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress,
                           the exact behaviour is simulated here */
                }
                if (ACPI_FAILURE(status))
@@ -819,7 +820,7 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_lcd(struct file *file, const char __user * buffer,
+proc_write_lcd(struct file *file, const char __user *buffer,
               unsigned long count, void *data)
 {
        int rv, value;
@@ -897,7 +898,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_brn(struct file *file, const char __user * buffer,
+proc_write_brn(struct file *file, const char __user *buffer,
               unsigned long count, void *data)
 {
        int rv, value;
@@ -921,7 +922,7 @@ static void set_display(int value)
 }
 
 /*
- * Now, *this* one could be more user-friendly, but so far, no-one has 
+ * Now, *this* one could be more user-friendly, but so far, no-one has
  * complained. The significance of bits is the same as in proc_write_disp()
  */
 static int
@@ -933,18 +934,18 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
        if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
                printk(KERN_WARNING
                       "Asus ACPI: Error reading display status\n");
-       value &= 0x07;          /* needed for some models, shouldn't hurt others */
+       value &= 0x07;  /* needed for some models, shouldn't hurt others */
        return sprintf(page, "%d\n", value);
 }
 
 /*
- * Experimental support for display switching. As of now: 1 should activate 
- * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination 
- * (bitwise) of these will suffice. I never actually tested 3 displays hooked up 
- * simultaneously, so be warned. See the acpi4asus README for more info.
+ * Experimental support for display switching. As of now: 1 should activate
+ * the LCD output, 2 should do for CRT, and 4 for TV-Out. Any combination
+ * (bitwise) of these will suffice. I never actually tested 3 displays hooked
+ * up simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char __user * buffer,
+proc_write_disp(struct file *file, const char __user *buffer,
                unsigned long count, void *data)
 {
        int rv, value;
@@ -957,12 +958,12 @@ proc_write_disp(struct file *file, const char __user * buffer,
 
 typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
                             int *eof, void *data);
-typedef int (proc_writefunc) (struct file * file, const char __user * buffer,
+typedef int (proc_writefunc) (struct file *file, const char __user *buffer,
                              unsigned long count, void *data);
 
 static int
-asus_proc_add(char *name, proc_writefunc * writefunc,
-                    proc_readfunc * readfunc, mode_t mode,
+asus_proc_add(char *name, proc_writefunc *writefunc,
+                    proc_readfunc *readfunc, mode_t mode,
                     struct acpi_device *device)
 {
        struct proc_dir_entry *proc =
@@ -1040,9 +1041,9 @@ static int asus_hotk_add_fs(struct acpi_device *device)
                              &proc_read_bluetooth, mode, device);
        }
 
-       /* 
-        * We need both read node and write method as LCD switch is also accessible
-        * from keyboard 
+       /*
+        * We need both read node and write method as LCD switch is also
+        * accessible from the keyboard
         */
        if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
                asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode,
@@ -1096,11 +1097,10 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
        if (!hotk)
                return;
 
-       if ((event & ~((u32) BR_UP)) < 16) {
+       if ((event & ~((u32) BR_UP)) < 16)
                hotk->brightness = (event & ~((u32) BR_UP));
-       } else if ((event & ~((u32) BR_DOWN)) < 16) {
+       else if ((event & ~((u32) BR_DOWN)) < 16)
                hotk->brightness = (event & ~((u32) BR_DOWN));
-       }
 
        acpi_bus_generate_proc_event(hotk->device, event,
                                hotk->event_count[event % 128]++);
@@ -1186,8 +1186,8 @@ static int asus_hotk_get_info(void)
        acpi_status status;
 
        /*
-        * Get DSDT headers early enough to allow for differentiating between 
-        * models, but late enough to allow acpi_bus_register_driver() to fail 
+        * Get DSDT headers early enough to allow for differentiating between
+        * models, but late enough to allow acpi_bus_register_driver() to fail
         * before doing anything ACPI-specific. Should we encounter a machine,
         * which needs special handling (i.e. its hotkey device has a different
         * HID), this bit will be moved. A global variable asus_info contains
@@ -1212,8 +1212,8 @@ static int asus_hotk_get_info(void)
 
        /*
         * Try to match the object returned by INIT to the specific model.
-        * Handle every possible object (or the lack of thereof) the DSDT 
-        * writers might throw at us. When in trouble, we pass NULL to 
+        * Handle every possible object (or the lack of thereof) the DSDT
+        * writers might throw at us. When in trouble, we pass NULL to
         * asus_model_match() and try something completely different.
         */
        if (buffer.pointer) {
@@ -1254,7 +1254,7 @@ static int asus_hotk_get_info(void)
        /* Sort of per-model blacklist */
        if (strncmp(string, "L2B", 3) == 0)
                hotk->methods->lcd_status = NULL;
-       /* L2B is similar enough to L3C to use its settings, with this only 
+       /* L2B is similar enough to L3C to use its settings, with this only
           exception */
        else if (strncmp(string, "A3G", 3) == 0)
                hotk->methods->lcd_status = "\\BLFG";
@@ -1366,10 +1366,9 @@ static int asus_hotk_add(struct acpi_device *device)
        /* LED display is off by default */
        hotk->ledd_status = 0xFFF;
 
-      end:
-       if (result) {
+end:
+       if (result)
                kfree(hotk);
-       }
 
        return result;
 }
@@ -1394,8 +1393,8 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
 }
 
 static struct backlight_ops asus_backlight_data = {
-        .get_brightness = read_brightness,
-        .update_status  = set_brightness_status,
+       .get_brightness = read_brightness,
+       .update_status  = set_brightness_status,
 };
 
 static void asus_acpi_exit(void)
@@ -1442,15 +1441,15 @@ static int __init asus_acpi_init(void)
                return -ENODEV;
        }
 
-       asus_backlight_device = backlight_device_register("asus",NULL,NULL,
+       asus_backlight_device = backlight_device_register("asus", NULL, NULL,
                                                          &asus_backlight_data);
-        if (IS_ERR(asus_backlight_device)) {
+       if (IS_ERR(asus_backlight_device)) {
                printk(KERN_ERR "Could not register asus backlight device\n");
                asus_backlight_device = NULL;
                asus_acpi_exit();
                return -ENODEV;
        }
-        asus_backlight_device->props.max_brightness = 15;
+       asus_backlight_device->props.max_brightness = 15;
 
        return 0;
 }
index 0dc44945725ef1c53e0ae0c5f9ebbbd220256675..e6311f432edf7f24d2c42fbaf73a23e65a035369 100644 (file)
@@ -48,6 +48,23 @@ EXPORT_SYMBOL(acpi_root_dir);
 
 #define STRUCT_TO_INT(s)       (*((int*)&s))
 
+static int set_power_nocheck(const struct dmi_system_id *id)
+{
+       printk(KERN_NOTICE PREFIX "%s detected - "
+               "disable power check in power transistion\n", id->ident);
+       acpi_power_nocheck = 1;
+       return 0;
+}
+static struct dmi_system_id __cpuinitdata power_nocheck_dmi_table[] = {
+       {
+       set_power_nocheck, "HP Pavilion 05", {
+       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+       DMI_MATCH(DMI_SYS_VENDOR, "HP Pavilion 05"),
+       DMI_MATCH(DMI_PRODUCT_VERSION, "2001211RE101GLEND") }, NULL},
+       {},
+};
+
+
 /* --------------------------------------------------------------------------
                                 Device Management
    -------------------------------------------------------------------------- */
@@ -95,21 +112,21 @@ int acpi_bus_get_status(struct acpi_device *device)
        }
 
        /*
-        * Otherwise we assume the status of our parent (unless we don't
-        * have one, in which case status is implied).
+        * According to ACPI spec some device can be present and functional
+        * even if the parent is not present but functional.
+        * In such conditions the child device should not inherit the status
+        * from the parent.
         */
-       else if (device->parent)
-               device->status = device->parent->status;
        else
                STRUCT_TO_INT(device->status) =
                    ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED |
                    ACPI_STA_DEVICE_UI      | ACPI_STA_DEVICE_FUNCTIONING;
 
        if (device->status.functional && !device->status.present) {
-               printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
-                      "functional but not present; setting present\n",
-                      device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
-               device->status.present = 1;
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
+                      "functional but not present;\n",
+                       device->pnp.bus_id,
+                       (u32) STRUCT_TO_INT(device->status)));
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
@@ -223,7 +240,19 @@ int acpi_bus_set_power(acpi_handle handle, int state)
        /*
         * Get device's current power state
         */
-       acpi_bus_get_power(device->handle, &device->power.state);
+       if (!acpi_power_nocheck) {
+               /*
+                * Maybe the incorrect power state is returned on the bogus
+                * bios, which is different with the real power state.
+                * For example: the bios returns D0 state and the real power
+                * state is D3. OS expects to set the device to D0 state. In
+                * such case if OS uses the power state returned by the BIOS,
+                * the device can't be transisted to the correct power state.
+                * So if the acpi_power_nocheck is set, it is unnecessary to
+                * get the power state by calling acpi_bus_get_power.
+                */
+               acpi_bus_get_power(device->handle, &device->power.state);
+       }
        if ((state == device->power.state) && !device->flags.force_power_state) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
                                  state));
@@ -833,7 +862,11 @@ static int __init acpi_init(void)
                }
        } else
                disable_acpi();
-
+       /*
+        * If the laptop falls into the DMI check table, the power state check
+        * will be disabled in the course of device power transistion.
+        */
+       dmi_check_system(power_nocheck_dmi_table);
        return result;
 }
 
index f9db4f444bd0f814fe4ffbec8252e4227df981dc..4441e84b28a9a2e652d00445d2dbf1b722ac8e90 100644 (file)
@@ -52,8 +52,8 @@ struct proc_dir_entry *acpi_lock_ac_dir(void)
        if (acpi_ac_dir) {
                lock_ac_dir_cnt++;
        } else {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Cannot create %s\n", ACPI_AC_CLASS));
+               printk(KERN_ERR PREFIX
+                                 "Cannot create %s\n", ACPI_AC_CLASS);
        }
        mutex_unlock(&cm_sbs_mutex);
        return acpi_ac_dir;
@@ -83,8 +83,8 @@ struct proc_dir_entry *acpi_lock_battery_dir(void)
        if (acpi_battery_dir) {
                lock_battery_dir_cnt++;
        } else {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Cannot create %s\n", ACPI_BATTERY_CLASS));
+               printk(KERN_ERR PREFIX
+                                 "Cannot create %s\n", ACPI_BATTERY_CLASS);
        }
        mutex_unlock(&cm_sbs_mutex);
        return acpi_battery_dir;
index 6df564f4ca6ed4bf48c1284f3c7d2807986b1f77..abf36b4b1d1d828ba7024ef3ddf49df5c9d1310f 100644 (file)
@@ -47,8 +47,6 @@ static const struct acpi_dlayer acpi_debug_layers[] = {
 };
 
 static const struct acpi_dlevel acpi_debug_levels[] = {
-       ACPI_DEBUG_INIT(ACPI_LV_ERROR),
-       ACPI_DEBUG_INIT(ACPI_LV_WARN),
        ACPI_DEBUG_INIT(ACPI_LV_INIT),
        ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT),
        ACPI_DEBUG_INIT(ACPI_LV_INFO),
index 4613b9ca57929f5c4ba867c6f8aa496a887d3dbe..279a5a60a0dd492a2b27f144b12b353b9de78a2a 100644 (file)
@@ -103,6 +103,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
                                                    NULL);
                acpi_ex_enter_interpreter();
        }
+
+       acpi_ds_clear_implicit_return(walk_state);
+
 #ifdef ACPI_DISASSEMBLER
        if (ACPI_FAILURE(status)) {
 
index 13c43eac35dba9570b0dc2ad8bf9a0c866a2d312..d03f81bd1bcb01f02cd6704732c37d54a2ae6822 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
@@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat")
 
 /* Local prototypes */
 static void
-acpi_ds_method_data_delete_value(u16 opcode,
+acpi_ds_method_data_delete_value(u8 type,
                                 u32 index, struct acpi_walk_state *walk_state);
 
 static acpi_status
-acpi_ds_method_data_set_value(u16 opcode,
+acpi_ds_method_data_set_value(u8 type,
                              u32 index,
                              union acpi_operand_object *object,
                              struct acpi_walk_state *walk_state);
@@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
                 * Store the argument in the method/walk descriptor.
                 * Do not copy the arg in order to implement call by reference
                 */
-               status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
+               status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index,
                                                       params[index],
                                                       walk_state);
                if (ACPI_FAILURE(status)) {
@@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
  *
  * FUNCTION:    acpi_ds_method_data_get_node
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg whose type to get
  *              walk_state          - Current walk state object
  *              Node                - Where the node is returned.
@@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_node(u16 opcode,
+acpi_ds_method_data_get_node(u8 type,
                             u32 index,
                             struct acpi_walk_state *walk_state,
                             struct acpi_namespace_node **node)
@@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode,
        /*
         * Method Locals and Arguments are supported
         */
-       switch (opcode) {
-       case AML_LOCAL_OP:
+       switch (type) {
+       case ACPI_REFCLASS_LOCAL:
 
                if (index > ACPI_METHOD_MAX_LOCAL) {
                        ACPI_ERROR((AE_INFO,
@@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode,
                *node = &walk_state->local_variables[index];
                break;
 
-       case AML_ARG_OP:
+       case ACPI_REFCLASS_ARG:
 
                if (index > ACPI_METHOD_MAX_ARG) {
                        ACPI_ERROR((AE_INFO,
@@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode,
                break;
 
        default:
-               ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
-               return_ACPI_STATUS(AE_AML_BAD_OPCODE);
+               ACPI_ERROR((AE_INFO, "Type %d is invalid", type));
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        return_ACPI_STATUS(AE_OK);
@@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode,
  *
  * FUNCTION:    acpi_ds_method_data_set_value
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg to get
  *              Object              - Object to be inserted into the stack entry
  *              walk_state          - Current walk state object
@@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode,
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_method_data_set_value(u16 opcode,
+acpi_ds_method_data_set_value(u8 type,
                              u32 index,
                              union acpi_operand_object *object,
                              struct acpi_walk_state *walk_state)
@@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode,
        ACPI_FUNCTION_TRACE(ds_method_data_set_value);
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                         "NewObj %p Opcode %X, Refs=%d [%s]\n", object,
-                         opcode, object->common.reference_count,
+                         "NewObj %p Type %2.2X, Refs=%d [%s]\n", object,
+                         type, object->common.reference_count,
                          acpi_ut_get_type_name(object->common.type)));
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -350,7 +351,8 @@ 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
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which local_var or argument to get
  *              walk_state          - Current walk state object
  *              dest_desc           - Where Arg or Local value is returned
@@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_value(u16 opcode,
+acpi_ds_method_data_get_value(u8 type,
                              u32 index,
                              struct acpi_walk_state *walk_state,
                              union acpi_operand_object **dest_desc)
@@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode,
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -419,8 +421,8 @@ acpi_ds_method_data_get_value(u16 opcode,
                /* Otherwise, return the error */
 
                else
-                       switch (opcode) {
-                       case AML_ARG_OP:
+                       switch (type) {
+                       case ACPI_REFCLASS_ARG:
 
                                ACPI_ERROR((AE_INFO,
                                            "Uninitialized Arg[%d] at node %p",
@@ -428,7 +430,7 @@ acpi_ds_method_data_get_value(u16 opcode,
 
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
-                       case AML_LOCAL_OP:
+                       case ACPI_REFCLASS_LOCAL:
 
                                ACPI_ERROR((AE_INFO,
                                            "Uninitialized Local[%d] at node %p",
@@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode,
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
                        default:
+
                                ACPI_ERROR((AE_INFO,
                                            "Not a Arg/Local opcode: %X",
-                                           opcode));
+                                           type));
                                return_ACPI_STATUS(AE_AML_INTERNAL);
                        }
        }
@@ -458,7 +461,8 @@ 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
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which local_var or argument to delete
  *              walk_state          - Current walk state object
  *
@@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode,
  ******************************************************************************/
 
 static void
-acpi_ds_method_data_delete_value(u16 opcode,
+acpi_ds_method_data_delete_value(u8 type,
                                 u32 index, struct acpi_walk_state *walk_state)
 {
        acpi_status status;
@@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
        if (ACPI_FAILURE(status)) {
                return_VOID;
        }
@@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode,
  *
  * FUNCTION:    acpi_ds_store_object_to_local
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg to set
  *              obj_desc            - Value to be stored
  *              walk_state          - Current walk state
@@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_store_object_to_local(u16 opcode,
+acpi_ds_store_object_to_local(u8 type,
                              u32 index,
                              union acpi_operand_object *obj_desc,
                              struct acpi_walk_state *walk_state)
@@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode,
        union acpi_operand_object *new_obj_desc;
 
        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));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
+                         type, index, obj_desc));
 
        /* Parameter validation */
 
@@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode,
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode,
                 *
                 * Weird, but true.
                 */
-               if (opcode == AML_ARG_OP) {
+               if (type == ACPI_REFCLASS_ARG) {
                        /*
                         * If we have a valid reference object that came from ref_of(),
                         * do the indirect store
@@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode,
                             ACPI_DESC_TYPE_OPERAND)
                            && (current_obj_desc->common.type ==
                                ACPI_TYPE_LOCAL_REFERENCE)
-                           && (current_obj_desc->reference.opcode ==
-                               AML_REF_OF_OP)) {
+                           && (current_obj_desc->reference.class ==
+                               ACPI_REFCLASS_REFOF)) {
                                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                                                  "Arg (%p) is an ObjRef(Node), storing in node %p\n",
                                                  new_obj_desc,
@@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode,
                        }
                }
 
-               /*
-                * Delete the existing object
-                * before storing the new one
-                */
-               acpi_ds_method_data_delete_value(opcode, index, walk_state);
+               /* Delete the existing object before storing the new one */
+
+               acpi_ds_method_data_delete_value(type, index, walk_state);
        }
 
        /*
@@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode,
         * (increments the object reference count by one)
         */
        status =
-           acpi_ds_method_data_set_value(opcode, index, new_obj_desc,
+           acpi_ds_method_data_set_value(type, index, new_obj_desc,
                                          walk_state);
 
        /* Remove local reference if we copied the object above */
index 0f280589921025c5e8f9f4e8caebc3ea5efc21b0..4f08e599d07e2a62eb257fefa2b6ba812b132578 100644 (file)
@@ -731,54 +731,70 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
                switch (op_info->type) {
                case AML_TYPE_LOCAL_VARIABLE:
 
-                       /* Split the opcode into a base opcode + offset */
+                       /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
 
-                       obj_desc->reference.opcode = AML_LOCAL_OP;
-                       obj_desc->reference.offset = opcode - AML_LOCAL_OP;
+                       obj_desc->reference.value = opcode - AML_LOCAL_OP;
+                       obj_desc->reference.class = ACPI_REFCLASS_LOCAL;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-                       status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
-                                                             obj_desc->
-                                                             reference.offset,
-                                                             walk_state,
-                                                             (struct
-                                                              acpi_namespace_node
-                                                              **)&obj_desc->
-                                                             reference.object);
+                       status =
+                           acpi_ds_method_data_get_node(ACPI_REFCLASS_LOCAL,
+                                                        obj_desc->reference.
+                                                        value, walk_state,
+                                                        ACPI_CAST_INDIRECT_PTR
+                                                        (struct
+                                                         acpi_namespace_node,
+                                                         &obj_desc->reference.
+                                                         object));
 #endif
                        break;
 
                case AML_TYPE_METHOD_ARGUMENT:
 
-                       /* Split the opcode into a base opcode + offset */
+                       /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
 
-                       obj_desc->reference.opcode = AML_ARG_OP;
-                       obj_desc->reference.offset = opcode - AML_ARG_OP;
+                       obj_desc->reference.value = opcode - AML_ARG_OP;
+                       obj_desc->reference.class = ACPI_REFCLASS_ARG;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-                       status = acpi_ds_method_data_get_node(AML_ARG_OP,
+                       status = acpi_ds_method_data_get_node(ACPI_REFCLASS_ARG,
                                                              obj_desc->
-                                                             reference.offset,
+                                                             reference.value,
                                                              walk_state,
+                                                             ACPI_CAST_INDIRECT_PTR
                                                              (struct
-                                                              acpi_namespace_node
-                                                              **)&obj_desc->
-                                                             reference.object);
+                                                              acpi_namespace_node,
+                                                              &obj_desc->
+                                                              reference.
+                                                              object));
 #endif
                        break;
 
-               default:        /* Other literals, etc.. */
+               default:        /* Object name or Debug object */
 
-                       if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
+                       switch (op->common.aml_opcode) {
+                       case AML_INT_NAMEPATH_OP:
 
                                /* Node was saved in Op */
 
                                obj_desc->reference.node = op->common.node;
                                obj_desc->reference.object =
                                    op->common.node->object;
-                       }
+                               obj_desc->reference.class = ACPI_REFCLASS_NAME;
+                               break;
+
+                       case AML_DEBUG_OP:
 
-                       obj_desc->reference.opcode = opcode;
+                               obj_desc->reference.class = ACPI_REFCLASS_DEBUG;
+                               break;
+
+                       default:
+
+                               ACPI_ERROR((AE_INFO,
+                                           "Unimplemented reference type for AML opcode: %4.4X",
+                                           opcode));
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
+                       }
                        break;
                }
                break;
index 6a81c4400edf4767b770fcec8cfe807d8ce36ade..69fae5905bb8219af26b0e0684ae22cedc1b84dc 100644 (file)
@@ -1330,7 +1330,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
                             (walk_state->results->results.obj_desc[0]) ==
                             ACPI_TYPE_LOCAL_REFERENCE)
                            && ((walk_state->results->results.obj_desc[0])->
-                               reference.opcode != AML_INDEX_OP)) {
+                               reference.class != ACPI_REFCLASS_INDEX)) {
                                status =
                                    acpi_ex_resolve_to_value(&walk_state->
                                                             results->results.
index b5072fa9c9205210ac731f45237a22cfd52c0d8a..396fe12078cd1595f99199c8bf837be59df7f3ae 100644 (file)
@@ -166,6 +166,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
                status = AE_CTRL_FALSE;
        }
 
+       /* Predicate can be used for an implicit return value */
+
+       (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE);
+
       cleanup:
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
@@ -429,10 +433,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                             ACPI_TYPE_LOCAL_REFERENCE)
                            && (walk_state->operands[1]->common.type ==
                                ACPI_TYPE_LOCAL_REFERENCE)
-                           && (walk_state->operands[0]->reference.opcode ==
-                               walk_state->operands[1]->reference.opcode)
-                           && (walk_state->operands[0]->reference.offset ==
-                               walk_state->operands[1]->reference.offset)) {
+                           && (walk_state->operands[0]->reference.class ==
+                               walk_state->operands[1]->reference.class)
+                           && (walk_state->operands[0]->reference.value ==
+                               walk_state->operands[1]->reference.value)) {
                                status = AE_OK;
                        } else {
                                ACPI_EXCEPTION((AE_INFO, status,
index 13593f9f21970ec79af46f62b0233689065e848d..4c004286b3d9f230f23a0a52ec49105ed0ef0a1b 100644 (file)
@@ -862,8 +862,19 @@ static int ec_install_handlers(struct acpi_ec *ec)
                                                    &acpi_ec_space_handler,
                                                    NULL, ec);
        if (ACPI_FAILURE(status)) {
-               acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
-               return -ENODEV;
+               if (status == AE_NOT_FOUND) {
+                       /*
+                        * Maybe OS fails in evaluating the _REG object.
+                        * The AE_NOT_FOUND error will be ignored and OS
+                        * continue to initialize EC.
+                        */
+                       printk(KERN_ERR "Fail in evaluating the _REG object"
+                               " of EC device. Broken bios is suspected.\n");
+               } else {
+                       acpi_remove_gpe_handler(NULL, ec->gpe,
+                               &acpi_ec_gpe_handler);
+                       return -ENODEV;
+               }
        }
 
        ec->handlers_installed = 1;
index 8892b9824fae7d8acad9c214356df84c528dc9b1..74da6fa52ef183e4db2b3e9db7b24c7d75da5f12 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/actables.h>
 #include <acpi/acdispat.h>
@@ -91,13 +90,12 @@ acpi_ex_add_table(u32 table_index,
 
        /* Init the table handle */
 
-       obj_desc->reference.opcode = AML_LOAD_OP;
+       obj_desc->reference.class = ACPI_REFCLASS_TABLE;
        *ddb_handle = obj_desc;
 
        /* Install the new table into the local data structures */
 
-       obj_desc->reference.object = ACPI_CAST_PTR(void,
-                       (unsigned long)table_index);
+       obj_desc->reference.value = table_index;
 
        /* Add the table to the namespace */
 
@@ -280,6 +278,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object *ddb_handle;
+       struct acpi_table_header *table;
        struct acpi_table_desc table_desc;
        u32 table_index;
        acpi_status status;
@@ -294,9 +293,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_REGION:
 
-               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
-                                 obj_desc,
-                                 acpi_ut_get_object_type_name(obj_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Load table from Region %p\n", obj_desc));
 
                /* Region must be system_memory (from ACPI spec) */
 
@@ -316,61 +314,112 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                }
 
                /*
-                * We will simply map the memory region for the table. However, the
-                * memory region is technically not guaranteed to remain stable and
-                * we may eventually have to copy the table to a local buffer.
+                * Map the table header and get the actual table length. The region
+                * length is not guaranteed to be the same as the table length.
+                */
+               table = acpi_os_map_memory(obj_desc->region.address,
+                                          sizeof(struct acpi_table_header));
+               if (!table) {
+                       return_ACPI_STATUS(AE_NO_MEMORY);
+               }
+
+               length = table->length;
+               acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
+
+               /* Must have at least an ACPI table header */
+
+               if (length < sizeof(struct acpi_table_header)) {
+                       return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
+               }
+
+               /*
+                * The memory region is not guaranteed to remain stable and we must
+                * copy the table to a local buffer. For example, the memory region
+                * is corrupted after suspend on some machines. Dynamically loaded
+                * tables are usually small, so this overhead is minimal.
                 */
+
+               /* Allocate a buffer for the table */
+
+               table_desc.pointer = ACPI_ALLOCATE(length);
+               if (!table_desc.pointer) {
+                       return_ACPI_STATUS(AE_NO_MEMORY);
+               }
+
+               /* Map the entire table and copy it */
+
+               table = acpi_os_map_memory(obj_desc->region.address, length);
+               if (!table) {
+                       ACPI_FREE(table_desc.pointer);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
+               }
+
+               ACPI_MEMCPY(table_desc.pointer, table, length);
+               acpi_os_unmap_memory(table, length);
+
                table_desc.address = obj_desc->region.address;
-               table_desc.length = obj_desc->region.length;
-               table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED;
                break;
 
        case ACPI_TYPE_BUFFER:  /* Buffer or resolved region_field */
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "Load from Buffer or Field %p %s\n", obj_desc,
-                                 acpi_ut_get_object_type_name(obj_desc)));
-
-               length = obj_desc->buffer.length;
+                                 "Load table from Buffer or Field %p\n",
+                                 obj_desc));
 
                /* Must have at least an ACPI table header */
 
-               if (length < sizeof(struct acpi_table_header)) {
+               if (obj_desc->buffer.length < sizeof(struct acpi_table_header)) {
                        return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
                }
 
-               /* Validate checksum here. It won't get validated in tb_add_table */
+               /* Get the actual table length from the table header */
 
-               status =
-                   acpi_tb_verify_checksum(ACPI_CAST_PTR
-                                           (struct acpi_table_header,
-                                            obj_desc->buffer.pointer), length);
-               if (ACPI_FAILURE(status)) {
-                       return_ACPI_STATUS(status);
+               table =
+                   ACPI_CAST_PTR(struct acpi_table_header,
+                                 obj_desc->buffer.pointer);
+               length = table->length;
+
+               /* Table cannot extend beyond the buffer */
+
+               if (length > obj_desc->buffer.length) {
+                       return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
+               }
+               if (length < sizeof(struct acpi_table_header)) {
+                       return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
                }
 
                /*
-                * We need to copy the buffer since the original buffer could be
-                * changed or deleted in the future
+                * Copy the table from the buffer because the buffer could be modified
+                * or even deleted in the future
                 */
                table_desc.pointer = ACPI_ALLOCATE(length);
                if (!table_desc.pointer) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
-               ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer,
-                           length);
-               table_desc.length = length;
-               table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED;
+               ACPI_MEMCPY(table_desc.pointer, table, length);
+               table_desc.address = ACPI_TO_INTEGER(table_desc.pointer);
                break;
 
        default:
                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
-       /*
-        * Install the new table into the local data structures
-        */
+       /* Validate table checksum (will not get validated in tb_add_table) */
+
+       status = acpi_tb_verify_checksum(table_desc.pointer, length);
+       if (ACPI_FAILURE(status)) {
+               ACPI_FREE(table_desc.pointer);
+               return_ACPI_STATUS(status);
+       }
+
+       /* Complete the table descriptor */
+
+       table_desc.length = length;
+       table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED;
+
+       /* Install the new table into the local data structures */
+
        status = acpi_tb_add_table(&table_desc, &table_index);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
@@ -379,7 +428,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
        /*
         * Add the table to the namespace.
         *
-        * Note: We load the table objects relative to the root of the namespace.
+        * Note: Load the table objects relative to the root of the namespace.
         * This appears to go against the ACPI specification, but we do it for
         * compatibility with other ACPI implementations.
         */
@@ -415,7 +464,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
       cleanup:
        if (ACPI_FAILURE(status)) {
 
-               /* Delete allocated buffer or mapping */
+               /* Delete allocated table buffer */
 
                acpi_tb_delete_table(&table_desc);
        }
@@ -455,9 +504,9 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /* Get the table index from the ddb_handle (acpi_size for 64-bit case) */
+       /* Get the table index from the ddb_handle */
 
-       table_index = (u32) (acpi_size) table_desc->reference.object;
+       table_index = table_desc->reference.value;
 
        /* Invoke table handler if present */
 
index 261d97516d9b3cf69451f0559560b846b265a875..1d1f35adddde65cfd0558ff4a2be97f087759c95 100644 (file)
@@ -57,7 +57,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
  *
  * FUNCTION:    acpi_ex_convert_to_integer
  *
- * PARAMETERS:  obj_desc        - Object to be converted.  Must be an
+ * PARAMETERS:  obj_desc        - Object to be converted. Must be an
  *                                Integer, Buffer, or String
  *              result_desc     - Where the new Integer object is returned
  *              Flags           - Used for string conversion
@@ -103,7 +103,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
        }
 
        /*
-        * Convert the buffer/string to an integer.  Note that both buffers and
+        * Convert the buffer/string to an integer. Note that both buffers and
         * strings are treated as raw data - we don't convert ascii to hex for
         * strings.
         *
@@ -120,7 +120,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
 
                /*
                 * Convert string to an integer - for most cases, the string must be
-                * hexadecimal as per the ACPI specification.  The only exception (as
+                * hexadecimal as per the ACPI specification. The only exception (as
                 * of ACPI 3.0) is that the to_integer() operator allows both decimal
                 * and hexadecimal strings (hex prefixed with "0x").
                 */
@@ -159,6 +159,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
                break;
 
        default:
+
                /* No other types can get here */
                break;
        }
@@ -185,7 +186,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
  *
  * FUNCTION:    acpi_ex_convert_to_buffer
  *
- * PARAMETERS:  obj_desc        - Object to be converted.  Must be an
+ * PARAMETERS:  obj_desc        - Object to be converted. Must be an
  *                                Integer, Buffer, or String
  *              result_desc     - Where the new buffer object is returned
  *
@@ -365,7 +366,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
        }
 
        /*
-        * Since leading zeros are supressed, we must check for the case where
+        * Since leading zeros are suppressed, we must check for the case where
         * the integer equals 0
         *
         * Finally, null terminate the string and return the length
@@ -383,7 +384,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer,
  *
  * FUNCTION:    acpi_ex_convert_to_string
  *
- * PARAMETERS:  obj_desc        - Object to be converted.  Must be an
+ * PARAMETERS:  obj_desc        - Object to be converted. Must be an
  *                                Integer, Buffer, or String
  *              result_desc     - Where the string object is returned
  *              Type            - String flags (base and conversion type)
@@ -472,7 +473,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                        base = 10;
 
                        /*
-                        * Calculate the final string length.  Individual string values
+                        * Calculate the final string length. Individual string values
                         * are variable length (include separator for each)
                         */
                        for (i = 0; i < obj_desc->buffer.length; i++) {
@@ -511,9 +512,14 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                /*
                 * Create a new string object and string buffer
                 * (-1 because of extra separator included in string_length from above)
+                * Allow creation of zero-length strings from zero-length buffers.
                 */
+               if (string_length) {
+                       string_length--;
+               }
+
                return_desc = acpi_ut_create_string_object((acpi_size)
-                                                          (string_length - 1));
+                                                          string_length);
                if (!return_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -536,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                 * Null terminate the string
                 * (overwrites final comma/space from above)
                 */
-               new_buf--;
+               if (obj_desc->buffer.length) {
+                       new_buf--;
+               }
                *new_buf = 0;
                break;
 
@@ -617,7 +625,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
                case ACPI_TYPE_LOCAL_BANK_FIELD:
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
                        /*
-                        * These types require an Integer operand.  We can convert
+                        * These types require an Integer operand. We can convert
                         * a Buffer or a String to an Integer if necessary.
                         */
                        status =
@@ -627,7 +635,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
 
                case ACPI_TYPE_STRING:
                        /*
-                        * The operand must be a String.  We can convert an
+                        * The operand must be a String. We can convert an
                         * Integer or Buffer if necessary
                         */
                        status =
@@ -637,7 +645,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
 
                case ACPI_TYPE_BUFFER:
                        /*
-                        * The operand must be a Buffer.  We can convert an
+                        * The operand must be a Buffer. We can convert an
                         * Integer or String if necessary
                         */
                        status =
index 2be2e2bf95bf1447aa031be9d1cf3a33a46f39a9..d087a7d28aa53f34173cb7d64d688db119017086 100644 (file)
@@ -45,7 +45,6 @@
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exdump")
@@ -214,10 +213,11 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
 };
 
-static struct acpi_exdump_info acpi_ex_dump_reference[7] = {
+static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
        {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
+       {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
        {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
-       {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"},
+       {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"},
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"},
        {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
@@ -413,10 +413,10 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
 
                case ACPI_EXD_REFERENCE:
 
-                       acpi_ex_out_string("Opcode",
-                                          (acpi_ps_get_opcode_info
-                                           (obj_desc->reference.opcode))->
-                                          name);
+                       acpi_ex_out_string("Class Name",
+                                          (char *)
+                                          acpi_ut_get_reference_name
+                                          (obj_desc));
                        acpi_ex_dump_reference_obj(obj_desc);
                        break;
 
@@ -494,40 +494,41 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               switch (obj_desc->reference.opcode) {
-               case AML_DEBUG_OP:
+               acpi_os_printf("Reference: [%s] ",
+                              acpi_ut_get_reference_name(obj_desc));
+
+               switch (obj_desc->reference.class) {
+               case ACPI_REFCLASS_DEBUG:
 
-                       acpi_os_printf("Reference: Debug\n");
+                       acpi_os_printf("\n");
                        break;
 
-               case AML_INDEX_OP:
+               case ACPI_REFCLASS_INDEX:
 
-                       acpi_os_printf("Reference: Index %p\n",
-                                      obj_desc->reference.object);
+                       acpi_os_printf("%p\n", obj_desc->reference.object);
                        break;
 
-               case AML_LOAD_OP:
+               case ACPI_REFCLASS_TABLE:
 
-                       acpi_os_printf("Reference: [DdbHandle] TableIndex %p\n",
-                                      obj_desc->reference.object);
+                       acpi_os_printf("Table Index %X\n",
+                                      obj_desc->reference.value);
                        break;
 
-               case AML_REF_OF_OP:
+               case ACPI_REFCLASS_REFOF:
 
-                       acpi_os_printf("Reference: (RefOf) %p [%s]\n",
-                                      obj_desc->reference.object,
+                       acpi_os_printf("%p [%s]\n", obj_desc->reference.object,
                                       acpi_ut_get_type_name(((union
                                                               acpi_operand_object
-                                                              *)obj_desc->
+                                                              *)
+                                                             obj_desc->
                                                              reference.
                                                              object)->common.
                                                             type));
                        break;
 
-               case AML_ARG_OP:
+               case ACPI_REFCLASS_ARG:
 
-                       acpi_os_printf("Reference: Arg%d",
-                                      obj_desc->reference.offset);
+                       acpi_os_printf("%X", obj_desc->reference.value);
 
                        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
 
@@ -542,10 +543,9 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
                        acpi_os_printf("\n");
                        break;
 
-               case AML_LOCAL_OP:
+               case ACPI_REFCLASS_LOCAL:
 
-                       acpi_os_printf("Reference: Local%d",
-                                      obj_desc->reference.offset);
+                       acpi_os_printf("%X", obj_desc->reference.value);
 
                        if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
 
@@ -560,21 +560,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
                        acpi_os_printf("\n");
                        break;
 
-               case AML_INT_NAMEPATH_OP:
+               case ACPI_REFCLASS_NAME:
 
-                       acpi_os_printf("Reference: Namepath %X [%4.4s]\n",
-                                      obj_desc->reference.node->name.integer,
+                       acpi_os_printf("- [%4.4s]\n",
                                       obj_desc->reference.node->name.ascii);
                        break;
 
-               default:
-
-                       /* Unknown opcode */
+               default:        /* Unknown reference class */
 
-                       acpi_os_printf("Unknown Reference opcode=%X\n",
-                                      obj_desc->reference.opcode);
+                       acpi_os_printf("%2.2X\n", obj_desc->reference.class);
                        break;
-
                }
                break;
 
@@ -865,8 +860,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
 
        ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
-       if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
-               acpi_os_printf(" Named Object %p ", obj_desc->reference.node);
+       if (obj_desc->reference.class == ACPI_REFCLASS_NAME) {
+               acpi_os_printf(" %p ", obj_desc->reference.node);
 
                status =
                    acpi_ns_handle_to_pathname(obj_desc->reference.node,
@@ -882,14 +877,12 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
                    ACPI_DESC_TYPE_OPERAND) {
                        acpi_os_printf(" Target: %p",
                                       obj_desc->reference.object);
-                       if (obj_desc->reference.opcode == AML_LOAD_OP) {
-                               /*
-                                * For DDBHandle reference,
-                                * obj_desc->Reference.Object is the table index
-                                */
-                               acpi_os_printf(" [DDBHandle]\n");
+                       if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
+                               acpi_os_printf(" Table Index: %X\n",
+                                              obj_desc->reference.value);
                        } else {
-                               acpi_os_printf(" [%s]\n",
+                               acpi_os_printf(" Target: %p [%s]\n",
+                                              obj_desc->reference.object,
                                               acpi_ut_get_type_name(((union
                                                                       acpi_operand_object
                                                                       *)
@@ -988,9 +981,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               acpi_os_printf("[Object Reference] %s",
-                              (acpi_ps_get_opcode_info
-                               (obj_desc->reference.opcode))->name);
+               acpi_os_printf("[Object Reference] Type [%s] %2.2X",
+                              acpi_ut_get_reference_name(obj_desc),
+                              obj_desc->reference.class);
                acpi_ex_dump_reference_obj(obj_desc);
                break;
 
index 731414a581a6226f1d8c53fed278123465b6253c..efb19134005951cb8adce2b7b473c8734b44b610 100644 (file)
@@ -86,10 +86,10 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
                /*
                 * Must be a reference to a Local or Arg
                 */
-               switch (obj_desc->reference.opcode) {
-               case AML_LOCAL_OP:
-               case AML_ARG_OP:
-               case AML_DEBUG_OP:
+               switch (obj_desc->reference.class) {
+               case ACPI_REFCLASS_LOCAL:
+               case ACPI_REFCLASS_ARG:
+               case ACPI_REFCLASS_DEBUG:
 
                        /* The referenced object is the pseudo-node for the local/arg */
 
@@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
 
                default:
 
-                       ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X",
-                                   obj_desc->reference.opcode));
+                       ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X",
+                                   obj_desc->reference.class));
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
                break;
@@ -127,7 +127,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       reference_obj->reference.opcode = AML_REF_OF_OP;
+       reference_obj->reference.class = ACPI_REFCLASS_REFOF;
        reference_obj->reference.object = referenced_obj;
        *return_desc = reference_obj;
 
index 7c3bea575e02653c2960a472c4b994a48ce9574b..f622f9eac8a1a85bfe0bfb4afbed5854b5435609 100644 (file)
@@ -825,16 +825,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                 *
                                 * Must resolve/dereference the local/arg reference first
                                 */
-                               switch (operand[0]->reference.opcode) {
-                               case AML_LOCAL_OP:
-                               case AML_ARG_OP:
+                               switch (operand[0]->reference.class) {
+                               case ACPI_REFCLASS_LOCAL:
+                               case ACPI_REFCLASS_ARG:
 
                                        /* Set Operand[0] to the value of the local/arg */
 
                                        status =
                                            acpi_ds_method_data_get_value
-                                           (operand[0]->reference.opcode,
-                                            operand[0]->reference.offset,
+                                           (operand[0]->reference.class,
+                                            operand[0]->reference.value,
                                             walk_state, &temp_desc);
                                        if (ACPI_FAILURE(status)) {
                                                goto cleanup;
@@ -848,7 +848,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                        operand[0] = temp_desc;
                                        break;
 
-                               case AML_REF_OF_OP:
+                               case ACPI_REFCLASS_REFOF:
 
                                        /* Get the object to which the reference refers */
 
@@ -928,8 +928,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                         * This must be a reference object produced by either the
                         * Index() or ref_of() operator
                         */
-                       switch (operand[0]->reference.opcode) {
-                       case AML_INDEX_OP:
+                       switch (operand[0]->reference.class) {
+                       case ACPI_REFCLASS_INDEX:
 
                                /*
                                 * The target type for the Index operator must be
@@ -965,7 +965,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                        return_desc->integer.value =
                                            temp_desc->buffer.
                                            pointer[operand[0]->reference.
-                                                   offset];
+                                                   value];
                                        break;
 
                                case ACPI_TYPE_PACKAGE:
@@ -985,7 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                default:
 
                                        ACPI_ERROR((AE_INFO,
-                                                   "Unknown Index TargetType %X in obj %p",
+                                                   "Unknown Index TargetType %X in reference object %p",
                                                    operand[0]->reference.
                                                    target_type, operand[0]));
                                        status = AE_AML_OPERAND_TYPE;
@@ -993,7 +993,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                }
                                break;
 
-                       case AML_REF_OF_OP:
+                       case ACPI_REFCLASS_REFOF:
 
                                return_desc = operand[0]->reference.object;
 
@@ -1013,9 +1013,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown opcode in reference(%p) - %X",
+                                           "Unknown class in reference(%p) - %2.2X",
                                            operand[0],
-                                           operand[0]->reference.opcode));
+                                           operand[0]->reference.class));
 
                                status = AE_TYPE;
                                goto cleanup;
index 8e8bbb6ccebd541008b0f15caa2ffacbe62eaf34..368def5dffceb0ffc47be5866d640b83e18f6c53 100644 (file)
@@ -391,8 +391,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
                /* Initialize the Index reference object */
 
                index = operand[1]->integer.value;
-               return_desc->reference.offset = (u32) index;
-               return_desc->reference.opcode = AML_INDEX_OP;
+               return_desc->reference.value = (u32) index;
+               return_desc->reference.class = ACPI_REFCLASS_INDEX;
 
                /*
                 * At this point, the Source operand is a String, Buffer, or Package.
index 5596f42c9676038c329f6f3d0f473773adbfcb3f..423ad3635f3d0aa702e8d5f3652ecf0b572af954 100644 (file)
@@ -46,8 +46,6 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresnte")
@@ -238,10 +236,10 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               switch (source_desc->reference.opcode) {
-               case AML_LOAD_OP:       /* This is a ddb_handle */
-               case AML_REF_OF_OP:
-               case AML_INDEX_OP:
+               switch (source_desc->reference.class) {
+               case ACPI_REFCLASS_TABLE:       /* This is a ddb_handle */
+               case ACPI_REFCLASS_REFOF:
+               case ACPI_REFCLASS_INDEX:
 
                        /* Return an additional reference to the object */
 
@@ -253,10 +251,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
                        /* No named references are allowed here */
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unsupported Reference opcode %X (%s)",
-                                   source_desc->reference.opcode,
-                                   acpi_ps_get_opcode_name(source_desc->
-                                                           reference.opcode)));
+                                   "Unsupported Reference type %X",
+                                   source_desc->reference.class));
 
                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
index b35f7c817acf169a244b21e052d09d26db074504..89571b92a52279258812e7cc6f93ad5024acc28b 100644 (file)
@@ -47,7 +47,6 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresolv")
@@ -141,7 +140,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        acpi_status status = AE_OK;
        union acpi_operand_object *stack_desc;
        union acpi_operand_object *obj_desc = NULL;
-       u16 opcode;
+       u8 ref_type;
 
        ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
 
@@ -152,19 +151,19 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               opcode = stack_desc->reference.opcode;
+               ref_type = stack_desc->reference.class;
 
-               switch (opcode) {
-               case AML_LOCAL_OP:
-               case AML_ARG_OP:
+               switch (ref_type) {
+               case ACPI_REFCLASS_LOCAL:
+               case ACPI_REFCLASS_ARG:
 
                        /*
                         * Get the local from the method's state info
                         * Note: this increments the local's object reference count
                         */
-                       status = acpi_ds_method_data_get_value(opcode,
+                       status = acpi_ds_method_data_get_value(ref_type,
                                                               stack_desc->
-                                                              reference.offset,
+                                                              reference.value,
                                                               walk_state,
                                                               &obj_desc);
                        if (ACPI_FAILURE(status)) {
@@ -173,7 +172,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                                          "[Arg/Local %X] ValueObj is %p\n",
-                                         stack_desc->reference.offset,
+                                         stack_desc->reference.value,
                                          obj_desc));
 
                        /*
@@ -184,7 +183,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        *stack_ptr = obj_desc;
                        break;
 
-               case AML_INDEX_OP:
+               case ACPI_REFCLASS_INDEX:
 
                        switch (stack_desc->reference.target_type) {
                        case ACPI_TYPE_BUFFER_FIELD:
@@ -239,15 +238,15 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        }
                        break;
 
-               case AML_REF_OF_OP:
-               case AML_DEBUG_OP:
-               case AML_LOAD_OP:
+               case ACPI_REFCLASS_REFOF:
+               case ACPI_REFCLASS_DEBUG:
+               case ACPI_REFCLASS_TABLE:
 
                        /* Just leave the object as-is, do not dereference */
 
                        break;
 
-               case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
+               case ACPI_REFCLASS_NAME:        /* Reference to a named object */
 
                        /* Dereference the name */
 
@@ -273,8 +272,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                default:
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unknown Reference opcode %X (%s) in %p",
-                                   opcode, acpi_ps_get_opcode_name(opcode),
+                                   "Unknown Reference type %X in %p", ref_type,
                                    stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
@@ -388,13 +386,13 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
         * traversing the list of possibly many nested references.
         */
        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:
+               switch (obj_desc->reference.class) {
+               case ACPI_REFCLASS_REFOF:
+               case ACPI_REFCLASS_NAME:
 
                        /* Dereference the reference pointer */
 
-                       if (obj_desc->reference.opcode == AML_REF_OF_OP) {
+                       if (obj_desc->reference.class == ACPI_REFCLASS_REFOF) {
                                node = obj_desc->reference.object;
                        } else {        /* AML_INT_NAMEPATH_OP */
 
@@ -429,7 +427,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_INDEX_OP:
+               case ACPI_REFCLASS_INDEX:
 
                        /* Get the type of this reference (index into another object) */
 
@@ -455,22 +453,22 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_LOAD_OP:
+               case ACPI_REFCLASS_TABLE:
 
                        type = ACPI_TYPE_DDB_HANDLE;
                        goto exit;
 
-               case AML_LOCAL_OP:
-               case AML_ARG_OP:
+               case ACPI_REFCLASS_LOCAL:
+               case ACPI_REFCLASS_ARG:
 
                        if (return_desc) {
                                status =
                                    acpi_ds_method_data_get_value(obj_desc->
                                                                  reference.
-                                                                 opcode,
+                                                                 class,
                                                                  obj_desc->
                                                                  reference.
-                                                                 offset,
+                                                                 value,
                                                                  walk_state,
                                                                  &obj_desc);
                                if (ACPI_FAILURE(status)) {
@@ -481,10 +479,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                                status =
                                    acpi_ds_method_data_get_node(obj_desc->
                                                                 reference.
-                                                                opcode,
+                                                                class,
                                                                 obj_desc->
                                                                 reference.
-                                                                offset,
+                                                                value,
                                                                 walk_state,
                                                                 &node);
                                if (ACPI_FAILURE(status)) {
@@ -499,7 +497,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_DEBUG_OP:
+               case ACPI_REFCLASS_DEBUG:
 
                        /* The Debug Object is of type "DebugObject" */
 
@@ -509,8 +507,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                default:
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unknown Reference subtype %X",
-                                   obj_desc->reference.opcode));
+                                   "Unknown Reference Class %2.2X",
+                                   obj_desc->reference.class));
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
        }
index 54085f16ec28360d4f252c3f8e34dc230da3cbff..0bb82593da724d62ca766a2a843827a9cf33376c 100644 (file)
@@ -225,41 +225,36 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
 
-                               /* Decode the Reference */
+                               /* Validate the Reference */
 
-                               op_info = acpi_ps_get_opcode_info(opcode);
-                               if (op_info->class == AML_CLASS_UNKNOWN) {
-                                       return_ACPI_STATUS(AE_AML_BAD_OPCODE);
-                               }
+                               switch (obj_desc->reference.class) {
+                               case ACPI_REFCLASS_DEBUG:
 
-                               switch (obj_desc->reference.opcode) {
-                               case AML_DEBUG_OP:
                                        target_op = AML_DEBUG_OP;
 
                                        /*lint -fallthrough */
 
-                               case AML_INDEX_OP:
-                               case AML_REF_OF_OP:
-                               case AML_ARG_OP:
-                               case AML_LOCAL_OP:
-                               case AML_LOAD_OP:       /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
-                               case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
-
-                                       ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
-                                                               ((ACPI_DB_EXEC,
-                                                                 "Operand is a Reference, RefOpcode [%s]\n",
-                                                                 (acpi_ps_get_opcode_info
-                                                                  (obj_desc->
-                                                                   reference.
-                                                                   opcode))->
-                                                                 name)));
+                               case ACPI_REFCLASS_ARG:
+                               case ACPI_REFCLASS_LOCAL:
+                               case ACPI_REFCLASS_INDEX:
+                               case ACPI_REFCLASS_REFOF:
+                               case ACPI_REFCLASS_TABLE:       /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
+                               case ACPI_REFCLASS_NAME:        /* Reference to a named object */
+
+                                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                         "Operand is a Reference, Class [%s] %2.2X\n",
+                                                         acpi_ut_get_reference_name
+                                                         (obj_desc),
+                                                         obj_desc->reference.
+                                                         class));
                                        break;
 
                                default:
+
                                        ACPI_ERROR((AE_INFO,
-                                                   "Operand is a Reference, Unknown Reference Opcode: %X",
-                                                   obj_desc->reference.
-                                                   opcode));
+                                                   "Unknown Reference Class %2.2X in %p",
+                                                   obj_desc->reference.class,
+                                                   obj_desc));
 
                                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
@@ -270,8 +265,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        /* Invalid descriptor */
 
-                       ACPI_ERROR((AE_INFO,
-                                   "Invalid descriptor %p [%s]",
+                       ACPI_ERROR((AE_INFO, "Invalid descriptor %p [%s]",
                                    obj_desc,
                                    acpi_ut_get_descriptor_name(obj_desc)));
 
@@ -343,7 +337,7 @@ acpi_ex_resolve_operands(u16 opcode,
                        if ((opcode == AML_STORE_OP) &&
                            (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
                             ACPI_TYPE_LOCAL_REFERENCE)
-                           && ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
+                           && ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) {
                                goto next_operand;
                        }
                        break;
index 38b55e352495df4ed3808ffe713995dafe05e8db..3318df4cbd989191fc46de95e3cbd209ccf0f525 100644 (file)
@@ -47,7 +47,6 @@
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exstore")
@@ -179,22 +178,26 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               if (source_desc->reference.opcode == AML_INDEX_OP) {
-                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
-                                             "[%s, 0x%X]\n",
-                                             acpi_ps_get_opcode_name
-                                             (source_desc->reference.opcode),
-                                             source_desc->reference.offset));
-               } else {
-                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]",
-                                             acpi_ps_get_opcode_name
-                                             (source_desc->reference.opcode)));
-               }
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s] ",
+                                     acpi_ut_get_reference_name(source_desc)));
+
+               /* Decode the reference */
+
+               switch (source_desc->reference.class) {
+               case ACPI_REFCLASS_INDEX:
+
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
+                                             source_desc->reference.value));
+                       break;
+
+               case ACPI_REFCLASS_TABLE:
 
-               if (source_desc->reference.opcode == AML_LOAD_OP) {     /* Load and load_table */
                        ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
-                                             " Table OwnerId %p\n",
-                                             source_desc->reference.object));
+                                             "Table Index 0x%X\n",
+                                             source_desc->reference.value));
+                       break;
+
+               default:
                        break;
                }
 
@@ -347,15 +350,15 @@ acpi_ex_store(union acpi_operand_object *source_desc,
        }
 
        /*
-        * Examine the Reference opcode.  These cases are handled:
+        * Examine the Reference class. These cases are handled:
         *
         * 1) Store to Name (Change the object associated with a name)
         * 2) Store to an indexed area of a Buffer or Package
         * 3) Store to a Method Local or Arg
         * 4) Store to the debug object
         */
-       switch (ref_desc->reference.opcode) {
-       case AML_REF_OF_OP:
+       switch (ref_desc->reference.class) {
+       case ACPI_REFCLASS_REFOF:
 
                /* Storing an object into a Name "container" */
 
@@ -365,7 +368,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                                                      ACPI_IMPLICIT_CONVERSION);
                break;
 
-       case AML_INDEX_OP:
+       case ACPI_REFCLASS_INDEX:
 
                /* Storing to an Index (pointer into a packager or buffer) */
 
@@ -374,18 +377,18 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                                                  walk_state);
                break;
 
-       case AML_LOCAL_OP:
-       case AML_ARG_OP:
+       case ACPI_REFCLASS_LOCAL:
+       case ACPI_REFCLASS_ARG:
 
                /* Store to a method local/arg  */
 
                status =
-                   acpi_ds_store_object_to_local(ref_desc->reference.opcode,
-                                                 ref_desc->reference.offset,
+                   acpi_ds_store_object_to_local(ref_desc->reference.class,
+                                                 ref_desc->reference.value,
                                                  source_desc, walk_state);
                break;
 
-       case AML_DEBUG_OP:
+       case ACPI_REFCLASS_DEBUG:
 
                /*
                 * Storing to the Debug object causes the value stored to be
@@ -401,9 +404,9 @@ acpi_ex_store(union acpi_operand_object *source_desc,
 
        default:
 
-               ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X",
-                           ref_desc->reference.opcode));
-               ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
+               ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X",
+                           ref_desc->reference.class));
+               ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_INFO);
 
                status = AE_AML_INTERNAL;
                break;
@@ -458,7 +461,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
 
                if (ACPI_GET_OBJECT_TYPE(source_desc) ==
                    ACPI_TYPE_LOCAL_REFERENCE
-                   && source_desc->reference.opcode == AML_LOAD_OP) {
+                   && source_desc->reference.class == ACPI_REFCLASS_TABLE) {
 
                        /* This is a DDBHandle, just add a reference to it */
 
@@ -553,7 +556,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
 
                /* Store the source value into the target buffer byte */
 
-               obj_desc->buffer.pointer[index_desc->reference.offset] = value;
+               obj_desc->buffer.pointer[index_desc->reference.value] = value;
                break;
 
        default:
index a6d2168b81f99f9301f091ba3cf6ba4a0eb48b1d..eef61a00803edf560bf2917e1cf66d7c8587e9cc 100644 (file)
@@ -121,7 +121,8 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
                    (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
                    !((ACPI_GET_OBJECT_TYPE(source_desc) ==
                       ACPI_TYPE_LOCAL_REFERENCE)
-                     && (source_desc->reference.opcode == AML_LOAD_OP))) {
+                     && (source_desc->reference.class ==
+                         ACPI_REFCLASS_TABLE))) {
 
                        /* Conversion successful but still not a valid type */
 
index 2655bc1b4eebc7cbb02a16afc715e703dd0e3499..dfc0486ffaff36bcaefd11eefbcd9bb076306982 100644 (file)
@@ -327,8 +327,8 @@ static int acpi_fan_resume(struct acpi_device *device)
 
        result = acpi_bus_get_power(device->handle, &power_state);
        if (result) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Error reading fan power state\n"));
+               printk(KERN_ERR PREFIX
+                                 "Error reading fan power state\n");
                return result;
        }
 
index 084109507c9f5101a1cdcf678db34005984a2855..8dd3336efd7e242209240010b7fa9710bb2ae6e8 100644 (file)
@@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
                                "firmware_node");
                ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
                                "physical_node");
-               if (acpi_dev->wakeup.flags.valid)
+               if (acpi_dev->wakeup.flags.valid) {
                        device_set_wakeup_capable(dev, true);
+                       device_set_wakeup_enable(dev,
+                                               acpi_dev->wakeup.state.enabled);
+               }
        }
 
        return 0;
index 3f63d36406966cda6a0821fe67fc741da8dd302e..371a2daf837f1c7806fb8b2ab4afb962bbcbed62 100644 (file)
@@ -5,7 +5,7 @@
 obj-y := nsaccess.o  nsload.o    nssearch.o  nsxfeval.o \
         nsalloc.o   nseval.o    nsnames.o   nsutils.o   nsxfname.o \
         nsdump.o    nsinit.o    nsobject.o  nswalk.o    nsxfobj.o  \
-        nsparse.o
+        nsparse.o   nspredef.o
 
 obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
 
index 0ab22004728a9aae08f7697cb8230456177d0c9f..cc0ae39440e4358838626c73c63d43ccc8e15d01 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsdump")
@@ -334,9 +333,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                case ACPI_TYPE_LOCAL_REFERENCE:
 
                        acpi_os_printf("[%s]\n",
-                                      acpi_ps_get_opcode_name(obj_desc->
-                                                              reference.
-                                                              opcode));
+                                      acpi_ut_get_reference_name(obj_desc));
                        break;
 
                case ACPI_TYPE_BUFFER_FIELD:
index d369164e00b0bc16d594e8617e93be3ada99d95f..4cdf03ac2b467803189d97e8c5b7d11feabc073e 100644 (file)
@@ -78,6 +78,7 @@ ACPI_MODULE_NAME("nseval")
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 {
        acpi_status status;
+       struct acpi_namespace_node *node;
 
        ACPI_FUNCTION_TRACE(ns_evaluate);
 
@@ -117,6 +118,8 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                          info->resolved_node,
                          acpi_ns_get_attached_object(info->resolved_node)));
 
+       node = info->resolved_node;
+
        /*
         * Two major cases here:
         *
@@ -148,21 +151,22 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                                info->param_count++;
                }
 
-               /* Error if too few arguments were passed in */
+               /*
+                * Warning if too few or too many arguments have been passed by the
+                * caller. We don't want to abort here with an error because an
+                * incorrect number of arguments may not cause the method to fail.
+                * However, the method will fail if there are too few arguments passed
+                * and the method attempts to use one of the missing ones.
+                */
 
                if (info->param_count < info->obj_desc->method.param_count) {
-                       ACPI_ERROR((AE_INFO,
+                       ACPI_WARNING((AE_INFO,
                                    "Insufficient arguments - "
                                    "method [%4.4s] needs %d, found %d",
                                    acpi_ut_get_node_name(info->resolved_node),
                                    info->obj_desc->method.param_count,
                                    info->param_count));
-                       return_ACPI_STATUS(AE_MISSING_ARGUMENTS);
-               }
-
-               /* Just a warning if too many arguments */
-
-               else if (info->param_count >
+               } else if (info->param_count >
                                info->obj_desc->method.param_count) {
                        ACPI_WARNING((AE_INFO,
                                      "Excess arguments - "
@@ -195,7 +199,28 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
        } else {
                /*
                 * 2) Object is not a method, return its current value
+                *
+                * Disallow certain object types. For these, "evaluation" is undefined.
                 */
+               switch (info->resolved_node->type) {
+               case ACPI_TYPE_DEVICE:
+               case ACPI_TYPE_EVENT:
+               case ACPI_TYPE_MUTEX:
+               case ACPI_TYPE_REGION:
+               case ACPI_TYPE_THERMAL:
+               case ACPI_TYPE_LOCAL_SCOPE:
+
+                       ACPI_ERROR((AE_INFO,
+                                   "[%4.4s] Evaluation of object type [%s] is not supported",
+                                   info->resolved_node->name.ascii,
+                                   acpi_ut_get_type_name(info->resolved_node->
+                                                         type)));
+
+                       return_ACPI_STATUS(AE_TYPE);
+
+               default:
+                       break;
+               }
 
                /*
                 * Objects require additional resolution steps (e.g., the Node may be
@@ -239,9 +264,35 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                }
        }
 
-       /*
-        * Check if there is a return value that must be dealt with
-        */
+       /* Validation of return values for ACPI-predefined methods and objects */
+
+       if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) {
+               /*
+                * If this is the first evaluation, check the return value. This
+                * ensures that any warnings will only be emitted during the very
+                * first evaluation of the object.
+                */
+               if (!(node->flags & ANOBJ_EVALUATED)) {
+                       /*
+                        * Check for a predefined ACPI name. If found, validate the
+                        * returned object.
+                        *
+                        * Note: Ignore return status for now, emit warnings if there are
+                        * problems with the returned object. May change later to abort
+                        * the method on invalid return object.
+                        */
+                       (void)acpi_ns_check_predefined_names(node,
+                                                            info->
+                                                            return_object);
+               }
+
+               /* Mark the node as having been evaluated */
+
+               node->flags |= ANOBJ_EVALUATED;
+       }
+
+       /* 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 */
index bd5773878009eeb8b9ce38863465c92da6a0d660..42a39a7c96e913a519e6b1bf7b5a79d152dd4a4d 100644 (file)
@@ -115,7 +115,6 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
        return (AE_OK);
 }
 
-#ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_external_pathname
@@ -142,7 +141,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
        size = acpi_ns_get_pathname_length(node);
        if (!size) {
-               return (NULL);
+               return_PTR(NULL);
        }
 
        /* Allocate a buffer to be returned to caller */
@@ -157,12 +156,12 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
        status = acpi_ns_build_external_path(node, size, name_buffer);
        if (ACPI_FAILURE(status)) {
-               return (NULL);
+               ACPI_FREE(name_buffer);
+               return_PTR(NULL);
        }
 
        return_PTR(name_buffer);
 }
-#endif
 
 /*******************************************************************************
  *
diff --git a/drivers/acpi/namespace/nspredef.c b/drivers/acpi/namespace/nspredef.c
new file mode 100644 (file)
index 0000000..0f17cf0
--- /dev/null
@@ -0,0 +1,900 @@
+/******************************************************************************
+ *
+ * Module Name: nspredef - Validation of ACPI predefined methods and objects
+ *              $Revision: 1.1 $
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2008, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+#include <acpi/acnamesp.h>
+#include <acpi/acpredef.h>
+
+#define _COMPONENT          ACPI_NAMESPACE
+ACPI_MODULE_NAME("nspredef")
+
+/*******************************************************************************
+ *
+ * This module validates predefined ACPI objects that appear in the namespace,
+ * at the time they are evaluated (via acpi_evaluate_object). The purpose of this
+ * validation is to detect problems with BIOS-exposed predefined ACPI objects
+ * before the results are returned to the ACPI-related drivers.
+ *
+ * There are several areas that are validated:
+ *
+ *  1) The number of input arguments as defined by the method/object in the
+ *      ASL is validated against the ACPI specification.
+ *  2) The type of the return object (if any) is validated against the ACPI
+ *      specification.
+ *  3) For returned package objects, the count of package elements is
+ *      validated, as well as the type of each package element. Nested
+ *      packages are supported.
+ *
+ * For any problems found, a warning message is issued.
+ *
+ ******************************************************************************/
+/* Local prototypes */
+static acpi_status
+acpi_ns_check_package(char *pathname,
+                     union acpi_operand_object *return_object,
+                     const union acpi_predefined_info *predefined);
+
+static acpi_status
+acpi_ns_check_package_elements(char *pathname,
+                              union acpi_operand_object **elements,
+                              u8 type1, u32 count1, u8 type2, u32 count2);
+
+static acpi_status
+acpi_ns_check_object_type(char *pathname,
+                         union acpi_operand_object *return_object,
+                         u32 expected_btypes, u32 package_index);
+
+static acpi_status
+acpi_ns_check_reference(char *pathname,
+                       union acpi_operand_object *return_object);
+
+/*
+ * Names for the types that can be returned by the predefined objects.
+ * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
+ */
+static const char *acpi_rtype_names[] = {
+       "/Integer",
+       "/String",
+       "/Buffer",
+       "/Package",
+       "/Reference",
+};
+
+#define ACPI_NOT_PACKAGE    ACPI_UINT32_MAX
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_predefined_names
+ *
+ * PARAMETERS:  Node            - Namespace node for the method/object
+ *              return_object   - Object returned from the evaluation of this
+ *                                method/object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check an ACPI name for a match in the predefined name list.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
+                              union acpi_operand_object *return_object)
+{
+       acpi_status status = AE_OK;
+       const union acpi_predefined_info *predefined;
+       char *pathname;
+
+       /* Match the name for this method/object against the predefined list */
+
+       predefined = acpi_ns_check_for_predefined_name(node);
+       if (!predefined) {
+
+               /* Name was not one of the predefined names */
+
+               return (AE_OK);
+       }
+
+       /* Get the full pathname to the object, for use in error messages */
+
+       pathname = acpi_ns_get_external_pathname(node);
+       if (!pathname) {
+               pathname = ACPI_CAST_PTR(char, predefined->info.name);
+       }
+
+       /*
+        * Check that the parameter count for this method is in accordance
+        * with the ACPI specification.
+        */
+       acpi_ns_check_parameter_count(pathname, node, predefined);
+
+       /*
+        * If there is no return value, check if we require a return value for
+        * this predefined name. Either one return value is expected, or none,
+        * for both methods and other objects.
+        *
+        * Exit now if there is no return object. Warning if one was expected.
+        */
+       if (!return_object) {
+               if ((predefined->info.expected_btypes) &&
+                   (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
+                       ACPI_ERROR((AE_INFO,
+                                   "%s: Missing expected return value",
+                                   pathname));
+
+                       status = AE_AML_NO_RETURN_VALUE;
+               }
+               goto exit;
+       }
+
+       /*
+        * We have a return value, but if one wasn't expected, just exit, this is
+        * not a problem
+        *
+        * For example, if "Implicit return value" is enabled, methods will
+        * always return a value
+        */
+       if (!predefined->info.expected_btypes) {
+               goto exit;
+       }
+
+       /*
+        * Check that the type of the return object is what is expected for
+        * this predefined name
+        */
+       status = acpi_ns_check_object_type(pathname, return_object,
+                                          predefined->info.expected_btypes,
+                                          ACPI_NOT_PACKAGE);
+       if (ACPI_FAILURE(status)) {
+               goto exit;
+       }
+
+       /* For returned Package objects, check the type of all sub-objects */
+
+       if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) {
+               status =
+                   acpi_ns_check_package(pathname, return_object, predefined);
+       }
+
+      exit:
+       if (pathname) {
+               ACPI_FREE(pathname);
+       }
+
+       return (status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_parameter_count
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              Node            - Namespace node for the method/object
+ *              Predefined      - Pointer to entry in predefined name table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a
+ *              predefined name is what is expected (i.e., what is defined in
+ *              the ACPI specification for this predefined name.)
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_check_parameter_count(char *pathname,
+                             struct acpi_namespace_node *node,
+                             const union acpi_predefined_info *predefined)
+{
+       u32 param_count;
+       u32 required_params_current;
+       u32 required_params_old;
+
+       /*
+        * Check that the ASL-defined parameter count is what is expected for
+        * this predefined name.
+        *
+        * Methods have 0-7 parameters. All other types have zero.
+        */
+       param_count = 0;
+       if (node->type == ACPI_TYPE_METHOD) {
+               param_count = node->object->method.param_count;
+       }
+
+       /* Validate parameter count - allow two different legal counts (_SCP) */
+
+       required_params_current = predefined->info.param_count & 0x0F;
+       required_params_old = predefined->info.param_count >> 4;
+
+       if ((param_count != required_params_current) &&
+           (param_count != required_params_old)) {
+               ACPI_WARNING((AE_INFO,
+                             "%s: Parameter count mismatch - ASL declared %d, expected %d",
+                             pathname, param_count, required_params_current));
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_for_predefined_name
+ *
+ * PARAMETERS:  Node            - Namespace node for the method/object
+ *
+ * RETURN:      Pointer to entry in predefined table. NULL indicates not found.
+ *
+ * DESCRIPTION: Check an object name against the predefined object list.
+ *
+ ******************************************************************************/
+
+const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
+                                                                   acpi_namespace_node
+                                                                   *node)
+{
+       const union acpi_predefined_info *this_name;
+
+       /* Quick check for a predefined name, first character must be underscore */
+
+       if (node->name.ascii[0] != '_') {
+               return (NULL);
+       }
+
+       /* Search info table for a predefined method/object name */
+
+       this_name = predefined_names;
+       while (this_name->info.name[0]) {
+               if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) {
+
+                       /* Return pointer to this table entry */
+
+                       return (this_name);
+               }
+
+               /*
+                * Skip next entry in the table if this name returns a Package
+                * (next entry contains the package info)
+                */
+               if (this_name->info.expected_btypes & ACPI_RTYPE_PACKAGE) {
+                       this_name++;
+               }
+
+               this_name++;
+       }
+
+       return (NULL);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_package
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              return_object   - Object returned from the evaluation of a
+ *                                method or object
+ *              Predefined      - Pointer to entry in predefined name table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check a returned package object for the correct count and
+ *              correct type of all sub-objects.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_check_package(char *pathname,
+                     union acpi_operand_object *return_object,
+                     const union acpi_predefined_info *predefined)
+{
+       const union acpi_predefined_info *package;
+       union acpi_operand_object *sub_package;
+       union acpi_operand_object **elements;
+       union acpi_operand_object **sub_elements;
+       acpi_status status;
+       u32 expected_count;
+       u32 count;
+       u32 i;
+       u32 j;
+
+       ACPI_FUNCTION_NAME(ns_check_package);
+
+       /* The package info for this name is in the next table entry */
+
+       package = predefined + 1;
+
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "%s Validating return Package of Type %X, Count %X\n",
+                         pathname, package->ret_info.type,
+                         return_object->package.count));
+
+       /* Extract package count and elements array */
+
+       elements = return_object->package.elements;
+       count = return_object->package.count;
+
+       /* The package must have at least one element, else invalid */
+
+       if (!count) {
+               ACPI_WARNING((AE_INFO,
+                             "%s: Return Package has no elements (empty)",
+                             pathname));
+
+               return (AE_AML_OPERAND_VALUE);
+       }
+
+       /*
+        * Decode the type of the expected package contents
+        *
+        * PTYPE1 packages contain no subpackages
+        * PTYPE2 packages contain sub-packages
+        */
+       switch (package->ret_info.type) {
+       case ACPI_PTYPE1_FIXED:
+
+               /*
+                * The package count is fixed and there are no sub-packages
+                *
+                * If package is too small, exit.
+                * If package is larger than expected, issue warning but continue
+                */
+               expected_count =
+                   package->ret_info.count1 + package->ret_info.count2;
+               if (count < expected_count) {
+                       goto package_too_small;
+               } else if (count > expected_count) {
+                       ACPI_WARNING((AE_INFO,
+                                     "%s: Return Package is larger than needed - "
+                                     "found %u, expected %u", pathname, count,
+                                     expected_count));
+               }
+
+               /* Validate all elements of the returned package */
+
+               status = acpi_ns_check_package_elements(pathname, elements,
+                                                       package->ret_info.
+                                                       object_type1,
+                                                       package->ret_info.
+                                                       count1,
+                                                       package->ret_info.
+                                                       object_type2,
+                                                       package->ret_info.
+                                                       count2);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+               break;
+
+       case ACPI_PTYPE1_VAR:
+
+               /*
+                * The package count is variable, there are no sub-packages, and all
+                * elements must be of the same type
+                */
+               for (i = 0; i < count; i++) {
+                       status = acpi_ns_check_object_type(pathname, *elements,
+                                                          package->ret_info.
+                                                          object_type1, i);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       elements++;
+               }
+               break;
+
+       case ACPI_PTYPE1_OPTION:
+
+               /*
+                * The package count is variable, there are no sub-packages. There are
+                * a fixed number of required elements, and a variable number of
+                * optional elements.
+                *
+                * Check if package is at least as large as the minimum required
+                */
+               expected_count = package->ret_info3.count;
+               if (count < expected_count) {
+                       goto package_too_small;
+               }
+
+               /* Variable number of sub-objects */
+
+               for (i = 0; i < count; i++) {
+                       if (i < package->ret_info3.count) {
+
+                               /* These are the required package elements (0, 1, or 2) */
+
+                               status =
+                                   acpi_ns_check_object_type(pathname,
+                                                             *elements,
+                                                             package->
+                                                             ret_info3.
+                                                             object_type[i],
+                                                             i);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+                       } else {
+                               /* These are the optional package elements */
+
+                               status =
+                                   acpi_ns_check_object_type(pathname,
+                                                             *elements,
+                                                             package->
+                                                             ret_info3.
+                                                             tail_object_type,
+                                                             i);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+                       }
+                       elements++;
+               }
+               break;
+
+       case ACPI_PTYPE2_PKG_COUNT:
+
+               /* First element is the (Integer) count of sub-packages to follow */
+
+               status = acpi_ns_check_object_type(pathname, *elements,
+                                                  ACPI_RTYPE_INTEGER, 0);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+
+               /*
+                * Count cannot be larger than the parent package length, but allow it
+                * to be smaller. The >= accounts for the Integer above.
+                */
+               expected_count = (u32) (*elements)->integer.value;
+               if (expected_count >= count) {
+                       goto package_too_small;
+               }
+
+               count = expected_count;
+               elements++;
+
+               /* Now we can walk the sub-packages */
+
+               /*lint -fallthrough */
+
+       case ACPI_PTYPE2:
+       case ACPI_PTYPE2_FIXED:
+       case ACPI_PTYPE2_MIN:
+       case ACPI_PTYPE2_COUNT:
+
+               /*
+                * These types all return a single package that consists of a variable
+                * number of sub-packages
+                */
+               for (i = 0; i < count; i++) {
+                       sub_package = *elements;
+                       sub_elements = sub_package->package.elements;
+
+                       /* Each sub-object must be of type Package */
+
+                       status =
+                           acpi_ns_check_object_type(pathname, sub_package,
+                                                     ACPI_RTYPE_PACKAGE, i);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+
+                       /* Examine the different types of sub-packages */
+
+                       switch (package->ret_info.type) {
+                       case ACPI_PTYPE2:
+                       case ACPI_PTYPE2_PKG_COUNT:
+
+                               /* Each subpackage has a fixed number of elements */
+
+                               expected_count =
+                                   package->ret_info.count1 +
+                                   package->ret_info.count2;
+                               if (sub_package->package.count !=
+                                   expected_count) {
+                                       count = sub_package->package.count;
+                                       goto package_too_small;
+                               }
+
+                               status =
+                                   acpi_ns_check_package_elements(pathname,
+                                                                  sub_elements,
+                                                                  package->
+                                                                  ret_info.
+                                                                  object_type1,
+                                                                  package->
+                                                                  ret_info.
+                                                                  count1,
+                                                                  package->
+                                                                  ret_info.
+                                                                  object_type2,
+                                                                  package->
+                                                                  ret_info.
+                                                                  count2);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+                               break;
+
+                       case ACPI_PTYPE2_FIXED:
+
+                               /* Each sub-package has a fixed length */
+
+                               expected_count = package->ret_info2.count;
+                               if (sub_package->package.count < expected_count) {
+                                       count = sub_package->package.count;
+                                       goto package_too_small;
+                               }
+
+                               /* Check the type of each sub-package element */
+
+                               for (j = 0; j < expected_count; j++) {
+                                       status =
+                                           acpi_ns_check_object_type(pathname,
+                                                                     sub_elements
+                                                                     [j],
+                                                                     package->
+                                                                     ret_info2.
+                                                                     object_type
+                                                                     [j], j);
+                                       if (ACPI_FAILURE(status)) {
+                                               return (status);
+                                       }
+                               }
+                               break;
+
+                       case ACPI_PTYPE2_MIN:
+
+                               /* Each sub-package has a variable but minimum length */
+
+                               expected_count = package->ret_info.count1;
+                               if (sub_package->package.count < expected_count) {
+                                       count = sub_package->package.count;
+                                       goto package_too_small;
+                               }
+
+                               /* Check the type of each sub-package element */
+
+                               status =
+                                   acpi_ns_check_package_elements(pathname,
+                                                                  sub_elements,
+                                                                  package->
+                                                                  ret_info.
+                                                                  object_type1,
+                                                                  sub_package->
+                                                                  package.
+                                                                  count, 0, 0);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+                               break;
+
+                       case ACPI_PTYPE2_COUNT:
+
+                               /* First element is the (Integer) count of elements to follow */
+
+                               status =
+                                   acpi_ns_check_object_type(pathname,
+                                                             *sub_elements,
+                                                             ACPI_RTYPE_INTEGER,
+                                                             0);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+
+                               /* Make sure package is large enough for the Count */
+
+                               expected_count =
+                                   (u32) (*sub_elements)->integer.value;
+                               if (sub_package->package.count < expected_count) {
+                                       count = sub_package->package.count;
+                                       goto package_too_small;
+                               }
+
+                               /* Check the type of each sub-package element */
+
+                               status =
+                                   acpi_ns_check_package_elements(pathname,
+                                                                  (sub_elements
+                                                                   + 1),
+                                                                  package->
+                                                                  ret_info.
+                                                                  object_type1,
+                                                                  (expected_count
+                                                                   - 1), 0, 0);
+                               if (ACPI_FAILURE(status)) {
+                                       return (status);
+                               }
+                               break;
+
+                       default:
+                               break;
+                       }
+
+                       elements++;
+               }
+               break;
+
+       default:
+
+               /* Should not get here if predefined info table is correct */
+
+               ACPI_WARNING((AE_INFO,
+                             "%s: Invalid internal return type in table entry: %X",
+                             pathname, package->ret_info.type));
+
+               return (AE_AML_INTERNAL);
+       }
+
+       return (AE_OK);
+
+      package_too_small:
+
+       /* Error exit for the case with an incorrect package count */
+
+       ACPI_WARNING((AE_INFO, "%s: Return Package is too small - "
+                     "found %u, expected %u", pathname, count,
+                     expected_count));
+
+       return (AE_AML_OPERAND_VALUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_package_elements
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              Elements        - Pointer to the package elements array
+ *              Type1           - Object type for first group
+ *              Count1          - Count for first group
+ *              Type2           - Object type for second group
+ *              Count2          - Count for second group
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check that all elements of a package are of the correct object
+ *              type. Supports up to two groups of different object types.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_check_package_elements(char *pathname,
+                              union acpi_operand_object **elements,
+                              u8 type1, u32 count1, u8 type2, u32 count2)
+{
+       union acpi_operand_object **this_element = elements;
+       acpi_status status;
+       u32 i;
+
+       /*
+        * Up to two groups of package elements are supported by the data
+        * structure. All elements in each group must be of the same type.
+        * The second group can have a count of zero.
+        */
+       for (i = 0; i < count1; i++) {
+               status = acpi_ns_check_object_type(pathname, *this_element,
+                                                  type1, i);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+               this_element++;
+       }
+
+       for (i = 0; i < count2; i++) {
+               status = acpi_ns_check_object_type(pathname, *this_element,
+                                                  type2, (i + count1));
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+               this_element++;
+       }
+
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_object_type
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              return_object   - Object return from the execution of this
+ *                                method/object
+ *              expected_btypes - Bitmap of expected return type(s)
+ *              package_index   - Index of object within parent package (if
+ *                                applicable - ACPI_NOT_PACKAGE otherwise)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check the type of the return object against the expected object
+ *              type(s). Use of Btype allows multiple expected object types.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_check_object_type(char *pathname,
+                         union acpi_operand_object *return_object,
+                         u32 expected_btypes, u32 package_index)
+{
+       acpi_status status = AE_OK;
+       u32 return_btype;
+       char type_buffer[48];   /* Room for 5 types */
+       u32 this_rtype;
+       u32 i;
+       u32 j;
+
+       /*
+        * If we get a NULL return_object here, it is a NULL package element,
+        * and this is always an error.
+        */
+       if (!return_object) {
+               goto type_error_exit;
+       }
+
+       /* A Namespace node should not get here, but make sure */
+
+       if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
+               ACPI_WARNING((AE_INFO,
+                             "%s: Invalid return type - Found a Namespace node [%4.4s] type %s",
+                             pathname, return_object->node.name.ascii,
+                             acpi_ut_get_type_name(return_object->node.type)));
+               return (AE_AML_OPERAND_TYPE);
+       }
+
+       /*
+        * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type.
+        * The bitmapped type allows multiple possible return types.
+        *
+        * Note, the cases below must handle all of the possible types returned
+        * from all of the predefined names (including elements of returned
+        * packages)
+        */
+       switch (ACPI_GET_OBJECT_TYPE(return_object)) {
+       case ACPI_TYPE_INTEGER:
+               return_btype = ACPI_RTYPE_INTEGER;
+               break;
+
+       case ACPI_TYPE_BUFFER:
+               return_btype = ACPI_RTYPE_BUFFER;
+               break;
+
+       case ACPI_TYPE_STRING:
+               return_btype = ACPI_RTYPE_STRING;
+               break;
+
+       case ACPI_TYPE_PACKAGE:
+               return_btype = ACPI_RTYPE_PACKAGE;
+               break;
+
+       case ACPI_TYPE_LOCAL_REFERENCE:
+               return_btype = ACPI_RTYPE_REFERENCE;
+               break;
+
+       default:
+               /* Not one of the supported objects, must be incorrect */
+
+               goto type_error_exit;
+       }
+
+       /* Is the object one of the expected types? */
+
+       if (!(return_btype & expected_btypes)) {
+               goto type_error_exit;
+       }
+
+       /* For reference objects, check that the reference type is correct */
+
+       if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_LOCAL_REFERENCE) {
+               status = acpi_ns_check_reference(pathname, return_object);
+       }
+
+       return (status);
+
+      type_error_exit:
+
+       /* Create a string with all expected types for this predefined object */
+
+       j = 1;
+       type_buffer[0] = 0;
+       this_rtype = ACPI_RTYPE_INTEGER;
+
+       for (i = 0; i < ACPI_NUM_RTYPES; i++) {
+
+               /* If one of the expected types, concatenate the name of this type */
+
+               if (expected_btypes & this_rtype) {
+                       ACPI_STRCAT(type_buffer, &acpi_rtype_names[i][j]);
+                       j = 0;  /* Use name separator from now on */
+               }
+               this_rtype <<= 1;       /* Next Rtype */
+       }
+
+       if (package_index == ACPI_NOT_PACKAGE) {
+               ACPI_WARNING((AE_INFO,
+                             "%s: Return type mismatch - found %s, expected %s",
+                             pathname,
+                             acpi_ut_get_object_type_name(return_object),
+                             type_buffer));
+       } else {
+               ACPI_WARNING((AE_INFO,
+                             "%s: Return Package type mismatch at index %u - "
+                             "found %s, expected %s", pathname, package_index,
+                             acpi_ut_get_object_type_name(return_object),
+                             type_buffer));
+       }
+
+       return (AE_AML_OPERAND_TYPE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_reference
+ *
+ * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ *              return_object   - Object returned from the evaluation of a
+ *                                method or object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check a returned reference object for the correct reference
+ *              type. The only reference type that can be returned from a
+ *              predefined method is a named reference. All others are invalid.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_check_reference(char *pathname,
+                       union acpi_operand_object *return_object)
+{
+
+       /*
+        * Check the reference object for the correct reference type (opcode).
+        * The only type of reference that can be converted to an union acpi_object is
+        * a reference to a named object (reference class: NAME)
+        */
+       if (return_object->reference.class == ACPI_REFCLASS_NAME) {
+               return (AE_OK);
+       }
+
+       ACPI_WARNING((AE_INFO,
+                     "%s: Return type mismatch - unexpected reference object type [%s] %2.2X",
+                     pathname, acpi_ut_get_reference_name(return_object),
+                     return_object->reference.class));
+
+       return (AE_AML_OPERAND_TYPE);
+}
index 8399276cba1e4049155ffd7229e9c06b4fdad8c9..a9a80bf811b3ecca3239006a41e546b6ce1973de 100644 (file)
@@ -331,7 +331,7 @@ acpi_ns_search_and_enter(u32 target_name,
                                      "Found bad character(s) in name, repaired: [%4.4s]\n",
                                      ACPI_CAST_PTR(char, &target_name)));
                } else {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                          "Found bad character(s) in name, repaired: [%4.4s]\n",
                                          ACPI_CAST_PTR(char, &target_name)));
                }
index 38be5865d95df30e382f21b2adb8d2b6837aa2f9..a085cc39c055703bea5b144f01fb5db3478cff7e 100644 (file)
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsxfeval")
+
+/* Local prototypes */
+static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
+
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -69,6 +73,7 @@ ACPI_MODULE_NAME("nsxfeval")
  *              be valid (non-null)
  *
  ******************************************************************************/
+
 acpi_status
 acpi_evaluate_object_typed(acpi_handle handle,
                           acpi_string pathname,
@@ -283,6 +288,10 @@ acpi_evaluate_object(acpi_handle handle,
 
                        if (ACPI_SUCCESS(status)) {
 
+                               /* Dereference Index and ref_of references */
+
+                               acpi_ns_resolve_references(info);
+
                                /* Get the size of the returned object */
 
                                status =
@@ -350,6 +359,74 @@ acpi_evaluate_object(acpi_handle handle,
 
 ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_resolve_references
+ *
+ * PARAMETERS:  Info                    - Evaluation info block
+ *
+ * RETURN:      Info->return_object is replaced with the dereferenced object
+ *
+ * DESCRIPTION: Dereference certain reference objects. Called before an
+ *              internal return object is converted to an external union acpi_object.
+ *
+ * Performs an automatic dereference of Index and ref_of reference objects.
+ * These reference objects are not supported by the union acpi_object, so this is a
+ * last resort effort to return something useful. Also, provides compatibility
+ * with other ACPI implementations.
+ *
+ * NOTE: does not handle references within returned package objects or nested
+ * references, but this support could be added later if found to be necessary.
+ *
+ ******************************************************************************/
+static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
+{
+       union acpi_operand_object *obj_desc = NULL;
+       struct acpi_namespace_node *node;
+
+       /* We are interested in reference objects only */
+
+       if (ACPI_GET_OBJECT_TYPE(info->return_object) !=
+           ACPI_TYPE_LOCAL_REFERENCE) {
+               return;
+       }
+
+       /*
+        * Two types of references are supported - those created by Index and
+        * ref_of operators. A name reference (AML_NAMEPATH_OP) can be converted
+        * to an union acpi_object, so it is not dereferenced here. A ddb_handle
+        * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
+        * an union acpi_object.
+        */
+       switch (info->return_object->reference.class) {
+       case ACPI_REFCLASS_INDEX:
+
+               obj_desc = *(info->return_object->reference.where);
+               break;
+
+       case ACPI_REFCLASS_REFOF:
+
+               node = info->return_object->reference.object;
+               if (node) {
+                       obj_desc = node->object;
+               }
+               break;
+
+       default:
+               return;
+       }
+
+       /* Replace the existing reference object */
+
+       if (obj_desc) {
+               acpi_ut_add_reference(obj_desc);
+               acpi_ut_remove_reference(info->return_object);
+               info->return_object = obj_desc;
+       }
+
+       return;
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_walk_namespace
@@ -379,6 +456,7 @@ ACPI_EXPORT_SYMBOL(acpi_evaluate_object)
  *              function, etc.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_walk_namespace(acpi_object_type type,
                    acpi_handle start_object,
index a287ed550f5474db1802e2bb785ecd3531b33f10..5efa4e7ddb0b18088f8cf68a34ba262f9e8aa677 100644 (file)
@@ -253,6 +253,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
        node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
                (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+               status = AE_BAD_PARAMETER;
                goto cleanup;
        }
 
@@ -264,6 +265,10 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
        info->name = node->name.integer;
        info->valid = 0;
 
+       if (node->type == ACPI_TYPE_METHOD) {
+               info->param_count = node->object->method.param_count;
+       }
+
        status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
index 750e0df15604e13a979684801ffc13e0c3ce7873..6234d3e7acd33e1e4e5f5e31c1c97446454f2abd 100644 (file)
@@ -754,8 +754,8 @@ static acpi_status __acpi_os_execute(acpi_execute_type type,
        }
 
        if (!ret) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                         "Call to queue_work() failed.\n"));
+               printk(KERN_ERR PREFIX
+                         "Call to queue_work() failed.\n");
                status = AE_ERROR;
                kfree(dpc);
        }
index c06238e55d98bebd1582536a684949e194c74229..4647039a0d8a2c7183f1cc25653a673cf7657ff4 100644 (file)
@@ -719,6 +719,8 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
                *op = NULL;
        }
 
+       ACPI_PREEMPTION_POINT();
+
        return_ACPI_STATUS(AE_OK);
 }
 
index 15e1702e48d606ad4313d547dafbc4b99b518d75..68e932f215ea5ef73c407a241a4d11d3367897fa 100644 (file)
@@ -137,6 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        union acpi_parse_object *next;
        const struct acpi_opcode_info *parent_info;
        union acpi_parse_object *replacement_op = NULL;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
 
@@ -186,7 +187,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                        replacement_op =
                            acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto allocate_error;
+                               status = AE_NO_MEMORY;
                        }
                        break;
 
@@ -211,7 +212,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                                replacement_op =
                                    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                                if (!replacement_op) {
-                                       goto allocate_error;
+                                       status = AE_NO_MEMORY;
                                }
                        } else
                            if ((op->common.parent->common.aml_opcode ==
@@ -226,13 +227,13 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                                            acpi_ps_alloc_op(op->common.
                                                             aml_opcode);
                                        if (!replacement_op) {
-                                               goto allocate_error;
+                                               status = AE_NO_MEMORY;
+                                       } else {
+                                               replacement_op->named.data =
+                                                   op->named.data;
+                                               replacement_op->named.length =
+                                                   op->named.length;
                                        }
-
-                                       replacement_op->named.data =
-                                           op->named.data;
-                                       replacement_op->named.length =
-                                           op->named.length;
                                }
                        }
                        break;
@@ -242,7 +243,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                        replacement_op =
                            acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto allocate_error;
+                               status = AE_NO_MEMORY;
                        }
                }
 
@@ -302,14 +303,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
        /* Now we can actually delete the subtree rooted at Op */
 
        acpi_ps_delete_parse_tree(op);
-       return_ACPI_STATUS(AE_OK);
-
-      allocate_error:
-
-       /* Always delete the subtree, even on error */
-
-       acpi_ps_delete_parse_tree(op);
-       return_ACPI_STATUS(AE_NO_MEMORY);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -641,10 +635,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
                                            ACPI_WALK_METHOD_RESTART;
                                }
                        } else {
-                               /* On error, delete any return object */
+                               /* On error, delete any return object or implicit return */
 
                                acpi_ut_remove_reference(previous_walk_state->
                                                         return_desc);
+                               acpi_ds_clear_implicit_return
+                                   (previous_walk_state);
                        }
                }
 
index cf47805a7448ccc9ddfbec7009cc975be371c760..65bf4fa596336534cd69dab10ad18a3f10239216 100644 (file)
@@ -709,7 +709,7 @@ int acpi_pci_link_free_irq(acpi_handle handle)
                          acpi_device_bid(link->device)));
 
        if (link->refcnt == 0) {
-               acpi_ut_evaluate_object(link->device->handle, "_DIS", 0, NULL);
+               acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL);
        }
        mutex_unlock(&acpi_link_lock);
        return (link->irq.active);
@@ -773,7 +773,7 @@ static int acpi_pci_link_add(struct acpi_device *device)
 
       end:
        /* disable all links -- to be activated on use */
-       acpi_ut_evaluate_object(device->handle, "_DIS", 0, NULL);
+       acpi_evaluate_object(device->handle, "_DIS", NULL, NULL);
        mutex_unlock(&acpi_link_lock);
 
        if (result)
index 4ab21cb1c8c7ebde037b51256de4c326efcfd7f6..7ff7349c0c52b92d02e230a4322b3b85f4baa516 100644 (file)
@@ -54,6 +54,14 @@ ACPI_MODULE_NAME("power");
 #define ACPI_POWER_RESOURCE_STATE_OFF  0x00
 #define ACPI_POWER_RESOURCE_STATE_ON   0x01
 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
+
+#ifdef MODULE_PARAM_PREFIX
+#undef MODULE_PARAM_PREFIX
+#endif
+#define MODULE_PARAM_PREFIX "acpi."
+int acpi_power_nocheck;
+module_param_named(power_nocheck, acpi_power_nocheck, bool, 000);
+
 static int acpi_power_add(struct acpi_device *device);
 static int acpi_power_remove(struct acpi_device *device, int type);
 static int acpi_power_resume(struct acpi_device *device);
@@ -128,16 +136,16 @@ acpi_power_get_context(acpi_handle handle,
        return 0;
 }
 
-static int acpi_power_get_state(struct acpi_power_resource *resource, int *state)
+static int acpi_power_get_state(acpi_handle handle, int *state)
 {
        acpi_status status = AE_OK;
        unsigned long sta = 0;
 
 
-       if (!resource || !state)
+       if (!handle || !state)
                return -EINVAL;
 
-       status = acpi_evaluate_integer(resource->device->handle, "_STA", NULL, &sta);
+       status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -145,7 +153,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource, int *state
                              ACPI_POWER_RESOURCE_STATE_OFF;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
-                         resource->name, state ? "on" : "off"));
+                         acpi_ut_get_node_name(handle), state ? "on" : "off"));
 
        return 0;
 }
@@ -153,7 +161,6 @@ static int acpi_power_get_state(struct acpi_power_resource *resource, int *state
 static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
 {
        int result = 0, state1;
-       struct acpi_power_resource *resource = NULL;
        u32 i = 0;
 
 
@@ -161,12 +168,15 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
                return -EINVAL;
 
        /* The state of the list is 'on' IFF all resources are 'on'. */
+       /* */
 
        for (i = 0; i < list->count; i++) {
-               result = acpi_power_get_context(list->handles[i], &resource);
-               if (result)
-                       return result;
-               result = acpi_power_get_state(resource, &state1);
+               /*
+                * The state of the power resource can be obtained by
+                * using the ACPI handle. In such case it is unnecessary to
+                * get the Power resource first and then get its state again.
+                */
+               result = acpi_power_get_state(list->handles[i], &state1);
                if (result)
                        return result;
 
@@ -226,12 +236,18 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       result = acpi_power_get_state(resource, &state);
-       if (result)
-               return result;
-       if (state != ACPI_POWER_RESOURCE_STATE_ON)
-               return -ENOEXEC;
-
+       if (!acpi_power_nocheck) {
+               /*
+                * If acpi_power_nocheck is set, it is unnecessary to check
+                * the power state after power transition.
+                */
+               result = acpi_power_get_state(resource->device->handle,
+                               &state);
+               if (result)
+                       return result;
+               if (state != ACPI_POWER_RESOURCE_STATE_ON)
+                       return -ENOEXEC;
+       }
        /* Update the power resource's _device_ power state */
        resource->device->power.state = ACPI_STATE_D0;
 
@@ -277,11 +293,17 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       result = acpi_power_get_state(resource, &state);
-       if (result)
-               return result;
-       if (state != ACPI_POWER_RESOURCE_STATE_OFF)
-               return -ENOEXEC;
+       if (!acpi_power_nocheck) {
+               /*
+                * If acpi_power_nocheck is set, it is unnecessary to check
+                * the power state after power transition.
+                */
+               result = acpi_power_get_state(handle, &state);
+               if (result)
+                       return result;
+               if (state != ACPI_POWER_RESOURCE_STATE_OFF)
+                       return -ENOEXEC;
+       }
 
        /* Update the power resource's _device_ power state */
        resource->device->power.state = ACPI_STATE_D3;
@@ -555,7 +577,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
        if (!resource)
                goto end;
 
-       result = acpi_power_get_state(resource, &state);
+       result = acpi_power_get_state(resource->device->handle, &state);
        if (result)
                goto end;
 
@@ -668,7 +690,7 @@ static int acpi_power_add(struct acpi_device *device)
        resource->system_level = acpi_object.power_resource.system_level;
        resource->order = acpi_object.power_resource.resource_order;
 
-       result = acpi_power_get_state(resource, &state);
+       result = acpi_power_get_state(device->handle, &state);
        if (result)
                goto end;
 
@@ -735,7 +757,7 @@ static int acpi_power_resume(struct acpi_device *device)
 
        resource = (struct acpi_power_resource *)acpi_driver_data(device);
 
-       result = acpi_power_get_state(resource, &state);
+       result = acpi_power_get_state(device->handle, &state);
        if (result)
                return result;
 
index cf5b1b7b684f1de0473796d26ed8e2edc2213eef..81b40ed5379e76edcd02553aaa4881f1107a1422 100644 (file)
@@ -1587,6 +1587,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 
        if (acpi_idle_bm_check()) {
                if (dev->safe_state) {
+                       dev->last_state = dev->safe_state;
                        return dev->safe_state->enter(dev, dev->safe_state);
                } else {
                        local_irq_disable();
index 80c251ec6d2aac7dff658a9c6df5fec5733bc168..b0614f3794705c0286a3d6e8381db1a7c1809857 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <asm/uaccess.h>
 #endif
+#include <asm/cpufeature.h>
 
 #include <acpi/acpi_bus.h>
 #include <acpi/processor.h>
@@ -334,7 +335,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
        acpi_status status = AE_OK;
        acpi_handle handle = NULL;
 
-
        if (!pr || !pr->performance || !pr->handle)
                return -EINVAL;
 
@@ -347,13 +347,25 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
 
        result = acpi_processor_get_performance_control(pr);
        if (result)
-               return result;
+               goto update_bios;
 
        result = acpi_processor_get_performance_states(pr);
        if (result)
-               return result;
+               goto update_bios;
 
        return 0;
+
+       /*
+        * Having _PPC but missing frequencies (_PSS, _PCT) is a very good hint that
+        * the BIOS is older than the CPU and does not know its frequencies
+        */
+ update_bios:
+       if (ACPI_SUCCESS(acpi_get_handle(pr->handle, "_PPC", &handle))){
+               if(boot_cpu_has(X86_FEATURE_EST))
+                       printk(KERN_WARNING FW_BUG "BIOS needs update for CPU "
+                              "frequency support\n");
+       }
+       return result;
 }
 
 int acpi_processor_notify_smm(struct module *calling_module)
@@ -524,13 +536,13 @@ static int acpi_processor_get_psd(struct acpi_processor   *pr)
 
        psd = buffer.pointer;
        if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _PSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (psd->package.count != 1) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _PSD data\n");
                result = -EFAULT;
                goto end;
        }
@@ -543,19 +555,19 @@ static int acpi_processor_get_psd(struct acpi_processor   *pr)
        status = acpi_extract_package(&(psd->package.elements[0]),
                &format, &state);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _PSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:num_entries\n"));
+               printk(KERN_ERR PREFIX "Unknown _PSD:num_entries\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->revision != ACPI_PSD_REV0_REVISION) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:revision\n"));
+               printk(KERN_ERR PREFIX "Unknown _PSD:revision\n");
                result = -EFAULT;
                goto end;
        }
index a56fc6c4394bb1dab26cb06527d3f89239333683..e89a25824f2a1244eff5bdb7c5e00467b2f48a5d 100644 (file)
@@ -528,13 +528,13 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
 
        tsd = buffer.pointer;
        if (!tsd || (tsd->type != ACPI_TYPE_PACKAGE)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (tsd->package.count != 1) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
@@ -547,19 +547,19 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr)
        status = acpi_extract_package(&(tsd->package.elements[0]),
                                      &format, &state);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _TSD data\n"));
+               printk(KERN_ERR PREFIX "Invalid _TSD data\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->num_entries != ACPI_TSD_REV0_ENTRIES) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:num_entries\n"));
+               printk(KERN_ERR PREFIX "Unknown _TSD:num_entries\n");
                result = -EFAULT;
                goto end;
        }
 
        if (pdomain->revision != ACPI_TSD_REV0_REVISION) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _TSD:revision\n"));
+               printk(KERN_ERR PREFIX "Unknown _TSD:revision\n");
                result = -EFAULT;
                goto end;
        }
index a6b662c00b67764d311366963171a1a5b289f73d..755baf2ca70ad5b44676390242038a737e0f46a2 100644 (file)
@@ -15,9 +15,28 @@ void acpi_reboot(void)
 
        rr = &acpi_gbl_FADT.reset_register;
 
-       /* Is the reset register supported? */
-       if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
-           rr->bit_width != 8 || rr->bit_offset != 0)
+       /*
+        * Is the ACPI reset register supported?
+        *
+        * According to ACPI 3.0, FADT.flags.RESET_REG_SUP indicates
+        * whether the ACPI reset mechanism is supported.
+        *
+        * However, some boxes have this bit clear, yet a valid
+        * ACPI_RESET_REG & RESET_VALUE, and ACPI reboot is the only
+        * mechanism that works for them after S3.
+        *
+        * This suggests that other operating systems may not be checking
+        * the RESET_REG_SUP bit, and are using other means to decide
+        * whether to use the ACPI reboot mechanism or not.
+        *
+        * So when acpi reboot is requested,
+        * only the reset_register is checked. If the following
+        * conditions are met, it indicates that the reset register is supported.
+        *      a. reset_register is not zero
+        *      b. the access width is eight
+        *      c. the bit_offset is zero
+        */
+       if (!(rr->address) || rr->bit_width != 8 || rr->bit_offset != 0)
                return;
 
        reset_value = acpi_gbl_FADT.reset_value;
index d9063ea414e33d2cda60a796dd97eb41379cb1d0..8eaaecf9200939ea4cb72b9a2f9842e4b80af5a7 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
@@ -560,8 +559,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
                              ACPI_GET_OBJECT_TYPE(*sub_object_list)) ||
                             ((ACPI_TYPE_LOCAL_REFERENCE ==
                               ACPI_GET_OBJECT_TYPE(*sub_object_list)) &&
-                             ((*sub_object_list)->reference.opcode ==
-                              AML_INT_NAMEPATH_OP)))) {
+                             ((*sub_object_list)->reference.class ==
+                              ACPI_REFCLASS_NAME)))) {
                                name_found = TRUE;
                        } else {
                                /* Look at the next element */
index 7804a8c40e7a36e0d1505ee7b10994f1ef1805f3..c0bbfa2c419319f92d9f561a98afe0eabb296971 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
@@ -310,13 +309,12 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_LOCAL_REFERENCE:
 
-                               if (obj_desc->reference.opcode !=
-                                   AML_INT_NAMEPATH_OP) {
+                               if (obj_desc->reference.class !=
+                                   ACPI_REFCLASS_NAME) {
                                        ACPI_ERROR((AE_INFO,
-                                                   "(PRT[%X].Source) Need name, found reference op %X",
+                                                   "(PRT[%X].Source) Need name, found Reference Class %X",
                                                    index,
-                                                   obj_desc->reference.
-                                                   opcode));
+                                                   obj_desc->reference.class));
                                        return_ACPI_STATUS(AE_BAD_DATA);
                                }
 
index f6f52c1a2abad88cecc73a41ea65c4bddfafc0ae..3196749398eae552de75ffb51a03da9452114644 100644 (file)
@@ -113,16 +113,16 @@ static int acpi_bus_hot_remove_device(void *context)
 
 
        if (acpi_bus_trim(device, 1)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Removing device failed\n"));
+               printk(KERN_ERR PREFIX
+                               "Removing device failed\n");
                return -1;
        }
 
        /* power off device */
        status = acpi_evaluate_object(handle, "_PS3", NULL, NULL);
        if (ACPI_FAILURE(status) && status != AE_NOT_FOUND)
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                               "Power-off device failed\n"));
+               printk(KERN_WARNING PREFIX
+                               "Power-off device failed\n");
 
        if (device->flags.lockable) {
                arg_list.count = 1;
@@ -276,6 +276,13 @@ int acpi_match_device_ids(struct acpi_device *device,
 {
        const struct acpi_device_id *id;
 
+       /*
+        * If the device is not present, it is unnecessary to load device
+        * driver for it.
+        */
+       if (!device->status.present)
+               return -ENODEV;
+
        if (device->flags.hardware_id) {
                for (id = ids; id->id[0]; id++) {
                        if (!strcmp((char*)id->id, device->pnp.hardware_id))
@@ -477,7 +484,7 @@ static int acpi_device_register(struct acpi_device *device,
 
        result = acpi_device_setup_files(device);
        if(result)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error creating sysfs interface for device %s\n", device->dev.bus_id));
+               printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", device->dev.bus_id);
 
        device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
        return 0;
@@ -744,6 +751,16 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
        if (!acpi_match_device_ids(device, button_device_ids))
                device->wakeup.flags.run_wake = 1;
 
+       /*
+        * Don't set Power button GPE as run_wake
+        * if Fixed Power button is used
+        */
+       if (!strcmp(device->pnp.hardware_id, "PNP0C0C") &&
+               !(acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON)) {
+               device->wakeup.flags.run_wake = 0;
+               device->wakeup.flags.valid = 0;
+       }
+
       end:
        if (ACPI_FAILURE(status))
                device->flags.wake_capable = 0;
@@ -807,6 +824,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
        /* TBD: System wake support and resource requirements. */
 
        device->power.state = ACPI_STATE_UNKNOWN;
+       acpi_bus_get_power(device->handle, &(device->power.state));
 
        return 0;
 }
@@ -1152,20 +1170,6 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
        return 0;
 }
 
-static int
-acpi_is_child_device(struct acpi_device *device,
-                       int (*matcher)(struct acpi_device *))
-{
-       int result = -ENODEV;
-
-       do {
-               if (ACPI_SUCCESS(matcher(device)))
-                       return AE_OK;
-       } while ((device = device->parent));
-
-       return result;
-}
-
 static int
 acpi_add_single_object(struct acpi_device **child,
                       struct acpi_device *parent, acpi_handle handle, int type,
@@ -1221,15 +1225,18 @@ acpi_add_single_object(struct acpi_device **child,
                        result = -ENODEV;
                        goto end;
                }
-               if (!device->status.present) {
-                       /* Bay and dock should be handled even if absent */
-                       if (!ACPI_SUCCESS(
-                            acpi_is_child_device(device, acpi_bay_match)) &&
-                           !ACPI_SUCCESS(
-                            acpi_is_child_device(device, acpi_dock_match))) {
-                                       result = -ENODEV;
-                                       goto end;
-                       }
+               /*
+                * When the device is neither present nor functional, the
+                * device should not be added to Linux ACPI device tree.
+                * When the status of the device is not present but functinal,
+                * it should be added to Linux ACPI tree. For example : bay
+                * device , dock device.
+                * In such conditions it is unncessary to check whether it is
+                * bay device or dock device.
+                */
+               if (!device->status.present && !device->status.functional) {
+                       result = -ENODEV;
+                       goto end;
                }
                break;
        default:
@@ -1251,6 +1258,16 @@ acpi_add_single_object(struct acpi_device **child,
         */
        acpi_device_set_id(device, parent, handle, type);
 
+       /*
+        * The ACPI device is attached to acpi handle before getting
+        * the power/wakeup/peformance flags. Otherwise OS can't get
+        * the corresponding ACPI device by the acpi handle in the course
+        * of getting the power/wakeup/performance flags.
+        */
+       result = acpi_device_set_context(device, type);
+       if (result)
+               goto end;
+
        /*
         * Power Management
         * ----------------
@@ -1281,8 +1298,6 @@ acpi_add_single_object(struct acpi_device **child,
                        goto end;
        }
 
-       if ((result = acpi_device_set_context(device, type)))
-               goto end;
 
        result = acpi_device_register(device, parent);
 
@@ -1402,7 +1417,12 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
                 * TBD: Need notifications and other detection mechanisms
                 *      in place before we can fully implement this.
                 */
-               if (child->status.present) {
+                /*
+                * When the device is not present but functional, it is also
+                * necessary to scan the children of this device.
+                */
+               if (child->status.present || (!child->status.present &&
+                                       child->status.functional)) {
                        status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
                                                      NULL, NULL);
                        if (ACPI_SUCCESS(status)) {
index 4ebbba2b6b194f4f6c6532ad698d9a0582e2519f..bf5b04de02d1c6e48123454656ab3f36e72bf8b7 100644 (file)
@@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
        return 0;
 }
 
+static void physical_device_enable_wakeup(struct acpi_device *adev)
+{
+       struct device *dev = acpi_get_physical_device(adev->handle);
+
+       if (dev && device_can_wakeup(dev))
+               device_set_wakeup_enable(dev, adev->wakeup.state.enabled);
+}
+
 static ssize_t
 acpi_system_write_wakeup_device(struct file *file,
                                const char __user * buffer,
@@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file,
                }
        }
        if (found_dev) {
+               physical_device_enable_wakeup(found_dev);
                list_for_each_safe(node, next, &acpi_wakeup_device_list) {
                        struct acpi_device *dev = container_of(node,
                                                               struct
@@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file,
                                       dev->pnp.bus_id, found_dev->pnp.bus_id);
                                dev->wakeup.state.enabled =
                                    found_dev->wakeup.state.enabled;
+                               physical_device_enable_wakeup(dev);
                        }
                }
        }
index 91dec448b3edcd5055112a892f1c368433bc6281..3eefd6d029f904afc5f668fbb39a6dbf4666667d 100644 (file)
@@ -387,8 +387,8 @@ static ssize_t counter_set(struct kobject *kobj,
                goto end;
 
        if (!(all_counters[index].flags & ACPI_EVENT_VALID)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                       "Can not change Invalid GPE/Fixed Event status\n"));
+               printk(KERN_WARNING PREFIX
+                       "Can not change Invalid GPE/Fixed Event status\n");
                return -EINVAL;
        }
 
index b22185f55a16acf80e9814059acff89a4a1e508b..18747ce8dd2f2b15b83e6e5465fc8b34c8118258 100644 (file)
@@ -110,7 +110,6 @@ acpi_status
 acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
 {
        u32 i;
-       u32 length;
        acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE(tb_add_table);
@@ -145,25 +144,64 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
                        }
                }
 
-               length = ACPI_MIN(table_desc->length,
-                                 acpi_gbl_root_table_list.tables[i].length);
+               /*
+                * Check for a table match on the entire table length,
+                * not just the header.
+                */
+               if (table_desc->length !=
+                   acpi_gbl_root_table_list.tables[i].length) {
+                       continue;
+               }
+
                if (ACPI_MEMCMP(table_desc->pointer,
                                acpi_gbl_root_table_list.tables[i].pointer,
-                               length)) {
+                               acpi_gbl_root_table_list.tables[i].length)) {
                        continue;
                }
 
-               /* Table is already registered */
-
+               /*
+                * Note: the current mechanism does not unregister a table if it is
+                * dynamically unloaded. The related namespace entries are deleted,
+                * but the table remains in the root table list.
+                *
+                * The assumption here is that the number of different tables that
+                * will be loaded is actually small, and there is minimal overhead
+                * in just keeping the table in case it is needed again.
+                *
+                * If this assumption changes in the future (perhaps on large
+                * machines with many table load/unload operations), tables will
+                * need to be unregistered when they are unloaded, and slots in the
+                * root table list should be reused when empty.
+                */
+
+               /*
+                * Table is already registered.
+                * We can delete the table that was passed as a parameter.
+                */
                acpi_tb_delete_table(table_desc);
                *table_index = i;
-               status = AE_ALREADY_EXISTS;
-               goto release;
+
+               if (acpi_gbl_root_table_list.tables[i].
+                   flags & ACPI_TABLE_IS_LOADED) {
+
+                       /* Table is still loaded, this is an error */
+
+                       status = AE_ALREADY_EXISTS;
+                       goto release;
+               } else {
+                       /* Table was unloaded, allow it to be reloaded */
+
+                       table_desc->pointer =
+                           acpi_gbl_root_table_list.tables[i].pointer;
+                       table_desc->address =
+                           acpi_gbl_root_table_list.tables[i].address;
+                       status = AE_OK;
+                       goto print_header;
+               }
        }
 
-       /*
-        * Add the table to the global table list
-        */
+       /* Add the table to the global root table list */
+
        status = acpi_tb_store_table(table_desc->address, table_desc->pointer,
                                     table_desc->length, table_desc->flags,
                                     table_index);
@@ -171,6 +209,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
                goto release;
        }
 
+      print_header:
        acpi_tb_print_table_header(table_desc->address, table_desc->pointer);
 
       release:
index 912703691d36306b0d2256ba345570cab139f688..263ec08a901188d37f2b90b7dbbbc729734e9f0d 100644 (file)
@@ -1213,8 +1213,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
                                  acpi_bus_private_data_handler,
                                  tz->thermal_zone);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error attaching device data\n"));
+               printk(KERN_ERR PREFIX
+                               "Error attaching device data\n");
                return -ENODEV;
        }
 
index 7dcb67e0b215d1d56de71cff60edf3f4e56b2b9b..241c535c1753bb7f844a14805a8aaea88960e586 100644 (file)
@@ -232,7 +232,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
  * RETURN:      Status
  *
  * DESCRIPTION: Validate that the buffer is of the required length or
- *              allocate a new buffer.  Returned buffer is always zeroed.
+ *              allocate a new buffer. Returned buffer is always zeroed.
  *
  ******************************************************************************/
 
@@ -240,7 +240,7 @@ acpi_status
 acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
                          acpi_size required_length)
 {
-       acpi_status status = AE_OK;
+       acpi_size input_buffer_length;
 
        /* Parameter validation */
 
@@ -248,55 +248,58 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
                return (AE_BAD_PARAMETER);
        }
 
-       switch (buffer->length) {
+       /*
+        * Buffer->Length is used as both an input and output parameter. Get the
+        * input actual length and set the output required buffer length.
+        */
+       input_buffer_length = buffer->length;
+       buffer->length = required_length;
+
+       /*
+        * The input buffer length contains the actual buffer length, or the type
+        * of buffer to be allocated by this routine.
+        */
+       switch (input_buffer_length) {
        case ACPI_NO_BUFFER:
 
-               /* Set the exception and returned the required length */
+               /* Return the exception (and the required buffer length) */
 
-               status = AE_BUFFER_OVERFLOW;
-               break;
+               return (AE_BUFFER_OVERFLOW);
 
        case ACPI_ALLOCATE_BUFFER:
 
                /* Allocate a new buffer */
 
                buffer->pointer = acpi_os_allocate(required_length);
-               if (!buffer->pointer) {
-                       return (AE_NO_MEMORY);
-               }
-
-               /* Clear the buffer */
-
-               ACPI_MEMSET(buffer->pointer, 0, required_length);
                break;
 
        case ACPI_ALLOCATE_LOCAL_BUFFER:
 
                /* Allocate a new buffer with local interface to allow tracking */
 
-               buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length);
-               if (!buffer->pointer) {
-                       return (AE_NO_MEMORY);
-               }
+               buffer->pointer = ACPI_ALLOCATE(required_length);
                break;
 
        default:
 
                /* Existing buffer: Validate the size of the buffer */
 
-               if (buffer->length < required_length) {
-                       status = AE_BUFFER_OVERFLOW;
-                       break;
+               if (input_buffer_length < required_length) {
+                       return (AE_BUFFER_OVERFLOW);
                }
+               break;
+       }
 
-               /* Clear the buffer */
+       /* Validate allocation from above or input buffer pointer */
 
-               ACPI_MEMSET(buffer->pointer, 0, required_length);
-               break;
+       if (!buffer->pointer) {
+               return (AE_NO_MEMORY);
        }
 
-       buffer->length = required_length;
-       return (status);
+       /* Have a valid buffer, clear it */
+
+       ACPI_MEMSET(buffer->pointer, 0, required_length);
+       return (AE_OK);
 }
 
 #ifdef NOT_USED_BY_LINUX
index 53499ac90988a19477b39bd9c0113c14594cbf5f..5b2f7c27b705f2714c9fce18f997837ff8bdf6f3 100644 (file)
@@ -42,7 +42,6 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 
@@ -176,20 +175,24 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
 
                /* This is an object reference. */
 
-               switch (internal_object->reference.opcode) {
-               case AML_INT_NAMEPATH_OP:
-
-                       /* For namepath, return the object handle ("reference") */
-
-               default:
-
-                       /* We are referring to the namespace node */
+               switch (internal_object->reference.class) {
+               case ACPI_REFCLASS_NAME:
 
+                       /*
+                        * For namepath, return the object handle ("reference")
+                        * We are referring to the namespace node
+                        */
                        external_object->reference.handle =
                            internal_object->reference.node;
                        external_object->reference.actual_type =
                            acpi_ns_get_type(internal_object->reference.node);
                        break;
+
+               default:
+
+                       /* All other reference types are unsupported */
+
+                       return_ACPI_STATUS(AE_TYPE);
                }
                break;
 
@@ -533,7 +536,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
 
                /* TBD: should validate incoming handle */
 
-               internal_object->reference.opcode = AML_INT_NAMEPATH_OP;
+               internal_object->reference.class = ACPI_REFCLASS_NAME;
                internal_object->reference.node =
                    external_object->reference.handle;
                break;
@@ -743,11 +746,11 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
                 * We copied the reference object, so we now must add a reference
                 * to the object pointed to by the reference
                 *
-                * DDBHandle reference (from Load/load_table is a special reference,
-                * it's Reference.Object is the table index, so does not need to
+                * DDBHandle reference (from Load/load_table) is a special reference,
+                * it does not have a Reference.Object, so does not need to
                 * increase the reference count
                 */
-               if (source_desc->reference.opcode == AML_LOAD_OP) {
+               if (source_desc->reference.class == ACPI_REFCLASS_TABLE) {
                        break;
                }
 
index 42609d3a8aa9db23f3852743f767ee1641b631af..d197c6b29e170e2381e2fcd0765c4368e090121a 100644 (file)
@@ -45,7 +45,6 @@
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utdelete")
@@ -548,8 +547,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
                         * reference must track changes to the ref count of the index or
                         * target object.
                         */
-                       if ((object->reference.opcode == AML_INDEX_OP) ||
-                           (object->reference.opcode == AML_INT_NAMEPATH_OP)) {
+                       if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
+                           (object->reference.class == ACPI_REFCLASS_NAME)) {
                                next_object = object->reference.object;
                        }
                        break;
@@ -586,6 +585,13 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
        ACPI_EXCEPTION((AE_INFO, status,
                        "Could not update object reference count"));
 
+       /* Free any stacked Update State objects */
+
+       while (state_list) {
+               state = acpi_ut_pop_generic_state(&state_list);
+               acpi_ut_delete_generic_state(state);
+       }
+
        return_ACPI_STATUS(status);
 }
 
index a6e71b801d2d5708642a90b76549175957aa2662..670551b95e56e44fecfc075d9cbd5255a2aebc55 100644 (file)
@@ -281,7 +281,6 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
        /* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
                                                ACPI_BITPOSITION_RT_CLOCK_ENABLE,
                                                ACPI_BITMASK_RT_CLOCK_ENABLE},
-       /* ACPI_BITREG_WAKE_ENABLE          */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
        /* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
                                                ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
                                                ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
@@ -575,6 +574,47 @@ char *acpi_ut_get_descriptor_name(void *object)
 
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_get_reference_name
+ *
+ * PARAMETERS:  Object               - An ACPI reference object
+ *
+ * RETURN:      Pointer to a string
+ *
+ * DESCRIPTION: Decode a reference object sub-type to a string.
+ *
+ ******************************************************************************/
+
+/* Printable names of reference object sub-types */
+
+static const char *acpi_gbl_ref_class_names[] = {
+       /* 00 */ "Local",
+       /* 01 */ "Argument",
+       /* 02 */ "RefOf",
+       /* 03 */ "Index",
+       /* 04 */ "DdbHandle",
+       /* 05 */ "Named Object",
+       /* 06 */ "Debug"
+};
+
+const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
+{
+       if (!object)
+               return "NULL Object";
+
+       if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND)
+               return "Not an Operand object";
+
+       if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE)
+               return "Not a Reference object";
+
+       if (object->reference.class > ACPI_REFCLASS_MAX)
+               return "Unknown Reference class";
+
+       return acpi_gbl_ref_class_names[object->reference.class];
+}
+
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*
  * Strings and procedures used for debug only
@@ -677,14 +717,14 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
  *
  * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
  * DESCRIPTION: Init library globals.  All globals that require specific
  *              initialization should be initialized here!
  *
  ******************************************************************************/
 
-void acpi_ut_init_globals(void)
+acpi_status acpi_ut_init_globals(void)
 {
        acpi_status status;
        u32 i;
@@ -695,7 +735,7 @@ void acpi_ut_init_globals(void)
 
        status = acpi_ut_create_caches();
        if (ACPI_FAILURE(status)) {
-               return;
+               return_ACPI_STATUS(status);
        }
 
        /* Mutex locked flags */
@@ -772,8 +812,8 @@ void acpi_ut_init_globals(void)
        acpi_gbl_display_final_mem_stats = FALSE;
 #endif
 
-       return_VOID;
+       return_ACPI_STATUS(AE_OK);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
-    ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
+ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
index f34be6773556beebd53f3dde5f63bc03a78e07cf..9089a158a8740c4fd47d5b75d56c6b3d6e350e67 100644 (file)
@@ -995,6 +995,15 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
                                                         state->pkg.
                                                         this_target_obj, 0);
                        if (!state) {
+
+                               /* Free any stacked Update State objects */
+
+                               while (state_list) {
+                                       state =
+                                           acpi_ut_pop_generic_state
+                                           (&state_list);
+                                       acpi_ut_delete_generic_state(state);
+                               }
                                return_ACPI_STATUS(AE_NO_MEMORY);
                        }
                }
index 916eff399eb3e6c8c9fdd7a00d8a37006621a0d0..c354e7a42bcde3ea4168ea0a0107a4b9ccfa358d 100644 (file)
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utobject")
@@ -478,8 +477,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               switch (internal_object->reference.opcode) {
-               case AML_INT_NAMEPATH_OP:
+               switch (internal_object->reference.class) {
+               case ACPI_REFCLASS_NAME:
 
                        /*
                         * Get the actual length of the full pathname to this object.
@@ -503,8 +502,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
                         * required eventually.
                         */
                        ACPI_ERROR((AE_INFO,
-                                   "Unsupported Reference opcode=%X in object %p",
-                                   internal_object->reference.opcode,
+                                   "Cannot convert to external object - "
+                                   "unsupported Reference Class [%s] %X in object %p",
+                                   acpi_ut_get_reference_name(internal_object),
+                                   internal_object->reference.class,
                                    internal_object));
                        status = AE_TYPE;
                        break;
@@ -513,7 +514,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
 
        default:
 
-               ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
+               ACPI_ERROR((AE_INFO, "Cannot convert to external object - "
+                           "unsupported type [%s] %X in object %p",
+                           acpi_ut_get_object_type_name(internal_object),
                            ACPI_GET_OBJECT_TYPE(internal_object),
                            internal_object));
                status = AE_TYPE;
index f8bdadf3c32fffba99a72c5e4d905d9634331fdc..c198a4d40583e7f14fc0e1a545d496c118c98b96 100644 (file)
@@ -81,7 +81,12 @@ acpi_status __init acpi_initialize_subsystem(void)
 
        /* Initialize all globals used by the subsystem */
 
-       acpi_ut_init_globals();
+       status = acpi_ut_init_globals();
+       if (ACPI_FAILURE(status)) {
+               ACPI_EXCEPTION((AE_INFO, status,
+                               "During initialization of globals"));
+               return_ACPI_STATUS(status);
+       }
 
        /* Create the default mutex objects */
 
index e8a51a1700f710ca45d7ceba5a22429f7d348fbe..4ae39ee8cdef283edad7b1cad95f2915d49efffd 100644 (file)
@@ -1530,8 +1530,8 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
                                                     acpi_video_device_notify,
                                                     data);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Error installing notify handler\n"));
+                       printk(KERN_ERR PREFIX
+                                         "Error installing notify handler\n");
                        if(data->brightness)
                                kfree(data->brightness->levels);
                        kfree(data->brightness);
@@ -1745,8 +1745,8 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
 
                status = acpi_video_bus_get_one_device(dev, video);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                                       "Cant attach device"));
+                       printk(KERN_WARNING PREFIX
+                                       "Cant attach device");
                        continue;
                }
        }
@@ -2003,8 +2003,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
                                             ACPI_DEVICE_NOTIFY,
                                             acpi_video_bus_notify, video);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "Error installing notify handler\n"));
+               printk(KERN_ERR PREFIX
+                                 "Error installing notify handler\n");
                error = -ENODEV;
                goto err_stop_video;
        }
index cfe2c833474d07e0a7dc6ddc35b6656c9bc4523a..47cd7baf9b1bd85fb327efc79186a7e6f5b1c461 100644 (file)
@@ -217,6 +217,35 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
        return 0;
 }
 
+static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
+{
+       struct guid_block *block = NULL;
+       char method[5];
+       struct acpi_object_list input;
+       union acpi_object params[1];
+       acpi_status status;
+       acpi_handle handle;
+
+       block = &wblock->gblock;
+       handle = wblock->handle;
+
+       if (!block)
+               return AE_NOT_EXIST;
+
+       input.count = 1;
+       input.pointer = params;
+       params[0].type = ACPI_TYPE_INTEGER;
+       params[0].integer.value = enable;
+
+       snprintf(method, 5, "WE%02X", block->notify_id);
+       status = acpi_evaluate_object(handle, method, &input, NULL);
+
+       if (status != AE_OK && status != AE_NOT_FOUND)
+               return status;
+       else
+               return AE_OK;
+}
+
 /*
  * Exported WMI functions
  */
@@ -242,7 +271,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
        char method[4] = "WM";
 
        if (!find_guid(guid_string, &wblock))
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
 
        block = &wblock->gblock;
        handle = wblock->handle;
@@ -304,7 +333,7 @@ struct acpi_buffer *out)
                return AE_BAD_PARAMETER;
 
        if (!find_guid(guid_string, &wblock))
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
 
        block = &wblock->gblock;
        handle = wblock->handle;
@@ -314,7 +343,7 @@ struct acpi_buffer *out)
 
        /* Check GUID is a data block */
        if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
 
        input.count = 1;
        input.pointer = wq_params;
@@ -385,7 +414,7 @@ const struct acpi_buffer *in)
                return AE_BAD_DATA;
 
        if (!find_guid(guid_string, &wblock))
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
 
        block = &wblock->gblock;
        handle = wblock->handle;
@@ -395,7 +424,7 @@ const struct acpi_buffer *in)
 
        /* Check GUID is a data block */
        if (block->flags & (ACPI_WMI_EVENT | ACPI_WMI_METHOD))
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
 
        input.count = 2;
        input.pointer = params;
@@ -427,6 +456,7 @@ acpi_status wmi_install_notify_handler(const char *guid,
 wmi_notify_handler handler, void *data)
 {
        struct wmi_block *block;
+       acpi_status status;
 
        if (!guid || !handler)
                return AE_BAD_PARAMETER;
@@ -441,7 +471,9 @@ wmi_notify_handler handler, void *data)
        block->handler = handler;
        block->handler_data = data;
 
-       return AE_OK;
+       status = wmi_method_enable(block, 1);
+
+       return status;
 }
 EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 
@@ -453,6 +485,7 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);
 acpi_status wmi_remove_notify_handler(const char *guid)
 {
        struct wmi_block *block;
+       acpi_status status;
 
        if (!guid)
                return AE_BAD_PARAMETER;
@@ -464,10 +497,12 @@ acpi_status wmi_remove_notify_handler(const char *guid)
        if (!block->handler)
                return AE_NULL_ENTRY;
 
+       status = wmi_method_enable(block, 0);
+
        block->handler = NULL;
        block->handler_data = NULL;
 
-       return AE_OK;
+       return status;
 }
 EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);
 
index 1e1f3f3757ae7bf98fd7ce2d39cfafdc644095f0..14601dc05e4162eeab2f544fd02da2738cd17db4 100644 (file)
@@ -309,6 +309,8 @@ static void nv_nf2_freeze(struct ata_port *ap);
 static void nv_nf2_thaw(struct ata_port *ap);
 static void nv_ck804_freeze(struct ata_port *ap);
 static void nv_ck804_thaw(struct ata_port *ap);
+static int nv_hardreset(struct ata_link *link, unsigned int *class,
+                       unsigned long deadline);
 static int nv_adma_slave_config(struct scsi_device *sdev);
 static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
 static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
@@ -403,28 +405,45 @@ static struct scsi_host_template nv_swncq_sht = {
        .slave_configure        = nv_swncq_slave_config,
 };
 
-static struct ata_port_operations nv_generic_ops = {
+/* OSDL bz3352 reports that some nv controllers can't determine device
+ * signature reliably and nv_hardreset is implemented to work around
+ * the problem.  This was reported on nf3 and it's unclear whether any
+ * other controllers are affected.  However, the workaround has been
+ * applied to all variants and there isn't much to gain by trying to
+ * find out exactly which ones are affected at this point especially
+ * because NV has moved over to ahci for newer controllers.
+ */
+static struct ata_port_operations nv_common_ops = {
        .inherits               = &ata_bmdma_port_ops,
-       .hardreset              = ATA_OP_NULL,
+       .hardreset              = nv_hardreset,
        .scr_read               = nv_scr_read,
        .scr_write              = nv_scr_write,
 };
 
+/* OSDL bz11195 reports that link doesn't come online after hardreset
+ * on generic nv's and there have been several other similar reports
+ * on linux-ide.  Disable hardreset for generic nv's.
+ */
+static struct ata_port_operations nv_generic_ops = {
+       .inherits               = &nv_common_ops,
+       .hardreset              = ATA_OP_NULL,
+};
+
 static struct ata_port_operations nv_nf2_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
        .freeze                 = nv_nf2_freeze,
        .thaw                   = nv_nf2_thaw,
 };
 
 static struct ata_port_operations nv_ck804_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
        .freeze                 = nv_ck804_freeze,
        .thaw                   = nv_ck804_thaw,
        .host_stop              = nv_ck804_host_stop,
 };
 
 static struct ata_port_operations nv_adma_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
 
        .check_atapi_dma        = nv_adma_check_atapi_dma,
        .sff_tf_read            = nv_adma_tf_read,
@@ -448,7 +467,7 @@ static struct ata_port_operations nv_adma_ops = {
 };
 
 static struct ata_port_operations nv_swncq_ops = {
-       .inherits               = &nv_generic_ops,
+       .inherits               = &nv_common_ops,
 
        .qc_defer               = ata_std_qc_defer,
        .qc_prep                = nv_swncq_qc_prep,
@@ -1586,6 +1605,21 @@ static void nv_mcp55_thaw(struct ata_port *ap)
        ata_sff_thaw(ap);
 }
 
+static int nv_hardreset(struct ata_link *link, unsigned int *class,
+                       unsigned long deadline)
+{
+       int rc;
+
+       /* SATA hardreset fails to retrieve proper device signature on
+        * some controllers.  Request follow up SRST.  For more info,
+        * see http://bugzilla.kernel.org/show_bug.cgi?id=3352
+        */
+       rc = sata_sff_hardreset(link, class, deadline);
+       if (rc)
+               return rc;
+       return -EAGAIN;
+}
+
 static void nv_adma_error_handler(struct ata_port *ap)
 {
        struct nv_adma_port_priv *pp = ap->private_data;
index 1e55a658e6cefe0af8014bee290dc81f8b5a119d..32f3a8ed8d3d20e568e5547a48b559537de5fac1 100644 (file)
@@ -256,7 +256,6 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -298,7 +297,6 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
index 6a010681ecf3d33f114bb78607e0d6f19d46b319..af472e05273296e664e8ddcb7fa443f4bc0e60e8 100644 (file)
@@ -102,14 +102,19 @@ static struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
        /* Broadcom BCM2046 */
+       { USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET },
        { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET },
 
+       /* Apple MacBook Pro with Broadcom chip */
+       { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET },
+
        /* IBM/Lenovo ThinkPad with Broadcom chip */
        { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
        { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
        /* Targus ACB10US */
        { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET },
+       { USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET },
 
        /* ANYCOM Bluetooth USB-200 and USB-250 */
        { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET },
@@ -147,6 +152,9 @@ static struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
        { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
 
+       /* Belkin F8T016 device */
+       { USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET },
+
        /* Digianswer devices */
        { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
        { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -169,6 +177,7 @@ static struct usb_device_id blacklist_table[] = {
 struct btusb_data {
        struct hci_dev       *hdev;
        struct usb_device    *udev;
+       struct usb_interface *intf;
        struct usb_interface *isoc;
 
        spinlock_t lock;
@@ -267,7 +276,6 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -350,7 +358,6 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -471,7 +478,6 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev)
                BT_ERR("%s urb %p submission failed (%d)",
                                                hdev->name, urb, -err);
                usb_unanchor_urb(urb);
-               kfree(buf);
        }
 
        usb_free_urb(urb);
@@ -516,7 +522,7 @@ static int btusb_open(struct hci_dev *hdev)
 
        err = btusb_submit_intr_urb(hdev);
        if (err < 0) {
-               clear_bit(BTUSB_INTR_RUNNING, &hdev->flags);
+               clear_bit(BTUSB_INTR_RUNNING, &data->flags);
                clear_bit(HCI_RUNNING, &hdev->flags);
        }
 
@@ -532,8 +538,10 @@ static int btusb_close(struct hci_dev *hdev)
        if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
                return 0;
 
+       cancel_work_sync(&data->work);
+
        clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
-       usb_kill_anchored_urbs(&data->intr_anchor);
+       usb_kill_anchored_urbs(&data->isoc_anchor);
 
        clear_bit(BTUSB_BULK_RUNNING, &data->flags);
        usb_kill_anchored_urbs(&data->bulk_anchor);
@@ -821,6 +829,7 @@ static int btusb_probe(struct usb_interface *intf,
        }
 
        data->udev = interface_to_usbdev(intf);
+       data->intf = intf;
 
        spin_lock_init(&data->lock);
 
@@ -889,7 +898,7 @@ static int btusb_probe(struct usb_interface *intf,
 
        if (data->isoc) {
                err = usb_driver_claim_interface(&btusb_driver,
-                                                       data->isoc, NULL);
+                                                       data->isoc, data);
                if (err < 0) {
                        hci_free_dev(hdev);
                        kfree(data);
@@ -921,13 +930,22 @@ static void btusb_disconnect(struct usb_interface *intf)
 
        hdev = data->hdev;
 
-       if (data->isoc)
-               usb_driver_release_interface(&btusb_driver, data->isoc);
+       __hci_dev_hold(hdev);
 
-       usb_set_intfdata(intf, NULL);
+       usb_set_intfdata(data->intf, NULL);
+
+       if (data->isoc)
+               usb_set_intfdata(data->isoc, NULL);
 
        hci_unregister_dev(hdev);
 
+       if (intf == data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->intf);
+       else if (data->isoc)
+               usb_driver_release_interface(&btusb_driver, data->isoc);
+
+       __hci_dev_put(hdev);
+
        hci_free_dev(hdev);
 }
 
index daeb8f76697123bf47015e0145e5a15ccfe86940..e4dce87095410f8f648137ecb992927a6630c483 100644 (file)
@@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line)
 {
        struct tty_driver *p, *res = NULL;
        int tty_line = 0;
+       int len;
        char *str;
 
+       for (str = name; *str; str++)
+               if ((*str >= '0' && *str <= '9') || *str == ',')
+                       break;
+       if (!*str)
+               return NULL;
+
+       len = str - name;
+       tty_line = simple_strtoul(str, &str, 10);
+
        mutex_lock(&tty_mutex);
        /* Search through the tty devices to look for a match */
        list_for_each_entry(p, &tty_drivers, tty_drivers) {
-               str = name + strlen(p->name);
-               tty_line = simple_strtoul(str, &str, 10);
+               if (strncmp(name, p->name, len) != 0)
+                       continue;
                if (*str == ',')
                        str++;
                if (*str == '\0')
index 5ce07b517c5875def9106c5041402032c3f70fc1..bb6e3b338043e13e8e87bc8fceaad67e8f6a9dcc 100644 (file)
@@ -56,7 +56,11 @@ static void cpuidle_idle_call(void)
                if (pm_idle_old)
                        pm_idle_old();
                else
+#if defined(CONFIG_ARCH_HAS_DEFAULT_IDLE)
+                       default_idle();
+#else
                        local_irq_enable();
+#endif
                return;
        }
 
@@ -67,8 +71,11 @@ static void cpuidle_idle_call(void)
        target_state = &dev->states[next_state];
 
        /* enter the state and update stats */
-       dev->last_residency = target_state->enter(dev, target_state);
        dev->last_state = target_state;
+       dev->last_residency = target_state->enter(dev, target_state);
+       if (dev->last_state)
+               target_state = dev->last_state;
+
        target_state->time += (unsigned long long)dev->last_residency;
        target_state->usage++;
 
index 94df91771243565aa2b660b2a0eed0dc5d2013a3..0778d99aea7c3e6c53e56cdb92b6f11320a6c9f5 100644 (file)
@@ -364,7 +364,7 @@ static void dw_dma_tasklet(unsigned long data)
        int i;
 
        status_block = dma_readl(dw, RAW.BLOCK);
-       status_xfer = dma_readl(dw, RAW.BLOCK);
+       status_xfer = dma_readl(dw, RAW.XFER);
        status_err = dma_readl(dw, RAW.ERROR);
 
        dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n",
index d568c65c137089a1f6402237404c80bb1d402dc1..d9e7a49d6cbf089da4f14f054695bf6be727200e 100644 (file)
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
                { "OTES1 Fan",          36, 2, 60, 1, 0 },
                { NULL, 0, 0, 0, 0, 0 } }
        },
-       { 0x0011, NULL /* Abit AT8 32X, need DMI string */, {
+       { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", {
                { "CPU Core",            0, 0, 10, 1, 0 },
                { "DDR",                 1, 0, 20, 1, 0 },
                { "DDR VTT",             2, 0, 10, 1, 0 },
@@ -303,6 +303,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
                { "SYS Fan",            34, 2, 60, 1, 0 },
                { "AUX1 Fan",           35, 2, 60, 1, 0 },
                { "AUX2 Fan",           36, 2, 60, 1, 0 },
+               { "AUX3 Fan",           37, 2, 60, 1, 0 },
                { NULL, 0, 0, 0, 0, 0 } }
        },
        { 0x0012, NULL /* Abit AN8 32X, need DMI string */, {
index f1133081cc42789b642a9e11c76c5efa6749a618..d793cc0119908abd5494ed9f531a27f3dbbb478b 100644 (file)
@@ -46,6 +46,8 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
+#include <linux/string.h>
+#include <linux/dmi.h>
 #include <asm/io.h>
 
 #define DRVNAME "it87"
@@ -236,6 +238,8 @@ struct it87_sio_data {
        /* Values read from Super-I/O config space */
        u8 revision;
        u8 vid_value;
+       /* Values set based on DMI strings */
+       u8 skip_pwm;
 };
 
 /* For each registered chip, we need to keep some data in memory.
@@ -964,6 +968,7 @@ static int __init it87_find(unsigned short *address,
 {
        int err = -ENODEV;
        u16 chip_type;
+       const char *board_vendor, *board_name;
 
        superio_enter();
        chip_type = force_id ? force_id : superio_inw(DEVID);
@@ -1022,6 +1027,24 @@ static int __init it87_find(unsigned short *address,
                        pr_info("it87: in7 is VCCH (+5V Stand-By)\n");
        }
 
+       /* Disable specific features based on DMI strings */
+       board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+       board_name = dmi_get_system_info(DMI_BOARD_NAME);
+       if (board_vendor && board_name) {
+               if (strcmp(board_vendor, "nVIDIA") == 0
+                && strcmp(board_name, "FN68PT") == 0) {
+                       /* On the Shuttle SN68PT, FAN_CTL2 is apparently not
+                          connected to a fan, but to something else. One user
+                          has reported instant system power-off when changing
+                          the PWM2 duty cycle, so we disable it.
+                          I use the board name string as the trigger in case
+                          the same board is ever used in other systems. */
+                       pr_info("it87: Disabling pwm2 due to "
+                               "hardware constraints\n");
+                       sio_data->skip_pwm = (1 << 1);
+               }
+       }
+
 exit:
        superio_exit();
        return err;
@@ -1168,25 +1191,33 @@ static int __devinit it87_probe(struct platform_device *pdev)
        }
 
        if (enable_pwm_interface) {
-               if ((err = device_create_file(dev,
-                    &sensor_dev_attr_pwm1_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm2_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm3_enable.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm1.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm2.dev_attr))
-                || (err = device_create_file(dev,
-                    &sensor_dev_attr_pwm3.dev_attr))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm1_freq))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm2_freq))
-                || (err = device_create_file(dev,
-                    &dev_attr_pwm3_freq)))
-                       goto ERROR4;
+               if (!(sio_data->skip_pwm & (1 << 0))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm1_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm1.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm1_freq)))
+                               goto ERROR4;
+               }
+               if (!(sio_data->skip_pwm & (1 << 1))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm2_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm2.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm2_freq)))
+                               goto ERROR4;
+               }
+               if (!(sio_data->skip_pwm & (1 << 2))) {
+                       if ((err = device_create_file(dev,
+                            &sensor_dev_attr_pwm3_enable.dev_attr))
+                        || (err = device_create_file(dev,
+                            &sensor_dev_attr_pwm3.dev_attr))
+                        || (err = device_create_file(dev,
+                            &dev_attr_pwm3_freq)))
+                               goto ERROR4;
+               }
        }
 
        if (data->type == it8712 || data->type == it8716
@@ -1546,6 +1577,7 @@ static int __init sm_it87_init(void)
        unsigned short isa_address=0;
        struct it87_sio_data sio_data;
 
+       memset(&sio_data, 0, sizeof(struct it87_sio_data));
        err = it87_find(&isa_address, &sio_data);
        if (err)
                return err;
index 22f6d5c00d80e85829dc5d81133cc5cb2f9c6029..0e7b1c6724aa5e0059deede2ca40f3cf5fcd89e8 100644 (file)
@@ -180,7 +180,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
 };
 
 
-static int i2c_powermac_remove(struct platform_device *dev)
+static int __devexit i2c_powermac_remove(struct platform_device *dev)
 {
        struct i2c_adapter      *adapter = platform_get_drvdata(dev);
        struct pmac_i2c_bus     *bus = i2c_get_adapdata(adapter);
@@ -200,7 +200,7 @@ static int i2c_powermac_remove(struct platform_device *dev)
 }
 
 
-static int __devexit i2c_powermac_probe(struct platform_device *dev)
+static int __devinit i2c_powermac_probe(struct platform_device *dev)
 {
        struct pmac_i2c_bus *bus = dev->dev.platform_data;
        struct device_node *parent = NULL;
index af4491fa7e347c3059b50d6bf68d509cdb24ea5b..307d976c9b69b977c389e62abfbe43682b1d3e24 100644 (file)
@@ -583,8 +583,10 @@ static int __init i2c_dev_init(void)
                goto out;
 
        i2c_dev_class = class_create(THIS_MODULE, "i2c-dev");
-       if (IS_ERR(i2c_dev_class))
+       if (IS_ERR(i2c_dev_class)) {
+               res = PTR_ERR(i2c_dev_class);
                goto out_unreg_chrdev;
+       }
 
        res = i2c_add_driver(&i2cdev_driver);
        if (res)
index fc735ab08ff4f8f3f80c82e911242a2f54f84758..052879a6f8534bf55296e48918c030178f5f99b7 100644 (file)
@@ -292,6 +292,20 @@ config IDE_GENERIC
        tristate "generic/default IDE chipset support"
        depends on ALPHA || X86 || IA64 || M32R || MIPS
        help
+         This is the generic IDE driver.  This driver attaches to the
+         fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and
+         so on).  Please note that if this driver is built into the
+         kernel or loaded before other ATA (IDE or libata) drivers
+         and the controller is located at legacy ports, this driver
+         may grab those ports and thus can prevent the controller
+         specific driver from attaching.
+
+         Also, currently, IDE generic doesn't allow IRQ sharing
+         meaning that the IRQs it grabs won't be available to other
+         controllers sharing those IRQs which usually makes drivers
+         for those controllers fail.  Generally, it's not a good idea
+         to load IDE generic driver on modern systems.
+
          If unsure, say N.
 
 config BLK_DEV_PLATFORM
@@ -766,10 +780,6 @@ config BLK_DEV_IDEDMA_PMAC
          to transfer data to and from memory.  Saying Y is safe and improves
          performance.
 
-config BLK_DEV_IDE_SWARM
-       tristate "IDE for Sibyte evaluation boards"
-       depends on SIBYTE_SB1xxx_SOC
-
 config BLK_DEV_IDE_AU1XXX
        bool "IDE for AMD Alchemy Au1200"
        depends on SOC_AU1200
index 49a8c589e346c15982e158e5116c9fd930aa9b46..f16bb4667238acb65d0a9f3af3ee1421858194a6 100644 (file)
@@ -1661,7 +1661,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
                cdi->mask &= ~CDC_PLAY_AUDIO;
 
        mechtype = buf[8 + 6] >> 5;
-       if (mechtype == mechtype_caddy || mechtype == mechtype_popup)
+       if (mechtype == mechtype_caddy ||
+           mechtype == mechtype_popup ||
+           (drive->atapi_flags & IDE_AFLAG_NO_AUTOCLOSE))
                cdi->mask |= CDC_CLOSE_TRAY;
 
        if (cdi->sanyo_slot > 0) {
@@ -1859,6 +1861,8 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
        { "MATSHITADVD-ROM SR-8176", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
        { "MATSHITADVD-ROM SR-8174", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
        { "Optiarc DVD RW AD-5200A", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
+       { "Optiarc DVD RW AD-7200A", NULL,   IDE_AFLAG_PLAY_AUDIO_OK         },
+       { "Optiarc DVD RW AD-7543A", NULL,   IDE_AFLAG_NO_AUTOCLOSE          },
        { NULL, NULL, 0 }
 };
 
index adc6827558577b32e3d3b144aac17197e6cf03fe..3fa07c0aeaa433e2ba3bfdc769c669ae05f8d71d 100644 (file)
@@ -211,7 +211,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
                                xcount = bcount & 0xffff;
                                if (is_trm290)
                                        xcount = ((xcount >> 2) - 1) << 16;
-                               if (xcount == 0x0000) {
+                               else if (xcount == 0x0000) {
        /* 
         * Most chipsets correctly interpret a length of 0x0000 as 64KB,
         * but at least one (e.g. CS5530) misinterprets it as zero (!).
index 994e41099b42e5e95ed08cce0154bb89b6e727b0..a51a30e9eab3c1e1712fc3924fa934113acef10a 100644 (file)
@@ -1492,7 +1492,7 @@ static struct device_attribute *ide_port_attrs[] = {
 
 static int ide_sysfs_register_port(ide_hwif_t *hwif)
 {
-       int i, rc;
+       int i, uninitialized_var(rc);
 
        for (i = 0; ide_port_attrs[i]; i++) {
                rc = device_create_file(hwif->portdev, ide_port_attrs[i]);
index 1bce84b566304115c2834a1742f03284e2c25ce9..3833189144edd507de0c26339ca8687ed734dedc 100644 (file)
@@ -2338,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
 {
        idetape_tape_t *tape = drive->driver_data;
        struct ide_atapi_pc pc;
-       char fw_rev[6], vendor_id[10], product_id[18];
+       char fw_rev[4], vendor_id[8], product_id[16];
 
        idetape_create_inquiry_cmd(&pc);
        if (idetape_queue_pc_tail(drive, &pc)) {
@@ -2350,11 +2350,11 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
        memcpy(product_id, &pc.buf[16], 16);
        memcpy(fw_rev, &pc.buf[32], 4);
 
-       ide_fixstring(vendor_id, 10, 0);
-       ide_fixstring(product_id, 18, 0);
-       ide_fixstring(fw_rev, 6, 0);
+       ide_fixstring(vendor_id, 8, 0);
+       ide_fixstring(product_id, 16, 0);
+       ide_fixstring(fw_rev, 4, 0);
 
-       printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n",
+       printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n",
                        drive->name, tape->name, vendor_id, product_id, fw_rev);
 }
 
index 677c7b2bac92419879119205bf209c88289879ca..5873fa0b8769e40288dfc2f1bf67d0dec4802782 100644 (file)
@@ -1,4 +1,3 @@
-obj-$(CONFIG_BLK_DEV_IDE_SWARM)                += swarm.o
 obj-$(CONFIG_BLK_DEV_IDE_AU1XXX)       += au1xxx-ide.o
 
 EXTRA_CFLAGS    := -Idrivers/ide
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
deleted file mode 100644 (file)
index badf79f..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
- * Copyright (C) 2004 MontaVista Software Inc.
- *     Author: Manish Lachwani, mlachwani@mvista.com
- * Copyright (C) 2004  MIPS Technologies, Inc.  All rights reserved.
- *     Author: Maciej W. Rozycki <macro@mips.com>
- * Copyright (c) 2006, 2008  Maciej W. Rozycki
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-/*
- *  Derived loosely from ide-pmac.c, so:
- *  Copyright (C) 1998 Paul Mackerras.
- *  Copyright (C) 1995-1998 Mark Lord
- */
-
-/*
- * Boards with SiByte processors so far have supported IDE devices via
- * the Generic Bus, PCI bus, and built-in PCMCIA interface.  In all
- * cases, byte-swapping must be avoided for these devices (whereas
- * other PCI devices, for example, will require swapping).  Any
- * SiByte-targetted kernel including IDE support will include this
- * file.  Probing of a Generic Bus for an IDE device is controlled by
- * the definition of "SIBYTE_HAVE_IDE", which is provided by
- * <asm/sibyte/board.h> for Broadcom boards.
- */
-
-#include <linux/ide.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/platform_device.h>
-
-#include <asm/io.h>
-
-#include <asm/sibyte/board.h>
-#include <asm/sibyte/sb1250_genbus.h>
-#include <asm/sibyte/sb1250_regs.h>
-
-#define DRV_NAME "ide-swarm"
-
-static char swarm_ide_string[] = DRV_NAME;
-
-static struct resource swarm_ide_resource = {
-       .name   = "SWARM GenBus IDE",
-       .flags  = IORESOURCE_MEM,
-};
-
-static struct platform_device *swarm_ide_dev;
-
-static const struct ide_port_info swarm_port_info = {
-       .name                   = DRV_NAME,
-       .host_flags             = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
-};
-
-/*
- * swarm_ide_probe - if the board header indicates the existence of
- * Generic Bus IDE, allocate a HWIF for it.
- */
-static int __devinit swarm_ide_probe(struct device *dev)
-{
-       u8 __iomem *base;
-       struct ide_host *host;
-       phys_t offset, size;
-       int i, rc;
-       hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-
-       if (!SIBYTE_HAVE_IDE)
-               return -ENODEV;
-
-       base = ioremap(A_IO_EXT_BASE, 0x800);
-       offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
-       size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
-       iounmap(base);
-
-       offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
-       size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
-       if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
-               printk(KERN_INFO DRV_NAME
-                      ": IDE interface at GenBus disabled\n");
-               return -EBUSY;
-       }
-
-       printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n",
-              IDE_CS);
-
-       swarm_ide_resource.start = offset;
-       swarm_ide_resource.end = offset + size - 1;
-       if (request_resource(&iomem_resource, &swarm_ide_resource)) {
-               printk(KERN_ERR DRV_NAME
-                      ": can't request I/O memory resource\n");
-               return -EBUSY;
-       }
-
-       base = ioremap(offset, size);
-
-       for (i = 0; i <= 7; i++)
-               hw.io_ports_array[i] =
-                               (unsigned long)(base + ((0x1f0 + i) << 5));
-       hw.io_ports.ctl_addr =
-                               (unsigned long)(base + (0x3f6 << 5));
-       hw.irq = K_INT_GB_IDE;
-       hw.chipset = ide_generic;
-
-       rc = ide_host_add(&swarm_port_info, hws, &host);
-       if (rc)
-               goto err;
-
-       dev_set_drvdata(dev, host);
-
-       return 0;
-err:
-       release_resource(&swarm_ide_resource);
-       iounmap(base);
-       return rc;
-}
-
-static struct device_driver swarm_ide_driver = {
-       .name   = swarm_ide_string,
-       .bus    = &platform_bus_type,
-       .probe  = swarm_ide_probe,
-};
-
-static void swarm_ide_platform_release(struct device *device)
-{
-       struct platform_device *pldev;
-
-       /* free device */
-       pldev = to_platform_device(device);
-       kfree(pldev);
-}
-
-static int __devinit swarm_ide_init_module(void)
-{
-       struct platform_device *pldev;
-       int err;
-
-       printk(KERN_INFO "SWARM IDE driver\n");
-
-       if (driver_register(&swarm_ide_driver)) {
-               printk(KERN_ERR "Driver registration failed\n");
-               err = -ENODEV;
-               goto out;
-       }
-
-        if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) {
-               err = -ENOMEM;
-               goto out_unregister_driver;
-       }
-
-       pldev->name             = swarm_ide_string;
-       pldev->id               = 0;
-       pldev->dev.release      = swarm_ide_platform_release;
-
-       if (platform_device_register(pldev)) {
-               err = -ENODEV;
-               goto out_free_pldev;
-       }
-
-        if (!pldev->dev.driver) {
-               /*
-                * The driver was not bound to this device, there was
-                 * no hardware at this address. Unregister it, as the
-                * release fuction will take care of freeing the
-                * allocated structure
-                */
-               platform_device_unregister (pldev);
-       }
-
-       swarm_ide_dev = pldev;
-
-       return 0;
-
-out_free_pldev:
-       kfree(pldev);
-
-out_unregister_driver:
-       driver_unregister(&swarm_ide_driver);
-out:
-       return err;
-}
-
-module_init(swarm_ide_init_module);
index 1b1df5cc4113f7487e54876afd8aa5f44eaab456..e9ca3cb57d5219960f9f67adf7eadb19dabc206e 100644 (file)
@@ -404,7 +404,7 @@ static void path_rec_completion(int status,
        struct net_device *dev = path->dev;
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_ah *ah = NULL;
-       struct ipoib_ah *old_ah;
+       struct ipoib_ah *old_ah = NULL;
        struct ipoib_neigh *neigh, *tn;
        struct sk_buff_head skqueue;
        struct sk_buff *skb;
@@ -428,12 +428,12 @@ static void path_rec_completion(int status,
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       old_ah   = path->ah;
-       path->ah = ah;
-
        if (ah) {
                path->pathrec = *pathrec;
 
+               old_ah   = path->ah;
+               path->ah = ah;
+
                ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
                          ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
 
index 18f4d7f6ce6d0d3b983d34fffc7b6da437679cc7..2998a6ac9ae44f82aa4a61f88ccda12de56bf71e 100644 (file)
@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
 #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE          0x300
 #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX          0
 #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE           0x01
+#define BCM5974_WELLSPRING_MODE_NORMAL_VALUE           0x08
 
-static int bcm5974_wellspring_mode(struct bcm5974 *dev)
+static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
 {
        char *data = kmalloc(8, GFP_KERNEL);
        int retval = 0, size;
@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
        }
 
        /* apply the mode switch */
-       data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE;
+       data[0] = on ?
+               BCM5974_WELLSPRING_MODE_VENDOR_VALUE :
+               BCM5974_WELLSPRING_MODE_NORMAL_VALUE;
 
        /* write configuration */
        size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
                goto out;
        }
 
-       dprintk(2, "bcm5974: switched to wellspring mode.\n");
+       dprintk(2, "bcm5974: switched to %s mode.\n",
+               on ? "wellspring" : "normal");
 
  out:
        kfree(data);
@@ -481,7 +485,7 @@ exit:
  */
 static int bcm5974_start_traffic(struct bcm5974 *dev)
 {
-       if (bcm5974_wellspring_mode(dev)) {
+       if (bcm5974_wellspring_mode(dev, true)) {
                dprintk(1, "bcm5974: mode switch failed\n");
                goto error;
        }
@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev)
 {
        usb_kill_urb(dev->tp_urb);
        usb_kill_urb(dev->bt_urb);
+       bcm5974_wellspring_mode(dev, false);
 }
 
 /*
index bf44f9d68342bdcd41f4b63ed87737d60e8f70cf..c8b7e8a45c4d91292c09afeb239be90efe598c79 100644 (file)
@@ -119,8 +119,8 @@ static int __devinit jornada720_ts_probe(struct platform_device *pdev)
        input_dev->id.bustype = BUS_HOST;
        input_dev->dev.parent = &pdev->dev;
 
-       input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-       input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+       input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+       input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
        input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
        input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
 
index be0e12144b8b6d5cc03ca24c38caa3d98309e0ed..34935155c1c00077b6e94201cb4c5e6a534f1fad 100644 (file)
@@ -161,6 +161,16 @@ static int fsg_led_probe(struct platform_device *pdev)
 {
        int ret;
 
+       /* Map the LED chip select address space */
+       latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
+       if (!latch_address) {
+               ret = -ENOMEM;
+               goto failremap;
+       }
+
+       latch_value = 0xffff;
+       *latch_address = latch_value;
+
        ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
        if (ret < 0)
                goto failwlan;
@@ -185,20 +195,8 @@ static int fsg_led_probe(struct platform_device *pdev)
        if (ret < 0)
                goto failring;
 
-       /* Map the LED chip select address space */
-       latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
-       if (!latch_address) {
-               ret = -ENOMEM;
-               goto failremap;
-       }
-
-       latch_value = 0xffff;
-       *latch_address = latch_value;
-
        return ret;
 
- failremap:
-       led_classdev_unregister(&fsg_ring_led);
  failring:
        led_classdev_unregister(&fsg_sync_led);
  failsync:
@@ -210,14 +208,14 @@ static int fsg_led_probe(struct platform_device *pdev)
  failwan:
        led_classdev_unregister(&fsg_wlan_led);
  failwlan:
+       iounmap(latch_address);
+ failremap:
 
        return ret;
 }
 
 static int fsg_led_remove(struct platform_device *pdev)
 {
-       iounmap(latch_address);
-
        led_classdev_unregister(&fsg_wlan_led);
        led_classdev_unregister(&fsg_wan_led);
        led_classdev_unregister(&fsg_sata_led);
@@ -225,6 +223,8 @@ static int fsg_led_remove(struct platform_device *pdev)
        led_classdev_unregister(&fsg_sync_led);
        led_classdev_unregister(&fsg_ring_led);
 
+       iounmap(latch_address);
+
        return 0;
 }
 
index 146c06972863fae8d49629bfbb593c474a260ce0..f508729123b54795480eb1ec25092107fd4f4857 100644 (file)
@@ -248,11 +248,10 @@ static int __devinit pca955x_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
 {
        struct pca955x_led *pca955x;
-       int i;
-       int err = -ENODEV;
        struct pca955x_chipdef *chip;
        struct i2c_adapter *adapter;
        struct led_platform_data *pdata;
+       int i, err;
 
        chip = &pca955x_chipdefs[id->driver_data];
        adapter = to_i2c_adapter(client->dev.parent);
@@ -282,43 +281,41 @@ static int __devinit pca955x_probe(struct i2c_client *client,
                }
        }
 
+       pca955x = kzalloc(sizeof(*pca955x) * chip->bits, GFP_KERNEL);
+       if (!pca955x)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, pca955x);
+
        for (i = 0; i < chip->bits; i++) {
-               pca955x = kzalloc(sizeof(struct pca955x_led), GFP_KERNEL);
-               if (!pca955x) {
-                       err = -ENOMEM;
-                       goto exit;
-               }
+               pca955x[i].chipdef = chip;
+               pca955x[i].client = client;
+               pca955x[i].led_num = i;
 
-               pca955x->chipdef = chip;
-               pca955x->client = client;
-               pca955x->led_num = i;
                /* Platform data can specify LED names and default triggers */
                if (pdata) {
                        if (pdata->leds[i].name)
-                               snprintf(pca955x->name, 32, "pca955x:%s",
-                                                       pdata->leds[i].name);
+                               snprintf(pca955x[i].name,
+                                        sizeof(pca955x[i].name), "pca955x:%s",
+                                        pdata->leds[i].name);
                        if (pdata->leds[i].default_trigger)
-                               pca955x->led_cdev.default_trigger =
+                               pca955x[i].led_cdev.default_trigger =
                                        pdata->leds[i].default_trigger;
                } else {
-                       snprintf(pca955x->name, 32, "pca955x:%d", i);
+                       snprintf(pca955x[i].name, sizeof(pca955x[i].name),
+                                "pca955x:%d", i);
                }
-               spin_lock_init(&pca955x->lock);
 
-               pca955x->led_cdev.name = pca955x->name;
-               pca955x->led_cdev.brightness_set =
-                               pca955x_led_set;
+               spin_lock_init(&pca955x[i].lock);
 
-               /*
-                * Client data is a pointer to the _first_ pca955x_led
-                * struct
-                */
-               if (i == 0)
-                       i2c_set_clientdata(client, pca955x);
+               pca955x[i].led_cdev.name = pca955x[i].name;
+               pca955x[i].led_cdev.brightness_set = pca955x_led_set;
 
-               INIT_WORK(&(pca955x->work), pca955x_led_work);
+               INIT_WORK(&pca955x[i].work, pca955x_led_work);
 
-               led_classdev_register(&client->dev, &(pca955x->led_cdev));
+               err = led_classdev_register(&client->dev, &pca955x[i].led_cdev);
+               if (err < 0)
+                       goto exit;
        }
 
        /* Turn off LEDs */
@@ -336,23 +333,32 @@ static int __devinit pca955x_probe(struct i2c_client *client,
        pca955x_write_psc(client, 1, 0);
 
        return 0;
+
 exit:
+       while (i--) {
+               led_classdev_unregister(&pca955x[i].led_cdev);
+               cancel_work_sync(&pca955x[i].work);
+       }
+
+       kfree(pca955x);
+       i2c_set_clientdata(client, NULL);
+
        return err;
 }
 
 static int __devexit pca955x_remove(struct i2c_client *client)
 {
        struct pca955x_led *pca955x = i2c_get_clientdata(client);
-       int leds = pca955x->chipdef->bits;
        int i;
 
-       for (i = 0; i < leds; i++) {
-               led_classdev_unregister(&(pca955x->led_cdev));
-               cancel_work_sync(&(pca955x->work));
-               kfree(pca955x);
-               pca955x = pca955x + 1;
+       for (i = 0; i < pca955x->chipdef->bits; i++) {
+               led_classdev_unregister(&pca955x[i].led_cdev);
+               cancel_work_sync(&pca955x[i].work);
        }
 
+       kfree(pca955x);
+       i2c_set_clientdata(client, NULL);
+
        return 0;
 }
 
index 71dd65aa31b696aa37a894b0d7bd9cbdc2034123..c2fcf28b4c7022b2ec66e0c9d661e8a87b5279c8 100644 (file)
@@ -63,6 +63,7 @@ struct multipath {
 
        const char *hw_handler_name;
        struct work_struct activate_path;
+       struct pgpath *pgpath_to_activate;
        unsigned nr_priority_groups;
        struct list_head priority_groups;
        unsigned pg_init_required;      /* pg_init needs calling? */
@@ -146,6 +147,7 @@ static struct priority_group *alloc_priority_group(void)
 
 static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
 {
+       unsigned long flags;
        struct pgpath *pgpath, *tmp;
        struct multipath *m = ti->private;
 
@@ -154,6 +156,10 @@ static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
                if (m->hw_handler_name)
                        scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev));
                dm_put_device(ti, pgpath->path.dev);
+               spin_lock_irqsave(&m->lock, flags);
+               if (m->pgpath_to_activate == pgpath)
+                       m->pgpath_to_activate = NULL;
+               spin_unlock_irqrestore(&m->lock, flags);
                free_pgpath(pgpath);
        }
 }
@@ -421,6 +427,7 @@ static void process_queued_ios(struct work_struct *work)
                __choose_pgpath(m);
 
        pgpath = m->current_pgpath;
+       m->pgpath_to_activate = m->current_pgpath;
 
        if ((pgpath && !m->queue_io) ||
            (!pgpath && !m->queue_if_no_path))
@@ -1093,8 +1100,15 @@ static void activate_path(struct work_struct *work)
        int ret;
        struct multipath *m =
                container_of(work, struct multipath, activate_path);
-       struct dm_path *path = &m->current_pgpath->path;
+       struct dm_path *path;
+       unsigned long flags;
 
+       spin_lock_irqsave(&m->lock, flags);
+       path = &m->pgpath_to_activate->path;
+       m->pgpath_to_activate = NULL;
+       spin_unlock_irqrestore(&m->lock, flags);
+       if (!path)
+               return;
        ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev));
        pg_init_done(path, ret);
 }
index bca448e118786a78a5e07b54f3cb3a7e3aca85d5..ace998ce59f6af2616da4a24eca66de8b59c69ba 100644 (file)
@@ -837,12 +837,14 @@ static int dm_merge_bvec(struct request_queue *q,
        struct dm_table *map = dm_get_table(md);
        struct dm_target *ti;
        sector_t max_sectors;
-       int max_size;
+       int max_size = 0;
 
        if (unlikely(!map))
-               return 0;
+               goto out;
 
        ti = dm_table_find_target(map, bvm->bi_sector);
+       if (!dm_target_is_valid(ti))
+               goto out_table;
 
        /*
         * Find maximum amount of I/O that won't need splitting
@@ -861,14 +863,16 @@ static int dm_merge_bvec(struct request_queue *q,
        if (max_size && ti->type->merge)
                max_size = ti->type->merge(ti, bvm, biovec, max_size);
 
+out_table:
+       dm_table_put(map);
+
+out:
        /*
         * Always allow an entire first page
         */
        if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT))
                max_size = biovec->bv_len;
 
-       dm_table_put(map);
-
        return max_size;
 }
 
index 216025cf5d4bfdbe430851636818c69789987cab..2c5b6282b569203d8551cbcb23ff4e727318d756 100644 (file)
@@ -10,6 +10,7 @@
 #include "dvb_frontend.h"
 
 #define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
+#define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
 
 /*      Dmoduler               IF (kHz) */
 #define        XC3028_FE_DEFAULT       0               /* Don't load SCODE */
index 4eed783f4bce0daaa4e724e20bfbfe21f80cdef9..a127a4175c402a45c1940d7dec586762557544b5 100644 (file)
@@ -491,6 +491,7 @@ static struct s5h1420_config skystar2_rev2_7_s5h1420_config = {
        .demod_address = 0x53,
        .invert = 1,
        .repeated_start_workaround = 1,
+       .serial_mpeg = 1,
 };
 
 static struct itd1000_config skystar2_rev2_7_itd1000_config = {
index 069d847ba887c39e2f1f83eafdf7c06a07b838a7..0c733c66a44150d7abd6afdea0acbbd760fe385b 100644 (file)
@@ -364,15 +364,16 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
                                       enum dmx_success success)
 {
        struct dmxdev_filter *dmxdevfilter = filter->priv;
+       unsigned long flags;
        int ret;
 
        if (dmxdevfilter->buffer.error) {
                wake_up(&dmxdevfilter->buffer.queue);
                return 0;
        }
-       spin_lock(&dmxdevfilter->dev->lock);
+       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
        if (dmxdevfilter->state != DMXDEV_STATE_GO) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                return 0;
        }
        del_timer(&dmxdevfilter->timer);
@@ -391,7 +392,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
        }
        if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
                dmxdevfilter->state = DMXDEV_STATE_DONE;
-       spin_unlock(&dmxdevfilter->dev->lock);
+       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
        wake_up(&dmxdevfilter->buffer.queue);
        return 0;
 }
@@ -403,11 +404,12 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
 {
        struct dmxdev_filter *dmxdevfilter = feed->priv;
        struct dvb_ringbuffer *buffer;
+       unsigned long flags;
        int ret;
 
-       spin_lock(&dmxdevfilter->dev->lock);
+       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
        if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                return 0;
        }
 
@@ -417,7 +419,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
        else
                buffer = &dmxdevfilter->dev->dvr_buffer;
        if (buffer->error) {
-               spin_unlock(&dmxdevfilter->dev->lock);
+               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
                wake_up(&buffer->queue);
                return 0;
        }
@@ -428,7 +430,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
                dvb_ringbuffer_flush(buffer);
                buffer->error = ret;
        }
-       spin_unlock(&dmxdevfilter->dev->lock);
+       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
        wake_up(&buffer->queue);
        return 0;
 }
index e2eca0b1fe7cfad6dc1215aa6d2bd1247497b93e..a2c1fd5d2f67b05b5b25da04cf6a8dc0d7e8da49 100644 (file)
@@ -399,7 +399,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                              size_t count)
 {
-       spin_lock(&demux->lock);
+       unsigned long flags;
+
+       spin_lock_irqsave(&demux->lock, flags);
 
        while (count--) {
                if (buf[0] == 0x47)
@@ -407,16 +409,17 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                buf += 188;
        }
 
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
 
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
+       unsigned long flags;
        int p = 0, i, j;
 
-       spin_lock(&demux->lock);
+       spin_lock_irqsave(&demux->lock, flags);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -449,17 +452,18 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter);
 
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
+       unsigned long flags;
        int p = 0, i, j;
        u8 tmppack[188];
 
-       spin_lock(&demux->lock);
+       spin_lock_irqsave(&demux->lock, flags);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -500,7 +504,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock(&demux->lock);
+       spin_unlock_irqrestore(&demux->lock, flags);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_204);
index 747d3fa2e5e5c47721a187858bb79c629aea9387..2e9fd2893ede8e573fd8d56adb92e59055f75636 100644 (file)
@@ -59,7 +59,7 @@ struct s5h1420_state {
         * it does not support repeated-start, workaround: write addr-1
         * and then read
         */
-       u8 shadow[255];
+       u8 shadow[256];
 };
 
 static u32 s5h1420_getsymbolrate(struct s5h1420_state* state);
@@ -94,8 +94,11 @@ static u8 s5h1420_readreg(struct s5h1420_state *state, u8 reg)
                if (ret != 3)
                        return ret;
        } else {
-               ret = i2c_transfer(state->i2c, &msg[1], 2);
-               if (ret != 2)
+               ret = i2c_transfer(state->i2c, &msg[1], 1);
+               if (ret != 1)
+                       return ret;
+               ret = i2c_transfer(state->i2c, &msg[2], 1);
+               if (ret != 1)
                        return ret;
        }
 
@@ -823,7 +826,7 @@ static int s5h1420_init (struct dvb_frontend* fe)
        struct s5h1420_state* state = fe->demodulator_priv;
 
        /* disable power down and do reset */
-       state->CON_1_val = 0x10;
+       state->CON_1_val = state->config->serial_mpeg << 4;
        s5h1420_writereg(state, 0x02, state->CON_1_val);
        msleep(10);
        s5h1420_reset(state);
index 4c913f142bc4258a307fd38e63c1d488e97f72fb..ff308136d8658e0f67f6c2d424588cbfcf4b63f9 100644 (file)
@@ -32,10 +32,12 @@ struct s5h1420_config
        u8 demod_address;
 
        /* does the inversion require inversion? */
-       u8 invert : 1;
+       u8 invert:1;
 
-       u8 repeated_start_workaround : 1;
-       u8 cdclk_polarity : 1; /* 1 == falling edge, 0 == raising edge */
+       u8 repeated_start_workaround:1;
+       u8 cdclk_polarity:1; /* 1 == falling edge, 0 == raising edge */
+
+       u8 serial_mpeg:1;
 };
 
 #if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE))
index cc5efb643f33eb9de793843888cea0ee1a747a28..9da260fe3fd12313c0e633567ca818770e4afac4 100644 (file)
@@ -40,6 +40,8 @@ struct usb_device_id smsusb_id_table[] = {
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
        { USB_DEVICE(0x2040, 0x5500),
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
+       { USB_DEVICE(0x2040, 0x5510),
+               .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
        { USB_DEVICE(0x2040, 0x5580),
                .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
        { USB_DEVICE(0x2040, 0x5590),
@@ -87,7 +89,7 @@ static struct sms_board sms_boards[] = {
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
        },
        [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
-               .name   = "Hauppauge WinTV-Nova-T-MiniStick",
+               .name   = "Hauppauge WinTV MiniStick",
                .type   = SMS_NOVA_B0,
                .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw",
        },
index 6ae4cc860efedebdfdfc66babb7c683908417bd8..933eaef41eadd4b3be9e404924d22fb316c1bd70 100644 (file)
@@ -3431,7 +3431,7 @@ static int radio_open(struct inode *inode, struct file *file)
        dprintk("bttv: open minor=%d\n",minor);
 
        for (i = 0; i < bttv_num; i++) {
-               if (bttvs[i].radio_dev->minor == minor) {
+               if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) {
                        btv = &bttvs[i];
                        break;
                }
index c149b7d712e5a703d5f277ebed607aafe6202202..5405c30dbb041748b47941c5e9b0fd19842915c4 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
index a4574740350df30cf6bd3cb84592b8c84d39f779..a8a199047cbde4c448dbfb736beedbb78d3c4e08 100644 (file)
@@ -632,7 +632,7 @@ int cpia2_usb_transfer_cmd(struct camera_data *cam,
 static int submit_urbs(struct camera_data *cam)
 {
        struct urb *urb;
-       int fx, err, i;
+       int fx, err, i, j;
 
        for(i=0; i<NUM_SBUF; ++i) {
                if (cam->sbuf[i].data)
@@ -657,6 +657,9 @@ static int submit_urbs(struct camera_data *cam)
                }
                urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
                if (!urb) {
+                       ERR("%s: usb_alloc_urb error!\n", __func__);
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(cam->sbuf[j].urb);
                        return -ENOMEM;
                }
 
index 8fe5f38c4d7cf694a6a2c9a7738bfffd79324430..3cb9734ec07bf7f6314f84590430ce3ee93b7432 100644 (file)
@@ -163,7 +163,7 @@ static const struct cx18_card cx18_card_h900 = {
        },
        .audio_inputs = {
                { CX18_CARD_INPUT_AUD_TUNER,
-                 CX18_AV_AUDIO8, 0 },
+                 CX18_AV_AUDIO5, 0 },
                { CX18_CARD_INPUT_LINE_IN1,
                  CX18_AV_AUDIO_SERIAL1, 0 },
        },
index 3c006103c1eb369c4817fd74522ef7ffebc91e61..ac3292d7646cb71cc3eb2f229e9b81f352c5c769 100644 (file)
@@ -117,10 +117,10 @@ static void em28xx_audio_isocirq(struct urb *urb)
 
                        if (oldptr + length >= runtime->buffer_size) {
                                unsigned int cnt =
-                                   runtime->buffer_size - oldptr - 1;
+                                   runtime->buffer_size - oldptr;
                                memcpy(runtime->dma_area + oldptr * stride, cp,
                                       cnt * stride);
-                               memcpy(runtime->dma_area, cp + cnt,
+                               memcpy(runtime->dma_area, cp + cnt * stride,
                                       length * stride - cnt * stride);
                        } else {
                                memcpy(runtime->dma_area + oldptr * stride, cp,
@@ -161,8 +161,14 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
 
                memset(dev->adev->transfer_buffer[i], 0x80, sb_size);
                urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
-               if (!urb)
+               if (!urb) {
+                       em28xx_errdev("usb_alloc_urb failed!\n");
+                       for (j = 0; j < i; j++) {
+                               usb_free_urb(dev->adev->urb[j]);
+                               kfree(dev->adev->transfer_buffer[j]);
+                       }
                        return -ENOMEM;
+               }
 
                urb->dev = dev->udev;
                urb->context = dev;
index 452da70e719f330740a1263f07e149d2b74e254b..de943cf6c169aa58eb5eb319cab4f0909a2fe27d 100644 (file)
@@ -93,28 +93,6 @@ struct em28xx_board em28xx_boards[] = {
                        .amux     = 0,
                } },
        },
-       [EM2800_BOARD_KWORLD_USB2800] = {
-               .name         = "Kworld USB2800",
-               .valid        = EM28XX_BOARD_NOT_VALIDATED,
-               .is_em2800    = 1,
-               .vchannels    = 3,
-               .tuner_type   = TUNER_PHILIPS_FCV1236D,
-               .tda9887_conf = TDA9887_PRESENT,
-               .decoder      = EM28XX_SAA7113,
-               .input          = { {
-                       .type     = EM28XX_VMUX_TELEVISION,
-                       .vmux     = SAA7115_COMPOSITE2,
-                       .amux     = 0,
-               }, {
-                       .type     = EM28XX_VMUX_COMPOSITE1,
-                       .vmux     = SAA7115_COMPOSITE0,
-                       .amux     = 1,
-               }, {
-                       .type     = EM28XX_VMUX_SVIDEO,
-                       .vmux     = SAA7115_SVIDEO3,
-                       .amux     = 1,
-               } },
-       },
        [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
                .name         = "Kworld PVR TV 2800 RF",
                .is_em2800    = 0,
@@ -599,7 +577,7 @@ struct em28xx_board em28xx_boards[] = {
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
                        .vmux     = TVP5150_COMPOSITE1,
-                       .amux     = 1,
+                       .amux     = 3,
                }, {
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
@@ -952,22 +930,23 @@ struct em28xx_board em28xx_boards[] = {
        },
        [EM2880_BOARD_KWORLD_DVB_310U] = {
                .name         = "KWorld DVB-T 310U",
-               .valid        = EM28XX_BOARD_NOT_VALIDATED,
                .vchannels    = 3,
                .tuner_type   = TUNER_XC2028,
+               .has_dvb      = 1,
+               .mts_firmware = 1,
                .decoder      = EM28XX_TVP5150,
                .input          = { {
                        .type     = EM28XX_VMUX_TELEVISION,
                        .vmux     = TVP5150_COMPOSITE0,
-                       .amux     = 0,
+                       .amux     = EM28XX_AMUX_VIDEO,
                }, {
                        .type     = EM28XX_VMUX_COMPOSITE1,
                        .vmux     = TVP5150_COMPOSITE1,
-                       .amux     = 1,
-               }, {
+                       .amux     = EM28XX_AMUX_AC97_LINE_IN,
+               }, {    /* S-video has not been tested yet */
                        .type     = EM28XX_VMUX_SVIDEO,
                        .vmux     = TVP5150_SVIDEO,
-                       .amux     = 1,
+                       .amux     = EM28XX_AMUX_AC97_LINE_IN,
                } },
        },
        [EM2881_BOARD_DNT_DA2_HYBRID] = {
@@ -1282,6 +1261,7 @@ static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
 static struct em28xx_hash_table em28xx_eeprom_hash [] = {
        /* P/N: SA 60002070465 Tuner: TVF7533-MF */
        {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
+       {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -1552,9 +1532,12 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
                /* djh - Not sure which demod we need here */
                ctl->demod = XC3028_FE_DEFAULT;
                break;
+       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
+               ctl->demod = XC3028_FE_DEFAULT;
+               ctl->fname = XC3028L_DEFAULT_FIRMWARE;
+               break;
        case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
        case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
-       case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
                /* FIXME: Better to specify the needed IF */
                ctl->demod = XC3028_FE_DEFAULT;
                break;
@@ -1764,6 +1747,20 @@ void em28xx_card_setup(struct em28xx *dev)
                break;
        case EM2820_BOARD_UNKNOWN:
        case EM2800_BOARD_UNKNOWN:
+               /*
+                * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
+                *
+                * This occurs because they share identical USB vendor and
+                * product IDs.
+                *
+                * What we do here is look up the EEPROM hash of the K-WORLD
+                * and if it is found then we decide that we do not have
+                * a DIGIVOX and reset the device to the K-WORLD instead.
+                *
+                * This solution is only valid if they do not share eeprom
+                * hash identities which has not been determined as yet.
+                */
+       case EM2880_BOARD_MSI_DIGIVOX_AD:
                if (!em28xx_hint_board(dev))
                        em28xx_set_model(dev);
                break;
index 4b992bc0083c91954f834afb7a60e95652544cab..d2b1a1a52689f57fe5d9b423887d0c169818f347 100644 (file)
@@ -452,6 +452,15 @@ static int dvb_init(struct em28xx *dev)
                        goto out_free;
                }
                break;
+       case EM2880_BOARD_KWORLD_DVB_310U:
+               dvb->frontend = dvb_attach(zl10353_attach,
+                                               &em28xx_zl10353_with_xc3028,
+                                               &dev->i2c_adap);
+               if (attach_xc3028(0x61, dev) < 0) {
+                       result = -EINVAL;
+                       goto out_free;
+               }
+               break;
        default:
                printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card"
                                " isn't supported yet\n",
index 7be69284da035b0475eb1f7bdb1b6c4cabf3ecaf..ac95c55887df4b38eb1cd8c4478538c53e042aef 100644 (file)
@@ -459,6 +459,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
                urb = usb_alloc_urb(npkt, GFP_KERNEL);
                if (!urb) {
                        err("usb_alloc_urb failed");
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
@@ -468,8 +469,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 
                if (urb->transfer_buffer == NULL) {
                        usb_free_urb(urb);
-                       destroy_urbs(gspca_dev);
                        err("usb_buffer_urb failed");
+                       destroy_urbs(gspca_dev);
                        return -ENOMEM;
                }
                gspca_dev->urb[n] = urb;
index d4be51843286dccc0f5af80502e96ca89e42eb19..ba865b7f1ed81710e902fdf86eb2ae1c1cf06e8a 100644 (file)
@@ -1063,6 +1063,7 @@ static __devinitdata struct usb_device_id device_table[] = {
        {USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302},
        {USB_DEVICE(0x093a, 0x2624), .driver_info = SENSOR_PAC7302},
        {USB_DEVICE(0x093a, 0x2626), .driver_info = SENSOR_PAC7302},
+       {USB_DEVICE(0x093a, 0x262a), .driver_info = SENSOR_PAC7302},
        {}
 };
 MODULE_DEVICE_TABLE(usb, device_table);
index 5dd78c6766eaf0745a52ad0c4e19d651421af524..12b81ae526b7206c0e982e3a845e20c4d1386ca2 100644 (file)
@@ -232,7 +232,7 @@ static struct ctrl sd_ctrls[] = {
 static struct v4l2_pix_format vga_mode[] = {
        {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
                .bytesperline = 160,
-               .sizeimage = 160 * 120 * 5 / 4,
+               .sizeimage = 160 * 120,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 2 | MODE_RAW},
        {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
@@ -264,7 +264,7 @@ static struct v4l2_pix_format sif_mode[] = {
                .priv = 1 | MODE_REDUCED_SIF},
        {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
                .bytesperline = 176,
-               .sizeimage = 176 * 144 * 5 / 4,
+               .sizeimage = 176 * 144,
                .colorspace = V4L2_COLORSPACE_SRGB,
                .priv = 1 | MODE_RAW},
        {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
index d75b1d20b3180e8982db8ca196de42823d1b00c3..572b0f363b640ccb407b7d312716c75c4da85e95 100644 (file)
@@ -707,6 +707,7 @@ static void i2c_w8(struct gspca_dev *gspca_dev,
                        0x08, 0,                /* value, index */
                        gspca_dev->usb_buf, 8,
                        500);
+       msleep(2);
 }
 
 /* read 5 bytes in gspca_dev->usb_buf */
@@ -976,13 +977,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
        case BRIDGE_SN9C105:
                if (regF1 != 0x11)
                        return -ENODEV;
-               reg_w(gspca_dev, 0x02, regGpio, 2);
+               reg_w(gspca_dev, 0x01, regGpio, 2);
                break;
        case BRIDGE_SN9C120:
                if (regF1 != 0x12)
                        return -ENODEV;
                regGpio[1] = 0x70;
-               reg_w(gspca_dev, 0x02, regGpio, 2);
+               reg_w(gspca_dev, 0x01, regGpio, 2);
                break;
        default:
 /*     case BRIDGE_SN9C110: */
@@ -1183,7 +1184,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
        static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd };    /* MI0360 */
        static const __u8 CE_ov76xx[] =
-                       { 0x32, 0xdd, 0x32, 0xdd };     /* OV7630/48 */
+                               { 0x32, 0xdd, 0x32, 0xdd };
 
        sn9c1xx = sn_tb[(int) sd->sensor];
        configure_gpio(gspca_dev, sn9c1xx);
@@ -1223,8 +1224,15 @@ static void sd_start(struct gspca_dev *gspca_dev)
        reg_w(gspca_dev, 0x20, gamma_def, sizeof gamma_def);
        for (i = 0; i < 8; i++)
                reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
+       switch (sd->sensor) {
+       case SENSOR_OV7660:
+               reg_w1(gspca_dev, 0x9a, 0x05);
+               break;
+       default:
                reg_w1(gspca_dev, 0x9a, 0x08);
                reg_w1(gspca_dev, 0x99, 0x59);
+               break;
+       }
 
        mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
        if (mode)
@@ -1275,8 +1283,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
 /*                     reg1 = 0x44; */
 /*                     reg1 = 0x46;    (done) */
                } else {
-                       reg17 = 0x22;   /* 640 MCKSIZE */
-                       reg1 = 0x06;
+                       reg17 = 0xa2;   /* 640 */
+                       reg1 = 0x44;
                }
                break;
        }
@@ -1285,6 +1293,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
        switch (sd->sensor) {
        case SENSOR_OV7630:
        case SENSOR_OV7648:
+       case SENSOR_OV7660:
                reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
                break;
        default:
index cfbc9ebc5c5d8f6bb6518bc352a1c0a69afe530b..95fcfcb9e31b51c8d2ce871fdae89b0096df1862 100644 (file)
@@ -225,7 +225,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
        reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01));
        do {
                reg_r(gspca_dev, 0x8803, 1);
-               if (!gspca_dev->usb_buf)
+               if (!gspca_dev->usb_buf[0])
                        break;
        } while (--retry);
        if (retry == 0)
index 8d7c27e6ac77dd697cab8f9ff4e0b0b617499eaa..d61ef727e0c241e08fe65b4f972450c154828da3 100644 (file)
@@ -6576,8 +6576,8 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
                 cs2102_60HZ, cs2102_60HZScale},
 /* SENSOR_CS2102K 1 */
                {cs2102_NoFliker, cs2102_NoFlikerScale,
-                cs2102_50HZ, cs2102_50HZScale,
-                cs2102_60HZ, cs2102_60HZScale},
+                NULL, NULL, /* currently disabled */
+                NULL, NULL},
 /* SENSOR_GC0305 2 */
                {gc0305_NoFliker, gc0305_NoFliker,
                 gc0305_50HZ, gc0305_50HZ,
index 3d3c48db45d958c4813e8dc2c0ea850a356b796a..c6852402c5e986d3b93161b636db049789f5b6a4 100644 (file)
@@ -3591,7 +3591,7 @@ static int
 ov51x_init_isoc(struct usb_ov511 *ov)
 {
        struct urb *urb;
-       int fx, err, n, size;
+       int fx, err, n, i, size;
 
        PDEBUG(3, "*** Initializing capture ***");
 
@@ -3662,6 +3662,8 @@ ov51x_init_isoc(struct usb_ov511 *ov)
                urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
                if (!urb) {
                        err("init isoc: usb_alloc_urb ret. NULL");
+                       for (i = 0; i < n; i++)
+                               usb_free_urb(ov->sbuf[i].urb);
                        return -ENOMEM;
                }
                ov->sbuf[n].urb = urb;
@@ -5651,7 +5653,7 @@ static ssize_t show_exposure(struct device *cd,
        if (!ov->dev)
                return -ENODEV;
        sensor_get_exposure(ov, &exp);
-       return sprintf(buf, "%d\n", exp >> 8);
+       return sprintf(buf, "%d\n", exp);
 }
 static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
 
index 88e175168438d52ab0ffa113d5b47d561d19d68b..cbe2a3417851a80bc6fa02459afdf521f256117d 100644 (file)
@@ -489,6 +489,8 @@ static const struct pvr2_device_desc pvr2_device_751xx = {
 struct usb_device_id pvr2_device_table[] = {
        { USB_DEVICE(0x2040, 0x2900),
          .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
+       { USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
+         .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
        { USB_DEVICE(0x2040, 0x2400),
          .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
        { USB_DEVICE(0x1164, 0x0622),
index b1d09d8e2b8572c35c88be39100cf35dbc7e21ba..92b83feae3668d2bca19f32a956962c2107de7f7 100644 (file)
@@ -669,7 +669,7 @@ static void s2255_fillbuff(struct s2255_dev *dev, struct s2255_buffer *buf,
                (unsigned long)vbuf, pos);
        /* tell v4l buffer was filled */
 
-       buf->vb.field_count++;
+       buf->vb.field_count = dev->frame_count[chn] * 2;
        do_gettimeofday(&ts);
        buf->vb.ts = ts;
        buf->vb.state = VIDEOBUF_DONE;
@@ -1268,6 +1268,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
        dev->last_frame[chn] = -1;
        dev->bad_payload[chn] = 0;
        dev->cur_frame[chn] = 0;
+       dev->frame_count[chn] = 0;
        for (j = 0; j < SYS_FRAMES; j++) {
                dev->buffer[chn].frame[j].ulState = 0;
                dev->buffer[chn].frame[j].cur_size = 0;
index 6ef3e5297de8c085cbeaa70a2ff628bba1b524dc..feab12aa2c7b5e9c0efb030a7eb1551611dbc766 100644 (file)
@@ -592,7 +592,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
        if (ctrl == NULL)
                return -EINVAL;
 
-       data = kmalloc(8, GFP_KERNEL);
+       data = kmalloc(ctrl->info->size, GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
index 168baabe46591b02b9276e11987aaee44679ac63..11edf79f57be328a0f6a196f7d849776c3235a39 100644 (file)
@@ -911,7 +911,6 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
 
        for (i = 0; i < W9968CF_URBS; i++) {
                urb = usb_alloc_urb(W9968CF_ISO_PACKETS, GFP_KERNEL);
-               cam->urb[i] = urb;
                if (!urb) {
                        for (j = 0; j < i; j++)
                                usb_free_urb(cam->urb[j]);
@@ -919,6 +918,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
                        return -ENOMEM;
                }
 
+               cam->urb[i] = urb;
                urb->dev = udev;
                urb->context = (void*)cam;
                urb->pipe = usb_rcvisocpipe(udev, 1);
index 95c79ad804872b0f0df78bea3ecb4283174a06bd..54ac3fe26ec2ad4afe2371ae069caa25f9aa1597 100644 (file)
@@ -274,10 +274,8 @@ static int wm8739_probe(struct i2c_client *client,
                        client->addr << 1, client->adapter->name);
 
        state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL);
-       if (state == NULL) {
-               kfree(client);
+       if (state == NULL)
                return -ENOMEM;
-       }
        state->vol_l = 0x17; /* 0dB */
        state->vol_r = 0x17; /* 0dB */
        state->muted = 0;
index d842a7cb99d274ad493fea6eed822a918acd58e5..3282be730298a1ee2be50c7a3fc4cbe55b342eae 100644 (file)
@@ -988,7 +988,7 @@ zoran_open_init_params (struct zoran *zr)
        zr->v4l_grab_seq = 0;
        zr->v4l_settings.width = 192;
        zr->v4l_settings.height = 144;
-       zr->v4l_settings.format = &zoran_formats[4];    /* YUY2 - YUV-4:2:2 packed */
+       zr->v4l_settings.format = &zoran_formats[7];    /* YUY2 - YUV-4:2:2 packed */
        zr->v4l_settings.bytesperline =
            zr->v4l_settings.width *
            ((zr->v4l_settings.format->depth + 7) / 8);
index ec6f59674b105c281d25a6a59e8b6696eeff7f7d..2dab9eea4def302f7f934dab82426f3f71850134 100644 (file)
@@ -134,7 +134,7 @@ const struct zoran_format zoran_formats[] = {
        }, {
                .name = "16-bit RGB BE",
                ZFMT(-1,
-                    V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
+                    V4L2_PIX_FMT_RGB565X, V4L2_COLORSPACE_SRGB),
                .depth = 16,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
@@ -2737,7 +2737,8 @@ zoran_do_ioctl (struct inode *inode,
                                    fh->v4l_settings.format->fourcc;
                                fmt->fmt.pix.colorspace =
                                    fh->v4l_settings.format->colorspace;
-                               fmt->fmt.pix.bytesperline = 0;
+                               fmt->fmt.pix.bytesperline =
+                                   fh->v4l_settings.bytesperline;
                                if (BUZ_MAX_HEIGHT <
                                    (fh->v4l_settings.height * 2))
                                        fmt->fmt.pix.field =
@@ -2833,13 +2834,6 @@ zoran_do_ioctl (struct inode *inode,
                                fmt->fmt.pix.pixelformat,
                                (char *) &printformat);
 
-                       if (fmt->fmt.pix.bytesperline > 0) {
-                               dprintk(5,
-                                       KERN_ERR "%s: bpl not supported\n",
-                                       ZR_DEVNAME(zr));
-                               return -EINVAL;
-                       }
-
                        /* we can be requested to do JPEG/raw playback/capture */
                        if (!
                            (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ||
@@ -2923,6 +2917,7 @@ zoran_do_ioctl (struct inode *inode,
                                fh->jpg_buffers.buffer_size =
                                    zoran_v4l2_calc_bufsize(&fh->
                                                            jpg_settings);
+                               fmt->fmt.pix.bytesperline = 0;
                                fmt->fmt.pix.sizeimage =
                                    fh->jpg_buffers.buffer_size;
 
@@ -2979,6 +2974,8 @@ zoran_do_ioctl (struct inode *inode,
 
                                /* tell the user the
                                 * results/missing stuff */
+                               fmt->fmt.pix.bytesperline =
+                                       fh->v4l_settings.bytesperline;
                                fmt->fmt.pix.sizeimage =
                                        fh->v4l_settings.height *
                                        fh->v4l_settings.bytesperline;
index 10c44d3fe01a429172855d2b76ea54e9255b6779..68dc8d9eb24ee87e39a99d3543962b2453bd008f 100644 (file)
@@ -21,7 +21,7 @@ config MFD_SM501
 
 config MFD_SM501_GPIO
        bool "Export GPIO via GPIO layer"
-       depends on MFD_SM501 && HAVE_GPIO_LIB
+       depends on MFD_SM501 && GPIOLIB
         ---help---
         This option uses the gpio library layer to export the 64 GPIO
         lines on the SM501. The platform data is used to supply the
@@ -29,7 +29,7 @@ config MFD_SM501_GPIO
 
 config MFD_ASIC3
        bool "Support for Compaq ASIC3"
-       depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM
+       depends on GENERIC_HARDIRQS && GPIOLIB && ARM
         ---help---
          This driver supports the ASIC3 multifunction chip found on many
          PDAs (mainly iPAQ and HTC based ones)
index bc2a807f210df1804129f0de665c8b2cacde9614..ba5aa2008273bebe869b12403d5f57ce8be0a2bb 100644 (file)
@@ -312,7 +312,6 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
        struct asic3 *asic = platform_get_drvdata(pdev);
        unsigned long clksel = 0;
        unsigned int irq, irq_base;
-       int map_size;
        int ret;
 
        ret = platform_get_irq(pdev, 0);
@@ -534,6 +533,7 @@ static int __init asic3_probe(struct platform_device *pdev)
        struct asic3 *asic;
        struct resource *mem;
        unsigned long clksel;
+       int map_size;
        int ret = 0;
 
        asic = kzalloc(sizeof(struct asic3), GFP_KERNEL);
index a726f3b01a6b36debf060b647c4384a4aab8f1b3..6abb95919c3898a00c684a48739a83f6ab51de73 100644 (file)
@@ -145,6 +145,7 @@ config ACER_WMI
        depends on NEW_LEDS
        depends on BACKLIGHT_CLASS_DEVICE
        depends on SERIO_I8042
+       depends on RFKILL
        select ACPI_WMI
        ---help---
          This is a driver for newer Acer (and Wistron) laptops. It adds
index d8b0d326e4522232fbcc1455dce67fb3e207c059..0532a2de2ce4decf8ef2744d5bfcaa4054b13597 100644 (file)
@@ -33,6 +33,8 @@
 #include <linux/platform_device.h>
 #include <linux/acpi.h>
 #include <linux/i8042.h>
+#include <linux/rfkill.h>
+#include <linux/workqueue.h>
 #include <linux/debugfs.h>
 
 #include <acpi/acpi_drivers.h>
@@ -123,21 +125,15 @@ enum interface_flags {
 
 static int max_brightness = 0xF;
 
-static int wireless = -1;
-static int bluetooth = -1;
 static int mailled = -1;
 static int brightness = -1;
 static int threeg = -1;
 static int force_series;
 
 module_param(mailled, int, 0444);
-module_param(wireless, int, 0444);
-module_param(bluetooth, int, 0444);
 module_param(brightness, int, 0444);
 module_param(threeg, int, 0444);
 module_param(force_series, int, 0444);
-MODULE_PARM_DESC(wireless, "Set initial state of Wireless hardware");
-MODULE_PARM_DESC(bluetooth, "Set initial state of Bluetooth hardware");
 MODULE_PARM_DESC(mailled, "Set initial state of Mail LED");
 MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness");
 MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware");
@@ -145,8 +141,6 @@ MODULE_PARM_DESC(force_series, "Force a different laptop series");
 
 struct acer_data {
        int mailled;
-       int wireless;
-       int bluetooth;
        int threeg;
        int brightness;
 };
@@ -157,6 +151,9 @@ struct acer_debug {
        u32 wmid_devices;
 };
 
+static struct rfkill *wireless_rfkill;
+static struct rfkill *bluetooth_rfkill;
+
 /* Each low-level interface must define at least some of the following */
 struct wmi_interface {
        /* The WMI device type */
@@ -476,7 +473,7 @@ struct wmi_interface *iface)
                }
                break;
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        return AE_OK;
 }
@@ -514,7 +511,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
                        break;
                }
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
 
        /* Actually do the set */
@@ -689,7 +686,7 @@ struct wmi_interface *iface)
                        return 0;
                }
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        status = WMI_execute_u32(method_id, 0, &result);
 
@@ -735,7 +732,7 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface)
                }
                break;
        default:
-               return AE_BAD_ADDRESS;
+               return AE_ERROR;
        }
        return WMI_execute_u32(method_id, (u32)value, NULL);
 }
@@ -785,7 +782,7 @@ static struct wmi_interface wmid_interface = {
 
 static acpi_status get_u32(u32 *value, u32 cap)
 {
-       acpi_status status = AE_BAD_ADDRESS;
+       acpi_status status = AE_ERROR;
 
        switch (interface->type) {
        case ACER_AMW0:
@@ -846,8 +843,6 @@ static void __init acer_commandline_init(void)
         * capability isn't available on the given interface
         */
        set_u32(mailled, ACER_CAP_MAILLED);
-       set_u32(wireless, ACER_CAP_WIRELESS);
-       set_u32(bluetooth, ACER_CAP_BLUETOOTH);
        set_u32(threeg, ACER_CAP_THREEG);
        set_u32(brightness, ACER_CAP_BRIGHTNESS);
 }
@@ -933,40 +928,135 @@ static void acer_backlight_exit(void)
 }
 
 /*
- * Read/ write bool sysfs macro
+ * Rfkill devices
  */
-#define show_set_bool(value, cap) \
-static ssize_t \
-show_bool_##value(struct device *dev, struct device_attribute *attr, \
-       char *buf) \
-{ \
-       u32 result; \
-       acpi_status status = get_u32(&result, cap); \
-       if (ACPI_SUCCESS(status)) \
-               return sprintf(buf, "%u\n", result); \
-       return sprintf(buf, "Read error\n"); \
-} \
-\
-static ssize_t \
-set_bool_##value(struct device *dev, struct device_attribute *attr, \
-       const char *buf, size_t count) \
-{ \
-       u32 tmp = simple_strtoul(buf, NULL, 10); \
-       acpi_status status = set_u32(tmp, cap); \
-               if (ACPI_FAILURE(status)) \
-                       return -EINVAL; \
-       return count; \
-} \
-static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \
-       show_bool_##value, set_bool_##value);
-
-show_set_bool(wireless, ACER_CAP_WIRELESS);
-show_set_bool(bluetooth, ACER_CAP_BLUETOOTH);
-show_set_bool(threeg, ACER_CAP_THREEG);
+static void acer_rfkill_update(struct work_struct *ignored);
+static DECLARE_DELAYED_WORK(acer_rfkill_work, acer_rfkill_update);
+static void acer_rfkill_update(struct work_struct *ignored)
+{
+       u32 state;
+       acpi_status status;
+
+       status = get_u32(&state, ACER_CAP_WIRELESS);
+       if (ACPI_SUCCESS(status))
+               rfkill_force_state(wireless_rfkill, state ?
+                       RFKILL_STATE_UNBLOCKED : RFKILL_STATE_SOFT_BLOCKED);
+
+       if (has_cap(ACER_CAP_BLUETOOTH)) {
+               status = get_u32(&state, ACER_CAP_BLUETOOTH);
+               if (ACPI_SUCCESS(status))
+                       rfkill_force_state(bluetooth_rfkill, state ?
+                               RFKILL_STATE_UNBLOCKED :
+                               RFKILL_STATE_SOFT_BLOCKED);
+       }
+
+       schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
+}
+
+static int acer_rfkill_set(void *data, enum rfkill_state state)
+{
+       acpi_status status;
+       u32 *cap = data;
+       status = set_u32((u32) (state == RFKILL_STATE_UNBLOCKED), *cap);
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
+       return 0;
+}
+
+static struct rfkill * acer_rfkill_register(struct device *dev,
+enum rfkill_type type, char *name, u32 cap)
+{
+       int err;
+       u32 state;
+       u32 *data;
+       struct rfkill *rfkill_dev;
+
+       rfkill_dev = rfkill_allocate(dev, type);
+       if (!rfkill_dev)
+               return ERR_PTR(-ENOMEM);
+       rfkill_dev->name = name;
+       get_u32(&state, cap);
+       rfkill_dev->state = state ? RFKILL_STATE_UNBLOCKED :
+               RFKILL_STATE_SOFT_BLOCKED;
+       data = kzalloc(sizeof(u32), GFP_KERNEL);
+       if (!data) {
+               rfkill_free(rfkill_dev);
+               return ERR_PTR(-ENOMEM);
+       }
+       *data = cap;
+       rfkill_dev->data = data;
+       rfkill_dev->toggle_radio = acer_rfkill_set;
+       rfkill_dev->user_claim_unsupported = 1;
+
+       err = rfkill_register(rfkill_dev);
+       if (err) {
+               kfree(rfkill_dev->data);
+               rfkill_free(rfkill_dev);
+               return ERR_PTR(err);
+       }
+       return rfkill_dev;
+}
+
+static int acer_rfkill_init(struct device *dev)
+{
+       wireless_rfkill = acer_rfkill_register(dev, RFKILL_TYPE_WLAN,
+               "acer-wireless", ACER_CAP_WIRELESS);
+       if (IS_ERR(wireless_rfkill))
+               return PTR_ERR(wireless_rfkill);
+
+       if (has_cap(ACER_CAP_BLUETOOTH)) {
+               bluetooth_rfkill = acer_rfkill_register(dev,
+                       RFKILL_TYPE_BLUETOOTH, "acer-bluetooth",
+                       ACER_CAP_BLUETOOTH);
+               if (IS_ERR(bluetooth_rfkill)) {
+                       kfree(wireless_rfkill->data);
+                       rfkill_unregister(wireless_rfkill);
+                       return PTR_ERR(bluetooth_rfkill);
+               }
+       }
+
+       schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
+
+       return 0;
+}
+
+static void acer_rfkill_exit(void)
+{
+       cancel_delayed_work_sync(&acer_rfkill_work);
+       kfree(wireless_rfkill->data);
+       rfkill_unregister(wireless_rfkill);
+       if (has_cap(ACER_CAP_BLUETOOTH)) {
+               kfree(wireless_rfkill->data);
+               rfkill_unregister(bluetooth_rfkill);
+       }
+       return;
+}
 
 /*
- * Read interface sysfs macro
+ * sysfs interface
  */
+static ssize_t show_bool_threeg(struct device *dev,
+       struct device_attribute *attr, char *buf)
+{
+       u32 result; \
+       acpi_status status = get_u32(&result, ACER_CAP_THREEG);
+       if (ACPI_SUCCESS(status))
+               return sprintf(buf, "%u\n", result);
+       return sprintf(buf, "Read error\n");
+}
+
+static ssize_t set_bool_threeg(struct device *dev,
+       struct device_attribute *attr, const char *buf, size_t count)
+{
+       u32 tmp = simple_strtoul(buf, NULL, 10);
+       acpi_status status = set_u32(tmp, ACER_CAP_THREEG);
+               if (ACPI_FAILURE(status))
+                       return -EINVAL;
+       return count;
+}
+static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg,
+       set_bool_threeg);
+
 static ssize_t show_interface(struct device *dev, struct device_attribute *attr,
        char *buf)
 {
@@ -1026,7 +1116,9 @@ static int __devinit acer_platform_probe(struct platform_device *device)
                        goto error_brightness;
        }
 
-       return 0;
+       err = acer_rfkill_init(&device->dev);
+
+       return err;
 
 error_brightness:
        acer_led_exit();
@@ -1040,6 +1132,8 @@ static int acer_platform_remove(struct platform_device *device)
                acer_led_exit();
        if (has_cap(ACER_CAP_BRIGHTNESS))
                acer_backlight_exit();
+
+       acer_rfkill_exit();
        return 0;
 }
 
@@ -1052,16 +1146,6 @@ pm_message_t state)
        if (!data)
                return -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS)) {
-               get_u32(&value, ACER_CAP_WIRELESS);
-               data->wireless = value;
-       }
-
-       if (has_cap(ACER_CAP_BLUETOOTH)) {
-               get_u32(&value, ACER_CAP_BLUETOOTH);
-               data->bluetooth = value;
-       }
-
        if (has_cap(ACER_CAP_MAILLED)) {
                get_u32(&value, ACER_CAP_MAILLED);
                data->mailled = value;
@@ -1082,15 +1166,6 @@ static int acer_platform_resume(struct platform_device *device)
        if (!data)
                return -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS))
-               set_u32(data->wireless, ACER_CAP_WIRELESS);
-
-       if (has_cap(ACER_CAP_BLUETOOTH))
-               set_u32(data->bluetooth, ACER_CAP_BLUETOOTH);
-
-       if (has_cap(ACER_CAP_THREEG))
-               set_u32(data->threeg, ACER_CAP_THREEG);
-
        if (has_cap(ACER_CAP_MAILLED))
                set_u32(data->mailled, ACER_CAP_MAILLED);
 
@@ -1115,12 +1190,6 @@ static struct platform_device *acer_platform_device;
 
 static int remove_sysfs(struct platform_device *device)
 {
-       if (has_cap(ACER_CAP_WIRELESS))
-               device_remove_file(&device->dev, &dev_attr_wireless);
-
-       if (has_cap(ACER_CAP_BLUETOOTH))
-               device_remove_file(&device->dev, &dev_attr_bluetooth);
-
        if (has_cap(ACER_CAP_THREEG))
                device_remove_file(&device->dev, &dev_attr_threeg);
 
@@ -1133,20 +1202,6 @@ static int create_sysfs(void)
 {
        int retval = -ENOMEM;
 
-       if (has_cap(ACER_CAP_WIRELESS)) {
-               retval = device_create_file(&acer_platform_device->dev,
-                       &dev_attr_wireless);
-               if (retval)
-                       goto error_sysfs;
-       }
-
-       if (has_cap(ACER_CAP_BLUETOOTH)) {
-               retval = device_create_file(&acer_platform_device->dev,
-                       &dev_attr_bluetooth);
-               if (retval)
-                       goto error_sysfs;
-       }
-
        if (has_cap(ACER_CAP_THREEG)) {
                retval = device_create_file(&acer_platform_device->dev,
                        &dev_attr_threeg);
index facdb9893c84c322dbb65f47e2a7bf8de3c69685..1ee8501e90f11eb7e350355712625120dd2a5aeb 100644 (file)
@@ -450,12 +450,14 @@ static int eeepc_get_fan_pwm(void)
        int value = 0;
 
        read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value);
+       value = value * 255 / 100;
        return (value);
 }
 
 static void eeepc_set_fan_pwm(int value)
 {
-       value = SENSORS_LIMIT(value, 0, 100);
+       value = SENSORS_LIMIT(value, 0, 255);
+       value = value * 100 / 255;
        ec_write(EEEPC_EC_SC02, value);
 }
 
@@ -520,15 +522,23 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
        static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
 
 EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
-EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR,
+EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
                         eeepc_get_fan_pwm, eeepc_set_fan_pwm);
 EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
                         eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
 
+static ssize_t
+show_name(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       return sprintf(buf, "eeepc\n");
+}
+static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
+
 static struct attribute *hwmon_attributes[] = {
-       &sensor_dev_attr_fan1_pwm.dev_attr.attr,
+       &sensor_dev_attr_pwm1.dev_attr.attr,
        &sensor_dev_attr_fan1_input.dev_attr.attr,
        &sensor_dev_attr_pwm1_enable.dev_attr.attr,
+       &sensor_dev_attr_name.dev_attr.attr,
        NULL
 };
 
index 917035e16da4c10eb53745fc07b5b62e20738d64..00008967ef7ae505568836510931eef134c59102 100644 (file)
@@ -426,8 +426,6 @@ static u32 atmci_submit_data(struct mmc_host *mmc, struct mmc_data *data)
        host->sg = NULL;
        host->data = data;
 
-       mci_writel(host, BLKR, MCI_BCNT(data->blocks)
-                       | MCI_BLKLEN(data->blksz));
        dev_vdbg(&mmc->class_dev, "BLKR=0x%08x\n",
                        MCI_BCNT(data->blocks) | MCI_BLKLEN(data->blksz));
 
@@ -483,6 +481,10 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
                if (data->blocks > 1 && data->blksz & 3)
                        goto fail;
                atmci_set_timeout(host, data);
+
+               /* Must set block count/size before sending command */
+               mci_writel(host, BLKR, MCI_BCNT(data->blocks)
+                               | MCI_BLKLEN(data->blksz));
        }
 
        iflags = MCI_CMDRDY;
index ac4e506b4f88a495cd9d6e7616cc662ed60abf96..5ea6b60fa3774a5ed6673949bd8e7ea0ee780170 100644 (file)
@@ -257,7 +257,6 @@ struct e1000_adapter {
        struct net_device *netdev;
        struct pci_dev *pdev;
        struct net_device_stats net_stats;
-       spinlock_t stats_lock;      /* prevent concurrent stats updates */
 
        /* structs defined in e1000_hw.h */
        struct e1000_hw hw;
@@ -284,6 +283,8 @@ struct e1000_adapter {
        unsigned long led_status;
 
        unsigned int flags;
+       struct work_struct downshift_task;
+       struct work_struct update_phy_task;
 };
 
 struct e1000_info {
@@ -305,6 +306,7 @@ struct e1000_info {
 #define FLAG_HAS_CTRLEXT_ON_LOAD          (1 << 5)
 #define FLAG_HAS_SWSM_ON_LOAD             (1 << 6)
 #define FLAG_HAS_JUMBO_FRAMES             (1 << 7)
+#define FLAG_READ_ONLY_NVM                (1 << 8)
 #define FLAG_IS_ICH                       (1 << 9)
 #define FLAG_HAS_SMART_POWER_DOWN         (1 << 11)
 #define FLAG_IS_QUAD_PORT_A               (1 << 12)
@@ -385,6 +387,7 @@ extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
 extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
 extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
 
+extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw);
 extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
                                                 bool state);
 extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
index e21c9e0f3738441a159ad0a4068e9bb8fe2b82e5..33a3ff17b5d07d80556dd394efed6d692f7faf05 100644 (file)
@@ -432,6 +432,10 @@ static void e1000_get_regs(struct net_device *netdev,
        regs_buff[11] = er32(TIDV);
 
        regs_buff[12] = adapter->hw.phy.type;  /* PHY type (IGP=1, M88=0) */
+
+       /* ethtool doesn't use anything past this point, so all this
+        * code is likely legacy junk for apps that may or may not
+        * exist */
        if (hw->phy.type == e1000_phy_m88) {
                e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
                regs_buff[13] = (u32)phy_data; /* cable length */
@@ -447,7 +451,7 @@ static void e1000_get_regs(struct net_device *netdev,
                regs_buff[22] = adapter->phy_stats.receive_errors;
                regs_buff[23] = regs_buff[13]; /* mdix mode */
        }
-       regs_buff[21] = adapter->phy_stats.idle_errors;  /* phy idle errors */
+       regs_buff[21] = 0; /* was idle_errors */
        e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
        regs_buff[24] = (u32)phy_data;  /* phy local receiver status */
        regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
@@ -529,6 +533,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
        if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16)))
                return -EFAULT;
 
+       if (adapter->flags & FLAG_READ_ONLY_NVM)
+               return -EINVAL;
+
        max_len = hw->nvm.word_size * 2;
 
        first_word = eeprom->offset >> 1;
index 9e38452a738cc4cd6038cf8829c0ff37787df64e..bcd2bc477af29110636abec9920b3f4a76a244b7 100644 (file)
@@ -58,6 +58,7 @@
 #define ICH_FLASH_HSFCTL               0x0006
 #define ICH_FLASH_FADDR                        0x0008
 #define ICH_FLASH_FDATA0               0x0010
+#define ICH_FLASH_PR0                  0x0074
 
 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500
 #define ICH_FLASH_WRITE_COMMAND_TIMEOUT        500
@@ -150,6 +151,19 @@ union ich8_hws_flash_regacc {
        u16 regval;
 };
 
+/* ICH Flash Protected Region */
+union ich8_flash_protected_range {
+       struct ich8_pr {
+               u32 base:13;     /* 0:12 Protected Range Base */
+               u32 reserved1:2; /* 13:14 Reserved */
+               u32 rpe:1;       /* 15 Read Protection Enable */
+               u32 limit:13;    /* 16:28 Protected Range Limit */
+               u32 reserved2:2; /* 29:30 Reserved */
+               u32 wpe:1;       /* 31 Write Protection Enable */
+       } range;
+       u32 regval;
+};
+
 static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
 static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
 static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
@@ -366,6 +380,9 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
        return 0;
 }
 
+static DEFINE_MUTEX(nvm_mutex);
+static pid_t nvm_owner = -1;
+
 /**
  *  e1000_acquire_swflag_ich8lan - Acquire software control flag
  *  @hw: pointer to the HW structure
@@ -379,6 +396,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
        u32 extcnf_ctrl;
        u32 timeout = PHY_CFG_TIMEOUT;
 
+       might_sleep();
+
+       if (!mutex_trylock(&nvm_mutex)) {
+               WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",
+                    nvm_owner);
+               mutex_lock(&nvm_mutex);
+       }
+       nvm_owner = current->pid;
+
        while (timeout) {
                extcnf_ctrl = er32(EXTCNF_CTRL);
                extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
@@ -393,6 +419,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 
        if (!timeout) {
                hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
+               nvm_owner = -1;
+               mutex_unlock(&nvm_mutex);
                return -E1000_ERR_CONFIG;
        }
 
@@ -414,6 +442,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
        extcnf_ctrl = er32(EXTCNF_CTRL);
        extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
        ew32(EXTCNF_CTRL, extcnf_ctrl);
+
+       nvm_owner = -1;
+       mutex_unlock(&nvm_mutex);
 }
 
 /**
@@ -1284,6 +1315,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
         * programming failed.
         */
        if (ret_val) {
+               /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
                hw_dbg(hw, "Flash commit failed.\n");
                e1000_release_swflag_ich8lan(hw);
                return ret_val;
@@ -1373,6 +1405,49 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
        return e1000e_validate_nvm_checksum_generic(hw);
 }
 
+/**
+ *  e1000e_write_protect_nvm_ich8lan - Make the NVM read-only
+ *  @hw: pointer to the HW structure
+ *
+ *  To prevent malicious write/erase of the NVM, set it to be read-only
+ *  so that the hardware ignores all write/erase cycles of the NVM via
+ *  the flash control registers.  The shadow-ram copy of the NVM will
+ *  still be updated, however any updates to this copy will not stick
+ *  across driver reloads.
+ **/
+void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
+{
+       union ich8_flash_protected_range pr0;
+       union ich8_hws_flash_status hsfsts;
+       u32 gfpreg;
+       s32 ret_val;
+
+       ret_val = e1000_acquire_swflag_ich8lan(hw);
+       if (ret_val)
+               return;
+
+       gfpreg = er32flash(ICH_FLASH_GFPREG);
+
+       /* Write-protect GbE Sector of NVM */
+       pr0.regval = er32flash(ICH_FLASH_PR0);
+       pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK;
+       pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
+       pr0.range.wpe = true;
+       ew32flash(ICH_FLASH_PR0, pr0.regval);
+
+       /*
+        * Lock down a subset of GbE Flash Control Registers, e.g.
+        * PR0 to prevent the write-protection from being lifted.
+        * Once FLOCKDN is set, the registers protected by it cannot
+        * be written until FLOCKDN is cleared by a hardware reset.
+        */
+       hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
+       hsfsts.hsf_status.flockdn = true;
+       ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
+
+       e1000_release_swflag_ich8lan(hw);
+}
+
 /**
  *  e1000_write_flash_data_ich8lan - Writes bytes to the NVM
  *  @hw: pointer to the HW structure
@@ -1720,6 +1795,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        ew32(CTRL, (ctrl | E1000_CTRL_RST));
        msleep(20);
 
+       /* release the swflag because it is not reset by hardware reset */
+       e1000_release_swflag_ich8lan(hw);
+
        ret_val = e1000e_get_auto_rd_done(hw);
        if (ret_val) {
                /*
index d266510c8a94683ae4d21516cf6c18491dc3eb3a..b81c4237b5d30a11dc7f6e3dcefdbbc3ae202fb2 100644 (file)
@@ -47,7 +47,7 @@
 
 #include "e1000.h"
 
-#define DRV_VERSION "0.3.3.3-k2"
+#define DRV_VERSION "0.3.3.3-k6"
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
@@ -1115,6 +1115,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
        writel(0, adapter->hw.hw_addr + rx_ring->tail);
 }
 
+static void e1000e_downshift_workaround(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                       struct e1000_adapter, downshift_task);
+
+       e1000e_gig_downshift_workaround_ich8lan(&adapter->hw);
+}
+
 /**
  * e1000_intr_msi - Interrupt Handler
  * @irq: interrupt number
@@ -1139,7 +1147,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
                 */
                if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
                    (!(er32(STATUS) & E1000_STATUS_LU)))
-                       e1000e_gig_downshift_workaround_ich8lan(hw);
+                       schedule_work(&adapter->downshift_task);
 
                /*
                 * 80003ES2LAN workaround-- For packet buffer work-around on
@@ -1205,7 +1213,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
                 */
                if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
                    (!(er32(STATUS) & E1000_STATUS_LU)))
-                       e1000e_gig_downshift_workaround_ich8lan(hw);
+                       schedule_work(&adapter->downshift_task);
 
                /*
                 * 80003ES2LAN workaround--
@@ -2592,8 +2600,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
        /* Explicitly disable IRQ since the NIC can be in any state. */
        e1000_irq_disable(adapter);
 
-       spin_lock_init(&adapter->stats_lock);
-
        set_bit(__E1000_DOWN, &adapter->state);
        return 0;
 
@@ -2912,6 +2918,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
        return 0;
 }
 
+/**
+ * e1000e_update_phy_task - work thread to update phy
+ * @work: pointer to our work struct
+ *
+ * this worker thread exists because we must acquire a
+ * semaphore to read the phy, which we could msleep while
+ * waiting for it, and we can't msleep in a timer.
+ **/
+static void e1000e_update_phy_task(struct work_struct *work)
+{
+       struct e1000_adapter *adapter = container_of(work,
+                                       struct e1000_adapter, update_phy_task);
+       e1000_get_phy_info(&adapter->hw);
+}
+
 /*
  * Need to wait a few seconds after link up to get diagnostic information from
  * the phy
@@ -2919,7 +2940,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
 static void e1000_update_phy_info(unsigned long data)
 {
        struct e1000_adapter *adapter = (struct e1000_adapter *) data;
-       e1000_get_phy_info(&adapter->hw);
+       schedule_work(&adapter->update_phy_task);
 }
 
 /**
@@ -2930,10 +2951,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
        struct pci_dev *pdev = adapter->pdev;
-       unsigned long irq_flags;
-       u16 phy_tmp;
-
-#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
 
        /*
         * Prevent stats update while adapter is being reset, or if the pci
@@ -2944,14 +2961,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
        if (pci_channel_offline(pdev))
                return;
 
-       spin_lock_irqsave(&adapter->stats_lock, irq_flags);
-
-       /*
-        * these counters are modified from e1000_adjust_tbi_stats,
-        * called from the interrupt context, so they must only
-        * be written while holding adapter->stats_lock
-        */
-
        adapter->stats.crcerrs += er32(CRCERRS);
        adapter->stats.gprc += er32(GPRC);
        adapter->stats.gorc += er32(GORCL);
@@ -3022,21 +3031,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
 
        /* Tx Dropped needs to be maintained elsewhere */
 
-       /* Phy Stats */
-       if (hw->phy.media_type == e1000_media_type_copper) {
-               if ((adapter->link_speed == SPEED_1000) &&
-                  (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) {
-                       phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
-                       adapter->phy_stats.idle_errors += phy_tmp;
-               }
-       }
-
        /* Management Stats */
        adapter->stats.mgptc += er32(MGTPTC);
        adapter->stats.mgprc += er32(MGTPRC);
        adapter->stats.mgpdc += er32(MGTPDC);
-
-       spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
 }
 
 /**
@@ -3048,10 +3046,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
        struct e1000_hw *hw = &adapter->hw;
        struct e1000_phy_regs *phy = &adapter->phy_regs;
        int ret_val;
-       unsigned long irq_flags;
-
-
-       spin_lock_irqsave(&adapter->stats_lock, irq_flags);
 
        if ((er32(STATUS) & E1000_STATUS_LU) &&
            (adapter->hw.phy.media_type == e1000_media_type_copper)) {
@@ -3082,8 +3076,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
                phy->stat1000 = 0;
                phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF);
        }
-
-       spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
 }
 
 static void e1000_print_link_info(struct e1000_adapter *adapter)
@@ -4467,6 +4459,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        adapter->bd_number = cards_found++;
 
+       e1000e_check_options(adapter);
+
        /* setup adapter struct */
        err = e1000_sw_init(adapter);
        if (err)
@@ -4482,6 +4476,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        if (err)
                goto err_hw_init;
 
+       if ((adapter->flags & FLAG_IS_ICH) &&
+           (adapter->flags & FLAG_READ_ONLY_NVM))
+               e1000e_write_protect_nvm_ich8lan(&adapter->hw);
+
        hw->mac.ops.get_bus_info(&adapter->hw);
 
        adapter->hw.phy.autoneg_wait_to_complete = 0;
@@ -4572,8 +4570,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        INIT_WORK(&adapter->reset_task, e1000_reset_task);
        INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
-
-       e1000e_check_options(adapter);
+       INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
+       INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
 
        /* Initialize link parameters. User can change them with ethtool */
        adapter->hw.mac.autoneg = 1;
index ed912e023a7266db32cf88dcb60e8bf406d5c421..d91dbf7ba4341665c403fe9491f81355098db80d 100644 (file)
@@ -133,6 +133,15 @@ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
  */
 E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
 
+/*
+ * Write Protect NVM
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (enabled)
+ */
+E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
+
 struct e1000_option {
        enum { enable_option, range_option, list_option } type;
        const char *name;
@@ -388,4 +397,25 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
                                                                       opt.def);
                }
        }
+       { /* Write-protect NVM */
+               const struct e1000_option opt = {
+                       .type = enable_option,
+                       .name = "Write-protect NVM",
+                       .err  = "defaulting to Enabled",
+                       .def  = OPTION_ENABLED
+               };
+
+               if (adapter->flags & FLAG_IS_ICH) {
+                       if (num_WriteProtectNVM > bd) {
+                               unsigned int write_protect_nvm = WriteProtectNVM[bd];
+                               e1000_validate_option(&write_protect_nvm, &opt,
+                                                     adapter);
+                               if (write_protect_nvm)
+                                       adapter->flags |= FLAG_READ_ONLY_NVM;
+                       } else {
+                               if (opt.def)
+                                       adapter->flags |= FLAG_READ_ONLY_NVM;
+                       }
+               }
+       }
 }
index f6c45288d0e7cad941a43ba501064d7401531902..87e37bc391454ecdf51921ad16504df28e3f103c 100644 (file)
@@ -294,8 +294,6 @@ static int ath_stop(struct ath_softc *sc)
         * hardware is gone (invalid).
         */
 
-       if (!sc->sc_invalid)
-               ath9k_hw_set_interrupts(ah, 0);
        ath_draintxq(sc, false);
        if (!sc->sc_invalid) {
                ath_stoprecv(sc);
@@ -797,6 +795,12 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
        if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
                sc->sc_imask |= ATH9K_INT_CST;
 
+       /* Note: We disable MIB interrupts for now as we don't yet
+        * handle processing ANI, otherwise you will get an interrupt
+        * storm after about 7 hours of usage making the system unusable
+        * with huge latency. Once we do have ANI processing included
+        * we can re-enable this interrupt. */
+#if 0
        /*
         * Enable MIB interrupts when there are hardware phy counters.
         * Note we only do this (at the moment) for station mode.
@@ -804,6 +808,7 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
        if (ath9k_hw_phycounters(ah) &&
            ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS)))
                sc->sc_imask |= ATH9K_INT_MIB;
+#endif
        /*
         * Some hardware processes the TIM IE and fires an
         * interrupt when the TIM bit is set.  For hardware
@@ -1336,6 +1341,8 @@ void ath_deinit(struct ath_softc *sc)
 
        DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__);
 
+       tasklet_kill(&sc->intr_tq);
+       tasklet_kill(&sc->bcon_tasklet);
        ath_stop(sc);
        if (!sc->sc_invalid)
                ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
index 4ee695b76b88ece8e9ac4de86576555a737f0168..2f84093331ee79253e58f33ff59006392c54d891 100644 (file)
@@ -974,7 +974,6 @@ struct ath_softc {
        u32 sc_keymax;          /* size of key cache */
        DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);  /* key use bit map */
        u8 sc_splitmic;         /* split TKIP MIC keys */
-       int sc_keytype;
 
        /* RX */
        struct list_head sc_rxbuf;
index 99badf1404c31a0fbb9640137cf5d1c36f212d28..acebdf1d20a842048ceaa1dcb5fcfbf117ce6fcc 100644 (file)
@@ -206,8 +206,6 @@ static int ath_key_config(struct ath_softc *sc,
        if (!ret)
                return -EIO;
 
-       if (mac)
-               sc->sc_keytype = hk.kv_type;
        return 0;
 }
 
@@ -778,7 +776,6 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
        case DISABLE_KEY:
                ath_key_delete(sc, key);
                clear_bit(key->keyidx, sc->sc_keymap);
-               sc->sc_keytype = ATH9K_CIPHER_CLR;
                break;
        default:
                ret = -EINVAL;
@@ -1414,10 +1411,17 @@ static void ath_pci_remove(struct pci_dev *pdev)
 {
        struct ieee80211_hw *hw = pci_get_drvdata(pdev);
        struct ath_softc *sc = hw->priv;
+       enum ath9k_int status;
 
-       if (pdev->irq)
+       if (pdev->irq) {
+               ath9k_hw_set_interrupts(sc->sc_ah, 0);
+               /* clear the ISR */
+               ath9k_hw_getisr(sc->sc_ah, &status);
+               sc->sc_invalid = 1;
                free_irq(pdev->irq, sc);
+       }
        ath_detach(sc);
+
        pci_iounmap(pdev, sc->mem);
        pci_release_region(pdev, 0);
        pci_disable_device(pdev);
index 550129f717e2c58ebd3f62f5edc6df0735e3c073..8b332e11a656729f078b47099ba044f2f33aef38 100644 (file)
@@ -315,11 +315,11 @@ static int ath_tx_prepare(struct ath_softc *sc,
                txctl->keyix = tx_info->control.hw_key->hw_key_idx;
                txctl->frmlen += tx_info->control.icv_len;
 
-               if (sc->sc_keytype == ATH9K_CIPHER_WEP)
+               if (tx_info->control.hw_key->alg == ALG_WEP)
                        txctl->keytype = ATH9K_KEY_TYPE_WEP;
-               else if (sc->sc_keytype == ATH9K_CIPHER_TKIP)
+               else if (tx_info->control.hw_key->alg == ALG_TKIP)
                        txctl->keytype = ATH9K_KEY_TYPE_TKIP;
-               else if (sc->sc_keytype == ATH9K_CIPHER_AES_CCM)
+               else if (tx_info->control.hw_key->alg == ALG_CCMP)
                        txctl->keytype = ATH9K_KEY_TYPE_AES;
        }
 
index da8b7433e3a69b731c5d534bb86d1f9a46bb301f..a60ae86bd5c9bddf5a9e8663ffdac0004d6183c8 100644 (file)
@@ -58,6 +58,7 @@ static struct usb_device_id usb_ids[] = {
        { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 },
        { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 },
        { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 },
+       { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 },
        /* ZD1211B */
        { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
        { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
index 9c718583a237f4f6082e7dcc5e84e23e85ee651c..77baff022f71b85259e1e064a06531b03a9bb727 100644 (file)
@@ -16,6 +16,7 @@
 
 
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/topology.h>
@@ -484,6 +485,21 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr,
 #endif /* HAVE_PCI_LEGACY */
 
 #ifdef HAVE_PCI_MMAP
+
+static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma)
+{
+       unsigned long nr, start, size;
+
+       nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       start = vma->vm_pgoff;
+       size = pci_resource_len(pdev, resno) >> PAGE_SHIFT;
+       if (start < size && size - start >= nr)
+               return 1;
+       WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n",
+               current->comm, start, start+nr, pci_name(pdev), resno, size);
+       return 0;
+}
+
 /**
  * pci_mmap_resource - map a PCI resource into user memory space
  * @kobj: kobject for mapping
@@ -510,6 +526,9 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
        if (i >= PCI_ROM_RESOURCE)
                return -ENODEV;
 
+       if (!pci_mmap_fits(pdev, i, vma))
+               return -EINVAL;
+
        /* pci_mmap_page_range() expects the same kind of entry as coming
         * from /proc/bus/pci/ which is a "user visible" value. If this is
         * different from the resource itself, arch will do necessary fixup.
index 9a7c9e1408a41823aef2198f6e3a8e0e220d609a..851f5b83cdbc3f62f352627d0ee91848fc9923c0 100644 (file)
@@ -527,7 +527,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
                 */
                pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
                        &reg32);
-               if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) {
+               if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) {
                        printk("Pre-1.1 PCIe device detected, "
                                "disable ASPM for %s. It can be enabled forcedly"
                                " with 'pcie_aspm=force'\n", pci_name(pdev));
index 3b3b5f1787973556f7dacecd01b1ab3bbe68b68f..4edfc4731bd4296f3b33081d2f9f66946f1f231f 100644 (file)
@@ -162,7 +162,7 @@ EXPORT_SYMBOL(pci_find_slot);
  * time.
  */
 struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
-                               const struct pci_dev *from)
+                               struct pci_dev *from)
 {
        struct pci_dev *pdev;
 
@@ -263,7 +263,7 @@ static int match_pci_dev_by_id(struct device *dev, void *data)
  * this file.
  */
 static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
-                                        const struct pci_dev *from)
+                                        struct pci_dev *from)
 {
        struct device *dev;
        struct device *dev_start = NULL;
@@ -303,7 +303,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
  */
 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
                               unsigned int ss_vendor, unsigned int ss_device,
-                              const struct pci_dev *from)
+                              struct pci_dev *from)
 {
        struct pci_dev *pdev;
        struct pci_device_id *id;
index 4174d9656e357f8ec5f16520ad03c86544a5e969..34c83d3ca0fac69df37ece4e352a99697ae515cd 100644 (file)
@@ -427,6 +427,18 @@ static int pcmcia_device_probe(struct device * dev)
        p_drv = to_pcmcia_drv(dev->driver);
        s = p_dev->socket;
 
+       /* The PCMCIA code passes the match data in via dev->driver_data
+        * which is an ugly hack. Once the driver probe is called it may
+        * and often will overwrite the match data so we must save it first
+        *
+        * handle pseudo multifunction devices:
+        * there are at most two pseudo multifunction devices.
+        * if we're matching against the first, schedule a
+        * call which will then check whether there are two
+        * pseudo devices, and if not, add the second one.
+        */
+       did = p_dev->dev.driver_data;
+
        ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id,
               p_drv->drv.name);
 
@@ -455,21 +467,14 @@ static int pcmcia_device_probe(struct device * dev)
                goto put_module;
        }
 
-       /* handle pseudo multifunction devices:
-        * there are at most two pseudo multifunction devices.
-        * if we're matching against the first, schedule a
-        * call which will then check whether there are two
-        * pseudo devices, and if not, add the second one.
-        */
-       did = p_dev->dev.driver_data;
        if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
            (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
                pcmcia_add_device_later(p_dev->socket, 0);
 
- put_module:
+put_module:
        if (ret)
                module_put(p_drv->owner);
- put_dev:
+put_dev:
        if (ret)
                put_device(dev);
        return (ret);
index c1b9ea34977b395c400fcd522ecd41f06fadbd21..98b9df7776e901188ebc1bcf2b00d0db81a40bd0 100644 (file)
@@ -148,9 +148,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
        acpi_status status;
        struct pnp_dev *dev;
 
+       /*
+        * If a PnPacpi device is not present , the device
+        * driver should not be loaded.
+        */
        status = acpi_get_handle(device->handle, "_CRS", &temp);
        if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
-           is_exclusive_device(device))
+           is_exclusive_device(device) || (!device->status.present))
                return 0;
 
        dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
index f118252f3a9f2b921cef3fff96fd1ef890d65b3c..52e2743b04ecf77bb6a975d6c8609fa042025dea 100644 (file)
@@ -422,6 +422,12 @@ done:
        return err;
 }
 
+static int rtc_dev_fasync(int fd, struct file *file, int on)
+{
+       struct rtc_device *rtc = file->private_data;
+       return fasync_helper(fd, file, on, &rtc->async_queue);
+}
+
 static int rtc_dev_release(struct inode *inode, struct file *file)
 {
        struct rtc_device *rtc = file->private_data;
@@ -434,16 +440,13 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
        if (rtc->ops->release)
                rtc->ops->release(rtc->dev.parent);
 
+       if (file->f_flags & FASYNC)
+               rtc_dev_fasync(-1, file, 0);
+
        clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
        return 0;
 }
 
-static int rtc_dev_fasync(int fd, struct file *file, int on)
-{
-       struct rtc_device *rtc = file->private_data;
-       return fasync_helper(fd, file, on, &rtc->async_queue);
-}
-
 static const struct file_operations rtc_dev_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
index 1679e2f91c945eb0164b3d8a813207c9cfd5efbd..a0b6b46e746647ae5451d5099c5a8ccde5e89175 100644 (file)
@@ -447,51 +447,36 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
 {
        char s[80];
 
-       sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no);
-
+       sprintf(s, "qdio: %s ", dev_name(&cdev->dev));
        switch (irq_ptr->qib.qfmt) {
        case QDIO_QETH_QFMT:
-               sprintf(s + strlen(s), "OSADE ");
+               sprintf(s + strlen(s), "OSA ");
                break;
        case QDIO_ZFCP_QFMT:
                sprintf(s + strlen(s), "ZFCP ");
                break;
        case QDIO_IQDIO_QFMT:
-               sprintf(s + strlen(s), "HiperSockets ");
+               sprintf(s + strlen(s), "HS ");
                break;
        }
-       sprintf(s + strlen(s), "using: ");
-
-       if (!is_thinint_irq(irq_ptr))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "AdapterInterrupts ");
-       if (!(irq_ptr->sch_token != 0))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "QEBSM ");
-       if (!(irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED))
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "OutboundPCI ");
-       if (!css_general_characteristics.aif_tdd)
-               sprintf(s + strlen(s), "no");
-       sprintf(s + strlen(s), "TDD\n");
-       printk(KERN_INFO "qdio: %s", s);
-
-       memset(s, 0, sizeof(s));
-       sprintf(s, "%s SIGA required: ", cdev->dev.bus_id);
-       if (irq_ptr->siga_flag.input)
-               sprintf(s + strlen(s), "Read ");
-       if (irq_ptr->siga_flag.output)
-               sprintf(s + strlen(s), "Write ");
-       if (irq_ptr->siga_flag.sync)
-               sprintf(s + strlen(s), "Sync ");
-       if (!irq_ptr->siga_flag.no_sync_ti)
-               sprintf(s + strlen(s), "SyncAI ");
-       if (!irq_ptr->siga_flag.no_sync_out_ti)
-               sprintf(s + strlen(s), "SyncOutAI ");
-       if (!irq_ptr->siga_flag.no_sync_out_pci)
-               sprintf(s + strlen(s), "SyncOutPCI");
+       sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no);
+       sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr));
+       sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0);
+       sprintf(s + strlen(s), "PCI:%d ",
+               (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0);
+       sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd);
+       sprintf(s + strlen(s), "SIGA:");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " ");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " ");
+       sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " ");
+       sprintf(s + strlen(s), "%s",
+               (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " ");
        sprintf(s + strlen(s), "\n");
-       printk(KERN_INFO "qdio: %s", s);
+       printk(KERN_INFO "%s", s);
 }
 
 int __init qdio_setup_init(void)
index 45a3b93eed57aac2617617a79a449df231f51f8f..bf41887cdd655a4dfd0ecc04a4a8a91aa67bc265 100644 (file)
@@ -1834,7 +1834,6 @@ clear_risc_ints:
                WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT);
        }
        spin_unlock_irq(&ha->hardware_lock);
-       ha->isp_ops->enable_intrs(ha);
 
 fail:
        return ret;
index 26afe44265c794177380eea2b25433d2277761f5..6d0f0e5f282791fc6b8bc40c77c89a2db55b92dc 100644 (file)
@@ -1740,6 +1740,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        if (ret)
                goto probe_failed;
 
+       ha->isp_ops->enable_intrs(ha);
+
        scsi_scan_host(host);
 
        qla2x00_alloc_sysfs_attr(ha);
index 4a1cf6377f6c89b7a654bf3c38e9e2ae8b1bcc4f..9053508967253b9d894efefbd81bdc1bf125e725 100644 (file)
@@ -914,6 +914,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
                                ds[i].d_count = sg_dma_len(s);
                        }
                        sg_count -= n;
+                       sg = s;
                }
        } else {
                cmd->dataseg[0].d_base = 0;
index ff5d56b3ee4d5c66a6ee4ab34609fc1800cd347b..62307bd794a924c1f04d6b6822aa61dd2ef875c3 100644 (file)
@@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
 void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 {
        int result = cmd->result;
-       int this_count = scsi_bufflen(cmd);
+       int this_count;
        struct request_queue *q = cmd->device->request_queue;
        struct request *req = cmd->request;
        int error = 0;
@@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
         */
        if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL)
                return;
+       this_count = blk_rq_bytes(req);
 
        /* good_bytes = 0, or (inclusive) there were leftovers and
         * result = 0, so scsi_end_request couldn't retry.
index 3a6da80b081c14405ecfdd60660470928843e84c..61fb8b6d19af77be5a9b180532725c22df68d44d 100644 (file)
@@ -131,7 +131,8 @@ struct atmel_uart_char {
 struct atmel_uart_port {
        struct uart_port        uart;           /* uart */
        struct clk              *clk;           /* uart clock */
-       unsigned short          suspended;      /* is port suspended? */
+       int                     may_wakeup;     /* cached value of device_may_wakeup for times we need to disable it */
+       u32                     backup_imr;     /* IMR saved during suspend */
        int                     break_active;   /* break being received */
 
        short                   use_dma_rx;     /* enable PDC receiver */
@@ -984,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
                 * This is called on uart_open() or a resume event.
                 */
                clk_enable(atmel_port->clk);
+
+               /* re-enable interrupts if we disabled some on suspend */
+               UART_PUT_IER(port, atmel_port->backup_imr);
                break;
        case 3:
+               /* Back up the interrupt mask and disable all interrupts */
+               atmel_port->backup_imr = UART_GET_IMR(port);
+               UART_PUT_IDR(port, -1);
+
                /*
                 * Disable the peripheral clock for this serial port.
                 * This is called on uart_close() or a suspend event.
@@ -1475,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev,
                        cpu_relax();
        }
 
-       if (device_may_wakeup(&pdev->dev)
-           && !atmel_serial_clk_will_stop())
-               enable_irq_wake(port->irq);
-       else {
-               uart_suspend_port(&atmel_uart, port);
-               atmel_port->suspended = 1;
-       }
+       /* we can not wake up if we're running on slow clock */
+       atmel_port->may_wakeup = device_may_wakeup(&pdev->dev);
+       if (atmel_serial_clk_will_stop())
+               device_set_wakeup_enable(&pdev->dev, 0);
+
+       uart_suspend_port(&atmel_uart, port);
 
        return 0;
 }
@@ -1491,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev)
        struct uart_port *port = platform_get_drvdata(pdev);
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
-       if (atmel_port->suspended) {
-               uart_resume_port(&atmel_uart, port);
-               atmel_port->suspended = 0;
-       } else
-               disable_irq_wake(port->irq);
+       uart_resume_port(&atmel_uart, port);
+       device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup);
 
        return 0;
 }
@@ -1513,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
        BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE));
 
        port = &atmel_ports[pdev->id];
+       port->backup_imr = 0;
+
        atmel_init_port(port, pdev);
 
        if (!atmel_use_dma_rx(&port->uart)) {
index c4eaacd6e5539ee53e65aa0909666f40f5a5568b..b872bfaf4bd2c0e4706c1551db8da94324622983 100644 (file)
@@ -427,7 +427,7 @@ static int orion_spi_transfer(struct spi_device *spi, struct spi_message *m)
                        goto msg_rejected;
                }
 
-               if (t->speed_hz < orion_spi->min_speed) {
+               if (t->speed_hz && t->speed_hz < orion_spi->min_speed) {
                        dev_err(&spi->dev,
                                "message rejected : "
                                "device min speed (%d Hz) exceeds "
index 0e53354c1cfe7edbde6e47ff8ca0efcc4306be7d..d47d3636227fe90e435fc03a8f59fd49860b1220 100644 (file)
@@ -49,7 +49,7 @@ MODULE_ALIAS("platform:pxa2xx-spi");
 
 #define DMA_INT_MASK           (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)
 #define RESET_DMA_CHANNEL      (DCSR_NODESC | DMA_INT_MASK)
-#define IS_DMA_ALIGNED(x)      (((x) & 0x07) == 0)
+#define IS_DMA_ALIGNED(x)      ((((u32)(x)) & 0x07) == 0)
 #define MAX_DMA_LEN            8191
 
 /*
@@ -896,7 +896,7 @@ static void pump_transfers(unsigned long data)
                                || transfer->rx_dma || transfer->tx_dma) {
                        dev_err(&drv_data->pdev->dev,
                                "pump_transfers: mapped transfer length "
-                               "of %lu is greater than %d\n",
+                               "of %u is greater than %d\n",
                                transfer->len, MAX_DMA_LEN);
                        message->status = -EINVAL;
                        giveback(drv_data);
index 87ab2443e66d405ec72d45a2da2f120d59e48f0c..0ffabf5c0b60dd9892b5b9c45e2a1d8881129108 100644 (file)
@@ -471,6 +471,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
 #endif
                        break;
                case SSB_BUSTYPE_SSB:
+                       dev->dma_mask = &dev->coherent_dma_mask;
                        break;
                }
 
index 8abd4e59bf4abac0bb2edcee5385894f42310e98..8ab389dca2b91c49bfdb75e900a1c5a5dde3d334 100644 (file)
@@ -1876,7 +1876,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
                 * with IRQF_SHARED. As usb_hcd_irq() will always disable
                 * interrupts we can remove it here.
                 */
-               irqflags &= ~IRQF_DISABLED;
+               if (irqflags & IRQF_SHARED)
+                       irqflags &= ~IRQF_DISABLED;
 
                snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
                                hcd->driver->description, hcd->self.busnum);
index 6a5cb018383d538a2b504429183be99e112c6a5b..d99963873e37aada67583be1cc84fc219f00bbb2 100644 (file)
@@ -2683,35 +2683,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                USB_PORT_STAT_C_ENABLE);
 #endif
 
-       /* Try to use the debounce delay for protection against
-        * port-enable changes caused, for example, by EMI.
-        */
-       if (portchange & (USB_PORT_STAT_C_CONNECTION |
-                               USB_PORT_STAT_C_ENABLE)) {
-               status = hub_port_debounce(hub, port1);
-               if (status < 0) {
-                       if (printk_ratelimit())
-                               dev_err (hub_dev, "connect-debounce failed, "
-                                               "port %d disabled\n", port1);
-                       portstatus &= ~USB_PORT_STAT_CONNECTION;
-               } else {
-                       portstatus = status;
-               }
-       }
-
        /* Try to resuscitate an existing device */
        udev = hdev->children[port1-1];
        if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
                        udev->state != USB_STATE_NOTATTACHED) {
-
                usb_lock_device(udev);
                if (portstatus & USB_PORT_STAT_ENABLE) {
                        status = 0;             /* Nothing to do */
-               } else if (!udev->persist_enabled) {
-                       status = -ENODEV;       /* Mustn't resuscitate */
 
 #ifdef CONFIG_USB_SUSPEND
-               } else if (udev->state == USB_STATE_SUSPENDED) {
+               } else if (udev->state == USB_STATE_SUSPENDED &&
+                               udev->persist_enabled) {
                        /* For a suspended device, treat this as a
                         * remote wakeup event.
                         */
@@ -2726,7 +2708,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 #endif
 
                } else {
-                       status = usb_reset_device(udev);
+                       status = -ENODEV;       /* Don't resuscitate */
                }
                usb_unlock_device(udev);
 
@@ -2741,6 +2723,19 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                usb_disconnect(&hdev->children[port1-1]);
        clear_bit(port1, hub->change_bits);
 
+       if (portchange & (USB_PORT_STAT_C_CONNECTION |
+                               USB_PORT_STAT_C_ENABLE)) {
+               status = hub_port_debounce(hub, port1);
+               if (status < 0) {
+                       if (printk_ratelimit())
+                               dev_err(hub_dev, "connect-debounce failed, "
+                                               "port %d disabled\n", port1);
+                       portstatus &= ~USB_PORT_STAT_CONNECTION;
+               } else {
+                       portstatus = status;
+               }
+       }
+
        /* Return now if debouncing failed or nothing is connected */
        if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
 
@@ -2748,7 +2743,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
                                && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
                        set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
+
                if (portstatus & USB_PORT_STAT_ENABLE)
                        goto done;
                return;
index 1cfccf102a2dc9fdc9948daf4aadaf5a32c793cf..45ad556169f106270675c706d8d7ae6836d4b2ea 100644 (file)
@@ -223,7 +223,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
        fsl_writel(tmp, &dr_regs->endpointlistaddr);
 
        VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x",
-               (int)udc->ep_qh, (int)tmp,
+               udc->ep_qh, (int)tmp,
                fsl_readl(&dr_regs->endpointlistaddr));
 
        /* Config PHY interface */
index 574c53831a05fd17afd6062633aaab4843609e5f..bb54cca4c54381736ead413cec0e3747e4af9b78 100644 (file)
@@ -787,7 +787,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
                        omap_set_dma_dest_params(ep->lch,
                                OMAP_DMA_PORT_TIPB,
                                OMAP_DMA_AMODE_CONSTANT,
-                               (unsigned long) io_v2p(UDC_DATA_DMA),
+                               UDC_DATA_DMA,
                                0, 0);
                }
        } else {
@@ -804,7 +804,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
                        omap_set_dma_src_params(ep->lch,
                                OMAP_DMA_PORT_TIPB,
                                OMAP_DMA_AMODE_CONSTANT,
-                               (unsigned long) io_v2p(UDC_DATA_DMA),
+                               UDC_DATA_DMA,
                                0, 0);
                        /* EMIFF or SDRC */
                        omap_set_dma_dest_burst_mode(ep->lch,
index d9d53f289caf48b83001b42321e1bbaf9ca00886..8409e0705d6365c34e6db7252cc39eb60575877a 100644 (file)
@@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
        return -ETIMEDOUT;
 }
 
-static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
-                                      u32 mask, u32 done, int usec)
-{
-       int error = handshake(ehci, ptr, mask, done, usec);
-       if (error)
-               ehci_to_hcd(ehci)->state = HC_STATE_HALT;
-
-       return error;
-}
-
 /* force HC to halt state from unknown (EHCI spec section 2.3) */
 static int ehci_halt (struct ehci_hcd *ehci)
 {
@@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *ehci)
                          STS_HALT, STS_HALT, 16 * 125);
 }
 
+static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
+                                      u32 mask, u32 done, int usec)
+{
+       int error;
+
+       error = handshake(ehci, ptr, mask, done, usec);
+       if (error) {
+               ehci_halt(ehci);
+               ehci_to_hcd(ehci)->state = HC_STATE_HALT;
+               ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n",
+                       ptr, mask, done, error);
+       }
+
+       return error;
+}
+
 /* put TDI/ARC silicon into EHCI mode */
 static void tdi_reset (struct ehci_hcd *ehci)
 {
index b7853c8bac0fb58c3c7f74e18145362b6f2002cd..4a0c5a78b2ed74358055e800d5181b1a1e2cb1c7 100644 (file)
@@ -437,6 +437,9 @@ static int enable_periodic (struct ehci_hcd *ehci)
        u32     cmd;
        int     status;
 
+       if (ehci->periodic_sched++)
+               return 0;
+
        /* did clearing PSE did take effect yet?
         * takes effect only at frame boundaries...
         */
@@ -461,6 +464,9 @@ static int disable_periodic (struct ehci_hcd *ehci)
        u32     cmd;
        int     status;
 
+       if (--ehci->periodic_sched)
+               return 0;
+
        /* did setting PSE not take effect yet?
         * takes effect only at frame boundaries...
         */
@@ -544,13 +550,10 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
                : (qh->usecs * 8);
 
        /* maybe enable periodic schedule processing */
-       if (!ehci->periodic_sched++)
-               return enable_periodic (ehci);
-
-       return 0;
+       return enable_periodic(ehci);
 }
 
-static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
+static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh)
 {
        unsigned        i;
        unsigned        period;
@@ -586,9 +589,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
        qh_put (qh);
 
        /* maybe turn off periodic schedule */
-       ehci->periodic_sched--;
-       if (!ehci->periodic_sched)
-               (void) disable_periodic (ehci);
+       return disable_periodic(ehci);
 }
 
 static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
@@ -1562,9 +1563,7 @@ itd_link_urb (
        urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
-       if (unlikely (!ehci->periodic_sched++))
-               return enable_periodic (ehci);
-       return 0;
+       return enable_periodic(ehci);
 }
 
 #define        ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR)
@@ -1642,7 +1641,7 @@ itd_complete (
        ehci_urb_done(ehci, urb, 0);
        retval = true;
        urb = NULL;
-       ehci->periodic_sched--;
+       (void) disable_periodic(ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (unlikely (list_empty (&stream->td_list))) {
@@ -1951,9 +1950,7 @@ sitd_link_urb (
        urb->hcpriv = NULL;
 
        timer_action (ehci, TIMER_IO_WATCHDOG);
-       if (!ehci->periodic_sched++)
-               return enable_periodic (ehci);
-       return 0;
+       return enable_periodic(ehci);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -2019,7 +2016,7 @@ sitd_complete (
        ehci_urb_done(ehci, urb, 0);
        retval = true;
        urb = NULL;
-       ehci->periodic_sched--;
+       (void) disable_periodic(ehci);
        ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
 
        if (list_empty (&stream->td_list)) {
@@ -2243,8 +2240,7 @@ restart:
                        if (unlikely (modified)) {
                                if (likely(ehci->periodic_sched > 0))
                                        goto restart;
-                               /* maybe we can short-circuit this scan! */
-                               disable_periodic(ehci);
+                               /* short-circuit this scan */
                                now_uframe = clock;
                                break;
                        }
index a0017486ad4ea27f6220764ede93cb3562e59247..58b2b8fc9439c7b93b956e930e74387f17057cf3 100644 (file)
@@ -9,6 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options"
 # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
 config USB_MUSB_HDRC
        depends on (USB || USB_GADGET) && HAVE_CLK
+       depends on !SUPERH
        select TWL4030_USB if MACH_OMAP_3430SDP
        tristate 'Inventra Highspeed Dual Role Controller (TI, ...)'
        help
index c5b8f0296fcf2f9f9a7ab40404d1f8324e325508..128e949db47c4a2c64f0156a2c7c227ef8f16fd1 100644 (file)
 #include <linux/io.h>
 
 #ifdef CONFIG_ARM
-#include <asm/arch/hardware.h>
-#include <asm/arch/memory.h>
+#include <mach/hardware.h>
+#include <mach/memory.h>
 #include <asm/mach-types.h>
 #endif
 
index 298b22e6ad0dd999afaa7872fafd3babdbdfe960..9d2dcb121c5e95cc7e6ba81a5cdfa59ae07637ae 100644 (file)
@@ -35,8 +35,8 @@
 #include <linux/io.h>
 
 #include <asm/mach-types.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/mux.h>
+#include <mach/hardware.h>
+#include <mach/mux.h>
 
 #include "musb_core.h"
 #include "omap2430.h"
index 786a62071f7236382be179f2cf3116d10f2e5135..dc7670718cd2ba4bfd8aa4f080b54a2de0fe3a86 100644 (file)
@@ -11,8 +11,8 @@
 #define __MUSB_OMAP243X_H__
 
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
-#include <asm/arch/hardware.h>
-#include <asm/arch/usb.h>
+#include <mach/hardware.h>
+#include <mach/usb.h>
 
 /*
  * OMAP2430-specific definitions
index 442cba69cce5b9742aa883872122522d0e525925..1279553381e34a5d4486ded444294a533f53371c 100644 (file)
@@ -72,6 +72,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
        { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
        { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
+       { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
        { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
        { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
        { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
@@ -83,6 +84,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
        { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
        { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
+       { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
        { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
@@ -93,6 +95,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
        { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
        { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
+       { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
        { } /* Terminating Entry */
 };
 
index 984f6eff4c475acb6cdfdb85407897aac9e87d01..3dc93b542b30634cd23bbbe012b16034c84f6449 100644 (file)
@@ -654,6 +654,9 @@ static struct usb_device_id id_table_combined [] = {
                .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
        { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
        { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
+       { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
        { },                                    /* Optional parameter entry */
        { }                                     /* Terminating entry */
 };
index 382265bba9690b84eaf51c57b16a0e460c3f29ee..8a5b6df3a97673664b27c2ebb162076f63261685 100644 (file)
 
 #define PAPOUCH_VID                    0x5050  /* Vendor ID */
 #define PAPOUCH_TMU_PID                        0x0400  /* TMU USB Thermometer */
+#define PAPOUCH_QUIDO4x4_PID           0x0900  /* Quido 4/4 Module */
 
 /*
  * ACG Identification Technologies GmbH products (http://www.acg.de/).
 /* Rig Expert Ukraine devices */
 #define FTDI_REU_TINY_PID              0xED22  /* RigExpert Tiny */
 
+/* Domintell products  http://www.domintell.com */
+#define FTDI_DOMINTELL_DGQG_PID        0xEF50  /* Master */
+#define FTDI_DOMINTELL_DUSB_PID        0xEF51  /* DUSB01 module */
+
 /* Commands */
 #define FTDI_SIO_RESET                 0 /* Reset the port */
 #define FTDI_SIO_MODEM_CTRL    1 /* Set the modem control register */
index 9f9cd36455f463423e4cbe22fd752e639415580b..73f8277f88f2d26d57dafa9604f4eae5cb0468a9 100644 (file)
@@ -218,6 +218,7 @@ static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
 /* ZTE PRODUCTS */
 #define ZTE_VENDOR_ID                          0x19d2
 #define ZTE_PRODUCT_MF628                      0x0015
+#define ZTE_PRODUCT_CDMA_TECH                  0xfffe
 
 static struct usb_device_id option_ids[] = {
        { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -347,6 +348,7 @@ static struct usb_device_id option_ids[] = {
        { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
        { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
        { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
+       { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
        { } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
index 706033753adb7836db59e343310022e2469436e5..ea1a103c99bea9f23d3a4eb7fb4f846ccbed987f 100644 (file)
@@ -14,7 +14,7 @@
   Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
 */
 
-#define DRIVER_VERSION "v.1.2.13a"
+#define DRIVER_VERSION "v.1.3.2"
 #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>"
 #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
 
@@ -30,9 +30,6 @@
 
 #define SWIMS_USB_REQUEST_SetPower     0x00
 #define SWIMS_USB_REQUEST_SetNmea      0x07
-#define SWIMS_USB_REQUEST_SetMode      0x0B
-#define SWIMS_USB_REQUEST_GetSwocInfo  0x0A
-#define SWIMS_SET_MODE_Modem           0x0001
 
 /* per port private data */
 #define N_IN_URB       4
@@ -163,7 +160,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
        { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
        { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
-       { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
+       { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */
        { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
        { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */
        { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
@@ -175,6 +172,8 @@ static struct usb_device_id id_table [] = {
         /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) },
        { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */
+       { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */
+       { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */
 
        { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
        { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
@@ -187,6 +186,7 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */
        { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */
        { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */
+       { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */
        { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */
        { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */
        { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */
@@ -204,6 +204,8 @@ static struct usb_device_id id_table [] = {
        /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)},
        /* Sierra Wireless Device */
+       { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)},
+       /* Sierra Wireless Device */
        { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
 
        { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
index e39c779e416099ea0a94a28d622851abaf71f13a..9a3e495c769cc92f7abaa59d33d7138fe2e73f73 100644 (file)
@@ -1744,7 +1744,7 @@ static int ti_download_firmware(struct ti_device *tdev, int type)
        if (buffer) {
                memcpy(buffer, fw_p->data, fw_p->size);
                memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size);
-               ti_do_download(dev, pipe, buffer, fw_p->size);
+               status = ti_do_download(dev, pipe, buffer, fw_p->size);
                kfree(buffer);
        }
        release_firmware(fw_p);
index b157c48e8b78df594bd0386f5ff38a725cf18929..4f7f9e3ae0a43fe0fd630aaf4f436637383b0e4d 100644 (file)
@@ -733,7 +733,9 @@ int usb_serial_probe(struct usb_interface *interface,
            ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) &&
             (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) ||
            ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) &&
-            (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID))) {
+            (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) ||
+           ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
+            (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) {
                if (interface != dev->actconfig->interface[0]) {
                        /* check out the endpoints of the other interface*/
                        iface_desc = dev->actconfig->interface[0]->cur_altsetting;
index c76034672c18c6c87220fc37e5913f45e95be782..3d9249632ae12e7051174817241ef37ea6f2cd4c 100644 (file)
@@ -146,18 +146,6 @@ config USB_STORAGE_KARMA
          on the resulting scsi device node returns the Karma to normal
          operation.
 
-config USB_STORAGE_SIERRA
-       bool "Sierra Wireless TRU-Install Feature Support"
-       depends on USB_STORAGE
-       help
-         Say Y here to include additional code to support Sierra Wireless
-         products with the TRU-Install feature (e.g., AC597E, AC881U).
-
-         This code switches the Sierra Wireless device from being in
-         Mass Storage mode to Modem mode. It also has the ability to
-         support host software upgrades should full Linux support be added
-         to TRU-Install.
-
 config USB_STORAGE_CYPRESS_ATACB
        bool "SAT emulation on Cypress USB/ATA Bridge with ATACB"
        depends on USB_STORAGE
index bc3415b475c9b5675d0aec6d33cf0f117d7862da..7f8beb5366aec91656787736c5c1b3f1fb0d0712 100644 (file)
@@ -21,11 +21,10 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT)      += jumpshot.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA)   += alauda.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA)    += karma.o
-usb-storage-obj-$(CONFIG_USB_STORAGE_SIERRA)   += sierra_ms.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o
 
 usb-storage-objs :=    scsiglue.o protocol.o transport.o usb.o \
-                       initializers.o $(usb-storage-obj-y)
+                       initializers.o sierra_ms.o $(usb-storage-obj-y)
 
 ifneq ($(CONFIG_USB_LIBUSUAL),)
        obj-$(CONFIG_USB)       += libusual.o
index ba412e68d474a70e13bf7b68543eeb5f32c3fad7..cd155475cb6edf9a3af0cf115ffd2aa751fb0972 100644 (file)
@@ -160,6 +160,13 @@ UNUSUAL_DEV(  0x0421, 0x0019, 0x0592, 0x0592,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_MAX_SECTORS_64 ),
 
+/* Reported by Filip Joelsson <filip@blueturtle.nu> */
+UNUSUAL_DEV(  0x0421, 0x005d, 0x0001, 0x0600,
+               "Nokia",
+               "Nokia 3110c",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_FIX_CAPACITY ),
+
 /* Reported by Mario Rettig <mariorettig@web.de> */
 UNUSUAL_DEV(  0x0421, 0x042e, 0x0100, 0x0100,
                "Nokia",
@@ -232,6 +239,20 @@ UNUSUAL_DEV(  0x0421, 0x04b9, 0x0551, 0x0551,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY ),
 
+/* Reported by Richard Nauber <RichardNauber@web.de> */
+UNUSUAL_DEV(  0x0421, 0x04fa, 0x0601, 0x0601,
+               "Nokia",
+               "6300",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_FIX_CAPACITY ),
+
+/* Patch for Nokia 5310 capacity */
+UNUSUAL_DEV(  0x0421, 0x006a, 0x0000, 0x0591,
+       "Nokia",
+       "5310",
+       US_SC_DEVICE, US_PR_DEVICE, NULL,
+       US_FL_FIX_CAPACITY ),
+
 /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
 UNUSUAL_DEV(  0x0424, 0x0fdc, 0x0210, 0x0210,
                "SMSC",
@@ -987,6 +1008,13 @@ UNUSUAL_DEV(  0x069b, 0x3004, 0x0001, 0x0001,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY ),
 
+/* Reported by Adrian Pilchowiec <adi1981@epf.pl> */
+UNUSUAL_DEV(  0x071b, 0x3203, 0x0000, 0x0000,
+               "RockChip",
+               "MP3",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64),
+
 /* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com>
  * This USB MP3/AVI player device fails and disconnects if more than 128
  * sectors (64kB) are read/written in a single command, and may be present
@@ -1576,7 +1604,6 @@ UNUSUAL_DEV(  0x10d6, 0x2200, 0x0100, 0x0100,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                0),
 
-#ifdef CONFIG_USB_STORAGE_SIERRA
 /* Reported by Kevin Lloyd <linux@sierrawireless.com>
  * Entry is needed for the initializer function override,
  * which instructs the device to load as a modem
@@ -1587,7 +1614,6 @@ UNUSUAL_DEV(  0x1199, 0x0fff, 0x0000, 0x9999,
                "USB MMC Storage",
                US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init,
                0),
-#endif
 
 /* Reported by Jaco Kroon <jaco@kroon.co.za>
  * The usb-storage module found on the Digitech GNX4 (and supposedly other
index 73679aa506debe4a7b26cd33fd24fcbafbb6f1bf..27016fd2cad19003852154d23afc3d3f75573c9e 100644 (file)
 #ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
 #include "cypress_atacb.h"
 #endif
-#ifdef CONFIG_USB_STORAGE_SIERRA
 #include "sierra_ms.h"
-#endif
 
 /* Some informational data */
 MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
index c6299e8a041de55fb205142792aa5c1d287500c9..9cbff84b787d9e4cf17d8ebd7d2dc1822d628f5f 100644 (file)
@@ -2400,11 +2400,15 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
 
        if (!fbcon_is_inactive(vc, info)) {
                if (ops->blank_state != blank) {
+                       int ret = 1;
+
                        ops->blank_state = blank;
                        fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
                        ops->cursor_flash = (!blank);
 
-                       if (fb_blank(info, blank))
+                       if (info->fbops->fb_blank)
+                               ret = info->fbops->fb_blank(blank, info);
+                       if (ret)
                                fbcon_generic_blank(vc, info, blank);
                }
 
index a6e38e9ea73f59e3b65e7f979c9481f8004c1fc0..89a346880ec014897f051168013d4af7fc5cd091 100644 (file)
@@ -110,7 +110,7 @@ static inline int mono_col(const struct fb_info *info)
        __u32 max_len;
        max_len = max(info->var.green.length, info->var.red.length);
        max_len = max(info->var.blue.length, max_len);
-       return ~(0xfff << (max_len & 0xff));
+       return (~(0xfff << max_len)) & 0xff;
 }
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,
index 614a5c7017b64a68022ab936281aad01c8db832b..6799a6de66fe87d1ec01499278bb9b92f5683385 100644 (file)
@@ -130,8 +130,8 @@ static ssize_t geodewdt_write(struct file *file, const char __user *data,
        return len;
 }
 
-static int geodewdt_ioctl(struct inode *inode, struct file *file,
-                               unsigned int cmd, unsigned long arg)
+static long geodewdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int __user *p = argp;
@@ -198,7 +198,7 @@ static const struct file_operations geodewdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = geodewdt_write,
-       .ioctl          = geodewdt_ioctl,
+       .unlocked_ioctl = geodewdt_ioctl,
        .open           = geodewdt_open,
        .release        = geodewdt_release,
 };
index b82405cfb4cd38534bac8235c8720b7382af5a05..89fcefcc8510da969bfb13a99677e4f73faf7463 100644 (file)
@@ -85,7 +85,6 @@ static void __asr_toggle(void)
 
        outb(reg & ~asr_toggle_mask, asr_write_addr);
        reg = inb(asr_read_addr);
-       spin_unlock(&asr_lock);
 }
 
 static void asr_toggle(void)
index 0ed84162437beb913a66cdf621bde5e0d2bc9a38..6d9f3d4a9987342f5900ba43200b8c447035c6d5 100644 (file)
@@ -173,8 +173,8 @@ static const struct watchdog_info ident = {
        .identity = "PNX4008 Watchdog",
 };
 
-static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file,
-                                       unsigned int cmd, unsigned long arg)
+static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        int ret = -ENOTTY;
        int time;
index 6756bcb009ed9efecdd30f8d3b40bc3f76cc2892..c9c73b69c5e54d2b6bb079c8dd70c99d3ef38aa8 100644 (file)
@@ -182,8 +182,8 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
        return 0;
 }
 
-static int rc32434_wdt_ioctl(struct inode *inode, struct file *file,
-       unsigned int cmd, unsigned long arg)
+static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        int new_timeout;
@@ -242,7 +242,7 @@ static struct file_operations rc32434_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
        .write          = rc32434_wdt_write,
-       .ioctl          = rc32434_wdt_ioctl,
+       .unlocked_ioctl = rc32434_wdt_ioctl,
        .open           = rc32434_wdt_open,
        .release        = rc32434_wdt_release,
 };
index 9108efa73e7da4b1adc0a929b667abe274b9cb50..bf92802f2bbe93ab19b4531610fea7d3978a7abb 100644 (file)
@@ -144,8 +144,8 @@ static int rdc321x_wdt_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static int rdc321x_wdt_ioctl(struct inode *inode, struct file *file,
-                               unsigned int cmd, unsigned long arg)
+static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
+                               unsigned long arg)
 {
        void __user *argp = (void __user *)arg;
        unsigned int value;
@@ -204,7 +204,7 @@ static ssize_t rdc321x_wdt_write(struct file *file, const char __user *buf,
 static const struct file_operations rdc321x_wdt_fops = {
        .owner          = THIS_MODULE,
        .llseek         = no_llseek,
-       .ioctl          = rdc321x_wdt_ioctl,
+       .unlocked_ioctl = rdc321x_wdt_ioctl,
        .open           = rdc321x_wdt_open,
        .write          = rdc321x_wdt_write,
        .release        = rdc321x_wdt_release,
index db362c34958bdf42e43ad1567eba11049795abbe..191ea6302107f39624a1e185d6e6a72a685722af 100644 (file)
@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t watchdog_write(struct file *file, const char *data,
-                                               size_t len, loff_t *ppos)
+static ssize_t watchdog_write(struct file *file, const char __user *data,
+                             size_t len, loff_t *ppos)
 {
        /*
         *      Refresh the timer.
@@ -133,21 +133,22 @@ static const struct watchdog_info ident = {
 };
 
 static long watchdog_ioctl(struct file *file, unsigned int cmd,
-                                                       unsigned long arg)
+                          unsigned long arg)
 {
        unsigned int new_margin;
+       int __user *int_arg = (int __user *)arg;
        int ret = -ENOTTY;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                ret = 0;
-               if (copy_to_user((void *)arg, &ident, sizeof(ident)))
+               if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
                        ret = -EFAULT;
                break;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-               ret = put_user(0, (int *)arg);
+               ret = put_user(0, int_arg);
                break;
 
        case WDIOC_KEEPALIVE:
@@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                break;
 
        case WDIOC_SETTIMEOUT:
-               ret = get_user(new_margin, (int *)arg);
+               ret = get_user(new_margin, int_arg);
                if (ret)
                        break;
 
@@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                watchdog_ping();
                /* Fall */
        case WDIOC_GETTIMEOUT:
-               ret = put_user(soft_margin, (int *)arg);
+               ret = put_user(soft_margin, int_arg);
                break;
        }
        return ret;
index c95295c65045a3540959b0ddb9c227e1366472f3..e83aa5ebe861d2a8454985875d4f74a6736291a2 100644 (file)
@@ -626,8 +626,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
        return NULL;
 
 error:
-       if (fid)
-               p9_client_clunk(fid);
+       p9_client_clunk(fid);
 
        return ERR_PTR(result);
 }
index 80e93956aced2e98f2ebe8053d126d104e860ba9..e7a1a99b7464ef442a8af4ed20b0d45a4db25a65 100644 (file)
@@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
                if (dentry->d_parent != parent)
                        goto next;
 
+               /* non-existing due to RCU? */
+               if (d_unhashed(dentry))
+                       goto next;
+
                /*
                 * It is safe to compare names since d_move() cannot
                 * change the qstr (protected by d_lock).
@@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
                                goto next;
                }
 
-               if (!d_unhashed(dentry)) {
-                       atomic_inc(&dentry->d_count);
-                       found = dentry;
-               }
+               atomic_inc(&dentry->d_count);
+               found = dentry;
                spin_unlock(&dentry->d_lock);
                break;
 next:
index 32993beecbe91a10670cc4f5a9a72a5faf813c56..cecee501ce78805c32c9d007c658fce1e87b0a97 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -752,11 +752,11 @@ static int exec_mmap(struct mm_struct *mm)
        tsk->active_mm = mm;
        activate_mm(active_mm, mm);
        task_unlock(tsk);
-       mm_update_next_owner(old_mm);
        arch_pick_mmap_layout(mm);
        if (old_mm) {
                up_read(&old_mm->mmap_sem);
                BUG_ON(active_mm != old_mm);
+               mm_update_next_owner(old_mm);
                mmput(old_mm);
                return 0;
        }
index 60249429a2530d11e6d5037e148d9a3c4fd00799..d85c7d931cdfd4cb4cfa5bc839b08b4de22f9bb1 100644 (file)
@@ -323,7 +323,7 @@ out:
 }
 
 /*
- * remove_kevent - cleans up and ultimately frees the given kevent
+ * remove_kevent - cleans up the given kevent
  *
  * Caller must hold dev->ev_mutex.
  */
@@ -334,7 +334,13 @@ static void remove_kevent(struct inotify_device *dev,
 
        dev->event_count--;
        dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len;
+}
 
+/*
+ * free_kevent - frees the given kevent.
+ */
+static void free_kevent(struct inotify_kernel_event *kevent)
+{
        kfree(kevent->name);
        kmem_cache_free(event_cachep, kevent);
 }
@@ -350,6 +356,7 @@ static void inotify_dev_event_dequeue(struct inotify_device *dev)
                struct inotify_kernel_event *kevent;
                kevent = inotify_dev_get_event(dev);
                remove_kevent(dev, kevent);
+               free_kevent(kevent);
        }
 }
 
@@ -433,17 +440,15 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
        dev = file->private_data;
 
        while (1) {
-               int events;
 
                prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE);
 
                mutex_lock(&dev->ev_mutex);
-               events = !list_empty(&dev->events);
-               mutex_unlock(&dev->ev_mutex);
-               if (events) {
+               if (!list_empty(&dev->events)) {
                        ret = 0;
                        break;
                }
+               mutex_unlock(&dev->ev_mutex);
 
                if (file->f_flags & O_NONBLOCK) {
                        ret = -EAGAIN;
@@ -462,7 +467,6 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
        if (ret)
                return ret;
 
-       mutex_lock(&dev->ev_mutex);
        while (1) {
                struct inotify_kernel_event *kevent;
 
@@ -481,6 +485,13 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
                        }
                        break;
                }
+               remove_kevent(dev, kevent);
+
+               /*
+                * Must perform the copy_to_user outside the mutex in order
+                * to avoid a lock order reversal with mmap_sem.
+                */
+               mutex_unlock(&dev->ev_mutex);
 
                if (copy_to_user(buf, &kevent->event, event_size)) {
                        ret = -EFAULT;
@@ -498,7 +509,9 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
                        count -= kevent->event.len;
                }
 
-               remove_kevent(dev, kevent);
+               free_kevent(kevent);
+
+               mutex_lock(&dev->ev_mutex);
        }
        mutex_unlock(&dev->ev_mutex);
 
index 52312ec93ff4ae5c0753cdb37af0991f1f733a4c..5145cb9125af8c62a574b0dde476a4f7e8f8f814 100644 (file)
@@ -58,7 +58,7 @@ const struct inode_operations ramfs_file_inode_operations = {
  * size 0 on the assumption that it's going to be used for an mmap of shared
  * memory
  */
-static int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
+int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
 {
        struct pagevec lru_pvec;
        unsigned long npages, xpages, loop, limit;
index 1bbc6f4bb09cb850cec29e64ea34bfabe083bb3b..a1e701c27156f78201532e8f701d1af2266744f0 100644 (file)
@@ -898,6 +898,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
        if (unlikely(!(out->f_mode & FMODE_WRITE)))
                return -EBADF;
 
+       if (unlikely(out->f_flags & O_APPEND))
+               return -EINVAL;
+
        ret = rw_verify_area(WRITE, out, ppos, len);
        if (unlikely(ret < 0))
                return ret;
index b9cb77473758563314980e00c5144a84c9ccfdaf..d7f7645779f2bab707af9c0a38e96288fe65bebf 100644 (file)
@@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
                printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n);
                for (i = 0; i < n; i++)
                        printk(KERN_DEBUG "\t  ino %llu\n",
-                              le64_to_cpu(orph->inos[i]));
+                              (unsigned long long)le64_to_cpu(orph->inos[i]));
                break;
        }
        default:
index 2b267c9a18065030ff8caff09fc6b2d5cc08b558..526c01ec80032be9205e6057c48f9188b136b6e8 100644 (file)
@@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
 
        while (1) {
                dbg_gen("feed '%s', ino %llu, new f_pos %#x",
-                       dent->name, le64_to_cpu(dent->inum),
+                       dent->name, (unsigned long long)le64_to_cpu(dent->inum),
                        key_hash_flash(c, &dent->key));
                ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum);
 
index e045c8b55423e9adc7c312efbd8164f7e3584bc5..47814cde24076ba1fdd3775824d0bdeda61f79a3 100644 (file)
@@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
                rsvd_idx_lebs = 0;
        lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
               c->lst.taken_empty_lebs;
-       ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs);
        if (rsvd_idx_lebs < lebs)
                /*
                 * OK to allocate an empty LEB, but we still don't want to go
index 13f1019c859f254bed9ee9512007b50ee79274da..02aba36fe3d4994ac6dbdba97d0705371cd8bf21 100644 (file)
@@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 
                err = move_nodes(c, sleb);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                err = gc_sync_wbufs(c);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0);
                if (err)
-                       goto out;
+                       goto out_inc_seq;
 
                /* Allow for races with TNC */
                c->gced_lnum = lnum;
@@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 out:
        ubifs_scan_destroy(sleb);
        return err;
+
+out_inc_seq:
+       /* We may have moved at least some nodes so allow for races with TNC */
+       c->gced_lnum = lnum;
+       smp_wmb();
+       c->gc_seq += 1;
+       smp_wmb();
+       goto out;
 }
 
 /**
index 7562464ac83fba3c19101afea8cf9495bf6cd692..3f4902060c7a10aba197a73c07491b7aca4cc84e 100644 (file)
@@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c)
                goto out_dereg;
        }
 
+       sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
        if (!mounted_read_only) {
                err = alloc_wbufs(c);
                if (err)
                        goto out_cbuf;
 
                /* Create background thread */
-               sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num,
-                       c->vi.vol_id);
                c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
                if (!c->bgt)
                        c->bgt = ERR_PTR(-EINVAL);
index 7da209ab93788f8cafb30d6532b946897d9ae384..7634c5970887960a9555e82757bf11ffe704a5f3 100644 (file)
@@ -1476,7 +1476,7 @@ again:
        }
 
        err = fallible_read_node(c, key, &zbr, node);
-       if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
+       if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
                /*
                 * The node may have been GC'ed out from under us so try again
                 * while keeping the TNC mutex locked.
index 00e80df9dd9d727191f15fefc79cd92055d4e9d6..dbd9cef852ece3d6d8b3b5b930626000c88bed06 100644 (file)
@@ -4118,7 +4118,7 @@ xfs_iext_indirect_to_direct(
        ASSERT(nextents <= XFS_LINEAR_EXTS);
        size = nextents * sizeof(xfs_bmbt_rec_t);
 
-       xfs_iext_irec_compact_full(ifp);
+       xfs_iext_irec_compact_pages(ifp);
        ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ);
 
        ep = ifp->if_u1.if_ext_irec->er_extbuf;
@@ -4449,8 +4449,7 @@ xfs_iext_irec_remove(
  * compaction policy is as follows:
  *
  *    Full Compaction: Extents fit into a single page (or inline buffer)
- *    Full Compaction: Extents occupy less than 10% of allocated space
- * Partial Compaction: Extents occupy > 10% and < 50% of allocated space
+ * Partial Compaction: Extents occupy less than 50% of allocated space
  *      No Compaction: Extents occupy at least 50% of allocated space
  */
 void
@@ -4471,8 +4470,6 @@ xfs_iext_irec_compact(
                xfs_iext_direct_to_inline(ifp, nextents);
        } else if (nextents <= XFS_LINEAR_EXTS) {
                xfs_iext_indirect_to_direct(ifp);
-       } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) {
-               xfs_iext_irec_compact_full(ifp);
        } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) {
                xfs_iext_irec_compact_pages(ifp);
        }
@@ -4496,7 +4493,7 @@ xfs_iext_irec_compact_pages(
                erp_next = erp + 1;
                if (erp_next->er_extcount <=
                    (XFS_LINEAR_EXTS - erp->er_extcount)) {
-                       memmove(&erp->er_extbuf[erp->er_extcount],
+                       memcpy(&erp->er_extbuf[erp->er_extcount],
                                erp_next->er_extbuf, erp_next->er_extcount *
                                sizeof(xfs_bmbt_rec_t));
                        erp->er_extcount += erp_next->er_extcount;
@@ -4515,91 +4512,6 @@ xfs_iext_irec_compact_pages(
        }
 }
 
-/*
- * Fully compact the extent records managed by the indirection array.
- */
-void
-xfs_iext_irec_compact_full(
-       xfs_ifork_t     *ifp)                   /* inode fork pointer */
-{
-       xfs_bmbt_rec_host_t *ep, *ep_next;      /* extent record pointers */
-       xfs_ext_irec_t  *erp, *erp_next;        /* extent irec pointers */
-       int             erp_idx = 0;            /* extent irec index */
-       int             ext_avail;              /* empty entries in ex list */
-       int             ext_diff;               /* number of exts to add */
-       int             nlists;                 /* number of irec's (ex lists) */
-
-       ASSERT(ifp->if_flags & XFS_IFEXTIREC);
-
-       nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
-       erp = ifp->if_u1.if_ext_irec;
-       ep = &erp->er_extbuf[erp->er_extcount];
-       erp_next = erp + 1;
-       ep_next = erp_next->er_extbuf;
-
-       while (erp_idx < nlists - 1) {
-               /*
-                * Check how many extent records are available in this irec.
-                * If there is none skip the whole exercise.
-                */
-               ext_avail = XFS_LINEAR_EXTS - erp->er_extcount;
-               if (ext_avail) {
-
-                       /*
-                        * Copy over as many as possible extent records into
-                        * the previous page.
-                        */
-                       ext_diff = MIN(ext_avail, erp_next->er_extcount);
-                       memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t));
-                       erp->er_extcount += ext_diff;
-                       erp_next->er_extcount -= ext_diff;
-
-                       /*
-                        * If the next irec is empty now we can simply
-                        * remove it.
-                        */
-                       if (erp_next->er_extcount == 0) {
-                               /*
-                                * Free page before removing extent record
-                                * so er_extoffs don't get modified in
-                                * xfs_iext_irec_remove.
-                                */
-                               kmem_free(erp_next->er_extbuf);
-                               erp_next->er_extbuf = NULL;
-                               xfs_iext_irec_remove(ifp, erp_idx + 1);
-                               erp = &ifp->if_u1.if_ext_irec[erp_idx];
-                               nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
-
-                       /*
-                        * If the next irec is not empty move up the content
-                        * that has not been copied to the previous page to
-                        * the beggining of this one.
-                        */
-                       } else {
-                               memmove(erp_next->er_extbuf, &ep_next[ext_diff],
-                                       erp_next->er_extcount *
-                                       sizeof(xfs_bmbt_rec_t));
-                               ep_next = erp_next->er_extbuf;
-                               memset(&ep_next[erp_next->er_extcount], 0,
-                                       (XFS_LINEAR_EXTS -
-                                               erp_next->er_extcount) *
-                                       sizeof(xfs_bmbt_rec_t));
-                       }
-               }
-
-               if (erp->er_extcount == XFS_LINEAR_EXTS) {
-                       erp_idx++;
-                       if (erp_idx < nlists)
-                               erp = &ifp->if_u1.if_ext_irec[erp_idx];
-                       else
-                               break;
-               }
-               ep = &erp->er_extbuf[erp->er_extcount];
-               erp_next = erp + 1;
-               ep_next = erp_next->er_extbuf;
-       }
-}
-
 /*
  * This is called to update the er_extoff field in the indirection
  * array when extents have been added or removed from one of the
index 4eb75a88795ad21da088d394f5e08faa898e04ad..29feee27f0ea8aeef29352635eb4f6720f55e1f2 100644 (file)
@@ -63,7 +63,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                0x20080609
+#define ACPI_CA_VERSION                 0x20080926
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
index c5a1b50d8d94c27ccb9f6d6dff2682ba3c30d115..62c59df3b86c049799e78f280d8a743bbed38aac 100644 (file)
@@ -123,6 +123,10 @@ void acpi_db_check_integrity(void);
 
 void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
 
+void acpi_db_check_predefined_names(void);
+
+void acpi_db_batch_execute(void);
+
 /*
  * dbdisply - debug display commands
  */
@@ -150,6 +154,10 @@ void
 acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
                                struct acpi_walk_state *walk_state);
 
+void acpi_db_check_predefined_names(void);
+
+void acpi_db_batch_execute(void);
+
 /*
  * dbexec - debugger control method execution
  */
index f53faca8ec8055cc367968aa9982ddd8ca0fcad0..0c1ed387073cf206cb7a3a4b3d02af15a086175f 100644 (file)
@@ -186,6 +186,8 @@ 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_madt9[];
+extern struct acpi_dmtable_info acpi_dm_table_info_madt10[];
 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[];
@@ -197,8 +199,10 @@ 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_srat_hdr[];
 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_srat2[];
 extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
 extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
 
index 21a73a105d0ab2920962c4febb1e6a2d795dd263..6291904be01e564d7b4433a1d35fbd30144f2774 100644 (file)
@@ -157,7 +157,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
  * dsmthdat - method data (locals/args)
  */
 acpi_status
-acpi_ds_store_object_to_local(u16 opcode,
+acpi_ds_store_object_to_local(u8 type,
                              u32 index,
                              union acpi_operand_object *src_desc,
                              struct acpi_walk_state *walk_state);
@@ -173,7 +173,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
 u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
 
 acpi_status
-acpi_ds_method_data_get_value(u16 opcode,
+acpi_ds_method_data_get_value(u8 type,
                              u32 index,
                              struct acpi_walk_state *walk_state,
                              union acpi_operand_object **dest_desc);
@@ -184,7 +184,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
                              struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_method_data_get_node(u16 opcode,
+acpi_ds_method_data_get_node(u8 type,
                             u32 index,
                             struct acpi_walk_state *walk_state,
                             struct acpi_namespace_node **node);
index e5a890ffeb02c26ec55f73ff4a0ff58912306087..84f5cb242863c28829c3919b62c57c1e699c68e3 100644 (file)
 #define AE_STACK_OVERFLOW               (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
 #define AE_STACK_UNDERFLOW              (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
 #define AE_NOT_IMPLEMENTED              (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
-#define AE_VERSION_MISMATCH             (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
-#define AE_SUPPORT                      (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
-#define AE_SHARE                        (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
-#define AE_LIMIT                        (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
-#define AE_TIME                         (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
-#define AE_UNKNOWN_STATUS               (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
-#define AE_ACQUIRE_DEADLOCK             (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
-#define AE_RELEASE_DEADLOCK             (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
-#define AE_NOT_ACQUIRED                 (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
-#define AE_ALREADY_ACQUIRED             (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_HARDWARE_RESPONSE         (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
-#define AE_NO_GLOBAL_LOCK               (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
-#define AE_LOGICAL_ADDRESS              (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
-#define AE_ABORT_METHOD                 (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
-#define AE_SAME_HANDLER                 (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
-#define AE_WAKE_ONLY_GPE                (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL)
-#define AE_OWNER_ID_LIMIT               (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL)
+#define AE_SUPPORT                      (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
+#define AE_LIMIT                        (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
+#define AE_TIME                         (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
+#define AE_ACQUIRE_DEADLOCK             (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
+#define AE_RELEASE_DEADLOCK             (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
+#define AE_NOT_ACQUIRED                 (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
+#define AE_ALREADY_ACQUIRED             (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_HARDWARE_RESPONSE         (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
+#define AE_NO_GLOBAL_LOCK               (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
+#define AE_ABORT_METHOD                 (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
+#define AE_SAME_HANDLER                 (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
+#define AE_WAKE_ONLY_GPE                (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
+#define AE_OWNER_ID_LIMIT               (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
 
-#define AE_CODE_ENV_MAX                 0x001F
+#define AE_CODE_ENV_MAX                 0x001B
 
 /*
  * Programmer exceptions
 #define AE_BAD_CHARACTER                (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
 #define AE_BAD_PATHNAME                 (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
 #define AE_BAD_DATA                     (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
-#define AE_BAD_ADDRESS                  (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
-#define AE_ALIGNMENT                    (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
-#define AE_BAD_HEX_CONSTANT             (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
-#define AE_BAD_OCTAL_CONSTANT           (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
-#define AE_BAD_DECIMAL_CONSTANT         (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
-#define AE_MISSING_ARGUMENTS           (acpi_status) (0x000A | AE_CODE_PROGRAMMER)
+#define AE_BAD_HEX_CONSTANT             (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
+#define AE_BAD_OCTAL_CONSTANT           (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
+#define AE_BAD_DECIMAL_CONSTANT         (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
+#define AE_MISSING_ARGUMENTS            (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
 
-#define AE_CODE_PGM_MAX                0x000A
+#define AE_CODE_PGM_MAX                 0x0008
 
 /*
  * Acpi table exceptions
 #define AE_BAD_HEADER                   (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
 #define AE_BAD_CHECKSUM                 (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
 #define AE_BAD_VALUE                    (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
-#define AE_TABLE_NOT_SUPPORTED          (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
-#define AE_INVALID_TABLE_LENGTH         (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
+#define AE_INVALID_TABLE_LENGTH         (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
 
-#define AE_CODE_TBL_MAX                 0x0006
+#define AE_CODE_TBL_MAX                 0x0005
 
 /*
  * AML exceptions.  These are caused by problems with
  * the actual AML byte stream
  */
-#define AE_AML_ERROR                    (acpi_status) (0x0001 | AE_CODE_AML)
-#define AE_AML_PARSE                    (acpi_status) (0x0002 | AE_CODE_AML)
-#define AE_AML_BAD_OPCODE               (acpi_status) (0x0003 | AE_CODE_AML)
-#define AE_AML_NO_OPERAND               (acpi_status) (0x0004 | AE_CODE_AML)
-#define AE_AML_OPERAND_TYPE             (acpi_status) (0x0005 | AE_CODE_AML)
-#define AE_AML_OPERAND_VALUE            (acpi_status) (0x0006 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_LOCAL      (acpi_status) (0x0007 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_ARG        (acpi_status) (0x0008 | AE_CODE_AML)
-#define AE_AML_UNINITIALIZED_ELEMENT    (acpi_status) (0x0009 | AE_CODE_AML)
-#define AE_AML_NUMERIC_OVERFLOW         (acpi_status) (0x000A | AE_CODE_AML)
-#define AE_AML_REGION_LIMIT             (acpi_status) (0x000B | AE_CODE_AML)
-#define AE_AML_BUFFER_LIMIT             (acpi_status) (0x000C | AE_CODE_AML)
-#define AE_AML_PACKAGE_LIMIT            (acpi_status) (0x000D | AE_CODE_AML)
-#define AE_AML_DIVIDE_BY_ZERO           (acpi_status) (0x000E | AE_CODE_AML)
-#define AE_AML_BAD_NAME                 (acpi_status) (0x000F | AE_CODE_AML)
-#define AE_AML_NAME_NOT_FOUND           (acpi_status) (0x0010 | AE_CODE_AML)
-#define AE_AML_INTERNAL                 (acpi_status) (0x0011 | AE_CODE_AML)
-#define AE_AML_INVALID_SPACE_ID         (acpi_status) (0x0012 | AE_CODE_AML)
-#define AE_AML_STRING_LIMIT             (acpi_status) (0x0013 | AE_CODE_AML)
-#define AE_AML_NO_RETURN_VALUE          (acpi_status) (0x0014 | AE_CODE_AML)
-#define AE_AML_METHOD_LIMIT             (acpi_status) (0x0015 | AE_CODE_AML)
-#define AE_AML_NOT_OWNER                (acpi_status) (0x0016 | AE_CODE_AML)
-#define AE_AML_MUTEX_ORDER              (acpi_status) (0x0017 | AE_CODE_AML)
-#define AE_AML_MUTEX_NOT_ACQUIRED       (acpi_status) (0x0018 | AE_CODE_AML)
-#define AE_AML_INVALID_RESOURCE_TYPE    (acpi_status) (0x0019 | AE_CODE_AML)
-#define AE_AML_INVALID_INDEX            (acpi_status) (0x001A | AE_CODE_AML)
-#define AE_AML_REGISTER_LIMIT           (acpi_status) (0x001B | AE_CODE_AML)
-#define AE_AML_NO_WHILE                 (acpi_status) (0x001C | AE_CODE_AML)
-#define AE_AML_ALIGNMENT                (acpi_status) (0x001D | AE_CODE_AML)
-#define AE_AML_NO_RESOURCE_END_TAG      (acpi_status) (0x001E | AE_CODE_AML)
-#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_AML_BAD_OPCODE               (acpi_status) (0x0001 | AE_CODE_AML)
+#define AE_AML_NO_OPERAND               (acpi_status) (0x0002 | AE_CODE_AML)
+#define AE_AML_OPERAND_TYPE             (acpi_status) (0x0003 | AE_CODE_AML)
+#define AE_AML_OPERAND_VALUE            (acpi_status) (0x0004 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_LOCAL      (acpi_status) (0x0005 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ARG        (acpi_status) (0x0006 | AE_CODE_AML)
+#define AE_AML_UNINITIALIZED_ELEMENT    (acpi_status) (0x0007 | AE_CODE_AML)
+#define AE_AML_NUMERIC_OVERFLOW         (acpi_status) (0x0008 | AE_CODE_AML)
+#define AE_AML_REGION_LIMIT             (acpi_status) (0x0009 | AE_CODE_AML)
+#define AE_AML_BUFFER_LIMIT             (acpi_status) (0x000A | AE_CODE_AML)
+#define AE_AML_PACKAGE_LIMIT            (acpi_status) (0x000B | AE_CODE_AML)
+#define AE_AML_DIVIDE_BY_ZERO           (acpi_status) (0x000C | AE_CODE_AML)
+#define AE_AML_BAD_NAME                 (acpi_status) (0x000D | AE_CODE_AML)
+#define AE_AML_NAME_NOT_FOUND           (acpi_status) (0x000E | AE_CODE_AML)
+#define AE_AML_INTERNAL                 (acpi_status) (0x000F | AE_CODE_AML)
+#define AE_AML_INVALID_SPACE_ID         (acpi_status) (0x0010 | AE_CODE_AML)
+#define AE_AML_STRING_LIMIT             (acpi_status) (0x0011 | AE_CODE_AML)
+#define AE_AML_NO_RETURN_VALUE          (acpi_status) (0x0012 | AE_CODE_AML)
+#define AE_AML_METHOD_LIMIT             (acpi_status) (0x0013 | AE_CODE_AML)
+#define AE_AML_NOT_OWNER                (acpi_status) (0x0014 | AE_CODE_AML)
+#define AE_AML_MUTEX_ORDER              (acpi_status) (0x0015 | AE_CODE_AML)
+#define AE_AML_MUTEX_NOT_ACQUIRED       (acpi_status) (0x0016 | AE_CODE_AML)
+#define AE_AML_INVALID_RESOURCE_TYPE    (acpi_status) (0x0017 | AE_CODE_AML)
+#define AE_AML_INVALID_INDEX            (acpi_status) (0x0018 | AE_CODE_AML)
+#define AE_AML_REGISTER_LIMIT           (acpi_status) (0x0019 | AE_CODE_AML)
+#define AE_AML_NO_WHILE                 (acpi_status) (0x001A | AE_CODE_AML)
+#define AE_AML_ALIGNMENT                (acpi_status) (0x001B | AE_CODE_AML)
+#define AE_AML_NO_RESOURCE_END_TAG      (acpi_status) (0x001C | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_VALUE       (acpi_status) (0x001D | AE_CODE_AML)
+#define AE_AML_CIRCULAR_REFERENCE       (acpi_status) (0x001E | AE_CODE_AML)
+#define AE_AML_BAD_RESOURCE_LENGTH      (acpi_status) (0x001F | AE_CODE_AML)
+#define AE_AML_ILLEGAL_ADDRESS          (acpi_status) (0x0020 | AE_CODE_AML)
 
-#define AE_CODE_AML_MAX                 0x0022
+#define AE_CODE_AML_MAX                 0x0020
 
 /*
  * Internal exceptions used for control
@@ -206,19 +197,15 @@ char const *acpi_gbl_exception_names_env[] = {
        "AE_STACK_OVERFLOW",
        "AE_STACK_UNDERFLOW",
        "AE_NOT_IMPLEMENTED",
-       "AE_VERSION_MISMATCH",
        "AE_SUPPORT",
-       "AE_SHARE",
        "AE_LIMIT",
        "AE_TIME",
-       "AE_UNKNOWN_STATUS",
        "AE_ACQUIRE_DEADLOCK",
        "AE_RELEASE_DEADLOCK",
        "AE_NOT_ACQUIRED",
        "AE_ALREADY_ACQUIRED",
        "AE_NO_HARDWARE_RESPONSE",
        "AE_NO_GLOBAL_LOCK",
-       "AE_LOGICAL_ADDRESS",
        "AE_ABORT_METHOD",
        "AE_SAME_HANDLER",
        "AE_WAKE_ONLY_GPE",
@@ -231,8 +218,6 @@ char const *acpi_gbl_exception_names_pgm[] = {
        "AE_BAD_CHARACTER",
        "AE_BAD_PATHNAME",
        "AE_BAD_DATA",
-       "AE_BAD_ADDRESS",
-       "AE_ALIGNMENT",
        "AE_BAD_HEX_CONSTANT",
        "AE_BAD_OCTAL_CONSTANT",
        "AE_BAD_DECIMAL_CONSTANT",
@@ -245,14 +230,11 @@ char const *acpi_gbl_exception_names_tbl[] = {
        "AE_BAD_HEADER",
        "AE_BAD_CHECKSUM",
        "AE_BAD_VALUE",
-       "AE_TABLE_NOT_SUPPORTED",
        "AE_INVALID_TABLE_LENGTH"
 };
 
 char const *acpi_gbl_exception_names_aml[] = {
        NULL,
-       "AE_AML_ERROR",
-       "AE_AML_PARSE",
        "AE_AML_BAD_OPCODE",
        "AE_AML_NO_OPERAND",
        "AE_AML_OPERAND_TYPE",
@@ -284,7 +266,7 @@ char const *acpi_gbl_exception_names_aml[] = {
        "AE_AML_BAD_RESOURCE_VALUE",
        "AE_AML_CIRCULAR_REFERENCE",
        "AE_AML_BAD_RESOURCE_LENGTH",
-       "AE_AML_ILLEGAL_ADDRESS"
+       "AE_AML_ILLEGAL_ADDRESS",
 };
 
 char const *acpi_gbl_exception_names_ctrl[] = {
index b221c8583dddf22966e65b3e974d508e17f43079..ecab527cf78ef72afe33309782bf184a12c13641 100644 (file)
@@ -208,6 +208,7 @@ struct acpi_namespace_node {
 #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_EVALUATED                 0x20   /* Set on first evaluation of node */
 
 #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 */
@@ -340,6 +341,82 @@ acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF     /* ARG or LOCAL */
 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 
+/*
+ * Information structure for ACPI predefined names.
+ * Each entry in the table contains the following items:
+ *
+ * Name                 - The ACPI reserved name
+ * param_count          - Number of arguments to the method
+ * expected_return_btypes - Allowed type(s) for the return value
+ */
+struct acpi_name_info {
+       char name[ACPI_NAME_SIZE];
+       u8 param_count;
+       u8 expected_btypes;
+};
+
+/*
+ * Secondary information structures for ACPI predefined objects that return
+ * package objects. This structure appears as the next entry in the table
+ * after the NAME_INFO structure above.
+ *
+ * The reason for this is to minimize the size of the predefined name table.
+ */
+
+/*
+ * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
+ * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
+ */
+struct acpi_package_info {
+       u8 type;
+       u8 object_type1;
+       u8 count1;
+       u8 object_type2;
+       u8 count2;
+       u8 reserved;
+};
+
+/* Used for ACPI_PTYPE2_FIXED */
+
+struct acpi_package_info2 {
+       u8 type;
+       u8 count;
+       u8 object_type[4];
+};
+
+/* Used for ACPI_PTYPE1_OPTION */
+
+struct acpi_package_info3 {
+       u8 type;
+       u8 count;
+       u8 object_type[2];
+       u8 tail_object_type;
+       u8 reserved;
+};
+
+union acpi_predefined_info {
+       struct acpi_name_info info;
+       struct acpi_package_info ret_info;
+       struct acpi_package_info2 ret_info2;
+       struct acpi_package_info3 ret_info3;
+};
+
+/*
+ * Bitmapped return value types
+ * Note: the actual data types must be contiguous, a loop in nspredef.c
+ * depends on this.
+ */
+#define ACPI_RTYPE_ANY                  0x00
+#define ACPI_RTYPE_NONE                 0x01
+#define ACPI_RTYPE_INTEGER              0x02
+#define ACPI_RTYPE_STRING               0x04
+#define ACPI_RTYPE_BUFFER               0x08
+#define ACPI_RTYPE_PACKAGE              0x10
+#define ACPI_RTYPE_REFERENCE            0x20
+#define ACPI_RTYPE_ALL                  0x3F
+
+#define ACPI_NUM_RTYPES                 5      /* Number of actual object types */
+
 /*****************************************************************************
  *
  * Event typedefs and structs
index 57ab9e9d7593e6213ff2342f55d2dbaaab92ff80..a1e3240bf460ba10950014559edf267eaa563a01 100644 (file)
@@ -62,7 +62,7 @@
 #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
 
 /*
- * Extract data using a pointer.  Any more than a byte and we
+ * Extract data using a pointer. Any more than a byte and we
  * get into potential aligment issues -- see the STORE macros below.
  * Use with care.
  */
  */
 #define ACPI_CAST_PTR(t, p)             ((t *) (acpi_uintptr_t) (p))
 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (acpi_uintptr_t) (p))
-#define ACPI_ADD_PTR(t, a, b)          ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_size)(b)))
-#define ACPI_PTR_DIFF(a, b)            (acpi_size) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b)))
+#define ACPI_ADD_PTR(t, a, b)          ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
+#define ACPI_PTR_DIFF(a, b)            (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
 
 /* Pointer/Integer type conversions */
 
 #define ACPI_TO_POINTER(i)             ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) 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_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_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
 
 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
+#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))
+#define ACPI_COMPARE_NAME(a, b)         (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
 #endif
 
 /*
@@ -114,7 +114,7 @@ struct acpi_integer_overlay {
 
 /* 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_FORMAT_UINT64(i)           ACPI_HIDWORD(i), ACPI_LODWORD(i)
 
 #if ACPI_MACHINE_WIDTH == 64
 #define ACPI_FORMAT_NATIVE_UINT(i)      ACPI_FORMAT_UINT64(i)
@@ -132,37 +132,33 @@ struct acpi_integer_overlay {
  * Macros for big-endian machines
  */
 
-/* This macro sets a buffer index, starting from the end of the buffer */
-
-#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran)))
-
 /* These macros reverse the bytes during the move, converting little-endian to big endian */
 
                          /* Big Endian      <==        Little Endian */
                          /*  Hi...Lo                     Lo...Hi     */
 /* 16-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_16_TO_16(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
+#define ACPI_MOVE_16_TO_16(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
                                           ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
 
-#define ACPI_MOVE_16_TO_32(d,s)         {(*(u32 *)(void *)(d))=0;\
+#define ACPI_MOVE_16_TO_32(d, s)        {(*(u32 *)(void *)(d))=0;\
                                                           ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
                                                           ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
-#define ACPI_MOVE_16_TO_64(d,s)         {(*(u64 *)(void *)(d))=0;\
+#define ACPI_MOVE_16_TO_64(d, s)        {(*(u64 *)(void *)(d))=0;\
                                                                         ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
                                                                         ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
 
-#define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
+#define ACPI_MOVE_32_TO_32(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
                                                                                 ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
                                                                                 ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
-#define ACPI_MOVE_32_TO_64(d,s)         {(*(u64 *)(void *)(d))=0;\
+#define ACPI_MOVE_32_TO_64(d, s)        {(*(u64 *)(void *)(d))=0;\
                                                                                   ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
                                                                                   ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
                                                                                   ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
@@ -170,11 +166,11 @@ struct acpi_integer_overlay {
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
 
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)       /* Truncate to 32 */
 
-#define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
+#define ACPI_MOVE_64_TO_64(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
                                                                                 ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
                                                                                 ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
@@ -187,63 +183,59 @@ struct acpi_integer_overlay {
  * Macros for little-endian machines
  */
 
-/* This macro sets a buffer index, starting from the beginning of the buffer */
-
-#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
-
 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
 
 /* The hardware supports unaligned transfers, just do the little-endian move */
 
 /* 16-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_16_TO_16(d,s)         *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
-#define ACPI_MOVE_16_TO_32(d,s)         *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
-#define ACPI_MOVE_16_TO_64(d,s)         *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_16(d, s)        *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_32(d, s)        *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
+#define ACPI_MOVE_16_TO_64(d, s)        *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
-#define ACPI_MOVE_32_TO_32(d,s)         *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
-#define ACPI_MOVE_32_TO_64(d,s)         *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_32(d, s)        *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
+#define ACPI_MOVE_32_TO_64(d, s)        *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
-#define ACPI_MOVE_64_TO_64(d,s)         *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
+#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)       /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d, s)        *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
 
 #else
 /*
- * The hardware does not support unaligned transfers.  We must move the
- * data one byte at a time.  These macros work whether the source or
+ * The hardware does not support unaligned transfers. We must move the
+ * data one byte at a time. These macros work whether the source or
  * the destination (or both) is/are unaligned.  (Little-endian move)
  */
 
 /* 16-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_16_TO_16(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+#define ACPI_MOVE_16_TO_16(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
 
-#define ACPI_MOVE_16_TO_32(d,s)         {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
-#define ACPI_MOVE_16_TO_64(d,s)         {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);}
+#define ACPI_MOVE_16_TO_32(d, s)        {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
+#define ACPI_MOVE_16_TO_64(d, s)        {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
 
-#define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+#define ACPI_MOVE_32_TO_32(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
                                                                                 ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
                                                                                 ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
 
-#define ACPI_MOVE_32_TO_64(d,s)         {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);}
+#define ACPI_MOVE_32_TO_64(d, s)        {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
-#define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
+#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)       /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)       /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_64(d, s)        {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
                                                                                 ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
                                                                                 ((  u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
@@ -257,10 +249,10 @@ struct acpi_integer_overlay {
 /* Macros based on machine integer width */
 
 #if ACPI_MACHINE_WIDTH == 32
-#define ACPI_MOVE_SIZE_TO_16(d,s)       ACPI_MOVE_32_TO_16(d,s)
+#define ACPI_MOVE_SIZE_TO_16(d, s)       ACPI_MOVE_32_TO_16(d, s)
 
 #elif ACPI_MACHINE_WIDTH == 64
-#define ACPI_MOVE_SIZE_TO_16(d,s)       ACPI_MOVE_64_TO_16(d,s)
+#define ACPI_MOVE_SIZE_TO_16(d, s)       ACPI_MOVE_64_TO_16(d, s)
 
 #else
 #error unknown ACPI_MACHINE_WIDTH
@@ -269,29 +261,29 @@ struct acpi_integer_overlay {
 /*
  * Fast power-of-two math macros for non-optimized compilers
  */
-#define _ACPI_DIV(value,power_of2)      ((u32) ((value) >> (power_of2)))
-#define _ACPI_MUL(value,power_of2)      ((u32) ((value) << (power_of2)))
-#define _ACPI_MOD(value,divisor)        ((u32) ((value) & ((divisor) -1)))
+#define _ACPI_DIV(value, power_of2)      ((u32) ((value) >> (power_of2)))
+#define _ACPI_MUL(value, power_of2)      ((u32) ((value) << (power_of2)))
+#define _ACPI_MOD(value, divisor)        ((u32) ((value) & ((divisor) -1)))
 
-#define ACPI_DIV_2(a)                   _ACPI_DIV(a,1)
-#define ACPI_MUL_2(a)                   _ACPI_MUL(a,1)
-#define ACPI_MOD_2(a)                   _ACPI_MOD(a,2)
+#define ACPI_DIV_2(a)                   _ACPI_DIV(a, 1)
+#define ACPI_MUL_2(a)                   _ACPI_MUL(a, 1)
+#define ACPI_MOD_2(a)                   _ACPI_MOD(a, 2)
 
-#define ACPI_DIV_4(a)                   _ACPI_DIV(a,2)
-#define ACPI_MUL_4(a)                   _ACPI_MUL(a,2)
-#define ACPI_MOD_4(a)                   _ACPI_MOD(a,4)
+#define ACPI_DIV_4(a)                   _ACPI_DIV(a, 2)
+#define ACPI_MUL_4(a)                   _ACPI_MUL(a, 2)
+#define ACPI_MOD_4(a)                   _ACPI_MOD(a, 4)
 
-#define ACPI_DIV_8(a)                   _ACPI_DIV(a,3)
-#define ACPI_MUL_8(a)                   _ACPI_MUL(a,3)
-#define ACPI_MOD_8(a)                   _ACPI_MOD(a,8)
+#define ACPI_DIV_8(a)                   _ACPI_DIV(a, 3)
+#define ACPI_MUL_8(a)                   _ACPI_MUL(a, 3)
+#define ACPI_MOD_8(a)                   _ACPI_MOD(a, 8)
 
-#define ACPI_DIV_16(a)                  _ACPI_DIV(a,4)
-#define ACPI_MUL_16(a)                  _ACPI_MUL(a,4)
-#define ACPI_MOD_16(a)                  _ACPI_MOD(a,16)
+#define ACPI_DIV_16(a)                  _ACPI_DIV(a, 4)
+#define ACPI_MUL_16(a)                  _ACPI_MUL(a, 4)
+#define ACPI_MOD_16(a)                  _ACPI_MOD(a, 16)
 
-#define ACPI_DIV_32(a)                  _ACPI_DIV(a,5)
-#define ACPI_MUL_32(a)                  _ACPI_MUL(a,5)
-#define ACPI_MOD_32(a)                  _ACPI_MOD(a,32)
+#define ACPI_DIV_32(a)                  _ACPI_DIV(a, 5)
+#define ACPI_MUL_32(a)                  _ACPI_MUL(a, 5)
+#define ACPI_MOD_32(a)                  _ACPI_MOD(a, 32)
 
 /*
  * Rounding macros (Power of two boundaries only)
@@ -305,13 +297,13 @@ struct acpi_integer_overlay {
 
 /* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
 
-#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_size))
+#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_size))
 
-#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_size))
+#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_size))
 
 #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))
@@ -320,9 +312,9 @@ struct acpi_integer_overlay {
 
 /* 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_size)value) & (sizeof(acpi_size)-1))
+#define ACPI_IS_MISALIGNED(value)          (((acpi_size) value) & (sizeof(acpi_size)-1))
 
 /*
  * Bitmask creation
@@ -333,8 +325,6 @@ struct acpi_integer_overlay {
 #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'))
-
 /* Bitfields within ACPI registers */
 
 #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask)      ((val << pos) & mask)
@@ -342,39 +332,29 @@ struct acpi_integer_overlay {
 
 #define ACPI_INSERT_BITS(target, mask, source)          target = ((target & (~(mask))) | (source & mask))
 
-/* Generate a UUID */
-
-#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
-       (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
-       (b) & 0xFF, ((b) >> 8) & 0xFF, \
-       (c) & 0xFF, ((c) >> 8) & 0xFF, \
-       (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
-
 /*
- * An struct acpi_namespace_node * can appear in some contexts,
- * where a pointer to an union acpi_operand_object    can also
- * appear.  This macro is used to distinguish them.
+ * An struct acpi_namespace_node can appear in some contexts
+ * where a pointer to an union acpi_operand_object can also
+ * appear. This macro is used to distinguish them.
  *
  * The "Descriptor" field is the first field in both structures.
  */
 #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)
+#define ACPI_SET_DESCRIPTOR_TYPE(d, t)  (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
 
 /* Macro to test the object type */
 
 #define ACPI_GET_OBJECT_TYPE(d)         (((union acpi_operand_object *)(void *)(d))->common.type)
 
-/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
-
-#define ACPI_IS_SINGLE_TABLE(x)         (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
-
 /*
  * Macros for the master AML opcode table
  */
-#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
-#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags)    {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
+#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
+       {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
 #else
-#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags)    {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type}
+#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
+       {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
 #endif
 
 #ifdef ACPI_DISASSEMBLER
@@ -392,18 +372,18 @@ struct acpi_integer_overlay {
 #define ARG_6(x)                        ((u32)(x) << (5 * ARG_TYPE_WIDTH))
 
 #define ARGI_LIST1(a)                   (ARG_1(a))
-#define ARGI_LIST2(a,b)                 (ARG_1(b)|ARG_2(a))
-#define ARGI_LIST3(a,b,c)               (ARG_1(c)|ARG_2(b)|ARG_3(a))
-#define ARGI_LIST4(a,b,c,d)             (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
-#define ARGI_LIST5(a,b,c,d,e)           (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
-#define ARGI_LIST6(a,b,c,d,e,f)         (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
+#define ARGI_LIST2(a, b)                (ARG_1(b)|ARG_2(a))
+#define ARGI_LIST3(a, b, c)             (ARG_1(c)|ARG_2(b)|ARG_3(a))
+#define ARGI_LIST4(a, b, c, d)          (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
+#define ARGI_LIST5(a, b, c, d, e)       (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
+#define ARGI_LIST6(a, b, c, d, e, f)    (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
 
 #define ARGP_LIST1(a)                   (ARG_1(a))
-#define ARGP_LIST2(a,b)                 (ARG_1(a)|ARG_2(b))
-#define ARGP_LIST3(a,b,c)               (ARG_1(a)|ARG_2(b)|ARG_3(c))
-#define ARGP_LIST4(a,b,c,d)             (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
-#define ARGP_LIST5(a,b,c,d,e)           (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
-#define ARGP_LIST6(a,b,c,d,e,f)         (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
+#define ARGP_LIST2(a, b)                (ARG_1(a)|ARG_2(b))
+#define ARGP_LIST3(a, b, c)             (ARG_1(a)|ARG_2(b)|ARG_3(c))
+#define ARGP_LIST4(a, b, c, d)          (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
+#define ARGP_LIST5(a, b, c, d, e)       (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
+#define ARGP_LIST6(a, b, c, d, e, f)    (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
 
 #define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
 #define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
@@ -434,8 +414,8 @@ struct acpi_integer_overlay {
 #define ACPI_WARNING(plist)             acpi_ut_warning plist
 #define ACPI_EXCEPTION(plist)           acpi_ut_exception plist
 #define ACPI_ERROR(plist)               acpi_ut_error plist
-#define ACPI_ERROR_NAMESPACE(s,e)       acpi_ns_report_error (AE_INFO, s, e);
-#define ACPI_ERROR_METHOD(s,n,p,e)      acpi_ns_report_method_error (AE_INFO, s, n, p, e);
+#define ACPI_ERROR_NAMESPACE(s, e)      acpi_ns_report_error (AE_INFO, s, e);
+#define ACPI_ERROR_METHOD(s, n, p, e)   acpi_ns_report_method_error (AE_INFO, s, n, p, e);
 
 #else
 
@@ -445,8 +425,8 @@ struct acpi_integer_overlay {
 #define ACPI_WARNING(plist)
 #define ACPI_EXCEPTION(plist)
 #define ACPI_ERROR(plist)
-#define ACPI_ERROR_NAMESPACE(s,e)
-#define ACPI_ERROR_METHOD(s,n,p,e)
+#define ACPI_ERROR_NAMESPACE(s, e)
+#define ACPI_ERROR_METHOD(s, n, p, e)
 #endif
 
 /*
@@ -489,18 +469,18 @@ struct acpi_integer_overlay {
 
 #define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
                          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)
-#define ACPI_FUNCTION_TRACE_U32(a,b)    ACPI_FUNCTION_NAME(a) \
-                                                        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)
+#define ACPI_FUNCTION_TRACE_PTR(a, b)   ACPI_FUNCTION_NAME(a) \
+                                          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)
+#define ACPI_FUNCTION_TRACE_STR(a, b)   ACPI_FUNCTION_NAME(a) \
+                                                                         acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
 
 #define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
 
 /*
  * Function exit tracing.
- * WARNING: These macros include a return statement.  This is usually considered
+ * 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 "_AcpiFunctionName" is defined.
@@ -596,13 +576,13 @@ struct acpi_integer_overlay {
 
 /* Stack and buffer dumping */
 
-#define ACPI_DUMP_STACK_ENTRY(a)        acpi_ex_dump_operand((a),0)
-#define ACPI_DUMP_OPERANDS(a,b,c)      acpi_ex_dump_operands(a,b,c)
+#define ACPI_DUMP_STACK_ENTRY(a)        acpi_ex_dump_operand((a), 0)
+#define ACPI_DUMP_OPERANDS(a, b, c)    acpi_ex_dump_operands(a, b, c)
 
-#define ACPI_DUMP_ENTRY(a,b)            acpi_ns_dump_entry (a,b)
-#define ACPI_DUMP_PATHNAME(a,b,c,d)     acpi_ns_dump_pathname(a,b,c,d)
+#define ACPI_DUMP_ENTRY(a, b)           acpi_ns_dump_entry (a, b)
+#define ACPI_DUMP_PATHNAME(a, b, c, d)  acpi_ns_dump_pathname(a, b, c, d)
 #define ACPI_DUMP_RESOURCE_LIST(a)      acpi_rs_dump_resource_list(a)
-#define ACPI_DUMP_BUFFER(a,b)           acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
+#define ACPI_DUMP_BUFFER(a, b)          acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
 
 /*
  * Master debug print macros
@@ -625,20 +605,20 @@ struct acpi_integer_overlay {
 #define ACPI_DEBUG_ONLY_MEMBERS(a)     do { } while(0)
 #define ACPI_FUNCTION_NAME(a)          do { } while(0)
 #define ACPI_FUNCTION_TRACE(a)         do { } while(0)
-#define ACPI_FUNCTION_TRACE_PTR(a,b)   do { } while(0)
-#define ACPI_FUNCTION_TRACE_U32(a,b)   do { } while(0)
-#define ACPI_FUNCTION_TRACE_STR(a,b)   do { } while(0)
+#define ACPI_FUNCTION_TRACE_PTR(a, b)  do { } while(0)
+#define ACPI_FUNCTION_TRACE_U32(a, b)  do { } while(0)
+#define ACPI_FUNCTION_TRACE_STR(a, b)  do { } while(0)
 #define ACPI_FUNCTION_EXIT             do { } while(0)
 #define ACPI_FUNCTION_STATUS_EXIT(s)   do { } while(0)
 #define ACPI_FUNCTION_VALUE_EXIT(s)    do { } while(0)
 #define ACPI_FUNCTION_ENTRY()          do { } while(0)
 #define ACPI_DUMP_STACK_ENTRY(a)       do { } while(0)
-#define ACPI_DUMP_OPERANDS(a,b,c)      do { } while(0)
-#define ACPI_DUMP_ENTRY(a,b)           do { } while(0)
-#define ACPI_DUMP_TABLES(a,b)          do { } while(0)
-#define ACPI_DUMP_PATHNAME(a,b,c,d)    do { } while(0)
+#define ACPI_DUMP_OPERANDS(a, b, c)     do { } while(0)
+#define ACPI_DUMP_ENTRY(a, b)          do { } while(0)
+#define ACPI_DUMP_TABLES(a, b)         do { } while(0)
+#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
 #define ACPI_DUMP_RESOURCE_LIST(a)     do { } while(0)
-#define ACPI_DUMP_BUFFER(a,b)          do { } while(0)
+#define ACPI_DUMP_BUFFER(a, b)         do { } while(0)
 #define ACPI_DEBUG_PRINT(pl)           do { } while(0)
 #define ACPI_DEBUG_PRINT_RAW(pl)       do { } while(0)
 
@@ -677,15 +657,17 @@ struct acpi_integer_overlay {
 /*
  * Memory allocation tracking (DEBUG ONLY)
  */
+#define ACPI_MEM_PARAMETERS         _COMPONENT, _acpi_module_name, __LINE__
+
 #ifndef ACPI_DBG_TRACK_ALLOCATIONS
 
 /* Memory allocation */
 
 #ifndef ACPI_ALLOCATE
-#define ACPI_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS)
 #endif
 #ifndef ACPI_ALLOCATE_ZEROED
-#define ACPI_ALLOCATE_ZEROED(a)     acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_ALLOCATE_ZEROED(a)     acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS)
 #endif
 #ifndef ACPI_FREE
 #define ACPI_FREE(a)                acpio_os_free(a)
@@ -696,11 +678,16 @@ struct acpi_integer_overlay {
 
 /* Memory allocation */
 
-#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_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
+#define ACPI_ALLOCATE_ZEROED(a)     acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
+#define ACPI_FREE(a)                acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
 #define ACPI_MEM_TRACKING(a)        a
 
 #endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
+/* Preemption point */
+#ifndef ACPI_PREEMPTION_POINT
+#define ACPI_PREEMPTION_POINT() /* no preemption */
+#endif
+
 #endif                         /* ACMACROS_H */
index c34008507b69f463e8dceeee8325cc7abbe6bf08..db4e6f677855293c1533c142ea575ce1a1306b00 100644 (file)
@@ -177,6 +177,22 @@ acpi_ns_dump_objects(acpi_object_type type,
  */
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 
+/*
+ * nspredef - Support for predefined/reserved names
+ */
+acpi_status
+acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
+                              union acpi_operand_object *return_object);
+
+const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
+                                                                   acpi_namespace_node
+                                                                   *node);
+
+void
+acpi_ns_check_parameter_count(char *pathname,
+                             struct acpi_namespace_node *node,
+                             const union acpi_predefined_info *info);
+
 /*
  * nsnames - Name and Scope manipulation
  */
index e9657dac69b788b6ed391efc4e838c5338f67889..eb6f038b03d9f23d8479fe1a2caa40bab2ee2cb3 100644 (file)
@@ -308,18 +308,34 @@ struct acpi_object_addr_handler {
  *****************************************************************************/
 
 /*
- * The Reference object type is used for these opcodes:
- * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op
+ * The Reference object is used for these opcodes:
+ * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
+ * The Reference.Class differentiates these types.
  */
 struct acpi_object_reference {
-       ACPI_OBJECT_COMMON_HEADER u8 target_type;       /* Used for index_op */
-       u16 opcode;
+       ACPI_OBJECT_COMMON_HEADER u8 class;     /* Reference Class */
+       u8 target_type;         /* Used for Index Op */
+       u8 reserved;
        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 */
+       struct acpi_namespace_node *node;       /* ref_of or Namepath */
+       union acpi_operand_object **where;      /* Target of Index */
+       u32 value;              /* Used for Local/Arg/Index/ddb_handle */
 };
 
+/* Values for Reference.Class above */
+
+typedef enum {
+       ACPI_REFCLASS_LOCAL = 0,        /* Method local */
+       ACPI_REFCLASS_ARG = 1,  /* Method argument */
+       ACPI_REFCLASS_REFOF = 2,        /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
+       ACPI_REFCLASS_INDEX = 3,        /* Result of Index() */
+       ACPI_REFCLASS_TABLE = 4,        /* ddb_handle - Load(), load_table() */
+       ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
+       ACPI_REFCLASS_DEBUG = 6,        /* Debug object */
+
+       ACPI_REFCLASS_MAX = 6
+} ACPI_REFERENCE_CLASSES;
+
 /*
  * Extra object is used as additional storage for types that
  * have AML code in their declarations (term_args) that must be
@@ -379,6 +395,13 @@ union acpi_operand_object {
        struct acpi_object_extra extra;
        struct acpi_object_data data;
        struct acpi_object_cache_list cache;
+
+       /*
+        * Add namespace node to union in order to simplify code that accepts both
+        * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
+        * a common descriptor_type field in order to differentiate them.
+        */
+       struct acpi_namespace_node node;
 };
 
 /******************************************************************************
index e17873defcec4fbc9ccf2548b95b9631f7e2e508..09d33c7740f0bfbf48f195c57bb209a03297baf4 100644 (file)
 /*
  * Raw debug output levels, do not use these in the DEBUG_PRINT macros
  */
-#define ACPI_LV_ERROR               0x00000001
-#define ACPI_LV_WARN                0x00000002
-#define ACPI_LV_INIT                0x00000004
-#define ACPI_LV_DEBUG_OBJECT        0x00000008
-#define ACPI_LV_INFO                0x00000010
-#define ACPI_LV_ALL_EXCEPTIONS      0x0000001F
+#define ACPI_LV_INIT                0x00000001
+#define ACPI_LV_DEBUG_OBJECT        0x00000002
+#define ACPI_LV_INFO                0x00000004
+#define ACPI_LV_ALL_EXCEPTIONS      0x00000007
 
 /* Trace verbosity level 1 [Standard Trace Level] */
 
 #define ACPI_LV_VERBOSE_INFO        0x20000000
 #define ACPI_LV_FULL_TABLES         0x40000000
 #define ACPI_LV_EVENTS              0x80000000
-
 #define ACPI_LV_VERBOSE             0xF0000000
 
 /*
  */
 #define ACPI_DEBUG_LEVEL(dl)        (u32) dl,ACPI_DEBUG_PARAMETERS
 
-/* Exception level -- used in the global "DebugLevel" */
-
+/*
+ * Exception level -- used in the global "DebugLevel"
+ *
+ * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces.
+ * For warnings, use ACPI_WARNING.
+ */
 #define ACPI_DB_INIT                ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
 #define ACPI_DB_DEBUG_OBJECT        ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
 #define ACPI_DB_INFO                ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
 #define ACPI_DB_ALL_EXCEPTIONS      ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
 
-/*
- * These two levels are essentially obsolete, all instances in the
- * 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 "DebugLevel" */
 
 #define ACPI_DB_INIT_NAMES          ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
 #define ACPI_DB_USER_REQUESTS       ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
 #define ACPI_DB_PACKAGE             ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
 #define ACPI_DB_MUTEX               ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
+#define ACPI_DB_EVENTS              ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS)
 
 #define ACPI_DB_ALL                 ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
 
 /* Defaults for debug_level, debug and normal */
 
-#define ACPI_DEBUG_DEFAULT          (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
-#define ACPI_NORMAL_DEFAULT         (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR)
+#define ACPI_DEBUG_DEFAULT          (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
+#define ACPI_NORMAL_DEFAULT         (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
 #define ACPI_DEBUG_ALL              (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
 #endif                         /* __ACOUTPUT_H__ */
index 4f5042a0ef80e9da1b7e99eaa1aa9ea20e671911..a35c9597d5b136d76a3e417a26bf1da279da6022 100644 (file)
@@ -93,6 +93,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
 int acpi_disable_wakeup_device_power(struct acpi_device *dev);
 int acpi_power_get_inferred_state(struct acpi_device *device);
 int acpi_power_transition(struct acpi_device *device, int state);
+extern int acpi_power_nocheck;
 #endif
 
 /* --------------------------------------------------------------------------
diff --git a/include/acpi/acpredef.h b/include/acpi/acpredef.h
new file mode 100644 (file)
index 0000000..619fb75
--- /dev/null
@@ -0,0 +1,371 @@
+/******************************************************************************
+ *
+ * Name: acpredef - Information table for ACPI predefined methods and objects
+ *              $Revision: 1.1 $
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2008, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#ifndef __ACPREDEF_H__
+#define __ACPREDEF_H__
+
+/******************************************************************************
+ *
+ * Return Package types
+ *
+ * 1) PTYPE1 packages do not contain sub-packages.
+ *
+ * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types:
+ *     object type
+ *     count
+ *     object type
+ *     count
+ *
+ * ACPI_PTYPE1_VAR: Variable length:
+ *    object type (Int/Buf/Ref)
+ *
+ * ACPI_PTYPE1_OPTION: Package has some required and some optional elements:
+ *      Used for _PRW
+ *
+ *
+ * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
+ *    different types describe the contents of each of the sub-packages.
+ *
+ * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
+ *     object type
+ *     count
+ *     object type
+ *     count
+ *
+ * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
+ *     object type
+ *
+ * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
+ *     object type
+ *     count
+ *     object type
+ *     count
+ *
+ * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length:
+ *      Used for _PRT
+ *
+ * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
+ *      Used for _HPX
+ *
+ *****************************************************************************/
+
+enum acpi_return_package_types {
+       ACPI_PTYPE1_FIXED = 1,
+       ACPI_PTYPE1_VAR = 2,
+       ACPI_PTYPE1_OPTION = 3,
+       ACPI_PTYPE2 = 4,
+       ACPI_PTYPE2_COUNT = 5,
+       ACPI_PTYPE2_PKG_COUNT = 6,
+       ACPI_PTYPE2_FIXED = 7,
+       ACPI_PTYPE2_MIN = 8
+};
+
+/*
+ * Predefined method/object information table.
+ *
+ * These are the names that can actually be evaluated via acpi_evaluate_object.
+ * Not present in this table are the following:
+ *
+ *      1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object:
+ *          _Lxx and _Exx GPE methods
+ *          _Qxx EC methods
+ *          _T_x compiler temporary variables
+ *
+ *      2) Predefined names that never actually exist within the AML code:
+ *          Predefined resource descriptor field names
+ *
+ *      3) Predefined names that are implemented within ACPICA:
+ *          _OSI
+ *
+ *      4) Some predefined names that are not documented within the ACPI spec.
+ *          _WDG, _WED
+ *
+ * The main entries in the table each contain the following items:
+ *
+ * Name                 - The ACPI reserved name
+ * param_count          - Number of arguments to the method
+ * expected_btypes      - Allowed type(s) for the return value.
+ *                        0 means that no return value is expected.
+ *
+ * For methods that return packages, the next entry in the table contains
+ * information about the expected structure of the package. This information
+ * is saved here (rather than in a separate table) in order to minimize the
+ * overall size of the stored data.
+ */
+static const union acpi_predefined_info predefined_names[] = {
+       {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */
+       {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
+       {.info = {"_BCM", 1, 0}},
+       {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_BFS", 1, 0}},
+       {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
+                                         9,
+                                         ACPI_RTYPE_STRING, 4, 0}},    /* fixed (9 Int),(4 Str) */
+       {.info = {"_BLT", 3, 0}},
+       {.info = {"_BMC", 1, 0}},
+       {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},   /* fixed (5 Int) */
+       {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
+       {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}},
+       {.info = {"_BTP", 1, 0}},
+       {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}},      /* see PCI firmware spec 3.0 */
+       {.info = {"_CID", 0,
+        ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}},
+       {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}},    /* variable (Ints/Strs) */
+       {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},   /* variable (1 Int(n), n-1 Int) */
+       {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT,
+                                         ACPI_RTYPE_BUFFER, 1,
+                                         ACPI_RTYPE_INTEGER, 3, 0}},   /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */
+       {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}},
+       {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
+       {.info = {"_DDN", 0, ACPI_RTYPE_STRING}},
+       {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_DIS", 0, 0}},
+       {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
+       {.info = {"_DOS", 1, 0}},
+       {.info = {"_DSM", 4, ACPI_RTYPE_ALL}},  /* Must return a type, but it can be of any type */
+       {.info = {"_DSS", 1, 0}},
+       {.info = {"_DSW", 3, 0}},
+       {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_EJ0", 1, 0}},
+       {.info = {"_EJ1", 1, 0}},
+       {.info = {"_EJ2", 1, 0}},
+       {.info = {"_EJ3", 1, 0}},
+       {.info = {"_EJ4", 1, 0}},
+       {.info = {"_EJD", 0, ACPI_RTYPE_STRING}},
+       {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}},  /* fixed (16 Int) */
+       {.info = {"_FDM", 1, 0}},
+       {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
+       {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}},      /* _GPE method, not _GPE scope */
+       {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_GTS", 1, 0}},
+       {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+       {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
+
+       /*
+        * For _HPX, a single package is returned, containing a variable number of sub-packages.
+        * Each sub-package contains a PCI record setting. There are several different type of
+        * record settings, of different lengths, but all elements of all settings are Integers.
+        */
+       {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},     /* variable (Pkgs) each (var Ints) */
+       {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}},      /* see IPMI spec */
+       {.info = {"_INI", 0, 0}},
+       {.info = {"_IRC", 0, 0}},
+       {.info = {"_LCK", 1, 0}},
+       {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}},  /* variable (Pkgs) each (2 Str) */
+       {.info = {"_MSG", 1, 0}},
+       {.info = {"_OFF", 0, 0}},
+       {.info = {"_ON_", 0, 0}},
+       {.info = {"_OS_", 0, ACPI_RTYPE_STRING}},
+       {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}},
+       {.info = {"_OST", 3, 0}},
+       {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}},    /* fixed (2 Buf) */
+       {.info = {"_PDC", 1, 0}},
+       {.info = {"_PIC", 1, 0}},
+       {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}},      /* variable (Bufs) */
+       {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}},      /* see dig64 spec */
+       {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}},
+
+       /*
+        * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
+        * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
+        * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
+        * type to the 2nd element (index 1) in the statement below.
+        */
+       {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4,
+                                         ACPI_RTYPE_INTEGER,
+                                         ACPI_RTYPE_INTEGER,
+                                         ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}},      /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */
+
+       {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2,
+                                         ACPI_RTYPE_INTEGER |
+                                         ACPI_RTYPE_PACKAGE,
+                                         ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}},        /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */
+
+       {.info = {"_PS0", 0, 0}},
+       {.info = {"_PS1", 0, 0}},
+       {.info = {"_PS2", 0, 0}},
+       {.info = {"_PS3", 0, 0}},
+       {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},   /* variable (Pkgs) each (5 Int) with count */
+       {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */
+       {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_PSW", 1, 0}},
+       {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}},    /* fixed (2 Buf) */
+       {.info = {"_PTS", 1, 0}},
+       {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_REG", 2, 0}},
+       {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}},
+       {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}},
+
+       /*
+        * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer,
+        * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length",
+        * but all elements must be Integers.
+        */
+       {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+       {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+       {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+       {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+       {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+       {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
+
+       {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_SCP", 0x13, 0}},    /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
+       /* Note: the 3-arg definition may be removed for ACPI 4.0 */
+       {.info = {"_SDD", 1, 0}},
+       {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}},
+       {.info = {"_SRS", 1, 0}},
+       {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}},      /* see IPMI spec */
+       {.info = {"_SST", 1, 0}},
+       {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_STM", 3, 0}},
+       {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}},
+       {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TPT", 1, 0}},
+       {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2,
+                                         ACPI_RTYPE_INTEGER, 6, 0}},   /* variable (Pkgs) each 2_ref/6_int */
+       {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},   /* variable (Pkgs) each 5_int with count */
+       {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */
+       {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_TTS", 1, 0}},
+       {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
+       {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}},
+       {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+       {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
+       {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}},
+       {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}},
+
+       /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
+
+       {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_PACKAGE}},
+       {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}},      /* fixed (2 Int), but is optional */
+       {.ret_info = {0, 0, 0, 0, 0, 0}}        /* Table terminator */
+};
+
+#if 0
+       /* Not implemented */
+
+{
+"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */
+
+{
+"_WED", 1, ACPI_RTYPE_PACKAGE},        /* MS Extension */
+
+    /* This is an internally implemented control method, no need to check */
+{
+"_OSI", 1, ACPI_RTYPE_INTEGER},
+
+    /* TBD: */
+    _PRT - currently ignore reversed entries.attempt to fix here ?
+    think about code that attempts to fix package elements like _BIF, etc.
+#endif
+#endif
index d38f9be2f6eeda77b42f48e492060ed6a9f3000b..63f5b4cf4de1e06c9075164ad65cea947b77ed94 100644 (file)
@@ -908,7 +908,9 @@ enum acpi_madt_type {
        ACPI_MADT_TYPE_IO_SAPIC = 6,
        ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
        ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
-       ACPI_MADT_TYPE_RESERVED = 9     /* 9 and greater are reserved */
+       ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
+       ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
+       ACPI_MADT_TYPE_RESERVED = 11    /* 11 and greater are reserved */
 };
 
 /*
@@ -1009,6 +1011,26 @@ struct acpi_madt_interrupt_source {
 
 #define ACPI_MADT_CPEI_OVERRIDE     (1)
 
+/* 9: Processor Local X2_APIC (07/2008) */
+
+struct acpi_madt_local_x2apic {
+       struct acpi_subtable_header header;
+       u16 reserved;           /* Reserved - must be zero */
+       u32 local_apic_id;      /* Processor X2_APIC ID  */
+       u32 lapic_flags;
+       u32 uid;                /* Extended X2_APIC processor ID */
+};
+
+/* 10: Local X2APIC NMI (07/2008) */
+
+struct acpi_madt_local_x2apic_nmi {
+       struct acpi_subtable_header header;
+       u16 inti_flags;
+       u32 uid;                /* Processor X2_APIC ID */
+       u8 lint;                /* LINTn to which NMI is connected */
+       u8 reserved[3];
+};
+
 /*
  * Common flags fields for MADT subtables
  */
@@ -1150,10 +1172,15 @@ struct acpi_table_srat {
 enum acpi_srat_type {
        ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
        ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
-       ACPI_SRAT_TYPE_RESERVED = 2
+       ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2,
+       ACPI_SRAT_TYPE_RESERVED = 3     /* 3 and greater are reserved */
 };
 
-/* SRAT sub-tables */
+/*
+ * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header
+ */
+
+/* 0: Processor Local APIC/SAPIC Affinity */
 
 struct acpi_srat_cpu_affinity {
        struct acpi_subtable_header header;
@@ -1165,9 +1192,7 @@ struct acpi_srat_cpu_affinity {
        u32 reserved;           /* Reserved, must be zero */
 };
 
-/* Flags */
-
-#define ACPI_SRAT_CPU_ENABLED       (1)        /* 00: Use affinity structure */
+/* 1: Memory Affinity */
 
 struct acpi_srat_mem_affinity {
        struct acpi_subtable_header header;
@@ -1186,6 +1211,20 @@ struct acpi_srat_mem_affinity {
 #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1)     /* 01: Memory region is hot pluggable */
 #define ACPI_SRAT_MEM_NON_VOLATILE  (1<<2)     /* 02: Memory region is non-volatile */
 
+/* 2: Processor Local X2_APIC Affinity (07/2008) */
+
+struct acpi_srat_x2apic_cpu_affinity {
+       struct acpi_subtable_header header;
+       u16 reserved;           /* Reserved, must be zero */
+       u32 proximity_domain;
+       u32 apic_id;
+       u32 flags;
+};
+
+/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
+
+#define ACPI_SRAT_CPU_ENABLED       (1)        /* 00: Use affinity structure */
+
 /*******************************************************************************
  *
  * TCPA - Trusted Computing Platform Alliance table
index 4ea4f40bf894c22e0a1f99b745bd503e6a996f24..e8936ab596277e26e1047dc8c3e2ceeb3b465427 100644 (file)
@@ -607,8 +607,15 @@ typedef u8 acpi_adr_space_type;
 
 /*
  * bit_register IDs
- * These are bitfields defined within the full ACPI registers
+ *
+ * These values are intended to be used by the hardware interfaces
+ * and are mapped to individual bitfields defined within the ACPI
+ * registers. See the acpi_gbl_bit_register_info global table in utglobal.c
+ * for this mapping.
  */
+
+/* PM1 Status register */
+
 #define ACPI_BITREG_TIMER_STATUS                0x00
 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
@@ -618,24 +625,29 @@ typedef u8 acpi_adr_space_type;
 #define ACPI_BITREG_WAKE_STATUS                 0x06
 #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
 
+/* PM1 Enable register */
+
 #define ACPI_BITREG_TIMER_ENABLE                0x08
 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
-#define ACPI_BITREG_WAKE_ENABLE                 0x0D
-#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0E
+#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
+
+/* PM1 Control register */
+
+#define ACPI_BITREG_SCI_ENABLE                  0x0E
+#define ACPI_BITREG_BUS_MASTER_RLD              0x0F
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
+#define ACPI_BITREG_SLEEP_TYPE_A                0x11
+#define ACPI_BITREG_SLEEP_TYPE_B                0x12
+#define ACPI_BITREG_SLEEP_ENABLE                0x13
 
-#define ACPI_BITREG_SCI_ENABLE                  0x0F
-#define ACPI_BITREG_BUS_MASTER_RLD              0x10
-#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x11
-#define ACPI_BITREG_SLEEP_TYPE_A                0x12
-#define ACPI_BITREG_SLEEP_TYPE_B                0x13
-#define ACPI_BITREG_SLEEP_ENABLE                0x14
+/* PM2 Control register */
 
-#define ACPI_BITREG_ARB_DISABLE                 0x15
+#define ACPI_BITREG_ARB_DISABLE                 0x14
 
-#define ACPI_BITREG_MAX                         0x15
+#define ACPI_BITREG_MAX                         0x14
 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
 
 /*
@@ -859,6 +871,7 @@ struct acpi_obj_info_header {
 struct acpi_device_info {
        ACPI_COMMON_OBJ_INFO;
 
+       u32 param_count;        /* If a method, required parameter count */
        u32 valid;              /* Indicates which fields below are valid */
        u32 current_status;     /* _STA value */
        acpi_integer address;   /* _ADR value if any */
@@ -1225,8 +1238,8 @@ struct acpi_resource {
 
 #pragma pack()
 
-#define ACPI_RS_SIZE_MIN                    12
 #define ACPI_RS_SIZE_NO_DATA                8  /* Id + Length fields */
+#define ACPI_RS_SIZE_MIN                    (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
 #define ACPI_RS_SIZE(type)                  (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
 
 #define ACPI_NEXT_RESOURCE(res)             (struct acpi_resource *)((u8 *) res + res->length)
index 69f8888771fffa6cdf532117ac31bc14eb5997ff..d8307b2987e371b706ac7e0c96359606fb5cd900 100644 (file)
@@ -110,7 +110,7 @@ struct acpi_pkg_info {
 /*
  * utglobal - Global data structures and procedures
  */
-void acpi_ut_init_globals(void);
+acpi_status acpi_ut_init_globals(void);
 
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 
@@ -126,6 +126,8 @@ char *acpi_ut_get_node_name(void *object);
 
 char *acpi_ut_get_descriptor_name(void *object);
 
+const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
+
 char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
 
 char *acpi_ut_get_region_name(u8 space_id);
index 9af4645986829bbf00ea5b77d3aeae2f818763ed..029c8c06c151ab4f7153d4aeb143bb51ed4d258c 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ctype.h>
+#include <linux/sched.h>
 #include <asm/system.h>
 #include <asm/atomic.h>
 #include <asm/div64.h>
@@ -137,4 +138,9 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
 #define ACPI_ALLOCATE_ZEROED(a)        acpi_os_allocate_zeroed(a)
 #define ACPI_FREE(a)           kfree(a)
 
+/*
+ * We need to show where it is safe to preempt execution of ACPICA
+ */
+#define ACPI_PREEMPTION_POINT()        cond_resched()
+
 #endif                         /* __ACLINUX_H__ */
diff --git a/include/asm-mips/cevt-r4k.h b/include/asm-mips/cevt-r4k.h
new file mode 100644 (file)
index 0000000..fa4328f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2008 Kevin D. Kissell
+ */
+
+/*
+ * Definitions used for common event timer implementation
+ * for MIPS 4K-type processors and their MIPS MT variants.
+ * Avoids unsightly extern declarations in C files.
+ */
+#ifndef __ASM_CEVT_R4K_H
+#define __ASM_CEVT_R4K_H
+
+DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
+
+void mips_event_handler(struct clock_event_device *dev);
+int c0_compare_int_usable(void);
+void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
+irqreturn_t c0_compare_interrupt(int, void *);
+
+extern struct irqaction c0_compare_irqaction;
+extern int cp0_timer_irq_installed;
+
+/*
+ * Possibly handle a performance counter interrupt.
+ * Return true if the timer interrupt should not be checked
+ */
+
+static inline int handle_perf_irq(int r2)
+{
+       /*
+        * The performance counter overflow interrupt may be shared with the
+        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
+        * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
+        * and we can't reliably determine if a counter interrupt has also
+        * happened (!r2) then don't check for a timer interrupt.
+        */
+       return (cp0_perfcount_irq < 0) &&
+               perf_irq() == IRQ_HANDLED &&
+               !r2;
+}
+
+#endif /* __ASM_CEVT_R4K_H */
index 881e8866501d5f2af6b09355227edc620c3ba5b4..701ec0ba8fa9cdd596369b9de3825b284bae1ec9 100644 (file)
@@ -38,8 +38,17 @@ __asm__(
        "       .set    pop                                             \n"
        "       .endm");
 
+extern void smtc_ipi_replay(void);
+
 static inline void raw_local_irq_enable(void)
 {
+#ifdef CONFIG_MIPS_MT_SMTC
+       /*
+        * SMTC kernel needs to do a software replay of queued
+        * IPIs, at the cost of call overhead on each local_irq_enable()
+        */
+       smtc_ipi_replay();
+#endif
        __asm__ __volatile__(
                "raw_local_irq_enable"
                : /* no outputs */
@@ -47,6 +56,7 @@ static inline void raw_local_irq_enable(void)
                : "memory");
 }
 
+
 /*
  * For cli() we have to insert nops to make sure that the new value
  * has actually arrived in the status register before the end of this
@@ -185,15 +195,14 @@ __asm__(
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-extern void smtc_ipi_replay(void);
 
 static inline void raw_local_irq_restore(unsigned long flags)
 {
        unsigned long __tmp1;
 
-#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
+#ifdef CONFIG_MIPS_MT_SMTC
        /*
-        * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
+        * SMTC kernel needs to do a software replay of queued
         * IPIs, at the cost of branch and call overhead on each
         * local_irq_restore()
         */
@@ -208,6 +217,17 @@ static inline void raw_local_irq_restore(unsigned long flags)
                : "memory");
 }
 
+static inline void __raw_local_irq_restore(unsigned long flags)
+{
+       unsigned long __tmp1;
+
+       __asm__ __volatile__(
+               "raw_local_irq_restore\t%0"
+               : "=r" (__tmp1)
+               : "0" (flags)
+               : "memory");
+}
+
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
 #ifdef CONFIG_MIPS_MT_SMTC
index a46f8e258e6bdfbeb9921998f4d8c4022844b81a..979866000da43d6fe7f0c72a1862db93a3ff0c19 100644 (file)
@@ -1462,7 +1462,7 @@ set_c0_##name(unsigned int set)                                   \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
        omt = __dmt();                                          \
@@ -1480,7 +1480,7 @@ clear_c0_##name(unsigned int clear)                               \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
        omt = __dmt();                                          \
@@ -1498,7 +1498,7 @@ change_c0_##name(unsigned int change, unsigned int new)           \
 {                                                              \
        unsigned int res;                                       \
        unsigned int omt;                                       \
-       unsigned int flags;                                     \
+       unsigned long flags;                                    \
                                                                \
        local_irq_save(flags);                                  \
                                                                \
index 4396e9ffd418960ed8aa15e17bc32e60587efd57..55813d6150c7ecc47ab0aa63e78e53e278e7f40b 100644 (file)
@@ -57,7 +57,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
 #define PMD_ORDER      1
 #define PTE_ORDER      0
 
-#define PTRS_PER_PGD   ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+#define PTRS_PER_PGD   (USER_PTRS_PER_PGD * 2)
 #define PTRS_PER_PTE   ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
 
 #define USER_PTRS_PER_PGD      (0x80000000UL/PGDIR_SIZE)
index 3639b28f80db84acbdea9672eb705fa8976aca7d..ea60bf08dcb0b9792e4433a7dd92117a3b1afd98 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <asm/mips_mt.h>
+#include <asm/smtc_ipi.h>
 
 /*
  * System-wide SMTC status information
@@ -38,14 +39,15 @@ struct mm_struct;
 struct task_struct;
 
 void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
-
+void self_ipi(struct smtc_ipi *);
 void smtc_flush_tlb_asid(unsigned long asid);
-extern int mipsmt_build_cpu_map(int startslot);
-extern void mipsmt_prepare_cpus(void);
+extern int smtc_build_cpu_map(int startslot);
+extern void smtc_prepare_cpus(int cpus);
 extern void smtc_smp_finish(void);
 extern void smtc_boot_secondary(int cpu, struct task_struct *t);
 extern void smtc_cpus_done(void);
 
+
 /*
  * Sharing the TLB between multiple VPEs means that the
  * "random" index selection function is not allowed to
index c3dd5d0d525fc66be6c92dc70c86b2ad5b547577..721496a0bb92979161c8ed3cc2946f7c069d256d 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef __ASM_SN_MAPPED_KERNEL_H
 #define __ASM_SN_MAPPED_KERNEL_H
 
+#include <linux/mmzone.h>
+
 /*
  * Note on how mapped kernels work: the text and data section is
  * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
 #define MAPPED_ADDR_RO_TO_PHYS(x)      (x - REP_BASE)
 #define MAPPED_ADDR_RW_TO_PHYS(x)      (x - REP_BASE - 16777216)
 
-#define MAPPED_KERN_RO_PHYSBASE(n) \
-                       (PLAT_NODE_DATA(n)->kern_vars.kv_ro_baseaddr)
-#define MAPPED_KERN_RW_PHYSBASE(n) \
-                       (PLAT_NODE_DATA(n)->kern_vars.kv_rw_baseaddr)
+#define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
+#define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
 
 #define MAPPED_KERN_RO_TO_PHYS(x) \
                                ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
index 051e1af0bb95d08cfcec7295bb30f7234f95a817..4c37c4e5f72e4e51b578148f2e8943554da1b41a 100644 (file)
 #ifdef CONFIG_MIPS_MT_SMTC
                .set    mips32r2
                /*
-                * This may not really be necessary if ints are already
-                * inhibited here.
+                * We need to make sure the read-modify-write
+                * of Status below isn't perturbed by an interrupt
+                * or cross-TC access, so we need to do at least a DMT,
+                * protected by an interrupt-inhibit. But setting IXMT
+                * also creates a few-cycle window where an IPI could
+                * be queued and not be detected before potentially
+                * returning to a WAIT or user-mode loop. It must be
+                * replayed.
+                *
+                * We're in the middle of a context switch, and
+                * we can't dispatch it directly without trashing
+                * some registers, so we'll try to detect this unlikely
+                * case and program a software interrupt in the VPE,
+                * as would be done for a cross-VPE IPI.  To accomodate
+                * the handling of that case, we're doing a DVPE instead
+                * of just a DMT here to protect against other threads.
+                * This is a lot of cruft to cover a tiny window.
+                * If you can find a better design, implement it!
+                *
                 */
                mfc0    v0, CP0_TCSTATUS
                ori     v0, TCSTATUS_IXMT
                mtc0    v0, CP0_TCSTATUS
                _ehb
-               DMT     5                               # dmt a1
+               DVPE    5                               # dvpe a1
                jal     mips_ihb
 #endif /* CONFIG_MIPS_MT_SMTC */
                mfc0    a0, CP0_STATUS
  */
                LONG_L  v1, PT_TCSTATUS(sp)
                _ehb
-               mfc0    v0, CP0_TCSTATUS
+               mfc0    a0, CP0_TCSTATUS
                andi    v1, TCSTATUS_IXMT
-               /* We know that TCStatua.IXMT should be set from above */
-               xori    v0, v0, TCSTATUS_IXMT
-               or      v0, v0, v1
-               mtc0    v0, CP0_TCSTATUS
-               _ehb
-               andi    a1, a1, VPECONTROL_TE
+               bnez    v1, 0f
+
+/*
+ * We'd like to detect any IPIs queued in the tiny window
+ * above and request an software interrupt to service them
+ * when we ERET.
+ *
+ * Computing the offset into the IPIQ array of the executing
+ * TC's IPI queue in-line would be tedious.  We use part of
+ * the TCContext register to hold 16 bits of offset that we
+ * can add in-line to find the queue head.
+ */
+               mfc0    v0, CP0_TCCONTEXT
+               la      a2, IPIQ
+               srl     v0, v0, 16
+               addu    a2, a2, v0
+               LONG_L  v0, 0(a2)
+               beqz    v0, 0f
+/*
+ * If we have a queue, provoke dispatch within the VPE by setting C_SW1
+ */
+               mfc0    v0, CP0_CAUSE
+               ori     v0, v0, C_SW1
+               mtc0    v0, CP0_CAUSE
+0:
+               /*
+                * This test should really never branch but
+                * let's be prudent here.  Having atomized
+                * the shared register modifications, we can
+                * now EVPE, and must do so before interrupts
+                * are potentially re-enabled.
+                */
+               andi    a1, a1, MVPCONTROL_EVP
                beqz    a1, 1f
-               emt
+               evpe
 1:
+               /* We know that TCStatua.IXMT should be set from above */
+               xori    a0, a0, TCSTATUS_IXMT
+               or      a0, a0, v1
+               mtc0    a0, CP0_TCSTATUS
+               _ehb
+
                .set    mips0
 #endif /* CONFIG_MIPS_MT_SMTC */
                LONG_L  v1, PT_EPC(sp)
index 635d764dc13e346e26dc6f27b8a45d5701a9c55b..35d1743b57ac733502f48c63676f313b8e7f61f3 100644 (file)
@@ -140,6 +140,8 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
            boot_cpu_data.x86_model <= 0x05 &&
            boot_cpu_data.x86_mask < 0x0A)
                return 1;
+       else if (boot_cpu_has(X86_FEATURE_AMDC1E))
+               return 1;
        else
                return max_cstate;
 }
index 9489283a4bcfbc6bbb4f9e8fd5c25dbb8ed547f8..cfcfb0a806bac0d6f591c272c3ad3f65c384d0fe 100644 (file)
@@ -81,6 +81,7 @@
 #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
 #define X86_FEATURE_11AP       (3*32+19) /* Bad local APIC aka 11AP */
 #define X86_FEATURE_NOPL       (3*32+20) /* The NOPL (0F 1F) instructions */
+#define X86_FEATURE_AMDC1E     (3*32+21) /* AMD C1E detected */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */
index d240e5b30a45d198acd26cf251c34930338d4e37..cbb649123612f003542c463ff99e54062653c306 100644 (file)
@@ -10,4 +10,6 @@ void idle_notifier_register(struct notifier_block *n);
 void enter_idle(void);
 void exit_idle(void);
 
+void c1e_remove_cpu(int cpu);
+
 #endif
index 484c47554f3bc6e76db3eafdb5443c2cda0ba55b..94d63db1036590d95e4666a2059877d6a54bc8d9 100644 (file)
@@ -39,12 +39,13 @@ enum regnames {
        GDB_FS,                 /* 14 */
        GDB_GS,                 /* 15 */
 };
+#define NUMREGBYTES            ((GDB_GS+1)*4)
 #else /* ! CONFIG_X86_32 */
-enum regnames {
+enum regnames64 {
        GDB_AX,                 /* 0 */
-       GDB_DX,                 /* 1 */
+       GDB_BX,                 /* 1 */
        GDB_CX,                 /* 2 */
-       GDB_BX,                 /* 3 */
+       GDB_DX,                 /* 3 */
        GDB_SI,                 /* 4 */
        GDB_DI,                 /* 5 */
        GDB_BP,                 /* 6 */
@@ -58,18 +59,15 @@ enum regnames {
        GDB_R14,                /* 14 */
        GDB_R15,                /* 15 */
        GDB_PC,                 /* 16 */
-       GDB_PS,                 /* 17 */
 };
-#endif /* CONFIG_X86_32 */
 
-/*
- * Number of bytes of registers:
- */
-#ifdef CONFIG_X86_32
-# define NUMREGBYTES           64
-#else
-# define NUMREGBYTES           ((GDB_PS+1)*8)
-#endif
+enum regnames32 {
+       GDB_PS = 34,
+       GDB_CS,
+       GDB_SS,
+};
+#define NUMREGBYTES            ((GDB_SS+1)*4)
+#endif /* CONFIG_X86_32 */
 
 static inline void arch_kgdb_breakpoint(void)
 {
index 515d4dce96b598bc6e9d07dba21332a44924948c..45806d60bcbedc0fb51208508fc0b0d5b991d04b 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/prefetch.h>
+#include <linux/lockdep.h>
 #include <asm/page.h>
 
 /*
similarity index 87%
rename from arch/arm/include/asm/cnt32_to_63.h
rename to include/linux/cnt32_to_63.h
index 480c873fa746ec8a5da3d371846b643e66ecba21..8c0f9505b48cbed9cab8b268ec67519df0f01ddc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits
+ *  Extend a 32-bit counter to 63 bits
  *
  *  Author:    Nicolas Pitre
  *  Created:   December 3, 2006
  * as published by the Free Software Foundation.
  */
 
-#ifndef __INCLUDE_CNT32_TO_63_H__
-#define __INCLUDE_CNT32_TO_63_H__
+#ifndef __LINUX_CNT32_TO_63_H__
+#define __LINUX_CNT32_TO_63_H__
 
 #include <linux/compiler.h>
-#include <asm/types.h>
+#include <linux/types.h>
 #include <asm/byteorder.h>
 
-/*
- * Prototype: u64 cnt32_to_63(u32 cnt)
+/* this is used only to give gcc a clue about good code generation */
+union cnt32_to_63 {
+       struct {
+#if defined(__LITTLE_ENDIAN)
+               u32 lo, hi;
+#elif defined(__BIG_ENDIAN)
+               u32 hi, lo;
+#endif
+       };
+       u64 val;
+};
+
+
+/**
+ * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter
+ * @cnt_lo: The low part of the counter
+ *
  * Many hardware clock counters are only 32 bits wide and therefore have
  * a relatively short period making wrap-arounds rather frequent.  This
  * is a problem when implementing sched_clock() for example, where a 64-bit
  * clear-bit instruction. Otherwise caller must remember to clear the top
  * bit explicitly.
  */
-
-/* this is used only to give gcc a clue about good code generation */
-typedef union {
-       struct {
-#if defined(__LITTLE_ENDIAN)
-               u32 lo, hi;
-#elif defined(__BIG_ENDIAN)
-               u32 hi, lo;
-#endif
-       };
-       u64 val;
-} cnt32_to_63_t;
-
 #define cnt32_to_63(cnt_lo) \
 ({ \
-       static volatile u32 __m_cnt_hi = 0; \
-       cnt32_to_63_t __x; \
+       static volatile u32 __m_cnt_hi; \
+       union cnt32_to_63 __x; \
        __x.hi = __m_cnt_hi; \
        __x.lo = (cnt_lo); \
-       if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
+       if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
                __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
        __x.val; \
 })
index 6d93dce61cbbc25c8b17d2f8f8c5c9d0e864ee9f..2f245fe63bda5611ad909c1452aa8a79c4f29eb4 100644 (file)
@@ -47,14 +47,22 @@ enum hrtimer_restart {
  *     HRTIMER_CB_IRQSAFE:             Callback may run in hardirq context
  *     HRTIMER_CB_IRQSAFE_NO_RESTART:  Callback may run in hardirq context and
  *                                     does not restart the timer
- *     HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:  Callback must run in hardirq context
- *                                     Special mode for tick emultation
+ *     HRTIMER_CB_IRQSAFE_PERCPU:      Callback must run in hardirq context
+ *                                     Special mode for tick emulation and
+ *                                     scheduler timer. Such timers are per
+ *                                     cpu and not allowed to be migrated on
+ *                                     cpu unplug.
+ *     HRTIMER_CB_IRQSAFE_UNLOCKED:    Callback should run in hardirq context
+ *                                     with timer->base lock unlocked
+ *                                     used for timers which call wakeup to
+ *                                     avoid lock order problems with rq->lock
  */
 enum hrtimer_cb_mode {
        HRTIMER_CB_SOFTIRQ,
        HRTIMER_CB_IRQSAFE,
        HRTIMER_CB_IRQSAFE_NO_RESTART,
-       HRTIMER_CB_IRQSAFE_NO_SOFTIRQ,
+       HRTIMER_CB_IRQSAFE_PERCPU,
+       HRTIMER_CB_IRQSAFE_UNLOCKED,
 };
 
 /*
@@ -67,9 +75,10 @@ enum hrtimer_cb_mode {
  * 0x02                callback function running
  * 0x04                callback pending (high resolution mode)
  *
- * Special case:
+ * Special cases:
  * 0x03                callback function running and enqueued
  *             (was requeued on another CPU)
+ * 0x09                timer was migrated on CPU hotunplug
  * The "callback function running and enqueued" status is only possible on
  * SMP. It happens for example when a posix timer expired and the callback
  * queued a signal. Between dropping the lock which protects the posix timer
@@ -87,6 +96,7 @@ enum hrtimer_cb_mode {
 #define HRTIMER_STATE_ENQUEUED 0x01
 #define HRTIMER_STATE_CALLBACK 0x02
 #define HRTIMER_STATE_PENDING  0x04
+#define HRTIMER_STATE_MIGRATE  0x08
 
 /**
  * struct hrtimer - the basic hrtimer structure
index 1524829f73f2cd8c5aa4fc9cbc6bd47c7a1fa48f..6514db8fd2e413b0f7912982207b5dea5b0a3e8b 100644 (file)
@@ -366,7 +366,9 @@ enum {
        /* Currently on a filemark */
        IDE_AFLAG_FILEMARK              = (1 << 25),
        /* 0 = no tape is loaded, so we don't rewind after ejecting */
-       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26)
+       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26),
+
+       IDE_AFLAG_NO_AUTOCLOSE          = (1 << 27),
 };
 
 struct ide_drive_s {
index 2651f805ba6d771b9ec1f26078609aebdb198853..0b19848e380e76baa67a858f523a6a597a494d68 100644 (file)
@@ -190,6 +190,30 @@ extern int kernel_text_address(unsigned long addr);
 struct pid;
 extern struct pid *session_of_pgrp(struct pid *pgrp);
 
+/*
+ * FW_BUG
+ * Add this to a message where you are sure the firmware is buggy or behaves
+ * really stupid or out of spec. Be aware that the responsible BIOS developer
+ * should be able to fix this issue or at least get a concrete idea of the
+ * problem by reading your message without the need of looking at the kernel
+ * code.
+ * 
+ * Use it for definite and high priority BIOS bugs.
+ *
+ * FW_WARN
+ * Use it for not that clear (e.g. could the kernel messed up things already?)
+ * and medium priority BIOS bugs.
+ *
+ * FW_INFO
+ * Use this one if you want to tell the user or vendor about something
+ * suspicious, but generally harmless related to the firmware.
+ *
+ * Use it for information or very low priority BIOS bugs.
+ */
+#define FW_BUG         "[Firmware Bug]: "
+#define FW_WARN                "[Firmware Warn]: "
+#define FW_INFO                "[Firmware Info]: "
+
 #ifdef CONFIG_PRINTK
 asmlinkage int vprintk(const char *fmt, va_list args)
        __attribute__ ((format (printf, 1, 0)));
index c0e14008a3c2bba4000ff5366bd54c3b24072301..98dc6243a706424ae099853320ef34edab5a8bc8 100644 (file)
@@ -534,7 +534,7 @@ extern void pci_sort_breadthfirst(void);
 #ifdef CONFIG_PCI_LEGACY
 struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
                                             unsigned int device,
-                                            const struct pci_dev *from);
+                                            struct pci_dev *from);
 struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
                                           unsigned int devfn);
 #endif /* CONFIG_PCI_LEGACY */
@@ -550,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
                                struct pci_dev *from);
 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
                                unsigned int ss_vendor, unsigned int ss_device,
-                               const struct pci_dev *from);
+                               struct pci_dev *from);
 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
 struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -816,7 +816,7 @@ _PCI_NOP_ALL(write,)
 
 static inline struct pci_dev *pci_find_device(unsigned int vendor,
                                              unsigned int device,
-                                             const struct pci_dev *from)
+                                             struct pci_dev *from)
 {
        return NULL;
 }
@@ -838,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
                                             unsigned int device,
                                             unsigned int ss_vendor,
                                             unsigned int ss_device,
-                                            const struct pci_dev *from)
+                                            struct pci_dev *from)
 {
        return NULL;
 }
index b160fb18e8d6ce6f724827fe19fd31dfe748ddb8..37aaf2b3986386b3c73784e91c8b70327ecfbbd2 100644 (file)
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type,
         int flags, const char *dev_name, void *data, struct vfsmount *mnt);
 
 #ifndef CONFIG_MMU
+extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
 extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
                                                   unsigned long addr,
                                                   unsigned long len,
index caa43b2370cb04b6b12e7aa47d398e35dbfbedb3..82fefddc5987d0fba7925c76a14f2ac52dd82caf 100644 (file)
@@ -11,7 +11,9 @@
 
 #include <linux/types.h>
 #include <linux/magic.h>
+#ifdef __KERNEL__
 #include <linux/time.h>
+#endif
 
 enum smb_protocol { 
        SMB_PROTOCOL_NONE, 
index 5da9794b2d782d27f3f77fde3418521a6a19a3e8..b106fd8e0d5c4298d6495e1d48cefdd81d21910d 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __LINUX_STACKTRACE_H
 #define __LINUX_STACKTRACE_H
 
+struct task_struct;
+
 #ifdef CONFIG_STACKTRACE
 struct stack_trace {
        unsigned int nr_entries, max_entries;
index b3d3e27c62999d08360dcb51c15430d2d93c953d..c3626c0ba9d39a4358e028c328dfe534c5393b18 100644 (file)
@@ -596,4 +596,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);
 int p9_error_init(void);
 int p9_errstr2errno(char *, int);
 int p9_trans_fd_init(void);
+void p9_trans_fd_exit(void);
 #endif /* NET_9P_H */
index 0db3a4038dc0d1e8feb9f89f763203169b335b36..3ca737120a90cff4f845d8ccc66fc9173e0fcd6f 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef NET_9P_TRANSPORT_H
 #define NET_9P_TRANSPORT_H
 
+#include <linux/module.h>
+
 /**
  * enum p9_trans_status - different states of underlying transports
  * @Connected: transport is connected and healthy
@@ -91,9 +93,12 @@ struct p9_trans_module {
        int maxsize;            /* max message size of transport */
        int def;                /* this transport should be default */
        struct p9_trans * (*create)(const char *, char *, int, unsigned char);
+       struct module *owner;
 };
 
 void v9fs_register_trans(struct p9_trans_module *m);
-struct p9_trans_module *v9fs_match_trans(const substring_t *name);
-struct p9_trans_module *v9fs_default_trans(void);
+void v9fs_unregister_trans(struct p9_trans_module *m);
+struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name);
+struct p9_trans_module *v9fs_get_default_trans(void);
+void v9fs_put_trans(struct p9_trans_module *m);
 #endif /* NET_9P_TRANSPORT_H */
index 24811732bdb2515977d7defbb5b9ce548dcea315..029a54a0239695894656d99c0342f0ed37b0ce61 100644 (file)
@@ -227,6 +227,9 @@ struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
                                   const struct sctp_chunk *,
                                   const __u8 *,
                                   const size_t );
+struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
+                                  const struct sctp_chunk *,
+                                  struct sctp_paramhdr *);
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
                                  const struct sctp_transport *,
                                  const void *payload,
index f6f7042331dc3ef9dbf156a807398936e0824b1a..3820323c4c8467c07831a8844532fb85976e9a9f 100644 (file)
@@ -708,7 +708,7 @@ int do_one_initcall(initcall_t fn)
        int result;
 
        if (initcall_debug) {
-               print_fn_descriptor_symbol("calling  %s\n", fn);
+               printk("calling  %pF\n", fn);
                t0 = ktime_get();
        }
 
@@ -718,8 +718,8 @@ int do_one_initcall(initcall_t fn)
                t1 = ktime_get();
                delta = ktime_sub(t1, t0);
 
-               print_fn_descriptor_symbol("initcall %s", fn);
-               printk(" returned %d after %Ld msecs\n", result,
+               printk("initcall %pF returned %d after %Ld msecs\n",
+                       fn, result,
                        (unsigned long long) delta.tv64 >> 20);
        }
 
@@ -737,8 +737,7 @@ int do_one_initcall(initcall_t fn)
                local_irq_enable();
        }
        if (msgbuf[0]) {
-               print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn);
-               printk(" returned with %s\n", msgbuf);
+               printk("initcall %pF returned with %s\n", fn, msgbuf);
        }
 
        return result;
index 13932abde15914e36a0d4f33e10b4a9a653f8c31..a0123d75ec9a7624f897bc2984ca4009b61abfbc 100644 (file)
@@ -2738,14 +2738,15 @@ void cgroup_fork_callbacks(struct task_struct *child)
  */
 void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
 {
-       struct cgroup *oldcgrp, *newcgrp;
+       struct cgroup *oldcgrp, *newcgrp = NULL;
 
        if (need_mm_owner_callback) {
                int i;
                for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
                        struct cgroup_subsys *ss = subsys[i];
                        oldcgrp = task_cgroup(old, ss->subsys_id);
-                       newcgrp = task_cgroup(new, ss->subsys_id);
+                       if (new)
+                               newcgrp = task_cgroup(new, ss->subsys_id);
                        if (oldcgrp == newcgrp)
                                continue;
                        if (ss->mm_owner_changed)
index 16395644a98ff8c060b2f5fd776fe7abadd61c6a..85a83c831856c193570e40a3b7d3e03ef8862d1c 100644 (file)
@@ -583,8 +583,6 @@ mm_need_new_owner(struct mm_struct *mm, struct task_struct *p)
         * If there are other users of the mm and the owner (us) is exiting
         * we need to find a new owner to take on the responsibility.
         */
-       if (!mm)
-               return 0;
        if (atomic_read(&mm->mm_users) <= 1)
                return 0;
        if (mm->owner != p)
@@ -627,6 +625,16 @@ retry:
        } while_each_thread(g, c);
 
        read_unlock(&tasklist_lock);
+       /*
+        * We found no owner yet mm_users > 1: this implies that we are
+        * most likely racing with swapoff (try_to_unuse()) or /proc or
+        * ptrace or page migration (get_task_mm()).  Mark owner as NULL,
+        * so that subsystems can understand the callback and take action.
+        */
+       down_write(&mm->mmap_sem);
+       cgroup_mm_owner_callbacks(mm->owner, NULL);
+       mm->owner = NULL;
+       up_write(&mm->mmap_sem);
        return;
 
 assign_new_owner:
index b8e4dce80a748dc06c94ed6cb43225903c7f99c1..cdec83e722fa1b80ee0af0f828d8e47532431a20 100644 (file)
@@ -672,13 +672,14 @@ static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
                         */
                        BUG_ON(timer->function(timer) != HRTIMER_NORESTART);
                        return 1;
-               case HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:
+               case HRTIMER_CB_IRQSAFE_PERCPU:
+               case HRTIMER_CB_IRQSAFE_UNLOCKED:
                        /*
                         * This is solely for the sched tick emulation with
                         * dynamic tick support to ensure that we do not
                         * restart the tick right on the edge and end up with
                         * the tick timer in the softirq ! The calling site
-                        * takes care of this.
+                        * takes care of this. Also used for hrtimer sleeper !
                         */
                        debug_hrtimer_deactivate(timer);
                        return 1;
@@ -1245,7 +1246,8 @@ static void __run_hrtimer(struct hrtimer *timer)
        timer_stats_account_hrtimer(timer);
 
        fn = timer->function;
-       if (timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ) {
+       if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||
+           timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED) {
                /*
                 * Used for scheduler timers, avoid lock inversion with
                 * rq->lock and tasklist_lock.
@@ -1452,7 +1454,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
        sl->timer.function = hrtimer_wakeup;
        sl->task = task;
 #ifdef CONFIG_HIGH_RES_TIMERS
-       sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
 #endif
 }
 
@@ -1591,29 +1593,95 @@ static void __cpuinit init_hrtimers_cpu(int cpu)
 
 #ifdef CONFIG_HOTPLUG_CPU
 
-static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
-                               struct hrtimer_clock_base *new_base)
+static int migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
+                               struct hrtimer_clock_base *new_base, int dcpu)
 {
        struct hrtimer *timer;
        struct rb_node *node;
+       int raise = 0;
 
        while ((node = rb_first(&old_base->active))) {
                timer = rb_entry(node, struct hrtimer, node);
                BUG_ON(hrtimer_callback_running(timer));
                debug_hrtimer_deactivate(timer);
-               __remove_hrtimer(timer, old_base, HRTIMER_STATE_INACTIVE, 0);
+
+               /*
+                * Should not happen. Per CPU timers should be
+                * canceled _before_ the migration code is called
+                */
+               if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU) {
+                       __remove_hrtimer(timer, old_base,
+                                        HRTIMER_STATE_INACTIVE, 0);
+                       WARN(1, "hrtimer (%p %p)active but cpu %d dead\n",
+                            timer, timer->function, dcpu);
+                       continue;
+               }
+
+               /*
+                * Mark it as STATE_MIGRATE not INACTIVE otherwise the
+                * timer could be seen as !active and just vanish away
+                * under us on another CPU
+                */
+               __remove_hrtimer(timer, old_base, HRTIMER_STATE_MIGRATE, 0);
                timer->base = new_base;
                /*
                 * Enqueue the timer. Allow reprogramming of the event device
                 */
                enqueue_hrtimer(timer, new_base, 1);
+
+#ifdef CONFIG_HIGH_RES_TIMERS
+               /*
+                * Happens with high res enabled when the timer was
+                * already expired and the callback mode is
+                * HRTIMER_CB_IRQSAFE_UNLOCKED (hrtimer_sleeper). The
+                * enqueue code does not move them to the soft irq
+                * pending list for performance/latency reasons, but
+                * in the migration state, we need to do that
+                * otherwise we end up with a stale timer.
+                */
+               if (timer->state == HRTIMER_STATE_MIGRATE) {
+                       timer->state = HRTIMER_STATE_PENDING;
+                       list_add_tail(&timer->cb_entry,
+                                     &new_base->cpu_base->cb_pending);
+                       raise = 1;
+               }
+#endif
+               /* Clear the migration state bit */
+               timer->state &= ~HRTIMER_STATE_MIGRATE;
+       }
+       return raise;
+}
+
+#ifdef CONFIG_HIGH_RES_TIMERS
+static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
+                                  struct hrtimer_cpu_base *new_base)
+{
+       struct hrtimer *timer;
+       int raise = 0;
+
+       while (!list_empty(&old_base->cb_pending)) {
+               timer = list_entry(old_base->cb_pending.next,
+                                  struct hrtimer, cb_entry);
+
+               __remove_hrtimer(timer, timer->base, HRTIMER_STATE_PENDING, 0);
+               timer->base = &new_base->clock_base[timer->base->index];
+               list_add_tail(&timer->cb_entry, &new_base->cb_pending);
+               raise = 1;
        }
+       return raise;
+}
+#else
+static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
+                                  struct hrtimer_cpu_base *new_base)
+{
+       return 0;
 }
+#endif
 
 static void migrate_hrtimers(int cpu)
 {
        struct hrtimer_cpu_base *old_base, *new_base;
-       int i;
+       int i, raise = 0;
 
        BUG_ON(cpu_online(cpu));
        old_base = &per_cpu(hrtimer_bases, cpu);
@@ -1626,14 +1694,21 @@ static void migrate_hrtimers(int cpu)
        spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
 
        for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
-               migrate_hrtimer_list(&old_base->clock_base[i],
-                                    &new_base->clock_base[i]);
+               if (migrate_hrtimer_list(&old_base->clock_base[i],
+                                        &new_base->clock_base[i], cpu))
+                       raise = 1;
        }
 
+       if (migrate_hrtimer_pending(old_base, new_base))
+               raise = 1;
+
        spin_unlock(&old_base->lock);
        spin_unlock(&new_base->lock);
        local_irq_enable();
        put_cpu_var(hrtimer_bases);
+
+       if (raise)
+               hrtimer_raise_softirq();
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
index 59f3f0df35d4e04365480f5362aac097a236b63d..aef265325cd3596db981ed2515efec42f255804e 100644 (file)
@@ -753,8 +753,14 @@ static struct page *kimage_alloc_page(struct kimage *image,
                        *old = addr | (*old & ~PAGE_MASK);
 
                        /* The old page I have found cannot be a
-                        * destination page, so return it.
+                        * destination page, so return it if it's
+                        * gfp_flags honor the ones passed in.
                         */
+                       if (!(gfp_mask & __GFP_HIGHMEM) &&
+                           PageHighMem(old_page)) {
+                               kimage_free_pages(old_page);
+                               continue;
+                       }
                        addr = old_addr;
                        page = old_page;
                        break;
index eaa21fc9ad1d54250142a6c806115267865d3be6..e4dcfb2272a4184b19903927b1c438169788461a 100644 (file)
@@ -488,7 +488,7 @@ static int write_mem_msg(int binary)
                if (err)
                        return err;
                if (CACHE_FLUSH_IS_SAFE)
-                       flush_icache_range(addr, addr + length + 1);
+                       flush_icache_range(addr, addr + length);
                return 0;
        }
 
@@ -590,6 +590,7 @@ static void kgdb_wait(struct pt_regs *regs)
 
        /* Signal the primary CPU that we are done: */
        atomic_set(&cpu_in_kgdb[cpu], 0);
+       touch_softlockup_watchdog();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 }
@@ -1432,6 +1433,7 @@ acquirelock:
            atomic_read(&kgdb_cpu_doing_single_step) != cpu) {
 
                atomic_set(&kgdb_active, -1);
+               touch_softlockup_watchdog();
                clocksource_touch_watchdog();
                local_irq_restore(flags);
 
@@ -1462,7 +1464,7 @@ acquirelock:
         * Get the passive CPU lock which will hold all the non-primary
         * CPU in a spin state while the debugger is active
         */
-       if (!kgdb_single_step || !kgdb_contthread) {
+       if (!kgdb_single_step) {
                for (i = 0; i < NR_CPUS; i++)
                        atomic_set(&passive_cpu_wait[i], 1);
        }
@@ -1475,7 +1477,7 @@ acquirelock:
 
 #ifdef CONFIG_SMP
        /* Signal the other CPUs to enter kgdb_wait() */
-       if ((!kgdb_single_step || !kgdb_contthread) && kgdb_do_roundup)
+       if ((!kgdb_single_step) && kgdb_do_roundup)
                kgdb_roundup_cpus(flags);
 #endif
 
@@ -1494,7 +1496,7 @@ acquirelock:
        kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code);
        kgdb_deactivate_sw_breakpoints();
        kgdb_single_step = 0;
-       kgdb_contthread = NULL;
+       kgdb_contthread = current;
        exception_level = 0;
 
        /* Talk to debugger with gdbserial protocol */
@@ -1508,7 +1510,7 @@ acquirelock:
        kgdb_info[ks->cpu].task = NULL;
        atomic_set(&cpu_in_kgdb[ks->cpu], 0);
 
-       if (!kgdb_single_step || !kgdb_contthread) {
+       if (!kgdb_single_step) {
                for (i = NR_CPUS-1; i >= 0; i--)
                        atomic_set(&passive_cpu_wait[i], 0);
                /*
@@ -1524,6 +1526,7 @@ acquirelock:
 kgdb_restore:
        /* Free kgdb_active */
        atomic_set(&kgdb_active, -1);
+       touch_softlockup_watchdog();
        clocksource_touch_watchdog();
        local_irq_restore(flags);
 
index e36d5798cbff427fca02fd8c9a8fb6f615dbd3fe..5131e5471169226ef8db42f20792c8ffdac6d12b 100644 (file)
@@ -441,7 +441,7 @@ static struct k_itimer * alloc_posix_timer(void)
                return tmr;
        if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
                kmem_cache_free(posix_timers_cache, tmr);
-               tmr = NULL;
+               return NULL;
        }
        memset(&tmr->sigq->info, 0, sizeof(siginfo_t));
        return tmr;
index 98890807375b87df9f134f3fdd7505153547e678..ad1962dc0aa20cb865675e8e08e49f5b49bce1df 100644 (file)
@@ -201,7 +201,7 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)
        hrtimer_init(&rt_b->rt_period_timer,
                        CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        rt_b->rt_period_timer.function = sched_rt_period_timer;
-       rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
 }
 
 static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
@@ -1087,7 +1087,7 @@ hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu)
        return NOTIFY_DONE;
 }
 
-static void init_hrtick(void)
+static __init void init_hrtick(void)
 {
        hotcpu_notifier(hotplug_hrtick, 0);
 }
@@ -1119,7 +1119,7 @@ static void init_rq_hrtick(struct rq *rq)
 
        hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        rq->hrtick_timer.function = hrtick;
-       rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 }
 #else
 static inline void hrtick_clear(struct rq *rq)
index f1f3eee28113f010492a9e7757d4f5b8ef651714..cb01cd8f919b2752cfb7d97b4dc9ea4e87834a97 100644 (file)
@@ -235,7 +235,8 @@ static void tick_do_broadcast_on_off(void *why)
        case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
                if (!cpu_isset(cpu, tick_broadcast_mask)) {
                        cpu_set(cpu, tick_broadcast_mask);
-                       if (td->mode == TICKDEV_MODE_PERIODIC)
+                       if (tick_broadcast_device.mode ==
+                           TICKDEV_MODE_PERIODIC)
                                clockevents_shutdown(dev);
                }
                if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
@@ -245,7 +246,8 @@ static void tick_do_broadcast_on_off(void *why)
                if (!tick_broadcast_force &&
                    cpu_isset(cpu, tick_broadcast_mask)) {
                        cpu_clear(cpu, tick_broadcast_mask);
-                       if (td->mode == TICKDEV_MODE_PERIODIC)
+                       if (tick_broadcast_device.mode ==
+                           TICKDEV_MODE_PERIODIC)
                                tick_setup_periodic(dev, 0);
                }
                break;
@@ -575,4 +577,12 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
        spin_unlock_irqrestore(&tick_broadcast_lock, flags);
 }
 
+/*
+ * Check, whether the broadcast device is in one shot mode
+ */
+int tick_broadcast_oneshot_active(void)
+{
+       return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
+}
+
 #endif
index 019315ebf9dec4495075b5057cca856e614fa582..df12434b43ca09ec5ea9b0c48d679b842feddc9e 100644 (file)
@@ -33,7 +33,7 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
  */
 ktime_t tick_next_period;
 ktime_t tick_period;
-int tick_do_timer_cpu __read_mostly = -1;
+int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT;
 DEFINE_SPINLOCK(tick_device_lock);
 
 /*
@@ -109,7 +109,8 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
        if (!tick_device_is_functional(dev))
                return;
 
-       if (dev->features & CLOCK_EVT_FEAT_PERIODIC) {
+       if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
+           !tick_broadcast_oneshot_active()) {
                clockevents_set_mode(dev, CLOCK_EVT_MODE_PERIODIC);
        } else {
                unsigned long seq;
@@ -148,7 +149,7 @@ static void tick_setup_device(struct tick_device *td,
                 * If no cpu took the do_timer update, assign it to
                 * this cpu:
                 */
-               if (tick_do_timer_cpu == -1) {
+               if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
                        tick_do_timer_cpu = cpu;
                        tick_next_period = ktime_get();
                        tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
@@ -300,7 +301,8 @@ static void tick_shutdown(unsigned int *cpup)
        if (*cpup == tick_do_timer_cpu) {
                int cpu = first_cpu(cpu_online_map);
 
-               tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : -1;
+               tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu :
+                       TICK_DO_TIMER_NONE;
        }
        spin_unlock_irqrestore(&tick_device_lock, flags);
 }
index 6e9db9734aa6213d866aaf93c1ec82ecf2ed9b18..469248782c2355c0c2d31cf731dc8c692023268e 100644 (file)
@@ -1,6 +1,10 @@
 /*
  * tick internal variable and functions used by low/high res code
  */
+
+#define TICK_DO_TIMER_NONE     -1
+#define TICK_DO_TIMER_BOOT     -2
+
 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
 extern spinlock_t tick_device_lock;
 extern ktime_t tick_next_period;
@@ -31,6 +35,7 @@ extern void tick_broadcast_oneshot_control(unsigned long reason);
 extern void tick_broadcast_switch_to_oneshot(void);
 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
+extern int tick_broadcast_oneshot_active(void);
 # else /* BROADCAST */
 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 {
@@ -39,6 +44,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
 static inline void tick_broadcast_switch_to_oneshot(void) { }
 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
+static inline int tick_broadcast_oneshot_active(void) { return 0; }
 # endif /* !BROADCAST */
 
 #else /* !ONESHOT */
@@ -68,6 +74,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
 {
        return 0;
 }
+static inline int tick_broadcast_oneshot_active(void) { return 0; }
 #endif /* !TICK_ONESHOT */
 
 /*
index a87b0468568b026d90683bde0b2e9da0295c7caa..cb02324bdb88b1c477f055af028bd4eace476d4d 100644 (file)
@@ -75,6 +75,9 @@ static void tick_do_update_jiffies64(ktime_t now)
                                                           incr * ticks);
                }
                do_timer(++ticks);
+
+               /* Keep the tick_next_period variable up to date */
+               tick_next_period = ktime_add(last_jiffies_update, tick_period);
        }
        write_sequnlock(&xtime_lock);
 }
@@ -221,7 +224,7 @@ void tick_nohz_stop_sched_tick(int inidle)
         */
        if (unlikely(!cpu_online(cpu))) {
                if (cpu == tick_do_timer_cpu)
-                       tick_do_timer_cpu = -1;
+                       tick_do_timer_cpu = TICK_DO_TIMER_NONE;
        }
 
        if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
@@ -303,7 +306,7 @@ void tick_nohz_stop_sched_tick(int inidle)
                 * invoked.
                 */
                if (cpu == tick_do_timer_cpu)
-                       tick_do_timer_cpu = -1;
+                       tick_do_timer_cpu = TICK_DO_TIMER_NONE;
 
                ts->idle_sleeps++;
 
@@ -468,7 +471,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
         * this duty, then the jiffies update is still serialized by
         * xtime_lock.
         */
-       if (unlikely(tick_do_timer_cpu == -1))
+       if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
                tick_do_timer_cpu = cpu;
 
        /* Check, if the jiffies need an update */
@@ -570,7 +573,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
         * this duty, then the jiffies update is still serialized by
         * xtime_lock.
         */
-       if (unlikely(tick_do_timer_cpu == -1))
+       if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
                tick_do_timer_cpu = cpu;
 #endif
 
@@ -622,7 +625,7 @@ void tick_setup_sched_timer(void)
         */
        hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
        ts->sched_timer.function = tick_sched_timer;
-       ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 
        /* Get the next period (per cpu) */
        ts->sched_timer.expires = tick_init_jiffy_update();
index bb948e52ce204bc1ec90b6bf6276a70203121de6..db58fb66a135bbbbc71b16f949bcbf47300fbb4c 100644 (file)
@@ -202,7 +202,7 @@ static void start_stack_timer(int cpu)
 
        hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        hrtimer->function = stack_trace_timer_fn;
-       hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+       hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
 
        hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL);
 }
index 0f1f7a7374bade23cf0052719a349a97322c5af4..36896f3eb7f5e5c2e4c3803cc8125fe461a71669 100644 (file)
@@ -250,6 +250,14 @@ static struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont)
 
 struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p)
 {
+       /*
+        * mm_update_next_owner() may clear mm->owner to NULL
+        * if it races with swapoff, page migration, etc.
+        * So this can be called with p == NULL.
+        */
+       if (unlikely(!p))
+               return NULL;
+
        return container_of(task_subsys_state(p, mem_cgroup_subsys_id),
                                struct mem_cgroup, css);
 }
@@ -549,6 +557,11 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
        if (likely(!memcg)) {
                rcu_read_lock();
                mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
+               if (unlikely(!mem)) {
+                       rcu_read_unlock();
+                       kmem_cache_free(page_cgroup_cache, pc);
+                       return 0;
+               }
                /*
                 * For every charge from the cgroup, increment reference count
                 */
@@ -801,11 +814,16 @@ int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask)
 
        rcu_read_lock();
        mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
+       if (unlikely(!mem)) {
+               rcu_read_unlock();
+               return 0;
+       }
        css_get(&mem->css);
        rcu_read_unlock();
 
        do {
                progress = try_to_free_mem_cgroup_pages(mem, gfp_mask);
+               progress += res_counter_check_under_limit(&mem->res);
        } while (!progress && --retry);
 
        css_put(&mem->css);
index e293c58bea58fc2195da7f34d95417262cedeffa..27b8681139fdb71e4d0da204ecc4a65fc3f7a1b5 100644 (file)
@@ -268,13 +268,14 @@ void prep_compound_page(struct page *page, unsigned long order)
 {
        int i;
        int nr_pages = 1 << order;
+       struct page *p = page + 1;
 
        set_compound_page_dtor(page, free_compound_page);
        set_compound_order(page, order);
        __SetPageHead(page);
-       for (i = 1; i < nr_pages; i++) {
-               struct page *p = page + i;
-
+       for (i = 1; i < nr_pages; i++, p++) {
+               if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
+                       p = pfn_to_page(page_to_pfn(page) + i);
                __SetPageTail(p);
                p->first_page = page;
        }
@@ -284,6 +285,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
 {
        int i;
        int nr_pages = 1 << order;
+       struct page *p = page + 1;
 
        if (unlikely(compound_order(page) != order))
                bad_page(page);
@@ -291,8 +293,9 @@ static void destroy_compound_page(struct page *page, unsigned long order)
        if (unlikely(!PageHead(page)))
                        bad_page(page);
        __ClearPageHead(page);
-       for (i = 1; i < nr_pages; i++) {
-               struct page *p = page + i;
+       for (i = 1; i < nr_pages; i++, p++) {
+               if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
+                       p = pfn_to_page(page_to_pfn(page) + i);
 
                if (unlikely(!PageTail(p) |
                                (p->first_page != page)))
index c69f84fe038d8b725b8639aae0fd88151206b515..b70a7fec1ff6c3a4aa2c210215185b31085c8f4d 100644 (file)
@@ -114,8 +114,10 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
 
 int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
 {
-       unsigned long pfn;
+       unsigned long pfn, flags;
        struct page *page;
+       struct zone *zone;
+       int ret;
 
        pfn = start_pfn;
        /*
@@ -131,7 +133,9 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
        if (pfn < end_pfn)
                return -EBUSY;
        /* Check all pages are free or Marked as ISOLATED */
-       if (__test_page_isolated_in_pageblock(start_pfn, end_pfn))
-               return 0;
-       return -EBUSY;
+       zone = page_zone(pfn_to_page(pfn));
+       spin_lock_irqsave(&zone->lock, flags);
+       ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
+       spin_unlock_irqrestore(&zone->lock, flags);
+       return ret ? 0 : -EBUSY;
 }
index 4c82dd41f32eae2ff2274f3d2b1d78e8e45fbb43..cb675d1267914dc263100b9c4a9ea5eb20fefa48 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -514,9 +514,11 @@ size_t ksize(const void *block)
                return 0;
 
        sp = (struct slob_page *)virt_to_page(block);
-       if (slob_page(sp))
-               return ((slob_t *)block - 1)->units + SLOB_UNIT;
-       else
+       if (slob_page(sp)) {
+               int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
+               unsigned int *m = (unsigned int *)(block - align);
+               return SLOB_UNITS(*m) * SLOB_UNIT;
+       } else
                return sp->page.private;
 }
 
index ae532f50194319ce83b813a88b6a25aa5a4e85e5..8d7a27a6335c4c6076b38fc2ab990a82081ada5d 100644 (file)
@@ -65,31 +65,31 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        if (!dentry)
                goto put_memory;
 
+       error = -ENFILE;
+       file = get_empty_filp();
+       if (!file)
+               goto put_dentry;
+
        error = -ENOSPC;
        inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
        if (!inode)
-               goto put_dentry;
+               goto close_file;
 
        d_instantiate(dentry, inode);
-       error = -ENFILE;
-       file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
-                       &ramfs_file_operations);
-       if (!file)
-               goto put_dentry;
-
+       inode->i_size = size;
        inode->i_nlink = 0;     /* It is unlinked */
+       init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+                       &ramfs_file_operations);
 
-       /* notify everyone as to the change of file size */
-       error = do_truncate(dentry, size, 0, file);
-       if (error < 0)
+#ifndef CONFIG_MMU
+       error = ramfs_nommu_expand_for_mapping(inode, size);
+       if (error)
                goto close_file;
-
+#endif
        return file;
 
 close_file:
        put_filp(file);
-       return ERR_PTR(error);
-
 put_dentry:
        dput(dentry);
 put_memory:
index 2ffe40cf2f01799634c478443284b80f62c9289c..10e320307ec015dad7e2a7db8b753f4a1886f645 100644 (file)
@@ -75,7 +75,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
        int option;
        int ret = 0;
 
-       clnt->trans_mod = v9fs_default_trans();
        clnt->dotu = 1;
        clnt->msize = 8192;
 
@@ -108,7 +107,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        clnt->msize = option;
                        break;
                case Opt_trans:
-                       clnt->trans_mod = v9fs_match_trans(&args[0]);
+                       clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
                        break;
                case Opt_legacy:
                        clnt->dotu = 0;
@@ -117,6 +116,10 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                        continue;
                }
        }
+
+       if (!clnt->trans_mod)
+               clnt->trans_mod = v9fs_get_default_trans();
+
        kfree(options);
        return ret;
 }
@@ -150,6 +153,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
        if (!clnt)
                return ERR_PTR(-ENOMEM);
 
+       clnt->trans_mod = NULL;
        clnt->trans = NULL;
        spin_lock_init(&clnt->lock);
        INIT_LIST_HEAD(&clnt->fidlist);
@@ -235,6 +239,8 @@ void p9_client_destroy(struct p9_client *clnt)
                clnt->trans = NULL;
        }
 
+       v9fs_put_trans(clnt->trans_mod);
+
        list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
                p9_fid_destroy(fid);
 
index 44547201f5bcce723787cbeeee1c5a541a51ba3e..5ad3a3bd73b297725aed1c7998c0da80e9bdf2ae 100644 (file)
@@ -451,8 +451,10 @@ p9_put_data(struct cbuf *bufp, const char *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        memmove(*pdata, data, count);
-       return count;
+       return 0;
 }
 
 static int
@@ -460,6 +462,8 @@ p9_put_user_data(struct cbuf *bufp, const char __user *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        return copy_from_user(*pdata, data, count);
 }
 
index bdee1fb7cc62909a565717e7fd27a6c0903a1895..1084feb24cb0a3a9ef2409071c1ba3c4c06695aa 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/parser.h>
 #include <net/9p/transport.h>
 #include <linux/list.h>
+#include <linux/spinlock.h>
 
 #ifdef CONFIG_NET_9P_DEBUG
 unsigned int p9_debug_level = 0;       /* feature-rific global debug level  */
@@ -44,8 +45,8 @@ MODULE_PARM_DESC(debug, "9P debugging level");
  *
  */
 
+static DEFINE_SPINLOCK(v9fs_trans_lock);
 static LIST_HEAD(v9fs_trans_list);
-static struct p9_trans_module *v9fs_default_transport;
 
 /**
  * v9fs_register_trans - register a new transport with 9p
@@ -54,48 +55,87 @@ static struct p9_trans_module *v9fs_default_transport;
  */
 void v9fs_register_trans(struct p9_trans_module *m)
 {
+       spin_lock(&v9fs_trans_lock);
        list_add_tail(&m->list, &v9fs_trans_list);
-       if (m->def)
-               v9fs_default_transport = m;
+       spin_unlock(&v9fs_trans_lock);
 }
 EXPORT_SYMBOL(v9fs_register_trans);
 
 /**
- * v9fs_match_trans - match transport versus registered transports
+ * v9fs_unregister_trans - unregister a 9p transport
+ * @m: the transport to remove
+ *
+ */
+void v9fs_unregister_trans(struct p9_trans_module *m)
+{
+       spin_lock(&v9fs_trans_lock);
+       list_del_init(&m->list);
+       spin_unlock(&v9fs_trans_lock);
+}
+EXPORT_SYMBOL(v9fs_unregister_trans);
+
+/**
+ * v9fs_get_trans_by_name - get transport with the matching name
  * @name: string identifying transport
  *
  */
-struct p9_trans_module *v9fs_match_trans(const substring_t *name)
+struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name)
 {
-       struct list_head *p;
-       struct p9_trans_module *t = NULL;
-
-       list_for_each(p, &v9fs_trans_list) {
-               t = list_entry(p, struct p9_trans_module, list);
-               if (strncmp(t->name, name->from, name->to-name->from) == 0)
-                       return t;
-       }
-       return NULL;
+       struct p9_trans_module *t, *found = NULL;
+
+       spin_lock(&v9fs_trans_lock);
+
+       list_for_each_entry(t, &v9fs_trans_list, list)
+               if (strncmp(t->name, name->from, name->to-name->from) == 0 &&
+                   try_module_get(t->owner)) {
+                       found = t;
+                       break;
+               }
+
+       spin_unlock(&v9fs_trans_lock);
+       return found;
 }
-EXPORT_SYMBOL(v9fs_match_trans);
+EXPORT_SYMBOL(v9fs_get_trans_by_name);
 
 /**
- * v9fs_default_trans - returns pointer to default transport
+ * v9fs_get_default_trans - get the default transport
  *
  */
 
-struct p9_trans_module *v9fs_default_trans(void)
+struct p9_trans_module *v9fs_get_default_trans(void)
 {
-       if (v9fs_default_transport)
-               return v9fs_default_transport;
-       else if (!list_empty(&v9fs_trans_list))
-               return list_first_entry(&v9fs_trans_list,
-                                       struct p9_trans_module, list);
-       else
-               return NULL;
+       struct p9_trans_module *t, *found = NULL;
+
+       spin_lock(&v9fs_trans_lock);
+
+       list_for_each_entry(t, &v9fs_trans_list, list)
+               if (t->def && try_module_get(t->owner)) {
+                       found = t;
+                       break;
+               }
+
+       if (!found)
+               list_for_each_entry(t, &v9fs_trans_list, list)
+                       if (try_module_get(t->owner)) {
+                               found = t;
+                               break;
+                       }
+
+       spin_unlock(&v9fs_trans_lock);
+       return found;
 }
-EXPORT_SYMBOL(v9fs_default_trans);
+EXPORT_SYMBOL(v9fs_get_default_trans);
 
+/**
+ * v9fs_put_trans - put trans
+ * @m: transport to put
+ *
+ */
+void v9fs_put_trans(struct p9_trans_module *m)
+{
+       if (m)
+               module_put(m->owner);
+}
 
 /**
  * v9fs_init - Initialize module
@@ -120,6 +160,8 @@ static int __init init_p9(void)
 static void __exit exit_p9(void)
 {
        printk(KERN_INFO "Unloading 9P2000 support\n");
+
+       p9_trans_fd_exit();
 }
 
 module_init(init_p9)
index cdf137af7adc87d580280fbbce9b3c2d64b9dc82..d652baf5ff919c422664ed8890996d9f71beadc1 100644 (file)
@@ -151,7 +151,6 @@ struct p9_mux_poll_task {
  * @trans: reference to transport instance for this connection
  * @tagpool: id accounting for transactions
  * @err: error state
- * @equeue: event wait_q (?)
  * @req_list: accounting for requests which have been sent
  * @unsent_req_list: accounting for requests that haven't been sent
  * @rcall: current response &p9_fcall structure
@@ -178,7 +177,6 @@ struct p9_conn {
        struct p9_trans *trans;
        struct p9_idpool *tagpool;
        int err;
-       wait_queue_head_t equeue;
        struct list_head req_list;
        struct list_head unsent_req_list;
        struct p9_fcall *rcall;
@@ -240,22 +238,6 @@ static int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
 
 static void p9_conn_cancel(struct p9_conn *m, int err);
 
-static int p9_mux_global_init(void)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
-               p9_mux_poll_tasks[i].task = NULL;
-
-       p9_mux_wq = create_workqueue("v9fs");
-       if (!p9_mux_wq) {
-               printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
-               return -ENOMEM;
-       }
-
-       return 0;
-}
-
 static u16 p9_mux_get_tag(struct p9_conn *m)
 {
        int tag;
@@ -409,11 +391,11 @@ static void p9_mux_poll_stop(struct p9_conn *m)
 static struct p9_conn *p9_conn_create(struct p9_trans *trans)
 {
        int i, n;
-       struct p9_conn *m, *mtmp;
+       struct p9_conn *m;
 
        P9_DPRINTK(P9_DEBUG_MUX, "transport %p msize %d\n", trans,
                                                                trans->msize);
-       m = kmalloc(sizeof(struct p9_conn), GFP_KERNEL);
+       m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL);
        if (!m)
                return ERR_PTR(-ENOMEM);
 
@@ -424,25 +406,14 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
        m->trans = trans;
        m->tagpool = p9_idpool_create();
        if (IS_ERR(m->tagpool)) {
-               mtmp = ERR_PTR(-ENOMEM);
                kfree(m);
-               return mtmp;
+               return ERR_PTR(-ENOMEM);
        }
 
-       m->err = 0;
-       init_waitqueue_head(&m->equeue);
        INIT_LIST_HEAD(&m->req_list);
        INIT_LIST_HEAD(&m->unsent_req_list);
-       m->rcall = NULL;
-       m->rpos = 0;
-       m->rbuf = NULL;
-       m->wpos = m->wsize = 0;
-       m->wbuf = NULL;
        INIT_WORK(&m->rq, p9_read_work);
        INIT_WORK(&m->wq, p9_write_work);
-       m->wsched = 0;
-       memset(&m->poll_waddr, 0, sizeof(m->poll_waddr));
-       m->poll_task = NULL;
        n = p9_mux_poll_start(m);
        if (n) {
                kfree(m);
@@ -463,10 +434,8 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
        for (i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) {
                if (IS_ERR(m->poll_waddr[i])) {
                        p9_mux_poll_stop(m);
-                       mtmp = (void *)m->poll_waddr;   /* the error code */
                        kfree(m);
-                       m = mtmp;
-                       break;
+                       return (void *)m->poll_waddr;   /* the error code */
                }
        }
 
@@ -483,18 +452,13 @@ static void p9_conn_destroy(struct p9_conn *m)
 {
        P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m,
                m->mux_list.prev, m->mux_list.next);
-       p9_conn_cancel(m, -ECONNRESET);
-
-       if (!list_empty(&m->req_list)) {
-               /* wait until all processes waiting on this session exit */
-               P9_DPRINTK(P9_DEBUG_MUX,
-                       "mux %p waiting for empty request queue\n", m);
-               wait_event_timeout(m->equeue, (list_empty(&m->req_list)), 5000);
-               P9_DPRINTK(P9_DEBUG_MUX, "mux %p request queue empty: %d\n", m,
-                       list_empty(&m->req_list));
-       }
 
        p9_mux_poll_stop(m);
+       cancel_work_sync(&m->rq);
+       cancel_work_sync(&m->wq);
+
+       p9_conn_cancel(m, -ECONNRESET);
+
        m->trans = NULL;
        p9_idpool_destroy(m->tagpool);
        kfree(m);
@@ -840,8 +804,6 @@ static void p9_read_work(struct work_struct *work)
                                        (*req->cb) (req, req->cba);
                                else
                                        kfree(req->rcall);
-
-                               wake_up(&m->equeue);
                        }
                } else {
                        if (err >= 0 && rcall->id != P9_RFLUSH)
@@ -908,8 +870,10 @@ static struct p9_req *p9_send_request(struct p9_conn *m,
        else
                n = p9_mux_get_tag(m);
 
-       if (n < 0)
+       if (n < 0) {
+               kfree(req);
                return ERR_PTR(-ENOMEM);
+       }
 
        p9_set_tag(tc, n);
 
@@ -984,8 +948,6 @@ static void p9_mux_flush_cb(struct p9_req *freq, void *a)
                        (*req->cb) (req, req->cba);
                else
                        kfree(req->rcall);
-
-               wake_up(&m->equeue);
        }
 
        kfree(freq->tcall);
@@ -1191,8 +1153,6 @@ void p9_conn_cancel(struct p9_conn *m, int err)
                else
                        kfree(req->rcall);
        }
-
-       wake_up(&m->equeue);
 }
 
 /**
@@ -1370,7 +1330,6 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
 {
        int ret, n;
        struct p9_trans_fd *ts = NULL;
-       mm_segment_t oldfs;
 
        if (trans && trans->status == Connected)
                ts = trans->priv;
@@ -1384,24 +1343,17 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
        if (!ts->wr->f_op || !ts->wr->f_op->poll)
                return -EIO;
 
-       oldfs = get_fs();
-       set_fs(get_ds());
-
        ret = ts->rd->f_op->poll(ts->rd, pt);
        if (ret < 0)
-               goto end;
+               return ret;
 
        if (ts->rd != ts->wr) {
                n = ts->wr->f_op->poll(ts->wr, pt);
-               if (n < 0) {
-                       ret = n;
-                       goto end;
-               }
+               if (n < 0)
+                       return n;
                ret = (ret & ~POLLOUT) | (n & ~POLLIN);
        }
 
-end:
-       set_fs(oldfs);
        return ret;
 }
 
@@ -1629,6 +1581,7 @@ static struct p9_trans_module p9_tcp_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 1,
        .create = p9_trans_create_tcp,
+       .owner = THIS_MODULE,
 };
 
 static struct p9_trans_module p9_unix_trans = {
@@ -1636,6 +1589,7 @@ static struct p9_trans_module p9_unix_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 0,
        .create = p9_trans_create_unix,
+       .owner = THIS_MODULE,
 };
 
 static struct p9_trans_module p9_fd_trans = {
@@ -1643,14 +1597,20 @@ static struct p9_trans_module p9_fd_trans = {
        .maxsize = MAX_SOCK_BUF,
        .def = 0,
        .create = p9_trans_create_fd,
+       .owner = THIS_MODULE,
 };
 
 int p9_trans_fd_init(void)
 {
-       int ret = p9_mux_global_init();
-       if (ret) {
-               printk(KERN_WARNING "9p: starting mux failed\n");
-               return ret;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
+               p9_mux_poll_tasks[i].task = NULL;
+
+       p9_mux_wq = create_workqueue("v9fs");
+       if (!p9_mux_wq) {
+               printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
+               return -ENOMEM;
        }
 
        v9fs_register_trans(&p9_tcp_trans);
@@ -1659,4 +1619,12 @@ int p9_trans_fd_init(void)
 
        return 0;
 }
-EXPORT_SYMBOL(p9_trans_fd_init);
+
+void p9_trans_fd_exit(void)
+{
+       v9fs_unregister_trans(&p9_tcp_trans);
+       v9fs_unregister_trans(&p9_unix_trans);
+       v9fs_unregister_trans(&p9_fd_trans);
+
+       destroy_workqueue(p9_mux_wq);
+}
index 42adc052b149251a46e3ac8a1bf039c91f00417f..94912e077a55e0ecdfdd137c9a9848256edd66b3 100644 (file)
@@ -528,6 +528,7 @@ static struct p9_trans_module p9_virtio_trans = {
        .create = p9_virtio_create,
        .maxsize = PAGE_SIZE*16,
        .def = 0,
+       .owner = THIS_MODULE,
 };
 
 /* The standard init function */
@@ -545,6 +546,7 @@ static int __init p9_virtio_init(void)
 static void __exit p9_virtio_cleanup(void)
 {
        unregister_virtio_driver(&p9_virtio_drv);
+       v9fs_unregister_trans(&p9_virtio_trans);
 }
 
 module_init(p9_virtio_init);
index 01c83e2a4c196f813122158af5aa5bf5ea13cbd0..28c71574a781e6b0600f453275e50bf8911dcca9 100644 (file)
@@ -317,6 +317,9 @@ void ax25_destroy_socket(ax25_cb *ax25)
                                /* Queue the unaccepted socket for death */
                                sock_orphan(skb->sk);
 
+                               /* 9A4GL: hack to release unaccepted sockets */
+                               skb->sk->sk_state = TCP_LISTEN;
+
                                ax25_start_heartbeat(sax25);
                                sax25->state = AX25_STATE_0;
                        }
index cdc7e751ef36129fc9e25f107d8beb1e58034faf..96e4b9273250918b4a60fdcc9ccce00b79090827 100644 (file)
@@ -39,9 +39,11 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
 
        switch (ax25->state) {
        case AX25_STATE_0:
-               if (!sk ||
-                   sock_flag(sk, SOCK_DESTROY) ||
-                   sock_flag(sk, SOCK_DEAD)) {
+               /* Magic here: If we listen() and a new link dies before it
+                  is accepted() it isn't 'dead' so doesn't get removed. */
+               if (!sk || sock_flag(sk, SOCK_DESTROY) ||
+                   (sk->sk_state == TCP_LISTEN &&
+                    sock_flag(sk, SOCK_DEAD))) {
                        if (sk) {
                                sock_hold(sk);
                                ax25_destroy_socket(ax25);
index e719ed29310ff5695c347db907a6311aa79e36c5..0ae08d3f57e79730ac893dbb8a046a6678cd622a 100644 (file)
 #include <linux/if_arp.h>
 #include <linux/if_vlan.h>
 #include <linux/ip.h>
+#include <net/ip.h>
 #include <linux/ipv6.h>
 #include <linux/in.h>
 #include <linux/jhash.h>
@@ -1667,7 +1668,7 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
 {
        u32 addr1, addr2, ports;
        u32 hash, ihl;
-       u8 ip_proto;
+       u8 ip_proto = 0;
 
        if (unlikely(!simple_tx_hashrnd_initialized)) {
                get_random_bytes(&simple_tx_hashrnd, 4);
@@ -1676,7 +1677,8 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
 
        switch (skb->protocol) {
        case __constant_htons(ETH_P_IP):
-               ip_proto = ip_hdr(skb)->protocol;
+               if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
+                       ip_proto = ip_hdr(skb)->protocol;
                addr1 = ip_hdr(skb)->saddr;
                addr2 = ip_hdr(skb)->daddr;
                ihl = ip_hdr(skb)->ihl;
@@ -2916,6 +2918,12 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
        return 0;
 }
 
+static void dev_change_rx_flags(struct net_device *dev, int flags)
+{
+       if (dev->flags & IFF_UP && dev->change_rx_flags)
+               dev->change_rx_flags(dev, flags);
+}
+
 static int __dev_set_promiscuity(struct net_device *dev, int inc)
 {
        unsigned short old_flags = dev->flags;
@@ -2953,8 +2961,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
                                current->uid, current->gid,
                                audit_get_sessionid(current));
 
-               if (dev->change_rx_flags)
-                       dev->change_rx_flags(dev, IFF_PROMISC);
+               dev_change_rx_flags(dev, IFF_PROMISC);
        }
        return 0;
 }
@@ -3020,8 +3027,7 @@ int dev_set_allmulti(struct net_device *dev, int inc)
                }
        }
        if (dev->flags ^ old_flags) {
-               if (dev->change_rx_flags)
-                       dev->change_rx_flags(dev, IFF_ALLMULTI);
+               dev_change_rx_flags(dev, IFF_ALLMULTI);
                dev_set_rx_mode(dev);
        }
        return 0;
@@ -3345,8 +3351,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
         *      Load in the correct multicast list now the flags have changed.
         */
 
-       if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST)
-               dev->change_rx_flags(dev, IFF_MULTICAST);
+       if ((old_flags ^ flags) & IFF_MULTICAST)
+               dev_change_rx_flags(dev, IFF_MULTICAST);
 
        dev_set_rx_mode(dev);
 
@@ -3806,14 +3812,11 @@ static int dev_new_index(struct net *net)
 }
 
 /* Delayed registration/unregisteration */
-static DEFINE_SPINLOCK(net_todo_list_lock);
 static LIST_HEAD(net_todo_list);
 
 static void net_set_todo(struct net_device *dev)
 {
-       spin_lock(&net_todo_list_lock);
        list_add_tail(&dev->todo_list, &net_todo_list);
-       spin_unlock(&net_todo_list_lock);
 }
 
 static void rollback_registered(struct net_device *dev)
@@ -4140,33 +4143,24 @@ static void netdev_wait_allrefs(struct net_device *dev)
  *     free_netdev(y1);
  *     free_netdev(y2);
  *
- * We are invoked by rtnl_unlock() after it drops the semaphore.
+ * We are invoked by rtnl_unlock().
  * This allows us to deal with problems:
  * 1) We can delete sysfs objects which invoke hotplug
  *    without deadlocking with linkwatch via keventd.
  * 2) Since we run with the RTNL semaphore not held, we can sleep
  *    safely in order to wait for the netdev refcnt to drop to zero.
+ *
+ * We must not return until all unregister events added during
+ * the interval the lock was held have been completed.
  */
-static DEFINE_MUTEX(net_todo_run_mutex);
 void netdev_run_todo(void)
 {
        struct list_head list;
 
-       /* Need to guard against multiple cpu's getting out of order. */
-       mutex_lock(&net_todo_run_mutex);
-
-       /* Not safe to do outside the semaphore.  We must not return
-        * until all unregister events invoked by the local processor
-        * have been completed (either by this todo run, or one on
-        * another cpu).
-        */
-       if (list_empty(&net_todo_list))
-               goto out;
-
        /* Snapshot list, allow later requests */
-       spin_lock(&net_todo_list_lock);
        list_replace_init(&net_todo_list, &list);
-       spin_unlock(&net_todo_list_lock);
+
+       __rtnl_unlock();
 
        while (!list_empty(&list)) {
                struct net_device *dev
@@ -4198,9 +4192,6 @@ void netdev_run_todo(void)
                /* Free network device */
                kobject_put(&dev->dev.kobj);
        }
-
-out:
-       mutex_unlock(&net_todo_run_mutex);
 }
 
 static struct net_device_stats *internal_stats(struct net_device *dev)
index 71edb8b36341622df50ec48f32127b1be490b19f..d6381c2a46936751b8da284d8191bf0404593597 100644 (file)
@@ -73,7 +73,7 @@ void __rtnl_unlock(void)
 
 void rtnl_unlock(void)
 {
-       mutex_unlock(&rtnl_mutex);
+       /* This fellow will unlock it for us. */
        netdev_run_todo();
 }
 
index bfcbd148a89d5daec4bf09b169010e6690c6f6c8..c209e054a634ed5b07f9b6d8374006887a2c2085 100644 (file)
@@ -150,7 +150,11 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                ca->snd_cwnd_cents -= 128;
                tp->snd_cwnd_cnt = 0;
        }
-
+       /* check when cwnd has not been incremented for a while */
+       if (increment == 0 && odd == 0 && tp->snd_cwnd_cnt >= tp->snd_cwnd) {
+               tp->snd_cwnd++;
+               tp->snd_cwnd_cnt = 0;
+       }
        /* clamp down slowstart cwnd to ssthresh value. */
        if (is_slowstart)
                tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
index 67ccce2a96bd0d7d506bc7bca08a7ac29c38fea6..7abc6b80d47d2fd6fd9ff539e23f50dc89147cec 100644 (file)
@@ -4879,7 +4879,8 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
                                        goto no_ack;
                        }
 
-                       __tcp_ack_snd_check(sk, 0);
+                       if (!copied_early || tp->rcv_nxt != tp->rcv_wup)
+                               __tcp_ack_snd_check(sk, 0);
 no_ack:
 #ifdef CONFIG_NET_DMA
                        if (copied_early)
index 1b4fee20fc932a54ad11f113c1f51786fb4b85f4..011478e46c406bd7dd75c2b2d06f578714d98606 100644 (file)
@@ -618,7 +618,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
                        ];
        } rep;
        struct ip_reply_arg arg;
-       struct net *net = dev_net(skb->dev);
+       struct net *net = dev_net(skb->dst->dev);
 
        memset(&rep.th, 0, sizeof(struct tcphdr));
        memset(&arg, 0, sizeof(arg));
index 62e39ace05888f72fcda1e3b54b3bcc2d366f005..26654b26d7fafd3f2d20103484498b2098d30461 100644 (file)
@@ -97,8 +97,6 @@ hbh_mt6(const struct sk_buff *skb, const struct net_device *in,
        hdrlen -= 2;
        if (!(optinfo->flags & IP6T_OPTS_OPTS)) {
                return ret;
-       } else if (optinfo->flags & IP6T_OPTS_NSTRICT) {
-               pr_debug("Not strict - not implemented");
        } else {
                pr_debug("Strict ");
                pr_debug("#%d ", optinfo->optsnr);
@@ -177,6 +175,12 @@ hbh_mt6_check(const char *tablename, const void *entry,
                pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
                return false;
        }
+
+       if (optsinfo->flags & IP6T_OPTS_NSTRICT) {
+               pr_debug("ip6t_opts: Not strict - not implemented");
+               return false;
+       }
+
        return true;
 }
 
index 9af6115f0f500822c94ff6cb751ab24cd34de911..63442a1e741c630cb7936702f3e0690353e11a5b 100644 (file)
@@ -2688,6 +2688,8 @@ int __init ip6_route_init(void)
        if (ret)
                goto out_kmem_cache;
 
+       ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
+
        /* Registering of the loopback is done before this portion of code,
         * the loopback reference in rt6_info will not be taken, do it
         * manually for init_net */
index b585c850a89a3737b1b6a19aab62dd7dd1cee5cb..10e22fd482225c0b49c17646fa0e347a6250904f 100644 (file)
@@ -1050,7 +1050,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
        struct tcphdr *th = tcp_hdr(skb), *t1;
        struct sk_buff *buff;
        struct flowi fl;
-       struct net *net = dev_net(skb->dev);
+       struct net *net = dev_net(skb->dst->dev);
        struct sock *ctl_sk = net->ipv6.tcp_sk;
        unsigned int tot_len = sizeof(struct tcphdr);
        __be32 *topt;
index 705959b31e24dab7cd85db52b1b098391cfa2489..d7b54b5bfa69954778a7eed398d23e06fa18633c 100644 (file)
@@ -524,7 +524,6 @@ static int iucv_enable(void)
        get_online_cpus();
        for_each_online_cpu(cpu)
                smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
-       preempt_enable();
        if (cpus_empty(iucv_buffer_cpumask))
                /* No cpu could declare an iucv buffer. */
                goto out_path;
@@ -547,7 +546,9 @@ out:
  */
 static void iucv_disable(void)
 {
+       get_online_cpus();
        on_each_cpu(iucv_retrieve_cpu, NULL, 1);
+       put_online_cpus();
        kfree(iucv_path_table);
 }
 
index d628df97e02ed5b81002e725bdda6f200649fc08..b7f5a1c353ee4ec81b299d42b1f429a2d564ec22 100644 (file)
@@ -73,22 +73,18 @@ static int pfkey_can_dump(struct sock *sk)
        return 0;
 }
 
-static int pfkey_do_dump(struct pfkey_sock *pfk)
+static void pfkey_terminate_dump(struct pfkey_sock *pfk)
 {
-       int rc;
-
-       rc = pfk->dump.dump(pfk);
-       if (rc == -ENOBUFS)
-               return 0;
-
-       pfk->dump.done(pfk);
-       pfk->dump.dump = NULL;
-       pfk->dump.done = NULL;
-       return rc;
+       if (pfk->dump.dump) {
+               pfk->dump.done(pfk);
+               pfk->dump.dump = NULL;
+               pfk->dump.done = NULL;
+       }
 }
 
 static void pfkey_sock_destruct(struct sock *sk)
 {
+       pfkey_terminate_dump(pfkey_sk(sk));
        skb_queue_purge(&sk->sk_receive_queue);
 
        if (!sock_flag(sk, SOCK_DEAD)) {
@@ -310,6 +306,18 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
        return err;
 }
 
+static int pfkey_do_dump(struct pfkey_sock *pfk)
+{
+       int rc;
+
+       rc = pfk->dump.dump(pfk);
+       if (rc == -ENOBUFS)
+               return 0;
+
+       pfkey_terminate_dump(pfk);
+       return rc;
+}
+
 static inline void pfkey_hdr_dup(struct sadb_msg *new, struct sadb_msg *orig)
 {
        *new = *orig;
index 532e4faa29f7cac835a854d4180f5d2e6861c794..9f1ea4a27b356e1f93f8a8fdc5dcb125cf488f0c 100644 (file)
@@ -525,6 +525,7 @@ static int nr_release(struct socket *sock)
        if (sk == NULL) return 0;
 
        sock_hold(sk);
+       sock_orphan(sk);
        lock_sock(sk);
        nr = nr_sk(sk);
 
@@ -548,7 +549,6 @@ static int nr_release(struct socket *sock)
                sk->sk_state    = TCP_CLOSE;
                sk->sk_shutdown |= SEND_SHUTDOWN;
                sk->sk_state_change(sk);
-               sock_orphan(sk);
                sock_set_flag(sk, SOCK_DESTROY);
                break;
 
index b599cbba4fbe33eb2eaa0a5a4033f1bb00d2c99f..d68869f966c3b3b99fb70f8361cae85452f98632 100644 (file)
@@ -1012,6 +1012,29 @@ end:
        return retval;
 }
 
+struct sctp_chunk *sctp_make_violation_paramlen(
+       const struct sctp_association *asoc,
+       const struct sctp_chunk *chunk,
+       struct sctp_paramhdr *param)
+{
+       struct sctp_chunk *retval;
+       static const char error[] = "The following parameter had invalid length:";
+       size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t) +
+                               sizeof(sctp_paramhdr_t);
+
+       retval = sctp_make_abort(asoc, chunk, payload_len);
+       if (!retval)
+               goto nodata;
+
+       sctp_init_cause(retval, SCTP_ERROR_PROTO_VIOLATION,
+                       sizeof(error) + sizeof(sctp_paramhdr_t));
+       sctp_addto_chunk(retval, sizeof(error), error);
+       sctp_addto_param(retval, sizeof(sctp_paramhdr_t), param);
+
+nodata:
+       return retval;
+}
+
 /* Make a HEARTBEAT chunk.  */
 struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
                                  const struct sctp_transport *transport,
@@ -1782,11 +1805,6 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
                                        const struct sctp_chunk *chunk,
                                        struct sctp_chunk **errp)
 {
-       static const char error[] = "The following parameter had invalid length:";
-       size_t          payload_len = WORD_ROUND(sizeof(error)) +
-                                               sizeof(sctp_paramhdr_t);
-
-
        /* This is a fatal error.  Any accumulated non-fatal errors are
         * not reported.
         */
@@ -1794,14 +1812,7 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
                sctp_chunk_free(*errp);
 
        /* Create an error chunk and fill it in with our payload. */
-       *errp = sctp_make_op_error_space(asoc, chunk, payload_len);
-
-       if (*errp) {
-               sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
-                               sizeof(error) + sizeof(sctp_paramhdr_t));
-               sctp_addto_chunk(*errp, sizeof(error), error);
-               sctp_addto_param(*errp, sizeof(sctp_paramhdr_t), param);
-       }
+       *errp = sctp_make_violation_paramlen(asoc, chunk, param);
 
        return 0;
 }
index 8848d329aa2cea8bea3e3aec60405a4af51767cb..7c622af2ce55ad14f27bfbf87234cab9de7a829e 100644 (file)
@@ -119,7 +119,7 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
                                     const struct sctp_endpoint *ep,
                                     const struct sctp_association *asoc,
                                     const sctp_subtype_t type,
-                                    void *arg,
+                                    void *arg, void *ext,
                                     sctp_cmd_seq_t *commands);
 
 static sctp_disposition_t sctp_sf_violation_ctsn(
@@ -3425,7 +3425,7 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
        addr_param = (union sctp_addr_param *)hdr->params;
        length = ntohs(addr_param->p.length);
        if (length < sizeof(sctp_paramhdr_t))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
                           (void *)addr_param, commands);
 
        /* Verify the ASCONF chunk before processing it. */
@@ -3433,8 +3433,8 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
                            (sctp_paramhdr_t *)((void *)addr_param + length),
                            (void *)chunk->chunk_end,
                            &err_param))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
-                                                 (void *)&err_param, commands);
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
+                                                 (void *)err_param, commands);
 
        /* ADDIP 5.2 E1) Compare the value of the serial number to the value
         * the endpoint stored in a new association variable
@@ -3542,8 +3542,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
            (sctp_paramhdr_t *)addip_hdr->params,
            (void *)asconf_ack->chunk_end,
            &err_param))
-               return sctp_sf_violation_paramlen(ep, asoc, type,
-                          (void *)&err_param, commands);
+               return sctp_sf_violation_paramlen(ep, asoc, type, arg,
+                          (void *)err_param, commands);
 
        if (last_asconf) {
                addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr;
@@ -4240,12 +4240,38 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
                                     const struct sctp_endpoint *ep,
                                     const struct sctp_association *asoc,
                                     const sctp_subtype_t type,
-                                    void *arg,
-                                    sctp_cmd_seq_t *commands) {
-       static const char err_str[] = "The following parameter had invalid length:";
+                                    void *arg, void *ext,
+                                    sctp_cmd_seq_t *commands)
+{
+       struct sctp_chunk *chunk =  arg;
+       struct sctp_paramhdr *param = ext;
+       struct sctp_chunk *abort = NULL;
 
-       return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str,
-                                       sizeof(err_str));
+       if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
+               goto discard;
+
+       /* Make the abort chunk. */
+       abort = sctp_make_violation_paramlen(asoc, chunk, param);
+       if (!abort)
+               goto nomem;
+
+       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
+       SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
+
+       sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
+                       SCTP_ERROR(ECONNABORTED));
+       sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
+                       SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION));
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
+
+discard:
+       sctp_sf_pdiscard(ep, asoc, SCTP_ST_CHUNK(0), arg, commands);
+
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+
+       return SCTP_DISPOSITION_ABORT;
+nomem:
+       return SCTP_DISPOSITION_NOMEM;
 }
 
 /* Handle a protocol violation when the peer trying to advance the
index 8ef8ba81b9e2048c93363f4a2f98f73b7778cdce..3e8d4e35c08f3892e615959f60b0855e72f348a1 100644 (file)
@@ -1511,6 +1511,7 @@ out_fd:
        goto out_put;
 }
 
+#if 0
 #ifdef HAVE_SET_RESTORE_SIGMASK
 asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
                            int __user *upeer_addrlen,
@@ -1564,6 +1565,7 @@ asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
        return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
 }
 #endif
+#endif
 
 asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
                           int __user *upeer_addrlen)
index ac25b4c0e982ee7d5089f7cf5c41d6d73c39ab51..dc50f1e71f76f86487ebded9991cb20bc4e46ef9 100644 (file)
@@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
                - skb_headroom(skb);
        int ntail = dst->dev->needed_tailroom - skb_tailroom(skb);
 
-       if (nhead > 0 || ntail > 0)
-               return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
-
-       return 0;
+       if (nhead <= 0) {
+               if (ntail <= 0)
+                       return 0;
+               nhead = 0;
+       } else if (ntail < 0)
+               ntail = 0;
+
+       return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
 }
 
 static int xfrm_output_one(struct sk_buff *skb, int err)
index 36b5eedcdc7518d9dc734078c2287e16cca9f4d0..3e1057f885c6a2496e981e6180611aa6878cede0 100644 (file)
@@ -32,6 +32,7 @@ char *defconfig_file;
 
 static int indent = 1;
 static int valid_stdin = 1;
+static int sync_kconfig;
 static int conf_cnt;
 static char line[128];
 static struct menu *rootEntry;
@@ -65,7 +66,7 @@ static void strip(char *str)
 
 static void check_stdin(void)
 {
-       if (!valid_stdin && input_mode == ask_silent) {
+       if (!valid_stdin) {
                printf(_("aborted!\n\n"));
                printf(_("Console input/output is redirected. "));
                printf(_("Run 'make oldconfig' to update configuration.\n\n"));
@@ -427,43 +428,6 @@ static void check_conf(struct menu *menu)
                check_conf(child);
 }
 
-static void conf_do_update(void)
-{
-       /* Update until a loop caused no more changes */
-       do {
-               conf_cnt = 0;
-               check_conf(&rootmenu);
-       } while (conf_cnt);
-}
-
-static int conf_silent_update(void)
-{
-       const char *name;
-
-       if (conf_get_changed()) {
-               name = getenv("KCONFIG_NOSILENTUPDATE");
-               if (name && *name) {
-                       fprintf(stderr,
-                       _("\n*** Kernel configuration requires explicit update.\n\n"));
-                       return 1;
-               }
-               conf_do_update();
-       }
-       return 0;
-}
-
-static int conf_update(void)
-{
-       rootEntry = &rootmenu;
-       conf(&rootmenu);
-       if (input_mode == ask_all) {
-               input_mode = ask_silent;
-               valid_stdin = 1;
-       }
-       conf_do_update();
-       return 0;
-}
-
 int main(int ac, char **av)
 {
        int opt;
@@ -477,11 +441,11 @@ int main(int ac, char **av)
        while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
                switch (opt) {
                case 'o':
-                       input_mode = ask_new;
+                       input_mode = ask_silent;
                        break;
                case 's':
                        input_mode = ask_silent;
-                       valid_stdin = isatty(0) && isatty(1) && isatty(2);
+                       sync_kconfig = 1;
                        break;
                case 'd':
                        input_mode = set_default;
@@ -519,6 +483,19 @@ int main(int ac, char **av)
        name = av[optind];
        conf_parse(name);
        //zconfdump(stdout);
+       if (sync_kconfig) {
+               if (stat(".config", &tmpstat)) {
+                       fprintf(stderr, _("***\n"
+                               "*** You have not yet configured your kernel!\n"
+                               "*** (missing kernel .config file)\n"
+                               "***\n"
+                               "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
+                               "*** \"make menuconfig\" or \"make xconfig\").\n"
+                               "***\n"));
+                       exit(1);
+               }
+       }
+
        switch (input_mode) {
        case set_default:
                if (!defconfig_file)
@@ -531,16 +508,6 @@ int main(int ac, char **av)
                }
                break;
        case ask_silent:
-               if (stat(".config", &tmpstat)) {
-                       printf(_("***\n"
-                               "*** You have not yet configured your kernel!\n"
-                               "*** (missing kernel .config file)\n"
-                               "***\n"
-                               "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
-                               "*** \"make menuconfig\" or \"make xconfig\").\n"
-                               "***\n"));
-                       exit(1);
-               }
        case ask_all:
        case ask_new:
                conf_read(NULL);
@@ -569,6 +536,19 @@ int main(int ac, char **av)
        default:
                break;
        }
+
+       if (sync_kconfig) {
+               if (conf_get_changed()) {
+                       name = getenv("KCONFIG_NOSILENTUPDATE");
+                       if (name && *name) {
+                               fprintf(stderr,
+                                       _("\n*** Kernel configuration requires explicit update.\n\n"));
+                               return 1;
+                       }
+               }
+               valid_stdin = isatty(0) && isatty(1) && isatty(2);
+       }
+
        switch (input_mode) {
        case set_no:
                conf_set_all_new_symbols(def_no);
@@ -585,27 +565,38 @@ int main(int ac, char **av)
        case set_default:
                conf_set_all_new_symbols(def_default);
                break;
-       case ask_silent:
        case ask_new:
-               if (conf_silent_update())
-                       exit(1);
-               break;
        case ask_all:
-               if (conf_update())
-                       exit(1);
+               rootEntry = &rootmenu;
+               conf(&rootmenu);
+               input_mode = ask_silent;
+               /* fall through */
+       case ask_silent:
+               /* Update until a loop caused no more changes */
+               do {
+                       conf_cnt = 0;
+                       check_conf(&rootmenu);
+               } while (conf_cnt);
                break;
        }
 
-       if (conf_write(NULL)) {
-               fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
-               exit(1);
-       }
-       /* ask_silent is used during the build so we shall update autoconf.
-        * All other commands are only used to generate a config.
-        */
-       if (input_mode == ask_silent && conf_write_autoconf()) {
-               fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
-               return 1;
+       if (sync_kconfig) {
+               /* silentoldconfig is used during the build so we shall update autoconf.
+                * All other commands are only used to generate a config.
+                */
+               if (conf_get_changed() && conf_write(NULL)) {
+                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       exit(1);
+               }
+               if (conf_write_autoconf()) {
+                       fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
+                       return 1;
+               }
+       } else {
+               if (conf_write(NULL)) {
+                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       exit(1);
+               }
        }
        return 0;
 }
index df6a188b993002ae7d2ca82cb12e8b853aefcb42..b91cf241a539ceaadbf603374d45b3c012a24e41 100644 (file)
@@ -222,8 +222,10 @@ load:
                                continue;
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 9);
-                               if (!sym)
+                               if (!sym) {
+                                       sym_add_change_count(1);
                                        break;
+                               }
                        } else {
                                sym = sym_lookup(line + 9, 0);
                                if (sym->type == S_UNKNOWN)
@@ -259,8 +261,10 @@ load:
                        }
                        if (def == S_DEF_USER) {
                                sym = sym_find(line + 7);
-                               if (!sym)
+                               if (!sym) {
+                                       sym_add_change_count(1);
                                        break;
+                               }
                        } else {
                                sym = sym_lookup(line + 7, 0);
                                if (sym->type == S_UNKNOWN)
index ff787e6ff8edcbef0edc7fbfaef7f3d088f930a0..44ee94d2ab761ba46b1f8f155009d78dbac2daad 100755 (executable)
@@ -781,6 +781,7 @@ sub output_struct_xml(%) {
     print " <refsect1>\n";
     print "  <title>Members</title>\n";
 
+    if ($#{$args{'parameterlist'}} >= 0) {
     print "  <variablelist>\n";
     foreach $parameter (@{$args{'parameterlist'}}) {
       ($parameter =~ /^#/) && next;
@@ -798,6 +799,9 @@ sub output_struct_xml(%) {
       print "    </varlistentry>\n";
     }
     print "  </variablelist>\n";
+    } else {
+       print " <para>\n  None\n </para>\n";
+    }
     print " </refsect1>\n";
 
     output_section_xml(@_);
index 418cd7dbbc939ae89ae88d04e71d14025885b4a8..8e0de6a5e18a0fad92f53cdf889c640022519774 100644 (file)
@@ -1986,11 +1986,13 @@ static void read_markers(const char *fname)
 
                mod = find_module(modname);
                if (!mod) {
-                       if (is_vmlinux(modname))
-                               have_vmlinux = 1;
                        mod = new_module(NOFAIL(strdup(modname)));
                        mod->skip = 1;
                }
+               if (is_vmlinux(modname)) {
+                       have_vmlinux = 1;
+                       mod->skip = 0;
+               }
 
                if (!mod->skip)
                        add_marker(mod, marker, fmt);
index d11a8154500f7f312e4fd83bd56430593c7b1393..8551952ef329bcf62c9fe1516f8a4d181988b543 100644 (file)
@@ -2737,6 +2737,7 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
                if (ctx == NULL)
                        goto netlbl_secattr_to_sid_return;
 
+               context_init(&ctx_new);
                ctx_new.user = ctx->user;
                ctx_new.role = ctx->role;
                ctx_new.type = ctx->type;
@@ -2745,13 +2746,9 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
                        if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat,
                                                  secattr->attr.mls.cat) != 0)
                                goto netlbl_secattr_to_sid_return;
-                       ctx_new.range.level[1].cat.highbit =
-                               ctx_new.range.level[0].cat.highbit;
-                       ctx_new.range.level[1].cat.node =
-                               ctx_new.range.level[0].cat.node;
-               } else {
-                       ebitmap_init(&ctx_new.range.level[0].cat);
-                       ebitmap_init(&ctx_new.range.level[1].cat);
+                       memcpy(&ctx_new.range.level[1].cat,
+                              &ctx_new.range.level[0].cat,
+                              sizeof(ctx_new.range.level[0].cat));
                }
                if (mls_context_isvalid(&policydb, &ctx_new) != 1)
                        goto netlbl_secattr_to_sid_return_cleanup;
index 9dd9bc73fe1d6ab8b568fa1ce865650f52bae72f..ece25c718e95e8f78c5a71b01df6e01e80519908 100644 (file)
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
                return -ENODEV;
 
        card = pcm->card;
-       down_read(&card->controls_rwsem);
+       read_lock(&card->ctl_files_rwlock);
        list_for_each_entry(kctl, &card->ctl_files, list) {
                if (kctl->pid == current->pid) {
                        prefer_subdevice = kctl->prefer_pcm_subdevice;
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
                                break;
                }
        }
-       up_read(&card->controls_rwsem);
+       read_unlock(&card->ctl_files_rwlock);
 
        switch (stream) {
        case SNDRV_PCM_STREAM_PLAYBACK:
index c49b9d9e303c76d6495943b5b99fb02eff710e1f..c487025d345777d56ba228918bbc95eb9564cd05 100644 (file)
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
        card = substream->pcm->card;
 
        if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
-           runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
+           runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED ||
+           runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
                return -EBADFD;
 
-       snd_power_lock(card);
-       if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
-               result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
-               if (result < 0)
-                       goto _unlock;
-       }
-
        snd_pcm_stream_lock_irq(substream);
        /* resume pause */
        if (runtime->status->state == SNDRV_PCM_STATE_PAUSED)
@@ -1564,8 +1558,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
        snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
        /* runtime->control->appl_ptr = runtime->status->hw_ptr; */
        snd_pcm_stream_unlock_irq(substream);
- _unlock:
-       snd_power_unlock(card);
+
        return result;
 }
 
index f7ea7287c59cd7edfcf75bc5795efce07d512d79..b917a9f981c7a276b3fbff94deece3f4ab8aa2f4 100644 (file)
@@ -418,7 +418,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
        mutex_lock(&rmidi->open_mutex);
        while (1) {
                subdevice = -1;
-               down_read(&card->controls_rwsem);
+               read_lock(&card->ctl_files_rwlock);
                list_for_each_entry(kctl, &card->ctl_files, list) {
                        if (kctl->pid == current->pid) {
                                subdevice = kctl->prefer_rawmidi_subdevice;
@@ -426,7 +426,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
                                        break;
                        }
                }
-               up_read(&card->controls_rwsem);
+               read_unlock(&card->ctl_files_rwlock);
                err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device,
                                              subdevice, fflags, rawmidi_file);
                if (err >= 0)
index ad994fcab72508da6a7e483fd4b51526388643b6..f3da621f25c533a48b5a710970381410e6006e45 100644 (file)
@@ -1683,8 +1683,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
        /* Dell 3 stack systems with verb table in BIOS */
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0227, "Dell Vostro 1400  ", STAC_DELL_BIOS),
-       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022e, "Dell     ", STAC_DELL_BIOS),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0242, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0243, "Dell     ", STAC_DELL_BIOS),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x02ff, "Dell     ", STAC_DELL_BIOS),
index 566a6d0daf4a0161871305ac617ffa7b390975cc..106c48225bbadd2978a10b325fe80badcc7f086d 100644 (file)
@@ -621,6 +621,13 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = {
        AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
 };
 
+static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __initdata = {
+       AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
+       AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
+       AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
+       AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
+};
+
 static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = {
        AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
        AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
@@ -688,7 +695,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = {
 static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata =
 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
 
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata =
+static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata =
+AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
+
+static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata =
 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
 
 
@@ -765,11 +775,12 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
 
 #define IS_PM7500 (machine_is_compatible("AAPL,7500"))
 #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
-#define IS_IMAC (machine_is_compatible("PowerMac2,1") \
-               || machine_is_compatible("PowerMac2,2") \
+#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
+#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
                || machine_is_compatible("PowerMac4,1"))
+#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
 
-static int imac;
+static int imac1, imac2;
 
 #ifdef PMAC_SUPPORT_AUTOMUTE
 /*
@@ -815,13 +826,18 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify)
                {
                        int reg = chip->awacs_reg[1]
                                | (MASK_HDMUTE | MASK_SPKMUTE);
-                       if (imac) {
+                       if (imac1) {
+                               reg &= ~MASK_SPKMUTE;
+                               reg |= MASK_PAROUT1;
+                       } else if (imac2) {
                                reg &= ~MASK_SPKMUTE;
                                reg &= ~MASK_PAROUT1;
                        }
                        if (snd_pmac_awacs_detect_headphone(chip))
                                reg &= ~MASK_HDMUTE;
-                       else if (imac)
+                       else if (imac1)
+                               reg &= ~MASK_PAROUT1;
+                       else if (imac2)
                                reg |= MASK_PAROUT1;
                        else
                                reg &= ~MASK_SPKMUTE;
@@ -850,9 +866,13 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
 {
        int pm7500 = IS_PM7500;
        int beige = IS_BEIGE;
+       int g4agp = IS_G4AGP;
+       int imac;
        int err, vol;
 
-       imac = IS_IMAC;
+       imac1 = IS_IMAC1;
+       imac2 = IS_IMAC2;
+       imac = imac1 || imac2;
        /* looks like MASK_GAINLINE triggers something, so we set here
         * as start-up
         */
@@ -939,7 +959,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                                snd_pmac_awacs_mixers);
        if (err < 0)
                return err;
-       if (beige)
+       if (beige || g4agp)
                ;
        else if (chip->model == PMAC_SCREAMER)
                err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2),
@@ -961,13 +981,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                err = build_mixers(chip,
                                   ARRAY_SIZE(snd_pmac_screamer_mixers_imac),
                                   snd_pmac_screamer_mixers_imac);
+       else if (g4agp)
+               err = build_mixers(chip,
+                                  ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp),
+                                  snd_pmac_screamer_mixers_g4agp);
        else
                err = build_mixers(chip,
                                   ARRAY_SIZE(snd_pmac_awacs_mixers_pmac),
                                   snd_pmac_awacs_mixers_pmac);
        if (err < 0)
                return err;
-       chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac)
+       chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp)
                        ? &snd_pmac_awacs_master_sw_imac
                        : &snd_pmac_awacs_master_sw, chip);
        err = snd_ctl_add(chip->card, chip->master_sw_ctl);
@@ -1004,15 +1028,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
                                        snd_pmac_awacs_speaker_vol);
                if (err < 0)
                        return err;
-               chip->speaker_sw_ctl = snd_ctl_new1(imac
-                               ? &snd_pmac_awacs_speaker_sw_imac
+               chip->speaker_sw_ctl = snd_ctl_new1(imac1
+                               ? &snd_pmac_awacs_speaker_sw_imac1
+                               : imac2
+                               ? &snd_pmac_awacs_speaker_sw_imac2
                                : &snd_pmac_awacs_speaker_sw, chip);
                err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
                if (err < 0)
                        return err;
        }
 
-       if (beige)
+       if (beige || g4agp)
                err = build_mixers(chip,
                                ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige),
                                snd_pmac_screamer_mic_boost_beige);
index 435f1daf177c39e767cd4a7b6999f6d81d9847dc..c83584f989a9bea6223e611acce0ea37f8f2b51c 100644 (file)
@@ -434,7 +434,8 @@ static int at32_pcm_suspend(struct platform_device *pdev,
        params = prtd->params;
 
        /* Disable the PDC and save the PDC registers */
-       ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
+       ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
+                  params->mask->pdc_disable);
 
        prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
        prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
@@ -464,7 +465,7 @@ static int at32_pcm_resume(struct platform_device *pdev,
        ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
        ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
 
-       ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
+       ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable);
        return 0;
 }
 #else /* CONFIG_PM */
index 9deb8c74fdfd3f1c07f5b1eaf518d4b8f145b5d6..0bbd94501d7ea45f1aa8b491bf43d275ffb779c9 100644 (file)
@@ -490,34 +490,7 @@ static int cs4270_mute(struct snd_soc_dai *dai, int mute)
 
 #endif
 
-static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind);
-
-/*
- * Notify the driver that a new I2C bus has been found.
- *
- * This function is called for each I2C bus in the system.  The function
- * then asks the I2C subsystem to probe that bus at the addresses on which
- * our device (the CS4270) could exist.  If a device is found at one of
- * those addresses, then our probe function (cs4270_i2c_probe) is called.
- */
-static int cs4270_i2c_attach(struct i2c_adapter *adapter)
-{
-       return i2c_probe(adapter, &addr_data, cs4270_i2c_probe);
-}
-
-static int cs4270_i2c_detach(struct i2c_client *client)
-{
-       struct snd_soc_codec *codec = i2c_get_clientdata(client);
-
-       i2c_detach_client(client);
-       codec->control_data = NULL;
-
-       kfree(codec->reg_cache);
-       codec->reg_cache = NULL;
-
-       kfree(client);
-       return 0;
-}
+static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *);
 
 /* A list of non-DAPM controls that the CS4270 supports */
 static const struct snd_kcontrol_new cs4270_snd_controls[] = {
@@ -525,14 +498,19 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = {
                CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1)
 };
 
+static const struct i2c_device_id cs4270_id[] = {
+       {"cs4270", 0},
+       {}
+};
+MODULE_DEVICE_TABLE(i2c, cs4270_id);
+
 static struct i2c_driver cs4270_i2c_driver = {
        .driver = {
                .name = "CS4270 I2C",
                .owner = THIS_MODULE,
        },
-       .id =             I2C_DRIVERID_CS4270,
-       .attach_adapter = cs4270_i2c_attach,
-       .detach_client =  cs4270_i2c_detach,
+       .id_table = cs4270_id,
+       .probe = cs4270_i2c_probe,
 };
 
 /*
@@ -561,11 +539,11 @@ static struct snd_soc_device *cs4270_socdev;
  * Note: snd_soc_new_pcms() must be called before this function can be called,
  * because of snd_ctl_add().
  */
-static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
+static int cs4270_i2c_probe(struct i2c_client *i2c_client,
+       const struct i2c_device_id *id)
 {
        struct snd_soc_device *socdev = cs4270_socdev;
        struct snd_soc_codec *codec = socdev->codec;
-       struct i2c_client *i2c_client = NULL;
        int i;
        int ret = 0;
 
@@ -578,12 +556,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
 
        /* Note: codec_dai->codec is NULL here */
 
-       i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (!i2c_client) {
-               printk(KERN_ERR "cs4270: could not allocate I2C client\n");
-               return -ENOMEM;
-       }
-
        codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL);
        if (!codec->reg_cache) {
                printk(KERN_ERR "cs4270: could not allocate register cache\n");
@@ -591,13 +563,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
                goto error;
        }
 
-       i2c_set_clientdata(i2c_client, codec);
-       strcpy(i2c_client->name, "CS4270");
-
-       i2c_client->driver = &cs4270_i2c_driver;
-       i2c_client->adapter = adapter;
-       i2c_client->addr = addr;
-
        /* Verify that we have a CS4270 */
 
        ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID);
@@ -612,18 +577,10 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
                goto error;
        }
 
-       printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr);
+       printk(KERN_INFO "cs4270: found device at I2C address %X\n",
+               i2c_client->addr);
        printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF);
 
-       /* Tell the I2C layer a new client has arrived */
-
-       ret = i2c_attach_client(i2c_client);
-       if (ret) {
-               printk(KERN_ERR "cs4270: could not attach codec, "
-                       "I2C address %x, error code %i\n", addr, ret);
-               goto error;
-       }
-
        codec->control_data = i2c_client;
        codec->read = cs4270_read_reg_cache;
        codec->write = cs4270_i2c_write;
@@ -648,20 +605,17 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
                        goto error;
        }
 
+       i2c_set_clientdata(i2c_client, codec);
+
        return 0;
 
 error:
-       if (codec->control_data) {
-               i2c_detach_client(i2c_client);
-               codec->control_data = NULL;
-       }
+       codec->control_data = NULL;
 
        kfree(codec->reg_cache);
        codec->reg_cache = NULL;
        codec->reg_cache_size = 0;
 
-       kfree(i2c_client);
-
        return ret;
 }
 
@@ -727,7 +681,7 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
        if (ret < 0) {
                printk(KERN_ERR "cs4270: failed to create PCMs\n");
-               return ret;
+               goto error_free_codec;
        }
 
 #ifdef USE_I2C
@@ -736,8 +690,7 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = i2c_add_driver(&cs4270_i2c_driver);
        if (ret) {
                printk(KERN_ERR "cs4270: failed to attach driver");
-               snd_soc_free_pcms(socdev);
-               return ret;
+               goto error_free_pcms;
        }
 
        /* Did we find a CS4270 on the I2C bus? */
@@ -759,10 +712,23 @@ static int cs4270_probe(struct platform_device *pdev)
        ret = snd_soc_register_card(socdev);
        if (ret < 0) {
                printk(KERN_ERR "cs4270: failed to register card\n");
-               snd_soc_free_pcms(socdev);
-               return ret;
+               goto error_del_driver;
        }
 
+       return 0;
+
+error_del_driver:
+#ifdef USE_I2C
+       i2c_del_driver(&cs4270_i2c_driver);
+
+error_free_pcms:
+#endif
+       snd_soc_free_pcms(socdev);
+
+error_free_codec:
+       kfree(socdev->codec);
+       socdev->codec = NULL;
+
        return ret;
 }
 
@@ -773,8 +739,7 @@ static int cs4270_remove(struct platform_device *pdev)
        snd_soc_free_pcms(socdev);
 
 #ifdef USE_I2C
-       if (socdev->codec->control_data)
-               i2c_del_driver(&cs4270_i2c_driver);
+       i2c_del_driver(&cs4270_i2c_driver);
 #endif
 
        kfree(socdev->codec);
index 5761164fe16dea17481b538f4734d66fafdbebe9..e873414840c854231899d5bdd1b83316f08de4d8 100644 (file)
@@ -583,7 +583,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
 
        /* out 4 */
        {"Out4 Mux", "VREF", "VREF"},
-       {"Out4 Mux", "Capture ST", "Capture ST Mixer"},
+       {"Out4 Mux", "Capture ST", "Playback Mixer"},
        {"Out4 Mux", "LOUT2", "LOUT2"},
        {"Out 4", NULL, "Out4 Mux"},
        {"OUT4", NULL, "Out 4"},
@@ -607,7 +607,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
        /* Capture Right Mux */
        {"Capture Right Mux", "PGA", "Right Capture Volume"},
        {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"},
-       {"Capture Right Mux", "Sidetone", "Capture ST Mixer"},
+       {"Capture Right Mux", "Sidetone", "Playback Mixer"},
 
        /* Mono Capture mixer-mux */
        {"Capture Right Mixer", "Stereo", "Capture Right Mux"},