Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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};
20
21#define DECLARE_XDNA_MSG_COMMON(name, op, status) \
22 struct name##_req req = { 0 }; \
23 struct name##_resp resp = { status }; \
24 struct xdna_notify hdl = { \
25 .error = 0, \
26 .data = (u32 *)&resp, \
27 .size = sizeof(resp), \
28 .comp = COMPLETION_INITIALIZER_ONSTACK(hdl.comp), \
29 }; \
30 struct xdna_mailbox_msg msg = { \
31 .send_data = (u8 *)&req, \
32 .send_size = sizeof(req), \
33 .handle = &hdl, \
34 .opcode = op, \
35 .notify_cb = xdna_msg_cb, \
36 }
37
38int xdna_msg_cb(void *handle, void __iomem *data, size_t size);
39int xdna_send_msg_wait(struct amdxdna_dev *xdna, struct mailbox_channel *chann,
40 struct xdna_mailbox_msg *msg);
41
42#endif /* _AMDXDNA_MAILBOX_HELPER_H */