xref: /onnv-gate/usr/src/uts/common/io/tpm/tpm_tis.h (revision 10346:9f0b25e42dc5)
19126SWyllys.Ingersoll@Sun.COM /*
29126SWyllys.Ingersoll@Sun.COM  * CDDL HEADER START
39126SWyllys.Ingersoll@Sun.COM  *
49126SWyllys.Ingersoll@Sun.COM  * The contents of this file are subject to the terms of the
59126SWyllys.Ingersoll@Sun.COM  * Common Development and Distribution License (the "License").
69126SWyllys.Ingersoll@Sun.COM  * You may not use this file except in compliance with the License.
79126SWyllys.Ingersoll@Sun.COM  *
89126SWyllys.Ingersoll@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99126SWyllys.Ingersoll@Sun.COM  * or http://www.opensolaris.org/os/licensing.
109126SWyllys.Ingersoll@Sun.COM  * See the License for the specific language governing permissions
119126SWyllys.Ingersoll@Sun.COM  * and limitations under the License.
129126SWyllys.Ingersoll@Sun.COM  *
139126SWyllys.Ingersoll@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
149126SWyllys.Ingersoll@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159126SWyllys.Ingersoll@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
169126SWyllys.Ingersoll@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
179126SWyllys.Ingersoll@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
189126SWyllys.Ingersoll@Sun.COM  *
199126SWyllys.Ingersoll@Sun.COM  * CDDL HEADER END
209126SWyllys.Ingersoll@Sun.COM  */
219126SWyllys.Ingersoll@Sun.COM 
229126SWyllys.Ingersoll@Sun.COM /*
239126SWyllys.Ingersoll@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
249126SWyllys.Ingersoll@Sun.COM  * Use is subject to license terms.
259126SWyllys.Ingersoll@Sun.COM  */
269126SWyllys.Ingersoll@Sun.COM #ifndef	_TPM_TIS_H
279126SWyllys.Ingersoll@Sun.COM #define	_TPM_TIS_H
289126SWyllys.Ingersoll@Sun.COM 
299126SWyllys.Ingersoll@Sun.COM /*
309126SWyllys.Ingersoll@Sun.COM  * TPM Interface Specification Defaults
319126SWyllys.Ingersoll@Sun.COM  * ICH7 spec (pg 253) says this is the base
329126SWyllys.Ingersoll@Sun.COM  * TPM on LPC: FED40000-FED40FFF But this is only locality 0
339126SWyllys.Ingersoll@Sun.COM  * It has to include 4 localities so the real range is FED40000-FED44FFF
349126SWyllys.Ingersoll@Sun.COM  * (TIS 1.2 pg 27)
359126SWyllys.Ingersoll@Sun.COM  */
369126SWyllys.Ingersoll@Sun.COM #define	TIS_MEM_BASE	0xFED40000
379126SWyllys.Ingersoll@Sun.COM #define	TIS_MEM_LEN    	0x5000
389126SWyllys.Ingersoll@Sun.COM 
39*10346Swyllys.ingersoll@sun.com #define	TPM_LOCALITY_OFFSET(x)	((x) << 12)
40*10346Swyllys.ingersoll@sun.com 
419126SWyllys.Ingersoll@Sun.COM /* Used to gain ownership */
42*10346Swyllys.ingersoll@sun.com #define	TPM_ACCESS		0x0000
439126SWyllys.Ingersoll@Sun.COM /* Enable Interrupts */
44*10346Swyllys.ingersoll@sun.com #define	TPM_INT_ENABLE		0x0008
459126SWyllys.Ingersoll@Sun.COM /* Interrupt vector (SIRQ values) */
46*10346Swyllys.ingersoll@sun.com #define	TPM_INT_VECTOR		0x000C
479126SWyllys.Ingersoll@Sun.COM /* What caused interrupt */
48*10346Swyllys.ingersoll@sun.com #define	TPM_INT_STATUS		0x0010
499126SWyllys.Ingersoll@Sun.COM /* Supported Interrupts */
50*10346Swyllys.ingersoll@sun.com #define	TPM_INTF_CAP		0x0014
519126SWyllys.Ingersoll@Sun.COM /* Status Register */
52*10346Swyllys.ingersoll@sun.com #define	TPM_STS			0x0018
539126SWyllys.Ingersoll@Sun.COM /* I/O FIFO */
54*10346Swyllys.ingersoll@sun.com #define	TPM_DATA_FIFO   	0x0024
559126SWyllys.Ingersoll@Sun.COM /* Vendor and Device ID */
56*10346Swyllys.ingersoll@sun.com #define	TPM_DID_VID		0x0F00
579126SWyllys.Ingersoll@Sun.COM /* Revision ID */
58*10346Swyllys.ingersoll@sun.com #define	TPM_RID			0x0F04
599126SWyllys.Ingersoll@Sun.COM 
609126SWyllys.Ingersoll@Sun.COM /* The number of all ordinals */
619126SWyllys.Ingersoll@Sun.COM #define	TSC_ORDINAL_MAX		12
629126SWyllys.Ingersoll@Sun.COM #define	TPM_ORDINAL_MAX		243
639126SWyllys.Ingersoll@Sun.COM #define	TSC_ORDINAL_MASK	0x40000000
649126SWyllys.Ingersoll@Sun.COM 
659126SWyllys.Ingersoll@Sun.COM /* Timeouts (in milliseconds) (TIS v1.2 pg 43) */
669126SWyllys.Ingersoll@Sun.COM #define	TPM_REQUEST_TIMEOUT	9000000		/* 9 seconds...too long? */
679126SWyllys.Ingersoll@Sun.COM #define	TPM_POLLING_TIMEOUT	10000		/* 10 ms for polling */
689126SWyllys.Ingersoll@Sun.COM 
699126SWyllys.Ingersoll@Sun.COM enum tis_timeouts {
709126SWyllys.Ingersoll@Sun.COM 	TIS_TIMEOUT_A = 750000,
719126SWyllys.Ingersoll@Sun.COM 	TIS_TIMEOUT_B = 2000000,
729126SWyllys.Ingersoll@Sun.COM 	TIS_TIMEOUT_C = 750000,
739126SWyllys.Ingersoll@Sun.COM 	TIS_TIMEOUT_D = 750000
749126SWyllys.Ingersoll@Sun.COM };
759126SWyllys.Ingersoll@Sun.COM 
769126SWyllys.Ingersoll@Sun.COM #define	TPM_DEFAULT_DURATION	750000
779126SWyllys.Ingersoll@Sun.COM 
789126SWyllys.Ingersoll@Sun.COM /* Possible TPM_ACCESS register bit values (TIS 1.2 pg.47-49) */
799126SWyllys.Ingersoll@Sun.COM enum tis_access {
809126SWyllys.Ingersoll@Sun.COM 	TPM_ACCESS_VALID = 0x80,
819126SWyllys.Ingersoll@Sun.COM 	TPM_ACCESS_ACTIVE_LOCALITY = 0x20,
829126SWyllys.Ingersoll@Sun.COM 	TPM_ACCESS_REQUEST_PENDING = 0x04,
839126SWyllys.Ingersoll@Sun.COM 	TPM_ACCESS_REQUEST_USE = 0x02
849126SWyllys.Ingersoll@Sun.COM };
859126SWyllys.Ingersoll@Sun.COM 
869126SWyllys.Ingersoll@Sun.COM /* Possible TPM_STS register values (TIS 1.2 pg.52-54) */
879126SWyllys.Ingersoll@Sun.COM enum tis_status {
889126SWyllys.Ingersoll@Sun.COM 	/* bit 0 and bit 2 are reserved */
899126SWyllys.Ingersoll@Sun.COM 	TPM_STS_RESPONSE_RETRY	= 0x02, /* bit 1 */
909126SWyllys.Ingersoll@Sun.COM 	TPM_STS_DATA_EXPECT	= 0x08, /* bit 3 */
919126SWyllys.Ingersoll@Sun.COM 	TPM_STS_DATA_AVAIL	= 0x10, /* bit 4 */
929126SWyllys.Ingersoll@Sun.COM 	TPM_STS_GO		= 0x20, /* bit 5 */
939126SWyllys.Ingersoll@Sun.COM 	TPM_STS_CMD_READY	= 0x40, /* bit 6 */
949126SWyllys.Ingersoll@Sun.COM 	TPM_STS_VALID		= 0x80  /* bit 7 */
959126SWyllys.Ingersoll@Sun.COM };
969126SWyllys.Ingersoll@Sun.COM 
979126SWyllys.Ingersoll@Sun.COM /* Possible TPM_INTF_CAPABILITY register values (TIS 1.2 pg.55) */
989126SWyllys.Ingersoll@Sun.COM enum tis_intf_cap {
999126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_BURST_COUNT_STATIC = 0x100,
1009126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_CMD_READY_INT = 0x080,
1019126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_EDGE_FALLING = 0x040,
1029126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_EDGE_RISING = 0x020,
1039126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_LEVEL_LOW = 0x010,
1049126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_LEVEL_HIGH = 0x008,
1059126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_LOCALITY_CHANGE_INT = 0x004,
1069126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_STS_VALID_INT = 0x002,
1079126SWyllys.Ingersoll@Sun.COM 	TPM_INTF_INT_DATA_AVAIL_INT = 0x001
1089126SWyllys.Ingersoll@Sun.COM };
1099126SWyllys.Ingersoll@Sun.COM 
1109126SWyllys.Ingersoll@Sun.COM /* Possible TPM_INT_ENABLE register values (TIS 1.2 pg.62-63) */
1119126SWyllys.Ingersoll@Sun.COM /* Interrupt enable bit for TPM_INT_ENABLE_x register */
1129126SWyllys.Ingersoll@Sun.COM /* Too big to fit in enum... */
1139126SWyllys.Ingersoll@Sun.COM #define	TPM_INT_GLOBAL_EN	0x80000000
1149126SWyllys.Ingersoll@Sun.COM enum tis_int_enable {
1159126SWyllys.Ingersoll@Sun.COM 	TPM_INT_CMD_RDY_EN = 0x80,
1169126SWyllys.Ingersoll@Sun.COM 	TPM_INT_LOCAL_CHANGE_INT_EN = 0x04,
1179126SWyllys.Ingersoll@Sun.COM 	TPM_INT_STS_VALID_EN = 0x02,
1189126SWyllys.Ingersoll@Sun.COM 	TPM_INT_STS_DATA_AVAIL_EN = 0x01
1199126SWyllys.Ingersoll@Sun.COM };
1209126SWyllys.Ingersoll@Sun.COM 
1219126SWyllys.Ingersoll@Sun.COM #endif	/* _TPM_TIS_H */
122