From aee738978b17c6a47a961ffe24b93eedaa0c63c5 Mon Sep 17 00:00:00 2001 From: Deepak Kodihalli Date: Wed, 12 Jul 2017 13:18:06 -0500 Subject: 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 --- mboxd_windows.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mboxd_windows.c') 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) { /* -- cgit v1.2.1