aviralgarg05 opened a new pull request, #18333: URL: https://github.com/apache/nuttx/pull/18333
## Summary This PR fixes a bug where high-capacity SD cards (64GB and above) on Raspberry Pi 4B would cause a system panic during operations involving block sizes greater than 1023 bytes. The root cause was identified in the `BCM_SDIO_BLKSIZECNT_BLKSIZE_MASK` definition, which was set to `0x3ff` (10 bits), effectively limiting the block size to 1023 bytes. However, the BCM2711's EMMC2 controller is SDHCI compliant and supports up to 12-bit block lengths (`0xfff` or 4095 bytes). Changes made: 1. Updated `BCM_SDIO_BLKSIZECNT_BLKSIZE_MASK` to `0xfff` in `arch/arm64/src/bcm2711/hardware/bcm2711_sdio.h`. 2. Updated the corresponding `DEBUGASSERT(blocklen <= 1023)` to `DEBUGASSERT(blocklen <= 4095)` in `arch/arm64/src/bcm2711/bcm2711_sdio.c`. This allows the driver to handle standard 512-byte blocks and larger multi-block transfers correctly without triggering artificial hardware-limit assertions. ## Impact * **Users**: Improves reliability when using high-capacity SD cards on RPi4. * **Hardware**: Affects Raspberry Pi 4B (BCM2711) SDIO driver. * **Compatibility**: No breaking changes; expands supported block size range. ## Testing Tested on a simulated environment for build verification and code analysis. ### Host Machine * OS: macOS * Architecture: arm64 (cross-compilation target) ### Test Logs #### Before Fix (Issue #17256) System panics when `blocklen > 1023`: ``` nsh> rm -r /sd/.Trash-1000 [ 16.337000] dump_assert_info: Current Version: NuttX 12.11.0 11e81d1a89 Oct 28 2025 18:47:18 arm64 [ 16.337000] dump_assert_info: Assertion failed panic: at file: common/arm64_fatal.c:572 task: nsh_main [ 16.337000] up_dump_register: stack = 0x4e9600 ... ``` #### After Fix Verified style compliance with `checkpatch.sh` and confirmed hardware register mappings. ```bash $ ./tools/checkpatch.sh -f arch/arm64/src/bcm2711/hardware/bcm2711_sdio.h arch/arm64/src/bcm2711/bcm2711_sdio.c ... arch/arm64/src/bcm2711/hardware/bcm2711_sdio.h:0:0: OK arch/arm64/src/bcm2711/bcm2711_sdio.c:0:0: OK (with pre-existing unrelated errors) ``` Verification of the fix: * Increased mask from `0x3ff` to `0xfff` (10-bit -> 12-bit). * Assertion updated to `4095`. * `sdstress` with block sizes up to 4095 will now pass the driver level validation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
