| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ISHTP client logic |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2003-2016, Intel Corporation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 8 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | 6 | */ |
|---|
| 15 | 7 | |
|---|
| 16 | 8 | #ifndef _ISHTP_CLIENT_H_ |
|---|
| .. | .. |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #include <linux/types.h> |
|---|
| 20 | 12 | #include "ishtp-dev.h" |
|---|
| 21 | | - |
|---|
| 22 | | -/* Client state */ |
|---|
| 23 | | -enum cl_state { |
|---|
| 24 | | - ISHTP_CL_INITIALIZING = 0, |
|---|
| 25 | | - ISHTP_CL_CONNECTING, |
|---|
| 26 | | - ISHTP_CL_CONNECTED, |
|---|
| 27 | | - ISHTP_CL_DISCONNECTING, |
|---|
| 28 | | - ISHTP_CL_DISCONNECTED |
|---|
| 29 | | -}; |
|---|
| 30 | 13 | |
|---|
| 31 | 14 | /* Tx and Rx ring size */ |
|---|
| 32 | 15 | #define CL_DEF_RX_RING_SIZE 2 |
|---|
| .. | .. |
|---|
| 84 | 67 | /* Client Tx buffers list */ |
|---|
| 85 | 68 | unsigned int tx_ring_size; |
|---|
| 86 | 69 | struct ishtp_cl_tx_ring tx_list, tx_free_list; |
|---|
| 70 | + int tx_ring_free_size; |
|---|
| 87 | 71 | spinlock_t tx_list_spinlock; |
|---|
| 88 | 72 | spinlock_t tx_free_list_spinlock; |
|---|
| 89 | 73 | size_t tx_offs; /* Offset in buffer at head of 'tx_list' */ |
|---|
| .. | .. |
|---|
| 125 | 109 | }; |
|---|
| 126 | 110 | |
|---|
| 127 | 111 | /* Client connection managenment internal functions */ |
|---|
| 128 | | -int ishtp_can_client_connect(struct ishtp_device *ishtp_dev, uuid_le *uuid); |
|---|
| 112 | +int ishtp_can_client_connect(struct ishtp_device *ishtp_dev, guid_t *uuid); |
|---|
| 129 | 113 | int ishtp_fw_cl_by_id(struct ishtp_device *dev, uint8_t client_id); |
|---|
| 130 | 114 | void ishtp_cl_send_msg(struct ishtp_device *dev, struct ishtp_cl *cl); |
|---|
| 131 | 115 | void recv_ishtp_cl_msg(struct ishtp_device *dev, |
|---|
| .. | .. |
|---|
| 137 | 121 | int ishtp_cl_alloc_tx_ring(struct ishtp_cl *cl); |
|---|
| 138 | 122 | void ishtp_cl_free_rx_ring(struct ishtp_cl *cl); |
|---|
| 139 | 123 | void ishtp_cl_free_tx_ring(struct ishtp_cl *cl); |
|---|
| 124 | +int ishtp_cl_get_tx_free_buffer_size(struct ishtp_cl *cl); |
|---|
| 125 | +int ishtp_cl_get_tx_free_rings(struct ishtp_cl *cl); |
|---|
| 140 | 126 | |
|---|
| 141 | 127 | /* DMA I/F functions */ |
|---|
| 142 | 128 | void recv_ishtp_cl_msg_dma(struct ishtp_device *dev, void *msg, |
|---|
| .. | .. |
|---|
| 165 | 151 | (cl1->host_client_id == cl2->host_client_id) && |
|---|
| 166 | 152 | (cl1->fw_client_id == cl2->fw_client_id); |
|---|
| 167 | 153 | } |
|---|
| 168 | | - |
|---|
| 169 | | -/* exported functions from ISHTP under client management scope */ |
|---|
| 170 | | -struct ishtp_cl *ishtp_cl_allocate(struct ishtp_device *dev); |
|---|
| 171 | | -void ishtp_cl_free(struct ishtp_cl *cl); |
|---|
| 172 | | -int ishtp_cl_link(struct ishtp_cl *cl, int id); |
|---|
| 173 | | -void ishtp_cl_unlink(struct ishtp_cl *cl); |
|---|
| 174 | | -int ishtp_cl_disconnect(struct ishtp_cl *cl); |
|---|
| 175 | | -int ishtp_cl_connect(struct ishtp_cl *cl); |
|---|
| 176 | | -int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length); |
|---|
| 177 | | -int ishtp_cl_flush_queues(struct ishtp_cl *cl); |
|---|
| 178 | | - |
|---|
| 179 | | -/* exported functions from ISHTP client buffer management scope */ |
|---|
| 180 | | -int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb); |
|---|
| 181 | 154 | |
|---|
| 182 | 155 | #endif /* _ISHTP_CLIENT_H_ */ |
|---|