From: Mike Frysinger Date: Tue, 11 Oct 2011 00:36:57 -0400 Subject: [U-Boot] [PATCH] Introduce generic TPM support in u-boot In-Reply-To: References: <20111010025327.119EB40B40@eskimo.mtv.corp.google.com> <20111010204844.7B2D21408753@gemini.denx.de> Message-ID: <201110110036.59523.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tuesday 11 October 2011 00:23:48 Vadim Bendebury wrote: > On Mon, Oct 10, 2011 at 1:48 PM, Wolfgang Denk wrote: > > > 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? > > I sure can, but what still is not clear to me - how to provide the > ability to trace when using structure pointer dereferencing. TPM is a > tricky device, and the ability to trace all accesses made debugging > much easier. seems like tracing should be part of asm/io.h so people can do "#define DEBUG_IO_TRACE" and then include io.h, and then automatically get the output for each read/write to an I/O address ... > Is there an example of how tracing should be done when the device is > referenced through a memory structure, or do you suggest that the > tracing should be dropped? untested: #define write(val, ptr) \ do { \ void *__ptr = (ptr); \ u32 __val = (val); \ tpm_debug("write reg %p with %#x\n", __ptr, __val); \ if (sizeof(*(ptr) == 4) \ writel(__val, __ptr); \ else writeb(__val, __ptr); \ } while (0) #define read(ptr) \ ({ \ void *__ptr = (ptr); \ u32 __ret = sizeof(*(ptr)) == 4 ? readl(__ptr) : readb(__ptr); \ tpm_debug("read reg %p returned %#x\n", ptr, __ret); \ __ret; \ }) -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20111011/11772cc2/attachment.pgp