copy_flash: update window size
When a pnor partition is copied to a window, update the window size with
the actual number of blocks copied. This is required in the response of
the V2 Read Window Command.
Change-Id: I2c158df1bd261a4e62b9cbb2765e7623a7fb3dc9
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/mboxd_pnor_partition_table.cpp b/mboxd_pnor_partition_table.cpp
index d2fdba3..60066f5 100644
--- a/mboxd_pnor_partition_table.cpp
+++ b/mboxd_pnor_partition_table.cpp
@@ -85,13 +85,14 @@
memcpy(&local.paths, &context->paths, sizeof(local.paths));
size_t tocOffset = 0;
+ uint32_t tocSize = blTable.size() * eraseSize;
// Copy TOC
copy_flash(&local, tocOffset,
static_cast<uint8_t*>(context->mem) + tocStart,
- blTable.size() * eraseSize);
+ tocSize);
const pnor_partition& partition = blTable.partition(blPartitionName);
size_t hbbOffset = partition.data.base * eraseSize;
- size_t hbbSize = partition.data.actual;
+ uint32_t hbbSize = partition.data.actual;
// Copy HBB
copy_flash(&local, hbbOffset,
static_cast<uint8_t*>(context->mem) + hbbOffset, hbbSize);