msm: pil-gss: Implement Secure PIL support
Use scm-pas to detect if Secure PIL is required and, if it is, call
scm-pas APIs to boot and shutdown the GSS processor instead of
handling these procedures in the Linux kernel.
Change-Id: Ia49c2e0ce8b31ba420d2951014c8a558a3b53164
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/pil-gss.c b/arch/arm/mach-msm/pil-gss.c
index f3e83d9..6ec9b5d 100644
--- a/arch/arm/mach-msm/pil-gss.c
+++ b/arch/arm/mach-msm/pil-gss.c
@@ -257,6 +257,49 @@
.shutdown = pil_gss_shutdown,
};
+static int pil_gss_init_image_trusted(struct pil_desc *pil,
+ const u8 *metadata, size_t size)
+{
+ return pas_init_image(PAS_GSS, metadata, size);
+}
+
+static int pil_gss_reset_trusted(struct pil_desc *pil)
+{
+ struct gss_data *drv = dev_get_drvdata(pil->dev);
+ int err;
+
+ err = make_gss_proxy_votes(pil->dev);
+ if (err)
+ return err;
+
+ err = pas_auth_and_reset(PAS_GSS);
+ if (err)
+ remove_gss_proxy_votes_now(drv);
+
+ return err;
+}
+
+static int pil_gss_shutdown_trusted(struct pil_desc *pil)
+{
+ struct gss_data *drv = dev_get_drvdata(pil->dev);
+ int ret;
+
+ ret = pas_shutdown(PAS_GSS);
+ if (ret)
+ return ret;
+
+ remove_gss_proxy_votes_now(drv);
+
+ return ret;
+}
+
+static struct pil_reset_ops pil_gss_ops_trusted = {
+ .init_image = pil_gss_init_image_trusted,
+ .verify_blob = nop_verify_blob,
+ .auth_and_reset = pil_gss_reset_trusted,
+ .shutdown = pil_gss_shutdown_trusted,
+};
+
static void configure_gss_pll(struct gss_data *drv)
{
u32 regval, is_pll_enabled;
@@ -354,8 +397,13 @@
desc->name = "gss";
desc->dev = &pdev->dev;
- desc->ops = &pil_gss_ops;
- dev_info(&pdev->dev, "using non-secure boot\n");
+ if (pas_supported(PAS_GSS) > 0) {
+ desc->ops = &pil_gss_ops_trusted;
+ dev_info(&pdev->dev, "using secure boot\n");
+ } else {
+ desc->ops = &pil_gss_ops;
+ dev_info(&pdev->dev, "using non-secure boot\n");
+ }
INIT_DELAYED_WORK(&drv->work, remove_gss_proxy_votes);
diff --git a/arch/arm/mach-msm/scm-pas.h b/arch/arm/mach-msm/scm-pas.h
index 67a0992..3651ee1 100644
--- a/arch/arm/mach-msm/scm-pas.h
+++ b/arch/arm/mach-msm/scm-pas.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2010-2012, 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
@@ -20,6 +20,8 @@
PAS_MODEM_SW,
PAS_MODEM_FW,
PAS_RIVA,
+ PAS_SECAPP,
+ PAS_GSS,
};
extern int pas_init_image(enum pas_id id, const u8 *metadata, size_t size);