| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Intel SST generic IPC Support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2015, Intel Corporation. All rights reserved. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 8 | | - * 2 as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #ifndef __SST_GENERIC_IPC_H |
|---|
| .. | .. |
|---|
| 24 | 15 | #include <linux/workqueue.h> |
|---|
| 25 | 16 | #include <linux/sched.h> |
|---|
| 26 | 17 | |
|---|
| 27 | | -#define IPC_MAX_MAILBOX_BYTES 256 |
|---|
| 18 | +struct sst_ipc_message { |
|---|
| 19 | + u64 header; |
|---|
| 20 | + void *data; |
|---|
| 21 | + size_t size; |
|---|
| 22 | +}; |
|---|
| 28 | 23 | |
|---|
| 29 | 24 | struct ipc_message { |
|---|
| 30 | 25 | struct list_head list; |
|---|
| 31 | | - u64 header; |
|---|
| 32 | | - |
|---|
| 33 | | - /* direction wrt host CPU */ |
|---|
| 34 | | - char *tx_data; |
|---|
| 35 | | - size_t tx_size; |
|---|
| 36 | | - char *rx_data; |
|---|
| 37 | | - size_t rx_size; |
|---|
| 26 | + struct sst_ipc_message tx; |
|---|
| 27 | + struct sst_ipc_message rx; |
|---|
| 38 | 28 | |
|---|
| 39 | 29 | wait_queue_head_t waitq; |
|---|
| 40 | 30 | bool pending; |
|---|
| .. | .. |
|---|
| 44 | 34 | }; |
|---|
| 45 | 35 | |
|---|
| 46 | 36 | struct sst_generic_ipc; |
|---|
| 37 | +struct sst_dsp; |
|---|
| 47 | 38 | |
|---|
| 48 | 39 | struct sst_plat_ipc_ops { |
|---|
| 49 | 40 | void (*tx_msg)(struct sst_generic_ipc *, struct ipc_message *); |
|---|
| .. | .. |
|---|
| 74 | 65 | struct sst_plat_ipc_ops ops; |
|---|
| 75 | 66 | }; |
|---|
| 76 | 67 | |
|---|
| 77 | | -int sst_ipc_tx_message_wait(struct sst_generic_ipc *ipc, u64 header, |
|---|
| 78 | | - void *tx_data, size_t tx_bytes, void *rx_data, size_t rx_bytes); |
|---|
| 68 | +int sst_ipc_tx_message_wait(struct sst_generic_ipc *ipc, |
|---|
| 69 | + struct sst_ipc_message request, struct sst_ipc_message *reply); |
|---|
| 79 | 70 | |
|---|
| 80 | | -int sst_ipc_tx_message_nowait(struct sst_generic_ipc *ipc, u64 header, |
|---|
| 81 | | - void *tx_data, size_t tx_bytes); |
|---|
| 71 | +int sst_ipc_tx_message_nowait(struct sst_generic_ipc *ipc, |
|---|
| 72 | + struct sst_ipc_message request); |
|---|
| 82 | 73 | |
|---|
| 83 | | -int sst_ipc_tx_message_nopm(struct sst_generic_ipc *ipc, u64 header, |
|---|
| 84 | | - void *tx_data, size_t tx_bytes, void *rx_data, size_t rx_bytes); |
|---|
| 74 | +int sst_ipc_tx_message_nopm(struct sst_generic_ipc *ipc, |
|---|
| 75 | + struct sst_ipc_message request, struct sst_ipc_message *reply); |
|---|
| 85 | 76 | |
|---|
| 86 | 77 | struct ipc_message *sst_ipc_reply_find_msg(struct sst_generic_ipc *ipc, |
|---|
| 87 | 78 | u64 header); |
|---|
| .. | .. |
|---|
| 89 | 80 | void sst_ipc_tx_msg_reply_complete(struct sst_generic_ipc *ipc, |
|---|
| 90 | 81 | struct ipc_message *msg); |
|---|
| 91 | 82 | |
|---|
| 92 | | -void sst_ipc_drop_all(struct sst_generic_ipc *ipc); |
|---|
| 93 | 83 | int sst_ipc_init(struct sst_generic_ipc *ipc); |
|---|
| 94 | 84 | void sst_ipc_fini(struct sst_generic_ipc *ipc); |
|---|
| 95 | 85 | |
|---|