diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-07-12 13:18:06 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-07-19 23:00:52 +0000 |
commit | aee738978b17c6a47a961ffe24b93eedaa0c63c5 (patch) | |
tree | 9325979060021b468ae4be1e07f0d2ca15a5ca7c | |
parent | e8b0e8acd8c991963fe501176e61815c064df991 (diff) | |
download | phosphor-mboxd-aee738978b17c6a47a961ffe24b93eedaa0c63c5.tar.gz phosphor-mboxd-aee738978b17c6a47a961ffe24b93eedaa0c63c5.zip |
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 <dkodihal@in.ibm.com>
-rw-r--r-- | mboxd_windows.c | 9 |
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. + */ +#ifndef VIRTUAL_PNOR_ENABLED 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); } +#endif if ((offset + cur->size) > context->flash_size) { /* |