• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
23 enum 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 
53 struct cros_oem_data {
54 	uint8_t *buffer;
55 	const uint32_t max_length;
56 	uint32_t length;
57 };
58 
59 extern struct cros_oem_data cros_oem_tpm_auth_pk;
60 
61 extern struct cros_oem_data cros_oem_huk;
62 
63 extern struct cros_oem_data cros_oem_rot;
64 
65 #endif /* CROS_WIDEVINE_SMC_HANDLERS_H */
66