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