Merge branches 'acpi-numa', 'acpi-tables' and 'acpi-osi'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 16 May 2016 14:45:25 +0000 (16:45 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 16 May 2016 14:45:25 +0000 (16:45 +0200)
* acpi-numa:
  ACPI / SRAT: fix SRAT parsing order with both LAPIC and X2APIC present

* acpi-tables:
  ACPI / tables: Fix DSDT override mechanism
  ACPI / tables: Convert initrd table override to table upgrade mechanism
  ACPI / x86: Cleanup initrd related code
  ACPI / tables: Move table override mechanisms to tables.c

* acpi-osi:
  ACPI / osi: Collect _OSI handling into one single file
  ACPI / osi: Cleanup coding style issues before creating a separate OSI source file
  ACPI / osi: Cleanup OSI handling code to use bool
  ACPI / osi: Fix default _OSI(Darwin) support
  ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=!
  ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
  ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings

Conflicts:
drivers/acpi/internal.h

361 files changed:
.mailmap
Documentation/acpi/initrd_table_override.txt
Documentation/devicetree/bindings/ata/ahci-platform.txt
Documentation/devicetree/bindings/net/cpsw.txt
Documentation/networking/altera_tse.txt
Documentation/networking/ipvlan.txt
Documentation/networking/pktgen.txt
Documentation/networking/vrf.txt
Documentation/networking/xfrm_sync.txt
MAINTAINERS
Makefile
arch/arc/Kconfig
arch/arc/include/asm/io.h
arch/arc/include/asm/mmzone.h [new file with mode: 0644]
arch/arc/include/asm/page.h
arch/arc/include/asm/pgtable.h
arch/arc/mm/init.c
arch/arm/boot/dts/omap3-n900.dts
arch/arm/boot/dts/omap34xx.dtsi
arch/arm/boot/dts/omap5-board-common.dtsi
arch/arm/boot/dts/omap5-cm-t54.dts
arch/arm/boot/dts/omap5.dtsi
arch/arm/boot/dts/qcom-apq8064.dtsi
arch/arm/boot/dts/sun8i-q8-common.dtsi
arch/arm/include/asm/domain.h
arch/arm/kernel/head-nommu.S
arch/arm/kvm/mmu.c
arch/arm/mach-davinci/board-mityomapl138.c
arch/arm/mach-davinci/common.c
arch/arm/mach-exynos/pm_domains.c
arch/arm/mach-socfpga/headsmp.S
arch/arm/mm/nommu.c
arch/arm64/boot/dts/renesas/r8a7795.dtsi
arch/parisc/kernel/syscall.S
arch/powerpc/include/asm/word-at-a-time.h
arch/sparc/configs/sparc32_defconfig
arch/sparc/configs/sparc64_defconfig
arch/sparc/include/asm/spitfire.h
arch/sparc/include/uapi/asm/unistd.h
arch/sparc/kernel/cherrs.S
arch/sparc/kernel/cpu.c
arch/sparc/kernel/cpumap.c
arch/sparc/kernel/fpu_traps.S
arch/sparc/kernel/head_64.S
arch/sparc/kernel/misctrap.S
arch/sparc/kernel/pci.c
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/spiterrs.S
arch/sparc/kernel/systbls_32.S
arch/sparc/kernel/systbls_64.S
arch/sparc/kernel/utrap.S
arch/sparc/kernel/vio.c
arch/sparc/kernel/vmlinux.lds.S
arch/sparc/kernel/winfixup.S
arch/sparc/mm/init_64.c
arch/x86/events/amd/iommu.c
arch/x86/events/intel/core.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/setup.c
arch/x86/kernel/sysfb_efi.c
arch/x86/kernel/tsc_msr.c
arch/x86/kvm/mmu.c
arch/x86/platform/efi/efi-bgrt.c
arch/x86/platform/efi/quirks.c
drivers/acpi/Kconfig
drivers/acpi/Makefile
drivers/acpi/acpi_amba.c
drivers/acpi/acpi_apd.c
drivers/acpi/acpi_video.c
drivers/acpi/acpica/Makefile
drivers/acpi/acpica/acdebug.h
drivers/acpi/acpica/acevents.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/acinterp.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acparser.h
drivers/acpi/acpica/acpredef.h
drivers/acpi/acpica/acresrc.h
drivers/acpi/acpica/acstruct.h
drivers/acpi/acpica/actables.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/dbcmds.c
drivers/acpi/acpica/dbconvert.c
drivers/acpi/acpica/dbexec.c
drivers/acpi/acpica/dbinput.c
drivers/acpi/acpica/dbnames.c
drivers/acpi/acpica/dbutils.c
drivers/acpi/acpica/dbxface.c
drivers/acpi/acpica/dscontrol.c
drivers/acpi/acpica/dsinit.c
drivers/acpi/acpica/dsmethod.c
drivers/acpi/acpica/dsutils.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/dswload2.c
drivers/acpi/acpica/dswstate.c
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evgpeblk.c
drivers/acpi/acpica/evgpeutil.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/exconcat.c [new file with mode: 0644]
drivers/acpi/acpica/exconfig.c
drivers/acpi/acpica/exconvrt.c
drivers/acpi/acpica/excreate.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/exfield.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exmisc.c
drivers/acpi/acpica/exnames.c
drivers/acpi/acpica/exoparg3.c
drivers/acpi/acpica/exoparg6.c
drivers/acpi/acpica/exregion.c
drivers/acpi/acpica/exresnte.c
drivers/acpi/acpica/exresolv.c
drivers/acpi/acpica/exresop.c
drivers/acpi/acpica/exstorob.c
drivers/acpi/acpica/exutils.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/acpica/hwregs.c
drivers/acpi/acpica/hwxface.c
drivers/acpi/acpica/nsaccess.c
drivers/acpi/acpica/nsconvert.c
drivers/acpi/acpica/nsdump.c
drivers/acpi/acpica/nsinit.c
drivers/acpi/acpica/nsload.c
drivers/acpi/acpica/nsnames.c
drivers/acpi/acpica/nsobject.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/nsxfname.c
drivers/acpi/acpica/nsxfobj.c
drivers/acpi/acpica/psargs.c
drivers/acpi/acpica/psopinfo.c
drivers/acpi/acpica/psparse.c
drivers/acpi/acpica/psutils.c
drivers/acpi/acpica/psxface.c
drivers/acpi/acpica/rscalc.c
drivers/acpi/acpica/rscreate.c
drivers/acpi/acpica/rsdump.c
drivers/acpi/acpica/rsdumpinfo.c
drivers/acpi/acpica/rsmisc.c
drivers/acpi/acpica/rsserial.c
drivers/acpi/acpica/rsutils.c
drivers/acpi/acpica/rsxface.c
drivers/acpi/acpica/tbdata.c
drivers/acpi/acpica/tbfadt.c
drivers/acpi/acpica/tbfind.c
drivers/acpi/acpica/tbinstal.c
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/tbxface.c
drivers/acpi/acpica/tbxfload.c
drivers/acpi/acpica/tbxfroot.c
drivers/acpi/acpica/utalloc.c
drivers/acpi/acpica/utascii.c [new file with mode: 0644]
drivers/acpi/acpica/utbuffer.c
drivers/acpi/acpica/utcache.c
drivers/acpi/acpica/utcopy.c
drivers/acpi/acpica/utdebug.c
drivers/acpi/acpica/utdecode.c
drivers/acpi/acpica/uteval.c
drivers/acpi/acpica/utglobal.c
drivers/acpi/acpica/utids.c
drivers/acpi/acpica/utmath.c
drivers/acpi/acpica/utmisc.c
drivers/acpi/acpica/utnonansi.c
drivers/acpi/acpica/utobject.c
drivers/acpi/acpica/utosi.c
drivers/acpi/acpica/utownerid.c
drivers/acpi/acpica/utprint.c
drivers/acpi/acpica/utstring.c
drivers/acpi/acpica/uttrack.c
drivers/acpi/acpica/utxface.c
drivers/acpi/bus.c
drivers/acpi/ec.c
drivers/acpi/evged.c [new file with mode: 0644]
drivers/acpi/internal.h
drivers/acpi/nfit.c
drivers/acpi/numa.c
drivers/acpi/osl.c
drivers/acpi/sleep.c
drivers/acpi/tables.c
drivers/acpi/video_detect.c
drivers/ata/Kconfig
drivers/ata/Makefile
drivers/ata/ahci_platform.c
drivers/ata/ahci_seattle.c [new file with mode: 0644]
drivers/ata/libahci.c
drivers/base/power/opp/core.c
drivers/base/property.c
drivers/clk/imx/clk-imx6q.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/intel_pstate.c
drivers/cpufreq/sti-cpufreq.c
drivers/cpuidle/cpuidle-arm.c
drivers/firmware/qemu_fw_cfg.c
drivers/gpio/gpio-rcar.c
drivers/gpio/gpiolib-acpi.c
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/radeon/atombios_encoders.c
drivers/gpu/ipu-v3/ipu-common.c
drivers/hid/hid-ids.h
drivers/hid/usbhid/hid-quirks.c
drivers/hid/wacom_wac.c
drivers/hv/ring_buffer.c
drivers/iio/adc/at91-sama5d2_adc.c
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
drivers/iio/magnetometer/ak8975.c
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/input/misc/twl6040-vibra.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/zforce_ts.c
drivers/md/md.c
drivers/md/raid0.c
drivers/md/raid5.c
drivers/media/media-device.c
drivers/media/platform/exynos4-is/media-dev.c
drivers/media/platform/s3c-camif/camif-core.c
drivers/misc/mic/vop/vop_vringh.c
drivers/net/dsa/mv88e6xxx.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/cadence/macb.c
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/mellanox/mlx5/core/Kconfig
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/uar.c
drivers/net/ethernet/mellanox/mlx5/core/vxlan.c
drivers/net/ethernet/mellanox/mlx5/core/vxlan.h
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/cpsw.h
drivers/net/ethernet/ti/davinci_emac.c
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
drivers/net/phy/at803x.c
drivers/net/usb/lan78xx.c
drivers/net/usb/pegasus.c
drivers/net/usb/smsc75xx.c
drivers/net/usb/smsc95xx.c
drivers/net/wireless/ath/ath9k/ar5008_phy.c
drivers/net/wireless/ath/ath9k/ar9002_phy.c
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
drivers/nvdimm/pmem.c
drivers/nvmem/mxs-ocotp.c
drivers/rapidio/devices/rio_mport_cdev.c
drivers/thermal/Kconfig
drivers/thermal/int340x_thermal/Kconfig [new file with mode: 0644]
drivers/thermal/int340x_thermal/Makefile
drivers/thermal/int340x_thermal/int3406_thermal.c [new file with mode: 0644]
drivers/usb/core/port.c
drivers/usb/core/usb.c
drivers/usb/musb/jz4740.c
drivers/usb/musb/musb_gadget.c
drivers/usb/musb/musb_host.c
drivers/usb/serial/cp210x.c
drivers/video/backlight/backlight.c
drivers/virtio/virtio_ring.c
drivers/xen/balloon.c
drivers/xen/evtchn.c
fs/fuse/file.c
fs/pnode.c
fs/proc/base.c
fs/udf/super.c
fs/udf/udfdecl.h
fs/udf/unicode.c
include/acpi/acpi_bus.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acrestyp.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actbl3.h
include/acpi/actypes.h
include/acpi/platform/acenv.h
include/acpi/platform/acmsvcex.h [deleted file]
include/acpi/platform/acwinex.h [deleted file]
include/acpi/video.h
include/linux/acpi.h
include/linux/backlight.h
include/linux/bpf.h
include/linux/hash.h
include/linux/if_ether.h
include/linux/net.h
include/linux/netdevice.h
include/linux/of.h
include/linux/page-flags.h
include/linux/rio_mport_cdev.h [deleted file]
include/linux/swap.h
include/net/vxlan.h
include/uapi/asm-generic/unistd.h
include/uapi/linux/rio_mport_cdev.h [new file with mode: 0644]
include/uapi/linux/swab.h
include/xen/page.h
kernel/bpf/inode.c
kernel/bpf/syscall.c
kernel/bpf/verifier.c
kernel/sched/core.c
kernel/trace/trace_events.c
lib/stackdepot.c
mm/compaction.c
mm/huge_memory.c
mm/memory.c
mm/page-writeback.c
mm/page_alloc.c
mm/zswap.c
net/batman-adv/bat_v.c
net/batman-adv/distributed-arp-table.c
net/batman-adv/hard-interface.c
net/batman-adv/originator.c
net/batman-adv/routing.c
net/batman-adv/send.c
net/batman-adv/soft-interface.c
net/batman-adv/translation-table.c
net/batman-adv/types.h
net/core/dev.c
net/ipv4/inet_hashtables.c
net/ipv4/ip_gre.c
net/ipv4/ip_tunnel.c
net/ipv6/ila/ila_lwt.c
net/l2tp/l2tp_core.c
net/mac80211/iface.c
net/rds/tcp.c
net/rds/tcp.h
net/rds/tcp_connect.c
net/rds/tcp_listen.c
net/sched/sch_netem.c
net/tipc/node.c
samples/bpf/trace_output_kern.c
scripts/mod/file2alias.c
security/integrity/ima/ima_policy.c
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
tools/power/acpi/os_specific/service_layers/osunixmap.c
tools/power/acpi/os_specific/service_layers/osunixxf.c
tools/power/acpi/tools/acpidump/Makefile
tools/power/acpi/tools/acpidump/apdump.c
tools/power/acpi/tools/acpidump/apmain.c

index c156a8b4d845cd3fbf29bbcb43213066dafd046b..08b80428f5837001940381417e0b1d0be1125b2c 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -69,6 +69,7 @@ Jean Tourrilhes <jt@hpl.hp.com>
 Jeff Garzik <jgarzik@pretzel.yyz.us>
 Jens Axboe <axboe@suse.de>
 Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
+John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
 John Stultz <johnstul@us.ibm.com>
 <josh@joshtriplett.org> <josh@freedesktop.org>
 <josh@joshtriplett.org> <josh@kernel.org>
index 35c3f5415476dcebd3e3397f719dcc8de5cc41a2..eb651a6aa28505769a38f68fa253e2a56be3ddef 100644 (file)
@@ -1,5 +1,5 @@
-Overriding ACPI tables via initrd
-=================================
+Upgrading ACPI tables via initrd
+================================
 
 1) Introduction (What is this about)
 2) What is this for
@@ -9,12 +9,14 @@ Overriding ACPI tables via initrd
 1) What is this about
 ---------------------
 
-If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible to
-override nearly any ACPI table provided by the BIOS with an instrumented,
-modified one.
+If the ACPI_TABLE_UPGRADE compile option is true, it is possible to
+upgrade the ACPI execution environment that is defined by the ACPI tables
+via upgrading the ACPI tables provided by the BIOS with an instrumented,
+modified, more recent version one, or installing brand new ACPI tables.
 
-For a full list of ACPI tables that can be overridden, take a look at
-the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in drivers/acpi/osl.c
+For a full list of ACPI tables that can be upgraded/installed, take a look
+at the char *table_sigs[MAX_ACPI_SIGNATURE]; definition in
+drivers/acpi/tables.c.
 All ACPI tables iasl (Intel's ACPI compiler and disassembler) knows should
 be overridable, except:
    - ACPI_SIG_RSDP (has a signature of 6 bytes)
@@ -25,17 +27,20 @@ Both could get implemented as well.
 2) What is this for
 -------------------
 
-Please keep in mind that this is a debug option.
-ACPI tables should not get overridden for productive use.
-If BIOS ACPI tables are overridden the kernel will get tainted with the
-TAINT_OVERRIDDEN_ACPI_TABLE flag.
-Complain to your platform/BIOS vendor if you find a bug which is so sever
-that a workaround is not accepted in the Linux kernel.
+Complain to your platform/BIOS vendor if you find a bug which is so severe
+that a workaround is not accepted in the Linux kernel. And this facility
+allows you to upgrade the buggy tables before your platform/BIOS vendor
+releases an upgraded BIOS binary.
 
-Still, it can and should be enabled in any kernel, because:
-  - There is no functional change with not instrumented initrds
-  - It provides a powerful feature to easily debug and test ACPI BIOS table
-    compatibility with the Linux kernel.
+This facility can be used by platform/BIOS vendors to provide a Linux
+compatible environment without modifying the underlying platform firmware.
+
+This facility also provides a powerful feature to easily debug and test
+ACPI BIOS table compatibility with the Linux kernel by modifying old
+platform provided ACPI tables or inserting new ACPI tables.
+
+It can and should be enabled in any kernel because there is no functional
+change with not instrumented initrds.
 
 
 3) How does it work
@@ -50,23 +55,31 @@ iasl -d *.dat
 # For example add this statement into a _PRT (PCI Routing Table) function
 # of the DSDT:
 Store("HELLO WORLD", debug)
+# And increase the OEM Revision. For example, before modification:
+DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000000)
+# After modification:
+DefinitionBlock ("DSDT.aml", "DSDT", 2, "INTEL ", "TEMPLATE", 0x00000001)
 iasl -sa dsdt.dsl
 # Add the raw ACPI tables to an uncompressed cpio archive.
-# They must be put into a /kernel/firmware/acpi directory inside the
-# cpio archive.
-# The uncompressed cpio archive must be the first.
-# Other, typically compressed cpio archives, must be
-# concatenated on top of the uncompressed one.
+# They must be put into a /kernel/firmware/acpi directory inside the cpio
+# archive. Note that if the table put here matches a platform table
+# (similar Table Signature, and similar OEMID, and similar OEM Table ID)
+# with a more recent OEM Revision, the platform table will be upgraded by
+# this table. If the table put here doesn't match a platform table
+# (dissimilar Table Signature, or dissimilar OEMID, or dissimilar OEM Table
+# ID), this table will be appended.
 mkdir -p kernel/firmware/acpi
 cp dsdt.aml kernel/firmware/acpi
-# A maximum of: #define ACPI_OVERRIDE_TABLES 10
-# tables are  currently allowed (see osl.c):
+# A maximum of "NR_ACPI_INITRD_TABLES (64)" tables are currently allowed
+# (see osl.c):
 iasl -sa facp.dsl
 iasl -sa ssdt1.dsl
 cp facp.aml kernel/firmware/acpi
 cp ssdt1.aml kernel/firmware/acpi
-# Create the uncompressed cpio archive and concatenate the original initrd
-# on top:
+# The uncompressed cpio archive must be the first. Other, typically
+# compressed cpio archives, must be concatenated on top of the uncompressed
+# one. Following command creates the uncompressed cpio archive and
+# concatenates the original initrd on top:
 find kernel | cpio -H newc --create > /boot/instrumented_initrd
 cat /boot/initrd >>/boot/instrumented_initrd
 # reboot with increased acpi debug level, e.g. boot params:
index 30df832a6f2f513f4e23841dd0a0ad888cc13dba..87adfb227ca92facd1b3dfe75501b21e9a610a52 100644 (file)
@@ -32,6 +32,10 @@ Optional properties:
 - target-supply     : regulator for SATA target power
 - phys              : reference to the SATA PHY node
 - phy-names         : must be "sata-phy"
+- ports-implemented : Mask that indicates which ports that the HBA supports
+                     are available for software to use. Useful if PORTS_IMPL
+                     is not programmed by the BIOS, which is true with
+                     some embedded SOC's.
 
 Required properties when using sub-nodes:
 - #address-cells    : number of cells to encode an address
index 28a4781ab6d7b9d6a1ab553ed96857f0f509e250..0ae06491b4302209607340a5f4b250c7ca1fe100 100644 (file)
@@ -45,13 +45,13 @@ Required properties:
 Optional properties:
 - dual_emac_res_vlan   : Specifies VID to be used to segregate the ports
 - mac-address          : See ethernet.txt file in the same directory
-- phy_id               : Specifies slave phy id
+- phy_id               : Specifies slave phy id (deprecated, use phy-handle)
 - phy-handle           : See ethernet.txt file in the same directory
 
 Slave sub-nodes:
 - fixed-link           : See fixed-link.txt file in the same directory
-                         Either the property phy_id, or the sub-node
-                         fixed-link can be specified
+
+Note: Exactly one of phy_id, phy-handle, or fixed-link must be specified.
 
 Note: "ti,hwmods" field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
index 3f24df8c6e6557cf1cf0d9e25857dead9cd0d94d..50b8589d12fd167371c87ca457708146bb765ae3 100644 (file)
@@ -6,7 +6,7 @@ This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers
 using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
 platform bus to obtain component resources. The designs used to test this
 driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
-and tested with ARM and NIOS processor hosts seperately. The anticipated use
+and tested with ARM and NIOS processor hosts separately. The anticipated use
 cases are simple communications between an embedded system and an external peer
 for status and simple configuration of the embedded system.
 
@@ -65,14 +65,14 @@ Driver parameters can be also passed in command line by using:
 4.1) Transmit process
 When the driver's transmit routine is called by the kernel, it sets up a
 transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
-MSGDMA), and initites a transmit operation. Once the transmit is complete, an
+MSGDMA), and initiates a transmit operation. Once the transmit is complete, an
 interrupt is driven by the transmit DMA logic. The driver handles the transmit
 completion in the context of the interrupt handling chain by recycling
 resource required to send and track the requested transmit operation.
 
 4.2) Receive process
 The driver will post receive buffers to the receive DMA logic during driver
-intialization. Receive buffers may or may not be queued depending upon the
+initialization. Receive buffers may or may not be queued depending upon the
 underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
 to queue receive buffers to the SGDMA receive logic). When a packet is
 received, the DMA logic generates an interrupt. The driver handles a receive
index cf996394e466b708d5ca02757143205d519ceb5b..14422f8fcdc474f5f32cde7868803cf67fbb0805 100644 (file)
@@ -8,7 +8,7 @@ Initial Release:
        This is conceptually very similar to the macvlan driver with one major
 exception of using L3 for mux-ing /demux-ing among slaves. This property makes
 the master device share the L2 with it's slave devices. I have developed this
-driver in conjuntion with network namespaces and not sure if there is use case
+driver in conjunction with network namespaces and not sure if there is use case
 outside of it.
 
 
@@ -42,7 +42,7 @@ out. In this mode the slaves will RX/TX multicast and broadcast (if applicable)
 as well.
 
 4.2 L3 mode:
-       In this mode TX processing upto L3 happens on the stack instance attached
+       In this mode TX processing up to L3 happens on the stack instance attached
 to the slave device and packets are switched to the stack instance of the
 master device for the L2 processing and routing from that instance will be
 used before packets are queued on the outbound device. In this mode the slaves
@@ -56,7 +56,7 @@ situations defines your use case then you can choose to use ipvlan -
        (a) The Linux host that is connected to the external switch / router has
 policy configured that allows only one mac per port.
        (b) No of virtual devices created on a master exceed the mac capacity and
-puts the NIC in promiscous mode and degraded performance is a concern.
+puts the NIC in promiscuous mode and degraded performance is a concern.
        (c) If the slave device is to be put into the hostile / untrusted network
 namespace where L2 on the slave could be changed / misused.
 
index f4be85e9600578e7411f1baa1ab37041a677fe4a..2c4e3354e12891e755de5986b6f9fa82eff0657b 100644 (file)
@@ -67,12 +67,12 @@ The two basic thread commands are:
  * add_device DEVICE@NAME -- adds a single device
  * rem_device_all         -- remove all associated devices
 
-When adding a device to a thread, a corrosponding procfile is created
+When adding a device to a thread, a corresponding procfile is created
 which is used for configuring this device. Thus, device names need to
 be unique.
 
 To support adding the same device to multiple threads, which is useful
-with multi queue NICs, the device naming scheme is extended with "@":
+with multi queue NICs, the device naming scheme is extended with "@":
  device@something
 
 The part after "@" can be anything, but it is custom to use the thread
@@ -221,7 +221,7 @@ Sample scripts
 
 A collection of tutorial scripts and helpers for pktgen is in the
 samples/pktgen directory. The helper parameters.sh file support easy
-and consistant parameter parsing across the sample scripts.
+and consistent parameter parsing across the sample scripts.
 
 Usage example and help:
  ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2
index d52aa10cfe911c88b47927c25cfd8ef596c65986..5da679c573d2326c88cdcd6eccde9805f8dd06dc 100644 (file)
@@ -41,7 +41,7 @@ using an rx_handler which gives the impression that packets flow through
 the VRF device. Similarly on egress routing rules are used to send packets
 to the VRF device driver before getting sent out the actual interface. This
 allows tcpdump on a VRF device to capture all packets into and out of the
-VRF as a whole.[1] Similiarly, netfilter [2] and tc rules can be applied
+VRF as a whole.[1] Similarly, netfilter [2] and tc rules can be applied
 using the VRF device to specify rules that apply to the VRF domain as a whole.
 
 [1] Packets in the forwarded state do not flow through the device, so those
index d7aac9dedeb4266d970e8cc910726a027305a0b3..8d88e0f2ec493be2e519dbaec3e7995f5027a325 100644 (file)
@@ -4,7 +4,7 @@ Krisztian <hidden@balabit.hu> and others and additional patches
 from Jamal <hadi@cyberus.ca>.
 
 The end goal for syncing is to be able to insert attributes + generate
-events so that the an SA can be safely moved from one machine to another
+events so that the SA can be safely moved from one machine to another
 for HA purposes.
 The idea is to synchronize the SA so that the takeover machine can do
 the processing of the SA as accurate as possible if it has access to it.
@@ -13,7 +13,7 @@ We already have the ability to generate SA add/del/upd events.
 These patches add ability to sync and have accurate lifetime byte (to
 ensure proper decay of SAs) and replay counters to avoid replay attacks
 with as minimal loss at failover time.
-This way a backup stays as closely uptodate as an active member.
+This way a backup stays as closely up-to-date as an active member.
 
 Because the above items change for every packet the SA receives,
 it is possible for a lot of the events to be generated.
@@ -163,7 +163,7 @@ If you have an SA that is getting hit by traffic in bursts such that
 there is a period where the timer threshold expires with no packets
 seen, then an odd behavior is seen as follows:
 The first packet arrival after a timer expiry will trigger a timeout
-aevent; i.e we dont wait for a timeout period or a packet threshold
+event; i.e we don't wait for a timeout period or a packet threshold
 to be reached. This is done for simplicity and efficiency reasons.
 
 -JHS
index 42e65d128d015e1aa9c907d424bc2fcc09cfbebf..a727d9959ecd1d982e8e35ab20d3ee2eaeed57a5 100644 (file)
@@ -872,9 +872,9 @@ F:  drivers/perf/arm_pmu.c
 F:     include/linux/perf/arm_pmu.h
 
 ARM PORT
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     arch/arm/
 
@@ -886,35 +886,35 @@ F:        arch/arm/plat-*/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
 
 ARM PRIMECELL AACI PL041 DRIVER
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     sound/arm/aaci.*
 
 ARM PRIMECELL CLCD PL110 DRIVER
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     drivers/video/fbdev/amba-clcd.*
 
 ARM PRIMECELL KMI PL050 DRIVER
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     drivers/input/serio/ambakmi.*
 F:     include/linux/amba/kmi.h
 
 ARM PRIMECELL MMCI PL180/1 DRIVER
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     drivers/mmc/host/mmci.*
 F:     include/linux/amba/mmci.h
 
 ARM PRIMECELL UART PL010 AND PL011 DRIVERS
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     drivers/tty/serial/amba-pl01*.c
 F:     include/linux/amba/serial.h
 
 ARM PRIMECELL BUS SUPPORT
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 S:     Maintained
 F:     drivers/amba/
 F:     include/linux/amba/bus.h
@@ -1036,7 +1036,7 @@ L:        linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 
 ARM/CLKDEV SUPPORT
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
 F:     arch/arm/include/asm/clkdev.h
@@ -1093,9 +1093,9 @@ F:        arch/arm/boot/dts/cx92755*
 N:     digicolor
 
 ARM/EBSA110 MACHINE SUPPORT
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     arch/arm/mach-ebsa110/
 F:     drivers/net/ethernet/amd/am79c961a.*
@@ -1124,9 +1124,9 @@ T:        git git://git.berlios.de/gemini-board
 F:     arch/arm/mm/*-fa*
 
 ARM/FOOTBRIDGE ARCHITECTURE
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     arch/arm/include/asm/hardware/dec21285.h
 F:     arch/arm/mach-footbridge/
@@ -1457,7 +1457,7 @@ S:        Maintained
 ARM/PT DIGITAL BOARD PORT
 M:     Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 
 ARM/QUALCOMM SUPPORT
@@ -1493,9 +1493,9 @@ S:        Supported
 F:     arch/arm64/boot/dts/renesas/
 
 ARM/RISCPC ARCHITECTURE
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     arch/arm/include/asm/hardware/entry-macro-iomd.S
 F:     arch/arm/include/asm/hardware/ioc.h
@@ -1773,9 +1773,9 @@ F:        drivers/clk/versatile/clk-vexpress-osc.c
 F:     drivers/clocksource/versatile.c
 
 ARM/VFP SUPPORT
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     arch/arm/vfp/
 
@@ -2921,7 +2921,7 @@ F:        mm/cleancache.c
 F:     include/linux/cleancache.h
 
 CLK API
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-clk@vger.kernel.org
 S:     Maintained
 F:     include/linux/clk.h
@@ -3354,9 +3354,9 @@ S:        Supported
 F:     drivers/net/ethernet/stmicro/stmmac/
 
 CYBERPRO FB DRIVER
-M:     Russell King <linux@arm.linux.org.uk>
+M:     Russell King <linux@armlinux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-W:     http://www.arm.linux.org.uk/
+W:     http://www.armlinux.org.uk/
 S:     Maintained
 F:     drivers/video/fbdev/cyber2000fb.*
 
@@ -3881,7 +3881,7 @@ F:        Documentation/devicetree/bindings/display/st,stih4xx.txt
 
 DRM DRIVERS FOR VIVANTE GPU IP
 M:     Lucas Stach <l.stach@pengutronix.de>
-R:     Russell King <linux+etnaviv@arm.linux.org.uk>
+R:     Russell King <linux+etnaviv@armlinux.org.uk>
 R:     Christian Gmeiner <christian.gmeiner@gmail.com>
 L:     dri-devel@lists.freedesktop.org
 S:     Maintained
@@ -4223,8 +4223,8 @@ F:        Documentation/efi-stub.txt
 F:     arch/ia64/kernel/efi.c
 F:     arch/x86/boot/compressed/eboot.[ch]
 F:     arch/x86/include/asm/efi.h
-F:     arch/x86/platform/efi/*
-F:     drivers/firmware/efi/*
+F:     arch/x86/platform/efi/
+F:     drivers/firmware/efi/
 F:     include/linux/efi*.h
 
 EFI VARIABLE FILESYSTEM
@@ -4744,7 +4744,7 @@ F:        drivers/platform/x86/fujitsu-tablet.c
 
 FUSE: FILESYSTEM IN USERSPACE
 M:     Miklos Szeredi <miklos@szeredi.hu>
-L:     fuse-devel@lists.sourceforge.net
+L:     linux-fsdevel@vger.kernel.org
 W:     http://fuse.sourceforge.net/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
 S:     Maintained
@@ -4903,7 +4903,7 @@ F:        net/ipv4/gre_offload.c
 F:     include/net/gre.h
 
 GRETH 10/100/1G Ethernet MAC device driver
-M:     Kristoffer Glembo <kristoffer@gaisler.com>
+M:     Andreas Larsson <andreas@gaisler.com>
 L:     netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/ethernet/aeroflex/
@@ -6905,7 +6905,7 @@ L:        linux-man@vger.kernel.org
 S:     Maintained
 
 MARVELL ARMADA DRM SUPPORT
-M:     Russell King <rmk+kernel@arm.linux.org.uk>
+M:     Russell King <rmk+kernel@armlinux.org.uk>
 S:     Maintained
 F:     drivers/gpu/drm/armada/
 
@@ -7905,7 +7905,7 @@ S:        Supported
 F:     drivers/nfc/nxp-nci
 
 NXP TDA998X DRM DRIVER
-M:     Russell King <rmk+kernel@arm.linux.org.uk>
+M:     Russell King <rmk+kernel@armlinux.org.uk>
 S:     Supported
 F:     drivers/gpu/drm/i2c/tda998x_drv.c
 F:     include/drm/i2c/tda998x.h
@@ -7978,7 +7978,7 @@ F:        arch/arm/*omap*/*pm*
 F:     drivers/cpufreq/omap-cpufreq.c
 
 OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT
-M:     Rajendra Nayak <rnayak@ti.com>
+M:     Rajendra Nayak <rnayak@codeaurora.org>
 M:     Paul Walmsley <paul@pwsan.com>
 L:     linux-omap@vger.kernel.org
 S:     Maintained
@@ -10014,7 +10014,8 @@ F:      drivers/infiniband/hw/ocrdma/
 
 SFC NETWORK DRIVER
 M:     Solarflare linux maintainers <linux-net-drivers@solarflare.com>
-M:     Shradha Shah <sshah@solarflare.com>
+M:     Edward Cree <ecree@solarflare.com>
+M:     Bert Kenward <bkenward@solarflare.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     drivers/net/ethernet/sfc/
index 7466de60ddc7ab98c66c7a28f3cd4a502f465411..acf6155421cc244913b71c6d3b95cd17690e64ff 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc7
 NAME = Charred Weasel
 
 # *DOCUMENTATION*
index ec4791ea691196bf7137b99ead768b3cc030a056..a8767430df7d6012463c8a34366d251496d15364 100644 (file)
@@ -58,6 +58,9 @@ config GENERIC_CSUM
 config RWSEM_GENERIC_SPINLOCK
        def_bool y
 
+config ARCH_DISCONTIGMEM_ENABLE
+       def_bool y
+
 config ARCH_FLATMEM_ENABLE
        def_bool y
 
@@ -347,6 +350,15 @@ config ARC_HUGEPAGE_16M
 
 endchoice
 
+config NODES_SHIFT
+       int "Maximum NUMA Nodes (as a power of 2)"
+       default "1" if !DISCONTIGMEM
+       default "2" if DISCONTIGMEM
+       depends on NEED_MULTIPLE_NODES
+       ---help---
+         Accessing memory beyond 1GB (with or w/o PAE) requires 2 memory
+         zones.
+
 if ISA_ARCOMPACT
 
 config ARC_COMPACT_IRQ_LEVELS
@@ -455,6 +467,7 @@ config LINUX_LINK_BASE
 
 config HIGHMEM
        bool "High Memory Support"
+       select DISCONTIGMEM
        help
          With ARC 2G:2G address split, only upper 2G is directly addressable by
          kernel. Enable this to potentially allow access to rest of 2G and PAE
index 17f85c9c73cfe830a40280ad79bf9decb1b65a17..c22b181e8206f3162c4e0e19214f8b303f13c576 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/page.h>
 
+#ifdef CONFIG_ISA_ARCV2
+#include <asm/barrier.h>
+#define __iormb()              rmb()
+#define __iowmb()              wmb()
+#else
+#define __iormb()              do { } while (0)
+#define __iowmb()              do { } while (0)
+#endif
+
 extern void __iomem *ioremap(phys_addr_t paddr, unsigned long size);
 extern void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
                                  unsigned long flags);
@@ -31,6 +40,15 @@ extern void iounmap(const void __iomem *addr);
 #define ioremap_wc(phy, sz)            ioremap(phy, sz)
 #define ioremap_wt(phy, sz)            ioremap(phy, sz)
 
+/*
+ * io{read,write}{16,32}be() macros
+ */
+#define ioread16be(p)          ({ u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
+#define ioread32be(p)          ({ u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
+
+#define iowrite16be(v,p)       ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); })
+#define iowrite32be(v,p)       ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); })
+
 /* Change struct page to physical address */
 #define page_to_phys(page)             (page_to_pfn(page) << PAGE_SHIFT)
 
@@ -108,15 +126,6 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr)
 
 }
 
-#ifdef CONFIG_ISA_ARCV2
-#include <asm/barrier.h>
-#define __iormb()              rmb()
-#define __iowmb()              wmb()
-#else
-#define __iormb()              do { } while (0)
-#define __iowmb()              do { } while (0)
-#endif
-
 /*
  * MMIO can also get buffered/optimized in micro-arch, so barriers needed
  * Based on ARM model for the typical use case
diff --git a/arch/arc/include/asm/mmzone.h b/arch/arc/include/asm/mmzone.h
new file mode 100644 (file)
index 0000000..8e97136
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.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.
+ */
+
+#ifndef _ASM_ARC_MMZONE_H
+#define _ASM_ARC_MMZONE_H
+
+#ifdef CONFIG_DISCONTIGMEM
+
+extern struct pglist_data node_data[];
+#define NODE_DATA(nid) (&node_data[nid])
+
+static inline int pfn_to_nid(unsigned long pfn)
+{
+       int is_end_low = 1;
+
+       if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
+               is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL);
+
+       /*
+        * node 0: lowmem:             0x8000_0000   to 0xFFFF_FFFF
+        * node 1: HIGHMEM w/o  PAE40: 0x0           to 0x7FFF_FFFF
+        *         HIGHMEM with PAE40: 0x1_0000_0000 to ...
+        */
+       if (pfn >= ARCH_PFN_OFFSET && is_end_low)
+               return 0;
+
+       return 1;
+}
+
+static inline int pfn_valid(unsigned long pfn)
+{
+       int nid = pfn_to_nid(pfn);
+
+       return (pfn <= node_end_pfn(nid));
+}
+#endif /* CONFIG_DISCONTIGMEM  */
+
+#endif
index 36da89e2c853ef0551bfcee0f145454e23a81dd6..0d53854884d047557a981fece15936715a4cd950 100644 (file)
@@ -72,11 +72,20 @@ typedef unsigned long pgprot_t;
 
 typedef pte_t * pgtable_t;
 
+/*
+ * Use virt_to_pfn with caution:
+ * If used in pte or paddr related macros, it could cause truncation
+ * in PAE40 builds
+ * As a rule of thumb, only use it in helpers starting with virt_
+ * You have been warned !
+ */
 #define virt_to_pfn(kaddr)     (__pa(kaddr) >> PAGE_SHIFT)
 
 #define ARCH_PFN_OFFSET                virt_to_pfn(CONFIG_LINUX_LINK_BASE)
 
+#ifdef CONFIG_FLATMEM
 #define pfn_valid(pfn)         (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
+#endif
 
 /*
  * __pa, __va, virt_to_page (ALERT: deprecated, don't use them)
@@ -85,12 +94,10 @@ typedef pte_t * pgtable_t;
  * virt here means link-address/program-address as embedded in object code.
  * And for ARC, link-addr = physical address
  */
-#define __pa(vaddr)  ((unsigned long)vaddr)
+#define __pa(vaddr)  ((unsigned long)(vaddr))
 #define __va(paddr)  ((void *)((unsigned long)(paddr)))
 
-#define virt_to_page(kaddr)    \
-       (mem_map + virt_to_pfn((kaddr) - CONFIG_LINUX_LINK_BASE))
-
+#define virt_to_page(kaddr)    pfn_to_page(virt_to_pfn(kaddr))
 #define virt_addr_valid(kaddr)  pfn_valid(virt_to_pfn(kaddr))
 
 /* Default Permissions for stack/heaps pages (Non Executable) */
index 7d6c93e63adf3af60a0642b03b3ae798061b1e65..10d4b8b8e5450e83468f96f16d9ad18b5c62d3b0 100644 (file)
@@ -278,14 +278,13 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)
 #define pmd_present(x)                 (pmd_val(x))
 #define pmd_clear(xp)                  do { pmd_val(*(xp)) = 0; } while (0)
 
-#define pte_page(pte)  \
-       (mem_map + virt_to_pfn(pte_val(pte) - CONFIG_LINUX_LINK_BASE))
-
+#define pte_page(pte)          pfn_to_page(pte_pfn(pte))
 #define mk_pte(page, prot)     pfn_pte(page_to_pfn(page), prot)
-#define pte_pfn(pte)           virt_to_pfn(pte_val(pte))
-#define pfn_pte(pfn, prot)     (__pte(((pte_t)(pfn) << PAGE_SHIFT) | \
-                                pgprot_val(prot)))
-#define __pte_index(addr)      (virt_to_pfn(addr) & (PTRS_PER_PTE - 1))
+#define pfn_pte(pfn, prot)     (__pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
+
+/* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/
+#define pte_pfn(pte)           (pte_val(pte) >> PAGE_SHIFT)
+#define __pte_index(addr)      (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 
 /*
  * pte_offset gets a @ptr to PMD entry (PGD in our 2-tier paging system)
index 5487d0b974005621a8cfaf119bdbf1f687d9ff7b..8be930394750a7cf7039a9dcc85cf6ee1994f4e6 100644 (file)
@@ -30,11 +30,16 @@ static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE;
 static unsigned long low_mem_sz;
 
 #ifdef CONFIG_HIGHMEM
-static unsigned long min_high_pfn;
+static unsigned long min_high_pfn, max_high_pfn;
 static u64 high_mem_start;
 static u64 high_mem_sz;
 #endif
 
+#ifdef CONFIG_DISCONTIGMEM
+struct pglist_data node_data[MAX_NUMNODES] __read_mostly;
+EXPORT_SYMBOL(node_data);
+#endif
+
 /* User can over-ride above with "mem=nnn[KkMm]" in cmdline */
 static int __init setup_mem_sz(char *str)
 {
@@ -109,13 +114,11 @@ void __init setup_arch_memory(void)
        /* Last usable page of low mem */
        max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz);
 
-#ifdef CONFIG_HIGHMEM
-       min_high_pfn = PFN_DOWN(high_mem_start);
-       max_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
+#ifdef CONFIG_FLATMEM
+       /* pfn_valid() uses this */
+       max_mapnr = max_low_pfn - min_low_pfn;
 #endif
 
-       max_mapnr = max_pfn - min_low_pfn;
-
        /*------------- bootmem allocator setup -----------------------*/
 
        /*
@@ -129,7 +132,7 @@ void __init setup_arch_memory(void)
         * the crash
         */
 
-       memblock_add(low_mem_start, low_mem_sz);
+       memblock_add_node(low_mem_start, low_mem_sz, 0);
        memblock_reserve(low_mem_start, __pa(_end) - low_mem_start);
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -149,13 +152,6 @@ void __init setup_arch_memory(void)
        zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
        zones_holes[ZONE_NORMAL] = 0;
 
-#ifdef CONFIG_HIGHMEM
-       zones_size[ZONE_HIGHMEM] = max_pfn - max_low_pfn;
-
-       /* This handles the peripheral address space hole */
-       zones_holes[ZONE_HIGHMEM] = min_high_pfn - max_low_pfn;
-#endif
-
        /*
         * We can't use the helper free_area_init(zones[]) because it uses
         * PAGE_OFFSET to compute the @min_low_pfn which would be wrong
@@ -168,6 +164,34 @@ void __init setup_arch_memory(void)
                            zones_holes);       /* holes */
 
 #ifdef CONFIG_HIGHMEM
+       /*
+        * Populate a new node with highmem
+        *
+        * On ARC (w/o PAE) HIGHMEM addresses are actually smaller (0 based)
+        * than addresses in normal ala low memory (0x8000_0000 based).
+        * Even with PAE, the huge peripheral space hole would waste a lot of
+        * mem with single mem_map[]. This warrants a mem_map per region design.
+        * Thus HIGHMEM on ARC is imlemented with DISCONTIGMEM.
+        *
+        * DISCONTIGMEM in turns requires multiple nodes. node 0 above is
+        * populated with normal memory zone while node 1 only has highmem
+        */
+       node_set_online(1);
+
+       min_high_pfn = PFN_DOWN(high_mem_start);
+       max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
+
+       zones_size[ZONE_NORMAL] = 0;
+       zones_holes[ZONE_NORMAL] = 0;
+
+       zones_size[ZONE_HIGHMEM] = max_high_pfn - min_high_pfn;
+       zones_holes[ZONE_HIGHMEM] = 0;
+
+       free_area_init_node(1,                  /* node-id */
+                           zones_size,         /* num pages per zone */
+                           min_high_pfn,       /* first pfn of node */
+                           zones_holes);       /* holes */
+
        high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
        kmap_init();
 #endif
@@ -185,7 +209,7 @@ void __init mem_init(void)
        unsigned long tmp;
 
        reset_all_zones_managed_pages();
-       for (tmp = min_high_pfn; tmp < max_pfn; tmp++)
+       for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
                free_highmem_page(pfn_to_page(tmp));
 #endif
 
index b3c26a96a7262bdc2356060f900cc9b0c8bbd8eb..d9e2d9c6e999e4aa6f3a4c8f582fe9caf74953f4 100644 (file)
        regulator-name = "V28";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <2800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
        regulator-always-on; /* due to battery cover sensor */
 };
 
        regulator-name = "VCSI";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
 };
 
 &vaux3 {
        regulator-name = "VMMC2_30";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <3000000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
 };
 
 &vaux4 {
        regulator-name = "VCAM_ANA_28";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <2800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
 };
 
 &vmmc1 {
        regulator-name = "VMMC1";
        regulator-min-microvolt = <1850000>;
        regulator-max-microvolt = <3150000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
 };
 
 &vmmc2 {
        regulator-name = "V28_A";
        regulator-min-microvolt = <2800000>;
        regulator-max-microvolt = <3000000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
        regulator-always-on; /* due VIO leak to AIC34 VDDs */
 };
 
        regulator-name = "VPLL";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
        regulator-always-on;
 };
 
        regulator-name = "VSDI_CSI";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
        regulator-always-on;
 };
 
        regulator-name = "VMMC2_IO_18";
        regulator-min-microvolt = <1800000>;
        regulator-max-microvolt = <1800000>;
+       regulator-initial-mode = <0x0e>; /* RES_STATE_ACTIVE */
 };
 
 &vio {
index 387dc31822fe9c8b2729d28da389d410ffb55fe7..96f8ce7bd2afc0aa5507d81cf98e59b4eddd61ec 100644 (file)
@@ -46,7 +46,7 @@
                               0x480bd800 0x017c>;
                        interrupts = <24>;
                        iommus = <&mmu_isp>;
-                       syscon = <&scm_conf 0xdc>;
+                       syscon = <&scm_conf 0x6c>;
                        ti,phy-type = <OMAP3ISP_PHY_TYPE_COMPLEX_IO>;
                        #clock-cells = <1>;
                        ports {
index 902657d6713b073df82d33158d3d1cd0fac5ef16..914bf4c47404f641f823a122c26ff93127f8d25e 100644 (file)
                                ldo1_reg: ldo1 {
                                        /* VDDAPHY_CAM: vdda_csiport */
                                        regulator-name = "ldo1";
-                                       regulator-min-microvolt = <1500000>;
+                                       regulator-min-microvolt = <1800000>;
                                        regulator-max-microvolt = <1800000>;
                                };
 
                                ldo4_reg: ldo4 {
                                        /* VDDAPHY_DISP: vdda_dsiport/hdmi */
                                        regulator-name = "ldo4";
-                                       regulator-min-microvolt = <1500000>;
+                                       regulator-min-microvolt = <1800000>;
                                        regulator-max-microvolt = <1800000>;
                                };
 
index ecc591dc0778ddbf77222d417884387511d31f0d..4d87d9c6c86d85ec32ae1bc4444fdd06ed5b317e 100644 (file)
                                ldo1_reg: ldo1 {
                                        /* VDDAPHY_CAM: vdda_csiport */
                                        regulator-name = "ldo1";
-                                       regulator-min-microvolt = <1500000>;
+                                       regulator-min-microvolt = <1800000>;
                                        regulator-max-microvolt = <1800000>;
                                };
 
                                ldo4_reg: ldo4 {
                                        /* VDDAPHY_DISP: vdda_dsiport/hdmi */
                                        regulator-name = "ldo4";
-                                       regulator-min-microvolt = <1500000>;
+                                       regulator-min-microvolt = <1800000>;
                                        regulator-max-microvolt = <1800000>;
                                };
 
index 38805ebbe2ba49f5dcd2ee92d80cde1e324cbb56..120b6b80cd39eacc2c874768e89eb14ab147b531 100644 (file)
                        omap5_pmx_wkup: pinmux@c840 {
                                compatible = "ti,omap5-padconf",
                                             "pinctrl-single";
-                               reg = <0xc840 0x0038>;
+                               reg = <0xc840 0x003c>;
                                #address-cells = <1>;
                                #size-cells = <0>;
                                #interrupt-cells = <1>;
index 65d0e8d9825947c68b06e53b162d10116df084c0..04f541bffbdd52d677c77cc717d2d82c63f3c549 100644 (file)
                };
 
                sata0: sata@29000000 {
-                       compatible              = "generic-ahci";
+                       compatible              = "qcom,apq8064-ahci", "generic-ahci";
                        status                  = "disabled";
                        reg                     = <0x29000000 0x180>;
                        interrupts              = <GIC_SPI 209 IRQ_TYPE_NONE>;
 
                        phys                    = <&sata_phy0>;
                        phy-names               = "sata-phy";
+                       ports-implemented       = <0x1>;
                };
 
                /* Temporary fixed regulator */
index 9d2b7e2f5975ed3dae7d9d107a5a0ed5c80369e9..346a49d805a7becd411cda921c7508edb35a3aa8 100644 (file)
 };
 
 &reg_dc1sw {
-       regulator-min-microvolt = <3000000>;
-       regulator-max-microvolt = <3000000>;
        regulator-name = "vcc-lcd";
 };
 
index fc8ba1663601e0743a05b7cda52703df9f9bc07a..99d9f630d6b6838954bde8ddbdd90b0b5ace17b8 100644 (file)
@@ -84,6 +84,7 @@
 
 #ifndef __ASSEMBLY__
 
+#ifdef CONFIG_CPU_CP15_MMU
 static inline unsigned int get_domain(void)
 {
        unsigned int domain;
@@ -103,6 +104,16 @@ static inline void set_domain(unsigned val)
          : : "r" (val) : "memory");
        isb();
 }
+#else
+static inline unsigned int get_domain(void)
+{
+       return 0;
+}
+
+static inline void set_domain(unsigned val)
+{
+}
+#endif
 
 #ifdef CONFIG_CPU_USE_DOMAINS
 #define modify_domain(dom,type)                                        \
index 9b8c5a1134347aea35b7c60850d2b671efc9d768..fb1a69eb49c1a842fc604dc2b64f905e30a39aac 100644 (file)
@@ -236,7 +236,7 @@ ENTRY(__setup_mpu)
        mov     r0, #CONFIG_VECTORS_BASE        @ Cover from VECTORS_BASE
        ldr     r5,=(MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL)
        /* Writing N to bits 5:1 (RSR_SZ) --> region size 2^N+1 */
-       mov     r6, #(((PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
+       mov     r6, #(((2 * PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
 
        setup_region r0, r5, r6, MPU_DATA_SIDE  @ VECTORS_BASE, PL0 NA, enabled
        beq     3f                              @ Memory-map not unified
index 58dbd5c439df45bc10497954db0e61b433646cd6..d6d4191e68f23cd1f80d8faf95fa1405d156b30a 100644 (file)
@@ -1004,7 +1004,7 @@ static bool transparent_hugepage_adjust(kvm_pfn_t *pfnp, phys_addr_t *ipap)
        kvm_pfn_t pfn = *pfnp;
        gfn_t gfn = *ipap >> PAGE_SHIFT;
 
-       if (PageTransCompound(pfn_to_page(pfn))) {
+       if (PageTransCompoundMap(pfn_to_page(pfn))) {
                unsigned long mask;
                /*
                 * The address we faulted on is backed by a transparent huge
index d97c588550ad467775dfe8b05487eb03d540c2f4..bc4e63fa9808932b451931d13906d69dbe2bd3ee 100644 (file)
@@ -121,6 +121,11 @@ static void read_factory_config(struct nvmem_device *nvmem, void *context)
        const char *partnum = NULL;
        struct davinci_soc_info *soc_info = &davinci_soc_info;
 
+       if (!IS_BUILTIN(CONFIG_NVMEM)) {
+               pr_warn("Factory Config not available without CONFIG_NVMEM\n");
+               goto bad_config;
+       }
+
        ret = nvmem_device_read(nvmem, 0, sizeof(factory_config),
                                &factory_config);
        if (ret != sizeof(struct factory_config)) {
index f55ef2ef2f92eb88c9c7485e5bfda537af126d31..742133b7266a64d7ca551a475f64e82ff2fa3841 100644 (file)
@@ -33,6 +33,11 @@ void davinci_get_mac_addr(struct nvmem_device *nvmem, void *context)
        char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
        off_t offset = (off_t)context;
 
+       if (!IS_BUILTIN(CONFIG_NVMEM)) {
+               pr_warn("Cannot read MAC addr from EEPROM without CONFIG_NVMEM\n");
+               return;
+       }
+
        /* Read MAC addr from EEPROM */
        if (nvmem_device_read(nvmem, offset, ETH_ALEN, mac_addr) == ETH_ALEN)
                pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr);
index 7c21760f590ffd0d4cd47fcafcbcaffe64a85952..875a2bab64f67b1a7dda20e216a264f01679f8a9 100644 (file)
@@ -92,7 +92,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on)
                        if (IS_ERR(pd->clk[i]))
                                break;
 
-                       if (IS_ERR(pd->clk[i]))
+                       if (IS_ERR(pd->pclk[i]))
                                continue; /* Skip on first power up */
                        if (clk_set_parent(pd->clk[i], pd->pclk[i]))
                                pr_err("%s: error setting parent to clock%d\n",
index 5d94b7a2fb108dc1bc1c5fcdd4edfa80ab2c0c7f..c160fa3007e943be451b82318149a69dce4d7e54 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/assembler.h>
 
        .arch   armv7-a
+       .arm
 
 ENTRY(secondary_trampoline)
        /* CPU1 will always fetch from 0x0 when it is brought out of reset.
index 1dd10936d68d0422b328128fbb6a234d77adee1d..d5805e4bf2fc71a0db019c198daedccb847a8376 100644 (file)
@@ -87,7 +87,6 @@ static unsigned long irbar_read(void)
 /* MPU initialisation functions */
 void __init sanity_check_meminfo_mpu(void)
 {
-       int i;
        phys_addr_t phys_offset = PHYS_OFFSET;
        phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size;
        struct memblock_region *reg;
@@ -110,11 +109,13 @@ void __init sanity_check_meminfo_mpu(void)
                } else {
                        /*
                         * memblock auto merges contiguous blocks, remove
-                        * all blocks afterwards
+                        * all blocks afterwards in one go (we can't remove
+                        * blocks separately while iterating)
                         */
                        pr_notice("Ignoring RAM after %pa, memory at %pa ignored\n",
-                                 &mem_start, &reg->base);
-                       memblock_remove(reg->base, reg->size);
+                                 &mem_end, &reg->base);
+                       memblock_remove(reg->base, 0 - reg->base);
+                       break;
                }
        }
 
@@ -144,7 +145,7 @@ void __init sanity_check_meminfo_mpu(void)
                pr_warn("Truncating memory from %pa to %pa (MPU region constraints)",
                                &specified_mem_size, &aligned_region_size);
                memblock_remove(mem_start + aligned_region_size,
-                               specified_mem_size - aligned_round_size);
+                               specified_mem_size - aligned_region_size);
 
                mem_end = mem_start + aligned_region_size;
        }
@@ -261,7 +262,7 @@ void __init mpu_setup(void)
                return;
 
        region_err = mpu_setup_region(MPU_RAM_REGION, PHYS_OFFSET,
-                                       ilog2(meminfo.bank[0].size),
+                                       ilog2(memblock.memory.regions[0].size),
                                        MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL);
        if (region_err) {
                panic("MPU region initialization failure! %d", region_err);
@@ -285,7 +286,7 @@ void __init arm_mm_memblock_reserve(void)
         * some architectures which the DRAM is the exception vector to trap,
         * alloc_page breaks with error, although it is not NULL, but "0."
         */
-       memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
+       memblock_reserve(CONFIG_VECTORS_BASE, 2 * PAGE_SIZE);
 #else /* ifndef CONFIG_CPU_V7M */
        /*
         * There is no dedicated vector page on V7-M. So nothing needs to be
index a7315ebe3883f276456280de64d31537099cd292..706d2426024f7f0665c47dc37b92f566cb87a726 100644 (file)
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <0>;
-               status = "disabled";
        };
 
        soc {
index c976ebfe2269db83e7efcc803bcd14e390695e3b..57b4836b7ecd898e10197aa0d473ea6107b9fb42 100644 (file)
@@ -344,7 +344,7 @@ tracesys_next:
 #endif
 
        cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */
-       comiclr,>>=     __NR_Linux_syscalls, %r20, %r0
+       comiclr,>>      __NR_Linux_syscalls, %r20, %r0
        b,n     .Ltracesys_nosys
 
        LDREGX  %r20(%r19), %r19
index e4396a7d0f7cf5627a92ea8c07756aba6bc52c7a..4afe66aa1400d5d7e3783e696a0a1de12d3a316c 100644 (file)
@@ -82,7 +82,7 @@ static inline unsigned long create_zero_mask(unsigned long bits)
            "andc       %1,%1,%2\n\t"
            "popcntd    %0,%1"
                : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask)
-               : "r" (bits));
+               : "b" (bits));
 
        return leading_zero_bits;
 }
index fb23fd6b186a1b0ffeeace7cca9e9a5a136fbfa6..c74d3701ad6830fe88338c185be374f7a6730f07 100644 (file)
@@ -24,7 +24,6 @@ CONFIG_INET_AH=y
 CONFIG_INET_ESP=y
 CONFIG_INET_IPCOMP=y
 # CONFIG_INET_LRO is not set
-CONFIG_IPV6_PRIVACY=y
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
index 04920ab8e292b75a99986b1a2d10ac6273e2db94..3583d676a9161f8197e826553162f011f390c1cd 100644 (file)
@@ -48,7 +48,6 @@ CONFIG_SYN_COOKIES=y
 CONFIG_INET_AH=y
 CONFIG_INET_ESP=y
 CONFIG_INET_IPCOMP=y
-CONFIG_IPV6_PRIVACY=y
 CONFIG_IPV6_ROUTER_PREF=y
 CONFIG_IPV6_ROUTE_INFO=y
 CONFIG_IPV6_OPTIMISTIC_DAD=y
index 56f933816144d47bf96506d09d3249445bc0fe32..1d8321c827a8821bb4e9f4989eb883cd761370db 100644 (file)
@@ -48,6 +48,7 @@
 #define SUN4V_CHIP_SPARC_M6    0x06
 #define SUN4V_CHIP_SPARC_M7    0x07
 #define SUN4V_CHIP_SPARC64X    0x8a
+#define SUN4V_CHIP_SPARC_SN    0x8b
 #define SUN4V_CHIP_UNKNOWN     0xff
 
 #ifndef __ASSEMBLY__
index b6de8b10a55b8b8f09eedb2c90d86906d5445686..36eee8132c22bac329e99fb7284211e11310ff26 100644 (file)
 #define __NR_setsockopt                355
 #define __NR_mlock2            356
 #define __NR_copy_file_range   357
+#define __NR_preadv2           358
+#define __NR_pwritev2          359
 
-#define NR_syscalls            358
+#define NR_syscalls            360
 
 /* Bitmask values returned from kern_features system call.  */
 #define KERN_FEATURE_MIXED_MODE_STACK  0x00000001
index 4ee1ad420862d425cff03ba7aad8e395fcb75907..655628def68e6be60b7cd31bda369b2fbbfd6c6b 100644 (file)
@@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal:       /* Ok we may use interrupt globals safely. */
        subcc           %g1, %g2, %g1           ! Next cacheline
        bge,pt          %icc, 1b
         nop
-       ba,pt           %xcc, dcpe_icpe_tl1_common
-        nop
+       ba,a,pt         %xcc, dcpe_icpe_tl1_common
 
 do_dcpe_tl1_fatal:
        sethi           %hi(1f), %g7
@@ -224,8 +223,7 @@ do_dcpe_tl1_fatal:
        mov             0x2, %o0
        call            cheetah_plus_parity_error
         add            %sp, PTREGS_OFF, %o1
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           do_dcpe_tl1,.-do_dcpe_tl1
 
        .globl          do_icpe_tl1
@@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal:       /* Ok we may use interrupt globals safely. */
        subcc           %g1, %g2, %g1
        bge,pt          %icc, 1b
         nop
-       ba,pt           %xcc, dcpe_icpe_tl1_common
-        nop
+       ba,a,pt         %xcc, dcpe_icpe_tl1_common
 
 do_icpe_tl1_fatal:
        sethi           %hi(1f), %g7
@@ -269,8 +266,7 @@ do_icpe_tl1_fatal:
        mov             0x3, %o0
        call            cheetah_plus_parity_error
         add            %sp, PTREGS_OFF, %o1
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           do_icpe_tl1,.-do_icpe_tl1
        
        .type           dcpe_icpe_tl1_common,#function
@@ -456,7 +452,7 @@ __cheetah_log_error:
         cmp            %g2, 0x63
        be              c_cee
         nop
-       ba,pt           %xcc, c_deferred
+       ba,a,pt         %xcc, c_deferred
        .size           __cheetah_log_error,.-__cheetah_log_error
 
        /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
index dfad8b1aea9fb042a40290c766a3bb7ede4e0480..493e023a468a919c61d77451e43e0a4a2e414bbe 100644 (file)
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void)
                sparc_pmu_type = "sparc-m7";
                break;
 
+       case SUN4V_CHIP_SPARC_SN:
+               sparc_cpu_type = "SPARC-SN";
+               sparc_fpu_type = "SPARC-SN integrated FPU";
+               sparc_pmu_type = "sparc-sn";
+               break;
+
        case SUN4V_CHIP_SPARC64X:
                sparc_cpu_type = "SPARC64-X";
                sparc_fpu_type = "SPARC64-X integrated FPU";
index e69ec0e3f15527705b3ce28fc89ff5c0341f03fb..45c820e1cba5d949ff936f15392ca3c0c8578a34 100644 (file)
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
        case SUN4V_CHIP_NIAGARA5:
        case SUN4V_CHIP_SPARC_M6:
        case SUN4V_CHIP_SPARC_M7:
+       case SUN4V_CHIP_SPARC_SN:
        case SUN4V_CHIP_SPARC64X:
                rover_inc_table = niagara_iterate_method;
                break;
index a6864826a4bd963f0188bd1f5d64218cbdee1981..336d2750fe78c3d4d79175e3427e94859e0cca95 100644 (file)
@@ -100,8 +100,8 @@ do_fpdis:
        fmuld           %f0, %f2, %f26
        faddd           %f0, %f2, %f28
        fmuld           %f0, %f2, %f30
-       b,pt            %xcc, fpdis_exit
-        nop
+       ba,a,pt         %xcc, fpdis_exit
+
 2:     andcc           %g5, FPRS_DU, %g0
        bne,pt          %icc, 3f
         fzero          %f32
@@ -144,8 +144,8 @@ do_fpdis:
        fmuld           %f32, %f34, %f58
        faddd           %f32, %f34, %f60
        fmuld           %f32, %f34, %f62
-       ba,pt           %xcc, fpdis_exit
-        nop
+       ba,a,pt         %xcc, fpdis_exit
+
 3:     mov             SECONDARY_CONTEXT, %g3
        add             %g6, TI_FPREGS, %g1
 
@@ -197,8 +197,7 @@ fpdis_exit2:
 fp_other_bounce:
        call            do_fpother
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           fp_other_bounce,.-fp_other_bounce
 
        .align          32
index cd1f592cd3479f8c94c599bfc589087184d4d180..a076b4249e622a4ebfe47eab6c9bcd7cb98b36ce 100644 (file)
@@ -414,6 +414,8 @@ sun4v_chip_type:
        cmp     %g2, 'T'
        be,pt   %xcc, 70f
         cmp    %g2, 'M'
+       be,pt   %xcc, 70f
+        cmp    %g2, 'S'
        bne,pn  %xcc, 49f
         nop
 
@@ -433,6 +435,9 @@ sun4v_chip_type:
        cmp     %g2, '7'
        be,pt   %xcc, 5f
         mov    SUN4V_CHIP_SPARC_M7, %g4
+       cmp     %g2, 'N'
+       be,pt   %xcc, 5f
+        mov    SUN4V_CHIP_SPARC_SN, %g4
        ba,pt   %xcc, 49f
         nop
 
@@ -461,9 +466,8 @@ sun4v_chip_type:
        subcc   %g3, 1, %g3
        bne,pt  %xcc, 41b
        add     %g1, 1, %g1
-       mov     SUN4V_CHIP_SPARC64X, %g4
        ba,pt   %xcc, 5f
-       nop
+        mov    SUN4V_CHIP_SPARC64X, %g4
 
 49:
        mov     SUN4V_CHIP_UNKNOWN, %g4
@@ -548,8 +552,7 @@ sun4u_init:
        stxa            %g0, [%g7] ASI_DMMU
        membar  #Sync
 
-       ba,pt           %xcc, sun4u_continue
-        nop
+       ba,a,pt         %xcc, sun4u_continue
 
 sun4v_init:
        /* Set ctx 0 */
@@ -560,14 +563,12 @@ sun4v_init:
        mov             SECONDARY_CONTEXT, %g7
        stxa            %g0, [%g7] ASI_MMU
        membar          #Sync
-       ba,pt           %xcc, niagara_tlb_fixup
-        nop
+       ba,a,pt         %xcc, niagara_tlb_fixup
 
 sun4u_continue:
        BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
 
-       ba,pt   %xcc, spitfire_tlb_fixup
-        nop
+       ba,a,pt %xcc, spitfire_tlb_fixup
 
 niagara_tlb_fixup:
        mov     3, %g2          /* Set TLB type to hypervisor. */
@@ -595,6 +596,9 @@ niagara_tlb_fixup:
        be,pt   %xcc, niagara4_patch
         nop
        cmp     %g1, SUN4V_CHIP_SPARC_M7
+       be,pt   %xcc, niagara4_patch
+        nop
+       cmp     %g1, SUN4V_CHIP_SPARC_SN
        be,pt   %xcc, niagara4_patch
         nop
 
@@ -639,8 +643,7 @@ niagara_patch:
        call    hypervisor_patch_cachetlbops
         nop
 
-       ba,pt   %xcc, tlb_fixup_done
-        nop
+       ba,a,pt %xcc, tlb_fixup_done
 
 cheetah_tlb_fixup:
        mov     2, %g2          /* Set TLB type to cheetah+. */
@@ -659,8 +662,7 @@ cheetah_tlb_fixup:
        call    cheetah_patch_cachetlbops
         nop
 
-       ba,pt   %xcc, tlb_fixup_done
-        nop
+       ba,a,pt %xcc, tlb_fixup_done
 
 spitfire_tlb_fixup:
        /* Set TLB type to spitfire. */
@@ -774,8 +776,7 @@ setup_trap_table:
        call    %o1
         add    %sp, (2047 + 128), %o0
 
-       ba,pt   %xcc, 2f
-        nop
+       ba,a,pt %xcc, 2f
 
 1:     sethi   %hi(sparc64_ttable_tl0), %o0
        set     prom_set_trap_table_name, %g2
@@ -814,8 +815,7 @@ setup_trap_table:
 
        BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
 
-       ba,pt   %xcc, 2f
-        nop
+       ba,a,pt %xcc, 2f
 
        /* Disable STICK_INT interrupts. */
 1:
index 753b4f031bfb710b77cefa78b74ade61a9d8850c..34b4933900bf7665b30e791565795d5782351b60 100644 (file)
@@ -18,8 +18,7 @@ __do_privact:
 109:   or              %g7, %lo(109b), %g7
        call            do_privact
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __do_privact,.-__do_privact
 
        .type           do_mna,#function
@@ -46,8 +45,7 @@ do_mna:
        mov             %l5, %o2
        call            mem_address_unaligned
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           do_mna,.-do_mna
 
        .type           do_lddfmna,#function
@@ -65,8 +63,7 @@ do_lddfmna:
        mov             %l5, %o2
        call            handle_lddfmna
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           do_lddfmna,.-do_lddfmna
 
        .type           do_stdfmna,#function
@@ -84,8 +81,7 @@ do_stdfmna:
        mov             %l5, %o2
        call            handle_stdfmna
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           do_stdfmna,.-do_stdfmna
 
        .type           breakpoint_trap,#function
index badf0951d73c8f2d875aa5cbc093caef04616aeb..c2b202d763a16ae74d1d150ed6e7dd940341d7dd 100644 (file)
@@ -245,6 +245,18 @@ static void pci_parse_of_addrs(struct platform_device *op,
        }
 }
 
+static void pci_init_dev_archdata(struct dev_archdata *sd, void *iommu,
+                                 void *stc, void *host_controller,
+                                 struct platform_device  *op,
+                                 int numa_node)
+{
+       sd->iommu = iommu;
+       sd->stc = stc;
+       sd->host_controller = host_controller;
+       sd->op = op;
+       sd->numa_node = numa_node;
+}
+
 static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
                                         struct device_node *node,
                                         struct pci_bus *bus, int devfn)
@@ -259,13 +271,10 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        if (!dev)
                return NULL;
 
+       op = of_find_device_by_node(node);
        sd = &dev->dev.archdata;
-       sd->iommu = pbm->iommu;
-       sd->stc = &pbm->stc;
-       sd->host_controller = pbm;
-       sd->op = op = of_find_device_by_node(node);
-       sd->numa_node = pbm->numa_node;
-
+       pci_init_dev_archdata(sd, pbm->iommu, &pbm->stc, pbm, op,
+                             pbm->numa_node);
        sd = &op->dev.archdata;
        sd->iommu = pbm->iommu;
        sd->stc = &pbm->stc;
@@ -994,6 +1003,27 @@ void pcibios_set_master(struct pci_dev *dev)
        /* No special bus mastering setup handling */
 }
 
+#ifdef CONFIG_PCI_IOV
+int pcibios_add_device(struct pci_dev *dev)
+{
+       struct pci_dev *pdev;
+
+       /* Add sriov arch specific initialization here.
+        * Copy dev_archdata from PF to VF
+        */
+       if (dev->is_virtfn) {
+               struct dev_archdata *psd;
+
+               pdev = dev->physfn;
+               psd = &pdev->dev.archdata;
+               pci_init_dev_archdata(&dev->dev.archdata, psd->iommu,
+                                     psd->stc, psd->host_controller, NULL,
+                                     psd->numa_node);
+       }
+       return 0;
+}
+#endif /* CONFIG_PCI_IOV */
+
 static int __init pcibios_init(void)
 {
        pci_dfl_cache_line_size = 64 >> 2;
index 26db95b54ee94c44537590a1b94a4870bd9227ce..599f1207eed2e469157e2475631d2537543b5794 100644 (file)
@@ -285,7 +285,8 @@ static void __init sun4v_patch(void)
 
        sun4v_patch_2insn_range(&__sun4v_2insn_patch,
                                &__sun4v_2insn_patch_end);
-       if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7)
+       if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
+           sun4v_chip_type == SUN4V_CHIP_SPARC_SN)
                sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
                                         &__sun_m7_2insn_patch_end);
 
@@ -524,6 +525,7 @@ static void __init init_sparc64_elf_hwcap(void)
                    sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
+                   sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC64X)
                        cap |= HWCAP_SPARC_BLKINIT;
                if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
@@ -532,6 +534,7 @@ static void __init init_sparc64_elf_hwcap(void)
                    sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
+                   sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
                    sun4v_chip_type == SUN4V_CHIP_SPARC64X)
                        cap |= HWCAP_SPARC_N2;
        }
@@ -561,6 +564,7 @@ static void __init init_sparc64_elf_hwcap(void)
                            sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
+                           sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC64X)
                                cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
                                        AV_SPARC_ASI_BLK_INIT |
@@ -570,6 +574,7 @@ static void __init init_sparc64_elf_hwcap(void)
                            sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
+                           sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
                            sun4v_chip_type == SUN4V_CHIP_SPARC64X)
                                cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
                                        AV_SPARC_FMAF);
index c357e40ffd01526ca38a824c12ac077cdba135c6..4a73009f66a5727e43ad45dbe1a2f7bded8cd48f 100644 (file)
@@ -85,8 +85,7 @@ __spitfire_cee_trap_continue:
        ba,pt           %xcc, etraptl1
         rd             %pc, %g7
 
-       ba,pt           %xcc, 2f
-        nop
+       ba,a,pt         %xcc, 2f
 
 1:     ba,pt           %xcc, etrap_irq
         rd             %pc, %g7
@@ -100,8 +99,7 @@ __spitfire_cee_trap_continue:
        mov             %l5, %o2
        call            spitfire_access_error
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __spitfire_access_error,.-__spitfire_access_error
 
        /* This is the trap handler entry point for ECC correctable
@@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1:
        mov             %l5, %o2
        call            spitfire_data_access_exception_tl1
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
 
        .type           __spitfire_data_access_exception,#function
@@ -200,8 +197,7 @@ __spitfire_data_access_exception:
        mov             %l5, %o2
        call            spitfire_data_access_exception
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __spitfire_data_access_exception,.-__spitfire_data_access_exception
 
        .type           __spitfire_insn_access_exception_tl1,#function
@@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1:
        mov             %l5, %o2
        call            spitfire_insn_access_exception_tl1
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
 
        .type           __spitfire_insn_access_exception,#function
@@ -240,6 +235,5 @@ __spitfire_insn_access_exception:
        mov             %l5, %o2
        call            spitfire_insn_access_exception
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
        .size           __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
index 6c3dd6c52f8bd09135e81f1d56704602d10c4f4e..eac7f0db5c8c6269a913152a11941f66f5f3e8d0 100644 (file)
@@ -88,4 +88,4 @@ sys_call_table:
 /*340*/        .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
 /*345*/        .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
 /*350*/        .long sys_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
-/*355*/        .long sys_setsockopt, sys_mlock2, sys_copy_file_range
+/*355*/        .long sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
index 12b524cfcfa0120caabdf7aa5b8606ecc3978c96..b0f17ff2ddba2daa75a8e8a646b5661dfe0d36e9 100644 (file)
@@ -89,7 +89,7 @@ sys_call_table32:
 /*340*/        .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
        .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
 /*350*/        .word sys32_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
-       .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range
+       .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range, compat_sys_preadv2, compat_sys_pwritev2
 
 #endif /* CONFIG_COMPAT */
 
@@ -170,4 +170,4 @@ sys_call_table:
 /*340*/        .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
        .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
 /*350*/        .word sys64_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
-       .word sys_setsockopt, sys_mlock2, sys_copy_file_range
+       .word sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
index b7f0f3f3a909b05b544da1a7b3d3e21d12bfa357..c731e8023d3e7c6333ae091f39ca76aedf332603 100644 (file)
@@ -11,8 +11,7 @@ utrap_trap:           /* %g3=handler,%g4=level */
        mov             %l4, %o1
         call           bad_trap
         add            %sp, PTREGS_OFF, %o0
-       ba,pt           %xcc, rtrap
-        nop
+       ba,a,pt         %xcc, rtrap
 
 invoke_utrap:
        sllx            %g3, 3, %g3
index cb5789c9f9613ed692733d50dcf0e2c39784b1f7..f6bb857254fcfa170155d4cd8dc8cb717c5bfb97 100644 (file)
@@ -45,6 +45,14 @@ static const struct vio_device_id *vio_match_device(
        return NULL;
 }
 
+static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
+{
+       const struct vio_dev *vio_dev = to_vio_dev(dev);
+
+       add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, vio_dev->compat);
+       return 0;
+}
+
 static int vio_bus_match(struct device *dev, struct device_driver *drv)
 {
        struct vio_dev *vio_dev = to_vio_dev(dev);
@@ -105,15 +113,25 @@ static ssize_t type_show(struct device *dev,
        return sprintf(buf, "%s\n", vdev->type);
 }
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+{
+       const struct vio_dev *vdev = to_vio_dev(dev);
+
+       return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat);
+}
+
 static struct device_attribute vio_dev_attrs[] = {
        __ATTR_RO(devspec),
        __ATTR_RO(type),
+       __ATTR_RO(modalias),
        __ATTR_NULL
 };
 
 static struct bus_type vio_bus_type = {
        .name           = "vio",
        .dev_attrs      = vio_dev_attrs,
+       .uevent         = vio_hotplug,
        .match          = vio_bus_match,
        .probe          = vio_device_probe,
        .remove         = vio_device_remove,
index aadd321aa05db983af75a13ee14f2693ad75ed5c..7d02b1fef0256bb84c218e55b4d2328d037f5903 100644 (file)
@@ -33,6 +33,10 @@ ENTRY(_start)
 jiffies = jiffies_64;
 #endif
 
+#ifdef CONFIG_SPARC64
+ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
+#endif
+
 SECTIONS
 {
 #ifdef CONFIG_SPARC64
index 1e67ce95836972d439b50c88aa77d8395a543652..855019a8590ea5d556b71c9ae9356f7dcb629588 100644 (file)
@@ -32,8 +32,7 @@ fill_fixup:
         rd     %pc, %g7
        call    do_sparc64_fault
         add    %sp, PTREGS_OFF, %o0
-       ba,pt   %xcc, rtrap
-        nop
+       ba,a,pt %xcc, rtrap
 
        /* Be very careful about usage of the trap globals here.
         * You cannot touch %g5 as that has the fault information.
index 1cfe6aab7a11572d54f6848fe4656b7b40af8cf2..09e838801e397b4071b6604852e24a2a799e0a86 100644 (file)
@@ -1769,6 +1769,7 @@ static void __init setup_page_offset(void)
                        max_phys_bits = 47;
                        break;
                case SUN4V_CHIP_SPARC_M7:
+               case SUN4V_CHIP_SPARC_SN:
                default:
                        /* M7 and later support 52-bit virtual addresses.  */
                        sparc64_va_hole_top =    0xfff8000000000000UL;
@@ -1986,6 +1987,7 @@ static void __init sun4v_linear_pte_xor_finalize(void)
         */
        switch (sun4v_chip_type) {
        case SUN4V_CHIP_SPARC_M7:
+       case SUN4V_CHIP_SPARC_SN:
                pagecv_flag = 0x00;
                break;
        default:
@@ -2138,6 +2140,7 @@ void __init paging_init(void)
         */
        switch (sun4v_chip_type) {
        case SUN4V_CHIP_SPARC_M7:
+       case SUN4V_CHIP_SPARC_SN:
                page_cache4v_flag = _PAGE_CP_4V;
                break;
        default:
index 40625ca7a190953fc87c386a03017bab96903435..6011a573dd64995f0818667c1bb426518d689b78 100644 (file)
@@ -474,6 +474,7 @@ static __init int _init_perf_amd_iommu(
 
 static struct perf_amd_iommu __perf_iommu = {
        .pmu = {
+               .task_ctx_nr    = perf_invalid_context,
                .event_init     = perf_iommu_event_init,
                .add            = perf_iommu_add,
                .del            = perf_iommu_del,
index aff79884e17d2818531b978df08726c882cc9fed..a6fd4dbcf820abf727b6118c0084a6877ec0340d 100644 (file)
@@ -3637,6 +3637,8 @@ __init int intel_pmu_init(void)
                pr_cont("Knights Landing events, ");
                break;
 
+       case 142: /* 14nm Kabylake Mobile */
+       case 158: /* 14nm Kabylake Desktop */
        case 78: /* 14nm Skylake Mobile */
        case 94: /* 14nm Skylake Desktop */
        case 85: /* 14nm Skylake Server */
index 8f4942e2bcbb21584a78225b1208adefe86e0aa9..d7ce96a7dacaedc630a0e9a5ef5b761edbd0ffc7 100644 (file)
@@ -891,9 +891,7 @@ void __init uv_system_init(void)
        }
        pr_info("UV: Found %s hub\n", hub);
 
-       /* We now only need to map the MMRs on UV1 */
-       if (is_uv1_hub())
-               map_low_mmrs();
+       map_low_mmrs();
 
        m_n_config.v = uv_read_local_mmr(UVH_RH_GAM_CONFIG_MMR );
        m_val = m_n_config.s.m_skt;
index 2367ae07eb76db48964ef311e6cdc50f8751ecee..c4e7b3991b60d4f9dc416e925c996e870969a6c2 100644 (file)
@@ -398,6 +398,11 @@ static void __init reserve_initrd(void)
 
        memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
 }
+
+static void __init early_initrd_acpi_init(void)
+{
+       early_acpi_table_init((void *)initrd_start, initrd_end - initrd_start);
+}
 #else
 static void __init early_reserve_initrd(void)
 {
@@ -405,6 +410,9 @@ static void __init early_reserve_initrd(void)
 static void __init reserve_initrd(void)
 {
 }
+static void __init early_initrd_acpi_init(void)
+{
+}
 #endif /* CONFIG_BLK_DEV_INITRD */
 
 static void __init parse_setup_data(void)
@@ -1138,9 +1146,7 @@ void __init setup_arch(char **cmdline_p)
 
        reserve_initrd();
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_BLK_DEV_INITRD)
-       acpi_initrd_override((void *)initrd_start, initrd_end - initrd_start);
-#endif
+       early_initrd_acpi_init();
 
        vsmp_init();
 
index b285d4e8c68e33bf3d4f2b070fdbcbbce7036d9a..5da924bbf0a0f22aa676f5be5a3f97fe4811b087 100644 (file)
@@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id)
                                        continue;
                                for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
                                        resource_size_t start, end;
+                                       unsigned long flags;
+
+                                       flags = pci_resource_flags(dev, i);
+                                       if (!(flags & IORESOURCE_MEM))
+                                               continue;
+
+                                       if (flags & IORESOURCE_UNSET)
+                                               continue;
+
+                                       if (pci_resource_len(dev, i) == 0)
+                                               continue;
 
                                        start = pci_resource_start(dev, i);
-                                       if (start == 0)
-                                               break;
                                        end = pci_resource_end(dev, i);
                                        if (screen_info.lfb_base >= start &&
                                            screen_info.lfb_base < end) {
                                                found_bar = 1;
+                                               break;
                                        }
                                }
                        }
index 92ae6acac8a7fbcb9b91cb386b3c23015c5377ea..6aa0f4d9eea6816bbf0c78514e0b76d8f4dc7def 100644 (file)
@@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void)
 
        if (freq_desc_tables[cpu_index].msr_plat) {
                rdmsr(MSR_PLATFORM_INFO, lo, hi);
-               ratio = (lo >> 8) & 0x1f;
+               ratio = (lo >> 8) & 0xff;
        } else {
                rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
                ratio = (hi >> 8) & 0x1f;
index 1ff4dbb73fb7a7ee56c2c28e0d37a6a049f3adc9..b6f50e8b0a393675009a5dcaad7f30af315bc91d 100644 (file)
@@ -2823,7 +2823,7 @@ static void transparent_hugepage_adjust(struct kvm_vcpu *vcpu,
         */
        if (!is_error_noslot_pfn(pfn) && !kvm_is_reserved_pfn(pfn) &&
            level == PT_PAGE_TABLE_LEVEL &&
-           PageTransCompound(pfn_to_page(pfn)) &&
+           PageTransCompoundMap(pfn_to_page(pfn)) &&
            !mmu_gfn_lpage_is_disallowed(vcpu, gfn, PT_DIRECTORY_LEVEL)) {
                unsigned long mask;
                /*
@@ -4785,7 +4785,7 @@ restart:
                 */
                if (sp->role.direct &&
                        !kvm_is_reserved_pfn(pfn) &&
-                       PageTransCompound(pfn_to_page(pfn))) {
+                       PageTransCompoundMap(pfn_to_page(pfn))) {
                        drop_spte(kvm, sptep);
                        need_tlb_flush = 1;
                        goto restart;
index a2433817c987833f525380d8425bb6e902873bbd..6a2f5691b1ab57261809617ca9a9b375adfe135e 100644 (file)
@@ -43,40 +43,40 @@ void __init efi_bgrt_init(void)
                return;
 
        if (bgrt_tab->header.length < sizeof(*bgrt_tab)) {
-               pr_err("Ignoring BGRT: invalid length %u (expected %zu)\n",
+               pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
                       bgrt_tab->header.length, sizeof(*bgrt_tab));
                return;
        }
        if (bgrt_tab->version != 1) {
-               pr_err("Ignoring BGRT: invalid version %u (expected 1)\n",
+               pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n",
                       bgrt_tab->version);
                return;
        }
        if (bgrt_tab->status & 0xfe) {
-               pr_err("Ignoring BGRT: reserved status bits are non-zero %u\n",
+               pr_notice("Ignoring BGRT: reserved status bits are non-zero %u\n",
                       bgrt_tab->status);
                return;
        }
        if (bgrt_tab->image_type != 0) {
-               pr_err("Ignoring BGRT: invalid image type %u (expected 0)\n",
+               pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",
                       bgrt_tab->image_type);
                return;
        }
        if (!bgrt_tab->image_address) {
-               pr_err("Ignoring BGRT: null image address\n");
+               pr_notice("Ignoring BGRT: null image address\n");
                return;
        }
 
        image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
        if (!image) {
-               pr_err("Ignoring BGRT: failed to map image header memory\n");
+               pr_notice("Ignoring BGRT: failed to map image header memory\n");
                return;
        }
 
        memcpy(&bmp_header, image, sizeof(bmp_header));
        memunmap(image);
        if (bmp_header.id != 0x4d42) {
-               pr_err("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n",
+               pr_notice("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n",
                        bmp_header.id);
                return;
        }
@@ -84,14 +84,14 @@ void __init efi_bgrt_init(void)
 
        bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
        if (!bgrt_image) {
-               pr_err("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
+               pr_notice("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
                       bgrt_image_size);
                return;
        }
 
        image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
        if (!image) {
-               pr_err("Ignoring BGRT: failed to map image memory\n");
+               pr_notice("Ignoring BGRT: failed to map image memory\n");
                kfree(bgrt_image);
                bgrt_image = NULL;
                return;
index ab50ada1d56e4f87f6fff3207995ea32312fb37b..818d12ad77619b8823ca8a5198c4103cf4aa0eb4 100644 (file)
@@ -373,5 +373,5 @@ bool efi_reboot_required(void)
 
 bool efi_poweroff_required(void)
 {
-       return !!acpi_gbl_reduced_hardware;
+       return acpi_gbl_reduced_hardware || acpi_no_s5;
 }
index 82b96ee8624c2b2713e981e9d9c4b0aefb9ae811..b225c4b9ba140bd17eee6f9a19b2f09198c043a0 100644 (file)
@@ -311,12 +311,12 @@ config ACPI_CUSTOM_DSDT
        bool
        default ACPI_CUSTOM_DSDT_FILE != ""
 
-config ACPI_INITRD_TABLE_OVERRIDE
-       bool "ACPI tables override via initrd"
+config ACPI_TABLE_UPGRADE
+       bool "Allow upgrading ACPI tables via initrd"
        depends on BLK_DEV_INITRD && X86
-       default n
+       default y
        help
-         This option provides functionality to override arbitrary ACPI tables
+         This option provides functionality to upgrade arbitrary ACPI tables
          via initrd. No functional change if no ACPI tables are passed via
          initrd, therefore it's safe to say Y.
          See Documentation/acpi/initrd_table_override.txt for details
index 345df7f960b61caa019ef13982b6dd4f58e81c0a..251ce85a66fbb4460e6c379d39f7ddd0e2062ce8 100644 (file)
@@ -47,6 +47,7 @@ acpi-$(CONFIG_ARM_AMBA)       += acpi_amba.o
 acpi-y                         += int340x_thermal.o
 acpi-y                         += power.o
 acpi-y                         += event.o
+acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o
 acpi-y                         += sysfs.o
 acpi-y                         += property.o
 acpi-$(CONFIG_X86)             += acpi_cmos_rtc.o
index 2a61b54ab968dca1742129dcad41a73ca1673e13..7f77c071709a75cec915009c74908453e5609c4a 100644 (file)
@@ -35,8 +35,7 @@ static void amba_register_dummy_clk(void)
        if (amba_dummy_clk)
                return;
 
-       amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL,
-                                               CLK_IS_ROOT, 0);
+       amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
        clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
 }
 
index f245bf35bedb59c38dad79badfd8e084cccb5644..1daf9c46df8e4b60cf7d128cc2487617bdbe08c7 100644 (file)
@@ -62,8 +62,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
        if (dev_desc->fixed_clk_rate) {
                clk = clk_register_fixed_rate(&pdata->adev->dev,
                                        dev_name(&pdata->adev->dev),
-                                       NULL, CLK_IS_ROOT,
-                                       dev_desc->fixed_clk_rate);
+                                       NULL, 0, dev_desc->fixed_clk_rate);
                clk_register_clkdev(clk, NULL, dev_name(&pdata->adev->dev));
                pdata->clk = clk;
        }
index 4361bc98ef4c7a1f64272b24f2213b0a28f08f27..3d5b8a099351e3c401de7e739b4d8bb043fab86e 100644 (file)
@@ -191,19 +191,6 @@ struct acpi_video_device_cap {
        u8 _DDC:1;              /* Return the EDID for this device */
 };
 
-struct acpi_video_brightness_flags {
-       u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
-       u8 _BCL_reversed:1;             /* _BCL package is in a reversed order */
-       u8 _BQC_use_index:1;            /* _BQC returns an index value */
-};
-
-struct acpi_video_device_brightness {
-       int curr;
-       int count;
-       int *levels;
-       struct acpi_video_brightness_flags flags;
-};
-
 struct acpi_video_device {
        unsigned long device_id;
        struct acpi_video_device_flags flags;
@@ -325,7 +312,7 @@ static const struct thermal_cooling_device_ops video_cooling_ops = {
  */
 
 static int
-acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
+acpi_video_device_lcd_query_levels(acpi_handle handle,
                                   union acpi_object **levels)
 {
        int status;
@@ -335,7 +322,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
 
        *levels = NULL;
 
-       status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
+       status = acpi_evaluate_object(handle, "_BCL", NULL, &buffer);
        if (!ACPI_SUCCESS(status))
                return status;
        obj = (union acpi_object *)buffer.pointer;
@@ -766,36 +753,28 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
        return 0;
 }
 
-
-/*
- *  Arg:
- *     device  : video output device (LCD, CRT, ..)
- *
- *  Return Value:
- *     Maximum brightness level
- *
- *  Allocate and initialize device->brightness.
- */
-
-static int
-acpi_video_init_brightness(struct acpi_video_device *device)
+int acpi_video_get_levels(struct acpi_device *device,
+                         struct acpi_video_device_brightness **dev_br)
 {
        union acpi_object *obj = NULL;
        int i, max_level = 0, count = 0, level_ac_battery = 0;
-       unsigned long long level, level_old;
        union acpi_object *o;
        struct acpi_video_device_brightness *br = NULL;
-       int result = -EINVAL;
+       int result = 0;
        u32 value;
 
-       if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
+       if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device->handle,
+                                                               &obj))) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available "
                                                "LCD brightness level\n"));
+               result = -ENODEV;
                goto out;
        }
 
-       if (obj->package.count < 2)
+       if (obj->package.count < 2) {
+               result = -EINVAL;
                goto out;
+       }
 
        br = kzalloc(sizeof(*br), GFP_KERNEL);
        if (!br) {
@@ -861,6 +840,38 @@ acpi_video_init_brightness(struct acpi_video_device *device)
                            "Found unordered _BCL package"));
 
        br->count = count;
+       *dev_br = br;
+
+out:
+       kfree(obj);
+       return result;
+out_free:
+       kfree(br);
+       goto out;
+}
+EXPORT_SYMBOL(acpi_video_get_levels);
+
+/*
+ *  Arg:
+ *     device  : video output device (LCD, CRT, ..)
+ *
+ *  Return Value:
+ *     Maximum brightness level
+ *
+ *  Allocate and initialize device->brightness.
+ */
+
+static int
+acpi_video_init_brightness(struct acpi_video_device *device)
+{
+       int i, max_level = 0;
+       unsigned long long level, level_old;
+       struct acpi_video_device_brightness *br = NULL;
+       int result = -EINVAL;
+
+       result = acpi_video_get_levels(device->dev, &br);
+       if (result)
+               return result;
        device->brightness = br;
 
        /* _BQC uses INDEX while _BCL uses VALUE in some laptops */
@@ -903,17 +914,13 @@ set_level:
                goto out_free_levels;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "found %d brightness levels\n", count - 2));
-       kfree(obj);
-       return result;
+                         "found %d brightness levels\n", br->count - 2));
+       return 0;
 
 out_free_levels:
        kfree(br->levels);
-out_free:
        kfree(br);
-out:
        device->brightness = NULL;
-       kfree(obj);
        return result;
 }
 
index f682374c19f45a7a421b29b474739e5c7e8109b6..227bb7bb19d7808ae2cae9ff21778dd0c612aace 100644 (file)
@@ -43,6 +43,7 @@ acpi-y +=             \
        evxfregn.o
 
 acpi-y +=              \
+       exconcat.o      \
        exconfig.o      \
        exconvrt.o      \
        excreate.o      \
@@ -149,6 +150,7 @@ acpi-y +=           \
 acpi-y +=              \
        utaddress.o     \
        utalloc.o       \
+       utascii.o       \
        utbuffer.o      \
        utcopy.o        \
        utexcep.o       \
index 993af9eb007a28e7b39982022e5d0f7c44602548..f6404ea928cbfeeeb08387af4ec510c19047d8ce 100644 (file)
@@ -53,7 +53,7 @@
 #define ACPI_DEBUG_BUFFER_SIZE  0x4000 /* 16K buffer for return objects */
 
 struct acpi_db_command_info {
-       char *name;             /* Command Name */
+       const char *name;       /* Command Name */
        u8 min_args;            /* Minimum arguments required */
 };
 
@@ -64,7 +64,7 @@ struct acpi_db_command_help {
 };
 
 struct acpi_db_argument_info {
-       char *name;             /* Argument Name */
+       const char *name;       /* Argument Name */
 };
 
 struct acpi_db_execute_walk {
@@ -196,7 +196,7 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
                                                             acpi_walk_state
                                                             *walk_state))
 
- acpi_status acpi_db_display_all_methods(char *display_count_arg);
+acpi_status acpi_db_display_all_methods(char *display_count_arg);
 
 void acpi_db_display_arguments(void);
 
@@ -220,7 +220,7 @@ ACPI_DBR_DEPENDENT_RETURN_VOID(void
  * dbexec - debugger control method execution
  */
 void
-acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags);
+acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags);
 
 void
 acpi_db_create_execution_threads(char *num_threads_arg,
@@ -271,7 +271,7 @@ void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
 acpi_status acpi_db_user_commands(void);
 
 char *acpi_db_get_next_token(char *string,
-                            char **next, acpi_object_type * return_type);
+                            char **next, acpi_object_type *return_type);
 
 /*
  * dbobject
index 010cf81bada9d9d892343bb2732e329cd4419b69..77af91cf46d401cb02e0918616d9740bbeb49b86 100644 (file)
@@ -72,6 +72,7 @@ acpi_status acpi_ev_init_global_lock_handler(void);
 ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
                            acpi_ev_acquire_global_lock(u16 timeout))
 ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void))
+
 acpi_status acpi_ev_remove_global_lock_handler(void);
 
 /*
@@ -198,8 +199,6 @@ void
 acpi_ev_detach_region(union acpi_operand_object *region_obj,
                      u8 acpi_ns_is_locked);
 
-void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj);
-
 void
 acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
                            acpi_adr_space_type space_id, u32 function);
index 51b073b68f161799119af908957b1254d7c68781..fded776236e224736be84f73491b23054379b448 100644 (file)
@@ -187,6 +187,8 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
 extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
 extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
 extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
+extern const char acpi_gbl_lower_hex_digits[];
+extern const char acpi_gbl_upper_hex_digits[];
 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
@@ -361,6 +363,15 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);
 
 #endif                         /* ACPI_DEBUGGER */
 
+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
+
+#endif
+
 /*****************************************************************************
  *
  * Application globals
index bae1a35c345f808133f3e33f35184ca2c7ef50e4..7ead235555cfa6e060b0cd09b00bc8789e07ce7a 100644 (file)
@@ -67,7 +67,7 @@
 typedef const struct acpi_exdump_info {
        u8 opcode;
        u8 offset;
-       char *name;
+       const char *name;
 
 } acpi_exdump_info;
 
@@ -370,7 +370,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
 acpi_status
 acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                         union acpi_operand_object *operand,
-                        acpi_object_type * return_type,
+                        acpi_object_type *return_type,
                         union acpi_operand_object **return_desc);
 
 /*
index 9562a10a1a18855c70fc1436605a3a178961ebf3..13331d70dea02444145f89ab4677122905654ea2 100644 (file)
@@ -278,7 +278,7 @@ struct acpi_create_field_info {
 };
 
 typedef
-acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
+acpi_status (*acpi_internal_method) (struct acpi_walk_state * walk_state);
 
 /*
  * Bitmapped ACPI types. Used internally only
@@ -395,11 +395,12 @@ union acpi_predefined_info {
 
 /* Return object auto-repair info */
 
-typedef acpi_status(*acpi_object_converter) (struct acpi_namespace_node * scope,
-                                            union acpi_operand_object
-                                            *original_object,
-                                            union acpi_operand_object
-                                            **converted_object);
+typedef acpi_status (*acpi_object_converter) (struct acpi_namespace_node *
+                                             scope,
+                                             union acpi_operand_object *
+                                             original_object,
+                                             union acpi_operand_object **
+                                             converted_object);
 
 struct acpi_simple_repair_info {
        char name[ACPI_NAME_SIZE];
@@ -539,10 +540,10 @@ struct acpi_gpe_device_info {
        struct acpi_namespace_node *gpe_device;
 };
 
-typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
-                                        gpe_xrupt_info,
-                                        struct acpi_gpe_block_info *gpe_block,
-                                        void *context);
+typedef acpi_status (*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
+                                         gpe_xrupt_info,
+                                         struct acpi_gpe_block_info *
+                                         gpe_block, void *context);
 
 /* Information about each particular fixed event */
 
@@ -657,10 +658,11 @@ struct acpi_result_values {
 };
 
 typedef
-acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
-                                   union acpi_parse_object ** out_op);
+acpi_status (*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
+                                    union acpi_parse_object ** out_op);
 
-typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
+typedef
+acpi_status (*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
 
 /* Global handlers for AML Notifies */
 
@@ -700,7 +702,8 @@ union acpi_generic_state {
  *
  ****************************************************************************/
 
-typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state);
+typedef
+acpi_status (*acpi_execute_op) (struct acpi_walk_state * walk_state);
 
 /* Address Range info block */
 
@@ -853,24 +856,24 @@ struct acpi_parse_state {
 
 /* Parse object flags */
 
-#define ACPI_PARSEOP_GENERIC            0x01
-#define ACPI_PARSEOP_NAMED              0x02
-#define ACPI_PARSEOP_DEFERRED           0x04
-#define ACPI_PARSEOP_BYTELIST           0x08
-#define ACPI_PARSEOP_IN_STACK           0x10
-#define ACPI_PARSEOP_TARGET             0x20
-#define ACPI_PARSEOP_IN_CACHE           0x80
+#define ACPI_PARSEOP_GENERIC                0x01
+#define ACPI_PARSEOP_NAMED_OBJECT           0x02
+#define ACPI_PARSEOP_DEFERRED               0x04
+#define ACPI_PARSEOP_BYTELIST               0x08
+#define ACPI_PARSEOP_IN_STACK               0x10
+#define ACPI_PARSEOP_TARGET                 0x20
+#define ACPI_PARSEOP_IN_CACHE               0x80
 
 /* Parse object disasm_flags */
 
-#define ACPI_PARSEOP_IGNORE             0x01
-#define ACPI_PARSEOP_PARAMLIST          0x02
-#define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
-#define ACPI_PARSEOP_PREDEF_CHECKED     0x08
-#define ACPI_PARSEOP_CLOSING_PAREN      0x10
-#define ACPI_PARSEOP_COMPOUND           0x20
-#define ACPI_PARSEOP_ASSIGNMENT         0x40
-#define ACPI_PARSEOP_ELSEIF             0x80
+#define ACPI_PARSEOP_IGNORE                 0x01
+#define ACPI_PARSEOP_PARAMETER_LIST         0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST         0x04
+#define ACPI_PARSEOP_PREDEFINED_CHECKED     0x08
+#define ACPI_PARSEOP_CLOSING_PAREN          0x10
+#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT    0x20
+#define ACPI_PARSEOP_ASSIGNMENT             0x40
+#define ACPI_PARSEOP_ELSEIF                 0x80
 
 /*****************************************************************************
  *
@@ -1096,6 +1099,7 @@ struct acpi_external_list {
 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02       /* External came from a file */
 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04       /* Deallocate internal path on completion */
 #define ACPI_EXT_EXTERNAL_EMITTED           0x08       /* External() statement has been emitted */
+#define ACPI_EXT_ORIGIN_FROM_OPCODE         0x10       /* External came from a External() opcode */
 
 struct acpi_external_file {
        char *path;
index 411c18b7d541c8a9aa81b514af7b5f88f6d728af..a3b95431b7c5cb09e3a135d3e072f7cc4685bdc8 100644 (file)
 
 #define ACPI_IS_MISALIGNED(value)           (((acpi_size) value) & (sizeof(acpi_size)-1))
 
+/* Generic (power-of-two) rounding */
+
+#define ACPI_IS_ALIGNED(a, s)               (((a) & ((s) - 1)) == 0)
+#define ACPI_IS_POWER_OF_TWO(a)             ACPI_IS_ALIGNED(a, a)
+
 /*
  * Bitmask creation
  * Bit positions start at zero.
  * MASK_BITS_ABOVE creates a mask starting AT the position and above
  * MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ * MASK_BITS_ABOVE/BELOW accpets a bit offset to create a mask
+ * MASK_BITS_ABOVE/BELOW_32/64 accpets a bit width to create a mask
+ * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
+ * differences with the shift operator
  */
 #define ACPI_MASK_BITS_ABOVE(position)      (~((ACPI_UINT64_MAX) << ((u32) (position))))
 #define ACPI_MASK_BITS_BELOW(position)      ((ACPI_UINT64_MAX) << ((u32) (position)))
+#define ACPI_MASK_BITS_ABOVE_32(width)      ((u32) ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_32(width)      ((u32) ACPI_MASK_BITS_BELOW(width))
+#define ACPI_MASK_BITS_ABOVE_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
+                                                                                               ACPI_UINT64_MAX : \
+                                                                                               ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_64(width)      ((width) == ACPI_INTEGER_BIT_SIZE ? \
+                                                                                               (u64) 0 : \
+                                                                                               ACPI_MASK_BITS_BELOW(width))
 
 /* Bitfields within ACPI registers */
 
 /* Generic bitfield macros and masks */
 
 #define ACPI_GET_BITS(source_ptr, position, mask) \
-       ((*source_ptr >> position) & mask)
+       ((*(source_ptr) >> (position)) & (mask))
 
 #define ACPI_SET_BITS(target_ptr, position, mask, value) \
-       (*target_ptr |= ((value & mask) << position))
+       (*(target_ptr) |= (((value) & (mask)) << (position)))
 
 #define ACPI_1BIT_MASK      0x00000001
 #define ACPI_2BIT_MASK      0x00000003
index 022d69cb345a07014d73f674e5a55dd189042952..f33a4ba8e0cb7fe2208cbbbea97615e1cb8500cc 100644 (file)
@@ -206,9 +206,10 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
 void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
 
 void
-acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
+acpi_ns_dump_pathname(acpi_handle handle,
+                     const char *msg, u32 level, u32 component);
 
-void acpi_ns_print_pathname(u32 num_segments, char *pathname);
+void acpi_ns_print_pathname(u32 num_segments, const char *pathname);
 
 acpi_status
 acpi_ns_dump_one_object(acpi_handle obj_handle,
index 7da639d62416d2049e98c67a84379b9244e56a66..fc305775c3d73c2e45a6d37a5fa0f7578a6a45f4 100644 (file)
@@ -139,7 +139,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
  */
 const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
 
-char *acpi_ps_get_opcode_name(u16 opcode);
+const char *acpi_ps_get_opcode_name(u16 opcode);
 
 u8 acpi_ps_get_argument_count(u32 op_type);
 
index 5faeab41e3028c65d472f3dcd07ba00cf06162c6..888440b2cf2edc70bc5bf3293a2bcdeed9badb0e 100644 (file)
@@ -129,7 +129,8 @@ enum acpi_return_package_types {
        ACPI_PTYPE2_REV_FIXED = 9,
        ACPI_PTYPE2_FIX_VAR = 10,
        ACPI_PTYPE2_VAR_VAR = 11,
-       ACPI_PTYPE2_UUID_PAIR = 12
+       ACPI_PTYPE2_UUID_PAIR = 12,
+       ACPI_PTYPE_CUSTOM = 13
 };
 
 /* Support macros for users of the predefined info table */
@@ -340,7 +341,7 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
 
        {{"_BIX", METHOD_0ARGS,
          METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */
-       PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,
+       PACKAGE_INFO(ACPI_PTYPE_CUSTOM, ACPI_RTYPE_INTEGER, 16,
                     ACPI_RTYPE_STRING, 4, 0),
 
        {{"_BLT",
@@ -523,6 +524,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
          METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
        PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
 
+       {{"_FIT", METHOD_0ARGS,
+         METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},  /* ACPI 6.0 */
+
        {{"_FIX", METHOD_0ARGS,
          METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
        PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
@@ -1053,6 +1057,12 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
          METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
                         ACPI_RTYPE_BUFFER)}},
 
+       {{"_WPC", METHOD_0ARGS,
+         METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
+
+       {{"_WPP", METHOD_0ARGS,
+         METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
+
        PACKAGE_INFO(0, 0, 0, 0, 0, 0)  /* Table terminator */
 };
 #else
index 5dd58beafa5cc9f35510bea1fe1562c2ac1ba743..63da1e37caba535be16d5d691ecc12de8f516469 100644 (file)
@@ -124,7 +124,7 @@ typedef enum {
 typedef const struct acpi_rsdump_info {
        u8 opcode;
        u8 offset;
-       char *name;
+       const char *name;
        const char **pointer;
 
 } acpi_rsdump_info;
@@ -209,7 +209,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
 
 acpi_status
 acpi_rs_get_method_data(acpi_handle handle,
-                       char *path, struct acpi_buffer *ret_buffer);
+                       const char *path, struct acpi_buffer *ret_buffer);
 
 acpi_status
 acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
@@ -223,16 +223,16 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
  * rscalc
  */
 acpi_status
-acpi_rs_get_list_length(u8 * aml_buffer,
-                       u32 aml_buffer_length, acpi_size * size_needed);
+acpi_rs_get_list_length(u8 *aml_buffer,
+                       u32 aml_buffer_length, acpi_size *size_needed);
 
 acpi_status
 acpi_rs_get_aml_length(struct acpi_resource *resource_list,
-                      acpi_size resource_list_size, acpi_size * size_needed);
+                      acpi_size resource_list_size, acpi_size *size_needed);
 
 acpi_status
 acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
-                                    acpi_size * buffer_size_needed);
+                                    acpi_size *buffer_size_needed);
 
 acpi_status
 acpi_rs_convert_aml_to_resources(u8 * aml,
index b3b386e0b1194481741ae72c7ce2a6c727769e33..6235642e31d38af81c8605789f8391ab58ef26c2 100644 (file)
@@ -184,7 +184,7 @@ struct acpi_evaluate_info {
        /* 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 */
+       const 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) */
index 848ad3ac938f802b26c8478be40302a718b284f3..cd5a135fcf29ac41c8292c371c7e08b2c339d451 100644 (file)
@@ -161,8 +161,6 @@ acpi_tb_install_fixed_table(acpi_physical_address address,
 
 acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
 
-u8 acpi_is_valid_signature(char *signature);
-
 /*
  * tbxfload
  */
index e43ab6f2ad7ea3d51bd73486d5cfbdc8b3872cc0..a7dbb2b882cf2ce35ca4c209485f1e382c12d194 100644 (file)
@@ -136,16 +136,16 @@ extern const char *acpi_gbl_pt_decode[];
 #define ACPI_SMALL_VARIABLE_LENGTH      3
 
 typedef
-acpi_status(*acpi_walk_aml_callback) (u8 *aml,
-                                     u32 length,
-                                     u32 offset,
-                                     u8 resource_index, void **context);
+acpi_status (*acpi_walk_aml_callback) (u8 *aml,
+                                      u32 length,
+                                      u32 offset,
+                                      u8 resource_index, void **context);
 
 typedef
-acpi_status(*acpi_pkg_callback) (u8 object_type,
-                                union acpi_operand_object *source_object,
-                                union acpi_generic_state * state,
-                                void *context);
+acpi_status (*acpi_pkg_callback) (u8 object_type,
+                                 union acpi_operand_object * source_object,
+                                 union acpi_generic_state * state,
+                                 void *context);
 
 struct acpi_pkg_info {
        u8 *free_space;
@@ -166,6 +166,15 @@ struct acpi_pkg_info {
 #define DB_DWORD_DISPLAY    4
 #define DB_QWORD_DISPLAY    8
 
+/*
+ * utascii - ASCII utilities
+ */
+u8 acpi_ut_valid_nameseg(char *signature);
+
+u8 acpi_ut_valid_name_char(char character, u32 position);
+
+void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count);
+
 /*
  * utnonansi - Non-ANSI C library functions
  */
@@ -175,7 +184,14 @@ void acpi_ut_strlwr(char *src_string);
 
 int acpi_ut_stricmp(char *string1, char *string2);
 
-acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
+acpi_status
+acpi_ut_strtoul64(char *string,
+                 u32 base, u32 max_integer_byte_width, u64 *ret_integer);
+
+/* Values for max_integer_byte_width above */
+
+#define ACPI_MAX32_BYTE_WIDTH       4
+#define ACPI_MAX64_BYTE_WIDTH       8
 
 /*
  * utglobal - Global data structures and procedures
@@ -266,7 +282,8 @@ acpi_ut_trace(u32 line_number,
 void
 acpi_ut_trace_ptr(u32 line_number,
                  const char *function_name,
-                 const char *module_name, u32 component_id, void *pointer);
+                 const char *module_name,
+                 u32 component_id, const void *pointer);
 
 void
 acpi_ut_trace_u32(u32 line_number,
@@ -276,7 +293,8 @@ acpi_ut_trace_u32(u32 line_number,
 void
 acpi_ut_trace_str(u32 line_number,
                  const char *function_name,
-                 const char *module_name, u32 component_id, char *string);
+                 const char *module_name,
+                 u32 component_id, const char *string);
 
 void
 acpi_ut_exit(u32 line_number,
@@ -335,12 +353,12 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
  */
 acpi_status
 acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
-                       char *path,
+                       const char *path,
                        u32 expected_return_btypes,
                        union acpi_operand_object **return_desc);
 
 acpi_status
-acpi_ut_evaluate_numeric_object(char *object_name,
+acpi_ut_evaluate_numeric_object(const char *object_name,
                                struct acpi_namespace_node *device_node,
                                u64 *value);
 
@@ -415,7 +433,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
 union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
 
 acpi_status
-acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
+acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size *obj_length);
 
 /*
  * utosi - Support for the _OSI predefined control method
@@ -526,15 +544,15 @@ void acpi_ut_set_integer_width(u8 revision);
 void
 acpi_ut_display_init_pathname(u8 type,
                              struct acpi_namespace_node *obj_handle,
-                             char *path);
+                             const char *path);
 #endif
 
 /*
  * utownerid - Support for Table/Method Owner IDs
  */
-acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
+acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id);
 
-void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
+void acpi_ut_release_owner_id(acpi_owner_id *owner_id);
 
 /*
  * utresrc
@@ -570,10 +588,6 @@ void acpi_ut_print_string(char *string, u16 max_length);
 void ut_convert_backslashes(char *pathname);
 #endif
 
-u8 acpi_ut_valid_acpi_name(char *name);
-
-u8 acpi_ut_valid_acpi_char(char character, u32 position);
-
 void acpi_ut_repair_name(char *name);
 
 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
@@ -628,7 +642,7 @@ void acpi_ut_dump_allocation_info(void);
 void acpi_ut_dump_allocations(u32 component, const char *module);
 
 acpi_status
-acpi_ut_create_list(char *list_name,
+acpi_ut_create_list(const char *list_name,
                    u16 object_size, struct acpi_memory_list **return_cache);
 
 #endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
index 772178c96ccf25a90a003135bb0f33ab89bcf104..62bd446535f5dfacbd65af7ed25a4884ce7e3f27 100644 (file)
@@ -738,9 +738,9 @@ acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name)
        original_aml = return_buffer.pointer;
 
        acpi_dm_compare_aml_resources(original_aml->buffer.pointer,
-                                     (acpi_rsdesc_size) original_aml->buffer.
+                                     (acpi_rsdesc_size)original_aml->buffer.
                                      length, new_aml.pointer,
-                                     (acpi_rsdesc_size) new_aml.length);
+                                     (acpi_rsdesc_size)new_aml.length);
 
        /* Cleanup and exit */
 
index 68f4e0f4b095ef0e1f7753d2680a3dc3e1ecf305..7cd07b27f75866228f05b06ac913be8c704bb1d7 100644 (file)
@@ -194,7 +194,7 @@ acpi_db_convert_to_buffer(char *string, union acpi_object *object)
  *
  ******************************************************************************/
 
-acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object)
+acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
 {
        char *this;
        char *next;
@@ -252,7 +252,7 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object)
 
 acpi_status
 acpi_db_convert_to_object(acpi_object_type type,
-                         char *string, union acpi_object * object)
+                         char *string, union acpi_object *object)
 {
        acpi_status status = AE_OK;
 
@@ -277,7 +277,9 @@ acpi_db_convert_to_object(acpi_object_type type,
        default:
 
                object->type = ACPI_TYPE_INTEGER;
-               status = acpi_ut_strtoul64(string, 16, &object->integer.value);
+               status =
+                   acpi_ut_strtoul64(string, 16, acpi_gbl_integer_byte_width,
+                                     &object->integer.value);
                break;
        }
 
index c814855376e27e8cefac4140b0725069434ec803..12df2915ad74beaac3907a5039a6dac45c15f225 100644 (file)
@@ -361,7 +361,7 @@ acpi_db_execution_walk(acpi_handle obj_handle,
  ******************************************************************************/
 
 void
-acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags)
+acpi_db_execute(char *name, char **args, acpi_object_type *types, u32 flags)
 {
        acpi_status status;
        struct acpi_buffer return_obj;
index 417c02a899150131666cea221fa5968ce71ed783..7cd5d2e022dad26388bdeca44450b24d81e729fb 100644 (file)
@@ -57,12 +57,12 @@ static u32 acpi_db_get_line(char *input_buffer);
 
 static u32 acpi_db_match_command(char *user_command);
 
-static void acpi_db_display_command_info(char *command, u8 display_all);
+static void acpi_db_display_command_info(const char *command, u8 display_all);
 
 static void acpi_db_display_help(char *command);
 
 static u8
-acpi_db_match_command_help(char *command,
+acpi_db_match_command_help(const char *command,
                           const struct acpi_db_command_help *help);
 
 /*
@@ -348,7 +348,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
  ******************************************************************************/
 
 static u8
-acpi_db_match_command_help(char *command,
+acpi_db_match_command_help(const char *command,
                           const struct acpi_db_command_help *help)
 {
        char *invocation = help->invocation;
@@ -402,7 +402,7 @@ acpi_db_match_command_help(char *command,
  *
  ******************************************************************************/
 
-static void acpi_db_display_command_info(char *command, u8 display_all)
+static void acpi_db_display_command_info(const char *command, u8 display_all)
 {
        const struct acpi_db_command_help *next;
        u8 matched;
@@ -466,7 +466,7 @@ static void acpi_db_display_help(char *command)
  ******************************************************************************/
 
 char *acpi_db_get_next_token(char *string,
-                            char **next, acpi_object_type * return_type)
+                            char **next, acpi_object_type *return_type)
 {
        char *start;
        u32 depth;
@@ -656,8 +656,9 @@ static u32 acpi_db_match_command(char *user_command)
        }
 
        for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) {
-               if (strstr(acpi_gbl_db_commands[i].name, user_command) ==
-                   acpi_gbl_db_commands[i].name) {
+               if (strstr
+                   (ACPI_CAST_PTR(char, acpi_gbl_db_commands[i].name),
+                    user_command) == acpi_gbl_db_commands[i].name) {
                        return (i);
                }
        }
@@ -683,8 +684,8 @@ static u32 acpi_db_match_command(char *user_command)
 
 acpi_status
 acpi_db_command_dispatch(char *input_buffer,
-                        struct acpi_walk_state * walk_state,
-                        union acpi_parse_object * op)
+                        struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op)
 {
        u32 temp;
        u32 command_index;
index 3c23b5a1079bacb6b4cc70ee844ed3d2a5100cf1..8667f14d535edcc58020c0ac82055ac297c17c9f 100644 (file)
@@ -285,7 +285,7 @@ void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg)
        u32 max_depth = ACPI_UINT32_MAX;
        acpi_owner_id owner_id;
 
-       owner_id = (acpi_owner_id) strtoul(owner_arg, NULL, 0);
+       owner_id = (acpi_owner_id)strtoul(owner_arg, NULL, 0);
 
        /* Now we can check for the depth argument */
 
@@ -709,7 +709,7 @@ acpi_db_integrity_walk(acpi_handle obj_handle,
                return (AE_OK);
        }
 
-       if (!acpi_ut_valid_acpi_name(node->name.ascii)) {
+       if (!acpi_ut_valid_nameseg(node->name.ascii)) {
                acpi_os_printf("Invalid AcpiName for Node %p\n", node);
                return (AE_OK);
        }
index b37a2c77b86b5bd6c86b0499a262389b08145d0d..ae80106d100052da4ce5196be2fbeebac23488e7 100644 (file)
@@ -56,8 +56,6 @@ acpi_status acpi_db_second_pass_parse(union acpi_parse_object *root);
 void acpi_db_dump_buffer(u32 address);
 #endif
 
-static char *gbl_hex_to_ascii = "0123456789ABCDEF";
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_db_match_argument
@@ -82,8 +80,9 @@ acpi_db_match_argument(char *user_argument,
        }
 
        for (i = 0; arguments[i].name; i++) {
-               if (strstr(arguments[i].name, user_argument) ==
-                   arguments[i].name) {
+               if (strstr(ACPI_CAST_PTR(char, arguments[i].name),
+                          ACPI_CAST_PTR(char,
+                                        user_argument)) == arguments[i].name) {
                        return (i);
                }
        }
@@ -339,7 +338,7 @@ void acpi_db_uint32_to_hex_string(u32 value, char *buffer)
        buffer[8] = '\0';
 
        for (i = 7; i >= 0; i--) {
-               buffer[i] = gbl_hex_to_ascii[value & 0x0F];
+               buffer[i] = acpi_gbl_upper_hex_digits[value & 0x0F];
                value = value >> 4;
        }
 }
index e94e0d80bc7b6743ef4f6d16acf5eaf4671393ad..124db237775db8192d271c0f5dc9ab4fd174670a 100644 (file)
@@ -162,8 +162,8 @@ void acpi_db_signal_break_point(struct acpi_walk_state *walk_state)
  ******************************************************************************/
 
 acpi_status
-acpi_db_single_step(struct acpi_walk_state * walk_state,
-                   union acpi_parse_object * op, u32 opcode_class)
+acpi_db_single_step(struct acpi_walk_state *walk_state,
+                   union acpi_parse_object *op, u32 opcode_class)
 {
        union acpi_parse_object *next;
        acpi_status status = AE_OK;
index c9a663f21ac8904bb10cff9b11809a0121a8a037..4ddcbf1002346b284042ad89d592714cf46e524f 100644 (file)
@@ -163,8 +163,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
-                           union acpi_parse_object * op)
+acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
+                           union acpi_parse_object *op)
 {
        acpi_status status = AE_OK;
        union acpi_generic_state *control_state;
index 5aa1c5feee504d4c7a0222b27da8fe30c64a31d5..f1e6dcc7a8271c6527e954299774841e5f4eaf78 100644 (file)
@@ -188,7 +188,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
 
 acpi_status
 acpi_ds_initialize_objects(u32 table_index,
-                          struct acpi_namespace_node * start_node)
+                          struct acpi_namespace_node *start_node)
 {
        acpi_status status;
        struct acpi_init_walk_info info;
index 1982310e6d83a3aa6a6e510e8f72682fb1c05226..47c7b52a519c8d25054f0627da222c39fa8b8fd3 100644 (file)
@@ -209,7 +209,7 @@ acpi_ds_detect_named_opcodes(struct acpi_walk_state *walk_state,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_error(acpi_status status, struct acpi_walk_state * walk_state)
+acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
 {
        u32 aml_offset;
 
@@ -428,6 +428,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
                                obj_desc->method.mutex->mutex.
                                    original_sync_level =
                                    obj_desc->method.mutex->mutex.sync_level;
+
+                               obj_desc->method.mutex->mutex.thread_id =
+                                   acpi_os_get_thread_id();
                        }
                }
 
index 8ca9416320e079c170863fbdf9f0882131293244..f393de9f588780b0ade5a1942def423347322229 100644 (file)
@@ -569,7 +569,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
                                        /* TBD: May only be temporary */
 
                                        obj_desc =
-                                           acpi_ut_create_string_object((acpi_size) name_length);
+                                           acpi_ut_create_string_object((acpi_size)name_length);
 
                                        strncpy(obj_desc->string.pointer,
                                                name_string, name_length);
index d1cedcfda1d2985b5e29c6f8347447a4d59df6c5..fd34040d4f44afdda54c8b7d87c76c2f9d3a4869 100644 (file)
@@ -137,8 +137,8 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
  ******************************************************************************/
 
 acpi_status
-acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
-                      union acpi_parse_object ** out_op)
+acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
+                      union acpi_parse_object **out_op)
 {
        union acpi_parse_object *op;
        struct acpi_namespace_node *node;
index 0bac6e14170e386886c3626f7362a5aa752bafa9..762db3fa70e0f94158dd858781805cf615b2f937 100644 (file)
@@ -490,8 +490,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
 
                        status =
                            acpi_ds_create_index_field(op,
-                                                      (acpi_handle) arg->
-                                                      common.node, walk_state);
+                                                      (acpi_handle)arg->common.
+                                                      node, walk_state);
                        break;
 
                case AML_BANK_FIELD_OP:
index 3a26ddbaed6d64502f15405c09867c56d78ff434..e3338698e56bf6ed0b56313fd8346b3b25481af2 100644 (file)
@@ -143,8 +143,8 @@ acpi_ds_result_pop(union acpi_operand_object **object,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_push(union acpi_operand_object * object,
-                   struct acpi_walk_state * walk_state)
+acpi_ds_result_push(union acpi_operand_object *object,
+                   struct acpi_walk_state *walk_state)
 {
        union acpi_generic_state *state;
        acpi_status status;
@@ -307,7 +307,7 @@ static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state)
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
+acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state)
 {
        ACPI_FUNCTION_NAME(ds_obj_stack_push);
 
@@ -354,7 +354,7 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
+acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state)
 {
        u32 i;
 
@@ -411,7 +411,7 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
                return;
        }
 
-       for (i = (s32) pop_count - 1; i >= 0; i--) {
+       for (i = (s32)pop_count - 1; i >= 0; i--) {
                if (walk_state->num_operands == 0) {
                        return;
                }
index b47e62aaf654658e0f4bc5993c4051797546a3c8..4b4949ce05bc2bdd0ef8940737cee7d18f5b9c5b 100644 (file)
@@ -440,7 +440,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list)
 
                                gpe_event_info =
                                    &gpe_block->
-                                   event_info[((acpi_size) i *
+                                   event_info[((acpi_size)i *
                                                ACPI_GPE_REGISTER_WIDTH) + j];
                                gpe_number =
                                    j + gpe_register_info->base_gpe_number;
@@ -652,7 +652,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_enable_gpe(void *context)
  *
  ******************************************************************************/
 
-acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info * gpe_event_info)
+acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
        acpi_status status;
 
index 447fa1cac64fdb3c3bdde2f3199e0ae326a8d953..d54014cab01d7fda62ad3dc22b4071d4be0bf1fb 100644 (file)
@@ -211,7 +211,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
        /* Allocate the GPE register information block */
 
-       gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->
+       gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->
                                                 register_count *
                                                 sizeof(struct
                                                        acpi_gpe_register_info));
@@ -225,7 +225,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
         * Allocate the GPE event_info block. There are eight distinct GPEs
         * per register. Initialization to zeros is sufficient.
         */
-       gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->gpe_count *
+       gpe_event_info = ACPI_ALLOCATE_ZEROED((acpi_size)gpe_block->gpe_count *
                                              sizeof(struct
                                                     acpi_gpe_event_info));
        if (!gpe_event_info) {
index 66c4b5b7cd642c62bb5032e7906426194a5158a5..3f150d567e6486a599e8d4c288c3b1ba30d9b0fc 100644 (file)
@@ -163,7 +163,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
 acpi_status
 acpi_ev_get_gpe_xrupt_block(u32 interrupt_number,
-                           struct acpi_gpe_xrupt_info ** gpe_xrupt_block)
+                           struct acpi_gpe_xrupt_info **gpe_xrupt_block)
 {
        struct acpi_gpe_xrupt_info *next_gpe_xrupt;
        struct acpi_gpe_xrupt_info *gpe_xrupt;
@@ -320,7 +320,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                /* Now look at the individual GPEs in this byte register */
 
                for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
-                       gpe_event_info = &gpe_block->event_info[((acpi_size) i *
+                       gpe_event_info = &gpe_block->event_info[((acpi_size)i *
                                                                 ACPI_GPE_REGISTER_WIDTH)
                                                                + j];
 
index 0f6be8956a99e6f87695c19929858ee3df24d453..24768ca03f191ae5fc98f8c130c6c2099c53d8e5 100644 (file)
@@ -359,7 +359,7 @@ union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type
  ******************************************************************************/
 
 acpi_status
-acpi_ev_install_space_handler(struct acpi_namespace_node * node,
+acpi_ev_install_space_handler(struct acpi_namespace_node *node,
                              acpi_adr_space_type space_id,
                              acpi_adr_space_handler handler,
                              acpi_adr_space_setup setup, void *context)
index c67d78c5995fc90348f4bddd20350d7ac814d313..f51d43adb7d1c70743fba9d4715b6a7588fc437a 100644 (file)
@@ -99,8 +99,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
  ******************************************************************************/
 
 acpi_status
-acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
-                            u32 notify_value)
+acpi_ev_queue_notify_request(struct acpi_namespace_node *node, u32 notify_value)
 {
        union acpi_operand_object *obj_desc;
        union acpi_operand_object *handler_list_head = NULL;
index 63924d1c737a0b303f999fa4de9f08cf5e12a89b..4c6f795140402a3d74231882cb67561fe0c15115 100644 (file)
@@ -526,81 +526,59 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ev_associate_reg_method
+ * FUNCTION:    acpi_ev_execute_reg_method
  *
  * PARAMETERS:  region_obj          - Region object
+ *              function            - Passed to _REG: On (1) or Off (0)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Find and associate _REG method to a region
+ * DESCRIPTION: Execute _REG method for a region
  *
  ******************************************************************************/
 
-void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj)
+acpi_status
+acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 {
-       acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+       struct acpi_evaluate_info *info;
+       union acpi_operand_object *args[3];
+       union acpi_operand_object *region_obj2;
+       const acpi_name *reg_name_ptr =
+           ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
        struct acpi_namespace_node *method_node;
        struct acpi_namespace_node *node;
-       union acpi_operand_object *region_obj2;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE(ev_associate_reg_method);
+       ACPI_FUNCTION_TRACE(ev_execute_reg_method);
+
+       if (!acpi_gbl_namespace_initialized ||
+           region_obj->region.handler == NULL) {
+               return_ACPI_STATUS(AE_OK);
+       }
 
        region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
-               return_VOID;
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
+       /*
+        * Find any "_REG" method associated with this region definition.
+        * The method should always be updated as this function may be
+        * invoked after a namespace change.
+        */
        node = region_obj->region.node->parent;
-
-       /* Find any "_REG" method associated with this region definition */
-
        status =
            acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
                                     &method_node);
        if (ACPI_SUCCESS(status)) {
                /*
-                * The _REG method is optional and there can be only one per region
-                * definition. This will be executed when the handler is attached
-                * or removed
+                * The _REG method is optional and there can be only one per
+                * region definition. This will be executed when the handler is
+                * attached or removed.
                 */
                region_obj2->extra.method_REG = method_node;
        }
-
-       return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ev_execute_reg_method
- *
- * PARAMETERS:  region_obj          - Region object
- *              function            - Passed to _REG: On (1) or Off (0)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Execute _REG method for a region
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
-{
-       struct acpi_evaluate_info *info;
-       union acpi_operand_object *args[3];
-       union acpi_operand_object *region_obj2;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE(ev_execute_reg_method);
-
-       region_obj2 = acpi_ns_get_secondary_object(region_obj);
-       if (!region_obj2) {
-               return_ACPI_STATUS(AE_NOT_EXIST);
-       }
-
-       if (region_obj2->extra.method_REG == NULL ||
-           region_obj->region.handler == NULL ||
-           !acpi_gbl_namespace_initialized) {
+       if (region_obj2->extra.method_REG == NULL) {
                return_ACPI_STATUS(AE_OK);
        }
 
index fda869c9ad0b9984e9fc2e4e545295596e06f978..b6ea9c0d0d8c42ce564181a3b7987fd390680b0d 100644 (file)
@@ -227,7 +227,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
 
                                /* Install a handler for this PCI root bridge */
 
-                               status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
+                               status = acpi_install_address_space_handler((acpi_handle)pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
                                if (ACPI_FAILURE(status)) {
                                        if (status == AE_SAME_HANDLER) {
                                                /*
@@ -518,7 +518,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
                return_ACPI_STATUS(AE_OK);
        }
 
-       acpi_ev_associate_reg_method(region_obj);
        region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;
 
        node = region_obj->region.node->parent;
index 90456714821fc36cb88cf6484ff55ffe9cdf229b..17cfef721d00a40e74ccd6ecda3d4ccbebebc6e4 100644 (file)
@@ -917,7 +917,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
  *              the FADT-defined gpe blocks. Otherwise, the GPE block device.
  *
  ******************************************************************************/
-acpi_status acpi_get_gpe_device(u32 index, acpi_handle * gpe_device)
+acpi_status acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
 {
        struct acpi_gpe_device_info info;
        acpi_status status;
diff --git a/drivers/acpi/acpica/exconcat.c b/drivers/acpi/acpica/exconcat.c
new file mode 100644 (file)
index 0000000..2423fe0
--- /dev/null
@@ -0,0 +1,439 @@
+/******************************************************************************
+ *
+ * Module Name: exconcat - Concatenate-type AML operators
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, 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 "acinterp.h"
+#include "amlresrc.h"
+
+#define _COMPONENT          ACPI_EXECUTER
+ACPI_MODULE_NAME("exconcat")
+
+/* Local Prototypes */
+static acpi_status
+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
+                                     union acpi_operand_object **result_desc);
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_do_concatenate
+ *
+ * PARAMETERS:  operand0            - First source object
+ *              operand1            - Second source object
+ *              actual_return_desc  - Where to place the return object
+ *              walk_state          - Current walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion
+ *              rules as necessary.
+ * NOTE:
+ * Per the ACPI spec (up to 6.1), Concatenate only supports Integer,
+ * String, and Buffer objects. However, we support all objects here
+ * as an extension. This improves the usefulness of both Concatenate
+ * and the Printf/Fprintf macros. The extension returns a string
+ * describing the object type for the other objects.
+ * 02/2016.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_do_concatenate(union acpi_operand_object *operand0,
+                      union acpi_operand_object *operand1,
+                      union acpi_operand_object **actual_return_desc,
+                      struct acpi_walk_state *walk_state)
+{
+       union acpi_operand_object *local_operand0 = operand0;
+       union acpi_operand_object *local_operand1 = operand1;
+       union acpi_operand_object *temp_operand1 = NULL;
+       union acpi_operand_object *return_desc;
+       char *buffer;
+       acpi_object_type operand0_type;
+       acpi_object_type operand1_type;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(ex_do_concatenate);
+
+       /* Operand 0 preprocessing */
+
+       switch (operand0->common.type) {
+       case ACPI_TYPE_INTEGER:
+       case ACPI_TYPE_STRING:
+       case ACPI_TYPE_BUFFER:
+
+               operand0_type = operand0->common.type;
+               break;
+
+       default:
+
+               /* For all other types, get the "object type" string */
+
+               status =
+                   acpi_ex_convert_to_object_type_string(operand0,
+                                                         &local_operand0);
+               if (ACPI_FAILURE(status)) {
+                       goto cleanup;
+               }
+
+               operand0_type = ACPI_TYPE_STRING;
+               break;
+       }
+
+       /* Operand 1 preprocessing */
+
+       switch (operand1->common.type) {
+       case ACPI_TYPE_INTEGER:
+       case ACPI_TYPE_STRING:
+       case ACPI_TYPE_BUFFER:
+
+               operand1_type = operand1->common.type;
+               break;
+
+       default:
+
+               /* For all other types, get the "object type" string */
+
+               status =
+                   acpi_ex_convert_to_object_type_string(operand1,
+                                                         &local_operand1);
+               if (ACPI_FAILURE(status)) {
+                       goto cleanup;
+               }
+
+               operand1_type = ACPI_TYPE_STRING;
+               break;
+       }
+
+       /*
+        * Convert the second operand if necessary. The first operand (0)
+        * determines the type of the second operand (1) (See the Data Types
+        * section of the ACPI specification). Both object types are
+        * guaranteed to be either Integer/String/Buffer by the operand
+        * resolution mechanism.
+        */
+       switch (operand0_type) {
+       case ACPI_TYPE_INTEGER:
+
+               status =
+                   acpi_ex_convert_to_integer(local_operand1, &temp_operand1,
+                                              16);
+               break;
+
+       case ACPI_TYPE_BUFFER:
+
+               status =
+                   acpi_ex_convert_to_buffer(local_operand1, &temp_operand1);
+               break;
+
+       case ACPI_TYPE_STRING:
+
+               switch (operand1_type) {
+               case ACPI_TYPE_INTEGER:
+               case ACPI_TYPE_STRING:
+               case ACPI_TYPE_BUFFER:
+
+                       /* Other types have already been converted to string */
+
+                       status =
+                           acpi_ex_convert_to_string(local_operand1,
+                                                     &temp_operand1,
+                                                     ACPI_IMPLICIT_CONVERT_HEX);
+                       break;
+
+               default:
+
+                       status = AE_OK;
+                       break;
+               }
+               break;
+
+       default:
+
+               ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
+                           operand0->common.type));
+               status = AE_AML_INTERNAL;
+       }
+
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
+       }
+
+       /* Take care with any newly created operand objects */
+
+       if ((local_operand1 != operand1) && (local_operand1 != temp_operand1)) {
+               acpi_ut_remove_reference(local_operand1);
+       }
+
+       local_operand1 = temp_operand1;
+
+       /*
+        * Both operands are now known to be the same object type
+        * (Both are Integer, String, or Buffer), and we can now perform
+        * the concatenation.
+        *
+        * There are three cases to handle, as per the ACPI spec:
+        *
+        * 1) Two Integers concatenated to produce a new Buffer
+        * 2) Two Strings concatenated to produce a new String
+        * 3) Two Buffers concatenated to produce a new Buffer
+        */
+       switch (operand0_type) {
+       case ACPI_TYPE_INTEGER:
+
+               /* Result of two Integers is a Buffer */
+               /* Need enough buffer space for two integers */
+
+               return_desc = acpi_ut_create_buffer_object((acpi_size)
+                                                          ACPI_MUL_2
+                                                          (acpi_gbl_integer_byte_width));
+               if (!return_desc) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
+               }
+
+               buffer = (char *)return_desc->buffer.pointer;
+
+               /* Copy the first integer, LSB first */
+
+               memcpy(buffer, &operand0->integer.value,
+                      acpi_gbl_integer_byte_width);
+
+               /* Copy the second integer (LSB first) after the first */
+
+               memcpy(buffer + acpi_gbl_integer_byte_width,
+                      &local_operand1->integer.value,
+                      acpi_gbl_integer_byte_width);
+               break;
+
+       case ACPI_TYPE_STRING:
+
+               /* Result of two Strings is a String */
+
+               return_desc = acpi_ut_create_string_object(((acpi_size)
+                                                           local_operand0->
+                                                           string.length +
+                                                           local_operand1->
+                                                           string.length));
+               if (!return_desc) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
+               }
+
+               buffer = return_desc->string.pointer;
+
+               /* Concatenate the strings */
+
+               strcpy(buffer, local_operand0->string.pointer);
+               strcat(buffer, local_operand1->string.pointer);
+               break;
+
+       case ACPI_TYPE_BUFFER:
+
+               /* Result of two Buffers is a Buffer */
+
+               return_desc = acpi_ut_create_buffer_object(((acpi_size)
+                                                           operand0->buffer.
+                                                           length +
+                                                           local_operand1->
+                                                           buffer.length));
+               if (!return_desc) {
+                       status = AE_NO_MEMORY;
+                       goto cleanup;
+               }
+
+               buffer = (char *)return_desc->buffer.pointer;
+
+               /* Concatenate the buffers */
+
+               memcpy(buffer, operand0->buffer.pointer,
+                      operand0->buffer.length);
+               memcpy(buffer + operand0->buffer.length,
+                      local_operand1->buffer.pointer,
+                      local_operand1->buffer.length);
+               break;
+
+       default:
+
+               /* Invalid object type, should not happen here */
+
+               ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
+                           operand0->common.type));
+               status = AE_AML_INTERNAL;
+               goto cleanup;
+       }
+
+       *actual_return_desc = return_desc;
+
+cleanup:
+       if (local_operand0 != operand0) {
+               acpi_ut_remove_reference(local_operand0);
+       }
+
+       if (local_operand1 != operand1) {
+               acpi_ut_remove_reference(local_operand1);
+       }
+
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_convert_to_object_type_string
+ *
+ * PARAMETERS:  obj_desc            - Object to be converted
+ *              return_desc         - Where to place the return object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Convert an object of arbitrary type to a string object that
+ *              contains the namestring for the object. Used for the
+ *              concatenate operator.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
+                                     union acpi_operand_object **result_desc)
+{
+       union acpi_operand_object *return_desc;
+       const char *type_string;
+
+       type_string = acpi_ut_get_type_name(obj_desc->common.type);
+
+       return_desc = acpi_ut_create_string_object(((acpi_size)strlen(type_string) + 9));       /* 9 For "[ Object]" */
+       if (!return_desc) {
+               return (AE_NO_MEMORY);
+       }
+
+       strcpy(return_desc->string.pointer, "[");
+       strcat(return_desc->string.pointer, type_string);
+       strcat(return_desc->string.pointer, " Object]");
+
+       *result_desc = return_desc;
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_concat_template
+ *
+ * PARAMETERS:  operand0            - First source object
+ *              operand1            - Second source object
+ *              actual_return_desc  - Where to place the return object
+ *              walk_state          - Current walk state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_concat_template(union acpi_operand_object *operand0,
+                       union acpi_operand_object *operand1,
+                       union acpi_operand_object **actual_return_desc,
+                       struct acpi_walk_state *walk_state)
+{
+       acpi_status status;
+       union acpi_operand_object *return_desc;
+       u8 *new_buf;
+       u8 *end_tag;
+       acpi_size length0;
+       acpi_size length1;
+       acpi_size new_length;
+
+       ACPI_FUNCTION_TRACE(ex_concat_template);
+
+       /*
+        * Find the end_tag descriptor in each resource template.
+        * Note1: returned pointers point TO the end_tag, not past it.
+        * Note2: zero-length buffers are allowed; treated like one end_tag
+        */
+
+       /* Get the length of the first resource template */
+
+       status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
+
+       /* Get the length of the second resource template */
+
+       status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
+
+       /* Combine both lengths, minimum size will be 2 for end_tag */
+
+       new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
+
+       /* Create a new buffer object for the result (with one end_tag) */
+
+       return_desc = acpi_ut_create_buffer_object(new_length);
+       if (!return_desc) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       /*
+        * Copy the templates to the new buffer, 0 first, then 1 follows. One
+        * end_tag descriptor is copied from Operand1.
+        */
+       new_buf = return_desc->buffer.pointer;
+       memcpy(new_buf, operand0->buffer.pointer, length0);
+       memcpy(new_buf + length0, operand1->buffer.pointer, length1);
+
+       /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
+
+       new_buf[new_length - 1] = 0;
+       new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
+
+       /* Return the completed resource template */
+
+       *actual_return_desc = return_desc;
+       return_ACPI_STATUS(AE_OK);
+}
index f7416130103798549e0b95f0f80069e381c30195..a1d177d58254cd8e201836481a51b809ec98c628 100644 (file)
@@ -118,7 +118,9 @@ acpi_ex_add_table(u32 table_index,
        /* Execute any module-level code that was found in the table */
 
        acpi_ex_exit_interpreter();
-       acpi_ns_exec_module_code_list();
+       if (acpi_gbl_group_module_level_code) {
+               acpi_ns_exec_module_code_list();
+       }
        acpi_ex_enter_interpreter();
 
        /*
index 0b9f2c13b98a906ba72202285d80890238ddcae6..b7e9b3d803e169aedf7e9d3fd15b544832ce08ff 100644 (file)
@@ -124,7 +124,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
                 * of ACPI 3.0) is that the to_integer() operator allows both decimal
                 * and hexadecimal strings (hex prefixed with "0x").
                 */
-               status = acpi_ut_strtoul64((char *)pointer, flags, &result);
+               status = acpi_ut_strtoul64((char *)pointer, flags,
+                                          acpi_gbl_integer_byte_width,
+                                          &result);
                if (ACPI_FAILURE(status)) {
                        return_ACPI_STATUS(status);
                }
@@ -439,7 +441,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                 * Need enough space for one ASCII integer (plus null terminator)
                 */
                return_desc =
-                   acpi_ut_create_string_object((acpi_size) string_length);
+                   acpi_ut_create_string_object((acpi_size)string_length);
                if (!return_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -518,7 +520,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
                }
 
                return_desc =
-                   acpi_ut_create_string_object((acpi_size) string_length);
+                   acpi_ut_create_string_object((acpi_size)string_length);
                if (!return_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
index bea9612e4720f83b277df400eddffe4654c99d9f..613ba6eb08bbb8899be5c7a0440a944da04a655c 100644 (file)
@@ -394,7 +394,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
        obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
        obj_desc->processor.length = (u8) operand[3]->integer.value;
        obj_desc->processor.address =
-           (acpi_io_address) operand[2]->integer.value;
+           (acpi_io_address)operand[2]->integer.value;
 
        /* Install the processor object in the parent Node */
 
index ee30974b245a581c0956ea002c81c5cd70ce2210..fce6b2e10209b01747ae2106f93cb2ad21f120af 100644 (file)
@@ -55,9 +55,9 @@ ACPI_MODULE_NAME("exdump")
  */
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /* Local prototypes */
-static void acpi_ex_out_string(char *title, char *value);
+static void acpi_ex_out_string(const char *title, const char *value);
 
-static void acpi_ex_out_pointer(char *title, void *value);
+static void acpi_ex_out_pointer(const char *title, const void *value);
 
 static void
 acpi_ex_dump_object(union acpi_operand_object *obj_desc,
@@ -365,8 +365,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
                    struct acpi_exdump_info *info)
 {
        u8 *target;
-       char *name;
-       const char *reference_name;
+       const char *name;
        u8 count;
        union acpi_operand_object *start;
        union acpi_operand_object *data = NULL;
@@ -459,9 +458,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
 
                case ACPI_EXD_REFERENCE:
 
-                       reference_name = acpi_ut_get_reference_name(obj_desc);
                        acpi_ex_out_string("Class Name",
-                                          ACPI_CAST_PTR(char, reference_name));
+                                          acpi_ut_get_reference_name
+                                          (obj_desc));
                        acpi_ex_dump_reference_obj(obj_desc);
                        break;
 
@@ -934,12 +933,12 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
  *
  ******************************************************************************/
 
-static void acpi_ex_out_string(char *title, char *value)
+static void acpi_ex_out_string(const char *title, const char *value)
 {
        acpi_os_printf("%20s : %s\n", title, value);
 }
 
-static void acpi_ex_out_pointer(char *title, void *value)
+static void acpi_ex_out_pointer(const char *title, const void *value)
 {
        acpi_os_printf("%20s : %p\n", title, value);
 }
index d5d8020a85236375ee3af3a8c1cf4a44df7d6f36..d7d3ee36338b4b49d11b8112ba01a2ea53288efb 100644 (file)
@@ -126,7 +126,7 @@ acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length)
  ******************************************************************************/
 
 acpi_status
-acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,
+acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
                             union acpi_operand_object *obj_desc,
                             union acpi_operand_object **ret_buffer_desc)
 {
@@ -233,7 +233,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state,
         * Note: Field.length is in bits.
         */
        length =
-           (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
+           (acpi_size)ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
 
        if (length > acpi_gbl_integer_byte_width) {
 
index f0c5ed0b7db8c10e0636817c6e76571c5672bbbb..ee76d299b3d0da7588b09022ac6a3f668b208dd1 100644 (file)
@@ -164,7 +164,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
                        if (ACPI_ROUND_UP(rgn_desc->region.length,
                                          obj_desc->common_field.
                                          access_byte_width) >=
-                           ((acpi_size) obj_desc->common_field.
+                           ((acpi_size)obj_desc->common_field.
                             base_byte_offset +
                             obj_desc->common_field.access_byte_width +
                             field_datum_byte_offset)) {
@@ -897,17 +897,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
 
        access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width);
 
-       /*
-        * Create the bitmasks used for bit insertion.
-        * Note: This if/else is used to bypass compiler differences with the
-        * shift operator
-        */
-       if (access_bit_width == ACPI_INTEGER_BIT_SIZE) {
-               width_mask = ACPI_UINT64_MAX;
-       } else {
-               width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width);
-       }
+       /* Create the bitmasks used for bit insertion */
 
+       width_mask = ACPI_MASK_BITS_ABOVE_64(access_bit_width);
        mask = width_mask &
            ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
 
index db30ae43ddd8685e820619b00e1f2df858081238..4f7e667624b30e9dc51bcb819db2cc58c0dde08d 100644 (file)
@@ -45,7 +45,6 @@
 #include "accommon.h"
 #include "acinterp.h"
 #include "amlcode.h"
-#include "amlresrc.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exmisc")
@@ -138,295 +137,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
        return_ACPI_STATUS(AE_OK);
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ex_concat_template
- *
- * PARAMETERS:  operand0            - First source object
- *              operand1            - Second source object
- *              actual_return_desc  - Where to place the return object
- *              walk_state          - Current walk state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Concatenate two resource templates
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_concat_template(union acpi_operand_object *operand0,
-                       union acpi_operand_object *operand1,
-                       union acpi_operand_object **actual_return_desc,
-                       struct acpi_walk_state *walk_state)
-{
-       acpi_status status;
-       union acpi_operand_object *return_desc;
-       u8 *new_buf;
-       u8 *end_tag;
-       acpi_size length0;
-       acpi_size length1;
-       acpi_size new_length;
-
-       ACPI_FUNCTION_TRACE(ex_concat_template);
-
-       /*
-        * Find the end_tag descriptor in each resource template.
-        * Note1: returned pointers point TO the end_tag, not past it.
-        * Note2: zero-length buffers are allowed; treated like one end_tag
-        */
-
-       /* Get the length of the first resource template */
-
-       status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
-
-       /* Get the length of the second resource template */
-
-       status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
-
-       /* Combine both lengths, minimum size will be 2 for end_tag */
-
-       new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
-
-       /* Create a new buffer object for the result (with one end_tag) */
-
-       return_desc = acpi_ut_create_buffer_object(new_length);
-       if (!return_desc) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
-       }
-
-       /*
-        * Copy the templates to the new buffer, 0 first, then 1 follows. One
-        * end_tag descriptor is copied from Operand1.
-        */
-       new_buf = return_desc->buffer.pointer;
-       memcpy(new_buf, operand0->buffer.pointer, length0);
-       memcpy(new_buf + length0, operand1->buffer.pointer, length1);
-
-       /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
-
-       new_buf[new_length - 1] = 0;
-       new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
-
-       /* Return the completed resource template */
-
-       *actual_return_desc = return_desc;
-       return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ex_do_concatenate
- *
- * PARAMETERS:  operand0            - First source object
- *              operand1            - Second source object
- *              actual_return_desc  - Where to place the return object
- *              walk_state          - Current walk state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_do_concatenate(union acpi_operand_object *operand0,
-                      union acpi_operand_object *operand1,
-                      union acpi_operand_object **actual_return_desc,
-                      struct acpi_walk_state *walk_state)
-{
-       union acpi_operand_object *local_operand1 = operand1;
-       union acpi_operand_object *return_desc;
-       char *new_buf;
-       const char *type_string;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE(ex_do_concatenate);
-
-       /*
-        * Convert the second operand if necessary. The first operand
-        * determines the type of the second operand, (See the Data Types
-        * section of the ACPI specification.)  Both object types are
-        * guaranteed to be either Integer/String/Buffer by the operand
-        * resolution mechanism.
-        */
-       switch (operand0->common.type) {
-       case ACPI_TYPE_INTEGER:
-
-               status =
-                   acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
-               break;
-
-       case ACPI_TYPE_STRING:
-               /*
-                * Per the ACPI spec, Concatenate only supports int/str/buf.
-                * However, we support all objects here as an extension.
-                * This improves the usefulness of the Printf() macro.
-                * 12/2015.
-                */
-               switch (operand1->common.type) {
-               case ACPI_TYPE_INTEGER:
-               case ACPI_TYPE_STRING:
-               case ACPI_TYPE_BUFFER:
-
-                       status =
-                           acpi_ex_convert_to_string(operand1, &local_operand1,
-                                                     ACPI_IMPLICIT_CONVERT_HEX);
-                       break;
-
-               default:
-                       /*
-                        * Just emit a string containing the object type.
-                        */
-                       type_string =
-                           acpi_ut_get_type_name(operand1->common.type);
-
-                       local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9));   /* 9 For "[Object]" */
-                       if (!local_operand1) {
-                               status = AE_NO_MEMORY;
-                               goto cleanup;
-                       }
-
-                       strcpy(local_operand1->string.pointer, "[");
-                       strcat(local_operand1->string.pointer, type_string);
-                       strcat(local_operand1->string.pointer, " Object]");
-                       status = AE_OK;
-                       break;
-               }
-               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;
-       }
-
-       if (ACPI_FAILURE(status)) {
-               goto cleanup;
-       }
-
-       /*
-        * Both operands are now known to be the same object type
-        * (Both are Integer, String, or Buffer), and we can now perform the
-        * concatenation.
-        */
-
-       /*
-        * There are three cases to handle:
-        *
-        * 1) Two Integers concatenated to produce a new Buffer
-        * 2) Two Strings concatenated to produce a new String
-        * 3) Two Buffers concatenated to produce a new Buffer
-        */
-       switch (operand0->common.type) {
-       case ACPI_TYPE_INTEGER:
-
-               /* Result of two Integers is a Buffer */
-               /* Need enough buffer space for two integers */
-
-               return_desc = acpi_ut_create_buffer_object((acpi_size)
-                                                          ACPI_MUL_2
-                                                          (acpi_gbl_integer_byte_width));
-               if (!return_desc) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               new_buf = (char *)return_desc->buffer.pointer;
-
-               /* Copy the first integer, LSB first */
-
-               memcpy(new_buf, &operand0->integer.value,
-                      acpi_gbl_integer_byte_width);
-
-               /* Copy the second integer (LSB first) after the first */
-
-               memcpy(new_buf + acpi_gbl_integer_byte_width,
-                      &local_operand1->integer.value,
-                      acpi_gbl_integer_byte_width);
-               break;
-
-       case ACPI_TYPE_STRING:
-
-               /* Result of two Strings is a String */
-
-               return_desc = acpi_ut_create_string_object(((acpi_size)
-                                                           operand0->string.
-                                                           length +
-                                                           local_operand1->
-                                                           string.length));
-               if (!return_desc) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               new_buf = return_desc->string.pointer;
-
-               /* Concatenate the strings */
-
-               strcpy(new_buf, operand0->string.pointer);
-               strcat(new_buf, local_operand1->string.pointer);
-               break;
-
-       case ACPI_TYPE_BUFFER:
-
-               /* Result of two Buffers is a Buffer */
-
-               return_desc = acpi_ut_create_buffer_object(((acpi_size)
-                                                           operand0->buffer.
-                                                           length +
-                                                           local_operand1->
-                                                           buffer.length));
-               if (!return_desc) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               new_buf = (char *)return_desc->buffer.pointer;
-
-               /* Concatenate the buffers */
-
-               memcpy(new_buf, operand0->buffer.pointer,
-                      operand0->buffer.length);
-               memcpy(new_buf + operand0->buffer.length,
-                      local_operand1->buffer.pointer,
-                      local_operand1->buffer.length);
-               break;
-
-       default:
-
-               /* Invalid object type, should not happen here */
-
-               ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
-                           operand0->common.type));
-               status = AE_AML_INTERNAL;
-               goto cleanup;
-       }
-
-       *actual_return_desc = return_desc;
-
-cleanup:
-       if (local_operand1 != operand1) {
-               acpi_ut_remove_reference(local_operand1);
-       }
-       return_ACPI_STATUS(status);
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_math_op
index 27c11ab5eb042fc71d5c0861747852f2dadb28a2..3d6af93fe5618093b5e3d69d58024b23bd63288a 100644 (file)
@@ -178,7 +178,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 
        for (index = 0;
             (index < ACPI_NAME_SIZE)
-            && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
+            && (acpi_ut_valid_name_char(*aml_address, 0)); index++) {
                char_buf[index] = *aml_address++;
                ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
        }
index 5aa21c4eda1d5b4a8f1101d00c51a50b95353060..69e4e269ad2f900ce1d4114d869218f3ca1f3580 100644 (file)
@@ -184,7 +184,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
                /* Get the Integer values from the objects */
 
                index = operand[1]->integer.value;
-               length = (acpi_size) operand[2]->integer.value;
+               length = (acpi_size)operand[2]->integer.value;
 
                /*
                 * If the index is beyond the length of the String/Buffer, or if the
@@ -198,8 +198,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
                else if ((index + length) > operand[0]->string.length) {
                        length =
-                           (acpi_size) operand[0]->string.length -
-                           (acpi_size) index;
+                           (acpi_size)operand[0]->string.length -
+                           (acpi_size)index;
                }
 
                /* Strings always have a sub-pointer, not so for buffers */
@@ -209,7 +209,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
                        /* Always allocate a new buffer for the String */
 
-                       buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);
+                       buffer = ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);
                        if (!buffer) {
                                status = AE_NO_MEMORY;
                                goto cleanup;
index e2b63483857f70c1671b9205a0e7886bc0953fdb..786d53b0bb373cc6d6e0c928a375c5d3b031c296 100644 (file)
@@ -207,7 +207,7 @@ acpi_ex_do_match(u32 match_op,
  *
  ******************************************************************************/
 
-acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
+acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object **operand = &walk_state->operands[0];
        union acpi_operand_object *return_desc = NULL;
index 076074daf2b607a97c49facb9c8ac8805ec35a07..31b381cae94df6c66553e52388e63a2cd3881c7e 100644 (file)
@@ -325,15 +325,15 @@ acpi_ex_system_io_space_handler(u32 function,
        switch (function) {
        case ACPI_READ:
 
-               status = acpi_hw_read_port((acpi_io_address) address,
+               status = acpi_hw_read_port((acpi_io_address)address,
                                           &value32, bit_width);
                *value = value32;
                break;
 
        case ACPI_WRITE:
 
-               status = acpi_hw_write_port((acpi_io_address) address,
-                                           (u32) * value, bit_width);
+               status = acpi_hw_write_port((acpi_io_address)address,
+                                           (u32)*value, bit_width);
                break;
 
        default:
index c1e8bfb0f7f42c1b5fda1902914d6e66c46bdd16..a183cb740d24d2dbf7f50435867d3a6960453351 100644 (file)
@@ -93,7 +93,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
         */
        node = *object_ptr;
        source_desc = acpi_ns_get_attached_object(node);
-       entry_type = acpi_ns_get_type((acpi_handle) node);
+       entry_type = acpi_ns_get_type((acpi_handle)node);
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
                          node, source_desc,
@@ -106,7 +106,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
                node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
                source_desc = acpi_ns_get_attached_object(node);
-               entry_type = acpi_ns_get_type((acpi_handle) node);
+               entry_type = acpi_ns_get_type((acpi_handle)node);
                *object_ptr = node;
        }
 
index fedacf13dc3685b38070b357edbee0f1f8f2cedb..e1d3878be2c6e058460d9943fe47d840c678d355 100644 (file)
@@ -334,7 +334,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 acpi_status
 acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                         union acpi_operand_object *operand,
-                        acpi_object_type * return_type,
+                        acpi_object_type *return_type,
                         union acpi_operand_object **return_desc)
 {
        union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand);
index cc2c26c46a6d6aa4a75224834da742acaf588e5b..27b41fd7542dba5c078dd558fc39818a6ff6b0cf 100644 (file)
@@ -131,8 +131,8 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
 
 acpi_status
 acpi_ex_resolve_operands(u16 opcode,
-                        union acpi_operand_object ** stack_ptr,
-                        struct acpi_walk_state * walk_state)
+                        union acpi_operand_object **stack_ptr,
+                        struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status = AE_OK;
index 28b724827f0fdaf589ba3aea814e3958caf4bdc1..1dab82746d06b2231d580e914cb25ee51357f68e 100644 (file)
@@ -188,7 +188,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
                 * Clear old string and copy in the new one
                 */
                memset(target_desc->string.pointer, 0,
-                      (acpi_size) target_desc->string.length + 1);
+                      (acpi_size)target_desc->string.length + 1);
                memcpy(target_desc->string.pointer, buffer, length);
        } else {
                /*
@@ -204,7 +204,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
                }
 
                target_desc->string.pointer =
-                   ACPI_ALLOCATE_ZEROED((acpi_size) length + 1);
+                   ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);
 
                if (!target_desc->string.pointer) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
index 4d44bc1cb2ca82fbb6a8a69b36df6bba46b256e6..425f13372e68f3fe57c8b58cfb1d2948d54886a1 100644 (file)
@@ -301,8 +301,8 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
  *
  * FUNCTION:    acpi_ex_eisa_id_to_string
  *
- * PARAMETERS:  compressed_id   - EISAID to be converted
- *              out_string      - Where to put the converted string (8 bytes)
+ * PARAMETERS:  out_string      - Where to put the converted string (8 bytes)
+ *              compressed_id   - EISAID to be converted
  *
  * RETURN:      None
  *
@@ -354,7 +354,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
  *                                possible 64-bit integer.
  *              value           - Value to be converted
  *
- * RETURN:      None, string
+ * RETURN:      Converted string in out_string
  *
  * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
  *              Assumes string buffer is large enough to hold the string. The
@@ -384,9 +384,9 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
  * FUNCTION:    acpi_ex_pci_cls_to_string
  *
  * PARAMETERS:  out_string      - Where to put the converted string (7 bytes)
- * PARAMETERS:  class_code      - PCI class code to be converted (3 bytes)
+ *              class_code      - PCI class code to be converted (3 bytes)
  *
- * RETURN:      None
+ * RETURN:      Converted string in out_string
  *
  * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
  *              Return buffer must be large enough to hold the string. The
@@ -417,7 +417,7 @@ void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
  *
  * PARAMETERS:  space_id            - ID to be validated
  *
- * RETURN:      TRUE if valid/supported ID.
+ * RETURN:      TRUE if space_id is a valid/supported ID.
  *
  * DESCRIPTION: Validate an operation region space_ID.
  *
index 1c4f4518611a7211881dac61d2d8f99736288b6b..bdecd5e76e87db1ac362fd56093f5c8d7b62cc32 100644 (file)
@@ -166,7 +166,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
  *
  ******************************************************************************/
 
-acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
+acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
        struct acpi_gpe_register_info *gpe_register_info;
        acpi_status status;
@@ -206,7 +206,7 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
  ******************************************************************************/
 
 acpi_status
-acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
+acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
                       acpi_event_status *event_status)
 {
        u32 in_byte;
@@ -391,7 +391,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
 acpi_status
 acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
-                                struct acpi_gpe_block_info * gpe_block,
+                                struct acpi_gpe_block_info *gpe_block,
                                 void *context)
 {
        u32 i;
index 5ba0498412fd5773d07feadd44ca442d88211b91..0f18dbc9a37fd7e80e80a65cb314ba3ac416da73 100644 (file)
@@ -51,6 +51,10 @@ ACPI_MODULE_NAME("hwregs")
 
 #if (!ACPI_REDUCED_HARDWARE)
 /* Local Prototypes */
+static u8
+acpi_hw_get_access_bit_width(struct acpi_generic_address *reg,
+                            u8 max_bit_width);
+
 static acpi_status
 acpi_hw_read_multiple(u32 *value,
                      struct acpi_generic_address *register_a,
@@ -63,6 +67,48 @@ acpi_hw_write_multiple(u32 value,
 
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_get_access_bit_width
+ *
+ * PARAMETERS:  reg                 - GAS register structure
+ *              max_bit_width       - Max bit_width supported (32 or 64)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Obtain optimal access bit width
+ *
+ ******************************************************************************/
+
+static u8
+acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
+{
+       u64 address;
+
+       if (!reg->access_width) {
+               /*
+                * Detect old register descriptors where only the bit_width field
+                * makes senses. The target address is copied to handle possible
+                * alignment issues.
+                */
+               ACPI_MOVE_64_TO_64(&address, &reg->address);
+               if (!reg->bit_offset && reg->bit_width &&
+                   ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
+                   ACPI_IS_ALIGNED(reg->bit_width, 8) &&
+                   ACPI_IS_ALIGNED(address, reg->bit_width)) {
+                       return (reg->bit_width);
+               } else {
+                       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
+                               return (32);
+                       } else {
+                               return (max_bit_width);
+                       }
+               }
+       } else {
+               return (1 << (reg->access_width + 2));
+       }
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_validate_register
@@ -83,6 +129,8 @@ acpi_status
 acpi_hw_validate_register(struct acpi_generic_address *reg,
                          u8 max_bit_width, u64 *address)
 {
+       u8 bit_width;
+       u8 access_width;
 
        /* Must have a valid pointer to a GAS structure */
 
@@ -109,23 +157,25 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
                return (AE_SUPPORT);
        }
 
-       /* Validate the bit_width */
+       /* Validate the access_width */
 
-       if ((reg->bit_width != 8) &&
-           (reg->bit_width != 16) &&
-           (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
+       if (reg->access_width > 4) {
                ACPI_ERROR((AE_INFO,
-                           "Unsupported register bit width: 0x%X",
-                           reg->bit_width));
+                           "Unsupported register access width: 0x%X",
+                           reg->access_width));
                return (AE_SUPPORT);
        }
 
-       /* Validate the bit_offset. Just a warning for now. */
+       /* Validate the bit_width, convert access_width into number of bits */
 
-       if (reg->bit_offset != 0) {
+       access_width = acpi_hw_get_access_bit_width(reg, max_bit_width);
+       bit_width =
+           ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);
+       if (max_bit_width < bit_width) {
                ACPI_WARNING((AE_INFO,
-                             "Unsupported register bit offset: 0x%X",
-                             reg->bit_offset));
+                             "Requested bit width 0x%X is smaller than register bit width 0x%X",
+                             max_bit_width, bit_width));
+               return (AE_SUPPORT);
        }
 
        return (AE_OK);
@@ -145,17 +195,19 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
  *              64-bit values is not needed.
  *
  * LIMITATIONS: <These limitations also apply to acpi_hw_write>
- *      bit_width must be exactly 8, 16, or 32.
  *      space_ID must be system_memory or system_IO.
- *      bit_offset and access_width are currently ignored, as there has
- *          not been a need to implement these.
  *
  ******************************************************************************/
 
 acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
 {
        u64 address;
+       u8 access_width;
+       u32 bit_width;
+       u8 bit_offset;
        u64 value64;
+       u32 value32;
+       u8 index;
        acpi_status status;
 
        ACPI_FUNCTION_NAME(hw_read);
@@ -167,28 +219,75 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
                return (status);
        }
 
-       /* Initialize entire 32-bit return value to zero */
-
+       /*
+        * Initialize entire 32-bit return value to zero, convert access_width
+        * into number of bits based
+        */
        *value = 0;
+       access_width = acpi_hw_get_access_bit_width(reg, 32);
+       bit_width = reg->bit_offset + reg->bit_width;
+       bit_offset = reg->bit_offset;
 
        /*
         * Two address spaces supported: Memory or IO. PCI_Config is
         * not supported here because the GAS structure is insufficient
         */
-       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
-               status = acpi_os_read_memory((acpi_physical_address)
-                                            address, &value64, reg->bit_width);
+       index = 0;
+       while (bit_width) {
+               if (bit_offset >= access_width) {
+                       value32 = 0;
+                       bit_offset -= access_width;
+               } else {
+                       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+                               status =
+                                   acpi_os_read_memory((acpi_physical_address)
+                                                       address +
+                                                       index *
+                                                       ACPI_DIV_8
+                                                       (access_width),
+                                                       &value64, access_width);
+                               value32 = (u32)value64;
+                       } else {        /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+                               status = acpi_hw_read_port((acpi_io_address)
+                                                          address +
+                                                          index *
+                                                          ACPI_DIV_8
+                                                          (access_width),
+                                                          &value32,
+                                                          access_width);
+                       }
+
+                       /*
+                        * Use offset style bit masks because:
+                        * bit_offset < access_width/bit_width < access_width, and
+                        * access_width is ensured to be less than 32-bits by
+                        * acpi_hw_validate_register().
+                        */
+                       if (bit_offset) {
+                               value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
+                               bit_offset = 0;
+                       }
+                       if (bit_width < access_width) {
+                               value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
+                       }
+               }
 
-               *value = (u32)value64;
-       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+               /*
+                * Use offset style bit writes because "Index * AccessWidth" is
+                * ensured to be less than 32-bits by acpi_hw_validate_register().
+                */
+               ACPI_SET_BITS(value, index * access_width,
+                             ACPI_MASK_BITS_ABOVE_32(access_width), value32);
 
-               status = acpi_hw_read_port((acpi_io_address)
-                                          address, value, reg->bit_width);
+               bit_width -=
+                   bit_width > access_width ? access_width : bit_width;
+               index++;
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_IO,
                          "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-                         *value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+                         *value, access_width, ACPI_FORMAT_UINT64(address),
                          acpi_ut_get_region_name(reg->space_id)));
 
        return (status);
@@ -212,6 +311,12 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
 acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
 {
        u64 address;
+       u8 access_width;
+       u32 bit_width;
+       u8 bit_offset;
+       u64 value64;
+       u32 new_value32, old_value32;
+       u8 index;
        acpi_status status;
 
        ACPI_FUNCTION_NAME(hw_write);
@@ -223,23 +328,145 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
                return (status);
        }
 
+       /* Convert access_width into number of bits based */
+
+       access_width = acpi_hw_get_access_bit_width(reg, 32);
+       bit_width = reg->bit_offset + reg->bit_width;
+       bit_offset = reg->bit_offset;
+
        /*
         * Two address spaces supported: Memory or IO. PCI_Config is
         * not supported here because the GAS structure is insufficient
         */
-       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
-               status = acpi_os_write_memory((acpi_physical_address)
-                                             address, (u64)value,
-                                             reg->bit_width);
-       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-
-               status = acpi_hw_write_port((acpi_io_address)
-                                           address, value, reg->bit_width);
+       index = 0;
+       while (bit_width) {
+               /*
+                * Use offset style bit reads because "Index * AccessWidth" is
+                * ensured to be less than 32-bits by acpi_hw_validate_register().
+                */
+               new_value32 = ACPI_GET_BITS(&value, index * access_width,
+                                           ACPI_MASK_BITS_ABOVE_32
+                                           (access_width));
+
+               if (bit_offset >= access_width) {
+                       bit_offset -= access_width;
+               } else {
+                       /*
+                        * Use offset style bit masks because access_width is ensured
+                        * to be less than 32-bits by acpi_hw_validate_register() and
+                        * bit_offset/bit_width is less than access_width here.
+                        */
+                       if (bit_offset) {
+                               new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
+                       }
+                       if (bit_width < access_width) {
+                               new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
+                       }
+
+                       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+                               if (bit_offset || bit_width < access_width) {
+                                       /*
+                                        * Read old values in order not to modify the bits that
+                                        * are beyond the register bit_width/bit_offset setting.
+                                        */
+                                       status =
+                                           acpi_os_read_memory((acpi_physical_address)
+                                                               address +
+                                                               index *
+                                                               ACPI_DIV_8
+                                                               (access_width),
+                                                               &value64,
+                                                               access_width);
+                                       old_value32 = (u32)value64;
+
+                                       /*
+                                        * Use offset style bit masks because access_width is
+                                        * ensured to be less than 32-bits by
+                                        * acpi_hw_validate_register() and bit_offset/bit_width is
+                                        * less than access_width here.
+                                        */
+                                       if (bit_offset) {
+                                               old_value32 &=
+                                                   ACPI_MASK_BITS_ABOVE
+                                                   (bit_offset);
+                                               bit_offset = 0;
+                                       }
+                                       if (bit_width < access_width) {
+                                               old_value32 &=
+                                                   ACPI_MASK_BITS_BELOW
+                                                   (bit_width);
+                                       }
+
+                                       new_value32 |= old_value32;
+                               }
+
+                               value64 = (u64)new_value32;
+                               status =
+                                   acpi_os_write_memory((acpi_physical_address)
+                                                        address +
+                                                        index *
+                                                        ACPI_DIV_8
+                                                        (access_width),
+                                                        value64, access_width);
+                       } else {        /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+                               if (bit_offset || bit_width < access_width) {
+                                       /*
+                                        * Read old values in order not to modify the bits that
+                                        * are beyond the register bit_width/bit_offset setting.
+                                        */
+                                       status =
+                                           acpi_hw_read_port((acpi_io_address)
+                                                             address +
+                                                             index *
+                                                             ACPI_DIV_8
+                                                             (access_width),
+                                                             &old_value32,
+                                                             access_width);
+
+                                       /*
+                                        * Use offset style bit masks because access_width is
+                                        * ensured to be less than 32-bits by
+                                        * acpi_hw_validate_register() and bit_offset/bit_width is
+                                        * less than access_width here.
+                                        */
+                                       if (bit_offset) {
+                                               old_value32 &=
+                                                   ACPI_MASK_BITS_ABOVE
+                                                   (bit_offset);
+                                               bit_offset = 0;
+                                       }
+                                       if (bit_width < access_width) {
+                                               old_value32 &=
+                                                   ACPI_MASK_BITS_BELOW
+                                                   (bit_width);
+                                       }
+
+                                       new_value32 |= old_value32;
+                               }
+
+                               status = acpi_hw_write_port((acpi_io_address)
+                                                           address +
+                                                           index *
+                                                           ACPI_DIV_8
+                                                           (access_width),
+                                                           new_value32,
+                                                           access_width);
+                       }
+               }
+
+               /*
+                * Index * access_width is ensured to be less than 32-bits by
+                * acpi_hw_validate_register().
+                */
+               bit_width -=
+                   bit_width > access_width ? access_width : bit_width;
+               index++;
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_IO,
                          "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-                         value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+                         value, access_width, ACPI_FORMAT_UINT64(address),
                          acpi_ut_get_region_name(reg->space_id)));
 
        return (status);
index a01ddb393a55c92aecc66053acacba1f06116527..98c26ff394092fa74e5f63c1b910289343d7e4e0 100644 (file)
@@ -91,10 +91,9 @@ acpi_status acpi_reset(void)
                 * compatibility with other ACPI implementations that have allowed
                 * BIOS code with bad register width values to go unnoticed.
                 */
-               status =
-                   acpi_os_write_port((acpi_io_address) reset_reg->address,
-                                      acpi_gbl_FADT.reset_value,
-                                      ACPI_RESET_REGISTER_WIDTH);
+               status = acpi_os_write_port((acpi_io_address)reset_reg->address,
+                                           acpi_gbl_FADT.reset_value,
+                                           ACPI_RESET_REGISTER_WIDTH);
        } else {
                /* Write the reset value to the reset register */
 
@@ -504,9 +503,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->relative_pathname = ACPI_CAST_PTR(char,
-                                               acpi_gbl_sleep_state_names
-                                               [sleep_state]);
+       info->relative_pathname = acpi_gbl_sleep_state_names[sleep_state];
 
        status = acpi_ns_evaluate(info);
        if (ACPI_FAILURE(status)) {
index 697af810e5ad480caf3780d0097eb649e6fb5ebf..426a6307eafaebb7165436e760a15b46882153c4 100644 (file)
@@ -107,9 +107,10 @@ acpi_status acpi_ns_root_initialize(void)
                        continue;
                }
 
-               status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
-                                       ACPI_IMODE_LOAD_PASS2,
-                                       ACPI_NS_NO_UPSEARCH, NULL, &new_node);
+               status =
+                   acpi_ns_lookup(NULL, (char *)init_val->name, init_val->type,
+                                  ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
+                                  NULL, &new_node);
                if (ACPI_FAILURE(status)) {
                        ACPI_EXCEPTION((AE_INFO, status,
                                        "Could not create predefined name %s",
index 878e8fb6a64c251d0a30c15edf4826119e6020d9..c803bda7915cdd4c9c399097a6e6b6d16e8a1e90 100644 (file)
@@ -79,7 +79,8 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
                /* String-to-Integer conversion */
 
                status = acpi_ut_strtoul64(original_object->string.pointer,
-                                          ACPI_ANY_BASE, &value);
+                                          ACPI_ANY_BASE,
+                                          acpi_gbl_integer_byte_width, &value);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -317,7 +318,7 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope,
+acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope,
                           union acpi_operand_object *original_object,
                           union acpi_operand_object **return_object)
 {
@@ -384,7 +385,7 @@ acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_convert_to_resource(struct acpi_namespace_node * scope,
+acpi_ns_convert_to_resource(struct acpi_namespace_node *scope,
                            union acpi_operand_object *original_object,
                            union acpi_operand_object **return_object)
 {
@@ -463,7 +464,7 @@ acpi_ns_convert_to_resource(struct acpi_namespace_node * scope,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_convert_to_reference(struct acpi_namespace_node * scope,
+acpi_ns_convert_to_reference(struct acpi_namespace_node *scope,
                             union acpi_operand_object *original_object,
                             union acpi_operand_object **return_object)
 {
index af236e348294cf450c579c6519557d3aa273c310..ce1f8605d996c8c594ac49b29e96bd475c9f0b1a 100644 (file)
@@ -81,7 +81,7 @@ acpi_ns_get_max_depth(acpi_handle obj_handle,
  *
  ******************************************************************************/
 
-void acpi_ns_print_pathname(u32 num_segments, char *pathname)
+void acpi_ns_print_pathname(u32 num_segments, const char *pathname)
 {
        u32 i;
 
@@ -114,6 +114,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
        acpi_os_printf("]\n");
 }
 
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/* Not used at this time, perhaps later */
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_pathname
@@ -131,7 +134,8 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
  ******************************************************************************/
 
 void
-acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
+acpi_ns_dump_pathname(acpi_handle handle,
+                     const char *msg, u32 level, u32 component)
 {
 
        ACPI_FUNCTION_TRACE(ns_dump_pathname);
@@ -148,6 +152,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
        acpi_os_printf("\n");
        return_VOID;
 }
+#endif
 
 /*******************************************************************************
  *
index d4aa8b696ee9d8e970c904e62ef95907841f1b4c..36643a8cf65a03b7694401befecf6000192f0c52 100644 (file)
@@ -140,6 +140,7 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
 {
        acpi_status status = AE_OK;
        struct acpi_device_walk_info info;
+       acpi_handle handle;
 
        ACPI_FUNCTION_TRACE(ns_initialize_devices);
 
@@ -190,6 +191,27 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
                if (ACPI_SUCCESS(status)) {
                        info.num_INI++;
                }
+
+               /*
+                * Execute \_SB._INI.
+                * There appears to be a strict order requirement for \_SB._INI,
+                * which should be evaluated before any _REG evaluations.
+                */
+               status = acpi_get_handle(NULL, "\\_SB", &handle);
+               if (ACPI_SUCCESS(status)) {
+                       memset(info.evaluate_info, 0,
+                              sizeof(struct acpi_evaluate_info));
+                       info.evaluate_info->prefix_node = handle;
+                       info.evaluate_info->relative_pathname =
+                           METHOD_NAME__INI;
+                       info.evaluate_info->parameters = NULL;
+                       info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+                       status = acpi_ns_evaluate(info.evaluate_info);
+                       if (ACPI_SUCCESS(status)) {
+                               info.num_INI++;
+                       }
+               }
        }
 
        /*
@@ -198,6 +220,12 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
         * Note: Any objects accessed by the _REG methods will be automatically
         * initialized, even if they contain executable AML (see the call to
         * acpi_ns_initialize_objects below).
+        *
+        * Note: According to the ACPI specification, we actually needn't execute
+        * _REG for system_memory/system_io operation regions, but for PCI_Config
+        * operation regions, it is required to evaluate _REG for those on a PCI
+        * root bus that doesn't contain _BBN object. So this code is kept here
+        * in order not to break things.
         */
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -592,33 +620,37 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
         * Note: We know there is an _INI within this subtree, but it may not be
         * under this particular device, it may be lower in the branch.
         */
-       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
-                       (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
-
-       memset(info, 0, sizeof(struct acpi_evaluate_info));
-       info->prefix_node = device_node;
-       info->relative_pathname = METHOD_NAME__INI;
-       info->parameters = NULL;
-       info->flags = ACPI_IGNORE_RETURN_VALUE;
-
-       status = acpi_ns_evaluate(info);
-
-       if (ACPI_SUCCESS(status)) {
-               walk_info->num_INI++;
-       }
+       if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
+           device_node->parent != acpi_gbl_root_node) {
+               ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                               (ACPI_TYPE_METHOD, device_node,
+                                METHOD_NAME__INI));
+
+               memset(info, 0, sizeof(struct acpi_evaluate_info));
+               info->prefix_node = device_node;
+               info->relative_pathname = METHOD_NAME__INI;
+               info->parameters = NULL;
+               info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+               status = acpi_ns_evaluate(info);
+               if (ACPI_SUCCESS(status)) {
+                       walk_info->num_INI++;
+               }
 #ifdef ACPI_DEBUG_OUTPUT
-       else if (status != AE_NOT_FOUND) {
+               else if (status != AE_NOT_FOUND) {
 
-               /* Ignore error and move on to next device */
+                       /* Ignore error and move on to next device */
 
-               char *scope_name =
-                   acpi_ns_get_normalized_pathname(device_node, TRUE);
+                       char *scope_name =
+                           acpi_ns_get_normalized_pathname(device_node, TRUE);
 
-               ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
-                               scope_name));
-               ACPI_FREE(scope_name);
-       }
+                       ACPI_EXCEPTION((AE_INFO, status,
+                                       "during %s._INI execution",
+                                       scope_name));
+                       ACPI_FREE(scope_name);
+               }
 #endif
+       }
 
        /* Ignore errors from above */
 
index 75cdb8790d490faf4acd86ef5041b3864be51cec..b5e2b0ada0abb4a7072df63b8a58ccb8cb675287 100644 (file)
@@ -123,8 +123,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
                (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list.
                                                  tables[table_index].owner_id);
-               acpi_tb_release_owner_id(table_index);
 
+               acpi_tb_release_owner_id(table_index);
                return_ACPI_STATUS(status);
        }
 
index eb6e1b88a51d9dbb1fa30c37c3069b92f7d1dcdc..f03dd41e86d023b521e90fe4aa6cd1ef635ff3be 100644 (file)
@@ -113,7 +113,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
 
 acpi_status
 acpi_ns_handle_to_pathname(acpi_handle target_handle,
-                          struct acpi_buffer * buffer, u8 no_trailing)
+                          struct acpi_buffer *buffer, u8 no_trailing)
 {
        acpi_status status;
        struct acpi_namespace_node *node;
index 051306f0d0d6ef95df029de9fd5aa4a92c856349..cfa2bb7162d83ef9056c38e3389d313f81000c7a 100644 (file)
@@ -399,7 +399,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_detach_data(struct acpi_namespace_node * node,
+acpi_ns_detach_data(struct acpi_namespace_node *node,
                    acpi_object_handler handler)
 {
        union acpi_operand_object *obj_desc;
@@ -444,7 +444,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_attached_data(struct acpi_namespace_node * node,
+acpi_ns_get_attached_data(struct acpi_namespace_node *node,
                          acpi_object_handler handler, void **data)
 {
        union acpi_operand_object *obj_desc;
index 9047f2808d5b39bc2622b319e95a0b4a7079bbbe..fbedc6e8ab3653e1fce44ba8c1c88f1232fed69f 100644 (file)
@@ -62,6 +62,10 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
                               u32 count1,
                               u8 type2, u32 count2, u32 start_index);
 
+static acpi_status
+acpi_ns_custom_package(struct acpi_evaluate_info *info,
+                      union acpi_operand_object **elements, u32 count);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_package
@@ -135,6 +139,11 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
         * PTYPE2 packages contain subpackages
         */
        switch (package->ret_info.type) {
+       case ACPI_PTYPE_CUSTOM:
+
+               status = acpi_ns_custom_package(info, elements, count);
+               break;
+
        case ACPI_PTYPE1_FIXED:
                /*
                 * The package count is fixed and there are no subpackages
@@ -179,6 +188,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
                        if (ACPI_FAILURE(status)) {
                                return (status);
                        }
+
                        elements++;
                }
                break;
@@ -225,6 +235,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
                                        return (status);
                                }
                        }
+
                        elements++;
                }
                break;
@@ -569,11 +580,13 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
                        if (sub_package->package.count < expected_count) {
                                goto package_too_small;
                        }
+
                        if (sub_package->package.count <
                            package->ret_info.count1) {
                                expected_count = package->ret_info.count1;
                                goto package_too_small;
                        }
+
                        if (expected_count == 0) {
                                /*
                                 * Either the num_entries element was originally zero or it was
@@ -620,6 +633,83 @@ package_too_small:
        return (AE_AML_OPERAND_VALUE);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_custom_package
+ *
+ * PARAMETERS:  info                - Method execution information block
+ *              elements            - Pointer to the package elements array
+ *              count               - Element count for the package
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check a returned package object for the correct count and
+ *              correct type of all sub-objects.
+ *
+ * NOTE: Currently used for the _BIX method only. When needed for two or more
+ * methods, probably a detect/dispatch mechanism will be required.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ns_custom_package(struct acpi_evaluate_info *info,
+                      union acpi_operand_object **elements, u32 count)
+{
+       u32 expected_count;
+       u32 version;
+       acpi_status status = AE_OK;
+
+       ACPI_FUNCTION_NAME(ns_custom_package);
+
+       /* Get version number, must be Integer */
+
+       if ((*elements)->common.type != ACPI_TYPE_INTEGER) {
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
+                                     "Return Package has invalid object type for version number"));
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
+       }
+
+       version = (u32)(*elements)->integer.value;
+       expected_count = 21;    /* Version 1 */
+
+       if (version == 0) {
+               expected_count = 20;    /* Version 0 */
+       }
+
+       if (count < expected_count) {
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
+                                     "Return Package is too small - found %u elements, expected %u",
+                                     count, expected_count));
+               return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
+       } else if (count > expected_count) {
+               ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
+                                 "%s: Return Package is larger than needed - "
+                                 "found %u, expected %u\n",
+                                 info->full_pathname, count, expected_count));
+       }
+
+       /* Validate all elements of the returned package */
+
+       status = acpi_ns_check_package_elements(info, elements,
+                                               ACPI_RTYPE_INTEGER, 16,
+                                               ACPI_RTYPE_STRING, 4, 0);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       /* Version 1 has a single trailing integer */
+
+       if (version > 0) {
+               status = acpi_ns_check_package_elements(info, elements + 20,
+                                                       ACPI_RTYPE_INTEGER, 1,
+                                                       0, 0, 20);
+       }
+
+       return_ACPI_STATUS(status);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_package_elements
@@ -661,6 +751,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
+
                this_element++;
        }
 
@@ -671,6 +762,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
+
                this_element++;
        }
 
index 805e36de8707c74f216b3b26ce142cfef8ada969..9523d41c7ae900c99266668b248b85059224a606 100644 (file)
@@ -399,7 +399,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
  ******************************************************************************/
 
 acpi_status
-acpi_ns_repair_null_element(struct acpi_evaluate_info * info,
+acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
                            u32 expected_btypes,
                            u32 package_index,
                            union acpi_operand_object **return_object_ptr)
index 63edbbbf9ae478f969be3b7c7b4e701da5fcbb67..d5336122486bb2a568086d468278708f2e74deef 100644 (file)
@@ -54,9 +54,9 @@ ACPI_MODULE_NAME("nsrepair2")
  * be repaired on a per-name basis.
  */
 typedef
-acpi_status(*acpi_repair_function) (struct acpi_evaluate_info * info,
-                                   union acpi_operand_object
-                                   **return_object_ptr);
+acpi_status (*acpi_repair_function) (struct acpi_evaluate_info * info,
+                                    union acpi_operand_object **
+                                    return_object_ptr);
 
 typedef struct acpi_repair_info {
        char name[ACPI_NAME_SIZE];
index c72cc62b92d0e3c9d8bb06eeb237caf5f8790ff2..784a30b76e0f42b23fa4d95e4df9474b341df72e 100644 (file)
@@ -272,11 +272,11 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
                        result = &internal_name[i];
                } else if (num_segments == 2) {
                        internal_name[i] = AML_DUAL_NAME_PREFIX;
-                       result = &internal_name[(acpi_size) i + 1];
+                       result = &internal_name[(acpi_size)i + 1];
                } else {
                        internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
-                       internal_name[(acpi_size) i + 1] = (char)num_segments;
-                       result = &internal_name[(acpi_size) i + 2];
+                       internal_name[(acpi_size)i + 1] = (char)num_segments;
+                       result = &internal_name[(acpi_size)i + 2];
                }
        }
 
@@ -456,7 +456,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
 
                        names_index = prefix_length + 2;
                        num_segments = (u8)
-                           internal_name[(acpi_size) prefix_length + 1];
+                           internal_name[(acpi_size)prefix_length + 1];
                        break;
 
                case AML_DUAL_NAME_PREFIX:
index a7deeaa8eddcf9a3c09be091d4092959a05c8175..d2a9b4fd739f66447d72d282a11a997b921cd515 100644 (file)
@@ -256,7 +256,7 @@ acpi_evaluate_object(acpi_handle handle,
                 * 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->
+               info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size)info->
                                                         param_count +
                                                         1) * sizeof(void *));
                if (!info->parameters) {
@@ -280,13 +280,12 @@ acpi_evaluate_object(acpi_handle handle,
                info->parameters[info->param_count] = NULL;
        }
 
-#if 0
+#ifdef _FUTURE_FEATURE
 
        /*
         * Begin incoming argument count analysis. Check for too few args
         * and too many args.
         */
-
        switch (acpi_ns_get_type(info->node)) {
        case ACPI_TYPE_METHOD:
 
@@ -370,68 +369,68 @@ acpi_evaluate_object(acpi_handle handle,
         * If we are expecting a return value, and all went well above,
         * copy the return value to an external object.
         */
-       if (return_buffer) {
-               if (!info->return_object) {
-                       return_buffer->length = 0;
-               } else {
-                       if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
-                           ACPI_DESC_TYPE_NAMED) {
-                               /*
-                                * If we received a NS Node as a return object, this means that
-                                * the object we are evaluating has nothing interesting to
-                                * return (such as a mutex, etc.)  We return an error because
-                                * these types are essentially unsupported by this interface.
-                                * We don't check up front because this makes it easier to add
-                                * support for various types at a later date if necessary.
-                                */
-                               status = AE_TYPE;
-                               info->return_object = NULL;     /* No need to delete a NS Node */
-                               return_buffer->length = 0;
-                       }
+       if (!return_buffer) {
+               goto cleanup_return_object;
+       }
 
-                       if (ACPI_SUCCESS(status)) {
+       if (!info->return_object) {
+               return_buffer->length = 0;
+               goto cleanup;
+       }
 
-                               /* Dereference Index and ref_of references */
+       if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) ==
+           ACPI_DESC_TYPE_NAMED) {
+               /*
+                * If we received a NS Node as a return object, this means that
+                * the object we are evaluating has nothing interesting to
+                * return (such as a mutex, etc.)  We return an error because
+                * these types are essentially unsupported by this interface.
+                * We don't check up front because this makes it easier to add
+                * support for various types at a later date if necessary.
+                */
+               status = AE_TYPE;
+               info->return_object = NULL;     /* No need to delete a NS Node */
+               return_buffer->length = 0;
+       }
 
-                               acpi_ns_resolve_references(info);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup_return_object;
+       }
 
-                               /* Get the size of the returned object */
+       /* Dereference Index and ref_of references */
 
-                               status =
-                                   acpi_ut_get_object_size(info->return_object,
-                                                           &buffer_space_needed);
-                               if (ACPI_SUCCESS(status)) {
-
-                                       /* Validate/Allocate/Clear caller buffer */
-
-                                       status =
-                                           acpi_ut_initialize_buffer
-                                           (return_buffer,
-                                            buffer_space_needed);
-                                       if (ACPI_FAILURE(status)) {
-                                               /*
-                                                * Caller's buffer is too small or a new one can't
-                                                * be allocated
-                                                */
-                                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                                                 "Needed buffer size %X, %s\n",
-                                                                 (u32)
-                                                                 buffer_space_needed,
-                                                                 acpi_format_exception
-                                                                 (status)));
-                                       } else {
-                                               /* We have enough space for the object, build it */
-
-                                               status =
-                                                   acpi_ut_copy_iobject_to_eobject
-                                                   (info->return_object,
-                                                    return_buffer);
-                                       }
-                               }
-                       }
+       acpi_ns_resolve_references(info);
+
+       /* Get the size of the returned object */
+
+       status = acpi_ut_get_object_size(info->return_object,
+                                        &buffer_space_needed);
+       if (ACPI_SUCCESS(status)) {
+
+               /* Validate/Allocate/Clear caller buffer */
+
+               status = acpi_ut_initialize_buffer(return_buffer,
+                                                  buffer_space_needed);
+               if (ACPI_FAILURE(status)) {
+                       /*
+                        * Caller's buffer is too small or a new one can't
+                        * be allocated
+                        */
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Needed buffer size %X, %s\n",
+                                         (u32)buffer_space_needed,
+                                         acpi_format_exception(status)));
+               } else {
+                       /* We have enough space for the object, build it */
+
+                       status =
+                           acpi_ut_copy_iobject_to_eobject(info->return_object,
+                                                           return_buffer);
                }
        }
 
+cleanup_return_object:
+
        if (info->return_object) {
                /*
                 * Delete the internal return object. NOTE: Interpreter must be
index 285b82044e7b4b5e42ce62e32e7a040fccd15c94..76a1bd4bb0700aa6ff6b129b399ed3ebdd729ba8 100644 (file)
@@ -78,7 +78,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
 
 acpi_status
 acpi_get_handle(acpi_handle parent,
-               acpi_string pathname, acpi_handle * ret_handle)
+               acpi_string pathname, acpi_handle *ret_handle)
 {
        acpi_status status;
        struct acpi_namespace_node *node = NULL;
@@ -155,7 +155,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)
  *
  ******************************************************************************/
 acpi_status
-acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
+acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer *buffer)
 {
        acpi_status status;
        struct acpi_namespace_node *node;
@@ -448,7 +448,7 @@ acpi_get_object_info(acpi_handle handle,
                /* Point past the CID PNP_DEVICE_ID array */
 
                next_id_string +=
-                   ((acpi_size) cid_list->count *
+                   ((acpi_size)cid_list->count *
                     sizeof(struct acpi_pnp_device_id));
        }
 
index c312cd490450d2db64761bfa637a9e2339f8c293..32d372b8524335f03bb69bca5a08201334d8a3df 100644 (file)
@@ -63,7 +63,7 @@ ACPI_MODULE_NAME("nsxfobj")
  * DESCRIPTION: This routine returns the type associatd with a particular handle
  *
  ******************************************************************************/
-acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
+acpi_status acpi_get_type(acpi_handle handle, acpi_object_type *ret_type)
 {
        struct acpi_namespace_node *node;
        acpi_status status;
@@ -115,7 +115,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_type)
  *              Handle.
  *
  ******************************************************************************/
-acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
+acpi_status acpi_get_parent(acpi_handle handle, acpi_handle *ret_handle)
 {
        struct acpi_namespace_node *node;
        struct acpi_namespace_node *parent_node;
@@ -183,7 +183,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_parent)
 acpi_status
 acpi_get_next_object(acpi_object_type type,
                     acpi_handle parent,
-                    acpi_handle child, acpi_handle * ret_handle)
+                    acpi_handle child, acpi_handle *ret_handle)
 {
        acpi_status status;
        struct acpi_namespace_node *node;
index d48cbed342c1dda500d5020c746a9caf1c72ad09..c29c930ffa0862bf8bc4ebfae09536a93de7d770 100644 (file)
@@ -87,7 +87,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
         * used to encode the package length, either 0,1,2, or 3
         */
        byte_count = (aml[0] >> 6);
-       parser_state->aml += ((acpi_size) byte_count + 1);
+       parser_state->aml += ((acpi_size)byte_count + 1);
 
        /* Get bytes 3, 2, 1 as needed */
 
index cfd17a4f2e91badda16dee6a7d98ffc116271399..177b05b239b701235105dbfcd746de7fbe2a553b 100644 (file)
@@ -158,7 +158,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
  *
  ******************************************************************************/
 
-char *acpi_ps_get_opcode_name(u16 opcode)
+const char *acpi_ps_get_opcode_name(u16 opcode)
 {
 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
 
index 8038ed2aca058ea6e6c7dfd667cc010899d37fbe..0a23897d8adf8c215316fcc3dfea5f5b7d85e7de 100644 (file)
@@ -130,8 +130,8 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
  ******************************************************************************/
 
 acpi_status
-acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
-                        union acpi_parse_object * op)
+acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op)
 {
        union acpi_parse_object *prev;
        union acpi_parse_object *next;
index b28b0da171b62019147b3b4659137f898dd380d4..89cb4bffcc7c047b2fd9f86721cc7e70aeb6feae 100644 (file)
@@ -128,7 +128,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
        if (op_info->flags & AML_DEFER) {
                flags = ACPI_PARSEOP_DEFERRED;
        } else if (op_info->flags & AML_NAMED) {
-               flags = ACPI_PARSEOP_NAMED;
+               flags = ACPI_PARSEOP_NAMED_OBJECT;
        } else if (opcode == AML_INT_BYTELIST_OP) {
                flags = ACPI_PARSEOP_BYTELIST;
        }
index 04b37fcca684df2eb29fa369b7f5e16058d6f2bd..cf30cd821f5e21530cbd5c004c2c4e3deae6a0d2 100644 (file)
@@ -115,7 +115,7 @@ acpi_debug_trace(const char *name, u32 debug_level, u32 debug_layer, u32 flags)
  *
  ******************************************************************************/
 
-acpi_status acpi_ps_execute_method(struct acpi_evaluate_info * info)
+acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
 {
        acpi_status status;
        union acpi_parse_object *op;
index 2b1209d73e44f4a3c33226a0e19213a402cbdfa5..f1e83addd5b431c5522c1d9b9e20901ecd51b0b7 100644 (file)
@@ -112,7 +112,7 @@ acpi_rs_struct_option_length(struct acpi_resource_source *resource_source)
         * resource_source_index (1).
         */
        if (resource_source->string_ptr) {
-               return ((acpi_rs_length) (resource_source->string_length + 1));
+               return ((acpi_rs_length)(resource_source->string_length + 1));
        }
 
        return (0);
@@ -188,7 +188,7 @@ acpi_rs_stream_option_length(u32 resource_length,
 
 acpi_status
 acpi_rs_get_aml_length(struct acpi_resource *resource,
-                      acpi_size resource_list_size, acpi_size * size_needed)
+                      acpi_size resource_list_size, acpi_size *size_needed)
 {
        acpi_size aml_size_needed = 0;
        struct acpi_resource *resource_end;
@@ -278,11 +278,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
                         * 16-Bit Address Resource:
                         * Add the size of the optional resource_source info
                         */
-                       total_size = (acpi_rs_length) (total_size +
-                                                      acpi_rs_struct_option_length
-                                                      (&resource->data.
-                                                       address16.
-                                                       resource_source));
+                       total_size = (acpi_rs_length)(total_size +
+                                                     acpi_rs_struct_option_length
+                                                     (&resource->data.
+                                                      address16.
+                                                      resource_source));
                        break;
 
                case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -290,11 +290,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
                         * 32-Bit Address Resource:
                         * Add the size of the optional resource_source info
                         */
-                       total_size = (acpi_rs_length) (total_size +
-                                                      acpi_rs_struct_option_length
-                                                      (&resource->data.
-                                                       address32.
-                                                       resource_source));
+                       total_size = (acpi_rs_length)(total_size +
+                                                     acpi_rs_struct_option_length
+                                                     (&resource->data.
+                                                      address32.
+                                                      resource_source));
                        break;
 
                case ACPI_RESOURCE_TYPE_ADDRESS64:
@@ -302,11 +302,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
                         * 64-Bit Address Resource:
                         * Add the size of the optional resource_source info
                         */
-                       total_size = (acpi_rs_length) (total_size +
-                                                      acpi_rs_struct_option_length
-                                                      (&resource->data.
-                                                       address64.
-                                                       resource_source));
+                       total_size = (acpi_rs_length)(total_size +
+                                                     acpi_rs_struct_option_length
+                                                     (&resource->data.
+                                                      address64.
+                                                      resource_source));
                        break;
 
                case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
@@ -315,28 +315,28 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
                         * Add the size of each additional optional interrupt beyond the
                         * required 1 (4 bytes for each u32 interrupt number)
                         */
-                       total_size = (acpi_rs_length) (total_size +
-                                                      ((resource->data.
-                                                        extended_irq.
-                                                        interrupt_count -
-                                                        1) * 4) +
-                                                      /* Add the size of the optional resource_source info */
-                                                      acpi_rs_struct_option_length
-                                                      (&resource->data.
+                       total_size = (acpi_rs_length)(total_size +
+                                                     ((resource->data.
                                                        extended_irq.
-                                                       resource_source));
+                                                       interrupt_count -
+                                                       1) * 4) +
+                                                     /* Add the size of the optional resource_source info */
+                                                     acpi_rs_struct_option_length
+                                                     (&resource->data.
+                                                      extended_irq.
+                                                      resource_source));
                        break;
 
                case ACPI_RESOURCE_TYPE_GPIO:
 
-                       total_size = (acpi_rs_length) (total_size +
-                                                      (resource->data.gpio.
-                                                       pin_table_length * 2) +
-                                                      resource->data.gpio.
-                                                      resource_source.
-                                                      string_length +
-                                                      resource->data.gpio.
-                                                      vendor_length);
+                       total_size = (acpi_rs_length)(total_size +
+                                                     (resource->data.gpio.
+                                                      pin_table_length * 2) +
+                                                     resource->data.gpio.
+                                                     resource_source.
+                                                     string_length +
+                                                     resource->data.gpio.
+                                                     vendor_length);
 
                        break;
 
@@ -348,14 +348,14 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
                                                                   common_serial_bus.
                                                                   type];
 
-                       total_size = (acpi_rs_length) (total_size +
-                                                      resource->data.
-                                                      i2c_serial_bus.
-                                                      resource_source.
-                                                      string_length +
-                                                      resource->data.
-                                                      i2c_serial_bus.
-                                                      vendor_length);
+                       total_size = (acpi_rs_length)(total_size +
+                                                     resource->data.
+                                                     i2c_serial_bus.
+                                                     resource_source.
+                                                     string_length +
+                                                     resource->data.
+                                                     i2c_serial_bus.
+                                                     vendor_length);
 
                        break;
 
@@ -397,8 +397,8 @@ acpi_rs_get_aml_length(struct acpi_resource *resource,
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_list_length(u8 * aml_buffer,
-                       u32 aml_buffer_length, acpi_size * size_needed)
+acpi_rs_get_list_length(u8 *aml_buffer,
+                       u32 aml_buffer_length, acpi_size *size_needed)
 {
        acpi_status status;
        u8 *end_aml;
@@ -610,7 +610,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
 
 acpi_status
 acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
-                                    acpi_size * buffer_size_needed)
+                                    acpi_size *buffer_size_needed)
 {
        u32 number_of_elements;
        acpi_size temp_size_needed = 0;
index 12978891e842a145ff8c203c43237362df5a846b..809b61c114fef1c008565bead600c1bcd28499b1 100644 (file)
@@ -347,7 +347,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                                           (u8 *) output_buffer->pointer);
                                path_buffer.pointer = user_prt->source;
 
-                               status = acpi_ns_handle_to_pathname((acpi_handle) node, &path_buffer, FALSE);
+                               status = acpi_ns_handle_to_pathname((acpi_handle)node, &path_buffer, FALSE);
 
                                /* +1 to include null terminator */
 
index 23a17c86d5a9fdfc7be6c17c0bc612478e297216..5ffdb5602d8db31d2c06776e4f5846252f1129da 100644 (file)
@@ -52,17 +52,17 @@ ACPI_MODULE_NAME("rsdump")
  * All functions in this module are used by the AML Debugger only
  */
 /* Local prototypes */
-static void acpi_rs_out_string(char *title, char *value);
+static void acpi_rs_out_string(const char *title, const char *value);
 
-static void acpi_rs_out_integer8(char *title, u8 value);
+static void acpi_rs_out_integer8(const char *title, u8 value);
 
-static void acpi_rs_out_integer16(char *title, u16 value);
+static void acpi_rs_out_integer16(const char *title, u16 value);
 
-static void acpi_rs_out_integer32(char *title, u32 value);
+static void acpi_rs_out_integer32(const char *title, u32 value);
 
-static void acpi_rs_out_integer64(char *title, u64 value);
+static void acpi_rs_out_integer64(const char *title, u64 value);
 
-static void acpi_rs_out_title(char *title);
+static void acpi_rs_out_title(const char *title);
 
 static void acpi_rs_dump_byte_list(u16 length, u8 *data);
 
@@ -208,7 +208,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
 {
        u8 *target = NULL;
        u8 *previous_target;
-       char *name;
+       const char *name;
        u8 count;
 
        /* First table entry must contain the table length (# of table entries) */
@@ -248,10 +248,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
                case ACPI_RSD_UINT8:
 
                        if (table->pointer) {
-                               acpi_rs_out_string(name, ACPI_CAST_PTR(char,
-                                                                      table->
-                                                                      pointer
-                                                                      [*target]));
+                               acpi_rs_out_string(name,
+                                                  table->pointer[*target]);
                        } else {
                                acpi_rs_out_integer8(name, ACPI_GET8(target));
                        }
@@ -276,26 +274,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
 
                case ACPI_RSD_1BITFLAG:
 
-                       acpi_rs_out_string(name, ACPI_CAST_PTR(char,
-                                                              table->
-                                                              pointer[*target &
-                                                                      0x01]));
+                       acpi_rs_out_string(name,
+                                          table->pointer[*target & 0x01]);
                        break;
 
                case ACPI_RSD_2BITFLAG:
 
-                       acpi_rs_out_string(name, ACPI_CAST_PTR(char,
-                                                              table->
-                                                              pointer[*target &
-                                                                      0x03]));
+                       acpi_rs_out_string(name,
+                                          table->pointer[*target & 0x03]);
                        break;
 
                case ACPI_RSD_3BITFLAG:
 
-                       acpi_rs_out_string(name, ACPI_CAST_PTR(char,
-                                                              table->
-                                                              pointer[*target &
-                                                                      0x07]));
+                       acpi_rs_out_string(name,
+                                          table->pointer[*target & 0x07]);
                        break;
 
                case ACPI_RSD_SHORTLIST:
@@ -481,7 +473,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
  *
  ******************************************************************************/
 
-static void acpi_rs_out_string(char *title, char *value)
+static void acpi_rs_out_string(const char *title, const char *value)
 {
 
        acpi_os_printf("%27s : %s", title, value);
@@ -491,30 +483,30 @@ static void acpi_rs_out_string(char *title, char *value)
        acpi_os_printf("\n");
 }
 
-static void acpi_rs_out_integer8(char *title, u8 value)
+static void acpi_rs_out_integer8(const char *title, u8 value)
 {
        acpi_os_printf("%27s : %2.2X\n", title, value);
 }
 
-static void acpi_rs_out_integer16(char *title, u16 value)
+static void acpi_rs_out_integer16(const char *title, u16 value)
 {
 
        acpi_os_printf("%27s : %4.4X\n", title, value);
 }
 
-static void acpi_rs_out_integer32(char *title, u32 value)
+static void acpi_rs_out_integer32(const char *title, u32 value)
 {
 
        acpi_os_printf("%27s : %8.8X\n", title, value);
 }
 
-static void acpi_rs_out_integer64(char *title, u64 value)
+static void acpi_rs_out_integer64(const char *title, u64 value)
 {
 
        acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
 }
 
-static void acpi_rs_out_title(char *title)
+static void acpi_rs_out_title(const char *title)
 {
 
        acpi_os_printf("%27s : ", title);
index 5c3491387f9fb4326f5842ba7ac6c159b3ab8543..61e8f16c857d66413e7dfc5fc52255fb482434fc 100644 (file)
@@ -330,19 +330,20 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
        {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (common_serial_bus.type),           "Type",                     acpi_gbl_sbt_decode}, \
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer",      acpi_gbl_consume_decode}, \
        {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode),     "SlaveMode",                acpi_gbl_sm_decode}, \
+       {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.connection_sharing),"ConnectionSharing",     acpi_gbl_shr_decode}, \
        {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId",         NULL}, \
        {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength",         NULL}, \
        {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource",          NULL}, \
        {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (common_serial_bus.vendor_length),  "VendorLength",             NULL}, \
        {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data),   "VendorData",               NULL},
 
-struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = {
+struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[11] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
         "Common Serial Bus", NULL},
        ACPI_RS_DUMP_COMMON_SERIAL_BUS
 };
 
-struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
+struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[14] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
         "I2C Serial Bus", NULL},
        ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@@ -355,7 +356,7 @@ struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
         "SlaveAddress", NULL},
 };
 
-struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
+struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[18] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
         "Spi Serial Bus", NULL},
        ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
@@ -376,7 +377,7 @@ struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
         "ConnectionSpeed", NULL},
 };
 
-struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = {
+struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[20] = {
        {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
         "Uart Serial Bus", NULL},
        ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
index ce3d0b77ec89f5ce206129570e6a4af3b1aa9553..25165ca420514435ae119435712c7287fc581654 100644 (file)
@@ -87,7 +87,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (((acpi_size) resource) & 0x3) {
+       if (((acpi_size)resource) & 0x3) {
 
                /* Each internal resource struct is expected to be 32-bit aligned */
 
index 8a01296ac7cf675aedb272778a8b4a7d7c42fccc..b82c061f205a0c6888986c9705d4c6454fe46390 100644 (file)
@@ -151,7 +151,7 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
  *
  ******************************************************************************/
 
-struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
+struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[17] = {
        {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
         ACPI_RS_SIZE(struct acpi_resource_i2c_serialbus),
         ACPI_RSC_TABLE_SIZE(acpi_rs_convert_i2c_serial_bus)},
@@ -177,6 +177,11 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
         AML_OFFSET(common_serial_bus.flags),
         1},
 
+       {ACPI_RSC_1BITFLAG,
+        ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
+        AML_OFFSET(common_serial_bus.flags),
+        2},
+
        {ACPI_RSC_MOVE8,
         ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
         AML_OFFSET(common_serial_bus.type_revision_id),
@@ -237,7 +242,7 @@ struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[16] = {
  *
  ******************************************************************************/
 
-struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
+struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[21] = {
        {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
         ACPI_RS_SIZE(struct acpi_resource_spi_serialbus),
         ACPI_RSC_TABLE_SIZE(acpi_rs_convert_spi_serial_bus)},
@@ -263,6 +268,11 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
         AML_OFFSET(common_serial_bus.flags),
         1},
 
+       {ACPI_RSC_1BITFLAG,
+        ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
+        AML_OFFSET(common_serial_bus.flags),
+        2},
+
        {ACPI_RSC_MOVE8,
         ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
         AML_OFFSET(common_serial_bus.type_revision_id),
@@ -339,7 +349,7 @@ struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[20] = {
  *
  ******************************************************************************/
 
-struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = {
+struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[23] = {
        {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_SERIAL_BUS,
         ACPI_RS_SIZE(struct acpi_resource_uart_serialbus),
         ACPI_RSC_TABLE_SIZE(acpi_rs_convert_uart_serial_bus)},
@@ -365,6 +375,11 @@ struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[22] = {
         AML_OFFSET(common_serial_bus.flags),
         1},
 
+       {ACPI_RSC_1BITFLAG,
+        ACPI_RS_OFFSET(data.common_serial_bus.connection_sharing),
+        AML_OFFSET(common_serial_bus.flags),
+        2},
+
        {ACPI_RSC_MOVE8,
         ACPI_RS_OFFSET(data.common_serial_bus.type_revision_id),
         AML_OFFSET(common_serial_bus.type_revision_id),
index cf06e49cd91c396237e5f96bb856f12daa6867c2..fa491c64c0404bef4c16904e1a1535c663a199e8 100644 (file)
@@ -338,7 +338,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
         * Note: Some resource descriptors will have an additional null, so
         * we add 1 to the minimum length.
         */
-       if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
+       if (total_length > (acpi_rsdesc_size)(minimum_length + 1)) {
 
                /* Get the resource_source_index */
 
@@ -377,7 +377,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
                                   ACPI_CAST_PTR(char,
                                                 &aml_resource_source[1]));
 
-               return ((acpi_rs_length) total_length);
+               return ((acpi_rs_length)total_length);
        }
 
        /* resource_source is not present */
@@ -406,9 +406,9 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
  ******************************************************************************/
 
 acpi_rsdesc_size
-acpi_rs_set_resource_source(union aml_resource * aml,
+acpi_rs_set_resource_source(union aml_resource *aml,
                            acpi_rs_length minimum_length,
-                           struct acpi_resource_source * resource_source)
+                           struct acpi_resource_source *resource_source)
 {
        u8 *aml_resource_source;
        acpi_rsdesc_size descriptor_length;
@@ -466,8 +466,8 @@ acpi_rs_set_resource_source(union aml_resource * aml,
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_prt_method_data(struct acpi_namespace_node * node,
-                           struct acpi_buffer * ret_buffer)
+acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
+                           struct acpi_buffer *ret_buffer)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
@@ -671,7 +671,7 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
 
 acpi_status
 acpi_rs_get_method_data(acpi_handle handle,
-                       char *path, struct acpi_buffer *ret_buffer)
+                       const char *path, struct acpi_buffer *ret_buffer)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
index 900933be99093de9bd9bb5ec5ff786451f178d54..465ed8137167ce6112387e719c4d299b14aa1268 100644 (file)
@@ -433,8 +433,8 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
 acpi_status
 acpi_get_vendor_resource(acpi_handle device_handle,
                         char *name,
-                        struct acpi_vendor_uuid * uuid,
-                        struct acpi_buffer * ret_buffer)
+                        struct acpi_vendor_uuid *uuid,
+                        struct acpi_buffer *ret_buffer)
 {
        struct acpi_vendor_walk_info info;
        acpi_status status;
@@ -539,7 +539,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
  ******************************************************************************/
 
 acpi_status
-acpi_walk_resource_buffer(struct acpi_buffer * buffer,
+acpi_walk_resource_buffer(struct acpi_buffer *buffer,
                          acpi_walk_resource_callback user_function,
                          void *context)
 {
index 7da79ce74080225754ef9296e64578b447280a4c..1388a19e5db81ac3d3dfff8bcc7a1c5f9e8e4a85 100644 (file)
@@ -368,7 +368,7 @@ acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc)
  *****************************************************************************/
 
 acpi_status
-acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
+acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature)
 {
        acpi_status status = AE_OK;
 
@@ -401,9 +401,9 @@ acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature)
                        ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY,
                                        "%4.4s 0x%8.8X%8.8X"
                                        " Attempted table install failed",
-                                       acpi_ut_valid_acpi_name(table_desc->
-                                                               signature.
-                                                               ascii) ?
+                                       acpi_ut_valid_nameseg(table_desc->
+                                                             signature.
+                                                             ascii) ?
                                        table_desc->signature.ascii : "????",
                                        ACPI_FORMAT_UINT64(table_desc->
                                                           address)));
@@ -454,7 +454,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
                table_count = acpi_gbl_root_table_list.current_table_count;
        }
 
-       tables = ACPI_ALLOCATE_ZEROED(((acpi_size) table_count +
+       tables = ACPI_ALLOCATE_ZEROED(((acpi_size)table_count +
                                       ACPI_ROOT_TABLE_SIZE_INCREMENT) *
                                      sizeof(struct acpi_table_desc));
        if (!tables) {
@@ -467,8 +467,7 @@ acpi_status acpi_tb_resize_root_table_list(void)
 
        if (acpi_gbl_root_table_list.tables) {
                memcpy(tables, acpi_gbl_root_table_list.tables,
-                      (acpi_size) table_count *
-                      sizeof(struct acpi_table_desc));
+                      (acpi_size)table_count * sizeof(struct acpi_table_desc));
 
                if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
                        ACPI_FREE(acpi_gbl_root_table_list.tables);
@@ -701,7 +700,7 @@ acpi_status acpi_tb_release_owner_id(u32 table_index)
  *
  ******************************************************************************/
 
-acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id * owner_id)
+acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id)
 {
        acpi_status status = AE_BAD_PARAMETER;
 
index a79e4f30b53051b4de6be90e26bae84f2c5c9866..620806965243d03813c99284285ac0f9dcdd98fd 100644 (file)
@@ -53,7 +53,7 @@ static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
                             u8 space_id,
                             u8 byte_width,
-                            u64 address, char *register_name, u8 flags);
+                            u64 address, const char *register_name, u8 flags);
 
 static void acpi_tb_convert_fadt(void);
 
@@ -65,7 +65,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64);
 /* Table for conversion of FADT to common internal format and FADT validation */
 
 typedef struct acpi_fadt_info {
-       char *name;
+       const char *name;
        u16 address64;
        u16 address32;
        u16 length;
@@ -192,7 +192,7 @@ static void
 acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
                             u8 space_id,
                             u8 byte_width,
-                            u64 address, char *register_name, u8 flags)
+                            u64 address, const char *register_name, u8 flags)
 {
        u8 bit_width;
 
@@ -344,7 +344,7 @@ void acpi_tb_parse_fadt(void)
 
        /* Obtain the DSDT and FACS tables via their addresses within the FADT */
 
-       acpi_tb_install_fixed_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt,
+       acpi_tb_install_fixed_table((acpi_physical_address)acpi_gbl_FADT.Xdsdt,
                                    ACPI_SIG_DSDT, &acpi_gbl_dsdt_index);
 
        /* If Hardware Reduced flag is set, there is no FACS */
@@ -385,14 +385,15 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
 {
        /*
         * Check if the FADT is larger than the largest table that we expect
-        * (the ACPI 5.0 version). If so, truncate the table, and issue
-        * a warning.
+        * (typically the current ACPI specification version). If so, truncate
+        * the table, and issue a warning.
         */
        if (length > sizeof(struct acpi_table_fadt)) {
                ACPI_BIOS_WARNING((AE_INFO,
-                                  "FADT (revision %u) is longer than ACPI 5.0 version, "
+                                  "FADT (revision %u) is longer than %s length, "
                                   "truncating length %u to %u",
-                                  table->revision, length,
+                                  table->revision, ACPI_FADT_CONFORMANCE,
+                                  length,
                                   (u32)sizeof(struct acpi_table_fadt)));
        }
 
@@ -467,7 +468,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
 
 static void acpi_tb_convert_fadt(void)
 {
-       char *name;
+       const char *name;
        struct acpi_generic_address *address64;
        u32 address32;
        u8 length;
@@ -646,9 +647,12 @@ static void acpi_tb_convert_fadt(void)
                        if ((address64->address && !length) ||
                            (!address64->address && length)) {
                                ACPI_BIOS_WARNING((AE_INFO,
-                                                  "Optional FADT field %s has zero address or length: "
-                                                  "0x%8.8X%8.8X/0x%X",
-                                                  name,
+                                                  "Optional FADT field %s has valid %s but zero %s: "
+                                                  "0x%8.8X%8.8X/0x%X", name,
+                                                  (length ? "Length" :
+                                                   "Address"),
+                                                  (length ? "Address" :
+                                                   "Length"),
                                                   ACPI_FORMAT_UINT64
                                                   (address64->address),
                                                   length));
index f2d08034630e34b1e616f9774f699a538d27ca59..e348d616e60f29e095d476c02b938c33fa78c827 100644 (file)
@@ -76,7 +76,7 @@ acpi_tb_find_table(char *signature,
 
        /* Validate the input table signature */
 
-       if (!acpi_is_valid_signature(signature)) {
+       if (!acpi_ut_valid_nameseg(signature)) {
                return_ACPI_STATUS(AE_BAD_SIGNATURE);
        }
 
index 4dc6108de4ffbf83a37ea714e0342cfcd8847d6c..8b13052128fcbe54f9d4be724a4a8dab0fbdde93 100644 (file)
@@ -299,9 +299,9 @@ acpi_tb_install_standard_table(acpi_physical_address address,
                        ACPI_BIOS_ERROR((AE_INFO,
                                         "Table has invalid signature [%4.4s] (0x%8.8X), "
                                         "must be SSDT or OEMx",
-                                        acpi_ut_valid_acpi_name(new_table_desc.
-                                                                signature.
-                                                                ascii) ?
+                                        acpi_ut_valid_nameseg(new_table_desc.
+                                                              signature.
+                                                              ascii) ?
                                         new_table_desc.signature.
                                         ascii : "????",
                                         new_table_desc.signature.integer));
index 9240c76d2823e333d2b30ca2d24ad32bfae3c5cf..e28553914bf5cc5fcb1da300b493036bc6a83743 100644 (file)
@@ -231,7 +231,7 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size)
                                           ACPI_FORMAT_UINT64(address64)));
                }
 #endif
-               return ((acpi_physical_address) (address64));
+               return ((acpi_physical_address)(address64));
        }
 }
 
@@ -287,12 +287,12 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
                 * the XSDT if the revision is > 1 and the XSDT pointer is present,
                 * as per the ACPI specification.
                 */
-               address = (acpi_physical_address) rsdp->xsdt_physical_address;
+               address = (acpi_physical_address)rsdp->xsdt_physical_address;
                table_entry_size = ACPI_XSDT_ENTRY_SIZE;
        } else {
                /* Root table is an RSDT (32-bit physical addresses) */
 
-               address = (acpi_physical_address) rsdp->rsdt_physical_address;
+               address = (acpi_physical_address)rsdp->rsdt_physical_address;
                table_entry_size = ACPI_RSDT_ENTRY_SIZE;
        }
 
@@ -380,30 +380,3 @@ next_table:
        acpi_os_unmap_memory(table, length);
        return_ACPI_STATUS(AE_OK);
 }
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_is_valid_signature
- *
- * PARAMETERS:  signature           - Sig string to be validated
- *
- * RETURN:      TRUE if signature is has 4 valid ACPI characters
- *
- * DESCRIPTION: Validate an ACPI table signature.
- *
- ******************************************************************************/
-
-u8 acpi_is_valid_signature(char *signature)
-{
-       u32 i;
-
-       /* Validate each character in the signature */
-
-       for (i = 0; i < ACPI_NAME_SIZE; i++) {
-               if (!acpi_ut_valid_acpi_char(signature[i], i)) {
-                       return (FALSE);
-               }
-       }
-
-       return (TRUE);
-}
index 326df65decef856bb6b3427f800197ed322aac86..3ecec937e8c95d9e1c64baa133c628d0fbfc75a7 100644 (file)
@@ -99,7 +99,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count)
  ******************************************************************************/
 
 acpi_status __init
-acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
+acpi_initialize_tables(struct acpi_table_desc *initial_table_array,
                       u32 initial_table_count, u8 allow_resize)
 {
        acpi_physical_address rsdp_address;
@@ -120,7 +120,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
                /* Root Table Array has been statically allocated by the host */
 
                memset(initial_table_array, 0,
-                      (acpi_size) initial_table_count *
+                      (acpi_size)initial_table_count *
                       sizeof(struct acpi_table_desc));
 
                acpi_gbl_root_table_list.tables = initial_table_array;
@@ -352,7 +352,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table)
  *
  ******************************************************************************/
 acpi_status
-acpi_get_table_by_index(u32 table_index, struct acpi_table_header ** table)
+acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table)
 {
        acpi_status status;
 
index 3151968c10d1a0aef3c2a1610307568b8e171d4a..ac71abcd32bbc6c48aaa9afd1374ae3d584ec288 100644 (file)
@@ -82,7 +82,7 @@ acpi_status __init acpi_load_tables(void)
         * their customized default region handlers.
         */
        status = acpi_ev_install_region_handlers();
-       if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) {
+       if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status,
                                "During Region initialization"));
                return_ACPI_STATUS(status);
index b9a78e457d19e0ab0ae023e49c1169b831a1a2e3..adb6cfc546618985472782469564b573f63e860a 100644 (file)
@@ -90,7 +90,7 @@ u32 acpi_tb_get_rsdp_length(struct acpi_table_rsdp *rsdp)
  *
  ******************************************************************************/
 
-acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp * rsdp)
+acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
 {
 
        /*
@@ -142,7 +142,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp * rsdp)
  *
  ******************************************************************************/
 
-acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address)
+acpi_status __init acpi_find_root_pointer(acpi_physical_address *table_address)
 {
        u8 *table_ptr;
        u8 *mem_rover;
@@ -201,7 +201,7 @@ acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address)
                            (u32) ACPI_PTR_DIFF(mem_rover, table_ptr);
 
                        *table_address =
-                           (acpi_physical_address) physical_address;
+                           (acpi_physical_address)physical_address;
                        return_ACPI_STATUS(AE_OK);
                }
        }
@@ -234,7 +234,7 @@ acpi_status __init acpi_find_root_pointer(acpi_physical_address * table_address)
                    (ACPI_HI_RSDP_WINDOW_BASE +
                     ACPI_PTR_DIFF(mem_rover, table_ptr));
 
-               *table_address = (acpi_physical_address) physical_address;
+               *table_address = (acpi_physical_address)physical_address;
                return_ACPI_STATUS(AE_OK);
        }
 
index 3dbdc3ab8b789662808ad37704dc666de48c0b7d..13324a27b99b3ea666807f6698bd0685a2a1dc28 100644 (file)
@@ -231,7 +231,7 @@ acpi_status acpi_ut_delete_caches(void)
  *
  ******************************************************************************/
 
-acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
+acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer)
 {
 
        /* Obviously, the structure pointer must be valid */
@@ -272,8 +272,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
  ******************************************************************************/
 
 acpi_status
-acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
-                         acpi_size required_length)
+acpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length)
 {
        acpi_size input_buffer_length;
 
diff --git a/drivers/acpi/acpica/utascii.c b/drivers/acpi/acpica/utascii.c
new file mode 100644 (file)
index 0000000..706c1f3
--- /dev/null
@@ -0,0 +1,140 @@
+/******************************************************************************
+ *
+ * Module Name: utascii - Utility ascii functions
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, 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"
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_valid_nameseg
+ *
+ * PARAMETERS:  name            - The name or table signature to be examined.
+ *                                Four characters, does not have to be a
+ *                                NULL terminated string.
+ *
+ * RETURN:      TRUE if signature is has 4 valid ACPI characters
+ *
+ * DESCRIPTION: Validate an ACPI table signature.
+ *
+ ******************************************************************************/
+
+u8 acpi_ut_valid_nameseg(char *name)
+{
+       u32 i;
+
+       /* Validate each character in the signature */
+
+       for (i = 0; i < ACPI_NAME_SIZE; i++) {
+               if (!acpi_ut_valid_name_char(name[i], i)) {
+                       return (FALSE);
+               }
+       }
+
+       return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_valid_name_char
+ *
+ * PARAMETERS:  char            - The character to be examined
+ *              position        - Byte position (0-3)
+ *
+ * RETURN:      TRUE if the character is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:
+ *              1) Upper case alpha
+ *              2) numeric
+ *              3) underscore
+ *
+ *              We allow a '!' as the last character because of the ASF! table
+ *
+ ******************************************************************************/
+
+u8 acpi_ut_valid_name_char(char character, u32 position)
+{
+
+       if (!((character >= 'A' && character <= 'Z') ||
+             (character >= '0' && character <= '9') || (character == '_'))) {
+
+               /* Allow a '!' in the last position */
+
+               if (character == '!' && position == 3) {
+                       return (TRUE);
+               }
+
+               return (FALSE);
+       }
+
+       return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_check_and_repair_ascii
+ *
+ * PARAMETERS:  name                - Ascii string
+ *              count               - Number of characters to check
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Ensure that the requested number of characters are printable
+ *              Ascii characters. Sets non-printable and null chars to <space>.
+ *
+ ******************************************************************************/
+
+void acpi_ut_check_and_repair_ascii(u8 *name, char *repaired_name, u32 count)
+{
+       u32 i;
+
+       for (i = 0; i < count; i++) {
+               repaired_name[i] = (char)name[i];
+
+               if (!name[i]) {
+                       return;
+               }
+               if (!isprint(name[i])) {
+                       repaired_name[i] = ' ';
+               }
+       }
+}
index 0cfb2b8edad557009a28fb6fe887fae56a2bfa41..bd31faf5da7ca8b7116205ff9464b8b5e1b115c9 100644 (file)
@@ -106,31 +106,31 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
                        default:        /* Default is BYTE display */
 
                                acpi_os_printf("%02X ",
-                                              buffer[(acpi_size) i + j]);
+                                              buffer[(acpi_size)i + j]);
                                break;
 
                        case DB_WORD_DISPLAY:
 
                                ACPI_MOVE_16_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
+                                                  &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]);
+                                                  &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]);
+                                                  &buffer[(acpi_size)i + j]);
                                acpi_os_printf("%08X", temp32);
 
                                ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j +
+                                                  &buffer[(acpi_size)i + j +
                                                           4]);
                                acpi_os_printf("%08X ", temp32);
                                break;
@@ -158,7 +158,7 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
                                acpi_os_printf("// ");
                        }
 
-                       buf_char = buffer[(acpi_size) i + j];
+                       buf_char = buffer[(acpi_size)i + j];
                        if (isprint(buf_char)) {
                                acpi_os_printf("%c", buf_char);
                        } else {
@@ -274,31 +274,31 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
                        default:        /* Default is BYTE display */
 
                                acpi_ut_file_printf(file, "%02X ",
-                                                   buffer[(acpi_size) i + j]);
+                                                   buffer[(acpi_size)i + j]);
                                break;
 
                        case DB_WORD_DISPLAY:
 
                                ACPI_MOVE_16_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
+                                                  &buffer[(acpi_size)i + j]);
                                acpi_ut_file_printf(file, "%04X ", temp32);
                                break;
 
                        case DB_DWORD_DISPLAY:
 
                                ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
+                                                  &buffer[(acpi_size)i + j]);
                                acpi_ut_file_printf(file, "%08X ", temp32);
                                break;
 
                        case DB_QWORD_DISPLAY:
 
                                ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j]);
+                                                  &buffer[(acpi_size)i + j]);
                                acpi_ut_file_printf(file, "%08X", temp32);
 
                                ACPI_MOVE_32_TO_32(&temp32,
-                                                  &buffer[(acpi_size) i + j +
+                                                  &buffer[(acpi_size)i + j +
                                                           4]);
                                acpi_ut_file_printf(file, "%08X ", temp32);
                                break;
@@ -318,7 +318,7 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
                                return;
                        }
 
-                       buf_char = buffer[(acpi_size) i + j];
+                       buf_char = buffer[(acpi_size)i + j];
                        if (isprint(buf_char)) {
                                acpi_ut_file_printf(file, "%c", buf_char);
                        } else {
index f8e9978888e162e7f035a69b339741ca515ef2a3..3b8d23ef351fe5dff1996d268a9689f14e2d2d79 100644 (file)
@@ -105,7 +105,7 @@ acpi_os_create_cache(char *cache_name,
  *
  ******************************************************************************/
 
-acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
+acpi_status acpi_os_purge_cache(struct acpi_memory_list *cache)
 {
        void *next;
        acpi_status status;
@@ -151,7 +151,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
  *
  ******************************************************************************/
 
-acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
+acpi_status acpi_os_delete_cache(struct acpi_memory_list *cache)
 {
        acpi_status status;
 
@@ -184,8 +184,7 @@ acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
  *
  ******************************************************************************/
 
-acpi_status
-acpi_os_release_object(struct acpi_memory_list * cache, void *object)
+acpi_status acpi_os_release_object(struct acpi_memory_list *cache, void *object)
 {
        acpi_status status;
 
index 98d53e59ce5522149685f07e8e0a2dd346b76e86..82f971402d85dd62d5bc29e0dd3e4e766380ee5e 100644 (file)
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("utcopy")
 static acpi_status
 acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
                                union acpi_object *external_object,
-                               u8 * data_space, acpi_size * buffer_space_used);
+                               u8 *data_space, acpi_size *buffer_space_used);
 
 static acpi_status
 acpi_ut_copy_ielement_to_ielement(u8 object_type,
@@ -63,7 +63,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
 
 static acpi_status
 acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
-                                 u8 * buffer, acpi_size * space_used);
+                                 u8 *buffer, acpi_size *space_used);
 
 static acpi_status
 acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
@@ -111,7 +111,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
 static acpi_status
 acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
                                union acpi_object *external_object,
-                               u8 * data_space, acpi_size * buffer_space_used)
+                               u8 *data_space, acpi_size *buffer_space_used)
 {
        acpi_status status = AE_OK;
 
@@ -151,7 +151,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
 
                memcpy((void *)data_space,
                       (void *)internal_object->string.pointer,
-                      (acpi_size) internal_object->string.length + 1);
+                      (acpi_size)internal_object->string.length + 1);
                break;
 
        case ACPI_TYPE_BUFFER:
@@ -331,7 +331,7 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type,
 
 static acpi_status
 acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
-                                 u8 * buffer, acpi_size * space_used)
+                                 u8 *buffer, acpi_size *space_used)
 {
        union acpi_object *external_object;
        acpi_status status;
@@ -362,7 +362,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
         * Leave room for an array of ACPI_OBJECTS in the buffer
         * and move the free space past it
         */
-       info.length += (acpi_size) external_object->package.count *
+       info.length += (acpi_size)external_object->package.count *
            ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
        info.free_space += external_object->package.count *
            ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
@@ -738,7 +738,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
                 */
                if (source_desc->string.pointer) {
                        dest_desc->string.pointer =
-                           ACPI_ALLOCATE((acpi_size) source_desc->string.
+                           ACPI_ALLOCATE((acpi_size)source_desc->string.
                                          length + 1);
                        if (!dest_desc->string.pointer) {
                                return (AE_NO_MEMORY);
@@ -748,7 +748,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
 
                        memcpy(dest_desc->string.pointer,
                               source_desc->string.pointer,
-                              (acpi_size) source_desc->string.length + 1);
+                              (acpi_size)source_desc->string.length + 1);
                }
                break;
 
index 1cfc5f69b0338048b1a76ac736543a21a95ac4fc..5744222050052b9ad29f4bdbd0ec5864654ec007 100644 (file)
 ACPI_MODULE_NAME("utdebug")
 
 #ifdef ACPI_DEBUG_OUTPUT
-static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF;
-static char *acpi_gbl_fn_entry_str = "----Entry";
-static char *acpi_gbl_fn_exit_str = "----Exit-";
-
-/* Local prototypes */
-
-static const char *acpi_ut_trim_function_name(const char *function_name);
+static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF;
+static const char *acpi_gbl_function_entry_prefix = "----Entry";
+static const char *acpi_gbl_function_exit_prefix = "----Exit-";
 
 /*******************************************************************************
  *
@@ -178,14 +174,14 @@ acpi_debug_print(u32 requested_debug_level,
         * Thread tracking and context switch notification
         */
        thread_id = acpi_os_get_thread_id();
-       if (thread_id != acpi_gbl_prev_thread_id) {
+       if (thread_id != acpi_gbl_previous_thread_id) {
                if (ACPI_LV_THREADS & acpi_dbg_level) {
                        acpi_os_printf
                            ("\n**** Context Switch from TID %u to TID %u ****\n\n",
-                            (u32)acpi_gbl_prev_thread_id, (u32)thread_id);
+                            (u32)acpi_gbl_previous_thread_id, (u32)thread_id);
                }
 
-               acpi_gbl_prev_thread_id = thread_id;
+               acpi_gbl_previous_thread_id = thread_id;
                acpi_gbl_nesting_level = 0;
        }
 
@@ -287,7 +283,8 @@ acpi_ut_trace(u32 line_number,
        if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
-                                component_id, "%s\n", acpi_gbl_fn_entry_str);
+                                component_id, "%s\n",
+                                acpi_gbl_function_entry_prefix);
        }
 }
 
@@ -312,7 +309,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
 void
 acpi_ut_trace_ptr(u32 line_number,
                  const char *function_name,
-                 const char *module_name, u32 component_id, void *pointer)
+                 const char *module_name,
+                 u32 component_id, const void *pointer)
 {
 
        acpi_gbl_nesting_level++;
@@ -323,8 +321,8 @@ acpi_ut_trace_ptr(u32 line_number,
        if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
-                                component_id, "%s %p\n", acpi_gbl_fn_entry_str,
-                                pointer);
+                                component_id, "%s %p\n",
+                                acpi_gbl_function_entry_prefix, pointer);
        }
 }
 
@@ -348,7 +346,7 @@ acpi_ut_trace_ptr(u32 line_number,
 void
 acpi_ut_trace_str(u32 line_number,
                  const char *function_name,
-                 const char *module_name, u32 component_id, char *string)
+                 const char *module_name, u32 component_id, const char *string)
 {
 
        acpi_gbl_nesting_level++;
@@ -359,8 +357,8 @@ acpi_ut_trace_str(u32 line_number,
        if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
-                                component_id, "%s %s\n", acpi_gbl_fn_entry_str,
-                                string);
+                                component_id, "%s %s\n",
+                                acpi_gbl_function_entry_prefix, string);
        }
 }
 
@@ -396,7 +394,7 @@ acpi_ut_trace_u32(u32 line_number,
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
                                 component_id, "%s %08X\n",
-                                acpi_gbl_fn_entry_str, integer);
+                                acpi_gbl_function_entry_prefix, integer);
        }
 }
 
@@ -427,7 +425,8 @@ acpi_ut_exit(u32 line_number,
        if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
-                                component_id, "%s\n", acpi_gbl_fn_exit_str);
+                                component_id, "%s\n",
+                                acpi_gbl_function_exit_prefix);
        }
 
        if (acpi_gbl_nesting_level) {
@@ -467,14 +466,14 @@ acpi_ut_status_exit(u32 line_number,
                        acpi_debug_print(ACPI_LV_FUNCTIONS,
                                         line_number, function_name,
                                         module_name, component_id, "%s %s\n",
-                                        acpi_gbl_fn_exit_str,
+                                        acpi_gbl_function_exit_prefix,
                                         acpi_format_exception(status));
                } else {
                        acpi_debug_print(ACPI_LV_FUNCTIONS,
                                         line_number, function_name,
                                         module_name, component_id,
                                         "%s ****Exception****: %s\n",
-                                        acpi_gbl_fn_exit_str,
+                                        acpi_gbl_function_exit_prefix,
                                         acpi_format_exception(status));
                }
        }
@@ -514,7 +513,7 @@ acpi_ut_value_exit(u32 line_number,
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
                                 component_id, "%s %8.8X%8.8X\n",
-                                acpi_gbl_fn_exit_str,
+                                acpi_gbl_function_exit_prefix,
                                 ACPI_FORMAT_UINT64(value));
        }
 
@@ -552,8 +551,8 @@ acpi_ut_ptr_exit(u32 line_number,
        if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
                acpi_debug_print(ACPI_LV_FUNCTIONS,
                                 line_number, function_name, module_name,
-                                component_id, "%s %p\n", acpi_gbl_fn_exit_str,
-                                ptr);
+                                component_id, "%s %p\n",
+                                acpi_gbl_function_exit_prefix, ptr);
        }
 
        if (acpi_gbl_nesting_level) {
index 6ba65b02550c164ab4dba6a709a0691f83cd188c..efd7988e34cb6ace48e5a7447595b769587fdb90 100644 (file)
@@ -446,7 +446,7 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)
 
 /* Names for Notify() values, used for debug output */
 
-static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
+static const char *acpi_gbl_generic_notify[ACPI_GENERIC_NOTIFY_MAX + 1] = {
        /* 00 */ "Bus Check",
        /* 01 */ "Device Check",
        /* 02 */ "Device Wake",
@@ -459,49 +459,53 @@ static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
        /* 09 */ "Device PLD Check",
        /* 0A */ "Reserved",
        /* 0B */ "System Locality Update",
-       /* 0C */ "Shutdown Request",
+                                       /* 0C */ "Shutdown Request",
+                                       /* Reserved in ACPI 6.0 */
        /* 0D */ "System Resource Affinity Update"
 };
 
-static const char *acpi_gbl_device_notify[4] = {
+static const char *acpi_gbl_device_notify[5] = {
        /* 80 */ "Status Change",
        /* 81 */ "Information Change",
        /* 82 */ "Device-Specific Change",
-       /* 83 */ "Device-Specific Change"
+       /* 83 */ "Device-Specific Change",
+       /* 84 */ "Reserved"
 };
 
-static const char *acpi_gbl_processor_notify[4] = {
+static const char *acpi_gbl_processor_notify[5] = {
        /* 80 */ "Performance Capability Change",
        /* 81 */ "C-State Change",
        /* 82 */ "Throttling Capability Change",
-       /* 83 */ "Device-Specific Change"
+       /* 83 */ "Guaranteed Change",
+       /* 84 */ "Minimum Excursion"
 };
 
-static const char *acpi_gbl_thermal_notify[4] = {
+static const char *acpi_gbl_thermal_notify[5] = {
        /* 80 */ "Thermal Status Change",
        /* 81 */ "Thermal Trip Point Change",
        /* 82 */ "Thermal Device List Change",
-       /* 83 */ "Thermal Relationship Change"
+       /* 83 */ "Thermal Relationship Change",
+       /* 84 */ "Reserved"
 };
 
 const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
 {
 
-       /* 00 - 0D are common to all object types */
+       /* 00 - 0D are "common to all object types" (from ACPI Spec) */
 
-       if (notify_value <= ACPI_NOTIFY_MAX) {
+       if (notify_value <= ACPI_GENERIC_NOTIFY_MAX) {
                return (acpi_gbl_generic_notify[notify_value]);
        }
 
-       /* 0D - 7F are reserved */
+       /* 0E - 7F are reserved */
 
        if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
                return ("Reserved");
        }
 
-       /* 80 - 83 are per-object-type */
+       /* 80 - 84 are per-object-type */
 
-       if (notify_value <= 0x83) {
+       if (notify_value <= ACPI_SPECIFIC_NOTIFY_MAX) {
                switch (type) {
                case ACPI_TYPE_ANY:
                case ACPI_TYPE_DEVICE:
index 17b9f3e6e1e1a7d321a723a43077ab599b314c7f..7bad13f2e518a184f8fd79c7b09512af3b5a7abf 100644 (file)
@@ -69,7 +69,7 @@ ACPI_MODULE_NAME("uteval")
 
 acpi_status
 acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
-                       char *path,
+                       const char *path,
                        u32 expected_return_btypes,
                        union acpi_operand_object **return_desc)
 {
@@ -204,7 +204,7 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ut_evaluate_numeric_object(char *object_name,
+acpi_ut_evaluate_numeric_object(const char *object_name,
                                struct acpi_namespace_node *device_node,
                                u64 *value)
 {
index 48fffcfe9911547edaba7d016bf01f8baff32f9e..dd3fd7f97f8e2520fffeb17495c879e314845ed0 100644 (file)
@@ -80,6 +80,11 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
        "_S4D"
 };
 
+/* Hex-to-ascii */
+
+const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
+const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
+
 /*******************************************************************************
  *
  * Namespace globals
@@ -221,6 +226,49 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
 };
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+/* to_pld macro: compile/disassemble strings */
+
+const char *acpi_gbl_pld_panel_list[] = {
+       "TOP",
+       "BOTTOM",
+       "LEFT",
+       "RIGHT",
+       "FRONT",
+       "BACK",
+       "UNKNOWN",
+       NULL
+};
+
+const char *acpi_gbl_pld_vertical_position_list[] = {
+       "UPPER",
+       "CENTER",
+       "LOWER",
+       NULL
+};
+
+const char *acpi_gbl_pld_horizontal_position_list[] = {
+       "LEFT",
+       "CENTER",
+       "RIGHT",
+       NULL
+};
+
+const char *acpi_gbl_pld_shape_list[] = {
+       "ROUND",
+       "OVAL",
+       "SQUARE",
+       "VERTICALRECTANGLE",
+       "HORIZONTALRECTANGLE",
+       "VERTICALTRAPEZOID",
+       "HORIZONTALTRAPEZOID",
+       "UNKNOWN",
+       "CHAMFERED",
+       NULL
+};
+#endif
+
 /* Public globals */
 
 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
index 6fb4ec365272b5cf14029a6862c8a4ced4d864ab..f7cd2d52643b99a69609ad0e600d7bd4df532266 100644 (file)
@@ -95,7 +95,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
 
        hid =
            ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
-                                (acpi_size) length);
+                                (acpi_size)length);
        if (!hid) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -173,7 +173,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
 
        uid =
            ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
-                                (acpi_size) length);
+                                (acpi_size)length);
        if (!uid) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -309,7 +309,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
        /* Area for CID strings starts after the CID PNP_DEVICE_ID array */
 
        next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
-           ((acpi_size) count * sizeof(struct acpi_pnp_device_id));
+           ((acpi_size)count * sizeof(struct acpi_pnp_device_id));
 
        /* Copy/convert the CIDs to the return buffer */
 
@@ -413,7 +413,7 @@ acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
 
        cls =
            ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
-                                (acpi_size) length);
+                                (acpi_size)length);
        if (!cls) {
                status = AE_NO_MEMORY;
                goto cleanup;
index 667372093de13dcb8e94ee5e8b14c63ed54d3344..2d6530ee7e51df61f25aed5fd676f93f9c65d042 100644 (file)
@@ -236,8 +236,8 @@ acpi_ut_divide(u64 in_dividend,
                        }
 
                        remainder.full = remainder.full - dividend.full;
-                       remainder.part.hi = (u32) - ((s32) remainder.part.hi);
-                       remainder.part.lo = (u32) - ((s32) remainder.part.lo);
+                       remainder.part.hi = (u32)-((s32)remainder.part.hi);
+                       remainder.part.lo = (u32)-((s32)remainder.part.lo);
 
                        if (remainder.part.lo) {
                                remainder.part.hi--;
index d938c27cc6cf495fbeed499eafc23af80faa5ede..389de3bd1ff1fa2c27b511d1671d9b43c9a2fae0 100644 (file)
@@ -361,7 +361,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
 void
 acpi_ut_display_init_pathname(u8 type,
                              struct acpi_namespace_node *obj_handle,
-                             char *path)
+                             const char *path)
 {
        acpi_status status;
        struct acpi_buffer buffer;
index d5c3adf19bd0595ea6f1e1ea356d7d081986246f..3465fe2c5a5c5f04a723c268c482d4dfe65a37a9 100644 (file)
@@ -205,37 +205,41 @@ acpi_ut_safe_strncat(char *dest,
  *
  * FUNCTION:    acpi_ut_strtoul64
  *
- * PARAMETERS:  string          - Null terminated string
- *              base            - Radix of the string: 16 or ACPI_ANY_BASE;
- *                                ACPI_ANY_BASE means 'in behalf of to_integer'
- *              ret_integer     - Where the converted integer is returned
+ * PARAMETERS:  string                  - Null terminated string
+ *              base                    - Radix of the string: 16 or 10 or
+ *                                        ACPI_ANY_BASE
+ *              max_integer_byte_width  - Maximum allowable integer,in bytes:
+ *                                        4 or 8 (32 or 64 bits)
+ *              ret_integer             - Where the converted integer is
+ *                                        returned
  *
  * RETURN:      Status and Converted value
  *
  * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- *              32-bit or 64-bit conversion, depending on the current mode
- *              of the interpreter.
+ *              32-bit or 64-bit conversion, depending on the input integer
+ *              size (often the current mode of the interpreter).
  *
- * NOTES:       acpi_gbl_integer_byte_width should be set to the proper width.
+ * NOTES:       Negative numbers are not supported, as they are not supported
+ *              by ACPI.
+ *
+ *              acpi_gbl_integer_byte_width should be set to the proper width.
  *              For the core ACPICA code, this width depends on the DSDT
- *              version. For iASL, the default byte width is always 8.
+ *              version. For iASL, the default byte width is always 8 for the
+ *              parser, but error checking is performed later to flag cases
+ *              where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
  *
  *              Does not support Octal strings, not needed at this time.
  *
- *              There is an earlier version of the function after this one,
- *              below. It is slightly different than this one, and the two
- *              may eventually may need to be merged. (01/2016).
- *
  ******************************************************************************/
 
-acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
+acpi_status
+acpi_ut_strtoul64(char *string,
+                 u32 base, u32 max_integer_byte_width, u64 *ret_integer)
 {
        u32 this_digit = 0;
        u64 return_value = 0;
        u64 quotient;
        u64 dividend;
-       u32 to_integer_op = (base == ACPI_ANY_BASE);
-       u32 mode32 = (acpi_gbl_integer_byte_width == 4);
        u8 valid_digits = 0;
        u8 sign_of0x = 0;
        u8 term = 0;
@@ -244,6 +248,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
        switch (base) {
        case ACPI_ANY_BASE:
+       case 10:
        case 16:
 
                break;
@@ -265,9 +270,9 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
                string++;
        }
 
-       if (to_integer_op) {
+       if (base == ACPI_ANY_BASE) {
                /*
-                * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+                * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
                 * We need to determine if it is decimal or hexadecimal.
                 */
                if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
@@ -284,7 +289,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
        /* Any string left? Check that '0x' is not followed by white space. */
 
        if (!(*string) || isspace((int)*string) || *string == '\t') {
-               if (to_integer_op) {
+               if (base == ACPI_ANY_BASE) {
                        goto error_exit;
                } else {
                        goto all_done;
@@ -292,10 +297,11 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
        }
 
        /*
-        * Perform a 32-bit or 64-bit conversion, depending upon the current
-        * execution mode of the interpreter
+        * Perform a 32-bit or 64-bit conversion, depending upon the input
+        * byte width
         */
-       dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+       dividend = (max_integer_byte_width <= ACPI_MAX32_BYTE_WIDTH) ?
+           ACPI_UINT32_MAX : ACPI_UINT64_MAX;
 
        /* Main loop: convert the string to a 32- or 64-bit integer */
 
@@ -323,7 +329,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
                }
 
                if (term) {
-                       if (to_integer_op) {
+                       if (base == ACPI_ANY_BASE) {
                                goto error_exit;
                        } else {
                                break;
@@ -338,12 +344,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
                valid_digits++;
 
-               if (sign_of0x
-                   && ((valid_digits > 16)
-                       || ((valid_digits > 8) && mode32))) {
+               if (sign_of0x && ((valid_digits > 16) ||
+                                 ((valid_digits > 8)
+                                  && (max_integer_byte_width <=
+                                      ACPI_MAX32_BYTE_WIDTH)))) {
                        /*
                         * This is to_integer operation case.
-                        * No any restrictions for string-to-integer conversion,
+                        * No restrictions for string-to-integer conversion,
                         * see ACPI spec.
                         */
                        goto error_exit;
@@ -355,7 +362,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
                                           &quotient, NULL);
 
                if (return_value > quotient) {
-                       if (to_integer_op) {
+                       if (base == ACPI_ANY_BASE) {
                                goto error_exit;
                        } else {
                                break;
@@ -378,7 +385,8 @@ all_done:
        return_ACPI_STATUS(AE_OK);
 
 error_exit:
-       /* Base was set/validated above */
+
+       /* Base was set/validated above (10 or 16) */
 
        if (base == 10) {
                return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
@@ -388,8 +396,7 @@ error_exit:
 }
 
 #ifdef _OBSOLETE_FUNCTIONS
-/* TBD: use version in ACPICA main code base? */
-/* DONE: 01/2016 */
+/* Removed: 01/2016 */
 
 /*******************************************************************************
  *
index edad3f043ab9be111041a3beb97ee21431acd301..72b9a062bbabff22eb52ace5918d648f10d848f1 100644 (file)
@@ -51,11 +51,11 @@ ACPI_MODULE_NAME("utobject")
 /* Local prototypes */
 static acpi_status
 acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
-                              acpi_size * obj_length);
+                              acpi_size *obj_length);
 
 static acpi_status
 acpi_ut_get_package_object_size(union acpi_operand_object *obj,
-                               acpi_size * obj_length);
+                               acpi_size *obj_length);
 
 static acpi_status
 acpi_ut_get_element_length(u8 object_type,
@@ -177,7 +177,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
         * Create the element array. Count+1 allows the array to be null
         * terminated.
         */
-       package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count +
+       package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size)count +
                                                 1) * sizeof(void *));
        if (!package_elements) {
                ACPI_FREE(package_desc);
@@ -454,7 +454,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
 
 static acpi_status
 acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
-                              acpi_size * obj_length)
+                              acpi_size *obj_length)
 {
        acpi_size length;
        acpi_size size;
@@ -495,12 +495,12 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
        switch (internal_object->common.type) {
        case ACPI_TYPE_STRING:
 
-               length += (acpi_size) internal_object->string.length + 1;
+               length += (acpi_size)internal_object->string.length + 1;
                break;
 
        case ACPI_TYPE_BUFFER:
 
-               length += (acpi_size) internal_object->buffer.length;
+               length += (acpi_size)internal_object->buffer.length;
                break;
 
        case ACPI_TYPE_INTEGER:
@@ -640,7 +640,7 @@ acpi_ut_get_element_length(u8 object_type,
 
 static acpi_status
 acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
-                               acpi_size * obj_length)
+                               acpi_size *obj_length)
 {
        acpi_status status;
        struct acpi_pkg_info info;
@@ -665,7 +665,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
         */
        info.length +=
            ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
-           (acpi_size) info.num_packages;
+           (acpi_size)info.num_packages;
 
        /* Return the total package length */
 
@@ -689,7 +689,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
 
 acpi_status
 acpi_ut_get_object_size(union acpi_operand_object *internal_object,
-                       acpi_size * obj_length)
+                       acpi_size *obj_length)
 {
        acpi_status status;
 
index b5cfe577fabf769ec5de134c67b3e5ac6c20d132..3f5fed670271cc4804d69427e0209ab2f4f8d10a 100644 (file)
@@ -150,7 +150,7 @@ acpi_status acpi_ut_initialize_interfaces(void)
             i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1);
             i++) {
                acpi_default_supported_interfaces[i].next =
-                   &acpi_default_supported_interfaces[(acpi_size) i + 1];
+                   &acpi_default_supported_interfaces[(acpi_size)i + 1];
        }
 
        acpi_os_release_mutex(acpi_gbl_osi_mutex);
@@ -397,7 +397,7 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
  *
  ******************************************************************************/
 
-acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state)
+acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
 {
        union acpi_operand_object *string_desc;
        union acpi_operand_object *return_desc;
index 813520ab8ca48ad7824ae67e8ee75e16c7f5b0e6..3cd573c5f7f9249e075a561170f1223b0b3534b2 100644 (file)
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utownerid")
  *              when the method exits or the table is unloaded.
  *
  ******************************************************************************/
-acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
+acpi_status acpi_ut_allocate_owner_id(acpi_owner_id *owner_id)
 {
        u32 i;
        u32 j;
@@ -122,7 +122,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
                                 * permanently allocated (prevents +1 overflow)
                                 */
                                *owner_id =
-                                   (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
+                                   (acpi_owner_id)((k + 1) + ACPI_MUL_32(j));
 
                                ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
                                                  "Allocated OwnerId: %2.2X\n",
@@ -167,7 +167,7 @@ exit:
  *
  ******************************************************************************/
 
-void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
+void acpi_ut_release_owner_id(acpi_owner_id *owner_id_ptr)
 {
        acpi_owner_id owner_id = *owner_id_ptr;
        acpi_status status;
index 8c218ad787cdf57daa6fc2711cdfb7568ace70da..dd084cf52502037b5f4eebf2f1b6b0fe38fcb859 100644 (file)
@@ -67,11 +67,6 @@ static char *acpi_ut_format_number(char *string,
 
 static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper);
 
-/* Module globals */
-
-static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
-static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_bound_string_length
@@ -269,9 +264,9 @@ static char *acpi_ut_format_number(char *string,
 
        sign = '\0';
        if (type & ACPI_FORMAT_SIGN) {
-               if ((s64) number < 0) {
+               if ((s64)number < 0) {
                        sign = '-';
-                       number = -(s64) number;
+                       number = -(s64)number;
                        width--;
                } else if (type & ACPI_FORMAT_SIGN_PLUS) {
                        sign = '+';
@@ -409,7 +404,7 @@ acpi_ut_vsnprintf(char *string,
                width = -1;
                if (isdigit((int)*format)) {
                        format = acpi_ut_scan_number(format, &number);
-                       width = (s32) number;
+                       width = (s32)number;
                } else if (*format == '*') {
                        ++format;
                        width = va_arg(args, int);
@@ -426,7 +421,7 @@ acpi_ut_vsnprintf(char *string,
                        ++format;
                        if (isdigit((int)*format)) {
                                format = acpi_ut_scan_number(format, &number);
-                               precision = (s32) number;
+                               precision = (s32)number;
                        } else if (*format == '*') {
                                ++format;
                                precision = va_arg(args, int);
@@ -555,17 +550,17 @@ acpi_ut_vsnprintf(char *string,
                if (qualifier == 'L') {
                        number = va_arg(args, u64);
                        if (type & ACPI_FORMAT_SIGN) {
-                               number = (s64) number;
+                               number = (s64)number;
                        }
                } else if (qualifier == 'l') {
                        number = va_arg(args, unsigned long);
                        if (type & ACPI_FORMAT_SIGN) {
-                               number = (s32) number;
+                               number = (s32)number;
                        }
                } else if (qualifier == 'h') {
                        number = (u16)va_arg(args, int);
                        if (type & ACPI_FORMAT_SIGN) {
-                               number = (s16) number;
+                               number = (s16)number;
                        }
                } else {
                        number = va_arg(args, unsigned int);
index 0b005728db4e63d17d8d1dcabbb226fee3df9b60..288913a0e709791ded0e6752eade316738e42ba0 100644 (file)
@@ -130,7 +130,7 @@ void acpi_ut_print_string(char *string, u16 max_length)
                        } else {
                                /* All others will be Hex escapes */
 
-                               acpi_os_printf("\\x%2.2X", (s32) string[i]);
+                               acpi_os_printf("\\x%2.2X", (s32)string[i]);
                        }
                        break;
                }
@@ -143,73 +143,6 @@ void acpi_ut_print_string(char *string, u16 max_length)
        }
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_valid_acpi_char
- *
- * PARAMETERS:  char            - The character to be examined
- *              position        - Byte position (0-3)
- *
- * RETURN:      TRUE if the character is valid, FALSE otherwise
- *
- * DESCRIPTION: Check for a valid ACPI character. Must be one of:
- *              1) Upper case alpha
- *              2) numeric
- *              3) underscore
- *
- *              We allow a '!' as the last character because of the ASF! table
- *
- ******************************************************************************/
-
-u8 acpi_ut_valid_acpi_char(char character, u32 position)
-{
-
-       if (!((character >= 'A' && character <= 'Z') ||
-             (character >= '0' && character <= '9') || (character == '_'))) {
-
-               /* Allow a '!' in the last position */
-
-               if (character == '!' && position == 3) {
-                       return (TRUE);
-               }
-
-               return (FALSE);
-       }
-
-       return (TRUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_valid_acpi_name
- *
- * PARAMETERS:  name            - The name to be examined. Does not have to
- *                                be NULL terminated string.
- *
- * RETURN:      TRUE if the name is valid, FALSE otherwise
- *
- * DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
- *              1) Upper case alpha
- *              2) numeric
- *              3) underscore
- *
- ******************************************************************************/
-
-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(name[i], i)) {
-                       return (FALSE);
-               }
-       }
-
-       return (TRUE);
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_repair_name
@@ -253,7 +186,7 @@ void acpi_ut_repair_name(char *name)
        /* Check each character in the name */
 
        for (i = 0; i < ACPI_NAME_SIZE; i++) {
-               if (acpi_ut_valid_acpi_char(name[i], i)) {
+               if (acpi_ut_valid_name_char(name[i], i)) {
                        continue;
                }
 
index 60c406a8efcb3b533b6d2fd1f1f5c9f75f13831e..0df07dfa53b6acccdce504f8b69de283f61677dc 100644 (file)
@@ -90,7 +90,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
  ******************************************************************************/
 
 acpi_status
-acpi_ut_create_list(char *list_name,
+acpi_ut_create_list(const char *list_name,
                    u16 object_size, struct acpi_memory_list **return_cache)
 {
        struct acpi_memory_list *cache;
index 68d4673f62e6be956da84cbc736296aaa39e4b88..d9e6aac7dc8399f1f9d0f9dd2514561c72bb932b 100644 (file)
@@ -127,7 +127,7 @@ ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
  *              and the value of out_buffer is undefined.
  *
  ******************************************************************************/
-acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
+acpi_status acpi_get_system_info(struct acpi_buffer *out_buffer)
 {
        struct acpi_system_info *info_ptr;
        acpi_status status;
@@ -483,7 +483,7 @@ ACPI_EXPORT_SYMBOL(acpi_check_address_range)
  ******************************************************************************/
 acpi_status
 acpi_decode_pld_buffer(u8 *in_buffer,
-                      acpi_size length, struct acpi_pld_info ** return_buffer)
+                      acpi_size length, struct acpi_pld_info **return_buffer)
 {
        struct acpi_pld_info *pld_info;
        u32 *buffer = ACPI_CAST_PTR(u32, in_buffer);
index c068c829b4537da3c3d8427dd58713a4cfdb9e5b..31e8da648fffb9b6db10cda340bcc394f3a95994 100644 (file)
@@ -925,11 +925,13 @@ void __init acpi_early_init(void)
                goto error0;
        }
 
-       status = acpi_load_tables();
-       if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX
-                      "Unable to load the System Description Tables\n");
-               goto error0;
+       if (acpi_gbl_group_module_level_code) {
+               status = acpi_load_tables();
+               if (ACPI_FAILURE(status)) {
+                       printk(KERN_ERR PREFIX
+                              "Unable to load the System Description Tables\n");
+                       goto error0;
+               }
        }
 
 #ifdef CONFIG_X86
@@ -995,17 +997,10 @@ static int __init acpi_bus_init(void)
 
        acpi_os_initialize1();
 
-       status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
-       if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX
-                      "Unable to start the ACPI Interpreter\n");
-               goto error1;
-       }
-
        /*
         * ACPI 2.0 requires the EC driver to be loaded and work before
-        * the EC device is found in the namespace (i.e. before acpi_initialize_objects()
-        * is called).
+        * the EC device is found in the namespace (i.e. before
+        * acpi_load_tables() is called).
         *
         * This is accomplished by looking for the ECDT table, and getting
         * the EC parameters out of that.
@@ -1013,6 +1008,22 @@ static int __init acpi_bus_init(void)
        status = acpi_ec_ecdt_probe();
        /* Ignore result. Not having an ECDT is not fatal. */
 
+       if (!acpi_gbl_group_module_level_code) {
+               status = acpi_load_tables();
+               if (ACPI_FAILURE(status)) {
+                       printk(KERN_ERR PREFIX
+                              "Unable to load the System Description Tables\n");
+                       goto error1;
+               }
+       }
+
+       status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE);
+       if (ACPI_FAILURE(status)) {
+               printk(KERN_ERR PREFIX
+                      "Unable to start the ACPI Interpreter\n");
+               goto error1;
+       }
+
        status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
        if (ACPI_FAILURE(status)) {
                printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
index b420fb46669dd698c4d346559c325c0f4afeaf4d..0e70181f150c9eae5e00b8f9a24a41382ee41bbc 100644 (file)
@@ -105,8 +105,8 @@ enum ec_command {
 enum {
        EC_FLAGS_QUERY_PENDING,         /* Query is pending */
        EC_FLAGS_QUERY_GUARDING,        /* Guard for SCI_EVT check */
-       EC_FLAGS_HANDLERS_INSTALLED,    /* Handlers for GPE and
-                                        * OpReg are installed */
+       EC_FLAGS_GPE_HANDLER_INSTALLED, /* GPE handler installed */
+       EC_FLAGS_EC_HANDLER_INSTALLED,  /* OpReg handler installed */
        EC_FLAGS_STARTED,               /* Driver is started */
        EC_FLAGS_STOPPED,               /* Driver is stopped */
        EC_FLAGS_COMMAND_STORM,         /* GPE storms occurred to the
@@ -175,10 +175,9 @@ static void acpi_ec_event_processor(struct work_struct *work);
 struct acpi_ec *boot_ec, *first_ec;
 EXPORT_SYMBOL(first_ec);
 
-static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */
-static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
 static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */
 static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */
+static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */
 
 /* --------------------------------------------------------------------------
  *                           Logging/Debugging
@@ -367,7 +366,8 @@ static inline void acpi_ec_clear_gpe(struct acpi_ec *ec)
 static void acpi_ec_submit_request(struct acpi_ec *ec)
 {
        ec->reference_count++;
-       if (ec->reference_count == 1)
+       if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags) &&
+           ec->reference_count == 1)
                acpi_ec_enable_gpe(ec, true);
 }
 
@@ -376,7 +376,8 @@ static void acpi_ec_complete_request(struct acpi_ec *ec)
        bool flushed = false;
 
        ec->reference_count--;
-       if (ec->reference_count == 0)
+       if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags) &&
+           ec->reference_count == 0)
                acpi_ec_disable_gpe(ec, true);
        flushed = acpi_ec_flushed(ec);
        if (flushed)
@@ -1287,52 +1288,64 @@ static int ec_install_handlers(struct acpi_ec *ec)
 {
        acpi_status status;
 
-       if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
-               return 0;
-       status = acpi_install_gpe_raw_handler(NULL, ec->gpe,
-                                 ACPI_GPE_EDGE_TRIGGERED,
-                                 &acpi_ec_gpe_handler, ec);
-       if (ACPI_FAILURE(status))
-               return -ENODEV;
-
        acpi_ec_start(ec, false);
-       status = acpi_install_address_space_handler(ec->handle,
-                                                   ACPI_ADR_SPACE_EC,
-                                                   &acpi_ec_space_handler,
-                                                   NULL, ec);
-       if (ACPI_FAILURE(status)) {
-               if (status == AE_NOT_FOUND) {
-                       /*
-                        * Maybe OS fails in evaluating the _REG object.
-                        * The AE_NOT_FOUND error will be ignored and OS
-                        * continue to initialize EC.
-                        */
-                       pr_err("Fail in evaluating the _REG object"
-                               " of EC device. Broken bios is suspected.\n");
-               } else {
-                       acpi_ec_stop(ec, false);
-                       acpi_remove_gpe_handler(NULL, ec->gpe,
-                               &acpi_ec_gpe_handler);
-                       return -ENODEV;
+
+       if (!test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
+               status = acpi_install_address_space_handler(ec->handle,
+                                                           ACPI_ADR_SPACE_EC,
+                                                           &acpi_ec_space_handler,
+                                                           NULL, ec);
+               if (ACPI_FAILURE(status)) {
+                       if (status == AE_NOT_FOUND) {
+                               /*
+                                * Maybe OS fails in evaluating the _REG
+                                * object. The AE_NOT_FOUND error will be
+                                * ignored and OS * continue to initialize
+                                * EC.
+                                */
+                               pr_err("Fail in evaluating the _REG object"
+                                       " of EC device. Broken bios is suspected.\n");
+                       } else {
+                               acpi_ec_stop(ec, false);
+                               return -ENODEV;
+                       }
+               }
+               set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
+       }
+
+       if (!test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
+               status = acpi_install_gpe_raw_handler(NULL, ec->gpe,
+                                         ACPI_GPE_EDGE_TRIGGERED,
+                                         &acpi_ec_gpe_handler, ec);
+               /* This is not fatal as we can poll EC events */
+               if (ACPI_SUCCESS(status)) {
+                       set_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags);
+                       if (test_bit(EC_FLAGS_STARTED, &ec->flags) &&
+                           ec->reference_count >= 1)
+                               acpi_ec_enable_gpe(ec, true);
                }
        }
 
-       set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
        return 0;
 }
 
 static void ec_remove_handlers(struct acpi_ec *ec)
 {
-       if (!test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
-               return;
        acpi_ec_stop(ec, false);
-       if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
-                               ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
-               pr_err("failed to remove space handler\n");
-       if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
-                               &acpi_ec_gpe_handler)))
-               pr_err("failed to remove gpe handler\n");
-       clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
+
+       if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
+               if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
+                                       ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
+                       pr_err("failed to remove space handler\n");
+               clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
+       }
+
+       if (test_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags)) {
+               if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
+                                       &acpi_ec_gpe_handler)))
+                       pr_err("failed to remove gpe handler\n");
+               clear_bit(EC_FLAGS_GPE_HANDLER_INSTALLED, &ec->flags);
+       }
 }
 
 static int acpi_ec_add(struct acpi_device *device)
@@ -1344,11 +1357,12 @@ static int acpi_ec_add(struct acpi_device *device)
        strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 
        /* Check for boot EC */
-       if (boot_ec &&
-           (boot_ec->handle == device->handle ||
-            boot_ec->handle == ACPI_ROOT_OBJECT)) {
+       if (boot_ec) {
                ec = boot_ec;
                boot_ec = NULL;
+               ec_remove_handlers(ec);
+               if (first_ec == ec)
+                       first_ec = NULL;
        } else {
                ec = make_acpi_ec();
                if (!ec)
@@ -1434,7 +1448,7 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
 
 int __init acpi_boot_ec_enable(void)
 {
-       if (!boot_ec || test_bit(EC_FLAGS_HANDLERS_INSTALLED, &boot_ec->flags))
+       if (!boot_ec)
                return 0;
        if (!ec_install_handlers(boot_ec)) {
                first_ec = boot_ec;
@@ -1448,20 +1462,6 @@ static const struct acpi_device_id ec_device_ids[] = {
        {"", 0},
 };
 
-/* Some BIOS do not survive early DSDT scan, skip it */
-static int ec_skip_dsdt_scan(const struct dmi_system_id *id)
-{
-       EC_FLAGS_SKIP_DSDT_SCAN = 1;
-       return 0;
-}
-
-/* ASUStek often supplies us with broken ECDT, validate it */
-static int ec_validate_ecdt(const struct dmi_system_id *id)
-{
-       EC_FLAGS_VALIDATE_ECDT = 1;
-       return 0;
-}
-
 #if 0
 /*
  * Some EC firmware variations refuses to respond QR_EC when SCI_EVT is not
@@ -1503,30 +1503,29 @@ static int ec_clear_on_resume(const struct dmi_system_id *id)
        return 0;
 }
 
+static int ec_correct_ecdt(const struct dmi_system_id *id)
+{
+       pr_debug("Detected system needing ECDT address correction.\n");
+       EC_FLAGS_CORRECT_ECDT = 1;
+       return 0;
+}
+
 static struct dmi_system_id ec_dmi_table[] __initdata = {
        {
-       ec_skip_dsdt_scan, "Compal JFL92", {
-       DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"),
-       DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL},
+       ec_correct_ecdt, "Asus L4R", {
+       DMI_MATCH(DMI_BIOS_VERSION, "1008.006"),
+       DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),
+       DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL},
        {
-       ec_validate_ecdt, "MSI MS-171F", {
+       ec_correct_ecdt, "Asus M6R", {
+       DMI_MATCH(DMI_BIOS_VERSION, "0207"),
+       DMI_MATCH(DMI_PRODUCT_NAME, "M6R"),
+       DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL},
+       {
+       ec_correct_ecdt, "MSI MS-171F", {
        DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star"),
        DMI_MATCH(DMI_PRODUCT_NAME, "MS-171F"),}, NULL},
        {
-       ec_validate_ecdt, "ASUS hardware", {
-       DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
-       {
-       ec_validate_ecdt, "ASUS hardware", {
-       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL},
-       {
-       ec_skip_dsdt_scan, "HP Folio 13", {
-       DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
-       DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13"),}, NULL},
-       {
-       ec_validate_ecdt, "ASUS hardware", {
-       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek Computer Inc."),
-       DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),}, NULL},
-       {
        ec_clear_on_resume, "Samsung hardware", {
        DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL},
        {},
@@ -1534,8 +1533,8 @@ static struct dmi_system_id ec_dmi_table[] __initdata = {
 
 int __init acpi_ec_ecdt_probe(void)
 {
+       int ret = 0;
        acpi_status status;
-       struct acpi_ec *saved_ec = NULL;
        struct acpi_table_ecdt *ecdt_ptr;
 
        boot_ec = make_acpi_ec();
@@ -1547,67 +1546,45 @@ int __init acpi_ec_ecdt_probe(void)
        dmi_check_system(ec_dmi_table);
        status = acpi_get_table(ACPI_SIG_ECDT, 1,
                                (struct acpi_table_header **)&ecdt_ptr);
-       if (ACPI_SUCCESS(status)) {
-               pr_info("EC description table is found, configuring boot EC\n");
-               boot_ec->command_addr = ecdt_ptr->control.address;
-               boot_ec->data_addr = ecdt_ptr->data.address;
-               boot_ec->gpe = ecdt_ptr->gpe;
-               boot_ec->handle = ACPI_ROOT_OBJECT;
-               acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id,
-                               &boot_ec->handle);
-               /* Don't trust ECDT, which comes from ASUSTek */
-               if (!EC_FLAGS_VALIDATE_ECDT)
-                       goto install;
-               saved_ec = kmemdup(boot_ec, sizeof(struct acpi_ec), GFP_KERNEL);
-               if (!saved_ec)
-                       return -ENOMEM;
-       /* fall through */
+       if (ACPI_FAILURE(status)) {
+               ret = -ENODEV;
+               goto error;
        }
 
-       if (EC_FLAGS_SKIP_DSDT_SCAN) {
-               kfree(saved_ec);
-               return -ENODEV;
+       if (!ecdt_ptr->control.address || !ecdt_ptr->data.address) {
+               /*
+                * Asus X50GL:
+                * https://bugzilla.kernel.org/show_bug.cgi?id=11880
+                */
+               ret = -ENODEV;
+               goto error;
        }
 
-       /* This workaround is needed only on some broken machines,
-        * which require early EC, but fail to provide ECDT */
-       pr_debug("Look up EC in DSDT\n");
-       status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
-                                       boot_ec, NULL);
-       /* Check that acpi_get_devices actually find something */
-       if (ACPI_FAILURE(status) || !boot_ec->handle)
-               goto error;
-       if (saved_ec) {
-               /* try to find good ECDT from ASUSTek */
-               if (saved_ec->command_addr != boot_ec->command_addr ||
-                   saved_ec->data_addr != boot_ec->data_addr ||
-                   saved_ec->gpe != boot_ec->gpe ||
-                   saved_ec->handle != boot_ec->handle)
-                       pr_info("ASUSTek keeps feeding us with broken "
-                       "ECDT tables, which are very hard to workaround. "
-                       "Trying to use DSDT EC info instead. Please send "
-                       "output of acpidump to linux-acpi@vger.kernel.org\n");
-               kfree(saved_ec);
-               saved_ec = NULL;
+       pr_info("EC description table is found, configuring boot EC\n");
+       if (EC_FLAGS_CORRECT_ECDT) {
+               /*
+                * Asus L4R, Asus M6R
+                * https://bugzilla.kernel.org/show_bug.cgi?id=9399
+                * MSI MS-171F
+                * https://bugzilla.kernel.org/show_bug.cgi?id=12461
+                */
+               boot_ec->command_addr = ecdt_ptr->data.address;
+               boot_ec->data_addr = ecdt_ptr->control.address;
        } else {
-               /* We really need to limit this workaround, the only ASUS,
-               * which needs it, has fake EC._INI method, so use it as flag.
-               * Keep boot_ec struct as it will be needed soon.
-               */
-               if (!dmi_name_in_vendors("ASUS") ||
-                   !acpi_has_method(boot_ec->handle, "_INI"))
-                       return -ENODEV;
+               boot_ec->command_addr = ecdt_ptr->control.address;
+               boot_ec->data_addr = ecdt_ptr->data.address;
        }
-install:
-       if (!ec_install_handlers(boot_ec)) {
+       boot_ec->gpe = ecdt_ptr->gpe;
+       boot_ec->handle = ACPI_ROOT_OBJECT;
+       ret = ec_install_handlers(boot_ec);
+       if (!ret)
                first_ec = boot_ec;
-               return 0;
-       }
 error:
-       kfree(boot_ec);
-       kfree(saved_ec);
-       boot_ec = NULL;
-       return -ENODEV;
+       if (ret) {
+               kfree(boot_ec);
+               boot_ec = NULL;
+       }
+       return ret;
 }
 
 static int param_set_event_clearing(const char *val, struct kernel_param *kp)
diff --git a/drivers/acpi/evged.c b/drivers/acpi/evged.c
new file mode 100644 (file)
index 0000000..46f0603
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Generic Event Device for ACPI.
+ *
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Generic Event Device allows platforms to handle interrupts in ACPI
+ * ASL statements. It follows very similar to  _EVT method approach
+ * from GPIO events. All interrupts are listed in _CRS and the handler
+ * is written in _EVT method. Here is an example.
+ *
+ * Device (GED0)
+ * {
+ *
+ *     Name (_HID, "ACPI0013")
+ *     Name (_UID, 0)
+ *     Method (_CRS, 0x0, Serialized)
+ *     {
+ *             Name (RBUF, ResourceTemplate ()
+ *             {
+ *             Interrupt(ResourceConsumer, Edge, ActiveHigh, Shared, , , )
+ *             {123}
+ *             }
+ *     })
+ *
+ *     Method (_EVT, 1) {
+ *             if (Lequal(123, Arg0))
+ *             {
+ *             }
+ *     }
+ * }
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/platform_device.h>
+#include <linux/acpi.h>
+
+#define MODULE_NAME    "acpi-ged"
+
+struct acpi_ged_event {
+       struct list_head node;
+       struct device *dev;
+       unsigned int gsi;
+       unsigned int irq;
+       acpi_handle handle;
+};
+
+static irqreturn_t acpi_ged_irq_handler(int irq, void *data)
+{
+       struct acpi_ged_event *event = data;
+       acpi_status acpi_ret;
+
+       acpi_ret = acpi_execute_simple_method(event->handle, NULL, event->gsi);
+       if (ACPI_FAILURE(acpi_ret))
+               dev_err_once(event->dev, "IRQ method execution failed\n");
+
+       return IRQ_HANDLED;
+}
+
+static acpi_status acpi_ged_request_interrupt(struct acpi_resource *ares,
+                                             void *context)
+{
+       struct acpi_ged_event *event;
+       unsigned int irq;
+       unsigned int gsi;
+       unsigned int irqflags = IRQF_ONESHOT;
+       struct device *dev = context;
+       acpi_handle handle = ACPI_HANDLE(dev);
+       acpi_handle evt_handle;
+       struct resource r;
+       struct acpi_resource_irq *p = &ares->data.irq;
+       struct acpi_resource_extended_irq *pext = &ares->data.extended_irq;
+
+       if (ares->type == ACPI_RESOURCE_TYPE_END_TAG)
+               return AE_OK;
+
+       if (!acpi_dev_resource_interrupt(ares, 0, &r)) {
+               dev_err(dev, "unable to parse IRQ resource\n");
+               return AE_ERROR;
+       }
+       if (ares->type == ACPI_RESOURCE_TYPE_IRQ)
+               gsi = p->interrupts[0];
+       else
+               gsi = pext->interrupts[0];
+
+       irq = r.start;
+
+       if (ACPI_FAILURE(acpi_get_handle(handle, "_EVT", &evt_handle))) {
+               dev_err(dev, "cannot locate _EVT method\n");
+               return AE_ERROR;
+       }
+
+       dev_info(dev, "GED listening GSI %u @ IRQ %u\n", gsi, irq);
+
+       event = devm_kzalloc(dev, sizeof(*event), GFP_KERNEL);
+       if (!event)
+               return AE_ERROR;
+
+       event->gsi = gsi;
+       event->dev = dev;
+       event->irq = irq;
+       event->handle = evt_handle;
+
+       if (r.flags & IORESOURCE_IRQ_SHAREABLE)
+               irqflags |= IRQF_SHARED;
+
+       if (devm_request_threaded_irq(dev, irq, NULL, acpi_ged_irq_handler,
+                                     irqflags, "ACPI:Ged", event)) {
+               dev_err(dev, "failed to setup event handler for irq %u\n", irq);
+               return AE_ERROR;
+       }
+
+       return AE_OK;
+}
+
+static int ged_probe(struct platform_device *pdev)
+{
+       acpi_status acpi_ret;
+
+       acpi_ret = acpi_walk_resources(ACPI_HANDLE(&pdev->dev), "_CRS",
+                                      acpi_ged_request_interrupt, &pdev->dev);
+       if (ACPI_FAILURE(acpi_ret)) {
+               dev_err(&pdev->dev, "unable to parse the _CRS record\n");
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+static const struct acpi_device_id ged_acpi_ids[] = {
+       {"ACPI0013"},
+       {},
+};
+
+static struct platform_driver ged_driver = {
+       .probe = ged_probe,
+       .driver = {
+               .name = MODULE_NAME,
+               .acpi_match_table = ACPI_PTR(ged_acpi_ids),
+       },
+};
+builtin_platform_driver(ged_driver);
index a8780a2e1975e077aa1c72431bb6ff671f18b45c..9bb0773d39bfd14f87f0e8dbfe5a1ed31b54162d 100644 (file)
@@ -22,7 +22,6 @@
 
 int early_acpi_osi_init(void);
 int acpi_osi_init(void);
-void acpi_initrd_initialize_tables(void);
 acpi_status acpi_os_initialize1(void);
 void init_acpi_device_notify(void);
 int acpi_scan_init(void);
index d0f35e63640ba78b956dd6ed3b870a542fedaac5..63cc9dbe4f3b4d1db7037fb4ca1df532b8dc5534 100644 (file)
@@ -287,8 +287,11 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
                                        offset);
                        rc = -ENXIO;
                }
-       } else
+       } else {
                rc = 0;
+               if (cmd_rc)
+                       *cmd_rc = xlat_status(buf, cmd);
+       }
 
  out:
        ACPI_FREE(out_obj);
index 72b6e9ef0ae9bedbf72ea0a3438f1f4395308136..d176e0ece47041c851f287563f31d4a8fbae6288 100644 (file)
@@ -327,10 +327,18 @@ int __init acpi_numa_init(void)
 
        /* SRAT: Static Resource Affinity Table */
        if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
-               acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY,
-                                    acpi_parse_x2apic_affinity, 0);
-               acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
-                                    acpi_parse_processor_affinity, 0);
+               struct acpi_subtable_proc srat_proc[2];
+
+               memset(srat_proc, 0, sizeof(srat_proc));
+               srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY;
+               srat_proc[0].handler = acpi_parse_processor_affinity;
+               srat_proc[1].id = ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY;
+               srat_proc[1].handler = acpi_parse_x2apic_affinity;
+
+               acpi_table_parse_entries_array(ACPI_SIG_SRAT,
+                                       sizeof(struct acpi_table_srat),
+                                       srat_proc, ARRAY_SIZE(srat_proc), 0);
+
                cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY,
                                            acpi_parse_memory_affinity,
                                            NR_NODE_MEMBLKS);
index 29af6b40c93ff1f68222f08db19c76a691bb7dbe..b108f1358a32b54931cbf9640410851ab7f736c1 100644 (file)
@@ -56,10 +56,6 @@ struct acpi_os_dpc {
        struct work_struct work;
 };
 
-#ifdef CONFIG_ACPI_CUSTOM_DSDT
-#include CONFIG_ACPI_CUSTOM_DSDT_FILE
-#endif
-
 #ifdef ENABLE_DEBUGGER
 #include <linux/kdb.h>
 
@@ -516,7 +512,7 @@ static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
 
 acpi_status
 acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
-                           char **new_val)
+                           acpi_string *new_val)
 {
        if (!init_val || !new_val)
                return AE_BAD_PARAMETER;
@@ -536,280 +532,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
        return AE_OK;
 }
 
-static void acpi_table_taint(struct acpi_table_header *table)
-{
-       pr_warn(PREFIX
-               "Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n",
-               table->signature, table->oem_table_id);
-       add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
-}
-
-#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
-#include <linux/earlycpio.h>
-#include <linux/memblock.h>
-
-static u64 acpi_tables_addr;
-static int all_tables_size;
-
-/* Copied from acpica/tbutils.c:acpi_tb_checksum() */
-static u8 __init acpi_table_checksum(u8 *buffer, u32 length)
-{
-       u8 sum = 0;
-       u8 *end = buffer + length;
-
-       while (buffer < end)
-               sum = (u8) (sum + *(buffer++));
-       return sum;
-}
-
-/* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */
-static const char * const table_sigs[] = {
-       ACPI_SIG_BERT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, ACPI_SIG_EINJ,
-       ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, ACPI_SIG_MSCT,
-       ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT, ACPI_SIG_ASF,
-       ACPI_SIG_BOOT, ACPI_SIG_DBGP, ACPI_SIG_DMAR, ACPI_SIG_HPET,
-       ACPI_SIG_IBFT, ACPI_SIG_IVRS, ACPI_SIG_MCFG, ACPI_SIG_MCHI,
-       ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA,
-       ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT,
-       ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT,
-       ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL };
-
-#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
-
-#define ACPI_OVERRIDE_TABLES 64
-static struct cpio_data __initdata acpi_initrd_files[ACPI_OVERRIDE_TABLES];
-static DECLARE_BITMAP(acpi_initrd_installed, ACPI_OVERRIDE_TABLES);
-
-#define MAP_CHUNK_SIZE   (NR_FIX_BTMAPS << PAGE_SHIFT)
-
-void __init acpi_initrd_override(void *data, size_t size)
-{
-       int sig, no, table_nr = 0, total_offset = 0;
-       long offset = 0;
-       struct acpi_table_header *table;
-       char cpio_path[32] = "kernel/firmware/acpi/";
-       struct cpio_data file;
-
-       if (data == NULL || size == 0)
-               return;
-
-       for (no = 0; no < ACPI_OVERRIDE_TABLES; no++) {
-               file = find_cpio_data(cpio_path, data, size, &offset);
-               if (!file.data)
-                       break;
-
-               data += offset;
-               size -= offset;
-
-               if (file.size < sizeof(struct acpi_table_header)) {
-                       pr_err("ACPI OVERRIDE: Table smaller than ACPI header [%s%s]\n",
-                               cpio_path, file.name);
-                       continue;
-               }
-
-               table = file.data;
-
-               for (sig = 0; table_sigs[sig]; sig++)
-                       if (!memcmp(table->signature, table_sigs[sig], 4))
-                               break;
-
-               if (!table_sigs[sig]) {
-                       pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n",
-                               cpio_path, file.name);
-                       continue;
-               }
-               if (file.size != table->length) {
-                       pr_err("ACPI OVERRIDE: File length does not match table length [%s%s]\n",
-                               cpio_path, file.name);
-                       continue;
-               }
-               if (acpi_table_checksum(file.data, table->length)) {
-                       pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n",
-                               cpio_path, file.name);
-                       continue;
-               }
-
-               pr_info("%4.4s ACPI table found in initrd [%s%s][0x%x]\n",
-                       table->signature, cpio_path, file.name, table->length);
-
-               all_tables_size += table->length;
-               acpi_initrd_files[table_nr].data = file.data;
-               acpi_initrd_files[table_nr].size = file.size;
-               table_nr++;
-       }
-       if (table_nr == 0)
-               return;
-
-       acpi_tables_addr =
-               memblock_find_in_range(0, max_low_pfn_mapped << PAGE_SHIFT,
-                                      all_tables_size, PAGE_SIZE);
-       if (!acpi_tables_addr) {
-               WARN_ON(1);
-               return;
-       }
-       /*
-        * Only calling e820_add_reserve does not work and the
-        * tables are invalid (memory got used) later.
-        * memblock_reserve works as expected and the tables won't get modified.
-        * But it's not enough on X86 because ioremap will
-        * complain later (used by acpi_os_map_memory) that the pages
-        * that should get mapped are not marked "reserved".
-        * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area)
-        * works fine.
-        */
-       memblock_reserve(acpi_tables_addr, all_tables_size);
-       arch_reserve_mem_area(acpi_tables_addr, all_tables_size);
-
-       /*
-        * early_ioremap only can remap 256k one time. If we map all
-        * tables one time, we will hit the limit. Need to map chunks
-        * one by one during copying the same as that in relocate_initrd().
-        */
-       for (no = 0; no < table_nr; no++) {
-               unsigned char *src_p = acpi_initrd_files[no].data;
-               phys_addr_t size = acpi_initrd_files[no].size;
-               phys_addr_t dest_addr = acpi_tables_addr + total_offset;
-               phys_addr_t slop, clen;
-               char *dest_p;
-
-               total_offset += size;
-
-               while (size) {
-                       slop = dest_addr & ~PAGE_MASK;
-                       clen = size;
-                       if (clen > MAP_CHUNK_SIZE - slop)
-                               clen = MAP_CHUNK_SIZE - slop;
-                       dest_p = early_ioremap(dest_addr & PAGE_MASK,
-                                                clen + slop);
-                       memcpy(dest_p + slop, src_p, clen);
-                       early_iounmap(dest_p, clen + slop);
-                       src_p += clen;
-                       dest_addr += clen;
-                       size -= clen;
-               }
-       }
-}
-
-acpi_status
-acpi_os_physical_table_override(struct acpi_table_header *existing_table,
-                               acpi_physical_address *address, u32 *length)
-{
-       int table_offset = 0;
-       int table_index = 0;
-       struct acpi_table_header *table;
-       u32 table_length;
-
-       *length = 0;
-       *address = 0;
-       if (!acpi_tables_addr)
-               return AE_OK;
-
-       while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
-               table = acpi_os_map_memory(acpi_tables_addr + table_offset,
-                                          ACPI_HEADER_SIZE);
-               if (table_offset + table->length > all_tables_size) {
-                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-                       WARN_ON(1);
-                       return AE_OK;
-               }
-
-               table_length = table->length;
-
-               /* Only override tables matched */
-               if (test_bit(table_index, acpi_initrd_installed) ||
-                   memcmp(existing_table->signature, table->signature, 4) ||
-                   memcmp(table->oem_table_id, existing_table->oem_table_id,
-                          ACPI_OEM_TABLE_ID_SIZE)) {
-                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-                       goto next_table;
-               }
-
-               *length = table_length;
-               *address = acpi_tables_addr + table_offset;
-               acpi_table_taint(existing_table);
-               acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-               set_bit(table_index, acpi_initrd_installed);
-               break;
-
-next_table:
-               table_offset += table_length;
-               table_index++;
-       }
-       return AE_OK;
-}
-
-void __init acpi_initrd_initialize_tables(void)
-{
-       int table_offset = 0;
-       int table_index = 0;
-       u32 table_length;
-       struct acpi_table_header *table;
-
-       if (!acpi_tables_addr)
-               return;
-
-       while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
-               table = acpi_os_map_memory(acpi_tables_addr + table_offset,
-                                          ACPI_HEADER_SIZE);
-               if (table_offset + table->length > all_tables_size) {
-                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-                       WARN_ON(1);
-                       return;
-               }
-
-               table_length = table->length;
-
-               /* Skip RSDT/XSDT which should only be used for override */
-               if (test_bit(table_index, acpi_initrd_installed) ||
-                   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_RSDT) ||
-                   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_XSDT)) {
-                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-                       goto next_table;
-               }
-
-               acpi_table_taint(table);
-               acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
-               acpi_install_table(acpi_tables_addr + table_offset, TRUE);
-               set_bit(table_index, acpi_initrd_installed);
-next_table:
-               table_offset += table_length;
-               table_index++;
-       }
-}
-#else
-acpi_status
-acpi_os_physical_table_override(struct acpi_table_header *existing_table,
-                               acpi_physical_address *address,
-                               u32 *table_length)
-{
-       *table_length = 0;
-       *address = 0;
-       return AE_OK;
-}
-
-void __init acpi_initrd_initialize_tables(void)
-{
-}
-#endif /* CONFIG_ACPI_INITRD_TABLE_OVERRIDE */
-
-acpi_status
-acpi_os_table_override(struct acpi_table_header *existing_table,
-                      struct acpi_table_header **new_table)
-{
-       if (!existing_table || !new_table)
-               return AE_BAD_PARAMETER;
-
-       *new_table = NULL;
-
-#ifdef CONFIG_ACPI_CUSTOM_DSDT
-       if (strncmp(existing_table->signature, "DSDT", 4) == 0)
-               *new_table = (struct acpi_table_header *)AmlCode;
-#endif
-       if (*new_table != NULL)
-               acpi_table_taint(existing_table);
-       return AE_OK;
-}
-
 static irqreturn_t acpi_irq(int irq, void *dev_id)
 {
        u32 handled;
index 2a8b5964429753b212a0f28ff9be5f19a7a1b777..7a2e4d45b266724c536ce87361c7eb1a2a6e007c 100644 (file)
 #include "internal.h"
 #include "sleep.h"
 
+/*
+ * Some HW-full platforms do not have _S5, so they may need
+ * to leverage efi power off for a shutdown.
+ */
+bool acpi_no_s5;
 static u8 sleep_states[ACPI_S_STATE_COUNT];
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -882,6 +887,8 @@ int __init acpi_sleep_init(void)
                sleep_states[ACPI_STATE_S5] = 1;
                pm_power_off_prepare = acpi_power_off_prepare;
                pm_power_off = acpi_power_off;
+       } else {
+               acpi_no_s5 = true;
        }
 
        supported[0] = 0;
index f49c02442d65c2d2c07fffa97ac79c2df305e917..a372f9eaa15deb8999abc60a4f0de2d7a9579cdd 100644 (file)
 #include <linux/errno.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
+#include <linux/earlycpio.h>
+#include <linux/memblock.h>
 #include "internal.h"
 
+#ifdef CONFIG_ACPI_CUSTOM_DSDT
+#include CONFIG_ACPI_CUSTOM_DSDT_FILE
+#endif
+
 #define ACPI_MAX_TABLES                128
 
 static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
@@ -433,6 +439,314 @@ static void __init check_multiple_madt(void)
        return;
 }
 
+static void acpi_table_taint(struct acpi_table_header *table)
+{
+       pr_warn("Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n",
+               table->signature, table->oem_table_id);
+       add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
+}
+
+#ifdef CONFIG_ACPI_TABLE_UPGRADE
+static u64 acpi_tables_addr;
+static int all_tables_size;
+
+/* Copied from acpica/tbutils.c:acpi_tb_checksum() */
+static u8 __init acpi_table_checksum(u8 *buffer, u32 length)
+{
+       u8 sum = 0;
+       u8 *end = buffer + length;
+
+       while (buffer < end)
+               sum = (u8) (sum + *(buffer++));
+       return sum;
+}
+
+/* All but ACPI_SIG_RSDP and ACPI_SIG_FACS: */
+static const char * const table_sigs[] = {
+       ACPI_SIG_BERT, ACPI_SIG_CPEP, ACPI_SIG_ECDT, ACPI_SIG_EINJ,
+       ACPI_SIG_ERST, ACPI_SIG_HEST, ACPI_SIG_MADT, ACPI_SIG_MSCT,
+       ACPI_SIG_SBST, ACPI_SIG_SLIT, ACPI_SIG_SRAT, ACPI_SIG_ASF,
+       ACPI_SIG_BOOT, ACPI_SIG_DBGP, ACPI_SIG_DMAR, ACPI_SIG_HPET,
+       ACPI_SIG_IBFT, ACPI_SIG_IVRS, ACPI_SIG_MCFG, ACPI_SIG_MCHI,
+       ACPI_SIG_SLIC, ACPI_SIG_SPCR, ACPI_SIG_SPMI, ACPI_SIG_TCPA,
+       ACPI_SIG_UEFI, ACPI_SIG_WAET, ACPI_SIG_WDAT, ACPI_SIG_WDDT,
+       ACPI_SIG_WDRT, ACPI_SIG_DSDT, ACPI_SIG_FADT, ACPI_SIG_PSDT,
+       ACPI_SIG_RSDT, ACPI_SIG_XSDT, ACPI_SIG_SSDT, NULL };
+
+#define ACPI_HEADER_SIZE sizeof(struct acpi_table_header)
+
+#define NR_ACPI_INITRD_TABLES 64
+static struct cpio_data __initdata acpi_initrd_files[NR_ACPI_INITRD_TABLES];
+static DECLARE_BITMAP(acpi_initrd_installed, NR_ACPI_INITRD_TABLES);
+
+#define MAP_CHUNK_SIZE   (NR_FIX_BTMAPS << PAGE_SHIFT)
+
+static void __init acpi_table_initrd_init(void *data, size_t size)
+{
+       int sig, no, table_nr = 0, total_offset = 0;
+       long offset = 0;
+       struct acpi_table_header *table;
+       char cpio_path[32] = "kernel/firmware/acpi/";
+       struct cpio_data file;
+
+       if (data == NULL || size == 0)
+               return;
+
+       for (no = 0; no < NR_ACPI_INITRD_TABLES; no++) {
+               file = find_cpio_data(cpio_path, data, size, &offset);
+               if (!file.data)
+                       break;
+
+               data += offset;
+               size -= offset;
+
+               if (file.size < sizeof(struct acpi_table_header)) {
+                       pr_err("ACPI OVERRIDE: Table smaller than ACPI header [%s%s]\n",
+                               cpio_path, file.name);
+                       continue;
+               }
+
+               table = file.data;
+
+               for (sig = 0; table_sigs[sig]; sig++)
+                       if (!memcmp(table->signature, table_sigs[sig], 4))
+                               break;
+
+               if (!table_sigs[sig]) {
+                       pr_err("ACPI OVERRIDE: Unknown signature [%s%s]\n",
+                               cpio_path, file.name);
+                       continue;
+               }
+               if (file.size != table->length) {
+                       pr_err("ACPI OVERRIDE: File length does not match table length [%s%s]\n",
+                               cpio_path, file.name);
+                       continue;
+               }
+               if (acpi_table_checksum(file.data, table->length)) {
+                       pr_err("ACPI OVERRIDE: Bad table checksum [%s%s]\n",
+                               cpio_path, file.name);
+                       continue;
+               }
+
+               pr_info("%4.4s ACPI table found in initrd [%s%s][0x%x]\n",
+                       table->signature, cpio_path, file.name, table->length);
+
+               all_tables_size += table->length;
+               acpi_initrd_files[table_nr].data = file.data;
+               acpi_initrd_files[table_nr].size = file.size;
+               table_nr++;
+       }
+       if (table_nr == 0)
+               return;
+
+       acpi_tables_addr =
+               memblock_find_in_range(0, max_low_pfn_mapped << PAGE_SHIFT,
+                                      all_tables_size, PAGE_SIZE);
+       if (!acpi_tables_addr) {
+               WARN_ON(1);
+               return;
+       }
+       /*
+        * Only calling e820_add_reserve does not work and the
+        * tables are invalid (memory got used) later.
+        * memblock_reserve works as expected and the tables won't get modified.
+        * But it's not enough on X86 because ioremap will
+        * complain later (used by acpi_os_map_memory) that the pages
+        * that should get mapped are not marked "reserved".
+        * Both memblock_reserve and e820_add_region (via arch_reserve_mem_area)
+        * works fine.
+        */
+       memblock_reserve(acpi_tables_addr, all_tables_size);
+       arch_reserve_mem_area(acpi_tables_addr, all_tables_size);
+
+       /*
+        * early_ioremap only can remap 256k one time. If we map all
+        * tables one time, we will hit the limit. Need to map chunks
+        * one by one during copying the same as that in relocate_initrd().
+        */
+       for (no = 0; no < table_nr; no++) {
+               unsigned char *src_p = acpi_initrd_files[no].data;
+               phys_addr_t size = acpi_initrd_files[no].size;
+               phys_addr_t dest_addr = acpi_tables_addr + total_offset;
+               phys_addr_t slop, clen;
+               char *dest_p;
+
+               total_offset += size;
+
+               while (size) {
+                       slop = dest_addr & ~PAGE_MASK;
+                       clen = size;
+                       if (clen > MAP_CHUNK_SIZE - slop)
+                               clen = MAP_CHUNK_SIZE - slop;
+                       dest_p = early_ioremap(dest_addr & PAGE_MASK,
+                                                clen + slop);
+                       memcpy(dest_p + slop, src_p, clen);
+                       early_iounmap(dest_p, clen + slop);
+                       src_p += clen;
+                       dest_addr += clen;
+                       size -= clen;
+               }
+       }
+}
+
+static acpi_status
+acpi_table_initrd_override(struct acpi_table_header *existing_table,
+                          acpi_physical_address *address, u32 *length)
+{
+       int table_offset = 0;
+       int table_index = 0;
+       struct acpi_table_header *table;
+       u32 table_length;
+
+       *length = 0;
+       *address = 0;
+       if (!acpi_tables_addr)
+               return AE_OK;
+
+       while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
+               table = acpi_os_map_memory(acpi_tables_addr + table_offset,
+                                          ACPI_HEADER_SIZE);
+               if (table_offset + table->length > all_tables_size) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       WARN_ON(1);
+                       return AE_OK;
+               }
+
+               table_length = table->length;
+
+               /* Only override tables matched */
+               if (memcmp(existing_table->signature, table->signature, 4) ||
+                   memcmp(table->oem_id, existing_table->oem_id,
+                          ACPI_OEM_ID_SIZE) ||
+                   memcmp(table->oem_table_id, existing_table->oem_table_id,
+                          ACPI_OEM_TABLE_ID_SIZE)) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       goto next_table;
+               }
+               /*
+                * Mark the table to avoid being used in
+                * acpi_table_initrd_scan() and check the revision.
+                */
+               if (test_and_set_bit(table_index, acpi_initrd_installed) ||
+                   existing_table->oem_revision >= table->oem_revision) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       goto next_table;
+               }
+
+               *length = table_length;
+               *address = acpi_tables_addr + table_offset;
+               pr_info("Table Upgrade: override [%4.4s-%6.6s-%8.8s]\n",
+                       table->signature, table->oem_id,
+                       table->oem_table_id);
+               acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+               break;
+
+next_table:
+               table_offset += table_length;
+               table_index++;
+       }
+       return AE_OK;
+}
+
+static void __init acpi_table_initrd_scan(void)
+{
+       int table_offset = 0;
+       int table_index = 0;
+       u32 table_length;
+       struct acpi_table_header *table;
+
+       if (!acpi_tables_addr)
+               return;
+
+       while (table_offset + ACPI_HEADER_SIZE <= all_tables_size) {
+               table = acpi_os_map_memory(acpi_tables_addr + table_offset,
+                                          ACPI_HEADER_SIZE);
+               if (table_offset + table->length > all_tables_size) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       WARN_ON(1);
+                       return;
+               }
+
+               table_length = table->length;
+
+               /* Skip RSDT/XSDT which should only be used for override */
+               if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_RSDT) ||
+                   ACPI_COMPARE_NAME(table->signature, ACPI_SIG_XSDT)) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       goto next_table;
+               }
+               /*
+                * Mark the table to avoid being used in
+                * acpi_table_initrd_override(). Though this is not possible
+                * because override is disabled in acpi_install_table().
+                */
+               if (test_and_set_bit(table_index, acpi_initrd_installed)) {
+                       acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+                       goto next_table;
+               }
+
+               pr_info("Table Upgrade: install [%4.4s-%6.6s-%8.8s]\n",
+                       table->signature, table->oem_id,
+                       table->oem_table_id);
+               acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
+               acpi_install_table(acpi_tables_addr + table_offset, TRUE);
+next_table:
+               table_offset += table_length;
+               table_index++;
+       }
+}
+#else
+static void __init acpi_table_initrd_init(void *data, size_t size)
+{
+}
+
+static acpi_status
+acpi_table_initrd_override(struct acpi_table_header *existing_table,
+                          acpi_physical_address *address,
+                          u32 *table_length)
+{
+       *table_length = 0;
+       *address = 0;
+       return AE_OK;
+}
+
+static void __init acpi_table_initrd_scan(void)
+{
+}
+#endif /* CONFIG_ACPI_TABLE_UPGRADE */
+
+acpi_status
+acpi_os_physical_table_override(struct acpi_table_header *existing_table,
+                               acpi_physical_address *address,
+                               u32 *table_length)
+{
+       return acpi_table_initrd_override(existing_table, address,
+                                         table_length);
+}
+
+acpi_status
+acpi_os_table_override(struct acpi_table_header *existing_table,
+                      struct acpi_table_header **new_table)
+{
+       if (!existing_table || !new_table)
+               return AE_BAD_PARAMETER;
+
+       *new_table = NULL;
+
+#ifdef CONFIG_ACPI_CUSTOM_DSDT
+       if (strncmp(existing_table->signature, "DSDT", 4) == 0)
+               *new_table = (struct acpi_table_header *)AmlCode;
+#endif
+       if (*new_table != NULL)
+               acpi_table_taint(existing_table);
+       return AE_OK;
+}
+
+void __init early_acpi_table_init(void *data, size_t size)
+{
+       acpi_table_initrd_init(data, size);
+}
+
 /*
  * acpi_table_init()
  *
@@ -457,7 +771,7 @@ int __init acpi_table_init(void)
        status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
        if (ACPI_FAILURE(status))
                return -EINVAL;
-       acpi_initrd_initialize_tables();
+       acpi_table_initrd_scan();
 
        check_multiple_madt();
        return 0;
index 1316ddd92fac0f6c59f4be85759947a2d1643334..3d1327615f7293eb6f76c2d2ab1bce8eddc1c399 100644 (file)
@@ -358,7 +358,7 @@ enum acpi_backlight_type acpi_video_get_backlight_type(void)
        if (!(video_caps & ACPI_VIDEO_BACKLIGHT))
                return acpi_backlight_vendor;
 
-       if (acpi_osi_is_win8() && backlight_device_registered(BACKLIGHT_RAW))
+       if (acpi_osi_is_win8() && backlight_device_get_by_type(BACKLIGHT_RAW))
                return acpi_backlight_native;
 
        return acpi_backlight_video;
index 5083f85efea76edb7f2968ffa967becbf4d4943a..cfa936a32513b1d70d74834fa743b6f612665dc1 100644 (file)
@@ -202,6 +202,14 @@ config SATA_FSL
 
          If unsure, say N.
 
+config SATA_AHCI_SEATTLE
+       tristate "AMD Seattle 6.0Gbps AHCI SATA host controller support"
+       depends on ARCH_SEATTLE
+       help
+        This option enables support for AMD Seattle SATA host controller.
+
+        If unsure, say N
+
 config SATA_INIC162X
        tristate "Initio 162x SATA support (Very Experimental)"
        depends on PCI
index 18579521464e48e22001838ab4d0abf3efbc4b0a..0b2afb7e5f359979f7a54cdadb3178b174c885b0 100644 (file)
@@ -4,6 +4,7 @@ obj-$(CONFIG_ATA)               += libata.o
 # non-SFF interface
 obj-$(CONFIG_SATA_AHCI)                += ahci.o libahci.o
 obj-$(CONFIG_SATA_ACARD_AHCI)  += acard-ahci.o libahci.o
+obj-$(CONFIG_SATA_AHCI_SEATTLE)        += ahci_seattle.o libahci.o libahci_platform.o
 obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o libahci_platform.o
 obj-$(CONFIG_SATA_FSL)         += sata_fsl.o
 obj-$(CONFIG_SATA_INIC162X)    += sata_inic162x.o
index 40442332bfa7c154b93b540eae3eb8ae94e6d9f3..62a04c8fb5c99c9ab0614bb6dc8f0146c47329e6 100644 (file)
@@ -51,6 +51,9 @@ static int ahci_probe(struct platform_device *pdev)
        if (rc)
                return rc;
 
+       of_property_read_u32(dev->of_node,
+                            "ports-implemented", &hpriv->force_port_map);
+
        if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
                hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
 
diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
new file mode 100644 (file)
index 0000000..6e702ab
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * AMD Seattle AHCI SATA driver
+ *
+ * Copyright (c) 2015, Advanced Micro Devices
+ * Author: Brijesh Singh <brijesh.singh@amd.com>
+ *
+ * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/device.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/libata.h>
+#include <linux/ahci_platform.h>
+#include <linux/acpi.h>
+#include <linux/pci_ids.h>
+#include "ahci.h"
+
+/* SGPIO Control Register definition
+ *
+ * Bit         Type            Description
+ * 31          RW              OD7.2 (activity)
+ * 30          RW              OD7.1 (locate)
+ * 29          RW              OD7.0 (fault)
+ * 28...8      RW              OD6.2...OD0.0 (3bits per port, 1 bit per LED)
+ * 7           RO              SGPIO feature flag
+ * 6:4         RO              Reserved
+ * 3:0         RO              Number of ports (0 means no port supported)
+ */
+#define ACTIVITY_BIT_POS(x)            (8 + (3 * x))
+#define LOCATE_BIT_POS(x)              (ACTIVITY_BIT_POS(x) + 1)
+#define FAULT_BIT_POS(x)               (LOCATE_BIT_POS(x) + 1)
+
+#define ACTIVITY_MASK                  0x00010000
+#define LOCATE_MASK                    0x00080000
+#define FAULT_MASK                     0x00400000
+
+#define DRV_NAME "ahci-seattle"
+
+static ssize_t seattle_transmit_led_message(struct ata_port *ap, u32 state,
+                                           ssize_t size);
+
+struct seattle_plat_data {
+       void __iomem *sgpio_ctrl;
+};
+
+static struct ata_port_operations ahci_port_ops = {
+       .inherits               = &ahci_ops,
+};
+
+static const struct ata_port_info ahci_port_info = {
+       .flags          = AHCI_FLAG_COMMON,
+       .pio_mask       = ATA_PIO4,
+       .udma_mask      = ATA_UDMA6,
+       .port_ops       = &ahci_port_ops,
+};
+
+static struct ata_port_operations ahci_seattle_ops = {
+       .inherits               = &ahci_ops,
+       .transmit_led_message   = seattle_transmit_led_message,
+};
+
+static const struct ata_port_info ahci_port_seattle_info = {
+       .flags          = AHCI_FLAG_COMMON | ATA_FLAG_EM | ATA_FLAG_SW_ACTIVITY,
+       .link_flags     = ATA_LFLAG_SW_ACTIVITY,
+       .pio_mask       = ATA_PIO4,
+       .udma_mask      = ATA_UDMA6,
+       .port_ops       = &ahci_seattle_ops,
+};
+
+static struct scsi_host_template ahci_platform_sht = {
+       AHCI_SHT(DRV_NAME),
+};
+
+static ssize_t seattle_transmit_led_message(struct ata_port *ap, u32 state,
+                                           ssize_t size)
+{
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+       struct ahci_port_priv *pp = ap->private_data;
+       struct seattle_plat_data *plat_data = hpriv->plat_data;
+       unsigned long flags;
+       int pmp;
+       struct ahci_em_priv *emp;
+       u32 val;
+
+       /* get the slot number from the message */
+       pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
+       if (pmp >= EM_MAX_SLOTS)
+               return -EINVAL;
+       emp = &pp->em_priv[pmp];
+
+       val = ioread32(plat_data->sgpio_ctrl);
+       if (state & ACTIVITY_MASK)
+               val |= 1 << ACTIVITY_BIT_POS((ap->port_no));
+       else
+               val &= ~(1 << ACTIVITY_BIT_POS((ap->port_no)));
+
+       if (state & LOCATE_MASK)
+               val |= 1 << LOCATE_BIT_POS((ap->port_no));
+       else
+               val &= ~(1 << LOCATE_BIT_POS((ap->port_no)));
+
+       if (state & FAULT_MASK)
+               val |= 1 << FAULT_BIT_POS((ap->port_no));
+       else
+               val &= ~(1 << FAULT_BIT_POS((ap->port_no)));
+
+       iowrite32(val, plat_data->sgpio_ctrl);
+
+       spin_lock_irqsave(ap->lock, flags);
+
+       /* save off new led state for port/slot */
+       emp->led_state = state;
+
+       spin_unlock_irqrestore(ap->lock, flags);
+
+       return size;
+}
+
+static const struct ata_port_info *ahci_seattle_get_port_info(
+               struct platform_device *pdev, struct ahci_host_priv *hpriv)
+{
+       struct device *dev = &pdev->dev;
+       struct seattle_plat_data *plat_data;
+       u32 val;
+
+       plat_data = devm_kzalloc(dev, sizeof(*plat_data), GFP_KERNEL);
+       if (IS_ERR(plat_data))
+               return &ahci_port_info;
+
+       plat_data->sgpio_ctrl = devm_ioremap_resource(dev,
+                             platform_get_resource(pdev, IORESOURCE_MEM, 1));
+       if (IS_ERR(plat_data->sgpio_ctrl))
+               return &ahci_port_info;
+
+       val = ioread32(plat_data->sgpio_ctrl);
+
+       if (!(val & 0xf))
+               return &ahci_port_info;
+
+       hpriv->em_loc = 0;
+       hpriv->em_buf_sz = 4;
+       hpriv->em_msg_type = EM_MSG_TYPE_LED;
+       hpriv->plat_data = plat_data;
+
+       dev_info(dev, "SGPIO LED control is enabled.\n");
+       return &ahci_port_seattle_info;
+}
+
+static int ahci_seattle_probe(struct platform_device *pdev)
+{
+       int rc;
+       struct ahci_host_priv *hpriv;
+
+       hpriv = ahci_platform_get_resources(pdev);
+       if (IS_ERR(hpriv))
+               return PTR_ERR(hpriv);
+
+       rc = ahci_platform_enable_resources(hpriv);
+       if (rc)
+               return rc;
+
+       rc = ahci_platform_init_host(pdev, hpriv,
+                                    ahci_seattle_get_port_info(pdev, hpriv),
+                                    &ahci_platform_sht);
+       if (rc)
+               goto disable_resources;
+
+       return 0;
+disable_resources:
+       ahci_platform_disable_resources(hpriv);
+       return rc;
+}
+
+static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
+                        ahci_platform_resume);
+
+static const struct acpi_device_id ahci_acpi_match[] = {
+       { "AMDI0600", 0 },
+       {}
+};
+MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
+
+static struct platform_driver ahci_seattle_driver = {
+       .probe = ahci_seattle_probe,
+       .remove = ata_platform_remove_one,
+       .driver = {
+               .name = DRV_NAME,
+               .acpi_match_table = ahci_acpi_match,
+               .pm = &ahci_pm_ops,
+       },
+};
+module_platform_driver(ahci_seattle_driver);
+
+MODULE_DESCRIPTION("Seattle AHCI SATA platform driver");
+MODULE_AUTHOR("Brijesh Singh <brijesh.singh@amd.com>");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:" DRV_NAME);
index 3982054060b81bb0d253b001883b32e346c6dc74..a5d7c1c2a05ee26dc80a41d440357c4a7be96a20 100644 (file)
@@ -507,6 +507,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
                dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
                         port_map, hpriv->force_port_map);
                port_map = hpriv->force_port_map;
+               hpriv->saved_port_map = port_map;
        }
 
        if (hpriv->mask_port_map) {
index 433b60092972d56abba55897158d6c22156cf631..d8f4cc22856c924b1be7bf1aa97f175b6579c554 100644 (file)
@@ -259,9 +259,6 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
        reg = opp_table->regulator;
        if (IS_ERR(reg)) {
                /* Regulator may not be required for device */
-               if (reg)
-                       dev_err(dev, "%s: Invalid regulator (%ld)\n", __func__,
-                               PTR_ERR(reg));
                rcu_read_unlock();
                return 0;
        }
index 9b1a65debd49e645d41343eac7d54a4369ddc2fd..7f692accdc90ec296c55ba738b2cd7f65426ba26 100644 (file)
@@ -21,7 +21,7 @@
 
 static inline bool is_pset_node(struct fwnode_handle *fwnode)
 {
-       return fwnode && fwnode->type == FWNODE_PDATA;
+       return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA;
 }
 
 static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode)
index 02e18182fcb5506da4c4981a0d5f1926376099e6..2beb396fe6523cb332ec369d6a65a1c7bf9d3e25 100644 (file)
@@ -394,7 +394,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
                clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7);
        } else {
                clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);
-               clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60", base + 0x20, 2, 6);
+               clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6);
                clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup);
                clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m",          base + 0x24, 0,  6);
                clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
index e93405f0eac46565d18c25873d1113c3a1aa65fd..c4acfc5273b3c1f8c5efc321f5ea8407a4b7f02b 100644 (file)
@@ -1557,21 +1557,25 @@ void cpufreq_suspend(void)
        if (!cpufreq_driver)
                return;
 
-       if (!has_target())
+       if (!has_target() && !cpufreq_driver->suspend)
                goto suspend;
 
        pr_debug("%s: Suspending Governors\n", __func__);
 
        for_each_active_policy(policy) {
-               down_write(&policy->rwsem);
-               ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP);
-               up_write(&policy->rwsem);
+               if (has_target()) {
+                       down_write(&policy->rwsem);
+                       ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP);
+                       up_write(&policy->rwsem);
 
-               if (ret)
-                       pr_err("%s: Failed to stop governor for policy: %p\n",
-                               __func__, policy);
-               else if (cpufreq_driver->suspend
-                   && cpufreq_driver->suspend(policy))
+                       if (ret) {
+                               pr_err("%s: Failed to stop governor for policy: %p\n",
+                                       __func__, policy);
+                               continue;
+                       }
+               }
+
+               if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
                        pr_err("%s: Failed to suspend driver: %p\n", __func__,
                                policy);
        }
@@ -1596,7 +1600,7 @@ void cpufreq_resume(void)
 
        cpufreq_suspended = false;
 
-       if (!has_target())
+       if (!has_target() && !cpufreq_driver->resume)
                return;
 
        pr_debug("%s: Resuming Governors\n", __func__);
@@ -1605,7 +1609,7 @@ void cpufreq_resume(void)
                if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
                        pr_err("%s: Failed to resume driver: %p\n", __func__,
                                policy);
-               } else {
+               } else if (has_target()) {
                        down_write(&policy->rwsem);
                        ret = cpufreq_start_governor(policy);
                        up_write(&policy->rwsem);
index f502d5b90c2537b88a86b5224f21d175556be744..b230ebaae66cb7ee0def1d228ff33c778343f344 100644 (file)
@@ -453,6 +453,14 @@ static void intel_pstate_hwp_set(const struct cpumask *cpumask)
        }
 }
 
+static int intel_pstate_hwp_set_policy(struct cpufreq_policy *policy)
+{
+       if (hwp_active)
+               intel_pstate_hwp_set(policy->cpus);
+
+       return 0;
+}
+
 static void intel_pstate_hwp_set_online_cpus(void)
 {
        get_online_cpus();
@@ -1062,8 +1070,9 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time)
 
 static inline int32_t get_avg_frequency(struct cpudata *cpu)
 {
-       return div64_u64(cpu->pstate.max_pstate_physical * cpu->sample.aperf *
-               cpu->pstate.scaling, cpu->sample.mperf);
+       return fp_toint(mul_fp(cpu->sample.core_pct_busy,
+                              int_tofp(cpu->pstate.max_pstate_physical *
+                                               cpu->pstate.scaling / 100)));
 }
 
 static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
@@ -1106,8 +1115,6 @@ static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu)
        int32_t core_busy, max_pstate, current_pstate, sample_ratio;
        u64 duration_ns;
 
-       intel_pstate_calc_busy(cpu);
-
        /*
         * core_busy is the ratio of actual performance to max
         * max_pstate is the max non turbo pstate available
@@ -1191,8 +1198,11 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time,
        if ((s64)delta_ns >= pid_params.sample_rate_ns) {
                bool sample_taken = intel_pstate_sample(cpu, time);
 
-               if (sample_taken && !hwp_active)
-                       intel_pstate_adjust_busy_pstate(cpu);
+               if (sample_taken) {
+                       intel_pstate_calc_busy(cpu);
+                       if (!hwp_active)
+                               intel_pstate_adjust_busy_pstate(cpu);
+               }
        }
 }
 
@@ -1346,8 +1356,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
  out:
        intel_pstate_set_update_util_hook(policy->cpu);
 
-       if (hwp_active)
-               intel_pstate_hwp_set(policy->cpus);
+       intel_pstate_hwp_set_policy(policy);
 
        return 0;
 }
@@ -1411,6 +1420,7 @@ static struct cpufreq_driver intel_pstate_driver = {
        .flags          = CPUFREQ_CONST_LOOPS,
        .verify         = intel_pstate_verify_policy,
        .setpolicy      = intel_pstate_set_policy,
+       .resume         = intel_pstate_hwp_set_policy,
        .get            = intel_pstate_get,
        .init           = intel_pstate_cpu_init,
        .stop_cpu       = intel_pstate_stop_cpu,
index a9c659f589747a2140f2b91e0c07cd7fe1cbcb69..04042038ec4b75e78631eda625f0f1bb2a4b4d95 100644 (file)
@@ -259,6 +259,10 @@ static int sti_cpufreq_init(void)
 {
        int ret;
 
+       if ((!of_machine_is_compatible("st,stih407")) &&
+               (!of_machine_is_compatible("st,stih410")))
+               return -ENODEV;
+
        ddata.cpu = get_cpu_device(0);
        if (!ddata.cpu) {
                dev_err(ddata.cpu, "Failed to get device for CPU0\n");
index 545069d5fdfba3e7ab07f0ec296404c64ad2a977..e342565e8715e95af6c76a80ca393d8fcfada66a 100644 (file)
@@ -50,7 +50,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
                 * call the CPU ops suspend protocol with idle index as a
                 * parameter.
                 */
-               arm_cpuidle_suspend(idx);
+               ret = arm_cpuidle_suspend(idx);
 
                cpu_pm_exit();
        }
index 815c4a5cae543e228a634eae28241bc6f24ac1ed..1b95475b6aefefd5144bca29ab464304826c6377 100644 (file)
@@ -77,7 +77,7 @@ static inline u16 fw_cfg_sel_endianness(u16 key)
 static inline void fw_cfg_read_blob(u16 key,
                                    void *buf, loff_t pos, size_t count)
 {
-       u32 glk;
+       u32 glk = -1U;
        acpi_status status;
 
        /* If we have ACPI, ensure mutual exclusion against any potential
index d9ab0cd1d205963528d7022d66213c26bf8304e5..4d9a315cfd43ea8fb9d97b0578f9c6bd4c38ef00 100644 (file)
@@ -196,44 +196,6 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
        return 0;
 }
 
-static void gpio_rcar_irq_bus_lock(struct irq_data *d)
-{
-       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct gpio_rcar_priv *p = gpiochip_get_data(gc);
-
-       pm_runtime_get_sync(&p->pdev->dev);
-}
-
-static void gpio_rcar_irq_bus_sync_unlock(struct irq_data *d)
-{
-       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct gpio_rcar_priv *p = gpiochip_get_data(gc);
-
-       pm_runtime_put(&p->pdev->dev);
-}
-
-
-static int gpio_rcar_irq_request_resources(struct irq_data *d)
-{
-       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct gpio_rcar_priv *p = gpiochip_get_data(gc);
-       int error;
-
-       error = pm_runtime_get_sync(&p->pdev->dev);
-       if (error < 0)
-               return error;
-
-       return 0;
-}
-
-static void gpio_rcar_irq_release_resources(struct irq_data *d)
-{
-       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct gpio_rcar_priv *p = gpiochip_get_data(gc);
-
-       pm_runtime_put(&p->pdev->dev);
-}
-
 static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
 {
        struct gpio_rcar_priv *p = dev_id;
@@ -280,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
 
 static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
 {
-       struct gpio_rcar_priv *p = gpiochip_get_data(chip);
-       int error;
-
-       error = pm_runtime_get_sync(&p->pdev->dev);
-       if (error < 0)
-               return error;
-
-       error = pinctrl_request_gpio(chip->base + offset);
-       if (error)
-               pm_runtime_put(&p->pdev->dev);
-
-       return error;
+       return pinctrl_request_gpio(chip->base + offset);
 }
 
 static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
 {
-       struct gpio_rcar_priv *p = gpiochip_get_data(chip);
-
        pinctrl_free_gpio(chip->base + offset);
 
-       /* Set the GPIO as an input to ensure that the next GPIO request won't
+       /*
+        * Set the GPIO as an input to ensure that the next GPIO request won't
         * drive the GPIO pin as an output.
         */
        gpio_rcar_config_general_input_output_mode(chip, offset, false);
-
-       pm_runtime_put(&p->pdev->dev);
 }
 
 static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -452,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        }
 
        pm_runtime_enable(dev);
+       pm_runtime_get_sync(dev);
 
        io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -488,10 +437,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        irq_chip->irq_unmask = gpio_rcar_irq_enable;
        irq_chip->irq_set_type = gpio_rcar_irq_set_type;
        irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
-       irq_chip->irq_bus_lock = gpio_rcar_irq_bus_lock;
-       irq_chip->irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock;
-       irq_chip->irq_request_resources = gpio_rcar_irq_request_resources;
-       irq_chip->irq_release_resources = gpio_rcar_irq_release_resources;
        irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
 
        ret = gpiochip_add_data(gpio_chip, p);
@@ -522,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 err1:
        gpiochip_remove(gpio_chip);
 err0:
+       pm_runtime_put(dev);
        pm_runtime_disable(dev);
        return ret;
 }
@@ -532,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
 
        gpiochip_remove(&p->gpio_chip);
 
+       pm_runtime_put(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
        return 0;
 }
index 682070d20f001dce1aef51147d99aca97cb2938c..2dc52585e3f2f1cc79664beba50ef453dcea1950 100644 (file)
@@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id)
                lookup = kmalloc(sizeof(*lookup), GFP_KERNEL);
                if (lookup) {
                        lookup->adev = adev;
-                       lookup->con_id = con_id;
+                       lookup->con_id = kstrdup(con_id, GFP_KERNEL);
                        list_add_tail(&lookup->node, &acpi_crs_lookup_list);
                }
        }
index e557fc1f17c8becfb3ddae209942326d05d5a884..7ecea83ce453cae868306b95b1600a01653a6de7 100644 (file)
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
        if (!metadata_size) {
                if (bo->metadata_size) {
                        kfree(bo->metadata);
+                       bo->metadata = NULL;
                        bo->metadata_size = 0;
                }
                return 0;
index 1e0bba29e16796f97c8eee38fc9d3100c405f6bc..1cd6de575305aa3f657fa1a7f5a70232b272d739 100644 (file)
@@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder,
            && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
                adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
 
+       /* vertical FP must be at least 1 */
+       if (mode->crtc_vsync_start == mode->crtc_vdisplay)
+               adjusted_mode->crtc_vsync_start++;
+
        /* get the native mode for scaling */
        if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT))
                amdgpu_panel_mode_fixup(encoder, adjusted_mode);
index 30798cbc6fc08938cc2adc62089148d545c118a6..6d2fb3f4ac628fddaaa5f6da8f724c3787330c5b 100644 (file)
@@ -792,7 +792,7 @@ static int i915_drm_resume(struct drm_device *dev)
 static int i915_drm_resume_early(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       int ret = 0;
+       int ret;
 
        /*
         * We have a resume ordering issue with the snd-hda driver also
@@ -803,6 +803,36 @@ static int i915_drm_resume_early(struct drm_device *dev)
         * FIXME: This should be solved with a special hdmi sink device or
         * similar so that power domains can be employed.
         */
+
+       /*
+        * Note that we need to set the power state explicitly, since we
+        * powered off the device during freeze and the PCI core won't power
+        * it back up for us during thaw. Powering off the device during
+        * freeze is not a hard requirement though, and during the
+        * suspend/resume phases the PCI core makes sure we get here with the
+        * device powered on. So in case we change our freeze logic and keep
+        * the device powered we can also remove the following set power state
+        * call.
+        */
+       ret = pci_set_power_state(dev->pdev, PCI_D0);
+       if (ret) {
+               DRM_ERROR("failed to set PCI D0 power state (%d)\n", ret);
+               goto out;
+       }
+
+       /*
+        * Note that pci_enable_device() first enables any parent bridge
+        * device and only then sets the power state for this device. The
+        * bridge enabling is a nop though, since bridge devices are resumed
+        * first. The order of enabling power and enabling the device is
+        * imposed by the PCI core as described above, so here we preserve the
+        * same order for the freeze/thaw phases.
+        *
+        * TODO: eventually we should remove pci_disable_device() /
+        * pci_enable_enable_device() from suspend/resume. Due to how they
+        * depend on the device enable refcount we can't anyway depend on them
+        * disabling/enabling the device.
+        */
        if (pci_enable_device(dev->pdev)) {
                ret = -EIO;
                goto out;
index f76cbf3e5d1e1999afa61b62bf9740c308e552bb..fffdac801d3b0da03abdd65b2c90e50fb1913e54 100644 (file)
@@ -2907,7 +2907,14 @@ enum skl_disp_power_wells {
 #define GEN6_RP_STATE_CAP      _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
 #define BXT_RP_STATE_CAP        _MMIO(0x138170)
 
-#define INTERVAL_1_28_US(us)   (((us) * 100) >> 7)
+/*
+ * Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS
+ * 8300) freezing up around GPU hangs. Looks as if even
+ * scheduling/timer interrupts start misbehaving if the RPS
+ * EI/thresholds are "bad", leading to a very sluggish or even
+ * frozen machine.
+ */
+#define INTERVAL_1_28_US(us)   roundup(((us) * 100) >> 7, 25)
 #define INTERVAL_1_33_US(us)   (((us) * 3)   >> 2)
 #define INTERVAL_0_833_US(us)  (((us) * 6) / 5)
 #define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \
index 62de9f4bce09959a8deb756c0e51ecb4e202315a..3b57bf06abe8598c1c3b6fba0dc8e19b7f192619 100644 (file)
@@ -443,9 +443,17 @@ void intel_prepare_ddi_buffer(struct intel_encoder *encoder)
        } else if (IS_BROADWELL(dev_priv)) {
                ddi_translations_fdi = bdw_ddi_translations_fdi;
                ddi_translations_dp = bdw_ddi_translations_dp;
-               ddi_translations_edp = bdw_ddi_translations_edp;
+
+               if (dev_priv->edp_low_vswing) {
+                       ddi_translations_edp = bdw_ddi_translations_edp;
+                       n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp);
+               } else {
+                       ddi_translations_edp = bdw_ddi_translations_dp;
+                       n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
+               }
+
                ddi_translations_hdmi = bdw_ddi_translations_hdmi;
-               n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp);
+
                n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
                n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
                hdmi_default_entry = 7;
@@ -3201,12 +3209,6 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
        intel_ddi_clock_get(encoder, pipe_config);
 }
 
-static void intel_ddi_destroy(struct drm_encoder *encoder)
-{
-       /* HDMI has nothing special to destroy, so we can go with this. */
-       intel_dp_encoder_destroy(encoder);
-}
-
 static bool intel_ddi_compute_config(struct intel_encoder *encoder,
                                     struct intel_crtc_state *pipe_config)
 {
@@ -3225,7 +3227,8 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 }
 
 static const struct drm_encoder_funcs intel_ddi_funcs = {
-       .destroy = intel_ddi_destroy,
+       .reset = intel_dp_encoder_reset,
+       .destroy = intel_dp_encoder_destroy,
 };
 
 static struct intel_connector *
@@ -3324,6 +3327,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
        intel_encoder->post_disable = intel_ddi_post_disable;
        intel_encoder->get_hw_state = intel_ddi_get_hw_state;
        intel_encoder->get_config = intel_ddi_get_config;
+       intel_encoder->suspend = intel_dp_encoder_suspend;
 
        intel_dig_port->port = port;
        intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
index 6e0d8283daa66d6383516c28542850d5c7364a48..182f84937345d5b3d778d9521ca17f4b04608037 100644 (file)
@@ -13351,6 +13351,9 @@ static int intel_atomic_prepare_commit(struct drm_device *dev,
        }
 
        for_each_crtc_in_state(state, crtc, crtc_state, i) {
+               if (state->legacy_cursor_update)
+                       continue;
+
                ret = intel_crtc_wait_for_pending_flips(crtc);
                if (ret)
                        return ret;
index f069a82deb57a42a814e2e5a30f5f1b1e4c51ad8..412a34c39522fc8474b87eaa02a5532f8a32d859 100644 (file)
@@ -4898,7 +4898,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
        kfree(intel_dig_port);
 }
 
-static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
+void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder)
 {
        struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
 
@@ -4940,7 +4940,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
        edp_panel_vdd_schedule_off(intel_dp);
 }
 
-static void intel_dp_encoder_reset(struct drm_encoder *encoder)
+void intel_dp_encoder_reset(struct drm_encoder *encoder)
 {
        struct intel_dp *intel_dp;
 
index 4c027d69fac92c99d6a67b6a98f98d9f67d84e60..7d3af3a72abea7ac557f5f107aaf597bc38d5165 100644 (file)
@@ -1238,6 +1238,8 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp,
 void intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
+void intel_dp_encoder_reset(struct drm_encoder *encoder);
+void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
 int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
index a0d8daed24701cf279ec6a452538eb814e092022..1ab6f687f6408ff9d72956fec2ebee33640c1755 100644 (file)
@@ -1415,8 +1415,16 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
                                hdmi_to_dig_port(intel_hdmi));
        }
 
-       if (!live_status)
-               DRM_DEBUG_KMS("Live status not up!");
+       if (!live_status) {
+               DRM_DEBUG_KMS("HDMI live status down\n");
+               /*
+                * Live status register is not reliable on all intel platforms.
+                * So consider live_status only for certain platforms, for
+                * others, read EDID to determine presence of sink.
+                */
+               if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv))
+                       live_status = true;
+       }
 
        intel_hdmi_unset_edid(connector);
 
index edd05cdb0cd843dfe9ee53ecbac7f4a8908d3dd2..587cae4e73c9abeeb65d2187b9e700bb8f0fa442 100644 (file)
@@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
            && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
                adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
 
+       /* vertical FP must be at least 1 */
+       if (mode->crtc_vsync_start == mode->crtc_vdisplay)
+               adjusted_mode->crtc_vsync_start++;
+
        /* get the native mode for scaling */
        if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
                radeon_panel_mode_fixup(encoder, adjusted_mode);
index e00db3f510dd425c62565d913c937c5638a072d5..abb98c77bad25c6901b910095068a3aec5059311 100644 (file)
@@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
                        goto err_register;
                }
 
-               pdev->dev.of_node = of_node;
                pdev->dev.parent = dev;
 
                ret = platform_device_add_data(pdev, &reg->pdata,
@@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
                        platform_device_put(pdev);
                        goto err_register;
                }
+
+               /*
+                * Set of_node only after calling platform_device_add. Otherwise
+                * the platform:imx-ipuv3-crtc modalias won't be used.
+                */
+               pdev->dev.of_node = of_node;
        }
 
        return 0;
index c6eaff5f88451f770cf036e71b9167a0202351e7..0238f0169e48f5d45b345498c5ba713c8cb9a96d 100644 (file)
 #define USB_DEVICE_ID_CORSAIR_K90      0x1b02
 
 #define USB_VENDOR_ID_CREATIVELABS     0x041e
+#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51     0x322c
 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
 
 #define USB_VENDOR_ID_CVTOUCH          0x1ff7
index ed2f68edc8f1c648e30b15178fc550cb9a071f88..53fc856d6867b032e6e2100c1c87c3bf5733702c 100644 (file)
@@ -71,6 +71,7 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
+       { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
index 02c4efea241c02eb6270d19b40cc90256b04721a..cf2ba43453fd4ecd9458075a9767676534a354fe 100644 (file)
@@ -684,6 +684,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
                wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]);
 
+               wacom->shared->stylus_in_proximity = true;
                return 1;
        }
 
@@ -3395,6 +3396,10 @@ static const struct wacom_features wacom_features_0x33E =
        { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
          INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
          .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
+static const struct wacom_features wacom_features_0x343 =
+       { "Wacom DTK1651", 34616, 19559, 1023, 0,
+         DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4,
+         WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
 
 static const struct wacom_features wacom_features_HID_ANY_ID =
        { "Wacom HID", .type = HID_GENERIC };
@@ -3560,6 +3565,7 @@ const struct hid_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x33C) },
        { USB_DEVICE_WACOM(0x33D) },
        { USB_DEVICE_WACOM(0x33E) },
+       { USB_DEVICE_WACOM(0x343) },
        { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x4004) },
        { USB_DEVICE_WACOM(0x5000) },
index 5613e2b5cff7759861a1e2d7ad2748f7626d16da..a40a73a7b71da359574bf4061d80340b1caa30a4 100644 (file)
@@ -103,15 +103,29 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi)
  *    there is room for the producer to send the pending packet.
  */
 
-static bool hv_need_to_signal_on_read(u32 prev_write_sz,
-                                     struct hv_ring_buffer_info *rbi)
+static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi)
 {
        u32 cur_write_sz;
        u32 r_size;
-       u32 write_loc = rbi->ring_buffer->write_index;
+       u32 write_loc;
        u32 read_loc = rbi->ring_buffer->read_index;
-       u32 pending_sz = rbi->ring_buffer->pending_send_sz;
+       u32 pending_sz;
 
+       /*
+        * Issue a full memory barrier before making the signaling decision.
+        * Here is the reason for having this barrier:
+        * If the reading of the pend_sz (in this function)
+        * were to be reordered and read before we commit the new read
+        * index (in the calling function)  we could
+        * have a problem. If the host were to set the pending_sz after we
+        * have sampled pending_sz and go to sleep before we commit the
+        * read index, we could miss sending the interrupt. Issue a full
+        * memory barrier to address this.
+        */
+       mb();
+
+       pending_sz = rbi->ring_buffer->pending_send_sz;
+       write_loc = rbi->ring_buffer->write_index;
        /* If the other end is not blocked on write don't bother. */
        if (pending_sz == 0)
                return false;
@@ -120,7 +134,7 @@ static bool hv_need_to_signal_on_read(u32 prev_write_sz,
        cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) :
                        read_loc - write_loc;
 
-       if ((prev_write_sz < pending_sz) && (cur_write_sz >= pending_sz))
+       if (cur_write_sz >= pending_sz)
                return true;
 
        return false;
@@ -455,7 +469,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info,
        /* Update the read index */
        hv_set_next_read_location(inring_info, next_read_location);
 
-       *signal = hv_need_to_signal_on_read(bytes_avail_towrite, inring_info);
+       *signal = hv_need_to_signal_on_read(inring_info);
 
        return ret;
 }
index dbee13ad33a3c341777beb60715ec1f7007fd767..2e154cb5168567ce3f09ef095bb65a639802d7e4 100644 (file)
@@ -451,6 +451,8 @@ static int at91_adc_probe(struct platform_device *pdev)
        if (ret)
                goto vref_disable;
 
+       platform_set_drvdata(pdev, indio_dev);
+
        ret = iio_device_register(indio_dev);
        if (ret < 0)
                goto per_clk_disable_unprepare;
index f581256d9d4c2473eca8979b3c0075c308f844a8..5ee4e0dc093e687445cfb3daab47f8a7f0e182fe 100644 (file)
@@ -104,6 +104,19 @@ static int inv_mpu6050_deselect_bypass(struct i2c_adapter *adap,
        return 0;
 }
 
+static const char *inv_mpu_match_acpi_device(struct device *dev, int *chip_id)
+{
+       const struct acpi_device_id *id;
+
+       id = acpi_match_device(dev->driver->acpi_match_table, dev);
+       if (!id)
+               return NULL;
+
+       *chip_id = (int)id->driver_data;
+
+       return dev_name(dev);
+}
+
 /**
  *  inv_mpu_probe() - probe function.
  *  @client:          i2c client.
@@ -115,14 +128,25 @@ static int inv_mpu_probe(struct i2c_client *client,
                         const struct i2c_device_id *id)
 {
        struct inv_mpu6050_state *st;
-       int result;
-       const char *name = id ? id->name : NULL;
+       int result, chip_type;
        struct regmap *regmap;
+       const char *name;
 
        if (!i2c_check_functionality(client->adapter,
                                     I2C_FUNC_SMBUS_I2C_BLOCK))
                return -EOPNOTSUPP;
 
+       if (id) {
+               chip_type = (int)id->driver_data;
+               name = id->name;
+       } else if (ACPI_HANDLE(&client->dev)) {
+               name = inv_mpu_match_acpi_device(&client->dev, &chip_type);
+               if (!name)
+                       return -ENODEV;
+       } else {
+               return -ENOSYS;
+       }
+
        regmap = devm_regmap_init_i2c(client, &inv_mpu_regmap_config);
        if (IS_ERR(regmap)) {
                dev_err(&client->dev, "Failed to register i2c regmap %d\n",
@@ -131,7 +155,7 @@ static int inv_mpu_probe(struct i2c_client *client,
        }
 
        result = inv_mpu_core_probe(regmap, client->irq, name,
-                                   NULL, id->driver_data);
+                                   NULL, chip_type);
        if (result < 0)
                return result;
 
index dea6c4361de013c38441100dc26078fd13393a89..7bcb8d839f0549a1a89c6291a78796841cf1db5c 100644 (file)
@@ -46,6 +46,7 @@ static int inv_mpu_probe(struct spi_device *spi)
        struct regmap *regmap;
        const struct spi_device_id *id = spi_get_device_id(spi);
        const char *name = id ? id->name : NULL;
+       const int chip_type = id ? id->driver_data : 0;
 
        regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config);
        if (IS_ERR(regmap)) {
@@ -55,7 +56,7 @@ static int inv_mpu_probe(struct spi_device *spi)
        }
 
        return inv_mpu_core_probe(regmap, spi->irq, name,
-                                 inv_mpu_i2c_disable, id->driver_data);
+                                 inv_mpu_i2c_disable, chip_type);
 }
 
 static int inv_mpu_remove(struct spi_device *spi)
index 9c5c9ef3f1dad25f37e108aeb9752940f46aa393..0e931a9a1669424278a1daa935a919e32db32e35 100644 (file)
@@ -462,6 +462,8 @@ static int ak8975_setup_irq(struct ak8975_data *data)
        int rc;
        int irq;
 
+       init_waitqueue_head(&data->data_ready_queue);
+       clear_bit(0, &data->flags);
        if (client->irq)
                irq = client->irq;
        else
@@ -477,8 +479,6 @@ static int ak8975_setup_irq(struct ak8975_data *data)
                return rc;
        }
 
-       init_waitqueue_head(&data->data_ready_queue);
-       clear_bit(0, &data->flags);
        data->eoc_irq = irq;
 
        return rc;
@@ -732,7 +732,7 @@ static int ak8975_probe(struct i2c_client *client,
        int eoc_gpio;
        int err;
        const char *name = NULL;
-       enum asahi_compass_chipset chipset;
+       enum asahi_compass_chipset chipset = AK_MAX_TYPE;
 
        /* Grab and set up the supplied GPIO. */
        if (client->dev.platform_data)
index 80b6bedc172f32a1d9dfad1e36ee8aa3a4a16240..64b3d11dcf1ed588a95d149f2bbd9ff884562893 100644 (file)
@@ -612,6 +612,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
        struct Scsi_Host *shost;
        struct iser_conn *iser_conn = NULL;
        struct ib_conn *ib_conn;
+       u32 max_fr_sectors;
        u16 max_cmds;
 
        shost = iscsi_host_alloc(&iscsi_iser_sht, 0, 0);
@@ -632,7 +633,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
                iser_conn = ep->dd_data;
                max_cmds = iser_conn->max_cmds;
                shost->sg_tablesize = iser_conn->scsi_sg_tablesize;
-               shost->max_sectors = iser_conn->scsi_max_sectors;
 
                mutex_lock(&iser_conn->state_mutex);
                if (iser_conn->state != ISER_CONN_UP) {
@@ -657,8 +657,6 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
                 */
                shost->sg_tablesize = min_t(unsigned short, shost->sg_tablesize,
                        ib_conn->device->ib_device->attrs.max_fast_reg_page_list_len);
-               shost->max_sectors = min_t(unsigned int,
-                       1024, (shost->sg_tablesize * PAGE_SIZE) >> 9);
 
                if (iscsi_host_add(shost,
                                   ib_conn->device->ib_device->dma_device)) {
@@ -672,6 +670,15 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
                        goto free_host;
        }
 
+       /*
+        * FRs or FMRs can only map up to a (device) page per entry, but if the
+        * first entry is misaligned we'll end up using using two entries
+        * (head and tail) for a single page worth data, so we have to drop
+        * one segment from the calculation.
+        */
+       max_fr_sectors = ((shost->sg_tablesize - 1) * PAGE_SIZE) >> 9;
+       shost->max_sectors = min(iser_max_sectors, max_fr_sectors);
+
        if (cmds_max > max_cmds) {
                iser_info("cmds_max changed from %u to %u\n",
                          cmds_max, max_cmds);
@@ -989,7 +996,6 @@ static struct scsi_host_template iscsi_iser_sht = {
        .queuecommand           = iscsi_queuecommand,
        .change_queue_depth     = scsi_change_queue_depth,
        .sg_tablesize           = ISCSI_ISER_DEF_SG_TABLESIZE,
-       .max_sectors            = ISER_DEF_MAX_SECTORS,
        .cmd_per_lun            = ISER_DEF_CMD_PER_LUN,
        .eh_abort_handler       = iscsi_eh_abort,
        .eh_device_reset_handler= iscsi_eh_device_reset,
index 53e33fab3f7afadef16e97a76271752d9d6d891c..df3581f606282a2890b8ce78cf13d9e4882c3c0a 100644 (file)
@@ -181,6 +181,14 @@ static void vibra_play_work(struct work_struct *work)
 {
        struct vibra_info *info = container_of(work,
                                struct vibra_info, play_work);
+       int ret;
+
+       /* Do not allow effect, while the routing is set to use audio */
+       ret = twl6040_get_vibralr_status(info->twl6040);
+       if (ret & TWL6040_VIBSEL) {
+               dev_info(info->dev, "Vibra is configured for audio\n");
+               return;
+       }
 
        mutex_lock(&info->mutex);
 
@@ -199,14 +207,6 @@ static int vibra_play(struct input_dev *input, void *data,
                      struct ff_effect *effect)
 {
        struct vibra_info *info = input_get_drvdata(input);
-       int ret;
-
-       /* Do not allow effect, while the routing is set to use audio */
-       ret = twl6040_get_vibralr_status(info->twl6040);
-       if (ret & TWL6040_VIBSEL) {
-               dev_info(&input->dev, "Vibra is configured for audio\n");
-               return -EBUSY;
-       }
 
        info->weak_speed = effect->u.rumble.weak_magnitude;
        info->strong_speed = effect->u.rumble.strong_magnitude;
index 2160512e861af57d289fb5873ef80b81c2fbf7c9..5af7907d0af4dd6ab79639ee91287cdf0bc90202 100644 (file)
@@ -1093,6 +1093,19 @@ static int mxt_t6_command(struct mxt_data *data, u16 cmd_offset,
        return 0;
 }
 
+static int mxt_acquire_irq(struct mxt_data *data)
+{
+       int error;
+
+       enable_irq(data->irq);
+
+       error = mxt_process_messages_until_invalid(data);
+       if (error)
+               return error;
+
+       return 0;
+}
+
 static int mxt_soft_reset(struct mxt_data *data)
 {
        struct device *dev = &data->client->dev;
@@ -1111,7 +1124,7 @@ static int mxt_soft_reset(struct mxt_data *data)
        /* Ignore CHG line for 100ms after reset */
        msleep(100);
 
-       enable_irq(data->irq);
+       mxt_acquire_irq(data);
 
        ret = mxt_wait_for_completion(data, &data->reset_completion,
                                      MXT_RESET_TIMEOUT);
@@ -1466,19 +1479,6 @@ release_mem:
        return ret;
 }
 
-static int mxt_acquire_irq(struct mxt_data *data)
-{
-       int error;
-
-       enable_irq(data->irq);
-
-       error = mxt_process_messages_until_invalid(data);
-       if (error)
-               return error;
-
-       return 0;
-}
-
 static int mxt_get_info(struct mxt_data *data)
 {
        struct i2c_client *client = data->client;
index 9bbadaaf6bc3723f044a9c44e8619773d242ec8f..7b3845aa5983ad57892a0022990f3353bcca82b6 100644 (file)
@@ -370,8 +370,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload)
                        point.coord_x = point.coord_y = 0;
                }
 
-               point.state = payload[9 * i + 5] & 0x03;
-               point.id = (payload[9 * i + 5] & 0xfc) >> 2;
+               point.state = payload[9 * i + 5] & 0x0f;
+               point.id = (payload[9 * i + 5] & 0xf0) >> 4;
 
                /* determine touch major, minor and orientation */
                point.area_major = max(payload[9 * i + 6],
index 194580fba7fd8b7a965ea87f9856cada61e15be6..14d3b37944df031214c2c6951ed15c46da104842 100644 (file)
@@ -284,6 +284,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
         * go away inside make_request
         */
        sectors = bio_sectors(bio);
+       /* bio could be mergeable after passing to underlayer */
+       bio->bi_rw &= ~REQ_NOMERGE;
        mddev->pers->make_request(mddev, bio);
 
        cpu = part_stat_lock();
index 2ea12c6bf65997895e26a89fe8977451ae438d97..34783a3c8b3c1af780a092b8d11018f702541481 100644 (file)
@@ -70,7 +70,6 @@ static void dump_zones(struct mddev *mddev)
                        (unsigned long long)zone_size>>1);
                zone_start = conf->strip_zone[j].zone_end;
        }
-       printk(KERN_INFO "\n");
 }
 
 static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
@@ -85,6 +84,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
        struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
        unsigned short blksize = 512;
 
+       *private_conf = ERR_PTR(-ENOMEM);
        if (!conf)
                return -ENOMEM;
        rdev_for_each(rdev1, mddev) {
index 8ab8b65e17413e4a015aab5e073728fd23e21b47..e48c262ce0322fe504d92d14403c70cb3ef4a608 100644 (file)
@@ -3502,8 +3502,6 @@ returnbi:
                                dev = &sh->dev[i];
                        } else if (test_bit(R5_Discard, &dev->flags))
                                discard_pending = 1;
-                       WARN_ON(test_bit(R5_SkipCopy, &dev->flags));
-                       WARN_ON(dev->page != dev->orig_page);
                }
 
        r5l_stripe_write_finished(sh);
index 6e43c95629ea8e8fc550b6fc63bf56b5c627b1ac..3cfd7af8c5cab06607a94c716951daa6166b60e2 100644 (file)
@@ -846,11 +846,11 @@ struct media_device *media_device_find_devres(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(media_device_find_devres);
 
+#if IS_ENABLED(CONFIG_PCI)
 void media_device_pci_init(struct media_device *mdev,
                           struct pci_dev *pci_dev,
                           const char *name)
 {
-#ifdef CONFIG_PCI
        mdev->dev = &pci_dev->dev;
 
        if (name)
@@ -866,16 +866,16 @@ void media_device_pci_init(struct media_device *mdev,
        mdev->driver_version = LINUX_VERSION_CODE;
 
        media_device_init(mdev);
-#endif
 }
 EXPORT_SYMBOL_GPL(media_device_pci_init);
+#endif
 
+#if IS_ENABLED(CONFIG_USB)
 void __media_device_usb_init(struct media_device *mdev,
                             struct usb_device *udev,
                             const char *board_name,
                             const char *driver_name)
 {
-#ifdef CONFIG_USB
        mdev->dev = &udev->dev;
 
        if (driver_name)
@@ -895,9 +895,9 @@ void __media_device_usb_init(struct media_device *mdev,
        mdev->driver_version = LINUX_VERSION_CODE;
 
        media_device_init(mdev);
-#endif
 }
 EXPORT_SYMBOL_GPL(__media_device_usb_init);
+#endif
 
 
 #endif /* CONFIG_MEDIA_CONTROLLER */
index feb521f28e14857b8344d7320769c87183cd17ac..4f494acd8150fd85f8aaedfb3572b85bb22b460d 100644 (file)
@@ -1446,22 +1446,13 @@ static int fimc_md_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, fmd);
 
-       /* Protect the media graph while we're registering entities */
-       mutex_lock(&fmd->media_dev.graph_mutex);
-
        ret = fimc_md_register_platform_entities(fmd, dev->of_node);
-       if (ret) {
-               mutex_unlock(&fmd->media_dev.graph_mutex);
+       if (ret)
                goto err_clk;
-       }
 
        ret = fimc_md_register_sensor_entities(fmd);
-       if (ret) {
-               mutex_unlock(&fmd->media_dev.graph_mutex);
+       if (ret)
                goto err_m_ent;
-       }
-
-       mutex_unlock(&fmd->media_dev.graph_mutex);
 
        ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode);
        if (ret)
index 0b44b9accf50794172ddb2249414883a1b125b43..af237af204e2760fc0efcaac6ac2dc31207ef662 100644 (file)
@@ -493,21 +493,17 @@ static int s3c_camif_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_sens;
 
-       mutex_lock(&camif->media_dev.graph_mutex);
-
        ret = v4l2_device_register_subdev_nodes(&camif->v4l2_dev);
        if (ret < 0)
-               goto err_unlock;
+               goto err_sens;
 
        ret = camif_register_video_nodes(camif);
        if (ret < 0)
-               goto err_unlock;
+               goto err_sens;
 
        ret = camif_create_media_links(camif);
        if (ret < 0)
-               goto err_unlock;
-
-       mutex_unlock(&camif->media_dev.graph_mutex);
+               goto err_sens;
 
        ret = media_device_register(&camif->media_dev);
        if (ret < 0)
@@ -516,8 +512,6 @@ static int s3c_camif_probe(struct platform_device *pdev)
        pm_runtime_put(dev);
        return 0;
 
-err_unlock:
-       mutex_unlock(&camif->media_dev.graph_mutex);
 err_sens:
        v4l2_device_unregister(&camif->v4l2_dev);
        media_device_unregister(&camif->media_dev);
index e94c7fb6712aab35a1a3278241c3bab494f68777..88e45234d527518e0d449d598c5f04a5be5538a1 100644 (file)
@@ -945,6 +945,11 @@ static long vop_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
                        ret = -EFAULT;
                        goto free_ret;
                }
+               /* Ensure desc has not changed between the two reads */
+               if (memcmp(&dd, dd_config, sizeof(dd))) {
+                       ret = -EINVAL;
+                       goto free_ret;
+               }
                mutex_lock(&vdev->vdev_mutex);
                mutex_lock(&vi->vop_mutex);
                ret = vop_virtio_add_device(vdev, dd_config);
index a2904029cccc2949b90d66cc8fb7d3fcbc11f103..5e572b3510b9483a6cf38a055ed473ab83776ab0 100644 (file)
@@ -2181,7 +2181,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
                               struct net_device *bridge)
 {
        struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-       int i, err;
+       int i, err = 0;
 
        mutex_lock(&ps->smi_mutex);
 
index 12a009d720cde6d85fd660c798616aee82be0ba9..72eb29ed0359e5fcac6c962ea46386aa5b050c88 100644 (file)
@@ -581,12 +581,30 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
        struct page *page;
        dma_addr_t mapping;
        u16 sw_prod = rxr->rx_sw_agg_prod;
+       unsigned int offset = 0;
 
-       page = alloc_page(gfp);
-       if (!page)
-               return -ENOMEM;
+       if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
+               page = rxr->rx_page;
+               if (!page) {
+                       page = alloc_page(gfp);
+                       if (!page)
+                               return -ENOMEM;
+                       rxr->rx_page = page;
+                       rxr->rx_page_offset = 0;
+               }
+               offset = rxr->rx_page_offset;
+               rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
+               if (rxr->rx_page_offset == PAGE_SIZE)
+                       rxr->rx_page = NULL;
+               else
+                       get_page(page);
+       } else {
+               page = alloc_page(gfp);
+               if (!page)
+                       return -ENOMEM;
+       }
 
-       mapping = dma_map_page(&pdev->dev, page, 0, PAGE_SIZE,
+       mapping = dma_map_page(&pdev->dev, page, offset, BNXT_RX_PAGE_SIZE,
                               PCI_DMA_FROMDEVICE);
        if (dma_mapping_error(&pdev->dev, mapping)) {
                __free_page(page);
@@ -601,6 +619,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
        rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod);
 
        rx_agg_buf->page = page;
+       rx_agg_buf->offset = offset;
        rx_agg_buf->mapping = mapping;
        rxbd->rx_bd_haddr = cpu_to_le64(mapping);
        rxbd->rx_bd_opaque = sw_prod;
@@ -642,6 +661,7 @@ static void bnxt_reuse_rx_agg_bufs(struct bnxt_napi *bnapi, u16 cp_cons,
                page = cons_rx_buf->page;
                cons_rx_buf->page = NULL;
                prod_rx_buf->page = page;
+               prod_rx_buf->offset = cons_rx_buf->offset;
 
                prod_rx_buf->mapping = cons_rx_buf->mapping;
 
@@ -709,7 +729,8 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
                            RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
 
                cons_rx_buf = &rxr->rx_agg_ring[cons];
-               skb_fill_page_desc(skb, i, cons_rx_buf->page, 0, frag_len);
+               skb_fill_page_desc(skb, i, cons_rx_buf->page,
+                                  cons_rx_buf->offset, frag_len);
                __clear_bit(cons, rxr->rx_agg_bmap);
 
                /* It is possible for bnxt_alloc_rx_page() to allocate
@@ -740,7 +761,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
                        return NULL;
                }
 
-               dma_unmap_page(&pdev->dev, mapping, PAGE_SIZE,
+               dma_unmap_page(&pdev->dev, mapping, BNXT_RX_PAGE_SIZE,
                               PCI_DMA_FROMDEVICE);
 
                skb->data_len += frag_len;
@@ -1584,13 +1605,17 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
 
                        dma_unmap_page(&pdev->dev,
                                       dma_unmap_addr(rx_agg_buf, mapping),
-                                      PAGE_SIZE, PCI_DMA_FROMDEVICE);
+                                      BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
 
                        rx_agg_buf->page = NULL;
                        __clear_bit(j, rxr->rx_agg_bmap);
 
                        __free_page(page);
                }
+               if (rxr->rx_page) {
+                       __free_page(rxr->rx_page);
+                       rxr->rx_page = NULL;
+               }
        }
 }
 
@@ -1973,7 +1998,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
        if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
                return 0;
 
-       type = ((u32)PAGE_SIZE << RX_BD_LEN_SHIFT) |
+       type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
                RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
 
        bnxt_init_rxbd_pages(ring, type);
@@ -2164,7 +2189,7 @@ void bnxt_set_ring_params(struct bnxt *bp)
        bp->rx_agg_nr_pages = 0;
 
        if (bp->flags & BNXT_FLAG_TPA)
-               agg_factor = 4;
+               agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
 
        bp->flags &= ~BNXT_FLAG_JUMBO;
        if (rx_space > PAGE_SIZE) {
@@ -3020,12 +3045,12 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags)
                /* Number of segs are log2 units, and first packet is not
                 * included as part of this units.
                 */
-               if (mss <= PAGE_SIZE) {
-                       n = PAGE_SIZE / mss;
+               if (mss <= BNXT_RX_PAGE_SIZE) {
+                       n = BNXT_RX_PAGE_SIZE / mss;
                        nsegs = (MAX_SKB_FRAGS - 1) * n;
                } else {
-                       n = mss / PAGE_SIZE;
-                       if (mss & (PAGE_SIZE - 1))
+                       n = mss / BNXT_RX_PAGE_SIZE;
+                       if (mss & (BNXT_RX_PAGE_SIZE - 1))
                                n++;
                        nsegs = (MAX_SKB_FRAGS - n) / n;
                }
@@ -4309,7 +4334,7 @@ static int bnxt_setup_int_mode(struct bnxt *bp)
        if (bp->flags & BNXT_FLAG_MSIX_CAP)
                rc = bnxt_setup_msix(bp);
 
-       if (!(bp->flags & BNXT_FLAG_USING_MSIX)) {
+       if (!(bp->flags & BNXT_FLAG_USING_MSIX) && BNXT_PF(bp)) {
                /* fallback to INTA */
                rc = bnxt_setup_inta(bp);
        }
index 709b95b8fcbad5742399607c9ec98a504ac05754..8b823ff558ffe2ab81422c0ce6bdfa61d3bc2b20 100644 (file)
@@ -407,6 +407,15 @@ struct rx_tpa_end_cmp_ext {
 
 #define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT)
 
+/* The RXBD length is 16-bit so we can only support page sizes < 64K */
+#if (PAGE_SHIFT > 15)
+#define BNXT_RX_PAGE_SHIFT 15
+#else
+#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT
+#endif
+
+#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT)
+
 #define BNXT_MIN_PKT_SIZE      45
 
 #define BNXT_NUM_TESTS(bp)     0
@@ -506,6 +515,7 @@ struct bnxt_sw_rx_bd {
 
 struct bnxt_sw_rx_agg_bd {
        struct page             *page;
+       unsigned int            offset;
        dma_addr_t              mapping;
 };
 
@@ -586,6 +596,9 @@ struct bnxt_rx_ring_info {
        unsigned long           *rx_agg_bmap;
        u16                     rx_agg_bmap_size;
 
+       struct page             *rx_page;
+       unsigned int            rx_page_offset;
+
        dma_addr_t              rx_desc_mapping[MAX_RX_PAGES];
        dma_addr_t              rx_agg_desc_mapping[MAX_RX_AGG_PAGES];
 
index 48a7d7dee8461117b3f47bcbdebe4c0745385bf7..a63551d0a18a4b63a5ea385a46fabef39b0d36a8 100644 (file)
@@ -441,7 +441,7 @@ static int macb_mii_init(struct macb *bp)
        snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
                bp->pdev->name, bp->pdev->id);
        bp->mii_bus->priv = bp;
-       bp->mii_bus->parent = &bp->dev->dev;
+       bp->mii_bus->parent = &bp->pdev->dev;
        pdata = dev_get_platdata(&bp->pdev->dev);
 
        dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
@@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp)
                                struct phy_device *phydev;
 
                                phydev = mdiobus_scan(bp->mii_bus, i);
-                               if (IS_ERR(phydev)) {
+                               if (IS_ERR(phydev) &&
+                                   PTR_ERR(phydev) != -ENODEV) {
                                        err = PTR_ERR(phydev);
                                        break;
                                }
@@ -3019,29 +3020,36 @@ static int macb_probe(struct platform_device *pdev)
        if (err)
                goto err_out_free_netdev;
 
+       err = macb_mii_init(bp);
+       if (err)
+               goto err_out_free_netdev;
+
+       phydev = bp->phy_dev;
+
+       netif_carrier_off(dev);
+
        err = register_netdev(dev);
        if (err) {
                dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
-               goto err_out_unregister_netdev;
+               goto err_out_unregister_mdio;
        }
 
-       err = macb_mii_init(bp);
-       if (err)
-               goto err_out_unregister_netdev;
-
-       netif_carrier_off(dev);
+       phy_attached_info(phydev);
 
        netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
                    macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
                    dev->base_addr, dev->irq, dev->dev_addr);
 
-       phydev = bp->phy_dev;
-       phy_attached_info(phydev);
-
        return 0;
 
-err_out_unregister_netdev:
-       unregister_netdev(dev);
+err_out_unregister_mdio:
+       phy_disconnect(bp->phy_dev);
+       mdiobus_unregister(bp->mii_bus);
+       mdiobus_free(bp->mii_bus);
+
+       /* Shutdown the PHY if there is a GPIO reset */
+       if (bp->reset_gpio)
+               gpiod_set_value(bp->reset_gpio, 0);
 
 err_out_free_netdev:
        free_netdev(dev);
index 60908eab3b3adf805d1b6cef462bd24ec5f64fe6..43da891fab97e7f16b572dd67f3fc6aa9020a1fb 100644 (file)
@@ -576,7 +576,7 @@ static void setup_rss(struct adapter *adap)
        unsigned int nq0 = adap2pinfo(adap, 0)->nqsets;
        unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1;
        u8 cpus[SGE_QSETS + 1];
-       u16 rspq_map[RSS_TABLE_SIZE];
+       u16 rspq_map[RSS_TABLE_SIZE + 1];
 
        for (i = 0; i < SGE_QSETS; ++i)
                cpus[i] = i;
@@ -586,6 +586,7 @@ static void setup_rss(struct adapter *adap)
                rspq_map[i] = i % nq0;
                rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0;
        }
+       rspq_map[RSS_TABLE_SIZE] = 0xffff; /* terminator */
 
        t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN |
                      F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN |
index 7fc490225da507de93c66c1b55eba3f0e5295e58..a6d26d351dfc47c777b39c04a44c2f17bca0feab 100644 (file)
@@ -3354,8 +3354,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
                /* Enable per-CPU interrupts on the CPU that is
                 * brought up.
                 */
-               smp_call_function_single(cpu, mvneta_percpu_enable,
-                                        pp, true);
+               mvneta_percpu_enable(pp);
 
                /* Enable per-CPU interrupt on the one CPU we care
                 * about.
@@ -3387,8 +3386,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
                /* Disable per-CPU interrupts on the CPU that is
                 * brought down.
                 */
-               smp_call_function_single(cpu, mvneta_percpu_disable,
-                                        pp, true);
+               mvneta_percpu_disable(pp);
 
                break;
        case CPU_DEAD:
index 7ace07dad6a31d4b18ab5aa1e5335c0727cff596..c442f6ad15fff806af5f747e70d085766dd37ae9 100644 (file)
@@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_device *dev)
                return 0;
 
        pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
+       if (IS_ERR(pep->phy))
+               return PTR_ERR(pep->phy);
        if (!pep->phy)
                return -ENODEV;
 
index 1cf722eba607d82e8e34ff498e1b154f8fc8cc5d..559d11a443bc4973aae435e611f45ee014cf41fb 100644 (file)
@@ -14,6 +14,7 @@ config MLX5_CORE_EN
        bool "Mellanox Technologies ConnectX-4 Ethernet support"
        depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
        select PTP_1588_CLOCK
+       select VXLAN if MLX5_CORE=y
        default n
        ---help---
          Ethernet support in Mellanox Technologies ConnectX-4 NIC.
index e80ce94b5dcf0e139b629732da3658892ca8590d..3881dce0cc30b6829c8a850ce9ff887024d665a9 100644 (file)
@@ -567,6 +567,7 @@ struct mlx5e_priv {
        struct mlx5e_vxlan_db      vxlan;
 
        struct mlx5e_params        params;
+       struct workqueue_struct    *wq;
        struct work_struct         update_carrier_work;
        struct work_struct         set_rx_mode_work;
        struct delayed_work        update_stats_work;
index 67d548b70e142a376d0fc802a4576ee965f92520..d4dfc5ce516a41daf2f668aa3015c37ff4b73853 100644 (file)
@@ -262,9 +262,8 @@ static void mlx5e_update_stats_work(struct work_struct *work)
        mutex_lock(&priv->state_lock);
        if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
                mlx5e_update_stats(priv);
-               schedule_delayed_work(dwork,
-                                     msecs_to_jiffies(
-                                             MLX5E_UPDATE_STATS_INTERVAL));
+               queue_delayed_work(priv->wq, dwork,
+                                  msecs_to_jiffies(MLX5E_UPDATE_STATS_INTERVAL));
        }
        mutex_unlock(&priv->state_lock);
 }
@@ -280,7 +279,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
        switch (event) {
        case MLX5_DEV_EVENT_PORT_UP:
        case MLX5_DEV_EVENT_PORT_DOWN:
-               schedule_work(&priv->update_carrier_work);
+               queue_work(priv->wq, &priv->update_carrier_work);
                break;
 
        default:
@@ -1505,7 +1504,7 @@ int mlx5e_open_locked(struct net_device *netdev)
        mlx5e_update_carrier(priv);
        mlx5e_timestamp_init(priv);
 
-       schedule_delayed_work(&priv->update_stats_work, 0);
+       queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
 
        return 0;
 
@@ -1961,7 +1960,7 @@ static void mlx5e_set_rx_mode(struct net_device *dev)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
 
-       schedule_work(&priv->set_rx_mode_work);
+       queue_work(priv->wq, &priv->set_rx_mode_work);
 }
 
 static int mlx5e_set_mac(struct net_device *netdev, void *addr)
@@ -1976,7 +1975,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr)
        ether_addr_copy(netdev->dev_addr, saddr->sa_data);
        netif_addr_unlock_bh(netdev);
 
-       schedule_work(&priv->set_rx_mode_work);
+       queue_work(priv->wq, &priv->set_rx_mode_work);
 
        return 0;
 }
@@ -2158,7 +2157,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev,
        if (!mlx5e_vxlan_allowed(priv->mdev))
                return;
 
-       mlx5e_vxlan_add_port(priv, be16_to_cpu(port));
+       mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 1);
 }
 
 static void mlx5e_del_vxlan_port(struct net_device *netdev,
@@ -2169,7 +2168,7 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev,
        if (!mlx5e_vxlan_allowed(priv->mdev))
                return;
 
-       mlx5e_vxlan_del_port(priv, be16_to_cpu(port));
+       mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0);
 }
 
 static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv,
@@ -2498,10 +2497,14 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
 
        priv = netdev_priv(netdev);
 
+       priv->wq = create_singlethread_workqueue("mlx5e");
+       if (!priv->wq)
+               goto err_free_netdev;
+
        err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false);
        if (err) {
                mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err);
-               goto err_free_netdev;
+               goto err_destroy_wq;
        }
 
        err = mlx5_core_alloc_pd(mdev, &priv->pdn);
@@ -2580,7 +2583,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev)
                vxlan_get_rx_port(netdev);
 
        mlx5e_enable_async_events(priv);
-       schedule_work(&priv->set_rx_mode_work);
+       queue_work(priv->wq, &priv->set_rx_mode_work);
 
        return priv;
 
@@ -2617,6 +2620,9 @@ err_dealloc_pd:
 err_unmap_free_uar:
        mlx5_unmap_free_uar(mdev, &priv->cq_uar);
 
+err_destroy_wq:
+       destroy_workqueue(priv->wq);
+
 err_free_netdev:
        free_netdev(netdev);
 
@@ -2630,9 +2636,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
 
        set_bit(MLX5E_STATE_DESTROYING, &priv->state);
 
-       schedule_work(&priv->set_rx_mode_work);
+       queue_work(priv->wq, &priv->set_rx_mode_work);
        mlx5e_disable_async_events(priv);
-       flush_scheduled_work();
+       flush_workqueue(priv->wq);
        if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) {
                netif_device_detach(netdev);
                mutex_lock(&priv->state_lock);
@@ -2655,6 +2661,8 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv)
        mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn);
        mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
        mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
+       cancel_delayed_work_sync(&priv->update_stats_work);
+       destroy_workqueue(priv->wq);
 
        if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state))
                free_netdev(netdev);
index 8ba080e441a1863e63d4188820afbd2f1c39bd6e..5ff8af472bf5221e736e5369b4de73bfe996b0e9 100644 (file)
@@ -269,8 +269,10 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar);
 
 void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
 {
-       iounmap(uar->map);
-       iounmap(uar->bf_map);
+       if (uar->map)
+               iounmap(uar->map);
+       else
+               iounmap(uar->bf_map);
        mlx5_cmd_free_uar(mdev, uar->index);
 }
 EXPORT_SYMBOL(mlx5_unmap_free_uar);
index 9f10df25f3cd52d9f631fd1e0963483eb1e7073a..f2fd1ef16da7eba68deb5af1648b7ff28cf7ff44 100644 (file)
@@ -95,21 +95,22 @@ struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port)
        return vxlan;
 }
 
-int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
+static void mlx5e_vxlan_add_port(struct work_struct *work)
 {
+       struct mlx5e_vxlan_work *vxlan_work =
+               container_of(work, struct mlx5e_vxlan_work, work);
+       struct mlx5e_priv *priv = vxlan_work->priv;
        struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan;
+       u16 port = vxlan_work->port;
        struct mlx5e_vxlan *vxlan;
        int err;
 
-       err = mlx5e_vxlan_core_add_port_cmd(priv->mdev, port);
-       if (err)
-               return err;
+       if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port))
+               goto free_work;
 
        vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL);
-       if (!vxlan) {
-               err = -ENOMEM;
+       if (!vxlan)
                goto err_delete_port;
-       }
 
        vxlan->udp_port = port;
 
@@ -119,13 +120,14 @@ int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
        if (err)
                goto err_free;
 
-       return 0;
+       goto free_work;
 
 err_free:
        kfree(vxlan);
 err_delete_port:
        mlx5e_vxlan_core_del_port_cmd(priv->mdev, port);
-       return err;
+free_work:
+       kfree(vxlan_work);
 }
 
 static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
@@ -145,12 +147,36 @@ static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
        kfree(vxlan);
 }
 
-void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port)
+static void mlx5e_vxlan_del_port(struct work_struct *work)
 {
-       if (!mlx5e_vxlan_lookup_port(priv, port))
-               return;
+       struct mlx5e_vxlan_work *vxlan_work =
+               container_of(work, struct mlx5e_vxlan_work, work);
+       struct mlx5e_priv *priv = vxlan_work->priv;
+       u16 port = vxlan_work->port;
 
        __mlx5e_vxlan_core_del_port(priv, port);
+
+       kfree(vxlan_work);
+}
+
+void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
+                           u16 port, int add)
+{
+       struct mlx5e_vxlan_work *vxlan_work;
+
+       vxlan_work = kmalloc(sizeof(*vxlan_work), GFP_ATOMIC);
+       if (!vxlan_work)
+               return;
+
+       if (add)
+               INIT_WORK(&vxlan_work->work, mlx5e_vxlan_add_port);
+       else
+               INIT_WORK(&vxlan_work->work, mlx5e_vxlan_del_port);
+
+       vxlan_work->priv = priv;
+       vxlan_work->port = port;
+       vxlan_work->sa_family = sa_family;
+       queue_work(priv->wq, &vxlan_work->work);
 }
 
 void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv)
index a01685056ab156201c1945607e34bb7b53771ee3..129f3527aa147ca8cf02b7df2128b7cfeaadfecf 100644 (file)
@@ -39,6 +39,13 @@ struct mlx5e_vxlan {
        u16 udp_port;
 };
 
+struct mlx5e_vxlan_work {
+       struct work_struct      work;
+       struct mlx5e_priv       *priv;
+       sa_family_t             sa_family;
+       u16                     port;
+};
+
 static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
 {
        return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) &&
@@ -46,8 +53,8 @@ static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
 }
 
 void mlx5e_vxlan_init(struct mlx5e_priv *priv);
-int  mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port);
-void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port);
+void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
+                           u16 port, int add);
 struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port);
 void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv);
 
index 270c9eeb7ab622955d237ae9cd96cadc5caa5f3a..6d1a956e3f779d57e83a8fd40a5136919231df2c 100644 (file)
@@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev)
 
        del_timer_sync(&mgp->watchdog_timer);
        mgp->running = MYRI10GE_ETH_STOPPING;
-       local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
        for (i = 0; i < mgp->num_slices; i++) {
                napi_disable(&mgp->ss[i].napi);
+               local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
                /* Lock the slice to prevent the busy_poll handler from
                 * accessing it.  Later when we bring the NIC up, myri10ge_open
                 * resets the slice including this lock.
@@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev)
                        pr_info("Slice %d locked\n", i);
                        mdelay(1);
                }
+               local_bh_enable();
        }
-       local_bh_enable();
        netif_carrier_off(dev);
 
        netif_tx_stop_all_queues(dev);
index 98d33d462c6ca0f6b78499cde0b8d3e2b51f8b07..1681084cc96f8270d36e55d9ede099a58632566a 100644 (file)
@@ -1920,6 +1920,10 @@ static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context,
                return 0;
        }
 
+       if (nic_data->datapath_caps &
+           1 << MC_CMD_GET_CAPABILITIES_OUT_RX_RSS_LIMITED_LBN)
+               return -EOPNOTSUPP;
+
        MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
                       nic_data->vport_id);
        MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type);
@@ -2923,9 +2927,16 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
                                      bool replacing)
 {
        struct efx_ef10_nic_data *nic_data = efx->nic_data;
+       u32 flags = spec->flags;
 
        memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN);
 
+       /* Remove RSS flag if we don't have an RSS context. */
+       if (flags & EFX_FILTER_FLAG_RX_RSS &&
+           spec->rss_context == EFX_FILTER_RSS_CONTEXT_DEFAULT &&
+           nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID)
+               flags &= ~EFX_FILTER_FLAG_RX_RSS;
+
        if (replacing) {
                MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
                               MC_CMD_FILTER_OP_IN_OP_REPLACE);
@@ -2985,10 +2996,10 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx,
                       spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
                       0 : spec->dmaq_id);
        MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE,
-                      (spec->flags & EFX_FILTER_FLAG_RX_RSS) ?
+                      (flags & EFX_FILTER_FLAG_RX_RSS) ?
                       MC_CMD_FILTER_OP_IN_RX_MODE_RSS :
                       MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE);
-       if (spec->flags & EFX_FILTER_FLAG_RX_RSS)
+       if (flags & EFX_FILTER_FLAG_RX_RSS)
                MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT,
                               spec->rss_context !=
                               EFX_FILTER_RSS_CONTEXT_DEFAULT ?
index bbb77cd8ad6776df47d01549cceb7165735c15f0..e2fcdf1eec441939af5e59dc2a581de2ebd02694 100644 (file)
@@ -367,7 +367,6 @@ struct cpsw_priv {
        spinlock_t                      lock;
        struct platform_device          *pdev;
        struct net_device               *ndev;
-       struct device_node              *phy_node;
        struct napi_struct              napi_rx;
        struct napi_struct              napi_tx;
        struct device                   *dev;
@@ -1148,25 +1147,34 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
                cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
                                   1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
 
-       if (priv->phy_node)
-               slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
+       if (slave->data->phy_node) {
+               slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
                                 &cpsw_adjust_link, 0, slave->data->phy_if);
-       else
+               if (!slave->phy) {
+                       dev_err(priv->dev, "phy \"%s\" not found on slave %d\n",
+                               slave->data->phy_node->full_name,
+                               slave->slave_num);
+                       return;
+               }
+       } else {
                slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
                                 &cpsw_adjust_link, slave->data->phy_if);
-       if (IS_ERR(slave->phy)) {
-               dev_err(priv->dev, "phy %s not found on slave %d\n",
-                       slave->data->phy_id, slave->slave_num);
-               slave->phy = NULL;
-       } else {
-               phy_attached_info(slave->phy);
+               if (IS_ERR(slave->phy)) {
+                       dev_err(priv->dev,
+                               "phy \"%s\" not found on slave %d, err %ld\n",
+                               slave->data->phy_id, slave->slave_num,
+                               PTR_ERR(slave->phy));
+                       slave->phy = NULL;
+                       return;
+               }
+       }
 
-               phy_start(slave->phy);
+       phy_attached_info(slave->phy);
 
-               /* Configure GMII_SEL register */
-               cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface,
-                            slave->slave_num);
-       }
+       phy_start(slave->phy);
+
+       /* Configure GMII_SEL register */
+       cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, slave->slave_num);
 }
 
 static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
@@ -1940,12 +1948,11 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,
        slave->port_vlan = data->dual_emac_res_vlan;
 }
 
-static int cpsw_probe_dt(struct cpsw_priv *priv,
+static int cpsw_probe_dt(struct cpsw_platform_data *data,
                         struct platform_device *pdev)
 {
        struct device_node *node = pdev->dev.of_node;
        struct device_node *slave_node;
-       struct cpsw_platform_data *data = &priv->data;
        int i = 0, ret;
        u32 prop;
 
@@ -2033,25 +2040,21 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
                if (strcmp(slave_node->name, "slave"))
                        continue;
 
-               priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
+               slave_data->phy_node = of_parse_phandle(slave_node,
+                                                       "phy-handle", 0);
                parp = of_get_property(slave_node, "phy_id", &lenp);
-               if (of_phy_is_fixed_link(slave_node)) {
-                       struct device_node *phy_node;
-                       struct phy_device *phy_dev;
-
+               if (slave_data->phy_node) {
+                       dev_dbg(&pdev->dev,
+                               "slave[%d] using phy-handle=\"%s\"\n",
+                               i, slave_data->phy_node->full_name);
+               } else if (of_phy_is_fixed_link(slave_node)) {
                        /* In the case of a fixed PHY, the DT node associated
                         * to the PHY is the Ethernet MAC DT node.
                         */
                        ret = of_phy_register_fixed_link(slave_node);
                        if (ret)
                                return ret;
-                       phy_node = of_node_get(slave_node);
-                       phy_dev = of_phy_find_device(phy_node);
-                       if (!phy_dev)
-                               return -ENODEV;
-                       snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
-                                PHY_ID_FMT, phy_dev->mdio.bus->id,
-                                phy_dev->mdio.addr);
+                       slave_data->phy_node = of_node_get(slave_node);
                } else if (parp) {
                        u32 phyid;
                        struct device_node *mdio_node;
@@ -2072,7 +2075,9 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
                        snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
                                 PHY_ID_FMT, mdio->name, phyid);
                } else {
-                       dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
+                       dev_err(&pdev->dev,
+                               "No slave[%d] phy_id, phy-handle, or fixed-link property\n",
+                               i);
                        goto no_phy_slave;
                }
                slave_data->phy_if = of_get_phy_mode(slave_node);
@@ -2275,7 +2280,7 @@ static int cpsw_probe(struct platform_device *pdev)
        /* Select default pin state */
        pinctrl_pm_select_default_state(&pdev->dev);
 
-       if (cpsw_probe_dt(priv, pdev)) {
+       if (cpsw_probe_dt(&priv->data, pdev)) {
                dev_err(&pdev->dev, "cpsw: platform data missing\n");
                ret = -ENODEV;
                goto clean_runtime_disable_ret;
index 442a7038e660c877b1cc7509efab7df214a25a87..e50afd1b2eda09d87a94b100646d774de52f32b5 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/phy.h>
 
 struct cpsw_slave_data {
+       struct device_node *phy_node;
        char            phy_id[MII_BUS_ID_SIZE];
        int             phy_if;
        u8              mac_addr[ETH_ALEN];
index 58d58f002559f627040a8bfb3fa452f671c62e44..f56d66e6ec155194e1f432ee42950d9db915c697 100644 (file)
@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
 
        /* TODO: Add phy read and write and private statistics get feature */
 
-       return phy_mii_ioctl(priv->phydev, ifrq, cmd);
+       if (priv->phydev)
+               return phy_mii_ioctl(priv->phydev, ifrq, cmd);
+       else
+               return -EOPNOTSUPP;
 }
 
 static int match_first_device(struct device *dev, void *data)
index 13214a6492ac5b1eced4d39c21b7736f5dcf19d4..743b18266a7c2b2be2b33f2d3f7fea0f9b80e361 100644 (file)
@@ -1622,7 +1622,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
                        continue;
 
                /* copy hw scan info */
-               memcpy(target->hwinfo, scan_info, scan_info->size);
+               memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
                target->essid_len = strnlen(scan_info->essid,
                                            sizeof(scan_info->essid));
                target->rate_len = 0;
index b3ffaee3085885e02a2556f5d34517320a875f1b..f279a897a5c7fe0e875fb8b058f4c00ae3059f62 100644 (file)
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev)
         * in the FIFO. In such cases, the FIFO enters an error mode it
         * cannot recover from by software.
         */
-       if (phydev->drv->phy_id == ATH8030_PHY_ID) {
-               if (phydev->state == PHY_NOLINK) {
-                       if (priv->gpiod_reset && !priv->phy_reset) {
-                               struct at803x_context context;
-
-                               at803x_context_save(phydev, &context);
-
-                               gpiod_set_value(priv->gpiod_reset, 1);
-                               msleep(1);
-                               gpiod_set_value(priv->gpiod_reset, 0);
-                               msleep(1);
-
-                               at803x_context_restore(phydev, &context);
-
-                               phydev_dbg(phydev, "%s(): phy was reset\n",
-                                          __func__);
-                               priv->phy_reset = true;
-                       }
-               } else {
-                       priv->phy_reset = false;
+       if (phydev->state == PHY_NOLINK) {
+               if (priv->gpiod_reset && !priv->phy_reset) {
+                       struct at803x_context context;
+
+                       at803x_context_save(phydev, &context);
+
+                       gpiod_set_value(priv->gpiod_reset, 1);
+                       msleep(1);
+                       gpiod_set_value(priv->gpiod_reset, 0);
+                       msleep(1);
+
+                       at803x_context_restore(phydev, &context);
+
+                       phydev_dbg(phydev, "%s(): phy was reset\n",
+                                  __func__);
+                       priv->phy_reset = true;
                }
+       } else {
+               priv->phy_reset = false;
        }
 }
 
@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = {
        .phy_id_mask            = 0xffffffef,
        .probe                  = at803x_probe,
        .config_init            = at803x_config_init,
-       .link_change_notify     = at803x_link_change_notify,
        .set_wol                = at803x_set_wol,
        .get_wol                = at803x_get_wol,
        .suspend                = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = {
        .phy_id_mask            = 0xffffffef,
        .probe                  = at803x_probe,
        .config_init            = at803x_config_init,
-       .link_change_notify     = at803x_link_change_notify,
        .set_wol                = at803x_set_wol,
        .get_wol                = at803x_get_wol,
        .suspend                = at803x_suspend,
index f20890ee03f33368fd68c6b5fb82f8fd76fa4310..f64778ad97535118d5b0705c1a5afa04ab57677c 100644 (file)
@@ -269,6 +269,7 @@ struct skb_data {           /* skb->cb is one of these */
        struct lan78xx_net *dev;
        enum skb_state state;
        size_t length;
+       int num_of_packet;
 };
 
 struct usb_context {
@@ -1803,7 +1804,34 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev)
 
 static void lan78xx_link_status_change(struct net_device *net)
 {
-       /* nothing to do */
+       struct phy_device *phydev = net->phydev;
+       int ret, temp;
+
+       /* At forced 100 F/H mode, chip may fail to set mode correctly
+        * when cable is switched between long(~50+m) and short one.
+        * As workaround, set to 10 before setting to 100
+        * at forced 100 F/H mode.
+        */
+       if (!phydev->autoneg && (phydev->speed == 100)) {
+               /* disable phy interrupt */
+               temp = phy_read(phydev, LAN88XX_INT_MASK);
+               temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
+               ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
+
+               temp = phy_read(phydev, MII_BMCR);
+               temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
+               phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
+               temp |= BMCR_SPEED100;
+               phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
+
+               /* clear pending interrupt generated while workaround */
+               temp = phy_read(phydev, LAN88XX_INT_STS);
+
+               /* enable phy interrupt back */
+               temp = phy_read(phydev, LAN88XX_INT_MASK);
+               temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
+               ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
+       }
 }
 
 static int lan78xx_phy_init(struct lan78xx_net *dev)
@@ -2464,7 +2492,7 @@ static void tx_complete(struct urb *urb)
        struct lan78xx_net *dev = entry->dev;
 
        if (urb->status == 0) {
-               dev->net->stats.tx_packets++;
+               dev->net->stats.tx_packets += entry->num_of_packet;
                dev->net->stats.tx_bytes += entry->length;
        } else {
                dev->net->stats.tx_errors++;
@@ -2681,10 +2709,11 @@ void lan78xx_skb_return(struct lan78xx_net *dev, struct sk_buff *skb)
                return;
        }
 
-       skb->protocol = eth_type_trans(skb, dev->net);
        dev->net->stats.rx_packets++;
        dev->net->stats.rx_bytes += skb->len;
 
+       skb->protocol = eth_type_trans(skb, dev->net);
+
        netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
                  skb->len + sizeof(struct ethhdr), skb->protocol);
        memset(skb->cb, 0, sizeof(struct skb_data));
@@ -2934,13 +2963,16 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
 
        skb_totallen = 0;
        pkt_cnt = 0;
+       count = 0;
+       length = 0;
        for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) {
                if (skb_is_gso(skb)) {
                        if (pkt_cnt) {
                                /* handle previous packets first */
                                break;
                        }
-                       length = skb->len;
+                       count = 1;
+                       length = skb->len - TX_OVERHEAD;
                        skb2 = skb_dequeue(tqp);
                        goto gso_skb;
                }
@@ -2961,14 +2993,13 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev)
        for (count = pos = 0; count < pkt_cnt; count++) {
                skb2 = skb_dequeue(tqp);
                if (skb2) {
+                       length += (skb2->len - TX_OVERHEAD);
                        memcpy(skb->data + pos, skb2->data, skb2->len);
                        pos += roundup(skb2->len, sizeof(u32));
                        dev_kfree_skb(skb2);
                }
        }
 
-       length = skb_totallen;
-
 gso_skb:
        urb = usb_alloc_urb(0, GFP_ATOMIC);
        if (!urb) {
@@ -2980,6 +3011,7 @@ gso_skb:
        entry->urb = urb;
        entry->dev = dev;
        entry->length = length;
+       entry->num_of_packet = count;
 
        spin_lock_irqsave(&dev->txq.lock, flags);
        ret = usb_autopm_get_interface_async(dev->intf);
index f840802159158b56a5b840d7abb83152fcd0c83f..82129eef77748f25ffe05f4754f4f6df81e3e8cd 100644 (file)
@@ -411,7 +411,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
        int ret;
 
        read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
-       data[0] = 0xc9;
+       data[0] = 0xc8; /* TX & RX enable, append status, no CRC */
        data[1] = 0;
        if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL))
                data[1] |= 0x20;        /* set full duplex */
@@ -497,7 +497,7 @@ static void read_bulk_callback(struct urb *urb)
                pkt_len = buf[count - 3] << 8;
                pkt_len += buf[count - 4];
                pkt_len &= 0xfff;
-               pkt_len -= 8;
+               pkt_len -= 4;
        }
 
        /*
@@ -528,7 +528,7 @@ static void read_bulk_callback(struct urb *urb)
 goon:
        usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
                          usb_rcvbulkpipe(pegasus->usb, 1),
-                         pegasus->rx_skb->data, PEGASUS_MTU + 8,
+                         pegasus->rx_skb->data, PEGASUS_MTU,
                          read_bulk_callback, pegasus);
        rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
        if (rx_status == -ENODEV)
@@ -569,7 +569,7 @@ static void rx_fixup(unsigned long data)
        }
        usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
                          usb_rcvbulkpipe(pegasus->usb, 1),
-                         pegasus->rx_skb->data, PEGASUS_MTU + 8,
+                         pegasus->rx_skb->data, PEGASUS_MTU,
                          read_bulk_callback, pegasus);
 try_again:
        status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
@@ -823,7 +823,7 @@ static int pegasus_open(struct net_device *net)
 
        usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
                          usb_rcvbulkpipe(pegasus->usb, 1),
-                         pegasus->rx_skb->data, PEGASUS_MTU + 8,
+                         pegasus->rx_skb->data, PEGASUS_MTU,
                          read_bulk_callback, pegasus);
        if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
                if (res == -ENODEV)
index 30033dbe666263f12ed05cbe7d2fe1e924b156e4..c369db99c005bd69e73217a60bfa87458ebeec9b 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/of_net.h>
 #include "smsc75xx.h"
 
 #define SMSC_CHIPNAME                  "smsc75xx"
@@ -761,6 +762,15 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 
 static void smsc75xx_init_mac_address(struct usbnet *dev)
 {
+       const u8 *mac_addr;
+
+       /* maybe the boot loader passed the MAC address in devicetree */
+       mac_addr = of_get_mac_address(dev->udev->dev.of_node);
+       if (mac_addr) {
+               memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
+               return;
+       }
+
        /* try reading mac address from EEPROM */
        if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
                        dev->net->dev_addr) == 0) {
@@ -772,7 +782,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
                }
        }
 
-       /* no eeprom, or eeprom values are invalid. generate random MAC */
+       /* no useful static MAC address found. generate a random one */
        eth_hw_addr_random(dev->net);
        netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
 }
index 66b3ab9f614eb07edb05757ee333e998f7841f7d..2edc2bc6d1b9fb3201a5f4d564dffed93e30bddc 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/of_net.h>
 #include "smsc95xx.h"
 
 #define SMSC_CHIPNAME                  "smsc95xx"
@@ -765,6 +766,15 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 
 static void smsc95xx_init_mac_address(struct usbnet *dev)
 {
+       const u8 *mac_addr;
+
+       /* maybe the boot loader passed the MAC address in devicetree */
+       mac_addr = of_get_mac_address(dev->udev->dev.of_node);
+       if (mac_addr) {
+               memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
+               return;
+       }
+
        /* try reading mac address from EEPROM */
        if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
                        dev->net->dev_addr) == 0) {
@@ -775,7 +785,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
                }
        }
 
-       /* no eeprom, or eeprom values are invalid. generate random MAC */
+       /* no useful static MAC address found. generate a random one */
        eth_hw_addr_random(dev->net);
        netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
 }
index 8f8793004b9f021c7f689e13dabcf32f10e2c3a0..1b271b99c49eee91a96639ee019d370f61d0cda0 100644 (file)
@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
        };
        static const int inc[4] = { 0, 100, 0, 0 };
 
+       memset(&mask_m, 0, sizeof(int8_t) * 123);
+       memset(&mask_p, 0, sizeof(int8_t) * 123);
+
        cur_bin = -6000;
        upper = bin + 100;
        lower = bin - 100;
@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah,
        int tmp, new;
        int i;
 
-       int8_t mask_m[123];
-       int8_t mask_p[123];
        int cur_bb_spur;
        bool is2GHz = IS_CHAN_2GHZ(chan);
 
-       memset(&mask_m, 0, sizeof(int8_t) * 123);
-       memset(&mask_p, 0, sizeof(int8_t) * 123);
-
        for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
                cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
                if (AR_NO_SPUR == cur_bb_spur)
index db6624527d9959d3ffd10a32f3fa76cb0b6dff83..53d7445a5d12c1edaaf012e4e853560ec1f75e39 100644 (file)
@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah,
        int i;
        struct chan_centers centers;
 
-       int8_t mask_m[123];
-       int8_t mask_p[123];
        int cur_bb_spur;
        bool is2GHz = IS_CHAN_2GHZ(chan);
 
-       memset(&mask_m, 0, sizeof(int8_t) * 123);
-       memset(&mask_p, 0, sizeof(int8_t) * 123);
-
        ath9k_hw_get_channel_centers(ah, chan, &centers);
        freq = centers.synth_center;
 
index 97be104d12030f194a07ab67b5f0e0b8ee15f3e6..b5c57eebf995301e023e683fb672afb6876924b6 100644 (file)
@@ -93,7 +93,7 @@
 #define IWL8260_SMEM_OFFSET            0x400000
 #define IWL8260_SMEM_LEN               0x68000
 
-#define IWL8000_FW_PRE "iwlwifi-8000"
+#define IWL8000_FW_PRE "iwlwifi-8000C-"
 #define IWL8000_MODULE_FIRMWARE(api) \
        IWL8000_FW_PRE "-" __stringify(api) ".ucode"
 
index f899666acb41f44f56a326f5b0bfcff6dce88bde..9e45bf9c60715c523a2af0729713c8726783fa2c 100644 (file)
@@ -238,19 +238,6 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
        snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
                 name_pre, tag);
 
-       /*
-        * Starting 8000B - FW name format has changed. This overwrites the
-        * previous name and uses the new format.
-        */
-       if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
-               char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev);
-
-               if (rev_step != 'A')
-                       snprintf(drv->firmware_name,
-                                sizeof(drv->firmware_name), "%s%c-%s.ucode",
-                                name_pre, rev_step, tag);
-       }
-
        IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
                       (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
                                ? "EXPERIMENTAL " : "",
@@ -1060,11 +1047,18 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
                return -EINVAL;
        }
 
-       if (WARN(fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
-                !gscan_capa,
-                "GSCAN is supported but capabilities TLV is unavailable\n"))
+       /*
+        * If ucode advertises that it supports GSCAN but GSCAN
+        * capabilities TLV is not present, or if it has an old format,
+        * warn and continue without GSCAN.
+        */
+       if (fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
+           !gscan_capa) {
+               IWL_DEBUG_INFO(drv,
+                              "GSCAN is supported but capabilities TLV is unavailable\n");
                __clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT,
                            capa->_capa);
+       }
 
        return 0;
 
index 4856eac120f60d5eff2e9707e828e541761a76ae..6938cd37be57c6e48ae9efc4d559b58845fd705c 100644 (file)
@@ -526,7 +526,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
                file_len += sizeof(*dump_data) + sizeof(*dump_mem) + sram2_len;
 
        /* Make room for fw's virtual image pages, if it exists */
-       if (mvm->fw->img[mvm->cur_ucode].paging_mem_size)
+       if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
+           mvm->fw_paging_db[0].fw_paging_block)
                file_len += mvm->num_of_paging_blk *
                        (sizeof(*dump_data) +
                         sizeof(struct iwl_fw_error_dump_paging) +
@@ -643,7 +644,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
        }
 
        /* Dump fw's virtual image */
-       if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) {
+       if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
+           mvm->fw_paging_db[0].fw_paging_block) {
                for (i = 1; i < mvm->num_of_paging_blk + 1; i++) {
                        struct iwl_fw_error_dump_paging *paging;
                        struct page *pages =
index 594cd0dc7df937d8b495f9c2864de13ed51f795d..09d895fafaf29dbf2de1cb824c0c02ae068acc96 100644 (file)
@@ -144,9 +144,11 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm)
 
                __free_pages(mvm->fw_paging_db[i].fw_paging_block,
                             get_order(mvm->fw_paging_db[i].fw_paging_size));
+               mvm->fw_paging_db[i].fw_paging_block = NULL;
        }
        kfree(mvm->trans->paging_download_buf);
        mvm->trans->paging_download_buf = NULL;
+       mvm->trans->paging_db = NULL;
 
        memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db));
 }
index 05b968506836af92426ee275d8efb35dc78c64cb..79d7cd7d461e49afda911356928b253f3c0ab794 100644 (file)
@@ -479,8 +479,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
        {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)},
        {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)},
        {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x9010, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x8110, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x8050, iwl8265_2ac_cfg)},
        {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)},
        {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)},
+       {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)},
 
 /* 9000 Series */
        {IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
index f798899338eddb6955c06f5b44c26c405dffdade..5101f3ab4f296a2edc0a290fc4ab87a3ba12f9bb 100644 (file)
@@ -397,10 +397,17 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
         */
        start += start_pad;
        npfns = (pmem->size - start_pad - end_trunc - SZ_8K) / SZ_4K;
-       if (nd_pfn->mode == PFN_MODE_PMEM)
-               offset = ALIGN(start + SZ_8K + 64 * npfns, nd_pfn->align)
+       if (nd_pfn->mode == PFN_MODE_PMEM) {
+               unsigned long memmap_size;
+
+               /*
+                * vmemmap_populate_hugepages() allocates the memmap array in
+                * HPAGE_SIZE chunks.
+                */
+               memmap_size = ALIGN(64 * npfns, HPAGE_SIZE);
+               offset = ALIGN(start + SZ_8K + memmap_size, nd_pfn->align)
                        - start;
-       else if (nd_pfn->mode == PFN_MODE_RAM)
+       else if (nd_pfn->mode == PFN_MODE_RAM)
                offset = ALIGN(start + SZ_8K, nd_pfn->align) - start;
        else
                goto err;
index 8ba19bba31569f22c6529a739fa1d30adf5c2f0f..2bb3c5799ac4b0146b2760d8823fb1eb28a6bdaa 100644 (file)
@@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
        if (ret)
                goto close_banks;
 
-       while (val_size) {
+       while (val_size >= reg_size) {
                if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) {
                        /* fill up non-data register */
                        *buf = 0;
@@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size,
                }
 
                buf++;
-               val_size--;
+               val_size -= reg_size;
                offset += reg_size;
        }
 
index 96168b8190449ccc1bee6e24ef0758af1bb3c69c..e165b7ce29d7dda18c6d84306a73cdba28818b6c 100644 (file)
@@ -126,7 +126,7 @@ struct rio_mport_mapping {
        struct list_head node;
        struct mport_dev *md;
        enum rio_mport_map_dir dir;
-       u32 rioid;
+       u16 rioid;
        u64 rio_addr;
        dma_addr_t phys_addr; /* for mmap */
        void *virt_addr; /* kernel address, for dma_free_coherent */
@@ -137,7 +137,7 @@ struct rio_mport_mapping {
 
 struct rio_mport_dma_map {
        int valid;
-       uint64_t length;
+       u64 length;
        void *vaddr;
        dma_addr_t paddr;
 };
@@ -208,7 +208,7 @@ struct mport_cdev_priv {
        struct kfifo            event_fifo;
        wait_queue_head_t       event_rx_wait;
        spinlock_t              fifo_lock;
-       unsigned int            event_mask; /* RIO_DOORBELL, RIO_PORTWRITE */
+       u32                     event_mask; /* RIO_DOORBELL, RIO_PORTWRITE */
 #ifdef CONFIG_RAPIDIO_DMA_ENGINE
        struct dma_chan         *dmach;
        struct list_head        async_list;
@@ -276,7 +276,8 @@ static int rio_mport_maint_rd(struct mport_cdev_priv *priv, void __user *arg,
                return -EFAULT;
 
        if ((maint_io.offset % 4) ||
-           (maint_io.length == 0) || (maint_io.length % 4))
+           (maint_io.length == 0) || (maint_io.length % 4) ||
+           (maint_io.length + maint_io.offset) > RIO_MAINT_SPACE_SZ)
                return -EINVAL;
 
        buffer = vmalloc(maint_io.length);
@@ -298,7 +299,8 @@ static int rio_mport_maint_rd(struct mport_cdev_priv *priv, void __user *arg,
                offset += 4;
        }
 
-       if (unlikely(copy_to_user(maint_io.buffer, buffer, maint_io.length)))
+       if (unlikely(copy_to_user((void __user *)(uintptr_t)maint_io.buffer,
+                                  buffer, maint_io.length)))
                ret = -EFAULT;
 out:
        vfree(buffer);
@@ -319,7 +321,8 @@ static int rio_mport_maint_wr(struct mport_cdev_priv *priv, void __user *arg,
                return -EFAULT;
 
        if ((maint_io.offset % 4) ||
-           (maint_io.length == 0) || (maint_io.length % 4))
+           (maint_io.length == 0) || (maint_io.length % 4) ||
+           (maint_io.length + maint_io.offset) > RIO_MAINT_SPACE_SZ)
                return -EINVAL;
 
        buffer = vmalloc(maint_io.length);
@@ -327,7 +330,8 @@ static int rio_mport_maint_wr(struct mport_cdev_priv *priv, void __user *arg,
                return -ENOMEM;
        length = maint_io.length;
 
-       if (unlikely(copy_from_user(buffer, maint_io.buffer, length))) {
+       if (unlikely(copy_from_user(buffer,
+                       (void __user *)(uintptr_t)maint_io.buffer, length))) {
                ret = -EFAULT;
                goto out;
        }
@@ -360,7 +364,7 @@ out:
  */
 static int
 rio_mport_create_outbound_mapping(struct mport_dev *md, struct file *filp,
-                                 u32 rioid, u64 raddr, u32 size,
+                                 u16 rioid, u64 raddr, u32 size,
                                  dma_addr_t *paddr)
 {
        struct rio_mport *mport = md->mport;
@@ -369,7 +373,7 @@ rio_mport_create_outbound_mapping(struct mport_dev *md, struct file *filp,
 
        rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%x", rioid, raddr, size);
 
-       map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL);
+       map = kzalloc(sizeof(*map), GFP_KERNEL);
        if (map == NULL)
                return -ENOMEM;
 
@@ -394,7 +398,7 @@ err_map_outb:
 
 static int
 rio_mport_get_outbound_mapping(struct mport_dev *md, struct file *filp,
-                              u32 rioid, u64 raddr, u32 size,
+                              u16 rioid, u64 raddr, u32 size,
                               dma_addr_t *paddr)
 {
        struct rio_mport_mapping *map;
@@ -433,7 +437,7 @@ static int rio_mport_obw_map(struct file *filp, void __user *arg)
        dma_addr_t paddr;
        int ret;
 
-       if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_mmap))))
+       if (unlikely(copy_from_user(&map, arg, sizeof(map))))
                return -EFAULT;
 
        rmcd_debug(OBW, "did=%d ra=0x%llx sz=0x%llx",
@@ -448,7 +452,7 @@ static int rio_mport_obw_map(struct file *filp, void __user *arg)
 
        map.handle = paddr;
 
-       if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_mmap))))
+       if (unlikely(copy_to_user(arg, &map, sizeof(map))))
                return -EFAULT;
        return 0;
 }
@@ -469,7 +473,7 @@ static int rio_mport_obw_free(struct file *filp, void __user *arg)
        if (!md->mport->ops->unmap_outb)
                return -EPROTONOSUPPORT;
 
-       if (copy_from_user(&handle, arg, sizeof(u64)))
+       if (copy_from_user(&handle, arg, sizeof(handle)))
                return -EFAULT;
 
        rmcd_debug(OBW, "h=0x%llx", handle);
@@ -498,9 +502,9 @@ static int rio_mport_obw_free(struct file *filp, void __user *arg)
 static int maint_hdid_set(struct mport_cdev_priv *priv, void __user *arg)
 {
        struct mport_dev *md = priv->md;
-       uint16_t hdid;
+       u16 hdid;
 
-       if (copy_from_user(&hdid, arg, sizeof(uint16_t)))
+       if (copy_from_user(&hdid, arg, sizeof(hdid)))
                return -EFAULT;
 
        md->mport->host_deviceid = hdid;
@@ -520,9 +524,9 @@ static int maint_hdid_set(struct mport_cdev_priv *priv, void __user *arg)
 static int maint_comptag_set(struct mport_cdev_priv *priv, void __user *arg)
 {
        struct mport_dev *md = priv->md;
-       uint32_t comptag;
+       u32 comptag;
 
-       if (copy_from_user(&comptag, arg, sizeof(uint32_t)))
+       if (copy_from_user(&comptag, arg, sizeof(comptag)))
                return -EFAULT;
 
        rio_local_write_config_32(md->mport, RIO_COMPONENT_TAG_CSR, comptag);
@@ -837,7 +841,7 @@ err_out:
  * @xfer: data transfer descriptor structure
  */
 static int
-rio_dma_transfer(struct file *filp, uint32_t transfer_mode,
+rio_dma_transfer(struct file *filp, u32 transfer_mode,
                 enum rio_transfer_sync sync, enum dma_data_direction dir,
                 struct rio_transfer_io *xfer)
 {
@@ -875,7 +879,7 @@ rio_dma_transfer(struct file *filp, uint32_t transfer_mode,
                unsigned long offset;
                long pinned;
 
-               offset = (unsigned long)xfer->loc_addr & ~PAGE_MASK;
+               offset = (unsigned long)(uintptr_t)xfer->loc_addr & ~PAGE_MASK;
                nr_pages = PAGE_ALIGN(xfer->length + offset) >> PAGE_SHIFT;
 
                page_list = kmalloc_array(nr_pages,
@@ -1015,19 +1019,20 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg)
        if (unlikely(copy_from_user(&transaction, arg, sizeof(transaction))))
                return -EFAULT;
 
-       if (transaction.count != 1)
+       if (transaction.count != 1) /* only single transfer for now */
                return -EINVAL;
 
        if ((transaction.transfer_mode &
             priv->md->properties.transfer_mode) == 0)
                return -ENODEV;
 
-       transfer = vmalloc(transaction.count * sizeof(struct rio_transfer_io));
+       transfer = vmalloc(transaction.count * sizeof(*transfer));
        if (!transfer)
                return -ENOMEM;
 
-       if (unlikely(copy_from_user(transfer, transaction.block,
-             transaction.count * sizeof(struct rio_transfer_io)))) {
+       if (unlikely(copy_from_user(transfer,
+                                   (void __user *)(uintptr_t)transaction.block,
+                                   transaction.count * sizeof(*transfer)))) {
                ret = -EFAULT;
                goto out_free;
        }
@@ -1038,8 +1043,9 @@ static int rio_mport_transfer_ioctl(struct file *filp, void __user *arg)
                ret = rio_dma_transfer(filp, transaction.transfer_mode,
                        transaction.sync, dir, &transfer[i]);
 
-       if (unlikely(copy_to_user(transaction.block, transfer,
-             transaction.count * sizeof(struct rio_transfer_io))))
+       if (unlikely(copy_to_user((void __user *)(uintptr_t)transaction.block,
+                                 transfer,
+                                 transaction.count * sizeof(*transfer))))
                ret = -EFAULT;
 
 out_free:
@@ -1129,11 +1135,11 @@ err_tmo:
 }
 
 static int rio_mport_create_dma_mapping(struct mport_dev *md, struct file *filp,
-                       uint64_t size, struct rio_mport_mapping **mapping)
+                       u64 size, struct rio_mport_mapping **mapping)
 {
        struct rio_mport_mapping *map;
 
-       map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL);
+       map = kzalloc(sizeof(*map), GFP_KERNEL);
        if (map == NULL)
                return -ENOMEM;
 
@@ -1165,7 +1171,7 @@ static int rio_mport_alloc_dma(struct file *filp, void __user *arg)
        struct rio_mport_mapping *mapping = NULL;
        int ret;
 
-       if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_dma_mem))))
+       if (unlikely(copy_from_user(&map, arg, sizeof(map))))
                return -EFAULT;
 
        ret = rio_mport_create_dma_mapping(md, filp, map.length, &mapping);
@@ -1174,7 +1180,7 @@ static int rio_mport_alloc_dma(struct file *filp, void __user *arg)
 
        map.dma_handle = mapping->phys_addr;
 
-       if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_dma_mem)))) {
+       if (unlikely(copy_to_user(arg, &map, sizeof(map)))) {
                mutex_lock(&md->buf_mutex);
                kref_put(&mapping->ref, mport_release_mapping);
                mutex_unlock(&md->buf_mutex);
@@ -1192,7 +1198,7 @@ static int rio_mport_free_dma(struct file *filp, void __user *arg)
        int ret = -EFAULT;
        struct rio_mport_mapping *map, *_map;
 
-       if (copy_from_user(&handle, arg, sizeof(u64)))
+       if (copy_from_user(&handle, arg, sizeof(handle)))
                return -EFAULT;
        rmcd_debug(EXIT, "filp=%p", filp);
 
@@ -1242,14 +1248,18 @@ static int rio_mport_free_dma(struct file *filp, void __user *arg)
 
 static int
 rio_mport_create_inbound_mapping(struct mport_dev *md, struct file *filp,
-                               u64 raddr, u32 size,
+                               u64 raddr, u64 size,
                                struct rio_mport_mapping **mapping)
 {
        struct rio_mport *mport = md->mport;
        struct rio_mport_mapping *map;
        int ret;
 
-       map = kzalloc(sizeof(struct rio_mport_mapping), GFP_KERNEL);
+       /* rio_map_inb_region() accepts u32 size */
+       if (size > 0xffffffff)
+               return -EINVAL;
+
+       map = kzalloc(sizeof(*map), GFP_KERNEL);
        if (map == NULL)
                return -ENOMEM;
 
@@ -1262,7 +1272,7 @@ rio_mport_create_inbound_mapping(struct mport_dev *md, struct file *filp,
 
        if (raddr == RIO_MAP_ANY_ADDR)
                raddr = map->phys_addr;
-       ret = rio_map_inb_region(mport, map->phys_addr, raddr, size, 0);
+       ret = rio_map_inb_region(mport, map->phys_addr, raddr, (u32)size, 0);
        if (ret < 0)
                goto err_map_inb;
 
@@ -1288,7 +1298,7 @@ err_dma_alloc:
 
 static int
 rio_mport_get_inbound_mapping(struct mport_dev *md, struct file *filp,
-                             u64 raddr, u32 size,
+                             u64 raddr, u64 size,
                              struct rio_mport_mapping **mapping)
 {
        struct rio_mport_mapping *map;
@@ -1331,7 +1341,7 @@ static int rio_mport_map_inbound(struct file *filp, void __user *arg)
 
        if (!md->mport->ops->map_inb)
                return -EPROTONOSUPPORT;
-       if (unlikely(copy_from_user(&map, arg, sizeof(struct rio_mmap))))
+       if (unlikely(copy_from_user(&map, arg, sizeof(map))))
                return -EFAULT;
 
        rmcd_debug(IBW, "%s filp=%p", dev_name(&priv->md->dev), filp);
@@ -1344,7 +1354,7 @@ static int rio_mport_map_inbound(struct file *filp, void __user *arg)
        map.handle = mapping->phys_addr;
        map.rio_addr = mapping->rio_addr;
 
-       if (unlikely(copy_to_user(arg, &map, sizeof(struct rio_mmap)))) {
+       if (unlikely(copy_to_user(arg, &map, sizeof(map)))) {
                /* Delete mapping if it was created by this request */
                if (ret == 0 && mapping->filp == filp) {
                        mutex_lock(&md->buf_mutex);
@@ -1375,7 +1385,7 @@ static int rio_mport_inbound_free(struct file *filp, void __user *arg)
        if (!md->mport->ops->unmap_inb)
                return -EPROTONOSUPPORT;
 
-       if (copy_from_user(&handle, arg, sizeof(u64)))
+       if (copy_from_user(&handle, arg, sizeof(handle)))
                return -EFAULT;
 
        mutex_lock(&md->buf_mutex);
@@ -1401,7 +1411,7 @@ static int rio_mport_inbound_free(struct file *filp, void __user *arg)
 static int maint_port_idx_get(struct mport_cdev_priv *priv, void __user *arg)
 {
        struct mport_dev *md = priv->md;
-       uint32_t port_idx = md->mport->index;
+       u32 port_idx = md->mport->index;
 
        rmcd_debug(MPORT, "port_index=%d", port_idx);
 
@@ -1451,7 +1461,7 @@ static void rio_mport_doorbell_handler(struct rio_mport *mport, void *dev_id,
        handled = 0;
        spin_lock(&data->db_lock);
        list_for_each_entry(db_filter, &data->doorbells, data_node) {
-               if (((db_filter->filter.rioid == 0xffffffff ||
+               if (((db_filter->filter.rioid == RIO_INVALID_DESTID ||
                      db_filter->filter.rioid == src)) &&
                      info >= db_filter->filter.low &&
                      info <= db_filter->filter.high) {
@@ -1525,6 +1535,9 @@ static int rio_mport_remove_db_filter(struct mport_cdev_priv *priv,
        if (copy_from_user(&filter, arg, sizeof(filter)))
                return -EFAULT;
 
+       if (filter.low > filter.high)
+               return -EINVAL;
+
        spin_lock_irqsave(&priv->md->db_lock, flags);
        list_for_each_entry(db_filter, &priv->db_filters, priv_node) {
                if (db_filter->filter.rioid == filter.rioid &&
@@ -1737,10 +1750,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
                return -EEXIST;
        }
 
-       size = sizeof(struct rio_dev);
+       size = sizeof(*rdev);
        mport = md->mport;
-       destid = (u16)dev_info.destid;
-       hopcount = (u8)dev_info.hopcount;
+       destid = dev_info.destid;
+       hopcount = dev_info.hopcount;
 
        if (rio_mport_read_config_32(mport, destid, hopcount,
                                     RIO_PEF_CAR, &rval))
@@ -1872,8 +1885,8 @@ static int rio_mport_del_riodev(struct mport_cdev_priv *priv, void __user *arg)
                do {
                        rdev = rio_get_comptag(dev_info.comptag, rdev);
                        if (rdev && rdev->dev.parent == &mport->net->dev &&
-                           rdev->destid == (u16)dev_info.destid &&
-                           rdev->hopcount == (u8)dev_info.hopcount)
+                           rdev->destid == dev_info.destid &&
+                           rdev->hopcount == dev_info.hopcount)
                                break;
                } while (rdev);
        }
@@ -2146,8 +2159,8 @@ static long mport_cdev_ioctl(struct file *filp,
                return maint_port_idx_get(data, (void __user *)arg);
        case RIO_MPORT_GET_PROPERTIES:
                md->properties.hdid = md->mport->host_deviceid;
-               if (copy_to_user((void __user *)arg, &(data->md->properties),
-                                sizeof(data->md->properties)))
+               if (copy_to_user((void __user *)arg, &(md->properties),
+                                sizeof(md->properties)))
                        return -EFAULT;
                return 0;
        case RIO_ENABLE_DOORBELL_RANGE:
@@ -2159,11 +2172,11 @@ static long mport_cdev_ioctl(struct file *filp,
        case RIO_DISABLE_PORTWRITE_RANGE:
                return rio_mport_remove_pw_filter(data, (void __user *)arg);
        case RIO_SET_EVENT_MASK:
-               data->event_mask = arg;
+               data->event_mask = (u32)arg;
                return 0;
        case RIO_GET_EVENT_MASK:
                if (copy_to_user((void __user *)arg, &data->event_mask,
-                                   sizeof(data->event_mask)))
+                                   sizeof(u32)))
                        return -EFAULT;
                return 0;
        case RIO_MAP_OUTBOUND:
@@ -2374,7 +2387,7 @@ static ssize_t mport_write(struct file *filp, const char __user *buf,
                        return -EINVAL;
 
                ret = rio_mport_send_doorbell(mport,
-                                             (u16)event.u.doorbell.rioid,
+                                             event.u.doorbell.rioid,
                                              event.u.doorbell.payload);
                if (ret < 0)
                        return ret;
@@ -2421,7 +2434,7 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)
        struct mport_dev *md;
        struct rio_mport_attr attr;
 
-       md = kzalloc(sizeof(struct mport_dev), GFP_KERNEL);
+       md = kzalloc(sizeof(*md), GFP_KERNEL);
        if (!md) {
                rmcd_error("Unable allocate a device object");
                return NULL;
@@ -2470,7 +2483,7 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)
        /* The transfer_mode property will be returned through mport query
         * interface
         */
-#ifdef CONFIG_PPC /* for now: only on Freescale's SoCs */
+#ifdef CONFIG_FSL_RIO /* for now: only on Freescale's SoCs */
        md->properties.transfer_mode |= RIO_TRANSFER_MODE_MAPPED;
 #else
        md->properties.transfer_mode |= RIO_TRANSFER_MODE_TRANSFER;
index 3c3dc4a3d52cfb4685bdcbd2c62b55d33447804d..d89d60c8b6cf09cf934f220cdf3fb936ff1040bc 100644 (file)
@@ -338,31 +338,9 @@ config INTEL_QUARK_DTS_THERMAL
          hot & critical. The critical trip point default value is set by
          underlying BIOS/Firmware.
 
-config INT340X_THERMAL
-       tristate "ACPI INT340X thermal drivers"
-       depends on X86 && ACPI
-       select THERMAL_GOV_USER_SPACE
-       select ACPI_THERMAL_REL
-       select ACPI_FAN
-       select INTEL_SOC_DTS_IOSF_CORE
-       select THERMAL_WRITABLE_TRIPS
-       help
-         Newer laptops and tablets that use ACPI may have thermal sensors and
-         other devices with thermal control capabilities outside the core
-         CPU/SOC, for thermal safety reasons.
-         They are exposed for the OS to use via the INT3400 ACPI device object
-         as the master, and INT3401~INT340B ACPI device objects as the slaves.
-         Enable this to expose the temperature information and cooling ability
-         from these objects to userspace via the normal thermal framework.
-         This means that a wide range of applications and GUI widgets can show
-         the information to the user or use this information for making
-         decisions. For example, the Intel Thermal Daemon can use this
-         information to allow the user to select his laptop to run without
-         turning on the fans.
-
-config ACPI_THERMAL_REL
-       tristate
-       depends on ACPI
+menu "ACPI INT340X thermal drivers"
+source drivers/thermal/int340x_thermal/Kconfig
+endmenu
 
 config INTEL_PCH_THERMAL
        tristate "Intel PCH Thermal Reporting Driver"
diff --git a/drivers/thermal/int340x_thermal/Kconfig b/drivers/thermal/int340x_thermal/Kconfig
new file mode 100644 (file)
index 0000000..0582bd1
--- /dev/null
@@ -0,0 +1,42 @@
+#
+# ACPI INT340x thermal drivers configuration
+#
+
+config INT340X_THERMAL
+       tristate "ACPI INT340X thermal drivers"
+       depends on X86 && ACPI
+       select THERMAL_GOV_USER_SPACE
+       select ACPI_THERMAL_REL
+       select ACPI_FAN
+       select INTEL_SOC_DTS_IOSF_CORE
+       help
+         Newer laptops and tablets that use ACPI may have thermal sensors and
+         other devices with thermal control capabilities outside the core
+         CPU/SOC, for thermal safety reasons.
+         They are exposed for the OS to use via the INT3400 ACPI device object
+         as the master, and INT3401~INT340B ACPI device objects as the slaves.
+         Enable this to expose the temperature information and cooling ability
+         from these objects to userspace via the normal thermal framework.
+         This means that a wide range of applications and GUI widgets can show
+         the information to the user or use this information for making
+         decisions. For example, the Intel Thermal Daemon can use this
+         information to allow the user to select his laptop to run without
+         turning on the fans.
+
+config ACPI_THERMAL_REL
+       tristate
+       depends on ACPI
+
+if INT340X_THERMAL
+
+config INT3406_THERMAL
+       tristate "ACPI INT3406 display thermal driver"
+       depends on ACPI_VIDEO
+       help
+         The display thermal device represents the LED/LCD display panel
+         that may or may not include touch support. The main function of
+         the display thermal device is to allow control of the display
+         brightness in order to address a thermal condition or to reduce
+         power consumed by display device.
+
+endif
index ba77a34f659f180357d22ce98c602b77c83882f2..df0df055e7ffaa82cfa640306f611f15b0ed2b89 100644 (file)
@@ -3,4 +3,5 @@ obj-$(CONFIG_INT340X_THERMAL)   += int340x_thermal_zone.o
 obj-$(CONFIG_INT340X_THERMAL)  += int3402_thermal.o
 obj-$(CONFIG_INT340X_THERMAL)  += int3403_thermal.o
 obj-$(CONFIG_INT340X_THERMAL)  += processor_thermal_device.o
+obj-$(CONFIG_INT3406_THERMAL)  += int3406_thermal.o
 obj-$(CONFIG_ACPI_THERMAL_REL) += acpi_thermal_rel.o
diff --git a/drivers/thermal/int340x_thermal/int3406_thermal.c b/drivers/thermal/int340x_thermal/int3406_thermal.c
new file mode 100644 (file)
index 0000000..13d431c
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * INT3406 thermal driver for display participant device
+ *
+ * Copyright (C) 2016, Intel Corporation
+ * Authors: Aaron Lu <aaron.lu@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/module.h>
+#include <linux/platform_device.h>
+#include <linux/acpi.h>
+#include <linux/backlight.h>
+#include <linux/thermal.h>
+#include <acpi/video.h>
+
+#define INT3406_BRIGHTNESS_LIMITS_CHANGED      0x80
+
+struct int3406_thermal_data {
+       int upper_limit;
+       int upper_limit_index;
+       int lower_limit;
+       int lower_limit_index;
+       acpi_handle handle;
+       struct acpi_video_device_brightness *br;
+       struct backlight_device *raw_bd;
+       struct thermal_cooling_device *cooling_dev;
+};
+
+static int int3406_thermal_to_raw(int level, struct int3406_thermal_data *d)
+{
+       int max_level = d->br->levels[d->br->count - 1];
+       int raw_max = d->raw_bd->props.max_brightness;
+
+       return level * raw_max / max_level;
+}
+
+static int int3406_thermal_to_acpi(int level, struct int3406_thermal_data *d)
+{
+       int raw_max = d->raw_bd->props.max_brightness;
+       int max_level = d->br->levels[d->br->count - 1];
+
+       return level * max_level / raw_max;
+}
+
+static int
+int3406_thermal_get_max_state(struct thermal_cooling_device *cooling_dev,
+                             unsigned long *state)
+{
+       struct int3406_thermal_data *d = cooling_dev->devdata;
+       int index = d->lower_limit_index ? d->lower_limit_index : 2;
+
+       *state = d->br->count - 1 - index;
+       return 0;
+}
+
+static int
+int3406_thermal_set_cur_state(struct thermal_cooling_device *cooling_dev,
+                             unsigned long state)
+{
+       struct int3406_thermal_data *d = cooling_dev->devdata;
+       int level, raw_level;
+
+       if (state > d->br->count - 3)
+               return -EINVAL;
+
+       state = d->br->count - 1 - state;
+       level = d->br->levels[state];
+
+       if ((d->upper_limit && level > d->upper_limit) ||
+           (d->lower_limit && level < d->lower_limit))
+               return -EINVAL;
+
+       raw_level = int3406_thermal_to_raw(level, d);
+       return backlight_device_set_brightness(d->raw_bd, raw_level);
+}
+
+static int
+int3406_thermal_get_cur_state(struct thermal_cooling_device *cooling_dev,
+                             unsigned long *state)
+{
+       struct int3406_thermal_data *d = cooling_dev->devdata;
+       int raw_level, level, i;
+       int *levels = d->br->levels;
+
+       raw_level = d->raw_bd->props.brightness;
+       level = int3406_thermal_to_acpi(raw_level, d);
+
+       /*
+        * There is no 1:1 mapping between the firmware interface level with the
+        * raw interface level, we will have to find one that is close enough.
+        */
+       for (i = 2; i < d->br->count; i++) {
+               if (level < levels[i]) {
+                       if (i == 2)
+                               break;
+                       if ((level - levels[i - 1]) < (levels[i] - level))
+                               i--;
+                       break;
+               }
+       }
+
+       *state = d->br->count - 1 - i;
+       return 0;
+}
+
+static const struct thermal_cooling_device_ops video_cooling_ops = {
+       .get_max_state = int3406_thermal_get_max_state,
+       .get_cur_state = int3406_thermal_get_cur_state,
+       .set_cur_state = int3406_thermal_set_cur_state,
+};
+
+static int int3406_thermal_get_index(int *array, int nr, int value)
+{
+       int i;
+
+       for (i = 0; i < nr; i++) {
+               if (array[i] == value)
+                       break;
+       }
+       return i == nr ? -ENOENT : i;
+}
+
+static void int3406_thermal_get_limit(struct int3406_thermal_data *d)
+{
+       acpi_status status;
+       unsigned long long lower_limit, upper_limit;
+       int index;
+
+       status = acpi_evaluate_integer(d->handle, "DDDL", NULL, &lower_limit);
+       if (ACPI_SUCCESS(status)) {
+               index = int3406_thermal_get_index(d->br->levels, d->br->count,
+                                                 lower_limit);
+               if (index > 0) {
+                       d->lower_limit = (int)lower_limit;
+                       d->lower_limit_index = index;
+               }
+       }
+
+       status = acpi_evaluate_integer(d->handle, "DDPC", NULL, &upper_limit);
+       if (ACPI_SUCCESS(status)) {
+               index = int3406_thermal_get_index(d->br->levels, d->br->count,
+                                                 upper_limit);
+               if (index > 0) {
+                       d->upper_limit = (int)upper_limit;
+                       d->upper_limit_index = index;
+               }
+       }
+}
+
+static void int3406_notify(acpi_handle handle, u32 event, void *data)
+{
+       if (event == INT3406_BRIGHTNESS_LIMITS_CHANGED)
+               int3406_thermal_get_limit(data);
+}
+
+static int int3406_thermal_probe(struct platform_device *pdev)
+{
+       struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
+       struct int3406_thermal_data *d;
+       struct backlight_device *bd;
+       int ret;
+
+       if (!ACPI_HANDLE(&pdev->dev))
+               return -ENODEV;
+
+       d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL);
+       if (!d)
+               return -ENOMEM;
+       d->handle = ACPI_HANDLE(&pdev->dev);
+
+       bd = backlight_device_get_by_type(BACKLIGHT_RAW);
+       if (!bd)
+               return -ENODEV;
+       d->raw_bd = bd;
+
+       ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br);
+       if (ret)
+               return ret;
+
+       int3406_thermal_get_limit(d);
+
+       d->cooling_dev = thermal_cooling_device_register(acpi_device_bid(adev),
+                                                        d, &video_cooling_ops);
+       if (IS_ERR(d->cooling_dev))
+               goto err;
+
+       ret = acpi_install_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
+                                         int3406_notify, d);
+       if (ret)
+               goto err_cdev;
+
+       platform_set_drvdata(pdev, d);
+
+       return 0;
+
+err_cdev:
+       thermal_cooling_device_unregister(d->cooling_dev);
+err:
+       kfree(d->br);
+       return -ENODEV;
+}
+
+static int int3406_thermal_remove(struct platform_device *pdev)
+{
+       struct int3406_thermal_data *d = platform_get_drvdata(pdev);
+
+       thermal_cooling_device_unregister(d->cooling_dev);
+       kfree(d->br);
+       return 0;
+}
+
+static const struct acpi_device_id int3406_thermal_match[] = {
+       {"INT3406", 0},
+       {}
+};
+
+MODULE_DEVICE_TABLE(acpi, int3406_thermal_match);
+
+static struct platform_driver int3406_thermal_driver = {
+       .probe = int3406_thermal_probe,
+       .remove = int3406_thermal_remove,
+       .driver = {
+                  .name = "int3406 thermal",
+                  .owner = THIS_MODULE,
+                  .acpi_match_table = int3406_thermal_match,
+                  },
+};
+
+module_platform_driver(int3406_thermal_driver);
+
+MODULE_DESCRIPTION("INT3406 Thermal driver");
+MODULE_LICENSE("GPL v2");
index 14718a9ffcfb18d398f8ab5ae2cb3df99d4994db..460c855be0d020bd21d3cc024d0a33d705b0d59d 100644 (file)
@@ -249,18 +249,12 @@ static int usb_port_runtime_suspend(struct device *dev)
 
        return retval;
 }
-
-static int usb_port_prepare(struct device *dev)
-{
-       return 1;
-}
 #endif
 
 static const struct dev_pm_ops usb_port_pm_ops = {
 #ifdef CONFIG_PM
        .runtime_suspend =      usb_port_runtime_suspend,
        .runtime_resume =       usb_port_runtime_resume,
-       .prepare =              usb_port_prepare,
 #endif
 };
 
index dcb85e3cd5a76ab40e963f0e6dd402dfb63fa219..479187c32571d7efa9e49dccb3ea7d386102fd13 100644 (file)
@@ -312,13 +312,7 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
 
 static int usb_dev_prepare(struct device *dev)
 {
-       struct usb_device *udev = to_usb_device(dev);
-
-       /* Return 0 if the current wakeup setting is wrong, otherwise 1 */
-       if (udev->do_remote_wakeup != device_may_wakeup(dev))
-               return 0;
-
-       return 1;
+       return 0;               /* Implement eventually? */
 }
 
 static void usb_dev_complete(struct device *dev)
index 5e5a8fa005f8befc1ca9eb4814b12afbf8e3ccea..bc8889956d172b293e6771b2cd7e1e604005b2f1 100644 (file)
@@ -83,9 +83,9 @@ static int jz4740_musb_init(struct musb *musb)
 {
        usb_phy_generic_register();
        musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
-       if (!musb->xceiv) {
+       if (IS_ERR(musb->xceiv)) {
                pr_err("HS UDC: no transceiver configured\n");
-               return -ENODEV;
+               return PTR_ERR(musb->xceiv);
        }
 
        /* Silicon does not implement ConfigData register.
index 87bd578799a8a9eb47339177cfc63a5b3bba5a5d..152865b3652295caf52340ca86397d5494f34c84 100644 (file)
@@ -1164,12 +1164,12 @@ static int musb_gadget_disable(struct usb_ep *ep)
                musb_writew(epio, MUSB_RXMAXP, 0);
        }
 
-       musb_ep->desc = NULL;
-       musb_ep->end_point.desc = NULL;
-
        /* abort all pending DMA and requests */
        nuke(musb_ep, -ESHUTDOWN);
 
+       musb_ep->desc = NULL;
+       musb_ep->end_point.desc = NULL;
+
        schedule_work(&musb->irq_work);
 
        spin_unlock_irqrestore(&(musb->lock), flags);
index 58487a4735218518ce50326750ca8718aaa2a516..2f8ad7f1f482cd55116b8cb3a7fd575fc79c360a 100644 (file)
@@ -2735,7 +2735,7 @@ static const struct hc_driver musb_hc_driver = {
        .description            = "musb-hcd",
        .product_desc           = "MUSB HDRC host driver",
        .hcd_priv_size          = sizeof(struct musb *),
-       .flags                  = HCD_USB2 | HCD_MEMORY | HCD_BH,
+       .flags                  = HCD_USB2 | HCD_MEMORY,
 
        /* not using irq handler or reset hooks from usbcore, since
         * those must be shared with peripheral code for OTG configs
index dd47823bb014c4664fed94181b33fbcd5f8d6e85..7c9f25e9c422a278ae71ea37de6a5c367a6e58cf 100644 (file)
@@ -109,6 +109,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */
        { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */
        { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */
+       { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */
        { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */
        { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
        { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
@@ -118,6 +119,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
        { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
        { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
+       { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
        { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
        { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */
        { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
@@ -141,6 +143,8 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */
        { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */
        { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
+       { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */
+       { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */
        { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
        { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
        { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
index bddc8b17a4d8a688f978aa82c58ff8c7514b21f0..288318ad21ddfcc8e8fef0b61ac5694c8e0f8ebd 100644 (file)
@@ -164,18 +164,10 @@ static ssize_t brightness_show(struct device *dev,
        return sprintf(buf, "%d\n", bd->props.brightness);
 }
 
-static ssize_t brightness_store(struct device *dev,
-               struct device_attribute *attr, const char *buf, size_t count)
+int backlight_device_set_brightness(struct backlight_device *bd,
+                                   unsigned long brightness)
 {
-       int rc;
-       struct backlight_device *bd = to_backlight_device(dev);
-       unsigned long brightness;
-
-       rc = kstrtoul(buf, 0, &brightness);
-       if (rc)
-               return rc;
-
-       rc = -ENXIO;
+       int rc = -ENXIO;
 
        mutex_lock(&bd->ops_lock);
        if (bd->ops) {
@@ -185,7 +177,7 @@ static ssize_t brightness_store(struct device *dev,
                        pr_debug("set brightness to %lu\n", brightness);
                        bd->props.brightness = brightness;
                        backlight_update_status(bd);
-                       rc = count;
+                       rc = 0;
                }
        }
        mutex_unlock(&bd->ops_lock);
@@ -194,6 +186,23 @@ static ssize_t brightness_store(struct device *dev,
 
        return rc;
 }
+EXPORT_SYMBOL(backlight_device_set_brightness);
+
+static ssize_t brightness_store(struct device *dev,
+               struct device_attribute *attr, const char *buf, size_t count)
+{
+       int rc;
+       struct backlight_device *bd = to_backlight_device(dev);
+       unsigned long brightness;
+
+       rc = kstrtoul(buf, 0, &brightness);
+       if (rc)
+               return rc;
+
+       rc = backlight_device_set_brightness(bd, brightness);
+
+       return rc ? rc : count;
+}
 static DEVICE_ATTR_RW(brightness);
 
 static ssize_t type_show(struct device *dev, struct device_attribute *attr,
@@ -380,7 +389,7 @@ struct backlight_device *backlight_device_register(const char *name,
 }
 EXPORT_SYMBOL(backlight_device_register);
 
-bool backlight_device_registered(enum backlight_type type)
+struct backlight_device *backlight_device_get_by_type(enum backlight_type type)
 {
        bool found = false;
        struct backlight_device *bd;
@@ -394,9 +403,9 @@ bool backlight_device_registered(enum backlight_type type)
        }
        mutex_unlock(&backlight_dev_list_mutex);
 
-       return found;
+       return found ? bd : NULL;
 }
-EXPORT_SYMBOL(backlight_device_registered);
+EXPORT_SYMBOL(backlight_device_get_by_type);
 
 /**
  * backlight_device_unregister - unregisters a backlight device object.
index 5c802d47892c5091c971eaef256310f99b4d175d..ca6bfddaacad2beeb1897a0e397bd5300ccff30d 100644 (file)
@@ -1006,7 +1006,7 @@ struct virtqueue *vring_create_virtqueue(
        const char *name)
 {
        struct virtqueue *vq;
-       void *queue;
+       void *queue = NULL;
        dma_addr_t dma_addr;
        size_t queue_size_in_bytes;
        struct vring vring;
index 9781e0dd59d6fc6a1b02da5e51e516e27ccafad1..d46839f51e730ff50e2c756a9f4b1326af82e2ec 100644 (file)
@@ -151,6 +151,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq);
 static void balloon_process(struct work_struct *work);
 static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
 
+static void release_memory_resource(struct resource *resource);
+
 /* When ballooning out (allocating memory to return to Xen) we don't really
    want the kernel to try too hard since that can trigger the oom killer. */
 #define GFP_BALLOON \
@@ -267,6 +269,20 @@ static struct resource *additional_memory_resource(phys_addr_t size)
                return NULL;
        }
 
+#ifdef CONFIG_SPARSEMEM
+       {
+               unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT);
+               unsigned long pfn = res->start >> PAGE_SHIFT;
+
+               if (pfn > limit) {
+                       pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n",
+                              pfn, limit);
+                       release_memory_resource(res);
+                       return NULL;
+               }
+       }
+#endif
+
        return res;
 }
 
index 38272ad245516c272ab571bed1a5c962f4a0e808..f4edd6df3df235c55aef1329cb8e17b5ae8cf9f7 100644 (file)
@@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per_user_data *u)
 {
        unsigned int new_size;
        evtchn_port_t *new_ring, *old_ring;
-       unsigned int p, c;
 
        /*
         * Ensure the ring is large enough to capture all possible
@@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per_user_data *u)
        /*
         * Copy the old ring contents to the new ring.
         *
-        * If the ring contents crosses the end of the current ring,
-        * it needs to be copied in two chunks.
+        * To take care of wrapping, a full ring, and the new index
+        * pointing into the second half, simply copy the old contents
+        * twice.
         *
         * +---------+    +------------------+
-        * |34567  12| -> |       1234567    |
-        * +-----p-c-+    +------------------+
+        * |34567  12| -> |34567  1234567  12|
+        * +-----p-c-+    +-------c------p---+
         */
-       p = evtchn_ring_offset(u, u->ring_prod);
-       c = evtchn_ring_offset(u, u->ring_cons);
-       if (p < c) {
-               memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * sizeof(*u->ring));
-               memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring));
-       } else
-               memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring));
+       memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring));
+       memcpy(new_ring + u->ring_size, old_ring,
+              u->ring_size * sizeof(*u->ring));
 
        u->ring = new_ring;
        u->ring_size = new_size;
index 719924d6c7062bf9af20a0ecd561a77841954b17..dcad5e2105252fa277a1c66ef83d8a960d2a082b 100644 (file)
@@ -1295,7 +1295,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,
 
        *nbytesp = nbytes;
 
-       return ret;
+       return ret < 0 ? ret : 0;
 }
 
 static inline int fuse_iter_npages(const struct iov_iter *ii_p)
index c524fdddc7fb1f601d6d06ddb46d0affcca89c08..99899705b1055411723c3e5919ecbc1f50139e14 100644 (file)
@@ -198,7 +198,7 @@ static struct mount *next_group(struct mount *m, struct mount *origin)
 
 /* all accesses are serialized by namespace_sem */
 static struct user_namespace *user_ns;
-static struct mount *last_dest, *last_source, *dest_master;
+static struct mount *last_dest, *first_source, *last_source, *dest_master;
 static struct mountpoint *mp;
 static struct hlist_head *list;
 
@@ -221,20 +221,22 @@ static int propagate_one(struct mount *m)
                type = CL_MAKE_SHARED;
        } else {
                struct mount *n, *p;
+               bool done;
                for (n = m; ; n = p) {
                        p = n->mnt_master;
-                       if (p == dest_master || IS_MNT_MARKED(p)) {
-                               while (last_dest->mnt_master != p) {
-                                       last_source = last_source->mnt_master;
-                                       last_dest = last_source->mnt_parent;
-                               }
-                               if (!peers(n, last_dest)) {
-                                       last_source = last_source->mnt_master;
-                                       last_dest = last_source->mnt_parent;
-                               }
+                       if (p == dest_master || IS_MNT_MARKED(p))
                                break;
-                       }
                }
+               do {
+                       struct mount *parent = last_source->mnt_parent;
+                       if (last_source == first_source)
+                               break;
+                       done = parent->mnt_master == p;
+                       if (done && peers(n, parent))
+                               break;
+                       last_source = last_source->mnt_master;
+               } while (!done);
+
                type = CL_SLAVE;
                /* beginning of peer group among the slaves? */
                if (IS_MNT_SHARED(m))
@@ -286,6 +288,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp,
         */
        user_ns = current->nsproxy->mnt_ns->user_ns;
        last_dest = dest_mnt;
+       first_source = source_mnt;
        last_source = source_mnt;
        mp = dest_mp;
        list = tree_list;
index b1755b23893e5e34513582d51d7a9cf9ed6b7227..92e37e224cd22d66d0b9675f1790e110d5e7b415 100644 (file)
@@ -955,7 +955,8 @@ static ssize_t environ_read(struct file *file, char __user *buf,
        struct mm_struct *mm = file->private_data;
        unsigned long env_start, env_end;
 
-       if (!mm)
+       /* Ensure the process spawned far enough to have an environment. */
+       if (!mm || !mm->env_end)
                return 0;
 
        page = (char *)__get_free_page(GFP_TEMPORARY);
index fa92fe839fda2f989e3d52c368cc7520b80679e5..36661acaf33b4f61d27f8f48d467ced432521b3c 100644 (file)
@@ -919,14 +919,14 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
 #endif
        }
 
-       ret = udf_CS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
+       ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
        if (ret < 0)
                goto out_bh;
 
        strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
        udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);
 
-       ret = udf_CS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
+       ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
        if (ret < 0)
                goto out_bh;
 
index 972b70625614f837310e39d41f6d8e836d205144..263829ef1873644a16ac3340555291a7fc240a4a 100644 (file)
@@ -212,7 +212,7 @@ extern int udf_get_filename(struct super_block *, const uint8_t *, int,
                            uint8_t *, int);
 extern int udf_put_filename(struct super_block *, const uint8_t *, int,
                            uint8_t *, int);
-extern int udf_CS0toUTF8(uint8_t *, int, const uint8_t *, int);
+extern int udf_dstrCS0toUTF8(uint8_t *, int, const uint8_t *, int);
 
 /* ialloc.c */
 extern void udf_free_inode(struct inode *);
index 3ff42f4437f3eb3374fea6b1cd0e839b71b65577..695389a4fc239f245cfacfa5a1e2fde9eae5b4a7 100644 (file)
@@ -335,9 +335,21 @@ try_again:
        return u_len;
 }
 
-int udf_CS0toUTF8(uint8_t *utf_o, int o_len, const uint8_t *ocu_i, int i_len)
+int udf_dstrCS0toUTF8(uint8_t *utf_o, int o_len,
+                     const uint8_t *ocu_i, int i_len)
 {
-       return udf_name_from_CS0(utf_o, o_len, ocu_i, i_len,
+       int s_len = 0;
+
+       if (i_len > 0) {
+               s_len = ocu_i[i_len - 1];
+               if (s_len >= i_len) {
+                       pr_err("incorrect dstring lengths (%d/%d)\n",
+                              s_len, i_len);
+                       return -EINVAL;
+               }
+       }
+
+       return udf_name_from_CS0(utf_o, o_len, ocu_i, s_len,
                                 udf_uni2char_utf8, 0);
 }
 
index 14362a84c78e3ca1d5712d284d6dce22ed656ba1..3a932501d69078951ee4e70c1acd4ae429ca2a85 100644 (file)
@@ -394,13 +394,13 @@ struct acpi_data_node {
 
 static inline bool is_acpi_node(struct fwnode_handle *fwnode)
 {
-       return fwnode && (fwnode->type == FWNODE_ACPI
+       return !IS_ERR_OR_NULL(fwnode) && (fwnode->type == FWNODE_ACPI
                || fwnode->type == FWNODE_ACPI_DATA);
 }
 
 static inline bool is_acpi_device_node(struct fwnode_handle *fwnode)
 {
-       return fwnode && fwnode->type == FWNODE_ACPI;
+       return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_ACPI;
 }
 
 static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode)
index d1e34d1eeea67e36deac0a268415c46a57828b66..562603d7aabe1a049222328e25b9a83d5bc67a3c 100644 (file)
@@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
 acpi_status
 acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
-                           char **new_val);
+                           acpi_string *new_val);
 #endif
 
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
@@ -108,7 +108,7 @@ acpi_os_table_override(struct acpi_table_header *existing_table,
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_physical_table_override
 acpi_status
 acpi_os_physical_table_override(struct acpi_table_header *existing_table,
-                               acpi_physical_address * new_address,
+                               acpi_physical_address *new_address,
                                u32 *new_table_length);
 #endif
 
@@ -203,7 +203,7 @@ void acpi_os_unmap_memory(void *logical_address, acpi_size size);
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_physical_address
 acpi_status
 acpi_os_get_physical_address(void *logical_address,
-                            acpi_physical_address * physical_address);
+                            acpi_physical_address *physical_address);
 #endif
 
 /*
@@ -379,14 +379,14 @@ acpi_status
 acpi_os_get_table_by_name(char *signature,
                          u32 instance,
                          struct acpi_table_header **table,
-                         acpi_physical_address * address);
+                         acpi_physical_address *address);
 #endif
 
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_index
 acpi_status
 acpi_os_get_table_by_index(u32 index,
                           struct acpi_table_header **table,
-                          u32 *instance, acpi_physical_address * address);
+                          u32 *instance, acpi_physical_address *address);
 #endif
 
 #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_table_by_address
index 17556979dc79bffdb26b928d6f6348edfae4d095..4e4c21491c4188a4401887feb55978fe58b1ff47 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20160108
+#define ACPI_CA_VERSION                 0x20160422
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
@@ -192,7 +192,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
 /*
  * Optionally support group module level code.
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_group_module_level_code, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_group_module_level_code, FALSE);
 
 /*
  * Optionally use 32-bit FADT addresses if and when there is a conflict
@@ -484,8 +484,8 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
-                           acpi_find_root_pointer(acpi_physical_address *
-                                                  rsdp_address))
+                           acpi_find_root_pointer(acpi_physical_address
+                                                  *rsdp_address))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                             acpi_get_table_header(acpi_string signature,
                                                   u32 instance,
@@ -530,7 +530,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                             acpi_get_handle(acpi_handle parent,
                                             acpi_string pathname,
-                                            acpi_handle * ret_handle))
+                                            acpi_handle *ret_handle))
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                             acpi_attach_data(acpi_handle object,
                                              acpi_object_handler handler,
@@ -575,15 +575,15 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                            acpi_get_next_object(acpi_object_type type,
                                                 acpi_handle parent,
                                                 acpi_handle child,
-                                                acpi_handle * out_handle))
+                                                acpi_handle *out_handle))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                            acpi_get_type(acpi_handle object,
-                                         acpi_object_type * out_type))
+                                         acpi_object_type *out_type))
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                            acpi_get_parent(acpi_handle object,
-                                           acpi_handle * out_handle))
+                                           acpi_handle *out_handle))
 
 /*
  * Handler interfaces
@@ -755,7 +755,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_get_gpe_device(u32 gpe_index,
-                                                   acpi_handle * gpe_device))
+                                                   acpi_handle *gpe_device))
 
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_install_gpe_block(acpi_handle gpe_device,
@@ -771,8 +771,8 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
  * Resource interfaces
  */
 typedef
-acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
-                                          void *context);
+acpi_status (*acpi_walk_resource_callback) (struct acpi_resource * resource,
+                                           void *context);
 
 ACPI_EXTERNAL_RETURN_STATUS(acpi_status
                            acpi_get_vendor_resource(acpi_handle device,
@@ -938,7 +938,8 @@ ACPI_DBG_DEPENDENT_RETURN_VOID(void
 ACPI_APP_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(1)
                                void ACPI_INTERNAL_VAR_XFACE
                                acpi_log_error(const char *format, ...))
- acpi_status acpi_initialize_debugger(void);
+
+acpi_status acpi_initialize_debugger(void);
 
 void acpi_terminate_debugger(void);
 
index cf2acb84dfeb13ab823c04bbc0571aaae647630b..16c189283ea0c4eab8053329daa55ba7287d4dfe 100644 (file)
@@ -417,6 +417,7 @@ struct acpi_resource_gpio {
        u8                                      type; \
        u8                                      producer_consumer;   /* For values, see Producer/Consumer above */\
        u8                                      slave_mode; \
+       u8                                      connection_sharing; \
        u8                                      type_revision_id; \
        u16                                     type_data_length; \
        u16                                     vendor_length; \
index 0cb1a003698637543fee127e2726091f563a4cef..c19700e2a2fe25d169a64180593438d9815c3f77 100644 (file)
@@ -223,7 +223,7 @@ struct acpi_table_facs {
 /*******************************************************************************
  *
  * FADT - Fixed ACPI Description Table (Signature "FACP")
- *        Version 4
+ *        Version 6
  *
  ******************************************************************************/
 
@@ -413,4 +413,6 @@ struct acpi_table_desc {
 #define ACPI_FADT_V5_SIZE       (u32) (ACPI_FADT_OFFSET (hypervisor_id))
 #define ACPI_FADT_V6_SIZE       (u32) (sizeof (struct acpi_table_fadt))
 
+#define ACPI_FADT_CONFORMANCE   "ACPI 6.1 (FADT version 6)"
+
 #endif                         /* __ACTBL_H__ */
index 16e013600c194de06f2c4d74708a4c7e0d6013b8..796d6baae3a34c08c51787bc1b8d562323d2d0f2 100644 (file)
@@ -236,7 +236,8 @@ enum acpi_einj_actions {
        ACPI_EINJ_CHECK_BUSY_STATUS = 6,
        ACPI_EINJ_GET_COMMAND_STATUS = 7,
        ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
-       ACPI_EINJ_ACTION_RESERVED = 9,  /* 9 and greater are reserved */
+       ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
+       ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */
        ACPI_EINJ_TRIGGER_ERROR = 0xFF  /* Except for this value */
 };
 
@@ -348,7 +349,8 @@ enum acpi_erst_actions {
        ACPI_ERST_GET_ERROR_RANGE = 13,
        ACPI_ERST_GET_ERROR_LENGTH = 14,
        ACPI_ERST_GET_ERROR_ATTRIBUTES = 15,
-       ACPI_ERST_ACTION_RESERVED = 16  /* 16 and greater are reserved */
+       ACPI_ERST_EXECUTE_TIMINGS = 16,
+       ACPI_ERST_ACTION_RESERVED = 17  /* 17 and greater are reserved */
 };
 
 /* Values for Instruction field above */
@@ -427,7 +429,8 @@ enum acpi_hest_types {
        ACPI_HEST_TYPE_AER_ENDPOINT = 7,
        ACPI_HEST_TYPE_AER_BRIDGE = 8,
        ACPI_HEST_TYPE_GENERIC_ERROR = 9,
-       ACPI_HEST_TYPE_RESERVED = 10    /* 10 and greater are reserved */
+       ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10,
+       ACPI_HEST_TYPE_RESERVED = 11    /* 11 and greater are reserved */
 };
 
 /*
@@ -506,7 +509,11 @@ enum acpi_hest_notify_types {
        ACPI_HEST_NOTIFY_NMI = 4,
        ACPI_HEST_NOTIFY_CMCI = 5,      /* ACPI 5.0 */
        ACPI_HEST_NOTIFY_MCE = 6,       /* ACPI 5.0 */
-       ACPI_HEST_NOTIFY_RESERVED = 7   /* 7 and greater are reserved */
+       ACPI_HEST_NOTIFY_GPIO = 7,      /* ACPI 6.0 */
+       ACPI_HEST_NOTIFY_SEA = 8,       /* ACPI 6.1 */
+       ACPI_HEST_NOTIFY_SEI = 9,       /* ACPI 6.1 */
+       ACPI_HEST_NOTIFY_GSIV = 10,     /* ACPI 6.1 */
+       ACPI_HEST_NOTIFY_RESERVED = 11  /* 11 and greater are reserved */
 };
 
 /* Values for config_write_enable bitfield above */
@@ -603,6 +610,24 @@ struct acpi_hest_generic {
        u32 error_block_length;
 };
 
+/* 10: Generic Hardware Error Source, version 2 */
+
+struct acpi_hest_generic_v2 {
+       struct acpi_hest_header header;
+       u16 related_source_id;
+       u8 reserved;
+       u8 enabled;
+       u32 records_to_preallocate;
+       u32 max_sections_per_record;
+       u32 max_raw_data_length;
+       struct acpi_generic_address error_status_address;
+       struct acpi_hest_notify notify;
+       u32 error_block_length;
+       struct acpi_generic_address read_ack_register;
+       u64 read_ack_preserve;
+       u64 read_ack_write;
+};
+
 /* Generic Error Status block */
 
 struct acpi_hest_generic_status {
@@ -634,6 +659,33 @@ struct acpi_hest_generic_data {
        u8 fru_text[20];
 };
 
+/* Extension for revision 0x0300 */
+
+struct acpi_hest_generic_data_v300 {
+       u8 section_type[16];
+       u32 error_severity;
+       u16 revision;
+       u8 validation_bits;
+       u8 flags;
+       u32 error_data_length;
+       u8 fru_id[16];
+       u8 fru_text[20];
+       u64 time_stamp;
+};
+
+/* Values for error_severity above */
+
+#define ACPI_HEST_GEN_ERROR_RECOVERABLE     0
+#define ACPI_HEST_GEN_ERROR_FATAL           1
+#define ACPI_HEST_GEN_ERROR_CORRECTED       2
+#define ACPI_HEST_GEN_ERROR_NONE            3
+
+/* Flags for validation_bits above */
+
+#define ACPI_HEST_GEN_VALID_FRU_ID          (1)
+#define ACPI_HEST_GEN_VALID_FRU_STRING      (1<<1)
+#define ACPI_HEST_GEN_VALID_TIMESTAMP       (1<<2)
+
 /*******************************************************************************
  *
  * MADT - Multiple APIC Description Table
@@ -934,7 +986,7 @@ struct acpi_msct_proximity {
 
 /*******************************************************************************
  *
- * NFIT - NVDIMM Interface Table (ACPI 6.0)
+ * NFIT - NVDIMM Interface Table (ACPI 6.0+)
  *        Version 1
  *
  ******************************************************************************/
@@ -1015,6 +1067,7 @@ struct acpi_nfit_memory_map {
 #define ACPI_NFIT_MEM_NOT_ARMED         (1<<3) /* 03: Memory Device is not armed */
 #define ACPI_NFIT_MEM_HEALTH_OBSERVED   (1<<4) /* 04: Memory Device observed SMART/health events */
 #define ACPI_NFIT_MEM_HEALTH_ENABLED    (1<<5) /* 05: SMART/health events enabled */
+#define ACPI_NFIT_MEM_MAP_FAILED        (1<<6) /* 06: Mapping to SPA failed */
 
 /* 2: Interleave Structure */
 
@@ -1046,7 +1099,10 @@ struct acpi_nfit_control_region {
        u16 subsystem_vendor_id;
        u16 subsystem_device_id;
        u16 subsystem_revision_id;
-       u8 reserved[6];         /* Reserved, must be zero */
+       u8 valid_fields;
+       u8 manufacturing_location;
+       u16 manufacturing_date;
+       u8 reserved[2];         /* Reserved, must be zero */
        u32 serial_number;
        u16 code;
        u16 windows;
@@ -1061,7 +1117,11 @@ struct acpi_nfit_control_region {
 
 /* Flags */
 
-#define ACPI_NFIT_CONTROL_BUFFERED      (1)    /* Block Data Windows implementation is buffered */
+#define ACPI_NFIT_CONTROL_BUFFERED          (1)        /* Block Data Windows implementation is buffered */
+
+/* valid_fields bits */
+
+#define ACPI_NFIT_CONTROL_MFG_INFO_VALID    (1)        /* Manufacturing fields are valid */
 
 /* 5: NVDIMM Block Data Window Region Structure */
 
index a4ef62537cac8d747f2f1985b56c5632146ab513..c93dbadfc71d34836f085d872c2b625b8bce1ad6 100644 (file)
@@ -321,7 +321,7 @@ struct acpi_csrt_descriptor {
  * DBG2 - Debug Port Table 2
  *        Version 0 (Both main table and subtables)
  *
- * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
+ * Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015
  *
  ******************************************************************************/
 
@@ -371,6 +371,11 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
+#define ACPI_DBG2_ARM_DCC           0x000F
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
@@ -399,7 +404,7 @@ struct acpi_table_dbgp {
  *        Version 1
  *
  * Conforms to "Intel Virtualization Technology for Directed I/O",
- * Version 2.2, Sept. 2013
+ * Version 2.3, October 2014
  *
  ******************************************************************************/
 
@@ -413,6 +418,8 @@ struct acpi_table_dmar {
 /* Masks for Flags field above */
 
 #define ACPI_DMAR_INTR_REMAP        (1)
+#define ACPI_DMAR_X2APIC_OPT_OUT    (1<<1)
+#define ACPI_DMAR_X2APIC_MODE       (1<<2)
 
 /* DMAR subtable header */
 
@@ -655,7 +662,7 @@ struct acpi_ibft_target {
  * IORT - IO Remapping Table
  *
  * Conforms to "IO Remapping Table System Software on ARM Platforms",
- * Document number: ARM DEN 0049A, 2015
+ * Document number: ARM DEN 0049B, October 2015
  *
  ******************************************************************************/
 
@@ -685,7 +692,8 @@ enum acpi_iort_node_type {
        ACPI_IORT_NODE_ITS_GROUP = 0x00,
        ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
        ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
-       ACPI_IORT_NODE_SMMU = 0x03
+       ACPI_IORT_NODE_SMMU = 0x03,
+       ACPI_IORT_NODE_SMMU_V3 = 0x04
 };
 
 struct acpi_iort_id_mapping {
@@ -775,6 +783,23 @@ struct acpi_iort_smmu {
 #define ACPI_IORT_SMMU_DVM_SUPPORTED    (1)
 #define ACPI_IORT_SMMU_COHERENT_WALK    (1<<1)
 
+struct acpi_iort_smmu_v3 {
+       u64 base_address;       /* SMMUv3 base address */
+       u32 flags;
+       u32 reserved;
+       u64 vatos_address;
+       u32 model;              /* O: generic SMMUv3 */
+       u32 event_gsiv;
+       u32 pri_gsiv;
+       u32 gerr_gsiv;
+       u32 sync_gsiv;
+};
+
+/* Masks for Flags field above */
+
+#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE   (1)
+#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE     (1<<1)
+
 /*******************************************************************************
  *
  * IVRS - I/O Virtualization Reporting Structure
@@ -1102,10 +1127,10 @@ struct acpi_table_slic {
 /*******************************************************************************
  *
  * SPCR - Serial Port Console Redirection table
- *        Version 1
+ *        Version 2
  *
  * Conforms to "Serial Port Console Redirection Table",
- * Version 1.00, January 11, 2002
+ * Version 1.03, August 10, 2015
  *
  ******************************************************************************/
 
@@ -1137,6 +1162,8 @@ struct acpi_table_spcr {
 
 #define ACPI_SPCR_DO_NOT_DISABLE    (1)
 
+/* Values for Interface Type: See the definition of the DBG2 table */
+
 /*******************************************************************************
  *
  * SPMI - Server Platform Management Interface table
index ddf5e66c3b1543d288f9a16782cfb37d800d82b3..ebc1f4f9fe66e3b9b3a8bbc0364c5ca11e8d2809 100644 (file)
@@ -184,7 +184,7 @@ struct acpi_table_fpdt {
        struct acpi_table_header header;        /* Common ACPI table header */
 };
 
-/* FPDT subtable header */
+/* FPDT subtable header (Performance Record Structure) */
 
 struct acpi_fpdt_header {
        u16 type;
@@ -205,19 +205,15 @@ enum acpi_fpdt_type {
 
 /* 0: Firmware Basic Boot Performance Record */
 
-struct acpi_fpdt_boot {
+struct acpi_fpdt_boot_pointer {
        struct acpi_fpdt_header header;
        u8 reserved[4];
-       u64 reset_end;
-       u64 load_start;
-       u64 startup_start;
-       u64 exit_services_entry;
-       u64 exit_services_exit;
+       u64 address;
 };
 
 /* 1: S3 Performance Table Pointer Record */
 
-struct acpi_fpdt_s3pt_ptr {
+struct acpi_fpdt_s3pt_pointer {
        struct acpi_fpdt_header header;
        u8 reserved[4];
        u64 address;
@@ -225,7 +221,7 @@ struct acpi_fpdt_s3pt_ptr {
 
 /*
  * S3PT - S3 Performance Table. This table is pointed to by the
- * FPDT S3 Pointer Record above.
+ * S3 Pointer Record above.
  */
 struct acpi_table_s3pt {
        u8 signature[4];        /* "S3PT" */
@@ -233,34 +229,43 @@ struct acpi_table_s3pt {
 };
 
 /*
- * S3PT Subtables
+ * S3PT Subtables (Not part of the actual FPDT)
  */
-struct acpi_s3pt_header {
-       u16 type;
-       u8 length;
-       u8 revision;
-};
 
-/* Values for Type field above */
+/* Values for Type field in S3PT header */
 
 enum acpi_s3pt_type {
        ACPI_S3PT_TYPE_RESUME = 0,
-       ACPI_S3PT_TYPE_SUSPEND = 1
+       ACPI_S3PT_TYPE_SUSPEND = 1,
+       ACPI_FPDT_BOOT_PERFORMANCE = 2
 };
 
 struct acpi_s3pt_resume {
-       struct acpi_s3pt_header header;
+       struct acpi_fpdt_header header;
        u32 resume_count;
        u64 full_resume;
        u64 average_resume;
 };
 
 struct acpi_s3pt_suspend {
-       struct acpi_s3pt_header header;
+       struct acpi_fpdt_header header;
        u64 suspend_start;
        u64 suspend_end;
 };
 
+/*
+ * FPDT Boot Performance Record (Not part of the actual FPDT)
+ */
+struct acpi_fpdt_boot {
+       struct acpi_fpdt_header header;
+       u8 reserved[4];
+       u64 reset_end;
+       u64 load_start;
+       u64 startup_start;
+       u64 exit_services_entry;
+       u64 exit_services_exit;
+};
+
 /*******************************************************************************
  *
  * GTDT - Generic Timer Description Table (ACPI 5.1)
@@ -476,7 +481,8 @@ struct acpi_table_pcct {
 enum acpi_pcct_type {
        ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
        ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
-       ACPI_PCCT_TYPE_RESERVED = 2     /* 2 and greater are reserved */
+       ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2,   /* ACPI 6.1 */
+       ACPI_PCCT_TYPE_RESERVED = 3     /* 3 and greater are reserved */
 };
 
 /*
@@ -515,6 +521,26 @@ struct acpi_pcct_hw_reduced {
        u16 min_turnaround_time;
 };
 
+/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
+
+struct acpi_pcct_hw_reduced_type2 {
+       struct acpi_subtable_header header;
+       u32 doorbell_interrupt;
+       u8 flags;
+       u8 reserved;
+       u64 base_address;
+       u64 length;
+       struct acpi_generic_address doorbell_register;
+       u64 preserve_mask;
+       u64 write_mask;
+       u32 latency;
+       u32 max_access_rate;
+       u16 min_turnaround_time;
+       struct acpi_generic_address doorbell_ack_register;
+       u64 ack_preserve_mask;
+       u64 ack_write_mask;
+};
+
 /* Values for doorbell flags above */
 
 #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
index db46546d3b9d6534834fcc6c99c1b6e35cb66b86..cb389efd321c86592ed40a0e62541df236f93bd9 100644 (file)
@@ -630,7 +630,8 @@ typedef u64 acpi_integer;
 #define ACPI_NOTIFY_SHUTDOWN_REQUEST    (u8) 0x0C
 #define ACPI_NOTIFY_AFFINITY_UPDATE     (u8) 0x0D
 
-#define ACPI_NOTIFY_MAX                 0x0D
+#define ACPI_GENERIC_NOTIFY_MAX         0x0D
+#define ACPI_SPECIFIC_NOTIFY_MAX        0x84
 
 /*
  * Types associated with ACPI names and objects. The first group of
@@ -892,7 +893,7 @@ typedef u8 acpi_adr_space_type;
 
 /* Sleep function dispatch */
 
-typedef acpi_status(*acpi_sleep_function) (u8 sleep_state);
+typedef acpi_status (*acpi_sleep_function) (u8 sleep_state);
 
 struct acpi_sleep_functions {
        acpi_sleep_function legacy_function;
@@ -994,7 +995,7 @@ struct acpi_buffer {
  * Predefined Namespace items
  */
 struct acpi_predefined_names {
-       char *name;
+       const char *name;
        u8 type;
        char *val;
 };
@@ -1071,20 +1072,21 @@ void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
 typedef
 void (*acpi_object_handler) (acpi_handle object, void *data);
 
-typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
+typedef
+acpi_status (*acpi_init_handler) (acpi_handle object, u32 function);
 
 #define ACPI_INIT_DEVICE_INI        1
 
 typedef
-acpi_status(*acpi_exception_handler) (acpi_status aml_status,
-                                     acpi_name name,
-                                     u16 opcode,
-                                     u32 aml_offset, void *context);
+acpi_status (*acpi_exception_handler) (acpi_status aml_status,
+                                      acpi_name name,
+                                      u16 opcode,
+                                      u32 aml_offset, void *context);
 
 /* Table Event handler (Load, load_table, etc.) and types */
 
 typedef
-acpi_status(*acpi_table_handler) (u32 event, void *table, void *context);
+acpi_status (*acpi_table_handler) (u32 event, void *table, void *context);
 
 #define ACPI_TABLE_LOAD             0x0
 #define ACPI_TABLE_UNLOAD           0x1
@@ -1093,12 +1095,12 @@ acpi_status(*acpi_table_handler) (u32 event, void *table, void *context);
 /* Address Spaces (For Operation Regions) */
 
 typedef
-acpi_status(*acpi_adr_space_handler) (u32 function,
-                                     acpi_physical_address address,
-                                     u32 bit_width,
-                                     u64 *value,
-                                     void *handler_context,
-                                     void *region_context);
+acpi_status (*acpi_adr_space_handler) (u32 function,
+                                      acpi_physical_address address,
+                                      u32 bit_width,
+                                      u64 *value,
+                                      void *handler_context,
+                                      void *region_context);
 
 #define ACPI_DEFAULT_HANDLER            NULL
 
@@ -1111,18 +1113,18 @@ struct acpi_connection_info {
 };
 
 typedef
-acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
-                                   u32 function,
-                                   void *handler_context,
-                                   void **region_context);
+acpi_status (*acpi_adr_space_setup) (acpi_handle region_handle,
+                                    u32 function,
+                                    void *handler_context,
+                                    void **region_context);
 
 #define ACPI_REGION_ACTIVATE    0
 #define ACPI_REGION_DEACTIVATE  1
 
 typedef
-acpi_status(*acpi_walk_callback) (acpi_handle object,
-                                 u32 nesting_level,
-                                 void *context, void **return_value);
+acpi_status (*acpi_walk_callback) (acpi_handle object,
+                                  u32 nesting_level,
+                                  void *context, void **return_value);
 
 typedef
 u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
@@ -1227,7 +1229,7 @@ struct acpi_mem_space_context {
  * struct acpi_memory_list is used only if the ACPICA local cache is enabled
  */
 struct acpi_memory_list {
-       char *list_name;
+       const char *list_name;
        void *list_head;
        u16 object_size;
        u16 max_depth;
index 7c0595bde1324ec152d1b4b7d5f4b73efd036f34..86b5a8447606c4b4d1c87ac7c9b76146babd1dd7 100644 (file)
  *
  *****************************************************************************/
 
+/* Common application configuration. All single threaded except for acpi_exec. */
+
+#if (defined ACPI_ASL_COMPILER) || \
+       (defined ACPI_BIN_APP)      || \
+       (defined ACPI_DUMP_APP)     || \
+       (defined ACPI_HELP_APP)     || \
+       (defined ACPI_NAMES_APP)    || \
+       (defined ACPI_SRC_APP)      || \
+       (defined ACPI_XTRACT_APP)   || \
+       (defined ACPI_EXAMPLE_APP)
+#define ACPI_APPLICATION
+#define ACPI_SINGLE_THREADED
+#endif
+
 /* iASL configuration */
 
 #ifdef ACPI_ASL_COMPILER
-#define ACPI_APPLICATION
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_CONSTANT_EVAL_ONLY
 #define ACPI_LARGE_NAMESPACE_NODE
 #define ACPI_DATA_TABLE_DISASSEMBLY
-#define ACPI_SINGLE_THREADED
 #define ACPI_32BIT_PHYSICAL_ADDRESS
-
 #define ACPI_DISASSEMBLER 1
 #endif
 
 #define ACPI_DBG_TRACK_ALLOCATIONS
 #endif
 
-/*
- * acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example
- * configuration. All single threaded.
- */
-#if (defined ACPI_BIN_APP)      || \
-       (defined ACPI_DUMP_APP)     || \
-       (defined ACPI_HELP_APP)     || \
-       (defined ACPI_NAMES_APP)    || \
-       (defined ACPI_SRC_APP)      || \
-       (defined ACPI_XTRACT_APP)   || \
-       (defined ACPI_EXAMPLE_APP)
-#define ACPI_APPLICATION
-#define ACPI_SINGLE_THREADED
-#endif
-
 /* acpi_help configuration. Error messages disabled. */
 
 #ifdef ACPI_HELP_APP
 #define ACPI_REDUCED_HARDWARE 1
 #endif
 
-/* Linkable ACPICA library */
+/* Linkable ACPICA library. Two versions, one with full debug. */
 
 #ifdef ACPI_LIBRARY
 #define ACPI_USE_LOCAL_CACHE
-#define ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER 1
+#define ACPI_DISASSEMBLER 1
+
+#ifdef _DEBUG
+#define ACPI_DEBUG_OUTPUT
+#endif
 #endif
 
 /* Common for all ACPICA applications */
 #elif defined(__HAIKU__)
 #include "achaiku.h"
 
+#elif defined(__QNX__)
+#include "acqnx.h"
+
 #else
 
 /* Unknown environment */
diff --git a/include/acpi/platform/acmsvcex.h b/include/acpi/platform/acmsvcex.h
deleted file mode 100644 (file)
index 28084a1..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/******************************************************************************
- *
- * Name: acmsvcex.h - Extra VC specific defines, etc.
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2016, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, and the following disclaimer,
- *    without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- *    substantially similar to the "NO WARRANTY" disclaimer below
- *    ("Disclaimer") and any redistribution must be conditioned upon
- *    including a substantially similar Disclaimer requirement for further
- *    binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- *    of any contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#ifndef __ACMSVCEX_H__
-#define __ACMSVCEX_H__
-
-/* Debug support. */
-
-#ifdef _DEBUG
-#define _CRTDBG_MAP_ALLOC      /* Enables specific file/lineno for leaks */
-#include <crtdbg.h>
-#endif
-
-#endif                         /* __ACMSVCEX_H__ */
diff --git a/include/acpi/platform/acwinex.h b/include/acpi/platform/acwinex.h
deleted file mode 100644 (file)
index a00b3e4..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/******************************************************************************
- *
- * Name: acwinex.h - Extra OS specific defines, etc.
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2016, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, and the following disclaimer,
- *    without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- *    substantially similar to the "NO WARRANTY" disclaimer below
- *    ("Disclaimer") and any redistribution must be conditioned upon
- *    including a substantially similar Disclaimer requirement for further
- *    binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- *    of any contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#ifndef __ACWINEX_H__
-#define __ACWINEX_H__
-
-/* Windows uses VC */
-
-#endif                         /* __ACWINEX_H__ */
index 5ca2f2c1645811f4893a7c15758da1bccf05bfe7..70a41f74203728ecfd86e5807563110a690238c5 100644 (file)
@@ -4,6 +4,19 @@
 #include <linux/errno.h> /* for ENODEV */
 #include <linux/types.h> /* for bool */
 
+struct acpi_video_brightness_flags {
+       u8 _BCL_no_ac_battery_levels:1; /* no AC/Battery levels in _BCL */
+       u8 _BCL_reversed:1;             /* _BCL package is in a reversed order */
+       u8 _BQC_use_index:1;            /* _BQC returns an index value */
+};
+
+struct acpi_video_device_brightness {
+       int curr;
+       int count;
+       int *levels;
+       struct acpi_video_brightness_flags flags;
+};
+
 struct acpi_device;
 
 #define ACPI_VIDEO_CLASS       "video"
@@ -37,6 +50,8 @@ extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
  * may change over time and should not be cached.
  */
 extern bool acpi_video_handles_brightness_key_presses(void);
+extern int acpi_video_get_levels(struct acpi_device *device,
+                                struct acpi_video_device_brightness **dev_br);
 #else
 static inline int acpi_video_register(void) { return 0; }
 static inline void acpi_video_unregister(void) { return; }
@@ -56,6 +71,11 @@ static inline bool acpi_video_handles_brightness_key_presses(void)
 {
        return false;
 }
+static inline int acpi_video_get_levels(struct acpi_device *device,
+                       struct acpi_video_device_brightness **dev_br)
+{
+       return -ENODEV;
+}
 #endif
 
 #endif
index 58f707a399c2a4d7196ffda6346ec11ba2d29d07..b25690bceab63411386eaa449e70a7fae5485618 100644 (file)
@@ -190,14 +190,6 @@ static inline int acpi_debugger_notify_command_complete(void)
 }
 #endif
 
-#ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
-void acpi_initrd_override(void *data, size_t size);
-#else
-static inline void acpi_initrd_override(void *data, size_t size)
-{
-}
-#endif
-
 #define BAD_MADT_ENTRY(entry, end) (                                       \
                (!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
                ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
@@ -216,6 +208,7 @@ void acpi_boot_table_init (void);
 int acpi_mps_check (void);
 int acpi_numa_init (void);
 
+void early_acpi_table_init(void *data, size_t size);
 int acpi_table_init (void);
 int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
 int __init acpi_parse_entries(char *id, unsigned long table_size,
@@ -278,6 +271,7 @@ void acpi_irq_stats_init(void);
 extern u32 acpi_irq_handled;
 extern u32 acpi_irq_not_handled;
 extern unsigned int acpi_sci_irq;
+extern bool acpi_no_s5;
 #define INVALID_ACPI_IRQ       ((unsigned)-1)
 static inline bool acpi_sci_irq_valid(void)
 {
@@ -595,6 +589,7 @@ static inline const char *acpi_dev_name(struct acpi_device *adev)
        return NULL;
 }
 
+static inline void early_acpi_table_init(void *data, size_t size) { }
 static inline void acpi_early_init(void) { }
 static inline void acpi_subsystem_init(void) { }
 
index 1e7a69adbe6f6992fa955e1c907d0820a224d177..5f2fd61ef4fb12ec52d3384abab93fabd87c084a 100644 (file)
@@ -141,9 +141,10 @@ extern void devm_backlight_device_unregister(struct device *dev,
                                        struct backlight_device *bd);
 extern void backlight_force_update(struct backlight_device *bd,
                                   enum backlight_update_reason reason);
-extern bool backlight_device_registered(enum backlight_type type);
 extern int backlight_register_notifier(struct notifier_block *nb);
 extern int backlight_unregister_notifier(struct notifier_block *nb);
+extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type);
+extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness);
 
 #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
 
index 21ee41b92e8aaad2030f0d86c614dc4bfc4b5c5a..f1d5c5acc8dd58cd92df76915391b4737d90c083 100644 (file)
@@ -171,12 +171,13 @@ void bpf_register_prog_type(struct bpf_prog_type_list *tl);
 void bpf_register_map_type(struct bpf_map_type_list *tl);
 
 struct bpf_prog *bpf_prog_get(u32 ufd);
+struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog);
 void bpf_prog_put(struct bpf_prog *prog);
 void bpf_prog_put_rcu(struct bpf_prog *prog);
 
 struct bpf_map *bpf_map_get_with_uref(u32 ufd);
 struct bpf_map *__bpf_map_get(struct fd f);
-void bpf_map_inc(struct bpf_map *map, bool uref);
+struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref);
 void bpf_map_put_with_uref(struct bpf_map *map);
 void bpf_map_put(struct bpf_map *map);
 int bpf_map_precharge_memlock(u32 pages);
index 1afde47e1528c36ad8613c2e56fb23d1f614e476..79c52fa81cac9ea2dd3a1bea6e1093cd81fdb79c 100644 (file)
 #error Wordsize not 32 or 64
 #endif
 
+/*
+ * The above primes are actively bad for hashing, since they are
+ * too sparse. The 32-bit one is mostly ok, the 64-bit one causes
+ * real problems. Besides, the "prime" part is pointless for the
+ * multiplicative hash.
+ *
+ * Although a random odd number will do, it turns out that the golden
+ * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice
+ * properties.
+ *
+ * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2.
+ * (See Knuth vol 3, section 6.4, exercise 9.)
+ */
+#define GOLDEN_RATIO_32 0x61C88647
+#define GOLDEN_RATIO_64 0x61C8864680B583EBull
+
 static __always_inline u64 hash_64(u64 val, unsigned int bits)
 {
        u64 hash = val;
 
-#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
-       hash = hash * GOLDEN_RATIO_PRIME_64;
+#if BITS_PER_LONG == 64
+       hash = hash * GOLDEN_RATIO_64;
 #else
        /*  Sigh, gcc can't optimise this alone like it does for 32 bits. */
        u64 n = hash;
index d5569734f6724d6194497fe9842e9aac56ef0b09..548fd535fd02399634bace0607471d07b973d8dc 100644 (file)
@@ -28,6 +28,11 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
        return (struct ethhdr *)skb_mac_header(skb);
 }
 
+static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
+{
+       return (struct ethhdr *)skb_inner_mac_header(skb);
+}
+
 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
 
 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
index 49175e4ced11288c535eb41cf967683858d6bc3b..f840d77c6c313cdeecad084e366a762b00512319 100644 (file)
@@ -246,7 +246,15 @@ do {                                                               \
        net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
 #define net_info_ratelimited(fmt, ...)                         \
        net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
-#if defined(DEBUG)
+#if defined(CONFIG_DYNAMIC_DEBUG)
+#define net_dbg_ratelimited(fmt, ...)                                  \
+do {                                                                   \
+       DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);                 \
+       if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&        \
+           net_ratelimit())                                            \
+               __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__);    \
+} while (0)
+#elif defined(DEBUG)
 #define net_dbg_ratelimited(fmt, ...)                          \
        net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
 #else
index 8395308a24456028f22621c5e00f757c4c817576..b3c46b019ac1435c9da1d6c308b14b3ad849d279 100644 (file)
@@ -4004,7 +4004,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb);
 
 static inline bool net_gso_ok(netdev_features_t features, int gso_type)
 {
-       netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
+       netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
 
        /* check flags correspondence */
        BUILD_BUG_ON(SKB_GSO_TCPV4   != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
index 7fcb681baadf172824017d067721c65189638565..31758036787c3a490bb4aa31dda27b8a12be48da 100644 (file)
@@ -133,7 +133,7 @@ void of_core_init(void);
 
 static inline bool is_of_node(struct fwnode_handle *fwnode)
 {
-       return fwnode && fwnode->type == FWNODE_OF;
+       return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF;
 }
 
 static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
index f4ed4f1b0c77ac84f65a4586502863fd78448063..6b052aa7b5b79de6712ee36fe3a424f6f93bd548 100644 (file)
@@ -516,6 +516,27 @@ static inline int PageTransCompound(struct page *page)
        return PageCompound(page);
 }
 
+/*
+ * PageTransCompoundMap is the same as PageTransCompound, but it also
+ * guarantees the primary MMU has the entire compound page mapped
+ * through pmd_trans_huge, which in turn guarantees the secondary MMUs
+ * can also map the entire compound page. This allows the secondary
+ * MMUs to call get_user_pages() only once for each compound page and
+ * to immediately map the entire compound page with a single secondary
+ * MMU fault. If there will be a pmd split later, the secondary MMUs
+ * will get an update through the MMU notifier invalidation through
+ * split_huge_pmd().
+ *
+ * Unlike PageTransCompound, this is safe to be called only while
+ * split_huge_pmd() cannot run from under us, like if protected by the
+ * MMU notifier, otherwise it may result in page->_mapcount < 0 false
+ * positives.
+ */
+static inline int PageTransCompoundMap(struct page *page)
+{
+       return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;
+}
+
 /*
  * PageTransTail returns true for both transparent huge pages
  * and hugetlbfs pages, so it should only be called when it's known
@@ -559,6 +580,7 @@ static inline int TestClearPageDoubleMap(struct page *page)
 #else
 TESTPAGEFLAG_FALSE(TransHuge)
 TESTPAGEFLAG_FALSE(TransCompound)
+TESTPAGEFLAG_FALSE(TransCompoundMap)
 TESTPAGEFLAG_FALSE(TransTail)
 TESTPAGEFLAG_FALSE(DoubleMap)
        TESTSETFLAG_FALSE(DoubleMap)
diff --git a/include/linux/rio_mport_cdev.h b/include/linux/rio_mport_cdev.h
deleted file mode 100644 (file)
index b65d19d..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 2015-2016, Integrated Device Technology Inc.
- * Copyright (c) 2015, Prodrive Technologies
- * Copyright (c) 2015, Texas Instruments Incorporated
- * Copyright (c) 2015, RapidIO Trade Association
- * All rights reserved.
- *
- * This software is available to you under a choice of one of two licenses.
- * You may choose to be licensed under the terms of the GNU General Public
- * License(GPL) Version 2, or the BSD-3 Clause license below:
- *
- * 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.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its contributors
- * may be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RIO_MPORT_CDEV_H_
-#define _RIO_MPORT_CDEV_H_
-
-#ifndef __user
-#define __user
-#endif
-
-struct rio_mport_maint_io {
-       uint32_t rioid;         /* destID of remote device */
-       uint32_t hopcount;      /* hopcount to remote device */
-       uint32_t offset;        /* offset in register space */
-       size_t length;          /* length in bytes */
-       void __user *buffer;    /* data buffer */
-};
-
-/*
- * Definitions for RapidIO data transfers:
- * - memory mapped (MAPPED)
- * - packet generation from memory (TRANSFER)
- */
-#define RIO_TRANSFER_MODE_MAPPED       (1 << 0)
-#define RIO_TRANSFER_MODE_TRANSFER     (1 << 1)
-#define RIO_CAP_DBL_SEND               (1 << 2)
-#define RIO_CAP_DBL_RECV               (1 << 3)
-#define RIO_CAP_PW_SEND                        (1 << 4)
-#define RIO_CAP_PW_RECV                        (1 << 5)
-#define RIO_CAP_MAP_OUTB               (1 << 6)
-#define RIO_CAP_MAP_INB                        (1 << 7)
-
-struct rio_mport_properties {
-       uint16_t hdid;
-       uint8_t id;                     /* Physical port ID */
-       uint8_t  index;
-       uint32_t flags;
-       uint32_t sys_size;              /* Default addressing size */
-       uint8_t  port_ok;
-       uint8_t  link_speed;
-       uint8_t  link_width;
-       uint32_t dma_max_sge;
-       uint32_t dma_max_size;
-       uint32_t dma_align;
-       uint32_t transfer_mode;         /* Default transfer mode */
-       uint32_t cap_sys_size;          /* Capable system sizes */
-       uint32_t cap_addr_size;         /* Capable addressing sizes */
-       uint32_t cap_transfer_mode;     /* Capable transfer modes */
-       uint32_t cap_mport;             /* Mport capabilities */
-};
-
-/*
- * Definitions for RapidIO events;
- * - incoming port-writes
- * - incoming doorbells
- */
-#define RIO_DOORBELL   (1 << 0)
-#define RIO_PORTWRITE  (1 << 1)
-
-struct rio_doorbell {
-       uint32_t rioid;
-       uint16_t payload;
-};
-
-struct rio_doorbell_filter {
-       uint32_t rioid;                 /* 0xffffffff to match all ids */
-       uint16_t low;
-       uint16_t high;
-};
-
-
-struct rio_portwrite {
-       uint32_t payload[16];
-};
-
-struct rio_pw_filter {
-       uint32_t mask;
-       uint32_t low;
-       uint32_t high;
-};
-
-/* RapidIO base address for inbound requests set to value defined below
- * indicates that no specific RIO-to-local address translation is requested
- * and driver should use direct (one-to-one) address mapping.
-*/
-#define RIO_MAP_ANY_ADDR       (uint64_t)(~((uint64_t) 0))
-
-struct rio_mmap {
-       uint32_t rioid;
-       uint64_t rio_addr;
-       uint64_t length;
-       uint64_t handle;
-       void *address;
-};
-
-struct rio_dma_mem {
-       uint64_t length;                /* length of DMA memory */
-       uint64_t dma_handle;            /* handle associated with this memory */
-       void *buffer;                   /* pointer to this memory */
-};
-
-
-struct rio_event {
-       unsigned int header;    /* event type RIO_DOORBELL or RIO_PORTWRITE */
-       union {
-               struct rio_doorbell doorbell;   /* header for RIO_DOORBELL */
-               struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */
-       } u;
-};
-
-enum rio_transfer_sync {
-       RIO_TRANSFER_SYNC,      /* synchronous transfer */
-       RIO_TRANSFER_ASYNC,     /* asynchronous transfer */
-       RIO_TRANSFER_FAF,       /* fire-and-forget transfer */
-};
-
-enum rio_transfer_dir {
-       RIO_TRANSFER_DIR_READ,  /* Read operation */
-       RIO_TRANSFER_DIR_WRITE, /* Write operation */
-};
-
-/*
- * RapidIO data exchange transactions are lists of individual transfers. Each
- * transfer exchanges data between two RapidIO devices by remote direct memory
- * access and has its own completion code.
- *
- * The RapidIO specification defines four types of data exchange requests:
- * NREAD, NWRITE, SWRITE and NWRITE_R. The RapidIO DMA channel interface allows
- * to specify the required type of write operation or combination of them when
- * only the last data packet requires response.
- *
- * NREAD:    read up to 256 bytes from remote device memory into local memory
- * NWRITE:   write up to 256 bytes from local memory to remote device memory
- *           without confirmation
- * SWRITE:   as NWRITE, but all addresses and payloads must be 64-bit aligned
- * NWRITE_R: as NWRITE, but expect acknowledgment from remote device.
- *
- * The default exchange is chosen from NREAD and any of the WRITE modes as the
- * driver sees fit. For write requests the user can explicitly choose between
- * any of the write modes for each transaction.
- */
-enum rio_exchange {
-       RIO_EXCHANGE_DEFAULT,   /* Default method */
-       RIO_EXCHANGE_NWRITE,    /* All packets using NWRITE */
-       RIO_EXCHANGE_SWRITE,    /* All packets using SWRITE */
-       RIO_EXCHANGE_NWRITE_R,  /* Last packet NWRITE_R, others NWRITE */
-       RIO_EXCHANGE_SWRITE_R,  /* Last packet NWRITE_R, others SWRITE */
-       RIO_EXCHANGE_NWRITE_R_ALL, /* All packets using NWRITE_R */
-};
-
-struct rio_transfer_io {
-       uint32_t rioid;                 /* Target destID */
-       uint64_t rio_addr;              /* Address in target's RIO mem space */
-       enum rio_exchange method;       /* Data exchange method */
-       void __user *loc_addr;
-       uint64_t handle;
-       uint64_t offset;                /* Offset in buffer */
-       uint64_t length;                /* Length in bytes */
-       uint32_t completion_code;       /* Completion code for this transfer */
-};
-
-struct rio_transaction {
-       uint32_t transfer_mode;         /* Data transfer mode */
-       enum rio_transfer_sync sync;    /* Synchronization method */
-       enum rio_transfer_dir dir;      /* Transfer direction */
-       size_t count;                   /* Number of transfers */
-       struct rio_transfer_io __user *block;   /* Array of <count> transfers */
-};
-
-struct rio_async_tx_wait {
-       uint32_t token;         /* DMA transaction ID token */
-       uint32_t timeout;       /* Wait timeout in msec, if 0 use default TO */
-};
-
-#define RIO_MAX_DEVNAME_SZ     20
-
-struct rio_rdev_info {
-       uint32_t destid;
-       uint8_t hopcount;
-       uint32_t comptag;
-       char name[RIO_MAX_DEVNAME_SZ + 1];
-};
-
-/* Driver IOCTL codes */
-#define RIO_MPORT_DRV_MAGIC           'm'
-
-#define RIO_MPORT_MAINT_HDID_SET       \
-       _IOW(RIO_MPORT_DRV_MAGIC, 1, uint16_t)
-#define RIO_MPORT_MAINT_COMPTAG_SET    \
-       _IOW(RIO_MPORT_DRV_MAGIC, 2, uint32_t)
-#define RIO_MPORT_MAINT_PORT_IDX_GET   \
-       _IOR(RIO_MPORT_DRV_MAGIC, 3, uint32_t)
-#define RIO_MPORT_GET_PROPERTIES \
-       _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties)
-#define RIO_MPORT_MAINT_READ_LOCAL \
-       _IOR(RIO_MPORT_DRV_MAGIC, 5, struct rio_mport_maint_io)
-#define RIO_MPORT_MAINT_WRITE_LOCAL \
-       _IOW(RIO_MPORT_DRV_MAGIC, 6, struct rio_mport_maint_io)
-#define RIO_MPORT_MAINT_READ_REMOTE \
-       _IOR(RIO_MPORT_DRV_MAGIC, 7, struct rio_mport_maint_io)
-#define RIO_MPORT_MAINT_WRITE_REMOTE \
-       _IOW(RIO_MPORT_DRV_MAGIC, 8, struct rio_mport_maint_io)
-#define RIO_ENABLE_DOORBELL_RANGE      \
-       _IOW(RIO_MPORT_DRV_MAGIC, 9, struct rio_doorbell_filter)
-#define RIO_DISABLE_DOORBELL_RANGE     \
-       _IOW(RIO_MPORT_DRV_MAGIC, 10, struct rio_doorbell_filter)
-#define RIO_ENABLE_PORTWRITE_RANGE     \
-       _IOW(RIO_MPORT_DRV_MAGIC, 11, struct rio_pw_filter)
-#define RIO_DISABLE_PORTWRITE_RANGE    \
-       _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter)
-#define RIO_SET_EVENT_MASK             \
-       _IOW(RIO_MPORT_DRV_MAGIC, 13, unsigned int)
-#define RIO_GET_EVENT_MASK             \
-       _IOR(RIO_MPORT_DRV_MAGIC, 14, unsigned int)
-#define RIO_MAP_OUTBOUND \
-       _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap)
-#define RIO_UNMAP_OUTBOUND \
-       _IOW(RIO_MPORT_DRV_MAGIC, 16, struct rio_mmap)
-#define RIO_MAP_INBOUND \
-       _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap)
-#define RIO_UNMAP_INBOUND \
-       _IOW(RIO_MPORT_DRV_MAGIC, 18, uint64_t)
-#define RIO_ALLOC_DMA \
-       _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem)
-#define RIO_FREE_DMA \
-       _IOW(RIO_MPORT_DRV_MAGIC, 20, uint64_t)
-#define RIO_TRANSFER \
-       _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction)
-#define RIO_WAIT_FOR_ASYNC \
-       _IOW(RIO_MPORT_DRV_MAGIC, 22, struct rio_async_tx_wait)
-#define RIO_DEV_ADD \
-       _IOW(RIO_MPORT_DRV_MAGIC, 23, struct rio_rdev_info)
-#define RIO_DEV_DEL \
-       _IOW(RIO_MPORT_DRV_MAGIC, 24, struct rio_rdev_info)
-
-#endif /* _RIO_MPORT_CDEV_H_ */
index 2b83359c19cabee6dc211c887518d001f05081f4..0a4cd4703f403f0d65f867aaa6dcc3e128fcde05 100644 (file)
@@ -533,6 +533,10 @@ static inline swp_entry_t get_swap_page(void)
 #ifdef CONFIG_MEMCG
 static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
 {
+       /* Cgroup2 doesn't have per-cgroup swappiness */
+       if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
+               return vm_swappiness;
+
        /* root ? */
        if (mem_cgroup_disabled() || !memcg->css.parent)
                return vm_swappiness;
index 73ed2e951c020d28c21457d907c55764ea7b3d88..35437c779da8d6d6d113ed0deedbd39428852238 100644 (file)
@@ -252,7 +252,9 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
            (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
             skb->inner_protocol != htons(ETH_P_TEB) ||
             (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
-             sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
+             sizeof(struct udphdr) + sizeof(struct vxlanhdr)) ||
+            (skb->ip_summed != CHECKSUM_NONE &&
+             !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto))))
                return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
 
        return features;
index 6e0f5f01734cb893bfec236bd39bb012d333e510..c51afb71bfabc658b16be2773ad5a0e78ca1d09b 100644 (file)
@@ -718,9 +718,9 @@ __SYSCALL(__NR_mlock2, sys_mlock2)
 #define __NR_copy_file_range 285
 __SYSCALL(__NR_copy_file_range, sys_copy_file_range)
 #define __NR_preadv2 286
-__SYSCALL(__NR_preadv2, sys_preadv2)
+__SC_COMP(__NR_preadv2, sys_preadv2, compat_sys_preadv2)
 #define __NR_pwritev2 287
-__SYSCALL(__NR_pwritev2, sys_pwritev2)
+__SC_COMP(__NR_pwritev2, sys_pwritev2, compat_sys_pwritev2)
 
 #undef __NR_syscalls
 #define __NR_syscalls 288
diff --git a/include/uapi/linux/rio_mport_cdev.h b/include/uapi/linux/rio_mport_cdev.h
new file mode 100644 (file)
index 0000000..5796bf1
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2015-2016, Integrated Device Technology Inc.
+ * Copyright (c) 2015, Prodrive Technologies
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * Copyright (c) 2015, RapidIO Trade Association
+ * All rights reserved.
+ *
+ * This software is available to you under a choice of one of two licenses.
+ * You may choose to be licensed under the terms of the GNU General Public
+ * License(GPL) Version 2, or the BSD-3 Clause license below:
+ *
+ * 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.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RIO_MPORT_CDEV_H_
+#define _RIO_MPORT_CDEV_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+struct rio_mport_maint_io {
+       __u16 rioid;            /* destID of remote device */
+       __u8  hopcount;         /* hopcount to remote device */
+       __u8  pad0[5];
+       __u32 offset;           /* offset in register space */
+       __u32 length;           /* length in bytes */
+       __u64 buffer;           /* pointer to data buffer */
+};
+
+/*
+ * Definitions for RapidIO data transfers:
+ * - memory mapped (MAPPED)
+ * - packet generation from memory (TRANSFER)
+ */
+#define RIO_TRANSFER_MODE_MAPPED       (1 << 0)
+#define RIO_TRANSFER_MODE_TRANSFER     (1 << 1)
+#define RIO_CAP_DBL_SEND               (1 << 2)
+#define RIO_CAP_DBL_RECV               (1 << 3)
+#define RIO_CAP_PW_SEND                        (1 << 4)
+#define RIO_CAP_PW_RECV                        (1 << 5)
+#define RIO_CAP_MAP_OUTB               (1 << 6)
+#define RIO_CAP_MAP_INB                        (1 << 7)
+
+struct rio_mport_properties {
+       __u16 hdid;
+       __u8  id;                       /* Physical port ID */
+       __u8  index;
+       __u32 flags;
+       __u32 sys_size;         /* Default addressing size */
+       __u8  port_ok;
+       __u8  link_speed;
+       __u8  link_width;
+       __u8  pad0;
+       __u32 dma_max_sge;
+       __u32 dma_max_size;
+       __u32 dma_align;
+       __u32 transfer_mode;            /* Default transfer mode */
+       __u32 cap_sys_size;             /* Capable system sizes */
+       __u32 cap_addr_size;            /* Capable addressing sizes */
+       __u32 cap_transfer_mode;        /* Capable transfer modes */
+       __u32 cap_mport;                /* Mport capabilities */
+};
+
+/*
+ * Definitions for RapidIO events;
+ * - incoming port-writes
+ * - incoming doorbells
+ */
+#define RIO_DOORBELL   (1 << 0)
+#define RIO_PORTWRITE  (1 << 1)
+
+struct rio_doorbell {
+       __u16 rioid;
+       __u16 payload;
+};
+
+struct rio_doorbell_filter {
+       __u16 rioid;    /* Use RIO_INVALID_DESTID to match all ids */
+       __u16 low;
+       __u16 high;
+       __u16 pad0;
+};
+
+
+struct rio_portwrite {
+       __u32 payload[16];
+};
+
+struct rio_pw_filter {
+       __u32 mask;
+       __u32 low;
+       __u32 high;
+       __u32 pad0;
+};
+
+/* RapidIO base address for inbound requests set to value defined below
+ * indicates that no specific RIO-to-local address translation is requested
+ * and driver should use direct (one-to-one) address mapping.
+*/
+#define RIO_MAP_ANY_ADDR       (__u64)(~((__u64) 0))
+
+struct rio_mmap {
+       __u16 rioid;
+       __u16 pad0[3];
+       __u64 rio_addr;
+       __u64 length;
+       __u64 handle;
+       __u64 address;
+};
+
+struct rio_dma_mem {
+       __u64 length;           /* length of DMA memory */
+       __u64 dma_handle;       /* handle associated with this memory */
+       __u64 address;
+};
+
+struct rio_event {
+       __u32 header;   /* event type RIO_DOORBELL or RIO_PORTWRITE */
+       union {
+               struct rio_doorbell doorbell;   /* header for RIO_DOORBELL */
+               struct rio_portwrite portwrite; /* header for RIO_PORTWRITE */
+       } u;
+       __u32 pad0;
+};
+
+enum rio_transfer_sync {
+       RIO_TRANSFER_SYNC,      /* synchronous transfer */
+       RIO_TRANSFER_ASYNC,     /* asynchronous transfer */
+       RIO_TRANSFER_FAF,       /* fire-and-forget transfer */
+};
+
+enum rio_transfer_dir {
+       RIO_TRANSFER_DIR_READ,  /* Read operation */
+       RIO_TRANSFER_DIR_WRITE, /* Write operation */
+};
+
+/*
+ * RapidIO data exchange transactions are lists of individual transfers. Each
+ * transfer exchanges data between two RapidIO devices by remote direct memory
+ * access and has its own completion code.
+ *
+ * The RapidIO specification defines four types of data exchange requests:
+ * NREAD, NWRITE, SWRITE and NWRITE_R. The RapidIO DMA channel interface allows
+ * to specify the required type of write operation or combination of them when
+ * only the last data packet requires response.
+ *
+ * NREAD:    read up to 256 bytes from remote device memory into local memory
+ * NWRITE:   write up to 256 bytes from local memory to remote device memory
+ *           without confirmation
+ * SWRITE:   as NWRITE, but all addresses and payloads must be 64-bit aligned
+ * NWRITE_R: as NWRITE, but expect acknowledgment from remote device.
+ *
+ * The default exchange is chosen from NREAD and any of the WRITE modes as the
+ * driver sees fit. For write requests the user can explicitly choose between
+ * any of the write modes for each transaction.
+ */
+enum rio_exchange {
+       RIO_EXCHANGE_DEFAULT,   /* Default method */
+       RIO_EXCHANGE_NWRITE,    /* All packets using NWRITE */
+       RIO_EXCHANGE_SWRITE,    /* All packets using SWRITE */
+       RIO_EXCHANGE_NWRITE_R,  /* Last packet NWRITE_R, others NWRITE */
+       RIO_EXCHANGE_SWRITE_R,  /* Last packet NWRITE_R, others SWRITE */
+       RIO_EXCHANGE_NWRITE_R_ALL, /* All packets using NWRITE_R */
+};
+
+struct rio_transfer_io {
+       __u64 rio_addr; /* Address in target's RIO mem space */
+       __u64 loc_addr;
+       __u64 handle;
+       __u64 offset;   /* Offset in buffer */
+       __u64 length;   /* Length in bytes */
+       __u16 rioid;    /* Target destID */
+       __u16 method;   /* Data exchange method, one of rio_exchange enum */
+       __u32 completion_code;  /* Completion code for this transfer */
+};
+
+struct rio_transaction {
+       __u64 block;    /* Pointer to array of <count> transfers */
+       __u32 count;    /* Number of transfers */
+       __u32 transfer_mode;    /* Data transfer mode */
+       __u16 sync;     /* Synch method, one of rio_transfer_sync enum */
+       __u16 dir;      /* Transfer direction, one of rio_transfer_dir enum */
+       __u32 pad0;
+};
+
+struct rio_async_tx_wait {
+       __u32 token;    /* DMA transaction ID token */
+       __u32 timeout;  /* Wait timeout in msec, if 0 use default TO */
+};
+
+#define RIO_MAX_DEVNAME_SZ     20
+
+struct rio_rdev_info {
+       __u16 destid;
+       __u8 hopcount;
+       __u8 pad0;
+       __u32 comptag;
+       char name[RIO_MAX_DEVNAME_SZ + 1];
+};
+
+/* Driver IOCTL codes */
+#define RIO_MPORT_DRV_MAGIC           'm'
+
+#define RIO_MPORT_MAINT_HDID_SET       \
+       _IOW(RIO_MPORT_DRV_MAGIC, 1, __u16)
+#define RIO_MPORT_MAINT_COMPTAG_SET    \
+       _IOW(RIO_MPORT_DRV_MAGIC, 2, __u32)
+#define RIO_MPORT_MAINT_PORT_IDX_GET   \
+       _IOR(RIO_MPORT_DRV_MAGIC, 3, __u32)
+#define RIO_MPORT_GET_PROPERTIES \
+       _IOR(RIO_MPORT_DRV_MAGIC, 4, struct rio_mport_properties)
+#define RIO_MPORT_MAINT_READ_LOCAL \
+       _IOR(RIO_MPORT_DRV_MAGIC, 5, struct rio_mport_maint_io)
+#define RIO_MPORT_MAINT_WRITE_LOCAL \
+       _IOW(RIO_MPORT_DRV_MAGIC, 6, struct rio_mport_maint_io)
+#define RIO_MPORT_MAINT_READ_REMOTE \
+       _IOR(RIO_MPORT_DRV_MAGIC, 7, struct rio_mport_maint_io)
+#define RIO_MPORT_MAINT_WRITE_REMOTE \
+       _IOW(RIO_MPORT_DRV_MAGIC, 8, struct rio_mport_maint_io)
+#define RIO_ENABLE_DOORBELL_RANGE      \
+       _IOW(RIO_MPORT_DRV_MAGIC, 9, struct rio_doorbell_filter)
+#define RIO_DISABLE_DOORBELL_RANGE     \
+       _IOW(RIO_MPORT_DRV_MAGIC, 10, struct rio_doorbell_filter)
+#define RIO_ENABLE_PORTWRITE_RANGE     \
+       _IOW(RIO_MPORT_DRV_MAGIC, 11, struct rio_pw_filter)
+#define RIO_DISABLE_PORTWRITE_RANGE    \
+       _IOW(RIO_MPORT_DRV_MAGIC, 12, struct rio_pw_filter)
+#define RIO_SET_EVENT_MASK             \
+       _IOW(RIO_MPORT_DRV_MAGIC, 13, __u32)
+#define RIO_GET_EVENT_MASK             \
+       _IOR(RIO_MPORT_DRV_MAGIC, 14, __u32)
+#define RIO_MAP_OUTBOUND \
+       _IOWR(RIO_MPORT_DRV_MAGIC, 15, struct rio_mmap)
+#define RIO_UNMAP_OUTBOUND \
+       _IOW(RIO_MPORT_DRV_MAGIC, 16, struct rio_mmap)
+#define RIO_MAP_INBOUND \
+       _IOWR(RIO_MPORT_DRV_MAGIC, 17, struct rio_mmap)
+#define RIO_UNMAP_INBOUND \
+       _IOW(RIO_MPORT_DRV_MAGIC, 18, __u64)
+#define RIO_ALLOC_DMA \
+       _IOWR(RIO_MPORT_DRV_MAGIC, 19, struct rio_dma_mem)
+#define RIO_FREE_DMA \
+       _IOW(RIO_MPORT_DRV_MAGIC, 20, __u64)
+#define RIO_TRANSFER \
+       _IOWR(RIO_MPORT_DRV_MAGIC, 21, struct rio_transaction)
+#define RIO_WAIT_FOR_ASYNC \
+       _IOW(RIO_MPORT_DRV_MAGIC, 22, struct rio_async_tx_wait)
+#define RIO_DEV_ADD \
+       _IOW(RIO_MPORT_DRV_MAGIC, 23, struct rio_rdev_info)
+#define RIO_DEV_DEL \
+       _IOW(RIO_MPORT_DRV_MAGIC, 24, struct rio_rdev_info)
+
+#endif /* _RIO_MPORT_CDEV_H_ */
index 3f10e5317b46b3858479b2af949d5a719bc72405..8f3a8f606fd95b723d9ed26e179c8a741250717f 100644 (file)
@@ -45,9 +45,7 @@
 
 static inline __attribute_const__ __u16 __fswab16(__u16 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP16__
-       return __builtin_bswap16(val);
-#elif defined (__arch_swab16)
+#if defined (__arch_swab16)
        return __arch_swab16(val);
 #else
        return ___constant_swab16(val);
@@ -56,9 +54,7 @@ static inline __attribute_const__ __u16 __fswab16(__u16 val)
 
 static inline __attribute_const__ __u32 __fswab32(__u32 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP32__
-       return __builtin_bswap32(val);
-#elif defined(__arch_swab32)
+#if defined(__arch_swab32)
        return __arch_swab32(val);
 #else
        return ___constant_swab32(val);
@@ -67,9 +63,7 @@ static inline __attribute_const__ __u32 __fswab32(__u32 val)
 
 static inline __attribute_const__ __u64 __fswab64(__u64 val)
 {
-#ifdef __HAVE_BUILTIN_BSWAP64__
-       return __builtin_bswap64(val);
-#elif defined (__arch_swab64)
+#if defined (__arch_swab64)
        return __arch_swab64(val);
 #elif defined(__SWAB_64_THRU_32__)
        __u32 h = val >> 32;
@@ -102,28 +96,40 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
  * __swab16 - return a byteswapped 16-bit value
  * @x: value to byteswap
  */
+#ifdef __HAVE_BUILTIN_BSWAP16__
+#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
+#else
 #define __swab16(x)                            \
        (__builtin_constant_p((__u16)(x)) ?     \
        ___constant_swab16(x) :                 \
        __fswab16(x))
+#endif
 
 /**
  * __swab32 - return a byteswapped 32-bit value
  * @x: value to byteswap
  */
+#ifdef __HAVE_BUILTIN_BSWAP32__
+#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
+#else
 #define __swab32(x)                            \
        (__builtin_constant_p((__u32)(x)) ?     \
        ___constant_swab32(x) :                 \
        __fswab32(x))
+#endif
 
 /**
  * __swab64 - return a byteswapped 64-bit value
  * @x: value to byteswap
  */
+#ifdef __HAVE_BUILTIN_BSWAP64__
+#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
+#else
 #define __swab64(x)                            \
        (__builtin_constant_p((__u64)(x)) ?     \
        ___constant_swab64(x) :                 \
        __fswab64(x))
+#endif
 
 /**
  * __swahw32 - return a word-swapped 32-bit value
index 96294ac937552178531266cb16ce04185e47c99a..9dc46cb8a0fd79be7f4bdae7ae8f5f4dbdcdb7f4 100644 (file)
@@ -15,9 +15,9 @@
  */
 
 #define xen_pfn_to_page(xen_pfn)       \
-       ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT)))
+       (pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT)))
 #define page_to_xen_pfn(page)          \
-       (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT)
+       ((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT))
 
 #define XEN_PFN_PER_PAGE       (PAGE_SIZE / XEN_PAGE_SIZE)
 
index f2ece3c174a5b540b40492833048d6c8bd9f3f1c..8f94ca1860cfdcdd9509e40d40c3ad7cbf572e2d 100644 (file)
@@ -31,10 +31,10 @@ static void *bpf_any_get(void *raw, enum bpf_type type)
 {
        switch (type) {
        case BPF_TYPE_PROG:
-               atomic_inc(&((struct bpf_prog *)raw)->aux->refcnt);
+               raw = bpf_prog_inc(raw);
                break;
        case BPF_TYPE_MAP:
-               bpf_map_inc(raw, true);
+               raw = bpf_map_inc(raw, true);
                break;
        default:
                WARN_ON_ONCE(1);
@@ -297,7 +297,8 @@ static void *bpf_obj_do_get(const struct filename *pathname,
                goto out;
 
        raw = bpf_any_get(inode->i_private, *type);
-       touch_atime(&path);
+       if (!IS_ERR(raw))
+               touch_atime(&path);
 
        path_put(&path);
        return raw;
index adc5e4bd74f8bc3310cfe4b75257647886b2e11f..cf5e9f7ad13ad13ebb5b6bc5a775beca834c7c86 100644 (file)
@@ -218,11 +218,18 @@ struct bpf_map *__bpf_map_get(struct fd f)
        return f.file->private_data;
 }
 
-void bpf_map_inc(struct bpf_map *map, bool uref)
+/* prog's and map's refcnt limit */
+#define BPF_MAX_REFCNT 32768
+
+struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref)
 {
-       atomic_inc(&map->refcnt);
+       if (atomic_inc_return(&map->refcnt) > BPF_MAX_REFCNT) {
+               atomic_dec(&map->refcnt);
+               return ERR_PTR(-EBUSY);
+       }
        if (uref)
                atomic_inc(&map->usercnt);
+       return map;
 }
 
 struct bpf_map *bpf_map_get_with_uref(u32 ufd)
@@ -234,7 +241,7 @@ struct bpf_map *bpf_map_get_with_uref(u32 ufd)
        if (IS_ERR(map))
                return map;
 
-       bpf_map_inc(map, true);
+       map = bpf_map_inc(map, true);
        fdput(f);
 
        return map;
@@ -658,6 +665,15 @@ static struct bpf_prog *__bpf_prog_get(struct fd f)
        return f.file->private_data;
 }
 
+struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
+{
+       if (atomic_inc_return(&prog->aux->refcnt) > BPF_MAX_REFCNT) {
+               atomic_dec(&prog->aux->refcnt);
+               return ERR_PTR(-EBUSY);
+       }
+       return prog;
+}
+
 /* called by sockets/tracing/seccomp before attaching program to an event
  * pairs with bpf_prog_put()
  */
@@ -670,7 +686,7 @@ struct bpf_prog *bpf_prog_get(u32 ufd)
        if (IS_ERR(prog))
                return prog;
 
-       atomic_inc(&prog->aux->refcnt);
+       prog = bpf_prog_inc(prog);
        fdput(f);
 
        return prog;
index db2574e7b8b008395bb8fee53baf513fdc56c392..c5c17a62f509f67385cfb9a587e702646cc19b80 100644 (file)
@@ -239,16 +239,6 @@ static const char * const reg_type_str[] = {
        [CONST_IMM]             = "imm",
 };
 
-static const struct {
-       int map_type;
-       int func_id;
-} func_limit[] = {
-       {BPF_MAP_TYPE_PROG_ARRAY, BPF_FUNC_tail_call},
-       {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_read},
-       {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_output},
-       {BPF_MAP_TYPE_STACK_TRACE, BPF_FUNC_get_stackid},
-};
-
 static void print_verifier_state(struct verifier_env *env)
 {
        enum bpf_reg_type t;
@@ -921,27 +911,52 @@ static int check_func_arg(struct verifier_env *env, u32 regno,
 
 static int check_map_func_compatibility(struct bpf_map *map, int func_id)
 {
-       bool bool_map, bool_func;
-       int i;
-
        if (!map)
                return 0;
 
-       for (i = 0; i < ARRAY_SIZE(func_limit); i++) {
-               bool_map = (map->map_type == func_limit[i].map_type);
-               bool_func = (func_id == func_limit[i].func_id);
-               /* only when map & func pair match it can continue.
-                * don't allow any other map type to be passed into
-                * the special func;
-                */
-               if (bool_func && bool_map != bool_func) {
-                       verbose("cannot pass map_type %d into func %d\n",
-                               map->map_type, func_id);
-                       return -EINVAL;
-               }
+       /* We need a two way check, first is from map perspective ... */
+       switch (map->map_type) {
+       case BPF_MAP_TYPE_PROG_ARRAY:
+               if (func_id != BPF_FUNC_tail_call)
+                       goto error;
+               break;
+       case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
+               if (func_id != BPF_FUNC_perf_event_read &&
+                   func_id != BPF_FUNC_perf_event_output)
+                       goto error;
+               break;
+       case BPF_MAP_TYPE_STACK_TRACE:
+               if (func_id != BPF_FUNC_get_stackid)
+                       goto error;
+               break;
+       default:
+               break;
+       }
+
+       /* ... and second from the function itself. */
+       switch (func_id) {
+       case BPF_FUNC_tail_call:
+               if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY)
+                       goto error;
+               break;
+       case BPF_FUNC_perf_event_read:
+       case BPF_FUNC_perf_event_output:
+               if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
+                       goto error;
+               break;
+       case BPF_FUNC_get_stackid:
+               if (map->map_type != BPF_MAP_TYPE_STACK_TRACE)
+                       goto error;
+               break;
+       default:
+               break;
        }
 
        return 0;
+error:
+       verbose("cannot pass map_type %d into func %d\n",
+               map->map_type, func_id);
+       return -EINVAL;
 }
 
 static int check_call(struct verifier_env *env, int func_id)
@@ -2049,15 +2064,18 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env)
                                return -E2BIG;
                        }
 
-                       /* remember this map */
-                       env->used_maps[env->used_map_cnt++] = map;
-
                        /* hold the map. If the program is rejected by verifier,
                         * the map will be released by release_maps() or it
                         * will be used by the valid program until it's unloaded
                         * and all maps are released in free_bpf_prog_info()
                         */
-                       bpf_map_inc(map, false);
+                       map = bpf_map_inc(map, false);
+                       if (IS_ERR(map)) {
+                               fdput(f);
+                               return PTR_ERR(map);
+                       }
+                       env->used_maps[env->used_map_cnt++] = map;
+
                        fdput(f);
 next_insn:
                        insn++;
index 8b489fcac37bd9d829439feb08d8bac1354c7e71..d1f7149f870439d65b9cfcfbc27d4160bbb1672f 100644 (file)
@@ -596,17 +596,8 @@ bool sched_can_stop_tick(struct rq *rq)
                return false;
 
        /*
-        * FIFO realtime policy runs the highest priority task (after DEADLINE).
-        * Other runnable tasks are of a lower priority. The scheduler tick
-        * isn't needed.
-        */
-       fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;
-       if (fifo_nr_running)
-               return true;
-
-       /*
-        * Round-robin realtime tasks time slice with other tasks at the same
-        * realtime priority.
+        * If there are more than one RR tasks, we need the tick to effect the
+        * actual RR behaviour.
         */
        if (rq->rt.rr_nr_running) {
                if (rq->rt.rr_nr_running == 1)
@@ -615,8 +606,20 @@ bool sched_can_stop_tick(struct rq *rq)
                        return false;
        }
 
-       /* Normal multitasking need periodic preemption checks */
-       if (rq->cfs.nr_running > 1)
+       /*
+        * If there's no RR tasks, but FIFO tasks, we can skip the tick, no
+        * forced preemption between FIFO tasks.
+        */
+       fifo_nr_running = rq->rt.rt_nr_running - rq->rt.rr_nr_running;
+       if (fifo_nr_running)
+               return true;
+
+       /*
+        * If there are no DL,RR/FIFO tasks, there must only be CFS tasks left;
+        * if there's more than one we need the tick for involuntary
+        * preemption.
+        */
+       if (rq->nr_running > 1)
                return false;
 
        return true;
index 05ddc0820771eb7bc456aab9e2f0e5167ce7f023..6f965864cc029ad47f63c67f6713cb79a519599e 100644 (file)
@@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
        trace_create_file("filter", 0644, file->dir, file,
                          &ftrace_event_filter_fops);
 
-       trace_create_file("trigger", 0644, file->dir, file,
-                         &event_trigger_fops);
+       /*
+        * Only event directories that can be enabled should have
+        * triggers.
+        */
+       if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
+               trace_create_file("trigger", 0644, file->dir, file,
+                                 &event_trigger_fops);
 
        trace_create_file("format", 0444, file->dir, call,
                          &ftrace_event_format_fops);
index 9e0b0315a724caf24ea195e275ed431639a262b4..53ad6c0831aebe6d3c9ec7cfc1387fa34ca7ea72 100644 (file)
 
 #define DEPOT_STACK_BITS (sizeof(depot_stack_handle_t) * 8)
 
+#define STACK_ALLOC_NULL_PROTECTION_BITS 1
 #define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */
 #define STACK_ALLOC_SIZE (1LL << (PAGE_SHIFT + STACK_ALLOC_ORDER))
 #define STACK_ALLOC_ALIGN 4
 #define STACK_ALLOC_OFFSET_BITS (STACK_ALLOC_ORDER + PAGE_SHIFT - \
                                        STACK_ALLOC_ALIGN)
-#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - STACK_ALLOC_OFFSET_BITS)
+#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \
+               STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS)
 #define STACK_ALLOC_SLABS_CAP 1024
 #define STACK_ALLOC_MAX_SLABS \
        (((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \
@@ -59,6 +61,7 @@ union handle_parts {
        struct {
                u32 slabindex : STACK_ALLOC_INDEX_BITS;
                u32 offset : STACK_ALLOC_OFFSET_BITS;
+               u32 valid : STACK_ALLOC_NULL_PROTECTION_BITS;
        };
 };
 
@@ -136,6 +139,7 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size,
        stack->size = size;
        stack->handle.slabindex = depot_index;
        stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
+       stack->handle.valid = 1;
        memcpy(stack->entries, entries, size * sizeof(unsigned long));
        depot_offset += required_size;
 
index ccf97b02b85f32d38f6f68a41bedf89b9a1ee596..8fa2540438015c1859724c606072a2770939d954 100644 (file)
@@ -852,16 +852,8 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
                pfn = isolate_migratepages_block(cc, pfn, block_end_pfn,
                                                        ISOLATE_UNEVICTABLE);
 
-               /*
-                * In case of fatal failure, release everything that might
-                * have been isolated in the previous iteration, and signal
-                * the failure back to caller.
-                */
-               if (!pfn) {
-                       putback_movable_pages(&cc->migratepages);
-                       cc->nr_migratepages = 0;
+               if (!pfn)
                        break;
-               }
 
                if (cc->nr_migratepages == COMPACT_CLUSTER_MAX)
                        break;
@@ -1741,7 +1733,7 @@ void compaction_unregister_node(struct node *node)
 
 static inline bool kcompactd_work_requested(pg_data_t *pgdat)
 {
-       return pgdat->kcompactd_max_order > 0;
+       return pgdat->kcompactd_max_order > 0 || kthread_should_stop();
 }
 
 static bool kcompactd_node_suitable(pg_data_t *pgdat)
@@ -1805,6 +1797,8 @@ static void kcompactd_do_work(pg_data_t *pgdat)
                INIT_LIST_HEAD(&cc.freepages);
                INIT_LIST_HEAD(&cc.migratepages);
 
+               if (kthread_should_stop())
+                       return;
                status = compact_zone(zone, &cc);
 
                if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone),
index df67b53ae3c53423b8f3065093a6e65f90dbafb7..f7daa7de8f4867dc871edb8ea3a1ec6189e4d54f 100644 (file)
@@ -3452,7 +3452,7 @@ next:
                }
        }
 
-       pr_info("%lu of %lu THP split", split, total);
+       pr_info("%lu of %lu THP split\n", split, total);
 
        return 0;
 }
@@ -3463,7 +3463,7 @@ static int __init split_huge_pages_debugfs(void)
 {
        void *ret;
 
-       ret = debugfs_create_file("split_huge_pages", 0644, NULL, NULL,
+       ret = debugfs_create_file("split_huge_pages", 0200, NULL, NULL,
                        &split_huge_pages_fops);
        if (!ret)
                pr_warn("Failed to create split_huge_pages in debugfs");
index 305537fc86406076ba07b3cdfeb6bf7affbc8ff6..52c218e2b724cdb8db1678c4070f31ab033daf65 100644 (file)
@@ -1222,15 +1222,8 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb,
                next = pmd_addr_end(addr, end);
                if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
                        if (next - addr != HPAGE_PMD_SIZE) {
-#ifdef CONFIG_DEBUG_VM
-                               if (!rwsem_is_locked(&tlb->mm->mmap_sem)) {
-                                       pr_err("%s: mmap_sem is unlocked! addr=0x%lx end=0x%lx vma->vm_start=0x%lx vma->vm_end=0x%lx\n",
-                                               __func__, addr, end,
-                                               vma->vm_start,
-                                               vma->vm_end);
-                                       BUG();
-                               }
-#endif
+                               VM_BUG_ON_VMA(vma_is_anonymous(vma) &&
+                                   !rwsem_is_locked(&tlb->mm->mmap_sem), vma);
                                split_huge_pmd(vma, pmd, addr);
                        } else if (zap_huge_pmd(tlb, vma, pmd, addr))
                                goto next;
index 999792d35ccc0faee6c4f85d70b6e31876855284..bc5149d5ec38016da91a8b1c85aeca0193143f0c 100644 (file)
@@ -1910,7 +1910,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb)
        if (gdtc->dirty > gdtc->bg_thresh)
                return true;
 
-       if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(gdtc))
+       if (wb_stat(wb, WB_RECLAIMABLE) >
+           wb_calc_thresh(gdtc->wb, gdtc->bg_thresh))
                return true;
 
        if (mdtc) {
@@ -1924,7 +1925,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb)
                if (mdtc->dirty > mdtc->bg_thresh)
                        return true;
 
-               if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(mdtc))
+               if (wb_stat(wb, WB_RECLAIMABLE) >
+                   wb_calc_thresh(mdtc->wb, mdtc->bg_thresh))
                        return true;
        }
 
index 59de90d5d3a362c7293e624e748cd7b6ebab73b3..c1069efcc4d7477a5fc517303b67747f89b77074 100644 (file)
@@ -6485,7 +6485,7 @@ int __meminit init_per_zone_wmark_min(void)
        setup_per_zone_inactive_ratio();
        return 0;
 }
-module_init(init_per_zone_wmark_min)
+core_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
index 91dad80d068b75de629105ec0e688ce16335e16f..de0f119b1780b2af14d6bf6868f0a8da0f1ee236 100644 (file)
@@ -170,6 +170,8 @@ static struct zswap_tree *zswap_trees[MAX_SWAPFILES];
 static LIST_HEAD(zswap_pools);
 /* protects zswap_pools list modification */
 static DEFINE_SPINLOCK(zswap_pools_lock);
+/* pool counter to provide unique names to zpool */
+static atomic_t zswap_pools_count = ATOMIC_INIT(0);
 
 /* used by param callback function */
 static bool zswap_init_started;
@@ -565,6 +567,7 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)
 static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
 {
        struct zswap_pool *pool;
+       char name[38]; /* 'zswap' + 32 char (max) num + \0 */
        gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM;
 
        pool = kzalloc(sizeof(*pool), GFP_KERNEL);
@@ -573,7 +576,10 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor)
                return NULL;
        }
 
-       pool->zpool = zpool_create_pool(type, "zswap", gfp, &zswap_zpool_ops);
+       /* unique name for each pool specifically required by zsmalloc */
+       snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count));
+
+       pool->zpool = zpool_create_pool(type, name, gfp, &zswap_zpool_ops);
        if (!pool->zpool) {
                pr_err("%s zpool not available\n", type);
                goto error;
index 3315b9a598af0f71a95a080d450cf1faf3a70a1d..4026f198a7345c91a34ef1c8aed6f750e7b27d3e 100644 (file)
 
 #include "bat_v_elp.h"
 #include "bat_v_ogm.h"
+#include "hard-interface.h"
 #include "hash.h"
 #include "originator.h"
 #include "packet.h"
 
+static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
+{
+       /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
+        * set the interface as ACTIVE right away, without any risk of race
+        * condition
+        */
+       if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
+               hard_iface->if_status = BATADV_IF_ACTIVE;
+}
+
 static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
 {
        int ret;
@@ -274,6 +285,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1,
 
 static struct batadv_algo_ops batadv_batman_v __read_mostly = {
        .name = "BATMAN_V",
+       .bat_iface_activate = batadv_v_iface_activate,
        .bat_iface_enable = batadv_v_iface_enable,
        .bat_iface_disable = batadv_v_iface_disable,
        .bat_iface_update_mac = batadv_v_iface_update_mac,
index e96d7c745b4a1de6444284f38207ed599925ac2e..3e6b2624f9809365ac29da7f88a3895af3df8728 100644 (file)
@@ -568,6 +568,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
  * be sent to
  * @bat_priv: the bat priv with all the soft interface information
  * @ip_dst: ipv4 to look up in the DHT
+ * @vid: VLAN identifier
  *
  * An originator O is selected if and only if its DHT_ID value is one of three
  * closest values (from the LEFT, with wrap around if needed) then the hash
@@ -576,7 +577,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv,
  * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM.
  */
 static struct batadv_dat_candidate *
-batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
+batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst,
+                            unsigned short vid)
 {
        int select;
        batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
@@ -592,7 +594,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
                return NULL;
 
        dat.ip = ip_dst;
-       dat.vid = 0;
+       dat.vid = vid;
        ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
                                                    BATADV_DAT_ADDR_MAX);
 
@@ -612,6 +614,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
  * @bat_priv: the bat priv with all the soft interface information
  * @skb: payload to send
  * @ip: the DHT key
+ * @vid: VLAN identifier
  * @packet_subtype: unicast4addr packet subtype to use
  *
  * This function copies the skb with pskb_copy() and is sent as unicast packet
@@ -622,7 +625,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
  */
 static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
                                 struct sk_buff *skb, __be32 ip,
-                                int packet_subtype)
+                                unsigned short vid, int packet_subtype)
 {
        int i;
        bool ret = false;
@@ -631,7 +634,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
        struct sk_buff *tmp_skb;
        struct batadv_dat_candidate *cand;
 
-       cand = batadv_dat_select_candidates(bat_priv, ip);
+       cand = batadv_dat_select_candidates(bat_priv, ip, vid);
        if (!cand)
                goto out;
 
@@ -1022,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
                ret = true;
        } else {
                /* Send the request to the DHT */
-               ret = batadv_dat_send_data(bat_priv, skb, ip_dst,
+               ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid,
                                           BATADV_P_DAT_DHT_GET);
        }
 out:
@@ -1150,8 +1153,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
        /* Send the ARP reply to the candidates for both the IP addresses that
         * the node obtained from the ARP reply
         */
-       batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
-       batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
+       batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT);
+       batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT);
 }
 
 /**
index b22b2775a0a5ff706c17ea06c39c9bb092da1f9a..0a7deaf2670a981078d0c5c3de1805f69c265796 100644 (file)
@@ -407,6 +407,9 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface)
 
        batadv_update_min_mtu(hard_iface->soft_iface);
 
+       if (bat_priv->bat_algo_ops->bat_iface_activate)
+               bat_priv->bat_algo_ops->bat_iface_activate(hard_iface);
+
 out:
        if (primary_if)
                batadv_hardif_put(primary_if);
@@ -572,8 +575,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
        struct batadv_hard_iface *primary_if = NULL;
 
-       if (hard_iface->if_status == BATADV_IF_ACTIVE)
-               batadv_hardif_deactivate_interface(hard_iface);
+       batadv_hardif_deactivate_interface(hard_iface);
 
        if (hard_iface->if_status != BATADV_IF_INACTIVE)
                goto out;
index e4cbb0753e37ff6681a20e8912df1f4ad1e74a05..c355a824713cd9224e2c705e222c2061cb504b5a 100644 (file)
@@ -250,7 +250,6 @@ static void batadv_neigh_node_release(struct kref *ref)
 {
        struct hlist_node *node_tmp;
        struct batadv_neigh_node *neigh_node;
-       struct batadv_hardif_neigh_node *hardif_neigh;
        struct batadv_neigh_ifinfo *neigh_ifinfo;
        struct batadv_algo_ops *bao;
 
@@ -262,13 +261,7 @@ static void batadv_neigh_node_release(struct kref *ref)
                batadv_neigh_ifinfo_put(neigh_ifinfo);
        }
 
-       hardif_neigh = batadv_hardif_neigh_get(neigh_node->if_incoming,
-                                              neigh_node->addr);
-       if (hardif_neigh) {
-               /* batadv_hardif_neigh_get() increases refcount too */
-               batadv_hardif_neigh_put(hardif_neigh);
-               batadv_hardif_neigh_put(hardif_neigh);
-       }
+       batadv_hardif_neigh_put(neigh_node->hardif_neigh);
 
        if (bao->bat_neigh_free)
                bao->bat_neigh_free(neigh_node);
@@ -663,6 +656,11 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
        ether_addr_copy(neigh_node->addr, neigh_addr);
        neigh_node->if_incoming = hard_iface;
        neigh_node->orig_node = orig_node;
+       neigh_node->last_seen = jiffies;
+
+       /* increment unique neighbor refcount */
+       kref_get(&hardif_neigh->refcount);
+       neigh_node->hardif_neigh = hardif_neigh;
 
        /* extra reference for return */
        kref_init(&neigh_node->refcount);
@@ -672,9 +670,6 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
        hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
        spin_unlock_bh(&orig_node->neigh_list_lock);
 
-       /* increment unique neighbor refcount */
-       kref_get(&hardif_neigh->refcount);
-
        batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
                   "Creating new neighbor %pM for orig_node %pM on interface %s\n",
                   neigh_addr, orig_node->orig, hard_iface->net_dev->name);
index 4dd646a52f1a16ca297a3cdb1abeff56206df166..b781bf75325061a5157c54bc976d1df1a522e0bd 100644 (file)
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv,
                neigh_node = NULL;
 
        spin_lock_bh(&orig_node->neigh_list_lock);
+       /* curr_router used earlier may not be the current orig_ifinfo->router
+        * anymore because it was dereferenced outside of the neigh_list_lock
+        * protected region. After the new best neighbor has replace the current
+        * best neighbor the reference counter needs to decrease. Consequently,
+        * the code needs to ensure the curr_router variable contains a pointer
+        * to the replaced best neighbor.
+        */
+       curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
+
        rcu_assign_pointer(orig_ifinfo->router, neigh_node);
        spin_unlock_bh(&orig_node->neigh_list_lock);
        batadv_orig_ifinfo_put(orig_ifinfo);
index 3ce06e0a91b1c125cdf5ff594db57529a2deaacf..76417850d3fcbb6ddf5d6f15c822cebdda4912da 100644 (file)
@@ -675,6 +675,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
                if (pending) {
                        hlist_del(&forw_packet->list);
+                       if (!forw_packet->own)
+                               atomic_inc(&bat_priv->bcast_queue_left);
+
                        batadv_forw_packet_free(forw_packet);
                }
        }
@@ -702,6 +705,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,
 
                if (pending) {
                        hlist_del(&forw_packet->list);
+                       if (!forw_packet->own)
+                               atomic_inc(&bat_priv->batman_queue_left);
+
                        batadv_forw_packet_free(forw_packet);
                }
        }
index 0710379491bffc0627c35f0ed5ba6bbf535bb1bb..8a136b6a1ff06165b7e7c257fd8b00847fbf3065 100644 (file)
@@ -408,11 +408,17 @@ void batadv_interface_rx(struct net_device *soft_iface,
         */
        nf_reset(skb);
 
+       if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
+               goto dropped;
+
        vid = batadv_get_vid(skb, 0);
        ethhdr = eth_hdr(skb);
 
        switch (ntohs(ethhdr->h_proto)) {
        case ETH_P_8021Q:
+               if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
+                       goto dropped;
+
                vhdr = (struct vlan_ethhdr *)skb->data;
 
                if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -424,8 +430,6 @@ void batadv_interface_rx(struct net_device *soft_iface,
        }
 
        /* skb->dev & skb->pkt_type are set here */
-       if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
-               goto dropped;
        skb->protocol = eth_type_trans(skb, soft_iface);
 
        /* should not be necessary anymore as we use skb_pull_rcsum()
index 0b43e86328a59bb42f7200380b840b0209fd26a1..9b4551a86535c6fb0264948cfa5aad63b8ee6dbb 100644 (file)
@@ -215,6 +215,8 @@ static void batadv_tt_local_entry_release(struct kref *ref)
        tt_local_entry = container_of(ref, struct batadv_tt_local_entry,
                                      common.refcount);
 
+       batadv_softif_vlan_put(tt_local_entry->vlan);
+
        kfree_rcu(tt_local_entry, common.rcu);
 }
 
@@ -673,6 +675,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
        kref_get(&tt_local->common.refcount);
        tt_local->last_seen = jiffies;
        tt_local->common.added_at = tt_local->last_seen;
+       tt_local->vlan = vlan;
 
        /* the batman interface mac and multicast addresses should never be
         * purged
@@ -991,7 +994,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
        struct batadv_tt_common_entry *tt_common_entry;
        struct batadv_tt_local_entry *tt_local;
        struct batadv_hard_iface *primary_if;
-       struct batadv_softif_vlan *vlan;
        struct hlist_head *head;
        unsigned short vid;
        u32 i;
@@ -1027,14 +1029,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
                        last_seen_msecs = last_seen_msecs % 1000;
 
                        no_purge = tt_common_entry->flags & np_flag;
-
-                       vlan = batadv_softif_vlan_get(bat_priv, vid);
-                       if (!vlan) {
-                               seq_printf(seq, "Cannot retrieve VLAN %d\n",
-                                          BATADV_PRINT_VID(vid));
-                               continue;
-                       }
-
                        seq_printf(seq,
                                   " * %pM %4i [%c%c%c%c%c%c] %3u.%03u   (%#.8x)\n",
                                   tt_common_entry->addr,
@@ -1052,9 +1046,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
                                     BATADV_TT_CLIENT_ISOLA) ? 'I' : '.'),
                                   no_purge ? 0 : last_seen_secs,
                                   no_purge ? 0 : last_seen_msecs,
-                                  vlan->tt.crc);
-
-                       batadv_softif_vlan_put(vlan);
+                                  tt_local->vlan->tt.crc);
                }
                rcu_read_unlock();
        }
@@ -1099,7 +1091,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
 {
        struct batadv_tt_local_entry *tt_local_entry;
        u16 flags, curr_flags = BATADV_NO_FLAGS;
-       struct batadv_softif_vlan *vlan;
        void *tt_entry_exists;
 
        tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
@@ -1139,14 +1130,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
        /* extra call to free the local tt entry */
        batadv_tt_local_entry_put(tt_local_entry);
 
-       /* decrease the reference held for this vlan */
-       vlan = batadv_softif_vlan_get(bat_priv, vid);
-       if (!vlan)
-               goto out;
-
-       batadv_softif_vlan_put(vlan);
-       batadv_softif_vlan_put(vlan);
-
 out:
        if (tt_local_entry)
                batadv_tt_local_entry_put(tt_local_entry);
@@ -1219,7 +1202,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
        spinlock_t *list_lock; /* protects write access to the hash lists */
        struct batadv_tt_common_entry *tt_common_entry;
        struct batadv_tt_local_entry *tt_local;
-       struct batadv_softif_vlan *vlan;
        struct hlist_node *node_tmp;
        struct hlist_head *head;
        u32 i;
@@ -1241,14 +1223,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
                                                struct batadv_tt_local_entry,
                                                common);
 
-                       /* decrease the reference held for this vlan */
-                       vlan = batadv_softif_vlan_get(bat_priv,
-                                                     tt_common_entry->vid);
-                       if (vlan) {
-                               batadv_softif_vlan_put(vlan);
-                               batadv_softif_vlan_put(vlan);
-                       }
-
                        batadv_tt_local_entry_put(tt_local);
                }
                spin_unlock_bh(list_lock);
@@ -3309,7 +3283,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
        struct batadv_hashtable *hash = bat_priv->tt.local_hash;
        struct batadv_tt_common_entry *tt_common;
        struct batadv_tt_local_entry *tt_local;
-       struct batadv_softif_vlan *vlan;
        struct hlist_node *node_tmp;
        struct hlist_head *head;
        spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -3339,13 +3312,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
                                                struct batadv_tt_local_entry,
                                                common);
 
-                       /* decrease the reference held for this vlan */
-                       vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
-                       if (vlan) {
-                               batadv_softif_vlan_put(vlan);
-                               batadv_softif_vlan_put(vlan);
-                       }
-
                        batadv_tt_local_entry_put(tt_local);
                }
                spin_unlock_bh(list_lock);
index 9abfb3e73c3448a9612c9c282166fe5e18b44327..1e47fbe8bb7b2e9b3ec79c64ef508d7305b5d1a7 100644 (file)
@@ -433,6 +433,7 @@ struct batadv_hardif_neigh_node {
  * @ifinfo_lock: lock protecting private ifinfo members and list
  * @if_incoming: pointer to incoming hard-interface
  * @last_seen: when last packet via this neighbor was received
+ * @hardif_neigh: hardif_neigh of this neighbor
  * @refcount: number of contexts the object is used
  * @rcu: struct used for freeing in an RCU-safe manner
  */
@@ -444,6 +445,7 @@ struct batadv_neigh_node {
        spinlock_t ifinfo_lock; /* protects ifinfo_list and its members */
        struct batadv_hard_iface *if_incoming;
        unsigned long last_seen;
+       struct batadv_hardif_neigh_node *hardif_neigh;
        struct kref refcount;
        struct rcu_head rcu;
 };
@@ -1073,10 +1075,12 @@ struct batadv_tt_common_entry {
  * struct batadv_tt_local_entry - translation table local entry data
  * @common: general translation table data
  * @last_seen: timestamp used for purging stale tt local entries
+ * @vlan: soft-interface vlan of the entry
  */
 struct batadv_tt_local_entry {
        struct batadv_tt_common_entry common;
        unsigned long last_seen;
+       struct batadv_softif_vlan *vlan;
 };
 
 /**
@@ -1250,6 +1254,8 @@ struct batadv_forw_packet {
  * struct batadv_algo_ops - mesh algorithm callbacks
  * @list: list node for the batadv_algo_list
  * @name: name of the algorithm
+ * @bat_iface_activate: start routing mechanisms when hard-interface is brought
+ *  up
  * @bat_iface_enable: init routing info when hard-interface is enabled
  * @bat_iface_disable: de-init routing info when hard-interface is disabled
  * @bat_iface_update_mac: (re-)init mac addresses of the protocol information
@@ -1277,6 +1283,7 @@ struct batadv_forw_packet {
 struct batadv_algo_ops {
        struct hlist_node list;
        char *name;
+       void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
        int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
        void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
        void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
index 77a71cd68535fc02ae939168934fa4fb4f419644..5c925ac50b9572755e35be168cde8c858fd4ba95 100644 (file)
@@ -2802,7 +2802,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb,
 
        if (skb->ip_summed != CHECKSUM_NONE &&
            !can_checksum_protocol(features, type)) {
-               features &= ~NETIF_F_CSUM_MASK;
+               features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
        } else if (illegal_highdma(skb->dev, skb)) {
                features &= ~NETIF_F_SG;
        }
index bc68eced0105716dca6f04abbdd491a1cfb9e908..0d9e9d7bb029373e37e4de6ed4003397d41f82cd 100644 (file)
@@ -470,6 +470,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
                                                     const struct sock *sk2,
                                                     bool match_wildcard))
 {
+       struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash;
        struct sock *sk2;
        struct hlist_nulls_node *node;
        kuid_t uid = sock_i_uid(sk);
@@ -479,6 +480,7 @@ static int inet_reuseport_add_sock(struct sock *sk,
                    sk2->sk_family == sk->sk_family &&
                    ipv6_only_sock(sk2) == ipv6_only_sock(sk) &&
                    sk2->sk_bound_dev_if == sk->sk_bound_dev_if &&
+                   inet_csk(sk2)->icsk_bind_hash == tb &&
                    sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) &&
                    saddr_same(sk, sk2, false))
                        return reuseport_add_sock(sk, sk2);
index af5d1f38217f4e4dcb977b6410d0d9a6a6c1e87c..205a2b8a5a84579c909a62fd4aafdd19fe64aa54 100644 (file)
@@ -179,6 +179,7 @@ static __be16 tnl_flags_to_gre_flags(__be16 tflags)
        return flags;
 }
 
+/* Fills in tpi and returns header length to be pulled. */
 static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                            bool *csum_err)
 {
@@ -238,7 +239,7 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
                                return -EINVAL;
                }
        }
-       return iptunnel_pull_header(skb, hdr_len, tpi->proto, false);
+       return hdr_len;
 }
 
 static void ipgre_err(struct sk_buff *skb, u32 info,
@@ -341,7 +342,7 @@ static void gre_err(struct sk_buff *skb, u32 info)
        struct tnl_ptk_info tpi;
        bool csum_err = false;
 
-       if (parse_gre_header(skb, &tpi, &csum_err)) {
+       if (parse_gre_header(skb, &tpi, &csum_err) < 0) {
                if (!csum_err)          /* ignore csum errors. */
                        return;
        }
@@ -419,6 +420,7 @@ static int gre_rcv(struct sk_buff *skb)
 {
        struct tnl_ptk_info tpi;
        bool csum_err = false;
+       int hdr_len;
 
 #ifdef CONFIG_NET_IPGRE_BROADCAST
        if (ipv4_is_multicast(ip_hdr(skb)->daddr)) {
@@ -428,7 +430,10 @@ static int gre_rcv(struct sk_buff *skb)
        }
 #endif
 
-       if (parse_gre_header(skb, &tpi, &csum_err) < 0)
+       hdr_len = parse_gre_header(skb, &tpi, &csum_err);
+       if (hdr_len < 0)
+               goto drop;
+       if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false) < 0)
                goto drop;
 
        if (ipgre_rcv(skb, &tpi) == PACKET_RCVD)
@@ -523,7 +528,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb,
        return ip_route_output_key(net, fl);
 }
 
-static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
+static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
+                       __be16 proto)
 {
        struct ip_tunnel_info *tun_info;
        const struct ip_tunnel_key *key;
@@ -575,7 +581,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
-       build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB),
+       build_header(skb, tunnel_hlen, flags, proto,
                     tunnel_id_to_key(tun_info->key.tun_id), 0);
 
        df = key->tun_flags & TUNNEL_DONT_FRAGMENT ?  htons(IP_DF) : 0;
@@ -616,7 +622,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
        const struct iphdr *tnl_params;
 
        if (tunnel->collect_md) {
-               gre_fb_xmit(skb, dev);
+               gre_fb_xmit(skb, dev, skb->protocol);
                return NETDEV_TX_OK;
        }
 
@@ -660,7 +666,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
        struct ip_tunnel *tunnel = netdev_priv(dev);
 
        if (tunnel->collect_md) {
-               gre_fb_xmit(skb, dev);
+               gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
                return NETDEV_TX_OK;
        }
 
@@ -893,7 +899,7 @@ static int ipgre_tunnel_init(struct net_device *dev)
        netif_keep_dst(dev);
        dev->addr_len           = 4;
 
-       if (iph->daddr) {
+       if (iph->daddr && !tunnel->collect_md) {
 #ifdef CONFIG_NET_IPGRE_BROADCAST
                if (ipv4_is_multicast(iph->daddr)) {
                        if (!iph->saddr)
@@ -902,8 +908,9 @@ static int ipgre_tunnel_init(struct net_device *dev)
                        dev->header_ops = &ipgre_header_ops;
                }
 #endif
-       } else
+       } else if (!tunnel->collect_md) {
                dev->header_ops = &ipgre_header_ops;
+       }
 
        return ip_tunnel_init(dev);
 }
@@ -946,6 +953,11 @@ static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[])
        if (flags & (GRE_VERSION|GRE_ROUTING))
                return -EINVAL;
 
+       if (data[IFLA_GRE_COLLECT_METADATA] &&
+           data[IFLA_GRE_ENCAP_TYPE] &&
+           nla_get_u16(data[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE)
+               return -EINVAL;
+
        return 0;
 }
 
index 6aad0192443d49966785f0de67ee30934775dfca..a69ed94bda1b107634f0aacb6dbedb3d03cc87b0 100644 (file)
@@ -326,12 +326,12 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
 
                if (!IS_ERR(rt)) {
                        tdev = rt->dst.dev;
-                       dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
-                                         fl4.saddr);
                        ip_rt_put(rt);
                }
                if (dev->type != ARPHRD_ETHER)
                        dev->flags |= IFF_POINTOPOINT;
+
+               dst_cache_reset(&tunnel->dst_cache);
        }
 
        if (!tdev && tunnel->parms.link)
index 2ae3c4fd8aabc65a7206a73480b3dca4b975f7e3..41f18de5dcc2cda4686af5fe89c8ab4760966d91 100644 (file)
@@ -120,8 +120,7 @@ nla_put_failure:
 
 static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
 {
-       /* No encapsulation overhead */
-       return 0;
+       return nla_total_size(sizeof(u64)); /* ILA_ATTR_LOCATOR */
 }
 
 static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
index afca2eb4dfa777c75288dfb6fce9636b309a2ebc..6edfa99803148815e383eb13ce6a9c1eb098058d 100644 (file)
@@ -1376,9 +1376,9 @@ static int l2tp_tunnel_sock_create(struct net *net,
                        memcpy(&udp_conf.peer_ip6, cfg->peer_ip6,
                               sizeof(udp_conf.peer_ip6));
                        udp_conf.use_udp6_tx_checksums =
-                           cfg->udp6_zero_tx_checksums;
+                         ! cfg->udp6_zero_tx_checksums;
                        udp_conf.use_udp6_rx_checksums =
-                           cfg->udp6_zero_rx_checksums;
+                         ! cfg->udp6_zero_rx_checksums;
                } else
 #endif
                {
index 453b4e7417804105cb136e2ec7f4c57a39392db3..e1cb22c16530377cc8ce0d9bf907bbd662f18337 100644 (file)
@@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
                ret = dev_alloc_name(ndev, ndev->name);
                if (ret < 0) {
-                       free_netdev(ndev);
+                       ieee80211_if_free(ndev);
                        return ret;
                }
 
@@ -1847,7 +1847,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
                ret = register_netdevice(ndev);
                if (ret) {
-                       free_netdev(ndev);
+                       ieee80211_if_free(ndev);
                        return ret;
                }
        }
index 61ed2a8764ba4c7a66788d7843cef18abb9e904a..86187dad14403100ff6199ee79beed5262de818f 100644 (file)
@@ -127,7 +127,7 @@ void rds_tcp_restore_callbacks(struct socket *sock,
 
 /*
  * This is the only path that sets tc->t_sock.  Send and receive trust that
- * it is set.  The RDS_CONN_CONNECTED bit protects those paths from being
+ * it is set.  The RDS_CONN_UP bit protects those paths from being
  * called while it isn't set.
  */
 void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn)
@@ -216,6 +216,7 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp)
        if (!tc)
                return -ENOMEM;
 
+       mutex_init(&tc->t_conn_lock);
        tc->t_sock = NULL;
        tc->t_tinc = NULL;
        tc->t_tinc_hdr_rem = sizeof(struct rds_header);
index 64f873c0c6b6d15574ec9771506d04e617a6aaac..41c228300525c029df02472b609ada1a71cea98e 100644 (file)
@@ -12,6 +12,10 @@ struct rds_tcp_connection {
 
        struct list_head        t_tcp_node;
        struct rds_connection   *conn;
+       /* t_conn_lock synchronizes the connection establishment between
+        * rds_tcp_accept_one and rds_tcp_conn_connect
+        */
+       struct mutex            t_conn_lock;
        struct socket           *t_sock;
        void                    *t_orig_write_space;
        void                    *t_orig_data_ready;
index 5cb16875c4603dba71c733de6600ada40e39cffc..49a3fcfed360edfb146416976c700b24e4520864 100644 (file)
@@ -78,7 +78,14 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
        struct socket *sock = NULL;
        struct sockaddr_in src, dest;
        int ret;
+       struct rds_tcp_connection *tc = conn->c_transport_data;
+
+       mutex_lock(&tc->t_conn_lock);
 
+       if (rds_conn_up(conn)) {
+               mutex_unlock(&tc->t_conn_lock);
+               return 0;
+       }
        ret = sock_create_kern(rds_conn_net(conn), PF_INET,
                               SOCK_STREAM, IPPROTO_TCP, &sock);
        if (ret < 0)
@@ -120,6 +127,7 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
        }
 
 out:
+       mutex_unlock(&tc->t_conn_lock);
        if (sock)
                sock_release(sock);
        return ret;
index 0936a4a32b476fdde5c7208fc465ec3324bbcf09..be263cdf268bae5b59a4746d4011d1042ede58cd 100644 (file)
@@ -76,7 +76,9 @@ int rds_tcp_accept_one(struct socket *sock)
        struct rds_connection *conn;
        int ret;
        struct inet_sock *inet;
-       struct rds_tcp_connection *rs_tcp;
+       struct rds_tcp_connection *rs_tcp = NULL;
+       int conn_state;
+       struct sock *nsk;
 
        ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
                               sock->sk->sk_type, sock->sk->sk_protocol,
@@ -115,28 +117,44 @@ int rds_tcp_accept_one(struct socket *sock)
         * rds_tcp_state_change() will do that cleanup
         */
        rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data;
-       if (rs_tcp->t_sock &&
-           ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
-               struct sock *nsk = new_sock->sk;
-
-               nsk->sk_user_data = NULL;
-               nsk->sk_prot->disconnect(nsk, 0);
-               tcp_done(nsk);
-               new_sock = NULL;
-               ret = 0;
-               goto out;
-       } else if (rs_tcp->t_sock) {
-               rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
-               conn->c_outgoing = 0;
-       }
-
        rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING);
+       mutex_lock(&rs_tcp->t_conn_lock);
+       conn_state = rds_conn_state(conn);
+       if (conn_state != RDS_CONN_CONNECTING && conn_state != RDS_CONN_UP)
+               goto rst_nsk;
+       if (rs_tcp->t_sock) {
+               /* Need to resolve a duelling SYN between peers.
+                * We have an outstanding SYN to this peer, which may
+                * potentially have transitioned to the RDS_CONN_UP state,
+                * so we must quiesce any send threads before resetting
+                * c_transport_data.
+                */
+               wait_event(conn->c_waitq,
+                          !test_bit(RDS_IN_XMIT, &conn->c_flags));
+               if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
+                       goto rst_nsk;
+               } else if (rs_tcp->t_sock) {
+                       rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
+                       conn->c_outgoing = 0;
+               }
+       }
        rds_tcp_set_callbacks(new_sock, conn);
-       rds_connect_complete(conn);
+       rds_connect_complete(conn); /* marks RDS_CONN_UP */
+       new_sock = NULL;
+       ret = 0;
+       goto out;
+rst_nsk:
+       /* reset the newly returned accept sock and bail */
+       nsk = new_sock->sk;
+       rds_tcp_stats_inc(s_tcp_listen_closed_stale);
+       nsk->sk_user_data = NULL;
+       nsk->sk_prot->disconnect(nsk, 0);
+       tcp_done(nsk);
        new_sock = NULL;
        ret = 0;
-
 out:
+       if (rs_tcp)
+               mutex_unlock(&rs_tcp->t_conn_lock);
        if (new_sock)
                sock_release(new_sock);
        return ret;
index 9640bb39a5d293d55a96edc5164d369c1cded127..4befe97a90349832030e139125369c048cb1d67c 100644 (file)
@@ -395,6 +395,25 @@ static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
        sch->q.qlen++;
 }
 
+/* netem can't properly corrupt a megapacket (like we get from GSO), so instead
+ * when we statistically choose to corrupt one, we instead segment it, returning
+ * the first packet to be corrupted, and re-enqueue the remaining frames
+ */
+static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch)
+{
+       struct sk_buff *segs;
+       netdev_features_t features = netif_skb_features(skb);
+
+       segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
+
+       if (IS_ERR_OR_NULL(segs)) {
+               qdisc_reshape_fail(skb, sch);
+               return NULL;
+       }
+       consume_skb(skb);
+       return segs;
+}
+
 /*
  * Insert one skb into qdisc.
  * Note: parent depends on return value to account for queue length.
@@ -407,7 +426,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        /* We don't fill cb now as skb_unshare() may invalidate it */
        struct netem_skb_cb *cb;
        struct sk_buff *skb2;
+       struct sk_buff *segs = NULL;
+       unsigned int len = 0, last_len, prev_len = qdisc_pkt_len(skb);
+       int nb = 0;
        int count = 1;
+       int rc = NET_XMIT_SUCCESS;
 
        /* Random duplication */
        if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))
@@ -453,10 +476,23 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
         * do it now in software before we mangle it.
         */
        if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
+               if (skb_is_gso(skb)) {
+                       segs = netem_segment(skb, sch);
+                       if (!segs)
+                               return NET_XMIT_DROP;
+               } else {
+                       segs = skb;
+               }
+
+               skb = segs;
+               segs = segs->next;
+
                if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
                    (skb->ip_summed == CHECKSUM_PARTIAL &&
-                    skb_checksum_help(skb)))
-                       return qdisc_drop(skb, sch);
+                    skb_checksum_help(skb))) {
+                       rc = qdisc_drop(skb, sch);
+                       goto finish_segs;
+               }
 
                skb->data[prandom_u32() % skb_headlen(skb)] ^=
                        1<<(prandom_u32() % 8);
@@ -516,6 +552,27 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                sch->qstats.requeues++;
        }
 
+finish_segs:
+       if (segs) {
+               while (segs) {
+                       skb2 = segs->next;
+                       segs->next = NULL;
+                       qdisc_skb_cb(segs)->pkt_len = segs->len;
+                       last_len = segs->len;
+                       rc = qdisc_enqueue(segs, sch);
+                       if (rc != NET_XMIT_SUCCESS) {
+                               if (net_xmit_drop_count(rc))
+                                       qdisc_qstats_drop(sch);
+                       } else {
+                               nb++;
+                               len += last_len;
+                       }
+                       segs = skb2;
+               }
+               sch->q.qlen += nb;
+               if (nb > 1)
+                       qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len);
+       }
        return NET_XMIT_SUCCESS;
 }
 
index ace178fd385038523bc498222e9497245ccae4b0..9aaa1bc566ae3ec59d03a1ef3c7872ab86a71c0d 100644 (file)
@@ -1444,6 +1444,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
        int bearer_id = b->identity;
        struct tipc_link_entry *le;
        u16 bc_ack = msg_bcast_ack(hdr);
+       u32 self = tipc_own_addr(net);
        int rc = 0;
 
        __skb_queue_head_init(&xmitq);
@@ -1460,6 +1461,10 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
                        return tipc_node_bc_rcv(net, skb, bearer_id);
        }
 
+       /* Discard unicast link messages destined for another node */
+       if (unlikely(!msg_short(hdr) && (msg_destnode(hdr) != self)))
+               goto discard;
+
        /* Locate neighboring node that sent packet */
        n = tipc_node_find(net, msg_prevnode(hdr));
        if (unlikely(!n))
index 8d8d1ec429eb6761b0d29b30299536ac782779c5..9b96f4fb8cea64f9b98c835b045bd8c840719433 100644 (file)
@@ -18,7 +18,6 @@ int bpf_prog1(struct pt_regs *ctx)
                u64 cookie;
        } data;
 
-       memset(&data, 0, sizeof(data));
        data.pid = bpf_get_current_pid_tgid();
        data.cookie = 0x12345678;
 
index 161dd0d67da8a84f0062672cd9125c491a2f58e3..a9155077feefb957d38dc29b4823a9529a7ee0e9 100644 (file)
@@ -371,6 +371,49 @@ static void do_usb_table(void *symval, unsigned long size,
                do_usb_entry_multi(symval + i, mod);
 }
 
+static void do_of_entry_multi(void *symval, struct module *mod)
+{
+       char alias[500];
+       int len;
+       char *tmp;
+
+       DEF_FIELD_ADDR(symval, of_device_id, name);
+       DEF_FIELD_ADDR(symval, of_device_id, type);
+       DEF_FIELD_ADDR(symval, of_device_id, compatible);
+
+       len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
+                     (*type)[0] ? *type : "*");
+
+       if (compatible[0])
+               sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
+                       *compatible);
+
+       /* Replace all whitespace with underscores */
+       for (tmp = alias; tmp && *tmp; tmp++)
+               if (isspace(*tmp))
+                       *tmp = '_';
+
+       buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
+       strcat(alias, "C");
+       add_wildcard(alias);
+       buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias);
+}
+
+static void do_of_table(void *symval, unsigned long size,
+                       struct module *mod)
+{
+       unsigned int i;
+       const unsigned long id_size = SIZE_of_device_id;
+
+       device_id_check(mod->name, "of", size, id_size, symval);
+
+       /* Leave last one: it's the terminator. */
+       size -= id_size;
+
+       for (i = 0; i < size; i += id_size)
+               do_of_entry_multi(symval + i, mod);
+}
+
 /* Looks like: hid:bNvNpN */
 static int do_hid_entry(const char *filename,
                             void *symval, char *alias)
@@ -684,30 +727,6 @@ static int do_pcmcia_entry(const char *filename,
 }
 ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry);
 
-static int do_of_entry (const char *filename, void *symval, char *alias)
-{
-       int len;
-       char *tmp;
-       DEF_FIELD_ADDR(symval, of_device_id, name);
-       DEF_FIELD_ADDR(symval, of_device_id, type);
-       DEF_FIELD_ADDR(symval, of_device_id, compatible);
-
-       len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
-                     (*type)[0] ? *type : "*");
-
-       if (compatible[0])
-               sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
-                       *compatible);
-
-       /* Replace all whitespace with underscores */
-       for (tmp = alias; tmp && *tmp; tmp++)
-               if (isspace (*tmp))
-                       *tmp = '_';
-
-       return 1;
-}
-ADD_TO_DEVTABLE("of", of_device_id, do_of_entry);
-
 static int do_vio_entry(const char *filename, void *symval,
                char *alias)
 {
@@ -1348,6 +1367,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
        /* First handle the "special" cases */
        if (sym_is(name, namelen, "usb"))
                do_usb_table(symval, sym->st_size, mod);
+       if (sym_is(name, namelen, "of"))
+               do_of_table(symval, sym->st_size, mod);
        else if (sym_is(name, namelen, "pnp"))
                do_pnp_device_entry(symval, sym->st_size, mod);
        else if (sym_is(name, namelen, "pnp_card"))
index be09e2cacf828d32c75028ccf04f31e88657da70..3cd0a58672dd1df684e12d0a4331b56fd4fa12fb 100644 (file)
@@ -884,10 +884,10 @@ static char *func_tokens[] = {
        "BPRM_CHECK",
        "MODULE_CHECK",
        "FIRMWARE_CHECK",
+       "POST_SETATTR",
        "KEXEC_KERNEL_CHECK",
        "KEXEC_INITRAMFS_CHECK",
-       "POLICY_CHECK",
-       "POST_SETATTR"
+       "POLICY_CHECK"
 };
 
 void *ima_policy_start(struct seq_file *m, loff_t *pos)
index d0e6b857d8d17677885945db87559bb14746cb51..546cf4a503b78f473b4a705548645b3bde6a84b4 100644 (file)
@@ -91,7 +91,7 @@ osl_get_customized_table(char *pathname,
                         char *signature,
                         u32 instance,
                         struct acpi_table_header **table,
-                        acpi_physical_address * address);
+                        acpi_physical_address *address);
 
 static acpi_status osl_list_bios_tables(void);
 
@@ -99,7 +99,7 @@ static acpi_status
 osl_get_bios_table(char *signature,
                   u32 instance,
                   struct acpi_table_header **table,
-                  acpi_physical_address * address);
+                  acpi_physical_address *address);
 
 static acpi_status osl_get_last_status(acpi_status default_status);
 
@@ -187,7 +187,7 @@ static acpi_status osl_get_last_status(acpi_status default_status)
 
 acpi_status
 acpi_os_get_table_by_address(acpi_physical_address address,
-                            struct acpi_table_header ** table)
+                            struct acpi_table_header **table)
 {
        u32 table_length;
        struct acpi_table_header *mapped_table;
@@ -252,8 +252,8 @@ exit:
 acpi_status
 acpi_os_get_table_by_name(char *signature,
                          u32 instance,
-                         struct acpi_table_header ** table,
-                         acpi_physical_address * address)
+                         struct acpi_table_header **table,
+                         acpi_physical_address *address)
 {
        acpi_status status;
 
@@ -380,8 +380,8 @@ static acpi_status osl_add_table_to_list(char *signature, u32 instance)
 
 acpi_status
 acpi_os_get_table_by_index(u32 index,
-                          struct acpi_table_header ** table,
-                          u32 *instance, acpi_physical_address * address)
+                          struct acpi_table_header **table,
+                          u32 *instance, acpi_physical_address *address)
 {
        struct osl_table_info *info;
        acpi_status status;
@@ -447,7 +447,7 @@ osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword)
                }
        }
 
-       return ((acpi_physical_address) (address));
+       return ((acpi_physical_address)(address));
 }
 
 /******************************************************************************
@@ -751,10 +751,10 @@ static acpi_status osl_list_bios_tables(void)
        for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
                if (osl_can_use_xsdt()) {
                        table_address =
-                           (acpi_physical_address) (*ACPI_CAST64(table_data));
+                           (acpi_physical_address)(*ACPI_CAST64(table_data));
                } else {
                        table_address =
-                           (acpi_physical_address) (*ACPI_CAST32(table_data));
+                           (acpi_physical_address)(*ACPI_CAST32(table_data));
                }
 
                /* Skip NULL entries in RSDT/XSDT */
@@ -800,7 +800,7 @@ static acpi_status
 osl_get_bios_table(char *signature,
                   u32 instance,
                   struct acpi_table_header **table,
-                  acpi_physical_address * address)
+                  acpi_physical_address *address)
 {
        struct acpi_table_header *local_table = NULL;
        struct acpi_table_header *mapped_table = NULL;
@@ -833,38 +833,37 @@ osl_get_bios_table(char *signature,
                        if ((gbl_fadt->header.length >= MIN_FADT_FOR_XDSDT) &&
                            gbl_fadt->Xdsdt) {
                                table_address =
-                                   (acpi_physical_address) gbl_fadt->Xdsdt;
+                                   (acpi_physical_address)gbl_fadt->Xdsdt;
                        } else
                            if ((gbl_fadt->header.length >= MIN_FADT_FOR_DSDT)
                                && gbl_fadt->dsdt) {
                                table_address =
-                                   (acpi_physical_address) gbl_fadt->dsdt;
+                                   (acpi_physical_address)gbl_fadt->dsdt;
                        }
                } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_FACS)) {
                        if ((gbl_fadt->header.length >= MIN_FADT_FOR_XFACS) &&
                            gbl_fadt->Xfacs) {
                                table_address =
-                                   (acpi_physical_address) gbl_fadt->Xfacs;
+                                   (acpi_physical_address)gbl_fadt->Xfacs;
                        } else
                            if ((gbl_fadt->header.length >= MIN_FADT_FOR_FACS)
                                && gbl_fadt->facs) {
                                table_address =
-                                   (acpi_physical_address) gbl_fadt->facs;
+                                   (acpi_physical_address)gbl_fadt->facs;
                        }
                } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_XSDT)) {
                        if (!gbl_revision) {
                                return (AE_BAD_SIGNATURE);
                        }
                        table_address =
-                           (acpi_physical_address) gbl_rsdp.
+                           (acpi_physical_address)gbl_rsdp.
                            xsdt_physical_address;
                } else if (ACPI_COMPARE_NAME(signature, ACPI_SIG_RSDT)) {
                        table_address =
-                           (acpi_physical_address) gbl_rsdp.
+                           (acpi_physical_address)gbl_rsdp.
                            rsdt_physical_address;
                } else {
-                       table_address =
-                           (acpi_physical_address) gbl_rsdp_address;
+                       table_address = (acpi_physical_address)gbl_rsdp_address;
                        signature = ACPI_SIG_RSDP;
                }
 
@@ -904,12 +903,12 @@ osl_get_bios_table(char *signature,
                for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
                        if (osl_can_use_xsdt()) {
                                table_address =
-                                   (acpi_physical_address) (*ACPI_CAST64
-                                                            (table_data));
+                                   (acpi_physical_address)(*ACPI_CAST64
+                                                           (table_data));
                        } else {
                                table_address =
-                                   (acpi_physical_address) (*ACPI_CAST32
-                                                            (table_data));
+                                   (acpi_physical_address)(*ACPI_CAST32
+                                                           (table_data));
                        }
 
                        /* Skip NULL entries in RSDT/XSDT */
@@ -1301,7 +1300,7 @@ osl_get_customized_table(char *pathname,
                         char *signature,
                         u32 instance,
                         struct acpi_table_header **table,
-                        acpi_physical_address * address)
+                        acpi_physical_address *address)
 {
        void *table_dir;
        u32 current_instance = 0;
index 3818fd07e50fd1e74a8ea2450bbfa29bff4957ba..cbfbce18783d322978ffa32dea43f4d6d96a7f20 100644 (file)
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
-#if defined(_dragon_fly) || defined(_free_BSD)
+#if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX)
 #define MMAP_FLAGS          MAP_SHARED
 #else
 #define MMAP_FLAGS          MAP_PRIVATE
index 08cb8b2035f22a7af9fd030dc101b04750079107..88aa66ef4ad53394f4bec5622355935f5f60169a 100644 (file)
@@ -246,8 +246,8 @@ acpi_physical_address acpi_os_get_root_pointer(void)
  *****************************************************************************/
 
 acpi_status
-acpi_os_predefined_override(const struct acpi_predefined_names * init_val,
-                           acpi_string * new_val)
+acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
+                           acpi_string *new_val)
 {
 
        if (!init_val || !new_val) {
@@ -274,8 +274,8 @@ acpi_os_predefined_override(const struct acpi_predefined_names * init_val,
  *****************************************************************************/
 
 acpi_status
-acpi_os_table_override(struct acpi_table_header * existing_table,
-                      struct acpi_table_header ** new_table)
+acpi_os_table_override(struct acpi_table_header *existing_table,
+                      struct acpi_table_header **new_table)
 {
 
        if (!existing_table || !new_table) {
@@ -311,8 +311,8 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
  *****************************************************************************/
 
 acpi_status
-acpi_os_physical_table_override(struct acpi_table_header * existing_table,
-                               acpi_physical_address * new_address,
+acpi_os_physical_table_override(struct acpi_table_header *existing_table,
+                               acpi_physical_address *new_address,
                                u32 *new_table_length)
 {
 
@@ -506,7 +506,7 @@ acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read)
 void *acpi_os_map_memory(acpi_physical_address where, acpi_size length)
 {
 
-       return (ACPI_TO_POINTER((acpi_size) where));
+       return (ACPI_TO_POINTER((acpi_size)where));
 }
 
 /******************************************************************************
@@ -603,9 +603,9 @@ void acpi_os_free(void *mem)
 
 acpi_status
 acpi_os_create_semaphore(u32 max_units,
-                        u32 initial_units, acpi_handle * out_handle)
+                        u32 initial_units, acpi_handle *out_handle)
 {
-       *out_handle = (acpi_handle) 1;
+       *out_handle = (acpi_handle)1;
        return (AE_OK);
 }
 
@@ -640,7 +640,7 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
 
 acpi_status
 acpi_os_create_semaphore(u32 max_units,
-                        u32 initial_units, acpi_handle * out_handle)
+                        u32 initial_units, acpi_handle *out_handle)
 {
        sem_t *sem;
 
@@ -672,7 +672,7 @@ acpi_os_create_semaphore(u32 max_units,
        }
 #endif
 
-       *out_handle = (acpi_handle) sem;
+       *out_handle = (acpi_handle)sem;
        return (AE_OK);
 }
 
@@ -1035,7 +1035,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
  *****************************************************************************/
 
 acpi_status
-acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id,
+acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
                                u32 pci_register, u64 value, u32 width)
 {
 
index 8d761576e91b076799a6d2e02d7e9f0737f5d69b..2942cdced2ad4d6103fd42554193d3541f4326c0 100644 (file)
@@ -31,6 +31,7 @@ TOOL_OBJS = \
        osunixxf.o\
        tbprint.o\
        tbxfroot.o\
+       utascii.o\
        utbuffer.o\
        utdebug.o\
        utexcep.o\
index da44458d3b6c313eb3d967bb65d2dd03dd325298..fb8f1d9e3b1b6e70bb0d731e9de7fb2a4db05cff 100644 (file)
@@ -68,7 +68,7 @@ u8 ap_is_valid_header(struct acpi_table_header *table)
 
                /* Make sure signature is all ASCII and a valid ACPI name */
 
-               if (!acpi_ut_valid_acpi_name(table->signature)) {
+               if (!acpi_ut_valid_nameseg(table->signature)) {
                        acpi_log_error("Table signature (0x%8.8X) is invalid\n",
                                       *(u32 *)table->signature);
                        return (FALSE);
@@ -286,14 +286,15 @@ int ap_dump_table_by_address(char *ascii_address)
 
        /* Convert argument to an integer physical address */
 
-       status = acpi_ut_strtoul64(ascii_address, 0, &long_address);
+       status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE,
+                                  ACPI_MAX64_BYTE_WIDTH, &long_address);
        if (ACPI_FAILURE(status)) {
                acpi_log_error("%s: Could not convert to a physical address\n",
                               ascii_address);
                return (-1);
        }
 
-       address = (acpi_physical_address) long_address;
+       address = (acpi_physical_address)long_address;
        status = acpi_os_get_table_by_address(address, &table);
        if (ACPI_FAILURE(status)) {
                acpi_log_error("Could not get table at 0x%8.8X%8.8X, %s\n",
@@ -406,6 +407,12 @@ int ap_dump_table_from_file(char *pathname)
                return (-1);
        }
 
+       if (!acpi_ut_valid_nameseg(table->signature)) {
+               acpi_log_error
+                   ("No valid ACPI signature was found in input file %s\n",
+                    pathname);
+       }
+
        /* File must be at least as long as the table length */
 
        if (table->length > file_size) {
index c3c09152fac665da753a26a9ef59caf0637ef083..7692e6b887e120c3f89757f104653255d6e87651 100644 (file)
@@ -209,7 +209,8 @@ static int ap_do_options(int argc, char **argv)
                case 'r':       /* Dump tables from specified RSDP */
 
                        status =
-                           acpi_ut_strtoul64(acpi_gbl_optarg, 0,
+                           acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE,
+                                             ACPI_MAX64_BYTE_WIDTH,
                                              &gbl_rsdp_base);
                        if (ACPI_FAILURE(status)) {
                                acpi_log_error