[U-Boot] [PATCH] Introduce generic TPM support in u-boot

Wolfgang Denk wd at denx.de
Mon Oct 10 22:48:44 CEST 2011


Dear Vadim Bendebury,

In message <CAC3GErEyjcB=Cbhex4X8SQ1QbVvBGCR-=fqd5jb0dmU04kcBbw at mail.gmail.com> you wrote:
>
> so, this chip has five different areas (localities) which have the
> same structure, and are mapped at certain regular offsets inside the
> chip.
> 
> thus the structure describing the chip would be something like
> 
> struct locality {
>   u16 field_a;
>   u8 field_b;

insert here:

    u8 reserved[3];
>   u32 field_c;
>   ..
>   u8 padding[<padding size>];
> } __packed;

...and omit the "__packed" as this will only cause major PITA rather
sooner than later.

And better use "standard" types like uint8_t and uint32_t.

> struct tmp_chip {
>       struct locality localities[5];
> } __packed;

Again, without the "__packed".

> which is very compiler dependent, but probably not the only place in
> u-boot, so I could live with that if you could.

Actually this is not compiler dependent, if you manyally arrange for
correct alignment (and necessary padding), and if you omit any
"useful" attributes like about padding.

> Yet another inconvenience though is the requirement to be able to
> trace accesses to the registers. Some of the registers can be accessed
> in 32 bit mode or 8 bit mode, and this determines how many bytes get

Can you not always use one of the modes only?

> What I am getting at is that the code is much better readable as it is
> now even though it is in violation of the 'use structure to access
> registers' requirement.

The purpose is to enable the compiler to perform type checking.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wait!  You have not been prepared!
	-- Mr. Atoz, "Tomorrow is Yesterday", stardate 3113.2


More information about the U-Boot mailing list