mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
The hardware mailboxes are used by the driver to submit requests to firmware and receive the completion notices from hardware. Initially, a management mailbox channel is up and running. The driver may request firmware to create/destroy more channels dynamically through management channel. Add driver internal mailbox interfaces. - create/destroy a mailbox channel instance - send a message to the firmware through a specific channel - wait for a notification from the specific channel Co-developed-by: George Yang <George.Yang@amd.com> Signed-off-by: George Yang <George.Yang@amd.com> Co-developed-by: Min Ma <min.ma@amd.com> Signed-off-by: Min Ma <min.ma@amd.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241118172942.2014541-4-lizhi.hou@amd.com
42 lines
1.1 KiB
C
42 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;
|
|
};
|
|
|
|
#define DECLARE_XDNA_MSG_COMMON(name, op, status) \
|
|
struct name##_req req = { 0 }; \
|
|
struct name##_resp resp = { status }; \
|
|
struct xdna_notify hdl = { \
|
|
.error = 0, \
|
|
.data = (u32 *)&resp, \
|
|
.size = sizeof(resp), \
|
|
.comp = COMPLETION_INITIALIZER_ONSTACK(hdl.comp), \
|
|
}; \
|
|
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, const u32 *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 */
|