cmd: bcb: fix bcb struct alignment issue
authorGary Bisson <gary.bisson@boundarydevices.com>
Tue, 11 Jan 2022 17:06:06 +0000 (18:06 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 5 Feb 2022 14:49:00 +0000 (15:49 +0100)
commit18956cd41926b1d41b4ae09c4bb70a8e986c7085
treea73978d7d4b646de0e76928c675dfe6640f6e345
parentf8a5cda5ec27fd532a218c9988aa30b2318cb13d
cmd: bcb: fix bcb struct alignment issue

Without this patch the bcb struct could be located at an odd address
which resulted in data not being copied to the buffer.

Here was the repro steps (from Mattijs):
=> mmc dev 1
=> bcb load 1 misc
=> bcb dump command
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=> part start mmc 1 misc misc_start
=> mmc read ${loadaddr} ${misc_start} 4
=> bcb load 1 misc
=> bcb dump command
00000000: 62 6f 6f 74 6f 6e 63 65 2d 62 6f 6f 74 6c 6f 61
00000010: 64 65 72 00 00 00 00 00 00 00 00 00 00 00 00 00

This behavior was observed on an Amlogic A311D (ARM64) platform with a
recent GCC toolchain (11.2.0) but is most likely affecting other
platforms.

To avoid issues the structure is aligned on DMA minimum alignment value
as it is passed directly to the read function.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on khadas vim3
cmd/bcb.c