diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 16:56:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 16:56:38 -0500 |
commit | 6a5971d8fea1f4a8c33dfe0cec6a1c490f0c9cde (patch) | |
tree | 982911522177da03dd839d816a6a93cc210e4657 /drivers/misc/mei/mei_dev.h | |
parent | cff2f741b8ee8a70b208830e330de053efd4fc45 (diff) | |
parent | 70e78c40ed6c25bb34d642848e485d79ffc55c26 (diff) |
Merge tag 'char-misc-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull Char/Misc driver merge from Greg Kroah-Hartman:
"Here is the "big" char/misc driver patches for 3.8-rc1. I'm starting
to put random driver subsystems that I had previously sent you through
the driver-core tree in this tree, as it makes more sense to do so.
Nothing major here, the various __dev* removals, some mei driver
updates, and other random driver-specific things from the different
maintainers and developers.
Note, some MFD drivers got added through this tree, and they are also
coming in through the "real" MFD tree as well, due to some major
mis-communication between me and the different developers. If you
have any merge conflicts, take the ones from the MFD tree, not these
ones, sorry about that.
All of this has been in linux-next for a while.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fix up trivial conflict in drivers/mmc/host/Kconfig due to new drivers
having been added (both at the end, as usual..)
* tag 'char-misc-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (84 commits)
MAINTAINERS: remove drivers/staging/hv/
misc/st_kim: Free resources in the error path of probe()
drivers/char: for hpet, add count checking, and ~0UL instead of -1
w1-gpio: Simplify & get rid of defines
w1-gpio: Pinctrl-fy
extcon: remove use of __devexit_p
extcon: remove use of __devinit
extcon: remove use of __devexit
drivers: uio: Only allocate new private data when probing device tree node
drivers: uio_dmem_genirq: Allow partial success when opening device
drivers: uio_dmem_genirq: Don't use DMA_ERROR_CODE to indicate unmapped regions
drivers: uio_dmem_genirq: Don't mix address spaces for dynamic region vaddr
uio: remove use of __devexit
uio: remove use of __devinitdata
uio: remove use of __devinit
uio: remove use of __devexit_p
char: remove use of __devexit
char: remove use of __devinitconst
char: remove use of __devinitdata
char: remove use of __devinit
...
Diffstat (limited to 'drivers/misc/mei/mei_dev.h')
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 155 |
1 files changed, 112 insertions, 43 deletions
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index adb35fb9281c..25da04549d04 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/watchdog.h> | 21 | #include <linux/watchdog.h> |
22 | #include <linux/poll.h> | ||
22 | #include <linux/mei.h> | 23 | #include <linux/mei.h> |
23 | #include "hw.h" | 24 | #include "hw.h" |
24 | 25 | ||
@@ -125,13 +126,20 @@ enum mei_wd_states { | |||
125 | MEI_WD_STOPPING, | 126 | MEI_WD_STOPPING, |
126 | }; | 127 | }; |
127 | 128 | ||
128 | /* MEI CB */ | 129 | /** |
129 | enum mei_cb_major_types { | 130 | * enum mei_cb_file_ops - file operation associated with the callback |
130 | MEI_READ = 0, | 131 | * @MEI_FOP_READ - read |
131 | MEI_WRITE, | 132 | * @MEI_FOP_WRITE - write |
132 | MEI_IOCTL, | 133 | * @MEI_FOP_IOCTL - ioctl |
133 | MEI_OPEN, | 134 | * @MEI_FOP_OPEN - open |
134 | MEI_CLOSE | 135 | * @MEI_FOP_CLOSE - close |
136 | */ | ||
137 | enum mei_cb_file_ops { | ||
138 | MEI_FOP_READ = 0, | ||
139 | MEI_FOP_WRITE, | ||
140 | MEI_FOP_IOCTL, | ||
141 | MEI_FOP_OPEN, | ||
142 | MEI_FOP_CLOSE | ||
135 | }; | 143 | }; |
136 | 144 | ||
137 | /* | 145 | /* |
@@ -143,13 +151,21 @@ struct mei_message_data { | |||
143 | }; | 151 | }; |
144 | 152 | ||
145 | 153 | ||
154 | struct mei_cl; | ||
155 | |||
156 | /** | ||
157 | * struct mei_cl_cb - file operation callback structure | ||
158 | * | ||
159 | * @cl - file client who is running this operation | ||
160 | * @fop_type - file operation type | ||
161 | */ | ||
146 | struct mei_cl_cb { | 162 | struct mei_cl_cb { |
147 | struct list_head cb_list; | 163 | struct list_head list; |
148 | enum mei_cb_major_types major_file_operations; | 164 | struct mei_cl *cl; |
149 | void *file_private; | 165 | enum mei_cb_file_ops fop_type; |
150 | struct mei_message_data request_buffer; | 166 | struct mei_message_data request_buffer; |
151 | struct mei_message_data response_buffer; | 167 | struct mei_message_data response_buffer; |
152 | unsigned long information; | 168 | unsigned long buf_idx; |
153 | unsigned long read_time; | 169 | unsigned long read_time; |
154 | struct file *file_object; | 170 | struct file *file_object; |
155 | }; | 171 | }; |
@@ -175,29 +191,23 @@ struct mei_cl { | |||
175 | struct mei_cl_cb *read_cb; | 191 | struct mei_cl_cb *read_cb; |
176 | }; | 192 | }; |
177 | 193 | ||
178 | struct mei_io_list { | ||
179 | struct mei_cl_cb mei_cb; | ||
180 | }; | ||
181 | |||
182 | /** | 194 | /** |
183 | * struct mei_deive - MEI private device struct | 195 | * struct mei_device - MEI private device struct |
184 | * @hbuf_depth - depth of host(write) buffer | 196 | * @hbuf_depth - depth of host(write) buffer |
197 | * @wr_ext_msg - buffer for hbm control responses (set in read cycle) | ||
185 | */ | 198 | */ |
186 | struct mei_device { | 199 | struct mei_device { |
187 | struct pci_dev *pdev; /* pointer to pci device struct */ | 200 | struct pci_dev *pdev; /* pointer to pci device struct */ |
188 | /* | 201 | /* |
189 | * lists of queues | 202 | * lists of queues |
190 | */ | 203 | */ |
191 | /* array of pointers to aio lists */ | 204 | /* array of pointers to aio lists */ |
192 | struct mei_io_list read_list; /* driver read queue */ | 205 | struct mei_cl_cb read_list; /* driver read queue */ |
193 | struct mei_io_list write_list; /* driver write queue */ | 206 | struct mei_cl_cb write_list; /* driver write queue */ |
194 | struct mei_io_list write_waiting_list; /* write waiting queue */ | 207 | struct mei_cl_cb write_waiting_list; /* write waiting queue */ |
195 | struct mei_io_list ctrl_wr_list; /* managed write IOCTL list */ | 208 | struct mei_cl_cb ctrl_wr_list; /* managed write IOCTL list */ |
196 | struct mei_io_list ctrl_rd_list; /* managed read IOCTL list */ | 209 | struct mei_cl_cb ctrl_rd_list; /* managed read IOCTL list */ |
197 | struct mei_io_list amthi_cmd_list; /* amthi list for cmd waiting */ | 210 | |
198 | |||
199 | /* driver managed amthi list for reading completed amthi cmd data */ | ||
200 | struct mei_io_list amthi_read_complete_list; | ||
201 | /* | 211 | /* |
202 | * list of files | 212 | * list of files |
203 | */ | 213 | */ |
@@ -235,11 +245,13 @@ struct mei_device { | |||
235 | u16 init_clients_timer; | 245 | u16 init_clients_timer; |
236 | bool need_reset; | 246 | bool need_reset; |
237 | 247 | ||
238 | u32 extra_write_index; | ||
239 | unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */ | 248 | unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */ |
240 | u32 wr_msg_buf[128]; /* used for control messages */ | ||
241 | u32 ext_msg_buf[8]; /* for control responses */ | ||
242 | u32 rd_msg_hdr; | 249 | u32 rd_msg_hdr; |
250 | u32 wr_msg_buf[128]; /* used for control messages */ | ||
251 | struct { | ||
252 | struct mei_msg_hdr hdr; | ||
253 | unsigned char data[4]; /* All HBM messages are 4 bytes */ | ||
254 | } wr_ext_msg; /* for control responses */ | ||
243 | 255 | ||
244 | struct hbm_version version; | 256 | struct hbm_version version; |
245 | 257 | ||
@@ -253,12 +265,15 @@ struct mei_device { | |||
253 | 265 | ||
254 | struct mei_cl wd_cl; | 266 | struct mei_cl wd_cl; |
255 | enum mei_wd_states wd_state; | 267 | enum mei_wd_states wd_state; |
256 | bool wd_interface_reg; | ||
257 | bool wd_pending; | 268 | bool wd_pending; |
258 | u16 wd_timeout; | 269 | u16 wd_timeout; |
259 | unsigned char wd_data[MEI_WD_START_MSG_SIZE]; | 270 | unsigned char wd_data[MEI_WD_START_MSG_SIZE]; |
260 | 271 | ||
261 | 272 | ||
273 | /* amthif list for cmd waiting */ | ||
274 | struct mei_cl_cb amthif_cmd_list; | ||
275 | /* driver managed amthif list for reading completed amthif cmd data */ | ||
276 | struct mei_cl_cb amthif_rd_complete_list; | ||
262 | struct file *iamthif_file_object; | 277 | struct file *iamthif_file_object; |
263 | struct mei_cl iamthif_cl; | 278 | struct mei_cl iamthif_cl; |
264 | struct mei_cl_cb *iamthif_current_cb; | 279 | struct mei_cl_cb *iamthif_current_cb; |
@@ -272,8 +287,15 @@ struct mei_device { | |||
272 | bool iamthif_flow_control_pending; | 287 | bool iamthif_flow_control_pending; |
273 | bool iamthif_ioctl; | 288 | bool iamthif_ioctl; |
274 | bool iamthif_canceled; | 289 | bool iamthif_canceled; |
290 | |||
291 | struct work_struct init_work; | ||
275 | }; | 292 | }; |
276 | 293 | ||
294 | static inline unsigned long mei_secs_to_jiffies(unsigned long sec) | ||
295 | { | ||
296 | return msecs_to_jiffies(sec * MSEC_PER_SEC); | ||
297 | } | ||
298 | |||
277 | 299 | ||
278 | /* | 300 | /* |
279 | * mei init function prototypes | 301 | * mei init function prototypes |
@@ -284,21 +306,34 @@ int mei_hw_init(struct mei_device *dev); | |||
284 | int mei_task_initialize_clients(void *data); | 306 | int mei_task_initialize_clients(void *data); |
285 | int mei_initialize_clients(struct mei_device *dev); | 307 | int mei_initialize_clients(struct mei_device *dev); |
286 | int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl); | 308 | int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl); |
287 | void mei_remove_client_from_file_list(struct mei_device *dev, u8 host_client_id); | ||
288 | void mei_host_init_iamthif(struct mei_device *dev); | ||
289 | void mei_allocate_me_clients_storage(struct mei_device *dev); | 309 | void mei_allocate_me_clients_storage(struct mei_device *dev); |
290 | 310 | ||
291 | 311 | ||
292 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, | 312 | int mei_me_cl_link(struct mei_device *dev, struct mei_cl *cl, |
293 | const uuid_le *cguid, u8 host_client_id); | 313 | const uuid_le *cguid, u8 host_client_id); |
314 | void mei_me_cl_unlink(struct mei_device *dev, struct mei_cl *cl); | ||
294 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); | 315 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); |
295 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); | 316 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); |
296 | 317 | ||
297 | /* | 318 | /* |
298 | * MEI IO List Functions | 319 | * MEI IO Functions |
320 | */ | ||
321 | struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, struct file *fp); | ||
322 | void mei_io_cb_free(struct mei_cl_cb *priv_cb); | ||
323 | int mei_io_cb_alloc_req_buf(struct mei_cl_cb *cb, size_t length); | ||
324 | int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length); | ||
325 | |||
326 | |||
327 | /** | ||
328 | * mei_io_list_init - Sets up a queue list. | ||
329 | * | ||
330 | * @list: An instance cl callback structure | ||
299 | */ | 331 | */ |
300 | void mei_io_list_init(struct mei_io_list *list); | 332 | static inline void mei_io_list_init(struct mei_cl_cb *list) |
301 | void mei_io_list_flush(struct mei_io_list *list, struct mei_cl *cl); | 333 | { |
334 | INIT_LIST_HEAD(&list->list); | ||
335 | } | ||
336 | void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl); | ||
302 | 337 | ||
303 | /* | 338 | /* |
304 | * MEI ME Client Functions | 339 | * MEI ME Client Functions |
@@ -330,7 +365,8 @@ static inline bool mei_cl_cmp_id(const struct mei_cl *cl1, | |||
330 | */ | 365 | */ |
331 | void mei_host_start_message(struct mei_device *dev); | 366 | void mei_host_start_message(struct mei_device *dev); |
332 | void mei_host_enum_clients_message(struct mei_device *dev); | 367 | void mei_host_enum_clients_message(struct mei_device *dev); |
333 | int mei_host_client_properties(struct mei_device *dev); | 368 | int mei_host_client_enumerate(struct mei_device *dev); |
369 | void mei_host_client_init(struct work_struct *work); | ||
334 | 370 | ||
335 | /* | 371 | /* |
336 | * MEI interrupt functions prototype | 372 | * MEI interrupt functions prototype |
@@ -347,18 +383,40 @@ int mei_ioctl_connect_client(struct file *file, | |||
347 | 383 | ||
348 | int mei_start_read(struct mei_device *dev, struct mei_cl *cl); | 384 | int mei_start_read(struct mei_device *dev, struct mei_cl *cl); |
349 | 385 | ||
350 | int amthi_write(struct mei_device *dev, struct mei_cl_cb *priv_cb); | ||
351 | 386 | ||
352 | int amthi_read(struct mei_device *dev, struct file *file, | 387 | /* |
353 | char __user *ubuf, size_t length, loff_t *offset); | 388 | * AMTHIF - AMT Host Interface Functions |
389 | */ | ||
390 | void mei_amthif_reset_params(struct mei_device *dev); | ||
391 | |||
392 | void mei_amthif_host_init(struct mei_device *dev); | ||
393 | |||
394 | int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *priv_cb); | ||
354 | 395 | ||
355 | struct mei_cl_cb *find_amthi_read_list_entry(struct mei_device *dev, | 396 | int mei_amthif_read(struct mei_device *dev, struct file *file, |
397 | char __user *ubuf, size_t length, loff_t *offset); | ||
398 | |||
399 | unsigned int mei_amthif_poll(struct mei_device *dev, | ||
400 | struct file *file, poll_table *wait); | ||
401 | |||
402 | int mei_amthif_release(struct mei_device *dev, struct file *file); | ||
403 | |||
404 | struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, | ||
356 | struct file *file); | 405 | struct file *file); |
357 | 406 | ||
358 | void mei_run_next_iamthif_cmd(struct mei_device *dev); | 407 | void mei_amthif_run_next_cmd(struct mei_device *dev); |
408 | |||
359 | 409 | ||
360 | void mei_free_cb_private(struct mei_cl_cb *priv_cb); | 410 | int mei_amthif_read_message(struct mei_cl_cb *complete_list, |
411 | struct mei_device *dev, struct mei_msg_hdr *mei_hdr); | ||
361 | 412 | ||
413 | int mei_amthif_irq_write_complete(struct mei_device *dev, s32 *slots, | ||
414 | struct mei_cl_cb *cb, struct mei_cl_cb *cmpl_list); | ||
415 | |||
416 | void mei_amthif_complete(struct mei_device *dev, struct mei_cl_cb *cb); | ||
417 | int mei_amthif_irq_read_message(struct mei_cl_cb *complete_list, | ||
418 | struct mei_device *dev, struct mei_msg_hdr *mei_hdr); | ||
419 | int mei_amthif_irq_read(struct mei_device *dev, s32 *slots); | ||
362 | 420 | ||
363 | /* | 421 | /* |
364 | * Register Access Function | 422 | * Register Access Function |
@@ -437,4 +495,15 @@ void mei_csr_clear_his(struct mei_device *dev); | |||
437 | void mei_enable_interrupts(struct mei_device *dev); | 495 | void mei_enable_interrupts(struct mei_device *dev); |
438 | void mei_disable_interrupts(struct mei_device *dev); | 496 | void mei_disable_interrupts(struct mei_device *dev); |
439 | 497 | ||
498 | static inline struct mei_msg_hdr *mei_hbm_hdr(u32 *buf, size_t length) | ||
499 | { | ||
500 | struct mei_msg_hdr *hdr = (struct mei_msg_hdr *)buf; | ||
501 | hdr->host_addr = 0; | ||
502 | hdr->me_addr = 0; | ||
503 | hdr->length = length; | ||
504 | hdr->msg_complete = 1; | ||
505 | hdr->reserved = 0; | ||
506 | return hdr; | ||
507 | } | ||
508 | |||
440 | #endif | 509 | #endif |