diff options
author | Michael Neuling <mikey@neuling.org> | 2016-07-05 21:36:36 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-08-25 19:07:08 +1000 |
commit | 0ae753a084b555e3356c37c79ca743aedd11df02 (patch) | |
tree | ad190ba227be9537c2bdaf50c2cf7124f75d55c7 | |
parent | 026b9a13bf8d61a7e72721d59961b40cbc98b410 (diff) | |
download | skiboot-0ae753a084b555e3356c37c79ca743aedd11df02.zip skiboot-0ae753a084b555e3356c37c79ca743aedd11df02.tar.gz skiboot-0ae753a084b555e3356c37c79ca743aedd11df02.tar.bz2 |
flash: Rework error paths and messages for multiple flash controllers
The current flash code was written with only one flash chip, which is
a system_flash (ie. the PNOR image), in mind.
Now that we have mambo bogusdisk flash, we can have many flash chips.
This is resulting in some confusing output messages.
This reworks some of the error paths and warnings to make this more
coherent when we have multiple flash chips.
We assume everything can be a system flash, so I've removed the
is_system_flash parameter from flash_register(). We'll use the first
system flash we find and warn if we find another since discovery order
is not a guaranteed API.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/flash.c | 45 | ||||
-rw-r--r-- | include/skiboot.h | 2 | ||||
-rw-r--r-- | libflash/libffs.c | 2 | ||||
-rw-r--r-- | platforms/astbmc/pnor.c | 2 | ||||
-rw-r--r-- | platforms/mambo/mambo.c | 2 | ||||
-rw-r--r-- | platforms/rhesus/rhesus.c | 2 |
6 files changed, 28 insertions, 27 deletions
diff --git a/core/flash.c b/core/flash.c index 6d384d4..2087866 100644 --- a/core/flash.c +++ b/core/flash.c @@ -208,31 +208,25 @@ static void setup_system_flash(struct flash *flash, struct dt_node *node, { char *path; - if (system_flash) { - /** - * @fwts-label SystemFlashDuplicate - * @fwts-advice More than one flash device was registered - * as the system flash device. Check for duplicate calls - * to flash_register(..., true). - */ - prlog(PR_WARNING, "FLASH: attempted to register a second " - "system flash device %s\n", name); + if (!ffs) return; - } - if (!ffs) { + if (system_flash) { /** - * @fwts-label SystemFlashNoPartitionTable - * @fwts-advice OPAL Could not read a partition table on - * system flash. Since we've still booted the machine (which - * requires flash), check that we're registering the proper - * system flash device. + * @fwts-label SystemFlashMultiple + * @fwts-advice OPAL Found multiple system flash. + * Since we've already found a system flash we are + * going to use that one but this ordering is not + * guaranteed so may change in future. */ - prlog(PR_WARNING, "FLASH: attempted to register system flash " - "%s, which has no partition info\n", name); + prlog(PR_WARNING, "FLASH: Attempted to register multiple system " + "flash: %s\n", name); return; } + prlog(PR_NOTICE, "FLASH: Found system flash: %s id:%i\n", + name, flash->id); + system_flash = flash; path = dt_get_path(node); dt_add_property_string(dt_chosen, "ibm,system-flash", path); @@ -254,7 +248,7 @@ static int num_flashes(void) return i; } -int flash_register(struct blocklevel_device *bl, bool is_system_flash) +int flash_register(struct blocklevel_device *bl) { uint64_t size; uint32_t block_size; @@ -304,8 +298,7 @@ int flash_register(struct blocklevel_device *bl, bool is_system_flash) node = flash_add_dt_node(flash, flash->id); - if (is_system_flash) - setup_system_flash(flash, node, name, ffs); + setup_system_flash(flash, node, name, ffs); if (ffs) ffs_close(ffs); @@ -553,8 +546,16 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, lock(&flash_lock); - if (!system_flash) + if (!system_flash) { + /** + * @fwts-label SystemFlashNotFound + * @fwts-advice No system flash was found. Check for missing + * calls flash_register(...). + */ + prlog(PR_WARNING, "FLASH: Can't load resource id:%i. " + "No system flash found\n", id); goto out_unlock; + } flash = system_flash; diff --git a/include/skiboot.h b/include/skiboot.h index 1dbe38f..4ccf46d 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -217,7 +217,7 @@ extern void lpc_rtc_init(void); /* flash support */ struct flash_chip; -extern int flash_register(struct blocklevel_device *bl, bool is_system_flash); +extern int flash_register(struct blocklevel_device *bl); extern int flash_start_preload_resource(enum resource_id id, uint32_t subid, void *buf, size_t *len); extern int flash_resource_loaded(enum resource_id id, uint32_t idx); diff --git a/libflash/libffs.c b/libflash/libffs.c index 65c3fbe..8b1c2a7 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -135,7 +135,7 @@ int ffs_init(uint32_t offset, uint32_t max_size, struct blocklevel_device *bl, /* Convert and check flash header */ rc = ffs_check_convert_header(&f->hdr, &hdr); if (rc) { - FL_ERR("FFS: Error %d checking flash header\n", rc); + FL_INF("FFS: Flash header not found. Code: %d\n", rc); goto out; } diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c index 74353ea..de4cafa 100644 --- a/platforms/astbmc/pnor.c +++ b/platforms/astbmc/pnor.c @@ -52,7 +52,7 @@ int pnor_init(void) goto fail; } - rc = flash_register(bl, true); + rc = flash_register(bl); if (!rc) return 0; diff --git a/platforms/mambo/mambo.c b/platforms/mambo/mambo.c index 066f748..64248ef 100644 --- a/platforms/mambo/mambo.c +++ b/platforms/mambo/mambo.c @@ -213,7 +213,7 @@ static void bogus_disk_flash_init(void) bl->priv = bdi; bl->erase_mask = BD_SECT_SZ - 1; - rc = flash_register(bl, true); + rc = flash_register(bl); if (rc) prerror("mambo: Failed to register bogus disk: %li\n", id); diff --git a/platforms/rhesus/rhesus.c b/platforms/rhesus/rhesus.c index 8faf295..c96f120 100644 --- a/platforms/rhesus/rhesus.c +++ b/platforms/rhesus/rhesus.c @@ -135,7 +135,7 @@ static int rhesus_pnor_init(void) goto fail; } - rc = flash_register(bl, true); + rc = flash_register(bl); if (!rc) return 0; |