aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineering.com>2019-04-26 12:01:04 -0500
committerStewart Smith <stewart@linux.ibm.com>2019-05-02 09:57:15 +1000
commit0f42d72abdf7e1018fade2758d20d05a0a88947c (patch)
treea76945dd27af3ce755dd6123bcc701741c958223
parent27fcf2fa8350f4c326e37603674242d36e786975 (diff)
downloadskiboot-0f42d72abdf7e1018fade2758d20d05a0a88947c.zip
skiboot-0f42d72abdf7e1018fade2758d20d05a0a88947c.tar.gz
skiboot-0f42d72abdf7e1018fade2758d20d05a0a88947c.tar.bz2
Mark all partitions except full PNOR and boot kernel firmware read only
FFS partitions don't always align on erase blocks. Mark any paritions not known to align on erase blocks as read only to prevent silent corruption of adjacent partitions during erase / write from the host. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--core/flash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/flash.c b/core/flash.c
index e775dd1..3da6d4a 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -279,6 +279,13 @@ static struct dt_node *flash_add_dt_node(struct flash *flash, int id)
partition_node = dt_new_addr(partition_container_node, "partition", ffs_part_start);
dt_add_property_strings(partition_node, "label", name);
dt_add_property_cells(partition_node, "reg", ffs_part_start, ffs_part_size);
+ if (part_name_map[i].id != RESOURCE_ID_KERNEL_FW) {
+ /* Mark all partitions other than the full PNOR and the boot kernel
+ * firmware as read only. These two partitions are the only partitions
+ * that are properly erase block aligned at this time.
+ */
+ dt_add_property(partition_node, "read-only", NULL, 0);
+ }
}
partition_node = dt_new_addr(partition_container_node, "partition", 0);