diff options
Diffstat (limited to 'core/flash.c')
-rw-r--r-- | core/flash.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/core/flash.c b/core/flash.c index 5df4195..be4f9cc 100644 --- a/core/flash.c +++ b/core/flash.c @@ -49,10 +49,6 @@ static struct lock flash_lock; static struct flash *nvram_flash; static u32 nvram_offset, nvram_size; -/* ibm,firmware-versions support */ -static char *version_buf; -static size_t version_buf_size = 0x2000; - bool flash_reserve(void) { bool rc = false; @@ -165,131 +161,6 @@ out: return rc; } -static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data) -{ - static bool first = true; - char *prop; - int version_len, i; - int len = strlen(data); - const char * version_str[] = {"open-power", "buildroot", "skiboot", - "hostboot-binaries", "hostboot", "linux", - "petitboot", "occ", "capp-ucode", "sbe", - "machine-xml", "hcode"}; - - if (first) { - first = false; - - /* Increment past "key-" */ - if (memcmp(data, "open-power", strlen("open-power")) == 0) - prop = data + strlen("open-power"); - else - prop = strchr(data, '-'); - if (!prop) { - prlog(PR_DEBUG, - "FLASH: Invalid fw version format (%s)\n", data); - return; - } - prop++; - - dt_add_property_string(fw_version, "version", prop); - return; - } - - /* - * PNOR version strings are not easily consumable. Split them into - * property, value. - * - * Example input from PNOR : - * "open-power-firestone-v1.8" - * "linux-4.4.6-openpower1-8420e0f" - * - * Desired output in device tree: - * open-power = "firestone-v1.8"; - * linux = "4.4.6-openpower1-8420e0f"; - */ - for(i = 0; i < ARRAY_SIZE(version_str); i++) - { - version_len = strlen(version_str[i]); - if (len < version_len) - continue; - - if (memcmp(data, version_str[i], version_len) != 0) - continue; - - /* Found a match, add property */ - if (dt_find_property(fw_version, version_str[i])) - continue; - - /* Increment past "key-" */ - prop = data + version_len + 1; - dt_add_property_string(fw_version, version_str[i], prop); - } -} - -void flash_dt_add_fw_version(void) -{ - uint8_t version_data[80]; - int rc; - int numbytes = 0, i = 0; - struct dt_node *fw_version; - - if (version_buf == NULL) - return; - - rc = wait_for_resource_loaded(RESOURCE_ID_VERSION, RESOURCE_SUBID_NONE); - if (rc != OPAL_SUCCESS) { - prlog(PR_WARNING, "FLASH: Failed to load VERSION data\n"); - free(version_buf); - return; - } - - fw_version = dt_new(dt_root, "ibm,firmware-versions"); - assert(fw_version); - - if (stb_is_container(version_buf, version_buf_size)) - numbytes += SECURE_BOOT_HEADERS_SIZE; - for ( ; (numbytes < version_buf_size) && version_buf[numbytes]; numbytes++) { - if (version_buf[numbytes] == '\n') { - version_data[i] = '\0'; - __flash_dt_add_fw_version(fw_version, version_data); - memset(version_data, 0, sizeof(version_data)); - i = 0; - continue; - } else if (version_buf[numbytes] == '\t') { - continue; /* skip tabs */ - } - - version_data[i++] = version_buf[numbytes]; - } - - free(version_buf); -} - -void flash_fw_version_preload(void) -{ - int rc; - - if (proc_gen < proc_gen_p9) - return; - - prlog(PR_INFO, "FLASH: Loading VERSION section\n"); - - version_buf = malloc(version_buf_size); - if (!version_buf) { - prlog(PR_WARNING, "FLASH: Failed to allocate memory\n"); - return; - } - - rc = start_preload_resource(RESOURCE_ID_VERSION, RESOURCE_SUBID_NONE, - version_buf, &version_buf_size); - if (rc != OPAL_SUCCESS) { - prlog(PR_WARNING, - "FLASH: Failed to start loading VERSION data\n"); - free(version_buf); - version_buf = NULL; - } -} - static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs) { uint32_t start, size, part; |