File Index
Files and directories
Sign in
FILE

amdxdna_mailbox_helper.h

File preview with syntax highlighting.

linux-6.19.14/drivers/accel/amdxdna/amdxdna_mailbox_helper.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Copyright (C) 2023-2024, Advanced Micro Devices, Inc.
 4 */
 5
 6#ifndef _AMDXDNA_MAILBOX_HELPER_H
 7#define _AMDXDNA_MAILBOX_HELPER_H
 8
 9#define TX_TIMEOUT 2000 /* milliseconds */
10#define RX_TIMEOUT 5000 /* milliseconds */
11
12struct amdxdna_dev;
13
14struct xdna_notify {
15	struct completion       comp;
16	u32			*data;
17	size_t			size;
18	int			error;
19	u32			*status;
20};
21
22#define DECLARE_XDNA_MSG_COMMON(name, op, s)				\
23	struct name##_req	req = { 0 };				\
24	struct name##_resp	resp = { .status = s };			\
25	struct xdna_notify	hdl = {					\
26		.error = 0,						\
27		.data = (u32 *)&resp,					\
28		.size = sizeof(resp),					\
29		.comp = COMPLETION_INITIALIZER_ONSTACK(hdl.comp),	\
30		.status = (u32 *)&resp.status,				\
31	};								\
32	struct xdna_mailbox_msg msg = {					\
33		.send_data = (u8 *)&req,				\
34		.send_size = sizeof(req),				\
35		.handle = &hdl,						\
36		.opcode = op,						\
37		.notify_cb = xdna_msg_cb,				\
38	}
39
40int xdna_msg_cb(void *handle, void __iomem *data, size_t size);
41int xdna_send_msg_wait(struct amdxdna_dev *xdna, struct mailbox_channel *chann,
42		       struct xdna_mailbox_msg *msg);
43
44#endif /* _AMDXDNA_MAILBOX_HELPER_H */
~/ Read-only file preview.