2 * Part of Intel(R) Manageability Engine Interface Linux driver
4 * Copyright (c) 2003 - 2008 Intel Corp.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 * substantially similar to the "NO WARRANTY" disclaimer below
15 * ("Disclaimer") and any redistribution must be conditioned upon
16 * including a substantially similar Disclaimer requirement for further
17 * binary redistribution.
18 * 3. Neither the names of the above-listed copyright holders nor the names
19 * of any contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * Alternatively, this software may be distributed under the terms of the
23 * GNU General Public License ("GPL") version 2 as published by the Free
24 * Software Foundation.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGES.
42 #ifndef _HECI_INTERFACE_H_
43 #define _HECI_INTERFACE_H_
45 #include <linux/version.h>
46 #include <linux/spinlock.h>
47 #include <linux/list.h>
48 #include <linux/pci.h>
49 #include <linux/timer.h>
50 #include <linux/interrupt.h>
51 #include <linux/workqueue.h>
52 #include <linux/module.h>
53 #include <linux/aio.h>
54 #include <linux/types.h>
55 #include "heci_data_structures.h"
58 #define HBM_MINOR_VERSION 0
59 #define HBM_MAJOR_VERSION 1
60 #define HBM_TIMEOUT 1 /* 1 second */
63 #define HOST_START_REQ_CMD 0x01
64 #define HOST_START_RES_CMD 0x81
66 #define HOST_STOP_REQ_CMD 0x02
67 #define HOST_STOP_RES_CMD 0x82
69 #define ME_STOP_REQ_CMD 0x03
71 #define HOST_ENUM_REQ_CMD 0x04
72 #define HOST_ENUM_RES_CMD 0x84
74 #define HOST_CLIENT_PROPERTEIS_REQ_CMD 0x05
75 #define HOST_CLIENT_PROPERTEIS_RES_CMD 0x85
77 #define CLIENT_CONNECT_REQ_CMD 0x06
78 #define CLIENT_CONNECT_RES_CMD 0x86
80 #define CLIENT_DISCONNECT_REQ_CMD 0x07
81 #define CLIENT_DISCONNECT_RES_CMD 0x87
83 #define HECI_FLOW_CONTROL_CMD 0x08
86 #define AMT_WD_VALUE 120 /* seconds */
88 #define HECI_WATCHDOG_DATA_SIZE 16
89 #define HECI_START_WD_DATA_SIZE 20
90 #define HECI_WD_PARAMS_SIZE 4
93 #define IOCTL_HECI_GET_VERSION \
94 _IOWR('H' , 0x0, struct heci_message_data)
95 #define IOCTL_HECI_CONNECT_CLIENT \
96 _IOWR('H' , 0x01, struct heci_message_data)
97 #define IOCTL_HECI_WD \
98 _IOWR('H' , 0x02, struct heci_message_data)
99 #define IOCTL_HECI_BYPASS_WD \
100 _IOWR('H' , 0x10, struct heci_message_data)
102 enum heci_stop_reason_types{
103 DRIVER_STOP_REQUEST = 0x00,
104 DEVICE_D1_ENTRY = 0x01,
105 DEVICE_D2_ENTRY = 0x02,
106 DEVICE_D3_ENTRY = 0x03,
107 SYSTEM_S1_ENTRY = 0x04,
108 SYSTEM_S2_ENTRY = 0x05,
109 SYSTEM_S3_ENTRY = 0x06,
110 SYSTEM_S4_ENTRY = 0x07,
111 SYSTEM_S5_ENTRY = 0x08
114 enum me_stop_reason_types{
118 enum client_connect_status_types{
120 CCS_NOT_FOUND = 0x01,
121 CCS_ALREADY_STARTED = 0x02,
122 CCS_OUT_OF_RESOURCES = 0x03,
123 CCS_MESSAGE_SMALL = 0x04
126 enum client_disconnect_status_types{
132 * heci interface function prototypes
134 void heci_set_csr_register(struct iamt_heci_device *dev);
135 void heci_csr_enable_interrupts(struct iamt_heci_device *dev);
136 void heci_csr_disable_interrupts(struct iamt_heci_device *dev);
138 void heci_read_slots(struct iamt_heci_device *dev,
139 unsigned char *buffer, unsigned long buffer_length);
141 int heci_write_message(struct iamt_heci_device *dev,
142 struct heci_msg_hdr *header,
143 unsigned char *write_buffer,
144 unsigned long write_length);
146 int host_buffer_is_empty(struct iamt_heci_device *dev);
148 __s32 count_full_read_slots(struct iamt_heci_device *dev);
150 __s32 count_empty_write_slots(const struct iamt_heci_device *dev);
152 int flow_ctrl_creds(struct iamt_heci_device *dev,
153 struct heci_file_private *file_ext);
155 int heci_send_wd(struct iamt_heci_device *dev);
157 void flow_ctrl_reduce(struct iamt_heci_device *dev,
158 struct heci_file_private *file_ext);
160 int heci_send_flow_control(struct iamt_heci_device *dev,
161 struct heci_file_private *file_ext);
163 int heci_disconnect(struct iamt_heci_device *dev,
164 struct heci_file_private *file_ext);
165 int other_client_is_connecting(struct iamt_heci_device *dev,
166 struct heci_file_private *file_ext);
167 int heci_connect(struct iamt_heci_device *dev,
168 struct heci_file_private *file_ext);
170 #endif /* _HECI_INTERFACE_H_ */