[FOSS_TLK]ote: tlk: Remove support for cmdline
Sharif Inamdar [Fri, 24 Apr 2015 05:50:56 +0000 (10:50 +0530)]
Previously we had to pass boot params as cmdline and
hence we had to parse the cmdline to get the params.
Since we have removed support for cmdline from bootloader,
making this change to remove support for cmdline from TLK.

Change-Id: Ie03dd2239678b3d80914ac750dc931b96ff7b4b9
Signed-off-by: Sharif Inamdar <isharif@nvidia.com>
Reviewed-on: http://git-master/r/752888
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>

include/kernel/boot_params.h
kernel/boot.c
platform/tegra/common/memory.c

index e1f5872..1a716d8 100644 (file)
 #define TLK_BOOT_PARAMS_MAX_STRING     1024
 #define EKS_MAXIMUM_CODE_SIZE          0x600
 
-
-typedef struct {
-       uint32_t        param_string_sz;
-       char            param_string[TLK_BOOT_PARAMS_MAX_STRING];       // our cmdline arguments
-} boot_params;
-
 typedef struct {
        uint32_t        encrypted_key_sz;
        char            encrypted_keys[EKS_MAXIMUM_CODE_SIZE];          // encrypted keys
index 88dcfec..83966d6 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <debug.h>
-#include <err.h>
 #include <kernel/boot_params.h>
 #include <platform/platform_p.h>
 #include <common/ote_nv_uuid.h>
@@ -62,102 +61,13 @@ static int getoffsetof(char *source, char c)
        return offset;
 }
 
-static int parse_cmdline(void)
-{
-       boot_params *boot_params_ptr = (boot_params*)__bootarg_addr;
-       char *str;
-       int cmdline_len, i;
-       struct cmdline_member members[] = {
-               {CMDLINE_OS_BOOT_ADDR, &normal_os_coldboot_fn},
-               {CMDLINE_DEVICE_UID0, &device_uid[0]},
-               {CMDLINE_DEVICE_UID1, &device_uid[1]},
-               {CMDLINE_DEVICE_UID2, &device_uid[2]},
-               {CMDLINE_DEVICE_UID3, &device_uid[3]},
-               {CMDLINE_DEBUG_UART_ID, &debug_uart_id},
-               {CMDLINE_TFKEY_ADDR, &tf_key_addr},
-               {CMDLINE_TFKEY_SIZE, &tf_key_size},
-               {CMDLINE_DTB_ADDR, &dtb_addr}
-       };
-
-       if (!boot_params_ptr ||
-           !boot_params_ptr->param_string[0])
-               return ERR_INVALID_ARGS;
-
-       /* Check whether parameters are passed as cmdline or structure */
-       cmdline_len = boot_params_ptr->param_string_sz;
-       if (cmdline_len == 0)
-               return ERR_NOT_SUPPORTED;
-
-       str = boot_params_ptr->param_string;
-       for (i = 0; i < cmdline_len; i++) {
-               if (*(str + i) == '\n') {
-                       *(str + i) = '\0';
-                       cmdline_len--;
-               }
-       }
-
-       str = boot_params_ptr->param_string;
-       while (cmdline_len > 0) {
-               if (*str == '[')
-                       goto done;
-
-               unsigned int offset = getoffsetof(str, ':');
-
-               if (strlen(str) < offset)
-                       goto done;
-
-               *(str + offset) = '\0';
-               cmdline_len -= (strlen(str) + 1);
-
-               for (i = 0; i < ARRAY_SIZE(members); i++) {
-                       if (!strncmp(str, (const char *)&members[i].name, strlen(members[i].name))) {
-                               str += strlen(str) + 2;
-                               *members[i].container = atoi(str);
-                               cmdline_len--;
-                               break;
-                       } else if (!strncmp(str, CMDLINE_DRAM_RANGE, strlen(CMDLINE_DRAM_RANGE))) {
-                               paddr_t base, size;
-
-                               /* format is "mem: <size>M@<base>M" in MBbytes */
-                               str += strlen(str) + 2;
-                               size = (paddr_t) atoui(str);
-                               base = (paddr_t) atoui(strchr(str, '@') + 1);
-                               cmdline_len--;
-
-                               tz_add_dram_range(base << 20, size << 20);
-                               break;
-                       } else if (!strncmp(str, CMDLINE_TSEC_CARVEOUT, strlen(CMDLINE_TSEC_CARVEOUT))) {
-
-                               /* format is "tsec: <size>M@<base>M" in MBbytes */
-                               str += strlen(str) + 2;
-                               tsec_carveout_size = (paddr_t) atoui(str);
-                               tsec_carveout_base = (paddr_t) atoui(strchr(str, '@') + 1);
-                               tsec_carveout_size <<= 20;
-                               tsec_carveout_base <<= 20;
-                               cmdline_len--;
-                               break;
-                       }
-               }
-
-               if (i == ARRAY_SIZE(members)) {
-                       str += strlen(str) + 2;
-                       cmdline_len--;
-               }
-
-done:
-               cmdline_len -= strlen(str);
-               str += strlen(str) + 1;
-       }
-       return NO_ERROR;
-}
-
-static int parse_bootargs(void)
+void get_boot_params(void)
 {
-       boot_params_t *boot_params_ptr = (boot_params*)__bootarg_addr;
+       boot_params_t *boot_params_ptr = (boot_params_t*)__bootarg_addr;
        uint64_t base, size;
 
-       if (!boot_params_ptr || boot_params_ptr->version != 0)
-               return ERR_INVALID_ARGS;
+       if (!boot_params_ptr)
+               return;
 
        device_uid[0] = boot_params_ptr->chip_uid[0];
        device_uid[1] = boot_params_ptr->chip_uid[1];
@@ -185,16 +95,6 @@ static int parse_bootargs(void)
        tsec_carveout_size <<= 20;
        tsec_carveout_base <<= 20;
 
-       return NO_ERROR;
-}
-
-void get_boot_params(void)
-{
-       int32_t err = NO_ERROR;
-
-       err = parse_cmdline();
-       if (err)
-               err = parse_bootargs();
 }
 
 int get_boot_args(task_t *task, uint32_t *argv)
index 03c368e..2eca740 100644 (file)
 
 __WEAK void platform_setup_keys(void)
 {
-       boot_params *boot_params_ptr;
        boot_params_t *boot_params_ptr_args;
        key_params *keys_ptr;
-       int cmdline_len;
        uint32_t reg, offset;
        extern uint32_t __bootarg_addr;
 
        /* keys immediately follow the boot params in DRAM */
-       boot_params_ptr = (boot_params *) __bootarg_addr;
-
-       cmdline_len = boot_params_ptr->param_string_sz;
-
-       /* Check whether parameters are passed as cmdline or structure */
-       if (cmdline_len == 0) {
-               boot_params_ptr_args = (boot_params_t *) __bootarg_addr;
-               offset = sizeof(boot_params_t);
-               keys_ptr = (key_params *)((uintptr_t)boot_params_ptr_args + offset);
-       } else {
-               offset = ROUNDUP(boot_params_ptr->param_string_sz, sizeof(uint32_t));
-               keys_ptr = (key_params *)((uintptr_t)boot_params_ptr->param_string + offset);
-       }
+       boot_params_ptr_args = (boot_params_t *) __bootarg_addr;
+       offset = sizeof(boot_params_t);
+       keys_ptr = (key_params *)((uintptr_t)boot_params_ptr_args + offset);
 
        /* ensure TZRAM clock is enabled */
        reg  = readl(TEGRA_CLK_RESET_BASE + CLK_OUT_ENB_V);