17 #include <linux/pci.h>
67 static unsigned char mei_hbuf_filled_slots(
struct mei_device *
dev)
69 char read_ptr, write_ptr;
76 return (
unsigned char) (write_ptr - read_ptr);
88 return mei_hbuf_filled_slots(dev) == 0;
100 unsigned char filled_slots, empty_slots;
102 filled_slots = mei_hbuf_filled_slots(dev);
123 unsigned char *
buf,
unsigned long length)
125 unsigned long rem, dw_cnt;
126 u32 *reg_buf = (
u32 *)buf;
132 "mei_write_message header=%08x.\n",
136 dev_dbg(&dev->
pdev->dev,
"empty slots = %hu.\n", empty_slots);
138 dw_cnt = mei_data2slots(length);
139 if (empty_slots < 0 || dw_cnt > empty_slots)
142 mei_reg_write(dev,
H_CB_WW, *((
u32 *) header));
144 for (i = 0; i < length / 4; i++)
145 mei_reg_write(dev,
H_CB_WW, reg_buf[i]);
150 memcpy(®, &buf[length - rem], rem);
151 mei_reg_write(dev,
H_CB_WW, reg);
173 char read_ptr, write_ptr;
174 unsigned char buffer_depth, filled_slots;
180 filled_slots = (
unsigned char) (write_ptr - read_ptr);
183 if (filled_slots > buffer_depth)
186 dev_dbg(&dev->
pdev->dev,
"filled_slots =%08x\n", filled_slots);
187 return (
int)filled_slots;
200 u32 *reg_buf = (
u32 *)buffer;
202 for (; buffer_length >=
sizeof(
u32); buffer_length -=
sizeof(
u32))
203 *reg_buf++ = mei_mecbrw_read(dev);
205 if (buffer_length > 0) {
206 u32 reg = mei_mecbrw_read(dev);
207 memcpy(reg_buf, ®, buffer_length);
269 if (me_cl->
props.single_recv_buf != 0) {
305 memset(mei_flow_control, 0,
sizeof(*mei_flow_control));
310 sizeof(mei_flow_control->
reserved));
311 dev_dbg(&dev->
pdev->dev,
"sending flow control host client = %d, ME client = %d\n",
315 (
unsigned char *) mei_flow_control,
366 memset(mei_cli_disconnect, 0,
sizeof(*mei_cli_disconnect));
370 mei_cli_disconnect->
reserved[0] = 0;
373 (
unsigned char *) mei_cli_disconnect,
405 (
unsigned char *) mei_cli_connect,