msm: pil: Extract secure PIL operations

Move secure pil code into one file so we stop duplicating it in
each peripheral-reset-$(ARCH) file.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/configs/msm8660-perf_defconfig b/arch/arm/configs/msm8660-perf_defconfig
index 9d79d0e..2cd7953 100644
--- a/arch/arm/configs/msm8660-perf_defconfig
+++ b/arch/arm/configs/msm8660-perf_defconfig
@@ -61,7 +61,6 @@
 CONFIG_MSM_RMT_STORAGE_CLIENT=y
 CONFIG_MSM_SDIO_SMEM=y
 # CONFIG_MSM_HW3D is not set
-CONFIG_MSM_SECURE_PIL=y
 CONFIG_MSM_SUBSYSTEM_RESTART=y
 CONFIG_MSM_RPM_LOG=y
 CONFIG_MSM_RPM_STATS_LOG=y
diff --git a/arch/arm/configs/msm8660_defconfig b/arch/arm/configs/msm8660_defconfig
index 758608b..705021a 100644
--- a/arch/arm/configs/msm8660_defconfig
+++ b/arch/arm/configs/msm8660_defconfig
@@ -53,7 +53,6 @@
 # CONFIG_MSM_RPCSERVER_HANDSET is not set
 CONFIG_MSM_RMT_STORAGE_CLIENT=y
 # CONFIG_MSM_HW3D is not set
-CONFIG_MSM_SECURE_PIL=y
 CONFIG_MSM_SUBSYSTEM_RESTART=y
 CONFIG_MSM_RPM_LOG=y
 CONFIG_MSM_RPM_STATS_LOG=y
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 8f6e59d..e04d6d1 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -1432,11 +1432,6 @@
 
 	  Say yes to support these devices.
 
-config MSM_SECURE_PIL
-	bool "Secure Peripheral image loading"
-	depends on MSM_PIL
-	default n
-
 config MSM_SCM
 	bool "Secure Channel Manager (SCM) support"
 	default n
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index db154de..931cb94 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -57,6 +57,7 @@
 obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
 obj-$(CONFIG_MSM_SECURE_IO) += scm-io.o
 obj-$(CONFIG_MSM_PIL) += peripheral-loader.o
+obj-$(CONFIG_MSM_PIL) += scm-pas.o
 ifdef CONFIG_MSM_PIL
 obj-$(CONFIG_ARCH_MSM8X60) += peripheral-reset.o
 obj-$(CONFIG_ARCH_MSM8960) += peripheral-reset-8960.o
diff --git a/arch/arm/mach-msm/peripheral-reset-8960.c b/arch/arm/mach-msm/peripheral-reset-8960.c
index ef73244..51cd204 100644
--- a/arch/arm/mach-msm/peripheral-reset-8960.c
+++ b/arch/arm/mach-msm/peripheral-reset-8960.c
@@ -25,6 +25,7 @@
 #include <mach/scm.h>
 
 #include "peripheral-loader.h"
+#include "scm-pas.h"
 
 #define MSM_FW_QDSP6SS_PHYS	0x08800000
 #define MSM_SW_QDSP6SS_PHYS	0x08900000
@@ -119,43 +120,6 @@
 #define PPSS_PROC_CLK_CTL		(MSM_CLK_CTL_BASE + 0x2588)
 #define PPSS_HCLK_CTL			(MSM_CLK_CTL_BASE + 0x2580)
 
-#define PAS_Q6		1
-#define PAS_DSPS	2
-#define PAS_MODEM_SW	4
-#define PAS_MODEM_FW	5
-#define PAS_RIVA	6
-
-#define PAS_INIT_IMAGE_CMD	1
-#define PAS_MEM_CMD		2
-#define PAS_AUTH_AND_RESET_CMD	5
-#define PAS_SHUTDOWN_CMD	6
-#define PAS_IS_SUPPORTED_CMD	7
-
-struct pas_init_image_req {
-	u32	proc;
-	u32	image_addr;
-};
-
-struct pas_init_image_resp {
-	u32	image_valid;
-};
-
-struct pas_auth_image_req {
-	u32	proc;
-};
-
-struct pas_auth_image_resp {
-	u32	reset_initiated;
-};
-
-struct pas_shutdown_req {
-	u32	proc;
-};
-
-struct pas_shutdown_resp {
-	u32	success;
-};
-
 struct q6_data {
 	const unsigned strap_tcm_base;
 	const unsigned strap_ahb_upper;
@@ -203,46 +167,22 @@
 static void __iomem *msm_riva_base;
 static unsigned long riva_start;
 
-static int init_image_trusted(int id, const u8 *metadata, size_t size)
-{
-	int ret;
-	struct pas_init_image_req request;
-	struct pas_init_image_resp resp = {0};
-	void *mdata_buf;
-
-	/* Make memory physically contiguous */
-	mdata_buf = kmemdup(metadata, size, GFP_KERNEL);
-	if (!mdata_buf)
-		return -ENOMEM;
-
-	request.proc = id;
-	request.image_addr = virt_to_phys(mdata_buf);
-
-	ret = scm_call(SCM_SVC_PIL, PAS_INIT_IMAGE_CMD, &request,
-			sizeof(request), &resp, sizeof(resp));
-	kfree(mdata_buf);
-
-	if (ret)
-		return ret;
-	return resp.image_valid;
-}
-
 static int init_image_lpass_q6_trusted(struct pil_device *pil,
 				       const u8 *metadata, size_t size)
 {
-	return init_image_trusted(PAS_Q6, metadata, size);
+	return pas_init_image(PAS_Q6, metadata, size);
 }
 
 static int init_image_modem_fw_q6_trusted(struct pil_device *pil,
 					  const u8 *metadata, size_t size)
 {
-	return init_image_trusted(PAS_MODEM_FW, metadata, size);
+	return pas_init_image(PAS_MODEM_FW, metadata, size);
 }
 
 static int init_image_modem_sw_q6_trusted(struct pil_device *pil,
 					  const u8 *metadata, size_t size)
 {
-	return init_image_trusted(PAS_MODEM_SW, metadata, size);
+	return pas_init_image(PAS_MODEM_SW, metadata, size);
 }
 
 static int init_image_lpass_q6_untrusted(struct pil_device *pil,
@@ -274,21 +214,6 @@
 	return 0;
 }
 
-static int auth_and_reset_trusted(int id)
-{
-	int ret;
-	struct pas_auth_image_req request;
-	struct pas_auth_image_resp resp = {0};
-
-	request.proc = id;
-	ret = scm_call(SCM_SVC_PIL, PAS_AUTH_AND_RESET_CMD, &request,
-			sizeof(request), &resp, sizeof(resp));
-	if (ret)
-		return ret;
-
-	return resp.reset_initiated;
-}
-
 static int power_up_q6(struct q6_data *q6)
 {
 	int err;
@@ -317,7 +242,7 @@
 	int err = power_up_q6(q6);
 	if (err)
 		return err;
-	return auth_and_reset_trusted(id);
+	return pas_auth_and_reset(id);
 }
 
 static int reset_lpass_q6_trusted(struct pil_device *pil)
@@ -454,26 +379,11 @@
 	return reset_q6_untrusted(&q6_modem_sw);
 }
 
-static int shutdown_trusted(int id)
-{
-	int ret;
-	struct pas_shutdown_req request;
-	struct pas_shutdown_resp resp = {0};
-
-	request.proc = id;
-	ret = scm_call(SCM_SVC_PIL, PAS_SHUTDOWN_CMD, &request, sizeof(request),
-			&resp, sizeof(resp));
-	if (ret)
-		return ret;
-
-	return resp.success;
-}
-
 static int shutdown_q6_trusted(int id, struct q6_data *q6)
 {
 	int ret;
 
-	ret = shutdown_trusted(id);
+	ret = pas_shutdown(id);
 	if (ret)
 		return ret;
 
@@ -655,17 +565,17 @@
 static int init_image_riva_trusted(struct pil_device *pil, const u8 *metadata,
 				   size_t size)
 {
-	return init_image_trusted(PAS_RIVA, metadata, size);
+	return pas_init_image(PAS_RIVA, metadata, size);
 }
 
 static int reset_riva_trusted(struct pil_device *pil)
 {
-	return auth_and_reset_trusted(PAS_RIVA);
+	return pas_auth_and_reset(PAS_RIVA);
 }
 
 static int shutdown_riva_trusted(struct pil_device *pil)
 {
-	return shutdown_trusted(PAS_RIVA);
+	return pas_shutdown(PAS_RIVA);
 }
 
 static int init_image_dsps_untrusted(struct pil_device *pil, const u8 *metadata,
@@ -695,17 +605,17 @@
 static int init_image_dsps_trusted(struct pil_device *pil, const u8 *metadata,
 				   size_t size)
 {
-	return init_image_trusted(PAS_DSPS, metadata, size);
+	return pas_init_image(PAS_DSPS, metadata, size);
 }
 
 static int reset_dsps_trusted(struct pil_device *pil)
 {
-	return auth_and_reset_trusted(PAS_DSPS);
+	return pas_auth_and_reset(PAS_DSPS);
 }
 
 static int shutdown_dsps_trusted(struct pil_device *pil)
 {
-	return shutdown_trusted(PAS_DSPS);
+	return pas_shutdown(PAS_DSPS);
 }
 
 static struct pil_reset_ops pil_modem_fw_q6_ops = {
@@ -814,59 +724,41 @@
 	return err;
 }
 
-static int __init can_secure_boot(int id)
-{
-	int ret;
-	u32 periph = id;
-	u32 ret_val = 0;
-
-	ret = scm_call(SCM_SVC_PIL, PAS_IS_SUPPORTED_CMD, &periph,
-			sizeof(periph), &ret_val, sizeof(ret_val));
-	if (ret)
-		return ret;
-
-	return ret_val;
-}
-
-static bool secure_pil = true;
-
 static void __init use_secure_pil(void)
 {
 
-	if (scm_is_call_available(SCM_SVC_PIL, PAS_IS_SUPPORTED_CMD) <= 0)
-		return;
-
-	if (can_secure_boot(PAS_Q6) > 0) {
+	if (pas_supported(PAS_Q6) > 0) {
 		pil_lpass_q6_ops.init_image = init_image_lpass_q6_trusted;
 		pil_lpass_q6_ops.auth_and_reset = reset_lpass_q6_trusted;
 		pil_lpass_q6_ops.shutdown = shutdown_lpass_q6_trusted;
 	}
 
-	if (can_secure_boot(PAS_MODEM_FW) > 0) {
+	if (pas_supported(PAS_MODEM_FW) > 0) {
 		pil_modem_fw_q6_ops.init_image = init_image_modem_fw_q6_trusted;
 		pil_modem_fw_q6_ops.auth_and_reset = reset_modem_fw_q6_trusted;
 		pil_modem_fw_q6_ops.shutdown = shutdown_modem_fw_q6_trusted;
 	}
 
-	if (can_secure_boot(PAS_MODEM_SW) > 0) {
+	if (pas_supported(PAS_MODEM_SW) > 0) {
 		pil_modem_sw_q6_ops.init_image = init_image_modem_sw_q6_trusted;
 		pil_modem_sw_q6_ops.auth_and_reset = reset_modem_sw_q6_trusted;
 		pil_modem_sw_q6_ops.shutdown = shutdown_modem_sw_q6_trusted;
 	}
 
-	if (can_secure_boot(PAS_DSPS) > 0) {
+	if (pas_supported(PAS_DSPS) > 0) {
 		pil_dsps_ops.init_image = init_image_dsps_trusted;
 		pil_dsps_ops.auth_and_reset = reset_dsps_trusted;
 		pil_dsps_ops.shutdown = shutdown_dsps_trusted;
 	}
 
-	if (can_secure_boot(PAS_RIVA) > 0) {
+	if (pas_supported(PAS_RIVA) > 0) {
 		pil_riva_ops.init_image = init_image_riva_trusted;
 		pil_riva_ops.auth_and_reset = reset_riva_trusted;
 		pil_riva_ops.shutdown = shutdown_riva_trusted;
 	}
 }
 
+
 static int __init msm_peripheral_reset_init(void)
 {
 	int err;
@@ -878,8 +770,7 @@
 	if (machine_is_msm8960_sim() || machine_is_msm8960_rumi3())
 		return 0;
 
-	if (secure_pil)
-		use_secure_pil();
+	use_secure_pil();
 
 	err = q6_reset_init(&q6_lpass);
 	if (err)
@@ -912,5 +803,3 @@
 	return 0;
 }
 arch_initcall(msm_peripheral_reset_init);
-module_param(secure_pil, bool, S_IRUGO);
-MODULE_PARM_DESC(secure_pil, "Use Secure PIL");
diff --git a/arch/arm/mach-msm/peripheral-reset.c b/arch/arm/mach-msm/peripheral-reset.c
index 7089772..d19f1b2 100644
--- a/arch/arm/mach-msm/peripheral-reset.c
+++ b/arch/arm/mach-msm/peripheral-reset.c
@@ -26,6 +26,7 @@
 #include <mach/msm_xo.h>
 
 #include "peripheral-loader.h"
+#include "scm-pas.h"
 
 #define PROXY_VOTE_TIMEOUT		10000
 
@@ -63,73 +64,14 @@
 #define PPSS_PROC_CLK_CTL		(MSM_CLK_CTL_BASE + 0x2588)
 #define CLK_HALT_DFAB_STATE		(MSM_CLK_CTL_BASE + 0x2FC8)
 
-#define PAS_MODEM	0
-#define PAS_Q6		1
-#define PAS_DSPS	2
-#define PAS_PLAYREADY	3
-
-#define PAS_INIT_IMAGE_CMD	1
-#define PAS_MEM_CMD		2
-#define PAS_AUTH_AND_RESET_CMD	5
-#define PAS_SHUTDOWN_CMD	6
-
-struct pas_init_image_req {
-	u32	proc;
-	u32	image_addr;
-};
-
-struct pas_init_image_resp {
-	u32	image_valid;
-};
-
-struct pas_auth_image_req {
-	u32	proc;
-};
-
-struct pas_auth_image_resp {
-	u32	reset_initiated;
-};
-
-struct pas_shutdown_req {
-	u32	proc;
-};
-
-struct pas_shutdown_resp {
-	u32	success;
-};
-
 static int modem_start, q6_start, dsps_start;
 static void __iomem *msm_mms_regs_base;
 static void __iomem *msm_lpass_qdsp6ss_base;
 
-static int init_image_trusted(int id, const u8 *metadata, size_t size)
-{
-	int ret;
-	struct pas_init_image_req request;
-	struct pas_init_image_resp resp = {0};
-	void *mdata_buf;
-
-	/* Make memory physically contiguous */
-	mdata_buf = kmemdup(metadata, size, GFP_KERNEL);
-	if (!mdata_buf)
-		return -ENOMEM;
-
-	request.proc = id;
-	request.image_addr = virt_to_phys(mdata_buf);
-
-	ret = scm_call(SCM_SVC_PIL, PAS_INIT_IMAGE_CMD, &request,
-			sizeof(request), &resp, sizeof(resp));
-	kfree(mdata_buf);
-
-	if (ret)
-		return ret;
-	return resp.image_valid;
-}
-
 static int init_image_modem_trusted(struct pil_device *pil, const u8 *metadata,
 				    size_t size)
 {
-	return init_image_trusted(PAS_MODEM, metadata, size);
+	return pas_init_image(PAS_MODEM, metadata, size);
 }
 
 static int init_image_modem_untrusted(struct pil_device *pil,
@@ -143,7 +85,7 @@
 static int init_image_q6_trusted(struct pil_device *pil,
 				 const u8 *metadata, size_t size)
 {
-	return init_image_trusted(PAS_Q6, metadata, size);
+	return pas_init_image(PAS_Q6, metadata, size);
 }
 
 static int init_image_q6_untrusted(struct pil_device *pil, const u8 *metadata,
@@ -157,7 +99,7 @@
 static int init_image_dsps_trusted(struct pil_device *pil, const u8 *metadata,
 				   size_t size)
 {
-	return init_image_trusted(PAS_DSPS, metadata, size);
+	return pas_init_image(PAS_DSPS, metadata, size);
 }
 
 static int init_image_dsps_untrusted(struct pil_device *pil, const u8 *metadata,
@@ -176,21 +118,6 @@
 	return 0;
 }
 
-static int auth_and_reset_trusted(int id)
-{
-	int ret;
-	struct pas_auth_image_req request;
-	struct pas_auth_image_resp resp = {0};
-
-	request.proc = id;
-	ret = scm_call(SCM_SVC_PIL, PAS_AUTH_AND_RESET_CMD, &request,
-			sizeof(request), &resp, sizeof(resp));
-	if (ret)
-		return ret;
-
-	return resp.reset_initiated;
-}
-
 static struct msm_xo_voter *pxo;
 static void remove_modem_proxy_votes(unsigned long data)
 {
@@ -300,28 +227,13 @@
 
 	make_modem_proxy_votes();
 
-	ret = auth_and_reset_trusted(PAS_MODEM);
+	ret = pas_auth_and_reset(PAS_MODEM);
 	if (ret)
 		remove_modem_proxy_votes_now();
 
 	return ret;
 }
 
-static int shutdown_trusted(int id)
-{
-	int ret;
-	struct pas_shutdown_req request;
-	struct pas_shutdown_resp resp = {0};
-
-	request.proc = id;
-	ret = scm_call(SCM_SVC_PIL, PAS_SHUTDOWN_CMD, &request, sizeof(request),
-			&resp, sizeof(resp));
-	if (ret)
-		return ret;
-
-	return resp.success;
-}
-
 static int shutdown_modem_untrusted(struct pil_device *pil)
 {
 	u32 reg;
@@ -367,7 +279,7 @@
 {
 	int ret;
 
-	ret = shutdown_trusted(PAS_MODEM);
+	ret = pas_shutdown(PAS_MODEM);
 	if (ret)
 		return ret;
 
@@ -481,7 +393,7 @@
 {
 	make_q6_proxy_votes();
 
-	return auth_and_reset_trusted(PAS_Q6);
+	return pas_auth_and_reset(PAS_Q6);
 }
 
 static int shutdown_q6_untrusted(struct pil_device *pil)
@@ -515,7 +427,7 @@
 {
 	int ret;
 
-	ret = shutdown_trusted(PAS_Q6);
+	ret = pas_shutdown(PAS_Q6);
 	if (ret)
 		return ret;
 
@@ -537,12 +449,12 @@
 
 static int reset_dsps_trusted(struct pil_device *pil)
 {
-	return auth_and_reset_trusted(PAS_DSPS);
+	return pas_auth_and_reset(PAS_DSPS);
 }
 
 static int shutdown_dsps_trusted(struct pil_device *pil)
 {
-	return shutdown_trusted(PAS_DSPS);
+	return pas_shutdown(PAS_DSPS);
 }
 
 static int shutdown_dsps_untrusted(struct pil_device *pil)
@@ -555,17 +467,17 @@
 static int init_image_playready(struct pil_device *pil, const u8 *metadata,
 		size_t size)
 {
-	return init_image_trusted(PAS_PLAYREADY, metadata, size);
+	return pas_init_image(PAS_PLAYREADY, metadata, size);
 }
 
 static int reset_playready(struct pil_device *pil)
 {
-	return auth_and_reset_trusted(PAS_PLAYREADY);
+	return pas_auth_and_reset(PAS_PLAYREADY);
 }
 
 static int shutdown_playready(struct pil_device *pil)
 {
-	return shutdown_trusted(PAS_PLAYREADY);
+	return pas_shutdown(PAS_PLAYREADY);
 }
 
 struct pil_reset_ops pil_modem_ops = {
@@ -633,12 +545,6 @@
 	.ops = &pil_dsps_ops,
 };
 
-#ifdef CONFIG_MSM_SECURE_PIL
-#define SECURE_PIL 1
-#else
-#define SECURE_PIL 0
-#endif
-
 static int __init msm_peripheral_reset_init(void)
 {
 	unsigned i;
@@ -659,15 +565,19 @@
 	if (IS_ERR(pll4))
 		goto err_clk;
 
-	if (SECURE_PIL) {
+	if (pas_supported(PAS_MODEM) > 0) {
 		pil_modem_ops.init_image = init_image_modem_trusted;
 		pil_modem_ops.auth_and_reset = reset_modem_trusted;
 		pil_modem_ops.shutdown = shutdown_modem_trusted;
+	}
 
+	if (pas_supported(PAS_Q6) > 0) {
 		pil_q6_ops.init_image = init_image_q6_trusted;
 		pil_q6_ops.auth_and_reset = reset_q6_trusted;
 		pil_q6_ops.shutdown = shutdown_q6_trusted;
+	}
 
+	if (pas_supported(PAS_DSPS) > 0) {
 		pil_dsps_ops.init_image = init_image_dsps_trusted;
 		pil_dsps_ops.auth_and_reset = reset_dsps_trusted;
 		pil_dsps_ops.shutdown = shutdown_dsps_trusted;
diff --git a/arch/arm/mach-msm/scm-pas.c b/arch/arm/mach-msm/scm-pas.c
new file mode 100644
index 0000000..5bbffd3
--- /dev/null
+++ b/arch/arm/mach-msm/scm-pas.c
@@ -0,0 +1,110 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. 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.
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+
+#include <mach/scm.h>
+#include <mach/socinfo.h>
+#include "scm-pas.h"
+
+#define PAS_INIT_IMAGE_CMD	1
+#define PAS_AUTH_AND_RESET_CMD	5
+#define PAS_SHUTDOWN_CMD	6
+#define PAS_IS_SUPPORTED_CMD	7
+
+int pas_init_image(enum pas_id id, const u8 *metadata, size_t size)
+{
+	int ret;
+	struct pas_init_image_req {
+		u32	proc;
+		u32	image_addr;
+	} request;
+	u32 scm_ret = 0;
+	/* Make memory physically contiguous */
+	void *mdata_buf = kmemdup(metadata, size, GFP_KERNEL);
+
+	if (!mdata_buf)
+		return -ENOMEM;
+
+	request.proc = id;
+	request.image_addr = virt_to_phys(mdata_buf);
+
+	ret = scm_call(SCM_SVC_PIL, PAS_INIT_IMAGE_CMD, &request,
+			sizeof(request), &scm_ret, sizeof(scm_ret));
+	kfree(mdata_buf);
+
+	if (ret)
+		return ret;
+	return scm_ret;
+}
+EXPORT_SYMBOL(pas_init_image);
+
+int pas_auth_and_reset(enum pas_id id)
+{
+	int ret;
+	u32 proc = id, scm_ret = 0;
+
+	ret = scm_call(SCM_SVC_PIL, PAS_AUTH_AND_RESET_CMD, &proc,
+			sizeof(proc), &scm_ret, sizeof(scm_ret));
+	if (ret)
+		return ret;
+
+	return scm_ret;
+}
+EXPORT_SYMBOL(pas_auth_and_reset);
+
+int pas_shutdown(enum pas_id id)
+{
+	int ret;
+	u32 proc = id, scm_ret = 0;
+
+	ret = scm_call(SCM_SVC_PIL, PAS_SHUTDOWN_CMD, &proc, sizeof(proc),
+			&scm_ret, sizeof(scm_ret));
+	if (ret)
+		return ret;
+
+	return scm_ret;
+}
+EXPORT_SYMBOL(pas_shutdown);
+
+static bool secure_pil = true;
+module_param(secure_pil, bool, S_IRUGO);
+MODULE_PARM_DESC(secure_pil, "Use secure PIL");
+
+int pas_supported(enum pas_id id)
+{
+	int ret;
+	u32 periph = id, ret_val = 0;
+
+	if (!secure_pil)
+		return 0;
+
+	/*
+	 * 8660 SCM doesn't support querying secure PIL support so just return
+	 * true if not overridden on the command line.
+	 */
+	if (cpu_is_msm8x60())
+		return 1;
+
+	if (scm_is_call_available(SCM_SVC_PIL, PAS_IS_SUPPORTED_CMD) <= 0)
+		return 0;
+
+	ret = scm_call(SCM_SVC_PIL, PAS_IS_SUPPORTED_CMD, &periph,
+			sizeof(periph), &ret_val, sizeof(ret_val));
+	if (ret)
+		return ret;
+
+	return ret_val;
+}
+EXPORT_SYMBOL(pas_supported);
diff --git a/arch/arm/mach-msm/scm-pas.h b/arch/arm/mach-msm/scm-pas.h
new file mode 100644
index 0000000..3442098
--- /dev/null
+++ b/arch/arm/mach-msm/scm-pas.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. 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.
+ */
+#ifndef __MSM_SCM_PAS_H
+#define __MSM_SCM_PAS_H
+
+enum pas_id {
+	PAS_MODEM,
+	PAS_Q6,
+	PAS_DSPS,
+	PAS_PLAYREADY,
+	PAS_MODEM_SW,
+	PAS_MODEM_FW,
+	PAS_RIVA,
+};
+
+extern int pas_init_image(enum pas_id id, const u8 *metadata, size_t size);
+extern int pas_auth_and_reset(enum pas_id id);
+extern int pas_shutdown(enum pas_id id);
+extern int pas_supported(enum pas_id id);
+#endif