Home | History | Annotate | Line # | Download | only in ic
tpmreg.h revision 1.1
      1  1.1  christos /*	$NetBSD: tpmreg.h,v 1.1 2012/01/22 06:44:28 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /*
      4  1.1  christos  * Copyright (c) 2008, 2009 Michael Shalayeff
      5  1.1  christos  * Copyright (c) 2009, 2010 Hans-Jrg Hxer
      6  1.1  christos  * All rights reserved.
      7  1.1  christos  *
      8  1.1  christos  * Permission to use, copy, modify, and distribute this software for any
      9  1.1  christos  * purpose with or without fee is hereby granted, provided that the above
     10  1.1  christos  * copyright notice and this permission notice appear in all copies.
     11  1.1  christos  *
     12  1.1  christos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     13  1.1  christos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     14  1.1  christos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     15  1.1  christos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     16  1.1  christos  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
     17  1.1  christos  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     18  1.1  christos  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     19  1.1  christos  */
     20  1.1  christos 
     21  1.1  christos #define	TPM_BUFSIZ	1024
     22  1.1  christos 
     23  1.1  christos #define TPM_HDRSIZE	10
     24  1.1  christos 
     25  1.1  christos #define TPM_PARAM_SIZE	0x0001
     26  1.1  christos 
     27  1.1  christos #define	TPM_ACCESS			0x0000	/* acess register */
     28  1.1  christos #define	TPM_ACCESS_ESTABLISHMENT	0x01	/* establishment */
     29  1.1  christos #define	TPM_ACCESS_REQUEST_USE		0x02	/* request using locality */
     30  1.1  christos #define	TPM_ACCESS_REQUEST_PENDING	0x04	/* pending request */
     31  1.1  christos #define	TPM_ACCESS_SEIZE		0x08	/* request locality seize */
     32  1.1  christos #define	TPM_ACCESS_SEIZED		0x10	/* locality has been seized */
     33  1.1  christos #define	TPM_ACCESS_ACTIVE_LOCALITY	0x20	/* locality is active */
     34  1.1  christos #define	TPM_ACCESS_VALID		0x80	/* bits are valid */
     35  1.1  christos #define	TPM_ACCESS_BITS	\
     36  1.1  christos     "\020\01EST\02REQ\03PEND\04SEIZE\05SEIZED\06ACT\010VALID"
     37  1.1  christos 
     38  1.1  christos #define	TPM_INTERRUPT_ENABLE	0x0008
     39  1.1  christos #define	TPM_GLOBAL_INT_ENABLE	0x80000000	/* enable ints */
     40  1.1  christos #define	TPM_CMD_READY_INT	0x00000080	/* cmd ready enable */
     41  1.1  christos #define	TPM_INT_EDGE_FALLING	0x00000018
     42  1.1  christos #define	TPM_INT_EDGE_RISING	0x00000010
     43  1.1  christos #define	TPM_INT_LEVEL_LOW	0x00000008
     44  1.1  christos #define	TPM_INT_LEVEL_HIGH	0x00000000
     45  1.1  christos #define	TPM_LOCALITY_CHANGE_INT	0x00000004	/* locality change enable */
     46  1.1  christos #define	TPM_STS_VALID_INT	0x00000002	/* int on TPM_STS_VALID is set */
     47  1.1  christos #define	TPM_DATA_AVAIL_INT	0x00000001	/* int on TPM_STS_DATA_AVAIL is set */
     48  1.1  christos #define	TPM_INTERRUPT_ENABLE_BITS \
     49  1.1  christos     "\020\040ENA\010RDY\03LOCH\02STSV\01DRDY"
     50  1.1  christos 
     51  1.1  christos #define	TPM_INT_VECTOR		0x000c	/* 8 bit reg for 4 bit irq vector */
     52  1.1  christos #define	TPM_INT_STATUS		0x0010	/* bits are & 0x87 from TPM_INTERRUPT_ENABLE */
     53  1.1  christos 
     54  1.1  christos #define	TPM_INTF_CAPABILITIES		0x0014	/* capability register */
     55  1.1  christos #define	TPM_INTF_BURST_COUNT_STATIC	0x0100	/* TPM_STS_BMASK static */
     56  1.1  christos #define	TPM_INTF_CMD_READY_INT		0x0080	/* int on ready supported */
     57  1.1  christos #define	TPM_INTF_INT_EDGE_FALLING	0x0040	/* falling edge ints supported */
     58  1.1  christos #define	TPM_INTF_INT_EDGE_RISING	0x0020	/* rising edge ints supported */
     59  1.1  christos #define	TPM_INTF_INT_LEVEL_LOW		0x0010	/* level-low ints supported */
     60  1.1  christos #define	TPM_INTF_INT_LEVEL_HIGH		0x0008	/* level-high ints supported */
     61  1.1  christos #define	TPM_INTF_LOCALITY_CHANGE_INT	0x0004	/* locality-change int (mb 1) */
     62  1.1  christos #define	TPM_INTF_STS_VALID_INT		0x0002	/* TPM_STS_VALID int supported */
     63  1.1  christos #define	TPM_INTF_DATA_AVAIL_INT		0x0001	/* TPM_STS_DATA_AVAIL int supported (mb 1) */
     64  1.1  christos #define	TPM_CAPSREQ \
     65  1.1  christos   (TPM_INTF_DATA_AVAIL_INT|TPM_INTF_LOCALITY_CHANGE_INT|TPM_INTF_INT_LEVEL_LOW)
     66  1.1  christos #define	TPM_CAPBITS \
     67  1.1  christos   "\020\01IDRDY\02ISTSV\03ILOCH\04IHIGH\05ILOW\06IEDGE\07IFALL\010IRDY\011BCST"
     68  1.1  christos 
     69  1.1  christos #define	TPM_STS			0x0018		/* status register */
     70  1.1  christos #define TPM_STS_MASK		0x000000ff	/* status bits */
     71  1.1  christos #define	TPM_STS_BMASK		0x00ffff00	/* ro io burst size */
     72  1.1  christos #define	TPM_STS_VALID		0x00000080	/* ro other bits are valid */
     73  1.1  christos #define	TPM_STS_CMD_READY	0x00000040	/* rw chip/signal ready */
     74  1.1  christos #define	TPM_STS_GO		0x00000020	/* wo start the command */
     75  1.1  christos #define	TPM_STS_DATA_AVAIL	0x00000010	/* ro data available */
     76  1.1  christos #define	TPM_STS_DATA_EXPECT	0x00000008	/* ro more data to be written */
     77  1.1  christos #define	TPM_STS_RESP_RETRY	0x00000002	/* wo resend the response */
     78  1.1  christos #define	TPM_STS_BITS	"\020\010VALID\07RDY\06GO\05DRDY\04EXPECT\02RETRY"
     79  1.1  christos 
     80  1.1  christos #define	TPM_DATA	0x0024
     81  1.1  christos #define	TPM_ID		0x0f00
     82  1.1  christos #define	TPM_REV		0x0f04
     83  1.1  christos #define	TPM_SIZE	0x5000		/* five pages of the above */
     84  1.1  christos 
     85  1.1  christos #define	TPM_ACCESS_TMO	2000		/* 2sec */
     86  1.1  christos #define	TPM_READY_TMO	2000		/* 2sec */
     87  1.1  christos #define	TPM_READ_TMO	120000		/* 2 minutes */
     88  1.1  christos #define TPM_BURST_TMO	2000		/* 2sec */
     89  1.1  christos 
     90  1.1  christos #define	TPM_LEGACY_BUSY	0x01
     91  1.1  christos #define	TPM_LEGACY_ABRT	0x01
     92  1.1  christos #define	TPM_LEGACY_DA	0x02
     93  1.1  christos #define	TPM_LEGACY_RE	0x04
     94  1.1  christos #define	TPM_LEGACY_LAST	0x04
     95  1.1  christos #define	TPM_LEGACY_BITS	"\020\01BUSY\2DA\3RE\4LAST"
     96  1.1  christos #define	TPM_LEGACY_TMO		(2*60)	/* sec */
     97  1.1  christos #define	TPM_LEGACY_SLEEP	5	/* ticks */
     98  1.1  christos #define	TPM_LEGACY_DELAY	100
     99