Incorrect struct onfi_params definition
Ian Lepore
ian at FreeBSD.org
Wed Nov 6 23:59:23 UTC 2013
On Wed, 2013-11-06 at 22:28 +0100, Kristof Provost wrote:
> Hi,
>
> The definition of struct onfi_params in sys/dev/nand/nand.h is
> incorrect. The total structure size should be 256 bytes, but it's only
> 176 bytes.
>
> That's because the vendor_spec array was declared as being 8 bytes,
> rather than the 88 bytes it should be. Clearly a typo.
>
> This patch should fix it:
>
> diff --git a/sys/dev/nand/nand.h b/sys/dev/nand/nand.h
> index 0d6d7b4..46b6993 100644
> --- a/sys/dev/nand/nand.h
> +++ b/sys/dev/nand/nand.h
> @@ -217,7 +217,7 @@ struct onfi_params {
> uint8_t driver_strength_support;
> uint8_t res4[12];
> uint16_t vendor_rev;
> - uint8_t vendor_spec[8];
> + uint8_t vendor_spec[88];
> uint16_t crc;
> }__attribute__((packed));
>
>
There's more wrong with the onfi support than just that. The biggie is
that it doesn't handle packed/unaligned accesses and the endianess of
the data in the struct. I've got patches from like a year ago that I've
been meaning to dust off and check in. They address more than just the
onfi, and they contain a mix of unrelated stuff and style changes, so
there's some work involved in making them committable.
I'll attach them here so you can at least get an idea what I'm talking
about and see if there's anything useful for you in them.
-- Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nand1.diff
Type: text/x-patch
Size: 11490 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-embedded/attachments/20131106/43fe98ef/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nand2.diff
Type: text/x-patch
Size: 9626 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-embedded/attachments/20131106/43fe98ef/attachment-0001.bin>
More information about the freebsd-embedded
mailing list