Skip to content
Snippets Groups Projects
image.c 30.2 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
    	*cmd_start = (ulong) & cmdline[0];
    	*cmd_end = *cmd_start + strlen(cmdline);
    
    	debug ("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
    
    
     * boot_get_kbd - allocate and initialize kernel copy of board info
    
     * @lmb: pointer to lmb handle, will be used for memory mgmt
    
     * @kbd: double pointer to board info data
    
     * @bootmap_base: ulong variable, holds offset in physical memory to
     * base of bootmap
    
     * boot_get_kbd() allocates space for kernel copy of board info data below
    
     * BOOTMAPSZ + bootmap_base address and kernel board info is initialized with
     * the current u-boot board info data.
    
     *      0 - success
     *     -1 - failure
    
    int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
    
    	*kbd = (bd_t *)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
    				      CFG_BOOTMAPSZ + bootmap_base);
    	if (*kbd == NULL)
    		return -1;
    
    
    	**kbd = *(gd->bd);
    
    	debug ("## kernel board info at 0x%08lx\n", (ulong)*kbd);
    
    #if defined(DEBUG) && defined(CONFIG_CMD_BDI)
    	do_bdinfo(NULL, 0, 0, NULL);
    #endif
    
    
    }
    #endif /* CONFIG_PPC || CONFIG_M68K */
    
    #if defined(CONFIG_FIT)
    /*****************************************************************************/
    /* New uImage format routines */
    /*****************************************************************************/
    static int fit_parse_spec (const char *spec, char sepc, ulong addr_curr,
    		ulong *addr, const char **name)
    {
    	const char *sep;
    
    	*addr = addr_curr;
    	*name = NULL;
    
    	sep = strchr (spec, sepc);
    	if (sep) {
    		if (sep - spec > 0)
    			*addr = simple_strtoul (spec, NULL, 16);
    
    		*name = sep + 1;
    		return 1;
    	}
    
    	return 0;
    }
    
    /**
     * fit_parse_conf - parse FIT configuration spec
     * @spec: input string, containing configuration spec
     * @add_curr: current image address (to be used as a possible default)
     * @addr: pointer to a ulong variable, will hold FIT image address of a given
     * configuration
     * @conf_name double pointer to a char, will hold pointer to a configuration
     * unit name
     *
     * fit_parse_conf() expects configuration spec in the for of [<addr>]#<conf>,
     * where <addr> is a FIT image address that contains configuration
     * with a <conf> unit name.
     *
     * Address part is optional, and if omitted default add_curr will
     * be used instead.
     *
     * returns:
     *     1 if spec is a valid configuration string,
     *     addr and conf_name are set accordingly
     *     0 otherwise
     */
    inline int fit_parse_conf (const char *spec, ulong addr_curr,
    		ulong *addr, const char **conf_name)
    {
    	return fit_parse_spec (spec, '#', addr_curr, addr, conf_name);
    }
    
    /**
     * fit_parse_subimage - parse FIT subimage spec
     * @spec: input string, containing subimage spec
     * @add_curr: current image address (to be used as a possible default)
     * @addr: pointer to a ulong variable, will hold FIT image address of a given
     * subimage
     * @image_name: double pointer to a char, will hold pointer to a subimage name
     *
     * fit_parse_subimage() expects subimage spec in the for of
     * [<addr>]:<subimage>, where <addr> is a FIT image address that contains
     * subimage with a <subimg> unit name.
     *
     * Address part is optional, and if omitted default add_curr will
     * be used instead.
     *
     * returns:
     *     1 if spec is a valid subimage string,
     *     addr and image_name are set accordingly
     *     0 otherwise
     */
    inline int fit_parse_subimage (const char *spec, ulong addr_curr,
    		ulong *addr, const char **image_name)
    {
    	return fit_parse_spec (spec, ':', addr_curr, addr, image_name);
    }