From: Wolfgang Denk Date: Mon, 10 Oct 2011 22:48:44 +0200 Subject: [U-Boot] [PATCH] Introduce generic TPM support in u-boot In-Reply-To: References: <20111010025327.119EB40B40@eskimo.mtv.corp.google.com> <20111010104503.7EF641408753@gemini.denx.de> Message-ID: <20111010204844.7B2D21408753@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Vadim Bendebury, In message 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[]; > } __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