blob: a5251d76ce05266bdfe201db0406a91b2ea6b01b [file] [log] [blame]
Yi Chou097051f2023-04-11 15:57:08 +08001/*
2 * Copyright (c) 2024, The ChromiumOS Authors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef CROS_WIDEVINE_SMC_HANDLERS_H
8#define CROS_WIDEVINE_SMC_HANDLERS_H
9
10#include <lib/smccc.h>
11
12/*******************************************************************************
13 * Defines for CrOS OEM Service queries
14 ******************************************************************************/
15
16/* 0xC300C050 - 0xC300C05F are CrOS OEM service calls */
17#define CROS_OEM_SMC_ID 0xC050
18#define CROS_OEM_SMC_CALL_ID(func_num) \
19 ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \
20 ((SMC_64) << FUNCID_CC_SHIFT) | (OEN_OEM_START << FUNCID_OEN_SHIFT) | \
21 (CROS_OEM_SMC_ID) | ((func_num) & FUNCID_NUM_MASK))
22
23enum cros_drm_set {
24 CROS_DRM_SET_TPM_AUTH_PUB = 0U,
25 CROS_DRM_SET_HARDWARE_UNIQUE_KEY = 1U,
26 CROS_DRM_SET_ROOT_OF_TRUST = 2U,
27};
28
29/*******************************************************************************
30 * Defines for runtime services func ids
31 ******************************************************************************/
32
33/* Sets the TPM auth public key. The maximum size is 128 bytes.
34 * |x1| is the length of the data, |x2| is the physical address of the data.
35 */
36#define CROS_OEM_SMC_DRM_SET_TPM_AUTH_PUB_FUNC_ID \
37 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_TPM_AUTH_PUB)
38
39/* Sets the hardware unique key. The maximum size is 32 bytes.
40 * |x1| is the length of the data, |x2| is the physical address of the data.
41 */
42#define CROS_OEM_SMC_DRM_SET_HARDWARE_UNIQUE_KEY_FUNC_ID \
43 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_HARDWARE_UNIQUE_KEY)
44
45/* Sets the widevine root of trust. The maximum size is 32 bytes.
46 * |x1| is the length of the data, |x2| is the physical address of the data.
47 */
48#define CROS_OEM_SMC_DRM_SET_ROOT_OF_TRUST_FUNC_ID \
49 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_ROOT_OF_TRUST)
50
51#define is_cros_oem_smc(_call_id) (((_call_id) & 0xFFF0U) == CROS_OEM_SMC_ID)
52
53struct cros_oem_data {
54 uint8_t *buffer;
55 const uint32_t max_length;
56 uint32_t length;
57};
58
59extern struct cros_oem_data cros_oem_tpm_auth_pk;
60
61extern struct cros_oem_data cros_oem_huk;
62
63extern struct cros_oem_data cros_oem_rot;
64
65#endif /* CROS_WIDEVINE_SMC_HANDLERS_H */