Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2023-2024, Advanced Micro Devices, Inc.
|
|
*/
|
|
|
|
#ifndef _AMDXDNA_MAILBOX_HELPER_H
|
|
#define _AMDXDNA_MAILBOX_HELPER_H
|
|
|
|
#define TX_TIMEOUT 2000 /* milliseconds */
|
|
#define RX_TIMEOUT 5000 /* milliseconds */
|
|
|
|
struct amdxdna_dev;
|
|
|
|
struct xdna_notify {
|
|
struct completion comp;
|
|
u32 *data;
|
|
size_t size;
|
|
int error;
|
|
u32 *status;
|
|
};
|
|
|
|
#define DECLARE_XDNA_MSG_COMMON(name, op, s) \
|
|
struct name##_req req = { 0 }; \
|
|
struct name##_resp resp = { .status = s }; \
|
|
struct xdna_notify hdl = { \
|
|
.error = 0, \
|
|
.data = (u32 *)&resp, \
|
|
.size = sizeof(resp), \
|
|
.comp = COMPLETION_INITIALIZER_ONSTACK(hdl.comp), \
|
|
.status = (u32 *)&resp.status, \
|
|
}; \
|
|
struct xdna_mailbox_msg msg = { \
|
|
.send_data = (u8 *)&req, \
|
|
.send_size = sizeof(req), \
|
|
.handle = &hdl, \
|
|
.opcode = op, \
|
|
.notify_cb = xdna_msg_cb, \
|
|
}
|
|
|
|
int xdna_msg_cb(void *handle, void __iomem *data, size_t size);
|
|
int xdna_send_msg_wait(struct amdxdna_dev *xdna, struct mailbox_channel *chann,
|
|
struct xdna_mailbox_msg *msg);
|
|
|
|
#endif /* _AMDXDNA_MAILBOX_HELPER_H */
|