bus.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * ISHTP bus definitions
  4. *
  5. * Copyright (c) 2014-2016, Intel Corporation.
  6. */
  7. #ifndef _LINUX_ISHTP_CL_BUS_H
  8. #define _LINUX_ISHTP_CL_BUS_H
  9. #include <linux/device.h>
  10. #include <linux/mod_devicetable.h>
  11. #include <linux/intel-ish-client-if.h>
  12. struct ishtp_cl;
  13. struct ishtp_cl_device;
  14. struct ishtp_device;
  15. struct ishtp_msg_hdr;
  16. /**
  17. * struct ishtp_cl_device - ISHTP device handle
  18. * @dev: device pointer
  19. * @ishtp_dev: pointer to ishtp device structure to primarily to access
  20. * hw device operation callbacks and properties
  21. * @fw_client: fw_client pointer to get fw information like protocol name
  22. * max message length etc.
  23. * @device_link: Link to next client in the list on a bus
  24. * @event_work: Used to schedule rx event for client
  25. * @driver_data: Storage driver private data
  26. * @reference_count: Used for get/put device
  27. * @event_cb: Callback to driver to send events
  28. *
  29. * An ishtp_cl_device pointer is returned from ishtp_add_device()
  30. * and links ISHTP bus clients to their actual host client pointer.
  31. * Drivers for ISHTP devices will get an ishtp_cl_device pointer
  32. * when being probed and shall use it for doing bus I/O.
  33. */
  34. struct ishtp_cl_device {
  35. struct device dev;
  36. struct ishtp_device *ishtp_dev;
  37. struct ishtp_fw_client *fw_client;
  38. struct list_head device_link;
  39. struct work_struct event_work;
  40. void *driver_data;
  41. int reference_count;
  42. void (*event_cb)(struct ishtp_cl_device *device);
  43. };
  44. int ishtp_bus_new_client(struct ishtp_device *dev);
  45. void ishtp_remove_all_clients(struct ishtp_device *dev);
  46. int ishtp_cl_device_bind(struct ishtp_cl *cl);
  47. void ishtp_cl_bus_rx_event(struct ishtp_cl_device *device);
  48. /* Write a multi-fragment message */
  49. int ishtp_send_msg(struct ishtp_device *dev,
  50. struct ishtp_msg_hdr *hdr, void *msg,
  51. void (*ipc_send_compl)(void *),
  52. void *ipc_send_compl_prm);
  53. /* Write a single-fragment message */
  54. int ishtp_write_message(struct ishtp_device *dev,
  55. struct ishtp_msg_hdr *hdr,
  56. void *buf);
  57. /* Use DMA to send/receive messages */
  58. int ishtp_use_dma_transfer(void);
  59. /* Exported functions */
  60. void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
  61. bool warm_reset);
  62. void ishtp_recv(struct ishtp_device *dev);
  63. void ishtp_reset_handler(struct ishtp_device *dev);
  64. void ishtp_reset_compl_handler(struct ishtp_device *dev);
  65. int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *cuuid);
  66. #endif /* _LINUX_ISHTP_CL_BUS_H */