Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2018-2020 Linaro Ltd.
0005  */
0006 #ifndef _GSI_PRIVATE_H_
0007 #define _GSI_PRIVATE_H_
0008 
0009 /* === Only "gsi.c" and "gsi_trans.c" should include this file === */
0010 
0011 #include <linux/types.h>
0012 
0013 struct gsi_trans;
0014 struct gsi_ring;
0015 struct gsi_channel;
0016 
0017 #define GSI_RING_ELEMENT_SIZE   16  /* bytes; must be a power of 2 */
0018 
0019 /**
0020  * gsi_trans_move_complete() - Mark a GSI transaction completed
0021  * @trans:  Transaction to commit
0022  */
0023 void gsi_trans_move_complete(struct gsi_trans *trans);
0024 
0025 /**
0026  * gsi_trans_move_polled() - Mark a transaction polled
0027  * @trans:  Transaction to update
0028  */
0029 void gsi_trans_move_polled(struct gsi_trans *trans);
0030 
0031 /**
0032  * gsi_trans_complete() - Complete a GSI transaction
0033  * @trans:  Transaction to complete
0034  *
0035  * Marks a transaction complete (including freeing it).
0036  */
0037 void gsi_trans_complete(struct gsi_trans *trans);
0038 
0039 /**
0040  * gsi_channel_trans_mapped() - Return a transaction mapped to a TRE index
0041  * @channel:    Channel associated with the transaction
0042  * @index:  Index of the TRE having a transaction
0043  *
0044  * Return:  The GSI transaction pointer associated with the TRE index
0045  */
0046 struct gsi_trans *gsi_channel_trans_mapped(struct gsi_channel *channel,
0047                        u32 index);
0048 
0049 /**
0050  * gsi_channel_trans_complete() - Return a channel's next completed transaction
0051  * @channel:    Channel whose next transaction is to be returned
0052  *
0053  * Return:  The next completed transaction, or NULL if nothing new
0054  */
0055 struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel);
0056 
0057 /**
0058  * gsi_channel_trans_cancel_pending() - Cancel pending transactions
0059  * @channel:    Channel whose pending transactions should be cancelled
0060  *
0061  * Cancel all pending transactions on a channel.  These are transactions
0062  * that have been committed but not yet completed.  This is required when
0063  * the channel gets reset.  At that time all pending transactions will be
0064  * marked as cancelled.
0065  *
0066  * NOTE:  Transactions already complete at the time of this call are
0067  *    unaffected.
0068  */
0069 void gsi_channel_trans_cancel_pending(struct gsi_channel *channel);
0070 
0071 /**
0072  * gsi_channel_trans_init() - Initialize a channel's GSI transaction info
0073  * @gsi:    GSI pointer
0074  * @channel_id: Channel number
0075  *
0076  * Return:  0 if successful, or -ENOMEM on allocation failure
0077  *
0078  * Creates and sets up information for managing transactions on a channel
0079  */
0080 int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id);
0081 
0082 /**
0083  * gsi_channel_trans_exit() - Inverse of gsi_channel_trans_init()
0084  * @channel:    Channel whose transaction information is to be cleaned up
0085  */
0086 void gsi_channel_trans_exit(struct gsi_channel *channel);
0087 
0088 /**
0089  * gsi_channel_doorbell() - Ring a channel's doorbell
0090  * @channel:    Channel whose doorbell should be rung
0091  *
0092  * Rings a channel's doorbell to inform the GSI hardware that new
0093  * transactions (TREs, really) are available for it to process.
0094  */
0095 void gsi_channel_doorbell(struct gsi_channel *channel);
0096 
0097 /**
0098  * gsi_ring_virt() - Return virtual address for a ring entry
0099  * @ring:   Ring whose address is to be translated
0100  * @index:  Index (slot number) of entry
0101  */
0102 void *gsi_ring_virt(struct gsi_ring *ring, u32 index);
0103 
0104 /**
0105  * gsi_trans_tx_committed() - Record bytes committed for transmit
0106  * @trans:  TX endpoint transaction being committed
0107  *
0108  * Report that a TX transaction has been committed.  It updates some
0109  * statistics used to manage transmit rates.
0110  */
0111 void gsi_trans_tx_committed(struct gsi_trans *trans);
0112 
0113 /**
0114  * gsi_trans_tx_queued() - Report a queued TX channel transaction
0115  * @trans:  Transaction being passed to hardware
0116  *
0117  * Report to the network stack that a TX transaction is being supplied
0118  * to the hardware.
0119  */
0120 void gsi_trans_tx_queued(struct gsi_trans *trans);
0121 
0122 #endif /* _GSI_PRIVATE_H_ */