Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +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 | 3ce7272 | 2011-05-15 13:43:43 +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 "mei_dev.h" |
Tomas Winkler | 4f3afe1 | 2012-05-09 16:38:59 +0300 | [diff] [blame] | 19 | #include <linux/mei.h> |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 20 | #include "interface.h" |
| 21 | |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * mei_set_csr_register - writes H_CSR register to the mei device, |
| 26 | * and ignores the H_IS bit for it is write-one-to-zero. |
| 27 | * |
| 28 | * @dev: the device structure |
| 29 | */ |
| 30 | void mei_hcsr_set(struct mei_device *dev) |
| 31 | { |
| 32 | if ((dev->host_hw_state & H_IS) == H_IS) |
| 33 | dev->host_hw_state &= ~H_IS; |
| 34 | mei_reg_write(dev, H_CSR, dev->host_hw_state); |
| 35 | dev->host_hw_state = mei_hcsr_read(dev); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * mei_csr_enable_interrupts - enables mei device interrupts |
| 40 | * |
| 41 | * @dev: the device structure |
| 42 | */ |
| 43 | void mei_enable_interrupts(struct mei_device *dev) |
| 44 | { |
| 45 | dev->host_hw_state |= H_IE; |
| 46 | mei_hcsr_set(dev); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * mei_csr_disable_interrupts - disables mei device interrupts |
| 51 | * |
| 52 | * @dev: the device structure |
| 53 | */ |
| 54 | void mei_disable_interrupts(struct mei_device *dev) |
| 55 | { |
| 56 | dev->host_hw_state &= ~H_IE; |
| 57 | mei_hcsr_set(dev); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * _host_get_filled_slots - gets number of device filled buffer slots |
| 62 | * |
| 63 | * @device: the device structure |
| 64 | * |
| 65 | * returns number of filled slots |
| 66 | */ |
| 67 | static unsigned char _host_get_filled_slots(const struct mei_device *dev) |
| 68 | { |
| 69 | char read_ptr, write_ptr; |
| 70 | |
| 71 | read_ptr = (char) ((dev->host_hw_state & H_CBRP) >> 8); |
| 72 | write_ptr = (char) ((dev->host_hw_state & H_CBWP) >> 16); |
| 73 | |
| 74 | return (unsigned char) (write_ptr - read_ptr); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * mei_host_buffer_is_empty - checks if host buffer is empty. |
| 79 | * |
| 80 | * @dev: the device structure |
| 81 | * |
| 82 | * returns 1 if empty, 0 - otherwise. |
| 83 | */ |
| 84 | int mei_host_buffer_is_empty(struct mei_device *dev) |
| 85 | { |
| 86 | unsigned char filled_slots; |
| 87 | |
| 88 | dev->host_hw_state = mei_hcsr_read(dev); |
| 89 | filled_slots = _host_get_filled_slots(dev); |
| 90 | |
| 91 | if (filled_slots == 0) |
| 92 | return 1; |
| 93 | |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * mei_count_empty_write_slots - counts write empty slots. |
| 99 | * |
| 100 | * @dev: the device structure |
| 101 | * |
| 102 | * returns -1(ESLOTS_OVERFLOW) if overflow, otherwise empty slots count |
| 103 | */ |
| 104 | int mei_count_empty_write_slots(struct mei_device *dev) |
| 105 | { |
| 106 | unsigned char buffer_depth, filled_slots, empty_slots; |
| 107 | |
| 108 | dev->host_hw_state = mei_hcsr_read(dev); |
| 109 | buffer_depth = (unsigned char) ((dev->host_hw_state & H_CBD) >> 24); |
| 110 | filled_slots = _host_get_filled_slots(dev); |
| 111 | empty_slots = buffer_depth - filled_slots; |
| 112 | |
| 113 | /* check for overflow */ |
| 114 | if (filled_slots > buffer_depth) |
| 115 | return -EOVERFLOW; |
| 116 | |
| 117 | return empty_slots; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * mei_write_message - writes a message to mei device. |
| 122 | * |
| 123 | * @dev: the device structure |
| 124 | * @header: header of message |
| 125 | * @write_buffer: message buffer will be written |
| 126 | * @write_length: message size will be written |
| 127 | * |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 128 | * This function returns -EIO if write has failed |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 129 | */ |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 130 | int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header, |
| 131 | unsigned char *buf, unsigned long length) |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 132 | { |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 133 | unsigned long rem, dw_cnt; |
| 134 | u32 *reg_buf = (u32 *)buf; |
| 135 | int i; |
| 136 | int empty_slots; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 137 | |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 138 | |
| 139 | dev_dbg(&dev->pdev->dev, |
| 140 | "mei_write_message header=%08x.\n", |
| 141 | *((u32 *) header)); |
| 142 | |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 143 | empty_slots = mei_count_empty_write_slots(dev); |
| 144 | dev_dbg(&dev->pdev->dev, "empty slots = %hu.\n", empty_slots); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 145 | |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 146 | dw_cnt = (length + sizeof(*header) + 3) / 4; |
| 147 | if (empty_slots < 0 || dw_cnt > empty_slots) |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 148 | return -EIO; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 149 | |
| 150 | mei_reg_write(dev, H_CB_WW, *((u32 *) header)); |
| 151 | |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 152 | for (i = 0; i < length / 4; i++) |
| 153 | mei_reg_write(dev, H_CB_WW, reg_buf[i]); |
| 154 | |
| 155 | rem = length & 0x3; |
| 156 | if (rem > 0) { |
| 157 | u32 reg = 0; |
| 158 | memcpy(®, &buf[length - rem], rem); |
| 159 | mei_reg_write(dev, H_CB_WW, reg); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 160 | } |
| 161 | |
Tomas Winkler | 169d133 | 2012-06-19 09:13:35 +0300 | [diff] [blame] | 162 | dev->host_hw_state = mei_hcsr_read(dev); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 163 | dev->host_hw_state |= H_IG; |
| 164 | mei_hcsr_set(dev); |
| 165 | dev->me_hw_state = mei_mecsr_read(dev); |
| 166 | if ((dev->me_hw_state & ME_RDY_HRA) != ME_RDY_HRA) |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 167 | return -EIO; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 168 | |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 169 | return 0; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | /** |
| 173 | * mei_count_full_read_slots - counts read full slots. |
| 174 | * |
| 175 | * @dev: the device structure |
| 176 | * |
| 177 | * returns -1(ESLOTS_OVERFLOW) if overflow, otherwise filled slots count |
| 178 | */ |
| 179 | int mei_count_full_read_slots(struct mei_device *dev) |
| 180 | { |
| 181 | char read_ptr, write_ptr; |
| 182 | unsigned char buffer_depth, filled_slots; |
| 183 | |
| 184 | dev->me_hw_state = mei_mecsr_read(dev); |
| 185 | buffer_depth = (unsigned char)((dev->me_hw_state & ME_CBD_HRA) >> 24); |
| 186 | read_ptr = (char) ((dev->me_hw_state & ME_CBRP_HRA) >> 8); |
| 187 | write_ptr = (char) ((dev->me_hw_state & ME_CBWP_HRA) >> 16); |
| 188 | filled_slots = (unsigned char) (write_ptr - read_ptr); |
| 189 | |
| 190 | /* check for overflow */ |
| 191 | if (filled_slots > buffer_depth) |
| 192 | return -EOVERFLOW; |
| 193 | |
| 194 | dev_dbg(&dev->pdev->dev, "filled_slots =%08x\n", filled_slots); |
| 195 | return (int)filled_slots; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * mei_read_slots - reads a message from mei device. |
| 200 | * |
| 201 | * @dev: the device structure |
| 202 | * @buffer: message buffer will be written |
| 203 | * @buffer_length: message size will be read |
| 204 | */ |
Tomas Winkler | edf1eed | 2012-02-09 19:25:54 +0200 | [diff] [blame] | 205 | void mei_read_slots(struct mei_device *dev, unsigned char *buffer, |
| 206 | unsigned long buffer_length) |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 207 | { |
Tomas Winkler | edf1eed | 2012-02-09 19:25:54 +0200 | [diff] [blame] | 208 | u32 *reg_buf = (u32 *)buffer; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 209 | |
Tomas Winkler | edf1eed | 2012-02-09 19:25:54 +0200 | [diff] [blame] | 210 | for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32)) |
| 211 | *reg_buf++ = mei_mecbrw_read(dev); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 212 | |
| 213 | if (buffer_length > 0) { |
Tomas Winkler | edf1eed | 2012-02-09 19:25:54 +0200 | [diff] [blame] | 214 | u32 reg = mei_mecbrw_read(dev); |
| 215 | memcpy(reg_buf, ®, buffer_length); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | dev->host_hw_state |= H_IG; |
| 219 | mei_hcsr_set(dev); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * mei_flow_ctrl_creds - checks flow_control credentials. |
| 224 | * |
| 225 | * @dev: the device structure |
| 226 | * @cl: private data of the file object |
| 227 | * |
| 228 | * returns 1 if mei_flow_ctrl_creds >0, 0 - otherwise. |
| 229 | * -ENOENT if mei_cl is not present |
| 230 | * -EINVAL if single_recv_buf == 0 |
| 231 | */ |
| 232 | int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl) |
| 233 | { |
| 234 | int i; |
| 235 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 236 | if (!dev->me_clients_num) |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 237 | return 0; |
| 238 | |
| 239 | if (cl->mei_flow_ctrl_creds > 0) |
| 240 | return 1; |
| 241 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 242 | for (i = 0; i < dev->me_clients_num; i++) { |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 243 | struct mei_me_client *me_cl = &dev->me_clients[i]; |
| 244 | if (me_cl->client_id == cl->me_client_id) { |
| 245 | if (me_cl->mei_flow_ctrl_creds) { |
| 246 | if (WARN_ON(me_cl->props.single_recv_buf == 0)) |
| 247 | return -EINVAL; |
| 248 | return 1; |
| 249 | } else { |
| 250 | return 0; |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | return -ENOENT; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * mei_flow_ctrl_reduce - reduces flow_control. |
| 259 | * |
| 260 | * @dev: the device structure |
| 261 | * @cl: private data of the file object |
| 262 | * @returns |
| 263 | * 0 on success |
| 264 | * -ENOENT when me client is not found |
Justin P. Mattock | 5f9092f | 2012-03-12 07:18:09 -0700 | [diff] [blame] | 265 | * -EINVAL when ctrl credits are <= 0 |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 266 | */ |
| 267 | int mei_flow_ctrl_reduce(struct mei_device *dev, struct mei_cl *cl) |
| 268 | { |
| 269 | int i; |
| 270 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 271 | if (!dev->me_clients_num) |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 272 | return -ENOENT; |
| 273 | |
Tomas Winkler | cf9673d | 2011-06-06 10:44:33 +0300 | [diff] [blame] | 274 | for (i = 0; i < dev->me_clients_num; i++) { |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 275 | struct mei_me_client *me_cl = &dev->me_clients[i]; |
| 276 | if (me_cl->client_id == cl->me_client_id) { |
| 277 | if (me_cl->props.single_recv_buf != 0) { |
| 278 | if (WARN_ON(me_cl->mei_flow_ctrl_creds <= 0)) |
| 279 | return -EINVAL; |
| 280 | dev->me_clients[i].mei_flow_ctrl_creds--; |
| 281 | } else { |
| 282 | if (WARN_ON(cl->mei_flow_ctrl_creds <= 0)) |
| 283 | return -EINVAL; |
| 284 | cl->mei_flow_ctrl_creds--; |
| 285 | } |
| 286 | return 0; |
| 287 | } |
| 288 | } |
| 289 | return -ENOENT; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * mei_send_flow_control - sends flow control to fw. |
| 294 | * |
| 295 | * @dev: the device structure |
| 296 | * @cl: private data of the file object |
| 297 | * |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 298 | * This function returns -EIO on write failure |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 299 | */ |
| 300 | int mei_send_flow_control(struct mei_device *dev, struct mei_cl *cl) |
| 301 | { |
| 302 | struct mei_msg_hdr *mei_hdr; |
| 303 | struct hbm_flow_control *mei_flow_control; |
| 304 | |
| 305 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; |
| 306 | mei_hdr->host_addr = 0; |
| 307 | mei_hdr->me_addr = 0; |
| 308 | mei_hdr->length = sizeof(struct hbm_flow_control); |
| 309 | mei_hdr->msg_complete = 1; |
| 310 | mei_hdr->reserved = 0; |
| 311 | |
| 312 | mei_flow_control = (struct hbm_flow_control *) &dev->wr_msg_buf[1]; |
Julia Lawall | c056998 | 2011-09-16 08:57:33 +0200 | [diff] [blame] | 313 | memset(mei_flow_control, 0, sizeof(*mei_flow_control)); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 314 | mei_flow_control->host_addr = cl->host_client_id; |
| 315 | mei_flow_control->me_addr = cl->me_client_id; |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 316 | mei_flow_control->hbm_cmd = MEI_FLOW_CONTROL_CMD; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 317 | memset(mei_flow_control->reserved, 0, |
| 318 | sizeof(mei_flow_control->reserved)); |
| 319 | dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n", |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 320 | cl->host_client_id, cl->me_client_id); |
| 321 | |
| 322 | return mei_write_message(dev, mei_hdr, |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 323 | (unsigned char *) mei_flow_control, |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 324 | sizeof(struct hbm_flow_control)); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | /** |
| 328 | * mei_other_client_is_connecting - checks if other |
| 329 | * client with the same client id is connected. |
| 330 | * |
| 331 | * @dev: the device structure |
| 332 | * @cl: private data of the file object |
| 333 | * |
| 334 | * returns 1 if other client is connected, 0 - otherwise. |
| 335 | */ |
| 336 | int mei_other_client_is_connecting(struct mei_device *dev, |
| 337 | struct mei_cl *cl) |
| 338 | { |
| 339 | struct mei_cl *cl_pos = NULL; |
| 340 | struct mei_cl *cl_next = NULL; |
| 341 | |
| 342 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { |
| 343 | if ((cl_pos->state == MEI_FILE_CONNECTING) && |
| 344 | (cl_pos != cl) && |
| 345 | cl->me_client_id == cl_pos->me_client_id) |
| 346 | return 1; |
| 347 | |
| 348 | } |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * mei_disconnect - sends disconnect message to fw. |
| 354 | * |
| 355 | * @dev: the device structure |
| 356 | * @cl: private data of the file object |
| 357 | * |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 358 | * This function returns -EIO on write failure |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 359 | */ |
| 360 | int mei_disconnect(struct mei_device *dev, struct mei_cl *cl) |
| 361 | { |
| 362 | struct mei_msg_hdr *mei_hdr; |
| 363 | struct hbm_client_disconnect_request *mei_cli_disconnect; |
| 364 | |
| 365 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; |
| 366 | mei_hdr->host_addr = 0; |
| 367 | mei_hdr->me_addr = 0; |
| 368 | mei_hdr->length = sizeof(struct hbm_client_disconnect_request); |
| 369 | mei_hdr->msg_complete = 1; |
| 370 | mei_hdr->reserved = 0; |
| 371 | |
| 372 | mei_cli_disconnect = |
| 373 | (struct hbm_client_disconnect_request *) &dev->wr_msg_buf[1]; |
Julia Lawall | c056998 | 2011-09-16 08:57:33 +0200 | [diff] [blame] | 374 | memset(mei_cli_disconnect, 0, sizeof(*mei_cli_disconnect)); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 375 | mei_cli_disconnect->host_addr = cl->host_client_id; |
| 376 | mei_cli_disconnect->me_addr = cl->me_client_id; |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 377 | mei_cli_disconnect->hbm_cmd = CLIENT_DISCONNECT_REQ_CMD; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 378 | mei_cli_disconnect->reserved[0] = 0; |
| 379 | |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 380 | return mei_write_message(dev, mei_hdr, |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 381 | (unsigned char *) mei_cli_disconnect, |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 382 | sizeof(struct hbm_client_disconnect_request)); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | /** |
| 386 | * mei_connect - sends connect message to fw. |
| 387 | * |
| 388 | * @dev: the device structure |
| 389 | * @cl: private data of the file object |
| 390 | * |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 391 | * This function returns -EIO on write failure |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 392 | */ |
| 393 | int mei_connect(struct mei_device *dev, struct mei_cl *cl) |
| 394 | { |
| 395 | struct mei_msg_hdr *mei_hdr; |
| 396 | struct hbm_client_connect_request *mei_cli_connect; |
| 397 | |
| 398 | mei_hdr = (struct mei_msg_hdr *) &dev->wr_msg_buf[0]; |
| 399 | mei_hdr->host_addr = 0; |
| 400 | mei_hdr->me_addr = 0; |
| 401 | mei_hdr->length = sizeof(struct hbm_client_connect_request); |
| 402 | mei_hdr->msg_complete = 1; |
| 403 | mei_hdr->reserved = 0; |
| 404 | |
| 405 | mei_cli_connect = |
| 406 | (struct hbm_client_connect_request *) &dev->wr_msg_buf[1]; |
| 407 | mei_cli_connect->host_addr = cl->host_client_id; |
| 408 | mei_cli_connect->me_addr = cl->me_client_id; |
Tomas Winkler | 1ca7e78 | 2012-02-26 23:18:57 +0200 | [diff] [blame] | 409 | mei_cli_connect->hbm_cmd = CLIENT_CONNECT_REQ_CMD; |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 410 | mei_cli_connect->reserved = 0; |
| 411 | |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 412 | return mei_write_message(dev, mei_hdr, |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 413 | (unsigned char *) mei_cli_connect, |
Tomas Winkler | 1ccb7b6 | 2012-03-14 14:39:42 +0200 | [diff] [blame] | 414 | sizeof(struct hbm_client_connect_request)); |
Oren Weil | 3ce7272 | 2011-05-15 13:43:43 +0300 | [diff] [blame] | 415 | } |