]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm64: zynqmp: Add command for disabling loading other overlays
authorMichal Simek <michal.simek@xilinx.com>
Tue, 16 Nov 2021 14:18:23 +0000 (15:18 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 6 Dec 2021 12:32:48 +0000 (13:32 +0100)
Add command "zynqmp pmufw node close" to disable permission to load
additional pmufw config overlays. This command will make sure that any
other sw will ask for changing permission.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/cmds.c
drivers/firmware/firmware-zynqmp.c
include/zynqmp_firmware.h

index 5a277c712f6061512e2c21e5df1e755c303ec77e..2ab9596248c04d71388396b02cf93e5da50da696 100644 (file)
@@ -209,6 +209,19 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,
        if (argc != cmdtp->maxargs)
                return CMD_RET_USAGE;
 
+       if (!strncmp(argv[2], "node", 4)) {
+               u32 id;
+
+               if (!strncmp(argv[3], "close", 5))
+                       return zynqmp_pmufw_config_close();
+
+               id = dectoul(argv[3], NULL);
+
+               printf("Enable permission for node ID %d\n", id);
+
+               return zynqmp_pmufw_node(id);
+       }
+
        addr = hextoul(argv[2], NULL);
        size = hextoul(argv[3], NULL);
 
@@ -416,6 +429,9 @@ static char zynqmp_help_text[] =
        "                      lock(0)/split(1)\n"
 #endif
        "zynqmp pmufw address size - load PMU FW configuration object\n"
+       "zynqmp pmufw node <id> - load PMU FW configuration object\n"
+       "zynqmp pmufw node close - disable config object loading\n"
+       "       node: keyword, id: NODE_ID in decimal format\n"
        "zynqmp rsa srcaddr srclen mod exp rsaop -\n"
        "       Performs RSA encryption and RSA decryption on blob of data\n"
        "       at srcaddr and puts it back in srcaddr using modulus and\n"
index 53c0ae8d70caeff6ab804e343b51383f1af1730a..a01f5ff71b954c2885d55cc65edd339d6078ccb4 100644 (file)
@@ -47,6 +47,25 @@ static unsigned int xpm_configobject[] = {
        PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK, /* IPI Mask */
 };
 
+static unsigned int xpm_configobject_close[] = {
+       /**********************************************************************/
+       /* HEADER */
+       2,      /* Number of remaining words in the header */
+       1,      /* Number of sections included in config object */
+       PM_CONFIG_OBJECT_TYPE_OVERLAY,  /* Type of Config object as overlay */
+       /**********************************************************************/
+       /* SET CONFIG SECTION */
+       PM_CONFIG_SET_CONFIG_SECTION_ID,
+       0U,     /* Loading permission to Overlay config object */
+};
+
+int zynqmp_pmufw_config_close(void)
+{
+       zynqmp_pmufw_load_config_object(xpm_configobject_close,
+                                       sizeof(xpm_configobject_close));
+       return 0;
+}
+
 int zynqmp_pmufw_node(u32 id)
 {
        /* Record power domain id */
index f005dca887c61a6430b429f675d456aceec3db51..6d246019c4b8b5bf4297ba4c0dc61f43069e0575 100644 (file)
@@ -428,6 +428,7 @@ enum zynqmp_pm_request_ack {
 
 unsigned int zynqmp_firmware_version(void);
 int zynqmp_pmufw_node(u32 id);
+int zynqmp_pmufw_config_close(void);
 void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size);
 int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2,
                      u32 arg3, u32 *ret_payload);