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