1/*
2 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3 * Use is subject to license terms.
4 */
5
6/*
7 * Part of Intel(R) Manageability Engine Interface Linux driver
8 *
9 * Copyright (c) 2003 - 2008 Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions, and the following disclaimer,
17 *    without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 *    substantially similar to the "NO WARRANTY" disclaimer below
20 *    ("Disclaimer") and any redistribution must be conditioned upon
21 *    including a substantially similar Disclaimer requirement for further
22 *    binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 *    of any contributors may be used to endorse or promote products derived
25 *    from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 *
44 */
45
46#ifndef	_HECI_H_
47#define	_HECI_H_
48
49
50extern const struct guid heci_pthi_guid;
51extern const struct guid heci_wd_guid;
52extern const uint8_t start_wd_params[];
53extern const uint8_t stop_wd_params[];
54extern const uint8_t heci_wd_state_independence_msg[3][4];
55
56/*
57 * heci device ID
58 */
59#define	HECI_DEV_ID_82946GZ    0x2974  /* 82946GZ/GL */
60#define	HECI_DEV_ID_82G35	0x2984  /* 82G35 Express */
61#define	HECI_DEV_ID_82Q965	0x2994  /* 82Q963/Q965 */
62#define	HECI_DEV_ID_82G965	0x29A4  /* 82P965/G965 */
63
64#define	HECI_DEV_ID_82GM965	0x2A04  /* Mobile PM965/GM965 */
65#define	HECI_DEV_ID_82GME965	0x2A14  /* Mobile GME965/GLE960 */
66
67#define	HECI_DEV_ID_ICH9_82Q35	0x29B4  /* 82Q35 Express */
68#define	HECI_DEV_ID_ICH9_82G33 0x29C4  /* 82G33/G31/P35/P31 Express */
69#define	HECI_DEV_ID_ICH9_82Q33 0x29D4  /* 82Q33 Express */
70#define	HECI_DEV_ID_ICH9_82X38 0x29E4  /* 82X38/X48 Express */
71#define	HECI_DEV_ID_ICH9_3200  0x29F4  /* 3200/3210 Server */
72
73#define	HECI_DEV_ID_ICH9_6	0x28B4  /* Bearlake */
74#define	HECI_DEV_ID_ICH9_7	0x28C4  /* Bearlake */
75#define	HECI_DEV_ID_ICH9_8	0x28D4  /* Bearlake */
76#define	HECI_DEV_ID_ICH9_9	0x28E4  /* Bearlake */
77#define	HECI_DEV_ID_ICH9_10	0x28F4  /* Bearlake */
78
79#define	HECI_DEV_ID_ICH9M_1	0x2A44  /* Cantiga */
80#define	HECI_DEV_ID_ICH9M_2	0x2A54  /* Cantiga */
81#define	HECI_DEV_ID_ICH9M_3	0x2A64  /* Cantiga */
82#define	HECI_DEV_ID_ICH9M_4	0x2A74  /* Cantiga */
83
84#define	HECI_DEV_ID_ICH10_1	0x2E04  /* Eaglelake */
85#define	HECI_DEV_ID_ICH10_2	0x2E14  /* Eaglelake */
86#define	HECI_DEV_ID_ICH10_3	0x2E24  /* Eaglelake */
87#define	HECI_DEV_ID_ICH10_4	0x2E34  /* Eaglelake */
88
89/*
90 * heci init function prototypes
91 */
92void init_heci_device(dev_info_t *dip,
93	struct iamt_heci_device *device);
94void fini_heci_device(struct iamt_heci_device *device);
95void heci_reset(struct iamt_heci_device *dev, int interrupts);
96int heci_hw_init(struct iamt_heci_device *dev);
97void heci_task_initialize_clients(void *data);
98int heci_initialize_clients(struct iamt_heci_device *dev);
99struct heci_file_private *heci_alloc_file_private(struct heci_file *file);
100int heci_disconnect_host_client(struct iamt_heci_device *dev,
101				struct heci_file_private *file_ext);
102void heci_initialize_list(struct io_heci_list *list,
103	struct iamt_heci_device *dev);
104void heci_flush_list(struct io_heci_list *list,
105	struct heci_file_private *file_ext);
106void heci_flush_queues(struct iamt_heci_device *dev,
107	struct heci_file_private *file_ext);
108
109void heci_remove_client_from_file_list(struct iamt_heci_device *dev,
110	uint8_t host_client_id);
111
112/*
113 *  interrupt function prototype
114 */
115uint_t heci_isr_interrupt(caddr_t);
116
117void heci_wd_timer(void *data);
118
119/*
120 *  input output function prototype
121 */
122int heci_ioctl_get_version(struct iamt_heci_device *device, int if_num,
123	struct heci_message_data *u_msg, struct heci_message_data k_msg,
124	struct heci_file_private *file_ext,
125	int mode);
126
127int heci_ioctl_connect_client(struct iamt_heci_device *dev, int if_num,
128	struct heci_message_data *u_msg, struct heci_message_data k_msg,
129	struct heci_file *file, int mode);
130
131int heci_ioctl_wd(struct iamt_heci_device *device, int if_num,
132	struct heci_message_data k_msg,
133	struct heci_file_private *file_ext, int mode);
134
135int heci_ioctl_bypass_wd(struct iamt_heci_device *device, int if_num,
136	struct heci_message_data k_msg,
137	struct heci_file_private *file_ext, int mode);
138
139int heci_start_read(struct iamt_heci_device *device, int if_num,
140	struct heci_file_private *file_ext);
141
142int pthi_write(struct iamt_heci_device *device,
143	struct heci_cb_private *priv_cb);
144
145int pthi_read(struct iamt_heci_device *device, int if_num,
146	struct heci_file *file, struct uio *uio_p);
147
148struct heci_cb_private *find_pthi_read_list_entry(
149	struct iamt_heci_device *device, struct heci_file *file);
150
151void run_next_iamthif_cmd(struct iamt_heci_device *device);
152
153void heci_free_cb_private(struct heci_cb_private *priv_cb);
154
155void heci_free_file_private(struct heci_file_private *priv);
156
157#endif /* _HECI_H_ */
158