summaryrefslogtreecommitdiffstats
path: root/bsps/shared
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2023-12-02 14:17:26 -0600
committerJoel Sherrill <joel@rtems.org>2023-12-14 13:40:03 -0600
commitd77a873ddb373aafe5927bbbb95fe3a1c2b6e6eb (patch)
tree30849eceeb17c2f799d20a50152d8df37cb67ed3 /bsps/shared
parentbsps/xnandpsu: Write BBT to correct location (diff)
downloadrtems-d77a873ddb373aafe5927bbbb95fe3a1c2b6e6eb.tar.bz2
bsps/xnandpsu: Mark correct reserved blocks
When marking the trailing blocks on a device as reserved for Bad Block Table usage, ensure that the correct blocks are marked. This resolves an off-by-one error that was marking one block too low and leaving the last block in the device unmarked.
Diffstat (limited to 'bsps/shared')
-rw-r--r--bsps/shared/dev/nand/xnandpsu_bbm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bsps/shared/dev/nand/xnandpsu_bbm.c b/bsps/shared/dev/nand/xnandpsu_bbm.c
index d1b7d5a39d..4fb62b2f6d 100644
--- a/bsps/shared/dev/nand/xnandpsu_bbm.c
+++ b/bsps/shared/dev/nand/xnandpsu_bbm.c
@@ -830,7 +830,11 @@ static s32 XNandPsu_MarkBbt(XNandPsu* InstancePtr, XNandPsu_BbtDesc *Desc,
/* Mark the last four blocks as Reserved */
BlockIndex = ((Target + (u32)1) * InstancePtr->Geometry.NumTargetBlocks) -
+#ifdef __rtems__
+ Desc->MaxBlocks;
+#else
Desc->MaxBlocks - (u32)1;
+#endif
for(Index = 0U; Index < Desc->MaxBlocks; Index++) {