Lines Matching refs:me
111 static bool mei_init(struct mei *me, const uuid_le *guid, in mei_init() argument
118 me->verbose = verbose; in mei_init()
120 me->fd = open("/dev/mei0", O_RDWR); in mei_init()
121 if (me->fd == -1) { in mei_init()
122 mei_err(me, "Cannot establish a handle to the Intel MEI driver\n"); in mei_init()
125 memcpy(&me->guid, guid, sizeof(*guid)); in mei_init()
127 me->initialized = true; in mei_init()
129 memcpy(&data.in_client_uuid, &me->guid, sizeof(me->guid)); in mei_init()
130 result = ioctl(me->fd, IOCTL_MEI_CONNECT_CLIENT, &data); in mei_init()
132 mei_err(me, "IOCTL_MEI_CONNECT_CLIENT receive message. err=%d\n", result); in mei_init()
136 mei_msg(me, "max_message_length %d\n", cl->max_msg_length); in mei_init()
137 mei_msg(me, "protocol_version %d\n", cl->protocol_version); in mei_init()
141 mei_err(me, "Intel MEI protocol version not supported\n"); in mei_init()
145 me->buf_size = cl->max_msg_length; in mei_init()
146 me->prot_ver = cl->protocol_version; in mei_init()
150 mei_deinit(me); in mei_init()
154 static ssize_t mei_recv_msg(struct mei *me, unsigned char *buffer, in mei_recv_msg() argument
164 mei_msg(me, "call read length = %zd\n", len); in mei_recv_msg()
167 FD_SET(me->fd, &set); in mei_recv_msg()
168 rc = select(me->fd + 1, &set, NULL, NULL, &tv); in mei_recv_msg()
169 if (rc > 0 && FD_ISSET(me->fd, &set)) { in mei_recv_msg()
170 mei_msg(me, "have reply\n"); in mei_recv_msg()
173 mei_err(me, "read failed on timeout\n"); in mei_recv_msg()
177 mei_err(me, "read failed on select with status %zd %s\n", in mei_recv_msg()
182 rc = read(me->fd, buffer, len); in mei_recv_msg()
184 mei_err(me, "read failed with status %zd %s\n", in mei_recv_msg()
189 mei_msg(me, "read succeeded with result %zd\n", rc); in mei_recv_msg()
193 mei_deinit(me); in mei_recv_msg()
198 static ssize_t mei_send_msg(struct mei *me, const unsigned char *buffer, in mei_send_msg() argument
204 mei_msg(me, "call write length = %zd\n", len); in mei_send_msg()
206 written = write(me->fd, buffer, len); in mei_send_msg()
209 mei_err(me, "write failed with status %zd %s\n", in mei_send_msg()
213 mei_msg(me, "write success\n"); in mei_send_msg()
218 mei_deinit(me); in mei_send_msg()