Lines Matching refs:msg

56 static int __hsmp_send_message(struct hsmp_socket *sock, struct hsmp_message *msg)  in __hsmp_send_message()  argument
76 while (index < msg->num_args) { in __hsmp_send_message()
78 &msg->args[index], HSMP_WR); in __hsmp_send_message()
87 ret = sock->amd_hsmp_rdwr(sock, mbinfo->msg_id_off, &msg->msg_id, HSMP_WR); in __hsmp_send_message()
89 dev_err(sock->dev, "Error %d writing message ID %u\n", ret, msg->msg_id); in __hsmp_send_message()
120 msg->msg_id, mbox_status); in __hsmp_send_message()
124 msg->msg_id, mbox_status); in __hsmp_send_message()
128 msg->msg_id, mbox_status); in __hsmp_send_message()
132 msg->msg_id, mbox_status); in __hsmp_send_message()
136 msg->msg_id, mbox_status); in __hsmp_send_message()
140 msg->msg_id, mbox_status); in __hsmp_send_message()
152 while (index < msg->response_sz) { in __hsmp_send_message()
154 &msg->args[index], HSMP_RD); in __hsmp_send_message()
157 ret, index, msg->msg_id); in __hsmp_send_message()
166 static int validate_message(struct hsmp_message *msg) in validate_message() argument
169 if (msg->msg_id < HSMP_TEST || msg->msg_id >= HSMP_MSG_ID_MAX) in validate_message()
173 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_RSVD) in validate_message()
180 if (msg->num_args != hsmp_msg_desc_table[msg->msg_id].num_args) in validate_message()
190 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET) { in validate_message()
191 if (msg->response_sz > hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
195 if (msg->response_sz != hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
201 int hsmp_send_message(struct hsmp_message *msg) in hsmp_send_message() argument
206 if (!msg) in hsmp_send_message()
208 ret = validate_message(msg); in hsmp_send_message()
212 if (!hsmp_pdev.sock || msg->sock_ind >= hsmp_pdev.num_sockets) in hsmp_send_message()
214 sock = &hsmp_pdev.sock[msg->sock_ind]; in hsmp_send_message()
226 ret = __hsmp_send_message(sock, msg); in hsmp_send_message()
236 struct hsmp_message msg = { 0 }; in hsmp_test() local
243 msg.msg_id = HSMP_TEST; in hsmp_test()
244 msg.num_args = 1; in hsmp_test()
245 msg.response_sz = 1; in hsmp_test()
246 msg.args[0] = value; in hsmp_test()
247 msg.sock_ind = sock_ind; in hsmp_test()
249 ret = hsmp_send_message(&msg); in hsmp_test()
254 if (msg.args[0] != (value + 1)) { in hsmp_test()
257 sock_ind, (value + 1), msg.args[0]); in hsmp_test()
265 static bool is_get_msg(struct hsmp_message *msg) in is_get_msg() argument
267 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_GET) in is_get_msg()
270 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET && in is_get_msg()
271 (msg->args[0] & CHECK_GET_BIT)) in is_get_msg()
280 struct hsmp_message msg = { 0 }; in hsmp_ioctl() local
283 if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_message))) in hsmp_ioctl()
290 if (msg.msg_id < HSMP_TEST || msg.msg_id >= HSMP_MSG_ID_MAX) in hsmp_ioctl()
299 if (is_get_msg(&msg)) in hsmp_ioctl()
307 if (!is_get_msg(&msg)) in hsmp_ioctl()
320 ret = hsmp_send_message(&msg); in hsmp_ioctl()
324 if (hsmp_msg_desc_table[msg.msg_id].response_sz > 0) { in hsmp_ioctl()
326 if (copy_to_user(arguser, &msg, sizeof(struct hsmp_message))) in hsmp_ioctl()
335 struct hsmp_message msg = { 0 }; in hsmp_metric_tbl_read() local
347 msg.msg_id = HSMP_GET_METRIC_TABLE; in hsmp_metric_tbl_read()
348 msg.sock_ind = sock->sock_ind; in hsmp_metric_tbl_read()
350 ret = hsmp_send_message(&msg); in hsmp_metric_tbl_read()
362 struct hsmp_message msg = { 0 }; in hsmp_get_tbl_dram_base() local
366 msg.sock_ind = sock_ind; in hsmp_get_tbl_dram_base()
367 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_METRIC_TABLE_DRAM_ADDR].response_sz; in hsmp_get_tbl_dram_base()
368 msg.msg_id = HSMP_GET_METRIC_TABLE_DRAM_ADDR; in hsmp_get_tbl_dram_base()
370 ret = hsmp_send_message(&msg); in hsmp_get_tbl_dram_base()
378 dram_addr = msg.args[0] | ((u64)(msg.args[1]) << 32); in hsmp_get_tbl_dram_base()
395 struct hsmp_message msg = { 0 }; in hsmp_cache_proto_ver() local
398 msg.msg_id = HSMP_GET_PROTO_VER; in hsmp_cache_proto_ver()
399 msg.sock_ind = sock_ind; in hsmp_cache_proto_ver()
400 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_PROTO_VER].response_sz; in hsmp_cache_proto_ver()
402 ret = hsmp_send_message(&msg); in hsmp_cache_proto_ver()
404 hsmp_pdev.proto_ver = msg.args[0]; in hsmp_cache_proto_ver()