]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
Merge branch 'acpi-pm'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 28 Jun 2013 10:58:30 +0000 (12:58 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 28 Jun 2013 10:58:30 +0000 (12:58 +0200)
* acpi-pm:
  ACPI / PM: Rework and clean up acpi_dev_pm_get_state()
  ACPI / PM: Replace ACPI_STATE_D3 with ACPI_STATE_D3_COLD in device_pm.c
  ACPI / PM: Rename function acpi_device_power_state() and make it static
  ACPI / PM: acpi_processor_suspend() can be static
  xen / ACPI / sleep: Register an acpi_suspend_lowlevel callback.
  x86 / ACPI / sleep: Provide registration for acpi_suspend_lowlevel.

289 files changed:
Documentation/ABI/testing/sysfs-devices-online [new file with mode: 0644]
Documentation/ABI/testing/sysfs-firmware-acpi
Documentation/DocBook/media/v4l/dev-codec.xml
Documentation/DocBook/media/v4l/v4l2.xml
Documentation/devicetree/bindings/media/exynos-fimc-lite.txt
Documentation/sound/alsa/HD-Audio-Models.txt
Makefile
arch/arm/Kconfig
arch/arm/boot/compressed/Makefile
arch/arm/boot/dts/exynos5250-pinctrl.dtsi
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/include/asm/cacheflush.h
arch/arm/kernel/machine_kexec.c
arch/arm/kernel/process.c
arch/arm/kernel/smp.c
arch/arm/mm/cache-v7.S
arch/arm/mm/flush.c
arch/arm/mm/mmu.c
arch/arm/mm/proc-v7.S
arch/arm64/kernel/perf_event.c
arch/ia64/hp/common/sba_iommu.c
arch/ia64/include/asm/irqflags.h
arch/metag/include/asm/hugetlb.h
arch/mn10300/include/asm/irqflags.h
arch/mn10300/include/asm/smp.h
arch/parisc/include/asm/mmzone.h
arch/parisc/include/asm/pci.h
arch/parisc/kernel/hardware.c
arch/parisc/kernel/pacache.S
arch/parisc/kernel/pci.c
arch/parisc/mm/init.c
arch/powerpc/kvm/booke.c
arch/powerpc/mm/hugetlbpage.c
arch/sparc/include/asm/Kbuild
arch/sparc/include/asm/leon.h
arch/sparc/include/asm/leon_amba.h
arch/sparc/include/asm/linkage.h [deleted file]
arch/sparc/kernel/ds.c
arch/sparc/kernel/leon_kernel.c
arch/sparc/kernel/leon_pci_grpci1.c
arch/sparc/kernel/leon_pmc.c
arch/sparc/kernel/setup_32.c
arch/sparc/kernel/setup_64.c
arch/sparc/mm/init_64.c
arch/sparc/mm/tlb.c
arch/sparc/prom/bootstr_32.c
arch/sparc/prom/tree_64.c
arch/tile/lib/exports.c
arch/um/drivers/mconsole_kern.c
arch/x86/Kconfig
arch/x86/crypto/aesni-intel_asm.S
arch/x86/ia32/ia32_aout.c
arch/x86/include/asm/irq.h
arch/x86/include/asm/microcode.h
arch/x86/include/asm/nmi.h
arch/x86/kernel/apic/hw_nmi.c
arch/x86/kernel/cpu/mtrr/cleanup.c
arch/x86/kernel/cpu/perf_event_intel.c
arch/x86/kernel/kvmclock.c
arch/x86/kernel/process.c
arch/x86/kernel/smpboot.c
arch/x86/kvm/x86.c
arch/x86/platform/efi/efi.c
drivers/acpi/Makefile
drivers/acpi/acpi_lpss.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/acpi_processor.c [new file with mode: 0644]
drivers/acpi/acpica/Makefile
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acpredef.h
drivers/acpi/acpica/acstruct.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/dscontrol.c
drivers/acpi/acpica/dsfield.c
drivers/acpi/acpica/dsinit.c
drivers/acpi/acpica/dsmthdat.c
drivers/acpi/acpica/dsobject.c
drivers/acpi/acpica/dsopcode.c
drivers/acpi/acpica/dsutils.c
drivers/acpi/acpica/dswexec.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/dswload2.c
drivers/acpi/acpica/evglock.c
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evgpeblk.c
drivers/acpi/acpica/evgpeinit.c
drivers/acpi/acpica/evhandler.c
drivers/acpi/acpica/evmisc.c
drivers/acpi/acpica/evregion.c
drivers/acpi/acpica/evrgnini.c
drivers/acpi/acpica/evxfgpe.c
drivers/acpi/acpica/evxfregn.c
drivers/acpi/acpica/exconfig.c
drivers/acpi/acpica/exconvrt.c
drivers/acpi/acpica/excreate.c
drivers/acpi/acpica/exdebug.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/exfield.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exmisc.c
drivers/acpi/acpica/exoparg1.c
drivers/acpi/acpica/exoparg2.c
drivers/acpi/acpica/exoparg3.c
drivers/acpi/acpica/exoparg6.c
drivers/acpi/acpica/exprep.c
drivers/acpi/acpica/exregion.c
drivers/acpi/acpica/exresnte.c
drivers/acpi/acpica/exresolv.c
drivers/acpi/acpica/exresop.c
drivers/acpi/acpica/exstore.c
drivers/acpi/acpica/exstoren.c
drivers/acpi/acpica/hwacpi.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/acpica/hwregs.c
drivers/acpi/acpica/hwxface.c
drivers/acpi/acpica/hwxfsleep.c
drivers/acpi/acpica/nsaccess.c
drivers/acpi/acpica/nsarguments.c [new file with mode: 0644]
drivers/acpi/acpica/nsconvert.c
drivers/acpi/acpica/nsdump.c
drivers/acpi/acpica/nseval.c
drivers/acpi/acpica/nsinit.c
drivers/acpi/acpica/nspredef.c
drivers/acpi/acpica/nsprepkg.c
drivers/acpi/acpica/nsrepair.c
drivers/acpi/acpica/nsrepair2.c
drivers/acpi/acpica/nsutils.c
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/acpica/psargs.c
drivers/acpi/acpica/psloop.c
drivers/acpi/acpica/psobject.c
drivers/acpi/acpica/psparse.c
drivers/acpi/acpica/pstree.c
drivers/acpi/acpica/psxface.c
drivers/acpi/acpica/rscalc.c
drivers/acpi/acpica/rscreate.c
drivers/acpi/acpica/rsdump.c
drivers/acpi/acpica/rsmisc.c
drivers/acpi/acpica/rsutils.c
drivers/acpi/acpica/rsxface.c
drivers/acpi/acpica/tbinstal.c
drivers/acpi/acpica/tbprint.c [new file with mode: 0644]
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/tbxfload.c
drivers/acpi/acpica/utbuffer.c [new file with mode: 0644]
drivers/acpi/acpica/utcopy.c
drivers/acpi/acpica/utdebug.c
drivers/acpi/acpica/utdelete.c
drivers/acpi/acpica/uterror.c [new file with mode: 0644]
drivers/acpi/acpica/uteval.c
drivers/acpi/acpica/utexcep.c
drivers/acpi/acpica/utids.c
drivers/acpi/acpica/utmisc.c
drivers/acpi/acpica/utobject.c
drivers/acpi/acpica/utpredef.c
drivers/acpi/acpica/utstring.c
drivers/acpi/acpica/uttrack.c
drivers/acpi/acpica/utxferror.c
drivers/acpi/device_pm.c
drivers/acpi/dock.c
drivers/acpi/glue.c
drivers/acpi/internal.h
drivers/acpi/osl.c
drivers/acpi/power.c
drivers/acpi/processor_driver.c
drivers/acpi/resource.c
drivers/acpi/scan.c
drivers/acpi/sysfs.c
drivers/acpi/video.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata.h
drivers/base/core.c
drivers/base/cpu.c
drivers/base/firmware_class.c
drivers/base/memory.c
drivers/block/rbd.c
drivers/clk/clk.c
drivers/clk/samsung/clk-exynos5250.c
drivers/clk/samsung/clk-pll.c
drivers/clk/spear/spear3xx_clock.c
drivers/clk/tegra/clk-tegra30.c
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/gpu/drm/drm_prime.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/drm/radeon/radeon_fence.c
drivers/gpu/drm/radeon/radeon_gart.c
drivers/gpu/drm/radeon/radeon_ring.c
drivers/gpu/drm/radeon/radeon_uvd.c
drivers/irqchip/irq-gic.c
drivers/media/Kconfig
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/pci/cx88/cx88-alsa.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/platform/coda.c
drivers/media/platform/davinci/vpbe_display.c
drivers/media/platform/davinci/vpfe_capture.c
drivers/media/platform/exynos4-is/fimc-is-regs.c
drivers/media/platform/exynos4-is/fimc-is.c
drivers/media/platform/exynos4-is/fimc-is.h
drivers/media/platform/exynos4-is/fimc-isp.c
drivers/media/platform/exynos4-is/mipi-csis.c
drivers/media/platform/s3c-camif/camif-core.h
drivers/media/platform/s5p-jpeg/Makefile
drivers/media/platform/s5p-mfc/Makefile
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
drivers/media/platform/s5p-mfc/s5p_mfc_debug.h
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
drivers/media/platform/s5p-mfc/s5p_mfc_pm.c
drivers/media/platform/sh_veu.c
drivers/media/platform/soc_camera/soc_camera.c
drivers/media/radio/Kconfig
drivers/media/radio/radio-si476x.c
drivers/media/tuners/Kconfig
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
drivers/media/usb/gspca/sonixb.c
drivers/media/usb/pwc/pwc.h
drivers/media/v4l2-core/v4l2-ctrls.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/media/v4l2-core/videobuf2-core.c
drivers/net/ethernet/brocade/bna/bnad_debugfs.c
drivers/parisc/iosapic.c
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/pci.h
drivers/pci/setup-bus.c
drivers/scsi/bfa/bfad_debugfs.c
drivers/scsi/fnic/fnic_debugfs.c
drivers/scsi/lpfc/lpfc_debugfs.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c
drivers/staging/media/davinci_vpfe/Kconfig
drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
drivers/staging/media/solo6x10/Kconfig
drivers/target/iscsi/iscsi_target_configfs.c
drivers/target/iscsi/iscsi_target_erl0.c
drivers/target/iscsi/iscsi_target_login.c
drivers/target/iscsi/iscsi_target_nego.c
drivers/tty/pty.c
drivers/tty/serial/8250/8250_gsc.c
drivers/tty/vt/vt_ioctl.c
drivers/usb/phy/Kconfig
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/ti_usb_3410_5052.h
fs/internal.h
fs/read_write.c
fs/splice.c
include/acpi/acconfig.h
include/acpi/acoutput.h
include/acpi/acpi_bus.h
include/acpi/acpi_drivers.h
include/acpi/acpixf.h
include/acpi/processor.h
include/linux/acpi.h
include/linux/context_tracking.h
include/linux/device.h
include/linux/fs.h
include/linux/kvm_host.h
include/linux/memory_hotplug.h
include/linux/perf_event.h
include/linux/preempt.h
include/linux/splice.h
include/linux/vtime.h
include/media/v4l2-mem2mem.h
kernel/context_tracking.c
kernel/cpu/idle.c
kernel/events/core.c
kernel/events/internal.h
kernel/kprobes.c
kernel/range.c
kernel/sched/core.c
kernel/sched/cputime.c
kernel/time/tick-broadcast.c
kernel/time/tick-sched.c
mm/memory_hotplug.c
mm/slab_common.c
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_realtek.c
sound/usb/card.c
sound/usb/mixer.c

diff --git a/Documentation/ABI/testing/sysfs-devices-online b/Documentation/ABI/testing/sysfs-devices-online
new file mode 100644 (file)
index 0000000..f990026
--- /dev/null
@@ -0,0 +1,20 @@
+What:          /sys/devices/.../online
+Date:          April 2013
+Contact:       Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Description:
+               The /sys/devices/.../online attribute is only present for
+               devices whose bus types provide .online() and .offline()
+               callbacks.  The number read from it (0 or 1) reflects the value
+               of the device's 'offline' field.  If that number is 1 and '0'
+               (or 'n', or 'N') is written to this file, the device bus type's
+               .offline() callback is executed for the device and (if
+               successful) its 'offline' field is updated accordingly.  In
+               turn, if that number is 0 and '1' (or 'y', or 'Y') is written to
+               this file, the device bus type's .online() callback is executed
+               for the device and (if successful) its 'offline' field is
+               updated as appropriate.
+
+               After a successful execution of the bus type's .offline()
+               callback the device cannot be used for any purpose until either
+               it is removed (i.e. device_del() is called for it), or its bus
+               type's .online() is exeucted successfully.
index ce9bee98b43be62f84937502ed6fdfae38d43b3d..b4436cca97a83612fd3305630f5e0807eb53caeb 100644 (file)
@@ -44,6 +44,16 @@ Description:
                or 0 (unset).  Attempts to write any other values to it will
                cause -EINVAL to be returned.
 
+What:          /sys/firmware/acpi/hotplug/force_remove
+Date:          May 2013
+Contact:       Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Description:
+               The number in this file (0 or 1) determines whether (1) or not
+               (0) the ACPI subsystem will allow devices to be hot-removed even
+               if they cannot be put offline gracefully (from the kernel's
+               viewpoint).  That number can be changed by writing a boolean
+               value to this file.
+
 What:          /sys/firmware/acpi/interrupts/
 Date:          February 2008
 Contact:       Len Brown <lenb@kernel.org>
index dca0ecd54dc699fa92e1cab272e665423712cd45..ff44c16fc0801090b8020c28e7eb6bda8ecc8ea1 100644 (file)
@@ -1,18 +1,27 @@
   <title>Codec Interface</title>
 
-  <note>
-    <title>Suspended</title>
+  <para>A V4L2 codec can compress, decompress, transform, or otherwise
+convert video data from one format into another format, in memory. Typically
+such devices are memory-to-memory devices (i.e. devices with the
+<constant>V4L2_CAP_VIDEO_M2M</constant> or <constant>V4L2_CAP_VIDEO_M2M_MPLANE</constant>
+capability set).
+</para>
 
-    <para>This interface has been be suspended from the V4L2 API
-implemented in Linux 2.6 until we have more experience with codec
-device interfaces.</para>
-  </note>
+  <para>A memory-to-memory video node acts just like a normal video node, but it
+supports both output (sending frames from memory to the codec hardware) and
+capture (receiving the processed frames from the codec hardware into memory)
+stream I/O. An application will have to setup the stream
+I/O for both sides and finally call &VIDIOC-STREAMON; for both capture and output
+to start the codec.</para>
 
-  <para>A V4L2 codec can compress, decompress, transform, or otherwise
-convert video data from one format into another format, in memory.
-Applications send data to be converted to the driver through a
-&func-write; call, and receive the converted data through a
-&func-read; call. For efficiency a driver may also support streaming
-I/O.</para>
+  <para>Video compression codecs use the MPEG controls to setup their codec parameters
+(note that the MPEG controls actually support many more codecs than just MPEG).
+See <xref linkend="mpeg-controls"></xref>.</para>
 
-  <para>[to do]</para>
+  <para>Memory-to-memory devices can often be used as a shared resource: you can
+open the video node multiple times, each application setting up their own codec properties
+that are local to the file handle, and each can use it independently from the others.
+The driver will arbitrate access to the codec and reprogram it whenever another file
+handler gets access. This is different from the usual video node behavior where the video properties
+are global to the device (i.e. changing something through one file handle is visible
+through another file handle).</para>
index bfc93cdcf69644ca9d4e42d0652881330c747e3e..bfe823dd0f31cf7c6adecb79b5b8a888f434b888 100644 (file)
@@ -493,7 +493,7 @@ and discussions on the V4L mailing list.</revremark>
 </partinfo>
 
 <title>Video for Linux Two API Specification</title>
- <subtitle>Revision 3.9</subtitle>
+ <subtitle>Revision 3.10</subtitle>
 
   <chapter id="common">
     &sub-common;
index 3f62adfb3e0b4102dbeb888497a5f58dc90b5295..de9f6b78ee515ca3893a3ac954f2a15d516c7a76 100644 (file)
@@ -2,7 +2,7 @@ Exynos4x12/Exynos5 SoC series camera host interface (FIMC-LITE)
 
 Required properties:
 
-- compatible   : should be "samsung,exynos4212-fimc" for Exynos4212 and
+- compatible   : should be "samsung,exynos4212-fimc-lite" for Exynos4212 and
                  Exynos4412 SoCs;
 - reg          : physical base address and size of the device memory mapped
                  registers;
index bb8b0dc532b8d5b98d7fe44d168be90a0044bef6..77d68e23b2476f05993be8f9897b76f3bf08edea 100644 (file)
@@ -29,6 +29,8 @@ ALC269/270/275/276/280/282
   alc271-dmic  Enable ALC271X digital mic workaround
   inv-dmic     Inverted internal mic workaround
   lenovo-dock   Enables docking station I/O for some Lenovos
+  dell-headset-multi   Headset jack, which can also be used as mic-in
+  dell-headset-dock    Headset jack (without mic-in), and also dock I/O
 
 ALC662/663/272
 ==============
@@ -42,6 +44,7 @@ ALC662/663/272
   asus-mode7   ASUS
   asus-mode8   ASUS
   inv-dmic     Inverted internal mic workaround
+  dell-headset-multi   Headset jack, which can also be used as mic-in
 
 ALC680
 ======
index c6863b55f7c7a48d53338d51d6c5a6b711cbadc1..0142c934adbd20718845c6459b90cf02ab2e4517 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 10
 SUBLEVEL = 0
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc7
 NAME = Unicycling Gorilla
 
 # *DOCUMENTATION*
index 49d993cee51232874a81814fe39ca99e09b88bad..2651b1da1c56a0ab8692b9a844890b4b81263091 100644 (file)
@@ -1189,6 +1189,16 @@ config PL310_ERRATA_588369
           is not correctly implemented in PL310 as clean lines are not
           invalidated as a result of these operations.
 
+config ARM_ERRATA_643719
+       bool "ARM errata: LoUIS bit field in CLIDR register is incorrect"
+       depends on CPU_V7 && SMP
+       help
+         This option enables the workaround for the 643719 Cortex-A9 (prior to
+         r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR
+         register returns zero when it should return one. The workaround
+         corrects this value, ensuring cache maintenance operations which use
+         it behave as intended and avoiding data corruption.
+
 config ARM_ERRATA_720789
        bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
        depends on CPU_V7
@@ -2006,7 +2016,7 @@ config XIP_PHYS_ADDR
 
 config KEXEC
        bool "Kexec system call (EXPERIMENTAL)"
-       depends on (!SMP || HOTPLUG_CPU)
+       depends on (!SMP || PM_SLEEP_SMP)
        help
          kexec is a system call that implements the ability to shutdown your
          current kernel, and to start another kernel.  It is like a reboot
index 79e9bdbfc491a29521939aa2747862fc491c6d6d..120b83bfde20e5b8f3d46b4f13ff4c82ef75a471 100644 (file)
@@ -116,7 +116,8 @@ targets       := vmlinux vmlinux.lds \
 
 # Make sure files are removed during clean
 extra-y       += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \
-                lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs)
+                lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \
+                hyp-stub.S
 
 ifeq ($(CONFIG_FUNCTION_TRACER),y)
 ORIG_CFLAGS := $(KBUILD_CFLAGS)
index d1650fb34c0a38e85f90b798d103a94612e7c65d..ded558bb0f3bb88219655656976134f6ac749810 100644 (file)
                };
        };
 
-       pinctrl@03680000 {
+       pinctrl@03860000 {
                gpz: gpz {
                        gpio-controller;
                        #gpio-cells = <2>;
index 0673524238a61f706c7c17a096ef3319fb095287..fc9fb3d526e25aff898f4e226284e7204413d2ac 100644 (file)
                interrupts = <0 50 0>;
        };
 
-       pinctrl_3: pinctrl@03680000 {
+       pinctrl_3: pinctrl@03860000 {
                compatible = "samsung,exynos5250-pinctrl";
-               reg = <0x0368000 0x1000>;
+               reg = <0x03860000 0x1000>;
                interrupts = <0 47 0>;
        };
 
index bff71388e72a163c4c18c93fc745f72db9b29e00..17d0ae8672fa666b8d1e43ae40b0226e1bd04ac8 100644 (file)
@@ -320,9 +320,7 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
 }
 
 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
-static inline void flush_kernel_dcache_page(struct page *page)
-{
-}
+extern void flush_kernel_dcache_page(struct page *);
 
 #define flush_dcache_mmap_lock(mapping) \
        spin_lock_irq(&(mapping)->tree_lock)
index 8ef8c9337809cbe5ccb91b33525c38a379e9e986..4fb074c446bf901df288b3878341a169dacb843b 100644 (file)
@@ -134,6 +134,10 @@ void machine_kexec(struct kimage *image)
        unsigned long reboot_code_buffer_phys;
        void *reboot_code_buffer;
 
+       if (num_online_cpus() > 1) {
+               pr_err("kexec: error: multiple CPUs still online\n");
+               return;
+       }
 
        page_list = image->head & PAGE_MASK;
 
index 282de4826abb640bd310ce8cf6099dec297803ce..6e8931ccf13ed048f0b93880476a3911b3a9b587 100644 (file)
@@ -184,30 +184,61 @@ int __init reboot_setup(char *str)
 
 __setup("reboot=", reboot_setup);
 
+/*
+ * Called by kexec, immediately prior to machine_kexec().
+ *
+ * This must completely disable all secondary CPUs; simply causing those CPUs
+ * to execute e.g. a RAM-based pin loop is not sufficient. This allows the
+ * kexec'd kernel to use any and all RAM as it sees fit, without having to
+ * avoid any code or data used by any SW CPU pin loop. The CPU hotplug
+ * functionality embodied in disable_nonboot_cpus() to achieve this.
+ */
 void machine_shutdown(void)
 {
-#ifdef CONFIG_SMP
-       smp_send_stop();
-#endif
+       disable_nonboot_cpus();
 }
 
+/*
+ * Halting simply requires that the secondary CPUs stop performing any
+ * activity (executing tasks, handling interrupts). smp_send_stop()
+ * achieves this.
+ */
 void machine_halt(void)
 {
-       machine_shutdown();
+       smp_send_stop();
+
        local_irq_disable();
        while (1);
 }
 
+/*
+ * Power-off simply requires that the secondary CPUs stop performing any
+ * activity (executing tasks, handling interrupts). smp_send_stop()
+ * achieves this. When the system power is turned off, it will take all CPUs
+ * with it.
+ */
 void machine_power_off(void)
 {
-       machine_shutdown();
+       smp_send_stop();
+
        if (pm_power_off)
                pm_power_off();
 }
 
+/*
+ * Restart requires that the secondary CPUs stop performing any activity
+ * while the primary CPU resets the system. Systems with a single CPU can
+ * use soft_restart() as their machine descriptor's .restart hook, since that
+ * will cause the only available CPU to reset. Systems with multiple CPUs must
+ * provide a HW restart implementation, to ensure that all CPUs reset at once.
+ * This is required so that any code running after reset on the primary CPU
+ * doesn't have to co-ordinate with other CPUs to ensure they aren't still
+ * executing pre-reset code, and using RAM that the primary CPU's code wishes
+ * to use. Implementing such co-ordination would be essentially impossible.
+ */
 void machine_restart(char *cmd)
 {
-       machine_shutdown();
+       smp_send_stop();
 
        arm_pm_restart(reboot_mode, cmd);
 
index 550d63cef68e4be6ada87a3c7942ccd767061c6d..5919eb451bb9840590091c3d26a922bd65b1d005 100644 (file)
@@ -651,17 +651,6 @@ void smp_send_reschedule(int cpu)
        smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static void smp_kill_cpus(cpumask_t *mask)
-{
-       unsigned int cpu;
-       for_each_cpu(cpu, mask)
-               platform_cpu_kill(cpu);
-}
-#else
-static void smp_kill_cpus(cpumask_t *mask) { }
-#endif
-
 void smp_send_stop(void)
 {
        unsigned long timeout;
@@ -679,8 +668,6 @@ void smp_send_stop(void)
 
        if (num_online_cpus() > 1)
                pr_warning("SMP: failed to stop secondary CPUs\n");
-
-       smp_kill_cpus(&mask);
 }
 
 /*
index 15451ee4acc8f61f1ebd2f20164290c28c2b6a12..515b00064da8f66db5400c3990905f7ad89e2113 100644 (file)
@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis)
        mrc     p15, 1, r0, c0, c0, 1           @ read clidr, r0 = clidr
        ALT_SMP(ands    r3, r0, #(7 << 21))     @ extract LoUIS from clidr
        ALT_UP(ands     r3, r0, #(7 << 27))     @ extract LoUU from clidr
+#ifdef CONFIG_ARM_ERRATA_643719
+       ALT_SMP(mrceq   p15, 0, r2, c0, c0, 0)  @ read main ID register
+       ALT_UP(moveq    pc, lr)                 @ LoUU is zero, so nothing to do
+       ldreq   r1, =0x410fc090                 @ ID of ARM Cortex A9 r0p?
+       biceq   r2, r2, #0x0000000f             @ clear minor revision number
+       teqeq   r2, r1                          @ test for errata affected core and if so...
+       orreqs  r3, #(1 << 21)                  @   fix LoUIS value (and set flags state to 'ne')
+#endif
        ALT_SMP(mov     r3, r3, lsr #20)        @ r3 = LoUIS * 2
        ALT_UP(mov      r3, r3, lsr #26)        @ r3 = LoUU * 2
        moveq   pc, lr                          @ return if level == 0
index 0d473cce501c137e8c87c40f9ccb455d6ec275eb..32aa5861119f2bdd353468114462dd8a680a60cb 100644 (file)
@@ -300,6 +300,39 @@ void flush_dcache_page(struct page *page)
 }
 EXPORT_SYMBOL(flush_dcache_page);
 
+/*
+ * Ensure cache coherency for the kernel mapping of this page. We can
+ * assume that the page is pinned via kmap.
+ *
+ * If the page only exists in the page cache and there are no user
+ * space mappings, this is a no-op since the page was already marked
+ * dirty at creation.  Otherwise, we need to flush the dirty kernel
+ * cache lines directly.
+ */
+void flush_kernel_dcache_page(struct page *page)
+{
+       if (cache_is_vivt() || cache_is_vipt_aliasing()) {
+               struct address_space *mapping;
+
+               mapping = page_mapping(page);
+
+               if (!mapping || mapping_mapped(mapping)) {
+                       void *addr;
+
+                       addr = page_address(page);
+                       /*
+                        * kmap_atomic() doesn't set the page virtual
+                        * address for highmem pages, and
+                        * kunmap_atomic() takes care of cache
+                        * flushing already.
+                        */
+                       if (!IS_ENABLED(CONFIG_HIGHMEM) || addr)
+                               __cpuc_flush_dcache_area(addr, PAGE_SIZE);
+               }
+       }
+}
+EXPORT_SYMBOL(flush_kernel_dcache_page);
+
 /*
  * Flush an anonymous page so that users of get_user_pages()
  * can safely access the data.  The expected sequence is:
index e0d8565671a6c8104c643937098b963ac2f517ee..4d409e6a552df67f11ea8bb81b1930e830c3dcde 100644 (file)
@@ -616,10 +616,12 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
        } while (pte++, addr += PAGE_SIZE, addr != end);
 }
 
-static void __init map_init_section(pmd_t *pmd, unsigned long addr,
+static void __init __map_init_section(pmd_t *pmd, unsigned long addr,
                        unsigned long end, phys_addr_t phys,
                        const struct mem_type *type)
 {
+       pmd_t *p = pmd;
+
 #ifndef CONFIG_ARM_LPAE
        /*
         * In classic MMU format, puds and pmds are folded in to
@@ -638,7 +640,7 @@ static void __init map_init_section(pmd_t *pmd, unsigned long addr,
                phys += SECTION_SIZE;
        } while (pmd++, addr += SECTION_SIZE, addr != end);
 
-       flush_pmd_entry(pmd);
+       flush_pmd_entry(p);
 }
 
 static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
@@ -661,7 +663,7 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
                 */
                if (type->prot_sect &&
                                ((addr | next | phys) & ~SECTION_MASK) == 0) {
-                       map_init_section(pmd, addr, next, phys, type);
+                       __map_init_section(pmd, addr, next, phys, type);
                } else {
                        alloc_init_pte(pmd, addr, next,
                                                __phys_to_pfn(phys), type);
index 2c73a7301ff7017eea046df2f2b67e475ab653de..4c8c9c10a3880736571b863f96a7c8a9005f129e 100644 (file)
@@ -409,8 +409,8 @@ __v7_ca9mp_proc_info:
         */
        .type   __v7_pj4b_proc_info, #object
 __v7_pj4b_proc_info:
-       .long   0x562f5840
-       .long   0xfffffff0
+       .long   0x560f5800
+       .long   0xff0fff00
        __v7_proc __v7_pj4b_setup
        .size   __v7_pj4b_proc_info, . - __v7_pj4b_proc_info
 
index 1e49e5eb81e977fe44fccc369be1974617680cac..9ba33c40cdf8f841e974f68e599f0f97e87138ff 100644 (file)
@@ -1336,6 +1336,7 @@ void perf_callchain_user(struct perf_callchain_entry *entry,
                return;
        }
 
+       perf_callchain_store(entry, regs->pc);
        tail = (struct frame_tail __user *)regs->regs[29];
 
        while (entry->nr < PERF_MAX_STACK_DEPTH &&
index bcda5b2d121a624ee784f81843a13c155b7865a8..d43daf192b21d54df034e52c809a4ac4b2178161 100644 (file)
@@ -2042,7 +2042,8 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
 #endif
 
 static int __init
-acpi_sba_ioc_add(struct acpi_device *device)
+acpi_sba_ioc_add(struct acpi_device *device,
+                const struct acpi_device_id *not_used)
 {
        struct ioc *ioc;
        acpi_status status;
@@ -2090,14 +2091,18 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
        {"HWP0004", 0},
        {"", 0},
 };
-static struct acpi_driver acpi_sba_ioc_driver = {
-       .name           = "IOC IOMMU Driver",
-       .ids            = hp_ioc_iommu_device_ids,
-       .ops            = {
-               .add    = acpi_sba_ioc_add,
-       },
+static struct acpi_scan_handler acpi_sba_ioc_handler = {
+       .ids    = hp_ioc_iommu_device_ids,
+       .attach = acpi_sba_ioc_add,
 };
 
+static int __init acpi_sba_ioc_init_acpi(void)
+{
+       return acpi_scan_add_handler(&acpi_sba_ioc_handler);
+}
+/* This has to run before acpi_scan_init(). */
+arch_initcall(acpi_sba_ioc_init_acpi);
+
 extern struct dma_map_ops swiotlb_dma_ops;
 
 static int __init
@@ -2122,7 +2127,10 @@ sba_init(void)
        }
 #endif
 
-       acpi_bus_register_driver(&acpi_sba_ioc_driver);
+       /*
+        * ioc_list should be populated by the acpi_sba_ioc_handler's .attach()
+        * routine, but that only happens if acpi_scan_init() has already run.
+        */
        if (!ioc_list) {
 #ifdef CONFIG_IA64_GENERIC
                /*
index 1bf2cf2f4ab45fb6f965ec0708494cd515348593..cec6c06b52c0fba49a53bb1ee7a925520bf27b9d 100644 (file)
@@ -11,6 +11,7 @@
 #define _ASM_IA64_IRQFLAGS_H
 
 #include <asm/pal.h>
+#include <asm/kregs.h>
 
 #ifdef CONFIG_IA64_DEBUG_IRQ
 extern unsigned long last_cli_ip;
index f545477e61f3486d2f87b9a9b169993a324c8bed..471f481e67f3ebb07b34364890dc9a3feb56b013 100644 (file)
@@ -2,6 +2,7 @@
 #define _ASM_METAG_HUGETLB_H
 
 #include <asm/page.h>
+#include <asm-generic/hugetlb.h>
 
 
 static inline int is_hugepage_only_range(struct mm_struct *mm,
index 678f68d5f37bb7ef819ab900302ff9e14c61705d..8730c0a3c37d222630da2eba69525a084da59c70 100644 (file)
@@ -13,9 +13,8 @@
 #define _ASM_IRQFLAGS_H
 
 #include <asm/cpu-regs.h>
-#ifndef __ASSEMBLY__
-#include <linux/smp.h>
-#endif
+/* linux/smp.h <- linux/irqflags.h needs asm/smp.h first */
+#include <asm/smp.h>
 
 /*
  * interrupt control
index 6745dbe649441d906cc76de00df7c496961ba1d7..56c42417d428777ef3f928136dcd8b9d60df9b84 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef __ASSEMBLY__
 #include <linux/threads.h>
 #include <linux/cpumask.h>
+#include <linux/thread_info.h>
 #endif
 
 #ifdef CONFIG_SMP
@@ -85,7 +86,7 @@ extern cpumask_t cpu_boot_map;
 extern void smp_init_cpus(void);
 extern void smp_cache_interrupt(void);
 extern void send_IPI_allbutself(int irq);
-extern int smp_nmi_call_function(smp_call_func_t func, void *info, int wait);
+extern int smp_nmi_call_function(void (*func)(void *), void *info, int wait);
 
 extern void arch_send_call_function_single_ipi(int cpu);
 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
@@ -100,6 +101,7 @@ extern void __cpu_die(unsigned int cpu);
 #ifndef __ASSEMBLY__
 
 static inline void smp_init_cpus(void) {}
+#define raw_smp_processor_id() 0
 
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_SMP */
index cc50d33b7b881b7c57f7a46c125a56860840e514..b6b34a0987e7d7aafb42cd47d0c3b8f888007bd8 100644 (file)
@@ -27,7 +27,7 @@ extern struct node_map_data node_data[];
 
 #define PFNNID_SHIFT (30 - PAGE_SHIFT)
 #define PFNNID_MAP_MAX  512     /* support 512GB */
-extern unsigned char pfnnid_map[PFNNID_MAP_MAX];
+extern signed char pfnnid_map[PFNNID_MAP_MAX];
 
 #ifndef CONFIG_64BIT
 #define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT))
@@ -46,7 +46,7 @@ static inline int pfn_to_nid(unsigned long pfn)
        i = pfn >> PFNNID_SHIFT;
        BUG_ON(i >= ARRAY_SIZE(pfnnid_map));
 
-       return (int)pfnnid_map[i];
+       return pfnnid_map[i];
 }
 
 static inline int pfn_valid(int pfn)
index 3234f492d5754b3935d03f73e3ead2bb940747c5..465154076d23f9c1191f6ff7dcc59cf7b61333de 100644 (file)
@@ -225,4 +225,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
        return channel ? 15 : 14;
 }
 
+#define HAVE_PCI_MMAP
+
+extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+       enum pci_mmap_state mmap_state, int write_combine);
+
 #endif /* __ASM_PARISC_PCI_H */
index 9e2d2e408529f744b7bf5b7830cec15ad48a6012..872275659d986f0b4357b35db888740895c2211e 100644 (file)
@@ -1205,6 +1205,7 @@ static struct hp_hardware hp_hardware_list[] = {
        {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, 
        {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, 
        {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, 
+       {HPHW_FIO, 0x076, 0x000AD, 0x00, "Crestone Peak RS-232"},
        {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, 
        {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, 
        {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, 
index 36d7f402e48edb8b8cb13dea9e302d1e84edfdf9..b743a80eaba0311e934eda70c76e7acbf8ae6a78 100644 (file)
@@ -860,7 +860,7 @@ ENTRY(flush_dcache_page_asm)
 #endif
 
        ldil            L%dcache_stride, %r1
-       ldw             R%dcache_stride(%r1), %r1
+       ldw             R%dcache_stride(%r1), r31
 
 #ifdef CONFIG_64BIT
        depdi,z         1, 63-PAGE_SHIFT,1, %r25
@@ -868,26 +868,26 @@ ENTRY(flush_dcache_page_asm)
        depwi,z         1, 31-PAGE_SHIFT,1, %r25
 #endif
        add             %r28, %r25, %r25
-       sub             %r25, %r1, %r25
-
-
-1:      fdc,m          %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
-       fdc,m           %r1(%r28)
+       sub             %r25, r31, %r25
+
+
+1:      fdc,m          r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
+       fdc,m           r31(%r28)
        cmpb,COND(<<)           %r28, %r25,1b
-       fdc,m           %r1(%r28)
+       fdc,m           r31(%r28)
 
        sync
 
@@ -936,7 +936,7 @@ ENTRY(flush_icache_page_asm)
 #endif
 
        ldil            L%icache_stride, %r1
-       ldw             R%icache_stride(%r1), %r1
+       ldw             R%icache_stride(%r1), %r31
 
 #ifdef CONFIG_64BIT
        depdi,z         1, 63-PAGE_SHIFT,1, %r25
@@ -944,28 +944,28 @@ ENTRY(flush_icache_page_asm)
        depwi,z         1, 31-PAGE_SHIFT,1, %r25
 #endif
        add             %r28, %r25, %r25
-       sub             %r25, %r1, %r25
+       sub             %r25, %r31, %r25
 
 
        /* fic only has the type 26 form on PA1.1, requiring an
         * explicit space specification, so use %sr4 */
-1:      fic,m          %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
-       fic,m           %r1(%sr4,%r28)
+1:      fic,m          %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
        cmpb,COND(<<)   %r28, %r25,1b
-       fic,m           %r1(%sr4,%r28)
+       fic,m           %r31(%sr4,%r28)
 
        sync
 
index 60309051875e9887bcda5e584742ddc843d8585d..64f2764a8cef8778a0602262a5c5b10e4d68975d 100644 (file)
@@ -220,6 +220,33 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
 }
 
 
+int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+                       enum pci_mmap_state mmap_state, int write_combine)
+{
+       unsigned long prot;
+
+       /*
+        * I/O space can be accessed via normal processor loads and stores on
+        * this platform but for now we elect not to do this and portable
+        * drivers should not do this anyway.
+        */
+       if (mmap_state == pci_mmap_io)
+               return -EINVAL;
+
+       if (write_combine)
+               return -EINVAL;
+
+       /*
+        * Ignore write-combine; for now only return uncached mappings.
+        */
+       prot = pgprot_val(vma->vm_page_prot);
+       prot |= _PAGE_NO_CACHE;
+       vma->vm_page_prot = __pgprot(prot);
+
+       return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+               vma->vm_end - vma->vm_start, vma->vm_page_prot);
+}
+
 /*
  * A driver is enabling the device.  We make sure that all the appropriate
  * bits are set to allow the device to operate as the driver is expecting.
index 1c965642068b48d6b7102a5b6adb365f321f73e6..505b56c6b9b9c6dafa9df67b775c44eb1ebf1867 100644 (file)
@@ -47,7 +47,7 @@ pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pt
 
 #ifdef CONFIG_DISCONTIGMEM
 struct node_map_data node_data[MAX_NUMNODES] __read_mostly;
-unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
+signed char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
 #endif
 
 static struct resource data_resource = {
index 5cd7ad0c11764ec59432d945b5d824ea05f6603d..1a1b511897733da58ec1a1b79d6c9a66ffdedea2 100644 (file)
@@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
                ret = s;
                goto out;
        }
-       kvmppc_lazy_ee_enable();
 
        kvm_guest_enter();
 
@@ -699,6 +698,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
        kvmppc_load_guest_fp(vcpu);
 #endif
 
+       kvmppc_lazy_ee_enable();
+
        ret = __kvmppc_vcpu_run(kvm_run, vcpu);
 
        /* No need for kvm_guest_exit. It's done in handle_exit.
index 237c8e5f2640b79dce83c4bce7f7f66ef09fe02f..77fdd2cef33b5a2c18ac40c442645d9dc38365ad 100644 (file)
@@ -592,8 +592,14 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
        do {
                pmd = pmd_offset(pud, addr);
                next = pmd_addr_end(addr, end);
-               if (pmd_none_or_clear_bad(pmd))
+               if (!is_hugepd(pmd)) {
+                       /*
+                        * if it is not hugepd pointer, we should already find
+                        * it cleared.
+                        */
+                       WARN_ON(!pmd_none_or_clear_bad(pmd));
                        continue;
+               }
 #ifdef CONFIG_PPC_FSL_BOOK3E
                /*
                 * Increment next by the size of the huge mapping since
index ff18e3cfb6b1ffe3e75df94fdd68319b912ab1d8..7e4a97fbded412158d845926026987290907902c 100644 (file)
@@ -6,6 +6,7 @@ generic-y += cputime.h
 generic-y += div64.h
 generic-y += emergency-restart.h
 generic-y += exec.h
+generic-y += linkage.h
 generic-y += local64.h
 generic-y += mutex.h
 generic-y += irq_regs.h
index 15a716934e4dd790d589678af3ae58369d81ddf6..b836e9297f2a71c3084df4cd695109474856d72d 100644 (file)
@@ -135,7 +135,7 @@ static inline int sparc_leon3_cpuid(void)
 
 #ifdef CONFIG_SMP
 # define LEON3_IRQ_IPI_DEFAULT         13
-# define LEON3_IRQ_TICKER              (leon3_ticker_irq)
+# define LEON3_IRQ_TICKER              (leon3_gptimer_irq)
 # define LEON3_IRQ_CROSS_CALL          15
 #endif
 
index f3034eddf4682569c257a2ce19941b013a98c218..24ec48c3ff90ae57125c5e768471195307c60efc 100644 (file)
@@ -47,6 +47,7 @@ struct amba_prom_registers {
 #define LEON3_GPTIMER_LD 4
 #define LEON3_GPTIMER_IRQEN 8
 #define LEON3_GPTIMER_SEPIRQ 8
+#define LEON3_GPTIMER_TIMERS 0x7
 
 #define LEON23_REG_TIMER_CONTROL_EN    0x00000001 /* 1 = enable counting */
 /* 0 = hold scalar and counter */
diff --git a/arch/sparc/include/asm/linkage.h b/arch/sparc/include/asm/linkage.h
deleted file mode 100644 (file)
index 291c2d0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_LINKAGE_H
-#define __ASM_LINKAGE_H
-
-/* Nothing to see here... */
-
-#endif
index 75bb608c423eacb459321c5628ee45d6ce769ba6..5ef48dab563694db95935564e5df92172fd67bab 100644 (file)
@@ -843,7 +843,8 @@ void ldom_reboot(const char *boot_command)
                unsigned long len;
 
                strcpy(full_boot_str, "boot ");
-               strcpy(full_boot_str + strlen("boot "), boot_command);
+               strlcpy(full_boot_str + strlen("boot "), boot_command,
+                       sizeof(full_boot_str + strlen("boot ")));
                len = strlen(full_boot_str);
 
                if (reboot_data_supported) {
index 7c0231dabe445f1021190aafe4527b68c113a421..b7c68976cbc7568360dfde49044f70a4aac9ffb7 100644 (file)
@@ -38,7 +38,6 @@ static DEFINE_SPINLOCK(leon_irq_lock);
 
 unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
 unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
-int leon3_ticker_irq; /* Timer ticker IRQ */
 unsigned int sparc_leon_eirq;
 #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
 #define LEON_IACK (&leon3_irqctrl_regs->iclear)
@@ -278,6 +277,9 @@ irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
 
        leon_clear_profile_irq(cpu);
 
+       if (cpu == boot_cpu_id)
+               timer_interrupt(irq, NULL);
+
        ce = &per_cpu(sparc32_clockevent, cpu);
 
        irq_enter();
@@ -299,6 +301,7 @@ void __init leon_init_timers(void)
        int icsel;
        int ampopts;
        int err;
+       u32 config;
 
        sparc_config.get_cycles_offset = leon_cycles_offset;
        sparc_config.cs_period = 1000000 / HZ;
@@ -377,23 +380,6 @@ void __init leon_init_timers(void)
        LEON3_BYPASS_STORE_PA(
                        &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0);
 
-#ifdef CONFIG_SMP
-       leon3_ticker_irq = leon3_gptimer_irq + 1 + leon3_gptimer_idx;
-
-       if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) &
-             (1<<LEON3_GPTIMER_SEPIRQ))) {
-               printk(KERN_ERR "timer not configured with separate irqs\n");
-               BUG();
-       }
-
-       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].val,
-                               0);
-       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld,
-                               (((1000000/HZ) - 1)));
-       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl,
-                               0);
-#endif
-
        /*
         * The IRQ controller may (if implemented) consist of multiple
         * IRQ controllers, each mapped on a 4Kb boundary.
@@ -416,13 +402,6 @@ void __init leon_init_timers(void)
        if (eirq != 0)
                leon_eirq_setup(eirq);
 
-       irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx);
-       err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
-       if (err) {
-               printk(KERN_ERR "unable to attach timer IRQ%d\n", irq);
-               prom_halt();
-       }
-
 #ifdef CONFIG_SMP
        {
                unsigned long flags;
@@ -439,30 +418,31 @@ void __init leon_init_timers(void)
        }
 #endif
 
-       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl,
-                             LEON3_GPTIMER_EN |
-                             LEON3_GPTIMER_RL |
-                             LEON3_GPTIMER_LD |
-                             LEON3_GPTIMER_IRQEN);
+       config = LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config);
+       if (config & (1 << LEON3_GPTIMER_SEPIRQ))
+               leon3_gptimer_irq += leon3_gptimer_idx;
+       else if ((config & LEON3_GPTIMER_TIMERS) > 1)
+               pr_warn("GPTIMER uses shared irqs, using other timers of the same core will fail.\n");
 
 #ifdef CONFIG_SMP
        /* Install per-cpu IRQ handler for broadcasted ticker */
-       irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq,
+       irq = leon_build_device_irq(leon3_gptimer_irq, handle_percpu_irq,
                                    "per-cpu", 0);
        err = request_irq(irq, leon_percpu_timer_ce_interrupt,
-                         IRQF_PERCPU | IRQF_TIMER, "ticker",
-                         NULL);
+                         IRQF_PERCPU | IRQF_TIMER, "timer", NULL);
+#else
+       irq = _leon_build_device_irq(NULL, leon3_gptimer_irq);
+       err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
+#endif
        if (err) {
-               printk(KERN_ERR "unable to attach ticker IRQ%d\n", irq);
+               pr_err("Unable to attach timer IRQ%d\n", irq);
                prom_halt();
        }
-
-       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl,
+       LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl,
                              LEON3_GPTIMER_EN |
                              LEON3_GPTIMER_RL |
                              LEON3_GPTIMER_LD |
                              LEON3_GPTIMER_IRQEN);
-#endif
        return;
 bad:
        printk(KERN_ERR "No Timer/irqctrl found\n");
index 7739a54315e2dfdf71f5fff8c21f407046059892..6df26e37f8790c700c21a6b5651c4c84cf2ad874 100644 (file)
@@ -536,11 +536,9 @@ static int grpci1_of_probe(struct platform_device *ofdev)
 
        /* find device register base address */
        res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-       regs = devm_request_and_ioremap(&ofdev->dev, res);
-       if (!regs) {
-               dev_err(&ofdev->dev, "io-regs mapping failed\n");
-               return -EADDRNOTAVAIL;
-       }
+       regs = devm_ioremap_resource(&ofdev->dev, res);
+       if (IS_ERR(regs))
+               return PTR_ERR(regs);
 
        /*
         * check that we're in Host Slot and that we can act as a Host Bridge
index bdf53d9a8d460041e9237ebbfd219bb180879a86..b0b3967a2dd2d1e6ca46571d635a43b02e38fa75 100644 (file)
@@ -47,6 +47,10 @@ void pmc_leon_idle_fixup(void)
         * MMU does not get a TLB miss here by using the MMU BYPASS ASI.
         */
        register unsigned int address = (unsigned int)leon3_irqctrl_regs;
+
+       /* Interrupts need to be enabled to not hang the CPU */
+       local_irq_enable();
+
        __asm__ __volatile__ (
                "wr     %%g0, %%asr19\n"
                "lda    [%0] %1, %%g0\n"
@@ -60,6 +64,9 @@ void pmc_leon_idle_fixup(void)
  */
 void pmc_leon_idle(void)
 {
+       /* Interrupts need to be enabled to not hang the CPU */
+       local_irq_enable();
+
        /* For systems without power-down, this will be no-op */
        __asm__ __volatile__ ("wr       %g0, %asr19\n\t");
 }
index 38bf80a22f02396704fbb0f69ccef74fd83d689b..1434526970a6bf446a495d275eab9f46073a4172 100644 (file)
@@ -304,7 +304,7 @@ void __init setup_arch(char **cmdline_p)
 
        /* Initialize PROM console and command line. */
        *cmdline_p = prom_getbootargs();
-       strcpy(boot_command_line, *cmdline_p);
+       strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
        parse_early_param();
 
        boot_flags_init(*cmdline_p);
index 88a127b9c69e8b1876a94b60db94456eca6fe5ef..13785547e435274bb6fa079968a9d516dc25800f 100644 (file)
@@ -555,7 +555,7 @@ void __init setup_arch(char **cmdline_p)
 {
        /* Initialize PROM console and command line. */
        *cmdline_p = prom_getbootargs();
-       strcpy(boot_command_line, *cmdline_p);
+       strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
        parse_early_param();
 
        boot_flags_init(*cmdline_p);
index a7171997adfdd4b7b5bf9154528b94c31b0a3bb3..04fd55a6e4613ae009d6f53abce4fbf3f043bc8e 100644 (file)
@@ -1098,7 +1098,14 @@ static int __init grab_mblocks(struct mdesc_handle *md)
                m->size = *val;
                val = mdesc_get_property(md, node,
                                         "address-congruence-offset", NULL);
-               m->offset = *val;
+
+               /* The address-congruence-offset property is optional.
+                * Explicity zero it be identifty this.
+                */
+               if (val)
+                       m->offset = *val;
+               else
+                       m->offset = 0UL;
 
                numadbg("MBLOCK[%d]: base[%llx] size[%llx] offset[%llx]\n",
                        count - 1, m->base, m->size, m->offset);
index 83d89bcb44afcace24b757b02ce5305c1e762afe..37e7bc4c95b373aad3c9dbac1f16fe172b205890 100644 (file)
@@ -85,8 +85,8 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
        }
 
        if (!tb->active) {
-               global_flush_tlb_page(mm, vaddr);
                flush_tsb_user_page(mm, vaddr);
+               global_flush_tlb_page(mm, vaddr);
                goto out;
        }
 
index f5ec32e0d419b550313c71c344816808da7a4ab5..d2b49d2365e76d962db243aca29735d85d564dfb 100644 (file)
@@ -23,23 +23,25 @@ prom_getbootargs(void)
                return barg_buf;
        }
 
-       switch(prom_vers) {
+       switch (prom_vers) {
        case PROM_V0:
                cp = barg_buf;
                /* Start from 1 and go over fd(0,0,0)kernel */
-               for(iter = 1; iter < 8; iter++) {
+               for (iter = 1; iter < 8; iter++) {
                        arg = (*(romvec->pv_v0bootargs))->argv[iter];
                        if (arg == NULL)
                                break;
-                       while(*arg != 0) {
+                       while (*arg != 0) {
                                /* Leave place for space and null. */
-                               if(cp >= barg_buf + BARG_LEN-2){
+                               if (cp >= barg_buf + BARG_LEN - 2)
                                        /* We might issue a warning here. */
                                        break;
-                               }
                                *cp++ = *arg++;
                        }
                        *cp++ = ' ';
+                       if (cp >= barg_buf + BARG_LEN - 1)
+                               /* We might issue a warning here. */
+                               break;
                }
                *cp = 0;
                break;
index 92204c3800b57afe3366ffa49121001323c06243..bd1b2a3ac34e3a9cd82df45c4fedb86b34614ef0 100644 (file)
@@ -39,7 +39,7 @@ inline phandle __prom_getchild(phandle node)
        return prom_node_to_node("child", node);
 }
 
-inline phandle prom_getchild(phandle node)
+phandle prom_getchild(phandle node)
 {
        phandle cnode;
 
@@ -72,7 +72,7 @@ inline phandle __prom_getsibling(phandle node)
        return prom_node_to_node(prom_peer_name, node);
 }
 
-inline phandle prom_getsibling(phandle node)
+phandle prom_getsibling(phandle node)
 {
        phandle sibnode;
 
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(prom_getsibling);
 /* Return the length in bytes of property 'prop' at node 'node'.
  * Return -1 on error.
  */
-inline int prom_getproplen(phandle node, const char *prop)
+int prom_getproplen(phandle node, const char *prop)
 {
        unsigned long args[6];
 
@@ -113,8 +113,8 @@ EXPORT_SYMBOL(prom_getproplen);
  * 'buffer' which has a size of 'bufsize'.  If the acquisition
  * was successful the length will be returned, else -1 is returned.
  */
-inline int prom_getproperty(phandle node, const char *prop,
-                           char *buffer, int bufsize)
+int prom_getproperty(phandle node, const char *prop,
+                    char *buffer, int bufsize)
 {
        unsigned long args[8];
        int plen;
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(prom_getproperty);
 /* Acquire an integer property and return its value.  Returns -1
  * on failure.
  */
-inline int prom_getint(phandle node, const char *prop)
+int prom_getint(phandle node, const char *prop)
 {
        int intprop;
 
@@ -235,7 +235,7 @@ static const char *prom_nextprop_name = "nextprop";
 /* Return the first property type for node 'node'.
  * buffer should be at least 32B in length
  */
-inline char *prom_firstprop(phandle node, char *buffer)
+char *prom_firstprop(phandle node, char *buffer)
 {
        unsigned long args[7];
 
@@ -261,7 +261,7 @@ EXPORT_SYMBOL(prom_firstprop);
  * at node 'node' .  Returns NULL string if no more
  * property types for this node.
  */
-inline char *prom_nextprop(phandle node, const char *oprop, char *buffer)
+char *prom_nextprop(phandle node, const char *oprop, char *buffer)
 {
        unsigned long args[7];
        char buf[32];
index 4385cb6fa00ade132dc1ba9fb3fda09fbc775151..a93b02a252227c3b8bd40929e663e79f3f757862 100644 (file)
@@ -84,4 +84,6 @@ uint64_t __ashrdi3(uint64_t, unsigned int);
 EXPORT_SYMBOL(__ashrdi3);
 uint64_t __ashldi3(uint64_t, unsigned int);
 EXPORT_SYMBOL(__ashldi3);
+int __ffsdi2(uint64_t);
+EXPORT_SYMBOL(__ffsdi2);
 #endif
index d7d21851e60c12f0c3f64933a8c8e2856586ac46..3df3bd544492012ab9b78b0c43ab2648a1760e61 100644 (file)
@@ -147,7 +147,7 @@ void mconsole_proc(struct mc_request *req)
        }
 
        do {
-               loff_t pos;
+               loff_t pos = file->f_pos;
                mm_segment_t old_fs = get_fs();
                set_fs(KERNEL_DS);
                len = vfs_read(file, buf, PAGE_SIZE - 1, &pos);
index 685692c94f051a8a7ad582442efcc3fa11173332..fe120da25625b23ef52c74b479bf715f265261b4 100644 (file)
@@ -2265,6 +2265,7 @@ source "fs/Kconfig.binfmt"
 config IA32_EMULATION
        bool "IA32 Emulation"
        depends on X86_64
+       select BINFMT_ELF
        select COMPAT_BINFMT_ELF
        select HAVE_UID16
        ---help---
index 62fe22cd4cba5d33ec2434c79715267ff7031241..477e9d75149b8c62a0c971e37108b6b03ffa7668 100644 (file)
@@ -2681,56 +2681,68 @@ ENTRY(aesni_xts_crypt8)
        addq %rcx, KEYP
 
        movdqa IV, STATE1
-       pxor 0x00(INP), STATE1
+       movdqu 0x00(INP), INC
+       pxor INC, STATE1
        movdqu IV, 0x00(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE2
-       pxor 0x10(INP), STATE2
+       movdqu 0x10(INP), INC
+       pxor INC, STATE2
        movdqu IV, 0x10(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE3
-       pxor 0x20(INP), STATE3
+       movdqu 0x20(INP), INC
+       pxor INC, STATE3
        movdqu IV, 0x20(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE4
-       pxor 0x30(INP), STATE4
+       movdqu 0x30(INP), INC
+       pxor INC, STATE4
        movdqu IV, 0x30(OUTP)
 
        call *%r11
 
-       pxor 0x00(OUTP), STATE1
+       movdqu 0x00(OUTP), INC
+       pxor INC, STATE1
        movdqu STATE1, 0x00(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE1
-       pxor 0x40(INP), STATE1
+       movdqu 0x40(INP), INC
+       pxor INC, STATE1
        movdqu IV, 0x40(OUTP)
 
-       pxor 0x10(OUTP), STATE2
+       movdqu 0x10(OUTP), INC
+       pxor INC, STATE2
        movdqu STATE2, 0x10(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE2
-       pxor 0x50(INP), STATE2
+       movdqu 0x50(INP), INC
+       pxor INC, STATE2
        movdqu IV, 0x50(OUTP)
 
-       pxor 0x20(OUTP), STATE3
+       movdqu 0x20(OUTP), INC
+       pxor INC, STATE3
        movdqu STATE3, 0x20(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE3
-       pxor 0x60(INP), STATE3
+       movdqu 0x60(INP), INC
+       pxor INC, STATE3
        movdqu IV, 0x60(OUTP)
 
-       pxor 0x30(OUTP), STATE4
+       movdqu 0x30(OUTP), INC
+       pxor INC, STATE4
        movdqu STATE4, 0x30(OUTP)
 
        _aesni_gf128mul_x_ble()
        movdqa IV, STATE4
-       pxor 0x70(INP), STATE4
+       movdqu 0x70(INP), INC
+       pxor INC, STATE4
        movdqu IV, 0x70(OUTP)
 
        _aesni_gf128mul_x_ble()
@@ -2738,16 +2750,20 @@ ENTRY(aesni_xts_crypt8)
 
        call *%r11
 
-       pxor 0x40(OUTP), STATE1
+       movdqu 0x40(OUTP), INC
+       pxor INC, STATE1
        movdqu STATE1, 0x40(OUTP)
 
-       pxor 0x50(OUTP), STATE2
+       movdqu 0x50(OUTP), INC
+       pxor INC, STATE2
        movdqu STATE2, 0x50(OUTP)
 
-       pxor 0x60(OUTP), STATE3
+       movdqu 0x60(OUTP), INC
+       pxor INC, STATE3
        movdqu STATE3, 0x60(OUTP)
 
-       pxor 0x70(OUTP), STATE4
+       movdqu 0x70(OUTP), INC
+       pxor INC, STATE4
        movdqu STATE4, 0x70(OUTP)
 
        ret
index 805078e080133bbdb1eab29f9ff742ba55a54955..52ff81cce008e6dbaed3d3a3b290ea6c88412897 100644 (file)
@@ -192,7 +192,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
        /* struct user */
        DUMP_WRITE(&dump, sizeof(dump));
        /* Now dump all of the user data.  Include malloced stuff as well */
-       DUMP_SEEK(PAGE_SIZE);
+       DUMP_SEEK(PAGE_SIZE - sizeof(dump));
        /* now we start writing out the user space info */
        set_fs(USER_DS);
        /* Dump the data area */
index ba870bb6dd8ef30ab81a317a8eb43dcb83066630..57873beb32927426b3f5c5c97284729195d2c2e5 100644 (file)
@@ -41,4 +41,9 @@ extern int vector_used_by_percpu_irq(unsigned int vector);
 
 extern void init_ISA_irqs(void);
 
+#ifdef CONFIG_X86_LOCAL_APIC
+void arch_trigger_all_cpu_backtrace(void);
+#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
+#endif
+
 #endif /* _ASM_X86_IRQ_H */
index 6825e2efd1b411fdc8090e8218f391a93a8b6b91..6bc3985ee473d52ae74f16a2cec2e1fbd2fb693f 100644 (file)
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
 #ifdef CONFIG_MICROCODE_EARLY
 #define MAX_UCODE_COUNT 128
 extern void __init load_ucode_bsp(void);
-extern __init void load_ucode_ap(void);
+extern void __cpuinit load_ucode_ap(void);
 extern int __init save_microcode_in_initrd(void);
 #else
 static inline void __init load_ucode_bsp(void) {}
-static inline __init void load_ucode_ap(void) {}
+static inline void __cpuinit load_ucode_ap(void) {}
 static inline int __init save_microcode_in_initrd(void)
 {
        return 0;
index c0fa356e90de24ea60ba8a0ac90c39e6bb05d73b..86f9301903c818c632b227537b44142b71883c8d 100644 (file)
@@ -18,9 +18,7 @@ extern int proc_nmi_enabled(struct ctl_table *, int ,
                        void __user *, size_t *, loff_t *);
 extern int unknown_nmi_panic;
 
-void arch_trigger_all_cpu_backtrace(void);
-#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
-#endif
+#endif /* CONFIG_X86_LOCAL_APIC */
 
 #define NMI_FLAG_FIRST 1
 
index 31cb9ae992b7d7921b03bd6173068bae3138a06e..a698d7165c96a5b8fc0c08c8ee7f419b52933b08 100644 (file)
@@ -9,6 +9,7 @@
  *
  */
 #include <asm/apic.h>
+#include <asm/nmi.h>
 
 #include <linux/cpumask.h>
 #include <linux/kdebug.h>
index 35ffda5d0727d19b11cccccdde0e0d461b9e15ee..5f90b85ff22e584be8d1d7eb1615acde7584b397 100644 (file)
@@ -714,15 +714,15 @@ int __init mtrr_cleanup(unsigned address_bits)
        if (mtrr_tom2)
                x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base;
 
-       nr_range = x86_get_mtrr_mem_range(range, 0, x_remove_base, x_remove_size);
        /*
         * [0, 1M) should always be covered by var mtrr with WB
         * and fixed mtrrs should take effect before var mtrr for it:
         */
-       nr_range = add_range_with_merge(range, RANGE_NUM, nr_range, 0,
+       nr_range = add_range_with_merge(range, RANGE_NUM, 0, 0,
                                        1ULL<<(20 - PAGE_SHIFT));
-       /* Sort the ranges: */
-       sort_range(range, nr_range);
+       /* add from var mtrr at last */
+       nr_range = x86_get_mtrr_mem_range(range, nr_range,
+                                         x_remove_base, x_remove_size);
 
        range_sums = sum_ranges(range, nr_range);
        printk(KERN_INFO "total RAM covered: %ldM\n",
index f60d41ff9a97fba11bf28808a65ed775e1605666..a9e22073bd56a755ea1952dea202eba63e350f7f 100644 (file)
@@ -165,13 +165,13 @@ static struct extra_reg intel_snb_extra_regs[] __read_mostly = {
        INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0),
        INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1),
        INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
-       INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
        EVENT_EXTRA_END
 };
 
 static struct extra_reg intel_snbep_extra_regs[] __read_mostly = {
        INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0),
        INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1),
+       INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
        EVENT_EXTRA_END
 };
 
index d2c381280e3cfd1a3b462ab0d43320f424e1e7bc..3dd37ebd591b36db493d449506d33a6b8915841f 100644 (file)
@@ -242,6 +242,7 @@ void __init kvmclock_init(void)
        if (!mem)
                return;
        hv_clock = __va(mem);
+       memset(hv_clock, 0, size);
 
        if (kvm_register_clock("boot clock")) {
                hv_clock = NULL;
index 4e7a37ff03ab9f6aba634be08f7650e1ef5f2f7c..81a5f5e8f142a867b56a5e335d1b2a6598a8fbbe 100644 (file)
@@ -277,18 +277,6 @@ void exit_idle(void)
 }
 #endif
 
-void arch_cpu_idle_prepare(void)
-{
-       /*
-        * If we're the non-boot CPU, nothing set the stack canary up
-        * for us.  CPU0 already has it initialized but no harm in
-        * doing it again.  This is a good place for updating it, as
-        * we wont ever return from this function (so the invalid
-        * canaries already on the stack wont ever trigger).
-        */
-       boot_init_stack_canary();
-}
-
 void arch_cpu_idle_enter(void)
 {
        local_touch_nmi();
index 9c73b51817e4743264ef7c9abd01b72e21b98a8e..bfd348e9936926f56e13ffee8b67cc77ec4a4338 100644 (file)
@@ -372,15 +372,15 @@ static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
 
 void __cpuinit set_cpu_sibling_map(int cpu)
 {
-       bool has_mc = boot_cpu_data.x86_max_cores > 1;
        bool has_smt = smp_num_siblings > 1;
+       bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1;
        struct cpuinfo_x86 *c = &cpu_data(cpu);
        struct cpuinfo_x86 *o;
        int i;
 
        cpumask_set_cpu(cpu, cpu_sibling_setup_mask);
 
-       if (!has_smt && !has_mc) {
+       if (!has_mp) {
                cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
                cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
                cpumask_set_cpu(cpu, cpu_core_mask(cpu));
@@ -394,7 +394,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
                if ((i == cpu) || (has_smt && match_smt(c, o)))
                        link_mask(sibling, cpu, i);
 
-               if ((i == cpu) || (has_mc && match_llc(c, o)))
+               if ((i == cpu) || (has_mp && match_llc(c, o)))
                        link_mask(llc_shared, cpu, i);
 
        }
@@ -406,7 +406,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
        for_each_cpu(i, cpu_sibling_setup_mask) {
                o = &cpu_data(i);
 
-               if ((i == cpu) || (has_mc && match_mc(c, o))) {
+               if ((i == cpu) || (has_mp && match_mc(c, o))) {
                        link_mask(core, cpu, i);
 
                        /*
index 094b5d96ab1468c1875a2a2a5e682245f2909db9..e8ba99c341808d6069b0b4f6985b8d71ef243971 100644 (file)
@@ -582,8 +582,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
        if (index != XCR_XFEATURE_ENABLED_MASK)
                return 1;
        xcr0 = xcr;
-       if (kvm_x86_ops->get_cpl(vcpu) != 0)
-               return 1;
        if (!(xcr0 & XSTATE_FP))
                return 1;
        if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE))
@@ -597,7 +595,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 
 int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 {
-       if (__kvm_set_xcr(vcpu, index, xcr)) {
+       if (kvm_x86_ops->get_cpl(vcpu) != 0 ||
+           __kvm_set_xcr(vcpu, index, xcr)) {
                kvm_inject_gp(vcpu, 0);
                return 1;
        }
index 5ae2eb09419ec54d2ac7618904c31d961149df43..d2fbcedcf6eaf2fd77179075c1be2c5c4d3d8347 100644 (file)
@@ -1069,7 +1069,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
                 * that by attempting to use more space than is available.
                 */
                unsigned long dummy_size = remaining_size + 1024;
-               void *dummy = kmalloc(dummy_size, GFP_ATOMIC);
+               void *dummy = kzalloc(dummy_size, GFP_ATOMIC);
+
+               if (!dummy)
+                       return EFI_OUT_OF_RESOURCES;
 
                status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
                                          EFI_VARIABLE_NON_VOLATILE |
@@ -1089,6 +1092,8 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
                                         0, dummy);
                }
 
+               kfree(dummy);
+
                /*
                 * The runtime code may now have triggered a garbage collection
                 * run, so check the variable info again
index 536562c626a2fab4bb20c128abcf27f4404ca23f..d07771bc3d8c846ebd83bc8cded5aac7572d34c9 100644 (file)
@@ -34,6 +34,7 @@ acpi-$(CONFIG_ACPI_SLEEP)     += proc.o
 acpi-y                         += bus.o glue.o
 acpi-y                         += scan.o
 acpi-y                         += resource.o
+acpi-y                         += acpi_processor.o
 acpi-y                         += processor_core.o
 acpi-y                         += ec.o
 acpi-$(CONFIG_ACPI_DOCK)       += dock.o
index 652fd5ce303c4a9efdbfa3f6d4eb330fba42a5bd..cab13f2fc28e3033aaed24adbbf618199473bb28 100644 (file)
@@ -164,15 +164,24 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
        if (dev_desc->clk_required) {
                ret = register_device_clock(adev, pdata);
                if (ret) {
-                       /*
-                        * Skip the device, but don't terminate the namespace
-                        * scan.
-                        */
-                       kfree(pdata);
-                       return 0;
+                       /* Skip the device, but continue the namespace scan. */
+                       ret = 0;
+                       goto err_out;
                }
        }
 
+       /*
+        * This works around a known issue in ACPI tables where LPSS devices
+        * have _PS0 and _PS3 without _PSC (and no power resources), so
+        * acpi_bus_init_power() will assume that the BIOS has put them into D0.
+        */
+       ret = acpi_device_fix_up_power(adev);
+       if (ret) {
+               /* Skip the device, but continue the namespace scan. */
+               ret = 0;
+               goto err_out;
+       }
+
        adev->driver_data = pdata;
        ret = acpi_create_platform_device(adev, id);
        if (ret > 0)
index 5e6301e949206adb9f9b512a4b44b9d093e588df..c711d1144044ec18b47a8aad9f0c0f43e5f5f690 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <linux/acpi.h>
+#include <linux/memory.h>
 #include <linux/memory_hotplug.h>
 
 #include "internal.h"
@@ -166,13 +167,50 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
        return 0;
 }
 
+static unsigned long acpi_meminfo_start_pfn(struct acpi_memory_info *info)
+{
+       return PFN_DOWN(info->start_addr);
+}
+
+static unsigned long acpi_meminfo_end_pfn(struct acpi_memory_info *info)
+{
+       return PFN_UP(info->start_addr + info->length-1);
+}
+
+static int acpi_bind_memblk(struct memory_block *mem, void *arg)
+{
+       return acpi_bind_one(&mem->dev, (acpi_handle)arg);
+}
+
+static int acpi_bind_memory_blocks(struct acpi_memory_info *info,
+                                  acpi_handle handle)
+{
+       return walk_memory_range(acpi_meminfo_start_pfn(info),
+                                acpi_meminfo_end_pfn(info), (void *)handle,
+                                acpi_bind_memblk);
+}
+
+static int acpi_unbind_memblk(struct memory_block *mem, void *arg)
+{
+       acpi_unbind_one(&mem->dev);
+       return 0;
+}
+
+static void acpi_unbind_memory_blocks(struct acpi_memory_info *info,
+                                     acpi_handle handle)
+{
+       walk_memory_range(acpi_meminfo_start_pfn(info),
+                         acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk);
+}
+
 static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 {
+       acpi_handle handle = mem_device->device->handle;
        int result, num_enabled = 0;
        struct acpi_memory_info *info;
        int node;
 
-       node = acpi_get_node(mem_device->device->handle);
+       node = acpi_get_node(handle);
        /*
         * Tell the VM there is more memory here...
         * Note: Assume that this function returns zero on success
@@ -203,6 +241,12 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
                if (result && result != -EEXIST)
                        continue;
 
+               result = acpi_bind_memory_blocks(info, handle);
+               if (result) {
+                       acpi_unbind_memory_blocks(info, handle);
+                       return -ENODEV;
+               }
+
                info->enabled = 1;
 
                /*
@@ -227,12 +271,11 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
        return 0;
 }
 
-static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
+static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
 {
-       int result = 0, nid;
+       acpi_handle handle = mem_device->device->handle;
        struct acpi_memory_info *info, *n;
-
-       nid = acpi_get_node(mem_device->device->handle);
+       int nid = acpi_get_node(handle);
 
        list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
                if (!info->enabled)
@@ -240,15 +283,12 @@ static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
 
                if (nid < 0)
                        nid = memory_add_physaddr_to_nid(info->start_addr);
-               result = remove_memory(nid, info->start_addr, info->length);
-               if (result)
-                       return result;
 
+               acpi_unbind_memory_blocks(info, handle);
+               remove_memory(nid, info->start_addr, info->length);
                list_del(&info->list);
                kfree(info);
        }
-
-       return result;
 }
 
 static void acpi_memory_device_free(struct acpi_memory_device *mem_device)
@@ -300,7 +340,7 @@ static int acpi_memory_device_add(struct acpi_device *device,
        if (result) {
                dev_err(&device->dev, "acpi_memory_enable_device() error\n");
                acpi_memory_device_free(mem_device);
-               return -ENODEV;
+               return result;
        }
 
        dev_dbg(&device->dev, "Memory device configured by ACPI\n");
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
new file mode 100644 (file)
index 0000000..e9b01e3
--- /dev/null
@@ -0,0 +1,494 @@
+/*
+ * acpi_processor.c - ACPI processor enumeration support
+ *
+ * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ * Copyright (C) 2004       Dominik Brodowski <linux@brodo.de>
+ * Copyright (C) 2004  Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+ * Copyright (C) 2013, Intel Corporation
+ *                     Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+
+#include <acpi/processor.h>
+
+#include <asm/cpu.h>
+
+#include "internal.h"
+
+#define _COMPONENT     ACPI_PROCESSOR_COMPONENT
+
+ACPI_MODULE_NAME("processor");
+
+DEFINE_PER_CPU(struct acpi_processor *, processors);
+EXPORT_PER_CPU_SYMBOL(processors);
+
+/* --------------------------------------------------------------------------
+                                Errata Handling
+   -------------------------------------------------------------------------- */
+
+struct acpi_processor_errata errata __read_mostly;
+EXPORT_SYMBOL_GPL(errata);
+
+static int acpi_processor_errata_piix4(struct pci_dev *dev)
+{
+       u8 value1 = 0;
+       u8 value2 = 0;
+
+
+       if (!dev)
+               return -EINVAL;
+
+       /*
+        * Note that 'dev' references the PIIX4 ACPI Controller.
+        */
+
+       switch (dev->revision) {
+       case 0:
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n"));
+               break;
+       case 1:
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n"));
+               break;
+       case 2:
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n"));
+               break;
+       case 3:
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n"));
+               break;
+       default:
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n"));
+               break;
+       }
+
+       switch (dev->revision) {
+
+       case 0:         /* PIIX4 A-step */
+       case 1:         /* PIIX4 B-step */
+               /*
+                * See specification changes #13 ("Manual Throttle Duty Cycle")
+                * and #14 ("Enabling and Disabling Manual Throttle"), plus
+                * erratum #5 ("STPCLK# Deassertion Time") from the January
+                * 2002 PIIX4 specification update.  Applies to only older
+                * PIIX4 models.
+                */
+               errata.piix4.throttle = 1;
+
+       case 2:         /* PIIX4E */
+       case 3:         /* PIIX4M */
+               /*
+                * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
+                * Livelock") from the January 2002 PIIX4 specification update.
+                * Applies to all PIIX4 models.
+                */
+
+               /*
+                * BM-IDE
+                * ------
+                * Find the PIIX4 IDE Controller and get the Bus Master IDE
+                * Status register address.  We'll use this later to read
+                * each IDE controller's DMA status to make sure we catch all
+                * DMA activity.
+                */
+               dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
+                                    PCI_DEVICE_ID_INTEL_82371AB,
+                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
+               if (dev) {
+                       errata.piix4.bmisx = pci_resource_start(dev, 4);
+                       pci_dev_put(dev);
+               }
+
+               /*
+                * Type-F DMA
+                * ----------
+                * Find the PIIX4 ISA Controller and read the Motherboard
+                * DMA controller's status to see if Type-F (Fast) DMA mode
+                * is enabled (bit 7) on either channel.  Note that we'll
+                * disable C3 support if this is enabled, as some legacy
+                * devices won't operate well if fast DMA is disabled.
+                */
+               dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
+                                    PCI_DEVICE_ID_INTEL_82371AB_0,
+                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
+               if (dev) {
+                       pci_read_config_byte(dev, 0x76, &value1);
+                       pci_read_config_byte(dev, 0x77, &value2);
+                       if ((value1 & 0x80) || (value2 & 0x80))
+                               errata.piix4.fdma = 1;
+                       pci_dev_put(dev);
+               }
+
+               break;
+       }
+
+       if (errata.piix4.bmisx)
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Bus master activity detection (BM-IDE) erratum enabled\n"));
+       if (errata.piix4.fdma)
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Type-F DMA livelock erratum (C3 disabled)\n"));
+
+       return 0;
+}
+
+static int acpi_processor_errata(struct acpi_processor *pr)
+{
+       int result = 0;
+       struct pci_dev *dev = NULL;
+
+
+       if (!pr)
+               return -EINVAL;
+
+       /*
+        * PIIX4
+        */
+       dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
+                            PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
+                            PCI_ANY_ID, NULL);
+       if (dev) {
+               result = acpi_processor_errata_piix4(dev);
+               pci_dev_put(dev);
+       }
+
+       return result;
+}
+
+/* --------------------------------------------------------------------------
+                                Initialization
+   -------------------------------------------------------------------------- */
+
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+static int acpi_processor_hotadd_init(struct acpi_processor *pr)
+{
+       unsigned long long sta;
+       acpi_status status;
+       int ret;
+
+       status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
+       if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
+               return -ENODEV;
+
+       ret = acpi_map_lsapic(pr->handle, &pr->id);
+       if (ret)
+               return ret;
+
+       ret = arch_register_cpu(pr->id);
+       if (ret) {
+               acpi_unmap_lsapic(pr->id);
+               return ret;
+       }
+
+       /*
+        * CPU got hot-added, but cpu_data is not initialized yet.  Set a flag
+        * to delay cpu_idle/throttling initialization and do it when the CPU
+        * gets online for the first time.
+        */
+       pr_info("CPU%d has been hot-added\n", pr->id);
+       pr->flags.need_hotplug_init = 1;
+       return 0;
+}
+#else
+static inline int acpi_processor_hotadd_init(struct acpi_processor *pr)
+{
+       return -ENODEV;
+}
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
+static int acpi_processor_get_info(struct acpi_device *device)
+{
+       union acpi_object object = { 0 };
+       struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
+       struct acpi_processor *pr = acpi_driver_data(device);
+       int cpu_index, device_declaration = 0;
+       acpi_status status = AE_OK;
+       static int cpu0_initialized;
+
+       if (num_online_cpus() > 1)
+               errata.smp = TRUE;
+
+       acpi_processor_errata(pr);
+
+       /*
+        * Check to see if we have bus mastering arbitration control.  This
+        * is required for proper C3 usage (to maintain cache coherency).
+        */
+       if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
+               pr->flags.bm_control = 1;
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Bus mastering arbitration control present\n"));
+       } else
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "No bus mastering arbitration control\n"));
+
+       if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
+               /* Declared with "Processor" statement; match ProcessorID */
+               status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
+               if (ACPI_FAILURE(status)) {
+                       dev_err(&device->dev,
+                               "Failed to evaluate processor object (0x%x)\n",
+                               status);
+                       return -ENODEV;
+               }
+
+               /*
+                * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
+                *      >>> 'acpi_get_processor_id(acpi_id, &id)' in
+                *      arch/xxx/acpi.c
+                */
+               pr->acpi_id = object.processor.proc_id;
+       } else {
+               /*
+                * Declared with "Device" statement; match _UID.
+                * Note that we don't handle string _UIDs yet.
+                */
+               unsigned long long value;
+               status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
+                                               NULL, &value);
+               if (ACPI_FAILURE(status)) {
+                       dev_err(&device->dev,
+                               "Failed to evaluate processor _UID (0x%x)\n",
+                               status);
+                       return -ENODEV;
+               }
+               device_declaration = 1;
+               pr->acpi_id = value;
+       }
+       cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id);
+
+       /* Handle UP system running SMP kernel, with no LAPIC in MADT */
+       if (!cpu0_initialized && (cpu_index == -1) &&
+           (num_online_cpus() == 1)) {
+               cpu_index = 0;
+       }
+
+       cpu0_initialized = 1;
+
+       pr->id = cpu_index;
+
+       /*
+        *  Extra Processor objects may be enumerated on MP systems with
+        *  less than the max # of CPUs. They should be ignored _iff
+        *  they are physically not present.
+        */
+       if (pr->id == -1) {
+               int ret = acpi_processor_hotadd_init(pr);
+               if (ret)
+                       return ret;
+       }
+       /*
+        * On some boxes several processors use the same processor bus id.
+        * But they are located in different scope. For example:
+        * \_SB.SCK0.CPU0
+        * \_SB.SCK1.CPU0
+        * Rename the processor device bus id. And the new bus id will be
+        * generated as the following format:
+        * CPU+CPU ID.
+        */
+       sprintf(acpi_device_bid(device), "CPU%X", pr->id);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
+                         pr->acpi_id));
+
+       if (!object.processor.pblk_address)
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
+       else if (object.processor.pblk_length != 6)
+               dev_err(&device->dev, "Invalid PBLK length [%d]\n",
+                           object.processor.pblk_length);
+       else {
+               pr->throttling.address = object.processor.pblk_address;
+               pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
+               pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
+
+               pr->pblk = object.processor.pblk_address;
+
+               /*
+                * We don't care about error returns - we just try to mark
+                * these reserved so that nobody else is confused into thinking
+                * that this region might be unused..
+                *
+                * (In particular, allocating the IO range for Cardbus)
+                */
+               request_region(pr->throttling.address, 6, "ACPI CPU throttle");
+       }
+
+       /*
+        * If ACPI describes a slot number for this CPU, we can use it to
+        * ensure we get the right value in the "physical id" field
+        * of /proc/cpuinfo
+        */
+       status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer);
+       if (ACPI_SUCCESS(status))
+               arch_fix_phys_package_id(pr->id, object.integer.value);
+
+       return 0;
+}
+
+/*
+ * Do not put anything in here which needs the core to be online.
+ * For example MSR access or setting up things which check for cpuinfo_x86
+ * (cpu_data(cpu)) values, like CPU feature flags, family, model, etc.
+ * Such things have to be put in and set up by the processor driver's .probe().
+ */
+static DEFINE_PER_CPU(void *, processor_device_array);
+
+static int __cpuinit acpi_processor_add(struct acpi_device *device,
+                                       const struct acpi_device_id *id)
+{
+       struct acpi_processor *pr;
+       struct device *dev;
+       int result = 0;
+
+       pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
+       if (!pr)
+               return -ENOMEM;
+
+       if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
+               result = -ENOMEM;
+               goto err_free_pr;
+       }
+
+       pr->handle = device->handle;
+       strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
+       strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
+       device->driver_data = pr;
+
+       result = acpi_processor_get_info(device);
+       if (result) /* Processor is not physically present or unavailable */
+               return 0;
+
+#ifdef CONFIG_SMP
+       if (pr->id >= setup_max_cpus && pr->id != 0)
+               return 0;
+#endif
+
+       BUG_ON(pr->id >= nr_cpu_ids);
+
+       /*
+        * Buggy BIOS check.
+        * ACPI id of processors can be reported wrongly by the BIOS.
+        * Don't trust it blindly
+        */
+       if (per_cpu(processor_device_array, pr->id) != NULL &&
+           per_cpu(processor_device_array, pr->id) != device) {
+               dev_warn(&device->dev,
+                       "BIOS reported wrong ACPI id %d for the processor\n",
+                       pr->id);
+               /* Give up, but do not abort the namespace scan. */
+               goto err;
+       }
+       /*
+        * processor_device_array is not cleared on errors to allow buggy BIOS
+        * checks.
+        */
+       per_cpu(processor_device_array, pr->id) = device;
+       per_cpu(processors, pr->id) = pr;
+
+       dev = get_cpu_device(pr->id);
+       if (!dev) {
+               result = -ENODEV;
+               goto err;
+       }
+
+       result = acpi_bind_one(dev, pr->handle);
+       if (result)
+               goto err;
+
+       pr->dev = dev;
+       dev->offline = pr->flags.need_hotplug_init;
+
+       /* Trigger the processor driver's .probe() if present. */
+       if (device_attach(dev) >= 0)
+               return 1;
+
+       dev_err(dev, "Processor driver could not be attached\n");
+       acpi_unbind_one(dev);
+
+ err:
+       free_cpumask_var(pr->throttling.shared_cpu_map);
+       device->driver_data = NULL;
+       per_cpu(processors, pr->id) = NULL;
+ err_free_pr:
+       kfree(pr);
+       return result;
+}
+
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+/* --------------------------------------------------------------------------
+                                    Removal
+   -------------------------------------------------------------------------- */
+
+static void acpi_processor_remove(struct acpi_device *device)
+{
+       struct acpi_processor *pr;
+
+       if (!device || !acpi_driver_data(device))
+               return;
+
+       pr = acpi_driver_data(device);
+       if (pr->id >= nr_cpu_ids)
+               goto out;
+
+       /*
+        * The only reason why we ever get here is CPU hot-removal.  The CPU is
+        * already offline and the ACPI device removal locking prevents it from
+        * being put back online at this point.
+        *
+        * Unbind the driver from the processor device and detach it from the
+        * ACPI companion object.
+        */
+       device_release_driver(pr->dev);
+       acpi_unbind_one(pr->dev);
+
+       /* Clean up. */
+       per_cpu(processor_device_array, pr->id) = NULL;
+       per_cpu(processors, pr->id) = NULL;
+       try_offline_node(cpu_to_node(pr->id));
+
+       /* Remove the CPU. */
+       get_online_cpus();
+       arch_unregister_cpu(pr->id);
+       acpi_unmap_lsapic(pr->id);
+       put_online_cpus();
+
+ out:
+       free_cpumask_var(pr->throttling.shared_cpu_map);
+       kfree(pr);
+}
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
+/*
+ * The following ACPI IDs are known to be suitable for representing as
+ * processor devices.
+ */
+static const struct acpi_device_id processor_device_ids[] = {
+
+       { ACPI_PROCESSOR_OBJECT_HID, },
+       { ACPI_PROCESSOR_DEVICE_HID, },
+
+       { }
+};
+
+static struct acpi_scan_handler __refdata processor_handler = {
+       .ids = processor_device_ids,
+       .attach = acpi_processor_add,
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+       .detach = acpi_processor_remove,
+#endif
+       .hotplug = {
+               .enabled = true,
+       },
+};
+
+void __init acpi_processor_init(void)
+{
+       acpi_scan_add_handler_with_hotplug(&processor_handler, "processor");
+}
index 7ddf29eca9f59f42a9f98bd46c031ae89aa23fe1..438304086ff1bb117f946f79038ff586a80df9c5 100644 (file)
@@ -83,6 +83,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
 acpi-y +=              \
        nsaccess.o      \
        nsalloc.o       \
+       nsarguments.o   \
        nsconvert.o     \
        nsdump.o        \
        nseval.o        \
@@ -137,6 +138,7 @@ acpi-y +=           \
        tbfadt.o        \
        tbfind.o        \
        tbinstal.o      \
+       tbprint.o       \
        tbutils.o       \
        tbxface.o       \
        tbxfload.o      \
@@ -145,11 +147,13 @@ acpi-y +=         \
 acpi-y +=              \
        utaddress.o     \
        utalloc.o       \
+       utbuffer.o      \
        utcopy.o        \
        utexcep.o       \
        utdebug.o       \
        utdecode.o      \
        utdelete.o      \
+       uterror.o       \
        uteval.o        \
        utglobal.o      \
        utids.o         \
index 07160928ca25cced7906412401d46d40b72194be..b8d38117a20c9f5971b719bea11d90017e571d69 100644 (file)
@@ -132,6 +132,12 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
  */
 u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
 
+/*
+ * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
+ * This can be useful for debugging ACPI problems on some machines.
+ */
+u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
+
 /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
 
 struct acpi_table_fadt acpi_gbl_FADT;
index d5bfbd331bfdda124d92a195b3418ae34cfbc2af..dfed26545ba28bb7858ce832fdce823460407992 100644 (file)
@@ -362,23 +362,6 @@ union acpi_predefined_info {
 
 #pragma pack()
 
-/* Data block used during object validation */
-
-struct acpi_predefined_data {
-       char *pathname;
-       const union acpi_predefined_info *predefined;
-       union acpi_operand_object *parent_package;
-       struct acpi_namespace_node *node;
-       u32 flags;
-       u32 return_btype;
-       u8 node_flags;
-};
-
-/* Defines for Flags field above */
-
-#define ACPI_OBJECT_REPAIRED    1
-#define ACPI_OBJECT_WRAPPED     2
-
 /* Return object auto-repair info */
 
 typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
index 53666bd9193d5c566d264275ea7ba38518317ccc..530a2f8c1252da88d0598071b3f32da2bb739f1d 100644 (file)
  * the plist contains a set of parens to allow variable-length lists.
  * These macros are used for both the debug and non-debug versions of the code.
  */
-#define ACPI_ERROR_NAMESPACE(s, e)      acpi_ut_namespace_error (AE_INFO, s, e);
-#define ACPI_ERROR_METHOD(s, n, p, e)   acpi_ut_method_error (AE_INFO, s, n, p, e);
-#define ACPI_WARN_PREDEFINED(plist)     acpi_ut_predefined_warning plist
-#define ACPI_INFO_PREDEFINED(plist)     acpi_ut_predefined_info plist
+#define ACPI_ERROR_NAMESPACE(s, e)          acpi_ut_namespace_error (AE_INFO, s, e);
+#define ACPI_ERROR_METHOD(s, n, p, e)       acpi_ut_method_error (AE_INFO, s, n, p, e);
+#define ACPI_WARN_PREDEFINED(plist)         acpi_ut_predefined_warning plist
+#define ACPI_INFO_PREDEFINED(plist)         acpi_ut_predefined_info plist
+#define ACPI_BIOS_ERROR_PREDEFINED(plist)   acpi_ut_predefined_bios_error plist
 
 #else
 
 #define ACPI_ERROR_METHOD(s, n, p, e)
 #define ACPI_WARN_PREDEFINED(plist)
 #define ACPI_INFO_PREDEFINED(plist)
+#define ACPI_BIOS_ERROR_PREDEFINED(plist)
 
 #endif                         /* ACPI_NO_ERROR_MESSAGES */
 
index d2e491876bc043c64d7bd12d7bdd6d8217497a0a..b83dc32a5ae053eee5a935e30aaedaf0f7b6f3c3 100644 (file)
@@ -223,22 +223,33 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 void acpi_ns_exec_module_code_list(void);
 
 /*
- * nspredef - Support for predefined/reserved names
+ * nsarguments - Argument count/type checking for predefined/reserved names
  */
-acpi_status
-acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
-                              u32 user_param_count,
-                              acpi_status return_status,
-                              union acpi_operand_object **return_object);
+void
+acpi_ns_check_argument_count(char *pathname,
+                            struct acpi_namespace_node *node,
+                            u32 user_param_count,
+                            const union acpi_predefined_info *info);
 
 void
-acpi_ns_check_parameter_count(char *pathname,
+acpi_ns_check_acpi_compliance(char *pathname,
                              struct acpi_namespace_node *node,
-                             u32 user_param_count,
-                             const union acpi_predefined_info *info);
+                             const union acpi_predefined_info *predefined);
+
+void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);
+
+/*
+ * nspredef - Return value checking for predefined/reserved names
+ */
+acpi_status
+acpi_ns_check_return_value(struct acpi_namespace_node *node,
+                          struct acpi_evaluate_info *info,
+                          u32 user_param_count,
+                          acpi_status return_status,
+                          union acpi_operand_object **return_object);
 
 acpi_status
-acpi_ns_check_object_type(struct acpi_predefined_data *data,
+acpi_ns_check_object_type(struct acpi_evaluate_info *info,
                          union acpi_operand_object **return_object_ptr,
                          u32 expected_btypes, u32 package_index);
 
@@ -246,7 +257,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
  * nsprepkg - Validation of predefined name packages
  */
 acpi_status
-acpi_ns_check_package(struct acpi_predefined_data *data,
+acpi_ns_check_package(struct acpi_evaluate_info *info,
                      union acpi_operand_object **return_object_ptr);
 
 /*
@@ -308,24 +319,24 @@ acpi_ns_get_attached_data(struct acpi_namespace_node *node,
  * predefined methods/objects
  */
 acpi_status
-acpi_ns_simple_repair(struct acpi_predefined_data *data,
+acpi_ns_simple_repair(struct acpi_evaluate_info *info,
                      u32 expected_btypes,
                      u32 package_index,
                      union acpi_operand_object **return_object_ptr);
 
 acpi_status
-acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
+acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
                          union acpi_operand_object *original_object,
                          union acpi_operand_object **obj_desc_ptr);
 
 acpi_status
-acpi_ns_repair_null_element(struct acpi_predefined_data *data,
+acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
                            u32 expected_btypes,
                            u32 package_index,
                            union acpi_operand_object **return_object_ptr);
 
 void
-acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
+acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
                             u8 package_type,
                             union acpi_operand_object *obj_desc);
 
@@ -334,7 +345,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  * predefined methods/objects
  */
 acpi_status
-acpi_ns_complex_repairs(struct acpi_predefined_data *data,
+acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
                        struct acpi_namespace_node *node,
                        acpi_status validate_status,
                        union acpi_operand_object **return_object_ptr);
index b22b70944fd63175dc3f8f9876ad37c505948686..f600aded7261cde6762b3fee5d9b9a6a790664b8 100644 (file)
@@ -128,8 +128,8 @@ enum acpi_return_package_types {
 #define ARG_COUNT_IS_MINIMUM            0x8000
 #define METHOD_MAX_ARG_TYPE             ACPI_TYPE_PACKAGE
 
-#define METHOD_GET_COUNT(arg_list)      (arg_list & METHOD_ARG_MASK)
-#define METHOD_GET_NEXT_ARG(arg_list)   (arg_list >> METHOD_ARG_BIT_WIDTH)
+#define METHOD_GET_ARG_COUNT(arg_list)  ((arg_list) & METHOD_ARG_MASK)
+#define METHOD_GET_NEXT_TYPE(arg_list)  (((arg_list) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK)
 
 /* Macros used to build the predefined info table */
 
index 7896d85876cacd534991bf72e4a920ce041947b8..fc83c0a5ca70fe228857d1336d967a91dd0765fa 100644 (file)
@@ -178,25 +178,41 @@ union acpi_aml_operands {
 };
 
 /*
- * Structure used to pass object evaluation parameters.
+ * Structure used to pass object evaluation information and parameters.
  * Purpose is to reduce CPU stack use.
  */
 struct acpi_evaluate_info {
-       struct acpi_namespace_node *prefix_node;
-       char *pathname;
-       union acpi_operand_object *obj_desc;
-       union acpi_operand_object **parameters;
-       struct acpi_namespace_node *resolved_node;
-       union acpi_operand_object *return_object;
-       u8 param_count;
-       u8 pass_number;
-       u8 return_object_type;
-       u8 flags;
+       /* The first 3 elements are passed by the caller to acpi_ns_evaluate */
+
+       struct acpi_namespace_node *prefix_node;        /* Input: starting node */
+       char *relative_pathname;        /* Input: path relative to prefix_node */
+       union acpi_operand_object **parameters; /* Input: argument list */
+
+       struct acpi_namespace_node *node;       /* Resolved node (prefix_node:relative_pathname) */
+       union acpi_operand_object *obj_desc;    /* Object attached to the resolved node */
+       char *full_pathname;    /* Full pathname of the resolved node */
+
+       const union acpi_predefined_info *predefined;   /* Used if Node is a predefined name */
+       union acpi_operand_object *return_object;       /* Object returned from the evaluation */
+       union acpi_operand_object *parent_package;      /* Used if return object is a Package */
+
+       u32 return_flags;       /* Used for return value analysis */
+       u32 return_btype;       /* Bitmapped type of the returned object */
+       u16 param_count;        /* Count of the input argument list */
+       u8 pass_number;         /* Parser pass number */
+       u8 return_object_type;  /* Object type of the returned object */
+       u8 node_flags;          /* Same as Node->Flags */
+       u8 flags;               /* General flags */
 };
 
 /* Values for Flags above */
 
-#define ACPI_IGNORE_RETURN_VALUE        1
+#define ACPI_IGNORE_RETURN_VALUE    1
+
+/* Defines for return_flags field above */
+
+#define ACPI_OBJECT_REPAIRED        1
+#define ACPI_OBJECT_WRAPPED         2
 
 /* Info used by acpi_ns_initialize_devices */
 
index 202f4f12d3e2fad0e6d447a781c559a7bbcad88d..3c76edea6803faf0cf8c7db1b76431b5abafbf04 100644 (file)
@@ -87,6 +87,48 @@ extern const char *acpi_gbl_fc_decode[];
 extern const char *acpi_gbl_pt_decode[];
 #endif
 
+/*
+ * For the iASL compiler case, the output is redirected to stderr so that
+ * any of the various ACPI errors and warnings do not appear in the output
+ * files, for either the compiler or disassembler portions of the tool.
+ */
+#ifdef ACPI_ASL_COMPILER
+
+#include <stdio.h>
+extern FILE *acpi_gbl_output_file;
+
+#define ACPI_MSG_REDIRECT_BEGIN \
+       FILE                            *output_file = acpi_gbl_output_file; \
+       acpi_os_redirect_output (stderr);
+
+#define ACPI_MSG_REDIRECT_END \
+       acpi_os_redirect_output (output_file);
+
+#else
+/*
+ * non-iASL case - no redirection, nothing to do
+ */
+#define ACPI_MSG_REDIRECT_BEGIN
+#define ACPI_MSG_REDIRECT_END
+#endif
+
+/*
+ * Common error message prefixes
+ */
+#define ACPI_MSG_ERROR          "ACPI Error: "
+#define ACPI_MSG_EXCEPTION      "ACPI Exception: "
+#define ACPI_MSG_WARNING        "ACPI Warning: "
+#define ACPI_MSG_INFO           "ACPI: "
+
+#define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Error (bug): "
+#define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Warning (bug): "
+
+/*
+ * Common message suffix
+ */
+#define ACPI_MSG_SUFFIX \
+       acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
+
 /* Types for Resource descriptor entries */
 
 #define ACPI_INVALID_RESOURCE           0
@@ -578,7 +620,7 @@ void acpi_ut_print_string(char *string, u8 max_length);
 
 void ut_convert_backslashes(char *pathname);
 
-u8 acpi_ut_valid_acpi_name(u32 name);
+u8 acpi_ut_valid_acpi_name(char *name);
 
 u8 acpi_ut_valid_acpi_char(char character, u32 position);
 
@@ -670,6 +712,12 @@ acpi_ut_predefined_info(const char *module_name,
                        u32 line_number,
                        char *pathname, u8 node_flags, const char *format, ...);
 
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_predefined_bios_error(const char *module_name,
+                             u32 line_number,
+                             char *pathname,
+                             u8 node_flags, const char *format, ...);
+
 void
 acpi_ut_namespace_error(const char *module_name,
                        u32 line_number,
index 7ea0f162f11ca42e11d7247fc3263d4c1fb0b2e1..eb56b66444b5e3d671572b6290a1245473e7d165 100644 (file)
@@ -78,7 +78,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
 
        switch (op->common.aml_opcode) {
        case AML_WHILE_OP:
-
                /*
                 * If this is an additional iteration of a while loop, continue.
                 * There is no need to allocate a new control state.
@@ -99,7 +98,6 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                /*lint -fallthrough */
 
        case AML_IF_OP:
-
                /*
                 * IF/WHILE: Create a new control state to manage these
                 * constructs. We need to manage these as a stack, in order
@@ -142,6 +140,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
                break;
 
        default:
+
                break;
        }
 
@@ -344,6 +343,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
        case AML_NOOP_OP:
 
                /* Just do nothing! */
+
                break;
 
        case AML_BREAK_POINT_OP:
index feadeed1012dc2256c1596bb79e7ff6190e6cb41..d4bfe7b7f90a54a5b5cdafb8119f0d60698be171 100644 (file)
@@ -563,21 +563,25 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
         */
        switch (walk_state->opcode) {
        case AML_FIELD_OP:
+
                arg = acpi_ps_get_arg(op, 2);
                type = ACPI_TYPE_LOCAL_REGION_FIELD;
                break;
 
        case AML_BANK_FIELD_OP:
+
                arg = acpi_ps_get_arg(op, 4);
                type = ACPI_TYPE_LOCAL_BANK_FIELD;
                break;
 
        case AML_INDEX_FIELD_OP:
+
                arg = acpi_ps_get_arg(op, 3);
                type = ACPI_TYPE_LOCAL_INDEX_FIELD;
                break;
 
        default:
+
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
index bc8e63f7784b96a7bf39c5476dc9cacd07688bb5..14424200d246c8538bcde5070072100528dcf1dd 100644 (file)
@@ -127,6 +127,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
                break;
 
        default:
+
                break;
        }
 
index 3da80460ce38af069241fb59ee41d2aeb695d319..c4b0b365723758fe5181e26eaeaa7cb5314f18d3 100644 (file)
@@ -285,6 +285,7 @@ acpi_ds_method_data_get_node(u8 type,
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Type %u is invalid", type));
                return_ACPI_STATUS(AE_TYPE);
        }
@@ -428,7 +429,6 @@ acpi_ds_method_data_get_value(u8 type,
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
                        case ACPI_REFCLASS_LOCAL:
-
                                /*
                                 * No error message for this case, will be trapped again later to
                                 * detect and ignore cases of Store(local_x,local_x)
index e20e9f84eee80653b6dfc932f140c6eaebf4a5ac..63f0d220ca3d99a2da601b1b4571972bf2f71397 100644 (file)
@@ -648,7 +648,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
        switch (obj_desc->common.type) {
        case ACPI_TYPE_BUFFER:
-
                /*
                 * Defer evaluation of Buffer term_arg operand
                 */
@@ -660,7 +659,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
                break;
 
        case ACPI_TYPE_PACKAGE:
-
                /*
                 * Defer evaluation of Package term_arg operand
                 */
@@ -741,6 +739,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
                        break;
 
                default:
+
                        ACPI_ERROR((AE_INFO, "Unknown Integer type 0x%X",
                                    op_info->type));
                        status = AE_AML_OPERAND_TYPE;
index ee6367b8eaf7afcf6866ff75193e5ca59bfa94f4..1fc1ff114f269867bf1a281e584511c00595d960 100644 (file)
@@ -636,6 +636,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
                break;
 
        default:
+
                return_ACPI_STATUS(AE_AML_BAD_OPCODE);
        }
 
index 99778997c35ab8f1fb5c6249c030c9e48fd35366..c666fc01498795afdb76f6afad8383f75389d1bb 100644 (file)
@@ -240,7 +240,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 
                case AML_IF_OP:
                case AML_WHILE_OP:
-
                        /*
                         * If we are executing the predicate AND this is the predicate op,
                         * we will use the return value
@@ -254,7 +253,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                        break;
 
                default:
+
                        /* Ignore other control opcodes */
+
                        break;
                }
 
@@ -263,7 +264,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                goto result_not_used;
 
        case AML_CLASS_CREATE:
-
                /*
                 * These opcodes allow term_arg(s) as operands and therefore
                 * the operands can be method calls. The result is used.
@@ -292,7 +292,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
                goto result_not_used;
 
        default:
-
                /*
                 * In all other cases. the parent will actually use the return
                 * object, so keep it.
index e2199a9474703196326024af6bbfc0c5460e7201..151d924817e1b2041bfd60cad46aaaf1a5dc9e20 100644 (file)
@@ -327,6 +327,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
                break;
 
        default:
+
                break;
        }
 
@@ -488,7 +489,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
                        break;
 
                case AML_TYPE_METHOD_CALL:
-
                        /*
                         * If the method is referenced from within a package
                         * declaration, it is not a invocation of the method, just
@@ -582,7 +582,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 
                        switch (op->common.parent->common.aml_opcode) {
                        case AML_NAME_OP:
-
                                /*
                                 * Put the Node on the object stack (Contains the ACPI Name
                                 * of this object)
index 6e17c0e24e63ca4e758d1e2a2147419ed5e4b0ec..95e681a36f9c28d820b40f55d211426ae4b2de92 100644 (file)
@@ -74,6 +74,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
 
        switch (pass_number) {
        case 1:
+
                walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
                    ACPI_PARSE_DELETE_TREE;
                walk_state->descending_callback = acpi_ds_load1_begin_op;
@@ -81,6 +82,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
                break;
 
        case 2:
+
                walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
                    ACPI_PARSE_DELETE_TREE;
                walk_state->descending_callback = acpi_ds_load2_begin_op;
@@ -88,6 +90,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
                break;
 
        case 3:
+
 #ifndef ACPI_NO_METHOD_EXECUTION
                walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
                    ACPI_PARSE_DELETE_TREE;
@@ -97,6 +100,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
                break;
 
        default:
+
                return (AE_BAD_PARAMETER);
        }
 
@@ -161,7 +165,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
 
        switch (walk_state->opcode) {
        case AML_SCOPE_OP:
-
                /*
                 * The target name of the Scope() operator must exist at this point so
                 * that we can actually open the scope to enter new names underneath it.
@@ -210,7 +213,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                case ACPI_TYPE_INTEGER:
                case ACPI_TYPE_STRING:
                case ACPI_TYPE_BUFFER:
-
                        /*
                         * These types we will allow, but we will change the type.
                         * This enables some existing code of the form:
@@ -232,7 +234,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
                        break;
 
                case ACPI_TYPE_METHOD:
-
                        /*
                         * Allow scope change to root during execution of module-level
                         * code. Root is typed METHOD during this time.
index 4407ff2377d5918b10fe08875434ed07b981d836..b1f8f4725c230b0d6b0bf9155f13028f42d62667 100644 (file)
@@ -509,6 +509,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                        break;
 
                default:
+
                        /* All NAMED_FIELD opcodes must be handled above */
                        break;
                }
@@ -548,6 +549,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                        break;
 
                default:
+
                        /* Unknown opcode */
 
                        status = AE_OK;
@@ -674,6 +676,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
 #endif                         /* ACPI_NO_METHOD_EXECUTION */
 
                default:
+
                        /* All NAMED_COMPLEX opcodes must be handled above */
                        break;
                }
@@ -721,6 +724,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
                break;
 
        default:
+
                break;
        }
 
index a621481c6cf27f946a6050f5ef9f6ea466b51689..fdb0a76e40a3020806cfce8c4e637273e2fc4f2c 100644 (file)
@@ -128,6 +128,7 @@ acpi_status acpi_ev_remove_global_lock_handler(void)
        status = acpi_remove_fixed_event_handler(ACPI_EVENT_GLOBAL,
                                                 acpi_ev_global_lock_handler);
 
+       acpi_os_delete_lock(acpi_gbl_global_lock_pending_lock);
        return_ACPI_STATUS(status);
 }
 
index a493b528f8f9f3c5a88b13ed685befdbc07c9e13..c8a1f7d5931f518b004cc8311d31e5ad8e5cdaeb 100644 (file)
@@ -529,7 +529,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 
        switch (local_gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) {
        case ACPI_GPE_DISPATCH_NOTIFY:
-
                /*
                 * Implicit notify.
                 * Dispatch a DEVICE_WAKE notify to the appropriate handler.
@@ -579,11 +578,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
                                        (local_gpe_event_info->dispatch.
                                         method_node)));
                }
-
                break;
 
        default:
-               return_VOID;    /* Should never happen */
+
+               return_VOID;    /* Should never happen */
        }
 
        /* Defer enabling of GPE until all notify handlers are done */
@@ -755,7 +754,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
 
        case ACPI_GPE_DISPATCH_METHOD:
        case ACPI_GPE_DISPATCH_NOTIFY:
-
                /*
                 * Execute the method associated with the GPE
                 * NOTE: Level-triggered GPEs are cleared after the method completes.
@@ -771,7 +769,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
                break;
 
        default:
-
                /*
                 * No handler or method to run!
                 * 03/2010: This case should no longer be possible. We will not allow
index a2d688bbac02c7ee96e43b5764f97442c1dd2a6f..c1aa1eda26c32ec73dc68ac6d5433d783383348b 100644 (file)
@@ -382,6 +382,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
 
        status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
        if (ACPI_FAILURE(status)) {
+               ACPI_FREE(gpe_block->register_info);
+               ACPI_FREE(gpe_block->event_info);
                ACPI_FREE(gpe_block);
                return_ACPI_STATUS(status);
        }
index 72b8f6b3f4cafeac10eee0bacfa2af5c1851f281..9037f17c9608f70a6bc2df68eca5b55043ad9723 100644 (file)
@@ -363,14 +363,17 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
         */
        switch (name[1]) {
        case 'L':
+
                type = ACPI_GPE_LEVEL_TRIGGERED;
                break;
 
        case 'E':
+
                type = ACPI_GPE_EDGE_TRIGGERED;
                break;
 
        default:
+
                /* Unknown method type, just ignore it */
 
                ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
index d4f83112c2e266ff2fcf5f8415d9714ffa071330..068af96134b89787a739cce281f481db82e46e19 100644 (file)
@@ -354,36 +354,43 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
 
                switch (space_id) {
                case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+
                        handler = acpi_ex_system_memory_space_handler;
                        setup = acpi_ev_system_memory_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_SYSTEM_IO:
+
                        handler = acpi_ex_system_io_space_handler;
                        setup = acpi_ev_io_space_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_PCI_CONFIG:
+
                        handler = acpi_ex_pci_config_space_handler;
                        setup = acpi_ev_pci_config_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_CMOS:
+
                        handler = acpi_ex_cmos_space_handler;
                        setup = acpi_ev_cmos_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_PCI_BAR_TARGET:
+
                        handler = acpi_ex_pci_bar_space_handler;
                        setup = acpi_ev_pci_bar_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_DATA_TABLE:
+
                        handler = acpi_ex_data_table_space_handler;
                        setup = NULL;
                        break;
 
                default:
+
                        status = AE_BAD_PARAMETER;
                        goto unlock_and_exit;
                }
index c986b2336b81d6b1b85e60ee4e2e9568e2750a33..1b111ef74903771f8f9a8f690aef85b752f65c61 100644 (file)
@@ -78,6 +78,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
                return (TRUE);
 
        default:
+
                return (FALSE);
        }
 }
@@ -275,6 +276,8 @@ void acpi_ev_terminate(void)
                        ACPI_ERROR((AE_INFO,
                                    "Could not remove Global Lock handler"));
                }
+
+               acpi_gbl_events_initialized = FALSE;
        }
 
        /* Deallocate all handler objects installed within GPE info structs */
index 6555e350fc1fe21087cea7e219a9c4b170d70e25..cea14d6fc76c976db580144f93d28d890ff3938f 100644 (file)
@@ -54,7 +54,8 @@ extern u8 acpi_gbl_default_address_spaces[];
 
 /* Local prototypes */
 
-static void acpi_ev_orphan_ec_reg_method(void);
+static void
+acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node);
 
 static acpi_status
 acpi_ev_reg_run(acpi_handle obj_handle,
@@ -532,7 +533,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
        }
 
        info->prefix_node = region_obj2->extra.method_REG;
-       info->pathname = NULL;
+       info->relative_pathname = NULL;
        info->parameters = args;
        info->flags = ACPI_IGNORE_RETURN_VALUE;
 
@@ -612,7 +613,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
        /* Special case for EC: handle "orphan" _REG methods with no region */
 
        if (space_id == ACPI_ADR_SPACE_EC) {
-               acpi_ev_orphan_ec_reg_method();
+               acpi_ev_orphan_ec_reg_method(node);
        }
 
        return_ACPI_STATUS(status);
@@ -681,7 +682,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
  *
  * FUNCTION:    acpi_ev_orphan_ec_reg_method
  *
- * PARAMETERS:  None
+ * PARAMETERS:  ec_device_node      - Namespace node for an EC device
  *
  * RETURN:      None
  *
@@ -693,37 +694,27 @@ acpi_ev_reg_run(acpi_handle obj_handle,
  *              detected by providing a _REG method object underneath the
  *              Embedded Controller device."
  *
- *              To quickly access the EC device, we use the EC_ID that appears
- *              within the ECDT. Otherwise, we would need to perform a time-
- *              consuming namespace walk, executing _HID methods to find the
- *              EC device.
+ *              To quickly access the EC device, we use the ec_device_node used
+ *              during EC handler installation. Otherwise, we would need to
+ *              perform a time consuming namespace walk, executing _HID
+ *              methods to find the EC device.
+ *
+ *  MUTEX:      Assumes the namespace is locked
  *
  ******************************************************************************/
 
-static void acpi_ev_orphan_ec_reg_method(void)
+static void
+acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node)
 {
-       struct acpi_table_ecdt *table;
+       acpi_handle reg_method;
+       struct acpi_namespace_node *next_node;
        acpi_status status;
        struct acpi_object_list args;
        union acpi_object objects[2];
-       struct acpi_namespace_node *ec_device_node;
-       struct acpi_namespace_node *reg_method;
-       struct acpi_namespace_node *next_node;
 
        ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method);
 
-       /* Get the ECDT (if present in system) */
-
-       status = acpi_get_table(ACPI_SIG_ECDT, 0,
-                               ACPI_CAST_INDIRECT_PTR(struct acpi_table_header,
-                                                      &table));
-       if (ACPI_FAILURE(status)) {
-               return_VOID;
-       }
-
-       /* We need a valid EC_ID string */
-
-       if (!(*table->id)) {
+       if (!ec_device_node) {
                return_VOID;
        }
 
@@ -731,22 +722,11 @@ static void acpi_ev_orphan_ec_reg_method(void)
 
        (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-       /* Get a handle to the EC device referenced in the ECDT */
-
-       status = acpi_get_handle(NULL,
-                                ACPI_CAST_PTR(char, table->id),
-                                ACPI_CAST_PTR(acpi_handle, &ec_device_node));
-       if (ACPI_FAILURE(status)) {
-               goto exit;
-       }
-
        /* Get a handle to a _REG method immediately under the EC device */
 
-       status = acpi_get_handle(ec_device_node,
-                                METHOD_NAME__REG, ACPI_CAST_PTR(acpi_handle,
-                                                                &reg_method));
+       status = acpi_get_handle(ec_device_node, METHOD_NAME__REG, &reg_method);
        if (ACPI_FAILURE(status)) {
-               goto exit;
+               goto exit;      /* There is no _REG method present */
        }
 
        /*
@@ -754,19 +734,20 @@ static void acpi_ev_orphan_ec_reg_method(void)
         * this scope with the Embedded Controller space ID. Otherwise, it
         * will already have been executed. Note, this allows for Regions
         * with other space IDs to be present; but the code below will then
-        * execute the _REG method with the EC space ID argument.
+        * execute the _REG method with the embedded_control space_ID argument.
         */
        next_node = acpi_ns_get_next_node(ec_device_node, NULL);
        while (next_node) {
                if ((next_node->type == ACPI_TYPE_REGION) &&
                    (next_node->object) &&
                    (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) {
-                       goto exit;      /* Do not execute _REG */
+                       goto exit;      /* Do not execute the _REG */
                }
+
                next_node = acpi_ns_get_next_node(ec_device_node, next_node);
        }
 
-       /* Evaluate the _REG(EC,Connect) method */
+       /* Evaluate the _REG(embedded_control,Connect) method */
 
        args.count = 2;
        args.pointer = objects;
index 3bb616794b3b46fe5aaaaa7b77335523b351b159..8354c4f7f10c55c604765a92020abd2d30547de9 100644 (file)
@@ -596,7 +596,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
                                break;
 
                        default:
+
                                /* Ignore other objects */
+
                                break;
                        }
 
index aff4cc2612115304f41ea11a6aa57a5038a6f101..7662f1a42ff6bb19513e0f9272f90c921f64ec90 100644 (file)
@@ -366,16 +366,19 @@ acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
 
        switch (action) {
        case ACPI_GPE_ENABLE:
+
                ACPI_SET_BIT(gpe_register_info->enable_for_wake,
                             (u8)register_bit);
                break;
 
        case ACPI_GPE_DISABLE:
+
                ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
                               (u8)register_bit);
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "%u, Invalid action", action));
                status = AE_BAD_PARAMETER;
                break;
index 96c9e5f355aed40f7e07fc598d60b61907c501a6..80cecf8385917c7ed32ca75eb9afc807dbb6b0b2 100644 (file)
@@ -139,6 +139,7 @@ acpi_install_address_space_handler(acpi_handle device,
                break;
 
        default:
+
                break;
        }
 
index d93b70be60adf071c132687b208241d233bb4f3a..06d216c8d43ab18edc0fb1f66def077014b2aa3f 100644 (file)
@@ -480,6 +480,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
                break;
 
        default:
+
                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
@@ -588,7 +589,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
            (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
            (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE) ||
            (!(ddb_handle->common.flags & AOPOBJ_DATA_VALID))) {
-               return_ACPI_STATUS(AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /* Get the table index from the ddb_handle */
index d2b9613bbf01d231e72f44d87381e83ab87f11e4..69e4a8cc9b71728f98b1aad402a0a44538033457 100644 (file)
@@ -99,6 +99,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
                break;
 
        default:
+
                return_ACPI_STATUS(AE_TYPE);
        }
 
@@ -117,7 +118,6 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
 
        switch (obj_desc->common.type) {
        case ACPI_TYPE_STRING:
-
                /*
                 * Convert string to an integer - for most cases, the string must be
                 * hexadecimal as per the ACPI specification. The only exception (as
@@ -161,6 +161,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
        default:
 
                /* No other types can get here */
+
                break;
        }
 
@@ -213,7 +214,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
                return_ACPI_STATUS(AE_OK);
 
        case ACPI_TYPE_INTEGER:
-
                /*
                 * Create a new Buffer object.
                 * Need enough space for one integer
@@ -233,7 +233,6 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
                break;
 
        case ACPI_TYPE_STRING:
-
                /*
                 * Create a new Buffer object
                 * Size will be the string length
@@ -258,6 +257,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
                break;
 
        default:
+
                return_ACPI_STATUS(AE_TYPE);
        }
 
@@ -304,15 +304,18 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width)
 
                switch (data_width) {
                case 1:
+
                        decimal_length = ACPI_MAX8_DECIMAL_DIGITS;
                        break;
 
                case 4:
+
                        decimal_length = ACPI_MAX32_DECIMAL_DIGITS;
                        break;
 
                case 8:
                default:
+
                        decimal_length = ACPI_MAX64_DECIMAL_DIGITS;
                        break;
                }
@@ -546,6 +549,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                break;
 
        default:
+
                return_ACPI_STATUS(AE_TYPE);
        }
 
@@ -599,6 +603,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
                        break;
 
                default:
+
                        /* No conversion allowed for these types */
 
                        if (destination_type != source_desc->common.type) {
@@ -649,6 +654,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
                        break;
 
                default:
+
                        ACPI_ERROR((AE_INFO,
                                    "Bad destination type during conversion: 0x%X",
                                    destination_type));
@@ -664,6 +670,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO,
                            "Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
                            GET_CURRENT_ARG_TYPE(walk_state->op_info->
index 26a13f67977ea11248cc54ec9f034ecf1a584e45..269e81d86ef41c59e7eaa3d61bb7c63ba23457bd 100644 (file)
@@ -103,7 +103,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
        case ACPI_TYPE_BUFFER:
        case ACPI_TYPE_PACKAGE:
        case ACPI_TYPE_BUFFER_FIELD:
-
                /*
                 * These types open a new scope, so we need the NS node in order to access
                 * any children.
@@ -113,7 +112,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_THERMAL:
        case ACPI_TYPE_LOCAL_SCOPE:
-
                /*
                 * The new alias has the type ALIAS and points to the original
                 * NS node, not the object itself.
@@ -124,7 +122,6 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
                break;
 
        case ACPI_TYPE_METHOD:
-
                /*
                 * Control method aliases need to be differentiated
                 */
index 7eb853cd279f776f5b384543dba38fdedfafff38..81c72a4ecd823eaca8542135aea5396d7d6d5626 100644 (file)
@@ -193,6 +193,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
                        return_VOID;
 
                default:
+
                        break;
                }
 
@@ -226,6 +227,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
                                        break;
 
                                default:
+
                                        acpi_ex_do_debug_object((source_desc->
                                                                 reference.
                                                                 node)->object,
index e5a3c249f7fad23c544a856504d13d33134c104e..c740f24e3101069af922a5e5842a77fb60d34710 100644 (file)
@@ -357,6 +357,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
 
                switch (info->opcode) {
                case ACPI_EXD_INIT:
+
                        break;
 
                case ACPI_EXD_TYPE:
@@ -718,6 +719,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
                break;
 
        default:
+
                /* Unknown Type */
 
                acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
index 7d4bae71e8c62da6399bc6af7e0f3fd132efa574..c2a65aaf29af006f3be629aab6b9f6b698650b40 100644 (file)
@@ -331,21 +331,25 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
 
        switch (source_desc->common.type) {
        case ACPI_TYPE_INTEGER:
+
                buffer = &source_desc->integer.value;
                length = sizeof(source_desc->integer.value);
                break;
 
        case ACPI_TYPE_BUFFER:
+
                buffer = source_desc->buffer.pointer;
                length = source_desc->buffer.length;
                break;
 
        case ACPI_TYPE_STRING:
+
                buffer = source_desc->string.pointer;
                length = source_desc->string.length;
                break;
 
        default:
+
                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
index c84ee956fa4c58f50c8849cc660a151d46febe39..7e0afe72487ea73ee5504d73891b294b83aceb91 100644 (file)
@@ -446,7 +446,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                break;
 
        case ACPI_TYPE_LOCAL_BANK_FIELD:
-
                /*
                 * Ensure that the bank_value is not beyond the capacity of
                 * the register
@@ -488,7 +487,6 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
                break;
 
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
                /*
                 * Ensure that the index_value is not beyond the capacity of
                 * the register
index 72a2a13b6d36de72eb97cf7d38aacb0cada1587b..00bf298775741763054eabd2d3030dcb6494e150 100644 (file)
@@ -105,7 +105,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
                break;
 
        case ACPI_DESC_TYPE_NAMED:
-
                /*
                 * A named reference that has already been resolved to a Node
                 */
@@ -261,20 +260,24 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
         */
        switch (operand0->common.type) {
        case ACPI_TYPE_INTEGER:
+
                status =
                    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
                break;
 
        case ACPI_TYPE_STRING:
+
                status = acpi_ex_convert_to_string(operand1, &local_operand1,
                                                   ACPI_IMPLICIT_CONVERT_HEX);
                break;
 
        case ACPI_TYPE_BUFFER:
+
                status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
                            operand0->common.type));
                status = AE_AML_INTERNAL;
@@ -519,6 +522,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
                break;
 
        default:
+
                status = AE_AML_INTERNAL;
                break;
        }
@@ -580,20 +584,24 @@ acpi_ex_do_logical_op(u16 opcode,
         */
        switch (operand0->common.type) {
        case ACPI_TYPE_INTEGER:
+
                status =
                    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
                break;
 
        case ACPI_TYPE_STRING:
+
                status = acpi_ex_convert_to_string(operand1, &local_operand1,
                                                   ACPI_IMPLICIT_CONVERT_HEX);
                break;
 
        case ACPI_TYPE_BUFFER:
+
                status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
                break;
 
        default:
+
                status = AE_AML_INTERNAL;
                break;
        }
@@ -636,6 +644,7 @@ acpi_ex_do_logical_op(u16 opcode,
                        break;
 
                default:
+
                        status = AE_AML_INTERNAL;
                        break;
                }
@@ -703,6 +712,7 @@ acpi_ex_do_logical_op(u16 opcode,
                        break;
 
                default:
+
                        status = AE_AML_INTERNAL;
                        break;
                }
index b60c877f5906d9d8b7d00d9a022d3105f4aa2c2a..814b4a3d656ad1dc3d9acf438258735569017656 100644 (file)
@@ -327,7 +327,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                        break;
 
                case AML_FROM_BCD_OP:   /* from_bcd (BCDValue, Result) */
-
                        /*
                         * The 64-bit ACPI integer can hold 16 4-bit BCD characters
                         * (if table is 32-bit, integer can hold 8 BCD characters)
@@ -407,7 +406,6 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                        break;
 
                case AML_COND_REF_OF_OP:        /* cond_ref_of (source_object, Result) */
-
                        /*
                         * This op is a little strange because the internal return value is
                         * different than the return value stored in the result descriptor
@@ -442,13 +440,14 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
                        goto cleanup;
 
                default:
+
                        /* No other opcodes get here */
+
                        break;
                }
                break;
 
        case AML_STORE_OP:      /* Store (Source, Target) */
-
                /*
                 * A store operand is typically a number, string, buffer or lvalue
                 * Be careful about deleting the source object,
@@ -615,7 +614,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
        case AML_DECREMENT_OP:  /* Decrement (Operand)  */
        case AML_INCREMENT_OP:  /* Increment (Operand)  */
-
                /*
                 * Create a new integer. Can't just get the base integer and
                 * increment it because it may be an Arg or Field.
@@ -682,7 +680,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                break;
 
        case AML_TYPE_OP:       /* object_type (source_object) */
-
                /*
                 * Note: The operand is not resolved at this point because we want to
                 * get the associated object, not its value. For example, we don't
@@ -709,7 +706,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                break;
 
        case AML_SIZE_OF_OP:    /* size_of (source_object) */
-
                /*
                 * Note: The operand is not resolved at this point because we want to
                 * get the associated object, not its value.
@@ -735,10 +731,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                 */
                switch (type) {
                case ACPI_TYPE_INTEGER:
+
                        value = acpi_gbl_integer_byte_width;
                        break;
 
                case ACPI_TYPE_STRING:
+
                        value = temp_desc->string.length;
                        break;
 
@@ -759,6 +757,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                        break;
 
                default:
+
                        ACPI_ERROR((AE_INFO,
                                    "Operand must be Buffer/Integer/String/Package - found type %s",
                                    acpi_ut_get_type_name(type)));
@@ -860,9 +859,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                break;
 
                        case ACPI_TYPE_STRING:
+
                                break;
 
                        default:
+
                                status = AE_AML_OPERAND_TYPE;
                                goto cleanup;
                        }
@@ -923,7 +924,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                         */
                        switch (operand[0]->reference.class) {
                        case ACPI_REFCLASS_INDEX:
-
                                /*
                                 * The target type for the Index operator must be
                                 * either a Buffer or a Package
@@ -956,7 +956,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                        break;
 
                                case ACPI_TYPE_PACKAGE:
-
                                        /*
                                         * Return the referenced element of the package. We must
                                         * add another reference to the referenced object, however.
@@ -999,6 +998,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                break;
 
                        default:
+
                                ACPI_ERROR((AE_INFO,
                                            "Unknown class in reference(%p) - 0x%2.2X",
                                            operand[0],
index b0838a4ea53e6fc70cb9b57a8b3fc2fab1b2bce7..d5088f7030c753fb9e36b78b25d894e2c48cf74c 100644 (file)
@@ -304,7 +304,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
                break;
 
        case AML_TO_STRING_OP:  /* to_string (Buffer, Length, Result) (ACPI 2.0) */
-
                /*
                 * Input object is guaranteed to be a buffer at this point (it may have
                 * been converted.)  Copy the raw buffer data to a new object of
index 2d7491f3126ef906ee6e589494f7936f20885166..37656f12f204bcd3b12ae6c1d8384eb392990e1a 100644 (file)
@@ -155,7 +155,6 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
        switch (walk_state->opcode) {
        case AML_MID_OP:        /* Mid (Source[0], Index[1], Length[2], Result[3]) */
-
                /*
                 * Create the return object. The Source operand is guaranteed to be
                 * either a String or a Buffer, so just use its type.
index b76b97002dffd1701741b5fe18031f3104580dfb..879b6cd8319cdc09023e3852da1efe1b51f84282 100644 (file)
@@ -119,7 +119,6 @@ acpi_ex_do_match(u32 match_op,
                break;
 
        case MATCH_MEQ:
-
                /*
                 * True if equal: (P[i] == M)
                 * Change to:     (M == P[i])
@@ -133,7 +132,6 @@ acpi_ex_do_match(u32 match_op,
                break;
 
        case MATCH_MLE:
-
                /*
                 * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
                 * Change to:                  (M >= P[i]) (M not_less than P[i])
@@ -148,7 +146,6 @@ acpi_ex_do_match(u32 match_op,
                break;
 
        case MATCH_MLT:
-
                /*
                 * True if less than: (P[i] < M)
                 * Change to:         (M > P[i])
@@ -162,7 +159,6 @@ acpi_ex_do_match(u32 match_op,
                break;
 
        case MATCH_MGE:
-
                /*
                 * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
                 * Change to:                     (M <= P[i]) (M not_greater than P[i])
@@ -177,7 +173,6 @@ acpi_ex_do_match(u32 match_op,
                break;
 
        case MATCH_MGT:
-
                /*
                 * True if greater than: (P[i] > M)
                 * Change to:            (M < P[i])
index 6b728aef2dcab54804d11509e23660b06e11d21e..5a588611ab484f12e33966fcbdf4ce2a03ffdc4e 100644 (file)
@@ -253,26 +253,31 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
 
        case AML_FIELD_ACCESS_BYTE:
        case AML_FIELD_ACCESS_BUFFER:   /* ACPI 2.0 (SMBus Buffer) */
+
                byte_alignment = 1;
                bit_length = 8;
                break;
 
        case AML_FIELD_ACCESS_WORD:
+
                byte_alignment = 2;
                bit_length = 16;
                break;
 
        case AML_FIELD_ACCESS_DWORD:
+
                byte_alignment = 4;
                bit_length = 32;
                break;
 
        case AML_FIELD_ACCESS_QWORD:    /* ACPI 2.0 */
+
                byte_alignment = 8;
                bit_length = 64;
                break;
 
        default:
+
                /* Invalid field access type */
 
                ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
@@ -598,7 +603,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                break;
 
        default:
+
                /* No other types should get here */
+
                break;
        }
 
index 182abaf045e165588606bd4a52de7c98413717c1..303429bb4d5d6631878878a872b3f0c46f82f390 100644 (file)
@@ -88,22 +88,27 @@ acpi_ex_system_memory_space_handler(u32 function,
 
        switch (bit_width) {
        case 8:
+
                length = 1;
                break;
 
        case 16:
+
                length = 2;
                break;
 
        case 32:
+
                length = 4;
                break;
 
        case 64:
+
                length = 8;
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %u",
                            bit_width));
                return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
@@ -214,23 +219,29 @@ acpi_ex_system_memory_space_handler(u32 function,
                *value = 0;
                switch (bit_width) {
                case 8:
-                       *value = (u64) ACPI_GET8(logical_addr_ptr);
+
+                       *value = (u64)ACPI_GET8(logical_addr_ptr);
                        break;
 
                case 16:
-                       *value = (u64) ACPI_GET16(logical_addr_ptr);
+
+                       *value = (u64)ACPI_GET16(logical_addr_ptr);
                        break;
 
                case 32:
-                       *value = (u64) ACPI_GET32(logical_addr_ptr);
+
+                       *value = (u64)ACPI_GET32(logical_addr_ptr);
                        break;
 
                case 64:
-                       *value = (u64) ACPI_GET64(logical_addr_ptr);
+
+                       *value = (u64)ACPI_GET64(logical_addr_ptr);
                        break;
 
                default:
+
                        /* bit_width was already validated */
+
                        break;
                }
                break;
@@ -239,28 +250,35 @@ acpi_ex_system_memory_space_handler(u32 function,
 
                switch (bit_width) {
                case 8:
+
                        ACPI_SET8(logical_addr_ptr, *value);
                        break;
 
                case 16:
+
                        ACPI_SET16(logical_addr_ptr, *value);
                        break;
 
                case 32:
+
                        ACPI_SET32(logical_addr_ptr, *value);
                        break;
 
                case 64:
+
                        ACPI_SET64(logical_addr_ptr, *value);
                        break;
 
                default:
+
                        /* bit_width was already validated */
+
                        break;
                }
                break;
 
        default:
+
                status = AE_BAD_PARAMETER;
                break;
        }
@@ -320,6 +338,7 @@ acpi_ex_system_io_space_handler(u32 function,
                break;
 
        default:
+
                status = AE_BAD_PARAMETER;
                break;
        }
index 8565b6bd12bb41a886aa8ad94d9355dd74d3a942..acd34f5993131d573aa6bcdf6046e7dd34afad12 100644 (file)
@@ -248,6 +248,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
                        break;
 
                default:
+
                        /* No named references are allowed here */
 
                        ACPI_ERROR((AE_INFO,
index e4f9dfbb2a13f737e37e65bba8d374a7e673a987..ac04278ad28f00294d6fc7a3034795bcbb1c0bfb 100644 (file)
@@ -156,7 +156,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                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
@@ -309,6 +308,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                break;
 
        default:
+
                break;
        }
 
@@ -348,10 +348,12 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
 
        switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
        case ACPI_DESC_TYPE_OPERAND:
+
                type = obj_desc->common.type;
                break;
 
        case ACPI_DESC_TYPE_NAMED:
+
                type = ((struct acpi_namespace_node *)obj_desc)->type;
                obj_desc =
                    acpi_ns_get_attached_object((struct acpi_namespace_node *)
@@ -538,7 +540,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                break;
 
        default:
+
                /* No change to Type required */
+
                break;
        }
 
index 9fb9f5e9a4daefe2f3a477eeb222d6ba1e560719..00e5af7129c1234338e4c5f0aeddcde5941ce94d 100644 (file)
@@ -307,7 +307,6 @@ acpi_ex_resolve_operands(u16 opcode,
                case ARGI_TARGETREF:    /* Allows implicit conversion rules before store */
                case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
                case ARGI_SIMPLE_TARGET:        /* Name, Local, or arg - no implicit conversion  */
-
                        /*
                         * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
                         * A Namespace Node is OK as-is
@@ -326,7 +325,6 @@ acpi_ex_resolve_operands(u16 opcode,
                        goto next_operand;
 
                case ARGI_DATAREFOBJ:   /* Store operator only */
-
                        /*
                         * We don't want to resolve index_op reference objects during
                         * a store because this would be an implicit de_ref_of operation.
@@ -343,7 +341,9 @@ acpi_ex_resolve_operands(u16 opcode,
                        break;
 
                default:
+
                        /* All cases covered above */
+
                        break;
                }
 
@@ -433,7 +433,6 @@ acpi_ex_resolve_operands(u16 opcode,
                        goto next_operand;
 
                case ARGI_BUFFER:
-
                        /*
                         * Need an operand of type ACPI_TYPE_BUFFER,
                         * But we can implicitly convert from a STRING or INTEGER
@@ -459,7 +458,6 @@ acpi_ex_resolve_operands(u16 opcode,
                        goto next_operand;
 
                case ARGI_STRING:
-
                        /*
                         * Need an operand of type ACPI_TYPE_STRING,
                         * But we can implicitly convert from a BUFFER or INTEGER
@@ -562,6 +560,7 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
+
                                ACPI_ERROR((AE_INFO,
                                            "Needed [Buffer/String/Package/Reference], found [%s] %p",
                                            acpi_ut_get_object_type_name
@@ -584,6 +583,7 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
+
                                ACPI_ERROR((AE_INFO,
                                            "Needed [Buffer/String/Package], found [%s] %p",
                                            acpi_ut_get_object_type_name
@@ -605,6 +605,7 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
+
                                ACPI_ERROR((AE_INFO,
                                            "Needed [Region/Buffer], found [%s] %p",
                                            acpi_ut_get_object_type_name
index 93c6049c2d754d3e621729599510344e2d06d7dc..2bdba6f7d7620c43a8f6dafcbe83d5a14679f8b4 100644 (file)
@@ -114,6 +114,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
 
        switch (dest_desc->common.type) {
        case ACPI_TYPE_LOCAL_REFERENCE:
+
                break;
 
        case ACPI_TYPE_INTEGER:
@@ -178,7 +179,6 @@ acpi_ex_store(union acpi_operand_object *source_desc,
                break;
 
        case ACPI_REFCLASS_DEBUG:
-
                /*
                 * Storing to the Debug object causes the value stored to be
                 * displayed and otherwise has no effect -- see ACPI Specification
@@ -291,7 +291,6 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
                break;
 
        case ACPI_TYPE_BUFFER_FIELD:
-
                /*
                 * Store into a Buffer or String (not actually a real buffer_field)
                 * at a location defined by an Index.
@@ -447,7 +446,6 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
        case ACPI_TYPE_INTEGER:
        case ACPI_TYPE_STRING:
        case ACPI_TYPE_BUFFER:
-
                /*
                 * These target types are all of type Integer/String/Buffer, and
                 * therefore support implicit conversion before the store.
index 1cefe777068eef26b2d66851418c7992ede3244a..20d809d90c5b8f113e7b0f3c56fcafa58893dda2 100644 (file)
@@ -85,11 +85,9 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
                 * These cases all require only Integers or values that
                 * can be converted to Integers (Strings or Buffers)
                 */
-
        case ACPI_TYPE_INTEGER:
        case ACPI_TYPE_STRING:
        case ACPI_TYPE_BUFFER:
-
                /*
                 * Stores into a Field/Region or into a Integer/Buffer/String
                 * are all essentially the same. This case handles the
@@ -133,7 +131,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
 
        case ACPI_TYPE_LOCAL_ALIAS:
        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
-
                /*
                 * All aliases should have been resolved earlier, during the
                 * operand resolution phase.
@@ -144,7 +141,6 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
 
        case ACPI_TYPE_PACKAGE:
        default:
-
                /*
                 * All other types than Alias and the various Fields come here,
                 * including the untyped case - ACPI_TYPE_ANY.
index 579c3a53ac87ede953e7610dab23f1270c6bafcc..3d36df828f520b1c196783453905c3f05f34543c 100644 (file)
@@ -108,7 +108,6 @@ acpi_status acpi_hw_set_mode(u32 mode)
                break;
 
        case ACPI_SYS_MODE_LEGACY:
-
                /*
                 * BIOS should clear all fixed status bits and restore fixed event
                 * enable bits to default
@@ -120,6 +119,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
                break;
 
        default:
+
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
index 20d02e93c99021e10038849b5290d77e360b55fc..96540506058fcc94351e2980feab2adf990d9ad6 100644 (file)
@@ -127,14 +127,17 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
                /*lint -fallthrough */
 
        case ACPI_GPE_ENABLE:
+
                ACPI_SET_BIT(enable_mask, register_bit);
                break;
 
        case ACPI_GPE_DISABLE:
+
                ACPI_CLEAR_BIT(enable_mask, register_bit);
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Invalid GPE Action, %u", action));
                return (AE_BAD_PARAMETER);
        }
index 083d6551f0e2b2db97020d6e0ecc4e9d7ed85211..8d2e866be15f84a301183cf5690205785ec4f2ea 100644 (file)
@@ -419,6 +419,7 @@ acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value)
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
                status = AE_BAD_PARAMETER;
                break;
@@ -491,7 +492,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
                break;
 
        case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
-
                /*
                 * Perform a read first to preserve certain bits (per ACPI spec)
                 * Note: This includes SCI_EN, we never want to change this bit
@@ -520,7 +520,6 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
                break;
 
        case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
-
                /*
                 * For control registers, all reserved bits must be preserved,
                 * as per the ACPI spec.
@@ -555,6 +554,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
                break;
 
        default:
+
                ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
                status = AE_BAD_PARAMETER;
                break;
index 04c2e16f2c0a6ef86ab734cd309cfb1ce41d49db..5ee7a814cd9207db34d42b8945867e415ab733bb 100644 (file)
@@ -495,7 +495,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
         * Evaluate the \_Sx namespace object containing the register values
         * for this state
         */
-       info->pathname =
+       info->relative_pathname =
            ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
        status = acpi_ns_evaluate(info);
        if (ACPI_FAILURE(status)) {
@@ -506,7 +506,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 
        if (!info->return_object) {
                ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
-                           info->pathname));
+                           info->relative_pathname));
                status = AE_AML_NO_RETURN_VALUE;
                goto cleanup;
        }
@@ -528,10 +528,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
        elements = info->return_object->package.elements;
        switch (info->return_object->package.count) {
        case 0:
+
                status = AE_AML_PACKAGE_LIMIT;
                break;
 
        case 1:
+
                if (elements[0]->common.type != ACPI_TYPE_INTEGER) {
                        status = AE_AML_OPERAND_TYPE;
                        break;
@@ -545,6 +547,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 
        case 2:
        default:
+
                if ((elements[0]->common.type != ACPI_TYPE_INTEGER) ||
                    (elements[1]->common.type != ACPI_TYPE_INTEGER)) {
                        status = AE_AML_OPERAND_TYPE;
@@ -565,7 +568,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status,
                                "While evaluating Sleep State [%s]",
-                               info->pathname));
+                               info->relative_pathname));
        }
 
        ACPI_FREE(info);
index 35eebdac0f9d1e02976d382376005abbe4a870a5..f2e669db8b65e90deddae8ee64a1e2b8ed3bfb39 100644 (file)
@@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
            &acpi_sleep_dispatch[function_id];
 
 #if (!ACPI_REDUCED_HARDWARE)
-
        /*
         * If the Hardware Reduced flag is set (from the FADT), we must
-        * use the extended sleep registers
+        * use the extended sleep registers (FADT). Note: As per the ACPI
+        * specification, these extended registers are to be used for HW-reduced
+        * platforms only. They are not general-purpose replacements for the
+        * legacy PM register sleep support.
         */
-       if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
+       if (acpi_gbl_reduced_hardware) {
                status = sleep_functions->extended_function(sleep_state);
        } else {
                /* Legacy sleep */
@@ -314,20 +316,24 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
 
        switch (sleep_state) {
        case ACPI_STATE_S0:
+
                sst_value = ACPI_SST_WORKING;
                break;
 
        case ACPI_STATE_S1:
        case ACPI_STATE_S2:
        case ACPI_STATE_S3:
+
                sst_value = ACPI_SST_SLEEPING;
                break;
 
        case ACPI_STATE_S4:
+
                sst_value = ACPI_SST_SLEEP_CONTEXT;
                break;
 
        default:
+
                sst_value = ACPI_SST_INDICATOR_OFF;     /* Default is off */
                break;
        }
index 8769cf83b044ff704db113a4ef7ffc8a5f78fbc0..c5316e5bd4abf2efce5aad7d4968708d3bccdb3d 100644 (file)
@@ -151,6 +151,7 @@ acpi_status acpi_ns_root_initialize(void)
                         */
                        switch (init_val->type) {
                        case ACPI_TYPE_METHOD:
+
                                obj_desc->method.param_count =
                                    (u8) ACPI_TO_INTEGER(val);
                                obj_desc->common.flags |= AOPOBJ_DATA_VALID;
diff --git a/drivers/acpi/acpica/nsarguments.c b/drivers/acpi/acpica/nsarguments.c
new file mode 100644 (file)
index 0000000..74b24c8
--- /dev/null
@@ -0,0 +1,294 @@
+/******************************************************************************
+ *
+ * Module Name: nsarguments - Validation of args for ACPI predefined methods
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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 "accommon.h"
+#include "acnamesp.h"
+#include "acpredef.h"
+
+#define _COMPONENT          ACPI_NAMESPACE
+ACPI_MODULE_NAME("nsarguments")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_argument_types
+ *
+ * PARAMETERS:  info            - Method execution information block
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check the incoming argument count and all argument types
+ *              against the argument type list for a predefined name.
+ *
+ ******************************************************************************/
+void acpi_ns_check_argument_types(struct acpi_evaluate_info *info)
+{
+       u16 arg_type_list;
+       u8 arg_count;
+       u8 arg_type;
+       u8 user_arg_type;
+       u32 i;
+
+       /* If not a predefined name, cannot typecheck args */
+
+       if (!info->predefined) {
+               return;
+       }
+
+       arg_type_list = info->predefined->info.argument_list;
+       arg_count = METHOD_GET_ARG_COUNT(arg_type_list);
+
+       /* Typecheck all arguments */
+
+       for (i = 0; ((i < arg_count) && (i < info->param_count)); i++) {
+               arg_type = METHOD_GET_NEXT_TYPE(arg_type_list);
+               user_arg_type = info->parameters[i]->common.type;
+
+               if (user_arg_type != arg_type) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Argument #%u type mismatch - "
+                                             "Found [%s], ACPI requires [%s]",
+                                             (i + 1),
+                                             acpi_ut_get_type_name
+                                             (user_arg_type),
+                                             acpi_ut_get_type_name(arg_type)));
+               }
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_acpi_compliance
+ *
+ * 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 parameter count (in ASL/AML) for a
+ *              predefined name is what is expected (matches what is defined in
+ *              the ACPI specification for this predefined name.)
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_check_acpi_compliance(char *pathname,
+                             struct acpi_namespace_node *node,
+                             const union acpi_predefined_info *predefined)
+{
+       u32 aml_param_count;
+       u32 required_param_count;
+
+       if (!predefined) {
+               return;
+       }
+
+       /* Get the ACPI-required arg count from the predefined info table */
+
+       required_param_count =
+           METHOD_GET_ARG_COUNT(predefined->info.argument_list);
+
+       /*
+        * If this object is not a control method, we can check if the ACPI
+        * spec requires that it be a method.
+        */
+       if (node->type != ACPI_TYPE_METHOD) {
+               if (required_param_count > 0) {
+
+                       /* Object requires args, must be implemented as a method */
+
+                       ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
+                                                   ACPI_WARN_ALWAYS,
+                                                   "Object (%s) must be a control method with %u arguments",
+                                                   acpi_ut_get_type_name(node->
+                                                                         type),
+                                                   required_param_count));
+               } else if (!required_param_count
+                          && !predefined->info.expected_btypes) {
+
+                       /* Object requires no args and no return value, must be a method */
+
+                       ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname,
+                                                   ACPI_WARN_ALWAYS,
+                                                   "Object (%s) must be a control method "
+                                                   "with no arguments and no return value",
+                                                   acpi_ut_get_type_name(node->
+                                                                         type)));
+               }
+
+               return;
+       }
+
+       /*
+        * This is a control method.
+        * Check that the ASL/AML-defined parameter count for this method
+        * matches the ACPI-required parameter count
+        *
+        * Some methods are allowed to have a "minimum" number of args (_SCP)
+        * because their definition in ACPI has changed over time.
+        *
+        * Note: These are BIOS errors in the declaration of the object
+        */
+       aml_param_count = node->object->method.param_count;
+
+       if (aml_param_count < required_param_count) {
+               ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
+                                           "Insufficient arguments - "
+                                           "ASL declared %u, ACPI requires %u",
+                                           aml_param_count,
+                                           required_param_count));
+       } else if ((aml_param_count > required_param_count)
+                  && !(predefined->info.
+                       argument_list & ARG_COUNT_IS_MINIMUM)) {
+               ACPI_BIOS_ERROR_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
+                                           "Excess arguments - "
+                                           "ASL declared %u, ACPI requires %u",
+                                           aml_param_count,
+                                           required_param_count));
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_argument_count
+ *
+ * PARAMETERS:  pathname        - Full pathname to the node (for error msgs)
+ *              node            - Namespace node for the method/object
+ *              user_param_count - Number of args passed in by the caller
+ *              predefined      - Pointer to entry in predefined name table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Check that incoming argument count matches the declared
+ *              parameter count (in the ASL/AML) for an object.
+ *
+ ******************************************************************************/
+
+void
+acpi_ns_check_argument_count(char *pathname,
+                            struct acpi_namespace_node *node,
+                            u32 user_param_count,
+                            const union acpi_predefined_info *predefined)
+{
+       u32 aml_param_count;
+       u32 required_param_count;
+
+       if (!predefined) {
+               /*
+                * Not a predefined name. Check the incoming user argument count
+                * against the count that is specified in the method/object.
+                */
+               if (node->type != ACPI_TYPE_METHOD) {
+                       if (user_param_count) {
+                               ACPI_INFO_PREDEFINED((AE_INFO, pathname,
+                                                     ACPI_WARN_ALWAYS,
+                                                     "%u arguments were passed to a non-method ACPI object (%s)",
+                                                     user_param_count,
+                                                     acpi_ut_get_type_name
+                                                     (node->type)));
+                       }
+
+                       return;
+               }
+
+               /*
+                * This is a control method. Check the parameter count.
+                * We can only check the incoming argument count against the
+                * argument count declared for the method in the ASL/AML.
+                *
+                * Emit a message if too few or too many arguments have been passed
+                * by the caller.
+                *
+                * Note: Too many arguments will not cause the method to
+                * fail. However, the method will fail if there are too few
+                * arguments and the method attempts to use one of the missing ones.
+                */
+               aml_param_count = node->object->method.param_count;
+
+               if (user_param_count < aml_param_count) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Insufficient arguments - "
+                                             "Caller passed %u, method requires %u",
+                                             user_param_count,
+                                             aml_param_count));
+               } else if (user_param_count > aml_param_count) {
+                       ACPI_INFO_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Excess arguments - "
+                                             "Caller passed %u, method requires %u",
+                                             user_param_count,
+                                             aml_param_count));
+               }
+
+               return;
+       }
+
+       /*
+        * This is a predefined name. Validate the user-supplied parameter
+        * count against the ACPI specification. We don't validate against
+        * the method itself because what is important here is that the
+        * caller is in conformance with the spec. (The arg count for the
+        * method was checked against the ACPI spec earlier.)
+        *
+        * Some methods are allowed to have a "minimum" number of args (_SCP)
+        * because their definition in ACPI has changed over time.
+        */
+       required_param_count =
+           METHOD_GET_ARG_COUNT(predefined->info.argument_list);
+
+       if (user_param_count < required_param_count) {
+               ACPI_WARN_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
+                                     "Insufficient arguments - "
+                                     "Caller passed %u, ACPI requires %u",
+                                     user_param_count, required_param_count));
+       } else if ((user_param_count > required_param_count) &&
+                  !(predefined->info.argument_list & ARG_COUNT_IS_MINIMUM)) {
+               ACPI_INFO_PREDEFINED((AE_INFO, pathname, ACPI_WARN_ALWAYS,
+                                     "Excess arguments - "
+                                     "Caller passed %u, ACPI requires %u",
+                                     user_param_count, required_param_count));
+       }
+}
index 8f79a9d2d50ec659f157e0c3ccd011d81c0658df..acd2964c26906f995b159bd382a42ce000cfa2c3 100644 (file)
@@ -103,6 +103,7 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
                break;
 
        default:
+
                return (AE_AML_OPERAND_TYPE);
        }
 
@@ -191,6 +192,7 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
                break;
 
        default:
+
                return (AE_AML_OPERAND_TYPE);
        }
 
@@ -294,6 +296,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
                break;
 
        default:
+
                return (AE_AML_OPERAND_TYPE);
        }
 
index ce6e9732620523ba36e1a474d76dddfcf03005d9..7418c77fde8c70db88d0d0af9c0c6a8fcad6cad5 100644 (file)
@@ -244,10 +244,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                        case ACPI_TYPE_BUFFER:
                        case ACPI_TYPE_STRING:
                        case ACPI_TYPE_METHOD:
+
                                acpi_os_printf("<No attached object>");
                                break;
 
                        default:
+
                                break;
                        }
 
@@ -433,6 +435,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                        break;
 
                default:
+
                        break;
                }
                break;
@@ -567,32 +570,39 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                        goto cleanup;
 
                case ACPI_TYPE_BUFFER_FIELD:
+
                        obj_desc =
                            (union acpi_operand_object *)obj_desc->buffer_field.
                            buffer_obj;
                        break;
 
                case ACPI_TYPE_PACKAGE:
+
                        obj_desc = (void *)obj_desc->package.elements;
                        break;
 
                case ACPI_TYPE_METHOD:
+
                        obj_desc = (void *)obj_desc->method.aml_start;
                        break;
 
                case ACPI_TYPE_LOCAL_REGION_FIELD:
+
                        obj_desc = (void *)obj_desc->field.region_obj;
                        break;
 
                case ACPI_TYPE_LOCAL_BANK_FIELD:
+
                        obj_desc = (void *)obj_desc->bank_field.region_obj;
                        break;
 
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
                        obj_desc = (void *)obj_desc->index_field.index_obj;
                        break;
 
                default:
+
                        goto cleanup;
                }
 
index b61db69d56752160e5be0e4bd0ab430d2871fcb5..18108bc2e51cd76833c42b13d6c6e6e678bcb976 100644 (file)
@@ -61,7 +61,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
  *
  * PARAMETERS:  info            - Evaluation info block, contains:
  *                  prefix_node     - Prefix or Method/Object Node to execute
- *                  pathname        - Name of method to execute, If NULL, the
+ *                  relative_path   - Name of method to execute, If NULL, the
  *                                    Node is the object to execute
  *                  parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
@@ -82,10 +82,9 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
  *
  ******************************************************************************/
 
-acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
+acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
 {
        acpi_status status;
-       struct acpi_namespace_node *node;
 
        ACPI_FUNCTION_TRACE(ns_evaluate);
 
@@ -93,83 +92,138 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /* Initialize the return value to an invalid object */
-
-       info->return_object = NULL;
-       info->param_count = 0;
-
-       if (!info->resolved_node) {
+       if (!info->node) {
                /*
-                * Get the actual namespace node for the target object if we need to.
-                * Handles these cases:
+                * Get the actual namespace node for the target object if we
+                * need to. Handles these cases:
                 *
-                * 1) Null node, Pathname (absolute path)
-                * 2) Node, Pathname (path relative to Node)
-                * 3) Node, Null Pathname
+                * 1) Null node, valid pathname from root (absolute path)
+                * 2) Node and valid pathname (path relative to Node)
+                * 3) Node, Null pathname
                 */
-               status = acpi_ns_get_node(info->prefix_node, info->pathname,
-                                         ACPI_NS_NO_UPSEARCH,
-                                         &info->resolved_node);
+               status =
+                   acpi_ns_get_node(info->prefix_node, info->relative_pathname,
+                                    ACPI_NS_NO_UPSEARCH, &info->node);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
        }
 
        /*
-        * For a method alias, we must grab the actual method node so that proper
-        * scoping context will be established before execution.
+        * For a method alias, we must grab the actual method node so that
+        * proper scoping context will be established before execution.
         */
-       if (acpi_ns_get_type(info->resolved_node) ==
-           ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-               info->resolved_node =
+       if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+               info->node =
                    ACPI_CAST_PTR(struct acpi_namespace_node,
-                                 info->resolved_node->object);
+                                 info->node->object);
+       }
+
+       /* Complete the info block initialization */
+
+       info->return_object = NULL;
+       info->node_flags = info->node->flags;
+       info->obj_desc = acpi_ns_get_attached_object(info->node);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+                         info->relative_pathname, info->node,
+                         acpi_ns_get_attached_object(info->node)));
+
+       /* Get info if we have a predefined name (_HID, etc.) */
+
+       info->predefined =
+           acpi_ut_match_predefined_method(info->node->name.ascii);
+
+       /* Get the full pathname to the object, for use in warning messages */
+
+       info->full_pathname = acpi_ns_get_external_pathname(info->node);
+       if (!info->full_pathname) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname,
-                         info->resolved_node,
-                         acpi_ns_get_attached_object(info->resolved_node)));
+       /* Count the number of arguments being passed in */
+
+       info->param_count = 0;
+       if (info->parameters) {
+               while (info->parameters[info->param_count]) {
+                       info->param_count++;
+               }
+
+               /* Warn on impossible argument count */
+
+               if (info->param_count > ACPI_METHOD_NUM_ARGS) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Excess arguments (%u) - using only %u",
+                                             info->param_count,
+                                             ACPI_METHOD_NUM_ARGS));
+
+                       info->param_count = ACPI_METHOD_NUM_ARGS;
+               }
+       }
+
+       /*
+        * For predefined names: Check that the declared argument count
+        * matches the ACPI spec -- otherwise this is a BIOS error.
+        */
+       acpi_ns_check_acpi_compliance(info->full_pathname, info->node,
+                                     info->predefined);
+
+       /*
+        * For all names: Check that the incoming argument count for
+        * this method/object matches the actual ASL/AML definition.
+        */
+       acpi_ns_check_argument_count(info->full_pathname, info->node,
+                                    info->param_count, info->predefined);
 
-       node = info->resolved_node;
+       /* For predefined names: Typecheck all incoming arguments */
+
+       acpi_ns_check_argument_types(info);
 
        /*
-        * Two major cases here:
+        * Three major evaluation cases:
         *
-        * 1) The object is a control method -- execute it
-        * 2) The object is not a method -- just return it's current value
+        * 1) Object types that cannot be evaluated by definition
+        * 2) The object is a control method -- execute it
+        * 3) The object is not a method -- just return it's current value
         */
-       if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) {
+       switch (acpi_ns_get_type(info->node)) {
+       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:
+               /*
+                * 1) Disallow evaluation of certain object types. For these,
+                *    object evaluation is undefined and not supported.
+                */
+               ACPI_ERROR((AE_INFO,
+                           "%s: Evaluation of object type [%s] is not supported",
+                           info->full_pathname,
+                           acpi_ut_get_type_name(info->node->type)));
+
+               status = AE_TYPE;
+               goto cleanup;
+
+       case ACPI_TYPE_METHOD:
                /*
-                * 1) Object is a control method - execute it
+                * 2) Object is a control method - execute it
                 */
 
                /* Verify that there is a method object associated with this node */
 
-               info->obj_desc =
-                   acpi_ns_get_attached_object(info->resolved_node);
                if (!info->obj_desc) {
                        ACPI_ERROR((AE_INFO,
-                                   "Control method has no attached sub-object"));
-                       return_ACPI_STATUS(AE_NULL_OBJECT);
+                                   "%s: Method has no attached sub-object",
+                                   info->full_pathname));
+                       status = AE_NULL_OBJECT;
+                       goto cleanup;
                }
 
-               /* Count the number of arguments being passed to the method */
-
-               if (info->parameters) {
-                       while (info->parameters[info->param_count]) {
-                               if (info->param_count > ACPI_METHOD_MAX_ARG) {
-                                       return_ACPI_STATUS(AE_LIMIT);
-                               }
-                               info->param_count++;
-                       }
-               }
-
-
-               ACPI_DUMP_PATHNAME(info->resolved_node, "ACPI: Execute Method",
-                                  ACPI_LV_INFO, _COMPONENT);
-
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "Method at AML address %p Length %X\n",
+                                 "**** Execute method [%s] at AML address %p length %X\n",
+                                 info->full_pathname,
                                  info->obj_desc->method.aml_start + 1,
                                  info->obj_desc->method.aml_length - 1));
 
@@ -184,81 +238,61 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
                acpi_ex_enter_interpreter();
                status = acpi_ps_execute_method(info);
                acpi_ex_exit_interpreter();
-       } else {
+               break;
+
+       default:
                /*
-                * 2) Object is not a method, return its current value
-                *
-                * Disallow certain object types. For these, "evaluation" is undefined.
+                * 3) All other non-method objects -- get the current object value
                 */
-               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
-                * a field that must be read, etc.) -- we can't just grab the object
-                * out of the node.
+                * Some objects require additional resolution steps (e.g., the Node
+                * may be a field that must be read, etc.) -- we can't just grab
+                * the object out of the node.
                 *
                 * Use resolve_node_to_value() to get the associated value.
                 *
                 * NOTE: we can get away with passing in NULL for a walk state because
-                * resolved_node is guaranteed to not be a reference to either a method
+                * the Node is guaranteed to not be a reference to either a method
                 * local or a method argument (because this interface is never called
                 * from a running method.)
                 *
                 * Even though we do not directly invoke the interpreter for object
-                * resolution, we must lock it because we could access an opregion.
-                * The opregion access code assumes that the interpreter is locked.
+                * resolution, we must lock it because we could access an op_region.
+                * The op_region access code assumes that the interpreter is locked.
                 */
                acpi_ex_enter_interpreter();
 
-               /* Function has a strange interface */
+               /* TBD: resolve_node_to_value has a strange interface, fix */
+
+               info->return_object =
+                   ACPI_CAST_PTR(union acpi_operand_object, info->node);
 
                status =
-                   acpi_ex_resolve_node_to_value(&info->resolved_node, NULL);
+                   acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
+                                                 (struct acpi_namespace_node,
+                                                  &info->return_object), NULL);
                acpi_ex_exit_interpreter();
 
-               /*
-                * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
-                * in resolved_node.
-                */
-               if (ACPI_SUCCESS(status)) {
-                       status = AE_CTRL_RETURN_VALUE;
-                       info->return_object =
-                           ACPI_CAST_PTR(union acpi_operand_object,
-                                         info->resolved_node);
-
-                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                                         "Returning object %p [%s]\n",
-                                         info->return_object,
-                                         acpi_ut_get_object_type_name(info->
-                                                                      return_object)));
+               if (ACPI_FAILURE(status)) {
+                       goto cleanup;
                }
+
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Returned object %p [%s]\n",
+                                 info->return_object,
+                                 acpi_ut_get_object_type_name(info->
+                                                              return_object)));
+
+               status = AE_CTRL_RETURN_VALUE;  /* Always has a "return value" */
+               break;
        }
 
        /*
-        * Check input argument count against the ASL-defined count for a method.
-        * Also check predefined names: argument count and return value against
-        * the ACPI specification. Some incorrect return value types are repaired.
+        * For predefined names, check the return value against the ACPI
+        * specification. Some incorrect return value types are repaired.
         */
-       (void)acpi_ns_check_predefined_names(node, info->param_count,
-               status, &info->return_object);
+       (void)acpi_ns_check_return_value(info->node, info, info->param_count,
+                                        status, &info->return_object);
 
        /* Check if there is a return value that must be dealt with */
 
@@ -278,12 +312,15 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 
        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                          "*** Completed evaluation of object %s ***\n",
-                         info->pathname));
+                         info->relative_pathname));
 
+ cleanup:
        /*
         * Namespace was unlocked by the handling acpi_ns* function, so we
-        * just return
+        * just free the pathname and return
         */
+       ACPI_FREE(info->full_pathname);
+       info->full_pathname = NULL;
        return_ACPI_STATUS(status);
 }
 
index 46f0f83417a1024613c39be6fe036996350107a7..dd2ceae3f7177aff169e56391292794c0651a74c 100644 (file)
@@ -176,7 +176,7 @@ acpi_status acpi_ns_initialize_devices(void)
         * part of the ACPI specification.
         */
        info.evaluate_info->prefix_node = acpi_gbl_root_node;
-       info.evaluate_info->pathname = METHOD_NAME__INI;
+       info.evaluate_info->relative_pathname = METHOD_NAME__INI;
        info.evaluate_info->parameters = NULL;
        info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
 
@@ -266,28 +266,34 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
 
        switch (type) {
        case ACPI_TYPE_REGION:
+
                info->op_region_count++;
                break;
 
        case ACPI_TYPE_BUFFER_FIELD:
+
                info->field_count++;
                break;
 
        case ACPI_TYPE_LOCAL_BANK_FIELD:
+
                info->field_count++;
                break;
 
        case ACPI_TYPE_BUFFER:
+
                info->buffer_count++;
                break;
 
        case ACPI_TYPE_PACKAGE:
+
                info->package_count++;
                break;
 
        default:
 
                /* No init required, just exit now */
+
                return (AE_OK);
        }
 
@@ -337,7 +343,9 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
                break;
 
        default:
+
                /* No other types can get here */
+
                break;
        }
 
@@ -416,6 +424,7 @@ acpi_ns_find_ini_methods(acpi_handle obj_handle,
                break;
 
        default:
+
                break;
        }
 
@@ -560,7 +569,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 
        ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
        info->prefix_node = device_node;
-       info->pathname = METHOD_NAME__INI;
+       info->relative_pathname = METHOD_NAME__INI;
        info->parameters = NULL;
        info->flags = ACPI_IGNORE_RETURN_VALUE;
 
@@ -574,8 +583,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 
                /* Ignore error and move on to next device */
 
-               char *scope_name =
-                   acpi_ns_get_external_pathname(info->resolved_node);
+               char *scope_name = acpi_ns_get_external_pathname(info->node);
 
                ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
                                scope_name));
index 8a52916148cb005a1dbe3da762788db2741b7a9a..24b71a01bf9398340c6c01f68c990ac7caa8c51f 100644 (file)
@@ -61,28 +61,29 @@ ACPI_MODULE_NAME("nspredef")
  * 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.
+ *     ASL is validated against the ACPI specification.
  *  2) The type of the return object (if any) is validated against the ACPI
- *      specification.
+ *     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.
+ *     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_reference(struct acpi_predefined_data *data,
+acpi_ns_check_reference(struct acpi_evaluate_info *info,
                        union acpi_operand_object *return_object);
 
 static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_check_predefined_names
+ * FUNCTION:    acpi_ns_check_return_value
  *
  * PARAMETERS:  node            - Namespace node for the method/object
+ *              info            - Method execution information block
  *              user_param_count - Number of parameters actually passed
  *              return_status   - Status from the object evaluation
  *              return_object_ptr - Pointer to the object returned from the
@@ -90,44 +91,25 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object);
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Check an ACPI name for a match in the predefined name list.
+ * DESCRIPTION: Check the value returned from a predefined name.
  *
  ******************************************************************************/
 
 acpi_status
-acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
-                              u32 user_param_count,
-                              acpi_status return_status,
-                              union acpi_operand_object **return_object_ptr)
+acpi_ns_check_return_value(struct acpi_namespace_node *node,
+                          struct acpi_evaluate_info *info,
+                          u32 user_param_count,
+                          acpi_status return_status,
+                          union acpi_operand_object **return_object_ptr)
 {
-       acpi_status status = AE_OK;
+       acpi_status status;
        const union acpi_predefined_info *predefined;
-       char *pathname;
-       struct acpi_predefined_data *data;
-
-       /* Match the name for this method/object against the predefined list */
-
-       predefined = acpi_ut_match_predefined_method(node->name.ascii);
-
-       /* Get the full pathname to the object, for use in warning messages */
-
-       pathname = acpi_ns_get_external_pathname(node);
-       if (!pathname) {
-               return (AE_OK); /* Could not get pathname, ignore */
-       }
-
-       /*
-        * Check that the parameter count for this method matches the ASL
-        * definition. For predefined names, ensure that both the caller and
-        * the method itself are in accordance with the ACPI specification.
-        */
-       acpi_ns_check_parameter_count(pathname, node, user_param_count,
-                                     predefined);
 
        /* If not a predefined name, we cannot validate the return object */
 
+       predefined = info->predefined;
        if (!predefined) {
-               goto cleanup;
+               return (AE_OK);
        }
 
        /*
@@ -135,7 +117,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
         * validate the return object
         */
        if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
-               goto cleanup;
+               return (AE_OK);
        }
 
        /*
@@ -154,25 +136,14 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
        if (acpi_gbl_disable_auto_repair ||
            (!predefined->info.expected_btypes) ||
            (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
-               goto cleanup;
-       }
-
-       /* Create the parameter data block for object validation */
-
-       data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
-       if (!data) {
-               goto cleanup;
+               return (AE_OK);
        }
-       data->predefined = predefined;
-       data->node = node;
-       data->node_flags = node->flags;
-       data->pathname = pathname;
 
        /*
         * Check that the type of the main return object is what is expected
         * for this predefined name
         */
-       status = acpi_ns_check_object_type(data, return_object_ptr,
+       status = acpi_ns_check_object_type(info, return_object_ptr,
                                           predefined->info.expected_btypes,
                                           ACPI_NOT_PACKAGE_ELEMENT);
        if (ACPI_FAILURE(status)) {
@@ -184,10 +155,16 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
         * Note: Package may have been newly created by call above.
         */
        if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
-               data->parent_package = *return_object_ptr;
-               status = acpi_ns_check_package(data, return_object_ptr);
+               info->parent_package = *return_object_ptr;
+               status = acpi_ns_check_package(info, return_object_ptr);
                if (ACPI_FAILURE(status)) {
-                       goto exit;
+
+                       /* We might be able to fix some errors */
+
+                       if ((status != AE_AML_OPERAND_TYPE) &&
+                           (status != AE_AML_OPERAND_VALUE)) {
+                               goto exit;
+                       }
                }
        }
 
@@ -199,7 +176,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
         * performed on a per-name basis, i.e., the code is specific to
         * particular predefined names.
         */
-       status = acpi_ns_complex_repairs(data, node, status, return_object_ptr);
+       status = acpi_ns_complex_repairs(info, node, status, return_object_ptr);
 
 exit:
        /*
@@ -207,112 +184,18 @@ exit:
         * or more objects, mark the parent node to suppress further warning
         * messages during the next evaluation of the same method/object.
         */
-       if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) {
+       if (ACPI_FAILURE(status) || (info->return_flags & ACPI_OBJECT_REPAIRED)) {
                node->flags |= ANOBJ_EVALUATED;
        }
-       ACPI_FREE(data);
 
-cleanup:
-       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
- *              user_param_count - Number of args passed in by the caller
- *              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,
-                             u32 user_param_count,
-                             const union acpi_predefined_info *predefined)
-{
-       u32 param_count;
-       u32 required_params_current;
-       u32 required_params_old;
-
-       /* 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;
-       }
-
-       if (!predefined) {
-               /*
-                * Check the parameter count for non-predefined methods/objects.
-                *
-                * Warning if too few or too many arguments have been passed by the
-                * caller. An incorrect number of arguments may not cause the method
-                * to fail. However, the method will fail if there are too few
-                * arguments and the method attempts to use one of the missing ones.
-                */
-               if (user_param_count < param_count) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
-                                             ACPI_WARN_ALWAYS,
-                                             "Insufficient arguments - needs %u, found %u",
-                                             param_count, user_param_count));
-               } else if (user_param_count > param_count) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
-                                             ACPI_WARN_ALWAYS,
-                                             "Excess arguments - needs %u, found %u",
-                                             param_count, user_param_count));
-               }
-               return;
-       }
-
-       /*
-        * Validate the user-supplied parameter count.
-        * Allow two different legal argument counts (_SCP, etc.)
-        */
-       required_params_current =
-           predefined->info.argument_list & METHOD_ARG_MASK;
-       required_params_old =
-           predefined->info.argument_list >> METHOD_ARG_BIT_WIDTH;
-
-       if (user_param_count != ACPI_UINT32_MAX) {
-               if ((user_param_count != required_params_current) &&
-                   (user_param_count != required_params_old)) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
-                                             ACPI_WARN_ALWAYS,
-                                             "Parameter count mismatch - "
-                                             "caller passed %u, ACPI requires %u",
-                                             user_param_count,
-                                             required_params_current));
-               }
-       }
-
-       /*
-        * Check that the ASL-defined parameter count is what is expected for
-        * this predefined name (parameter count as defined by the ACPI
-        * specification)
-        */
-       if ((param_count != required_params_current) &&
-           (param_count != required_params_old)) {
-               ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
-                                     "Parameter count mismatch - ASL declared %u, ACPI requires %u",
-                                     param_count, required_params_current));
-       }
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_object_type
  *
- * PARAMETERS:  data            - Pointer to validation data structure
+ * PARAMETERS:  info            - Method execution information block
  *              return_object_ptr - Pointer to the object returned from the
  *                                evaluation of a method or object
  *              expected_btypes - Bitmap of expected return type(s)
@@ -328,7 +211,7 @@ acpi_ns_check_parameter_count(char *pathname,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_check_object_type(struct acpi_predefined_data *data,
+acpi_ns_check_object_type(struct acpi_evaluate_info *info,
                          union acpi_operand_object **return_object_ptr,
                          u32 expected_btypes, u32 package_index)
 {
@@ -340,7 +223,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
 
        if (return_object &&
            ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Invalid return type - Found a Namespace node [%4.4s] type %s",
                                      return_object->node.name.ascii,
                                      acpi_ut_get_type_name(return_object->node.
@@ -356,8 +240,8 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
         * from all of the predefined names (including elements of returned
         * packages)
         */
-       data->return_btype = acpi_ns_get_bitmapped_type(return_object);
-       if (data->return_btype == ACPI_RTYPE_ANY) {
+       info->return_btype = acpi_ns_get_bitmapped_type(return_object);
+       if (info->return_btype == ACPI_RTYPE_ANY) {
 
                /* Not one of the supported objects, must be incorrect */
                goto type_error_exit;
@@ -365,16 +249,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
 
        /* For reference objects, check that the reference type is correct */
 
-       if ((data->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
-               status = acpi_ns_check_reference(data, return_object);
+       if ((info->return_btype & expected_btypes) == ACPI_RTYPE_REFERENCE) {
+               status = acpi_ns_check_reference(info, return_object);
                return (status);
        }
 
        /* Attempt simple repair of the returned object if necessary */
 
-       status = acpi_ns_simple_repair(data, expected_btypes,
+       status = acpi_ns_simple_repair(info, expected_btypes,
                                       package_index, return_object_ptr);
-       return (status);
+       if (ACPI_SUCCESS(status)) {
+               return (AE_OK); /* Successful repair */
+       }
 
       type_error_exit:
 
@@ -383,12 +269,14 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
        acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
 
        if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Return type mismatch - found %s, expected %s",
                                      acpi_ut_get_object_type_name
                                      (return_object), type_buffer));
        } else {
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Return Package type mismatch at index %u - "
                                      "found %s, expected %s", package_index,
                                      acpi_ut_get_object_type_name
@@ -402,7 +290,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_check_reference
  *
- * PARAMETERS:  data            - Pointer to validation data structure
+ * PARAMETERS:  info            - Method execution information block
  *              return_object   - Object returned from the evaluation of a
  *                                method or object
  *
@@ -415,7 +303,7 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_reference(struct acpi_predefined_data *data,
+acpi_ns_check_reference(struct acpi_evaluate_info *info,
                        union acpi_operand_object *return_object)
 {
 
@@ -428,7 +316,7 @@ acpi_ns_check_reference(struct acpi_predefined_data *data,
                return (AE_OK);
        }
 
-       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
                              "Return type mismatch - unexpected reference object type [%s] %2.2X",
                              acpi_ut_get_reference_name(return_object),
                              return_object->reference.class));
@@ -462,26 +350,32 @@ static u32 acpi_ns_get_bitmapped_type(union acpi_operand_object *return_object)
 
        switch (return_object->common.type) {
        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 */
 
                return_btype = ACPI_RTYPE_ANY;
index 77cdd539de16c7030659a5df53cf706497e30540..6d55cef7916c4ba4715a9108697073822edc48ec 100644 (file)
@@ -51,12 +51,12 @@ ACPI_MODULE_NAME("nsprepkg")
 
 /* Local prototypes */
 static acpi_status
-acpi_ns_check_package_list(struct acpi_predefined_data *data,
+acpi_ns_check_package_list(struct acpi_evaluate_info *info,
                           const union acpi_predefined_info *package,
                           union acpi_operand_object **elements, u32 count);
 
 static acpi_status
-acpi_ns_check_package_elements(struct acpi_predefined_data *data,
+acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
                               union acpi_operand_object **elements,
                               u8 type1,
                               u32 count1,
@@ -66,7 +66,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_check_package
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -78,7 +78,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_check_package(struct acpi_predefined_data *data,
+acpi_ns_check_package(struct acpi_evaluate_info *info,
                      union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
@@ -93,18 +93,18 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
 
        /* The package info for this name is in the next table entry */
 
-       package = data->predefined + 1;
+       package = info->predefined + 1;
 
        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                          "%s Validating return Package of Type %X, Count %X\n",
-                         data->pathname, package->ret_info.type,
+                         info->full_pathname, package->ret_info.type,
                          return_object->package.count));
 
        /*
         * For variable-length Packages, we can safely remove all embedded
         * and trailing NULL package elements
         */
-       acpi_ns_remove_null_elements(data, package->ret_info.type,
+       acpi_ns_remove_null_elements(info, package->ret_info.type,
                                     return_object);
 
        /* Extract package count and elements array */
@@ -121,7 +121,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                        return (AE_OK);
                }
 
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Return Package has no elements (empty)"));
 
                return (AE_AML_OPERAND_VALUE);
@@ -135,7 +136,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
         */
        switch (package->ret_info.type) {
        case ACPI_PTYPE1_FIXED:
-
                /*
                 * The package count is fixed and there are no sub-packages
                 *
@@ -150,13 +150,13 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                        ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                          "%s: Return Package is larger than needed - "
                                          "found %u, expected %u\n",
-                                         data->pathname, count,
+                                         info->full_pathname, count,
                                          expected_count));
                }
 
                /* Validate all elements of the returned package */
 
-               status = acpi_ns_check_package_elements(data, elements,
+               status = acpi_ns_check_package_elements(info, elements,
                                                        package->ret_info.
                                                        object_type1,
                                                        package->ret_info.
@@ -168,13 +168,12 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                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(data, elements,
+                       status = acpi_ns_check_object_type(info, elements,
                                                           package->ret_info.
                                                           object_type1, i);
                        if (ACPI_FAILURE(status)) {
@@ -185,7 +184,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                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
@@ -206,7 +204,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                                /* These are the required package elements (0, 1, or 2) */
 
                                status =
-                                   acpi_ns_check_object_type(data, elements,
+                                   acpi_ns_check_object_type(info, elements,
                                                              package->
                                                              ret_info3.
                                                              object_type[i],
@@ -218,7 +216,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                                /* These are the optional package elements */
 
                                status =
-                                   acpi_ns_check_object_type(data, elements,
+                                   acpi_ns_check_object_type(info, elements,
                                                              package->
                                                              ret_info3.
                                                              tail_object_type,
@@ -235,7 +233,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
 
                /* First element is the (Integer) revision */
 
-               status = acpi_ns_check_object_type(data, elements,
+               status = acpi_ns_check_object_type(info, elements,
                                                   ACPI_RTYPE_INTEGER, 0);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -247,14 +245,14 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                /* Examine the sub-packages */
 
                status =
-                   acpi_ns_check_package_list(data, package, elements, count);
+                   acpi_ns_check_package_list(info, package, elements, count);
                break;
 
        case ACPI_PTYPE2_PKG_COUNT:
 
                /* First element is the (Integer) count of sub-packages to follow */
 
-               status = acpi_ns_check_object_type(data, elements,
+               status = acpi_ns_check_object_type(info, elements,
                                                   ACPI_RTYPE_INTEGER, 0);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -275,7 +273,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                /* Examine the sub-packages */
 
                status =
-                   acpi_ns_check_package_list(data, package, elements, count);
+                   acpi_ns_check_package_list(info, package, elements, count);
                break;
 
        case ACPI_PTYPE2:
@@ -283,7 +281,6 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
        case ACPI_PTYPE2_MIN:
        case ACPI_PTYPE2_COUNT:
        case ACPI_PTYPE2_FIX_VAR:
-
                /*
                 * These types all return a single Package that consists of a
                 * variable number of sub-Packages.
@@ -300,7 +297,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                        /* Create the new outer package and populate it */
 
                        status =
-                           acpi_ns_wrap_with_package(data, return_object,
+                           acpi_ns_wrap_with_package(info, return_object,
                                                      return_object_ptr);
                        if (ACPI_FAILURE(status)) {
                                return (status);
@@ -316,14 +313,15 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
                /* Examine the sub-packages */
 
                status =
-                   acpi_ns_check_package_list(data, package, elements, count);
+                   acpi_ns_check_package_list(info, package, elements, count);
                break;
 
        default:
 
                /* Should not get here if predefined info table is correct */
 
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Invalid internal return type in table entry: %X",
                                      package->ret_info.type));
 
@@ -336,7 +334,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
 
        /* Error exit for the case with an incorrect package count */
 
-       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
                              "Return Package is too small - found %u elements, expected %u",
                              count, expected_count));
 
@@ -347,7 +345,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_check_package_list
  *
- * PARAMETERS:  data            - Pointer to validation data structure
+ * PARAMETERS:  info            - Method execution information block
  *              package         - Pointer to package-specific info for method
  *              elements        - Element list of parent package. All elements
  *                                of this list should be of type Package.
@@ -360,7 +358,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_package_list(struct acpi_predefined_data *data,
+acpi_ns_check_package_list(struct acpi_evaluate_info *info,
                           const union acpi_predefined_info *package,
                           union acpi_operand_object **elements, u32 count)
 {
@@ -381,11 +379,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
        for (i = 0; i < count; i++) {
                sub_package = *elements;
                sub_elements = sub_package->package.elements;
-               data->parent_package = sub_package;
+               info->parent_package = sub_package;
 
                /* Each sub-object must be of type Package */
 
-               status = acpi_ns_check_object_type(data, &sub_package,
+               status = acpi_ns_check_object_type(info, &sub_package,
                                                   ACPI_RTYPE_PACKAGE, i);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -393,7 +391,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
 
                /* Examine the different types of expected sub-packages */
 
-               data->parent_package = sub_package;
+               info->parent_package = sub_package;
                switch (package->ret_info.type) {
                case ACPI_PTYPE2:
                case ACPI_PTYPE2_PKG_COUNT:
@@ -408,7 +406,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                        }
 
                        status =
-                           acpi_ns_check_package_elements(data, sub_elements,
+                           acpi_ns_check_package_elements(info, sub_elements,
                                                           package->ret_info.
                                                           object_type1,
                                                           package->ret_info.
@@ -434,7 +432,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                        }
 
                        status =
-                           acpi_ns_check_package_elements(data, sub_elements,
+                           acpi_ns_check_package_elements(info, sub_elements,
                                                           package->ret_info.
                                                           object_type1,
                                                           package->ret_info.
@@ -463,7 +461,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
 
                        for (j = 0; j < expected_count; j++) {
                                status =
-                                   acpi_ns_check_object_type(data,
+                                   acpi_ns_check_object_type(info,
                                                              &sub_elements[j],
                                                              package->
                                                              ret_info2.
@@ -487,7 +485,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                        /* Check the type of each sub-package element */
 
                        status =
-                           acpi_ns_check_package_elements(data, sub_elements,
+                           acpi_ns_check_package_elements(info, sub_elements,
                                                           package->ret_info.
                                                           object_type1,
                                                           sub_package->package.
@@ -498,12 +496,11 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                        break;
 
                case ACPI_PTYPE2_COUNT:
-
                        /*
                         * First element is the (Integer) count of elements, including
                         * the count field (the ACPI name is num_elements)
                         */
-                       status = acpi_ns_check_object_type(data, sub_elements,
+                       status = acpi_ns_check_object_type(info, sub_elements,
                                                           ACPI_RTYPE_INTEGER,
                                                           0);
                        if (ACPI_FAILURE(status)) {
@@ -537,7 +534,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
                        /* Check the type of each sub-package element */
 
                        status =
-                           acpi_ns_check_package_elements(data,
+                           acpi_ns_check_package_elements(info,
                                                           (sub_elements + 1),
                                                           package->ret_info.
                                                           object_type1,
@@ -562,7 +559,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
 
        /* The sub-package count was smaller than required */
 
-       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
                              "Return Sub-Package[%u] is too small - found %u elements, expected %u",
                              i, sub_package->package.count, expected_count));
 
@@ -573,7 +570,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_check_package_elements
  *
- * PARAMETERS:  data            - Pointer to validation data structure
+ * PARAMETERS:  info            - Method execution information block
  *              elements        - Pointer to the package elements array
  *              type1           - Object type for first group
  *              count1          - Count for first group
@@ -589,7 +586,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_package_elements(struct acpi_predefined_data *data,
+acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
                               union acpi_operand_object **elements,
                               u8 type1,
                               u32 count1,
@@ -605,7 +602,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
         * The second group can have a count of zero.
         */
        for (i = 0; i < count1; i++) {
-               status = acpi_ns_check_object_type(data, this_element,
+               status = acpi_ns_check_object_type(info, this_element,
                                                   type1, i + start_index);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -614,7 +611,7 @@ acpi_ns_check_package_elements(struct acpi_predefined_data *data,
        }
 
        for (i = 0; i < count2; i++) {
-               status = acpi_ns_check_object_type(data, this_element,
+               status = acpi_ns_check_object_type(info, this_element,
                                                   type2,
                                                   (i + count1 + start_index));
                if (ACPI_FAILURE(status)) {
index 18f02e4ece01dbc626be1d6829ef27c3f9950590..f8e71ea60319b21b6c014c88c69efc0b5a2dc751 100644 (file)
@@ -130,7 +130,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
  *
  * FUNCTION:    acpi_ns_simple_repair
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              expected_btypes     - Object types expected
  *              package_index       - Index of object within parent package (if
  *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -146,7 +146,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
  ******************************************************************************/
 
 acpi_status
-acpi_ns_simple_repair(struct acpi_predefined_data *data,
+acpi_ns_simple_repair(struct acpi_evaluate_info *info,
                      u32 expected_btypes,
                      u32 package_index,
                      union acpi_operand_object **return_object_ptr)
@@ -162,12 +162,12 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
         * Special repairs for certain names that are in the repair table.
         * Check if this name is in the list of repairable names.
         */
-       predefined = acpi_ns_match_simple_repair(data->node,
-                                                data->return_btype,
+       predefined = acpi_ns_match_simple_repair(info->node,
+                                                info->return_btype,
                                                 package_index);
        if (predefined) {
                if (!return_object) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
                                              ACPI_WARN_ALWAYS,
                                              "Missing expected return value"));
                }
@@ -191,7 +191,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
         * Do not perform simple object repair unless the return type is not
         * expected.
         */
-       if (data->return_btype & expected_btypes) {
+       if (info->return_btype & expected_btypes) {
                return (AE_OK);
        }
 
@@ -211,7 +211,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
         */
        if (!return_object) {
                if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
                                              ACPI_WARN_ALWAYS,
                                              "Missing expected return value"));
 
@@ -247,14 +247,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
                 * for correct contents (expected object type or types).
                 */
                status =
-                   acpi_ns_wrap_with_package(data, return_object, &new_object);
+                   acpi_ns_wrap_with_package(info, return_object, &new_object);
                if (ACPI_SUCCESS(status)) {
                        /*
                         * The original object just had its reference count
                         * incremented for being inserted into the new package.
                         */
                        *return_object_ptr = new_object;        /* New Package object */
-                       data->flags |= ACPI_OBJECT_REPAIRED;
+                       info->return_flags |= ACPI_OBJECT_REPAIRED;
                        return (AE_OK);
                }
        }
@@ -277,7 +277,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
                 * package object as part of the repair, we don't need to
                 * change the reference count.
                 */
-               if (!(data->flags & ACPI_OBJECT_WRAPPED)) {
+               if (!(info->return_flags & ACPI_OBJECT_WRAPPED)) {
                        new_object->common.reference_count =
                            return_object->common.reference_count;
 
@@ -288,14 +288,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
 
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                  "%s: Converted %s to expected %s at Package index %u\n",
-                                 data->pathname,
+                                 info->full_pathname,
                                  acpi_ut_get_object_type_name(return_object),
                                  acpi_ut_get_object_type_name(new_object),
                                  package_index));
        } else {
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                  "%s: Converted %s to expected %s\n",
-                                 data->pathname,
+                                 info->full_pathname,
                                  acpi_ut_get_object_type_name(return_object),
                                  acpi_ut_get_object_type_name(new_object)));
        }
@@ -304,7 +304,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
 
        acpi_ut_remove_reference(return_object);
        *return_object_ptr = new_object;
-       data->flags |= ACPI_OBJECT_REPAIRED;
+       info->return_flags |= ACPI_OBJECT_REPAIRED;
        return (AE_OK);
 }
 
@@ -359,7 +359,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
  *
  * FUNCTION:    acpi_ns_repair_null_element
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              expected_btypes     - Object types expected
  *              package_index       - Index of object within parent package (if
  *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT
@@ -374,7 +374,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
  ******************************************************************************/
 
 acpi_status
-acpi_ns_repair_null_element(struct acpi_predefined_data *data,
+acpi_ns_repair_null_element(struct acpi_evaluate_info * info,
                            u32 expected_btypes,
                            u32 package_index,
                            union acpi_operand_object **return_object_ptr)
@@ -424,16 +424,16 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
        /* Set the reference count according to the parent Package object */
 
        new_object->common.reference_count =
-           data->parent_package->common.reference_count;
+           info->parent_package->common.reference_count;
 
        ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                          "%s: Converted NULL package element to expected %s at index %u\n",
-                         data->pathname,
+                         info->full_pathname,
                          acpi_ut_get_object_type_name(new_object),
                          package_index));
 
        *return_object_ptr = new_object;
-       data->flags |= ACPI_OBJECT_REPAIRED;
+       info->return_flags |= ACPI_OBJECT_REPAIRED;
        return (AE_OK);
 }
 
@@ -441,7 +441,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_remove_null_elements
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              package_type        - An acpi_return_package_types value
  *              obj_desc            - A Package object
  *
@@ -454,7 +454,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 void
-acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
+acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
                             u8 package_type,
                             union acpi_operand_object *obj_desc)
 {
@@ -480,6 +480,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
        case ACPI_PTYPE2_MIN:
        case ACPI_PTYPE2_REV_FIXED:
        case ACPI_PTYPE2_FIX_VAR:
+
                break;
 
        default:
@@ -511,7 +512,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
        if (new_count < count) {
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                  "%s: Found and removed %u NULL elements\n",
-                                 data->pathname, (count - new_count)));
+                                 info->full_pathname, (count - new_count)));
 
                /* NULL terminate list and update the package count */
 
@@ -524,7 +525,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_wrap_with_package
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              original_object     - Pointer to the object to repair.
  *              obj_desc_ptr        - The new package object is returned here
  *
@@ -545,7 +546,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
+acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
                          union acpi_operand_object *original_object,
                          union acpi_operand_object **obj_desc_ptr)
 {
@@ -566,12 +567,12 @@ acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
 
        ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                          "%s: Wrapped %s with expected Package object\n",
-                         data->pathname,
+                         info->full_pathname,
                          acpi_ut_get_object_type_name(original_object)));
 
        /* Return the new object in the object pointer */
 
        *obj_desc_ptr = pkg_obj_desc;
-       data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
+       info->return_flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
        return (AE_OK);
 }
index 149e9b9c2c1b1e3fbb8349de7338697b540d976d..c84603ee83ae084312f3936324a1bfb524b64f08 100644 (file)
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("nsrepair2")
  * be repaired on a per-name basis.
  */
 typedef
-acpi_status(*acpi_repair_function) (struct acpi_predefined_data *data,
+acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,
                                    union acpi_operand_object
                                    **return_object_ptr);
 
@@ -71,45 +71,57 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
                                                                   *node);
 
 static acpi_status
-acpi_ns_repair_ALR(struct acpi_predefined_data *data,
+acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_repair_CID(struct acpi_predefined_data *data,
+acpi_ns_repair_CID(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_repair_FDE(struct acpi_predefined_data *data,
+acpi_ns_repair_CST(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_repair_HID(struct acpi_predefined_data *data,
+acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_repair_PSS(struct acpi_predefined_data *data,
+acpi_ns_repair_HID(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_repair_TSS(struct acpi_predefined_data *data,
+acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr);
 
 static acpi_status
-acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
+acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
+                  union acpi_operand_object **return_object_ptr);
+
+static acpi_status
+acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
+                  union acpi_operand_object **return_object_ptr);
+
+static acpi_status
+acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
                          union acpi_operand_object *return_object,
+                         u32 start_index,
                          u32 expected_count,
                          u32 sort_index,
                          u8 sort_direction, char *sort_key_name);
 
-static void
-acpi_ns_sort_list(union acpi_operand_object **elements,
-                 u32 count, u32 index, u8 sort_direction);
-
 /* Values for sort_direction above */
 
 #define ACPI_SORT_ASCENDING     0
 #define ACPI_SORT_DESCENDING    1
 
+static void
+acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index);
+
+static void
+acpi_ns_sort_list(union acpi_operand_object **elements,
+                 u32 count, u32 index, u8 sort_direction);
+
 /*
  * This table contains the names of the predefined methods for which we can
  * perform more complex repairs.
@@ -118,9 +130,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
  *
  * _ALR: Sort the list ascending by ambient_illuminance
  * _CID: Strings: uppercase all, remove any leading asterisk
+ * _CST: Sort the list ascending by C state type
  * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
  * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
  * _HID: Strings: uppercase all, remove any leading asterisk
+ * _PRT: Fix reversed source_name and source_index
  * _PSS: Sort the list descending by Power
  * _TSS: Sort the list descending by Power
  *
@@ -134,9 +148,11 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
 static const struct acpi_repair_info acpi_ns_repairable_names[] = {
        {"_ALR", acpi_ns_repair_ALR},
        {"_CID", acpi_ns_repair_CID},
+       {"_CST", acpi_ns_repair_CST},
        {"_FDE", acpi_ns_repair_FDE},
        {"_GTM", acpi_ns_repair_FDE},   /* _GTM has same repair as _FDE */
        {"_HID", acpi_ns_repair_HID},
+       {"_PRT", acpi_ns_repair_PRT},
        {"_PSS", acpi_ns_repair_PSS},
        {"_TSS", acpi_ns_repair_TSS},
        {{0, 0, 0, 0}, NULL}    /* Table terminator */
@@ -150,7 +166,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
  *
  * FUNCTION:    acpi_ns_complex_repairs
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              node                - Namespace node for the method/object
  *              validate_status     - Original status of earlier validation
  *              return_object_ptr   - Pointer to the object returned from the
@@ -165,7 +181,7 @@ static const struct acpi_repair_info acpi_ns_repairable_names[] = {
  *****************************************************************************/
 
 acpi_status
-acpi_ns_complex_repairs(struct acpi_predefined_data *data,
+acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
                        struct acpi_namespace_node *node,
                        acpi_status validate_status,
                        union acpi_operand_object **return_object_ptr)
@@ -180,7 +196,7 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data,
                return (validate_status);
        }
 
-       status = predefined->repair_function(data, return_object_ptr);
+       status = predefined->repair_function(info, return_object_ptr);
        return (status);
 }
 
@@ -219,7 +235,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
  *
  * FUNCTION:    acpi_ns_repair_ALR
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -231,13 +247,13 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_ALR(struct acpi_predefined_data *data,
+acpi_ns_repair_ALR(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
        acpi_status status;
 
-       status = acpi_ns_check_sorted_list(data, return_object, 2, 1,
+       status = acpi_ns_check_sorted_list(info, return_object, 0, 2, 1,
                                           ACPI_SORT_ASCENDING,
                                           "AmbientIlluminance");
 
@@ -248,7 +264,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_repair_FDE
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -262,7 +278,7 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_FDE(struct acpi_predefined_data *data,
+acpi_ns_repair_FDE(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
@@ -285,8 +301,8 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
                /* We can only repair if we have exactly 5 BYTEs */
 
                if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
-                                             data->node_flags,
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             info->node_flags,
                                              "Incorrect return buffer length %u, expected %u",
                                              return_object->buffer.length,
                                              ACPI_FDE_DWORD_BUFFER_SIZE));
@@ -316,10 +332,11 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
 
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                  "%s Expanded Byte Buffer to expected DWord Buffer\n",
-                                 data->pathname));
+                                 info->full_pathname));
                break;
 
        default:
+
                return (AE_AML_OPERAND_TYPE);
        }
 
@@ -328,7 +345,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
        acpi_ut_remove_reference(return_object);
        *return_object_ptr = buffer_object;
 
-       data->flags |= ACPI_OBJECT_REPAIRED;
+       info->return_flags |= ACPI_OBJECT_REPAIRED;
        return (AE_OK);
 }
 
@@ -336,7 +353,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
  *
  * FUNCTION:    acpi_ns_repair_CID
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -349,7 +366,7 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_CID(struct acpi_predefined_data *data,
+acpi_ns_repair_CID(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
        acpi_status status;
@@ -362,7 +379,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
        /* Check for _CID as a simple string */
 
        if (return_object->common.type == ACPI_TYPE_STRING) {
-               status = acpi_ns_repair_HID(data, return_object_ptr);
+               status = acpi_ns_repair_HID(info, return_object_ptr);
                return (status);
        }
 
@@ -379,7 +396,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
                original_element = *element_ptr;
                original_ref_count = original_element->common.reference_count;
 
-               status = acpi_ns_repair_HID(data, element_ptr);
+               status = acpi_ns_repair_HID(info, element_ptr);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -402,11 +419,97 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
        return (AE_OK);
 }
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_repair_CST
+ *
+ * PARAMETERS:  info                - Method execution information block
+ *              return_object_ptr   - Pointer to the object returned from the
+ *                                    evaluation of a method or object
+ *
+ * RETURN:      Status. AE_OK if object is OK or was repaired successfully
+ *
+ * DESCRIPTION: Repair for the _CST object:
+ *              1. Sort the list ascending by C state type
+ *              2. Ensure type cannot be zero
+ *              3. A sub-package count of zero means _CST is meaningless
+ *              4. Count must match the number of C state sub-packages
+ *
+ *****************************************************************************/
+
+static acpi_status
+acpi_ns_repair_CST(struct acpi_evaluate_info *info,
+                  union acpi_operand_object **return_object_ptr)
+{
+       union acpi_operand_object *return_object = *return_object_ptr;
+       union acpi_operand_object **outer_elements;
+       u32 outer_element_count;
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
+       u8 removing;
+       u32 i;
+
+       ACPI_FUNCTION_NAME(ns_repair_CST);
+
+       /*
+        * Check if the C-state type values are proportional.
+        */
+       outer_element_count = return_object->package.count - 1;
+       i = 0;
+       while (i < outer_element_count) {
+               outer_elements = &return_object->package.elements[i + 1];
+               removing = FALSE;
+
+               if ((*outer_elements)->package.count == 0) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             info->node_flags,
+                                             "SubPackage[%u] - removing entry due to zero count",
+                                             i));
+                       removing = TRUE;
+                       goto remove_element;
+               }
+
+               obj_desc = (*outer_elements)->package.elements[1];      /* Index1 = Type */
+               if ((u32)obj_desc->integer.value == 0) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             info->node_flags,
+                                             "SubPackage[%u] - removing entry due to invalid Type(0)",
+                                             i));
+                       removing = TRUE;
+               }
+
+             remove_element:
+               if (removing) {
+                       acpi_ns_remove_element(return_object, i + 1);
+                       outer_element_count--;
+               } else {
+                       i++;
+               }
+       }
+
+       /* Update top-level package count, Type "Integer" checked elsewhere */
+
+       obj_desc = return_object->package.elements[0];
+       obj_desc->integer.value = outer_element_count;
+
+       /*
+        * Entries (subpackages) in the _CST Package must be sorted by the
+        * C-state type, in ascending order.
+        */
+       status = acpi_ns_check_sorted_list(info, return_object, 1, 4, 1,
+                                          ACPI_SORT_ASCENDING, "C-State Type");
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       return (AE_OK);
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_ns_repair_HID
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -418,7 +521,7 @@ acpi_ns_repair_CID(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_HID(struct acpi_predefined_data *data,
+acpi_ns_repair_HID(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
@@ -435,12 +538,13 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
        }
 
        if (return_object->string.length == 0) {
-               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
                                      "Invalid zero-length _HID or _CID string"));
 
                /* Return AE_OK anyway, let driver handle it */
 
-               data->flags |= ACPI_OBJECT_REPAIRED;
+               info->return_flags |= ACPI_OBJECT_REPAIRED;
                return (AE_OK);
        }
 
@@ -464,7 +568,7 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
 
                ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                  "%s: Removed invalid leading asterisk\n",
-                                 data->pathname));
+                                 info->full_pathname));
        }
 
        /*
@@ -486,53 +590,69 @@ acpi_ns_repair_HID(struct acpi_predefined_data *data,
 
 /******************************************************************************
  *
- * FUNCTION:    acpi_ns_repair_TSS
+ * FUNCTION:    acpi_ns_repair_PRT
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
  * RETURN:      Status. AE_OK if object is OK or was repaired successfully
  *
- * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
- *              descending by the power dissipation values.
+ * DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed
+ *              source_name and source_index field, a common BIOS bug.
  *
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_TSS(struct acpi_predefined_data *data,
+acpi_ns_repair_PRT(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
-       union acpi_operand_object *return_object = *return_object_ptr;
-       acpi_status status;
-       struct acpi_namespace_node *node;
+       union acpi_operand_object *package_object = *return_object_ptr;
+       union acpi_operand_object **top_object_list;
+       union acpi_operand_object **sub_object_list;
+       union acpi_operand_object *obj_desc;
+       u32 element_count;
+       u32 index;
 
-       /*
-        * We can only sort the _TSS return package if there is no _PSS in the
-        * same scope. This is because if _PSS is present, the ACPI specification
-        * dictates that the _TSS Power Dissipation field is to be ignored, and
-        * therefore some BIOSs leave garbage values in the _TSS Power field(s).
-        * In this case, it is best to just return the _TSS package as-is.
-        * (May, 2011)
-        */
-       status =
-           acpi_ns_get_node(data->node, "^_PSS", ACPI_NS_NO_UPSEARCH, &node);
-       if (ACPI_SUCCESS(status)) {
-               return (AE_OK);
-       }
+       /* Each element in the _PRT package is a subpackage */
 
-       status = acpi_ns_check_sorted_list(data, return_object, 5, 1,
-                                          ACPI_SORT_DESCENDING,
-                                          "PowerDissipation");
+       top_object_list = package_object->package.elements;
+       element_count = package_object->package.count;
 
-       return (status);
+       for (index = 0; index < element_count; index++) {
+               sub_object_list = (*top_object_list)->package.elements;
+
+               /*
+                * If the BIOS has erroneously reversed the _PRT source_name (index 2)
+                * and the source_index (index 3), fix it. _PRT is important enough to
+                * workaround this BIOS error. This also provides compatibility with
+                * other ACPI implementations.
+                */
+               obj_desc = sub_object_list[3];
+               if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
+                       sub_object_list[3] = sub_object_list[2];
+                       sub_object_list[2] = obj_desc;
+                       info->return_flags |= ACPI_OBJECT_REPAIRED;
+
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             info->node_flags,
+                                             "PRT[%X]: Fixed reversed SourceName and SourceIndex",
+                                             index));
+               }
+
+               /* Point to the next union acpi_operand_object in the top level package */
+
+               top_object_list++;
+       }
+
+       return (AE_OK);
 }
 
 /******************************************************************************
  *
  * FUNCTION:    acpi_ns_repair_PSS
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object_ptr   - Pointer to the object returned from the
  *                                    evaluation of a method or object
  *
@@ -546,7 +666,7 @@ acpi_ns_repair_TSS(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_repair_PSS(struct acpi_predefined_data *data,
+acpi_ns_repair_PSS(struct acpi_evaluate_info *info,
                   union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
@@ -564,7 +684,7 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
         * incorrectly sorted, sort it. We sort by cpu_frequency, since this
         * should be proportional to the power.
         */
-       status = acpi_ns_check_sorted_list(data, return_object, 6, 0,
+       status = acpi_ns_check_sorted_list(info, return_object, 0, 6, 0,
                                           ACPI_SORT_DESCENDING,
                                           "CpuFrequency");
        if (ACPI_FAILURE(status)) {
@@ -584,8 +704,8 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
                obj_desc = elements[1]; /* Index1 = power_dissipation */
 
                if ((u32) obj_desc->integer.value > previous_value) {
-                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
-                                             data->node_flags,
+                       ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                             info->node_flags,
                                              "SubPackage[%u,%u] - suspicious power dissipation values",
                                              i - 1, i));
                }
@@ -597,12 +717,57 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
        return (AE_OK);
 }
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_repair_TSS
+ *
+ * PARAMETERS:  info                - Method execution information block
+ *              return_object_ptr   - Pointer to the object returned from the
+ *                                    evaluation of a method or object
+ *
+ * RETURN:      Status. AE_OK if object is OK or was repaired successfully
+ *
+ * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
+ *              descending by the power dissipation values.
+ *
+ *****************************************************************************/
+
+static acpi_status
+acpi_ns_repair_TSS(struct acpi_evaluate_info *info,
+                  union acpi_operand_object **return_object_ptr)
+{
+       union acpi_operand_object *return_object = *return_object_ptr;
+       acpi_status status;
+       struct acpi_namespace_node *node;
+
+       /*
+        * We can only sort the _TSS return package if there is no _PSS in the
+        * same scope. This is because if _PSS is present, the ACPI specification
+        * dictates that the _TSS Power Dissipation field is to be ignored, and
+        * therefore some BIOSs leave garbage values in the _TSS Power field(s).
+        * In this case, it is best to just return the _TSS package as-is.
+        * (May, 2011)
+        */
+       status = acpi_ns_get_node(info->node, "^_PSS",
+                                 ACPI_NS_NO_UPSEARCH, &node);
+       if (ACPI_SUCCESS(status)) {
+               return (AE_OK);
+       }
+
+       status = acpi_ns_check_sorted_list(info, return_object, 0, 5, 1,
+                                          ACPI_SORT_DESCENDING,
+                                          "PowerDissipation");
+
+       return (status);
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_sorted_list
  *
- * PARAMETERS:  data                - Pointer to validation data structure
+ * PARAMETERS:  info                - Method execution information block
  *              return_object       - Pointer to the top-level returned object
+ *              start_index         - Index of the first sub-package
  *              expected_count      - Minimum length of each sub-package
  *              sort_index          - Sub-package entry to sort on
  *              sort_direction      - Ascending or descending
@@ -617,8 +782,9 @@ acpi_ns_repair_PSS(struct acpi_predefined_data *data,
  *****************************************************************************/
 
 static acpi_status
-acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
+acpi_ns_check_sorted_list(struct acpi_evaluate_info *info,
                          union acpi_operand_object *return_object,
+                         u32 start_index,
                          u32 expected_count,
                          u32 sort_index,
                          u8 sort_direction, char *sort_key_name)
@@ -643,12 +809,14 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
         * Any NULL elements should have been removed by earlier call
         * to acpi_ns_remove_null_elements.
         */
-       outer_elements = return_object->package.elements;
        outer_element_count = return_object->package.count;
-       if (!outer_element_count) {
+       if (!outer_element_count || start_index >= outer_element_count) {
                return (AE_AML_PACKAGE_LIMIT);
        }
 
+       outer_elements = &return_object->package.elements[start_index];
+       outer_element_count -= start_index;
+
        previous_value = 0;
        if (sort_direction == ACPI_SORT_DESCENDING) {
                previous_value = ACPI_UINT32_MAX;
@@ -685,15 +853,16 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data,
                     (obj_desc->integer.value < previous_value)) ||
                    ((sort_direction == ACPI_SORT_DESCENDING) &&
                     (obj_desc->integer.value > previous_value))) {
-                       acpi_ns_sort_list(return_object->package.elements,
+                       acpi_ns_sort_list(&return_object->package.
+                                         elements[start_index],
                                          outer_element_count, sort_index,
                                          sort_direction);
 
-                       data->flags |= ACPI_OBJECT_REPAIRED;
+                       info->return_flags |= ACPI_OBJECT_REPAIRED;
 
                        ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
                                          "%s: Repaired unsorted list - now sorted by %s\n",
-                                         data->pathname, sort_key_name));
+                                         info->full_pathname, sort_key_name));
                        return (AE_OK);
                }
 
@@ -752,3 +921,52 @@ acpi_ns_sort_list(union acpi_operand_object **elements,
                }
        }
 }
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_remove_element
+ *
+ * PARAMETERS:  obj_desc            - Package object element list
+ *              index               - Index of element to remove
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Remove the requested element of a package and delete it.
+ *
+ *****************************************************************************/
+
+static void
+acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index)
+{
+       union acpi_operand_object **source;
+       union acpi_operand_object **dest;
+       u32 count;
+       u32 new_count;
+       u32 i;
+
+       ACPI_FUNCTION_NAME(ns_remove_element);
+
+       count = obj_desc->package.count;
+       new_count = count - 1;
+
+       source = obj_desc->package.elements;
+       dest = source;
+
+       /* Examine all elements of the package object, remove matched index */
+
+       for (i = 0; i < count; i++) {
+               if (i == index) {
+                       acpi_ut_remove_reference(*source);      /* Remove one ref for being in pkg */
+                       acpi_ut_remove_reference(*source);
+               } else {
+                       *dest = *source;
+                       dest++;
+               }
+               source++;
+       }
+
+       /* NULL terminate list and update the package count */
+
+       *dest = NULL;
+       obj_desc->package.count = new_count;
+}
index 2808586fad30c61a7bb6c5e014cde4b5a5dcff15..08c0b5beec888c65ea0d175f2795bb1be0f95227 100644 (file)
@@ -419,10 +419,12 @@ acpi_ns_externalize_name(u32 internal_name_length,
 
        switch (internal_name[0]) {
        case AML_ROOT_PREFIX:
+
                prefix_length = 1;
                break;
 
        case AML_PARENT_PREFIX:
+
                for (i = 0; i < internal_name_length; i++) {
                        if (ACPI_IS_PARENT_PREFIX(internal_name[i])) {
                                prefix_length = i + 1;
@@ -438,6 +440,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
                break;
 
        default:
+
                break;
        }
 
index fc69949151bb9cc073d61b9702eb6ef1c5fa91fd..f553cfdb71ddd6ec350b63077f6eda49f30daac9 100644 (file)
@@ -187,8 +187,6 @@ acpi_evaluate_object(acpi_handle handle,
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       info->pathname = pathname;
-
        /* Convert and validate the device handle */
 
        info->prefix_node = acpi_ns_validate_handle(handle);
@@ -198,17 +196,64 @@ acpi_evaluate_object(acpi_handle handle,
        }
 
        /*
-        * If there are parameters to be passed to a control method, the external
-        * objects must all be converted to internal objects
+        * Get the actual namespace node for the target object.
+        * Handles these cases:
+        *
+        * 1) Null node, valid pathname from root (absolute path)
+        * 2) Node and valid pathname (path relative to Node)
+        * 3) Node, Null pathname
+        */
+       if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
+
+               /* The path is fully qualified, just evaluate by name */
+
+               info->prefix_node = NULL;
+       } else if (!handle) {
+               /*
+                * A handle is optional iff a fully qualified pathname is specified.
+                * Since we've already handled fully qualified names above, this is
+                * an error.
+                */
+               if (!pathname) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Both Handle and Pathname are NULL"));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Null Handle with relative pathname [%s]",
+                                         pathname));
+               }
+
+               status = AE_BAD_PARAMETER;
+               goto cleanup;
+       }
+
+       info->relative_pathname = pathname;
+
+       /*
+        * Convert all external objects passed as arguments to the
+        * internal version(s).
         */
        if (external_params && external_params->count) {
+               info->param_count = (u16)external_params->count;
+
+               /* Warn on impossible argument count */
+
+               if (info->param_count > ACPI_METHOD_NUM_ARGS) {
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Excess arguments (%u) - using only %u",
+                                             info->param_count,
+                                             ACPI_METHOD_NUM_ARGS));
+
+                       info->param_count = ACPI_METHOD_NUM_ARGS;
+               }
+
                /*
                 * Allocate a new parameter block for the internal objects
                 * Add 1 to count to allow for null terminated internal list
                 */
-               info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
-                                                        external_params->
-                                                        count +
+               info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) info->
+                                                        param_count +
                                                         1) * sizeof(void *));
                if (!info->parameters) {
                        status = AE_NO_MEMORY;
@@ -217,7 +262,7 @@ acpi_evaluate_object(acpi_handle handle,
 
                /* Convert each external object in the list to an internal object */
 
-               for (i = 0; i < external_params->count; i++) {
+               for (i = 0; i < info->param_count; i++) {
                        status =
                            acpi_ut_copy_eobject_to_iobject(&external_params->
                                                            pointer[i],
@@ -227,43 +272,96 @@ acpi_evaluate_object(acpi_handle handle,
                                goto cleanup;
                        }
                }
-               info->parameters[external_params->count] = NULL;
+
+               info->parameters[info->param_count] = NULL;
        }
 
+#if 0
+
        /*
-        * Three major cases:
-        * 1) Fully qualified pathname
-        * 2) No handle, not fully qualified pathname (error)
-        * 3) Valid handle
+        * Begin incoming argument count analysis. Check for too few args
+        * and too many args.
         */
-       if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
 
-               /* The path is fully qualified, just evaluate by name */
+       switch (acpi_ns_get_type(info->node)) {
+       case ACPI_TYPE_METHOD:
+
+               /* Check incoming argument count against the method definition */
+
+               if (info->obj_desc->method.param_count > info->param_count) {
+                       ACPI_ERROR((AE_INFO,
+                                   "Insufficient arguments (%u) - %u are required",
+                                   info->param_count,
+                                   info->obj_desc->method.param_count));
+
+                       status = AE_MISSING_ARGUMENTS;
+                       goto cleanup;
+               }
+
+               else if (info->obj_desc->method.param_count < info->param_count) {
+                       ACPI_WARNING((AE_INFO,
+                                     "Excess arguments (%u) - only %u are required",
+                                     info->param_count,
+                                     info->obj_desc->method.param_count));
+
+                       /* Just pass the required number of arguments */
+
+                       info->param_count = info->obj_desc->method.param_count;
+               }
 
-               info->prefix_node = NULL;
-               status = acpi_ns_evaluate(info);
-       } else if (!handle) {
                /*
-                * A handle is optional iff a fully qualified pathname is specified.
-                * Since we've already handled fully qualified names above, this is
-                * an error
+                * Any incoming external objects to be passed as arguments to the
+                * method must be converted to internal objects
                 */
-               if (!pathname) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "Both Handle and Pathname are NULL"));
-               } else {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                         "Null Handle with relative pathname [%s]",
-                                         pathname));
+               if (info->param_count) {
+                       /*
+                        * Allocate a new parameter block for the internal objects
+                        * Add 1 to count to allow for null terminated internal list
+                        */
+                       info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)
+                                                                info->
+                                                                param_count +
+                                                                1) *
+                                                               sizeof(void *));
+                       if (!info->parameters) {
+                               status = AE_NO_MEMORY;
+                               goto cleanup;
+                       }
+
+                       /* Convert each external object in the list to an internal object */
+
+                       for (i = 0; i < info->param_count; i++) {
+                               status =
+                                   acpi_ut_copy_eobject_to_iobject
+                                   (&external_params->pointer[i],
+                                    &info->parameters[i]);
+                               if (ACPI_FAILURE(status)) {
+                                       goto cleanup;
+                               }
+                       }
+
+                       info->parameters[info->param_count] = NULL;
                }
+               break;
 
-               status = AE_BAD_PARAMETER;
-       } else {
-               /* We have a namespace a node and a possible relative path */
+       default:
+
+               /* Warn if arguments passed to an object that is not a method */
 
-               status = acpi_ns_evaluate(info);
+               if (info->param_count) {
+                       ACPI_WARNING((AE_INFO,
+                                     "%u arguments were passed to a non-method ACPI object",
+                                     info->param_count));
+               }
+               break;
        }
 
+#endif
+
+       /* Now we can evaluate the object */
+
+       status = acpi_ns_evaluate(info);
+
        /*
         * If we are expecting a return value, and all went well above,
         * copy the return value to an external object.
@@ -413,6 +511,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
                break;
 
        default:
+
                return;
        }
 
index 9f25a3d4e992c0dc890325f8ed0029942c3bac5b..91a5a69db80c316552e13f9704eb9435f9b94a30 100644 (file)
@@ -629,24 +629,28 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
 
                                switch (opcode) {
                                case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
+
                                        buffer_length =
                                            ACPI_GET8(parser_state->aml);
                                        parser_state->aml += 1;
                                        break;
 
                                case AML_WORD_OP:       /* AML_WORDDATA_ARG */
+
                                        buffer_length =
                                            ACPI_GET16(parser_state->aml);
                                        parser_state->aml += 2;
                                        break;
 
                                case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+
                                        buffer_length =
                                            ACPI_GET32(parser_state->aml);
                                        parser_state->aml += 4;
                                        break;
 
                                default:
+
                                        buffer_length = 0;
                                        break;
                                }
index 63c4554474817b591fdc0d71771dde8f2cf970ed..065b44ae538f28b7595fe9af1870b5c824052237 100644 (file)
@@ -164,7 +164,6 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
                        case AML_IF_OP:
                        case AML_ELSE_OP:
                        case AML_WHILE_OP:
-
                                /*
                                 * Currently supported module-level opcodes are:
                                 * IF/ELSE/WHILE. These appear to be the most common,
@@ -289,6 +288,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
                default:
 
                        /* No action for all other opcodes */
+
                        break;
                }
 
index 12c4028002b145e0fef8b9ed60ab9f00ccd100dc..95dc608a66a85b3b01e5a461b58a39f4a02b20f7 100644 (file)
@@ -402,6 +402,7 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
 
        switch (status) {
        case AE_OK:
+
                break;
 
        case AE_CTRL_TRANSFER:
index abc4c48b2eddd7c18acb854a5eeb960d73080393..86198a9139b52a653d24d6758ba63ed0d04df800 100644 (file)
@@ -176,10 +176,10 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 
                switch (parent_info->class) {
                case AML_CLASS_CONTROL:
+
                        break;
 
                case AML_CLASS_CREATE:
-
                        /*
                         * These opcodes contain term_arg operands. The current
                         * op must be replaced by a placeholder return op
@@ -192,7 +192,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
                        break;
 
                case AML_CLASS_NAMED_OBJECT:
-
                        /*
                         * These opcodes contain term_arg operands. The current
                         * op must be replaced by a placeholder return op
index c1934bf04f0af56f16db267dcdc5d3a914b749ab..877dc0de8df3e19da7057a8fd99042eb2d6f80b6 100644 (file)
@@ -308,7 +308,9 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
                break;
 
        default:
+
                /* All others have no children */
+
                break;
        }
 
index f682542689656d5ce98ba93db973fad907d41899..11b99ab20bb3a3c1a96cd5322149a4fefe7fbb4a 100644 (file)
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
        }
 
        if ((!acpi_gbl_trace_method_name) ||
-           (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) {
+           (acpi_gbl_trace_method_name != info->node->name.integer)) {
                goto exit;
        }
 
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
        }
 
        if ((!acpi_gbl_trace_method_name) ||
-           (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) {
+           (acpi_gbl_trace_method_name != info->node->name.integer)) {
                goto exit;
        }
 
@@ -226,15 +226,14 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
 
        /* Validate the Info and method Node */
 
-       if (!info || !info->resolved_node) {
+       if (!info || !info->node) {
                return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
        /* Init for new method, wait on concurrency semaphore */
 
        status =
-           acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc,
-                                          NULL);
+           acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
@@ -253,8 +252,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
                          "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
-                         info->resolved_node->name.ascii, info->resolved_node,
-                         info->obj_desc));
+                         info->node->name.ascii, info->node, info->obj_desc));
 
        /* Create and init a Root Node */
 
@@ -275,7 +273,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
                goto cleanup;
        }
 
-       status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
+       status = acpi_ds_init_aml_walk(walk_state, op, info->node,
                                       info->obj_desc->method.aml_start,
                                       info->obj_desc->method.aml_length, info,
                                       info->pass_number);
index 72077fa1eea5ecd7e5c489e3b65632c0be639ef2..b62a0f4f4f9bb527cd49fc95279b7032ba1a689a 100644 (file)
@@ -352,6 +352,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
                        break;
 
                default:
+
                        break;
                }
 
@@ -539,6 +540,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
                        break;
 
                default:
+
                        break;
                }
 
@@ -650,8 +652,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
 
                name_found = FALSE;
 
-               for (table_index = 0; table_index < 4 && !name_found;
-                    table_index++) {
+               for (table_index = 0;
+                    table_index < package_element->package.count
+                    && !name_found; table_index++) {
                        if (*sub_object_list && /* Null object allowed */
                            ((ACPI_TYPE_STRING ==
                              (*sub_object_list)->common.type) ||
index f8b55b426c9d9b83abfe7f1d1a42692406cf0cc7..65f3e1c5b5989f61bdcb03e6620cdd1a7371dba9 100644 (file)
@@ -273,17 +273,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                 */
                user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
 
-               /* Each element of the top-level package must also be a package */
-
-               if ((*top_object_list)->common.type != ACPI_TYPE_PACKAGE) {
-                       ACPI_ERROR((AE_INFO,
-                                   "(PRT[%u]) Need sub-package, found %s",
-                                   index,
-                                   acpi_ut_get_object_type_name
-                                   (*top_object_list)));
-                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
-               }
-
                /* Each sub-package must be of length 4 */
 
                if ((*top_object_list)->package.count != 4) {
@@ -326,22 +315,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 
                user_prt->pin = (u32) obj_desc->integer.value;
 
-               /*
-                * If the BIOS has erroneously reversed the _PRT source_name (index 2)
-                * and the source_index (index 3), fix it. _PRT is important enough to
-                * workaround this BIOS error. This also provides compatibility with
-                * other ACPI implementations.
-                */
-               obj_desc = sub_object_list[3];
-               if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
-                       sub_object_list[3] = sub_object_list[2];
-                       sub_object_list[2] = obj_desc;
-
-                       ACPI_WARNING((AE_INFO,
-                                     "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed",
-                                     index));
-               }
-
                /*
                 * 3) Third subobject: Dereference the PRT.source_name
                 * The name may be unresolved (slack mode), so allow a null object
index b5fc0db2e87bb4a78ddbaa707ee91a886b4e7215..8a2d4986b0aa576695ed2f479703cfa8dc4fd139 100644 (file)
@@ -120,17 +120,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                        /* Strings */
 
                case ACPI_RSD_LITERAL:
+
                        acpi_rs_out_string(name,
                                           ACPI_CAST_PTR(char, table->pointer));
                        break;
 
                case ACPI_RSD_STRING:
+
                        acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
                        break;
 
                        /* Data items, 8/16/32/64 bit */
 
                case ACPI_RSD_UINT8:
+
                        if (table->pointer) {
                                acpi_rs_out_string(name, ACPI_CAST_PTR(char,
                                                                       table->
@@ -142,20 +145,24 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                        break;
 
                case ACPI_RSD_UINT16:
+
                        acpi_rs_out_integer16(name, ACPI_GET16(target));
                        break;
 
                case ACPI_RSD_UINT32:
+
                        acpi_rs_out_integer32(name, ACPI_GET32(target));
                        break;
 
                case ACPI_RSD_UINT64:
+
                        acpi_rs_out_integer64(name, ACPI_GET64(target));
                        break;
 
                        /* Flags: 1-bit and 2-bit flags supported */
 
                case ACPI_RSD_1BITFLAG:
+
                        acpi_rs_out_string(name, ACPI_CAST_PTR(char,
                                                               table->
                                                               pointer[*target &
@@ -163,6 +170,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                        break;
 
                case ACPI_RSD_2BITFLAG:
+
                        acpi_rs_out_string(name, ACPI_CAST_PTR(char,
                                                               table->
                                                               pointer[*target &
@@ -170,6 +178,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                        break;
 
                case ACPI_RSD_3BITFLAG:
+
                        acpi_rs_out_string(name, ACPI_CAST_PTR(char,
                                                               table->
                                                               pointer[*target &
@@ -258,6 +267,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                        break;
 
                default:
+
                        acpi_os_printf("**** Invalid table opcode [%X] ****\n",
                                       table->opcode);
                        return;
index d5bf05a96096ad785897966876929b02dba60c02..80d12994e0d078f10b8842d6c5ee3d8a4c965c35 100644 (file)
@@ -194,7 +194,6 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
                        break;
 
                case ACPI_RSC_COUNT_GPIO_RES:
-
                        /*
                         * Vendor data is optional (length/offset may both be zero)
                         * Examine vendor data length field first
@@ -410,12 +409,14 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
                         */
                        switch (info->resource_offset) {
                        case ACPI_RSC_COMPARE_AML_LENGTH:
+
                                if (aml_resource_length != info->value) {
                                        goto exit;
                                }
                                break;
 
                        case ACPI_RSC_COMPARE_VALUE:
+
                                if (ACPI_GET8(source) != info->value) {
                                        goto exit;
                                }
index a44953c6f75da74d7c0e160078eff90b5abfc5ba..480b6b40c5eaa3527ce58b4f76f2b8a23b16db97 100644 (file)
@@ -147,6 +147,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
                case ACPI_RSC_MOVE_GPIO_RES:
                case ACPI_RSC_MOVE_SERIAL_VEN:
                case ACPI_RSC_MOVE_SERIAL_RES:
+
                        ACPI_MEMCPY(destination, source, item_count);
                        return;
 
@@ -157,21 +158,25 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
                         */
                case ACPI_RSC_MOVE16:
                case ACPI_RSC_MOVE_GPIO_PIN:
+
                        ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
                                           &ACPI_CAST_PTR(u16, source)[i]);
                        break;
 
                case ACPI_RSC_MOVE32:
+
                        ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
                                           &ACPI_CAST_PTR(u32, source)[i]);
                        break;
 
                case ACPI_RSC_MOVE64:
+
                        ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
                                           &ACPI_CAST_PTR(u64, source)[i]);
                        break;
 
                default:
+
                        return;
                }
        }
@@ -736,7 +741,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
        }
 
        info->prefix_node = node;
-       info->pathname = METHOD_NAME__SRS;
+       info->relative_pathname = METHOD_NAME__SRS;
        info->parameters = args;
        info->flags = ACPI_IGNORE_RETURN_VALUE;
 
index c0e5d2d3ce6757380928c9e50d1f2de0f158160a..94e3517554f9d52d121dd4f31469ddb4a9ec6567 100644 (file)
@@ -402,6 +402,7 @@ acpi_resource_to_address64(struct acpi_resource *resource,
                break;
 
        default:
+
                return (AE_BAD_PARAMETER);
        }
 
index e57cd38004e33c3adb3b7850bc25b4f23f577430..42a13c0d7015360ab44c684ab9645500fc63f1d8 100644 (file)
@@ -141,8 +141,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
                ACPI_BIOS_ERROR((AE_INFO,
                                 "Table has invalid signature [%4.4s] (0x%8.8X), "
                                 "must be SSDT or OEMx",
-                                acpi_ut_valid_acpi_name(*(u32 *)table_desc->
-                                                        pointer->
+                                acpi_ut_valid_acpi_name(table_desc->pointer->
                                                         signature) ?
                                 table_desc->pointer->signature : "????",
                                 *(u32 *)table_desc->pointer->signature));
@@ -471,15 +470,19 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc)
        }
        switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) {
        case ACPI_TABLE_ORIGIN_MAPPED:
+
                acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
                break;
+
        case ACPI_TABLE_ORIGIN_ALLOCATED:
+
                ACPI_FREE(table_desc->pointer);
                break;
 
                /* Not mapped or allocated, there is nothing we can do */
 
        default:
+
                return;
        }
 
diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c
new file mode 100644 (file)
index 0000000..dc963f8
--- /dev/null
@@ -0,0 +1,237 @@
+/******************************************************************************
+ *
+ * Module Name: tbprint - Table output utilities
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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 "accommon.h"
+#include "actables.h"
+
+#define _COMPONENT          ACPI_TABLES
+ACPI_MODULE_NAME("tbprint")
+
+/* Local prototypes */
+static void acpi_tb_fix_string(char *string, acpi_size length);
+
+static void
+acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
+                            struct acpi_table_header *header);
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_fix_string
+ *
+ * PARAMETERS:  string              - String to be repaired
+ *              length              - Maximum length
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
+ *              with a question mark '?'.
+ *
+ ******************************************************************************/
+
+static void acpi_tb_fix_string(char *string, acpi_size length)
+{
+
+       while (length && *string) {
+               if (!ACPI_IS_PRINT(*string)) {
+                       *string = '?';
+               }
+               string++;
+               length--;
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_cleanup_table_header
+ *
+ * PARAMETERS:  out_header          - Where the cleaned header is returned
+ *              header              - Input ACPI table header
+ *
+ * RETURN:      Returns the cleaned header in out_header
+ *
+ * DESCRIPTION: Copy the table header and ensure that all "string" fields in
+ *              the header consist of printable characters.
+ *
+ ******************************************************************************/
+
+static void
+acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
+                            struct acpi_table_header *header)
+{
+
+       ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
+
+       acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
+       acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
+       acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+       acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_print_table_header
+ *
+ * PARAMETERS:  address             - Table physical address
+ *              header              - Table header
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
+ *
+ ******************************************************************************/
+
+void
+acpi_tb_print_table_header(acpi_physical_address address,
+                          struct acpi_table_header *header)
+{
+       struct acpi_table_header local_header;
+
+       /*
+        * The reason that the Address is cast to a void pointer is so that we
+        * can use %p which will work properly on both 32-bit and 64-bit hosts.
+        */
+       if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
+
+               /* FACS only has signature and length fields */
+
+               ACPI_INFO((AE_INFO, "%4.4s %p %05X",
+                          header->signature, ACPI_CAST_PTR(void, address),
+                          header->length));
+       } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
+
+               /* RSDP has no common fields */
+
+               ACPI_MEMCPY(local_header.oem_id,
+                           ACPI_CAST_PTR(struct acpi_table_rsdp,
+                                         header)->oem_id, ACPI_OEM_ID_SIZE);
+               acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
+
+               ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
+                          ACPI_CAST_PTR(void, address),
+                          (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
+                           revision >
+                           0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
+                                              header)->length : 20,
+                          ACPI_CAST_PTR(struct acpi_table_rsdp,
+                                        header)->revision,
+                          local_header.oem_id));
+       } else {
+               /* Standard ACPI table with full common header */
+
+               acpi_tb_cleanup_table_header(&local_header, header);
+
+               ACPI_INFO((AE_INFO,
+                          "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
+                          local_header.signature, ACPI_CAST_PTR(void, address),
+                          local_header.length, local_header.revision,
+                          local_header.oem_id, local_header.oem_table_id,
+                          local_header.oem_revision,
+                          local_header.asl_compiler_id,
+                          local_header.asl_compiler_revision));
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_validate_checksum
+ *
+ * PARAMETERS:  table               - ACPI table to verify
+ *              length              - Length of entire table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
+ *              exception on bad checksum.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
+{
+       u8 checksum;
+
+       /* Compute the checksum on the table */
+
+       checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
+
+       /* Checksum ok? (should be zero) */
+
+       if (checksum) {
+               ACPI_BIOS_WARNING((AE_INFO,
+                                  "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
+                                  "should be 0x%2.2X",
+                                  table->signature, table->checksum,
+                                  (u8)(table->checksum - checksum)));
+
+#if (ACPI_CHECKSUM_ABORT)
+               return (AE_BAD_CHECKSUM);
+#endif
+       }
+
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_checksum
+ *
+ * PARAMETERS:  buffer          - Pointer to memory region to be checked
+ *              length          - Length of this memory region
+ *
+ * RETURN:      Checksum (u8)
+ *
+ * DESCRIPTION: Calculates circular checksum of memory region.
+ *
+ ******************************************************************************/
+
+u8 acpi_tb_checksum(u8 *buffer, u32 length)
+{
+       u8 sum = 0;
+       u8 *end = buffer + length;
+
+       while (buffer < end) {
+               sum = (u8)(sum + *(buffer++));
+       }
+
+       return (sum);
+}
index ce3d5db39a9c742d49fc7aa9103121942da73c6a..bffdfc7b832254068378320a94385abdd359c715 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: tbutils   - table utilities
+ * Module Name: tbutils - ACPI Table utilities
  *
  *****************************************************************************/
 
 ACPI_MODULE_NAME("tbutils")
 
 /* Local prototypes */
-static void acpi_tb_fix_string(char *string, acpi_size length);
-
-static void
-acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
-                            struct acpi_table_header *header);
-
 static acpi_physical_address
 acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
@@ -174,189 +168,6 @@ u8 acpi_tb_tables_loaded(void)
        return (FALSE);
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_fix_string
- *
- * PARAMETERS:  string              - String to be repaired
- *              length              - Maximum length
- *
- * RETURN:      None
- *
- * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
- *              with a question mark '?'.
- *
- ******************************************************************************/
-
-static void acpi_tb_fix_string(char *string, acpi_size length)
-{
-
-       while (length && *string) {
-               if (!ACPI_IS_PRINT(*string)) {
-                       *string = '?';
-               }
-               string++;
-               length--;
-       }
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_cleanup_table_header
- *
- * PARAMETERS:  out_header          - Where the cleaned header is returned
- *              header              - Input ACPI table header
- *
- * RETURN:      Returns the cleaned header in out_header
- *
- * DESCRIPTION: Copy the table header and ensure that all "string" fields in
- *              the header consist of printable characters.
- *
- ******************************************************************************/
-
-static void
-acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
-                            struct acpi_table_header *header)
-{
-
-       ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
-
-       acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
-       acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
-       acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
-       acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_print_table_header
- *
- * PARAMETERS:  address             - Table physical address
- *              header              - Table header
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
- *
- ******************************************************************************/
-
-void
-acpi_tb_print_table_header(acpi_physical_address address,
-                          struct acpi_table_header *header)
-{
-       struct acpi_table_header local_header;
-
-       /*
-        * The reason that the Address is cast to a void pointer is so that we
-        * can use %p which will work properly on both 32-bit and 64-bit hosts.
-        */
-       if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
-
-               /* FACS only has signature and length fields */
-
-               ACPI_INFO((AE_INFO, "%4.4s %p %05X",
-                          header->signature, ACPI_CAST_PTR(void, address),
-                          header->length));
-       } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
-
-               /* RSDP has no common fields */
-
-               ACPI_MEMCPY(local_header.oem_id,
-                           ACPI_CAST_PTR(struct acpi_table_rsdp,
-                                         header)->oem_id, ACPI_OEM_ID_SIZE);
-               acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
-
-               ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
-                          ACPI_CAST_PTR (void, address),
-                          (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
-                           revision >
-                           0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
-                                              header)->length : 20,
-                          ACPI_CAST_PTR(struct acpi_table_rsdp,
-                                        header)->revision,
-                          local_header.oem_id));
-       } else {
-               /* Standard ACPI table with full common header */
-
-               acpi_tb_cleanup_table_header(&local_header, header);
-
-               ACPI_INFO((AE_INFO,
-                          "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
-                          local_header.signature, ACPI_CAST_PTR(void, address),
-                          local_header.length, local_header.revision,
-                          local_header.oem_id, local_header.oem_table_id,
-                          local_header.oem_revision,
-                          local_header.asl_compiler_id,
-                          local_header.asl_compiler_revision));
-
-       }
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_validate_checksum
- *
- * PARAMETERS:  table               - ACPI table to verify
- *              length              - Length of entire table
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
- *              exception on bad checksum.
- *
- ******************************************************************************/
-
-acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length)
-{
-       u8 checksum;
-
-       /* Compute the checksum on the table */
-
-       checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length);
-
-       /* Checksum ok? (should be zero) */
-
-       if (checksum) {
-               ACPI_BIOS_WARNING((AE_INFO,
-                                  "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
-                                  "should be 0x%2.2X",
-                                  table->signature, table->checksum,
-                                  (u8)(table->checksum - checksum)));
-
-#if (ACPI_CHECKSUM_ABORT)
-
-               return (AE_BAD_CHECKSUM);
-#endif
-       }
-
-       return (AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_tb_checksum
- *
- * PARAMETERS:  buffer          - Pointer to memory region to be checked
- *              length          - Length of this memory region
- *
- * RETURN:      Checksum (u8)
- *
- * DESCRIPTION: Calculates circular checksum of memory region.
- *
- ******************************************************************************/
-
-u8 acpi_tb_checksum(u8 *buffer, u32 length)
-{
-       u8 sum = 0;
-       u8 *end = buffer + length;
-
-       while (buffer < end) {
-               sum = (u8) (sum + *(buffer++));
-       }
-
-       return (sum);
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_check_dsdt_header
index 67e046ec8f0afaedfec54d273b3193a9cffbb63a..0ba9e328d5d7b0c6fa199f4c7c8bc11ad135c9a1 100644 (file)
@@ -53,8 +53,6 @@ ACPI_MODULE_NAME("tbxfload")
 /* Local prototypes */
 static acpi_status acpi_tb_load_namespace(void);
 
-static int no_auto_ssdt;
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_load_tables
@@ -180,8 +178,16 @@ static acpi_status acpi_tb_load_namespace(void)
                        continue;
                }
 
-               if (no_auto_ssdt) {
-                       printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
+               /*
+                * Optionally do not load any SSDTs from the RSDT/XSDT. This can
+                * be useful for debugging ACPI problems on some machines.
+                */
+               if (acpi_gbl_disable_ssdt_table_load) {
+                       ACPI_INFO((AE_INFO, "Ignoring %4.4s at %p",
+                                  acpi_gbl_root_table_list.tables[i].signature.
+                                  ascii, ACPI_CAST_PTR(void,
+                                                       acpi_gbl_root_table_list.
+                                                       tables[i].address)));
                        continue;
                }
 
@@ -376,14 +382,3 @@ acpi_status acpi_unload_parent_table(acpi_handle object)
 }
 
 ACPI_EXPORT_SYMBOL(acpi_unload_parent_table)
-
-static int __init acpi_no_auto_ssdt_setup(char *s) {
-
-        printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
-
-        no_auto_ssdt = 1;
-
-        return 1;
-}
-
-__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c
new file mode 100644 (file)
index 0000000..11fde93
--- /dev/null
@@ -0,0 +1,201 @@
+/******************************************************************************
+ *
+ * Module Name: utbuffer - Buffer dump routines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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 "accommon.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+ACPI_MODULE_NAME("utbuffer")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_dump_buffer
+ *
+ * PARAMETERS:  buffer              - Buffer to dump
+ *              count               - Amount to dump, in bytes
+ *              display             - BYTE, WORD, DWORD, or QWORD display:
+ *                                      DB_BYTE_DISPLAY
+ *                                      DB_WORD_DISPLAY
+ *                                      DB_DWORD_DISPLAY
+ *                                      DB_QWORD_DISPLAY
+ *              base_offset         - Beginning buffer offset (display only)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ******************************************************************************/
+void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
+{
+       u32 i = 0;
+       u32 j;
+       u32 temp32;
+       u8 buf_char;
+
+       if (!buffer) {
+               acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
+               return;
+       }
+
+       if ((count < 4) || (count & 0x01)) {
+               display = DB_BYTE_DISPLAY;
+       }
+
+       /* Nasty little dump buffer routine! */
+
+       while (i < count) {
+
+               /* Print current offset */
+
+               acpi_os_printf("%6.4X: ", (base_offset + i));
+
+               /* Print 16 hex chars */
+
+               for (j = 0; j < 16;) {
+                       if (i + j >= count) {
+
+                               /* Dump fill spaces */
+
+                               acpi_os_printf("%*s", ((display * 2) + 1), " ");
+                               j += display;
+                               continue;
+                       }
+
+                       switch (display) {
+                       case DB_BYTE_DISPLAY:
+                       default:        /* Default is BYTE display */
+
+                               acpi_os_printf("%02X ",
+                                              buffer[(acpi_size) i + j]);
+                               break;
+
+                       case DB_WORD_DISPLAY:
+
+                               ACPI_MOVE_16_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
+                               acpi_os_printf("%04X ", temp32);
+                               break;
+
+                       case DB_DWORD_DISPLAY:
+
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
+                               acpi_os_printf("%08X ", temp32);
+                               break;
+
+                       case DB_QWORD_DISPLAY:
+
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j]);
+                               acpi_os_printf("%08X", temp32);
+
+                               ACPI_MOVE_32_TO_32(&temp32,
+                                                  &buffer[(acpi_size) i + j +
+                                                          4]);
+                               acpi_os_printf("%08X ", temp32);
+                               break;
+                       }
+
+                       j += display;
+               }
+
+               /*
+                * Print the ASCII equivalent characters but watch out for the bad
+                * unprintable ones (printable chars are 0x20 through 0x7E)
+                */
+               acpi_os_printf(" ");
+               for (j = 0; j < 16; j++) {
+                       if (i + j >= count) {
+                               acpi_os_printf("\n");
+                               return;
+                       }
+
+                       buf_char = buffer[(acpi_size) i + j];
+                       if (ACPI_IS_PRINT(buf_char)) {
+                               acpi_os_printf("%c", buf_char);
+                       } else {
+                               acpi_os_printf(".");
+                       }
+               }
+
+               /* Done with that line. */
+
+               acpi_os_printf("\n");
+               i += 16;
+       }
+
+       return;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_debug_dump_buffer
+ *
+ * PARAMETERS:  buffer              - Buffer to dump
+ *              count               - Amount to dump, in bytes
+ *              display             - BYTE, WORD, DWORD, or QWORD display:
+ *                                      DB_BYTE_DISPLAY
+ *                                      DB_WORD_DISPLAY
+ *                                      DB_DWORD_DISPLAY
+ *                                      DB_QWORD_DISPLAY
+ *              component_ID        - Caller's component ID
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
+{
+
+       /* Only dump the buffer if tracing is enabled */
+
+       if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
+             (component_id & acpi_dbg_layer))) {
+               return;
+       }
+
+       acpi_ut_dump_buffer(buffer, count, display, 0);
+}
index e4c9291fc0a3f530bfaea472895f6217a23f8b99..1731c27c36a682e5d47beba328096ff9c633043a 100644 (file)
@@ -178,7 +178,6 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
 
                switch (internal_object->reference.class) {
                case ACPI_REFCLASS_NAME:
-
                        /*
                         * For namepath, return the object handle ("reference")
                         * We are referring to the namespace node
@@ -264,7 +263,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
 
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
-
                /*
                 * This is a simple or null object
                 */
@@ -278,7 +276,6 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
                break;
 
        case ACPI_COPY_TYPE_PACKAGE:
-
                /*
                 * Build the package object
                 */
@@ -304,6 +301,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
                break;
 
        default:
+
                return (AE_BAD_PARAMETER);
        }
 
@@ -481,6 +479,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
                return_ACPI_STATUS(AE_OK);
 
        default:
+
                /* All other types are not supported */
 
                ACPI_ERROR((AE_INFO,
@@ -544,7 +543,9 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
                break;
 
        default:
+
                /* Other types can't get here */
+
                break;
        }
 
@@ -800,7 +801,9 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
                break;
 
        default:
+
                /* Nothing to do for other simple objects */
+
                break;
        }
 
@@ -868,7 +871,6 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
                break;
 
        case ACPI_COPY_TYPE_PACKAGE:
-
                /*
                 * This object is a package - go down another nesting level
                 * Create and build the package object
@@ -891,6 +893,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
                break;
 
        default:
+
                return (AE_BAD_PARAMETER);
        }
 
index c57d9cc07ba913c9576792f395ffcea08a76fc03..5796e11a0671d32fad4329262e05b51d038cd38e 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: utdebug - Debug print routines
+ * Module Name: utdebug - Debug print/trace routines
  *
  *****************************************************************************/
 
@@ -543,149 +543,3 @@ acpi_ut_ptr_exit(u32 line_number,
 }
 
 #endif
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_dump_buffer
- *
- * PARAMETERS:  buffer              - Buffer to dump
- *              count               - Amount to dump, in bytes
- *              display             - BYTE, WORD, DWORD, or QWORD display
- *              offset              - Beginning buffer offset (display only)
- *
- * RETURN:      None
- *
- * DESCRIPTION: Generic dump buffer in both hex and ascii.
- *
- ******************************************************************************/
-
-void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
-{
-       u32 i = 0;
-       u32 j;
-       u32 temp32;
-       u8 buf_char;
-
-       if (!buffer) {
-               acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n");
-               return;
-       }
-
-       if ((count < 4) || (count & 0x01)) {
-               display = DB_BYTE_DISPLAY;
-       }
-
-       /* Nasty little dump buffer routine! */
-
-       while (i < count) {
-
-               /* Print current offset */
-
-               acpi_os_printf("%6.4X: ", (base_offset + i));
-
-               /* Print 16 hex chars */
-
-               for (j = 0; j < 16;) {
-                       if (i + j >= count) {
-
-                               /* Dump fill spaces */
-
-                               acpi_os_printf("%*s", ((display * 2) + 1), " ");
-                               j += display;
-                               continue;
-                       }
-
-                       switch (display) {
-                       case DB_BYTE_DISPLAY:
-                       default:        /* Default is BYTE display */
-
-                               acpi_os_printf("%02X ",
-                                              buffer[(acpi_size) i + j]);
-                               break;
-
-                       case DB_WORD_DISPLAY:
-
-                               ACPI_MOVE_16_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
-                               acpi_os_printf("%04X ", temp32);
-                               break;
-
-                       case DB_DWORD_DISPLAY:
-
-                               ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
-                               acpi_os_printf("%08X ", temp32);
-                               break;
-
-                       case DB_QWORD_DISPLAY:
-
-                               ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
-                               acpi_os_printf("%08X", temp32);
-
-                               ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j +
-                                                          4]);
-                               acpi_os_printf("%08X ", temp32);
-                               break;
-                       }
-
-                       j += display;
-               }
-
-               /*
-                * Print the ASCII equivalent characters but watch out for the bad
-                * unprintable ones (printable chars are 0x20 through 0x7E)
-                */
-               acpi_os_printf(" ");
-               for (j = 0; j < 16; j++) {
-                       if (i + j >= count) {
-                               acpi_os_printf("\n");
-                               return;
-                       }
-
-                       buf_char = buffer[(acpi_size) i + j];
-                       if (ACPI_IS_PRINT(buf_char)) {
-                               acpi_os_printf("%c", buf_char);
-                       } else {
-                               acpi_os_printf(".");
-                       }
-               }
-
-               /* Done with that line. */
-
-               acpi_os_printf("\n");
-               i += 16;
-       }
-
-       return;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_debug_dump_buffer
- *
- * PARAMETERS:  buffer              - Buffer to dump
- *              count               - Amount to dump, in bytes
- *              display             - BYTE, WORD, DWORD, or QWORD display
- *              component_ID        - Caller's component ID
- *
- * RETURN:      None
- *
- * DESCRIPTION: Generic dump buffer in both hex and ascii.
- *
- ******************************************************************************/
-
-void
-acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
-{
-
-       /* Only dump the buffer if tracing is enabled */
-
-       if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
-             (component_id & acpi_dbg_layer))) {
-               return;
-       }
-
-       acpi_ut_dump_buffer(buffer, count, display, 0);
-}
index 29b930250b6fe01a7822a229dc0f45ed80290a52..d6b33f29d32754a50eef108ce1287b59886b013b 100644 (file)
@@ -303,6 +303,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                break;
 
        default:
+
                break;
        }
 
@@ -508,7 +509,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
                case ACPI_TYPE_PROCESSOR:
                case ACPI_TYPE_POWER:
                case ACPI_TYPE_THERMAL:
-
                        /*
                         * Update the notify objects for these types (if present)
                         * Two lists, system and device notify handlers.
@@ -623,6 +623,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
 
                case ACPI_TYPE_REGION:
                default:
+
                        break;  /* No subobjects for all other types */
                }
 
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c
new file mode 100644 (file)
index 0000000..154fdca
--- /dev/null
@@ -0,0 +1,289 @@
+/*******************************************************************************
+ *
+ * Module Name: uterror - Various internal error/warning output functions
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, 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 "accommon.h"
+#include "acnamesp.h"
+
+#define _COMPONENT          ACPI_UTILITIES
+ACPI_MODULE_NAME("uterror")
+
+/*
+ * This module contains internal error functions that may
+ * be configured out.
+ */
+#if !defined (ACPI_NO_ERROR_MESSAGES)
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_predefined_warning
+ *
+ * PARAMETERS:  module_name     - Caller's module name (for error output)
+ *              line_number     - Caller's line number (for error output)
+ *              pathname        - Full pathname to the node
+ *              node_flags      - From Namespace node for the method/object
+ *              format          - Printf format string + additional args
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Warnings for the predefined validation module. Messages are
+ *              only emitted the first time a problem with a particular
+ *              method/object is detected. This prevents a flood of error
+ *              messages for methods that are repeatedly evaluated.
+ *
+ ******************************************************************************/
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_predefined_warning(const char *module_name,
+                          u32 line_number,
+                          char *pathname,
+                          u8 node_flags, const char *format, ...)
+{
+       va_list arg_list;
+
+       /*
+        * Warning messages for this method/object will be disabled after the
+        * first time a validation fails or an object is successfully repaired.
+        */
+       if (node_flags & ANOBJ_EVALUATED) {
+               return;
+       }
+
+       acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname);
+
+       va_start(arg_list, format);
+       acpi_os_vprintf(format, arg_list);
+       ACPI_MSG_SUFFIX;
+       va_end(arg_list);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_predefined_info
+ *
+ * PARAMETERS:  module_name     - Caller's module name (for error output)
+ *              line_number     - Caller's line number (for error output)
+ *              pathname        - Full pathname to the node
+ *              node_flags      - From Namespace node for the method/object
+ *              format          - Printf format string + additional args
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Info messages for the predefined validation module. Messages
+ *              are only emitted the first time a problem with a particular
+ *              method/object is detected. This prevents a flood of
+ *              messages for methods that are repeatedly evaluated.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_predefined_info(const char *module_name,
+                       u32 line_number,
+                       char *pathname, u8 node_flags, const char *format, ...)
+{
+       va_list arg_list;
+
+       /*
+        * Warning messages for this method/object will be disabled after the
+        * first time a validation fails or an object is successfully repaired.
+        */
+       if (node_flags & ANOBJ_EVALUATED) {
+               return;
+       }
+
+       acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname);
+
+       va_start(arg_list, format);
+       acpi_os_vprintf(format, arg_list);
+       ACPI_MSG_SUFFIX;
+       va_end(arg_list);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_predefined_bios_error
+ *
+ * PARAMETERS:  module_name     - Caller's module name (for error output)
+ *              line_number     - Caller's line number (for error output)
+ *              pathname        - Full pathname to the node
+ *              node_flags      - From Namespace node for the method/object
+ *              format          - Printf format string + additional args
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: BIOS error message for predefined names. Messages
+ *              are only emitted the first time a problem with a particular
+ *              method/object is detected. This prevents a flood of
+ *              messages for methods that are repeatedly evaluated.
+ *
+ ******************************************************************************/
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_predefined_bios_error(const char *module_name,
+                             u32 line_number,
+                             char *pathname,
+                             u8 node_flags, const char *format, ...)
+{
+       va_list arg_list;
+
+       /*
+        * Warning messages for this method/object will be disabled after the
+        * first time a validation fails or an object is successfully repaired.
+        */
+       if (node_flags & ANOBJ_EVALUATED) {
+               return;
+       }
+
+       acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname);
+
+       va_start(arg_list, format);
+       acpi_os_vprintf(format, arg_list);
+       ACPI_MSG_SUFFIX;
+       va_end(arg_list);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_namespace_error
+ *
+ * PARAMETERS:  module_name         - Caller's module name (for error output)
+ *              line_number         - Caller's line number (for error output)
+ *              internal_name       - Name or path of the namespace node
+ *              lookup_status       - Exception code from NS lookup
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message with the full pathname for the NS node.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_namespace_error(const char *module_name,
+                       u32 line_number,
+                       const char *internal_name, acpi_status lookup_status)
+{
+       acpi_status status;
+       u32 bad_name;
+       char *name = NULL;
+
+       ACPI_MSG_REDIRECT_BEGIN;
+       acpi_os_printf(ACPI_MSG_ERROR);
+
+       if (lookup_status == AE_BAD_CHARACTER) {
+
+               /* There is a non-ascii character in the name */
+
+               ACPI_MOVE_32_TO_32(&bad_name,
+                                  ACPI_CAST_PTR(u32, internal_name));
+               acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
+       } else {
+               /* Convert path to external format */
+
+               status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
+                                                 internal_name, NULL, &name);
+
+               /* Print target name */
+
+               if (ACPI_SUCCESS(status)) {
+                       acpi_os_printf("[%s]", name);
+               } else {
+                       acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
+               }
+
+               if (name) {
+                       ACPI_FREE(name);
+               }
+       }
+
+       acpi_os_printf(" Namespace lookup failure, %s",
+                      acpi_format_exception(lookup_status));
+
+       ACPI_MSG_SUFFIX;
+       ACPI_MSG_REDIRECT_END;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_method_error
+ *
+ * PARAMETERS:  module_name         - Caller's module name (for error output)
+ *              line_number         - Caller's line number (for error output)
+ *              message             - Error message to use on failure
+ *              prefix_node         - Prefix relative to the path
+ *              path                - Path to the node (optional)
+ *              method_status       - Execution status
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print error message with the full pathname for the method.
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_method_error(const char *module_name,
+                    u32 line_number,
+                    const char *message,
+                    struct acpi_namespace_node *prefix_node,
+                    const char *path, acpi_status method_status)
+{
+       acpi_status status;
+       struct acpi_namespace_node *node = prefix_node;
+
+       ACPI_MSG_REDIRECT_BEGIN;
+       acpi_os_printf(ACPI_MSG_ERROR);
+
+       if (path) {
+               status =
+                   acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
+                                    &node);
+               if (ACPI_FAILURE(status)) {
+                       acpi_os_printf("[Could not get node by pathname]");
+               }
+       }
+
+       acpi_ns_print_node_pathname(node, message);
+       acpi_os_printf(", %s", acpi_format_exception(method_status));
+
+       ACPI_MSG_SUFFIX;
+       ACPI_MSG_REDIRECT_END;
+}
+
+#endif                         /* ACPI_NO_ERROR_MESSAGES */
index c3f3a7e7bdc7fd6bc51ba43b1d8ff8e3c6d6eb76..ee83adb97b1e73827a6a7740de03edb3680e2a28 100644 (file)
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval")
  ******************************************************************************/
 
 acpi_status
-acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
+acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
                        char *path,
                        u32 expected_return_btypes,
                        union acpi_operand_object **return_desc)
@@ -87,7 +87,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
        }
 
        info->prefix_node = prefix_node;
-       info->pathname = path;
+       info->relative_pathname = path;
 
        /* Evaluate the object/method */
 
@@ -123,22 +123,27 @@ acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node,
 
        switch ((info->return_object)->common.type) {
        case ACPI_TYPE_INTEGER:
+
                return_btype = ACPI_BTYPE_INTEGER;
                break;
 
        case ACPI_TYPE_BUFFER:
+
                return_btype = ACPI_BTYPE_BUFFER;
                break;
 
        case ACPI_TYPE_STRING:
+
                return_btype = ACPI_BTYPE_STRING;
                break;
 
        case ACPI_TYPE_PACKAGE:
+
                return_btype = ACPI_BTYPE_PACKAGE;
                break;
 
        default:
+
                return_btype = 0;
                break;
        }
index b543a144941a295a81c7aa9f237b56ac07e1a748..ff6d9e8aa8423ef04ed68ec18023d61ee570493b 100644 (file)
@@ -146,6 +146,7 @@ const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status)
                break;
 
        default:
+
                break;
        }
 
index 43a170a74a6139ae3aa10ae1120b27f773103085..fa69071db4181dc100e3242053756944590679f8 100644 (file)
@@ -341,14 +341,17 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 
                switch (cid_objects[i]->common.type) {
                case ACPI_TYPE_INTEGER:
+
                        string_area_size += ACPI_EISAID_STRING_SIZE;
                        break;
 
                case ACPI_TYPE_STRING:
+
                        string_area_size += cid_objects[i]->string.length + 1;
                        break;
 
                default:
+
                        status = AE_TYPE;
                        goto cleanup;
                }
index 785fdd07ae5673db012d27b1519dce75e85c3827..02f9101b65e47c29dc974020a8701322c9dc3824 100644 (file)
@@ -382,10 +382,12 @@ acpi_ut_display_init_pathname(u8 type,
 
        switch (type) {
        case ACPI_TYPE_METHOD:
+
                acpi_os_printf("Executing  ");
                break;
 
        default:
+
                acpi_os_printf("Initializing ");
                break;
        }
index 1099f5c069f8287fb354f148c9f8d681fcc94e44..aa61f66ee861ed1de71fee8bb72d0e412627382c 100644 (file)
@@ -129,6 +129,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
                break;
 
        default:
+
                /* All others have no secondary object */
                break;
        }
@@ -353,6 +354,7 @@ u8 acpi_ut_valid_internal_object(void *object)
                return (TRUE);
 
        default:
+
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                                  "%p is not not an ACPI operand obj [%s]\n",
                                  object, acpi_ut_get_descriptor_name(object)));
@@ -509,7 +511,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
 
                switch (internal_object->reference.class) {
                case ACPI_REFCLASS_NAME:
-
                        /*
                         * Get the actual length of the full pathname to this object.
                         * The reference will be converted to the pathname to the object
@@ -525,7 +526,6 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
                        break;
 
                default:
-
                        /*
                         * No other reference opcodes are supported.
                         * Notably, Locals and Args are not supported, but this may be
@@ -585,7 +585,6 @@ acpi_ut_get_element_length(u8 object_type,
 
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
-
                /*
                 * Simple object - just get the size (Null object/entry is handled
                 * here also) and sum it into the running package length
index 29459479148fe7b1e23f7b0fe64ea85a0c48b7bb..2b1ce4cd32073fc23e6bcb7d6c5666d156ae6432 100644 (file)
@@ -147,6 +147,11 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
        u32 i;
        u32 j;
 
+       if (!expected_btypes) {
+               ACPI_STRCPY(buffer, "NONE");
+               return;
+       }
+
        j = 1;
        buffer[0] = 0;
        this_rtype = ACPI_RTYPE_INTEGER;
@@ -328,9 +333,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
 
        /* First field in the types list is the count of args to follow */
 
-       arg_count = (argument_types & METHOD_ARG_MASK);
-       argument_types >>= METHOD_ARG_BIT_WIDTH;
-
+       arg_count = METHOD_GET_ARG_COUNT(argument_types);
        if (arg_count > METHOD_PREDEF_ARGS_MAX) {
                printf("**** Invalid argument count (%u) "
                       "in predefined info structure\n", arg_count);
@@ -340,7 +343,8 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
        /* Get each argument from the list, convert to ascii, store to buffer */
 
        for (i = 0; i < arg_count; i++) {
-               this_argument_type = (argument_types & METHOD_ARG_MASK);
+               this_argument_type = METHOD_GET_NEXT_TYPE(argument_types);
+
                if (!this_argument_type
                    || (this_argument_type > METHOD_MAX_ARG_TYPE)) {
                        printf("**** Invalid argument type (%u) "
@@ -351,10 +355,6 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
 
                strcat(buffer,
                       ut_external_type_names[this_argument_type] + sub_index);
-
-               /* Shift to next argument type field */
-
-               argument_types >>= METHOD_ARG_BIT_WIDTH;
                sub_index = 0;
        }
 
index b3e36a81aa4d1360b9280d2edd6d9d5f9e7330dd..c53759b76a3f97d0fe5558f36ad9b656fbc905fa 100644 (file)
@@ -186,10 +186,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
        switch (base) {
        case ACPI_ANY_BASE:
        case 16:
+
                break;
 
        default:
+
                /* Invalid Base */
+
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -355,36 +358,44 @@ void acpi_ut_print_string(char *string, u8 max_length)
 
                switch (string[i]) {
                case 0x07:
+
                        acpi_os_printf("\\a");  /* BELL */
                        break;
 
                case 0x08:
+
                        acpi_os_printf("\\b");  /* BACKSPACE */
                        break;
 
                case 0x0C:
+
                        acpi_os_printf("\\f");  /* FORMFEED */
                        break;
 
                case 0x0A:
+
                        acpi_os_printf("\\n");  /* LINEFEED */
                        break;
 
                case 0x0D:
+
                        acpi_os_printf("\\r");  /* CARRIAGE RETURN */
                        break;
 
                case 0x09:
+
                        acpi_os_printf("\\t");  /* HORIZONTAL TAB */
                        break;
 
                case 0x0B:
+
                        acpi_os_printf("\\v");  /* VERTICAL TAB */
                        break;
 
                case '\'':      /* Single Quote */
                case '\"':      /* Double Quote */
                case '\\':      /* Backslash */
+
                        acpi_os_printf("\\%c", (int)string[i]);
                        break;
 
@@ -451,7 +462,8 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
  *
  * FUNCTION:    acpi_ut_valid_acpi_name
  *
- * PARAMETERS:  name            - The name to be examined
+ * PARAMETERS:  name            - The name to be examined. Does not have to
+ *                                be NULL terminated string.
  *
  * RETURN:      TRUE if the name is valid, FALSE otherwise
  *
@@ -462,15 +474,14 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position)
  *
  ******************************************************************************/
 
-u8 acpi_ut_valid_acpi_name(u32 name)
+u8 acpi_ut_valid_acpi_name(char *name)
 {
        u32 i;
 
        ACPI_FUNCTION_ENTRY();
 
        for (i = 0; i < ACPI_NAME_SIZE; i++) {
-               if (!acpi_ut_valid_acpi_char
-                   ((ACPI_CAST_PTR(char, &name))[i], i)) {
+               if (!acpi_ut_valid_acpi_char(name[i], i)) {
                        return (FALSE);
                }
        }
index 62774c7b76a81402633d417277be05c5953239d0..160f13f4aab51a196200184c60cc625a5de4acc6 100644 (file)
@@ -603,6 +603,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                        switch (ACPI_GET_DESCRIPTOR_TYPE
                                                (descriptor)) {
                                        case ACPI_DESC_TYPE_OPERAND:
+
                                                if (element->size ==
                                                    sizeof(union
                                                           acpi_operand_object))
@@ -613,6 +614,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        case ACPI_DESC_TYPE_PARSER:
+
                                                if (element->size ==
                                                    sizeof(union
                                                           acpi_parse_object)) {
@@ -622,6 +624,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        case ACPI_DESC_TYPE_NAMED:
+
                                                if (element->size ==
                                                    sizeof(struct
                                                           acpi_namespace_node))
@@ -632,6 +635,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        default:
+
                                                break;
                                        }
 
@@ -639,6 +643,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
 
                                        switch (descriptor_type) {
                                        case ACPI_DESC_TYPE_OPERAND:
+
                                                acpi_os_printf
                                                    ("%12.12s RefCount 0x%04X\n",
                                                     acpi_ut_get_type_name
@@ -649,6 +654,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        case ACPI_DESC_TYPE_PARSER:
+
                                                acpi_os_printf
                                                    ("AmlOpcode 0x%04hX\n",
                                                     descriptor->op.asl.
@@ -656,6 +662,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        case ACPI_DESC_TYPE_NAMED:
+
                                                acpi_os_printf("%4.4s\n",
                                                               acpi_ut_get_node_name
                                                               (&descriptor->
@@ -663,6 +670,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
                                                break;
 
                                        default:
+
                                                acpi_os_printf("\n");
                                                break;
                                        }
index 976b6c734fce961b44a94773a4e8357b02727735..e966a2e47b765e6c097ca7973b54fa2d987ab6cd 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/export.h>
 #include <acpi/acpi.h>
 #include "accommon.h"
-#include "acnamesp.h"
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utxferror")
@@ -52,43 +51,7 @@ ACPI_MODULE_NAME("utxferror")
 /*
  * This module is used for the in-kernel ACPICA as well as the ACPICA
  * tools/applications.
- *
- * For the iASL compiler case, the output is redirected to stderr so that
- * any of the various ACPI errors and warnings do not appear in the output
- * files, for either the compiler or disassembler portions of the tool.
  */
-#ifdef ACPI_ASL_COMPILER
-#include <stdio.h>
-extern FILE *acpi_gbl_output_file;
-
-#define ACPI_MSG_REDIRECT_BEGIN \
-       FILE                            *output_file = acpi_gbl_output_file; \
-       acpi_os_redirect_output (stderr);
-
-#define ACPI_MSG_REDIRECT_END \
-       acpi_os_redirect_output (output_file);
-
-#else
-/*
- * non-iASL case - no redirection, nothing to do
- */
-#define ACPI_MSG_REDIRECT_BEGIN
-#define ACPI_MSG_REDIRECT_END
-#endif
-/*
- * Common message prefixes
- */
-#define ACPI_MSG_ERROR          "ACPI Error: "
-#define ACPI_MSG_EXCEPTION      "ACPI Exception: "
-#define ACPI_MSG_WARNING        "ACPI Warning: "
-#define ACPI_MSG_INFO           "ACPI: "
-#define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Bug: Error: "
-#define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Bug: Warning: "
-/*
- * Common message suffix
- */
-#define ACPI_MSG_SUFFIX \
-       acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
 /*******************************************************************************
  *
  * FUNCTION:    acpi_error
@@ -285,200 +248,3 @@ acpi_bios_warning(const char *module_name,
 }
 
 ACPI_EXPORT_SYMBOL(acpi_bios_warning)
-
-/*
- * The remainder of this module contains internal error functions that may
- * be configured out.
- */
-#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_predefined_warning
- *
- * PARAMETERS:  module_name     - Caller's module name (for error output)
- *              line_number     - Caller's line number (for error output)
- *              pathname        - Full pathname to the node
- *              node_flags      - From Namespace node for the method/object
- *              format          - Printf format string + additional args
- *
- * RETURN:      None
- *
- * DESCRIPTION: Warnings for the predefined validation module. Messages are
- *              only emitted the first time a problem with a particular
- *              method/object is detected. This prevents a flood of error
- *              messages for methods that are repeatedly evaluated.
- *
- ******************************************************************************/
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_predefined_warning(const char *module_name,
-                          u32 line_number,
-                          char *pathname,
-                          u8 node_flags, const char *format, ...)
-{
-       va_list arg_list;
-
-       /*
-        * Warning messages for this method/object will be disabled after the
-        * first time a validation fails or an object is successfully repaired.
-        */
-       if (node_flags & ANOBJ_EVALUATED) {
-               return;
-       }
-
-       acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname);
-
-       va_start(arg_list, format);
-       acpi_os_vprintf(format, arg_list);
-       ACPI_MSG_SUFFIX;
-       va_end(arg_list);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_predefined_info
- *
- * PARAMETERS:  module_name     - Caller's module name (for error output)
- *              line_number     - Caller's line number (for error output)
- *              pathname        - Full pathname to the node
- *              node_flags      - From Namespace node for the method/object
- *              format          - Printf format string + additional args
- *
- * RETURN:      None
- *
- * DESCRIPTION: Info messages for the predefined validation module. Messages
- *              are only emitted the first time a problem with a particular
- *              method/object is detected. This prevents a flood of
- *              messages for methods that are repeatedly evaluated.
- *
- ******************************************************************************/
-
-void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_predefined_info(const char *module_name,
-                       u32 line_number,
-                       char *pathname, u8 node_flags, const char *format, ...)
-{
-       va_list arg_list;
-
-       /*
-        * Warning messages for this method/object will be disabled after the
-        * first time a validation fails or an object is successfully repaired.
-        */
-       if (node_flags & ANOBJ_EVALUATED) {
-               return;
-       }
-
-       acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname);
-
-       va_start(arg_list, format);
-       acpi_os_vprintf(format, arg_list);
-       ACPI_MSG_SUFFIX;
-       va_end(arg_list);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_namespace_error
- *
- * PARAMETERS:  module_name         - Caller's module name (for error output)
- *              line_number         - Caller's line number (for error output)
- *              internal_name       - Name or path of the namespace node
- *              lookup_status       - Exception code from NS lookup
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message with the full pathname for the NS node.
- *
- ******************************************************************************/
-
-void
-acpi_ut_namespace_error(const char *module_name,
-                       u32 line_number,
-                       const char *internal_name, acpi_status lookup_status)
-{
-       acpi_status status;
-       u32 bad_name;
-       char *name = NULL;
-
-       ACPI_MSG_REDIRECT_BEGIN;
-       acpi_os_printf(ACPI_MSG_ERROR);
-
-       if (lookup_status == AE_BAD_CHARACTER) {
-
-               /* There is a non-ascii character in the name */
-
-               ACPI_MOVE_32_TO_32(&bad_name,
-                                  ACPI_CAST_PTR(u32, internal_name));
-               acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
-       } else {
-               /* Convert path to external format */
-
-               status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
-                                                 internal_name, NULL, &name);
-
-               /* Print target name */
-
-               if (ACPI_SUCCESS(status)) {
-                       acpi_os_printf("[%s]", name);
-               } else {
-                       acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
-               }
-
-               if (name) {
-                       ACPI_FREE(name);
-               }
-       }
-
-       acpi_os_printf(" Namespace lookup failure, %s",
-                      acpi_format_exception(lookup_status));
-
-       ACPI_MSG_SUFFIX;
-       ACPI_MSG_REDIRECT_END;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_method_error
- *
- * PARAMETERS:  module_name         - Caller's module name (for error output)
- *              line_number         - Caller's line number (for error output)
- *              message             - Error message to use on failure
- *              prefix_node         - Prefix relative to the path
- *              path                - Path to the node (optional)
- *              method_status       - Execution status
- *
- * RETURN:      None
- *
- * DESCRIPTION: Print error message with the full pathname for the method.
- *
- ******************************************************************************/
-
-void
-acpi_ut_method_error(const char *module_name,
-                    u32 line_number,
-                    const char *message,
-                    struct acpi_namespace_node *prefix_node,
-                    const char *path, acpi_status method_status)
-{
-       acpi_status status;
-       struct acpi_namespace_node *node = prefix_node;
-
-       ACPI_MSG_REDIRECT_BEGIN;
-       acpi_os_printf(ACPI_MSG_ERROR);
-
-       if (path) {
-               status =
-                   acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
-                                    &node);
-               if (ACPI_FAILURE(status)) {
-                       acpi_os_printf("[Could not get node by pathname]");
-               }
-       }
-
-       acpi_ns_print_node_pathname(node, message);
-       acpi_os_printf(", %s", acpi_format_exception(method_status));
-
-       ACPI_MSG_SUFFIX;
-       ACPI_MSG_REDIRECT_END;
-}
-
-#endif                         /* ACPI_NO_ERROR_MESSAGES */
index fd363b57a5963b028a228791573456301dfdbc53..5f3597b87f276dc9744090674c0bce0bde9360fc 100644 (file)
@@ -290,6 +290,26 @@ int acpi_bus_init_power(struct acpi_device *device)
        return 0;
 }
 
+/**
+ * acpi_device_fix_up_power - Force device with missing _PSC into D0.
+ * @device: Device object whose power state is to be fixed up.
+ *
+ * Devices without power resources and _PSC, but having _PS0 and _PS3 defined,
+ * are assumed to be put into D0 by the BIOS.  However, in some cases that may
+ * not be the case and this function should be used then.
+ */
+int acpi_device_fix_up_power(struct acpi_device *device)
+{
+       int ret = 0;
+
+       if (!device->power.flags.power_resources
+           && !device->power.flags.explicit_get
+           && device->power.state == ACPI_STATE_D0)
+               ret = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0);
+
+       return ret;
+}
+
 int acpi_bus_update_power(acpi_handle handle, int *state_p)
 {
        struct acpi_device *device;
index 4fdea381ef21e07017a87b94ae16ce0f8860fb75..14de9f46972ee798926e9a1805c356fc02bb291e 100644 (file)
@@ -66,20 +66,21 @@ struct dock_station {
        spinlock_t dd_lock;
        struct mutex hp_lock;
        struct list_head dependent_devices;
-       struct list_head hotplug_devices;
 
        struct list_head sibling;
        struct platform_device *dock_device;
 };
 static LIST_HEAD(dock_stations);
 static int dock_station_count;
+static DEFINE_MUTEX(hotplug_lock);
 
 struct dock_dependent_device {
        struct list_head list;
-       struct list_head hotplug_list;
        acpi_handle handle;
-       const struct acpi_dock_ops *ops;
-       void *context;
+       const struct acpi_dock_ops *hp_ops;
+       void *hp_context;
+       unsigned int hp_refcount;
+       void (*hp_release)(void *);
 };
 
 #define DOCK_DOCKING   0x00000001
@@ -111,7 +112,6 @@ add_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
 
        dd->handle = handle;
        INIT_LIST_HEAD(&dd->list);
-       INIT_LIST_HEAD(&dd->hotplug_list);
 
        spin_lock(&ds->dd_lock);
        list_add_tail(&dd->list, &ds->dependent_devices);
@@ -121,35 +121,90 @@ add_dock_dependent_device(struct dock_station *ds, acpi_handle handle)
 }
 
 /**
- * dock_add_hotplug_device - associate a hotplug handler with the dock station
- * @ds: The dock station
- * @dd: The dependent device struct
- *
- * Add the dependent device to the dock's hotplug device list
+ * dock_init_hotplug - Initialize a hotplug device on a docking station.
+ * @dd: Dock-dependent device.
+ * @ops: Dock operations to attach to the dependent device.
+ * @context: Data to pass to the @ops callbacks and @release.
+ * @init: Optional initialization routine to run after setting up context.
+ * @release: Optional release routine to run on removal.
  */
-static void
-dock_add_hotplug_device(struct dock_station *ds,
-                       struct dock_dependent_device *dd)
+static int dock_init_hotplug(struct dock_dependent_device *dd,
+                            const struct acpi_dock_ops *ops, void *context,
+                            void (*init)(void *), void (*release)(void *))
 {
-       mutex_lock(&ds->hp_lock);
-       list_add_tail(&dd->hotplug_list, &ds->hotplug_devices);
-       mutex_unlock(&ds->hp_lock);
+       int ret = 0;
+
+       mutex_lock(&hotplug_lock);
+
+       if (dd->hp_context) {
+               ret = -EEXIST;
+       } else {
+               dd->hp_refcount = 1;
+               dd->hp_ops = ops;
+               dd->hp_context = context;
+               dd->hp_release = release;
+       }
+
+       if (!WARN_ON(ret) && init)
+               init(context);
+
+       mutex_unlock(&hotplug_lock);
+       return ret;
 }
 
 /**
- * dock_del_hotplug_device - remove a hotplug handler from the dock station
- * @ds: The dock station
- * @dd: the dependent device struct
+ * dock_release_hotplug - Decrement hotplug reference counter of dock device.
+ * @dd: Dock-dependent device.
  *
- * Delete the dependent device from the dock's hotplug device list
+ * Decrement the reference counter of @dd and if 0, detach its hotplug
+ * operations from it, reset its context pointer and run the optional release
+ * routine if present.
  */
-static void
-dock_del_hotplug_device(struct dock_station *ds,
-                       struct dock_dependent_device *dd)
+static void dock_release_hotplug(struct dock_dependent_device *dd)
 {
-       mutex_lock(&ds->hp_lock);
-       list_del(&dd->hotplug_list);
-       mutex_unlock(&ds->hp_lock);
+       void (*release)(void *) = NULL;
+       void *context = NULL;
+
+       mutex_lock(&hotplug_lock);
+
+       if (dd->hp_context && !--dd->hp_refcount) {
+               dd->hp_ops = NULL;
+               context = dd->hp_context;
+               dd->hp_context = NULL;
+               release = dd->hp_release;
+               dd->hp_release = NULL;
+       }
+
+       if (release && context)
+               release(context);
+
+       mutex_unlock(&hotplug_lock);
+}
+
+static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event,
+                              bool uevent)
+{
+       acpi_notify_handler cb = NULL;
+       bool run = false;
+
+       mutex_lock(&hotplug_lock);
+
+       if (dd->hp_context) {
+               run = true;
+               dd->hp_refcount++;
+               if (dd->hp_ops)
+                       cb = uevent ? dd->hp_ops->uevent : dd->hp_ops->handler;
+       }
+
+       mutex_unlock(&hotplug_lock);
+
+       if (!run)
+               return;
+
+       if (cb)
+               cb(dd->handle, event, dd->hp_context);
+
+       dock_release_hotplug(dd);
 }
 
 /**
@@ -360,9 +415,8 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
        /*
         * First call driver specific hotplug functions
         */
-       list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list)
-               if (dd->ops && dd->ops->handler)
-                       dd->ops->handler(dd->handle, event, dd->context);
+       list_for_each_entry(dd, &ds->dependent_devices, list)
+               dock_hotplug_event(dd, event, false);
 
        /*
         * Now make sure that an acpi_device is created for each
@@ -398,9 +452,8 @@ static void dock_event(struct dock_station *ds, u32 event, int num)
        if (num == DOCK_EVENT)
                kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
 
-       list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list)
-               if (dd->ops && dd->ops->uevent)
-                       dd->ops->uevent(dd->handle, event, dd->context);
+       list_for_each_entry(dd, &ds->dependent_devices, list)
+               dock_hotplug_event(dd, event, true);
 
        if (num != DOCK_EVENT)
                kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
@@ -570,19 +623,24 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier);
  * @handle: the handle of the device
  * @ops: handlers to call after docking
  * @context: device specific data
+ * @init: Optional initialization routine to run after registration
+ * @release: Optional release routine to run on unregistration
  *
  * If a driver would like to perform a hotplug operation after a dock
  * event, they can register an acpi_notifiy_handler to be called by
  * the dock driver after _DCK is executed.
  */
-int
-register_hotplug_dock_device(acpi_handle handle, const struct acpi_dock_ops *ops,
-                            void *context)
+int register_hotplug_dock_device(acpi_handle handle,
+                                const struct acpi_dock_ops *ops, void *context,
+                                void (*init)(void *), void (*release)(void *))
 {
        struct dock_dependent_device *dd;
        struct dock_station *dock_station;
        int ret = -EINVAL;
 
+       if (WARN_ON(!context))
+               return -EINVAL;
+
        if (!dock_station_count)
                return -ENODEV;
 
@@ -597,12 +655,8 @@ register_hotplug_dock_device(acpi_handle handle, const struct acpi_dock_ops *ops
                 * ops
                 */
                dd = find_dock_dependent_device(dock_station, handle);
-               if (dd) {
-                       dd->ops = ops;
-                       dd->context = context;
-                       dock_add_hotplug_device(dock_station, dd);
+               if (dd && !dock_init_hotplug(dd, ops, context, init, release))
                        ret = 0;
-               }
        }
 
        return ret;
@@ -624,7 +678,7 @@ void unregister_hotplug_dock_device(acpi_handle handle)
        list_for_each_entry(dock_station, &dock_stations, sibling) {
                dd = find_dock_dependent_device(dock_station, handle);
                if (dd)
-                       dock_del_hotplug_device(dock_station, dd);
+                       dock_release_hotplug(dd);
        }
 }
 EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device);
@@ -868,8 +922,10 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
        if (!count)
                return -EINVAL;
 
+       acpi_scan_lock_acquire();
        begin_undock(dock_station);
        ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST);
+       acpi_scan_lock_release();
        return ret ? ret: count;
 }
 static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock);
@@ -951,7 +1007,6 @@ static int __init dock_add(acpi_handle handle)
        mutex_init(&dock_station->hp_lock);
        spin_lock_init(&dock_station->dd_lock);
        INIT_LIST_HEAD(&dock_station->sibling);
-       INIT_LIST_HEAD(&dock_station->hotplug_devices);
        ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
        INIT_LIST_HEAD(&dock_station->dependent_devices);
 
@@ -991,30 +1046,6 @@ err_unregister:
        return ret;
 }
 
-/**
- * dock_remove - free up resources related to the dock station
- */
-static int dock_remove(struct dock_station *ds)
-{
-       struct dock_dependent_device *dd, *tmp;
-       struct platform_device *dock_device = ds->dock_device;
-
-       if (!dock_station_count)
-               return 0;
-
-       /* remove dependent devices */
-       list_for_each_entry_safe(dd, tmp, &ds->dependent_devices, list)
-               kfree(dd);
-
-       list_del(&ds->sibling);
-
-       /* cleanup sysfs */
-       sysfs_remove_group(&dock_device->dev.kobj, &dock_attribute_group);
-       platform_device_unregister(dock_device);
-
-       return 0;
-}
-
 /**
  * find_dock_and_bay - look for dock stations and bays
  * @handle: acpi handle of a device
@@ -1033,7 +1064,7 @@ find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
        return AE_OK;
 }
 
-static int __init dock_init(void)
+int __init acpi_dock_init(void)
 {
        if (acpi_disabled)
                return 0;
@@ -1052,19 +1083,3 @@ static int __init dock_init(void)
                ACPI_DOCK_DRIVER_DESCRIPTION, dock_station_count);
        return 0;
 }
-
-static void __exit dock_exit(void)
-{
-       struct dock_station *tmp, *dock_station;
-
-       unregister_acpi_bus_notifier(&dock_acpi_notifier);
-       list_for_each_entry_safe(dock_station, tmp, &dock_stations, sibling)
-               dock_remove(dock_station);
-}
-
-/*
- * Must be called before drivers of devices in dock, otherwise we can't know
- * which devices are in a dock
- */
-subsys_initcall(dock_init);
-module_exit(dock_exit);
index 40a84cc6740c6c6522afc6bac6d5d5d2178a86bd..9783f400d857da574b8c275e74db17e4d3d27161 100644 (file)
@@ -105,7 +105,7 @@ acpi_handle acpi_get_child(acpi_handle parent, u64 address)
 }
 EXPORT_SYMBOL(acpi_get_child);
 
-static int acpi_bind_one(struct device *dev, acpi_handle handle)
+int acpi_bind_one(struct device *dev, acpi_handle handle)
 {
        struct acpi_device *acpi_dev;
        acpi_status status;
@@ -188,8 +188,9 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
        kfree(physical_node);
        goto err;
 }
+EXPORT_SYMBOL_GPL(acpi_bind_one);
 
-static int acpi_unbind_one(struct device *dev)
+int acpi_unbind_one(struct device *dev)
 {
        struct acpi_device_physical_node *entry;
        struct acpi_device *acpi_dev;
@@ -238,6 +239,7 @@ err:
        dev_err(dev, "Oops, 'acpi_handle' corrupt\n");
        return -EINVAL;
 }
+EXPORT_SYMBOL_GPL(acpi_unbind_one);
 
 static int acpi_platform_notify(struct device *dev)
 {
index 297cbf456f86bee35300ef6c72058615663f563f..520073ba36b497bf47cb6835aaa4f7a8b0897b4a 100644 (file)
@@ -33,6 +33,7 @@ static inline void acpi_pci_slot_init(void) { }
 void acpi_pci_root_init(void);
 void acpi_pci_link_init(void);
 void acpi_pci_root_hp_init(void);
+void acpi_processor_init(void);
 void acpi_platform_init(void);
 int acpi_sysfs_init(void);
 #ifdef CONFIG_ACPI_CONTAINER
@@ -40,12 +41,19 @@ void acpi_container_init(void);
 #else
 static inline void acpi_container_init(void) {}
 #endif
+#ifdef CONFIG_ACPI_DOCK
+void acpi_dock_init(void);
+#else
+static inline void acpi_dock_init(void) {}
+#endif
 #ifdef CONFIG_ACPI_HOTPLUG_MEMORY
 void acpi_memory_hotplug_init(void);
 #else
 static inline void acpi_memory_hotplug_init(void) {}
 #endif
 
+extern bool acpi_force_hot_remove;
+
 void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
                                    const char *name);
 int acpi_scan_add_handler_with_hotplug(struct acpi_scan_handler *handler,
@@ -76,6 +84,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
                             int type, unsigned long long sta);
 void acpi_device_add_finalize(struct acpi_device *device);
 void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
+int acpi_bind_one(struct device *dev, acpi_handle handle);
+int acpi_unbind_one(struct device *dev);
 
 /* --------------------------------------------------------------------------
                                   Power Resource
index e72186340fec50212f5da151a1e7137dde31d019..da6b6634e5b3292d6c822a7431b4a3259012ad11 100644 (file)
@@ -1715,6 +1715,17 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
 }
 #endif
 
+static int __init acpi_no_auto_ssdt_setup(char *s)
+{
+        printk(KERN_NOTICE PREFIX "SSDT auto-load disabled\n");
+
+        acpi_gbl_disable_ssdt_table_load = TRUE;
+
+        return 1;
+}
+
+__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
+
 acpi_status __init acpi_os_initialize(void)
 {
        acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block);
index f962047c6c85591762893ada0a73549913b03d85..288bb270f8edc11cb0d92e23f7b759619e35e660 100644 (file)
@@ -885,6 +885,7 @@ int acpi_add_power_resource(acpi_handle handle)
                                ACPI_STA_DEFAULT);
        mutex_init(&resource->resource_lock);
        INIT_LIST_HEAD(&resource->dependent);
+       INIT_LIST_HEAD(&resource->list_node);
        resource->name = device->pnp.bus_id;
        strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
index c266cdc117840bcdfc7909c2605840501b2c87c2..d93963f1e8f435d735cf0bbdaded9e568f35a1d6 100644 (file)
@@ -1,11 +1,13 @@
 /*
- * acpi_processor.c - ACPI Processor Driver ($Revision: 71 $)
+ * processor_driver.c - ACPI Processor Driver
  *
  *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  *  Copyright (C) 2004       Dominik Brodowski <linux@brodo.de>
  *  Copyright (C) 2004  Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
  *                     - Added processor hotplug support
+ *  Copyright (C) 2013, Intel Corporation
+ *                      Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  TBD:
- *     1. Make # power states dynamic.
- *     2. Support duty_cycle values that span bit 4.
- *     3. Optimize by having scheduler determine business instead of
- *        having us try to calculate it here.
- *     4. Need C1 timing -- must modify kernel (IRQ handler) to get this.
  */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/pm.h>
 #include <linux/cpufreq.h>
 #include <linux/cpu.h>
-#include <linux/dmi.h>
-#include <linux/moduleparam.h>
 #include <linux/cpuidle.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
-#include <linux/memory_hotplug.h>
-
-#include <asm/io.h>
-#include <asm/cpu.h>
-#include <asm/delay.h>
-#include <asm/uaccess.h>
-#include <asm/processor.h>
-#include <asm/smp.h>
-#include <asm/acpi.h>
-
-#include <acpi/acpi_bus.h>
-#include <acpi/acpi_drivers.h>
+
 #include <acpi/processor.h>
 
+#include "internal.h"
+
 #define PREFIX "ACPI: "
 
-#define ACPI_PROCESSOR_CLASS           "processor"
-#define ACPI_PROCESSOR_DEVICE_NAME     "Processor"
 #define ACPI_PROCESSOR_FILE_INFO       "info"
 #define ACPI_PROCESSOR_FILE_THROTTLING "throttling"
 #define ACPI_PROCESSOR_FILE_LIMIT      "limit"
 #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
 #define ACPI_PROCESSOR_NOTIFY_POWER    0x81
 #define ACPI_PROCESSOR_NOTIFY_THROTTLING       0x82
-#define ACPI_PROCESSOR_DEVICE_HID      "ACPI0007"
 
 #define ACPI_PROCESSOR_LIMIT_USER      0
 #define ACPI_PROCESSOR_LIMIT_THERMAL   1
@@ -81,12 +60,8 @@ MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION("ACPI Processor Driver");
 MODULE_LICENSE("GPL");
 
-static int acpi_processor_add(struct acpi_device *device);
-static int acpi_processor_remove(struct acpi_device *device);
-static void acpi_processor_notify(struct acpi_device *device, u32 event);
-static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr);
-static int acpi_processor_handle_eject(struct acpi_processor *pr);
-static int acpi_processor_start(struct acpi_processor *pr);
+static int acpi_processor_start(struct device *dev);
+static int acpi_processor_stop(struct device *dev);
 
 static const struct acpi_device_id processor_device_ids[] = {
        {ACPI_PROCESSOR_OBJECT_HID, 0},
@@ -95,295 +70,24 @@ static const struct acpi_device_id processor_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, processor_device_ids);
 
-static struct acpi_driver acpi_processor_driver = {
+static struct device_driver acpi_processor_driver = {
        .name = "processor",
-       .class = ACPI_PROCESSOR_CLASS,
-       .ids = processor_device_ids,
-       .ops = {
-               .add = acpi_processor_add,
-               .remove = acpi_processor_remove,
-               .notify = acpi_processor_notify,
-               },
+       .bus = &cpu_subsys,
+       .acpi_match_table = processor_device_ids,
+       .probe = acpi_processor_start,
+       .remove = acpi_processor_stop,
 };
 
-#define INSTALL_NOTIFY_HANDLER         1
-#define UNINSTALL_NOTIFY_HANDLER       2
-
-DEFINE_PER_CPU(struct acpi_processor *, processors);
-EXPORT_PER_CPU_SYMBOL(processors);
-
-struct acpi_processor_errata errata __read_mostly;
-
-/* --------------------------------------------------------------------------
-                                Errata Handling
-   -------------------------------------------------------------------------- */
-
-static int acpi_processor_errata_piix4(struct pci_dev *dev)
+static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
 {
-       u8 value1 = 0;
-       u8 value2 = 0;
-
-
-       if (!dev)
-               return -EINVAL;
-
-       /*
-        * Note that 'dev' references the PIIX4 ACPI Controller.
-        */
-
-       switch (dev->revision) {
-       case 0:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n"));
-               break;
-       case 1:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 B-step\n"));
-               break;
-       case 2:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4E\n"));
-               break;
-       case 3:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4M\n"));
-               break;
-       default:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unknown PIIX4\n"));
-               break;
-       }
-
-       switch (dev->revision) {
-
-       case 0:         /* PIIX4 A-step */
-       case 1:         /* PIIX4 B-step */
-               /*
-                * See specification changes #13 ("Manual Throttle Duty Cycle")
-                * and #14 ("Enabling and Disabling Manual Throttle"), plus
-                * erratum #5 ("STPCLK# Deassertion Time") from the January
-                * 2002 PIIX4 specification update.  Applies to only older
-                * PIIX4 models.
-                */
-               errata.piix4.throttle = 1;
-
-       case 2:         /* PIIX4E */
-       case 3:         /* PIIX4M */
-               /*
-                * See erratum #18 ("C3 Power State/BMIDE and Type-F DMA
-                * Livelock") from the January 2002 PIIX4 specification update.
-                * Applies to all PIIX4 models.
-                */
-
-               /*
-                * BM-IDE
-                * ------
-                * Find the PIIX4 IDE Controller and get the Bus Master IDE
-                * Status register address.  We'll use this later to read
-                * each IDE controller's DMA status to make sure we catch all
-                * DMA activity.
-                */
-               dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                                    PCI_DEVICE_ID_INTEL_82371AB,
-                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
-               if (dev) {
-                       errata.piix4.bmisx = pci_resource_start(dev, 4);
-                       pci_dev_put(dev);
-               }
-
-               /*
-                * Type-F DMA
-                * ----------
-                * Find the PIIX4 ISA Controller and read the Motherboard
-                * DMA controller's status to see if Type-F (Fast) DMA mode
-                * is enabled (bit 7) on either channel.  Note that we'll
-                * disable C3 support if this is enabled, as some legacy
-                * devices won't operate well if fast DMA is disabled.
-                */
-               dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                                    PCI_DEVICE_ID_INTEL_82371AB_0,
-                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
-               if (dev) {
-                       pci_read_config_byte(dev, 0x76, &value1);
-                       pci_read_config_byte(dev, 0x77, &value2);
-                       if ((value1 & 0x80) || (value2 & 0x80))
-                               errata.piix4.fdma = 1;
-                       pci_dev_put(dev);
-               }
-
-               break;
-       }
-
-       if (errata.piix4.bmisx)
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Bus master activity detection (BM-IDE) erratum enabled\n"));
-       if (errata.piix4.fdma)
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Type-F DMA livelock erratum (C3 disabled)\n"));
-
-       return 0;
-}
-
-static int acpi_processor_errata(struct acpi_processor *pr)
-{
-       int result = 0;
-       struct pci_dev *dev = NULL;
-
-
-       if (!pr)
-               return -EINVAL;
-
-       /*
-        * PIIX4
-        */
-       dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                            PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
-                            PCI_ANY_ID, NULL);
-       if (dev) {
-               result = acpi_processor_errata_piix4(dev);
-               pci_dev_put(dev);
-       }
-
-       return result;
-}
-
-/* --------------------------------------------------------------------------
-                                 Driver Interface
-   -------------------------------------------------------------------------- */
-
-static int acpi_processor_get_info(struct acpi_device *device)
-{
-       acpi_status status = 0;
-       union acpi_object object = { 0 };
-       struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
+       struct acpi_device *device = data;
        struct acpi_processor *pr;
-       int cpu_index, device_declaration = 0;
-       static int cpu0_initialized;
-
-       pr = acpi_driver_data(device);
-       if (!pr)
-               return -EINVAL;
-
-       if (num_online_cpus() > 1)
-               errata.smp = TRUE;
-
-       acpi_processor_errata(pr);
-
-       /*
-        * Check to see if we have bus mastering arbitration control.  This
-        * is required for proper C3 usage (to maintain cache coherency).
-        */
-       if (acpi_gbl_FADT.pm2_control_block && acpi_gbl_FADT.pm2_control_length) {
-               pr->flags.bm_control = 1;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Bus mastering arbitration control present\n"));
-       } else
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "No bus mastering arbitration control\n"));
-
-       if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
-               /* Declared with "Processor" statement; match ProcessorID */
-               status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
-               if (ACPI_FAILURE(status)) {
-                       dev_err(&device->dev,
-                               "Failed to evaluate processor object (0x%x)\n",
-                               status);
-                       return -ENODEV;
-               }
-
-               /*
-                * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
-                *      >>> 'acpi_get_processor_id(acpi_id, &id)' in
-                *      arch/xxx/acpi.c
-                */
-               pr->acpi_id = object.processor.proc_id;
-       } else {
-               /*
-                * Declared with "Device" statement; match _UID.
-                * Note that we don't handle string _UIDs yet.
-                */
-               unsigned long long value;
-               status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID,
-                                               NULL, &value);
-               if (ACPI_FAILURE(status)) {
-                       dev_err(&device->dev,
-                               "Failed to evaluate processor _UID (0x%x)\n",
-                               status);
-                       return -ENODEV;
-               }
-               device_declaration = 1;
-               pr->acpi_id = value;
-       }
-       cpu_index = acpi_get_cpuid(pr->handle, device_declaration, pr->acpi_id);
-
-       /* Handle UP system running SMP kernel, with no LAPIC in MADT */
-       if (!cpu0_initialized && (cpu_index == -1) &&
-           (num_online_cpus() == 1)) {
-               cpu_index = 0;
-       }
-
-       cpu0_initialized = 1;
-
-       pr->id = cpu_index;
-
-       /*
-        *  Extra Processor objects may be enumerated on MP systems with
-        *  less than the max # of CPUs. They should be ignored _iff
-        *  they are physically not present.
-        */
-       if (pr->id == -1) {
-               if (ACPI_FAILURE(acpi_processor_hotadd_init(pr)))
-                       return -ENODEV;
-       }
-       /*
-        * On some boxes several processors use the same processor bus id.
-        * But they are located in different scope. For example:
-        * \_SB.SCK0.CPU0
-        * \_SB.SCK1.CPU0
-        * Rename the processor device bus id. And the new bus id will be
-        * generated as the following format:
-        * CPU+CPU ID.
-        */
-       sprintf(acpi_device_bid(device), "CPU%X", pr->id);
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
-                         pr->acpi_id));
-
-       if (!object.processor.pblk_address)
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
-       else if (object.processor.pblk_length != 6)
-               dev_err(&device->dev, "Invalid PBLK length [%d]\n",
-                           object.processor.pblk_length);
-       else {
-               pr->throttling.address = object.processor.pblk_address;
-               pr->throttling.duty_offset = acpi_gbl_FADT.duty_offset;
-               pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
-
-               pr->pblk = object.processor.pblk_address;
-
-               /*
-                * We don't care about error returns - we just try to mark
-                * these reserved so that nobody else is confused into thinking
-                * that this region might be unused..
-                *
-                * (In particular, allocating the IO range for Cardbus)
-                */
-               request_region(pr->throttling.address, 6, "ACPI CPU throttle");
-       }
-
-       /*
-        * If ACPI describes a slot number for this CPU, we can use it
-        * ensure we get the right value in the "physical id" field
-        * of /proc/cpuinfo
-        */
-       status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer);
-       if (ACPI_SUCCESS(status))
-               arch_fix_phys_package_id(pr->id, object.integer.value);
-
-       return 0;
-}
-
-static DEFINE_PER_CPU(void *, processor_device_array);
-
-static void acpi_processor_notify(struct acpi_device *device, u32 event)
-{
-       struct acpi_processor *pr = acpi_driver_data(device);
        int saved;
 
+       if (device->handle != handle)
+               return;
+
+       pr = acpi_driver_data(device);
        if (!pr)
                return;
 
@@ -420,55 +124,62 @@ static void acpi_processor_notify(struct acpi_device *device, u32 event)
        return;
 }
 
-static int acpi_cpu_soft_notify(struct notifier_block *nfb,
-               unsigned long action, void *hcpu)
+static __cpuinit int __acpi_processor_start(struct acpi_device *device);
+
+static int __cpuinit acpi_cpu_soft_notify(struct notifier_block *nfb,
+                                         unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
        struct acpi_processor *pr = per_cpu(processors, cpu);
+       struct acpi_device *device;
+
+       if (!pr || acpi_bus_get_device(pr->handle, &device))
+               return NOTIFY_DONE;
 
-       if (action == CPU_ONLINE && pr) {
-               /* CPU got physically hotplugged and onlined the first time:
-                * Initialize missing things
+       if (action == CPU_ONLINE) {
+               /*
+                * CPU got physically hotplugged and onlined for the first time:
+                * Initialize missing things.
                 */
                if (pr->flags.need_hotplug_init) {
+                       int ret;
+
                        pr_info("Will online and init hotplugged CPU: %d\n",
                                pr->id);
-                       WARN(acpi_processor_start(pr), "Failed to start CPU:"
-                               " %d\n", pr->id);
                        pr->flags.need_hotplug_init = 0;
-               /* Normal CPU soft online event */
+                       ret = __acpi_processor_start(device);
+                       WARN(ret, "Failed to start CPU: %d\n", pr->id);
                } else {
+                       /* Normal CPU soft online event. */
                        acpi_processor_ppc_has_changed(pr, 0);
                        acpi_processor_hotplug(pr);
                        acpi_processor_reevaluate_tstate(pr, action);
                        acpi_processor_tstate_has_changed(pr);
                }
-       }
-       if (action == CPU_DEAD && pr) {
-               /* invalidate the flag.throttling after one CPU is offline */
+       } else if (action == CPU_DEAD) {
+               /* Invalidate flag.throttling after the CPU is offline. */
                acpi_processor_reevaluate_tstate(pr, action);
        }
        return NOTIFY_OK;
 }
 
-static struct notifier_block acpi_cpu_notifier =
+static struct notifier_block __refdata acpi_cpu_notifier =
 {
            .notifier_call = acpi_cpu_soft_notify,
 };
 
-/*
- * acpi_processor_start() is called by the cpu_hotplug_notifier func:
- * acpi_cpu_soft_notify(). Getting it __cpuinit{data} is difficult, the
- * root cause seem to be that acpi_processor_uninstall_hotplug_notify()
- * is in the module_exit (__exit) func. Allowing acpi_processor_start()
- * to not be in __cpuinit section, but being called from __cpuinit funcs
- * via __ref looks like the right thing to do here.
- */
-static __ref int acpi_processor_start(struct acpi_processor *pr)
+static __cpuinit int __acpi_processor_start(struct acpi_device *device)
 {
-       struct acpi_device *device = per_cpu(processor_device_array, pr->id);
+       struct acpi_processor *pr = acpi_driver_data(device);
+       acpi_status status;
        int result = 0;
 
+       if (!pr)
+               return -ENODEV;
+
+       if (pr->flags.need_hotplug_init)
+               return 0;
+
 #ifdef CONFIG_CPU_FREQ
        acpi_processor_ppc_has_changed(pr, 0);
        acpi_processor_load_module(pr);
@@ -506,462 +217,95 @@ static __ref int acpi_processor_start(struct acpi_processor *pr)
                goto err_remove_sysfs_thermal;
        }
 
-       return 0;
+       status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
+                                            acpi_processor_notify, device);
+       if (ACPI_SUCCESS(status))
+               return 0;
 
-err_remove_sysfs_thermal:
+       sysfs_remove_link(&pr->cdev->device.kobj, "device");
+ err_remove_sysfs_thermal:
        sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
-err_thermal_unregister:
+ err_thermal_unregister:
        thermal_cooling_device_unregister(pr->cdev);
-err_power_exit:
+ err_power_exit:
        acpi_processor_power_exit(pr);
-
        return result;
 }
 
-/*
- * Do not put anything in here which needs the core to be online.
- * For example MSR access or setting up things which check for cpuinfo_x86
- * (cpu_data(cpu)) values, like CPU feature flags, family, model, etc.
- * Such things have to be put in and set up above in acpi_processor_start()
- */
-static int __cpuinit acpi_processor_add(struct acpi_device *device)
+static int __cpuinit acpi_processor_start(struct device *dev)
 {
-       struct acpi_processor *pr = NULL;
-       int result = 0;
-       struct device *dev;
-
-       pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
-       if (!pr)
-               return -ENOMEM;
-
-       if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
-               result = -ENOMEM;
-               goto err_free_pr;
-       }
-
-       pr->handle = device->handle;
-       strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
-       strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
-       device->driver_data = pr;
-
-       result = acpi_processor_get_info(device);
-       if (result) {
-               /* Processor is physically not present */
-               return 0;
-       }
-
-#ifdef CONFIG_SMP
-       if (pr->id >= setup_max_cpus && pr->id != 0)
-               return 0;
-#endif
-
-       BUG_ON(pr->id >= nr_cpu_ids);
-
-       /*
-        * Buggy BIOS check
-        * ACPI id of processors can be reported wrongly by the BIOS.
-        * Don't trust it blindly
-        */
-       if (per_cpu(processor_device_array, pr->id) != NULL &&
-           per_cpu(processor_device_array, pr->id) != device) {
-               dev_warn(&device->dev,
-                       "BIOS reported wrong ACPI id %d for the processor\n",
-                       pr->id);
-               result = -ENODEV;
-               goto err_free_cpumask;
-       }
-       per_cpu(processor_device_array, pr->id) = device;
-
-       per_cpu(processors, pr->id) = pr;
-
-       dev = get_cpu_device(pr->id);
-       if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) {
-               result = -EFAULT;
-               goto err_clear_processor;
-       }
+       struct acpi_device *device;
 
-       /*
-        * Do not start hotplugged CPUs now, but when they
-        * are onlined the first time
-        */
-       if (pr->flags.need_hotplug_init)
-               return 0;
-
-       result = acpi_processor_start(pr);
-       if (result)
-               goto err_remove_sysfs;
-
-       return 0;
+       if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
+               return -ENODEV;
 
-err_remove_sysfs:
-       sysfs_remove_link(&device->dev.kobj, "sysdev");
-err_clear_processor:
-       /*
-        * processor_device_array is not cleared to allow checks for buggy BIOS
-        */ 
-       per_cpu(processors, pr->id) = NULL;
-err_free_cpumask:
-       free_cpumask_var(pr->throttling.shared_cpu_map);
-err_free_pr:
-       kfree(pr);
-       return result;
+       return __acpi_processor_start(device);
 }
 
-static int acpi_processor_remove(struct acpi_device *device)
+static int acpi_processor_stop(struct device *dev)
 {
-       struct acpi_processor *pr = NULL;
+       struct acpi_device *device;
+       struct acpi_processor *pr;
 
+       if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
+               return 0;
 
-       if (!device || !acpi_driver_data(device))
-               return -EINVAL;
+       acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
+                                  acpi_processor_notify);
 
        pr = acpi_driver_data(device);
-
-       if (pr->id >= nr_cpu_ids)
-               goto free;
-
-       if (device->removal_type == ACPI_BUS_REMOVAL_EJECT) {
-               if (acpi_processor_handle_eject(pr))
-                       return -EINVAL;
-       }
+       if (!pr)
+               return 0;
 
        acpi_processor_power_exit(pr);
 
-       sysfs_remove_link(&device->dev.kobj, "sysdev");
-
        if (pr->cdev) {
                sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
                sysfs_remove_link(&pr->cdev->device.kobj, "device");
                thermal_cooling_device_unregister(pr->cdev);
                pr->cdev = NULL;
        }
-
-       per_cpu(processors, pr->id) = NULL;
-       per_cpu(processor_device_array, pr->id) = NULL;
-       try_offline_node(cpu_to_node(pr->id));
-
-free:
-       free_cpumask_var(pr->throttling.shared_cpu_map);
-       kfree(pr);
-
        return 0;
 }
 
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-/****************************************************************************
- *     Acpi processor hotplug support                                      *
- ****************************************************************************/
-
-static int is_processor_present(acpi_handle handle)
-{
-       acpi_status status;
-       unsigned long long sta = 0;
-
-
-       status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
-
-       if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT))
-               return 1;
-
-       /*
-        * _STA is mandatory for a processor that supports hot plug
-        */
-       if (status == AE_NOT_FOUND)
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                               "Processor does not support hot plug\n"));
-       else
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Processor Device is not present"));
-       return 0;
-}
-
-static void acpi_processor_hotplug_notify(acpi_handle handle,
-                                         u32 event, void *data)
-{
-       struct acpi_device *device = NULL;
-       struct acpi_eject_event *ej_event = NULL;
-       u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
-       acpi_status status;
-       int result;
-
-       acpi_scan_lock_acquire();
-
-       switch (event) {
-       case ACPI_NOTIFY_BUS_CHECK:
-       case ACPI_NOTIFY_DEVICE_CHECK:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "Processor driver received %s event\n",
-                      (event == ACPI_NOTIFY_BUS_CHECK) ?
-                      "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"));
-
-               if (!is_processor_present(handle))
-                       break;
-
-               if (!acpi_bus_get_device(handle, &device))
-                       break;
-
-               result = acpi_bus_scan(handle);
-               if (result) {
-                       acpi_handle_err(handle, "Unable to add the device\n");
-                       break;
-               }
-               result = acpi_bus_get_device(handle, &device);
-               if (result) {
-                       acpi_handle_err(handle, "Missing device object\n");
-                       break;
-               }
-               ost_code = ACPI_OST_SC_SUCCESS;
-               break;
-
-       case ACPI_NOTIFY_EJECT_REQUEST:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "received ACPI_NOTIFY_EJECT_REQUEST\n"));
-
-               if (acpi_bus_get_device(handle, &device)) {
-                       acpi_handle_err(handle,
-                               "Device don't exist, dropping EJECT\n");
-                       break;
-               }
-               if (!acpi_driver_data(device)) {
-                       acpi_handle_err(handle,
-                               "Driver data is NULL, dropping EJECT\n");
-                       break;
-               }
-
-               ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
-               if (!ej_event) {
-                       acpi_handle_err(handle, "No memory, dropping EJECT\n");
-                       break;
-               }
-
-               get_device(&device->dev);
-               ej_event->device = device;
-               ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
-               /* The eject is carried out asynchronously. */
-               status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
-                                                ej_event);
-               if (ACPI_FAILURE(status)) {
-                       put_device(&device->dev);
-                       kfree(ej_event);
-                       break;
-               }
-               goto out;
-
-       default:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Unsupported event [0x%x]\n", event));
-
-               /* non-hotplug event; possibly handled by other handler */
-               goto out;
-       }
-
-       /* Inform firmware that the hotplug operation has completed */
-       (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
-
- out:
-       acpi_scan_lock_release();
-}
-
-static acpi_status is_processor_device(acpi_handle handle)
-{
-       struct acpi_device_info *info;
-       char *hid;
-       acpi_status status;
-
-       status = acpi_get_object_info(handle, &info);
-       if (ACPI_FAILURE(status))
-               return status;
-
-       if (info->type == ACPI_TYPE_PROCESSOR) {
-               kfree(info);
-               return AE_OK;   /* found a processor object */
-       }
-
-       if (!(info->valid & ACPI_VALID_HID)) {
-               kfree(info);
-               return AE_ERROR;
-       }
-
-       hid = info->hardware_id.string;
-       if ((hid == NULL) || strcmp(hid, ACPI_PROCESSOR_DEVICE_HID)) {
-               kfree(info);
-               return AE_ERROR;
-       }
-
-       kfree(info);
-       return AE_OK;   /* found a processor device object */
-}
-
-static acpi_status
-processor_walk_namespace_cb(acpi_handle handle,
-                           u32 lvl, void *context, void **rv)
-{
-       acpi_status status;
-       int *action = context;
-
-       status = is_processor_device(handle);
-       if (ACPI_FAILURE(status))
-               return AE_OK;   /* not a processor; continue to walk */
-
-       switch (*action) {
-       case INSTALL_NOTIFY_HANDLER:
-               acpi_install_notify_handler(handle,
-                                           ACPI_SYSTEM_NOTIFY,
-                                           acpi_processor_hotplug_notify,
-                                           NULL);
-               break;
-       case UNINSTALL_NOTIFY_HANDLER:
-               acpi_remove_notify_handler(handle,
-                                          ACPI_SYSTEM_NOTIFY,
-                                          acpi_processor_hotplug_notify);
-               break;
-       default:
-               break;
-       }
-
-       /* found a processor; skip walking underneath */
-       return AE_CTRL_DEPTH;
-}
-
-static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
-{
-       acpi_handle handle = pr->handle;
-
-       if (!is_processor_present(handle)) {
-               return AE_ERROR;
-       }
-
-       if (acpi_map_lsapic(handle, &pr->id))
-               return AE_ERROR;
-
-       if (arch_register_cpu(pr->id)) {
-               acpi_unmap_lsapic(pr->id);
-               return AE_ERROR;
-       }
-
-       /* CPU got hot-plugged, but cpu_data is not initialized yet
-        * Set flag to delay cpu_idle/throttling initialization
-        * in:
-        * acpi_processor_add()
-        *   acpi_processor_get_info()
-        * and do it when the CPU gets online the first time
-        * TBD: Cleanup above functions and try to do this more elegant.
-        */
-       pr_info("CPU %d got hotplugged\n", pr->id);
-       pr->flags.need_hotplug_init = 1;
-
-       return AE_OK;
-}
-
-static int acpi_processor_handle_eject(struct acpi_processor *pr)
-{
-       if (cpu_online(pr->id))
-               cpu_down(pr->id);
-
-       get_online_cpus();
-       /*
-        * The cpu might become online again at this point. So we check whether
-        * the cpu has been onlined or not. If the cpu became online, it means
-        * that someone wants to use the cpu. So acpi_processor_handle_eject()
-        * returns -EAGAIN.
-        */
-       if (unlikely(cpu_online(pr->id))) {
-               put_online_cpus();
-               pr_warn("Failed to remove CPU %d, because other task "
-                       "brought the CPU back online\n", pr->id);
-               return -EAGAIN;
-       }
-       arch_unregister_cpu(pr->id);
-       acpi_unmap_lsapic(pr->id);
-       put_online_cpus();
-       return (0);
-}
-#else
-static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr)
-{
-       return AE_ERROR;
-}
-static int acpi_processor_handle_eject(struct acpi_processor *pr)
-{
-       return (-EINVAL);
-}
-#endif
-
-static
-void acpi_processor_install_hotplug_notify(void)
-{
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-       int action = INSTALL_NOTIFY_HANDLER;
-       acpi_walk_namespace(ACPI_TYPE_ANY,
-                           ACPI_ROOT_OBJECT,
-                           ACPI_UINT32_MAX,
-                           processor_walk_namespace_cb, NULL, &action, NULL);
-#endif
-       register_hotcpu_notifier(&acpi_cpu_notifier);
-}
-
-static
-void acpi_processor_uninstall_hotplug_notify(void)
-{
-#ifdef CONFIG_ACPI_HOTPLUG_CPU
-       int action = UNINSTALL_NOTIFY_HANDLER;
-       acpi_walk_namespace(ACPI_TYPE_ANY,
-                           ACPI_ROOT_OBJECT,
-                           ACPI_UINT32_MAX,
-                           processor_walk_namespace_cb, NULL, &action, NULL);
-#endif
-       unregister_hotcpu_notifier(&acpi_cpu_notifier);
-}
-
 /*
  * We keep the driver loaded even when ACPI is not running.
  * This is needed for the powernow-k8 driver, that works even without
  * ACPI, but needs symbols from this driver
  */
 
-static int __init acpi_processor_init(void)
+static int __init acpi_processor_driver_init(void)
 {
        int result = 0;
 
        if (acpi_disabled)
                return 0;
 
-       result = acpi_bus_register_driver(&acpi_processor_driver);
+       result = driver_register(&acpi_processor_driver);
        if (result < 0)
                return result;
 
        acpi_processor_syscore_init();
-
-       acpi_processor_install_hotplug_notify();
-
+       register_hotcpu_notifier(&acpi_cpu_notifier);
        acpi_thermal_cpufreq_init();
-
        acpi_processor_ppc_init();
-
        acpi_processor_throttling_init();
-
        return 0;
 }
 
-static void __exit acpi_processor_exit(void)
+static void __exit acpi_processor_driver_exit(void)
 {
        if (acpi_disabled)
                return;
 
        acpi_processor_ppc_exit();
-
        acpi_thermal_cpufreq_exit();
-
-       acpi_processor_uninstall_hotplug_notify();
-
+       unregister_hotcpu_notifier(&acpi_cpu_notifier);
        acpi_processor_syscore_exit();
-
-       acpi_bus_unregister_driver(&acpi_processor_driver);
-
-       return;
+       driver_unregister(&acpi_processor_driver);
 }
 
-module_init(acpi_processor_init);
-module_exit(acpi_processor_exit);
+module_init(acpi_processor_driver_init);
+module_exit(acpi_processor_driver_exit);
 
 MODULE_ALIAS("processor");
index a3868f6c222abfc65541a5a599035e18145108f9..3322b47ab7cae22dc08520b6cec9a3b1df981b84 100644 (file)
@@ -304,7 +304,8 @@ static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi)
 }
 
 static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
-                                    u8 triggering, u8 polarity, u8 shareable)
+                                    u8 triggering, u8 polarity, u8 shareable,
+                                    bool legacy)
 {
        int irq, p, t;
 
@@ -317,14 +318,19 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
         * In IO-APIC mode, use overrided attribute. Two reasons:
         * 1. BIOS bug in DSDT
         * 2. BIOS uses IO-APIC mode Interrupt Source Override
+        *
+        * We do this only if we are dealing with IRQ() or IRQNoFlags()
+        * resource (the legacy ISA resources). With modern ACPI 5 devices
+        * using extended IRQ descriptors we take the IRQ configuration
+        * from _CRS directly.
         */
-       if (!acpi_get_override_irq(gsi, &t, &p)) {
+       if (legacy && !acpi_get_override_irq(gsi, &t, &p)) {
                u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
                u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
 
                if (triggering != trig || polarity != pol) {
                        pr_warning("ACPI: IRQ %d override to %s, %s\n", gsi,
-                                  t ? "edge" : "level", p ? "low" : "high");
+                                  t ? "level" : "edge", p ? "low" : "high");
                        triggering = trig;
                        polarity = pol;
                }
@@ -373,7 +379,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
                }
                acpi_dev_get_irqresource(res, irq->interrupts[index],
                                         irq->triggering, irq->polarity,
-                                        irq->sharable);
+                                        irq->sharable, true);
                break;
        case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                ext_irq = &ares->data.extended_irq;
@@ -383,7 +389,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
                }
                acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
                                         ext_irq->triggering, ext_irq->polarity,
-                                        ext_irq->sharable);
+                                        ext_irq->sharable, false);
                break;
        default:
                return false;
index b14ac46948c9e444246eba50e367ed1a16399ea2..e0db2dc42370981ba7170f448ae9f061c8debfb5 100644 (file)
@@ -27,6 +27,12 @@ extern struct acpi_device *acpi_root;
 
 #define ACPI_IS_ROOT_DEVICE(device)    (!(device)->parent)
 
+/*
+ * If set, devices will be hot-removed even if they cannot be put offline
+ * gracefully (from the kernel's standpoint).
+ */
+bool acpi_force_hot_remove;
+
 static const char *dummy_hid = "device";
 
 static LIST_HEAD(acpi_device_list);
@@ -120,12 +126,78 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha
 }
 static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
 
+static acpi_status acpi_bus_offline_companions(acpi_handle handle, u32 lvl,
+                                              void *data, void **ret_p)
+{
+       struct acpi_device *device = NULL;
+       struct acpi_device_physical_node *pn;
+       bool second_pass = (bool)data;
+       acpi_status status = AE_OK;
+
+       if (acpi_bus_get_device(handle, &device))
+               return AE_OK;
+
+       mutex_lock(&device->physical_node_lock);
+
+       list_for_each_entry(pn, &device->physical_node_list, node) {
+               int ret;
+
+               if (second_pass) {
+                       /* Skip devices offlined by the first pass. */
+                       if (pn->put_online)
+                               continue;
+               } else {
+                       pn->put_online = false;
+               }
+               ret = device_offline(pn->dev);
+               if (acpi_force_hot_remove)
+                       continue;
+
+               if (ret >= 0) {
+                       pn->put_online = !ret;
+               } else {
+                       *ret_p = pn->dev;
+                       if (second_pass) {
+                               status = AE_ERROR;
+                               break;
+                       }
+               }
+       }
+
+       mutex_unlock(&device->physical_node_lock);
+
+       return status;
+}
+
+static acpi_status acpi_bus_online_companions(acpi_handle handle, u32 lvl,
+                                             void *data, void **ret_p)
+{
+       struct acpi_device *device = NULL;
+       struct acpi_device_physical_node *pn;
+
+       if (acpi_bus_get_device(handle, &device))
+               return AE_OK;
+
+       mutex_lock(&device->physical_node_lock);
+
+       list_for_each_entry(pn, &device->physical_node_list, node)
+               if (pn->put_online) {
+                       device_online(pn->dev);
+                       pn->put_online = false;
+               }
+
+       mutex_unlock(&device->physical_node_lock);
+
+       return AE_OK;
+}
+
 static int acpi_scan_hot_remove(struct acpi_device *device)
 {
        acpi_handle handle = device->handle;
        acpi_handle not_used;
        struct acpi_object_list arg_list;
        union acpi_object arg;
+       struct device *errdev;
        acpi_status status;
        unsigned long long sta;
 
@@ -136,10 +208,53 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
                return -EINVAL;
        }
 
+       lock_device_hotplug();
+
+       /*
+        * Carry out two passes here and ignore errors in the first pass,
+        * because if the devices in question are memory blocks and
+        * CONFIG_MEMCG is set, one of the blocks may hold data structures
+        * that the other blocks depend on, but it is not known in advance which
+        * block holds them.
+        *
+        * If the first pass is successful, the second one isn't needed, though.
+        */
+       errdev = NULL;
+       acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
+                           NULL, acpi_bus_offline_companions,
+                           (void *)false, (void **)&errdev);
+       acpi_bus_offline_companions(handle, 0, (void *)false, (void **)&errdev);
+       if (errdev) {
+               errdev = NULL;
+               acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
+                                   NULL, acpi_bus_offline_companions,
+                                   (void *)true , (void **)&errdev);
+               if (!errdev || acpi_force_hot_remove)
+                       acpi_bus_offline_companions(handle, 0, (void *)true,
+                                                   (void **)&errdev);
+
+               if (errdev && !acpi_force_hot_remove) {
+                       dev_warn(errdev, "Offline failed.\n");
+                       acpi_bus_online_companions(handle, 0, NULL, NULL);
+                       acpi_walk_namespace(ACPI_TYPE_ANY, handle,
+                                           ACPI_UINT32_MAX,
+                                           acpi_bus_online_companions, NULL,
+                                           NULL, NULL);
+
+                       unlock_device_hotplug();
+
+                       put_device(&device->dev);
+                       return -EBUSY;
+               }
+       }
+
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                "Hot-removing device %s...\n", dev_name(&device->dev)));
 
        acpi_bus_trim(device);
+
+       unlock_device_hotplug();
+
        /* Device node has been unregistered. */
        put_device(&device->dev);
        device = NULL;
@@ -236,6 +351,7 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
        int error;
 
        mutex_lock(&acpi_scan_lock);
+       lock_device_hotplug();
 
        acpi_bus_get_device(handle, &device);
        if (device) {
@@ -259,6 +375,7 @@ static void acpi_scan_bus_device_check(acpi_handle handle, u32 ost_source)
                kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
 
  out:
+       unlock_device_hotplug();
        acpi_evaluate_hotplug_ost(handle, ost_source, ost_code, NULL);
        mutex_unlock(&acpi_scan_lock);
 }
@@ -816,32 +933,43 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
                                           acpi_device_notify);
 }
 
-static int acpi_bus_driver_init(struct acpi_device *, struct acpi_driver *);
-static int acpi_device_probe(struct device * dev)
+static int acpi_device_probe(struct device *dev)
 {
        struct acpi_device *acpi_dev = to_acpi_device(dev);
        struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
        int ret;
 
-       ret = acpi_bus_driver_init(acpi_dev, acpi_drv);
-       if (!ret) {
-               if (acpi_drv->ops.notify) {
-                       ret = acpi_device_install_notify_handler(acpi_dev);
-                       if (ret) {
-                               if (acpi_drv->ops.remove)
-                                       acpi_drv->ops.remove(acpi_dev);
-                               acpi_dev->driver = NULL;
-                               acpi_dev->driver_data = NULL;
-                               return ret;
-                       }
-               }
+       if (acpi_dev->handler)
+               return -EINVAL;
 
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Found driver [%s] for device [%s]\n",
-                       acpi_drv->name, acpi_dev->pnp.bus_id));
-               get_device(dev);
+       if (!acpi_drv->ops.add)
+               return -ENOSYS;
+
+       ret = acpi_drv->ops.add(acpi_dev);
+       if (ret)
+               return ret;
+
+       acpi_dev->driver = acpi_drv;
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Driver [%s] successfully bound to device [%s]\n",
+                         acpi_drv->name, acpi_dev->pnp.bus_id));
+
+       if (acpi_drv->ops.notify) {
+               ret = acpi_device_install_notify_handler(acpi_dev);
+               if (ret) {
+                       if (acpi_drv->ops.remove)
+                               acpi_drv->ops.remove(acpi_dev);
+
+                       acpi_dev->driver = NULL;
+                       acpi_dev->driver_data = NULL;
+                       return ret;
+               }
        }
-       return ret;
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n",
+                         acpi_drv->name, acpi_dev->pnp.bus_id));
+       get_device(dev);
+       return 0;
 }
 
 static int acpi_device_remove(struct device * dev)
@@ -952,7 +1080,6 @@ int acpi_device_add(struct acpi_device *device,
                printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n",
                       dev_name(&device->dev));
 
-       device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
        return 0;
 
  err:
@@ -997,41 +1124,6 @@ static void acpi_device_unregister(struct acpi_device *device)
 /* --------------------------------------------------------------------------
                                  Driver Management
    -------------------------------------------------------------------------- */
-/**
- * acpi_bus_driver_init - add a device to a driver
- * @device: the device to add and initialize
- * @driver: driver for the device
- *
- * Used to initialize a device via its device driver.  Called whenever a
- * driver is bound to a device.  Invokes the driver's add() ops.
- */
-static int
-acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
-{
-       int result = 0;
-
-       if (!device || !driver)
-               return -EINVAL;
-
-       if (!driver->ops.add)
-               return -ENOSYS;
-
-       result = driver->ops.add(device);
-       if (result)
-               return result;
-
-       device->driver = driver;
-
-       /*
-        * TBD - Configuration Management: Assign resources to device based
-        * upon possible configuration and currently allocated resources.
-        */
-
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "Driver successfully bound to device\n"));
-       return 0;
-}
-
 /**
  * acpi_bus_register_driver - register a driver with the ACPI bus
  * @driver: driver being registered
@@ -1939,7 +2031,6 @@ static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used,
        if (!acpi_bus_get_device(handle, &device)) {
                struct acpi_scan_handler *dev_handler = device->handler;
 
-               device->removal_type = ACPI_BUS_REMOVAL_EJECT;
                if (dev_handler) {
                        if (dev_handler->detach)
                                dev_handler->detach(device);
@@ -2038,10 +2129,12 @@ int __init acpi_scan_init(void)
 
        acpi_pci_root_init();
        acpi_pci_link_init();
+       acpi_processor_init();
        acpi_platform_init();
        acpi_lpss_init();
        acpi_container_init();
        acpi_memory_hotplug_init();
+       acpi_dock_init();
 
        mutex_lock(&acpi_scan_lock);
        /*
index fcae5fa2e1b322481ec2b331c4df0430bff66d53..5c5d1624fa2c261c8b6dca89a34156268a91d799 100644 (file)
@@ -780,6 +780,33 @@ void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
        pr_err(PREFIX "Unable to add hotplug profile '%s'\n", name);
 }
 
+static ssize_t force_remove_show(struct kobject *kobj,
+                                struct kobj_attribute *attr, char *buf)
+{
+       return sprintf(buf, "%d\n", !!acpi_force_hot_remove);
+}
+
+static ssize_t force_remove_store(struct kobject *kobj,
+                                 struct kobj_attribute *attr,
+                                 const char *buf, size_t size)
+{
+       bool val;
+       int ret;
+
+       ret = strtobool(buf, &val);
+       if (ret < 0)
+               return ret;
+
+       lock_device_hotplug();
+       acpi_force_hot_remove = val;
+       unlock_device_hotplug();
+       return size;
+}
+
+static const struct kobj_attribute force_remove_attr =
+       __ATTR(force_remove, S_IRUGO | S_IWUSR, force_remove_show,
+              force_remove_store);
+
 int __init acpi_sysfs_init(void)
 {
        int result;
@@ -789,6 +816,10 @@ int __init acpi_sysfs_init(void)
                return result;
 
        hotplug_kobj = kobject_create_and_add("hotplug", acpi_kobj);
+       result = sysfs_create_file(hotplug_kobj, &force_remove_attr.attr);
+       if (result)
+               return result;
+
        result = sysfs_create_file(acpi_kobj, &pm_profile_attr.attr);
        return result;
 }
index 440eadf2d32cdd270a75e9023f9ef31a1d9ae794..5d7075d25700b3bbd2cbe65772391155d1a10d30 100644 (file)
@@ -1722,9 +1722,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
        int error;
        acpi_status status;
 
-       if (device->handler)
-               return -EINVAL;
-
        status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
                                device->parent->handle, 1,
                                acpi_video_bus_match, NULL,
index 87f2f395d79a1f9a9cd3dbc81675f0d71ac6f2cd..cf4e7020adacde5e69881a21adb0c578d31d7a3e 100644 (file)
@@ -156,8 +156,10 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
 
        spin_unlock_irqrestore(ap->lock, flags);
 
-       if (wait)
+       if (wait) {
                ata_port_wait_eh(ap);
+               flush_work(&ap->hotplug_task.work);
+       }
 }
 
 static void ata_acpi_dev_notify_dock(acpi_handle handle, u32 event, void *data)
@@ -214,6 +216,39 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = {
        .uevent = ata_acpi_ap_uevent,
 };
 
+void ata_acpi_hotplug_init(struct ata_host *host)
+{
+       int i;
+
+       for (i = 0; i < host->n_ports; i++) {
+               struct ata_port *ap = host->ports[i];
+               acpi_handle handle;
+               struct ata_device *dev;
+
+               if (!ap)
+                       continue;
+
+               handle = ata_ap_acpi_handle(ap);
+               if (handle) {
+                       /* we might be on a docking station */
+                       register_hotplug_dock_device(handle,
+                                                    &ata_acpi_ap_dock_ops, ap,
+                                                    NULL, NULL);
+               }
+
+               ata_for_each_dev(dev, &ap->link, ALL) {
+                       handle = ata_dev_acpi_handle(dev);
+                       if (!handle)
+                               continue;
+
+                       /* we might be on a docking station */
+                       register_hotplug_dock_device(handle,
+                                                    &ata_acpi_dev_dock_ops,
+                                                    dev, NULL, NULL);
+               }
+       }
+}
+
 /**
  * ata_acpi_dissociate - dissociate ATA host from ACPI objects
  * @host: target ATA host
index f2184276539d885d167c2048a305847b51e58417..adf002a3c584b3d2bd7fb27357df040a381f3b82 100644 (file)
@@ -6148,6 +6148,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
        if (rc)
                goto err_tadd;
 
+       ata_acpi_hotplug_init(host);
+
        /* set cable, sata_spd_limit and report */
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];
index c949dd311b2ecd2e6d65e294409d24c4afea6eb7..577d902bc4deaa12d69d1acdc8aa304732163227 100644 (file)
@@ -122,6 +122,7 @@ extern int ata_acpi_register(void);
 extern void ata_acpi_unregister(void);
 extern void ata_acpi_bind(struct ata_device *dev);
 extern void ata_acpi_unbind(struct ata_device *dev);
+extern void ata_acpi_hotplug_init(struct ata_host *host);
 #else
 static inline void ata_acpi_dissociate(struct ata_host *host) { }
 static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; }
@@ -134,6 +135,7 @@ static inline int ata_acpi_register(void) { return 0; }
 static inline void ata_acpi_unregister(void) { }
 static inline void ata_acpi_bind(struct ata_device *dev) { }
 static inline void ata_acpi_unbind(struct ata_device *dev) { }
+static inline void ata_acpi_hotplug_init(struct ata_host *host) {}
 #endif
 
 /* libata-scsi.c */
index 2499cefdcdf2429d9503506d5514a4943f9ec4e1..2166f34b7d842ac7fa8d129858dac244e9e5394a 100644 (file)
@@ -403,6 +403,36 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
 static struct device_attribute uevent_attr =
        __ATTR(uevent, S_IRUGO | S_IWUSR, show_uevent, store_uevent);
 
+static ssize_t show_online(struct device *dev, struct device_attribute *attr,
+                          char *buf)
+{
+       bool val;
+
+       lock_device_hotplug();
+       val = !dev->offline;
+       unlock_device_hotplug();
+       return sprintf(buf, "%u\n", val);
+}
+
+static ssize_t store_online(struct device *dev, struct device_attribute *attr,
+                           const char *buf, size_t count)
+{
+       bool val;
+       int ret;
+
+       ret = strtobool(buf, &val);
+       if (ret < 0)
+               return ret;
+
+       lock_device_hotplug();
+       ret = val ? device_online(dev) : device_offline(dev);
+       unlock_device_hotplug();
+       return ret < 0 ? ret : count;
+}
+
+static struct device_attribute online_attr =
+       __ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online);
+
 static int device_add_attributes(struct device *dev,
                                 struct device_attribute *attrs)
 {
@@ -516,6 +546,12 @@ static int device_add_attrs(struct device *dev)
        if (error)
                goto err_remove_type_groups;
 
+       if (device_supports_offline(dev) && !dev->offline_disabled) {
+               error = device_create_file(dev, &online_attr);
+               if (error)
+                       goto err_remove_type_groups;
+       }
+
        return 0;
 
  err_remove_type_groups:
@@ -536,6 +572,7 @@ static void device_remove_attrs(struct device *dev)
        struct class *class = dev->class;
        const struct device_type *type = dev->type;
 
+       device_remove_file(dev, &online_attr);
        device_remove_groups(dev, dev->groups);
 
        if (type)
@@ -1433,6 +1470,99 @@ EXPORT_SYMBOL_GPL(put_device);
 EXPORT_SYMBOL_GPL(device_create_file);
 EXPORT_SYMBOL_GPL(device_remove_file);
 
+static DEFINE_MUTEX(device_hotplug_lock);
+
+void lock_device_hotplug(void)
+{
+       mutex_lock(&device_hotplug_lock);
+}
+
+void unlock_device_hotplug(void)
+{
+       mutex_unlock(&device_hotplug_lock);
+}
+
+static int device_check_offline(struct device *dev, void *not_used)
+{
+       int ret;
+
+       ret = device_for_each_child(dev, NULL, device_check_offline);
+       if (ret)
+               return ret;
+
+       return device_supports_offline(dev) && !dev->offline ? -EBUSY : 0;
+}
+
+/**
+ * device_offline - Prepare the device for hot-removal.
+ * @dev: Device to be put offline.
+ *
+ * Execute the device bus type's .offline() callback, if present, to prepare
+ * the device for a subsequent hot-removal.  If that succeeds, the device must
+ * not be used until either it is removed or its bus type's .online() callback
+ * is executed.
+ *
+ * Call under device_hotplug_lock.
+ */
+int device_offline(struct device *dev)
+{
+       int ret;
+
+       if (dev->offline_disabled)
+               return -EPERM;
+
+       ret = device_for_each_child(dev, NULL, device_check_offline);
+       if (ret)
+               return ret;
+
+       device_lock(dev);
+       if (device_supports_offline(dev)) {
+               if (dev->offline) {
+                       ret = 1;
+               } else {
+                       ret = dev->bus->offline(dev);
+                       if (!ret) {
+                               kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
+                               dev->offline = true;
+                       }
+               }
+       }
+       device_unlock(dev);
+
+       return ret;
+}
+
+/**
+ * device_online - Put the device back online after successful device_offline().
+ * @dev: Device to be put back online.
+ *
+ * If device_offline() has been successfully executed for @dev, but the device
+ * has not been removed subsequently, execute its bus type's .online() callback
+ * to indicate that the device can be used again.
+ *
+ * Call under device_hotplug_lock.
+ */
+int device_online(struct device *dev)
+{
+       int ret = 0;
+
+       device_lock(dev);
+       if (device_supports_offline(dev)) {
+               if (dev->offline) {
+                       ret = dev->bus->online(dev);
+                       if (!ret) {
+                               kobject_uevent(&dev->kobj, KOBJ_ONLINE);
+                               dev->offline = false;
+                       }
+               } else {
+                       ret = 1;
+               }
+       }
+       device_unlock(dev);
+
+       return ret;
+}
+
 struct root_device {
        struct device dev;
        struct module *owner;
index 3d48fc887ef4b3a3da1aadefaf9129578e3d1ef2..1d110dc6f0c1f371ac262a9f6e352b5d626bf2fa 100644 (file)
 #include <linux/gfp.h>
 #include <linux/slab.h>
 #include <linux/percpu.h>
+#include <linux/acpi.h>
 
 #include "base.h"
 
-struct bus_type cpu_subsys = {
-       .name = "cpu",
-       .dev_name = "cpu",
-};
-EXPORT_SYMBOL_GPL(cpu_subsys);
-
 static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
 
+static int cpu_subsys_match(struct device *dev, struct device_driver *drv)
+{
+       /* ACPI style match is the only one that may succeed. */
+       if (acpi_driver_match_device(dev, drv))
+               return 1;
+
+       return 0;
+}
+
 #ifdef CONFIG_HOTPLUG_CPU
 static void change_cpu_under_node(struct cpu *cpu,
                        unsigned int from_nid, unsigned int to_nid)
@@ -34,69 +38,45 @@ static void change_cpu_under_node(struct cpu *cpu,
        cpu->node_id = to_nid;
 }
 
-static ssize_t show_online(struct device *dev,
-                          struct device_attribute *attr,
-                          char *buf)
+static int __ref cpu_subsys_online(struct device *dev)
 {
        struct cpu *cpu = container_of(dev, struct cpu, dev);
+       int cpuid = dev->id;
+       int from_nid, to_nid;
+       int ret;
 
-       return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id));
+       cpu_hotplug_driver_lock();
+
+       from_nid = cpu_to_node(cpuid);
+       ret = cpu_up(cpuid);
+       /*
+        * When hot adding memory to memoryless node and enabling a cpu
+        * on the node, node number of the cpu may internally change.
+        */
+       to_nid = cpu_to_node(cpuid);
+       if (from_nid != to_nid)
+               change_cpu_under_node(cpu, from_nid, to_nid);
+
+       cpu_hotplug_driver_unlock();
+       return ret;
 }
 
-static ssize_t __ref store_online(struct device *dev,
-                                 struct device_attribute *attr,
-                                 const char *buf, size_t count)
+static int cpu_subsys_offline(struct device *dev)
 {
-       struct cpu *cpu = container_of(dev, struct cpu, dev);
-       int cpuid = cpu->dev.id;
-       int from_nid, to_nid;
-       ssize_t ret;
+       int ret;
 
        cpu_hotplug_driver_lock();
-       switch (buf[0]) {
-       case '0':
-               ret = cpu_down(cpuid);
-               if (!ret)
-                       kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
-               break;
-       case '1':
-               from_nid = cpu_to_node(cpuid);
-               ret = cpu_up(cpuid);
-
-               /*
-                * When hot adding memory to memoryless node and enabling a cpu
-                * on the node, node number of the cpu may internally change.
-                */
-               to_nid = cpu_to_node(cpuid);
-               if (from_nid != to_nid)
-                       change_cpu_under_node(cpu, from_nid, to_nid);
-
-               if (!ret)
-                       kobject_uevent(&dev->kobj, KOBJ_ONLINE);
-               break;
-       default:
-               ret = -EINVAL;
-       }
+       ret = cpu_down(dev->id);
        cpu_hotplug_driver_unlock();
-
-       if (ret >= 0)
-               ret = count;
        return ret;
 }
-static DEVICE_ATTR(online, 0644, show_online, store_online);
 
-static void __cpuinit register_cpu_control(struct cpu *cpu)
-{
-       device_create_file(&cpu->dev, &dev_attr_online);
-}
 void unregister_cpu(struct cpu *cpu)
 {
        int logical_cpu = cpu->dev.id;
 
        unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
 
-       device_remove_file(&cpu->dev, &dev_attr_online);
-
        device_unregister(&cpu->dev);
        per_cpu(cpu_sys_devices, logical_cpu) = NULL;
        return;
@@ -123,12 +103,19 @@ static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
 static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
 #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
 
-#else /* ... !CONFIG_HOTPLUG_CPU */
-static inline void register_cpu_control(struct cpu *cpu)
-{
-}
 #endif /* CONFIG_HOTPLUG_CPU */
 
+struct bus_type cpu_subsys = {
+       .name = "cpu",
+       .dev_name = "cpu",
+       .match = cpu_subsys_match,
+#ifdef CONFIG_HOTPLUG_CPU
+       .online = cpu_subsys_online,
+       .offline = cpu_subsys_offline,
+#endif
+};
+EXPORT_SYMBOL_GPL(cpu_subsys);
+
 #ifdef CONFIG_KEXEC
 #include <linux/kexec.h>
 
@@ -277,12 +264,12 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
        cpu->dev.id = num;
        cpu->dev.bus = &cpu_subsys;
        cpu->dev.release = cpu_device_release;
+       cpu->dev.offline_disabled = !cpu->hotpluggable;
+       cpu->dev.offline = !cpu_online(num);
 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
        cpu->dev.bus->uevent = arch_cpu_uevent;
 #endif
        error = device_register(&cpu->dev);
-       if (!error && cpu->hotpluggable)
-               register_cpu_control(cpu);
        if (!error)
                per_cpu(cpu_sys_devices, num) = &cpu->dev;
        if (!error)
index 4b1f9265887f1048ff5a64cc14fa3d04964b519b..01e21037d8feb5c04e6aedee608e9cdedc0d87bd 100644 (file)
@@ -450,8 +450,18 @@ static void fw_load_abort(struct firmware_priv *fw_priv)
 {
        struct firmware_buf *buf = fw_priv->buf;
 
+       /*
+        * There is a small window in which user can write to 'loading'
+        * between loading done and disappearance of 'loading'
+        */
+       if (test_bit(FW_STATUS_DONE, &buf->status))
+               return;
+
        set_bit(FW_STATUS_ABORT, &buf->status);
        complete_all(&buf->completion);
+
+       /* avoid user action after loading abort */
+       fw_priv->buf = NULL;
 }
 
 #define is_fw_load_aborted(buf)        \
@@ -528,7 +538,12 @@ static ssize_t firmware_loading_show(struct device *dev,
                                     struct device_attribute *attr, char *buf)
 {
        struct firmware_priv *fw_priv = to_firmware_priv(dev);
-       int loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status);
+       int loading = 0;
+
+       mutex_lock(&fw_lock);
+       if (fw_priv->buf)
+               loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status);
+       mutex_unlock(&fw_lock);
 
        return sprintf(buf, "%d\n", loading);
 }
@@ -570,12 +585,12 @@ static ssize_t firmware_loading_store(struct device *dev,
                                      const char *buf, size_t count)
 {
        struct firmware_priv *fw_priv = to_firmware_priv(dev);
-       struct firmware_buf *fw_buf = fw_priv->buf;
+       struct firmware_buf *fw_buf;
        int loading = simple_strtol(buf, NULL, 10);
        int i;
 
        mutex_lock(&fw_lock);
-
+       fw_buf = fw_priv->buf;
        if (!fw_buf)
                goto out;
 
@@ -777,10 +792,6 @@ static void firmware_class_timeout_work(struct work_struct *work)
                        struct firmware_priv, timeout_work.work);
 
        mutex_lock(&fw_lock);
-       if (test_bit(FW_STATUS_DONE, &(fw_priv->buf->status))) {
-               mutex_unlock(&fw_lock);
-               return;
-       }
        fw_load_abort(fw_priv);
        mutex_unlock(&fw_lock);
 }
@@ -861,8 +872,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
 
        cancel_delayed_work_sync(&fw_priv->timeout_work);
 
-       fw_priv->buf = NULL;
-
        device_remove_file(f_dev, &dev_attr_loading);
 err_del_bin_attr:
        device_remove_bin_file(f_dev, &firmware_attr_data);
index 14f8a6954da0a11f1250b75b050318a9c63a4cb2..4ebf97f99fae0f84fb7d8f28bc9a9bd513f7b5aa 100644 (file)
@@ -37,9 +37,14 @@ static inline int base_memory_block_id(int section_nr)
        return section_nr / sections_per_block;
 }
 
+static int memory_subsys_online(struct device *dev);
+static int memory_subsys_offline(struct device *dev);
+
 static struct bus_type memory_subsys = {
        .name = MEMORY_CLASS_NAME,
        .dev_name = MEMORY_CLASS_NAME,
+       .online = memory_subsys_online,
+       .offline = memory_subsys_offline,
 };
 
 static BLOCKING_NOTIFIER_HEAD(memory_chain);
@@ -88,6 +93,7 @@ int register_memory(struct memory_block *memory)
        memory->dev.bus = &memory_subsys;
        memory->dev.id = memory->start_section_nr / sections_per_block;
        memory->dev.release = memory_block_release;
+       memory->dev.offline = memory->state == MEM_OFFLINE;
 
        error = device_register(&memory->dev);
        return error;
@@ -278,33 +284,64 @@ static int __memory_block_change_state(struct memory_block *mem,
 {
        int ret = 0;
 
-       if (mem->state != from_state_req) {
-               ret = -EINVAL;
-               goto out;
-       }
+       if (mem->state != from_state_req)
+               return -EINVAL;
 
        if (to_state == MEM_OFFLINE)
                mem->state = MEM_GOING_OFFLINE;
 
        ret = memory_block_action(mem->start_section_nr, to_state, online_type);
+       mem->state = ret ? from_state_req : to_state;
+       return ret;
+}
 
-       if (ret) {
-               mem->state = from_state_req;
-               goto out;
-       }
+static int memory_subsys_online(struct device *dev)
+{
+       struct memory_block *mem = container_of(dev, struct memory_block, dev);
+       int ret;
 
-       mem->state = to_state;
-       switch (mem->state) {
-       case MEM_OFFLINE:
-               kobject_uevent(&mem->dev.kobj, KOBJ_OFFLINE);
-               break;
-       case MEM_ONLINE:
-               kobject_uevent(&mem->dev.kobj, KOBJ_ONLINE);
-               break;
-       default:
-               break;
+       mutex_lock(&mem->state_mutex);
+
+       ret = mem->state == MEM_ONLINE ? 0 :
+               __memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE,
+                                           ONLINE_KEEP);
+
+       mutex_unlock(&mem->state_mutex);
+       return ret;
+}
+
+static int memory_subsys_offline(struct device *dev)
+{
+       struct memory_block *mem = container_of(dev, struct memory_block, dev);
+       int ret;
+
+       mutex_lock(&mem->state_mutex);
+
+       ret = mem->state == MEM_OFFLINE ? 0 :
+               __memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE, -1);
+
+       mutex_unlock(&mem->state_mutex);
+       return ret;
+}
+
+static int __memory_block_change_state_uevent(struct memory_block *mem,
+               unsigned long to_state, unsigned long from_state_req,
+               int online_type)
+{
+       int ret = __memory_block_change_state(mem, to_state, from_state_req,
+                                             online_type);
+       if (!ret) {
+               switch (mem->state) {
+               case MEM_OFFLINE:
+                       kobject_uevent(&mem->dev.kobj, KOBJ_OFFLINE);
+                       break;
+               case MEM_ONLINE:
+                       kobject_uevent(&mem->dev.kobj, KOBJ_ONLINE);
+                       break;
+               default:
+                       break;
+               }
        }
-out:
        return ret;
 }
 
@@ -315,8 +352,8 @@ static int memory_block_change_state(struct memory_block *mem,
        int ret;
 
        mutex_lock(&mem->state_mutex);
-       ret = __memory_block_change_state(mem, to_state, from_state_req,
-                                         online_type);
+       ret = __memory_block_change_state_uevent(mem, to_state, from_state_req,
+                                                online_type);
        mutex_unlock(&mem->state_mutex);
 
        return ret;
@@ -326,22 +363,34 @@ store_mem_state(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t count)
 {
        struct memory_block *mem;
+       bool offline;
        int ret = -EINVAL;
 
        mem = container_of(dev, struct memory_block, dev);
 
-       if (!strncmp(buf, "online_kernel", min_t(int, count, 13)))
+       lock_device_hotplug();
+
+       if (!strncmp(buf, "online_kernel", min_t(int, count, 13))) {
+               offline = false;
                ret = memory_block_change_state(mem, MEM_ONLINE,
                                                MEM_OFFLINE, ONLINE_KERNEL);
-       else if (!strncmp(buf, "online_movable", min_t(int, count, 14)))
+       } else if (!strncmp(buf, "online_movable", min_t(int, count, 14))) {
+               offline = false;
                ret = memory_block_change_state(mem, MEM_ONLINE,
                                                MEM_OFFLINE, ONLINE_MOVABLE);
-       else if (!strncmp(buf, "online", min_t(int, count, 6)))
+       } else if (!strncmp(buf, "online", min_t(int, count, 6))) {
+               offline = false;
                ret = memory_block_change_state(mem, MEM_ONLINE,
                                                MEM_OFFLINE, ONLINE_KEEP);
-       else if(!strncmp(buf, "offline", min_t(int, count, 7)))
+       } else if(!strncmp(buf, "offline", min_t(int, count, 7))) {
+               offline = true;
                ret = memory_block_change_state(mem, MEM_OFFLINE,
                                                MEM_ONLINE, -1);
+       }
+       if (!ret)
+               dev->offline = offline;
+
+       unlock_device_hotplug();
 
        if (ret)
                return ret;
@@ -679,21 +728,6 @@ int unregister_memory_section(struct mem_section *section)
 }
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
-/*
- * offline one memory block. If the memory block has been offlined, do nothing.
- */
-int offline_memory_block(struct memory_block *mem)
-{
-       int ret = 0;
-
-       mutex_lock(&mem->state_mutex);
-       if (mem->state != MEM_OFFLINE)
-               ret = __memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE, -1);
-       mutex_unlock(&mem->state_mutex);
-
-       return ret;
-}
-
 /* return true if the memory block is offlined, otherwise, return false */
 bool is_memblock_offlined(struct memory_block *mem)
 {
index 3063452e55daf5dafd5b28bb536f81109212fc2e..49394e3f31bcd8073197ce8950ecebd0403a94b9 100644 (file)
@@ -1036,12 +1036,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset)
        char *name;
        u64 segment;
        int ret;
+       char *name_format;
 
        name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO);
        if (!name)
                return NULL;
        segment = offset >> rbd_dev->header.obj_order;
-       ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx",
+       name_format = "%s.%012llx";
+       if (rbd_dev->image_format == 2)
+               name_format = "%s.%016llx";
+       ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format,
                        rbd_dev->header.object_prefix, segment);
        if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) {
                pr_err("error formatting segment name for #%llu (%d)\n",
index 934cfd18f72ded4a295192f608cc653214c03908..1144e8c7579dddbf5c0a0b0ad3363c7f5d79c57e 100644 (file)
@@ -1955,6 +1955,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
                /* XXX the notifier code should handle this better */
                if (!cn->notifier_head.head) {
                        srcu_cleanup_notifier_head(&cn->notifier_head);
+                       list_del(&cn->node);
                        kfree(cn);
                }
 
index 5c97e75924a8a87b4aebfa5e7ddfde1f31231fff..22d7699e7cedc7509849e0062212f9df18b4b1b3 100644 (file)
@@ -155,7 +155,7 @@ static __initdata unsigned long exynos5250_clk_regs[] = {
 
 /* list of all parent clock list */
 PNAME(mout_apll_p)     = { "fin_pll", "fout_apll", };
-PNAME(mout_cpu_p)      = { "mout_apll", "mout_mpll", };
+PNAME(mout_cpu_p)      = { "mout_apll", "sclk_mpll", };
 PNAME(mout_mpll_fout_p)        = { "fout_mplldiv2", "fout_mpll" };
 PNAME(mout_mpll_p)     = { "fin_pll", "mout_mpll_fout" };
 PNAME(mout_bpll_fout_p)        = { "fout_bplldiv2", "fout_bpll" };
@@ -208,10 +208,10 @@ struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = {
 };
 
 struct samsung_mux_clock exynos5250_mux_clks[] __initdata = {
-       MUX(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1),
-       MUX(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1),
+       MUX_A(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, "mout_apll"),
+       MUX_A(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1, "mout_cpu"),
        MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1),
-       MUX(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1),
+       MUX_A(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1, "mout_mpll"),
        MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1),
        MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1),
        MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1),
@@ -378,7 +378,7 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = {
        GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0),
        GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0),
        GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0),
-       GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, 0, 0),
+       GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED, 0),
        GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0),
        GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0),
        GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0),
index 89135f6be116cc47e88267f671a472c7dff49718..362f12dcd94422fd7fb6c9da1c9b71684e649cef 100644 (file)
@@ -111,7 +111,8 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw,
                                unsigned long parent_rate)
 {
        struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw);
-       u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1;
+       u32 mdiv, pdiv, sdiv, pll_con0, pll_con1;
+       s16 kdiv;
        u64 fvco = parent_rate;
 
        pll_con0 = __raw_readl(pll->con_reg);
@@ -119,7 +120,7 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw,
        mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK;
        pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK;
        sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK;
-       kdiv = pll_con1 & PLL36XX_KDIV_MASK;
+       kdiv = (s16)(pll_con1 & PLL36XX_KDIV_MASK);
 
        fvco *= (mdiv << 16) + kdiv;
        do_div(fvco, (pdiv << sdiv));
index f9ec43fd1320065b1d2050bf799dad8d1a5a8028..080c3c5e33f67823c28b79ad1c0fa4707afeaaee 100644 (file)
@@ -369,7 +369,7 @@ static void __init spear320_clk_init(void __iomem *soc_config_base)
        clk_register_clkdev(clk, NULL, "60100000.serial");
 }
 #else
-static inline void spear320_clk_init(void) { }
+static inline void spear320_clk_init(void __iomem *soc_config_base) { }
 #endif
 
 void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base)
index c6921f538e28dd370cb156588ab0d5e77645ec07..ba99e3844106ec961c03c33cd637ad59b217e2b3 100644 (file)
@@ -1598,6 +1598,12 @@ static void __init tegra30_periph_clk_init(void)
        clk_register_clkdev(clk, "afi", "tegra-pcie");
        clks[afi] = clk;
 
+       /* pciex */
+       clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0,
+                                   74, &periph_u_regs, periph_clk_enb_refcnt);
+       clk_register_clkdev(clk, "pciex", "tegra-pcie");
+       clks[pciex] = clk;
+
        /* kfuse */
        clk = tegra_clk_register_periph_gate("kfuse", "clk_m",
                                    TEGRA_PERIPH_ON_APB,
@@ -1716,11 +1722,6 @@ static void __init tegra30_fixed_clk_init(void)
                                1, 0, &cml_lock);
        clk_register_clkdev(clk, "cml1", NULL);
        clks[cml1] = clk;
-
-       /* pciex */
-       clk = clk_register_fixed_rate(NULL, "pciex", "pll_e", 0, 100000000);
-       clk_register_clkdev(clk, "pciex", NULL);
-       clks[pciex] = clk;
 }
 
 static void __init tegra30_osc_clk_init(void)
index edc089e9d0c42028aa93a208dde52dea9224df53..b8efacf01d694cb50a07115cc0a79a57d638c3e4 100644 (file)
@@ -1034,4 +1034,11 @@ static const struct x86_cpu_id acpi_cpufreq_ids[] = {
 };
 MODULE_DEVICE_TABLE(x86cpu, acpi_cpufreq_ids);
 
+static const struct acpi_device_id processor_device_ids[] = {
+       {ACPI_PROCESSOR_OBJECT_HID, },
+       {ACPI_PROCESSOR_DEVICE_HID, },
+       {},
+};
+MODULE_DEVICE_TABLE(acpi, processor_device_ids);
+
 MODULE_ALIAS("acpi");
index 4b9bb5def6f159a126e4f05aa6a76d365c6a23f8..93eb5cbcc1f639bf1ec52479a169a49deecd72f5 100644 (file)
@@ -47,6 +47,8 @@ static struct od_ops od_ops;
 static struct cpufreq_governor cpufreq_gov_ondemand;
 #endif
 
+static unsigned int default_powersave_bias;
+
 static void ondemand_powersave_bias_init_cpu(int cpu)
 {
        struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
@@ -543,7 +545,7 @@ static int od_init(struct dbs_data *dbs_data)
 
        tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR;
        tuners->ignore_nice = 0;
-       tuners->powersave_bias = 0;
+       tuners->powersave_bias = default_powersave_bias;
        tuners->io_is_busy = should_io_be_busy();
 
        dbs_data->tuners = tuners;
@@ -585,6 +587,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
        unsigned int cpu;
        cpumask_t done;
 
+       default_powersave_bias = powersave_bias;
        cpumask_clear(&done);
 
        get_online_cpus();
@@ -593,11 +596,17 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
                        continue;
 
                policy = per_cpu(od_cpu_dbs_info, cpu).cdbs.cur_policy;
-               dbs_data = policy->governor_data;
-               od_tuners = dbs_data->tuners;
-               od_tuners->powersave_bias = powersave_bias;
+               if (!policy)
+                       continue;
 
                cpumask_or(&done, &done, policy->cpus);
+
+               if (policy->governor != &cpufreq_gov_ondemand)
+                       continue;
+
+               dbs_data = policy->governor_data;
+               od_tuners = dbs_data->tuners;
+               od_tuners->powersave_bias = default_powersave_bias;
        }
        put_online_cpus();
 }
index dcde35231e259c83460b9dfb8bb9b4a1514ca3a5..5b7b9110254b1669d046c85d2429a6d93cb2a36c 100644 (file)
@@ -190,8 +190,7 @@ struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
                if (ret)
                        return ERR_PTR(ret);
        }
-       return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size,
-                             0600);
+       return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, flags);
 }
 EXPORT_SYMBOL(drm_gem_prime_export);
 
index 0e5341695922b504298b103df17c936e95a34d0a..6948eb88c2b7848cad2ff436e0df835bdd8d7999 100644 (file)
@@ -2687,6 +2687,9 @@ void r600_uvd_rbc_stop(struct radeon_device *rdev)
 int r600_uvd_init(struct radeon_device *rdev)
 {
        int i, j, r;
+       /* disable byte swapping */
+       u32 lmi_swap_cntl = 0;
+       u32 mp_swap_cntl = 0;
 
        /* raise clocks while booting up the VCPU */
        radeon_set_uvd_clocks(rdev, 53300, 40000);
@@ -2711,9 +2714,13 @@ int r600_uvd_init(struct radeon_device *rdev)
        WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) |
                             (1 << 21) | (1 << 9) | (1 << 20));
 
-       /* disable byte swapping */
-       WREG32(UVD_LMI_SWAP_CNTL, 0);
-       WREG32(UVD_MP_SWAP_CNTL, 0);
+#ifdef __BIG_ENDIAN
+       /* swap (8 in 32) RB and IB */
+       lmi_swap_cntl = 0xa;
+       mp_swap_cntl = 0;
+#endif
+       WREG32(UVD_LMI_SWAP_CNTL, lmi_swap_cntl);
+       WREG32(UVD_MP_SWAP_CNTL, mp_swap_cntl);
 
        WREG32(UVD_MPC_SET_MUXA0, 0x40c2040);
        WREG32(UVD_MPC_SET_MUXA1, 0x0);
index 189973836cff691ced976818f1bf045ed58e424b..b0dc0b6cb4e0f83603c4f56255205880b197c4d6 100644 (file)
@@ -244,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg)
  */
 void radeon_wb_disable(struct radeon_device *rdev)
 {
-       int r;
-
-       if (rdev->wb.wb_obj) {
-               r = radeon_bo_reserve(rdev->wb.wb_obj, false);
-               if (unlikely(r != 0))
-                       return;
-               radeon_bo_kunmap(rdev->wb.wb_obj);
-               radeon_bo_unpin(rdev->wb.wb_obj);
-               radeon_bo_unreserve(rdev->wb.wb_obj);
-       }
        rdev->wb.enabled = false;
 }
 
@@ -269,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev)
 {
        radeon_wb_disable(rdev);
        if (rdev->wb.wb_obj) {
+               if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) {
+                       radeon_bo_kunmap(rdev->wb.wb_obj);
+                       radeon_bo_unpin(rdev->wb.wb_obj);
+                       radeon_bo_unreserve(rdev->wb.wb_obj);
+               }
                radeon_bo_unref(&rdev->wb.wb_obj);
                rdev->wb.wb = NULL;
                rdev->wb.wb_obj = NULL;
@@ -295,26 +290,26 @@ int radeon_wb_init(struct radeon_device *rdev)
                        dev_warn(rdev->dev, "(%d) create WB bo failed\n", r);
                        return r;
                }
-       }
-       r = radeon_bo_reserve(rdev->wb.wb_obj, false);
-       if (unlikely(r != 0)) {
-               radeon_wb_fini(rdev);
-               return r;
-       }
-       r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
-                         &rdev->wb.gpu_addr);
-       if (r) {
+               r = radeon_bo_reserve(rdev->wb.wb_obj, false);
+               if (unlikely(r != 0)) {
+                       radeon_wb_fini(rdev);
+                       return r;
+               }
+               r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
+                               &rdev->wb.gpu_addr);
+               if (r) {
+                       radeon_bo_unreserve(rdev->wb.wb_obj);
+                       dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
+                       radeon_wb_fini(rdev);
+                       return r;
+               }
+               r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb);
                radeon_bo_unreserve(rdev->wb.wb_obj);
-               dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
-               radeon_wb_fini(rdev);
-               return r;
-       }
-       r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb);
-       radeon_bo_unreserve(rdev->wb.wb_obj);
-       if (r) {
-               dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
-               radeon_wb_fini(rdev);
-               return r;
+               if (r) {
+                       dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
+                       radeon_wb_fini(rdev);
+                       return r;
+               }
        }
 
        /* clear wb memory */
index 5b937dfe6f65b8fc1c89f0370afbeb1100a61fdf..ddb8f8e04eb549f4fd264b2f704cdd407bcc65e0 100644 (file)
@@ -63,7 +63,9 @@ static void radeon_fence_write(struct radeon_device *rdev, u32 seq, int ring)
 {
        struct radeon_fence_driver *drv = &rdev->fence_drv[ring];
        if (likely(rdev->wb.enabled || !drv->scratch_reg)) {
-               *drv->cpu_addr = cpu_to_le32(seq);
+               if (drv->cpu_addr) {
+                       *drv->cpu_addr = cpu_to_le32(seq);
+               }
        } else {
                WREG32(drv->scratch_reg, seq);
        }
@@ -84,7 +86,11 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring)
        u32 seq = 0;
 
        if (likely(rdev->wb.enabled || !drv->scratch_reg)) {
-               seq = le32_to_cpu(*drv->cpu_addr);
+               if (drv->cpu_addr) {
+                       seq = le32_to_cpu(*drv->cpu_addr);
+               } else {
+                       seq = lower_32_bits(atomic64_read(&drv->last_seq));
+               }
        } else {
                seq = RREG32(drv->scratch_reg);
        }
index 2c1341f63dc5afa19e94bc4aac51e5986b4b3cdf..43ec4a401f077809371e0360f22aa7f10c21af3b 100644 (file)
@@ -1197,11 +1197,13 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev,
 int radeon_vm_bo_rmv(struct radeon_device *rdev,
                     struct radeon_bo_va *bo_va)
 {
-       int r;
+       int r = 0;
 
        mutex_lock(&rdev->vm_manager.lock);
        mutex_lock(&bo_va->vm->mutex);
-       r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL);
+       if (bo_va->soffset) {
+               r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL);
+       }
        mutex_unlock(&rdev->vm_manager.lock);
        list_del(&bo_va->vm_list);
        mutex_unlock(&bo_va->vm->mutex);
index e17faa7cf732ee436e66f99fc0e3ac69c6798eab..82434018cbe81c3cd989de7f6586f88df57ddce1 100644 (file)
@@ -402,6 +402,13 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi
                return -ENOMEM;
        /* Align requested size with padding so unlock_commit can
         * pad safely */
+       radeon_ring_free_size(rdev, ring);
+       if (ring->ring_free_dw == (ring->ring_size / 4)) {
+               /* This is an empty ring update lockup info to avoid
+                * false positive.
+                */
+               radeon_ring_lockup_update(ring);
+       }
        ndw = (ndw + ring->align_mask) & ~ring->align_mask;
        while (ndw > (ring->ring_free_dw - 1)) {
                radeon_ring_free_size(rdev, ring);
index 906e5c0ca3b9a3e7f99ccc627674d4c3cbf3e260..cad735dd02c6f95260a92b268a446d1fbebe3be5 100644 (file)
@@ -159,7 +159,17 @@ int radeon_uvd_suspend(struct radeon_device *rdev)
        if (!r) {
                radeon_bo_kunmap(rdev->uvd.vcpu_bo);
                radeon_bo_unpin(rdev->uvd.vcpu_bo);
+               rdev->uvd.cpu_addr = NULL;
+               if (!radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_CPU, NULL)) {
+                       radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr);
+               }
                radeon_bo_unreserve(rdev->uvd.vcpu_bo);
+
+               if (rdev->uvd.cpu_addr) {
+                       radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX);
+               } else {
+                       rdev->fence_drv[R600_RING_TYPE_UVD_INDEX].cpu_addr = NULL;
+               }
        }
        return r;
 }
@@ -178,6 +188,10 @@ int radeon_uvd_resume(struct radeon_device *rdev)
                return r;
        }
 
+       /* Have been pin in cpu unmap unpin */
+       radeon_bo_kunmap(rdev->uvd.vcpu_bo);
+       radeon_bo_unpin(rdev->uvd.vcpu_bo);
+
        r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM,
                          &rdev->uvd.gpu_addr);
        if (r) {
@@ -613,19 +627,19 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring,
        }
 
        /* stitch together an UVD create msg */
-       msg[0] = 0x00000de4;
-       msg[1] = 0x00000000;
-       msg[2] = handle;
-       msg[3] = 0x00000000;
-       msg[4] = 0x00000000;
-       msg[5] = 0x00000000;
-       msg[6] = 0x00000000;
-       msg[7] = 0x00000780;
-       msg[8] = 0x00000440;
-       msg[9] = 0x00000000;
-       msg[10] = 0x01b37000;
+       msg[0] = cpu_to_le32(0x00000de4);
+       msg[1] = cpu_to_le32(0x00000000);
+       msg[2] = cpu_to_le32(handle);
+       msg[3] = cpu_to_le32(0x00000000);
+       msg[4] = cpu_to_le32(0x00000000);
+       msg[5] = cpu_to_le32(0x00000000);
+       msg[6] = cpu_to_le32(0x00000000);
+       msg[7] = cpu_to_le32(0x00000780);
+       msg[8] = cpu_to_le32(0x00000440);
+       msg[9] = cpu_to_le32(0x00000000);
+       msg[10] = cpu_to_le32(0x01b37000);
        for (i = 11; i < 1024; ++i)
-               msg[i] = 0x0;
+               msg[i] = cpu_to_le32(0x0);
 
        radeon_bo_kunmap(bo);
        radeon_bo_unreserve(bo);
@@ -659,12 +673,12 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring,
        }
 
        /* stitch together an UVD destroy msg */
-       msg[0] = 0x00000de4;
-       msg[1] = 0x00000002;
-       msg[2] = handle;
-       msg[3] = 0x00000000;
+       msg[0] = cpu_to_le32(0x00000de4);
+       msg[1] = cpu_to_le32(0x00000002);
+       msg[2] = cpu_to_le32(handle);
+       msg[3] = cpu_to_le32(0x00000000);
        for (i = 4; i < 1024; ++i)
-               msg[i] = 0x0;
+               msg[i] = cpu_to_le32(0x0);
 
        radeon_bo_kunmap(bo);
        radeon_bo_unreserve(bo);
index 1760ceb68b7b61cf522e601c48d2f23aa11e6b21..19ceaa60e0f45c755fd67d840e8ee90de320d1ca 100644 (file)
@@ -705,7 +705,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
 static int __cpuinit gic_secondary_init(struct notifier_block *nfb,
                                        unsigned long action, void *hcpu)
 {
-       if (action == CPU_STARTING)
+       if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
                gic_cpu_init(&gic_data[0]);
        return NOTIFY_OK;
 }
index 7f5a7cac6dc7e3982aff30754bafd8c388976a5b..8270388e2a0d2b703f2d08e2cc95533ff434dc14 100644 (file)
@@ -136,9 +136,9 @@ config DVB_NET
 
 # This Kconfig option is used by both PCI and USB drivers
 config TTPCI_EEPROM
-        tristate
-        depends on I2C
-        default n
+       tristate
+       depends on I2C
+       default n
 
 source "drivers/media/dvb-core/Kconfig"
 
@@ -189,6 +189,12 @@ config MEDIA_SUBDRV_AUTOSELECT
 
          If unsure say Y.
 
+config MEDIA_ATTACH
+       bool
+       depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT
+       depends on MODULES
+       default MODULES
+
 source "drivers/media/i2c/Kconfig"
 source "drivers/media/tuners/Kconfig"
 source "drivers/media/dvb-frontends/Kconfig"
index cb52438e53ac46c59548fef332a0bd50902a18f6..9eac5310942fd97b503290a1a2f38ef09cb01479 100644 (file)
@@ -956,7 +956,7 @@ static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd,
 
        if (fie->pad != OIF_SOURCE_PAD)
                return -EINVAL;
-       if (fie->index > ARRAY_SIZE(s5c73m3_intervals))
+       if (fie->index >= ARRAY_SIZE(s5c73m3_intervals))
                return -EINVAL;
 
        mutex_lock(&state->lock);
index 27d62623274bbd967fa56559f3ed617a0557c6ba..aba5b1c649e693d3b205e12c2247f2c0f8a3b730 100644 (file)
@@ -615,7 +615,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
        int changed = 0;
        u32 old;
 
-       if (core->board.audio_chip == V4L2_IDENT_WM8775)
+       if (core->sd_wm8775)
                snd_cx88_wm8775_volume_put(kcontrol, value);
 
        left = value->value.integer.value[0] & 0x3f;
@@ -682,8 +682,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
                vol ^= bit;
                cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
                /* Pass mute onto any WM8775 */
-               if ((core->board.audio_chip == V4L2_IDENT_WM8775) &&
-                   ((1<<6) == bit))
+               if (core->sd_wm8775 && ((1<<6) == bit))
                        wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit));
                ret = 1;
        }
@@ -903,7 +902,7 @@ static int cx88_audio_initdev(struct pci_dev *pci,
                goto error;
 
        /* If there's a wm8775 then add a Line-In ALC switch */
-       if (core->board.audio_chip == V4L2_IDENT_WM8775)
+       if (core->sd_wm8775)
                snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip));
 
        strcpy (card->driver, "CX88x");
index 1b00615fd3953a44966a07656180f4351dc7e43c..c7a9be1065c0b2d907a23dba31d5861201a96dc3 100644 (file)
@@ -385,8 +385,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
                /* The wm8775 module has the "2" route hardwired into
                   the initialization. Some boards may use different
                   routes for different inputs. HVR-1300 surely does */
-               if (core->board.audio_chip &&
-                   core->board.audio_chip == V4L2_IDENT_WM8775) {
+               if (core->sd_wm8775) {
                        call_all(core, audio, s_routing,
                                 INPUT(input).audioroute, 0, 0);
                }
@@ -771,8 +770,7 @@ static int video_open(struct file *file)
                cx_write(MO_GP1_IO, core->board.radio.gpio1);
                cx_write(MO_GP2_IO, core->board.radio.gpio2);
                if (core->board.radio.audioroute) {
-                       if(core->board.audio_chip &&
-                               core->board.audio_chip == V4L2_IDENT_WM8775) {
+                       if (core->sd_wm8775) {
                                call_all(core, audio, s_routing,
                                        core->board.radio.audioroute, 0, 0);
                        }
@@ -959,7 +957,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
        u32 value,mask;
 
        /* Pass changes onto any WM8775 */
-       if (core->board.audio_chip == V4L2_IDENT_WM8775) {
+       if (core->sd_wm8775) {
                switch (ctrl->id) {
                case V4L2_CID_AUDIO_MUTE:
                        wm8775_s_ctrl(core, ctrl->id, ctrl->val);
index 48b8d7af386d5538bdc8b28219dd168cd540fcbd..9d1481a60bd97d5ce60e8387365a7e22cbc50016 100644 (file)
@@ -576,6 +576,14 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
        return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
 }
 
+static int vidioc_create_bufs(struct file *file, void *priv,
+                             struct v4l2_create_buffers *create)
+{
+       struct coda_ctx *ctx = fh_to_ctx(priv);
+
+       return v4l2_m2m_create_bufs(file, ctx->m2m_ctx, create);
+}
+
 static int vidioc_streamon(struct file *file, void *priv,
                           enum v4l2_buf_type type)
 {
@@ -610,6 +618,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = {
 
        .vidioc_qbuf            = vidioc_qbuf,
        .vidioc_dqbuf           = vidioc_dqbuf,
+       .vidioc_create_bufs     = vidioc_create_bufs,
 
        .vidioc_streamon        = vidioc_streamon,
        .vidioc_streamoff       = vidioc_streamoff,
index 1802f11e939f22a1ff9ca56fc42c5ff91cfffc8f..d0b375cf565fc9c384a5e7e93b16864b7c48d8ec 100644 (file)
@@ -916,6 +916,21 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
        other video window */
 
        layer->pix_fmt = *pixfmt;
+       if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12) {
+               struct vpbe_layer *otherlayer;
+
+               otherlayer = _vpbe_display_get_other_win_layer(disp_dev, layer);
+               /* if other layer is available, only
+                * claim it, do not configure it
+                */
+               ret = osd_device->ops.request_layer(osd_device,
+                                                   otherlayer->layer_info.id);
+               if (ret < 0) {
+                       v4l2_err(&vpbe_dev->v4l2_dev,
+                                "Display Manager failed to allocate layer\n");
+                       return -EBUSY;
+               }
+       }
 
        /* Get osd layer config */
        osd_device->ops.get_layer_config(osd_device,
index 8c50d3074866218c829e990ca376ab0744dc1a17..93609091cb237d837b513ed8661a40cbce0e17bc 100644 (file)
@@ -1837,7 +1837,7 @@ static int vpfe_probe(struct platform_device *pdev)
        if (NULL == ccdc_cfg) {
                v4l2_err(pdev->dev.driver,
                         "Memory allocation failed for ccdc_cfg\n");
-               goto probe_free_lock;
+               goto probe_free_dev_mem;
        }
 
        mutex_lock(&ccdc_lock);
@@ -1991,7 +1991,6 @@ probe_out_release_irq:
        free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
 probe_free_ccdc_cfg_mem:
        kfree(ccdc_cfg);
-probe_free_lock:
        mutex_unlock(&ccdc_lock);
 probe_free_dev_mem:
        kfree(vpfe_dev);
index b0ff67bc1b056647ecfcc7b3acc5812a9b0408ab..d05eaa2c84909cd5b78430030b2baeef005335c9 100644 (file)
@@ -174,7 +174,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is)
                HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO,
        };
 
-       if (WARN_ON(is->config_index > ARRAY_SIZE(cmd)))
+       if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd)))
                return -EINVAL;
 
        mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0));
index 47c6363d04e2ce5e6ef5d631e26223daf81c41ef..0741945b79ed08829d0fe7490771a9f725f6063c 100644 (file)
@@ -48,7 +48,6 @@ static char *fimc_is_clocks[ISS_CLKS_MAX] = {
        [ISS_CLK_LITE0]                 = "lite0",
        [ISS_CLK_LITE1]                 = "lite1",
        [ISS_CLK_MPLL]                  = "mpll",
-       [ISS_CLK_SYSREG]                = "sysreg",
        [ISS_CLK_ISP]                   = "isp",
        [ISS_CLK_DRC]                   = "drc",
        [ISS_CLK_FD]                    = "fd",
@@ -71,7 +70,6 @@ static void fimc_is_put_clocks(struct fimc_is *is)
        for (i = 0; i < ISS_CLKS_MAX; i++) {
                if (IS_ERR(is->clocks[i]))
                        continue;
-               clk_unprepare(is->clocks[i]);
                clk_put(is->clocks[i]);
                is->clocks[i] = ERR_PTR(-EINVAL);
        }
@@ -90,12 +88,6 @@ static int fimc_is_get_clocks(struct fimc_is *is)
                        ret = PTR_ERR(is->clocks[i]);
                        goto err;
                }
-               ret = clk_prepare(is->clocks[i]);
-               if (ret < 0) {
-                       clk_put(is->clocks[i]);
-                       is->clocks[i] = ERR_PTR(-EINVAL);
-                       goto err;
-               }
        }
 
        return 0;
@@ -103,7 +95,7 @@ err:
        fimc_is_put_clocks(is);
        dev_err(&is->pdev->dev, "failed to get clock: %s\n",
                fimc_is_clocks[i]);
-       return -ENXIO;
+       return ret;
 }
 
 static int fimc_is_setup_clocks(struct fimc_is *is)
@@ -144,7 +136,7 @@ int fimc_is_enable_clocks(struct fimc_is *is)
        for (i = 0; i < ISS_GATE_CLKS_MAX; i++) {
                if (IS_ERR(is->clocks[i]))
                        continue;
-               ret = clk_enable(is->clocks[i]);
+               ret = clk_prepare_enable(is->clocks[i]);
                if (ret < 0) {
                        dev_err(&is->pdev->dev, "clock %s enable failed\n",
                                fimc_is_clocks[i]);
@@ -163,7 +155,7 @@ void fimc_is_disable_clocks(struct fimc_is *is)
 
        for (i = 0; i < ISS_GATE_CLKS_MAX; i++) {
                if (!IS_ERR(is->clocks[i])) {
-                       clk_disable(is->clocks[i]);
+                       clk_disable_unprepare(is->clocks[i]);
                        pr_debug("disabled clock: %s\n", fimc_is_clocks[i]);
                }
        }
@@ -326,6 +318,11 @@ int fimc_is_start_firmware(struct fimc_is *is)
        struct device *dev = &is->pdev->dev;
        int ret;
 
+       if (is->fw.f_w == NULL) {
+               dev_err(dev, "firmware is not loaded\n");
+               return -EINVAL;
+       }
+
        memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size);
        wmb();
 
@@ -837,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev)
                goto err_clk;
        }
        pm_runtime_enable(dev);
-       /*
-        * Enable only the ISP power domain, keep FIMC-IS clocks off until
-        * the whole clock tree is configured. The ISP power domain needs
-        * be active in order to acces any CMU_ISP clock registers.
-        */
-       ret = pm_runtime_get_sync(dev);
-       if (ret < 0)
-               goto err_irq;
-
-       ret = fimc_is_setup_clocks(is);
-       pm_runtime_put_sync(dev);
 
+       ret = pm_runtime_get_sync(dev);
        if (ret < 0)
                goto err_irq;
 
-       is->clk_init = true;
-
        is->alloc_ctx = vb2_dma_contig_init_ctx(dev);
        if (IS_ERR(is->alloc_ctx)) {
                ret = PTR_ERR(is->alloc_ctx);
@@ -875,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_dfs;
 
+       pm_runtime_put_sync(dev);
+
        dev_dbg(dev, "FIMC-IS registered successfully\n");
        return 0;
 
@@ -894,9 +881,11 @@ err_clk:
 static int fimc_is_runtime_resume(struct device *dev)
 {
        struct fimc_is *is = dev_get_drvdata(dev);
+       int ret;
 
-       if (!is->clk_init)
-               return 0;
+       ret = fimc_is_setup_clocks(is);
+       if (ret)
+               return ret;
 
        return fimc_is_enable_clocks(is);
 }
@@ -905,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev)
 {
        struct fimc_is *is = dev_get_drvdata(dev);
 
-       if (is->clk_init)
-               fimc_is_disable_clocks(is);
-
+       fimc_is_disable_clocks(is);
        return 0;
 }
 
@@ -941,7 +928,8 @@ static int fimc_is_remove(struct platform_device *pdev)
        vb2_dma_contig_cleanup_ctx(is->alloc_ctx);
        fimc_is_put_clocks(is);
        fimc_is_debugfs_remove(is);
-       release_firmware(is->fw.f_w);
+       if (is->fw.f_w)
+               release_firmware(is->fw.f_w);
        fimc_is_free_cpu_memory(is);
 
        return 0;
index f5275a5b0156693cc4f04f7ed4f757fa32839243..d7db133b493f7068e9f5281af8a2c95b9c21bf50 100644 (file)
@@ -73,7 +73,6 @@ enum {
        ISS_CLK_LITE0,
        ISS_CLK_LITE1,
        ISS_CLK_MPLL,
-       ISS_CLK_SYSREG,
        ISS_CLK_ISP,
        ISS_CLK_DRC,
        ISS_CLK_FD,
@@ -265,7 +264,6 @@ struct fimc_is {
        spinlock_t                      slock;
 
        struct clk                      *clocks[ISS_CLKS_MAX];
-       bool                            clk_init;
        void __iomem                    *regs;
        void __iomem                    *pmu_regs;
        int                             irq;
index d63947f7b30205e69c0c09e4bd05cfc3a7817019..7ede30b5910fab78b8c70bf022c565cbc5ab6021 100644 (file)
@@ -138,7 +138,7 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd,
                return 0;
        }
 
-       mf->colorspace = V4L2_COLORSPACE_JPEG;
+       mf->colorspace = V4L2_COLORSPACE_SRGB;
 
        mutex_lock(&isp->subdev_lock);
        __is_get_frame_size(is, &cur_fmt);
@@ -194,7 +194,7 @@ static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd,
        v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n",
                 __func__, fmt->pad, mf->code, mf->width, mf->height);
 
-       mf->colorspace = V4L2_COLORSPACE_JPEG;
+       mf->colorspace = V4L2_COLORSPACE_SRGB;
 
        mutex_lock(&isp->subdev_lock);
        __isp_subdev_try_format(isp, fmt);
index a2eda9d5ac87c73d38f1dab3c6c5b6541e3ca6ec..254d70fe762ab3b24367727afa62715229fb9e66 100644 (file)
@@ -746,7 +746,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
        node = v4l2_of_get_next_endpoint(node, NULL);
        if (!node) {
                dev_err(&pdev->dev, "No port node at %s\n",
-                                       node->full_name);
+                               pdev->dev.of_node->full_name);
                return -EINVAL;
        }
        /* Get port node and validate MIPI-CSI channel id. */
index 261134baa655471e4adc55667a68b979e56ddcaa..35d2fcdc0036b39914eaabb80d70433f6f438bcb 100644 (file)
@@ -229,7 +229,7 @@ struct camif_vp {
        unsigned int            state;
        u16                     fmt_flags;
        u8                      id;
-       u                     rotation;
+       u16                     rotation;
        u8                      hflip;
        u8                      vflip;
        unsigned int            offset;
index ddc2900d88a29da54c772afc0122f15a46da325e..d18cb5edd2d53975cea549bd4c696d618fb88c55 100644 (file)
@@ -1,2 +1,2 @@
 s5p-jpeg-objs := jpeg-core.o
-obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) := s5p-jpeg.o
+obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o
index 379008c6d09adfca74f45afda0109b2bb3640768..15f59b324fefc396c9de24f5ae8be2694303ea7a 100644 (file)
@@ -1,4 +1,4 @@
-obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) := s5p-mfc.o
+obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc.o
 s5p-mfc-y += s5p_mfc.o s5p_mfc_intr.o
 s5p-mfc-y += s5p_mfc_dec.o s5p_mfc_enc.o
 s5p-mfc-y += s5p_mfc_ctrl.o s5p_mfc_pm.o
index 01f9ae0dadb0e1564d873d49694806d3283fc2e7..d12faa691af8fbb7f3e41f7c6f9516140067d565 100644 (file)
@@ -397,7 +397,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
 leave_handle_frame:
        spin_unlock_irqrestore(&dev->irqlock, flags);
        if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING)
-                                   || ctx->dst_queue_cnt < ctx->dpb_count)
+                                   || ctx->dst_queue_cnt < ctx->pb_count)
                clear_work_bit(ctx);
        s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
        wake_up_ctx(ctx, reason, err);
@@ -473,7 +473,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
 
                s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx);
 
-               ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count,
+               ctx->pb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count,
                                dev);
                ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count,
                                dev);
@@ -562,7 +562,7 @@ static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx,
        struct s5p_mfc_dev *dev = ctx->dev;
        struct s5p_mfc_buf *mb_entry;
 
-       mfc_debug(2, "Stream completed");
+       mfc_debug(2, "Stream completed\n");
 
        s5p_mfc_clear_int_flags(dev);
        ctx->int_type = reason;
@@ -1362,7 +1362,6 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = {
        .port_num       = MFC_NUM_PORTS,
        .buf_size       = &buf_size_v5,
        .buf_align      = &mfc_buf_align_v5,
-       .mclk_name      = "sclk_mfc",
        .fw_name        = "s5p-mfc.fw",
 };
 
@@ -1389,7 +1388,6 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = {
        .port_num       = MFC_NUM_PORTS_V6,
        .buf_size       = &buf_size_v6,
        .buf_align      = &mfc_buf_align_v6,
-       .mclk_name      = "aclk_333",
        .fw_name        = "s5p-mfc-v6.fw",
 };
 
index 202d1d7a37a8d87a96b5a56ab0d8f3724eeb8add..ef4074cd53163faa1f9c8776ccae59d49d97d201 100644 (file)
@@ -138,6 +138,7 @@ enum s5p_mfc_inst_state {
        MFCINST_INIT = 100,
        MFCINST_GOT_INST,
        MFCINST_HEAD_PARSED,
+       MFCINST_HEAD_PRODUCED,
        MFCINST_BUFS_SET,
        MFCINST_RUNNING,
        MFCINST_FINISHING,
@@ -231,7 +232,6 @@ struct s5p_mfc_variant {
        unsigned int port_num;
        struct s5p_mfc_buf_size *buf_size;
        struct s5p_mfc_buf_align *buf_align;
-       char    *mclk_name;
        char    *fw_name;
 };
 
@@ -438,7 +438,7 @@ struct s5p_mfc_enc_params {
        u32 rc_framerate_num;
        u32 rc_framerate_denom;
 
-       union {
+       struct {
                struct s5p_mfc_h264_enc_params h264;
                struct s5p_mfc_mpeg4_enc_params mpeg4;
        } codec;
@@ -602,7 +602,7 @@ struct s5p_mfc_ctx {
        int after_packed_pb;
        int sei_fp_parse;
 
-       int dpb_count;
+       int pb_count;
        int total_dpb_count;
        int mv_count;
        /* Buffers */
index 2e5f30b40deaaf16f8b5062232976cb0ee5496a9..dc1fc94a488d06c781a5fb83ee4dcecfa74687e6 100644 (file)
@@ -38,7 +38,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev)
        dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size,
                                        &dev->bank1, GFP_KERNEL);
 
-       if (IS_ERR(dev->fw_virt_addr)) {
+       if (IS_ERR_OR_NULL(dev->fw_virt_addr)) {
                dev->fw_virt_addr = NULL;
                mfc_err("Allocating bitprocessor buffer failed\n");
                return -ENOMEM;
index bd5cd4ae993ce778b066395259f9dce3a04cce31..8e608f5aa0d7c866009a06f7b203c51d136040f1 100644 (file)
@@ -30,8 +30,8 @@ extern int debug;
 #define mfc_debug(level, fmt, args...)
 #endif
 
-#define mfc_debug_enter() mfc_debug(5, "enter")
-#define mfc_debug_leave() mfc_debug(5, "leave")
+#define mfc_debug_enter() mfc_debug(5, "enter\n")
+#define mfc_debug_leave() mfc_debug(5, "leave\n")
 
 #define mfc_err(fmt, args...)                          \
        do {                                            \
index 4af53bd2f182344b232b5b00aece57b35b03e9e5..00b07032f4f0c7878f1ed94d5b45cbb9512f2eda 100644 (file)
@@ -210,11 +210,11 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx)
        /* Context is to decode a frame */
        if (ctx->src_queue_cnt >= 1 &&
            ctx->state == MFCINST_RUNNING &&
-           ctx->dst_queue_cnt >= ctx->dpb_count)
+           ctx->dst_queue_cnt >= ctx->pb_count)
                return 1;
        /* Context is to return last frame */
        if (ctx->state == MFCINST_FINISHING &&
-           ctx->dst_queue_cnt >= ctx->dpb_count)
+           ctx->dst_queue_cnt >= ctx->pb_count)
                return 1;
        /* Context is to set buffers */
        if (ctx->src_queue_cnt >= 1 &&
@@ -224,7 +224,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx)
        /* Resolution change */
        if ((ctx->state == MFCINST_RES_CHANGE_INIT ||
                ctx->state == MFCINST_RES_CHANGE_FLUSH) &&
-               ctx->dst_queue_cnt >= ctx->dpb_count)
+               ctx->dst_queue_cnt >= ctx->pb_count)
                return 1;
        if (ctx->state == MFCINST_RES_CHANGE_END &&
                ctx->src_queue_cnt >= 1)
@@ -537,7 +537,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
                        mfc_err("vb2_reqbufs on capture failed\n");
                        return ret;
                }
-               if (reqbufs->count < ctx->dpb_count) {
+               if (reqbufs->count < ctx->pb_count) {
                        mfc_err("Not enough buffers allocated\n");
                        reqbufs->count = 0;
                        s5p_mfc_clock_on();
@@ -751,7 +751,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl)
        case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
                if (ctx->state >= MFCINST_HEAD_PARSED &&
                    ctx->state < MFCINST_ABORT) {
-                       ctrl->val = ctx->dpb_count;
+                       ctrl->val = ctx->pb_count;
                        break;
                } else if (ctx->state != MFCINST_INIT) {
                        v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n");
@@ -763,7 +763,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl)
                                S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0);
                if (ctx->state >= MFCINST_HEAD_PARSED &&
                    ctx->state < MFCINST_ABORT) {
-                       ctrl->val = ctx->dpb_count;
+                       ctrl->val = ctx->pb_count;
                } else {
                        v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n");
                        return -EINVAL;
@@ -924,10 +924,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
                /* Output plane count is 2 - one for Y and one for CbCr */
                *plane_count = 2;
                /* Setup buffer count */
-               if (*buf_count < ctx->dpb_count)
-                       *buf_count = ctx->dpb_count;
-               if (*buf_count > ctx->dpb_count + MFC_MAX_EXTRA_DPB)
-                       *buf_count = ctx->dpb_count + MFC_MAX_EXTRA_DPB;
+               if (*buf_count < ctx->pb_count)
+                       *buf_count = ctx->pb_count;
+               if (*buf_count > ctx->pb_count + MFC_MAX_EXTRA_DPB)
+                       *buf_count = ctx->pb_count + MFC_MAX_EXTRA_DPB;
                if (*buf_count > MFC_MAX_BUFFERS)
                        *buf_count = MFC_MAX_BUFFERS;
        } else {
index 4f6b553c4b2de90f6686f2da38cf5221f68c352d..2549967b2f8589bb46007b8282520250392287b7 100644 (file)
@@ -592,7 +592,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx)
                return 1;
        /* context is ready to encode a frame */
        if ((ctx->state == MFCINST_RUNNING ||
-               ctx->state == MFCINST_HEAD_PARSED) &&
+               ctx->state == MFCINST_HEAD_PRODUCED) &&
                ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1)
                return 1;
        /* context is ready to encode remaining frames */
@@ -649,6 +649,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
        struct s5p_mfc_enc_params *p = &ctx->enc_params;
        struct s5p_mfc_buf *dst_mb;
        unsigned long flags;
+       unsigned int enc_pb_count;
 
        if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) {
                spin_lock_irqsave(&dev->irqlock, flags);
@@ -661,18 +662,19 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
                vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE);
                spin_unlock_irqrestore(&dev->irqlock, flags);
        }
-       if (IS_MFCV6(dev)) {
-               ctx->state = MFCINST_HEAD_PARSED; /* for INIT_BUFFER cmd */
-       } else {
+
+       if (!IS_MFCV6(dev)) {
                ctx->state = MFCINST_RUNNING;
                if (s5p_mfc_ctx_ready(ctx))
                        set_work_bit_irqsave(ctx);
                s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
-       }
-
-       if (IS_MFCV6(dev))
-               ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops,
+       } else {
+               enc_pb_count = s5p_mfc_hw_call(dev->mfc_ops,
                                get_enc_dpb_count, dev);
+               if (ctx->pb_count < enc_pb_count)
+                       ctx->pb_count = enc_pb_count;
+               ctx->state = MFCINST_HEAD_PRODUCED;
+       }
 
        return 0;
 }
@@ -717,9 +719,9 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
 
        slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev);
        strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev);
-       mfc_debug(2, "Encoded slice type: %d", slice_type);
-       mfc_debug(2, "Encoded stream size: %d", strm_size);
-       mfc_debug(2, "Display order: %d",
+       mfc_debug(2, "Encoded slice type: %d\n", slice_type);
+       mfc_debug(2, "Encoded stream size: %d\n", strm_size);
+       mfc_debug(2, "Display order: %d\n",
                  mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT));
        spin_lock_irqsave(&dev->irqlock, flags);
        if (slice_type >= 0) {
@@ -1055,15 +1057,13 @@ static int vidioc_reqbufs(struct file *file, void *priv,
                }
                ctx->capture_state = QUEUE_BUFS_REQUESTED;
 
-               if (!IS_MFCV6(dev)) {
-                       ret = s5p_mfc_hw_call(ctx->dev->mfc_ops,
-                                       alloc_codec_buffers, ctx);
-                       if (ret) {
-                               mfc_err("Failed to allocate encoding buffers\n");
-                               reqbufs->count = 0;
-                               ret = vb2_reqbufs(&ctx->vq_dst, reqbufs);
-                               return -ENOMEM;
-                       }
+               ret = s5p_mfc_hw_call(ctx->dev->mfc_ops,
+                               alloc_codec_buffers, ctx);
+               if (ret) {
+                       mfc_err("Failed to allocate encoding buffers\n");
+                       reqbufs->count = 0;
+                       ret = vb2_reqbufs(&ctx->vq_dst, reqbufs);
+                       return -ENOMEM;
                }
        } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
                if (ctx->output_state != QUEUE_FREE) {
@@ -1071,6 +1071,19 @@ static int vidioc_reqbufs(struct file *file, void *priv,
                                                        ctx->output_state);
                        return -EINVAL;
                }
+
+               if (IS_MFCV6(dev)) {
+                       /* Check for min encoder buffers */
+                       if (ctx->pb_count &&
+                               (reqbufs->count < ctx->pb_count)) {
+                               reqbufs->count = ctx->pb_count;
+                               mfc_debug(2, "Minimum %d output buffers needed\n",
+                                               ctx->pb_count);
+                       } else {
+                               ctx->pb_count = reqbufs->count;
+                       }
+               }
+
                ret = vb2_reqbufs(&ctx->vq_src, reqbufs);
                if (ret != 0) {
                        mfc_err("error in vb2_reqbufs() for E(S)\n");
@@ -1533,14 +1546,14 @@ int vidioc_encoder_cmd(struct file *file, void *priv,
 
                spin_lock_irqsave(&dev->irqlock, flags);
                if (list_empty(&ctx->src_queue)) {
-                       mfc_debug(2, "EOS: empty src queue, entering finishing state");
+                       mfc_debug(2, "EOS: empty src queue, entering finishing state\n");
                        ctx->state = MFCINST_FINISHING;
                        if (s5p_mfc_ctx_ready(ctx))
                                set_work_bit_irqsave(ctx);
                        spin_unlock_irqrestore(&dev->irqlock, flags);
                        s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
                } else {
-                       mfc_debug(2, "EOS: marking last buffer of stream");
+                       mfc_debug(2, "EOS: marking last buffer of stream\n");
                        buf = list_entry(ctx->src_queue.prev,
                                                struct s5p_mfc_buf, list);
                        if (buf->flags & MFC_BUF_FLAG_USED)
@@ -1609,9 +1622,9 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb)
                        mfc_err("failed to get plane cookie\n");
                        return -EINVAL;
                }
-               mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx",
-                               vb->v4l2_buf.index, i,
-                               vb2_dma_contig_plane_dma_addr(vb, i));
+               mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx\n",
+                         vb->v4l2_buf.index, i,
+                         vb2_dma_contig_plane_dma_addr(vb, i));
        }
        return 0;
 }
@@ -1760,11 +1773,27 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
        struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
        struct s5p_mfc_dev *dev = ctx->dev;
 
-       v4l2_ctrl_handler_setup(&ctx->ctrl_handler);
+       if (IS_MFCV6(dev) && (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
+
+               if ((ctx->state == MFCINST_GOT_INST) &&
+                       (dev->curr_ctx == ctx->num) && dev->hw_lock) {
+                       s5p_mfc_wait_for_done_ctx(ctx,
+                                               S5P_MFC_R2H_CMD_SEQ_DONE_RET,
+                                               0);
+               }
+
+               if (ctx->src_bufs_cnt < ctx->pb_count) {
+                       mfc_err("Need minimum %d OUTPUT buffers\n",
+                                       ctx->pb_count);
+                       return -EINVAL;
+               }
+       }
+
        /* If context is ready then dev = work->data;schedule it to run */
        if (s5p_mfc_ctx_ready(ctx))
                set_work_bit_irqsave(ctx);
        s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
+
        return 0;
 }
 
@@ -1920,6 +1949,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx)
                if (controls[i].is_volatile && ctx->ctrls[i])
                        ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE;
        }
+       v4l2_ctrl_handler_setup(&ctx->ctrl_handler);
        return 0;
 }
 
index 0af05a2d1cd411f5c3b3bb840ff37cbee9cd0b24..368582b091bfb35ac65ef7bf81705156fe36ae82 100644 (file)
@@ -1275,8 +1275,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
        s5p_mfc_clean_ctx_int_flags(ctx);
-       mfc_debug(2, "encoding buffer with index=%d state=%d",
-                       src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state);
+       mfc_debug(2, "encoding buffer with index=%d state=%d\n",
+                 src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state);
        s5p_mfc_encode_one_frame_v5(ctx);
        return 0;
 }
index 7e76fce2e524435f301955c286d5932cbf76adb2..66f0d042357fd32465fddd19a34a4ac201633163 100644 (file)
@@ -62,12 +62,6 @@ static void s5p_mfc_release_dec_desc_buffer_v6(struct s5p_mfc_ctx *ctx)
        /* NOP */
 }
 
-static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev)
-{
-       /* NOP */
-       return -1;
-}
-
 /* Allocate codec buffers */
 static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
 {
@@ -167,7 +161,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
                                S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
                ctx->bank1.size =
                        ctx->scratch_buf_size + ctx->tmv_buffer_size +
-                       (ctx->dpb_count * (ctx->luma_dpb_size +
+                       (ctx->pb_count * (ctx->luma_dpb_size +
                        ctx->chroma_dpb_size + ctx->me_buffer_size));
                ctx->bank2.size = 0;
                break;
@@ -181,7 +175,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
                                S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
                ctx->bank1.size =
                        ctx->scratch_buf_size + ctx->tmv_buffer_size +
-                       (ctx->dpb_count * (ctx->luma_dpb_size +
+                       (ctx->pb_count * (ctx->luma_dpb_size +
                        ctx->chroma_dpb_size + ctx->me_buffer_size));
                ctx->bank2.size = 0;
                break;
@@ -198,7 +192,6 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
                }
                BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1));
        }
-
        return 0;
 }
 
@@ -449,8 +442,8 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx,
        WRITEL(addr, S5P_FIMV_E_STREAM_BUFFER_ADDR_V6); /* 16B align */
        WRITEL(size, S5P_FIMV_E_STREAM_BUFFER_SIZE_V6);
 
-       mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d",
-               addr, size);
+       mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d\n",
+                 addr, size);
 
        return 0;
 }
@@ -463,8 +456,8 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
        WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */
        WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6);
 
-       mfc_debug(2, "enc src y buf addr: 0x%08lx", y_addr);
-       mfc_debug(2, "enc src c buf addr: 0x%08lx", c_addr);
+       mfc_debug(2, "enc src y buf addr: 0x%08lx\n", y_addr);
+       mfc_debug(2, "enc src c buf addr: 0x%08lx\n", c_addr);
 }
 
 static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
@@ -479,8 +472,8 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
        enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6);
        enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6);
 
-       mfc_debug(2, "recon y addr: 0x%08lx", enc_recon_y_addr);
-       mfc_debug(2, "recon c addr: 0x%08lx", enc_recon_c_addr);
+       mfc_debug(2, "recon y addr: 0x%08lx\n", enc_recon_y_addr);
+       mfc_debug(2, "recon c addr: 0x%08lx\n", enc_recon_c_addr);
 }
 
 /* Set encoding ref & codec buffer */
@@ -497,7 +490,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx)
 
        mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1);
 
-       for (i = 0; i < ctx->dpb_count; i++) {
+       for (i = 0; i < ctx->pb_count; i++) {
                WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i));
                buf_addr1 += ctx->luma_dpb_size;
                WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i));
@@ -520,7 +513,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx)
        buf_size1 -= ctx->tmv_buffer_size;
 
        mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n",
-                       buf_addr1, buf_size1, ctx->dpb_count);
+                       buf_addr1, buf_size1, ctx->pb_count);
        if (buf_size1 < 0) {
                mfc_debug(2, "Not enough memory has been allocated.\n");
                return -ENOMEM;
@@ -1431,8 +1424,8 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
        src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0);
        src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1);
 
-       mfc_debug(2, "enc src y addr: 0x%08lx", src_y_addr);
-       mfc_debug(2, "enc src c addr: 0x%08lx", src_c_addr);
+       mfc_debug(2, "enc src y addr: 0x%08lx\n", src_y_addr);
+       mfc_debug(2, "enc src c addr: 0x%08lx\n", src_c_addr);
 
        s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, src_c_addr);
 
@@ -1522,22 +1515,6 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx)
        struct s5p_mfc_dev *dev = ctx->dev;
        int ret;
 
-       ret = s5p_mfc_alloc_codec_buffers_v6(ctx);
-       if (ret) {
-               mfc_err("Failed to allocate encoding buffers.\n");
-               return -ENOMEM;
-       }
-
-       /* Header was generated now starting processing
-        * First set the reference frame buffers
-        */
-       if (ctx->capture_state != QUEUE_BUFS_REQUESTED) {
-               mfc_err("It seems that destionation buffers were not\n"
-                       "requested.MFC requires that header should be generated\n"
-                       "before allocating codec buffer.\n");
-               return -EAGAIN;
-       }
-
        dev->curr_ctx = ctx->num;
        s5p_mfc_clean_ctx_int_flags(ctx);
        ret = s5p_mfc_set_enc_ref_buffer_v6(ctx);
@@ -1582,7 +1559,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev)
        mfc_debug(1, "Seting new context to %p\n", ctx);
        /* Got context to run in ctx */
        mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n",
-               ctx->dst_queue_cnt, ctx->dpb_count, ctx->src_queue_cnt);
+               ctx->dst_queue_cnt, ctx->pb_count, ctx->src_queue_cnt);
        mfc_debug(1, "ctx->state=%d\n", ctx->state);
        /* Last frame has already been sent to MFC
         * Now obtaining frames from MFC buffer */
@@ -1647,7 +1624,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev)
                case MFCINST_GOT_INST:
                        s5p_mfc_run_init_enc(ctx);
                        break;
-               case MFCINST_HEAD_PARSED: /* Only for MFC6.x */
+               case MFCINST_HEAD_PRODUCED:
                        ret = s5p_mfc_run_init_enc_buffers(ctx);
                        break;
                default:
@@ -1730,7 +1707,7 @@ static int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev)
        return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6);
 }
 
-static int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev)
+static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev)
 {
        return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6);
 }
index 6aa38a56aaf26fda9adbe142aac5f4efbc20ce4e..11d5f1dada32b1d593b53b0555f4ebcdb371b9d2 100644 (file)
@@ -50,19 +50,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
                goto err_p_ip_clk;
        }
 
-       pm->clock = clk_get(&dev->plat_dev->dev, dev->variant->mclk_name);
-       if (IS_ERR(pm->clock)) {
-               mfc_err("Failed to get MFC clock\n");
-               ret = PTR_ERR(pm->clock);
-               goto err_g_ip_clk_2;
-       }
-
-       ret = clk_prepare(pm->clock);
-       if (ret) {
-               mfc_err("Failed to prepare MFC clock\n");
-               goto err_p_ip_clk_2;
-       }
-
        atomic_set(&pm->power, 0);
 #ifdef CONFIG_PM_RUNTIME
        pm->device = &dev->plat_dev->dev;
@@ -72,10 +59,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev)
        atomic_set(&clk_ref, 0);
 #endif
        return 0;
-err_p_ip_clk_2:
-       clk_put(pm->clock);
-err_g_ip_clk_2:
-       clk_unprepare(pm->clock_gate);
 err_p_ip_clk:
        clk_put(pm->clock_gate);
 err_g_ip_clk:
@@ -86,8 +69,6 @@ void s5p_mfc_final_pm(struct s5p_mfc_dev *dev)
 {
        clk_unprepare(pm->clock_gate);
        clk_put(pm->clock_gate);
-       clk_unprepare(pm->clock);
-       clk_put(pm->clock);
 #ifdef CONFIG_PM_RUNTIME
        pm_runtime_disable(pm->device);
 #endif
@@ -98,7 +79,7 @@ int s5p_mfc_clock_on(void)
        int ret;
 #ifdef CLK_DEBUG
        atomic_inc(&clk_ref);
-       mfc_debug(3, "+ %d", atomic_read(&clk_ref));
+       mfc_debug(3, "+ %d\n", atomic_read(&clk_ref));
 #endif
        ret = clk_enable(pm->clock_gate);
        return ret;
@@ -108,7 +89,7 @@ void s5p_mfc_clock_off(void)
 {
 #ifdef CLK_DEBUG
        atomic_dec(&clk_ref);
-       mfc_debug(3, "- %d", atomic_read(&clk_ref));
+       mfc_debug(3, "- %d\n", atomic_read(&clk_ref));
 #endif
        clk_disable(pm->clock_gate);
 }
index 0b32cc3f6a4749bb93599e8094f785ef237bd764..59a9deefb24253455d531c71888c08afd49c8dc8 100644 (file)
@@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq,
                if (ftmp.fmt.pix.width != pix->width ||
                    ftmp.fmt.pix.height != pix->height)
                        return -EINVAL;
-               size = pix->bytesperline ? pix->bytesperline * pix->height :
-                       pix->width * pix->height * fmt->depth >> 3;
+               size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth :
+                       pix->width * pix->height * fmt->depth / fmt->ydepth;
        } else {
                vfmt = sh_veu_get_vfmt(veu, vq->type);
-               size = vfmt->bytesperline * vfmt->frame.height;
+               size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth;
        }
 
        if (count < 2)
@@ -1033,8 +1033,6 @@ static int sh_veu_release(struct file *file)
 
        dev_dbg(veu->dev, "Releasing instance %p\n", veu_file);
 
-       pm_runtime_put(veu->dev);
-
        if (veu_file == veu->capture) {
                veu->capture = NULL;
                vb2_queue_release(v4l2_m2m_get_vq(veu->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE));
@@ -1050,6 +1048,8 @@ static int sh_veu_release(struct file *file)
                veu->m2m_ctx = NULL;
        }
 
+       pm_runtime_put(veu->dev);
+
        kfree(veu_file);
 
        return 0;
@@ -1138,10 +1138,7 @@ static irqreturn_t sh_veu_isr(int irq, void *dev_id)
 
        veu->xaction++;
 
-       if (!veu->aborting)
-               return IRQ_WAKE_THREAD;
-
-       return IRQ_HANDLED;
+       return IRQ_WAKE_THREAD;
 }
 
 static int sh_veu_probe(struct platform_device *pdev)
index eea832c5fd010e18ca4daffb3c434a5907bcc52c..3a4efbdc7668e30edfe74664809b744b56a1115d 100644 (file)
@@ -643,9 +643,9 @@ static int soc_camera_close(struct file *file)
 
                if (ici->ops->init_videobuf2)
                        vb2_queue_release(&icd->vb2_vidq);
-               ici->ops->remove(icd);
-
                __soc_camera_power_off(icd);
+
+               ici->ops->remove(icd);
        }
 
        if (icd->streamer == file)
index c0beee2fa37c1f2a31453c5cce0ff647ff9726cf..d529ba788f41753f17a97f1c7b920feb3a946d1f 100644 (file)
@@ -22,6 +22,7 @@ config RADIO_SI476X
        tristate "Silicon Laboratories Si476x I2C FM Radio"
        depends on I2C && VIDEO_V4L2
        depends on MFD_SI476X_CORE
+       depends on SND_SOC
        select SND_SOC_SI476X
        ---help---
          Choose Y here if you have this FM radio chip.
index 9430c6a2993734329c09d688fbd8806a306eac6a..9dc8bafe6486a07243c546b4fc45f00ebcceb84a 100644 (file)
@@ -44,7 +44,7 @@
 
 #define FREQ_MUL (10000000 / 625)
 
-#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status))
+#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0x80 & (status))
 
 #define DRIVER_NAME "si476x-radio"
 #define DRIVER_CARD "SI476x AM/FM Receiver"
index f6768cad001a58c8d859a95a224fc8ad3b78305c..15665debc572437a7e0544dacca3efe16d06ce0a 100644 (file)
@@ -1,23 +1,3 @@
-config MEDIA_ATTACH
-       bool "Load and attach frontend and tuner driver modules as needed"
-       depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT
-       depends on MODULES
-       default y if !EXPERT
-       help
-         Remove the static dependency of DVB card drivers on all
-         frontend modules for all possible card variants. Instead,
-         allow the card drivers to only load the frontend modules
-         they require.
-
-         Also, tuner module will automatically load a tuner driver
-         when needed, for analog mode.
-
-         This saves several KBytes of memory.
-
-         Note: You will need module-init-tools v3.2 or later for this feature.
-
-         If unsure say Y.
-
 # Analog TV tuners, auto-loaded via tuner.ko
 config MEDIA_TUNER
        tristate
index 22015fe1a0f322580ff9be7379f12ccc7ac9124e..2cc8ec70e3b68cee498a850525973c771354eef3 100644 (file)
@@ -376,7 +376,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
        struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf};
        struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf};
        struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
-       struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 5, buf};
+       struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
 
        dev_dbg(&d->udev->dev, "%s:\n", __func__);
 
@@ -481,9 +481,9 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
                goto found;
        }
 
-       /* check R820T by reading tuner stats at I2C addr 0x1a */
+       /* check R820T ID register; reg=00 val=69 */
        ret = rtl28xxu_ctrl_msg(d, &req_r820t);
-       if (ret == 0) {
+       if (ret == 0 && buf[0] == 0x69) {
                priv->tuner = TUNER_RTL2832_R820T;
                priv->tuner_name = "R820T";
                goto found;
index 3fe207e038c75b5ea260745149d271463f89d1e9..d7ff3b9687c57cb22c504e7a3a9493e41fd924eb 100644 (file)
@@ -1159,6 +1159,13 @@ static int sd_start(struct gspca_dev *gspca_dev)
                        regs[0x01] = 0x44; /* Select 24 Mhz clock */
                        regs[0x12] = 0x02; /* Set hstart to 2 */
                }
+               break;
+       case SENSOR_PAS202:
+               /* For some unknown reason we need to increase hstart by 1 on
+                  the sn9c103, otherwise we get wrong colors (bayer shift). */
+               if (sd->bridge == BRIDGE_103)
+                       regs[0x12] += 1;
+               break;
        }
        /* Disable compression when the raw bayer format has been selected */
        if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW)
index 7a6a0d39c2c669777d8aa7cbd61ff57de4ff865c..81b017a554bcaf939c1c226c65c9c225f83aa758 100644 (file)
@@ -226,7 +226,7 @@ struct pwc_device
        struct list_head queued_bufs;
        spinlock_t queued_bufs_lock; /* Protects queued_bufs */
 
-       /* Note if taking both locks v4l2_lock must always be locked first! */
+       /* If taking both locks vb_queue_lock must always be locked first! */
        struct mutex v4l2_lock;      /* Protects everything else */
        struct mutex vb_queue_lock;  /* Protects vb_queue and capt_file */
 
index ebb8e48619a29583f15bd298b92f6634d05e0a42..fccd08b66d1a04e16cfc127bb672e2c0fbe18e4d 100644 (file)
@@ -1835,6 +1835,8 @@ bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl)
 {
        if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX)
                return true;
+       if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_RX)
+               return true;
        switch (ctrl->id) {
        case V4L2_CID_AUDIO_MUTE:
        case V4L2_CID_AUDIO_VOLUME:
index f81bda1a48ec33ce603a1f741466bac726298e21..7658586fe5f4607fa7487c10a312913103b19d53 100644 (file)
@@ -243,7 +243,6 @@ static void v4l_print_format(const void *arg, bool write_only)
        const struct v4l2_vbi_format *vbi;
        const struct v4l2_sliced_vbi_format *sliced;
        const struct v4l2_window *win;
-       const struct v4l2_clip *clip;
        unsigned i;
 
        pr_cont("type=%s", prt_names(p->type, v4l2_type_names));
@@ -253,7 +252,7 @@ static void v4l_print_format(const void *arg, bool write_only)
                pix = &p->fmt.pix;
                pr_cont(", width=%u, height=%u, "
                        "pixelformat=%c%c%c%c, field=%s, "
-                       "bytesperline=%u sizeimage=%u, colorspace=%d\n",
+                       "bytesperline=%u, sizeimage=%u, colorspace=%d\n",
                        pix->width, pix->height,
                        (pix->pixelformat & 0xff),
                        (pix->pixelformat >>  8) & 0xff,
@@ -284,20 +283,14 @@ static void v4l_print_format(const void *arg, bool write_only)
        case V4L2_BUF_TYPE_VIDEO_OVERLAY:
        case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
                win = &p->fmt.win;
-               pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, "
-                       "chromakey=0x%08x, bitmap=%p, "
-                       "global_alpha=0x%02x\n",
-                       win->w.width, win->w.height,
-                       win->w.left, win->w.top,
+               /* Note: we can't print the clip list here since the clips
+                * pointer is a userspace pointer, not a kernelspace
+                * pointer. */
+               pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, chromakey=0x%08x, clipcount=%u, clips=%p, bitmap=%p, global_alpha=0x%02x\n",
+                       win->w.width, win->w.height, win->w.left, win->w.top,
                        prt_names(win->field, v4l2_field_names),
-                       win->chromakey, win->bitmap, win->global_alpha);
-               clip = win->clips;
-               for (i = 0; i < win->clipcount; i++) {
-                       printk(KERN_DEBUG "clip %u: wxh=%dx%d, x,y=%d,%d\n",
-                                       i, clip->c.width, clip->c.height,
-                                       clip->c.left, clip->c.top);
-                       clip = clip->next;
-               }
+                       win->chromakey, win->clipcount, win->clips,
+                       win->bitmap, win->global_alpha);
                break;
        case V4L2_BUF_TYPE_VBI_CAPTURE:
        case V4L2_BUF_TYPE_VBI_OUTPUT:
@@ -332,7 +325,7 @@ static void v4l_print_framebuffer(const void *arg, bool write_only)
 
        pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, "
                "height=%u, pixelformat=%c%c%c%c, "
-               "bytesperline=%u sizeimage=%u, colorspace=%d\n",
+               "bytesperline=%u, sizeimage=%u, colorspace=%d\n",
                        p->capability, p->flags, p->base,
                        p->fmt.width, p->fmt.height,
                        (p->fmt.pixelformat & 0xff),
@@ -353,7 +346,7 @@ static void v4l_print_modulator(const void *arg, bool write_only)
        const struct v4l2_modulator *p = arg;
 
        if (write_only)
-               pr_cont("index=%u, txsubchans=0x%x", p->index, p->txsubchans);
+               pr_cont("index=%u, txsubchans=0x%x\n", p->index, p->txsubchans);
        else
                pr_cont("index=%u, name=%.*s, capability=0x%x, "
                        "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n",
@@ -445,13 +438,13 @@ static void v4l_print_buffer(const void *arg, bool write_only)
                for (i = 0; i < p->length; ++i) {
                        plane = &p->m.planes[i];
                        printk(KERN_DEBUG
-                               "plane %d: bytesused=%d, data_offset=0x%08x "
+                               "plane %d: bytesused=%d, data_offset=0x%08x, "
                                "offset/userptr=0x%lx, length=%d\n",
                                i, plane->bytesused, plane->data_offset,
                                plane->m.userptr, plane->length);
                }
        } else {
-               pr_cont("bytesused=%d, offset/userptr=0x%lx, length=%d\n",
+               pr_cont("bytesused=%d, offset/userptr=0x%lx, length=%d\n",
                        p->bytesused, p->m.userptr, p->length);
        }
 
@@ -504,6 +497,8 @@ static void v4l_print_streamparm(const void *arg, bool write_only)
                        c->capability, c->outputmode,
                        c->timeperframe.numerator, c->timeperframe.denominator,
                        c->extendedmode, c->writebuffers);
+       } else {
+               pr_cont("\n");
        }
 }
 
@@ -734,11 +729,11 @@ static void v4l_print_frmsizeenum(const void *arg, bool write_only)
                        p->type);
        switch (p->type) {
        case V4L2_FRMSIZE_TYPE_DISCRETE:
-               pr_cont(" wxh=%ux%u\n",
+               pr_cont(", wxh=%ux%u\n",
                        p->discrete.width, p->discrete.height);
                break;
        case V4L2_FRMSIZE_TYPE_STEPWISE:
-               pr_cont(" min=%ux%u, max=%ux%u, step=%ux%u\n",
+               pr_cont(", min=%ux%u, max=%ux%u, step=%ux%u\n",
                                p->stepwise.min_width,  p->stepwise.min_height,
                                p->stepwise.step_width, p->stepwise.step_height,
                                p->stepwise.max_width,  p->stepwise.max_height);
@@ -764,12 +759,12 @@ static void v4l_print_frmivalenum(const void *arg, bool write_only)
                        p->width, p->height, p->type);
        switch (p->type) {
        case V4L2_FRMIVAL_TYPE_DISCRETE:
-               pr_cont(" fps=%d/%d\n",
+               pr_cont(", fps=%d/%d\n",
                                p->discrete.numerator,
                                p->discrete.denominator);
                break;
        case V4L2_FRMIVAL_TYPE_STEPWISE:
-               pr_cont(" min=%d/%d, max=%d/%d, step=%d/%d\n",
+               pr_cont(", min=%d/%d, max=%d/%d, step=%d/%d\n",
                                p->stepwise.min.numerator,
                                p->stepwise.min.denominator,
                                p->stepwise.max.numerator,
@@ -807,8 +802,8 @@ static void v4l_print_event(const void *arg, bool write_only)
                        pr_cont("value64=%lld, ", c->value64);
                else
                        pr_cont("value=%d, ", c->value);
-               pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d,"
-                               " default_value=%d\n",
+               pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d, "
+                       "default_value=%d\n",
                        c->flags, c->minimum, c->maximum,
                        c->step, c->default_value);
                break;
@@ -845,7 +840,7 @@ static void v4l_print_freq_band(const void *arg, bool write_only)
        const struct v4l2_frequency_band *p = arg;
 
        pr_cont("tuner=%u, type=%u, index=%u, capability=0x%x, "
-                       "rangelow=%u, rangehigh=%u, modulation=0x%x\n",
+               "rangelow=%u, rangehigh=%u, modulation=0x%x\n",
                        p->tuner, p->type, p->index,
                        p->capability, p->rangelow,
                        p->rangehigh, p->modulation);
index 66f599fcb8298f70cb18545460b8c8b0df807119..e96497f7c3ed1b598106da2b7aa51f9a46284c68 100644 (file)
@@ -205,7 +205,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
 static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
 {
        struct v4l2_m2m_dev *m2m_dev;
-       unsigned long flags_job, flags;
+       unsigned long flags_job, flags_out, flags_cap;
 
        m2m_dev = m2m_ctx->m2m_dev;
        dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx);
@@ -223,23 +223,26 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
                return;
        }
 
-       spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
+       spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
        if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) {
-               spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
+               spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
+                                       flags_out);
                spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
                dprintk("No input buffers available\n");
                return;
        }
-       spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
+       spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
        if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) {
-               spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
-               spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
+               spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock,
+                                       flags_cap);
+               spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock,
+                                       flags_out);
                spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
                dprintk("No output buffers available\n");
                return;
        }
-       spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags);
-       spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags);
+       spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
+       spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
 
        if (m2m_dev->m2m_ops->job_ready
                && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
@@ -371,6 +374,20 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 }
 EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf);
 
+/**
+ * v4l2_m2m_create_bufs() - create a source or destination buffer, depending
+ * on the type
+ */
+int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
+                        struct v4l2_create_buffers *create)
+{
+       struct vb2_queue *vq;
+
+       vq = v4l2_m2m_get_vq(m2m_ctx, create->format.type);
+       return vb2_create_bufs(vq, create);
+}
+EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs);
+
 /**
  * v4l2_m2m_expbuf() - export a source or destination buffer, depending on
  * the type
@@ -486,8 +503,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
        if (m2m_ctx->m2m_dev->m2m_ops->unlock)
                m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv);
 
-       poll_wait(file, &src_q->done_wq, wait);
-       poll_wait(file, &dst_q->done_wq, wait);
+       if (list_empty(&src_q->done_list))
+               poll_wait(file, &src_q->done_wq, wait);
+       if (list_empty(&dst_q->done_list))
+               poll_wait(file, &dst_q->done_wq, wait);
 
        if (m2m_ctx->m2m_dev->m2m_ops->lock)
                m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv);
index 7d833eefaf4e9bf2124f035db614179127268e4a..e3bdc3be91e12822bcf92c4538433522a2aaa886 100644 (file)
@@ -2014,7 +2014,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
        if (list_empty(&q->queued_list))
                return res | POLLERR;
 
-       poll_wait(file, &q->done_wq, wait);
+       if (list_empty(&q->done_list))
+               poll_wait(file, &q->done_wq, wait);
 
        /*
         * Take first buffer available for dequeuing.
index 6e8bc9d88c418c5eff9838948303c16c71019cc1..94d957d203a6466b9b809d49962f6630ed2bc7cb 100644 (file)
@@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig)
                file->f_pos += offset;
                break;
        case 2:
-               file->f_pos = debug->buffer_len - offset;
+               file->f_pos = debug->buffer_len + offset;
                break;
        default:
                return -EINVAL;
index 9544cdc0d1af120098466ca63d814acfa28957ef..e79e006eb9abc4eab4722aa483d2c6fb38a8c455 100644 (file)
@@ -811,6 +811,70 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev)
        return pcidev->irq;
 }
 
+static struct iosapic_info *first_isi = NULL;
+
+#ifdef CONFIG_64BIT
+int iosapic_serial_irq(int num)
+{
+       struct iosapic_info *isi = first_isi;
+       struct irt_entry *irte = NULL;  /* only used if PAT PDC */
+       struct vector_info *vi;
+       int isi_line;   /* line used by device */
+
+       /* lookup IRT entry for isi/slot/pin set */
+       irte = &irt_cell[num];
+
+       DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n",
+               irte,
+               irte->entry_type,
+               irte->entry_length,
+               irte->polarity_trigger,
+               irte->src_bus_irq_devno,
+               irte->src_bus_id,
+               irte->src_seg_id,
+               irte->dest_iosapic_intin,
+               (u32) irte->dest_iosapic_addr);
+       isi_line = irte->dest_iosapic_intin;
+
+       /* get vector info for this input line */
+       vi = isi->isi_vector + isi_line;
+       DBG_IRT("iosapic_serial_irq:  line %d vi 0x%p\n", isi_line, vi);
+
+       /* If this IRQ line has already been setup, skip it */
+       if (vi->irte)
+               goto out;
+
+       vi->irte = irte;
+
+       /*
+        * Allocate processor IRQ
+        *
+        * XXX/FIXME The txn_alloc_irq() code and related code should be
+        * moved to enable_irq(). That way we only allocate processor IRQ
+        * bits for devices that actually have drivers claiming them.
+        * Right now we assign an IRQ to every PCI device present,
+        * regardless of whether it's used or not.
+        */
+       vi->txn_irq = txn_alloc_irq(8);
+
+       if (vi->txn_irq < 0)
+               panic("I/O sapic: couldn't get TXN IRQ\n");
+
+       /* enable_irq() will use txn_* to program IRdT */
+       vi->txn_addr = txn_alloc_addr(vi->txn_irq);
+       vi->txn_data = txn_alloc_data(vi->txn_irq);
+
+       vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI;
+       vi->eoi_data = cpu_to_le32(vi->txn_data);
+
+       cpu_claim_irq(vi->txn_irq, &iosapic_interrupt_type, vi);
+
+ out:
+
+       return vi->txn_irq;
+}
+#endif
+
 
 /*
 ** squirrel away the I/O Sapic Version
@@ -877,6 +941,8 @@ void *iosapic_register(unsigned long hpa)
                vip->irqline = (unsigned char) cnt;
                vip->iosapic = isi;
        }
+       if (!first_isi)
+               first_isi = isi;
        return isi;
 }
 
index 716aa93fff76437ab0038de385d7c4fa7ec04834..59df8575a48ce834fb48ea002689ed97ed9ca51a 100644 (file)
@@ -61,6 +61,7 @@ static DEFINE_MUTEX(bridge_mutex);
 static void handle_hotplug_event_bridge (acpi_handle, u32, void *);
 static void acpiphp_sanitize_bus(struct pci_bus *bus);
 static void acpiphp_set_hpp_values(struct pci_bus *bus);
+static void hotplug_event_func(acpi_handle handle, u32 type, void *context);
 static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context);
 static void free_bridge(struct kref *kref);
 
@@ -147,7 +148,7 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
 
 
 static const struct acpi_dock_ops acpiphp_dock_ops = {
-       .handler = handle_hotplug_event_func,
+       .handler = hotplug_event_func,
 };
 
 /* Check whether the PCI device is managed by native PCIe hotplug driver */
@@ -179,6 +180,20 @@ static bool device_is_managed_by_native_pciehp(struct pci_dev *pdev)
        return true;
 }
 
+static void acpiphp_dock_init(void *data)
+{
+       struct acpiphp_func *func = data;
+
+       get_bridge(func->slot->bridge);
+}
+
+static void acpiphp_dock_release(void *data)
+{
+       struct acpiphp_func *func = data;
+
+       put_bridge(func->slot->bridge);
+}
+
 /* callback routine to register each ACPI PCI slot object */
 static acpi_status
 register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
@@ -298,7 +313,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
                 */
                newfunc->flags &= ~FUNC_HAS_EJ0;
                if (register_hotplug_dock_device(handle,
-                       &acpiphp_dock_ops, newfunc))
+                       &acpiphp_dock_ops, newfunc,
+                       acpiphp_dock_init, acpiphp_dock_release))
                        dbg("failed to register dock device\n");
 
                /* we need to be notified when dock events happen
@@ -670,6 +686,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
        struct pci_bus *bus = slot->bridge->pci_bus;
        struct acpiphp_func *func;
        int num, max, pass;
+       LIST_HEAD(add_list);
 
        if (slot->flags & SLOT_ENABLED)
                goto err_exit;
@@ -694,13 +711,15 @@ static int __ref enable_device(struct acpiphp_slot *slot)
                                max = pci_scan_bridge(bus, dev, max, pass);
                                if (pass && dev->subordinate) {
                                        check_hotplug_bridge(slot, dev);
-                                       pci_bus_size_bridges(dev->subordinate);
+                                       pcibios_resource_survey_bus(dev->subordinate);
+                                       __pci_bus_size_bridges(dev->subordinate,
+                                                              &add_list);
                                }
                        }
                }
        }
 
-       pci_bus_assign_resources(bus);
+       __pci_bus_assign_resources(bus, &add_list, NULL);
        acpiphp_sanitize_bus(bus);
        acpiphp_set_hpp_values(bus);
        acpiphp_set_acpi_region(slot);
@@ -1065,22 +1084,12 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type,
        alloc_acpi_hp_work(handle, type, context, _handle_hotplug_event_bridge);
 }
 
-static void _handle_hotplug_event_func(struct work_struct *work)
+static void hotplug_event_func(acpi_handle handle, u32 type, void *context)
 {
-       struct acpiphp_func *func;
+       struct acpiphp_func *func = context;
        char objname[64];
        struct acpi_buffer buffer = { .length = sizeof(objname),
                                      .pointer = objname };
-       struct acpi_hp_work *hp_work;
-       acpi_handle handle;
-       u32 type;
-
-       hp_work = container_of(work, struct acpi_hp_work, work);
-       handle = hp_work->handle;
-       type = hp_work->type;
-       func = (struct acpiphp_func *)hp_work->context;
-
-       acpi_scan_lock_acquire();
 
        acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
 
@@ -1113,6 +1122,18 @@ static void _handle_hotplug_event_func(struct work_struct *work)
                warn("notify_handler: unknown event type 0x%x for %s\n", type, objname);
                break;
        }
+}
+
+static void _handle_hotplug_event_func(struct work_struct *work)
+{
+       struct acpi_hp_work *hp_work;
+       struct acpiphp_func *func;
+
+       hp_work = container_of(work, struct acpi_hp_work, work);
+       func = hp_work->context;
+       acpi_scan_lock_acquire();
+
+       hotplug_event_func(hp_work->handle, hp_work->type, func);
 
        acpi_scan_lock_release();
        kfree(hp_work); /* allocated in handle_hotplug_event_func */
index 68678ed76b0da93114280ae2ec878457159f63c5..d1182c4a754e235b25fb2914d658010d05157756 100644 (file)
@@ -202,6 +202,11 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
                    struct resource *res, unsigned int reg);
 int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type);
 void pci_configure_ari(struct pci_dev *dev);
+void __ref __pci_bus_size_bridges(struct pci_bus *bus,
+                       struct list_head *realloc_head);
+void __ref __pci_bus_assign_resources(const struct pci_bus *bus,
+                                     struct list_head *realloc_head,
+                                     struct list_head *fail_head);
 
 /**
  * pci_ari_enabled - query ARI forwarding status
index 16abaaa1f83caed1009fb04018ece089b0138f26..d254e237953382bb99768c7cca79b65c3b9aded8 100644 (file)
@@ -1044,7 +1044,7 @@ handle_done:
        ;
 }
 
-static void __ref __pci_bus_size_bridges(struct pci_bus *bus,
+void __ref __pci_bus_size_bridges(struct pci_bus *bus,
                        struct list_head *realloc_head)
 {
        struct pci_dev *dev;
@@ -1115,9 +1115,9 @@ void __ref pci_bus_size_bridges(struct pci_bus *bus)
 }
 EXPORT_SYMBOL(pci_bus_size_bridges);
 
-static void __ref __pci_bus_assign_resources(const struct pci_bus *bus,
-                                        struct list_head *realloc_head,
-                                        struct list_head *fail_head)
+void __ref __pci_bus_assign_resources(const struct pci_bus *bus,
+                                     struct list_head *realloc_head,
+                                     struct list_head *fail_head)
 {
        struct pci_bus *b;
        struct pci_dev *dev;
index 439c012be763646c48be2910d67a3acce50c3d48..b63d534192e33a8defea70b6c0195293392ea98e 100644 (file)
@@ -186,7 +186,7 @@ bfad_debugfs_lseek(struct file *file, loff_t offset, int orig)
                file->f_pos += offset;
                break;
        case 2:
-               file->f_pos = debug->buffer_len - offset;
+               file->f_pos = debug->buffer_len + offset;
                break;
        default:
                return -EINVAL;
index adc1f7f471f554dd3bc48825ab45bd65df6ed3af..85e1ffd0e5c5af17e53305ad016f28898d65c8f7 100644 (file)
@@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file,
                pos = file->f_pos + offset;
                break;
        case 2:
-               pos = fnic_dbg_prt->buffer_len - offset;
+               pos = fnic_dbg_prt->buffer_len + offset;
        }
        return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ?
                          -EINVAL : (file->f_pos = pos);
index f63f5ff7f27467f7b34f80d3bc0089538dc147df..f525ecb7a9c6e187bf1097a6baf7aabad96377a4 100644 (file)
@@ -1178,7 +1178,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
                pos = file->f_pos + off;
                break;
        case 2:
-               pos = debug->len - off;
+               pos = debug->len + off;
        }
        return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos);
 }
index 7a3870f385f63adcc7ed23db355af7fe0682fb93..66b0b26a1381e4ecb17806c935ca05c1b62cfe70 100644 (file)
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
                 * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen
                 * for qla_tgt_xmit_response LLD code
                 */
+               if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
+                       se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT;
+                       se_cmd->residual_count = 0;
+               }
                se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT;
-               se_cmd->residual_count = se_cmd->data_length;
+               se_cmd->residual_count += se_cmd->data_length;
 
                cmd->bufflen = 0;
        }
index 2e4a28b018e8d894d92975ead5e14dfe01dabec4..12f321dd23993ea8a1d35c54e6d14b733470484c 100644 (file)
@@ -1,6 +1,6 @@
 config VIDEO_DM365_VPFE
        tristate "DM365 VPFE Media Controller Capture Driver"
-       depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_VPFE_CAPTURE
+       depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF
        select VIDEOBUF2_DMA_CONTIG
        help
          Support for DM365 VPFE based Media Controller Capture driver.
index b88e1ddce229755155a25da66af544218642321d..d8ce20d2fbda54f35fe5a12031cf391230719f69 100644 (file)
@@ -639,7 +639,8 @@ static int vpfe_probe(struct platform_device *pdev)
        if (ret)
                goto probe_free_dev_mem;
 
-       if (vpfe_initialize_modules(vpfe_dev, pdev))
+       ret = vpfe_initialize_modules(vpfe_dev, pdev);
+       if (ret)
                goto probe_disable_clock;
 
        vpfe_dev->media_dev.dev = vpfe_dev->pdev;
@@ -663,7 +664,8 @@ static int vpfe_probe(struct platform_device *pdev)
        /* set the driver data in platform device */
        platform_set_drvdata(pdev, vpfe_dev);
        /* register subdevs/entities */
-       if (vpfe_register_entities(vpfe_dev))
+       ret = vpfe_register_entities(vpfe_dev);
+       if (ret)
                goto probe_out_v4l2_unregister;
 
        ret = vpfe_attach_irq(vpfe_dev);
index df6569b997b88269bfdb48fd17dc410a0da50c0a..34f3b6d02d2a4075b423d1adcca0c62b5f949c96 100644 (file)
@@ -5,6 +5,7 @@ config SOLO6X10
        select VIDEOBUF2_DMA_SG
        select VIDEOBUF2_DMA_CONTIG
        select SND_PCM
+       select FONT_8x16
        ---help---
          This driver supports the Softlogic based MPEG-4 and h.264 codec
          cards.
index 13e9e715ad2e738a581d7db6f235d298b9b886fb..8d8b3ff68490be34fd78382f256bdd5dedda87f2 100644 (file)
@@ -155,7 +155,7 @@ static ssize_t lio_target_np_store_iser(
        struct iscsi_tpg_np *tpg_np_iser = NULL;
        char *endptr;
        u32 op;
-       int rc;
+       int rc = 0;
 
        op = simple_strtoul(page, &endptr, 0);
        if ((op != 1) && (op != 0)) {
@@ -174,31 +174,32 @@ static ssize_t lio_target_np_store_iser(
                return -EINVAL;
 
        if (op) {
-               int rc = request_module("ib_isert");
-               if (rc != 0)
+               rc = request_module("ib_isert");
+               if (rc != 0) {
                        pr_warn("Unable to request_module for ib_isert\n");
+                       rc = 0;
+               }
 
                tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr,
                                np->np_ip, tpg_np, ISCSI_INFINIBAND);
-               if (!tpg_np_iser || IS_ERR(tpg_np_iser))
+               if (IS_ERR(tpg_np_iser)) {
+                       rc = PTR_ERR(tpg_np_iser);
                        goto out;
+               }
        } else {
                tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND);
-               if (!tpg_np_iser)
-                       goto out;
-
-               rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser);
-               if (rc < 0)
-                       goto out;
+               if (tpg_np_iser) {
+                       rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser);
+                       if (rc < 0)
+                               goto out;
+               }
        }
 
-       printk("lio_target_np_store_iser() done, op: %d\n", op);
-
        iscsit_put_tpg(tpg);
        return count;
 out:
        iscsit_put_tpg(tpg);
-       return -EINVAL;
+       return rc;
 }
 
 TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR);
index 8e6298cc8839711e03745c08f7be04446ac47f3b..dcb199da06b9678d8dbd5fd1446dc0493edae003 100644 (file)
@@ -842,11 +842,11 @@ int iscsit_stop_time2retain_timer(struct iscsi_session *sess)
                return 0;
 
        sess->time2retain_timer_flags |= ISCSI_TF_STOP;
-       spin_unlock_bh(&se_tpg->session_lock);
+       spin_unlock(&se_tpg->session_lock);
 
        del_timer_sync(&sess->time2retain_timer);
 
-       spin_lock_bh(&se_tpg->session_lock);
+       spin_lock(&se_tpg->session_lock);
        sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING;
        pr_debug("Stopped Time2Retain Timer for SID: %u\n",
                        sess->sid);
index bb5d5c5bce65107877b4e326c70e4d195ac4ad6b..3402241be87cd401b500da10a398cb734e62bf8b 100644 (file)
@@ -984,8 +984,6 @@ int iscsi_target_setup_login_socket(
        }
 
        np->np_transport = t;
-       printk("Set np->np_transport to %p -> %s\n", np->np_transport,
-                               np->np_transport->name);
        return 0;
 }
 
@@ -1002,7 +1000,6 @@ int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn)
 
        conn->sock = new_sock;
        conn->login_family = np->np_sockaddr.ss_family;
-       printk("iSCSI/TCP: Setup conn->sock from new_sock: %p\n", new_sock);
 
        if (np->np_sockaddr.ss_family == AF_INET6) {
                memset(&sock_in6, 0, sizeof(struct sockaddr_in6));
index 7ad912060e21364ab75b577c28f7cc159cc436c3..cd5018ff9cd78e2b8d547a559e5d0eebb8ff8283 100644 (file)
@@ -721,9 +721,6 @@ int iscsi_target_locate_portal(
 
                start += strlen(key) + strlen(value) + 2;
        }
-
-       printk("i_buf: %s, s_buf: %s, t_buf: %s\n", i_buf, s_buf, t_buf);
-
        /*
         * See 5.3.  Login Phase.
         */
index 59bfaecc4e1438ecc771573c44c161b26fc3548d..abfd9908978188ffe3bfd7a9c3aa3e8c6700c5d9 100644 (file)
@@ -244,14 +244,9 @@ static void pty_flush_buffer(struct tty_struct *tty)
 
 static int pty_open(struct tty_struct *tty, struct file *filp)
 {
-       int     retval = -ENODEV;
-
        if (!tty || !tty->link)
-               goto out;
-
-       set_bit(TTY_IO_ERROR, &tty->flags);
+               return -ENODEV;
 
-       retval = -EIO;
        if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
                goto out;
        if (test_bit(TTY_PTY_LOCK, &tty->link->flags))
@@ -262,9 +257,11 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
        clear_bit(TTY_IO_ERROR, &tty->flags);
        clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
        set_bit(TTY_THROTTLED, &tty->flags);
-       retval = 0;
+       return 0;
+
 out:
-       return retval;
+       set_bit(TTY_IO_ERROR, &tty->flags);
+       return -EIO;
 }
 
 static void pty_set_termios(struct tty_struct *tty,
index 097dff9c08ad9e4ebec835f20800e6d118931bd0..bb91b4713ebdb8c7ba8849cba643d046c5bc9973 100644 (file)
@@ -30,6 +30,12 @@ static int __init serial_init_chip(struct parisc_device *dev)
        unsigned long address;
        int err;
 
+#ifdef CONFIG_64BIT
+       extern int iosapic_serial_irq(int cellnum);
+       if (!dev->irq && (dev->id.sversion == 0xad))
+               dev->irq = iosapic_serial_irq(dev->mod_index-1);
+#endif
+
        if (!dev->irq) {
                /* We find some unattached serial ports by walking native
                 * busses.  These should be silently ignored.  Otherwise,
@@ -51,7 +57,8 @@ static int __init serial_init_chip(struct parisc_device *dev)
        memset(&uart, 0, sizeof(uart));
        uart.port.iotype        = UPIO_MEM;
        /* 7.272727MHz on Lasi.  Assumed the same for Dino, Wax and Timi. */
-       uart.port.uartclk       = 7272727;
+       uart.port.uartclk       = (dev->id.sversion != 0xad) ?
+                                       7272727 : 1843200;
        uart.port.mapbase       = address;
        uart.port.membase       = ioremap_nocache(address, 16);
        uart.port.irq   = dev->irq;
@@ -73,6 +80,7 @@ static struct parisc_device_id serial_tbl[] = {
        { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
        { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
        { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
+       { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x000ad },
        { 0 }
 };
 
index fc2c06c66e89d5e7536c5bb5387bc0fd9a837086..2bd78e2ac8ecba07dbf42788b6c61506ee8b2b20 100644 (file)
@@ -289,13 +289,10 @@ static int vt_disallocate(unsigned int vc_num)
        struct vc_data *vc = NULL;
        int ret = 0;
 
-       if (!vc_num)
-               return 0;
-
        console_lock();
        if (VT_BUSY(vc_num))
                ret = -EBUSY;
-       else
+       else if (vc_num)
                vc = vc_deallocate(vc_num);
        console_unlock();
 
index 7ef3eb8617a6c7adc7775bc76a5fb0fd3d699ef8..2311b1e4e43c6d1258b68ca6b330cac68cb718a7 100644 (file)
@@ -4,11 +4,17 @@
 menuconfig USB_PHY
        bool "USB Physical Layer drivers"
        help
-         USB controllers (those which are host, device or DRD) need a
-         device to handle the physical layer signalling, commonly called
-         a PHY.
+         Most USB controllers have the physical layer signalling part
+         (commonly called a PHY) built in.  However, dual-role devices
+         (a.k.a. USB on-the-go) which support being USB master or slave
+         with the same connector often use an external PHY.
 
-         The following drivers add support for such PHY devices.
+         The drivers in this submenu add support for such PHY devices.
+         They are not needed for standard master-only (or the vast
+         majority of slave-only) USB interfaces.
+
+         If you're not sure if this applies to you, it probably doesn't;
+         say N here.
 
 if USB_PHY
 
index c92c5ed4e580ec6761d0acabc379cfe667faaeb1..e581c2549a57658bc702c854e4924c3f3ae01a25 100644 (file)
@@ -172,7 +172,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
        { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
        { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
-       { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
+       { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) },
+       { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
 };
 
index b353e7e3d4809d17478478eae47fa2cc75a0d5a6..4a2423e84d55820b594ca43ed99fc8ae88b2f002 100644 (file)
@@ -52,7 +52,9 @@
 
 /* Abbott Diabetics vendor and product ids */
 #define ABBOTT_VENDOR_ID               0x1a61
-#define ABBOTT_PRODUCT_ID              0x3410
+#define ABBOTT_STEREO_PLUG_ID          0x3410
+#define ABBOTT_PRODUCT_ID              ABBOTT_STEREO_PLUG_ID
+#define ABBOTT_STRIP_PORT_ID           0x3420
 
 /* Commands */
 #define TI_GET_VERSION                 0x01
index eaa75f75b625c572ec6e75650b3e6fb89d715a4a..68121584ae37d40a074bf81e55184ecb1674d882 100644 (file)
@@ -131,6 +131,12 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *);
  */
 extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
 
+/*
+ * splice.c
+ */
+extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
+               loff_t *opos, size_t len, unsigned int flags);
+
 /*
  * pipe.c
  */
index 03430008704e68fd74470e8dbb9fcb637dce3f97..2cefa417be349b0016ffa8606635db9e85751015 100644 (file)
@@ -1064,6 +1064,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
        struct fd in, out;
        struct inode *in_inode, *out_inode;
        loff_t pos;
+       loff_t out_pos;
        ssize_t retval;
        int fl;
 
@@ -1077,12 +1078,14 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
        if (!(in.file->f_mode & FMODE_READ))
                goto fput_in;
        retval = -ESPIPE;
-       if (!ppos)
-               ppos = &in.file->f_pos;
-       else
+       if (!ppos) {
+               pos = in.file->f_pos;
+       } else {
+               pos = *ppos;
                if (!(in.file->f_mode & FMODE_PREAD))
                        goto fput_in;
-       retval = rw_verify_area(READ, in.file, ppos, count);
+       }
+       retval = rw_verify_area(READ, in.file, &pos, count);
        if (retval < 0)
                goto fput_in;
        count = retval;
@@ -1099,7 +1102,8 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
        retval = -EINVAL;
        in_inode = file_inode(in.file);
        out_inode = file_inode(out.file);
-       retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count);
+       out_pos = out.file->f_pos;
+       retval = rw_verify_area(WRITE, out.file, &out_pos, count);
        if (retval < 0)
                goto fput_out;
        count = retval;
@@ -1107,7 +1111,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
        if (!max)
                max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes);
 
-       pos = *ppos;
        if (unlikely(pos + count > max)) {
                retval = -EOVERFLOW;
                if (pos >= max)
@@ -1126,18 +1129,23 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
        if (in.file->f_flags & O_NONBLOCK)
                fl = SPLICE_F_NONBLOCK;
 #endif
-       retval = do_splice_direct(in.file, ppos, out.file, count, fl);
+       retval = do_splice_direct(in.file, &pos, out.file, &out_pos, count, fl);
 
        if (retval > 0) {
                add_rchar(current, retval);
                add_wchar(current, retval);
                fsnotify_access(in.file);
                fsnotify_modify(out.file);
+               out.file->f_pos = out_pos;
+               if (ppos)
+                       *ppos = pos;
+               else
+                       in.file->f_pos = pos;
        }
 
        inc_syscr(current);
        inc_syscw(current);
-       if (*ppos > max)
+       if (pos > max)
                retval = -EOVERFLOW;
 
 fput_out:
index e6b25598c8c413d66026f96e6d6d1b351e28b62c..9eca476227d535eb29c74dfa7aaf324167f7e93f 100644 (file)
@@ -1274,7 +1274,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
 {
        struct file *file = sd->u.file;
 
-       return do_splice_from(pipe, file, &file->f_pos, sd->total_len,
+       return do_splice_from(pipe, file, sd->opos, sd->total_len,
                              sd->flags);
 }
 
@@ -1294,7 +1294,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
  *
  */
 long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
-                     size_t len, unsigned int flags)
+                     loff_t *opos, size_t len, unsigned int flags)
 {
        struct splice_desc sd = {
                .len            = len,
@@ -1302,6 +1302,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
                .flags          = flags,
                .pos            = *ppos,
                .u.file         = out,
+               .opos           = opos,
        };
        long ret;
 
@@ -1325,7 +1326,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
 {
        struct pipe_inode_info *ipipe;
        struct pipe_inode_info *opipe;
-       loff_t offset, *off;
+       loff_t offset;
        long ret;
 
        ipipe = get_pipe_info(in);
@@ -1356,13 +1357,15 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                                return -EINVAL;
                        if (copy_from_user(&offset, off_out, sizeof(loff_t)))
                                return -EFAULT;
-                       off = &offset;
-               } else
-                       off = &out->f_pos;
+               } else {
+                       offset = out->f_pos;
+               }
 
-               ret = do_splice_from(ipipe, out, off, len, flags);
+               ret = do_splice_from(ipipe, out, &offset, len, flags);
 
-               if (off_out && copy_to_user(off_out, off, sizeof(loff_t)))
+               if (!off_out)
+                       out->f_pos = offset;
+               else if (copy_to_user(off_out, &offset, sizeof(loff_t)))
                        ret = -EFAULT;
 
                return ret;
@@ -1376,13 +1379,15 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                                return -EINVAL;
                        if (copy_from_user(&offset, off_in, sizeof(loff_t)))
                                return -EFAULT;
-                       off = &offset;
-               } else
-                       off = &in->f_pos;
+               } else {
+                       offset = in->f_pos;
+               }
 
-               ret = do_splice_to(in, off, opipe, len, flags);
+               ret = do_splice_to(in, &offset, opipe, len, flags);
 
-               if (off_in && copy_to_user(off_in, off, sizeof(loff_t)))
+               if (!off_in)
+                       in->f_pos = offset;
+               else if (copy_to_user(off_in, &offset, sizeof(loff_t)))
                        ret = -EFAULT;
 
                return ret;
index 14ceff788c40b75cc7e7240db5bb07587d6ec783..1c16f821434f9c2ffee4ea793605800fa99a56b4 100644 (file)
  *
  *****************************************************************************/
 
-#define ACPI_DEBUGGER_MAX_ARGS          8      /* Must be max method args + 1 */
-#define ACPI_DB_LINE_BUFFER_SIZE       512
+#define ACPI_DEBUGGER_MAX_ARGS          ACPI_METHOD_NUM_ARGS + 4       /* Max command line arguments */
+#define ACPI_DB_LINE_BUFFER_SIZE        512
 
 #define ACPI_DEBUGGER_COMMAND_PROMPT    '-'
 #define ACPI_DEBUGGER_EXECUTE_PROMPT    '%'
index 4f52ea795c7ac2e5e39ff97703ad71ebe705351f..4607b027a6577111d3179d07cc292e25ba8de493 100644 (file)
  * This is the non-debug case -- make everything go away,
  * leaving no executable debug code!
  */
-#define ACPI_FUNCTION_NAME(a)
 #define ACPI_DEBUG_PRINT(pl)
 #define ACPI_DEBUG_PRINT_RAW(pl)
 #define ACPI_DEBUG_EXEC(a)
 #define ACPI_DEBUG_ONLY_MEMBERS(a)
+#define ACPI_FUNCTION_NAME(a)
 #define ACPI_FUNCTION_TRACE(a)
 #define ACPI_FUNCTION_TRACE_PTR(a, b)
 #define ACPI_FUNCTION_TRACE_U32(a, b)
 #define ACPI_FUNCTION_TRACE_STR(a, b)
-#define ACPI_FUNCTION_EXIT
-#define ACPI_FUNCTION_STATUS_EXIT(s)
-#define ACPI_FUNCTION_VALUE_EXIT(s)
 #define ACPI_FUNCTION_ENTRY()
 #define ACPI_DUMP_STACK_ENTRY(a)
 #define ACPI_DUMP_OPERANDS(a, b, c)
 #define ACPI_DUMP_ENTRY(a, b)
-#define ACPI_DUMP_TABLES(a, b)
 #define ACPI_DUMP_PATHNAME(a, b, c, d)
 #define ACPI_DUMP_BUFFER(a, b)
-#define ACPI_DEBUG_PRINT(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl)
 #define ACPI_IS_DEBUG_ENABLED(level, component) 0
 
 /* Return macros must have a return statement at the minimum */
index c3dc203a90f4ca967a406ca375c361768dccb826..cac0dfb2a082cc727dc9bb245bc8f6172bcc044c 100644 (file)
@@ -63,13 +63,6 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld
 #define ACPI_BUS_FILE_ROOT     "acpi"
 extern struct proc_dir_entry *acpi_root_dir;
 
-enum acpi_bus_removal_type {
-       ACPI_BUS_REMOVAL_NORMAL = 0,
-       ACPI_BUS_REMOVAL_EJECT,
-       ACPI_BUS_REMOVAL_SUPRISE,
-       ACPI_BUS_REMOVAL_TYPE_COUNT
-};
-
 enum acpi_bus_device_type {
        ACPI_BUS_TYPE_DEVICE = 0,
        ACPI_BUS_TYPE_POWER,
@@ -286,6 +279,7 @@ struct acpi_device_physical_node {
        u8 node_id;
        struct list_head node;
        struct device *dev;
+       bool put_online:1;
 };
 
 /* set maximum of physical nodes to 32 for expansibility */
@@ -310,7 +304,6 @@ struct acpi_device {
        struct acpi_driver *driver;
        void *driver_data;
        struct device dev;
-       enum acpi_bus_removal_type removal_type;        /* indicate for different removal type */
        u8 physical_node_count;
        struct list_head physical_node_list;
        struct mutex physical_node_lock;
@@ -382,6 +375,7 @@ const char *acpi_power_state_string(int state);
 int acpi_device_get_power(struct acpi_device *device, int *state);
 int acpi_device_set_power(struct acpi_device *device, int state);
 int acpi_bus_init_power(struct acpi_device *device);
+int acpi_device_fix_up_power(struct acpi_device *device);
 int acpi_bus_update_power(acpi_handle handle, int *state_p);
 bool acpi_bus_power_manageable(acpi_handle handle);
 
index e6168a24b9f0f202e9403f946c9aecbb8049f67b..b420939f5eb5608f2335e0b4ae4087176911022b 100644 (file)
@@ -123,7 +123,9 @@ extern int register_dock_notifier(struct notifier_block *nb);
 extern void unregister_dock_notifier(struct notifier_block *nb);
 extern int register_hotplug_dock_device(acpi_handle handle,
                                        const struct acpi_dock_ops *ops,
-                                       void *context);
+                                       void *context,
+                                       void (*init)(void *),
+                                       void (*release)(void *));
 extern void unregister_hotplug_dock_device(acpi_handle handle);
 #else
 static inline int is_dock_device(acpi_handle handle)
@@ -139,7 +141,9 @@ static inline void unregister_dock_notifier(struct notifier_block *nb)
 }
 static inline int register_hotplug_dock_device(acpi_handle handle,
                                               const struct acpi_dock_ops *ops,
-                                              void *context)
+                                              void *context,
+                                              void (*init)(void *),
+                                              void (*release)(void *))
 {
        return -ENODEV;
 }
index 454881e6450a4493eabf6fa5de03fd005fccc761..1b09300810e647dc71fbd7b490cd081ef7c0862d 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20130328
+#define ACPI_CA_VERSION                 0x20130517
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
@@ -80,6 +80,7 @@ extern bool acpi_gbl_enable_aml_debug_object;
 extern u8 acpi_gbl_copy_dsdt_locally;
 extern u8 acpi_gbl_truncate_io_addresses;
 extern u8 acpi_gbl_disable_auto_repair;
+extern u8 acpi_gbl_disable_ssdt_table_load;
 
 /*
  * Hardware-reduced prototypes. All interfaces that use these macros will
index ea69367fdd3bbafaf1775da248c7cc998c47fba8..66096d06925e417d70d6b8974a00a035d05ef1d8 100644 (file)
@@ -6,6 +6,10 @@
 #include <linux/thermal.h>
 #include <asm/acpi.h>
 
+#define ACPI_PROCESSOR_CLASS           "processor"
+#define ACPI_PROCESSOR_DEVICE_NAME     "Processor"
+#define ACPI_PROCESSOR_DEVICE_HID      "ACPI0007"
+
 #define ACPI_PROCESSOR_BUSY_METRIC     10
 
 #define ACPI_PROCESSOR_MAX_POWER       8
@@ -207,6 +211,7 @@ struct acpi_processor {
        struct acpi_processor_throttling throttling;
        struct acpi_processor_limit limit;
        struct thermal_cooling_device *cdev;
+       struct device *dev; /* Processor device. */
 };
 
 struct acpi_processor_errata {
index 17b5b596764100ae14400437b86e84b0c068291f..353ba256f3681e4f6ddd8b18b9feba61b1d98cec 100644 (file)
@@ -352,8 +352,7 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
 
 /* Enable _OST when all relevant hotplug operations are enabled */
 #if defined(CONFIG_ACPI_HOTPLUG_CPU) &&                        \
-       (defined(CONFIG_ACPI_HOTPLUG_MEMORY) ||         \
-        defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) && \
+       defined(CONFIG_ACPI_HOTPLUG_MEMORY) &&          \
        defined(CONFIG_ACPI_CONTAINER)
 #define ACPI_HOTPLUG_OST
 #endif
index 365f4a61bf0408c12b3b3dbeb1743c8a2b616c35..fc09d7b0dacfc00feef340cc03c06b207feed870 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/sched.h>
 #include <linux/percpu.h>
+#include <linux/vtime.h>
 #include <asm/ptrace.h>
 
 struct context_tracking {
@@ -19,6 +20,26 @@ struct context_tracking {
        } state;
 };
 
+static inline void __guest_enter(void)
+{
+       /*
+        * This is running in ioctl context so we can avoid
+        * the call to vtime_account() with its unnecessary idle check.
+        */
+       vtime_account_system(current);
+       current->flags |= PF_VCPU;
+}
+
+static inline void __guest_exit(void)
+{
+       /*
+        * This is running in ioctl context so we can avoid
+        * the call to vtime_account() with its unnecessary idle check.
+        */
+       vtime_account_system(current);
+       current->flags &= ~PF_VCPU;
+}
+
 #ifdef CONFIG_CONTEXT_TRACKING
 DECLARE_PER_CPU(struct context_tracking, context_tracking);
 
@@ -35,6 +56,9 @@ static inline bool context_tracking_active(void)
 extern void user_enter(void);
 extern void user_exit(void);
 
+extern void guest_enter(void);
+extern void guest_exit(void);
+
 static inline enum ctx_state exception_enter(void)
 {
        enum ctx_state prev_ctx;
@@ -57,6 +81,17 @@ extern void context_tracking_task_switch(struct task_struct *prev,
 static inline bool context_tracking_in_user(void) { return false; }
 static inline void user_enter(void) { }
 static inline void user_exit(void) { }
+
+static inline void guest_enter(void)
+{
+       __guest_enter();
+}
+
+static inline void guest_exit(void)
+{
+       __guest_exit();
+}
+
 static inline enum ctx_state exception_enter(void) { return 0; }
 static inline void exception_exit(enum ctx_state prev_ctx) { }
 static inline void context_tracking_task_switch(struct task_struct *prev,
index c0a12612532512bab2f792fba4b40580c48b13dd..eeb33315514c332ddf83b9fcf4183a580555bab6 100644 (file)
@@ -71,6 +71,10 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  *             the specific driver's probe to initial the matched device.
  * @remove:    Called when a device removed from this bus.
  * @shutdown:  Called at shut-down time to quiesce the device.
+ *
+ * @online:    Called to put the device back online (after offlining it).
+ * @offline:   Called to put the device offline for hot-removal. May fail.
+ *
  * @suspend:   Called when a device on this bus wants to go to sleep mode.
  * @resume:    Called to bring a device on this bus out of sleep mode.
  * @pm:                Power management operations of this bus, callback the specific
@@ -104,6 +108,9 @@ struct bus_type {
        int (*remove)(struct device *dev);
        void (*shutdown)(struct device *dev);
 
+       int (*online)(struct device *dev);
+       int (*offline)(struct device *dev);
+
        int (*suspend)(struct device *dev, pm_message_t state);
        int (*resume)(struct device *dev);
 
@@ -648,6 +655,8 @@ struct acpi_dev_node {
  * @release:   Callback to free the device after all references have
  *             gone away. This should be set by the allocator of the
  *             device (i.e. the bus driver that discovered the device).
+ * @offline_disabled: If set, the device is permanently online.
+ * @offline:   Set after successful invocation of bus type's .offline().
  *
  * At the lowest level, every device in a Linux system is represented by an
  * instance of struct device. The device structure contains the information
@@ -720,6 +729,9 @@ struct device {
 
        void    (*release)(struct device *dev);
        struct iommu_group      *iommu_group;
+
+       bool                    offline_disabled:1;
+       bool                    offline:1;
 };
 
 static inline struct device *kobj_to_dev(struct kobject *kobj)
@@ -856,6 +868,15 @@ extern const char *device_get_devnode(struct device *dev,
 extern void *dev_get_drvdata(const struct device *dev);
 extern int dev_set_drvdata(struct device *dev, void *data);
 
+static inline bool device_supports_offline(struct device *dev)
+{
+       return dev->bus && dev->bus->offline && dev->bus->online;
+}
+
+extern void lock_device_hotplug(void);
+extern void unlock_device_hotplug(void);
+extern int device_offline(struct device *dev);
+extern int device_online(struct device *dev);
 /*
  * Root device objects for grouping under /sys/devices
  */
index 43db02e9c9fa11bed1b058fba9dd9039ea9c226d..65c2be22b601cc40c17b175e4a88f8980979cc62 100644 (file)
@@ -2414,8 +2414,6 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
                struct file *, loff_t *, size_t, unsigned int);
 extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
                struct file *out, loff_t *, size_t len, unsigned int flags);
-extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
-               size_t len, unsigned int flags);
 
 extern void
 file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
index f0eea07d2c2bb5168820443639af6e85a9d47850..8db53cfaccdb64fdbd18d29935e698d101bf5bf1 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/ratelimit.h>
 #include <linux/err.h>
 #include <linux/irqflags.h>
+#include <linux/context_tracking.h>
 #include <asm/signal.h>
 
 #include <linux/kvm.h>
@@ -760,42 +761,6 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
 }
 #endif
 
-static inline void __guest_enter(void)
-{
-       /*
-        * This is running in ioctl context so we can avoid
-        * the call to vtime_account() with its unnecessary idle check.
-        */
-       vtime_account_system(current);
-       current->flags |= PF_VCPU;
-}
-
-static inline void __guest_exit(void)
-{
-       /*
-        * This is running in ioctl context so we can avoid
-        * the call to vtime_account() with its unnecessary idle check.
-        */
-       vtime_account_system(current);
-       current->flags &= ~PF_VCPU;
-}
-
-#ifdef CONFIG_CONTEXT_TRACKING
-extern void guest_enter(void);
-extern void guest_exit(void);
-
-#else /* !CONFIG_CONTEXT_TRACKING */
-static inline void guest_enter(void)
-{
-       __guest_enter();
-}
-
-static inline void guest_exit(void)
-{
-       __guest_exit();
-}
-#endif /* !CONFIG_CONTEXT_TRACKING */
-
 static inline void kvm_guest_enter(void)
 {
        unsigned long flags;
index 3e622c6109255650896ce67e141403ec1d36479e..dd38e62b84d2824ecf1e412cdd7fbb908dac675f 100644 (file)
@@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}
 
 extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
 extern void try_offline_node(int nid);
+extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
+extern void remove_memory(int nid, u64 start, u64 size);
 
 #else
 static inline int is_mem_section_removable(unsigned long pfn,
@@ -243,15 +245,23 @@ static inline int is_mem_section_removable(unsigned long pfn,
 }
 
 static inline void try_offline_node(int nid) {}
+
+static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
+{
+       return -EINVAL;
+}
+
+static inline void remove_memory(int nid, u64 start, u64 size) {}
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
+extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
+               void *arg, int (*func)(struct memory_block *, void *));
 extern int mem_online_node(int nid);
 extern int add_memory(int nid, u64 start, u64 size);
 extern int arch_add_memory(int nid, u64 start, u64 size);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
-extern int offline_memory_block(struct memory_block *mem);
 extern bool is_memblock_offlined(struct memory_block *mem);
-extern int remove_memory(int nid, u64 start, u64 size);
+extern void remove_memory(int nid, u64 start, u64 size);
 extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
                                                                int nr_pages);
 extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
index f463a46424e240715f2cc0c3bbf58f38955db1a8..c5b6dbf9c2fcd5c90d0b16d2e4e6e330af3ed0b0 100644 (file)
@@ -389,8 +389,7 @@ struct perf_event {
        /* mmap bits */
        struct mutex                    mmap_mutex;
        atomic_t                        mmap_count;
-       int                             mmap_locked;
-       struct user_struct              *mmap_user;
+
        struct ring_buffer              *rb;
        struct list_head                rb_entry;
 
index 87a03c746f177be0b4ddc0dee6a61860d596ff3d..f5d4723cdb3d3e6ab30d5af02d1eaadbdc7d0ee3 100644 (file)
@@ -33,9 +33,25 @@ do { \
                preempt_schedule(); \
 } while (0)
 
+#ifdef CONFIG_CONTEXT_TRACKING
+
+void preempt_schedule_context(void);
+
+#define preempt_check_resched_context() \
+do { \
+       if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
+               preempt_schedule_context(); \
+} while (0)
+#else
+
+#define preempt_check_resched_context() preempt_check_resched()
+
+#endif /* CONFIG_CONTEXT_TRACKING */
+
 #else /* !CONFIG_PREEMPT */
 
 #define preempt_check_resched()                do { } while (0)
+#define preempt_check_resched_context()        do { } while (0)
 
 #endif /* CONFIG_PREEMPT */
 
@@ -88,7 +104,7 @@ do { \
 do { \
        preempt_enable_no_resched_notrace(); \
        barrier(); \
-       preempt_check_resched(); \
+       preempt_check_resched_context(); \
 } while (0)
 
 #else /* !CONFIG_PREEMPT_COUNT */
index 09a545a7dfa39bcd7f736f446358d4c3b112aae4..74575cbf2d6f579c317fec5f1f16e9d3793fab03 100644 (file)
@@ -35,6 +35,7 @@ struct splice_desc {
                void *data;             /* cookie */
        } u;
        loff_t pos;                     /* file position */
+       loff_t *opos;                   /* sendfile: output position */
        size_t num_spliced;             /* number of bytes already spliced */
        bool need_wakeup;               /* need to wake up writer */
 };
index 71a5782d8c592fc027cd1e0ce7c4c5a99787c11f..b1dd2db80076d87d77236b76e9314557a185ae5c 100644 (file)
@@ -34,7 +34,7 @@ static inline void vtime_user_exit(struct task_struct *tsk)
 }
 extern void vtime_guest_enter(struct task_struct *tsk);
 extern void vtime_guest_exit(struct task_struct *tsk);
-extern void vtime_init_idle(struct task_struct *tsk);
+extern void vtime_init_idle(struct task_struct *tsk, int cpu);
 #else
 static inline void vtime_account_irq_exit(struct task_struct *tsk)
 {
@@ -45,7 +45,7 @@ static inline void vtime_user_enter(struct task_struct *tsk) { }
 static inline void vtime_user_exit(struct task_struct *tsk) { }
 static inline void vtime_guest_enter(struct task_struct *tsk) { }
 static inline void vtime_guest_exit(struct task_struct *tsk) { }
-static inline void vtime_init_idle(struct task_struct *tsk) { }
+static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { }
 #endif
 
 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
index d3eef01da648d49387d6efe41bb2cae66bd6dac6..0f4555b2a31bdfc4a499df23f3b77de6a95769a2 100644 (file)
@@ -110,6 +110,8 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
                  struct v4l2_buffer *buf);
 int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
                   struct v4l2_buffer *buf);
+int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
+                        struct v4l2_create_buffers *create);
 
 int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
                   struct v4l2_exportbuffer *eb);
index 65349f07b8782a19f13014e66b8ff8ac0e7a5ecf..383f8231e43676b5c5d3ddcaca51298bd9f42aa3 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include <linux/context_tracking.h>
-#include <linux/kvm_host.h>
 #include <linux/rcupdate.h>
 #include <linux/sched.h>
 #include <linux/hardirq.h>
@@ -71,6 +70,46 @@ void user_enter(void)
        local_irq_restore(flags);
 }
 
+#ifdef CONFIG_PREEMPT
+/**
+ * preempt_schedule_context - preempt_schedule called by tracing
+ *
+ * The tracing infrastructure uses preempt_enable_notrace to prevent
+ * recursion and tracing preempt enabling caused by the tracing
+ * infrastructure itself. But as tracing can happen in areas coming
+ * from userspace or just about to enter userspace, a preempt enable
+ * can occur before user_exit() is called. This will cause the scheduler
+ * to be called when the system is still in usermode.
+ *
+ * To prevent this, the preempt_enable_notrace will use this function
+ * instead of preempt_schedule() to exit user context if needed before
+ * calling the scheduler.
+ */
+void __sched notrace preempt_schedule_context(void)
+{
+       struct thread_info *ti = current_thread_info();
+       enum ctx_state prev_ctx;
+
+       if (likely(ti->preempt_count || irqs_disabled()))
+               return;
+
+       /*
+        * Need to disable preemption in case user_exit() is traced
+        * and the tracer calls preempt_enable_notrace() causing
+        * an infinite recursion.
+        */
+       preempt_disable_notrace();
+       prev_ctx = exception_enter();
+       preempt_enable_no_resched_notrace();
+
+       preempt_schedule();
+
+       preempt_disable_notrace();
+       exception_exit(prev_ctx);
+       preempt_enable_notrace();
+}
+EXPORT_SYMBOL_GPL(preempt_schedule_context);
+#endif /* CONFIG_PREEMPT */
 
 /**
  * user_exit - Inform the context tracking that the CPU is
index d5585f5e038ee1080f17777792a6927d5897e5ea..e695c0a0bcb5c84e79ee93e80de57e4fbab69b33 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/cpu.h>
 #include <linux/tick.h>
 #include <linux/mm.h>
+#include <linux/stackprotector.h>
 
 #include <asm/tlb.h>
 
@@ -58,6 +59,7 @@ void __weak arch_cpu_idle_dead(void) { }
 void __weak arch_cpu_idle(void)
 {
        cpu_idle_force_poll = 1;
+       local_irq_enable();
 }
 
 /*
@@ -112,6 +114,21 @@ static void cpu_idle_loop(void)
 
 void cpu_startup_entry(enum cpuhp_state state)
 {
+       /*
+        * This #ifdef needs to die, but it's too late in the cycle to
+        * make this generic (arm and sh have never invoked the canary
+        * init for the non boot cpus!). Will be fixed in 3.11
+        */
+#ifdef CONFIG_X86
+       /*
+        * If we're the non-boot CPU, nothing set the stack canary up
+        * for us. The boot CPU already has it initialized but no harm
+        * in doing it again. This is a good place for updating it, as
+        * we wont ever return from this function (so the invalid
+        * canaries already on the stack wont ever trigger).
+        */
+       boot_init_stack_canary();
+#endif
        current_set_polling();
        arch_cpu_idle_prepare();
        cpu_idle_loop();
index 9dc297faf7c01b68cbb1a7a24444b99c300cb8a3..b391907d53520cb4a126bc8e3e0a2d5a64ade54d 100644 (file)
@@ -196,9 +196,6 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx,
 static void update_context_time(struct perf_event_context *ctx);
 static u64 perf_event_time(struct perf_event *event);
 
-static void ring_buffer_attach(struct perf_event *event,
-                              struct ring_buffer *rb);
-
 void __weak perf_event_print_debug(void)       { }
 
 extern __weak const char *perf_pmu_name(void)
@@ -2918,6 +2915,7 @@ static void free_event_rcu(struct rcu_head *head)
 }
 
 static void ring_buffer_put(struct ring_buffer *rb);
+static void ring_buffer_detach(struct perf_event *event, struct ring_buffer *rb);
 
 static void free_event(struct perf_event *event)
 {
@@ -2942,15 +2940,30 @@ static void free_event(struct perf_event *event)
                if (has_branch_stack(event)) {
                        static_key_slow_dec_deferred(&perf_sched_events);
                        /* is system-wide event */
-                       if (!(event->attach_state & PERF_ATTACH_TASK))
+                       if (!(event->attach_state & PERF_ATTACH_TASK)) {
                                atomic_dec(&per_cpu(perf_branch_stack_events,
                                                    event->cpu));
+                       }
                }
        }
 
        if (event->rb) {
-               ring_buffer_put(event->rb);
-               event->rb = NULL;
+               struct ring_buffer *rb;
+
+               /*
+                * Can happen when we close an event with re-directed output.
+                *
+                * Since we have a 0 refcount, perf_mmap_close() will skip
+                * over us; possibly making our ring_buffer_put() the last.
+                */
+               mutex_lock(&event->mmap_mutex);
+               rb = event->rb;
+               if (rb) {
+                       rcu_assign_pointer(event->rb, NULL);
+                       ring_buffer_detach(event, rb);
+                       ring_buffer_put(rb); /* could be last */
+               }
+               mutex_unlock(&event->mmap_mutex);
        }
 
        if (is_cgroup_event(event))
@@ -3188,30 +3201,13 @@ static unsigned int perf_poll(struct file *file, poll_table *wait)
        unsigned int events = POLL_HUP;
 
        /*
-        * Race between perf_event_set_output() and perf_poll(): perf_poll()
-        * grabs the rb reference but perf_event_set_output() overrides it.
-        * Here is the timeline for two threads T1, T2:
-        * t0: T1, rb = rcu_dereference(event->rb)
-        * t1: T2, old_rb = event->rb
-        * t2: T2, event->rb = new rb
-        * t3: T2, ring_buffer_detach(old_rb)
-        * t4: T1, ring_buffer_attach(rb1)
-        * t5: T1, poll_wait(event->waitq)
-        *
-        * To avoid this problem, we grab mmap_mutex in perf_poll()
-        * thereby ensuring that the assignment of the new ring buffer
-        * and the detachment of the old buffer appear atomic to perf_poll()
+        * Pin the event->rb by taking event->mmap_mutex; otherwise
+        * perf_event_set_output() can swizzle our rb and make us miss wakeups.
         */
        mutex_lock(&event->mmap_mutex);
-
-       rcu_read_lock();
-       rb = rcu_dereference(event->rb);
-       if (rb) {
-               ring_buffer_attach(event, rb);
+       rb = event->rb;
+       if (rb)
                events = atomic_xchg(&rb->poll, 0);
-       }
-       rcu_read_unlock();
-
        mutex_unlock(&event->mmap_mutex);
 
        poll_wait(file, &event->waitq, wait);
@@ -3521,16 +3517,12 @@ static void ring_buffer_attach(struct perf_event *event,
                return;
 
        spin_lock_irqsave(&rb->event_lock, flags);
-       if (!list_empty(&event->rb_entry))
-               goto unlock;
-
-       list_add(&event->rb_entry, &rb->event_list);
-unlock:
+       if (list_empty(&event->rb_entry))
+               list_add(&event->rb_entry, &rb->event_list);
        spin_unlock_irqrestore(&rb->event_lock, flags);
 }
 
-static void ring_buffer_detach(struct perf_event *event,
-                              struct ring_buffer *rb)
+static void ring_buffer_detach(struct perf_event *event, struct ring_buffer *rb)
 {
        unsigned long flags;
 
@@ -3549,13 +3541,10 @@ static void ring_buffer_wakeup(struct perf_event *event)
 
        rcu_read_lock();
        rb = rcu_dereference(event->rb);
-       if (!rb)
-               goto unlock;
-
-       list_for_each_entry_rcu(event, &rb->event_list, rb_entry)
-               wake_up_all(&event->waitq);
-
-unlock:
+       if (rb) {
+               list_for_each_entry_rcu(event, &rb->event_list, rb_entry)
+                       wake_up_all(&event->waitq);
+       }
        rcu_read_unlock();
 }
 
@@ -3584,18 +3573,10 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event)
 
 static void ring_buffer_put(struct ring_buffer *rb)
 {
-       struct perf_event *event, *n;
-       unsigned long flags;
-
        if (!atomic_dec_and_test(&rb->refcount))
                return;
 
-       spin_lock_irqsave(&rb->event_lock, flags);
-       list_for_each_entry_safe(event, n, &rb->event_list, rb_entry) {
-               list_del_init(&event->rb_entry);
-               wake_up_all(&event->waitq);
-       }
-       spin_unlock_irqrestore(&rb->event_lock, flags);
+       WARN_ON_ONCE(!list_empty(&rb->event_list));
 
        call_rcu(&rb->rcu_head, rb_free_rcu);
 }
@@ -3605,26 +3586,100 @@ static void perf_mmap_open(struct vm_area_struct *vma)
        struct perf_event *event = vma->vm_file->private_data;
 
        atomic_inc(&event->mmap_count);
+       atomic_inc(&event->rb->mmap_count);
 }
 
+/*
+ * A buffer can be mmap()ed multiple times; either directly through the same
+ * event, or through other events by use of perf_event_set_output().
+ *
+ * In order to undo the VM accounting done by perf_mmap() we need to destroy
+ * the buffer here, where we still have a VM context. This means we need
+ * to detach all events redirecting to us.
+ */
 static void perf_mmap_close(struct vm_area_struct *vma)
 {
        struct perf_event *event = vma->vm_file->private_data;
 
-       if (atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) {
-               unsigned long size = perf_data_size(event->rb);
-               struct user_struct *user = event->mmap_user;
-               struct ring_buffer *rb = event->rb;
+       struct ring_buffer *rb = event->rb;
+       struct user_struct *mmap_user = rb->mmap_user;
+       int mmap_locked = rb->mmap_locked;
+       unsigned long size = perf_data_size(rb);
+
+       atomic_dec(&rb->mmap_count);
+
+       if (!atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex))
+               return;
 
-               atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
-               vma->vm_mm->pinned_vm -= event->mmap_locked;
-               rcu_assign_pointer(event->rb, NULL);
-               ring_buffer_detach(event, rb);
+       /* Detach current event from the buffer. */
+       rcu_assign_pointer(event->rb, NULL);
+       ring_buffer_detach(event, rb);
+       mutex_unlock(&event->mmap_mutex);
+
+       /* If there's still other mmap()s of this buffer, we're done. */
+       if (atomic_read(&rb->mmap_count)) {
+               ring_buffer_put(rb); /* can't be last */
+               return;
+       }
+
+       /*
+        * No other mmap()s, detach from all other events that might redirect
+        * into the now unreachable buffer. Somewhat complicated by the
+        * fact that rb::event_lock otherwise nests inside mmap_mutex.
+        */
+again:
+       rcu_read_lock();
+       list_for_each_entry_rcu(event, &rb->event_list, rb_entry) {
+               if (!atomic_long_inc_not_zero(&event->refcount)) {
+                       /*
+                        * This event is en-route to free_event() which will
+                        * detach it and remove it from the list.
+                        */
+                       continue;
+               }
+               rcu_read_unlock();
+
+               mutex_lock(&event->mmap_mutex);
+               /*
+                * Check we didn't race with perf_event_set_output() which can
+                * swizzle the rb from under us while we were waiting to
+                * acquire mmap_mutex.
+                *
+                * If we find a different rb; ignore this event, a next
+                * iteration will no longer find it on the list. We have to
+                * still restart the iteration to make sure we're not now
+                * iterating the wrong list.
+                */
+               if (event->rb == rb) {
+                       rcu_assign_pointer(event->rb, NULL);
+                       ring_buffer_detach(event, rb);
+                       ring_buffer_put(rb); /* can't be last, we still have one */
+               }
                mutex_unlock(&event->mmap_mutex);
+               put_event(event);
 
-               ring_buffer_put(rb);
-               free_uid(user);
+               /*
+                * Restart the iteration; either we're on the wrong list or
+                * destroyed its integrity by doing a deletion.
+                */
+               goto again;
        }
+       rcu_read_unlock();
+
+       /*
+        * It could be there's still a few 0-ref events on the list; they'll
+        * get cleaned up by free_event() -- they'll also still have their
+        * ref on the rb and will free it whenever they are done with it.
+        *
+        * Aside from that, this buffer is 'fully' detached and unmapped,
+        * undo the VM accounting.
+        */
+
+       atomic_long_sub((size >> PAGE_SHIFT) + 1, &mmap_user->locked_vm);
+       vma->vm_mm->pinned_vm -= mmap_locked;
+       free_uid(mmap_user);
+
+       ring_buffer_put(rb); /* could be last */
 }
 
 static const struct vm_operations_struct perf_mmap_vmops = {
@@ -3674,12 +3729,24 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
                return -EINVAL;
 
        WARN_ON_ONCE(event->ctx->parent_ctx);
+again:
        mutex_lock(&event->mmap_mutex);
        if (event->rb) {
-               if (event->rb->nr_pages == nr_pages)
-                       atomic_inc(&event->rb->refcount);
-               else
+               if (event->rb->nr_pages != nr_pages) {
                        ret = -EINVAL;
+                       goto unlock;
+               }
+
+               if (!atomic_inc_not_zero(&event->rb->mmap_count)) {
+                       /*
+                        * Raced against perf_mmap_close() through
+                        * perf_event_set_output(). Try again, hope for better
+                        * luck.
+                        */
+                       mutex_unlock(&event->mmap_mutex);
+                       goto again;
+               }
+
                goto unlock;
        }
 
@@ -3720,12 +3787,16 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
                ret = -ENOMEM;
                goto unlock;
        }
-       rcu_assign_pointer(event->rb, rb);
+
+       atomic_set(&rb->mmap_count, 1);
+       rb->mmap_locked = extra;
+       rb->mmap_user = get_current_user();
 
        atomic_long_add(user_extra, &user->locked_vm);
-       event->mmap_locked = extra;
-       event->mmap_user = get_current_user();
-       vma->vm_mm->pinned_vm += event->mmap_locked;
+       vma->vm_mm->pinned_vm += extra;
+
+       ring_buffer_attach(event, rb);
+       rcu_assign_pointer(event->rb, rb);
 
        perf_event_update_userpage(event);
 
@@ -3734,7 +3805,11 @@ unlock:
                atomic_inc(&event->mmap_count);
        mutex_unlock(&event->mmap_mutex);
 
-       vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+       /*
+        * Since pinned accounting is per vm we cannot allow fork() to copy our
+        * vma.
+        */
+       vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP;
        vma->vm_ops = &perf_mmap_vmops;
 
        return ret;
@@ -6412,6 +6487,8 @@ set:
        if (atomic_read(&event->mmap_count))
                goto unlock;
 
+       old_rb = event->rb;
+
        if (output_event) {
                /* get the rb we want to redirect to */
                rb = ring_buffer_get(output_event);
@@ -6419,16 +6496,28 @@ set:
                        goto unlock;
        }
 
-       old_rb = event->rb;
-       rcu_assign_pointer(event->rb, rb);
        if (old_rb)
                ring_buffer_detach(event, old_rb);
+
+       if (rb)
+               ring_buffer_attach(event, rb);
+
+       rcu_assign_pointer(event->rb, rb);
+
+       if (old_rb) {
+               ring_buffer_put(old_rb);
+               /*
+                * Since we detached before setting the new rb, so that we
+                * could attach the new rb, we could have missed a wakeup.
+                * Provide it now.
+                */
+               wake_up_all(&event->waitq);
+       }
+
        ret = 0;
 unlock:
        mutex_unlock(&event->mmap_mutex);
 
-       if (old_rb)
-               ring_buffer_put(old_rb);
 out:
        return ret;
 }
index eb675c4d59dfd440b9f93d92226ee2dc5ffe8290..ca6599723be5624cdeb4a3cad5ef5dd10a4e1c7b 100644 (file)
@@ -31,6 +31,10 @@ struct ring_buffer {
        spinlock_t                      event_lock;
        struct list_head                event_list;
 
+       atomic_t                        mmap_count;
+       unsigned long                   mmap_locked;
+       struct user_struct              *mmap_user;
+
        struct perf_event_mmap_page     *user_page;
        void                            *data_pages[0];
 };
index 3fed7f0cbcdfe3d2149dd903e6912628ba58da95..bddf3b201a480015e2b1b15c217c43ea6796fcd0 100644 (file)
@@ -467,6 +467,7 @@ static struct kprobe *__kprobes get_optimized_kprobe(unsigned long addr)
 /* Optimization staging list, protected by kprobe_mutex */
 static LIST_HEAD(optimizing_list);
 static LIST_HEAD(unoptimizing_list);
+static LIST_HEAD(freeing_list);
 
 static void kprobe_optimizer(struct work_struct *work);
 static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer);
@@ -504,7 +505,7 @@ static __kprobes void do_optimize_kprobes(void)
  * Unoptimize (replace a jump with a breakpoint and remove the breakpoint
  * if need) kprobes listed on unoptimizing_list.
  */
-static __kprobes void do_unoptimize_kprobes(struct list_head *free_list)
+static __kprobes void do_unoptimize_kprobes(void)
 {
        struct optimized_kprobe *op, *tmp;
 
@@ -515,9 +516,9 @@ static __kprobes void do_unoptimize_kprobes(struct list_head *free_list)
        /* Ditto to do_optimize_kprobes */
        get_online_cpus();
        mutex_lock(&text_mutex);
-       arch_unoptimize_kprobes(&unoptimizing_list, free_list);
+       arch_unoptimize_kprobes(&unoptimizing_list, &freeing_list);
        /* Loop free_list for disarming */
-       list_for_each_entry_safe(op, tmp, free_list, list) {
+       list_for_each_entry_safe(op, tmp, &freeing_list, list) {
                /* Disarm probes if marked disabled */
                if (kprobe_disabled(&op->kp))
                        arch_disarm_kprobe(&op->kp);
@@ -536,11 +537,11 @@ static __kprobes void do_unoptimize_kprobes(struct list_head *free_list)
 }
 
 /* Reclaim all kprobes on the free_list */
-static __kprobes void do_free_cleaned_kprobes(struct list_head *free_list)
+static __kprobes void do_free_cleaned_kprobes(void)
 {
        struct optimized_kprobe *op, *tmp;
 
-       list_for_each_entry_safe(op, tmp, free_list, list) {
+       list_for_each_entry_safe(op, tmp, &freeing_list, list) {
                BUG_ON(!kprobe_unused(&op->kp));
                list_del_init(&op->list);
                free_aggr_kprobe(&op->kp);
@@ -556,8 +557,6 @@ static __kprobes void kick_kprobe_optimizer(void)
 /* Kprobe jump optimizer */
 static __kprobes void kprobe_optimizer(struct work_struct *work)
 {
-       LIST_HEAD(free_list);
-
        mutex_lock(&kprobe_mutex);
        /* Lock modules while optimizing kprobes */
        mutex_lock(&module_mutex);
@@ -566,7 +565,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work)
         * Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed)
         * kprobes before waiting for quiesence period.
         */
-       do_unoptimize_kprobes(&free_list);
+       do_unoptimize_kprobes();
 
        /*
         * Step 2: Wait for quiesence period to ensure all running interrupts
@@ -581,7 +580,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work)
        do_optimize_kprobes();
 
        /* Step 4: Free cleaned kprobes after quiesence period */
-       do_free_cleaned_kprobes(&free_list);
+       do_free_cleaned_kprobes();
 
        mutex_unlock(&module_mutex);
        mutex_unlock(&kprobe_mutex);
@@ -723,8 +722,19 @@ static void __kprobes kill_optimized_kprobe(struct kprobe *p)
        if (!list_empty(&op->list))
                /* Dequeue from the (un)optimization queue */
                list_del_init(&op->list);
-
        op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED;
+
+       if (kprobe_unused(p)) {
+               /* Enqueue if it is unused */
+               list_add(&op->list, &freeing_list);
+               /*
+                * Remove unused probes from the hash list. After waiting
+                * for synchronization, this probe is reclaimed.
+                * (reclaiming is done by do_free_cleaned_kprobes().)
+                */
+               hlist_del_rcu(&op->kp.hlist);
+       }
+
        /* Don't touch the code, because it is already freed. */
        arch_remove_optimized_kprobe(op);
 }
index eb911dbce2679d29fea7226084be73d34a7336dd..322ea8e93e4ba36c11c0348a34c12e58c983da03 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sort.h>
-
+#include <linux/string.h>
 #include <linux/range.h>
 
 int add_range(struct range *range, int az, int nr_range, u64 start, u64 end)
@@ -32,9 +32,8 @@ int add_range_with_merge(struct range *range, int az, int nr_range,
        if (start >= end)
                return nr_range;
 
-       /* Try to merge it with old one: */
+       /* get new start/end: */
        for (i = 0; i < nr_range; i++) {
-               u64 final_start, final_end;
                u64 common_start, common_end;
 
                if (!range[i].end)
@@ -45,14 +44,16 @@ int add_range_with_merge(struct range *range, int az, int nr_range,
                if (common_start > common_end)
                        continue;
 
-               final_start = min(range[i].start, start);
-               final_end = max(range[i].end, end);
+               /* new start/end, will add it back at last */
+               start = min(range[i].start, start);
+               end = max(range[i].end, end);
 
-               /* clear it and add it back for further merge */
-               range[i].start = 0;
-               range[i].end =  0;
-               return add_range_with_merge(range, az, nr_range,
-                       final_start, final_end);
+               memmove(&range[i], &range[i + 1],
+                       (nr_range - (i + 1)) * sizeof(range[i]));
+               range[nr_range - 1].start = 0;
+               range[nr_range - 1].end   = 0;
+               nr_range--;
+               i--;
        }
 
        /* Need to add it: */
index 58453b8272fdbab9422bf6c040683397c269ba82..e8b335016c526594cd910a030c962099907d8518 100644 (file)
@@ -633,7 +633,19 @@ void wake_up_nohz_cpu(int cpu)
 static inline bool got_nohz_idle_kick(void)
 {
        int cpu = smp_processor_id();
-       return idle_cpu(cpu) && test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu));
+
+       if (!test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu)))
+               return false;
+
+       if (idle_cpu(cpu) && !need_resched())
+               return true;
+
+       /*
+        * We can't run Idle Load Balance on this CPU for this time so we
+        * cancel it and clear NOHZ_BALANCE_KICK
+        */
+       clear_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu));
+       return false;
 }
 
 #else /* CONFIG_NO_HZ_COMMON */
@@ -1393,8 +1405,9 @@ static void sched_ttwu_pending(void)
 
 void scheduler_ipi(void)
 {
-       if (llist_empty(&this_rq()->wake_list) && !got_nohz_idle_kick()
-           && !tick_nohz_full_cpu(smp_processor_id()))
+       if (llist_empty(&this_rq()->wake_list)
+                       && !tick_nohz_full_cpu(smp_processor_id())
+                       && !got_nohz_idle_kick())
                return;
 
        /*
@@ -1417,7 +1430,7 @@ void scheduler_ipi(void)
        /*
         * Check if someone kicked us for doing the nohz idle load balance.
         */
-       if (unlikely(got_nohz_idle_kick() && !need_resched())) {
+       if (unlikely(got_nohz_idle_kick())) {
                this_rq()->idle_balance = 1;
                raise_softirq_irqoff(SCHED_SOFTIRQ);
        }
@@ -4745,7 +4758,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
         */
        idle->sched_class = &idle_sched_class;
        ftrace_graph_init_idle_task(idle, cpu);
-       vtime_init_idle(idle);
+       vtime_init_idle(idle, cpu);
 #if defined(CONFIG_SMP)
        sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
 #endif
index cc2dc3eea8a3a55d7c86cc9896bfe9d235c18cab..b5ccba22603b51a92c2aa1f0ef647a878dd4e2c3 100644 (file)
@@ -747,17 +747,17 @@ void arch_vtime_task_switch(struct task_struct *prev)
 
        write_seqlock(&current->vtime_seqlock);
        current->vtime_snap_whence = VTIME_SYS;
-       current->vtime_snap = sched_clock();
+       current->vtime_snap = sched_clock_cpu(smp_processor_id());
        write_sequnlock(&current->vtime_seqlock);
 }
 
-void vtime_init_idle(struct task_struct *t)
+void vtime_init_idle(struct task_struct *t, int cpu)
 {
        unsigned long flags;
 
        write_seqlock_irqsave(&t->vtime_seqlock, flags);
        t->vtime_snap_whence = VTIME_SYS;
-       t->vtime_snap = sched_clock();
+       t->vtime_snap = sched_clock_cpu(cpu);
        write_sequnlock_irqrestore(&t->vtime_seqlock, flags);
 }
 
index 0c739423b0f9c5728de497e5391730e417536e61..b4c245580b792df082e2b4d2b9601d5b5e6565dc 100644 (file)
@@ -698,10 +698,6 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
 
                bc->event_handler = tick_handle_oneshot_broadcast;
 
-               /* Take the do_timer update */
-               if (!tick_nohz_full_cpu(cpu))
-                       tick_do_timer_cpu = cpu;
-
                /*
                 * We must be careful here. There might be other CPUs
                 * waiting for periodic broadcast. We need to set the
index f4208138fbf4cd1a72791f99c31adcbea9180e3e..0cf1c14531817eacb61eae48f6f76a45a0cc8027 100644 (file)
@@ -306,7 +306,7 @@ static int __cpuinit tick_nohz_cpu_down_callback(struct notifier_block *nfb,
                 * we can't safely shutdown that CPU.
                 */
                if (have_nohz_full_mask && tick_do_timer_cpu == cpu)
-                       return -EINVAL;
+                       return NOTIFY_BAD;
                break;
        }
        return NOTIFY_OK;
index 1ad92b46753edfe8d9f54fae81c5f3aa15b34110..081b4d654ed6d68f5538a831719de7331110fa2f 100644 (file)
@@ -1621,6 +1621,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
 {
        return __offline_pages(start_pfn, start_pfn + nr_pages, 120 * HZ);
 }
+#endif /* CONFIG_MEMORY_HOTREMOVE */
 
 /**
  * walk_memory_range - walks through all mem sections in [start_pfn, end_pfn)
@@ -1634,7 +1635,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
  *
  * Returns the return value of func.
  */
-static int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
+int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
                void *arg, int (*func)(struct memory_block *, void *))
 {
        struct memory_block *mem = NULL;
@@ -1671,24 +1672,7 @@ static int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
        return 0;
 }
 
-/**
- * offline_memory_block_cb - callback function for offlining memory block
- * @mem: the memory block to be offlined
- * @arg: buffer to hold error msg
- *
- * Always return 0, and put the error msg in arg if any.
- */
-static int offline_memory_block_cb(struct memory_block *mem, void *arg)
-{
-       int *ret = arg;
-       int error = offline_memory_block(mem);
-
-       if (error != 0 && *ret == 0)
-               *ret = error;
-
-       return 0;
-}
-
+#ifdef CONFIG_MEMORY_HOTREMOVE
 static int is_memblock_offlined_cb(struct memory_block *mem, void *arg)
 {
        int ret = !is_memblock_offlined(mem);
@@ -1814,54 +1798,22 @@ void try_offline_node(int nid)
 }
 EXPORT_SYMBOL(try_offline_node);
 
-int __ref remove_memory(int nid, u64 start, u64 size)
+void __ref remove_memory(int nid, u64 start, u64 size)
 {
-       unsigned long start_pfn, end_pfn;
-       int ret = 0;
-       int retry = 1;
-
-       start_pfn = PFN_DOWN(start);
-       end_pfn = PFN_UP(start + size - 1);
-
-       /*
-        * When CONFIG_MEMCG is on, one memory block may be used by other
-        * blocks to store page cgroup when onlining pages. But we don't know
-        * in what order pages are onlined. So we iterate twice to offline
-        * memory:
-        * 1st iterate: offline every non primary memory block.
-        * 2nd iterate: offline primary (i.e. first added) memory block.
-        */
-repeat:
-       walk_memory_range(start_pfn, end_pfn, &ret,
-                         offline_memory_block_cb);
-       if (ret) {
-               if (!retry)
-                       return ret;
-
-               retry = 0;
-               ret = 0;
-               goto repeat;
-       }
+       int ret;
 
        lock_memory_hotplug();
 
        /*
-        * we have offlined all memory blocks like this:
-        *   1. lock memory hotplug
-        *   2. offline a memory block
-        *   3. unlock memory hotplug
-        *
-        * repeat step1-3 to offline the memory block. All memory blocks
-        * must be offlined before removing memory. But we don't hold the
-        * lock in the whole operation. So we should check whether all
-        * memory blocks are offlined.
+        * All memory blocks must be offlined before removing memory.  Check
+        * whether all memory blocks in question are offline and trigger a BUG()
+        * if this is not the case.
         */
-
-       ret = walk_memory_range(start_pfn, end_pfn, NULL,
+       ret = walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL,
                                is_memblock_offlined_cb);
        if (ret) {
                unlock_memory_hotplug();
-               return ret;
+               BUG();
        }
 
        /* remove memmap entry */
@@ -1872,17 +1824,6 @@ repeat:
        try_offline_node(nid);
 
        unlock_memory_hotplug();
-
-       return 0;
 }
-#else
-int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
-{
-       return -EINVAL;
-}
-int remove_memory(int nid, u64 start, u64 size)
-{
-       return -EINVAL;
-}
-#endif /* CONFIG_MEMORY_HOTREMOVE */
 EXPORT_SYMBOL_GPL(remove_memory);
+#endif /* CONFIG_MEMORY_HOTREMOVE */
index ff3218a0f5e14029aab5c23dd323f447d2a86173..2d414508e9ecb32e64df911c72bf0dd2682b87b8 100644 (file)
@@ -373,8 +373,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
 {
        int index;
 
-       if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE))
+       if (size > KMALLOC_MAX_SIZE) {
+               WARN_ON_ONCE(!(flags & __GFP_NOWARN));
                return NULL;
+       }
 
        if (size <= 192) {
                if (!size)
index bd8d46cca2b3132b71a0fc5da99f31f0763d3cc9..cccaf9c7a7bbd29b195b6ae475c2479e528bdd86 100644 (file)
@@ -58,6 +58,7 @@ enum {
        CS420X_GPIO_23,
        CS420X_MBP101,
        CS420X_MBP81,
+       CS420X_MBA42,
        CS420X_AUTO,
        /* aliases */
        CS420X_IMAC27_122 = CS420X_GPIO_23,
@@ -346,6 +347,7 @@ static const struct hda_model_fixup cs420x_models[] = {
        { .id = CS420X_APPLE, .name = "apple" },
        { .id = CS420X_MBP101, .name = "mbp101" },
        { .id = CS420X_MBP81, .name = "mbp81" },
+       { .id = CS420X_MBA42, .name = "mba42" },
        {}
 };
 
@@ -361,6 +363,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = {
        SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81),
        SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
        SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
+       SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42),
        SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
        {} /* terminator */
 };
@@ -414,6 +417,20 @@ static const struct hda_pintbl mbp101_pincfgs[] = {
        {} /* terminator */
 };
 
+static const struct hda_pintbl mba42_pincfgs[] = {
+       { 0x09, 0x012b4030 }, /* HP */
+       { 0x0a, 0x400000f0 },
+       { 0x0b, 0x90100120 }, /* speaker */
+       { 0x0c, 0x400000f0 },
+       { 0x0d, 0x90a00110 }, /* mic */
+       { 0x0e, 0x400000f0 },
+       { 0x0f, 0x400000f0 },
+       { 0x10, 0x400000f0 },
+       { 0x12, 0x400000f0 },
+       { 0x15, 0x400000f0 },
+       {} /* terminator */
+};
+
 static void cs420x_fixup_gpio_13(struct hda_codec *codec,
                                 const struct hda_fixup *fix, int action)
 {
@@ -482,6 +499,12 @@ static const struct hda_fixup cs420x_fixups[] = {
                .chained = true,
                .chain_id = CS420X_GPIO_13,
        },
+       [CS420X_MBA42] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = mba42_pincfgs,
+               .chained = true,
+               .chain_id = CS420X_GPIO_13,
+       },
 };
 
 static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid)
index 02e22b4458d2ed5222c5985ec8bb2593c4a5c405..403010c9e82ea610125c82811e7f1f4ea3d27aac 100644 (file)
@@ -3483,6 +3483,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x05ca, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05cb, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05de, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x05e0, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05e9, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05ea, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05eb, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -3494,6 +3495,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x05f8, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
        SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
@@ -3596,6 +3599,8 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
        {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
        {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
+       {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
+       {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
        {}
 };
 
@@ -4275,6 +4280,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
        {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
        {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
        {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
+       {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
        {}
 };
 
index 1a033177b83f63f94d1be2262ccc0553ac9b8034..64952e2d3ed1e94a12ad9e593a15298e8eaceee7 100644 (file)
@@ -147,14 +147,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
                return -EINVAL;
        }
 
+       alts = &iface->altsetting[0];
+       altsd = get_iface_desc(alts);
+
+       /*
+        * Android with both accessory and audio interfaces enabled gets the
+        * interface numbers wrong.
+        */
+       if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) ||
+            chip->usb_id == USB_ID(0x18d1, 0x2d05)) &&
+           interface == 0 &&
+           altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
+           altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) {
+               interface = 2;
+               iface = usb_ifnum_to_if(dev, interface);
+               if (!iface)
+                       return -EINVAL;
+               alts = &iface->altsetting[0];
+               altsd = get_iface_desc(alts);
+       }
+
        if (usb_interface_claimed(iface)) {
                snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n",
                                                dev->devnum, ctrlif, interface);
                return -EINVAL;
        }
 
-       alts = &iface->altsetting[0];
-       altsd = get_iface_desc(alts);
        if ((altsd->bInterfaceClass == USB_CLASS_AUDIO ||
             altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) &&
            altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) {
index e5c7f9f20fddbea288de5287ab6923314986570a..d5438083fd6a8072c20275778f1f3b9fa0a42517 100644 (file)
@@ -885,6 +885,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
 
        case USB_ID(0x046d, 0x0808):
        case USB_ID(0x046d, 0x0809):
+       case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
        case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
        case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
        case USB_ID(0x046d, 0x0991):