summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include10
-rw-r--r--scripts/Makefile.build12
-rw-r--r--scripts/Makefile.dtbinst8
-rw-r--r--scripts/Makefile.extrawarn1
-rw-r--r--scripts/Makefile.headersinst105
-rw-r--r--scripts/Makefile.lib35
-rwxr-xr-xscripts/analyze_suspend.py5235
-rwxr-xr-xscripts/checkpatch.pl165
-rwxr-xr-xscripts/checkstack.pl5
-rwxr-xr-xscripts/checksyscalls.sh1
-rw-r--r--scripts/coccinelle/api/drm-get-put.cocci92
l---------scripts/dtc/include-prefixes/arc1
l---------scripts/dtc/include-prefixes/arm1
l---------scripts/dtc/include-prefixes/arm641
l---------scripts/dtc/include-prefixes/c6x1
l---------scripts/dtc/include-prefixes/cris1
l---------scripts/dtc/include-prefixes/dt-bindings1
l---------scripts/dtc/include-prefixes/h83001
l---------scripts/dtc/include-prefixes/metag1
l---------scripts/dtc/include-prefixes/microblaze1
l---------scripts/dtc/include-prefixes/mips1
l---------scripts/dtc/include-prefixes/nios21
l---------scripts/dtc/include-prefixes/openrisc1
l---------scripts/dtc/include-prefixes/powerpc1
l---------scripts/dtc/include-prefixes/sh1
l---------scripts/dtc/include-prefixes/xtensa1
-rw-r--r--scripts/genksyms/parse.tab.c_shipped474
-rw-r--r--scripts/genksyms/parse.y2
-rw-r--r--scripts/kconfig/gconf.c2
-rwxr-xr-xscripts/kernel-doc19
-rw-r--r--scripts/ksymoops/README5
-rw-r--r--scripts/mod/Makefile28
-rw-r--r--scripts/module-common.lds3
-rwxr-xr-xscripts/objdiff5
-rwxr-xr-xscripts/package/builddeb20
-rw-r--r--scripts/recordmcount.c1
-rwxr-xr-xscripts/recordmcount.pl1
-rw-r--r--scripts/selinux/genheaders/genheaders.c1
-rw-r--r--scripts/selinux/mdp/mdp.c1
-rw-r--r--scripts/spelling.txt33
-rwxr-xr-xscripts/ver_linux2
41 files changed, 623 insertions, 5658 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index d6ca649cb0e9..61f87a99bf0a 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
# cc-option-yn
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
cc-option-yn = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)
# cc-option-align
# Prefix align with either -falign or -malign
@@ -131,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\
# cc-disable-warning
# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
cc-disable-warning = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
# cc-name
# Expands to either gcc or clang
@@ -148,6 +148,10 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4))
+# cc-if-fullversion
+# Usage: EXTRA_CFLAGS += $(call cc-if-fullversion, -lt, 040502, -O1)
+cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo $(4))
+
# cc-ldoption
# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
cc-ldoption = $(call try-run,\
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d883116ebaa4..733e044fff8b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -177,6 +177,14 @@ cmd_cc_symtypes_c = \
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
+# LLVM assembly
+# Generate .ll files from .c
+quiet_cmd_cc_ll_c = CC $(quiet_modtag) $@
+ cmd_cc_ll_c = $(CC) $(c_flags) -emit-llvm -S -o $@ $<
+
+$(obj)/%.ll: $(src)/%.c FORCE
+ $(call if_changed_dep,cc_ll_c)
+
# C (.c) files
# The C file is compiled and updated dependency information is generated.
# (See cmd_cc_o_c + relevant part of rule_cc_o_c)
@@ -272,14 +280,14 @@ define rule_cc_o_c
$(call echo-cmd,checksrc) $(cmd_checksrc) \
$(call cmd_and_fixdep,cc_o_c) \
$(cmd_modversions_c) \
- $(cmd_objtool) \
+ $(call echo-cmd,objtool) $(cmd_objtool) \
$(call echo-cmd,record_mcount) $(cmd_record_mcount)
endef
define rule_as_o_S
$(call cmd_and_fixdep,as_o_S) \
$(cmd_modversions_S) \
- $(cmd_objtool)
+ $(call echo-cmd,objtool) $(cmd_objtool)
endef
# List module undefined symbols (or empty line if not enabled)
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index a1be75d0a5fd..34614a48b717 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -20,12 +20,6 @@ include include/config/auto.conf
include scripts/Kbuild.include
include $(src)/Makefile
-PHONY += __dtbs_install_prep
-__dtbs_install_prep:
-ifeq ("$(dtbinst-root)", "$(obj)")
- $(Q)mkdir -p $(INSTALL_DTBS_PATH)
-endif
-
dtbinst-files := $(dtb-y)
dtbinst-dirs := $(dts-dirs)
@@ -35,8 +29,6 @@ quiet_cmd_dtb_install = INSTALL $<
install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
-
$(dtbinst-files): %.dtb: $(obj)/%.dtb
$(call cmd,dtb_install,$(install-dir))
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 7c321a603b07..fb3522fd8702 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -64,7 +64,6 @@ ifeq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
KBUILD_CFLAGS += $(call cc-disable-warning, format)
-KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option)
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 1106d6ca3a38..ce753a408c56 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -1,33 +1,56 @@
# ==========================================================================
# Installing headers
#
-# header-y - list files to be installed. They are preprocessed
-# to remove __KERNEL__ section of the file
-# genhdr-y - Same as header-y but in a generated/ directory
+# All headers under include/uapi, include/generated/uapi,
+# arch/<arch>/include/uapi and arch/<arch>/include/generated/uapi are
+# exported.
+# They are preprocessed to remove __KERNEL__ section of the file.
#
# ==========================================================================
+PHONY := __headers
+__headers:
+
+include scripts/Kbuild.include
+
+srcdir := $(srctree)/$(obj)
+subdirs := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
+# caller may set destination dir (when installing to asm/)
+_dst := $(if $(dst),$(dst),$(obj))
+
+# Recursion
+__headers: $(subdirs)
+
+.PHONY: $(subdirs)
+$(subdirs):
+ $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
+
+# Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi.
+# We have only sub-directories there.
+skip-inst := $(if $(filter %/uapi,$(obj)),1)
+
+ifeq ($(skip-inst),)
+
# generated header directory
gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
+# Kbuild file is optional
kbuild-file := $(srctree)/$(obj)/Kbuild
-include $(kbuild-file)
-
-# called may set destination dir (when installing to asm/)
-_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
+-include $(kbuild-file)
old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
ifneq ($(wildcard $(old-kbuild-file)),)
include $(old-kbuild-file)
endif
-include scripts/Kbuild.include
-
installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
-header-y := $(sort $(header-y))
-subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
-header-y := $(filter-out %/, $(header-y))
+gendir := $(objtree)/$(gen)
+header-files := $(notdir $(wildcard $(srcdir)/*.h))
+header-files += $(notdir $(wildcard $(srcdir)/*.agh))
+header-files := $(filter-out $(no-export-headers), $(header-files))
+genhdr-files := $(notdir $(wildcard $(gendir)/*.h))
+genhdr-files := $(filter-out $(header-files), $(genhdr-files))
# files used to track state of install/check
install-file := $(installdir)/.install
@@ -35,36 +58,20 @@ check-file := $(installdir)/.check
# generic-y list all files an architecture uses from asm-generic
# Use this to build a list of headers which require a wrapper
-wrapper-files := $(filter $(header-y), $(generic-y))
-
-srcdir := $(srctree)/$(obj)
-gendir := $(objtree)/$(gen)
-
-oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
+generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h))
+wrapper-files := $(filter $(generic-files), $(generic-y))
+wrapper-files := $(filter-out $(header-files), $(wrapper-files))
# all headers files for this dir
-header-y := $(filter-out $(generic-y), $(header-y))
-all-files := $(header-y) $(genhdr-y) $(wrapper-files)
+all-files := $(header-files) $(genhdr-files) $(wrapper-files)
output-files := $(addprefix $(installdir)/, $(all-files))
-input-files1 := $(foreach hdr, $(header-y), \
- $(if $(wildcard $(srcdir)/$(hdr)), \
- $(wildcard $(srcdir)/$(hdr))) \
- )
-input-files1-name := $(notdir $(input-files1))
-input-files2 := $(foreach hdr, $(header-y), \
- $(if $(wildcard $(srcdir)/$(hdr)),, \
- $(if $(wildcard $(oldsrcdir)/$(hdr)), \
- $(wildcard $(oldsrcdir)/$(hdr)), \
- $(error Missing UAPI file $(srcdir)/$(hdr))) \
- ))
-input-files2-name := $(notdir $(input-files2))
-input-files3 := $(foreach hdr, $(genhdr-y), \
- $(if $(wildcard $(gendir)/$(hdr)), \
- $(wildcard $(gendir)/$(hdr)), \
- $(error Missing generated UAPI file $(gendir)/$(hdr)) \
- ))
-input-files3-name := $(notdir $(input-files3))
+ifneq ($(mandatory-y),)
+missing := $(filter-out $(all-files),$(mandatory-y))
+ifneq ($(missing),)
+$(error Some mandatory headers ($(missing)) are missing in $(obj))
+endif
+endif
# Work out what needs to be removed
oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -78,9 +85,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
file$(if $(word 2, $(all-files)),s))
cmd_install = \
- $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
- $(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
- $(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
+ $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
+ $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
for F in $(wrapper-files); do \
echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
done; \
@@ -98,21 +104,21 @@ quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
$(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
touch $@
-PHONY += __headersinst __headerscheck
-
ifndef HDRCHECK
# Rules for installing headers
-__headersinst: $(subdirs) $(install-file)
+__headers: $(install-file)
@:
targets += $(install-file)
-$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
+$(install-file): scripts/headers_install.sh \
+ $(addprefix $(srcdir)/,$(header-files)) \
+ $(addprefix $(gendir)/,$(genhdr-files)) FORCE
$(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install)
else
-__headerscheck: $(subdirs) $(check-file)
+__headers: $(check-file)
@:
targets += $(check-file)
@@ -121,11 +127,6 @@ $(check-file): scripts/headers_check.pl $(output-files) FORCE
endif
-# Recursion
-.PHONY: $(subdirs)
-$(subdirs):
- $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
-
targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard \
$(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
@@ -134,6 +135,8 @@ ifneq ($(cmd_files),)
include $(cmd_files)
endif
+endif # skip-inst
+
.PHONY: $(PHONY)
PHONY += FORCE
FORCE: ;
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 01c77403a803..58c05e5d9870 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -155,7 +155,7 @@ else
# $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
# and locates generated .h files
# FIXME: Replace both with specific CFLAGS* statements in the makefiles
-__c_flags = $(if $(obj),-I$(srctree)/$(src) -I$(obj)) \
+__c_flags = $(if $(obj),$(call addtree,-I$(src)) -I$(obj)) \
$(call flags,_c_flags)
__a_flags = $(call flags,_a_flags)
__cpp_flags = $(call flags,_cpp_flags)
@@ -175,7 +175,7 @@ ld_flags = $(LDFLAGS) $(ldflags-y)
dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
-I$(srctree)/arch/$(SRCARCH)/boot/dts \
- -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
+ -I$(srctree)/scripts/dtc/include-prefixes \
-I$(srctree)/drivers/of/testcase-data \
-undef -D__DTS__
@@ -420,3 +420,34 @@ quiet_cmd_xzmisc = XZMISC $@
cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
(rm -f $@ ; false)
+
+# ASM offsets
+# ---------------------------------------------------------------------------
+
+# Default sed regexp - multiline due to syntax constraints
+#
+# Use [:space:] because LLVM's integrated assembler inserts <tab> around
+# the .ascii directive whereas GCC keeps the <space> as-is.
+define sed-offsets
+ 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \
+ /^->/{s:->#\(.*\):/* \1 */:; \
+ s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
+ s:->::; p;}'
+endef
+
+# Use filechk to avoid rebuilds when a header changes, but the resulting file
+# does not
+define filechk_offsets
+ (set -e; \
+ echo "#ifndef $2"; \
+ echo "#define $2"; \
+ echo "/*"; \
+ echo " * DO NOT MODIFY."; \
+ echo " *"; \
+ echo " * This file was generated by Kbuild"; \
+ echo " */"; \
+ echo ""; \
+ sed -ne $(sed-offsets); \
+ echo ""; \
+ echo "#endif" )
+endef
diff --git a/scripts/analyze_suspend.py b/scripts/analyze_suspend.py
deleted file mode 100755
index 20cdb2bc1dae..000000000000
--- a/scripts/analyze_suspend.py
+++ /dev/null
@@ -1,5235 +0,0 @@
-#!/usr/bin/python
-#
-# Tool for analyzing suspend/resume timing
-# Copyright (c) 2013, Intel Corporation.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Authors:
-# Todd Brandt <todd.e.brandt@linux.intel.com>
-#
-# Links:
-# Home Page
-# https://01.org/suspendresume
-# Source repo
-# https://github.com/01org/suspendresume
-#
-# Description:
-# This tool is designed to assist kernel and OS developers in optimizing
-# their linux stack's suspend/resume time. Using a kernel image built
-# with a few extra options enabled, the tool will execute a suspend and
-# will capture dmesg and ftrace data until resume is complete. This data
-# is transformed into a device timeline and a callgraph to give a quick
-# and detailed view of which devices and callbacks are taking the most
-# time in suspend/resume. The output is a single html file which can be
-# viewed in firefox or chrome.
-#
-# The following kernel build options are required:
-# CONFIG_PM_DEBUG=y
-# CONFIG_PM_SLEEP_DEBUG=y
-# CONFIG_FTRACE=y
-# CONFIG_FUNCTION_TRACER=y
-# CONFIG_FUNCTION_GRAPH_TRACER=y
-# CONFIG_KPROBES=y
-# CONFIG_KPROBES_ON_FTRACE=y
-#
-# For kernel versions older than 3.15:
-# The following additional kernel parameters are required:
-# (e.g. in file /etc/default/grub)
-# GRUB_CMDLINE_LINUX_DEFAULT="... initcall_debug log_buf_len=16M ..."
-#
-
-# ----------------- LIBRARIES --------------------
-
-import sys
-import time
-import os
-import string
-import re
-import platform
-from datetime import datetime
-import struct
-import ConfigParser
-from threading import Thread
-from subprocess import call, Popen, PIPE
-
-# ----------------- CLASSES --------------------
-
-# Class: SystemValues
-# Description:
-# A global, single-instance container used to
-# store system values and test parameters
-class SystemValues:
- ansi = False
- version = '4.5'
- verbose = False
- addlogs = False
- mindevlen = 0.0
- mincglen = 0.0
- cgphase = ''
- cgtest = -1
- callloopmaxgap = 0.0001
- callloopmaxlen = 0.005
- srgap = 0
- cgexp = False
- outdir = ''
- testdir = '.'
- tpath = '/sys/kernel/debug/tracing/'
- fpdtpath = '/sys/firmware/acpi/tables/FPDT'
- epath = '/sys/kernel/debug/tracing/events/power/'
- traceevents = [
- 'suspend_resume',
- 'device_pm_callback_end',
- 'device_pm_callback_start'
- ]
- logmsg = ''
- testcommand = ''
- mempath = '/dev/mem'
- powerfile = '/sys/power/state'
- suspendmode = 'mem'
- hostname = 'localhost'
- prefix = 'test'
- teststamp = ''
- dmesgstart = 0.0
- dmesgfile = ''
- ftracefile = ''
- htmlfile = ''
- embedded = False
- rtcwake = False
- rtcwaketime = 10
- rtcpath = ''
- devicefilter = []
- stamp = 0
- execcount = 1
- x2delay = 0
- usecallgraph = False
- usetraceevents = False
- usetraceeventsonly = False
- usetracemarkers = True
- usekprobes = True
- usedevsrc = False
- useprocmon = False
- notestrun = False
- mixedphaseheight = True
- devprops = dict()
- predelay = 0
- postdelay = 0
- procexecfmt = 'ps - (?P<ps>.*)$'
- devpropfmt = '# Device Properties: .*'
- tracertypefmt = '# tracer: (?P<t>.*)'
- firmwarefmt = '# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
- stampfmt = '# suspend-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
- '(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
- ' (?P<host>.*) (?P<mode>.*) (?P<kernel>.*)$'
- tracefuncs = {
- 'sys_sync': dict(),
- 'pm_prepare_console': dict(),
- 'pm_notifier_call_chain': dict(),
- 'freeze_processes': dict(),
- 'freeze_kernel_threads': dict(),
- 'pm_restrict_gfp_mask': dict(),
- 'acpi_suspend_begin': dict(),
- 'suspend_console': dict(),
- 'acpi_pm_prepare': dict(),
- 'syscore_suspend': dict(),
- 'arch_enable_nonboot_cpus_end': dict(),
- 'syscore_resume': dict(),
- 'acpi_pm_finish': dict(),
- 'resume_console': dict(),
- 'acpi_pm_end': dict(),
- 'pm_restore_gfp_mask': dict(),
- 'thaw_processes': dict(),
- 'pm_restore_console': dict(),
- 'CPU_OFF': {
- 'func':'_cpu_down',
- 'args_x86_64': {'cpu':'%di:s32'},
- 'format': 'CPU_OFF[{cpu}]'
- },
- 'CPU_ON': {
- 'func':'_cpu_up',
- 'args_x86_64': {'cpu':'%di:s32'},
- 'format': 'CPU_ON[{cpu}]'
- },
- }
- dev_tracefuncs = {
- # general wait/delay/sleep
- 'msleep': { 'args_x86_64': {'time':'%di:s32'}, 'ub': 1 },
- 'schedule_timeout_uninterruptible': { 'args_x86_64': {'timeout':'%di:s32'}, 'ub': 1 },
- 'schedule_timeout': { 'args_x86_64': {'timeout':'%di:s32'}, 'ub': 1 },
- 'udelay': { 'func':'__const_udelay', 'args_x86_64': {'loops':'%di:s32'}, 'ub': 1 },
- 'usleep_range': { 'args_x86_64': {'min':'%di:s32', 'max':'%si:s32'}, 'ub': 1 },
- 'mutex_lock_slowpath': { 'func':'__mutex_lock_slowpath', 'ub': 1 },
- 'acpi_os_stall': {'ub': 1},
- # ACPI
- 'acpi_resume_power_resources': dict(),
- 'acpi_ps_parse_aml': dict(),
- # filesystem
- 'ext4_sync_fs': dict(),
- # 80211
- 'iwlagn_mac_start': dict(),
- 'iwlagn_alloc_bcast_station': dict(),
- 'iwl_trans_pcie_start_hw': dict(),
- 'iwl_trans_pcie_start_fw': dict(),
- 'iwl_run_init_ucode': dict(),
- 'iwl_load_ucode_wait_alive': dict(),
- 'iwl_alive_start': dict(),
- 'iwlagn_mac_stop': dict(),
- 'iwlagn_mac_suspend': dict(),
- 'iwlagn_mac_resume': dict(),
- 'iwlagn_mac_add_interface': dict(),
- 'iwlagn_mac_remove_interface': dict(),
- 'iwlagn_mac_change_interface': dict(),
- 'iwlagn_mac_config': dict(),
- 'iwlagn_configure_filter': dict(),
- 'iwlagn_mac_hw_scan': dict(),
- 'iwlagn_bss_info_changed': dict(),
- 'iwlagn_mac_channel_switch': dict(),
- 'iwlagn_mac_flush': dict(),
- # ATA
- 'ata_eh_recover': { 'args_x86_64': {'port':'+36(%di):s32'} },
- # i915
- 'i915_gem_resume': dict(),
- 'i915_restore_state': dict(),
- 'intel_opregion_setup': dict(),
- 'g4x_pre_enable_dp': dict(),
- 'vlv_pre_enable_dp': dict(),
- 'chv_pre_enable_dp': dict(),
- 'g4x_enable_dp': dict(),
- 'vlv_enable_dp': dict(),
- 'intel_hpd_init': dict(),
- 'intel_opregion_register': dict(),
- 'intel_dp_detect': dict(),
- 'intel_hdmi_detect': dict(),
- 'intel_opregion_init': dict(),
- 'intel_fbdev_set_suspend': dict(),
- }
- kprobes = dict()
- timeformat = '%.3f'
- def __init__(self):
- # if this is a phoronix test run, set some default options
- if('LOG_FILE' in os.environ and 'TEST_RESULTS_IDENTIFIER' in os.environ):
- self.embedded = True
- self.addlogs = True
- self.htmlfile = os.environ['LOG_FILE']
- self.archargs = 'args_'+platform.machine()
- self.hostname = platform.node()
- if(self.hostname == ''):
- self.hostname = 'localhost'
- rtc = "rtc0"
- if os.path.exists('/dev/rtc'):
- rtc = os.readlink('/dev/rtc')
- rtc = '/sys/class/rtc/'+rtc
- if os.path.exists(rtc) and os.path.exists(rtc+'/date') and \
- os.path.exists(rtc+'/time') and os.path.exists(rtc+'/wakealarm'):
- self.rtcpath = rtc
- if (hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()):
- self.ansi = True
- def setPrecision(self, num):
- if num < 0 or num > 6:
- return
- self.timeformat = '%.{0}f'.format(num)
- def setOutputFolder(self, value):
- args = dict()
- n = datetime.now()
- args['date'] = n.strftime('%y%m%d')
- args['time'] = n.strftime('%H%M%S')
- args['hostname'] = self.hostname
- self.outdir = value.format(**args)
- def setOutputFile(self):
- if((self.htmlfile == '') and (self.dmesgfile != '')):
- m = re.match('(?P<name>.*)_dmesg\.txt$', self.dmesgfile)
- if(m):
- self.htmlfile = m.group('name')+'.html'
- if((self.htmlfile == '') and (self.ftracefile != '')):
- m = re.match('(?P<name>.*)_ftrace\.txt$', self.ftracefile)
- if(m):
- self.htmlfile = m.group('name')+'.html'
- if(self.htmlfile == ''):
- self.htmlfile = 'output.html'
- def initTestOutput(self, subdir, testpath=''):
- self.prefix = self.hostname
- v = open('/proc/version', 'r').read().strip()
- kver = string.split(v)[2]
- n = datetime.now()
- testtime = n.strftime('suspend-%m%d%y-%H%M%S')
- if not testpath:
- testpath = n.strftime('suspend-%y%m%d-%H%M%S')
- if(subdir != "."):
- self.testdir = subdir+"/"+testpath
- else:
- self.testdir = testpath
- self.teststamp = \
- '# '+testtime+' '+self.prefix+' '+self.suspendmode+' '+kver
- if(self.embedded):
- self.dmesgfile = \
- '/tmp/'+testtime+'_'+self.suspendmode+'_dmesg.txt'
- self.ftracefile = \
- '/tmp/'+testtime+'_'+self.suspendmode+'_ftrace.txt'
- return
- self.dmesgfile = \
- self.testdir+'/'+self.prefix+'_'+self.suspendmode+'_dmesg.txt'
- self.ftracefile = \
- self.testdir+'/'+self.prefix+'_'+self.suspendmode+'_ftrace.txt'
- self.htmlfile = \
- self.testdir+'/'+self.prefix+'_'+self.suspendmode+'.html'
- if not os.path.isdir(self.testdir):
- os.mkdir(self.testdir)
- def setDeviceFilter(self, value):
- self.devicefilter = []
- if value:
- value = value.split(',')
- for i in value:
- self.devicefilter.append(i.strip())
- def rtcWakeAlarmOn(self):
- call('echo 0 > '+self.rtcpath+'/wakealarm', shell=True)
- outD = open(self.rtcpath+'/date', 'r').read().strip()
- outT = open(self.rtcpath+'/time', 'r').read().strip()
- mD = re.match('^(?P<y>[0-9]*)-(?P<m>[0-9]*)-(?P<d>[0-9]*)', outD)
- mT = re.match('^(?P<h>[0-9]*):(?P<m>[0-9]*):(?P<s>[0-9]*)', outT)
- if(mD and mT):
- # get the current time from hardware
- utcoffset = int((datetime.now() - datetime.utcnow()).total_seconds())
- dt = datetime(\
- int(mD.group('y')), int(mD.group('m')), int(mD.group('d')),
- int(mT.group('h')), int(mT.group('m')), int(mT.group('s')))
- nowtime = int(dt.strftime('%s')) + utcoffset
- else:
- # if hardware time fails, use the software time
- nowtime = int(datetime.now().strftime('%s'))
- alarm = nowtime + self.rtcwaketime
- call('echo %d > %s/wakealarm' % (alarm, self.rtcpath), shell=True)
- def rtcWakeAlarmOff(self):
- call('echo 0 > %s/wakealarm' % self.rtcpath, shell=True)
- def initdmesg(self):
- # get the latest time stamp from the dmesg log
- fp = Popen('dmesg', stdout=PIPE).stdout
- ktime = '0'
- for line in fp:
- line = line.replace('\r\n', '')
- idx = line.find('[')
- if idx > 1:
- line = line[idx:]
- m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)