Lines Matching refs:msg
53 static int __hsmp_send_message(struct hsmp_socket *sock, struct hsmp_message *msg) in __hsmp_send_message() argument
73 while (index < msg->num_args) { in __hsmp_send_message()
75 &msg->args[index], HSMP_WR); in __hsmp_send_message()
84 ret = sock->amd_hsmp_rdwr(sock, mbinfo->msg_id_off, &msg->msg_id, HSMP_WR); in __hsmp_send_message()
86 dev_err(sock->dev, "Error %d writing message ID %u\n", ret, msg->msg_id); in __hsmp_send_message()
121 msg->msg_id, mbox_status); in __hsmp_send_message()
125 msg->msg_id, mbox_status); in __hsmp_send_message()
129 msg->msg_id, mbox_status); in __hsmp_send_message()
133 msg->msg_id, mbox_status); in __hsmp_send_message()
137 msg->msg_id, mbox_status); in __hsmp_send_message()
141 msg->msg_id, mbox_status); in __hsmp_send_message()
153 while (index < msg->response_sz) { in __hsmp_send_message()
155 &msg->args[index], HSMP_RD); in __hsmp_send_message()
158 ret, index, msg->msg_id); in __hsmp_send_message()
167 static int validate_message(struct hsmp_message *msg) in validate_message() argument
170 if (msg->msg_id < HSMP_TEST || msg->msg_id >= HSMP_MSG_ID_MAX) in validate_message()
174 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_RSVD) in validate_message()
181 if (msg->num_args != hsmp_msg_desc_table[msg->msg_id].num_args) in validate_message()
191 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET) { in validate_message()
192 if (msg->response_sz > hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
196 if (msg->response_sz != hsmp_msg_desc_table[msg->msg_id].response_sz) in validate_message()
202 int hsmp_send_message(struct hsmp_message *msg) in hsmp_send_message() argument
207 if (!msg) in hsmp_send_message()
209 ret = validate_message(msg); in hsmp_send_message()
213 if (!hsmp_pdev.sock || msg->sock_ind >= hsmp_pdev.num_sockets) in hsmp_send_message()
215 sock = &hsmp_pdev.sock[msg->sock_ind]; in hsmp_send_message()
221 ret = __hsmp_send_message(sock, msg); in hsmp_send_message()
231 struct hsmp_message msg = {}; in hsmp_msg_get_nargs() local
237 msg.msg_id = msg_id; in hsmp_msg_get_nargs()
238 msg.sock_ind = sock_ind; in hsmp_msg_get_nargs()
239 msg.response_sz = num_args; in hsmp_msg_get_nargs()
241 ret = hsmp_send_message(&msg); in hsmp_msg_get_nargs()
246 data[i] = msg.args[i]; in hsmp_msg_get_nargs()
254 struct hsmp_message msg = { 0 }; in hsmp_test() local
261 msg.msg_id = HSMP_TEST; in hsmp_test()
262 msg.num_args = 1; in hsmp_test()
263 msg.response_sz = 1; in hsmp_test()
264 msg.args[0] = value; in hsmp_test()
265 msg.sock_ind = sock_ind; in hsmp_test()
267 ret = hsmp_send_message(&msg); in hsmp_test()
272 if (msg.args[0] != (value + 1)) { in hsmp_test()
275 sock_ind, (value + 1), msg.args[0]); in hsmp_test()
283 static bool is_get_msg(struct hsmp_message *msg) in is_get_msg() argument
285 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_GET) in is_get_msg()
288 if (hsmp_msg_desc_table[msg->msg_id].type == HSMP_SET_GET && in is_get_msg()
289 (msg->args[0] & CHECK_GET_BIT)) in is_get_msg()
298 struct hsmp_message msg = { 0 }; in hsmp_ioctl() local
301 if (copy_struct_from_user(&msg, sizeof(msg), arguser, sizeof(struct hsmp_message))) in hsmp_ioctl()
308 if (msg.msg_id < HSMP_TEST || msg.msg_id >= HSMP_MSG_ID_MAX) in hsmp_ioctl()
317 if (is_get_msg(&msg)) in hsmp_ioctl()
325 if (!is_get_msg(&msg)) in hsmp_ioctl()
338 ret = hsmp_send_message(&msg); in hsmp_ioctl()
342 if (hsmp_msg_desc_table[msg.msg_id].response_sz > 0) { in hsmp_ioctl()
344 if (copy_to_user(arguser, &msg, sizeof(struct hsmp_message))) in hsmp_ioctl()
353 struct hsmp_message msg = { 0 }; in hsmp_metric_tbl_read() local
365 msg.msg_id = HSMP_GET_METRIC_TABLE; in hsmp_metric_tbl_read()
366 msg.sock_ind = sock->sock_ind; in hsmp_metric_tbl_read()
368 ret = hsmp_send_message(&msg); in hsmp_metric_tbl_read()
380 struct hsmp_message msg = { 0 }; in hsmp_get_tbl_dram_base() local
384 msg.sock_ind = sock_ind; in hsmp_get_tbl_dram_base()
385 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_METRIC_TABLE_DRAM_ADDR].response_sz; in hsmp_get_tbl_dram_base()
386 msg.msg_id = HSMP_GET_METRIC_TABLE_DRAM_ADDR; in hsmp_get_tbl_dram_base()
388 ret = hsmp_send_message(&msg); in hsmp_get_tbl_dram_base()
396 dram_addr = msg.args[0] | ((u64)(msg.args[1]) << 32); in hsmp_get_tbl_dram_base()
413 struct hsmp_message msg = { 0 }; in hsmp_cache_proto_ver() local
416 msg.msg_id = HSMP_GET_PROTO_VER; in hsmp_cache_proto_ver()
417 msg.sock_ind = sock_ind; in hsmp_cache_proto_ver()
418 msg.response_sz = hsmp_msg_desc_table[HSMP_GET_PROTO_VER].response_sz; in hsmp_cache_proto_ver()
420 ret = hsmp_send_message(&msg); in hsmp_cache_proto_ver()
422 hsmp_pdev.proto_ver = msg.args[0]; in hsmp_cache_proto_ver()