Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Intel Management Engine Interface (Intel MEI) Linux driver |
Tomas Winkler | 733ba91 | 2012-02-09 19:25:53 +0200 | [diff] [blame] | 4 | * Copyright (c) 2003-2012, Intel Corporation. |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms and conditions of the GNU General Public License, |
| 8 | * version 2, as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | * more details. |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #include <linux/pci.h> |
| 18 | #include <linux/sched.h> |
| 19 | #include <linux/wait.h> |
| 20 | #include <linux/delay.h> |
| 21 | |
| 22 | #include "mei_dev.h" |
| 23 | #include "hw.h" |
| 24 | #include "interface.h" |
Tomas Winkler | 4f3afe1 | 2012-05-09 16:38:59 +0300 | [diff] [blame] | 25 | #include <linux/mei.h> |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 26 | |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 27 | const char *mei_dev_state_str(int state) |
| 28 | { |
| 29 | #define MEI_DEV_STATE(state) case MEI_DEV_##state: return #state |
| 30 | switch (state) { |
| 31 | MEI_DEV_STATE(INITIALIZING); |
| 32 | MEI_DEV_STATE(INIT_CLIENTS); |
| 33 | MEI_DEV_STATE(ENABLED); |
| 34 | MEI_DEV_STATE(RESETING); |
| 35 | MEI_DEV_STATE(DISABLED); |
| 36 | MEI_DEV_STATE(RECOVERING_FROM_RESET); |
| 37 | MEI_DEV_STATE(POWER_DOWN); |
| 38 | MEI_DEV_STATE(POWER_UP); |
| 39 | default: |
| 40 | return "unkown"; |
| 41 | } |
| 42 | #undef MEI_DEV_STATE |
| 43 | } |
| 44 | |
| 45 | |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 46 | /** |
Tomas Winkler | 0288c7c | 2011-06-06 10:44:34 +0300 | [diff] [blame] | 47 | * mei_io_list_flush - removes list entry belonging to cl. |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 48 | * |
| 49 | * @list: An instance of our list structure |
| 50 | * @cl: private data of the file object |
| 51 | */ |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 52 | void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 53 | { |
Tomas Winkler | 3a5352f | 2011-12-04 16:16:27 +0200 | [diff] [blame] | 54 | struct mei_cl_cb *pos; |
| 55 | struct mei_cl_cb *next; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 56 | |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 57 | list_for_each_entry_safe(pos, next, &list->list, list) { |
Tomas Winkler | db3ed43 | 2012-11-11 17:37:59 +0200 | [diff] [blame] | 58 | if (pos->cl) { |
| 59 | if (mei_cl_cmp_id(cl, pos->cl)) |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 60 | list_del(&pos->list); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | } |
Tomas Winkler | 0288c7c | 2011-06-06 10:44:34 +0300 | [diff] [blame] | 64 | /** |
| 65 | * mei_cl_flush_queues - flushes queue lists belonging to cl. |
| 66 | * |
| 67 | * @dev: the device structure |
| 68 | * @cl: private data of the file object |
| 69 | */ |
| 70 | int mei_cl_flush_queues(struct mei_cl *cl) |
| 71 | { |
| 72 | if (!cl || !cl->dev) |
| 73 | return -EINVAL; |
| 74 | |
| 75 | dev_dbg(&cl->dev->pdev->dev, "remove list entry belonging to cl\n"); |
| 76 | mei_io_list_flush(&cl->dev->read_list, cl); |
| 77 | mei_io_list_flush(&cl->dev->write_list, cl); |
| 78 | mei_io_list_flush(&cl->dev->write_waiting_list, cl); |
| 79 | mei_io_list_flush(&cl->dev->ctrl_wr_list, cl); |
| 80 | mei_io_list_flush(&cl->dev->ctrl_rd_list, cl); |
Tomas Winkler | e773efc | 2012-11-11 17:37:58 +0200 | [diff] [blame] | 81 | mei_io_list_flush(&cl->dev->amthif_cmd_list, cl); |
| 82 | mei_io_list_flush(&cl->dev->amthif_rd_complete_list, cl); |
Tomas Winkler | 0288c7c | 2011-06-06 10:44:34 +0300 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 87 | |
| 88 | /** |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 89 | * init_mei_device - allocates and initializes the mei device structure |
| 90 | * |
| 91 | * @pdev: The pci device structure |
| 92 | * |
| 93 | * returns The mei_device_device pointer on success, NULL on failure. |
| 94 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 95 | struct mei_device *mei_device_init(struct pci_dev *pdev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 96 | { |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 97 | struct mei_device *dev; |
| 98 | |
| 99 | dev = kzalloc(sizeof(struct mei_device), GFP_KERNEL); |
| 100 | if (!dev) |
| 101 | return NULL; |
| 102 | |
| 103 | /* setup our list array */ |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 104 | INIT_LIST_HEAD(&dev->file_list); |
| 105 | INIT_LIST_HEAD(&dev->wd_cl.link); |
| 106 | INIT_LIST_HEAD(&dev->iamthif_cl.link); |
| 107 | mutex_init(&dev->device_lock); |
| 108 | init_waitqueue_head(&dev->wait_recvd_msg); |
| 109 | init_waitqueue_head(&dev->wait_stop_wd); |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 110 | dev->dev_state = MEI_DEV_INITIALIZING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 111 | dev->iamthif_state = MEI_IAMTHIF_IDLE; |
Tomas Winkler | 0288c7c | 2011-06-06 10:44:34 +0300 | [diff] [blame] | 112 | |
| 113 | mei_io_list_init(&dev->read_list); |
| 114 | mei_io_list_init(&dev->write_list); |
| 115 | mei_io_list_init(&dev->write_waiting_list); |
| 116 | mei_io_list_init(&dev->ctrl_wr_list); |
| 117 | mei_io_list_init(&dev->ctrl_rd_list); |
Tomas Winkler | e773efc | 2012-11-11 17:37:58 +0200 | [diff] [blame] | 118 | mei_io_list_init(&dev->amthif_cmd_list); |
| 119 | mei_io_list_init(&dev->amthif_rd_complete_list); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 120 | dev->pdev = pdev; |
| 121 | return dev; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * mei_hw_init - initializes host and fw to start work. |
| 126 | * |
| 127 | * @dev: the device structure |
| 128 | * |
| 129 | * returns 0 on success, <0 on failure. |
| 130 | */ |
| 131 | int mei_hw_init(struct mei_device *dev) |
| 132 | { |
| 133 | int err = 0; |
| 134 | int ret; |
| 135 | |
| 136 | mutex_lock(&dev->device_lock); |
| 137 | |
| 138 | dev->host_hw_state = mei_hcsr_read(dev); |
| 139 | dev->me_hw_state = mei_mecsr_read(dev); |
| 140 | dev_dbg(&dev->pdev->dev, "host_hw_state = 0x%08x, mestate = 0x%08x.\n", |
| 141 | dev->host_hw_state, dev->me_hw_state); |
| 142 | |
| 143 | /* acknowledge interrupt and stop interupts */ |
| 144 | if ((dev->host_hw_state & H_IS) == H_IS) |
| 145 | mei_reg_write(dev, H_CSR, dev->host_hw_state); |
| 146 | |
Tomas Winkler | 24aadc8 | 2012-06-25 23:46:27 +0300 | [diff] [blame] | 147 | /* Doesn't change in runtime */ |
| 148 | dev->hbuf_depth = (dev->host_hw_state & H_CBD) >> 24; |
| 149 | |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 150 | dev->recvd_msg = false; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 151 | dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n"); |
| 152 | |
| 153 | mei_reset(dev, 1); |
| 154 | |
| 155 | dev_dbg(&dev->pdev->dev, "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
| 156 | dev->host_hw_state, dev->me_hw_state); |
| 157 | |
| 158 | /* wait for ME to turn on ME_RDY */ |
| 159 | if (!dev->recvd_msg) { |
| 160 | mutex_unlock(&dev->device_lock); |
| 161 | err = wait_event_interruptible_timeout(dev->wait_recvd_msg, |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 162 | dev->recvd_msg, |
| 163 | mei_secs_to_jiffies(MEI_INTEROP_TIMEOUT)); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 164 | mutex_lock(&dev->device_lock); |
| 165 | } |
| 166 | |
Tomas Winkler | a534bb6 | 2011-06-13 16:39:31 +0300 | [diff] [blame] | 167 | if (err <= 0 && !dev->recvd_msg) { |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 168 | dev->dev_state = MEI_DEV_DISABLED; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 169 | dev_dbg(&dev->pdev->dev, |
| 170 | "wait_event_interruptible_timeout failed" |
| 171 | "on wait for ME to turn on ME_RDY.\n"); |
| 172 | ret = -ENODEV; |
| 173 | goto out; |
| 174 | } |
| 175 | |
| 176 | if (!(((dev->host_hw_state & H_RDY) == H_RDY) && |
| 177 | ((dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA))) { |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 178 | dev->dev_state = MEI_DEV_DISABLED; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 179 | dev_dbg(&dev->pdev->dev, |
| 180 | "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
| 181 | dev->host_hw_state, dev->me_hw_state); |
| 182 | |
Dan Carpenter | 8eb73c6 | 2011-06-09 10:18:23 +0300 | [diff] [blame] | 183 | if (!(dev->host_hw_state & H_RDY)) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 184 | dev_dbg(&dev->pdev->dev, "host turn off H_RDY.\n"); |
| 185 | |
Dan Carpenter | 8eb73c6 | 2011-06-09 10:18:23 +0300 | [diff] [blame] | 186 | if (!(dev->me_hw_state & ME_RDY_HRA)) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 187 | dev_dbg(&dev->pdev->dev, "ME turn off ME_RDY.\n"); |
| 188 | |
Tomas Winkler | d39a464 | 2012-03-19 17:58:42 +0200 | [diff] [blame] | 189 | dev_err(&dev->pdev->dev, "link layer initialization failed.\n"); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 190 | ret = -ENODEV; |
| 191 | goto out; |
| 192 | } |
| 193 | |
| 194 | if (dev->version.major_version != HBM_MAJOR_VERSION || |
| 195 | dev->version.minor_version != HBM_MINOR_VERSION) { |
| 196 | dev_dbg(&dev->pdev->dev, "MEI start failed.\n"); |
| 197 | ret = -ENODEV; |
| 198 | goto out; |
| 199 | } |
| 200 | |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 201 | dev->recvd_msg = false; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 202 | dev_dbg(&dev->pdev->dev, "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
| 203 | dev->host_hw_state, dev->me_hw_state); |
| 204 | dev_dbg(&dev->pdev->dev, "ME turn on ME_RDY and host turn on H_RDY.\n"); |
| 205 | dev_dbg(&dev->pdev->dev, "link layer has been established.\n"); |
| 206 | dev_dbg(&dev->pdev->dev, "MEI start success.\n"); |
| 207 | ret = 0; |
| 208 | |
| 209 | out: |
| 210 | mutex_unlock(&dev->device_lock); |
| 211 | return ret; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * mei_hw_reset - resets fw via mei csr register. |
| 216 | * |
| 217 | * @dev: the device structure |
| 218 | * @interrupts_enabled: if interrupt should be enabled after reset. |
| 219 | */ |
| 220 | static void mei_hw_reset(struct mei_device *dev, int interrupts_enabled) |
| 221 | { |
| 222 | dev->host_hw_state |= (H_RST | H_IG); |
| 223 | |
| 224 | if (interrupts_enabled) |
| 225 | mei_enable_interrupts(dev); |
| 226 | else |
| 227 | mei_disable_interrupts(dev); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * mei_reset - resets host and fw. |
| 232 | * |
| 233 | * @dev: the device structure |
| 234 | * @interrupts_enabled: if interrupt should be enabled after reset. |
| 235 | */ |
| 236 | void mei_reset(struct mei_device *dev, int interrupts_enabled) |
| 237 | { |
| 238 | struct mei_cl *cl_pos = NULL; |
| 239 | struct mei_cl *cl_next = NULL; |
| 240 | struct mei_cl_cb *cb_pos = NULL; |
| 241 | struct mei_cl_cb *cb_next = NULL; |
| 242 | bool unexpected; |
| 243 | |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 244 | if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) { |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 245 | dev->need_reset = true; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 246 | return; |
| 247 | } |
| 248 | |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 249 | unexpected = (dev->dev_state != MEI_DEV_INITIALIZING && |
| 250 | dev->dev_state != MEI_DEV_DISABLED && |
| 251 | dev->dev_state != MEI_DEV_POWER_DOWN && |
| 252 | dev->dev_state != MEI_DEV_POWER_UP); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 253 | |
| 254 | dev->host_hw_state = mei_hcsr_read(dev); |
| 255 | |
| 256 | dev_dbg(&dev->pdev->dev, "before reset host_hw_state = 0x%08x.\n", |
| 257 | dev->host_hw_state); |
| 258 | |
| 259 | mei_hw_reset(dev, interrupts_enabled); |
| 260 | |
| 261 | dev->host_hw_state &= ~H_RST; |
| 262 | dev->host_hw_state |= H_IG; |
| 263 | |
| 264 | mei_hcsr_set(dev); |
| 265 | |
| 266 | dev_dbg(&dev->pdev->dev, "currently saved host_hw_state = 0x%08x.\n", |
| 267 | dev->host_hw_state); |
| 268 | |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 269 | dev->need_reset = false; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 270 | |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 271 | if (dev->dev_state != MEI_DEV_INITIALIZING) { |
| 272 | if (dev->dev_state != MEI_DEV_DISABLED && |
| 273 | dev->dev_state != MEI_DEV_POWER_DOWN) |
| 274 | dev->dev_state = MEI_DEV_RESETING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 275 | |
| 276 | list_for_each_entry_safe(cl_pos, |
| 277 | cl_next, &dev->file_list, link) { |
| 278 | cl_pos->state = MEI_FILE_DISCONNECTED; |
| 279 | cl_pos->mei_flow_ctrl_creds = 0; |
| 280 | cl_pos->read_cb = NULL; |
| 281 | cl_pos->timer_count = 0; |
| 282 | } |
| 283 | /* remove entry if already in list */ |
| 284 | dev_dbg(&dev->pdev->dev, "list del iamthif and wd file list.\n"); |
| 285 | mei_remove_client_from_file_list(dev, |
| 286 | dev->wd_cl.host_client_id); |
| 287 | |
| 288 | mei_remove_client_from_file_list(dev, |
| 289 | dev->iamthif_cl.host_client_id); |
| 290 | |
Tomas Winkler | 19838fb | 2012-11-01 21:17:15 +0200 | [diff] [blame] | 291 | mei_amthif_reset_params(dev); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 292 | dev->extra_write_index = 0; |
| 293 | } |
| 294 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 295 | dev->me_clients_num = 0; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 296 | dev->rd_msg_hdr = 0; |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 297 | dev->wd_pending = false; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 298 | |
| 299 | /* update the state of the registers after reset */ |
| 300 | dev->host_hw_state = mei_hcsr_read(dev); |
| 301 | dev->me_hw_state = mei_mecsr_read(dev); |
| 302 | |
| 303 | dev_dbg(&dev->pdev->dev, "after reset host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
| 304 | dev->host_hw_state, dev->me_hw_state); |
| 305 | |
| 306 | if (unexpected) |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 307 | dev_warn(&dev->pdev->dev, "unexpected reset: dev_state = %s\n", |
| 308 | mei_dev_state_str(dev->dev_state)); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 309 | |
| 310 | /* Wake up all readings so they can be interrupted */ |
| 311 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { |
| 312 | if (waitqueue_active(&cl_pos->rx_wait)) { |
| 313 | dev_dbg(&dev->pdev->dev, "Waking up client!\n"); |
| 314 | wake_up_interruptible(&cl_pos->rx_wait); |
| 315 | } |
| 316 | } |
| 317 | /* remove all waiting requests */ |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 318 | list_for_each_entry_safe(cb_pos, cb_next, &dev->write_list.list, list) { |
| 319 | list_del(&cb_pos->list); |
Tomas Winkler | 601a1ef | 2012-10-09 16:50:20 +0200 | [diff] [blame] | 320 | mei_io_cb_free(cb_pos); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 321 | } |
| 322 | } |
| 323 | |
| 324 | |
| 325 | |
| 326 | /** |
| 327 | * host_start_message - mei host sends start message. |
| 328 | * |
| 329 | * @dev: the device structure |
| 330 | * |
| 331 | * returns none. |
| 332 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 333 | void mei_host_start_message(struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 334 | { |
| 335 | struct mei_msg_hdr *mei_hdr; |
| 336 | struct hbm_host_version_request *host_start_req; |
| 337 | |
| 338 | /* host start message */ |
| 339 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; |
| 340 | mei_hdr->host_addr = 0; |
| 341 | mei_hdr->me_addr = 0; |
| 342 | mei_hdr->length = sizeof(struct hbm_host_version_request); |
| 343 | mei_hdr->msg_complete = 1; |
| 344 | mei_hdr->reserved = 0; |
| 345 | |
| 346 | host_start_req = |
| 347 | (struct hbm_host_version_request *) &dev->wr_msg_buf[1]; |
| 348 | memset(host_start_req, 0, sizeof(struct hbm_host_version_request)); |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 349 | host_start_req->hbm_cmd = HOST_START_REQ_CMD; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 350 | host_start_req->host_version.major_version = HBM_MAJOR_VERSION; |
| 351 | host_start_req->host_version.minor_version = HBM_MINOR_VERSION; |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 352 | dev->recvd_msg = false; |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 353 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req, |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 354 | mei_hdr->length)) { |
| 355 | dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 356 | dev->dev_state = MEI_DEV_RESETING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 357 | mei_reset(dev, 1); |
| 358 | } |
| 359 | dev->init_clients_state = MEI_START_MESSAGE; |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 360 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 361 | return ; |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * host_enum_clients_message - host sends enumeration client request message. |
| 366 | * |
| 367 | * @dev: the device structure |
| 368 | * |
| 369 | * returns none. |
| 370 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 371 | void mei_host_enum_clients_message(struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 372 | { |
| 373 | struct mei_msg_hdr *mei_hdr; |
| 374 | struct hbm_host_enum_request *host_enum_req; |
| 375 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; |
| 376 | /* enumerate clients */ |
| 377 | mei_hdr->host_addr = 0; |
| 378 | mei_hdr->me_addr = 0; |
| 379 | mei_hdr->length = sizeof(struct hbm_host_enum_request); |
| 380 | mei_hdr->msg_complete = 1; |
| 381 | mei_hdr->reserved = 0; |
| 382 | |
| 383 | host_enum_req = (struct hbm_host_enum_request *) &dev->wr_msg_buf[1]; |
| 384 | memset(host_enum_req, 0, sizeof(struct hbm_host_enum_request)); |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 385 | host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 386 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req, |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 387 | mei_hdr->length)) { |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 388 | dev->dev_state = MEI_DEV_RESETING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 389 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
| 390 | mei_reset(dev, 1); |
| 391 | } |
| 392 | dev->init_clients_state = MEI_ENUM_CLIENTS_MESSAGE; |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 393 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 394 | return; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | |
| 398 | /** |
| 399 | * allocate_me_clients_storage - allocates storage for me clients |
| 400 | * |
| 401 | * @dev: the device structure |
| 402 | * |
| 403 | * returns none. |
| 404 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 405 | void mei_allocate_me_clients_storage(struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 406 | { |
| 407 | struct mei_me_client *clients; |
| 408 | int b; |
| 409 | |
| 410 | /* count how many ME clients we have */ |
| 411 | for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX) |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 412 | dev->me_clients_num++; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 413 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 414 | if (dev->me_clients_num <= 0) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 415 | return ; |
| 416 | |
| 417 | |
| 418 | if (dev->me_clients != NULL) { |
| 419 | kfree(dev->me_clients); |
| 420 | dev->me_clients = NULL; |
| 421 | } |
| 422 | dev_dbg(&dev->pdev->dev, "memory allocation for ME clients size=%zd.\n", |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 423 | dev->me_clients_num * sizeof(struct mei_me_client)); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 424 | /* allocate storage for ME clients representation */ |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 425 | clients = kcalloc(dev->me_clients_num, |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 426 | sizeof(struct mei_me_client), GFP_KERNEL); |
| 427 | if (!clients) { |
| 428 | dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n"); |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 429 | dev->dev_state = MEI_DEV_RESETING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 430 | mei_reset(dev, 1); |
| 431 | return ; |
| 432 | } |
| 433 | dev->me_clients = clients; |
| 434 | return ; |
| 435 | } |
| 436 | /** |
| 437 | * host_client_properties - reads properties for client |
| 438 | * |
| 439 | * @dev: the device structure |
| 440 | * |
Oren Weil | abc51b6 | 2011-09-21 16:45:30 +0300 | [diff] [blame] | 441 | * returns: |
| 442 | * < 0 - Error. |
| 443 | * = 0 - no more clients. |
| 444 | * = 1 - still have clients to send properties request. |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 445 | */ |
Oren Weil | abc51b6 | 2011-09-21 16:45:30 +0300 | [diff] [blame] | 446 | int mei_host_client_properties(struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 447 | { |
| 448 | struct mei_msg_hdr *mei_header; |
| 449 | struct hbm_props_request *host_cli_req; |
| 450 | int b; |
| 451 | u8 client_num = dev->me_client_presentation_num; |
| 452 | |
| 453 | b = dev->me_client_index; |
| 454 | b = find_next_bit(dev->me_clients_map, MEI_CLIENTS_MAX, b); |
| 455 | if (b < MEI_CLIENTS_MAX) { |
| 456 | dev->me_clients[client_num].client_id = b; |
| 457 | dev->me_clients[client_num].mei_flow_ctrl_creds = 0; |
| 458 | mei_header = (struct mei_msg_hdr *)&dev->wr_msg_buf[0]; |
| 459 | mei_header->host_addr = 0; |
| 460 | mei_header->me_addr = 0; |
| 461 | mei_header->length = sizeof(struct hbm_props_request); |
| 462 | mei_header->msg_complete = 1; |
| 463 | mei_header->reserved = 0; |
| 464 | |
| 465 | host_cli_req = (struct hbm_props_request *)&dev->wr_msg_buf[1]; |
| 466 | |
| 467 | memset(host_cli_req, 0, sizeof(struct hbm_props_request)); |
| 468 | |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 469 | host_cli_req->hbm_cmd = HOST_CLIENT_PROPERTIES_REQ_CMD; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 470 | host_cli_req->address = b; |
| 471 | |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 472 | if (mei_write_message(dev, mei_header, |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 473 | (unsigned char *)host_cli_req, |
| 474 | mei_header->length)) { |
Tomas Winkler | b210d75 | 2012-08-07 00:03:56 +0300 | [diff] [blame] | 475 | dev->dev_state = MEI_DEV_RESETING; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 476 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
| 477 | mei_reset(dev, 1); |
Oren Weil | abc51b6 | 2011-09-21 16:45:30 +0300 | [diff] [blame] | 478 | return -EIO; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 479 | } |
| 480 | |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 481 | dev->init_clients_timer = MEI_CLIENTS_INIT_TIMEOUT; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 482 | dev->me_client_index = b; |
Oren Weil | abc51b6 | 2011-09-21 16:45:30 +0300 | [diff] [blame] | 483 | return 1; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 484 | } |
| 485 | |
Oren Weil | abc51b6 | 2011-09-21 16:45:30 +0300 | [diff] [blame] | 486 | return 0; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 487 | } |
| 488 | |
| 489 | /** |
| 490 | * mei_init_file_private - initializes private file structure. |
| 491 | * |
| 492 | * @priv: private file structure to be initialized |
| 493 | * @file: the file structure |
| 494 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 495 | void mei_cl_init(struct mei_cl *priv, struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 496 | { |
| 497 | memset(priv, 0, sizeof(struct mei_cl)); |
| 498 | init_waitqueue_head(&priv->wait); |
| 499 | init_waitqueue_head(&priv->rx_wait); |
| 500 | init_waitqueue_head(&priv->tx_wait); |
| 501 | INIT_LIST_HEAD(&priv->link); |
| 502 | priv->reading_state = MEI_IDLE; |
| 503 | priv->writing_state = MEI_IDLE; |
| 504 | priv->dev = dev; |
| 505 | } |
| 506 | |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 507 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 508 | { |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 509 | int i, res = -ENOENT; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 510 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 511 | for (i = 0; i < dev->me_clients_num; ++i) |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 512 | if (uuid_le_cmp(*cuuid, |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 513 | dev->me_clients[i].props.protocol_name) == 0) { |
| 514 | res = i; |
| 515 | break; |
| 516 | } |
| 517 | |
| 518 | return res; |
| 519 | } |
| 520 | |
| 521 | |
| 522 | /** |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 523 | * mei_me_cl_update_filext - searches for ME client guid |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 524 | * sets client_id in mei_file_private if found |
| 525 | * @dev: the device structure |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 526 | * @cl: private file structure to set client_id in |
| 527 | * @cuuid: searched uuid of ME client |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 528 | * @client_id: id of host client to be set in file private structure |
| 529 | * |
| 530 | * returns ME client index |
| 531 | */ |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 532 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, |
| 533 | const uuid_le *cuuid, u8 host_cl_id) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 534 | { |
| 535 | int i; |
| 536 | |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 537 | if (!dev || !cl || !cuuid) |
| 538 | return -EINVAL; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 539 | |
| 540 | /* check for valid client id */ |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 541 | i = mei_me_cl_by_uuid(dev, cuuid); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 542 | if (i >= 0) { |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 543 | cl->me_client_id = dev->me_clients[i].client_id; |
| 544 | cl->state = MEI_FILE_CONNECTING; |
| 545 | cl->host_client_id = host_cl_id; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 546 | |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 547 | list_add_tail(&cl->link, &dev->file_list); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 548 | return (u8)i; |
| 549 | } |
| 550 | |
Tomas Winkler | 07b509b | 2012-07-23 14:05:39 +0300 | [diff] [blame] | 551 | return -ENOENT; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 552 | } |
| 553 | |
| 554 | /** |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 555 | * mei_alloc_file_private - allocates a private file structure and sets it up. |
| 556 | * @file: the file structure |
| 557 | * |
| 558 | * returns The allocated file or NULL on failure |
| 559 | */ |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 560 | struct mei_cl *mei_cl_allocate(struct mei_device *dev) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 561 | { |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 562 | struct mei_cl *cl; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 563 | |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 564 | cl = kmalloc(sizeof(struct mei_cl), GFP_KERNEL); |
| 565 | if (!cl) |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 566 | return NULL; |
| 567 | |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 568 | mei_cl_init(cl, dev); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 569 | |
Tomas Winkler | c95efb7 | 2011-05-25 17:28:21 +0300 | [diff] [blame] | 570 | return cl; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | |
| 574 | |
| 575 | /** |
| 576 | * mei_disconnect_host_client - sends disconnect message to fw from host client. |
| 577 | * |
| 578 | * @dev: the device structure |
| 579 | * @cl: private data of the file object |
| 580 | * |
| 581 | * Locking: called under "dev->device_lock" lock |
| 582 | * |
| 583 | * returns 0 on success, <0 on failure. |
| 584 | */ |
| 585 | int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl) |
| 586 | { |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 587 | struct mei_cl_cb *cb; |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 588 | int rets, err; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 589 | |
| 590 | if (!dev || !cl) |
| 591 | return -ENODEV; |
| 592 | |
| 593 | if (cl->state != MEI_FILE_DISCONNECTING) |
| 594 | return 0; |
| 595 | |
Tomas Winkler | 664df38 | 2012-10-11 16:35:08 +0200 | [diff] [blame] | 596 | cb = mei_io_cb_init(cl, NULL); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 597 | if (!cb) |
| 598 | return -ENOMEM; |
| 599 | |
Tomas Winkler | 4b8960b | 2012-11-11 17:38:00 +0200 | [diff] [blame^] | 600 | cb->fop_type = MEI_FOP_CLOSE; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 601 | if (dev->mei_host_buffer_is_empty) { |
Tomas Winkler | eb9af0a | 2011-05-25 17:28:22 +0300 | [diff] [blame] | 602 | dev->mei_host_buffer_is_empty = false; |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 603 | if (mei_disconnect(dev, cl)) { |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 604 | rets = -ENODEV; |
| 605 | dev_dbg(&dev->pdev->dev, "failed to call mei_disconnect.\n"); |
| 606 | goto free; |
| 607 | } |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 608 | mdelay(10); /* Wait for hardware disconnection ready */ |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 609 | list_add_tail(&cb->list, &dev->ctrl_rd_list.list); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 610 | } else { |
| 611 | dev_dbg(&dev->pdev->dev, "add disconnect cb to control write list\n"); |
Tomas Winkler | fb601ad | 2012-10-15 12:06:48 +0200 | [diff] [blame] | 612 | list_add_tail(&cb->list, &dev->ctrl_wr_list.list); |
| 613 | |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 614 | } |
| 615 | mutex_unlock(&dev->device_lock); |
| 616 | |
| 617 | err = wait_event_timeout(dev->wait_recvd_msg, |
Tomas Winkler | 3870c32 | 2012-11-01 21:17:14 +0200 | [diff] [blame] | 618 | MEI_FILE_DISCONNECTED == cl->state, |
| 619 | mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT)); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 620 | |
| 621 | mutex_lock(&dev->device_lock); |
| 622 | if (MEI_FILE_DISCONNECTED == cl->state) { |
| 623 | rets = 0; |
| 624 | dev_dbg(&dev->pdev->dev, "successfully disconnected from FW client.\n"); |
| 625 | } else { |
| 626 | rets = -ENODEV; |
| 627 | if (MEI_FILE_DISCONNECTED != cl->state) |
| 628 | dev_dbg(&dev->pdev->dev, "wrong status client disconnect.\n"); |
| 629 | |
| 630 | if (err) |
| 631 | dev_dbg(&dev->pdev->dev, |
| 632 | "wait failed disconnect err=%08x\n", |
| 633 | err); |
| 634 | |
| 635 | dev_dbg(&dev->pdev->dev, "failed to disconnect from FW client.\n"); |
| 636 | } |
| 637 | |
Tomas Winkler | 0288c7c | 2011-06-06 10:44:34 +0300 | [diff] [blame] | 638 | mei_io_list_flush(&dev->ctrl_rd_list, cl); |
| 639 | mei_io_list_flush(&dev->ctrl_wr_list, cl); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 640 | free: |
Tomas Winkler | 601a1ef | 2012-10-09 16:50:20 +0200 | [diff] [blame] | 641 | mei_io_cb_free(cb); |
Oren Weil | 91f01c6 | 2011-05-15 13:43:44 +0300 | [diff] [blame] | 642 | return rets; |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * mei_remove_client_from_file_list - |
| 647 | * removes file private data from device file list |
| 648 | * |
| 649 | * @dev: the device structure |
| 650 | * @host_client_id: host client id to be removed |
| 651 | */ |
| 652 | void mei_remove_client_from_file_list(struct mei_device *dev, |
| 653 | u8 host_client_id) |
| 654 | { |
| 655 | struct mei_cl *cl_pos = NULL; |
| 656 | struct mei_cl *cl_next = NULL; |
| 657 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { |
| 658 | if (host_client_id == cl_pos->host_client_id) { |
| 659 | dev_dbg(&dev->pdev->dev, "remove host client = %d, ME client = %d\n", |
| 660 | cl_pos->host_client_id, |
| 661 | cl_pos->me_client_id); |
| 662 | list_del_init(&cl_pos->link); |
| 663 | break; |
| 664 | } |
| 665 | } |
| 666 | } |