[rtems commit] bsps/xnandpsu: Read correct BBT size

Joel Sherrill joel at rtems.org
Thu Dec 14 19:11:58 UTC 2023


Module:    rtems
Branch:    master
Commit:    d6b75cc24809038bec57f64756eda1c2783e3a3c
Changeset: http://git.rtems.org/rtems/commit/?id=d6b75cc24809038bec57f64756eda1c2783e3a3c

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Sat Dec  2 14:09:22 2023 -0600

bsps/xnandpsu: Read correct BBT size

The Bad Block Table is a per-device catalog of the dispositions of each
block in the device. Only read enough data to determine the dispositions
of blocks for the device being read.

---

 bsps/shared/dev/nand/xnandpsu_bbm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bsps/shared/dev/nand/xnandpsu_bbm.c b/bsps/shared/dev/nand/xnandpsu_bbm.c
index 36ca62fd52..df16d6f114 100644
--- a/bsps/shared/dev/nand/xnandpsu_bbm.c
+++ b/bsps/shared/dev/nand/xnandpsu_bbm.c
@@ -411,7 +411,11 @@ static s32 XNandPsu_ReadBbt(XNandPsu *InstancePtr, u32 Target)
 
 	XNandPsu_BbtDesc *Desc = &InstancePtr->BbtDesc;
 	XNandPsu_BbtDesc *MirrorDesc = &InstancePtr->BbtMirrorDesc;
+#ifdef __rtems__
+	BufLen = InstancePtr->Geometry.NumTargetBlocks >>
+#else
 	BufLen = InstancePtr->Geometry.NumBlocks >>
+#endif
 			XNANDPSU_BBT_BLOCK_SHIFT;
 	/* Search the Bad Block Table(BBT) in flash */
 	Status1 = XNandPsu_SearchBbt(InstancePtr, Desc, Target);



More information about the vc mailing list