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