Lines Matching full:msg
55 static int __hsmp_send_message(struct hsmp_socket *sock, struct hsmp_message *msg) in __hsmp_send_message() argument
75 while (index < msg->num_args) { in __hsmp_send_message()
77 &msg->args[index], HSMP_WR); in __hsmp_send_message()
86 ret = sock->amd_hsmp_rdwr(sock, mbinfo->msg_id_off, &msg->msg_id, HSMP_WR); in __hsmp_send_message()
88 dev_err(sock->dev, "Error %d writing message ID %u\n", ret, msg->msg_id); in __hsmp_send_message()
119 msg->msg_id, mbox_status); in __hsmp_send_message()
123 msg->msg_id, mbox_status); in __hsmp_send_message()
127 msg->msg_id, mbox_status); in __hsmp_send_message()
131 msg->msg_id, mbox_status); in __hsmp_send_message()
135 msg->msg_id, mbox_status); in __hsmp_send_message()
139 msg->msg_id, mbox_status); in __hsmp_send_message()
151 while (index < msg->response_sz) { in __hsmp_send_message()
153 &msg->args[index], HSMP_RD); in __hsmp_send_message()
156 ret, index, msg->msg_id); in __hsmp_send_message()
165 static int validate_message(struct hsmp_message *msg) in validate_message() argument
168 if (msg->msg_id < HSMP_TEST || msg->msg_id >= HSMP_MSG_ID_MAX) in validate_message()
172 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_RSVD) in validate_message()
179 if (msg->num_args != hsmp_msg_desc_table[msg->msg_id].num_args) in validate_message()
189 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET) { in validate_message()
190 if (msg->response_sz > hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
194 if (msg->response_sz != hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
200 int hsmp_send_message(struct hsmp_message *msg) in hsmp_send_message() argument
205 if (!msg) in hsmp_send_message()
207 ret = validate_message(msg); in hsmp_send_message()
211 if (!hsmp_pdev.sock || msg->sock_ind >= hsmp_pdev.num_sockets) in hsmp_send_message()
213 sock = &hsmp_pdev.sock[msg->sock_ind]; in hsmp_send_message()
225 ret = __hsmp_send_message(sock, msg); in hsmp_send_message()
235 struct hsmp_message msg = { 0 }; in hsmp_test() local
242 msg.msg_id = HSMP_TEST; in hsmp_test()
243 msg.num_args = 1; in hsmp_test()
244 msg.response_sz = 1; in hsmp_test()
245 msg.args[0] = value; in hsmp_test()
246 msg.sock_ind = sock_ind; in hsmp_test()
248 ret = hsmp_send_message(&msg); in hsmp_test()
253 if (msg.args[0] != (value + 1)) { in hsmp_test()
256 sock_ind, (value + 1), msg.args[0]); in hsmp_test()
264 static bool is_get_msg(struct hsmp_message *msg) in is_get_msg() argument
266 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_GET) in is_get_msg()
269 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET && in is_get_msg()
270 (msg->args[0] & CHECK_GET_BIT)) in is_get_msg()
279 struct hsmp_message msg = { 0 }; in hsmp_ioctl() local
282 if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_message))) in hsmp_ioctl()
286 * Check msg_id is within the range of supported msg ids in hsmp_ioctl()
289 if (msg.msg_id < HSMP_TEST || msg.msg_id >= HSMP_MSG_ID_MAX) in hsmp_ioctl()
298 if (is_get_msg(&msg)) in hsmp_ioctl()
306 if (!is_get_msg(&msg)) in hsmp_ioctl()
319 ret = hsmp_send_message(&msg); in hsmp_ioctl()
323 if (hsmp_msg_desc_table[msg.msg_id].response_sz > 0) { in hsmp_ioctl()
325 if (copy_to_user(arguser, &msg, sizeof(struct hsmp_message))) in hsmp_ioctl()
334 struct hsmp_message msg = { 0 }; in hsmp_metric_tbl_read() local
346 msg.msg_id = HSMP_GET_METRIC_TABLE; in hsmp_metric_tbl_read()
347 msg.sock_ind = sock->sock_ind; in hsmp_metric_tbl_read()
349 ret = hsmp_send_message(&msg); in hsmp_metric_tbl_read()
361 struct hsmp_message msg = { 0 }; in hsmp_get_tbl_dram_base() local
365 msg.sock_ind = sock_ind; in hsmp_get_tbl_dram_base()
366 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_METRIC_TABLE_DRAM_ADDR].response_sz; in hsmp_get_tbl_dram_base()
367 msg.msg_id = HSMP_GET_METRIC_TABLE_DRAM_ADDR; in hsmp_get_tbl_dram_base()
369 ret = hsmp_send_message(&msg); in hsmp_get_tbl_dram_base()
377 dram_addr = msg.args[0] | ((u64)(msg.args[1]) << 32); in hsmp_get_tbl_dram_base()
394 struct hsmp_message msg = { 0 }; in hsmp_cache_proto_ver() local
397 msg.msg_id = HSMP_GET_PROTO_VER; in hsmp_cache_proto_ver()
398 msg.sock_ind = sock_ind; in hsmp_cache_proto_ver()
399 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_PROTO_VER].response_sz; in hsmp_cache_proto_ver()
401 ret = hsmp_send_message(&msg); in hsmp_cache_proto_ver()
403 hsmp_pdev.proto_ver = msg.args[0]; in hsmp_cache_proto_ver()