aboutsummaryrefslogtreecommitdiff
path: root/plat/socionext/synquacer/drivers
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2018-06-15 15:25:42 +0530
committerSumit Garg <sumit.garg@linaro.org>2018-06-21 11:32:34 +0530
commitcfe19f85c9f0e8634e841e584c3b8772cdd5a41e (patch)
tree1b8e9f8d9920981b690fa64b1a290de550d09f88 /plat/socionext/synquacer/drivers
parentb7ad04449316e114c07f4b62163293fb50fefaa8 (diff)
downloadtrusted-firmware-a-cfe19f85c9f0e8634e841e584c3b8772cdd5a41e.tar.gz
synquacer: Retrieve DRAM info from SCP firmware
Retrieve DRAM info from SCP firmware using SCPI driver. Board supports multiple DRAM slots so its required to fetch DRAM info from SCP firmware and pass this info to UEFI via non-secure SRAM. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Diffstat (limited to 'plat/socionext/synquacer/drivers')
-rw-r--r--plat/socionext/synquacer/drivers/scpi/sq_scpi.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/plat/socionext/synquacer/drivers/scpi/sq_scpi.c b/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
index a6924e2e28..170b7e1846 100644
--- a/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
+++ b/plat/socionext/synquacer/drivers/scpi/sq_scpi.c
@@ -168,3 +168,49 @@ uint32_t scpi_sys_power_state(scpi_system_state_t system_state)
return response.status;
}
+
+uint32_t scpi_get_draminfo(struct draminfo *info)
+{
+ scpi_cmd_t *cmd;
+ struct {
+ scpi_cmd_t cmd;
+ struct draminfo info;
+ } response;
+ uint32_t mhu_status;
+
+ scpi_secure_message_start();
+
+ /* Populate the command header */
+ cmd = SCPI_CMD_HEADER_AP_TO_SCP;
+ cmd->id = SCPI_CMD_GET_DRAMINFO;
+ cmd->set = SCPI_SET_EXTENDED;
+ cmd->sender = 0;
+ cmd->size = 0;
+
+ scpi_secure_message_send(0);
+
+ mhu_status = mhu_secure_message_wait();
+
+ /* Expect an SCPI message, reject any other protocol */
+ if (mhu_status != (1 << SCPI_MHU_SLOT_ID)) {
+ ERROR("MHU: Unexpected protocol (MHU status: 0x%x)\n",
+ mhu_status);
+ panic();
+ }
+
+ /*
+ * Ensure that any read to the SCPI payload area is done after reading
+ * the MHU register. If these 2 reads were reordered then the CPU would
+ * read invalid payload data
+ */
+ dmbld();
+
+ memcpy(&response, (void *)SCPI_SHARED_MEM_SCP_TO_AP, sizeof(response));
+
+ scpi_secure_message_end();
+
+ if (response.cmd.status == SCP_OK)
+ *info = response.info;
+
+ return response.cmd.status;
+}