Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * ISHTP bus definitions
0004  *
0005  * Copyright (c) 2014-2016, Intel Corporation.
0006  */
0007 #ifndef _LINUX_ISHTP_CL_BUS_H
0008 #define _LINUX_ISHTP_CL_BUS_H
0009 
0010 #include <linux/device.h>
0011 #include <linux/mod_devicetable.h>
0012 #include <linux/intel-ish-client-if.h>
0013 
0014 struct ishtp_cl;
0015 struct ishtp_cl_device;
0016 struct ishtp_device;
0017 struct ishtp_msg_hdr;
0018 
0019 /**
0020  * struct ishtp_cl_device - ISHTP device handle
0021  * @dev:    device pointer
0022  * @ishtp_dev:  pointer to ishtp device structure to primarily to access
0023  *      hw device operation callbacks and properties
0024  * @fw_client:  fw_client pointer to get fw information like protocol name
0025  *      max message length etc.
0026  * @device_link: Link to next client in the list on a bus
0027  * @event_work: Used to schedule rx event for client
0028  * @driver_data: Storage driver private data
0029  * @reference_count:    Used for get/put device
0030  * @event_cb:   Callback to driver to send events
0031  *
0032  * An ishtp_cl_device pointer is returned from ishtp_add_device()
0033  * and links ISHTP bus clients to their actual host client pointer.
0034  * Drivers for ISHTP devices will get an ishtp_cl_device pointer
0035  * when being probed and shall use it for doing bus I/O.
0036  */
0037 struct ishtp_cl_device {
0038     struct device       dev;
0039     struct ishtp_device *ishtp_dev;
0040     struct ishtp_fw_client  *fw_client;
0041     struct list_head    device_link;
0042     struct work_struct  event_work;
0043     void            *driver_data;
0044     int         reference_count;
0045     void (*event_cb)(struct ishtp_cl_device *device);
0046 };
0047 
0048 int ishtp_bus_new_client(struct ishtp_device *dev);
0049 void    ishtp_remove_all_clients(struct ishtp_device *dev);
0050 int ishtp_cl_device_bind(struct ishtp_cl *cl);
0051 void    ishtp_cl_bus_rx_event(struct ishtp_cl_device *device);
0052 
0053 /* Write a multi-fragment message */
0054 int ishtp_send_msg(struct ishtp_device *dev,
0055                struct ishtp_msg_hdr *hdr, void *msg,
0056                void (*ipc_send_compl)(void *),
0057                void *ipc_send_compl_prm);
0058 
0059 /* Write a single-fragment message */
0060 int ishtp_write_message(struct ishtp_device *dev,
0061                 struct ishtp_msg_hdr *hdr,
0062                 void *buf);
0063 
0064 /* Use DMA to send/receive messages */
0065 int ishtp_use_dma_transfer(void);
0066 
0067 /* Exported functions */
0068 void    ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
0069                      bool warm_reset);
0070 
0071 void    ishtp_recv(struct ishtp_device *dev);
0072 void    ishtp_reset_handler(struct ishtp_device *dev);
0073 void    ishtp_reset_compl_handler(struct ishtp_device *dev);
0074 
0075 int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid);
0076 #endif /* _LINUX_ISHTP_CL_BUS_H */