From 9a2850e5fa2e1a96a4510e0bd62f8b660da08a0d Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Date: Tue, 4 Sep 2018 17:12:51 +0530 Subject: [PATCH] zynqmp: pm: Add IOCTL to set boot health status Since the MMIO read/write APIs are removed from Linux user space, Linux cannot directly write to the Global General Storage Register 4 any more to set healthy boot status. Create an IOCTL to allow Linux to set boot health status. Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Acked-by: Will Wong <willw@xilinx.com> --- plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c | 17 +++++++++++++++++ plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h | 2 ++ plat/xilinx/zynqmp/zynqmp_def.h | 4 ++++ 3 files changed, 23 insertions(+) diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c index 17918338d..6f60e47e6 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c @@ -505,6 +505,20 @@ static enum pm_ret_status pm_ioctl_ulpi_reset(void) return ret; } +/** + * pm_ioctl_set_boot_health_status() - Ioctl for setting healthy boot status + * + * This function sets healthy bit value to indicate boot health status + * to firmware. + * + * @return Returns status, either success or error+reason + */ +static enum pm_ret_status pm_ioctl_set_boot_health_status(unsigned int value) +{ + return pm_mmio_write(PM_BOOT_HEALTH_STATUS_REG, + PM_BOOT_HEALTH_STATUS_MASK, value); +} + /** * pm_api_ioctl() - PM IOCTL API for device control and configs * @node_id Node ID of the device @@ -577,6 +591,9 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid, case IOCTL_ULPI_RESET: ret = pm_ioctl_ulpi_reset(); break; + case IOCTL_SET_BOOT_HEALTH_STATUS: + ret = pm_ioctl_set_boot_health_status(arg1); + break; default: ret = PM_RET_ERROR_NOTSUPPORTED; break; diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h index bf17117f0..29cd96ef2 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h @@ -34,6 +34,8 @@ enum { IOCTL_READ_PGGS, /* IOCTL for ULPI reset */ IOCTL_ULPI_RESET, + /* Set healthy bit value */ + IOCTL_SET_BOOT_HEALTH_STATUS, }; //RPU operation mode diff --git a/plat/xilinx/zynqmp/zynqmp_def.h b/plat/xilinx/zynqmp/zynqmp_def.h index dd26c6c2c..bfd61976f 100644 --- a/plat/xilinx/zynqmp/zynqmp_def.h +++ b/plat/xilinx/zynqmp/zynqmp_def.h @@ -335,4 +335,8 @@ #define PGGS_BASEADDR (0xFFD80050U) #define PGGS_NUM_REGS U(4) +/* Warm restart boot health status register and mask */ +#define PM_BOOT_HEALTH_STATUS_REG (GGS_BASEADDR + U(0x10)) +#define PM_BOOT_HEALTH_STATUS_MASK U(0x01) + #endif /* __ZYNQMP_DEF_H__ */ -- GitLab