// SPDX-License-Identifier: GPL-2.0 /* * Copyright © 2019 Intel Corporation * * mei_hdcp.c: HDCP client driver for mei bus * * Author: * Ramalingam C <[email protected]> */ /** * DOC: MEI_HDCP Client Driver * * The mei_hdcp driver acts as a translation layer between HDCP 2.2 * protocol implementer (I915) and ME FW by translating HDCP2.2 * negotiation messages to ME FW command payloads and vice versa. */ #include <linux/module.h> #include <linux/pci.h> #include <linux/slab.h> #include <linux/mei.h> #include <linux/mei_cl_bus.h> #include <linux/component.h> #include <drm/drm_connector.h> #include <drm/intel/i915_component.h> #include <drm/intel/i915_hdcp_interface.h> #include "mei_hdcp.h" /** * mei_hdcp_initiate_session() - Initiate a Wired HDCP2.2 Tx Session in ME FW * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @ake_data: AKE_Init msg output. * * Return: 0 on Success, <0 on Failure. */ static int mei_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_init *ake_data) { … } /** * mei_hdcp_verify_receiver_cert_prepare_km() - Verify the Receiver Certificate * AKE_Send_Cert and prepare AKE_Stored_Km/AKE_No_Stored_Km * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @rx_cert: AKE_Send_Cert for verification * @km_stored: Pairing status flag output * @ek_pub_km: AKE_Stored_Km/AKE_No_Stored_Km output msg * @msg_sz : size of AKE_XXXXX_Km output msg * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_verify_receiver_cert_prepare_km(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_cert *rx_cert, bool *km_stored, struct hdcp2_ake_no_stored_km *ek_pub_km, size_t *msg_sz) { … } /** * mei_hdcp_verify_hprime() - Verify AKE_Send_H_prime at ME FW. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @rx_hprime: AKE_Send_H_prime msg for ME FW verification * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_hprime *rx_hprime) { … } /** * mei_hdcp_store_pairing_info() - Store pairing info received at ME FW * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @pairing_info: AKE_Send_Pairing_Info msg input to ME FW * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_send_pairing_info *pairing_info) { … } /** * mei_hdcp_initiate_locality_check() - Prepare LC_Init * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @lc_init_data: LC_Init msg output * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_initiate_locality_check(struct device *dev, struct hdcp_port_data *data, struct hdcp2_lc_init *lc_init_data) { … } /** * mei_hdcp_verify_lprime() - Verify lprime. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @rx_lprime: LC_Send_L_prime msg for ME FW verification * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_lc_send_lprime *rx_lprime) { … } /** * mei_hdcp_get_session_key() - Prepare SKE_Send_Eks. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @ske_data: SKE_Send_Eks msg output from ME FW. * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_get_session_key(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ske_send_eks *ske_data) { … } /** * mei_hdcp_repeater_check_flow_prepare_ack() - Validate the Downstream topology * and prepare rep_ack. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @rep_topology: Receiver ID List to be validated * @rep_send_ack : repeater ack from ME FW. * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_repeater_check_flow_prepare_ack(struct device *dev, struct hdcp_port_data *data, struct hdcp2_rep_send_receiverid_list *rep_topology, struct hdcp2_rep_send_ack *rep_send_ack) { … } /** * mei_hdcp_verify_mprime() - Verify mprime. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * @stream_ready: RepeaterAuth_Stream_Ready msg for ME FW verification. * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_verify_mprime(struct device *dev, struct hdcp_port_data *data, struct hdcp2_rep_stream_ready *stream_ready) { … } /** * mei_hdcp_enable_authentication() - Mark a port as authenticated * through ME FW * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_enable_authentication(struct device *dev, struct hdcp_port_data *data) { … } /** * mei_hdcp_close_session() - Close the Wired HDCP Tx session of ME FW per port. * This also disables the authenticated state of the port. * @dev: device corresponding to the mei_cl_device * @data: Intel HW specific hdcp data * * Return: 0 on Success, <0 on Failure */ static int mei_hdcp_close_session(struct device *dev, struct hdcp_port_data *data) { … } static const struct i915_hdcp_ops mei_hdcp_ops = …; static int mei_component_master_bind(struct device *dev) { … } static void mei_component_master_unbind(struct device *dev) { … } static const struct component_master_ops mei_component_master_ops = …; /** * mei_hdcp_component_match - compare function for matching mei hdcp. * * The function checks if the driver is i915, the subcomponent is HDCP * and the grand parent of hdcp and the parent of i915 are the same * PCH device. * * @dev: master device * @subcomponent: subcomponent to match (I915_COMPONENT_HDCP) * @data: compare data (mei hdcp device) * * Return: * * 1 - if components match * * 0 - otherwise */ static int mei_hdcp_component_match(struct device *dev, int subcomponent, void *data) { … } static int mei_hdcp_probe(struct mei_cl_device *cldev, const struct mei_cl_device_id *id) { … } static void mei_hdcp_remove(struct mei_cl_device *cldev) { … } #define MEI_UUID_HDCP … static const struct mei_cl_device_id mei_hdcp_tbl[] = …; MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl); static struct mei_cl_driver mei_hdcp_driver = …; module_mei_cl_driver(…) …; MODULE_AUTHOR(…) …; MODULE_LICENSE(…) …; MODULE_DESCRIPTION(…) …;