/** * fit_conf_print - prints out the FIT configuration details * @fit: pointer to the FIT format image header * @noffset: offset of the configuration node * @p: pointer to prefix string * * fit_conf_print() lists all mandatory properies for the processed * configuration node. * * returns: * no returned results */ void fit_conf_print(const void *fit, int noffset, const char *p) { char *desc; char *uname; int ret; int loadables_index; /* Mandatory properties */ ret = fit_get_desc(fit, noffset, &desc); printf("%s Description: ", p); if (ret) printf("unavailable\n"); else printf("%s\n", desc); uname = (char *)fdt_getprop(fit, noffset, FIT_KERNEL_PROP, NULL); printf("%s Kernel: ", p); if (uname == NULL) printf("unavailable\n"); else printf("%s\n", uname); /* Optional properties */ uname = (char *)fdt_getprop(fit, noffset, FIT_RAMDISK_PROP, NULL); if (uname) printf("%s Init Ramdisk: %s\n", p, uname); uname = (char *)fdt_getprop(fit, noffset, FIT_FDT_PROP, NULL); if (uname) printf("%s FDT: %s\n", p, uname); /* Print out all of the specified loadables */ for (loadables_index = 0; fdt_get_string_index(fit, noffset, FIT_LOADABLE_PROP, loadables_index, (const char **)&uname) == 0; loadables_index++) { if (loadables_index == 0) { printf("%s Loadables: ", p); } else { printf("%s ", p); } printf("%s\n", uname); } }
static int tegra_xusb_padctl_group_parse_dt(struct tegra_xusb_padctl *padctl, struct tegra_xusb_padctl_group *group, const void *fdt, int node) { unsigned int i; int len, err; group->name = fdt_get_name(fdt, node, &len); len = fdt_count_strings(fdt, node, "nvidia,lanes"); if (len < 0) { error("tegra-xusb-padctl: failed to parse \"nvidia,lanes\" property"); return -EINVAL; } group->num_pins = len; for (i = 0; i < group->num_pins; i++) { err = fdt_get_string_index(fdt, node, "nvidia,lanes", i, &group->pins[i]); if (err < 0) { error("tegra-xusb-padctl: failed to read string from \"nvidia,lanes\" property"); return -EINVAL; } } group->num_pins = len; err = fdt_get_string(fdt, node, "nvidia,function", &group->func); if (err < 0) { error("tegra-xusb-padctl: failed to parse \"nvidia,func\" property"); return -EINVAL; } group->iddq = fdtdec_get_int(fdt, node, "nvidia,iddq", -1); return 0; }
int fdt_get_string(const void *fdt, int node, const char *property, const char **output) { return fdt_get_string_index(fdt, node, property, 0, output); }
int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images, uint8_t arch, const ulong *ld_start, ulong * const ld_len) { /* * These variables are used to hold the current image location * in system memory. */ ulong tmp_img_addr; /* * These two variables are requirements for fit_image_load, but * their values are not used */ ulong img_data, img_len; void *buf; int loadables_index; int conf_noffset; int fit_img_result; char *uname; /* Check to see if the images struct has a FIT configuration */ if (!genimg_has_config(images)) { debug("## FIT configuration was not specified\n"); return 0; } /* * Obtain the os FIT header from the images struct * copy from dataflash if needed */ tmp_img_addr = map_to_sysmem(images->fit_hdr_os); tmp_img_addr = genimg_get_image(tmp_img_addr); buf = map_sysmem(tmp_img_addr, 0); /* * Check image type. For FIT images get FIT node * and attempt to locate a generic binary. */ switch (genimg_get_format(buf)) { case IMAGE_FORMAT_FIT: conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg); for (loadables_index = 0; fdt_get_string_index(buf, conf_noffset, FIT_LOADABLE_PROP, loadables_index, (const char **)&uname) == 0; loadables_index++) { fit_img_result = fit_image_load(images, tmp_img_addr, (const char **)&uname, &(images->fit_uname_cfg), arch, IH_TYPE_LOADABLE, BOOTSTAGE_ID_FIT_LOADABLE_START, FIT_LOAD_OPTIONAL_NON_ZERO, &img_data, &img_len); if (fit_img_result < 0) { /* Something went wrong! */ return fit_img_result; } } break; default: printf("The given image format is not supported (corrupt?)\n"); return 1; } return 0; }
int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images, uint8_t arch, const ulong *ld_start, ulong * const ld_len) { ulong tmp_img_addr, img_data, img_len; void *buf; int conf_noffset; int fit_img_result; char *uname, *name; int err; int devnum = 0; /* TODO support multi fpga platforms */ const fpga_desc * const desc = fpga_get_desc(devnum); xilinx_desc *desc_xilinx = desc->devdesc; /* Check to see if the images struct has a FIT configuration */ if (!genimg_has_config(images)) { debug("## FIT configuration was not specified\n"); return 0; } /* * Obtain the os FIT header from the images struct * copy from dataflash if needed */ tmp_img_addr = map_to_sysmem(images->fit_hdr_os); tmp_img_addr = genimg_get_image(tmp_img_addr); buf = map_sysmem(tmp_img_addr, 0); /* * Check image type. For FIT images get FIT node * and attempt to locate a generic binary. */ switch (genimg_get_format(buf)) { case IMAGE_FORMAT_FIT: conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg); err = fdt_get_string_index(buf, conf_noffset, FIT_FPGA_PROP, 0, (const char **)&uname); if (err < 0) { debug("## FPGA image is not specified\n"); return 0; } fit_img_result = fit_image_load(images, tmp_img_addr, (const char **)&uname, &(images->fit_uname_cfg), arch, IH_TYPE_FPGA, BOOTSTAGE_ID_FPGA_INIT, FIT_LOAD_OPTIONAL_NON_ZERO, &img_data, &img_len); debug("FPGA image (%s) loaded to 0x%lx/size 0x%lx\n", uname, img_data, img_len); if (fit_img_result < 0) { /* Something went wrong! */ return fit_img_result; } if (img_len >= desc_xilinx->size) { name = "full"; err = fpga_loadbitstream(devnum, (char *)img_data, img_len, BIT_FULL); if (err) err = fpga_load(devnum, (const void *)img_data, img_len, BIT_FULL); } else { name = "partial"; err = fpga_loadbitstream(devnum, (char *)img_data, img_len, BIT_PARTIAL); if (err) err = fpga_load(devnum, (const void *)img_data, img_len, BIT_PARTIAL); } printf(" Programming %s bitstream... ", name); if (err) printf("failed\n"); else printf("OK\n"); break; default: printf("The given image format is not supported (corrupt?)\n"); return 1; } return 0; }