Marcin Obara | d52b3d9 | 2009-02-25 12:29:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Part of Intel(R) Manageability Engine Interface Linux driver |
| 3 | * |
| 4 | * Copyright (c) 2003 - 2008 Intel Corp. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 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. |
| 21 | * |
| 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. |
| 25 | * |
| 26 | * NO WARRANTY |
| 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. |
| 38 | * |
| 39 | */ |
| 40 | |
| 41 | |
| 42 | #ifndef _HECI_INTERFACE_H_ |
| 43 | #define _HECI_INTERFACE_H_ |
| 44 | |
| 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" |
| 56 | |
| 57 | |
| 58 | #define HBM_MINOR_VERSION 0 |
| 59 | #define HBM_MAJOR_VERSION 1 |
| 60 | #define HBM_TIMEOUT 1 /* 1 second */ |
| 61 | |
| 62 | |
| 63 | #define HOST_START_REQ_CMD 0x01 |
| 64 | #define HOST_START_RES_CMD 0x81 |
| 65 | |
| 66 | #define HOST_STOP_REQ_CMD 0x02 |
| 67 | #define HOST_STOP_RES_CMD 0x82 |
| 68 | |
| 69 | #define ME_STOP_REQ_CMD 0x03 |
| 70 | |
| 71 | #define HOST_ENUM_REQ_CMD 0x04 |
| 72 | #define HOST_ENUM_RES_CMD 0x84 |
| 73 | |
| 74 | #define HOST_CLIENT_PROPERTEIS_REQ_CMD 0x05 |
| 75 | #define HOST_CLIENT_PROPERTEIS_RES_CMD 0x85 |
| 76 | |
| 77 | #define CLIENT_CONNECT_REQ_CMD 0x06 |
| 78 | #define CLIENT_CONNECT_RES_CMD 0x86 |
| 79 | |
| 80 | #define CLIENT_DISCONNECT_REQ_CMD 0x07 |
| 81 | #define CLIENT_DISCONNECT_RES_CMD 0x87 |
| 82 | |
| 83 | #define HECI_FLOW_CONTROL_CMD 0x08 |
| 84 | |
| 85 | |
| 86 | #define AMT_WD_VALUE 120 /* seconds */ |
| 87 | |
| 88 | #define HECI_WATCHDOG_DATA_SIZE 16 |
| 89 | #define HECI_START_WD_DATA_SIZE 20 |
| 90 | #define HECI_WD_PARAMS_SIZE 4 |
| 91 | |
| 92 | /* IOCTL commands */ |
| 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) |
| 101 | |
| 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 |
| 112 | }; |
| 113 | |
| 114 | enum me_stop_reason_types{ |
| 115 | FW_UPDATE = 0x00 |
| 116 | }; |
| 117 | |
| 118 | enum client_connect_status_types{ |
| 119 | CCS_SUCCESS = 0x00, |
| 120 | CCS_NOT_FOUND = 0x01, |
| 121 | CCS_ALREADY_STARTED = 0x02, |
| 122 | CCS_OUT_OF_RESOURCES = 0x03, |
| 123 | CCS_MESSAGE_SMALL = 0x04 |
| 124 | }; |
| 125 | |
| 126 | enum client_disconnect_status_types{ |
| 127 | CDS_SUCCESS = 0x00 |
| 128 | }; |
| 129 | |
| 130 | |
| 131 | /* |
| 132 | * heci interface function prototypes |
| 133 | */ |
| 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); |
| 137 | |
| 138 | void heci_read_slots(struct iamt_heci_device *dev, |
| 139 | unsigned char *buffer, unsigned long buffer_length); |
| 140 | |
| 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); |
| 145 | |
| 146 | int host_buffer_is_empty(struct iamt_heci_device *dev); |
| 147 | |
| 148 | __s32 count_full_read_slots(struct iamt_heci_device *dev); |
| 149 | |
| 150 | __s32 count_empty_write_slots(const struct iamt_heci_device *dev); |
| 151 | |
| 152 | int flow_ctrl_creds(struct iamt_heci_device *dev, |
| 153 | struct heci_file_private *file_ext); |
| 154 | |
| 155 | int heci_send_wd(struct iamt_heci_device *dev); |
| 156 | |
| 157 | void flow_ctrl_reduce(struct iamt_heci_device *dev, |
| 158 | struct heci_file_private *file_ext); |
| 159 | |
| 160 | int heci_send_flow_control(struct iamt_heci_device *dev, |
| 161 | struct heci_file_private *file_ext); |
| 162 | |
| 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); |
| 169 | |
| 170 | #endif /* _HECI_INTERFACE_H_ */ |