Changeset 104903 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 12, 2024 5:06:07 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Trace/VBoxTraceLogDecoders.cpp
r104900 r104903 44 44 *********************************************************************************************************************************/ 45 45 46 /** 47 */ 48 typedef DECLCALLBACKTYPE(void, FNDECODETPM2CC, (PCTPMREQHDR pHdr, size_t cb)); 49 /** Pointer to an event decode callback. */ 50 typedef FNDECODETPM2CC *PFNFNDECODETPM2CC; 51 46 52 47 53 /********************************************************************************************************************************* … … 54 60 *********************************************************************************************************************************/ 55 61 62 static DECLCALLBACK(void) vboxTraceLogDecodeEvtTpmDecodeStartupShutdown(PCTPMREQHDR pHdr, size_t cb) 63 { 64 if (cb >= sizeof(uint16_t)) 65 { 66 uint16_t u16TpmSu = RT_BE2H_U16(*(const uint16_t *)(pHdr + 1)); 67 if (u16TpmSu == TPM2_SU_CLEAR) 68 RTMsgInfo(" TPM2_SU_CLEAR\n"); 69 else if (u16TpmSu == TPM2_SU_STATE) 70 RTMsgInfo(" TPM2_SU_STATE\n"); 71 else 72 RTMsgInfo(" Unknown: %#x\n", u16TpmSu); 73 return; 74 } 75 76 RTMsgError("Malformed TPM2_CC_STARTUP/TPM2_CC_SHUTDOWN command, not enough room for TPM_SU constant\n"); 77 } 78 79 80 static DECLCALLBACK(void) vboxTraceLogDecodeEvtTpmDecodeGetCapability(PCTPMREQHDR pHdr, size_t cb) 81 { 82 if (cb >= sizeof(TPM2REQGETCAPABILITY)) 83 { 84 PCTPM2REQGETCAPABILITY pReq = (PCTPM2REQGETCAPABILITY)pHdr; 85 RTMsgInfo(" u32Cap: %#x\n" 86 " u32Property: %#x\n" 87 " u32Count: %#x\n", 88 RT_BE2H_U32(pReq->u32Cap), 89 RT_BE2H_U32(pReq->u32Property), 90 RT_BE2H_U32(pReq->u32Count)); 91 return; 92 } 93 94 RTMsgError("Malformed TPM2_CC_GET_CAPABILITY command, not enough room for the input\n"); 95 } 96 97 56 98 static struct 57 99 { 58 uint32_t u32CmdCode;59 const char *pszCmdCode;60 const char *pszCmdDesc;100 uint32_t u32CmdCode; 101 const char *pszCmdCode; 102 PFNFNDECODETPM2CC pfnDecode; 61 103 } s_aTpmCmdCodes[] = 62 104 { 63 105 #define TPM_CMD_CODE_INIT(a_CmdCode, a_Desc) { a_CmdCode, #a_CmdCode, a_Desc } 64 TPM_CMD_CODE_INIT(TPM2_CC_NV_UNDEFINE_SPACE_SPECIAL, NULL),65 TPM_CMD_CODE_INIT(TPM2_CC_EVICT_CONTROL, NULL),66 TPM_CMD_CODE_INIT(TPM2_CC_HIERARCHY_CONTROL, NULL),67 TPM_CMD_CODE_INIT(TPM2_CC_NV_UNDEFINE_SPACE, NULL),68 TPM_CMD_CODE_INIT(TPM2_CC_CHANGE_EPS, NULL),69 TPM_CMD_CODE_INIT(TPM2_CC_CHANGE_PPS, NULL),70 TPM_CMD_CODE_INIT(TPM2_CC_CLEAR, NULL),71 TPM_CMD_CODE_INIT(TPM2_CC_CLEAR_CONTROL, NULL),72 TPM_CMD_CODE_INIT(TPM2_CC_CLOCK_SET, NULL),73 TPM_CMD_CODE_INIT(TPM2_CC_HIERARCHY_CHANGE_AUTH, NULL),74 TPM_CMD_CODE_INIT(TPM2_CC_NV_DEFINE_SPACE, NULL),75 TPM_CMD_CODE_INIT(TPM2_CC_PCR_ALLOCATE, NULL),76 TPM_CMD_CODE_INIT(TPM2_CC_PCR_SET_AUTH_POLICY, NULL),77 TPM_CMD_CODE_INIT(TPM2_CC_PP_COMMANDS, NULL),78 TPM_CMD_CODE_INIT(TPM2_CC_SET_PRIMARY_POLICY, NULL),79 TPM_CMD_CODE_INIT(TPM2_CC_FIELD_UPGRADE_START, NULL),80 TPM_CMD_CODE_INIT(TPM2_CC_CLOCK_RATE_ADJUST, NULL),81 TPM_CMD_CODE_INIT(TPM2_CC_CREATE_PRIMARY, NULL),82 TPM_CMD_CODE_INIT(TPM2_CC_NV_GLOBAL_WRITE_LOCK, NULL),83 TPM_CMD_CODE_INIT(TPM2_CC_GET_COMMAND_AUDIT_DIGEST, NULL),84 TPM_CMD_CODE_INIT(TPM2_CC_NV_INCREMENT, NULL),85 TPM_CMD_CODE_INIT(TPM2_CC_NV_SET_BITS, NULL),86 TPM_CMD_CODE_INIT(TPM2_CC_NV_EXTEND, NULL),87 TPM_CMD_CODE_INIT(TPM2_CC_NV_WRITE, NULL),88 TPM_CMD_CODE_INIT(TPM2_CC_NV_WRITE_LOCK, NULL),89 TPM_CMD_CODE_INIT(TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET, NULL),90 TPM_CMD_CODE_INIT(TPM2_CC_DICTIONARY_ATTACK_PARAMETERS, NULL),91 TPM_CMD_CODE_INIT(TPM2_CC_NV_CHANGE_AUTH, NULL),92 TPM_CMD_CODE_INIT(TPM2_CC_PCR_EVENT, NULL),93 TPM_CMD_CODE_INIT(TPM2_CC_PCR_RESET, NULL),94 TPM_CMD_CODE_INIT(TPM2_CC_SEQUENCE_COMPLETE, NULL),106 TPM_CMD_CODE_INIT(TPM2_CC_NV_UNDEFINE_SPACE_SPECIAL, NULL), 107 TPM_CMD_CODE_INIT(TPM2_CC_EVICT_CONTROL, NULL), 108 TPM_CMD_CODE_INIT(TPM2_CC_HIERARCHY_CONTROL, NULL), 109 TPM_CMD_CODE_INIT(TPM2_CC_NV_UNDEFINE_SPACE, NULL), 110 TPM_CMD_CODE_INIT(TPM2_CC_CHANGE_EPS, NULL), 111 TPM_CMD_CODE_INIT(TPM2_CC_CHANGE_PPS, NULL), 112 TPM_CMD_CODE_INIT(TPM2_CC_CLEAR, NULL), 113 TPM_CMD_CODE_INIT(TPM2_CC_CLEAR_CONTROL, NULL), 114 TPM_CMD_CODE_INIT(TPM2_CC_CLOCK_SET, NULL), 115 TPM_CMD_CODE_INIT(TPM2_CC_HIERARCHY_CHANGE_AUTH, NULL), 116 TPM_CMD_CODE_INIT(TPM2_CC_NV_DEFINE_SPACE, NULL), 117 TPM_CMD_CODE_INIT(TPM2_CC_PCR_ALLOCATE, NULL), 118 TPM_CMD_CODE_INIT(TPM2_CC_PCR_SET_AUTH_POLICY, NULL), 119 TPM_CMD_CODE_INIT(TPM2_CC_PP_COMMANDS, NULL), 120 TPM_CMD_CODE_INIT(TPM2_CC_SET_PRIMARY_POLICY, NULL), 121 TPM_CMD_CODE_INIT(TPM2_CC_FIELD_UPGRADE_START, NULL), 122 TPM_CMD_CODE_INIT(TPM2_CC_CLOCK_RATE_ADJUST, NULL), 123 TPM_CMD_CODE_INIT(TPM2_CC_CREATE_PRIMARY, NULL), 124 TPM_CMD_CODE_INIT(TPM2_CC_NV_GLOBAL_WRITE_LOCK, NULL), 125 TPM_CMD_CODE_INIT(TPM2_CC_GET_COMMAND_AUDIT_DIGEST, NULL), 126 TPM_CMD_CODE_INIT(TPM2_CC_NV_INCREMENT, NULL), 127 TPM_CMD_CODE_INIT(TPM2_CC_NV_SET_BITS, NULL), 128 TPM_CMD_CODE_INIT(TPM2_CC_NV_EXTEND, NULL), 129 TPM_CMD_CODE_INIT(TPM2_CC_NV_WRITE, NULL), 130 TPM_CMD_CODE_INIT(TPM2_CC_NV_WRITE_LOCK, NULL), 131 TPM_CMD_CODE_INIT(TPM2_CC_DICTIONARY_ATTACK_LOCK_RESET, NULL), 132 TPM_CMD_CODE_INIT(TPM2_CC_DICTIONARY_ATTACK_PARAMETERS, NULL), 133 TPM_CMD_CODE_INIT(TPM2_CC_NV_CHANGE_AUTH, NULL), 134 TPM_CMD_CODE_INIT(TPM2_CC_PCR_EVENT, NULL), 135 TPM_CMD_CODE_INIT(TPM2_CC_PCR_RESET, NULL), 136 TPM_CMD_CODE_INIT(TPM2_CC_SEQUENCE_COMPLETE, NULL), 95 137 TPM_CMD_CODE_INIT(TPM2_CC_SET_ALGORITHM_SET, NULL), 96 138 TPM_CMD_CODE_INIT(TPM2_CC_SET_COMMAND_CODE_AUDIT_STATUS, NULL), … … 98 140 TPM_CMD_CODE_INIT(TPM2_CC_INCREMENTAL_SELF_TEST, NULL), 99 141 TPM_CMD_CODE_INIT(TPM2_CC_SELF_TEST, NULL), 100 TPM_CMD_CODE_INIT(TPM2_CC_STARTUP, NULL),101 TPM_CMD_CODE_INIT(TPM2_CC_SHUTDOWN, NULL),142 TPM_CMD_CODE_INIT(TPM2_CC_STARTUP, vboxTraceLogDecodeEvtTpmDecodeStartupShutdown), 143 TPM_CMD_CODE_INIT(TPM2_CC_SHUTDOWN, vboxTraceLogDecodeEvtTpmDecodeStartupShutdown), 102 144 TPM_CMD_CODE_INIT(TPM2_CC_STIR_RANDOM, NULL), 103 145 TPM_CMD_CODE_INIT(TPM2_CC_ACTIVATE_CREDENTIAL, NULL), … … 148 190 TPM_CMD_CODE_INIT(TPM2_CC_ECC_PARAMETERS, NULL), 149 191 TPM_CMD_CODE_INIT(TPM2_CC_FIRMWARE_READ, NULL), 150 TPM_CMD_CODE_INIT(TPM2_CC_GET_CAPABILITY, NULL),192 TPM_CMD_CODE_INIT(TPM2_CC_GET_CAPABILITY, vboxTraceLogDecodeEvtTpmDecodeGetCapability), 151 193 TPM_CMD_CODE_INIT(TPM2_CC_GET_RANDOM, NULL), 152 194 TPM_CMD_CODE_INIT(TPM2_CC_GET_TEST_RESULT, NULL), … … 200 242 { 201 243 RTMsgInfo(" %s:\n", s_aTpmCmdCodes[i].pszCmdCode); 244 if (s_aTpmCmdCodes[i].pfnDecode) 245 s_aTpmCmdCodes[i].pfnDecode(pHdr, RT_BE2H_U32(pHdr->cbReq)); 202 246 return; 203 247 }
Note:
See TracChangeset
for help on using the changeset viewer.