提交 f699f9f9 编写于 作者: G Greg Kroah-Hartman

Merge tag 'topic/mei-hdcp-2019-02-26' of...

Merge tag 'topic/mei-hdcp-2019-02-26' of git://anongit.freedesktop.org/drm/drm-intel into char-misc-next

Daniel writes:

mei-hdcp driver

mei driver for the me hdcp client, for use by drm/i915.

Including the following prep work:
- whitelist hdcp client in mei bus
- merge to include char-misc-next
- drm/i915 side of the mei_hdcp/i915 component interface
- component prep work (including one patch touching i915&snd-hda)

* tag 'topic/mei-hdcp-2019-02-26' of git://anongit.freedesktop.org/drm/drm-intel: (23 commits)
  misc/mei/hdcp: Component framework for I915 Interface
  misc/mei/hdcp: Closing wired HDCP2.2 Tx Session
  misc/mei/hdcp: Enabling the HDCP authentication
  misc/mei/hdcp: Verify M_prime
  misc/mei/hdcp: Repeater topology verification and ack
  misc/mei/hdcp: Prepare Session Key
  misc/mei/hdcp: Verify L_prime
  misc/mei/hdcp: Initiate Locality check
  misc/mei/hdcp: Store the HDCP Pairing info
  misc/mei/hdcp: Verify H_prime
  misc/mei/hdcp: Verify Receiver Cert and prepare km
  misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session
  misc/mei/hdcp: Define ME FW interface for HDCP2.2
  misc/mei/hdcp: Client driver for HDCP application
  mei: bus: whitelist hdcp client
  drm/audio: declaration of struct device
  drm: helper functions for hdcp2 seq_num to from u32
  drm/i915: MEI interface definition
  drm/i915: header for i915 - MEI_HDCP interface
  drm/i915: enum port definition is moved into i915_drm.h
  ...
======================================
Component Helper for Aggregate Drivers
======================================
.. kernel-doc:: drivers/base/component.c
:doc: overview
API
===
.. kernel-doc:: include/linux/component.h
:internal:
.. kernel-doc:: drivers/base/component.c
:export:
.. |struct dev_pm_domain| replace:: :c:type:`struct dev_pm_domain <dev_pm_domain>`
.. |struct generic_pm_domain| replace:: :c:type:`struct generic_pm_domain <generic_pm_domain>`
.. _device_link:
============
Device links
============
......
......@@ -22,6 +22,7 @@ available subsections can be seen below.
device_connection
dma-buf
device_link
component
message-based
sound
frame-buffer
......
......@@ -16,11 +16,38 @@
#include <linux/slab.h>
#include <linux/debugfs.h>
/**
* DOC: overview
*
* The component helper allows drivers to collect a pile of sub-devices,
* including their bound drivers, into an aggregate driver. Various subsystems
* already provide functions to get hold of such components, e.g.
* of_clk_get_by_name(). The component helper can be used when such a
* subsystem-specific way to find a device is not available: The component
* helper fills the niche of aggregate drivers for specific hardware, where
* further standardization into a subsystem would not be practical. The common
* example is when a logical device (e.g. a DRM display driver) is spread around
* the SoC on various component (scanout engines, blending blocks, transcoders
* for various outputs and so on).
*
* The component helper also doesn't solve runtime dependencies, e.g. for system
* suspend and resume operations. See also :ref:`device links<device_link>`.
*
* Components are registered using component_add() and unregistered with
* component_del(), usually from the driver's probe and disconnect functions.
*
* Aggregate drivers first assemble a component match list of what they need
* using component_match_add(). This is then registered as an aggregate driver
* using component_master_add_with_match(), and unregistered using
* component_master_del().
*/
struct component;
struct component_match_array {
void *data;
int (*compare)(struct device *, void *);
int (*compare_typed)(struct device *, int, void *);
void (*release)(struct device *, void *);
struct component *component;
bool duplicate;
......@@ -48,6 +75,7 @@ struct component {
bool bound;
const struct component_ops *ops;
int subcomponent;
struct device *dev;
};
......@@ -132,7 +160,7 @@ static struct master *__master_find(struct device *dev,
}
static struct component *find_component(struct master *master,
int (*compare)(struct device *, void *), void *compare_data)
struct component_match_array *mc)
{
struct component *c;
......@@ -140,7 +168,11 @@ static struct component *find_component(struct master *master,
if (c->master && c->master != master)
continue;
if (compare(c->dev, compare_data))
if (mc->compare && mc->compare(c->dev, mc->data))
return c;
if (mc->compare_typed &&
mc->compare_typed(c->dev, c->subcomponent, mc->data))
return c;
}
......@@ -166,7 +198,7 @@ static int find_components(struct master *master)
if (match->compare[i].component)
continue;
c = find_component(master, mc->compare, mc->data);
c = find_component(master, mc);
if (!c) {
ret = -ENXIO;
break;
......@@ -301,15 +333,12 @@ static int component_match_realloc(struct device *dev,
return 0;
}
/*
* Add a component to be matched, with a release function.
*
* The match array is first created or extended if necessary.
*/
void component_match_add_release(struct device *master,
static void __component_match_add(struct device *master,
struct component_match **matchptr,
void (*release)(struct device *, void *),
int (*compare)(struct device *, void *), void *compare_data)
int (*compare)(struct device *, void *),
int (*compare_typed)(struct device *, int, void *),
void *compare_data)
{
struct component_match *match = *matchptr;
......@@ -341,13 +370,69 @@ void component_match_add_release(struct device *master,
}
match->compare[match->num].compare = compare;
match->compare[match->num].compare_typed = compare_typed;
match->compare[match->num].release = release;
match->compare[match->num].data = compare_data;
match->compare[match->num].component = NULL;
match->num++;
}
/**
* component_match_add_release - add a component match with release callback
* @master: device with the aggregate driver
* @matchptr: pointer to the list of component matches
* @release: release function for @compare_data
* @compare: compare function to match against all components
* @compare_data: opaque pointer passed to the @compare function
*
* Adds a new component match to the list stored in @matchptr, which the @master
* aggregate driver needs to function. The list of component matches pointed to
* by @matchptr must be initialized to NULL before adding the first match. This
* only matches against components added with component_add().
*
* The allocated match list in @matchptr is automatically released using devm
* actions, where upon @release will be called to free any references held by
* @compare_data, e.g. when @compare_data is a &device_node that must be
* released with of_node_put().
*
* See also component_match_add() and component_match_add_typed().
*/
void component_match_add_release(struct device *master,
struct component_match **matchptr,
void (*release)(struct device *, void *),
int (*compare)(struct device *, void *), void *compare_data)
{
__component_match_add(master, matchptr, release, compare, NULL,
compare_data);
}
EXPORT_SYMBOL(component_match_add_release);
/**
* component_match_add_typed - add a compent match for a typed component
* @master: device with the aggregate driver
* @matchptr: pointer to the list of component matches
* @compare_typed: compare function to match against all typed components
* @compare_data: opaque pointer passed to the @compare function
*
* Adds a new component match to the list stored in @matchptr, which the @master
* aggregate driver needs to function. The list of component matches pointed to
* by @matchptr must be initialized to NULL before adding the first match. This
* only matches against components added with component_add_typed().
*
* The allocated match list in @matchptr is automatically released using devm
* actions.
*
* See also component_match_add_release() and component_match_add_typed().
*/
void component_match_add_typed(struct device *master,
struct component_match **matchptr,
int (*compare_typed)(struct device *, int, void *), void *compare_data)
{
__component_match_add(master, matchptr, NULL, NULL, compare_typed,
compare_data);
}
EXPORT_SYMBOL(component_match_add_typed);
static void free_master(struct master *master)
{
struct component_match *match = master->match;
......@@ -367,6 +452,18 @@ static void free_master(struct master *master)
kfree(master);
}
/**
* component_master_add_with_match - register an aggregate driver
* @dev: device with the aggregate driver
* @ops: callbacks for the aggregate driver
* @match: component match list for the aggregate driver
*
* Registers a new aggregate driver consisting of the components added to @match
* by calling one of the component_match_add() functions. Once all components in
* @match are available, it will be assembled by calling
* &component_master_ops.bind from @ops. Must be unregistered by calling
* component_master_del().
*/
int component_master_add_with_match(struct device *dev,
const struct component_master_ops *ops,
struct component_match *match)
......@@ -403,6 +500,15 @@ int component_master_add_with_match(struct device *dev,
}
EXPORT_SYMBOL_GPL(component_master_add_with_match);
/**
* component_master_del - unregister an aggregate driver
* @dev: device with the aggregate driver
* @ops: callbacks for the aggregate driver
*
* Unregisters an aggregate driver registered with
* component_master_add_with_match(). If necessary the aggregate driver is first
* disassembled by calling &component_master_ops.unbind from @ops.
*/
void component_master_del(struct device *dev,
const struct component_master_ops *ops)
{
......@@ -430,6 +536,15 @@ static void component_unbind(struct component *component,
devres_release_group(component->dev, component);
}
/**
* component_unbind_all - unbind all component to an aggregate driver
* @master_dev: device with the aggregate driver
* @data: opaque pointer, passed to all components
*
* Unbinds all components to the aggregate @dev by passing @data to their
* &component_ops.unbind functions. Should be called from
* &component_master_ops.unbind.
*/
void component_unbind_all(struct device *master_dev, void *data)
{
struct master *master;
......@@ -503,6 +618,15 @@ static int component_bind(struct component *component, struct master *master,
return ret;
}
/**
* component_bind_all - bind all component to an aggregate driver
* @master_dev: device with the aggregate driver
* @data: opaque pointer, passed to all components
*
* Binds all components to the aggregate @dev by passing @data to their
* &component_ops.bind functions. Should be called from
* &component_master_ops.bind.
*/
int component_bind_all(struct device *master_dev, void *data)
{
struct master *master;
......@@ -537,7 +661,8 @@ int component_bind_all(struct device *master_dev, void *data)
}
EXPORT_SYMBOL_GPL(component_bind_all);
int component_add(struct device *dev, const struct component_ops *ops)
static int __component_add(struct device *dev, const struct component_ops *ops,
int subcomponent)
{
struct component *component;
int ret;
......@@ -548,6 +673,7 @@ int component_add(struct device *dev, const struct component_ops *ops)
component->ops = ops;
component->dev = dev;
component->subcomponent = subcomponent;
dev_dbg(dev, "adding component (ops %ps)\n", ops);
......@@ -566,8 +692,66 @@ int component_add(struct device *dev, const struct component_ops *ops)
return ret < 0 ? ret : 0;
}
/**
* component_add_typed - register a component
* @dev: component device
* @ops: component callbacks
* @subcomponent: nonzero identifier for subcomponents
*
* Register a new component for @dev. Functions in @ops will be call when the
* aggregate driver is ready to bind the overall driver by calling
* component_bind_all(). See also &struct component_ops.
*
* @subcomponent must be nonzero and is used to differentiate between multiple
* components registerd on the same device @dev. These components are match
* using component_match_add_typed().
*
* The component needs to be unregistered at driver unload/disconnect by
* calling component_del().
*
* See also component_add().
*/
int component_add_typed(struct device *dev, const struct component_ops *ops,
int subcomponent)
{
if (WARN_ON(subcomponent == 0))
return -EINVAL;
return __component_add(dev, ops, subcomponent);
}
EXPORT_SYMBOL_GPL(component_add_typed);
/**
* component_add - register a component
* @dev: component device
* @ops: component callbacks
*
* Register a new component for @dev. Functions in @ops will be called when the
* aggregate driver is ready to bind the overall driver by calling
* component_bind_all(). See also &struct component_ops.
*
* The component needs to be unregistered at driver unload/disconnect by
* calling component_del().
*
* See also component_add_typed() for a variant that allows multipled different
* components on the same device.
*/
int component_add(struct device *dev, const struct component_ops *ops)
{
return __component_add(dev, ops, 0);
}
EXPORT_SYMBOL_GPL(component_add);
/**
* component_del - unregister a component
* @dev: component device
* @ops: component callbacks
*
* Unregister a component added with component_add(). If the component is bound
* into an aggregate driver, this will force the entire aggregate driver, including
* all its components, to be unbound.
*/
void component_del(struct device *dev, const struct component_ops *ops)
{
struct component *c, *component = NULL;
......
......@@ -984,7 +984,9 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv)
{
int ret;
ret = component_add(dev_priv->drm.dev, &i915_audio_component_bind_ops);
ret = component_add_typed(dev_priv->drm.dev,
&i915_audio_component_bind_ops,
I915_COMPONENT_AUDIO);
if (ret < 0) {
DRM_ERROR("failed to add audio component (%d)\n", ret);
/* continue with reduced functionality */
......
......@@ -26,6 +26,7 @@
#define _INTEL_DISPLAY_H_
#include <drm/drm_util.h>
#include <drm/i915_drm.h>
enum i915_gpio {
GPIOA,
......@@ -150,21 +151,6 @@ enum plane_id {
for ((__p) = PLANE_PRIMARY; (__p) < I915_MAX_PLANES; (__p)++) \
for_each_if((__crtc)->plane_ids_mask & BIT(__p))
enum port {
PORT_NONE = -1,
PORT_A = 0,
PORT_B,
PORT_C,
PORT_D,
PORT_E,
PORT_F,
I915_MAX_PORTS
};
#define port_name(p) ((p) + 'A')
/*
* Ports identifier referenced from other drivers.
* Expected to remain stable over time
......
......@@ -43,3 +43,13 @@ config INTEL_MEI_TXE
Supported SoCs:
Intel Bay Trail
config INTEL_MEI_HDCP
tristate "Intel HDCP2.2 services of ME Interface"
select INTEL_MEI_ME
depends on DRM_I915
help
MEI Support for HDCP2.2 Services on Intel platforms.
Enables the ME FW services required for HDCP2.2 support through
I915 display driver of Intel.
......@@ -24,3 +24,5 @@ mei-txe-objs += hw-txe.o
mei-$(CONFIG_EVENT_TRACING) += mei-trace.o
CFLAGS_mei-trace.o = -I$(src)
obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/
......@@ -40,6 +40,9 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;
#define MEI_UUID_MKHIF_FIX UUID_LE(0x55213584, 0x9a29, 0x4916, \
0xba, 0xdf, 0xf, 0xb7, 0xed, 0x68, 0x2a, 0xeb)
#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \
0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04)
#define MEI_UUID_ANY NULL_UUID_LE
/**
......@@ -71,6 +74,18 @@ static void blacklist(struct mei_cl_device *cldev)
cldev->do_match = 0;
}
/**
* whitelist - forcefully whitelist client
*
* @cldev: me clients device
*/
static void whitelist(struct mei_cl_device *cldev)
{
dev_dbg(&cldev->dev, "running hook %s\n", __func__);
cldev->do_match = 1;
}
#define OSTYPE_LINUX 2
struct mei_os_ver {
__le16 build;
......@@ -472,6 +487,7 @@ static struct mei_fixup {
MEI_FIXUP(MEI_UUID_NFC_HCI, mei_nfc),
MEI_FIXUP(MEI_UUID_WD, mei_wd),
MEI_FIXUP(MEI_UUID_MKHIF_FIX, mei_mkhi_fix),
MEI_FIXUP(MEI_UUID_HDCP, whitelist),
};
/**
......
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2019, Intel Corporation.
#
# Makefile - HDCP client driver for Intel MEI Bus Driver.
obj-$(CONFIG_INTEL_MEI_HDCP) += mei_hdcp.o
此差异已折叠。
/* SPDX-License-Identifier: (GPL-2.0+) */
/*
* Copyright © 2019 Intel Corporation
*
* Authors:
* Ramalingam C <ramalingam.c@intel.com>
*/
#ifndef __MEI_HDCP_H__
#define __MEI_HDCP_H__
#include <drm/drm_hdcp.h>
/* me_hdcp_status: Enumeration of all HDCP Status Codes */
enum me_hdcp_status {
ME_HDCP_STATUS_SUCCESS = 0x0000,
/* WiDi Generic Status Codes */
ME_HDCP_STATUS_INTERNAL_ERROR = 0x1000,
ME_HDCP_STATUS_UNKNOWN_ERROR = 0x1001,
ME_HDCP_STATUS_INCORRECT_API_VERSION = 0x1002,
ME_HDCP_STATUS_INVALID_FUNCTION = 0x1003,
ME_HDCP_STATUS_INVALID_BUFFER_LENGTH = 0x1004,
ME_HDCP_STATUS_INVALID_PARAMS = 0x1005,
ME_HDCP_STATUS_AUTHENTICATION_FAILED = 0x1006,
/* WiDi Status Codes */
ME_HDCP_INVALID_SESSION_STATE = 0x6000,
ME_HDCP_SRM_FRAGMENT_UNEXPECTED = 0x6001,
ME_HDCP_SRM_INVALID_LENGTH = 0x6002,
ME_HDCP_SRM_FRAGMENT_OFFSET_INVALID = 0x6003,
ME_HDCP_SRM_VERIFICATION_FAILED = 0x6004,
ME_HDCP_SRM_VERSION_TOO_OLD = 0x6005,
ME_HDCP_RX_CERT_VERIFICATION_FAILED = 0x6006,
ME_HDCP_RX_REVOKED = 0x6007,
ME_HDCP_H_VERIFICATION_FAILED = 0x6008,
ME_HDCP_REPEATER_CHECK_UNEXPECTED = 0x6009,
ME_HDCP_TOPOLOGY_MAX_EXCEEDED = 0x600A,
ME_HDCP_V_VERIFICATION_FAILED = 0x600B,
ME_HDCP_L_VERIFICATION_FAILED = 0x600C,
ME_HDCP_STREAM_KEY_ALLOC_FAILED = 0x600D,
ME_HDCP_BASE_KEY_RESET_FAILED = 0x600E,
ME_HDCP_NONCE_GENERATION_FAILED = 0x600F,
ME_HDCP_STATUS_INVALID_E_KEY_STATE = 0x6010,
ME_HDCP_STATUS_INVALID_CS_ICV = 0x6011,
ME_HDCP_STATUS_INVALID_KB_KEY_STATE = 0x6012,
ME_HDCP_STATUS_INVALID_PAVP_MODE_ICV = 0x6013,
ME_HDCP_STATUS_INVALID_PAVP_MODE = 0x6014,
ME_HDCP_STATUS_LC_MAX_ATTEMPTS = 0x6015,
/* New status for HDCP 2.1 */
ME_HDCP_STATUS_MISMATCH_IN_M = 0x6016,
/* New status code for HDCP 2.2 Rx */
ME_HDCP_STATUS_RX_PROV_NOT_ALLOWED = 0x6017,
ME_HDCP_STATUS_RX_PROV_WRONG_SUBJECT = 0x6018,
ME_HDCP_RX_NEEDS_PROVISIONING = 0x6019,
ME_HDCP_BKSV_ICV_AUTH_FAILED = 0x6020,
ME_HDCP_STATUS_INVALID_STREAM_ID = 0x6021,
ME_HDCP_STATUS_CHAIN_NOT_INITIALIZED = 0x6022,
ME_HDCP_FAIL_NOT_EXPECTED = 0x6023,
ME_HDCP_FAIL_HDCP_OFF = 0x6024,
ME_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE = 0x6025,
ME_HDCP_FAIL_AES_ECB_FAILURE = 0x6026,
ME_HDCP_FEATURE_NOT_SUPPORTED = 0x6027,
ME_HDCP_DMA_READ_ERROR = 0x6028,
ME_HDCP_DMA_WRITE_ERROR = 0x6029,
ME_HDCP_FAIL_INVALID_PACKET_SIZE = 0x6030,
ME_HDCP_H264_PARSING_ERROR = 0x6031,
ME_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION = 0x6032,
ME_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION = 0x6033,
ME_HDCP_TX_ACTIVE_ERROR = 0x6034,
ME_HDCP_MODE_CHANGE_ERROR = 0x6035,
ME_HDCP_STREAM_TYPE_ERROR = 0x6036,
ME_HDCP_STREAM_MANAGE_NOT_POSSIBLE = 0x6037,
ME_HDCP_STATUS_PORT_INVALID_COMMAND = 0x6038,
ME_HDCP_STATUS_UNSUPPORTED_PROTOCOL = 0x6039,
ME_HDCP_STATUS_INVALID_PORT_INDEX = 0x603a,
ME_HDCP_STATUS_TX_AUTH_NEEDED = 0x603b,
ME_HDCP_STATUS_NOT_INTEGRATED_PORT = 0x603c,
ME_HDCP_STATUS_SESSION_MAX_REACHED = 0x603d,
/* hdcp capable bit is not set in rx_caps(error is unique to DP) */
ME_HDCP_STATUS_NOT_HDCP_CAPABLE = 0x6041,
ME_HDCP_STATUS_INVALID_STREAM_COUNT = 0x6042,
};
#define HDCP_API_VERSION 0x00010000
#define HDCP_M_LEN 16
#define HDCP_KH_LEN 16
/* Payload Buffer size(Excluding Header) for CMDs and corresponding response */
/* Wired_Tx_AKE */
#define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN (4 + 1)
#define WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_OUT (4 + 8 + 3)
#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN (4 + 522 + 8 + 3)
#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MIN_OUT (4 + 1 + 3 + 16 + 16)
#define WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_MAX_OUT (4 + 1 + 3 + 128)
#define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN (4 + 32)
#define WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_OUT (4)
#define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN (4 + 16)
#define WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_OUT (4)
#define WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN (4)
#define WIRED_CMD_BUF_LEN_CLOSE_SESSION_OUT (4)
/* Wired_Tx_LC */
#define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN (4)
#define WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_OUT (4 + 8)
#define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN (4 + 32)
#define WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_OUT (4)
/* Wired_Tx_SKE */
#define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN (4)
#define WIRED_CMD_BUF_LEN_GET_SESSION_KEY_OUT (4 + 16 + 8)
/* Wired_Tx_SKE */
#define WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN (4 + 1)
#define WIRED_CMD_BUF_LEN_ENABLE_AUTH_OUT (4)
/* Wired_Tx_Repeater */
#define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN (4 + 2 + 3 + 16 + 155)
#define WIRED_CMD_BUF_LEN_VERIFY_REPEATER_OUT (4 + 1 + 16)
#define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN (4 + 3 + \
32 + 2 + 2)
#define WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_OUT (4)
/* hdcp_command_id: Enumeration of all WIRED HDCP Command IDs */
enum hdcp_command_id {
_WIDI_COMMAND_BASE = 0x00030000,
WIDI_INITIATE_HDCP2_SESSION = _WIDI_COMMAND_BASE,
HDCP_GET_SRM_STATUS,
HDCP_SEND_SRM_FRAGMENT,
/* The wired HDCP Tx commands */
_WIRED_COMMAND_BASE = 0x00031000,
WIRED_INITIATE_HDCP2_SESSION = _WIRED_COMMAND_BASE,
WIRED_VERIFY_RECEIVER_CERT,
WIRED_AKE_SEND_HPRIME,
WIRED_AKE_SEND_PAIRING_INFO,
WIRED_INIT_LOCALITY_CHECK,
WIRED_VALIDATE_LOCALITY,
WIRED_GET_SESSION_KEY,
WIRED_ENABLE_AUTH,
WIRED_VERIFY_REPEATER,
WIRED_REPEATER_AUTH_STREAM_REQ,
WIRED_CLOSE_SESSION,
_WIRED_COMMANDS_COUNT,
};
union encrypted_buff {
u8 e_kpub_km[HDCP_2_2_E_KPUB_KM_LEN];
u8 e_kh_km_m[HDCP_2_2_E_KH_KM_M_LEN];
struct {
u8 e_kh_km[HDCP_KH_LEN];
u8 m[HDCP_M_LEN];
} __packed;
};
/* HDCP HECI message header. All header values are little endian. */
struct hdcp_cmd_header {
u32 api_version;
u32 command_id;
enum me_hdcp_status status;
/* Length of the HECI message (excluding the header) */
u32 buffer_len;
} __packed;
/* Empty command request or response. No data follows the header. */
struct hdcp_cmd_no_data {
struct hdcp_cmd_header header;
} __packed;
/* Uniquely identifies the hdcp port being addressed for a given command. */
struct hdcp_port_id {
u8 integrated_port_type;
u8 physical_port;
u16 reserved;
} __packed;
/*
* Data structures for integrated wired HDCP2 Tx in
* support of the AKE protocol
*/
/* HECI struct for integrated wired HDCP Tx session initiation. */
struct wired_cmd_initiate_hdcp2_session_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 protocol; /* for HDMI vs DP */
} __packed;
struct wired_cmd_initiate_hdcp2_session_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 r_tx[HDCP_2_2_RTX_LEN];
struct hdcp2_tx_caps tx_caps;
} __packed;
/* HECI struct for ending an integrated wired HDCP Tx session. */
struct wired_cmd_close_session_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
struct wired_cmd_close_session_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
/* HECI struct for integrated wired HDCP Tx Rx Cert verification. */
struct wired_cmd_verify_receiver_cert_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
struct hdcp2_cert_rx cert_rx;
u8 r_rx[HDCP_2_2_RRX_LEN];
u8 rx_caps[HDCP_2_2_RXCAPS_LEN];
} __packed;
struct wired_cmd_verify_receiver_cert_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 km_stored;
u8 reserved[3];
union encrypted_buff ekm_buff;
} __packed;
/* HECI struct for verification of Rx's Hprime in a HDCP Tx session */
struct wired_cmd_ake_send_hprime_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 h_prime[HDCP_2_2_H_PRIME_LEN];
} __packed;
struct wired_cmd_ake_send_hprime_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
/*
* HECI struct for sending in AKE pairing data generated by the Rx in an
* integrated wired HDCP Tx session.
*/
struct wired_cmd_ake_send_pairing_info_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 e_kh_km[HDCP_2_2_E_KH_KM_LEN];
} __packed;
struct wired_cmd_ake_send_pairing_info_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
/* Data structures for integrated wired HDCP2 Tx in support of the LC protocol*/
/*
* HECI struct for initiating locality check with an
* integrated wired HDCP Tx session.
*/
struct wired_cmd_init_locality_check_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
struct wired_cmd_init_locality_check_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 r_n[HDCP_2_2_RN_LEN];
} __packed;
/*
* HECI struct for validating an Rx's LPrime value in an
* integrated wired HDCP Tx session.
*/
struct wired_cmd_validate_locality_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 l_prime[HDCP_2_2_L_PRIME_LEN];
} __packed;
struct wired_cmd_validate_locality_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
/*
* Data structures for integrated wired HDCP2 Tx in support of the
* SKE protocol
*/
/* HECI struct for creating session key */
struct wired_cmd_get_session_key_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
struct wired_cmd_get_session_key_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 e_dkey_ks[HDCP_2_2_E_DKEY_KS_LEN];
u8 r_iv[HDCP_2_2_RIV_LEN];
} __packed;
/* HECI struct for the Tx enable authentication command */
struct wired_cmd_enable_auth_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 stream_type;
} __packed;
struct wired_cmd_enable_auth_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
/*
* Data structures for integrated wired HDCP2 Tx in support of
* the repeater protocols
*/
/*
* HECI struct for verifying the downstream repeater's HDCP topology in an
* integrated wired HDCP Tx session.
*/
struct wired_cmd_verify_repeater_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 rx_info[HDCP_2_2_RXINFO_LEN];
u8 seq_num_v[HDCP_2_2_SEQ_NUM_LEN];
u8 v_prime[HDCP_2_2_V_PRIME_HALF_LEN];
u8 receiver_ids[HDCP_2_2_RECEIVER_IDS_MAX_LEN];
} __packed;
struct wired_cmd_verify_repeater_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 content_type_supported;
u8 v[HDCP_2_2_V_PRIME_HALF_LEN];
} __packed;
/*
* HECI struct in support of stream management in an
* integrated wired HDCP Tx session.
*/
struct wired_cmd_repeater_auth_stream_req_in {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
u8 seq_num_m[HDCP_2_2_SEQ_NUM_LEN];
u8 m_prime[HDCP_2_2_MPRIME_LEN];
__be16 k;
struct hdcp2_streamid_type streams[1];
} __packed;
struct wired_cmd_repeater_auth_stream_req_out {
struct hdcp_cmd_header header;
struct hdcp_port_id port;
} __packed;
enum mei_fw_ddi {
MEI_DDI_INVALID_PORT = 0x0,
MEI_DDI_B = 1,
MEI_DDI_C,
MEI_DDI_D,
MEI_DDI_E,
MEI_DDI_F,
MEI_DDI_A = 7,
MEI_DDI_RANGE_END = MEI_DDI_A,
};
#endif /* __MEI_HDCP_H__ */
......@@ -5,6 +5,7 @@
#define _DRM_AUDIO_COMPONENT_H_
struct drm_audio_component;
struct device;
/**
* struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver
......
......@@ -250,4 +250,22 @@ struct hdcp2_dp_errata_stream_type {
#define HDCP_2_2_HDMI_RXSTATUS_READY(x) ((x) & BIT(2))
#define HDCP_2_2_HDMI_RXSTATUS_REAUTH_REQ(x) ((x) & BIT(3))
/*
* Helper functions to convert 24bit big endian hdcp sequence number to
* host format and back
*/
static inline
u32 drm_hdcp2_seq_num_to_u32(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN])
{
return (u32)(seq_num[2] | seq_num[1] << 8 | seq_num[0] << 16);
}
static inline
void drm_hdcp2_u32_to_seq_num(u8 seq_num[HDCP_2_2_SEQ_NUM_LEN], u32 val)
{
seq_num[0] = val >> 16;
seq_num[1] = val >> 8;
seq_num[2] = val;
}
#endif
......@@ -26,6 +26,11 @@
#include "drm_audio_component.h"
enum i915_component_type {
I915_COMPONENT_AUDIO = 1,
I915_COMPONENT_HDCP,
};
/* MAX_PORT is the number of port
* It must be sync with I915_MAX_PORTS defined i915_drv.h
*/
......
......@@ -100,4 +100,19 @@ extern struct resource intel_graphics_stolen_res;
#define INTEL_GEN11_BSM_DW1 0xc4
#define INTEL_BSM_MASK (-(1u << 20))
enum port {
PORT_NONE = -1,
PORT_A = 0,
PORT_B,
PORT_C,
PORT_D,
PORT_E,
PORT_F,
I915_MAX_PORTS
};
#define port_name(p) ((p) + 'A')
#endif /* _I915_DRM_H_ */
/* SPDX-License-Identifier: (GPL-2.0+) */
/*
* Copyright © 2017-2018 Intel Corporation
*
* Authors:
* Ramalingam C <ramalingam.c@intel.com>
*/
#ifndef _I915_MEI_HDCP_INTERFACE_H_
#define _I915_MEI_HDCP_INTERFACE_H_
#include <linux/mutex.h>
#include <linux/device.h>
#include <drm/drm_hdcp.h>
#include <drm/i915_drm.h>
/**
* enum hdcp_port_type - HDCP port implementation type defined by ME FW
* @HDCP_PORT_TYPE_INVALID: Invalid hdcp port type
* @HDCP_PORT_TYPE_INTEGRATED: In-Host HDCP2.x port
* @HDCP_PORT_TYPE_LSPCON: HDCP2.2 discrete wired Tx port with LSPCON
* (HDMI 2.0) solution
* @HDCP_PORT_TYPE_CPDP: HDCP2.2 discrete wired Tx port using the CPDP (DP 1.3)
* solution
*/
enum hdcp_port_type {
HDCP_PORT_TYPE_INVALID,
HDCP_PORT_TYPE_INTEGRATED,
HDCP_PORT_TYPE_LSPCON,
HDCP_PORT_TYPE_CPDP
};
/**
* enum hdcp_wired_protocol - HDCP adaptation used on the port
* @HDCP_PROTOCOL_INVALID: Invalid HDCP adaptation protocol
* @HDCP_PROTOCOL_HDMI: HDMI adaptation of HDCP used on the port
* @HDCP_PROTOCOL_DP: DP adaptation of HDCP used on the port
*/
enum hdcp_wired_protocol {
HDCP_PROTOCOL_INVALID,
HDCP_PROTOCOL_HDMI,
HDCP_PROTOCOL_DP
};
/**
* struct hdcp_port_data - intel specific HDCP port data
* @port: port index as per I915
* @port_type: HDCP port type as per ME FW classification
* @protocol: HDCP adaptation as per ME FW
* @k: No of streams transmitted on a port. Only on DP MST this is != 1
* @seq_num_m: Count of RepeaterAuth_Stream_Manage msg propagated.
* Initialized to 0 on AKE_INIT. Incremented after every successful
* transmission of RepeaterAuth_Stream_Manage message. When it rolls
* over re-Auth has to be triggered.
* @streams: struct hdcp2_streamid_type[k]. Defines the type and id for the
* streams
*/
struct hdcp_port_data {
enum port port;
u8 port_type;
u8 protocol;
u16 k;
u32 seq_num_m;
struct hdcp2_streamid_type *streams;
};
/**
* struct i915_hdcp_component_ops- ops for HDCP2.2 services.
* @owner: Module providing the ops
* @initiate_hdcp2_session: Initiate a Wired HDCP2.2 Tx Session.
* And Prepare AKE_Init.
* @verify_receiver_cert_prepare_km: Verify the Receiver Certificate
* AKE_Send_Cert and prepare
AKE_Stored_Km/AKE_No_Stored_Km
* @verify_hprime: Verify AKE_Send_H_prime
* @store_pairing_info: Store pairing info received
* @initiate_locality_check: Prepare LC_Init
* @verify_lprime: Verify lprime
* @get_session_key: Prepare SKE_Send_Eks
* @repeater_check_flow_prepare_ack: Validate the Downstream topology
* and prepare rep_ack
* @verify_mprime: Verify mprime
* @enable_hdcp_authentication: Mark a port as authenticated.
* @close_hdcp_session: Close the Wired HDCP Tx session per port.
* This also disables the authenticated state of the port.
*/
struct i915_hdcp_component_ops {
/**
* @owner: mei_hdcp module
*/
struct module *owner;
int (*initiate_hdcp2_session)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_ake_init *ake_data);
int (*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);
int (*verify_hprime)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_ake_send_hprime *rx_hprime);
int (*store_pairing_info)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_ake_send_pairing_info
*pairing_info);
int (*initiate_locality_check)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_lc_init *lc_init_data);
int (*verify_lprime)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_lc_send_lprime *rx_lprime);
int (*get_session_key)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_ske_send_eks *ske_data);
int (*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);
int (*verify_mprime)(struct device *dev,
struct hdcp_port_data *data,
struct hdcp2_rep_stream_ready *stream_ready);
int (*enable_hdcp_authentication)(struct device *dev,
struct hdcp_port_data *data);
int (*close_hdcp_session)(struct device *dev,
struct hdcp_port_data *data);
};
/**
* struct i915_hdcp_component_master - Used for communication between i915
* and mei_hdcp drivers for the HDCP2.2 services
* @mei_dev: device that provide the HDCP2.2 service from MEI Bus.
* @hdcp_ops: Ops implemented by mei_hdcp driver, used by i915 driver.
*/
struct i915_hdcp_comp_master {
struct device *mei_dev;
const struct i915_hdcp_component_ops *ops;
/* To protect the above members. */
struct mutex mutex;
};
#endif /* _I915_MEI_HDCP_INTERFACE_H_ */
......@@ -4,16 +4,38 @@
#include <linux/stddef.h>
struct device;
/**
* struct component_ops - callbacks for component drivers
*
* Components are registered with component_add() and unregistered with
* component_del().
*/
struct component_ops {
/**
* @bind:
*
* Called through component_bind_all() when the aggregate driver is
* ready to bind the overall driver.
*/
int (*bind)(struct device *comp, struct device *master,
void *master_data);
/**
* @unbind:
*
* Called through component_unbind_all() when the aggregate driver is
* ready to bind the overall driver, or when component_bind_all() fails
* part-ways through and needs to unbind some already bound components.
*/
void (*unbind)(struct device *comp, struct device *master,
void *master_data);
};
int component_add(struct device *, const struct component_ops *);
int component_add_typed(struct device *dev, const struct component_ops *ops,
int subcomponent);
void component_del(struct device *, const struct component_ops *);
int component_bind_all(struct device *master, void *master_data);
......@@ -21,8 +43,42 @@ void component_unbind_all(struct device *master, void *master_data);
struct master;
/**
* struct component_master_ops - callback for the aggregate driver
*
* Aggregate drivers are registered with component_master_add_with_match() and
* unregistered with component_master_del().
*/
struct component_master_ops {
/**
* @bind:
*
* Called when all components or the aggregate driver, as specified in
* the match list passed to component_master_add_with_match(), are
* ready. Usually there are 3 steps to bind an aggregate driver:
*
* 1. Allocate a structure for the aggregate driver.
*
* 2. Bind all components to the aggregate driver by calling
* component_bind_all() with the aggregate driver structure as opaque
* pointer data.
*
* 3. Register the aggregate driver with the subsystem to publish its
* interfaces.
*
* Note that the lifetime of the aggregate driver does not align with
* any of the underlying &struct device instances. Therefore devm cannot
* be used and all resources acquired or allocated in this callback must
* be explicitly released in the @unbind callback.
*/
int (*bind)(struct device *master);
/**
* @unbind:
*
* Called when either the aggregate driver, using
* component_master_del(), or one of its components, using
* component_del(), is unregistered.
*/
void (*unbind)(struct device *master);
};
......@@ -37,7 +93,27 @@ void component_match_add_release(struct device *master,
struct component_match **matchptr,
void (*release)(struct device *, void *),
int (*compare)(struct device *, void *), void *compare_data);
void component_match_add_typed(struct device *master,
struct component_match **matchptr,
int (*compare_typed)(struct device *, int, void *), void *compare_data);
/**
* component_match_add - add a compent match
* @master: device with the aggregate driver
* @matchptr: pointer to the list of component matches
* @compare: compare function to match against all components
* @compare_data: opaque pointer passed to the @compare function
*
* Adds a new component match to the list stored in @matchptr, which the @master
* aggregate driver needs to function. The list of component matches pointed to
* by @matchptr must be initialized to NULL before adding the first match. This
* only matches against components added with component_add().
*
* The allocated match list in @matchptr is automatically released using devm
* actions.
*
* See also component_match_add_release() and component_match_add_typed().
*/
static inline void component_match_add(struct device *master,
struct component_match **matchptr,
int (*compare)(struct device *, void *), void *compare_data)
......
......@@ -20,7 +20,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id,
bool *audio_enabled, char *buffer, int max_bytes);
int snd_hdac_acomp_init(struct hdac_bus *bus,
const struct drm_audio_component_audio_ops *aops,
int (*match_master)(struct device *, void *),
int (*match_master)(struct device *, int, void *),
size_t extra_size);
int snd_hdac_acomp_exit(struct hdac_bus *bus);
int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
......@@ -47,7 +47,8 @@ static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t ni
}
static inline int snd_hdac_acomp_init(struct hdac_bus *bus,
const struct drm_audio_component_audio_ops *aops,
int (*match_master)(struct device *, void *),
int (*match_master)(struct device *,
int, void *),
size_t extra_size)
{
return -ENODEV;
......
......@@ -269,7 +269,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_register_notifier);
*/
int snd_hdac_acomp_init(struct hdac_bus *bus,
const struct drm_audio_component_audio_ops *aops,
int (*match_master)(struct device *, void *),
int (*match_master)(struct device *, int, void *),
size_t extra_size)
{
struct component_match *match = NULL;
......@@ -288,7 +288,7 @@ int snd_hdac_acomp_init(struct hdac_bus *bus,
bus->audio_component = acomp;
devres_add(dev, acomp);
component_match_add(dev, &match, match_master, bus);
component_match_add_typed(dev, &match, match_master, bus);
ret = component_master_add_with_match(dev, &hdac_component_master_ops,
match);
if (ret < 0)
......
......@@ -82,9 +82,11 @@ void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
}
EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk);
static int i915_component_master_match(struct device *dev, void *data)
static int i915_component_master_match(struct device *dev, int subcomponent,
void *data)
{
return !strcmp(dev->driver->name, "i915");
return !strcmp(dev->driver->name, "i915") &&
subcomponent == I915_COMPONENT_AUDIO;
}
/* check whether intel graphics is present */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册