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 CROS_DRM_SET_GSC_COUNTER_KEY = 3U, 28 CROS_DRM_SET_DRM_DEVICE_KEY = 4U, 29 CROS_DRM_SET_STABLE_HARDWARE_UNIQUE_KEY = 5U, 30 }; 31 32 /******************************************************************************* 33 * Defines for runtime services func ids 34 ******************************************************************************/ 35 36 /* Sets the TPM auth public key. The maximum size is 128 bytes. 37 * |x1| is the length of the data, |x2| is the physical address of the data. 38 */ 39 #define CROS_OEM_SMC_DRM_SET_TPM_AUTH_PUB_FUNC_ID \ 40 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_TPM_AUTH_PUB) 41 42 /* Sets the hardware unique key. The maximum size is 32 bytes. 43 * |x1| is the length of the data, |x2| is the physical address of the data. 44 */ 45 #define CROS_OEM_SMC_DRM_SET_HARDWARE_UNIQUE_KEY_FUNC_ID \ 46 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_HARDWARE_UNIQUE_KEY) 47 48 /* Sets the widevine root of trust. The maximum size is 32 bytes. 49 * |x1| is the length of the data, |x2| is the physical address of the data. 50 */ 51 #define CROS_OEM_SMC_DRM_SET_ROOT_OF_TRUST_FUNC_ID \ 52 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_ROOT_OF_TRUST) 53 54 /* Sets the GSC counter key. The maximum size is 32 bytes. 55 * |x1| is the length of the data, |x2| is the physical address of the data. 56 */ 57 #define CROS_OEM_SMC_DRM_SET_GSC_COUNTER_KEY_FUNC_ID \ 58 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_GSC_COUNTER_KEY) 59 60 /* Sets the DRM device key. The maximum size is 32 bytes. 61 * |x1| is the length of the data, |x2| is the physical address of the data. 62 */ 63 #define CROS_OEM_SMC_DRM_SET_DRM_DEVICE_KEY_FUNC_ID \ 64 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_DRM_DEVICE_KEY) 65 66 /* Sets the stable hardware unique key. The maximum size is 32 bytes. 67 * |x1| is the length of the data, |x2| is the physical address of the data. 68 */ 69 #define CROS_OEM_SMC_DRM_SET_STABLE_HARDWARE_UNIQUE_KEY_FUNC_ID \ 70 CROS_OEM_SMC_CALL_ID(CROS_DRM_SET_STABLE_HARDWARE_UNIQUE_KEY) 71 72 #define is_cros_oem_smc(_call_id) (((_call_id) & 0xFFF0U) == CROS_OEM_SMC_ID) 73 74 struct cros_oem_data { 75 uint8_t *buffer; 76 const uint32_t max_length; 77 uint32_t length; 78 }; 79 80 extern struct cros_oem_data cros_oem_tpm_auth_pk; 81 82 extern struct cros_oem_data cros_oem_huk; 83 84 extern struct cros_oem_data cros_oem_rot; 85 86 extern struct cros_oem_data cros_oem_gck; 87 88 extern struct cros_oem_data cros_oem_ddk; 89 90 extern struct cros_oem_data cros_oem_stable_huk; 91 92 #endif /* CROS_WIDEVINE_SMC_HANDLERS_H */ 93