aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-11-08 19:59:17 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-20 20:35:24 -0600
commiteb76931e7ae7ddd2eefd0d35ebea9c9b3cb276d9 (patch)
tree37ba4e06df23869a5ca890478390a9496fb1424c /external
parent2ee9d0560f7d2ef6d3b88ff56384f72cf2ada583 (diff)
downloadskiboot-eb76931e7ae7ddd2eefd0d35ebea9c9b3cb276d9.zip
skiboot-eb76931e7ae7ddd2eefd0d35ebea9c9b3cb276d9.tar.gz
skiboot-eb76931e7ae7ddd2eefd0d35ebea9c9b3cb276d9.tar.bz2
gard: Always use MTD to access flash
Direct mode is generally either unsafe or unsupported. We should always access the PNOR via an MTD device so make that the default. If someone really needs direct mode, then they can use pflash. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/gard/gard.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/external/gard/gard.c b/external/gard/gard.c
index 1ee54e6..8152434 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -879,6 +879,14 @@ int main(int argc, char **argv)
#endif
}
+ /*
+ * Force libflash to do flash accesses via the MTD. Direct mode is
+ * generally unsafe since it fiddles with the flash controller state
+ * underneath the kernel. Anyone who needs direct mode can use pflash
+ * instead.
+ */
+ arch_flash_access(ctx->bl, PNOR_MTD);
+
if (arch_flash_init(&(ctx->bl), filename, true)) {
/* Can fail for a few ways, most likely couldn't open MTD device */
fprintf(stderr, "Can't open %s\n", filename ? filename : "MTD Device. Are you root?");