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.
44 #include <linux/version.h>
45 #include <linux/spinlock.h>
46 #include <linux/list.h>
47 #include <linux/pci.h>
48 #include <linux/timer.h>
49 #include <linux/interrupt.h>
50 #include <linux/workqueue.h>
51 #include <linux/module.h>
52 #include <linux/aio.h>
53 #include <linux/types.h>
54 #include "heci_data_structures.h"
56 extern const struct guid heci_pthi_guid;
57 extern const struct guid heci_wd_guid;
58 extern const __u8 heci_start_wd_params[];
59 extern const __u8 heci_stop_wd_params[];
60 extern const __u8 heci_wd_state_independence_msg[3][4];
65 #define HECI_DEV_ID_82946GZ 0x2974 /* 82946GZ/GL */
66 #define HECI_DEV_ID_82G35 0x2984 /* 82G35 Express */
67 #define HECI_DEV_ID_82Q965 0x2994 /* 82Q963/Q965 */
68 #define HECI_DEV_ID_82G965 0x29A4 /* 82P965/G965 */
70 #define HECI_DEV_ID_82GM965 0x2A04 /* Mobile PM965/GM965 */
71 #define HECI_DEV_ID_82GME965 0x2A14 /* Mobile GME965/GLE960 */
73 #define HECI_DEV_ID_ICH9_82Q35 0x29B4 /* 82Q35 Express */
74 #define HECI_DEV_ID_ICH9_82G33 0x29C4 /* 82G33/G31/P35/P31 Express */
75 #define HECI_DEV_ID_ICH9_82Q33 0x29D4 /* 82Q33 Express */
76 #define HECI_DEV_ID_ICH9_82X38 0x29E4 /* 82X38/X48 Express */
77 #define HECI_DEV_ID_ICH9_3200 0x29F4 /* 3200/3210 Server */
79 #define HECI_DEV_ID_ICH9_6 0x28B4 /* Bearlake */
80 #define HECI_DEV_ID_ICH9_7 0x28C4 /* Bearlake */
81 #define HECI_DEV_ID_ICH9_8 0x28D4 /* Bearlake */
82 #define HECI_DEV_ID_ICH9_9 0x28E4 /* Bearlake */
83 #define HECI_DEV_ID_ICH9_10 0x28F4 /* Bearlake */
85 #define HECI_DEV_ID_ICH9M_1 0x2A44 /* Cantiga */
86 #define HECI_DEV_ID_ICH9M_2 0x2A54 /* Cantiga */
87 #define HECI_DEV_ID_ICH9M_3 0x2A64 /* Cantiga */
88 #define HECI_DEV_ID_ICH9M_4 0x2A74 /* Cantiga */
90 #define HECI_DEV_ID_ICH10_1 0x2E04 /* Eaglelake */
91 #define HECI_DEV_ID_ICH10_2 0x2E14 /* Eaglelake */
92 #define HECI_DEV_ID_ICH10_3 0x2E24 /* Eaglelake */
93 #define HECI_DEV_ID_ICH10_4 0x2E34 /* Eaglelake */
96 * heci init function prototypes
98 struct iamt_heci_device *init_heci_device(struct pci_dev *pdev);
99 void heci_reset(struct iamt_heci_device *dev, int interrupts);
100 int heci_hw_init(struct iamt_heci_device *dev);
101 int heci_task_initialize_clients(void *data);
102 int heci_initialize_clients(struct iamt_heci_device *dev);
103 struct heci_file_private *heci_alloc_file_private(struct file *file);
104 int heci_disconnect_host_client(struct iamt_heci_device *dev,
105 struct heci_file_private *file_ext);
106 void heci_initialize_list(struct io_heci_list *list,
107 struct iamt_heci_device *dev);
108 void heci_flush_list(struct io_heci_list *list,
109 struct heci_file_private *file_ext);
110 void heci_flush_queues(struct iamt_heci_device *dev,
111 struct heci_file_private *file_ext);
113 void heci_remove_client_from_file_list(struct iamt_heci_device *dev,
114 __u8 host_client_id);
117 * interrupt function prototype
119 irqreturn_t heci_isr_interrupt(int irq, void *dev_id);
121 void heci_wd_timer(unsigned long data);
124 * input output function prototype
126 int heci_ioctl_get_version(struct iamt_heci_device *dev, int if_num,
127 struct heci_message_data __user *u_msg,
128 struct heci_message_data k_msg,
129 struct heci_file_private *file_ext);
131 int heci_ioctl_connect_client(struct iamt_heci_device *dev, int if_num,
132 struct heci_message_data __user *u_msg,
133 struct heci_message_data k_msg,
136 int heci_ioctl_wd(struct iamt_heci_device *dev, int if_num,
137 struct heci_message_data k_msg,
138 struct heci_file_private *file_ext);
140 int heci_ioctl_bypass_wd(struct iamt_heci_device *dev, int if_num,
141 struct heci_message_data k_msg,
142 struct heci_file_private *file_ext);
144 int heci_start_read(struct iamt_heci_device *dev, int if_num,
145 struct heci_file_private *file_ext);
147 int pthi_write(struct iamt_heci_device *dev,
148 struct heci_cb_private *priv_cb);
150 int pthi_read(struct iamt_heci_device *dev, int if_num, struct file *file,
151 char __user *ubuf, size_t length, loff_t *offset);
153 struct heci_cb_private *find_pthi_read_list_entry(
154 struct iamt_heci_device *dev,
157 void run_next_iamthif_cmd(struct iamt_heci_device *dev);
159 void heci_free_cb_private(struct heci_cb_private *priv_cb);
162 * heci_fe_same_id - tell if file private data have same id
164 * @fe1: private data of 1. file object
165 * @fe2: private data of 2. file object
167 * returns !=0 - if ids are the same, 0 - if differ.
169 static inline int heci_fe_same_id(const struct heci_file_private *fe1,
170 const struct heci_file_private *fe2)
172 return ((fe1->host_client_id == fe2->host_client_id)
173 && (fe1->me_client_id == fe2->me_client_id));
176 #endif /* _HECI_H_ */