i915_mei_hdcp_interface.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* SPDX-License-Identifier: (GPL-2.0+) */
  2. /*
  3. * Copyright © 2017-2019 Intel Corporation
  4. *
  5. * Authors:
  6. * Ramalingam C <ramalingam.c@intel.com>
  7. */
  8. #ifndef _I915_MEI_HDCP_INTERFACE_H_
  9. #define _I915_MEI_HDCP_INTERFACE_H_
  10. #include <linux/mutex.h>
  11. #include <linux/device.h>
  12. #include <drm/drm_hdcp.h>
  13. /**
  14. * enum hdcp_port_type - HDCP port implementation type defined by ME FW
  15. * @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type
  16. * @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port
  17. * @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON
  18. * (HDMI 2.0) solution
  19. * @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3)
  20. * solution
  21. */
  22. enum hdcp_port_type {
  23. HDCP_PORT_TYPE_INVALID,
  24. HDCP_PORT_TYPE_INTEGRATED,
  25. HDCP_PORT_TYPE_LSPCON,
  26. HDCP_PORT_TYPE_CPDP
  27. };
  28. /**
  29. * enum hdcp_wired_protocol - HDCP adaptation used on the port
  30. * @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol
  31. * @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port
  32. * @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port
  33. */
  34. enum hdcp_wired_protocol {
  35. HDCP_PROTOCOL_INVALID,
  36. HDCP_PROTOCOL_HDMI,
  37. HDCP_PROTOCOL_DP
  38. };
  39. enum mei_fw_ddi {
  40. MEI_DDI_INVALID_PORT = 0x0,
  41. MEI_DDI_B = 1,
  42. MEI_DDI_C,
  43. MEI_DDI_D,
  44. MEI_DDI_E,
  45. MEI_DDI_F,
  46. MEI_DDI_A = 7,
  47. MEI_DDI_RANGE_END = MEI_DDI_A,
  48. };
  49. /**
  50. * enum mei_fw_tc - ME Firmware defined index for transcoders
  51. * @MEI_INVALID_TRANSCODER: Index for Invalid transcoder
  52. * @MEI_TRANSCODER_EDP: Index for EDP Transcoder
  53. * @MEI_TRANSCODER_DSI0: Index for DSI0 Transcoder
  54. * @MEI_TRANSCODER_DSI1: Index for DSI1 Transcoder
  55. * @MEI_TRANSCODER_A: Index for Transcoder A
  56. * @MEI_TRANSCODER_B: Index for Transcoder B
  57. * @MEI_TRANSCODER_C: Index for Transcoder C
  58. * @MEI_TRANSCODER_D: Index for Transcoder D
  59. */
  60. enum mei_fw_tc {
  61. MEI_INVALID_TRANSCODER = 0x00,
  62. MEI_TRANSCODER_EDP,
  63. MEI_TRANSCODER_DSI0,
  64. MEI_TRANSCODER_DSI1,
  65. MEI_TRANSCODER_A = 0x10,
  66. MEI_TRANSCODER_B,
  67. MEI_TRANSCODER_C,
  68. MEI_TRANSCODER_D
  69. };
  70. /**
  71. * struct hdcp_port_data - intel specific HDCP port data
  72. * @fw_ddi: ddi index as per ME FW
  73. * @fw_tc: transcoder index as per ME FW
  74. * @port_type: HDCP port type as per ME FW classification
  75. * @protocol: HDCP adaptation as per ME FW
  76. * @k: No of streams transmitted on a port. Only on DP MST this is != 1
  77. * @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated.
  78. * Initialized to 0 on AKE_INIT. Incremented after every successful
  79. * transmission of RepeaterAuth_Stream_Manage message. When it rolls
  80. * over re-Auth has to be triggered.
  81. * @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the
  82. * streams
  83. */
  84. struct hdcp_port_data {
  85. enum mei_fw_ddi fw_ddi;
  86. enum mei_fw_tc fw_tc;
  87. u8 port_type;
  88. u8 protocol;
  89. u16 k;
  90. u32 seq_num_m;
  91. struct hdcp2_streamid_type *streams;
  92. };
  93. /**
  94. * struct i915_hdcp_component_ops- ops for HDCP2.2 services.
  95. * @owner: Module providing the ops
  96. * @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session.
  97. * And Prepare AKE_Init.
  98. * @verify_receiver_cert_prepare_km: Verify the Receiver Certificate
  99. * AKE_Send_Cert and prepare
  100. AKE_Stored_Km/AKE_No_Stored_Km
  101. * @verify_hprime: Verify AKE_Send_H_prime
  102. * @store_pairing_info: Store pairing info received
  103. * @initiate_locality_check: Prepare LC_Init
  104. * @verify_lprime: Verify lprime
  105. * @get_session_key: Prepare SKE_Send_Eks
  106. * @repeater_check_flow_prepare_ack: Validate the Downstream topology
  107. * and prepare rep_ack
  108. * @verify_mprime: Verify mprime
  109. * @enable_hdcp_authentication: Mark a port as authenticated.
  110. * @close_hdcp_session: Close the Wired HDCP Tx session per port.
  111. * This also disables the authenticated state of the port.
  112. */
  113. struct i915_hdcp_component_ops {
  114. /**
  115. * @owner: mei_hdcp module
  116. */
  117. struct module *owner;
  118. int (*initiate_hdcp2_session)(struct device *dev,
  119. struct hdcp_port_data *data,
  120. struct hdcp2_ake_init *ake_data);
  121. int (*verify_receiver_cert_prepare_km)(struct device *dev,
  122. struct hdcp_port_data *data,
  123. struct hdcp2_ake_send_cert
  124. *rx_cert,
  125. bool *km_stored,
  126. struct hdcp2_ake_no_stored_km
  127. *ek_pub_km,
  128. size_t *msg_sz);
  129. int (*verify_hprime)(struct device *dev,
  130. struct hdcp_port_data *data,
  131. struct hdcp2_ake_send_hprime *rx_hprime);
  132. int (*store_pairing_info)(struct device *dev,
  133. struct hdcp_port_data *data,
  134. struct hdcp2_ake_send_pairing_info
  135. *pairing_info);
  136. int (*initiate_locality_check)(struct device *dev,
  137. struct hdcp_port_data *data,
  138. struct hdcp2_lc_init *lc_init_data);
  139. int (*verify_lprime)(struct device *dev,
  140. struct hdcp_port_data *data,
  141. struct hdcp2_lc_send_lprime *rx_lprime);
  142. int (*get_session_key)(struct device *dev,
  143. struct hdcp_port_data *data,
  144. struct hdcp2_ske_send_eks *ske_data);
  145. int (*repeater_check_flow_prepare_ack)(struct device *dev,
  146. struct hdcp_port_data *data,
  147. struct hdcp2_rep_send_receiverid_list
  148. *rep_topology,
  149. struct hdcp2_rep_send_ack
  150. *rep_send_ack);
  151. int (*verify_mprime)(struct device *dev,
  152. struct hdcp_port_data *data,
  153. struct hdcp2_rep_stream_ready *stream_ready);
  154. int (*enable_hdcp_authentication)(struct device *dev,
  155. struct hdcp_port_data *data);
  156. int (*close_hdcp_session)(struct device *dev,
  157. struct hdcp_port_data *data);
  158. };
  159. /**
  160. * struct i915_hdcp_component_master - Used for communication between i915
  161. * and mei_hdcp drivers for the HDCP2.2 services
  162. * @mei_dev: device that provide the HDCP2.2 service from MEI Bus.
  163. * @hdcp_ops: Ops implemented by mei_hdcp driver, used by i915 driver.
  164. */
  165. struct i915_hdcp_comp_master {
  166. struct device *mei_dev;
  167. const struct i915_hdcp_component_ops *ops;
  168. /* To protect the above members. */
  169. struct mutex mutex;
  170. };
  171. #endif /* _I915_MEI_HDCP_INTERFACE_H_ */