platform: msm: Add LK support for two SCM calls
Add LK side implementation of two already available SCM calls in TZ:
1) INFO_GET_SECURE_STATE - To return whether the device is in test mode.
2) QFPROM_READ_ROW_ID - To read an eFuse.
Change-Id: Ic66f3c437e89b6a190cbe3f0694c96c729f075dc
diff --git a/platform/msm_shared/include/scm.h b/platform/msm_shared/include/scm.h
index 6f92ee9..025a038 100644
--- a/platform/msm_shared/include/scm.h
+++ b/platform/msm_shared/include/scm.h
@@ -123,6 +123,23 @@
} feature_version_rsp;
typedef struct{
+ uint32 *status_ptr;
+ uint32 status_len;
+} get_secure_state_req;
+
+typedef struct{
+ uint32 status_low;
+ uint32 status_high;
+} get_secure_state_rsp;
+
+typedef struct{
+ uint32 row_address;
+ uint32 addr_type;
+ uint32 *row_data;
+ uint32 *qfprom_api_status;
+} qfprom_read_row_req;
+
+typedef struct{
uint32 *keystore_ptr;
uint32 keystore_len;
} ssd_protect_keystore_req;
@@ -235,6 +252,7 @@
#define IOMMU_SECURE_CFG 0x02
#define TZ_INFO_GET_FEATURE_ID 0x03
+#define TZ_INFO_GET_SECURE_STATE 0x04
#define PRNG_CMD_ID 0x01
#define IS_CALL_AVAIL_CMD 0x01
@@ -280,11 +298,30 @@
int decrypt_scm_v2(uint32_t ** img_ptr, uint32_t * img_len_ptr);
int encrypt_scm(uint32_t ** img_ptr, uint32_t * img_len_ptr);
int scm_svc_version(uint32 * major, uint32 * minor);
+
+/**
+ * Check security status on the device. Returns the security check result.
+ * Bit value 0 means the check passing, and bit value 1 means the check failing.
+ *
+ * @state_low[out] : lower 32 bits of the state:
+ * Bit 0: secboot enabling check failed
+ * Bit 1: Sec HW key is not programmed
+ * Bit 2: debug disable check failed
+ * Bit 3: Anti-rollback check failed
+ * Bit 4: fuse config check failed
+ * Bit 5: rpmb fuse check failed
+ * @state_high[out] : highr 32 bits of the state.
+ *
+ * Returns 0 on success, negative on failure.
+ */
+int scm_svc_get_secure_state(uint32_t *state_low, uint32_t *state_high);
+
int scm_protect_keystore(uint32_t * img_ptr, uint32_t img_len);
#define SCM_SVC_FUSE 0x08
#define SCM_BLOW_SW_FUSE_ID 0x01
#define SCM_IS_SW_FUSE_BLOWN_ID 0x02
+#define SCM_QFPROM_READ_ROW_ID 0x05
#define HLOS_IMG_TAMPER_FUSE 0
@@ -332,6 +369,19 @@
void set_tamper_fuse_cmd();
+/**
+ * Reads the row data of the specified QFPROM row address.
+ *
+ * @row_address[in] : Row address in the QFPROM region to read.
+ * @addr_type[in] : Raw or corrected address.
+ * @row_data[in] : Pointer to the data to be read.
+ * @qfprom_api_status[out] : Status of the read operation.
+ *
+ * Returns Any errors while reading data from the specified
+ * Returns 0 on success, negative on failure.
+ */
+int qfprom_read_row_cmd(uint32_t row_address, uint32_t addr_type, uint32_t *row_data, uint32_t *qfprom_api_status);
+
int scm_halt_pmic_arbiter();
int scm_call_atomic2(uint32_t svc, uint32_t cmd, uint32_t arg1, uint32_t arg2);
int restore_secure_cfg(uint32_t id);