Commit | Line | Data |
---|---|---|
9fff0425 | 1 | // SPDX-License-Identifier: GPL-2.0 |
bb1b0133 | 2 | /* |
df4b37bc | 3 | * Copyright (c) 2003-2020, Intel Corporation. All rights reserved. |
bb1b0133 | 4 | * Intel Management Engine Interface (Intel MEI) Linux driver |
bb1b0133 | 5 | */ |
4fcbc99b | 6 | #include <linux/export.h> |
bb1b0133 TW |
7 | #include <linux/sched.h> |
8 | #include <linux/wait.h> | |
180ea05b | 9 | #include <linux/pm_runtime.h> |
1f180359 TW |
10 | #include <linux/slab.h> |
11 | ||
12 | #include <linux/mei.h> | |
bb1b0133 TW |
13 | |
14 | #include "mei_dev.h" | |
0edb23fc | 15 | #include "hbm.h" |
12d00665 | 16 | #include "client.h" |
bb1b0133 | 17 | |
89778d6e TW |
18 | static const char *mei_hbm_status_str(enum mei_hbm_status status) |
19 | { | |
20 | #define MEI_HBM_STATUS(status) case MEI_HBMS_##status: return #status | |
21 | switch (status) { | |
22 | MEI_HBM_STATUS(SUCCESS); | |
23 | MEI_HBM_STATUS(CLIENT_NOT_FOUND); | |
24 | MEI_HBM_STATUS(ALREADY_EXISTS); | |
25 | MEI_HBM_STATUS(REJECTED); | |
26 | MEI_HBM_STATUS(INVALID_PARAMETER); | |
27 | MEI_HBM_STATUS(NOT_ALLOWED); | |
28 | MEI_HBM_STATUS(ALREADY_STARTED); | |
29 | MEI_HBM_STATUS(NOT_STARTED); | |
30 | default: return "unknown"; | |
31 | } | |
32 | #undef MEI_HBM_STATUS | |
33 | }; | |
34 | ||
285e2996 AU |
35 | static const char *mei_cl_conn_status_str(enum mei_cl_connect_status status) |
36 | { | |
37 | #define MEI_CL_CS(status) case MEI_CL_CONN_##status: return #status | |
38 | switch (status) { | |
39 | MEI_CL_CS(SUCCESS); | |
40 | MEI_CL_CS(NOT_FOUND); | |
41 | MEI_CL_CS(ALREADY_STARTED); | |
42 | MEI_CL_CS(OUT_OF_RESOURCES); | |
43 | MEI_CL_CS(MESSAGE_SMALL); | |
71e117f2 | 44 | MEI_CL_CS(NOT_ALLOWED); |
285e2996 AU |
45 | default: return "unknown"; |
46 | } | |
47 | #undef MEI_CL_CCS | |
48 | } | |
49 | ||
1beeb4b9 AU |
50 | const char *mei_hbm_state_str(enum mei_hbm_state state) |
51 | { | |
52 | #define MEI_HBM_STATE(state) case MEI_HBM_##state: return #state | |
53 | switch (state) { | |
54 | MEI_HBM_STATE(IDLE); | |
55 | MEI_HBM_STATE(STARTING); | |
56 | MEI_HBM_STATE(STARTED); | |
c55bf542 | 57 | MEI_HBM_STATE(DR_SETUP); |
1beeb4b9 AU |
58 | MEI_HBM_STATE(ENUM_CLIENTS); |
59 | MEI_HBM_STATE(CLIENT_PROPERTIES); | |
60 | MEI_HBM_STATE(STOPPED); | |
61 | default: | |
62 | return "unknown"; | |
63 | } | |
64 | #undef MEI_HBM_STATE | |
65 | } | |
66 | ||
285e2996 AU |
67 | /** |
68 | * mei_cl_conn_status_to_errno - convert client connect response | |
69 | * status to error code | |
70 | * | |
71 | * @status: client connect response status | |
72 | * | |
a8605ea2 | 73 | * Return: corresponding error code |
285e2996 AU |
74 | */ |
75 | static int mei_cl_conn_status_to_errno(enum mei_cl_connect_status status) | |
76 | { | |
77 | switch (status) { | |
78 | case MEI_CL_CONN_SUCCESS: return 0; | |
79 | case MEI_CL_CONN_NOT_FOUND: return -ENOTTY; | |
80 | case MEI_CL_CONN_ALREADY_STARTED: return -EBUSY; | |
81 | case MEI_CL_CONN_OUT_OF_RESOURCES: return -EBUSY; | |
82 | case MEI_CL_CONN_MESSAGE_SMALL: return -EINVAL; | |
71e117f2 | 83 | case MEI_CL_CONN_NOT_ALLOWED: return -EBUSY; |
285e2996 AU |
84 | default: return -EINVAL; |
85 | } | |
86 | } | |
87 | ||
98e70866 TW |
88 | /** |
89 | * mei_hbm_write_message - wrapper for sending hbm messages. | |
90 | * | |
91 | * @dev: mei device | |
92 | * @hdr: mei header | |
93 | * @data: payload | |
94 | */ | |
95 | static inline int mei_hbm_write_message(struct mei_device *dev, | |
96 | struct mei_msg_hdr *hdr, | |
97 | const void *data) | |
98 | { | |
99 | return mei_write_message(dev, hdr, sizeof(*hdr), data, hdr->length); | |
100 | } | |
101 | ||
84b3294a TW |
102 | /** |
103 | * mei_hbm_idle - set hbm to idle state | |
104 | * | |
105 | * @dev: the device structure | |
106 | */ | |
107 | void mei_hbm_idle(struct mei_device *dev) | |
108 | { | |
109 | dev->init_clients_timer = 0; | |
110 | dev->hbm_state = MEI_HBM_IDLE; | |
111 | } | |
112 | ||
25ca6472 TW |
113 | /** |
114 | * mei_hbm_reset - reset hbm counters and book keeping data structurs | |
115 | * | |
116 | * @dev: the device structure | |
117 | */ | |
118 | void mei_hbm_reset(struct mei_device *dev) | |
119 | { | |
79563db9 | 120 | mei_me_cl_rm_all(dev); |
84b3294a TW |
121 | |
122 | mei_hbm_idle(dev); | |
123 | } | |
124 | ||
2190fe2a TW |
125 | /** |
126 | * mei_hbm_hdr - construct hbm header | |
127 | * | |
0cd7c01a | 128 | * @mei_hdr: hbm header |
2190fe2a TW |
129 | * @length: payload length |
130 | */ | |
131 | ||
0cd7c01a | 132 | static inline void mei_hbm_hdr(struct mei_msg_hdr *mei_hdr, size_t length) |
2190fe2a | 133 | { |
0cd7c01a TW |
134 | memset(mei_hdr, 0, sizeof(*mei_hdr)); |
135 | mei_hdr->length = length; | |
136 | mei_hdr->msg_complete = 1; | |
2190fe2a TW |
137 | } |
138 | ||
cd51ed64 TW |
139 | /** |
140 | * mei_hbm_cl_hdr - construct client hbm header | |
393b148f | 141 | * |
68d1aa65 | 142 | * @cl: client |
cd51ed64 TW |
143 | * @hbm_cmd: host bus message command |
144 | * @buf: buffer for cl header | |
145 | * @len: buffer length | |
146 | */ | |
147 | static inline | |
148 | void mei_hbm_cl_hdr(struct mei_cl *cl, u8 hbm_cmd, void *buf, size_t len) | |
149 | { | |
150 | struct mei_hbm_cl_cmd *cmd = buf; | |
151 | ||
152 | memset(cmd, 0, len); | |
153 | ||
154 | cmd->hbm_cmd = hbm_cmd; | |
1df629ef | 155 | cmd->host_addr = mei_cl_host_addr(cl); |
d49ed64a | 156 | cmd->me_addr = mei_cl_me_id(cl); |
cd51ed64 TW |
157 | } |
158 | ||
68d1aa65 TW |
159 | /** |
160 | * mei_hbm_cl_write - write simple hbm client message | |
161 | * | |
162 | * @dev: the device structure | |
163 | * @cl: client | |
164 | * @hbm_cmd: host bus message command | |
041330d9 | 165 | * @buf: message buffer |
68d1aa65 | 166 | * @len: buffer length |
ce23139c AU |
167 | * |
168 | * Return: 0 on success, <0 on failure. | |
68d1aa65 | 169 | */ |
3fcbab6c TW |
170 | static inline int mei_hbm_cl_write(struct mei_device *dev, struct mei_cl *cl, |
171 | u8 hbm_cmd, void *buf, size_t len) | |
68d1aa65 | 172 | { |
c0ff9019 | 173 | struct mei_msg_hdr mei_hdr; |
68d1aa65 | 174 | |
c0ff9019 AU |
175 | mei_hbm_hdr(&mei_hdr, len); |
176 | mei_hbm_cl_hdr(cl, hbm_cmd, buf, len); | |
68d1aa65 | 177 | |
98e70866 | 178 | return mei_hbm_write_message(dev, &mei_hdr, buf); |
68d1aa65 TW |
179 | } |
180 | ||
cd51ed64 | 181 | /** |
2af89db1 TW |
182 | * mei_hbm_cl_addr_equal - check if the client's and |
183 | * the message address match | |
cd51ed64 | 184 | * |
2af89db1 TW |
185 | * @cl: client |
186 | * @cmd: hbm client message | |
cd51ed64 | 187 | * |
a8605ea2 | 188 | * Return: true if addresses are the same |
cd51ed64 TW |
189 | */ |
190 | static inline | |
2af89db1 | 191 | bool mei_hbm_cl_addr_equal(struct mei_cl *cl, struct mei_hbm_cl_cmd *cmd) |
cd51ed64 | 192 | { |
1df629ef | 193 | return mei_cl_host_addr(cl) == cmd->host_addr && |
d49ed64a | 194 | mei_cl_me_id(cl) == cmd->me_addr; |
cd51ed64 TW |
195 | } |
196 | ||
2af89db1 TW |
197 | /** |
198 | * mei_hbm_cl_find_by_cmd - find recipient client | |
199 | * | |
200 | * @dev: the device structure | |
201 | * @buf: a buffer with hbm cl command | |
202 | * | |
a8605ea2 | 203 | * Return: the recipient client or NULL if not found |
2af89db1 TW |
204 | */ |
205 | static inline | |
206 | struct mei_cl *mei_hbm_cl_find_by_cmd(struct mei_device *dev, void *buf) | |
207 | { | |
208 | struct mei_hbm_cl_cmd *cmd = (struct mei_hbm_cl_cmd *)buf; | |
209 | struct mei_cl *cl; | |
210 | ||
211 | list_for_each_entry(cl, &dev->file_list, link) | |
212 | if (mei_hbm_cl_addr_equal(cl, cmd)) | |
213 | return cl; | |
214 | return NULL; | |
215 | } | |
216 | ||
217 | ||
cb02efc3 AU |
218 | /** |
219 | * mei_hbm_start_wait - wait for start response message. | |
220 | * | |
221 | * @dev: the device structure | |
222 | * | |
a8605ea2 | 223 | * Return: 0 on success and < 0 on failure |
cb02efc3 | 224 | */ |
9b0d5efc TW |
225 | int mei_hbm_start_wait(struct mei_device *dev) |
226 | { | |
227 | int ret; | |
cb02efc3 AU |
228 | |
229 | if (dev->hbm_state > MEI_HBM_STARTING) | |
9b0d5efc TW |
230 | return 0; |
231 | ||
232 | mutex_unlock(&dev->device_lock); | |
cb02efc3 AU |
233 | ret = wait_event_timeout(dev->wait_hbm_start, |
234 | dev->hbm_state != MEI_HBM_STARTING, | |
7d93e58d | 235 | mei_secs_to_jiffies(MEI_HBM_TIMEOUT)); |
9b0d5efc TW |
236 | mutex_lock(&dev->device_lock); |
237 | ||
cb02efc3 | 238 | if (ret == 0 && (dev->hbm_state <= MEI_HBM_STARTING)) { |
9b0d5efc | 239 | dev->hbm_state = MEI_HBM_IDLE; |
2bf94cab | 240 | dev_err(dev->dev, "waiting for mei start failed\n"); |
7ca96aa2 | 241 | return -ETIME; |
9b0d5efc TW |
242 | } |
243 | return 0; | |
244 | } | |
245 | ||
bb1b0133 | 246 | /** |
8120e720 | 247 | * mei_hbm_start_req - sends start request message. |
bb1b0133 TW |
248 | * |
249 | * @dev: the device structure | |
544f9460 | 250 | * |
a8605ea2 | 251 | * Return: 0 on success and < 0 on failure |
bb1b0133 | 252 | */ |
9b0d5efc | 253 | int mei_hbm_start_req(struct mei_device *dev) |
bb1b0133 | 254 | { |
c0ff9019 | 255 | struct mei_msg_hdr mei_hdr; |
df4b37bc | 256 | struct hbm_host_version_request req; |
544f9460 | 257 | int ret; |
bb1b0133 | 258 | |
5ca2d388 TW |
259 | mei_hbm_reset(dev); |
260 | ||
df4b37bc | 261 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
bb1b0133 TW |
262 | |
263 | /* host start message */ | |
df4b37bc TW |
264 | memset(&req, 0, sizeof(req)); |
265 | req.hbm_cmd = HOST_START_REQ_CMD; | |
266 | req.host_version.major_version = HBM_MAJOR_VERSION; | |
267 | req.host_version.minor_version = HBM_MINOR_VERSION; | |
bb1b0133 | 268 | |
9b0d5efc | 269 | dev->hbm_state = MEI_HBM_IDLE; |
df4b37bc | 270 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
544f9460 | 271 | if (ret) { |
2bf94cab | 272 | dev_err(dev->dev, "version message write failed: ret = %d\n", |
544f9460 TW |
273 | ret); |
274 | return ret; | |
bb1b0133 | 275 | } |
544f9460 | 276 | |
cb02efc3 | 277 | dev->hbm_state = MEI_HBM_STARTING; |
bb1b0133 | 278 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; |
1892fc2e | 279 | mei_schedule_stall_timer(dev); |
9b0d5efc | 280 | return 0; |
bb1b0133 TW |
281 | } |
282 | ||
c55bf542 TW |
283 | /** |
284 | * mei_hbm_dma_setup_req() - setup DMA request | |
285 | * @dev: the device structure | |
286 | * | |
287 | * Return: 0 on success and < 0 on failure | |
288 | */ | |
289 | static int mei_hbm_dma_setup_req(struct mei_device *dev) | |
290 | { | |
291 | struct mei_msg_hdr mei_hdr; | |
292 | struct hbm_dma_setup_request req; | |
c55bf542 TW |
293 | unsigned int i; |
294 | int ret; | |
295 | ||
df4b37bc | 296 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
c55bf542 | 297 | |
df4b37bc | 298 | memset(&req, 0, sizeof(req)); |
c55bf542 TW |
299 | req.hbm_cmd = MEI_HBM_DMA_SETUP_REQ_CMD; |
300 | for (i = 0; i < DMA_DSCR_NUM; i++) { | |
301 | phys_addr_t paddr; | |
302 | ||
303 | paddr = dev->dr_dscr[i].daddr; | |
304 | req.dma_dscr[i].addr_hi = upper_32_bits(paddr); | |
305 | req.dma_dscr[i].addr_lo = lower_32_bits(paddr); | |
306 | req.dma_dscr[i].size = dev->dr_dscr[i].size; | |
307 | } | |
308 | ||
2513eb0d TW |
309 | mei_dma_ring_reset(dev); |
310 | ||
c55bf542 TW |
311 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
312 | if (ret) { | |
313 | dev_err(dev->dev, "dma setup request write failed: ret = %d.\n", | |
314 | ret); | |
315 | return ret; | |
316 | } | |
317 | ||
318 | dev->hbm_state = MEI_HBM_DR_SETUP; | |
319 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; | |
320 | mei_schedule_stall_timer(dev); | |
321 | return 0; | |
322 | } | |
323 | ||
e5cab1f9 AU |
324 | /** |
325 | * mei_hbm_capabilities_req - request capabilities | |
326 | * | |
327 | * @dev: the device structure | |
328 | * | |
329 | * Return: 0 on success and < 0 on failure | |
330 | */ | |
331 | static int mei_hbm_capabilities_req(struct mei_device *dev) | |
332 | { | |
333 | struct mei_msg_hdr mei_hdr; | |
334 | struct hbm_capability_request req; | |
335 | int ret; | |
336 | ||
337 | mei_hbm_hdr(&mei_hdr, sizeof(req)); | |
338 | ||
339 | memset(&req, 0, sizeof(req)); | |
340 | req.hbm_cmd = MEI_HBM_CAPABILITIES_REQ_CMD; | |
beb4e1e5 AU |
341 | if (dev->hbm_f_vt_supported) |
342 | req.capability_requested[0] = HBM_CAP_VT; | |
e5cab1f9 AU |
343 | |
344 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); | |
345 | if (ret) { | |
346 | dev_err(dev->dev, | |
347 | "capabilities request write failed: ret = %d.\n", ret); | |
348 | return ret; | |
349 | } | |
350 | ||
351 | dev->hbm_state = MEI_HBM_CAP_SETUP; | |
352 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; | |
353 | mei_schedule_stall_timer(dev); | |
354 | return 0; | |
355 | } | |
356 | ||
99c2658f | 357 | /** |
8120e720 | 358 | * mei_hbm_enum_clients_req - sends enumeration client request message. |
bb1b0133 TW |
359 | * |
360 | * @dev: the device structure | |
361 | * | |
a8605ea2 | 362 | * Return: 0 on success and < 0 on failure |
bb1b0133 | 363 | */ |
544f9460 | 364 | static int mei_hbm_enum_clients_req(struct mei_device *dev) |
bb1b0133 | 365 | { |
c0ff9019 | 366 | struct mei_msg_hdr mei_hdr; |
df4b37bc | 367 | struct hbm_host_enum_request req; |
544f9460 TW |
368 | int ret; |
369 | ||
bb1b0133 | 370 | /* enumerate clients */ |
df4b37bc | 371 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
bb1b0133 | 372 | |
df4b37bc TW |
373 | memset(&req, 0, sizeof(req)); |
374 | req.hbm_cmd = HOST_ENUM_REQ_CMD; | |
375 | req.flags |= dev->hbm_f_dc_supported ? MEI_HBM_ENUM_F_ALLOW_ADD : 0; | |
376 | req.flags |= dev->hbm_f_ie_supported ? | |
c0ff9019 | 377 | MEI_HBM_ENUM_F_IMMEDIATE_ENUM : 0; |
bb1b0133 | 378 | |
df4b37bc | 379 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
544f9460 | 380 | if (ret) { |
2bf94cab | 381 | dev_err(dev->dev, "enumeration request write failed: ret = %d.\n", |
544f9460 TW |
382 | ret); |
383 | return ret; | |
bb1b0133 | 384 | } |
9b0d5efc | 385 | dev->hbm_state = MEI_HBM_ENUM_CLIENTS; |
bb1b0133 | 386 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; |
1892fc2e | 387 | mei_schedule_stall_timer(dev); |
544f9460 | 388 | return 0; |
bb1b0133 TW |
389 | } |
390 | ||
99c2658f | 391 | /** |
5ca2d388 TW |
392 | * mei_hbm_me_cl_add - add new me client to the list |
393 | * | |
394 | * @dev: the device structure | |
395 | * @res: hbm property response | |
396 | * | |
a8605ea2 | 397 | * Return: 0 on success and -ENOMEM on allocation failure |
5ca2d388 TW |
398 | */ |
399 | ||
400 | static int mei_hbm_me_cl_add(struct mei_device *dev, | |
401 | struct hbm_props_response *res) | |
402 | { | |
403 | struct mei_me_client *me_cl; | |
79563db9 TW |
404 | const uuid_le *uuid = &res->client_properties.protocol_name; |
405 | ||
406 | mei_me_cl_rm_by_uuid(dev, uuid); | |
5ca2d388 | 407 | |
df4b37bc | 408 | me_cl = kzalloc(sizeof(*me_cl), GFP_KERNEL); |
5ca2d388 TW |
409 | if (!me_cl) |
410 | return -ENOMEM; | |
411 | ||
79563db9 TW |
412 | mei_me_cl_init(me_cl); |
413 | ||
5ca2d388 TW |
414 | me_cl->props = res->client_properties; |
415 | me_cl->client_id = res->me_addr; | |
4034b81b | 416 | me_cl->tx_flow_ctrl_creds = 0; |
5ca2d388 | 417 | |
b7d88514 TW |
418 | mei_me_cl_add(dev, me_cl); |
419 | ||
5ca2d388 TW |
420 | return 0; |
421 | } | |
422 | ||
70ef835c TW |
423 | /** |
424 | * mei_hbm_add_cl_resp - send response to fw on client add request | |
425 | * | |
426 | * @dev: the device structure | |
427 | * @addr: me address | |
428 | * @status: response status | |
429 | * | |
430 | * Return: 0 on success and < 0 on failure | |
431 | */ | |
432 | static int mei_hbm_add_cl_resp(struct mei_device *dev, u8 addr, u8 status) | |
433 | { | |
c0ff9019 AU |
434 | struct mei_msg_hdr mei_hdr; |
435 | struct hbm_add_client_response resp; | |
70ef835c TW |
436 | int ret; |
437 | ||
438 | dev_dbg(dev->dev, "adding client response\n"); | |
439 | ||
df4b37bc | 440 | mei_hbm_hdr(&mei_hdr, sizeof(resp)); |
70ef835c | 441 | |
df4b37bc | 442 | memset(&resp, 0, sizeof(resp)); |
c0ff9019 AU |
443 | resp.hbm_cmd = MEI_HBM_ADD_CLIENT_RES_CMD; |
444 | resp.me_addr = addr; | |
445 | resp.status = status; | |
70ef835c | 446 | |
98e70866 | 447 | ret = mei_hbm_write_message(dev, &mei_hdr, &resp); |
70ef835c TW |
448 | if (ret) |
449 | dev_err(dev->dev, "add client response write failed: ret = %d\n", | |
450 | ret); | |
451 | return ret; | |
452 | } | |
453 | ||
454 | /** | |
455 | * mei_hbm_fw_add_cl_req - request from the fw to add a client | |
456 | * | |
457 | * @dev: the device structure | |
458 | * @req: add client request | |
459 | * | |
460 | * Return: 0 on success and < 0 on failure | |
461 | */ | |
462 | static int mei_hbm_fw_add_cl_req(struct mei_device *dev, | |
463 | struct hbm_add_client_request *req) | |
464 | { | |
465 | int ret; | |
466 | u8 status = MEI_HBMS_SUCCESS; | |
467 | ||
468 | BUILD_BUG_ON(sizeof(struct hbm_add_client_request) != | |
469 | sizeof(struct hbm_props_response)); | |
470 | ||
471 | ret = mei_hbm_me_cl_add(dev, (struct hbm_props_response *)req); | |
472 | if (ret) | |
473 | status = !MEI_HBMS_SUCCESS; | |
474 | ||
a816a00e AU |
475 | if (dev->dev_state == MEI_DEV_ENABLED) |
476 | schedule_work(&dev->bus_rescan_work); | |
477 | ||
70ef835c TW |
478 | return mei_hbm_add_cl_resp(dev, req->me_addr, status); |
479 | } | |
480 | ||
965ae37a TW |
481 | /** |
482 | * mei_hbm_cl_notify_req - send notification request | |
483 | * | |
484 | * @dev: the device structure | |
485 | * @cl: a client to disconnect from | |
486 | * @start: true for start false for stop | |
487 | * | |
488 | * Return: 0 on success and -EIO on write failure | |
489 | */ | |
490 | int mei_hbm_cl_notify_req(struct mei_device *dev, | |
491 | struct mei_cl *cl, u8 start) | |
492 | { | |
493 | ||
c0ff9019 AU |
494 | struct mei_msg_hdr mei_hdr; |
495 | struct hbm_notification_request req; | |
965ae37a TW |
496 | int ret; |
497 | ||
df4b37bc TW |
498 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
499 | mei_hbm_cl_hdr(cl, MEI_HBM_NOTIFY_REQ_CMD, &req, sizeof(req)); | |
965ae37a | 500 | |
c0ff9019 | 501 | req.start = start; |
965ae37a | 502 | |
98e70866 | 503 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
965ae37a TW |
504 | if (ret) |
505 | dev_err(dev->dev, "notify request failed: ret = %d\n", ret); | |
506 | ||
507 | return ret; | |
508 | } | |
509 | ||
510 | /** | |
511 | * notify_res_to_fop - convert notification response to the proper | |
512 | * notification FOP | |
513 | * | |
514 | * @cmd: client notification start response command | |
515 | * | |
516 | * Return: MEI_FOP_NOTIFY_START or MEI_FOP_NOTIFY_STOP; | |
517 | */ | |
518 | static inline enum mei_cb_file_ops notify_res_to_fop(struct mei_hbm_cl_cmd *cmd) | |
519 | { | |
520 | struct hbm_notification_response *rs = | |
521 | (struct hbm_notification_response *)cmd; | |
522 | ||
51678ccb | 523 | return mei_cl_notify_req2fop(rs->start); |
965ae37a TW |
524 | } |
525 | ||
526 | /** | |
527 | * mei_hbm_cl_notify_start_res - update the client state according | |
528 | * notify start response | |
529 | * | |
530 | * @dev: the device structure | |
531 | * @cl: mei host client | |
532 | * @cmd: client notification start response command | |
533 | */ | |
534 | static void mei_hbm_cl_notify_start_res(struct mei_device *dev, | |
535 | struct mei_cl *cl, | |
536 | struct mei_hbm_cl_cmd *cmd) | |
537 | { | |
538 | struct hbm_notification_response *rs = | |
539 | (struct hbm_notification_response *)cmd; | |
540 | ||
541 | cl_dbg(dev, cl, "hbm: notify start response status=%d\n", rs->status); | |
542 | ||
543 | if (rs->status == MEI_HBMS_SUCCESS || | |
544 | rs->status == MEI_HBMS_ALREADY_STARTED) { | |
545 | cl->notify_en = true; | |
546 | cl->status = 0; | |
547 | } else { | |
548 | cl->status = -EINVAL; | |
549 | } | |
550 | } | |
551 | ||
552 | /** | |
553 | * mei_hbm_cl_notify_stop_res - update the client state according | |
554 | * notify stop response | |
555 | * | |
556 | * @dev: the device structure | |
557 | * @cl: mei host client | |
558 | * @cmd: client notification stop response command | |
559 | */ | |
560 | static void mei_hbm_cl_notify_stop_res(struct mei_device *dev, | |
561 | struct mei_cl *cl, | |
562 | struct mei_hbm_cl_cmd *cmd) | |
563 | { | |
564 | struct hbm_notification_response *rs = | |
565 | (struct hbm_notification_response *)cmd; | |
566 | ||
567 | cl_dbg(dev, cl, "hbm: notify stop response status=%d\n", rs->status); | |
568 | ||
569 | if (rs->status == MEI_HBMS_SUCCESS || | |
570 | rs->status == MEI_HBMS_NOT_STARTED) { | |
571 | cl->notify_en = false; | |
572 | cl->status = 0; | |
573 | } else { | |
574 | /* TODO: spec is not clear yet about other possible issues */ | |
575 | cl->status = -EINVAL; | |
576 | } | |
577 | } | |
578 | ||
579 | /** | |
580 | * mei_hbm_cl_notify - signal notification event | |
581 | * | |
582 | * @dev: the device structure | |
583 | * @cmd: notification client message | |
584 | */ | |
585 | static void mei_hbm_cl_notify(struct mei_device *dev, | |
586 | struct mei_hbm_cl_cmd *cmd) | |
587 | { | |
588 | struct mei_cl *cl; | |
589 | ||
590 | cl = mei_hbm_cl_find_by_cmd(dev, cmd); | |
237092bf TW |
591 | if (cl) |
592 | mei_cl_notify(cl); | |
965ae37a TW |
593 | } |
594 | ||
8120e720 | 595 | /** |
393b148f | 596 | * mei_hbm_prop_req - request property for a single client |
8120e720 TW |
597 | * |
598 | * @dev: the device structure | |
cc25aa94 | 599 | * @start_idx: client index to start search |
8120e720 | 600 | * |
a8605ea2 | 601 | * Return: 0 on success and < 0 on failure |
8120e720 | 602 | */ |
cc25aa94 | 603 | static int mei_hbm_prop_req(struct mei_device *dev, unsigned long start_idx) |
bb1b0133 | 604 | { |
c0ff9019 | 605 | struct mei_msg_hdr mei_hdr; |
df4b37bc | 606 | struct hbm_props_request req; |
cc25aa94 | 607 | unsigned long addr; |
544f9460 | 608 | int ret; |
bb1b0133 | 609 | |
cc25aa94 | 610 | addr = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, start_idx); |
bb1b0133 TW |
611 | |
612 | /* We got all client properties */ | |
cc25aa94 | 613 | if (addr == MEI_CLIENTS_MAX) { |
9b0d5efc | 614 | dev->hbm_state = MEI_HBM_STARTED; |
025fb792 | 615 | mei_host_client_init(dev); |
bb1b0133 TW |
616 | return 0; |
617 | } | |
618 | ||
df4b37bc | 619 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
bb1b0133 | 620 | |
df4b37bc | 621 | memset(&req, 0, sizeof(req)); |
bb1b0133 | 622 | |
df4b37bc TW |
623 | req.hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD; |
624 | req.me_addr = addr; | |
bb1b0133 | 625 | |
df4b37bc | 626 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
544f9460 | 627 | if (ret) { |
2bf94cab | 628 | dev_err(dev->dev, "properties request write failed: ret = %d\n", |
544f9460 TW |
629 | ret); |
630 | return ret; | |
bb1b0133 TW |
631 | } |
632 | ||
633 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; | |
1892fc2e | 634 | mei_schedule_stall_timer(dev); |
bb1b0133 TW |
635 | |
636 | return 0; | |
637 | } | |
638 | ||
99c2658f | 639 | /** |
4fcbc99b TW |
640 | * mei_hbm_pg - sends pg command |
641 | * | |
642 | * @dev: the device structure | |
643 | * @pg_cmd: the pg command code | |
644 | * | |
a8605ea2 | 645 | * Return: -EIO on write failure |
bae1cc7d | 646 | * -EOPNOTSUPP if the operation is not supported by the protocol |
4fcbc99b TW |
647 | */ |
648 | int mei_hbm_pg(struct mei_device *dev, u8 pg_cmd) | |
649 | { | |
c0ff9019 AU |
650 | struct mei_msg_hdr mei_hdr; |
651 | struct hbm_power_gate req; | |
4fcbc99b TW |
652 | int ret; |
653 | ||
bae1cc7d TW |
654 | if (!dev->hbm_f_pg_supported) |
655 | return -EOPNOTSUPP; | |
656 | ||
df4b37bc | 657 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
4fcbc99b | 658 | |
df4b37bc | 659 | memset(&req, 0, sizeof(req)); |
c0ff9019 | 660 | req.hbm_cmd = pg_cmd; |
4fcbc99b | 661 | |
98e70866 | 662 | ret = mei_hbm_write_message(dev, &mei_hdr, &req); |
4fcbc99b | 663 | if (ret) |
2bf94cab | 664 | dev_err(dev->dev, "power gate command write failed.\n"); |
4fcbc99b TW |
665 | return ret; |
666 | } | |
667 | EXPORT_SYMBOL_GPL(mei_hbm_pg); | |
668 | ||
e46f1874 | 669 | /** |
6bb948c9 | 670 | * mei_hbm_stop_req - send stop request message |
e46f1874 | 671 | * |
a8605ea2 | 672 | * @dev: mei device |
6bb948c9 | 673 | * |
a8605ea2 | 674 | * Return: -EIO on write failure |
e46f1874 | 675 | */ |
6bb948c9 | 676 | static int mei_hbm_stop_req(struct mei_device *dev) |
e46f1874 | 677 | { |
c0ff9019 AU |
678 | struct mei_msg_hdr mei_hdr; |
679 | struct hbm_host_stop_request req; | |
e46f1874 | 680 | |
df4b37bc | 681 | mei_hbm_hdr(&mei_hdr, sizeof(req)); |
e46f1874 | 682 | |
df4b37bc | 683 | memset(&req, 0, sizeof(req)); |
c0ff9019 AU |
684 | req.hbm_cmd = HOST_STOP_REQ_CMD; |
685 | req.reason = DRIVER_STOP_REQUEST; | |
6bb948c9 | 686 | |
98e70866 | 687 | return mei_hbm_write_message(dev, &mei_hdr, &req); |
e46f1874 TW |
688 | } |
689 | ||
bb1b0133 | 690 | /** |
83ce0741 | 691 | * mei_hbm_cl_flow_control_req - sends flow control request. |
bb1b0133 TW |
692 | * |
693 | * @dev: the device structure | |
8120e720 | 694 | * @cl: client info |
bb1b0133 | 695 | * |
a8605ea2 | 696 | * Return: -EIO on write failure |
bb1b0133 | 697 | */ |
8120e720 | 698 | int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl) |
bb1b0133 | 699 | { |
3fcbab6c | 700 | struct hbm_flow_control req; |
92db1555 | 701 | |
46922186 | 702 | cl_dbg(dev, cl, "sending flow control\n"); |
3fcbab6c TW |
703 | return mei_hbm_cl_write(dev, cl, MEI_FLOW_CONTROL_CMD, |
704 | &req, sizeof(req)); | |
bb1b0133 TW |
705 | } |
706 | ||
6bbda15f | 707 | /** |
4034b81b | 708 | * mei_hbm_add_single_tx_flow_ctrl_creds - adds single buffer credentials. |
6bbda15f | 709 | * |
393b148f | 710 | * @dev: the device structure |
4034b81b | 711 | * @fctrl: flow control response bus message |
12d00665 | 712 | * |
a8605ea2 | 713 | * Return: 0 on success, < 0 otherwise |
6bbda15f | 714 | */ |
4034b81b TW |
715 | static int mei_hbm_add_single_tx_flow_ctrl_creds(struct mei_device *dev, |
716 | struct hbm_flow_control *fctrl) | |
6bbda15f | 717 | { |
12d00665 | 718 | struct mei_me_client *me_cl; |
79563db9 | 719 | int rets; |
12d00665 | 720 | |
4034b81b | 721 | me_cl = mei_me_cl_by_id(dev, fctrl->me_addr); |
d320832f | 722 | if (!me_cl) { |
4034b81b | 723 | dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr); |
d320832f | 724 | return -ENOENT; |
12d00665 AU |
725 | } |
726 | ||
79563db9 TW |
727 | if (WARN_ON(me_cl->props.single_recv_buf == 0)) { |
728 | rets = -EINVAL; | |
729 | goto out; | |
730 | } | |
d320832f | 731 | |
4034b81b | 732 | me_cl->tx_flow_ctrl_creds++; |
2bf94cab | 733 | dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", |
4034b81b | 734 | fctrl->me_addr, me_cl->tx_flow_ctrl_creds); |
12d00665 | 735 | |
79563db9 TW |
736 | rets = 0; |
737 | out: | |
738 | mei_me_cl_put(me_cl); | |
739 | return rets; | |
6bbda15f TW |
740 | } |
741 | ||
742 | /** | |
743 | * mei_hbm_cl_flow_control_res - flow control response from me | |
744 | * | |
745 | * @dev: the device structure | |
4034b81b | 746 | * @fctrl: flow control response bus message |
6bbda15f | 747 | */ |
4034b81b TW |
748 | static void mei_hbm_cl_tx_flow_ctrl_creds_res(struct mei_device *dev, |
749 | struct hbm_flow_control *fctrl) | |
6bbda15f | 750 | { |
31f88f57 | 751 | struct mei_cl *cl; |
6bbda15f | 752 | |
4034b81b | 753 | if (!fctrl->host_addr) { |
6bbda15f | 754 | /* single receive buffer */ |
4034b81b | 755 | mei_hbm_add_single_tx_flow_ctrl_creds(dev, fctrl); |
6bbda15f TW |
756 | return; |
757 | } | |
758 | ||
4034b81b | 759 | cl = mei_hbm_cl_find_by_cmd(dev, fctrl); |
2af89db1 | 760 | if (cl) { |
4034b81b | 761 | cl->tx_flow_ctrl_creds++; |
2af89db1 | 762 | cl_dbg(dev, cl, "flow control creds = %d.\n", |
4034b81b | 763 | cl->tx_flow_ctrl_creds); |
6bbda15f TW |
764 | } |
765 | } | |
766 | ||
767 | ||
bb1b0133 | 768 | /** |
8120e720 | 769 | * mei_hbm_cl_disconnect_req - sends disconnect message to fw. |
bb1b0133 TW |
770 | * |
771 | * @dev: the device structure | |
8120e720 | 772 | * @cl: a client to disconnect from |
bb1b0133 | 773 | * |
a8605ea2 | 774 | * Return: -EIO on write failure |
bb1b0133 | 775 | */ |
8120e720 | 776 | int mei_hbm_cl_disconnect_req(struct mei_device *dev, struct mei_cl *cl) |
bb1b0133 | 777 | { |
3fcbab6c | 778 | struct hbm_client_connect_request req; |
92db1555 | 779 | |
3fcbab6c TW |
780 | return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_REQ_CMD, |
781 | &req, sizeof(req)); | |
bb1b0133 TW |
782 | } |
783 | ||
6bb948c9 TW |
784 | /** |
785 | * mei_hbm_cl_disconnect_rsp - sends disconnect respose to the FW | |
786 | * | |
787 | * @dev: the device structure | |
788 | * @cl: a client to disconnect from | |
789 | * | |
a8605ea2 | 790 | * Return: -EIO on write failure |
6bb948c9 TW |
791 | */ |
792 | int mei_hbm_cl_disconnect_rsp(struct mei_device *dev, struct mei_cl *cl) | |
793 | { | |
3fcbab6c | 794 | struct hbm_client_connect_response resp; |
92db1555 | 795 | |
3fcbab6c TW |
796 | return mei_hbm_cl_write(dev, cl, CLIENT_DISCONNECT_RES_CMD, |
797 | &resp, sizeof(resp)); | |
6bb948c9 TW |
798 | } |
799 | ||
6bbda15f | 800 | /** |
12f45ed4 TW |
801 | * mei_hbm_cl_disconnect_res - update the client state according |
802 | * disconnect response | |
6bbda15f | 803 | * |
d512c209 | 804 | * @dev: the device structure |
12f45ed4 TW |
805 | * @cl: mei host client |
806 | * @cmd: disconnect client response host bus message | |
6bbda15f | 807 | */ |
d512c209 | 808 | static void mei_hbm_cl_disconnect_res(struct mei_device *dev, struct mei_cl *cl, |
12f45ed4 | 809 | struct mei_hbm_cl_cmd *cmd) |
6bbda15f | 810 | { |
12f45ed4 TW |
811 | struct hbm_client_connect_response *rs = |
812 | (struct hbm_client_connect_response *)cmd; | |
6bbda15f | 813 | |
d512c209 | 814 | cl_dbg(dev, cl, "hbm: disconnect response status=%d\n", rs->status); |
6bbda15f | 815 | |
12f45ed4 | 816 | if (rs->status == MEI_CL_DISCONN_SUCCESS) |
3c666182 | 817 | cl->state = MEI_FILE_DISCONNECT_REPLY; |
12f45ed4 | 818 | cl->status = 0; |
6bbda15f TW |
819 | } |
820 | ||
bb1b0133 | 821 | /** |
8120e720 | 822 | * mei_hbm_cl_connect_req - send connection request to specific me client |
bb1b0133 TW |
823 | * |
824 | * @dev: the device structure | |
8120e720 | 825 | * @cl: a client to connect to |
bb1b0133 | 826 | * |
a8605ea2 | 827 | * Return: -EIO on write failure |
bb1b0133 | 828 | */ |
8120e720 | 829 | int mei_hbm_cl_connect_req(struct mei_device *dev, struct mei_cl *cl) |
bb1b0133 | 830 | { |
3fcbab6c | 831 | struct hbm_client_connect_request req; |
92db1555 | 832 | |
3fcbab6c TW |
833 | return mei_hbm_cl_write(dev, cl, CLIENT_CONNECT_REQ_CMD, |
834 | &req, sizeof(req)); | |
bb1b0133 TW |
835 | } |
836 | ||
6bbda15f | 837 | /** |
12f45ed4 TW |
838 | * mei_hbm_cl_connect_res - update the client state according |
839 | * connection response | |
6bbda15f | 840 | * |
d512c209 | 841 | * @dev: the device structure |
12f45ed4 TW |
842 | * @cl: mei host client |
843 | * @cmd: connect client response host bus message | |
6bbda15f | 844 | */ |
d512c209 | 845 | static void mei_hbm_cl_connect_res(struct mei_device *dev, struct mei_cl *cl, |
12f45ed4 | 846 | struct mei_hbm_cl_cmd *cmd) |
6bbda15f | 847 | { |
12f45ed4 TW |
848 | struct hbm_client_connect_response *rs = |
849 | (struct hbm_client_connect_response *)cmd; | |
6bbda15f | 850 | |
d512c209 | 851 | cl_dbg(dev, cl, "hbm: connect response status=%s\n", |
285e2996 | 852 | mei_cl_conn_status_str(rs->status)); |
6bbda15f | 853 | |
12f45ed4 TW |
854 | if (rs->status == MEI_CL_CONN_SUCCESS) |
855 | cl->state = MEI_FILE_CONNECTED; | |
70ef835c | 856 | else { |
3c666182 | 857 | cl->state = MEI_FILE_DISCONNECT_REPLY; |
a816a00e | 858 | if (rs->status == MEI_CL_CONN_NOT_FOUND) { |
70ef835c | 859 | mei_me_cl_del(dev, cl->me_cl); |
a816a00e AU |
860 | if (dev->dev_state == MEI_DEV_ENABLED) |
861 | schedule_work(&dev->bus_rescan_work); | |
862 | } | |
70ef835c | 863 | } |
12f45ed4 TW |
864 | cl->status = mei_cl_conn_status_to_errno(rs->status); |
865 | } | |
866 | ||
867 | /** | |
868 | * mei_hbm_cl_res - process hbm response received on behalf | |
869 | * an client | |
870 | * | |
871 | * @dev: the device structure | |
872 | * @rs: hbm client message | |
873 | * @fop_type: file operation type | |
874 | */ | |
875 | static void mei_hbm_cl_res(struct mei_device *dev, | |
876 | struct mei_hbm_cl_cmd *rs, | |
877 | enum mei_cb_file_ops fop_type) | |
878 | { | |
879 | struct mei_cl *cl; | |
880 | struct mei_cl_cb *cb, *next; | |
6bbda15f | 881 | |
12f45ed4 | 882 | cl = NULL; |
962ff7bc | 883 | list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list, list) { |
6bbda15f | 884 | |
64092858 | 885 | cl = cb->cl; |
6bbda15f | 886 | |
12f45ed4 | 887 | if (cb->fop_type != fop_type) |
64092858 | 888 | continue; |
6bbda15f | 889 | |
64092858 | 890 | if (mei_hbm_cl_addr_equal(cl, rs)) { |
928fa666 | 891 | list_del_init(&cb->list); |
64092858 | 892 | break; |
6bbda15f TW |
893 | } |
894 | } | |
64092858 TW |
895 | |
896 | if (!cl) | |
897 | return; | |
898 | ||
12f45ed4 TW |
899 | switch (fop_type) { |
900 | case MEI_FOP_CONNECT: | |
d512c209 | 901 | mei_hbm_cl_connect_res(dev, cl, rs); |
12f45ed4 TW |
902 | break; |
903 | case MEI_FOP_DISCONNECT: | |
d512c209 | 904 | mei_hbm_cl_disconnect_res(dev, cl, rs); |
12f45ed4 | 905 | break; |
965ae37a TW |
906 | case MEI_FOP_NOTIFY_START: |
907 | mei_hbm_cl_notify_start_res(dev, cl, rs); | |
908 | break; | |
909 | case MEI_FOP_NOTIFY_STOP: | |
910 | mei_hbm_cl_notify_stop_res(dev, cl, rs); | |
911 | break; | |
12f45ed4 TW |
912 | default: |
913 | return; | |
914 | } | |
915 | ||
64092858 | 916 | cl->timer_count = 0; |
12f45ed4 | 917 | wake_up(&cl->wait); |
6bbda15f TW |
918 | } |
919 | ||
920 | ||
bb1b0133 | 921 | /** |
83ce0741 AU |
922 | * mei_hbm_fw_disconnect_req - disconnect request initiated by ME firmware |
923 | * host sends disconnect response | |
bb1b0133 TW |
924 | * |
925 | * @dev: the device structure. | |
8120e720 | 926 | * @disconnect_req: disconnect request bus message from the me |
6bb948c9 | 927 | * |
a8605ea2 | 928 | * Return: -ENOMEM on allocation failure |
bb1b0133 | 929 | */ |
6bb948c9 | 930 | static int mei_hbm_fw_disconnect_req(struct mei_device *dev, |
bb1b0133 TW |
931 | struct hbm_client_connect_request *disconnect_req) |
932 | { | |
31f88f57 | 933 | struct mei_cl *cl; |
6bb948c9 | 934 | struct mei_cl_cb *cb; |
bb1b0133 | 935 | |
2af89db1 TW |
936 | cl = mei_hbm_cl_find_by_cmd(dev, disconnect_req); |
937 | if (cl) { | |
6938c192 | 938 | cl_warn(dev, cl, "fw disconnect request received\n"); |
3c666182 | 939 | cl->state = MEI_FILE_DISCONNECTING; |
2af89db1 TW |
940 | cl->timer_count = 0; |
941 | ||
3030dc05 TW |
942 | cb = mei_cl_enqueue_ctrl_wr_cb(cl, 0, MEI_FOP_DISCONNECT_RSP, |
943 | NULL); | |
2af89db1 TW |
944 | if (!cb) |
945 | return -ENOMEM; | |
bb1b0133 | 946 | } |
6bb948c9 | 947 | return 0; |
bb1b0133 TW |
948 | } |
949 | ||
63f75232 AU |
950 | /** |
951 | * mei_hbm_pg_enter_res - PG enter response received | |
952 | * | |
953 | * @dev: the device structure. | |
954 | * | |
955 | * Return: 0 on success, -EPROTO on state mismatch | |
956 | */ | |
957 | static int mei_hbm_pg_enter_res(struct mei_device *dev) | |
958 | { | |
959 | if (mei_pg_state(dev) != MEI_PG_OFF || | |
960 | dev->pg_event != MEI_PG_EVENT_WAIT) { | |
961 | dev_err(dev->dev, "hbm: pg entry response: state mismatch [%s, %d]\n", | |
962 | mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); | |
963 | return -EPROTO; | |
964 | } | |
965 | ||
966 | dev->pg_event = MEI_PG_EVENT_RECEIVED; | |
967 | wake_up(&dev->wait_pg); | |
968 | ||
969 | return 0; | |
970 | } | |
971 | ||
859ef2ff AU |
972 | /** |
973 | * mei_hbm_pg_resume - process with PG resume | |
974 | * | |
975 | * @dev: the device structure. | |
976 | */ | |
977 | void mei_hbm_pg_resume(struct mei_device *dev) | |
978 | { | |
979 | pm_request_resume(dev->dev); | |
980 | } | |
981 | EXPORT_SYMBOL_GPL(mei_hbm_pg_resume); | |
982 | ||
63f75232 AU |
983 | /** |
984 | * mei_hbm_pg_exit_res - PG exit response received | |
985 | * | |
986 | * @dev: the device structure. | |
987 | * | |
988 | * Return: 0 on success, -EPROTO on state mismatch | |
989 | */ | |
990 | static int mei_hbm_pg_exit_res(struct mei_device *dev) | |
991 | { | |
992 | if (mei_pg_state(dev) != MEI_PG_ON || | |
993 | (dev->pg_event != MEI_PG_EVENT_WAIT && | |
994 | dev->pg_event != MEI_PG_EVENT_IDLE)) { | |
995 | dev_err(dev->dev, "hbm: pg exit response: state mismatch [%s, %d]\n", | |
996 | mei_pg_state_str(mei_pg_state(dev)), dev->pg_event); | |
997 | return -EPROTO; | |
998 | } | |
999 | ||
1000 | switch (dev->pg_event) { | |
1001 | case MEI_PG_EVENT_WAIT: | |
1002 | dev->pg_event = MEI_PG_EVENT_RECEIVED; | |
1003 | wake_up(&dev->wait_pg); | |
1004 | break; | |
1005 | case MEI_PG_EVENT_IDLE: | |
1006 | /* | |
1007 | * If the driver is not waiting on this then | |
1008 | * this is HW initiated exit from PG. | |
1009 | * Start runtime pm resume sequence to exit from PG. | |
1010 | */ | |
1011 | dev->pg_event = MEI_PG_EVENT_RECEIVED; | |
859ef2ff | 1012 | mei_hbm_pg_resume(dev); |
63f75232 AU |
1013 | break; |
1014 | default: | |
1015 | WARN(1, "hbm: pg exit response: unexpected pg event = %d\n", | |
1016 | dev->pg_event); | |
1017 | return -EPROTO; | |
1018 | } | |
1019 | ||
1020 | return 0; | |
1021 | } | |
1022 | ||
bae1cc7d | 1023 | /** |
a8605ea2 | 1024 | * mei_hbm_config_features - check what hbm features and commands |
bae1cc7d TW |
1025 | * are supported by the fw |
1026 | * | |
1027 | * @dev: the device structure | |
1028 | */ | |
1029 | static void mei_hbm_config_features(struct mei_device *dev) | |
1030 | { | |
1031 | /* Power Gating Isolation Support */ | |
1032 | dev->hbm_f_pg_supported = 0; | |
1033 | if (dev->version.major_version > HBM_MAJOR_VERSION_PGI) | |
1034 | dev->hbm_f_pg_supported = 1; | |
1035 | ||
1036 | if (dev->version.major_version == HBM_MAJOR_VERSION_PGI && | |
1037 | dev->version.minor_version >= HBM_MINOR_VERSION_PGI) | |
1038 | dev->hbm_f_pg_supported = 1; | |
70ef835c | 1039 | |
37fd0b62 | 1040 | dev->hbm_f_dc_supported = 0; |
70ef835c TW |
1041 | if (dev->version.major_version >= HBM_MAJOR_VERSION_DC) |
1042 | dev->hbm_f_dc_supported = 1; | |
18901357 | 1043 | |
37fd0b62 | 1044 | dev->hbm_f_ie_supported = 0; |
27f476ea AU |
1045 | if (dev->version.major_version >= HBM_MAJOR_VERSION_IE) |
1046 | dev->hbm_f_ie_supported = 1; | |
1047 | ||
18901357 | 1048 | /* disconnect on connect timeout instead of link reset */ |
37fd0b62 | 1049 | dev->hbm_f_dot_supported = 0; |
18901357 AU |
1050 | if (dev->version.major_version >= HBM_MAJOR_VERSION_DOT) |
1051 | dev->hbm_f_dot_supported = 1; | |
4d99877d TW |
1052 | |
1053 | /* Notification Event Support */ | |
37fd0b62 | 1054 | dev->hbm_f_ev_supported = 0; |
4d99877d TW |
1055 | if (dev->version.major_version >= HBM_MAJOR_VERSION_EV) |
1056 | dev->hbm_f_ev_supported = 1; | |
f4e06246 AU |
1057 | |
1058 | /* Fixed Address Client Support */ | |
37fd0b62 | 1059 | dev->hbm_f_fa_supported = 0; |
f4e06246 AU |
1060 | if (dev->version.major_version >= HBM_MAJOR_VERSION_FA) |
1061 | dev->hbm_f_fa_supported = 1; | |
7ee7f45a AU |
1062 | |
1063 | /* OS ver message Support */ | |
37fd0b62 | 1064 | dev->hbm_f_os_supported = 0; |
7ee7f45a AU |
1065 | if (dev->version.major_version >= HBM_MAJOR_VERSION_OS) |
1066 | dev->hbm_f_os_supported = 1; | |
c2bd9fc1 TW |
1067 | |
1068 | /* DMA Ring Support */ | |
37fd0b62 | 1069 | dev->hbm_f_dr_supported = 0; |
c2bd9fc1 TW |
1070 | if (dev->version.major_version > HBM_MAJOR_VERSION_DR || |
1071 | (dev->version.major_version == HBM_MAJOR_VERSION_DR && | |
1072 | dev->version.minor_version >= HBM_MINOR_VERSION_DR)) | |
1073 | dev->hbm_f_dr_supported = 1; | |
e5cab1f9 | 1074 | |
beb4e1e5 AU |
1075 | /* VTag Support */ |
1076 | dev->hbm_f_vt_supported = 0; | |
1077 | if (dev->version.major_version > HBM_MAJOR_VERSION_VT || | |
1078 | (dev->version.major_version == HBM_MAJOR_VERSION_VT && | |
1079 | dev->version.minor_version >= HBM_MINOR_VERSION_VT)) | |
1080 | dev->hbm_f_vt_supported = 1; | |
1081 | ||
1082 | /* Capability message Support */ | |
e5cab1f9 AU |
1083 | dev->hbm_f_cap_supported = 0; |
1084 | if (dev->version.major_version > HBM_MAJOR_VERSION_CAP || | |
1085 | (dev->version.major_version == HBM_MAJOR_VERSION_CAP && | |
1086 | dev->version.minor_version >= HBM_MINOR_VERSION_CAP)) | |
1087 | dev->hbm_f_cap_supported = 1; | |
bae1cc7d | 1088 | } |
bb1b0133 | 1089 | |
2c9b48ac TW |
1090 | /** |
1091 | * mei_hbm_version_is_supported - checks whether the driver can | |
1092 | * support the hbm version of the device | |
1093 | * | |
1094 | * @dev: the device structure | |
a8605ea2 | 1095 | * Return: true if driver can support hbm version of the device |
2c9b48ac TW |
1096 | */ |
1097 | bool mei_hbm_version_is_supported(struct mei_device *dev) | |
1098 | { | |
1099 | return (dev->version.major_version < HBM_MAJOR_VERSION) || | |
1100 | (dev->version.major_version == HBM_MAJOR_VERSION && | |
1101 | dev->version.minor_version <= HBM_MINOR_VERSION); | |
1102 | } | |
1103 | ||
bb1b0133 TW |
1104 | /** |
1105 | * mei_hbm_dispatch - bottom half read routine after ISR to | |
1106 | * handle the read bus message cmd processing. | |
1107 | * | |
1108 | * @dev: the device structure | |
a8605ea2 | 1109 | * @hdr: header of bus message |
544f9460 | 1110 | * |
a8605ea2 | 1111 | * Return: 0 on success and < 0 on failure |
bb1b0133 | 1112 | */ |
544f9460 | 1113 | int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) |
bb1b0133 TW |
1114 | { |
1115 | struct mei_bus_message *mei_msg; | |
bb1b0133 | 1116 | struct hbm_host_version_response *version_res; |
bb1b0133 TW |
1117 | struct hbm_props_response *props_res; |
1118 | struct hbm_host_enum_response *enum_res; | |
c55bf542 | 1119 | struct hbm_dma_setup_response *dma_setup_res; |
70ef835c | 1120 | struct hbm_add_client_request *add_cl_req; |
beb4e1e5 | 1121 | struct hbm_capability_response *capability_res; |
70ef835c | 1122 | int ret; |
bb1b0133 | 1123 | |
12f45ed4 TW |
1124 | struct mei_hbm_cl_cmd *cl_cmd; |
1125 | struct hbm_client_connect_request *disconnect_req; | |
4034b81b | 1126 | struct hbm_flow_control *fctrl; |
12f45ed4 | 1127 | |
bb1b0133 TW |
1128 | /* read the message to our buffer */ |
1129 | BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); | |
1130 | mei_read_slots(dev, dev->rd_msg_buf, hdr->length); | |
1131 | mei_msg = (struct mei_bus_message *)dev->rd_msg_buf; | |
12f45ed4 | 1132 | cl_cmd = (struct mei_hbm_cl_cmd *)mei_msg; |
bb1b0133 | 1133 | |
66ae460b TW |
1134 | /* ignore spurious message and prevent reset nesting |
1135 | * hbm is put to idle during system reset | |
1136 | */ | |
1137 | if (dev->hbm_state == MEI_HBM_IDLE) { | |
2bf94cab | 1138 | dev_dbg(dev->dev, "hbm: state is idle ignore spurious messages\n"); |
66ae460b TW |
1139 | return 0; |
1140 | } | |
1141 | ||
bb1b0133 TW |
1142 | switch (mei_msg->hbm_cmd) { |
1143 | case HOST_START_RES_CMD: | |
2bf94cab | 1144 | dev_dbg(dev->dev, "hbm: start: response message received.\n"); |
544f9460 TW |
1145 | |
1146 | dev->init_clients_timer = 0; | |
1147 | ||
bb1b0133 | 1148 | version_res = (struct hbm_host_version_response *)mei_msg; |
2c9b48ac | 1149 | |
2bf94cab | 1150 | dev_dbg(dev->dev, "HBM VERSION: DRIVER=%02d:%02d DEVICE=%02d:%02d\n", |
2c9b48ac TW |
1151 | HBM_MAJOR_VERSION, HBM_MINOR_VERSION, |
1152 | version_res->me_max_version.major_version, | |
1153 | version_res->me_max_version.minor_version); | |
1154 | ||
1155 | if (version_res->host_version_supported) { | |
1156 | dev->version.major_version = HBM_MAJOR_VERSION; | |
1157 | dev->version.minor_version = HBM_MINOR_VERSION; | |
1158 | } else { | |
1159 | dev->version.major_version = | |
1160 | version_res->me_max_version.major_version; | |
1161 | dev->version.minor_version = | |
1162 | version_res->me_max_version.minor_version; | |
1163 | } | |
1164 | ||
1165 | if (!mei_hbm_version_is_supported(dev)) { | |
2bf94cab | 1166 | dev_warn(dev->dev, "hbm: start: version mismatch - stopping the driver.\n"); |
bb1b0133 | 1167 | |
544f9460 | 1168 | dev->hbm_state = MEI_HBM_STOPPED; |
6bb948c9 | 1169 | if (mei_hbm_stop_req(dev)) { |
2bf94cab | 1170 | dev_err(dev->dev, "hbm: start: failed to send stop request\n"); |
544f9460 TW |
1171 | return -EIO; |
1172 | } | |
1173 | break; | |
1174 | } | |
9b0d5efc | 1175 | |
bae1cc7d TW |
1176 | mei_hbm_config_features(dev); |
1177 | ||
544f9460 | 1178 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
cb02efc3 | 1179 | dev->hbm_state != MEI_HBM_STARTING) { |
2bf94cab | 1180 | dev_err(dev->dev, "hbm: start: state mismatch, [%d, %d]\n", |
544f9460 TW |
1181 | dev->dev_state, dev->hbm_state); |
1182 | return -EPROTO; | |
e46f1874 | 1183 | } |
bb1b0133 | 1184 | |
e5cab1f9 AU |
1185 | if (dev->hbm_f_cap_supported) { |
1186 | if (mei_hbm_capabilities_req(dev)) | |
1187 | return -EIO; | |
1188 | wake_up(&dev->wait_hbm_start); | |
1189 | break; | |
1190 | } | |
1191 | ||
c55bf542 TW |
1192 | if (dev->hbm_f_dr_supported) { |
1193 | if (mei_dmam_ring_alloc(dev)) | |
1194 | dev_info(dev->dev, "running w/o dma ring\n"); | |
1195 | if (mei_dma_ring_is_allocated(dev)) { | |
1196 | if (mei_hbm_dma_setup_req(dev)) | |
1197 | return -EIO; | |
1198 | ||
1199 | wake_up(&dev->wait_hbm_start); | |
1200 | break; | |
1201 | } | |
bb1b0133 TW |
1202 | } |
1203 | ||
c55bf542 TW |
1204 | dev->hbm_f_dr_supported = 0; |
1205 | mei_dmam_ring_free(dev); | |
1206 | ||
1207 | if (mei_hbm_enum_clients_req(dev)) | |
1208 | return -EIO; | |
1209 | ||
cb02efc3 | 1210 | wake_up(&dev->wait_hbm_start); |
bb1b0133 TW |
1211 | break; |
1212 | ||
e5cab1f9 AU |
1213 | case MEI_HBM_CAPABILITIES_RES_CMD: |
1214 | dev_dbg(dev->dev, "hbm: capabilities response: message received.\n"); | |
1215 | ||
1216 | dev->init_clients_timer = 0; | |
1217 | ||
1218 | if (dev->hbm_state != MEI_HBM_CAP_SETUP) { | |
1219 | dev_err(dev->dev, "hbm: capabilities response: state mismatch, [%d, %d]\n", | |
1220 | dev->dev_state, dev->hbm_state); | |
1221 | return -EPROTO; | |
1222 | } | |
1223 | ||
beb4e1e5 AU |
1224 | capability_res = (struct hbm_capability_response *)mei_msg; |
1225 | if (!(capability_res->capability_granted[0] & HBM_CAP_VT)) | |
1226 | dev->hbm_f_vt_supported = 0; | |
1227 | ||
e5cab1f9 AU |
1228 | if (dev->hbm_f_dr_supported) { |
1229 | if (mei_dmam_ring_alloc(dev)) | |
1230 | dev_info(dev->dev, "running w/o dma ring\n"); | |
1231 | if (mei_dma_ring_is_allocated(dev)) { | |
1232 | if (mei_hbm_dma_setup_req(dev)) | |
1233 | return -EIO; | |
1234 | break; | |
1235 | } | |
1236 | } | |
1237 | ||
1238 | dev->hbm_f_dr_supported = 0; | |
1239 | mei_dmam_ring_free(dev); | |
1240 | ||
1241 | if (mei_hbm_enum_clients_req(dev)) | |
1242 | return -EIO; | |
1243 | break; | |
1244 | ||
c55bf542 TW |
1245 | case MEI_HBM_DMA_SETUP_RES_CMD: |
1246 | dev_dbg(dev->dev, "hbm: dma setup response: message received.\n"); | |
1247 | ||
1248 | dev->init_clients_timer = 0; | |
1249 | ||
1250 | if (dev->hbm_state != MEI_HBM_DR_SETUP) { | |
1251 | dev_err(dev->dev, "hbm: dma setup response: state mismatch, [%d, %d]\n", | |
1252 | dev->dev_state, dev->hbm_state); | |
1253 | return -EPROTO; | |
1254 | } | |
1255 | ||
1256 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; | |
1257 | ||
1258 | if (dma_setup_res->status) { | |
82e59cbe TW |
1259 | u8 status = dma_setup_res->status; |
1260 | ||
1261 | if (status == MEI_HBMS_NOT_ALLOWED) { | |
1262 | dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); | |
1263 | } else { | |
1264 | dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | |
1265 | status, | |
1266 | mei_hbm_status_str(status)); | |
1267 | } | |
c55bf542 TW |
1268 | dev->hbm_f_dr_supported = 0; |
1269 | mei_dmam_ring_free(dev); | |
1270 | } | |
1271 | ||
1272 | if (mei_hbm_enum_clients_req(dev)) | |
1273 | return -EIO; | |
1274 | break; | |
1275 | ||
bb1b0133 | 1276 | case CLIENT_CONNECT_RES_CMD: |
2bf94cab | 1277 | dev_dbg(dev->dev, "hbm: client connect response: message received.\n"); |
12f45ed4 | 1278 | mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_CONNECT); |
bb1b0133 TW |
1279 | break; |
1280 | ||
1281 | case CLIENT_DISCONNECT_RES_CMD: | |
2bf94cab | 1282 | dev_dbg(dev->dev, "hbm: client disconnect response: message received.\n"); |
12f45ed4 | 1283 | mei_hbm_cl_res(dev, cl_cmd, MEI_FOP_DISCONNECT); |
bb1b0133 TW |
1284 | break; |
1285 | ||
1286 | case MEI_FLOW_CONTROL_CMD: | |
2bf94cab | 1287 | dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); |
544f9460 | 1288 | |
4034b81b TW |
1289 | fctrl = (struct hbm_flow_control *)mei_msg; |
1290 | mei_hbm_cl_tx_flow_ctrl_creds_res(dev, fctrl); | |
bb1b0133 TW |
1291 | break; |
1292 | ||
4fcbc99b | 1293 | case MEI_PG_ISOLATION_ENTRY_RES_CMD: |
63f75232 AU |
1294 | dev_dbg(dev->dev, "hbm: power gate isolation entry response received\n"); |
1295 | ret = mei_hbm_pg_enter_res(dev); | |
1296 | if (ret) | |
1297 | return ret; | |
4fcbc99b TW |
1298 | break; |
1299 | ||
1300 | case MEI_PG_ISOLATION_EXIT_REQ_CMD: | |
63f75232 AU |
1301 | dev_dbg(dev->dev, "hbm: power gate isolation exit request received\n"); |
1302 | ret = mei_hbm_pg_exit_res(dev); | |
1303 | if (ret) | |
1304 | return ret; | |
4fcbc99b TW |
1305 | break; |
1306 | ||
bb1b0133 | 1307 | case HOST_CLIENT_PROPERTIES_RES_CMD: |
2bf94cab | 1308 | dev_dbg(dev->dev, "hbm: properties response: message received.\n"); |
544f9460 TW |
1309 | |
1310 | dev->init_clients_timer = 0; | |
1311 | ||
5ca2d388 TW |
1312 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || |
1313 | dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { | |
2bf94cab | 1314 | dev_err(dev->dev, "hbm: properties response: state mismatch, [%d, %d]\n", |
5ca2d388 | 1315 | dev->dev_state, dev->hbm_state); |
544f9460 TW |
1316 | return -EPROTO; |
1317 | } | |
1318 | ||
bb1b0133 | 1319 | props_res = (struct hbm_props_response *)mei_msg; |
bb1b0133 | 1320 | |
8d2d8935 AU |
1321 | if (props_res->status == MEI_HBMS_CLIENT_NOT_FOUND) { |
1322 | dev_dbg(dev->dev, "hbm: properties response: %d CLIENT_NOT_FOUND\n", | |
1323 | props_res->me_addr); | |
1324 | } else if (props_res->status) { | |
2bf94cab | 1325 | dev_err(dev->dev, "hbm: properties response: wrong status = %d %s\n", |
89778d6e TW |
1326 | props_res->status, |
1327 | mei_hbm_status_str(props_res->status)); | |
544f9460 | 1328 | return -EPROTO; |
8d2d8935 AU |
1329 | } else { |
1330 | mei_hbm_me_cl_add(dev, props_res); | |
bb1b0133 TW |
1331 | } |
1332 | ||
8120e720 | 1333 | /* request property for the next client */ |
cc25aa94 | 1334 | if (mei_hbm_prop_req(dev, props_res->me_addr + 1)) |
544f9460 | 1335 | return -EIO; |
bb1b0133 TW |
1336 | |
1337 | break; | |
1338 | ||
1339 | case HOST_ENUM_RES_CMD: | |
2bf94cab | 1340 | dev_dbg(dev->dev, "hbm: enumeration response: message received\n"); |
544f9460 TW |
1341 | |
1342 | dev->init_clients_timer = 0; | |
1343 | ||
bb1b0133 | 1344 | enum_res = (struct hbm_host_enum_response *) mei_msg; |
23f5a322 TW |
1345 | BUILD_BUG_ON(sizeof(dev->me_clients_map) |
1346 | < sizeof(enum_res->valid_addresses)); | |
1347 | memcpy(dev->me_clients_map, enum_res->valid_addresses, | |
5ca2d388 | 1348 | sizeof(enum_res->valid_addresses)); |
544f9460 TW |
1349 | |
1350 | if (dev->dev_state != MEI_DEV_INIT_CLIENTS || | |
1351 | dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { | |
2bf94cab | 1352 | dev_err(dev->dev, "hbm: enumeration response: state mismatch, [%d, %d]\n", |
544f9460 TW |
1353 | dev->dev_state, dev->hbm_state); |
1354 | return -EPROTO; | |
bb1b0133 | 1355 | } |
544f9460 | 1356 | |
544f9460 TW |
1357 | dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES; |
1358 | ||
1359 | /* first property request */ | |
cc25aa94 | 1360 | if (mei_hbm_prop_req(dev, 0)) |
544f9460 TW |
1361 | return -EIO; |
1362 | ||
bb1b0133 TW |
1363 | break; |
1364 | ||
1365 | case HOST_STOP_RES_CMD: | |
2bf94cab | 1366 | dev_dbg(dev->dev, "hbm: stop response: message received\n"); |
544f9460 TW |
1367 | |
1368 | dev->init_clients_timer = 0; | |
1369 | ||
1370 | if (dev->hbm_state != MEI_HBM_STOPPED) { | |
2bf94cab | 1371 | dev_err(dev->dev, "hbm: stop response: state mismatch, [%d, %d]\n", |
544f9460 TW |
1372 | dev->dev_state, dev->hbm_state); |
1373 | return -EPROTO; | |
1374 | } | |
9b0d5efc | 1375 | |
3a77df62 | 1376 | mei_set_devstate(dev, MEI_DEV_POWER_DOWN); |
2bf94cab | 1377 | dev_info(dev->dev, "hbm: stop response: resetting.\n"); |
544f9460 TW |
1378 | /* force the reset */ |
1379 | return -EPROTO; | |
bb1b0133 TW |
1380 | |
1381 | case CLIENT_DISCONNECT_REQ_CMD: | |
2bf94cab | 1382 | dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); |
544f9460 | 1383 | |
bb1b0133 | 1384 | disconnect_req = (struct hbm_client_connect_request *)mei_msg; |
8120e720 | 1385 | mei_hbm_fw_disconnect_req(dev, disconnect_req); |
bb1b0133 TW |
1386 | break; |
1387 | ||
1388 | case ME_STOP_REQ_CMD: | |
2bf94cab | 1389 | dev_dbg(dev->dev, "hbm: stop request: message received\n"); |
544f9460 | 1390 | dev->hbm_state = MEI_HBM_STOPPED; |
6bb948c9 | 1391 | if (mei_hbm_stop_req(dev)) { |
2bf94cab | 1392 | dev_err(dev->dev, "hbm: stop request: failed to send stop request\n"); |
6bb948c9 TW |
1393 | return -EIO; |
1394 | } | |
bb1b0133 | 1395 | break; |
70ef835c TW |
1396 | |
1397 | case MEI_HBM_ADD_CLIENT_REQ_CMD: | |
1398 | dev_dbg(dev->dev, "hbm: add client request received\n"); | |
1399 | /* | |
1400 | * after the host receives the enum_resp | |
1401 | * message clients may be added or removed | |
1402 | */ | |
84dfe03a | 1403 | if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS || |
70ef835c TW |
1404 | dev->hbm_state >= MEI_HBM_STOPPED) { |
1405 | dev_err(dev->dev, "hbm: add client: state mismatch, [%d, %d]\n", | |
1406 | dev->dev_state, dev->hbm_state); | |
1407 | return -EPROTO; | |
1408 | } | |
1409 | add_cl_req = (struct hbm_add_client_request *)mei_msg; | |
1410 | ret = mei_hbm_fw_add_cl_req(dev, add_cl_req); | |
1411 | if (ret) { | |
1412 | dev_err(dev->dev, "hbm: add client: failed to send response %d\n", | |
1413 | ret); | |
1414 | return -EIO; | |
1415 | } | |
1416 | dev_dbg(dev->dev, "hbm: add client request processed\n"); | |
1417 | break; | |
1418 | ||
965ae37a TW |
1419 | case MEI_HBM_NOTIFY_RES_CMD: |
1420 | dev_dbg(dev->dev, "hbm: notify response received\n"); | |
1421 | mei_hbm_cl_res(dev, cl_cmd, notify_res_to_fop(cl_cmd)); | |
1422 | break; | |
1423 | ||
1424 | case MEI_HBM_NOTIFICATION_CMD: | |
1425 | dev_dbg(dev->dev, "hbm: notification\n"); | |
1426 | mei_hbm_cl_notify(dev, cl_cmd); | |
1427 | break; | |
1428 | ||
bb1b0133 | 1429 | default: |
40a66973 TW |
1430 | WARN(1, "hbm: wrong command %d\n", mei_msg->hbm_cmd); |
1431 | return -EPROTO; | |
bb1b0133 TW |
1432 | |
1433 | } | |
544f9460 | 1434 | return 0; |
bb1b0133 TW |
1435 | } |
1436 |