aboutsummaryrefslogtreecommitdiff
path: root/core/flash.c
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2016-07-05 21:36:36 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-08-25 19:07:08 +1000
commit0ae753a084b555e3356c37c79ca743aedd11df02 (patch)
treead190ba227be9537c2bdaf50c2cf7124f75d55c7 /core/flash.c
parent026b9a13bf8d61a7e72721d59961b40cbc98b410 (diff)
downloadskiboot-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>
Diffstat (limited to 'core/flash.c')
-rw-r--r--core/flash.c45
1 files changed, 23 insertions, 22 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;