path: root/mboxd_windows.c
diff options
authorDeepak Kodihalli <>2017-07-12 13:18:06 -0500
committerPatrick Williams <>2017-07-19 23:00:52 +0000
commitaee738978b17c6a47a961ffe24b93eedaa0c63c5 (patch)
tree9325979060021b468ae4be1e07f0d2ca15a5ca7c /mboxd_windows.c
parente8b0e8acd8c991963fe501176e61815c064df991 (diff)
vpnor: correct offset alignment
With the current implementation of the virtual pnor, a window contains at most one partition, and a partition may be smaller than the window max size. An offset requested by the host, which starts right after such a small partition ends, must result in a new window mapping (because said offset points to another partition). Change-Id: I07fd51c6af2c8125891073bf10ceb1399a55dc92 Signed-off-by: Deepak Kodihalli <>
Diffstat (limited to 'mboxd_windows.c')
1 files changed, 9 insertions, 0 deletions
diff --git a/mboxd_windows.c b/mboxd_windows.c
index 1755c4a..e4d9882 100644
--- a/mboxd_windows.c
+++ b/mboxd_windows.c
@@ -586,6 +586,14 @@ int create_map_window(struct mbox_context *context,
cur = find_oldest_window(context);
+ * In case of the virtual pnor, as of now it's possible that a window may
+ * have content less than it's max size. We basically copy one flash partition
+ * per window, and some partitions are smaller than the max size. An offset
+ * right after such a small partition ends should lead to new mapping. The code
+ * below prevents that.
+ */
if (!exact) {
* It would be nice to align the offsets which we map to window
@@ -597,6 +605,7 @@ int create_map_window(struct mbox_context *context,
offset &= ~(cur->size - 1);
if ((offset + cur->size) > context->flash_size) {
OpenPOWER on IntegriCloud