xref: /titanic_41/usr/src/uts/intel/io/heci/heci_interface.h (revision a4dd1f3517267c5e5aa5b2bb53cb388002bc688f)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Part of Intel(R) Manageability Engine Interface Linux driver
8  *
9  * Copyright (c) 2003 - 2008 Intel Corp.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  *
44  */
45 
46 
47 #ifndef _HECI_INTERFACE_H_
48 #define	_HECI_INTERFACE_H_
49 
50 
51 #define	HBM_MINOR_VERSION	0
52 #define	HBM_MAJOR_VERSION	1
53 #define	HBM_TIMEOUT	1	/* 1 second */
54 
55 
56 #define	HOST_START_REQ_CMD	0x01
57 #define	HOST_START_RES_CMD	0x81
58 
59 #define	HOST_STOP_REQ_CMD	0x02
60 #define	HOST_STOP_RES_CMD	0x82
61 
62 #define	ME_STOP_REQ_CMD	0x03
63 
64 #define	HOST_ENUM_REQ_CMD	0x04
65 #define	HOST_ENUM_RES_CMD	0x84
66 
67 #define	HOST_CLIENT_PROPERTEIS_REQ_CMD	0x05
68 #define	HOST_CLIENT_PROPERTEIS_RES_CMD	0x85
69 
70 #define	CLIENT_CONNECT_REQ_CMD	0x06
71 #define	CLIENT_CONNECT_RES_CMD	0x86
72 
73 #define	CLIENT_DISCONNECT_REQ_CMD	0x07
74 #define	CLIENT_DISCONNECT_RES_CMD	0x87
75 
76 #define	HECI_FLOW_CONTROL_CMD	0x08
77 
78 
79 #define	AMT_WD_VALUE 120	/* seconds */
80 
81 #define	HECI_WATCHDOG_DATA_SIZE	16
82 #define	HECI_START_WD_DATA_SIZE	20
83 #define	HECI_WD_PARAMS_SIZE	4
84 
85 #pragma	pack(1)
86 /* IOCTL commands */
87 #define	IOCTL_HECI_GET_VERSION \
88     _IOWR('H', 0x0, struct heci_message_data)
89 #define	IOCTL_HECI_CONNECT_CLIENT \
90     _IOWR('H', 0x01, struct heci_message_data)
91 #define	IOCTL_HECI_WD \
92     _IOWR('H', 0x02, struct heci_message_data)
93 #define	IOCTL_HECI_BYPASS_WD \
94     _IOWR('H', 0x10, struct heci_message_data)
95 
96 
97 enum heci_stop_reason_types {
98 	DRIVER_STOP_REQUEST = 0x00,
99 	DEVICE_D1_ENTRY = 0x01,
100 	DEVICE_D2_ENTRY = 0x02,
101 	DEVICE_D3_ENTRY = 0x03,
102 	SYSTEM_S1_ENTRY = 0x04,
103 	SYSTEM_S2_ENTRY = 0x05,
104 	SYSTEM_S3_ENTRY = 0x06,
105 	SYSTEM_S4_ENTRY = 0x07,
106 	SYSTEM_S5_ENTRY = 0x08
107 };
108 
109 enum me_stop_reason_types {
110 	FW_UPDATE = 0x00
111 };
112 
113 enum client_connect_status_types {
114 	CCS_SUCCESS = 0x00,
115 	CCS_NOT_FOUND = 0x01,
116 	CCS_ALREADY_STARTED = 0x02,
117 	CCS_OUT_OF_RESOURCES = 0x03,
118 	CCS_MESSAGE_SMALL = 0x04
119 };
120 
121 enum client_disconnect_status_types {
122 	CDS_SUCCESS = 0x00
123 };
124 
125 
126 /*
127  * heci interface function prototypes
128  */
129 void heci_set_csr_register(struct iamt_heci_device *dev);
130 void heci_csr_enable_interrupts(struct iamt_heci_device *dev);
131 void heci_csr_disable_interrupts(struct iamt_heci_device *dev);
132 
133 void heci_read_slots(struct iamt_heci_device *dev,
134 	unsigned char *buffer, unsigned long buffer_length);
135 
136 int heci_write_message(struct iamt_heci_device *dev,
137 	struct heci_msg_hdr *header,
138 	unsigned char *write_buffer,
139 	unsigned long write_length);
140 
141 int host_buffer_is_empty(struct iamt_heci_device *dev);
142 
143 int32_t count_full_read_slots(struct iamt_heci_device *dev);
144 
145 int32_t count_empty_write_slots(struct iamt_heci_device *dev);
146 
147 int flow_ctrl_creds(struct iamt_heci_device *dev,
148 	struct heci_file_private *file_ext);
149 
150 int heci_send_wd(struct iamt_heci_device *dev);
151 
152 void flow_ctrl_reduce(struct iamt_heci_device *dev,
153 	struct heci_file_private *file_ext);
154 
155 int heci_send_flow_control(struct iamt_heci_device *dev,
156 	struct heci_file_private *file_ext);
157 
158 int heci_disconnect(struct iamt_heci_device *dev,
159 	struct heci_file_private *file_ext);
160 int other_client_is_connecting(struct iamt_heci_device *dev,
161 	struct heci_file_private *file_ext);
162 int heci_connect(struct iamt_heci_device *dev,
163 	struct heci_file_private *file_ext);
164 
165 #endif /* _HECI_INTERFACE_H_ */
166