From 7907eb535c982e8a8b9f54ba69ea2ed1efe615f0 Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Thu, 17 May 2012 12:43:40 -0700 Subject: [PATCH] cs: move qdss code under drivers In preparation to create generic coresight drivers code move existing qdss code under drivers/cs and include/linux Change-Id: If7697a9961006fe94818e32d19aea75c56ce225d Signed-off-by: Pratik Patel --- arch/arm/mach-msm/Kconfig | 36 ++++++------------- arch/arm/mach-msm/Makefile | 1 - arch/arm/mach-msm/devices-8064.c | 2 +- arch/arm/mach-msm/devices-8960.c | 2 +- arch/arm/mach-msm/hotplug.c | 2 +- arch/arm/mach-msm/jtag.c | 13 ++++++- drivers/Kconfig | 2 ++ drivers/Makefile | 2 ++ drivers/cs/Kconfig | 32 +++++++++++++++++ drivers/cs/Makefile | 2 ++ {arch/arm/mach-msm => drivers/cs}/qdss-etb.c | 0 {arch/arm/mach-msm => drivers/cs}/qdss-etm.c | 0 .../arm/mach-msm => drivers/cs}/qdss-funnel.c | 0 {arch/arm/mach-msm => drivers/cs}/qdss-priv.h | 2 +- {arch/arm/mach-msm => drivers/cs}/qdss-stm.c | 0 {arch/arm/mach-msm => drivers/cs}/qdss-tpiu.c | 0 {arch/arm/mach-msm => drivers/cs}/qdss.c | 0 .../include/mach => include/linux}/qdss.h | 0 18 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 drivers/cs/Kconfig create mode 100644 drivers/cs/Makefile rename {arch/arm/mach-msm => drivers/cs}/qdss-etb.c (100%) rename {arch/arm/mach-msm => drivers/cs}/qdss-etm.c (100%) rename {arch/arm/mach-msm => drivers/cs}/qdss-funnel.c (100%) rename {arch/arm/mach-msm => drivers/cs}/qdss-priv.h (98%) rename {arch/arm/mach-msm => drivers/cs}/qdss-stm.c (100%) rename {arch/arm/mach-msm => drivers/cs}/qdss-tpiu.c (100%) rename {arch/arm/mach-msm => drivers/cs}/qdss.c (100%) rename {arch/arm/mach-msm/include/mach => include/linux}/qdss.h (100%) diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index d1ab4dd77c1..776bf40570d 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig @@ -347,12 +347,14 @@ config ARCH_MSM_SCORPIONMP select ARCH_MSM_SCORPION select MSM_SMP select HAVE_ARCH_HAS_CURRENT_TIMER + select MSM_JTAG if MSM_QDSS bool config ARCH_MSM_KRAITMP select ARCH_MSM_KRAIT select MSM_SMP select HAVE_ARCH_HAS_CURRENT_TIMER + select MSM_JTAG if MSM_QDSS bool select HAVE_HW_BRKPT_RESERVED_RW_ACCESS @@ -2074,9 +2076,15 @@ config MSM_DLOAD_MODE enabled via another mechanism. config MSM_JTAG - bool "JTAG debug and trace support" + bool "JTAG and kernel debug and trace support across power collapse" help - Add additional support for JTAG kernel debugging and tracing. + Enables support for kernel debugging (specifically breakpoints) and + processor tracing across power collapse both for JTag and OS hosted + software running on the target. Enabling this will ensure debug + and ETM registers are saved and restored across power collapse. + + For production builds, you should probably say 'N' here to avoid + potential power, performance and memory penalty. config MSM_ETM tristate "Enable MSM ETM and ETB" @@ -2085,30 +2093,6 @@ config MSM_ETM help Enables embedded trace collection on MSM8660 -config MSM_QDSS - bool "Qualcomm Debug Subsystem" - select MSM_JTAG - help - Enables support for Qualcomm Debug Subsystem. - -config MSM_QDSS_STM_DEFAULT_ENABLE - bool "Turn on QDSS STM Tracing by Default" - depends on MSM_QDSS - help - Turns on QDSS STM tracing (hardware assisted software - instrumentation based tracing) by default. Otherwise, tracing is - disabled by default but can be enabled via sysfs. - - For production builds, you should probably say 'N' here to avoid - potential power, performance and memory penalty. - -config MSM_QDSS_ETM_DEFAULT_ENABLE - bool "Turn on QDSS ETM Tracing by Default" - depends on MSM_QDSS - help - Turns on QDSS ETM tracing by default. Otherwise, tracing is - disabled by default but can be enabled by other means. - config MSM_SLEEP_STATS bool "Enable exporting of MSM sleep stats to userspace" depends on CPU_IDLE diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index 8315d70284d..ec8de9f070c 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile @@ -55,7 +55,6 @@ obj-$(CONFIG_MSM_JTAG) += jtag.o msm-etm-objs := etm.o obj-$(CONFIG_MSM_ETM) += msm-etm.o -obj-$(CONFIG_MSM_QDSS) += qdss.o qdss-etb.o qdss-tpiu.o qdss-funnel.o qdss-stm.o qdss-etm.o quiet_cmd_mkrpcsym = MKCAP $@ cmd_mkrpcsym = $(PERL) $(srctree)/$(src)/mkrpcsym.pl $< $@ diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c index cc3c6db4aa3..288d0e31ca7 100644 --- a/arch/arm/mach-msm/devices-8064.c +++ b/arch/arm/mach-msm/devices-8064.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include "clock.h" #include "devices.h" diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c index 550a283b6b7..d26a68ac194 100644 --- a/arch/arm/mach-msm/devices-8960.c +++ b/arch/arm/mach-msm/devices-8960.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #include #include -#include #include #include "clock.h" #include "devices.h" diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c index 46e835ff7b0..60059e850b3 100644 --- a/arch/arm/mach-msm/hotplug.c +++ b/arch/arm/mach-msm/hotplug.c @@ -11,12 +11,12 @@ #include #include #include +#include #include #include #include -#include #include #include "pm.h" diff --git a/arch/arm/mach-msm/jtag.c b/arch/arm/mach-msm/jtag.c index 8dae9c63a52..cd4a908ef53 100644 --- a/arch/arm/mach-msm/jtag.c +++ b/arch/arm/mach-msm/jtag.c @@ -21,9 +21,20 @@ #include #include -#include "qdss-priv.h" #include "cp14.h" +/* DBGv7 with baseline CP14 registers implemented */ +#define ARM_DEBUG_ARCH_V7B (0x3) +/* DBGv7 with all CP14 registers implemented */ +#define ARM_DEBUG_ARCH_V7 (0x4) +#define ARM_DEBUG_ARCH_V7_1 (0x5) +#define ETM_ARCH_V3_3 (0x23) +#define PFT_ARCH_V1_1 (0x31) + +#define BM(lsb, msb) ((BIT(msb) - BIT(lsb)) + BIT(msb)) +#define BMVAL(val, lsb, msb) ((val & BM(lsb, msb)) >> lsb) +#define BVAL(val, n) ((val & BIT(n)) >> n) + /* no of dbg regs + 1 (for storing the reg count) */ #define MAX_DBG_REGS (90) #define MAX_DBG_STATE_SIZE (MAX_DBG_REGS * num_possible_cpus()) diff --git a/drivers/Kconfig b/drivers/Kconfig index 286a4d4b53f..7225bdf1015 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -148,4 +148,6 @@ source "drivers/devfreq/Kconfig" source "drivers/gud/Kconfig" +source "drivers/cs/Kconfig" + endmenu diff --git a/drivers/Makefile b/drivers/Makefile index bea505cd15e..3272e2cbac0 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -140,3 +140,5 @@ obj-$(CONFIG_PM_DEVFREQ) += devfreq/ #MobiCore obj-$(CONFIG_MOBICORE_SUPPORT) += gud/ + +obj-$(CONFIG_MSM_QDSS) += cs/ diff --git a/drivers/cs/Kconfig b/drivers/cs/Kconfig new file mode 100644 index 00000000000..1219af10ca7 --- /dev/null +++ b/drivers/cs/Kconfig @@ -0,0 +1,32 @@ +config MSM_QDSS + bool "CoreSight tracing" + help + Enables support for CoreSight tracing. This uses CoreSight trace + components and buses to support both hardware (eg. processor ETM) + and hardware assisted software instrumentation based (eg. STM) + tracing. + + For production builds, you should probably say 'N' here to avoid + potential power, performance and memory penalty. + +config MSM_QDSS_STM_DEFAULT_ENABLE + bool "Turn on CoreSight STM tracing by default" + depends on MSM_QDSS + help + Turns on CoreSight STM tracing (hardware assisted software + instrumentation based tracing) by default. Otherwise, tracing is + disabled by default but can be enabled via sysfs. + + For production builds, you should probably say 'N' here to avoid + potential power, performance and memory penalty. + +config MSM_QDSS_ETM_DEFAULT_ENABLE + bool "Turn on CoreSight ETM tracing by default" + depends on MSM_QDSS + help + Turns on CoreSight ETM tracing (processor tracing) by default. + Otherwise, tracing is disabled by default but can be enabled via + sysfs. + + For production builds, you should probably say 'N' here to avoid + potential power, performance and memory penalty. diff --git a/drivers/cs/Makefile b/drivers/cs/Makefile new file mode 100644 index 00000000000..9a634a1f42a --- /dev/null +++ b/drivers/cs/Makefile @@ -0,0 +1,2 @@ + +obj-$(CONFIG_MSM_QDSS) += qdss.o qdss-etb.o qdss-tpiu.o qdss-funnel.o qdss-stm.o qdss-etm.o diff --git a/arch/arm/mach-msm/qdss-etb.c b/drivers/cs/qdss-etb.c similarity index 100% rename from arch/arm/mach-msm/qdss-etb.c rename to drivers/cs/qdss-etb.c diff --git a/arch/arm/mach-msm/qdss-etm.c b/drivers/cs/qdss-etm.c similarity index 100% rename from arch/arm/mach-msm/qdss-etm.c rename to drivers/cs/qdss-etm.c diff --git a/arch/arm/mach-msm/qdss-funnel.c b/drivers/cs/qdss-funnel.c similarity index 100% rename from arch/arm/mach-msm/qdss-funnel.c rename to drivers/cs/qdss-funnel.c diff --git a/arch/arm/mach-msm/qdss-priv.h b/drivers/cs/qdss-priv.h similarity index 98% rename from arch/arm/mach-msm/qdss-priv.h rename to drivers/cs/qdss-priv.h index f39bc52a164..868514c95ac 100644 --- a/arch/arm/mach-msm/qdss-priv.h +++ b/drivers/cs/qdss-priv.h @@ -14,7 +14,7 @@ #define _ARCH_ARM_MACH_MSM_QDSS_H_ #include -#include +#include /* Coresight management registers (0xF00-0xFCC) * 0xFA0 - 0xFA4: Management registers in PFTv1.0 diff --git a/arch/arm/mach-msm/qdss-stm.c b/drivers/cs/qdss-stm.c similarity index 100% rename from arch/arm/mach-msm/qdss-stm.c rename to drivers/cs/qdss-stm.c diff --git a/arch/arm/mach-msm/qdss-tpiu.c b/drivers/cs/qdss-tpiu.c similarity index 100% rename from arch/arm/mach-msm/qdss-tpiu.c rename to drivers/cs/qdss-tpiu.c diff --git a/arch/arm/mach-msm/qdss.c b/drivers/cs/qdss.c similarity index 100% rename from arch/arm/mach-msm/qdss.c rename to drivers/cs/qdss.c diff --git a/arch/arm/mach-msm/include/mach/qdss.h b/include/linux/qdss.h similarity index 100% rename from arch/arm/mach-msm/include/mach/qdss.h rename to include/linux/qdss.h