Lines Matching refs:msg

78 static int __hsmp_send_message(struct pci_dev *root, struct hsmp_message *msg)  in __hsmp_send_message()  argument
95 while (index < msg->num_args) { in __hsmp_send_message()
97 &msg->args[index], HSMP_WR); in __hsmp_send_message()
106 ret = amd_hsmp_rdwr(root, SMN_HSMP_MSG_ID, &msg->msg_id, HSMP_WR); in __hsmp_send_message()
108 pr_err("Error %d writing message ID %u\n", ret, msg->msg_id); in __hsmp_send_message()
145 msg->msg_id, mbox_status); in __hsmp_send_message()
157 while (index < msg->response_sz) { in __hsmp_send_message()
159 &msg->args[index], HSMP_RD); in __hsmp_send_message()
162 ret, index, msg->msg_id); in __hsmp_send_message()
171 static int validate_message(struct hsmp_message *msg) in validate_message() argument
174 if (msg->msg_id < HSMP_TEST || msg->msg_id >= HSMP_MSG_ID_MAX) in validate_message()
178 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_RSVD) in validate_message()
182 if (msg->num_args != hsmp_msg_desc_table[msg->msg_id].num_args || in validate_message()
183 msg->response_sz != hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
189 int hsmp_send_message(struct hsmp_message *msg) in hsmp_send_message() argument
194 if (!msg) in hsmp_send_message()
197 nb = node_to_amd_nb(msg->sock_ind); in hsmp_send_message()
201 ret = validate_message(msg); in hsmp_send_message()
211 ret = down_timeout(&hsmp_sem[msg->sock_ind], in hsmp_send_message()
216 ret = __hsmp_send_message(nb->root, msg); in hsmp_send_message()
218 up(&hsmp_sem[msg->sock_ind]); in hsmp_send_message()
226 struct hsmp_message msg = { 0 }; in hsmp_test() local
238 msg.msg_id = HSMP_TEST; in hsmp_test()
239 msg.num_args = 1; in hsmp_test()
240 msg.response_sz = 1; in hsmp_test()
241 msg.args[0] = value; in hsmp_test()
242 msg.sock_ind = sock_ind; in hsmp_test()
244 ret = __hsmp_send_message(nb->root, &msg); in hsmp_test()
249 if (msg.args[0] != (value + 1)) { in hsmp_test()
251 sock_ind, (value + 1), msg.args[0]); in hsmp_test()
261 struct hsmp_message msg = { 0 }; in hsmp_ioctl() local
264 if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_message))) in hsmp_ioctl()
271 if (msg.msg_id < HSMP_TEST || msg.msg_id >= HSMP_MSG_ID_MAX) in hsmp_ioctl()
280 if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_SET) in hsmp_ioctl()
288 if (hsmp_msg_desc_table[msg.msg_id].type != HSMP_GET) in hsmp_ioctl()
301 ret = hsmp_send_message(&msg); in hsmp_ioctl()
305 if (hsmp_msg_desc_table[msg.msg_id].response_sz > 0) { in hsmp_ioctl()
307 if (copy_to_user(arguser, &msg, sizeof(struct hsmp_message))) in hsmp_ioctl()