• Home
  • Raw
  • Download

Lines Matching refs:cmd

56 static void AddVisibleField(Command* cmd, const char* name, int offset) {  in AddVisibleField()  argument
58 if (cmd->fields != NULL) { in AddVisibleField()
61 fld->next = cmd->fields; in AddVisibleField()
62 cmd->fields = fld; in AddVisibleField()
71 static void AddInitializedField(Command* cmd, int offset, in AddInitializedField() argument
74 fld->next = cmd->fields; in AddInitializedField()
75 cmd->fields = fld; in AddInitializedField()
86 Command* cmd = (Command*) calloc(1, sizeof(Command)); in newCommand() local
87 cmd->size = size; in newCommand()
88 AddInitializedField(cmd, 0, sizeof(TPM_TAG), TPM_TAG_RQU_COMMAND); in newCommand()
89 AddInitializedField(cmd, sizeof(TPM_TAG), sizeof(uint32_t), size); in newCommand()
90 AddInitializedField(cmd, sizeof(TPM_TAG) + sizeof(uint32_t), in newCommand()
92 return cmd; in newCommand()
132 Command* cmd = newCommand(TPM_ORD_NV_DefineSpace, size); in BuildDefineSpaceCommand() local
133 cmd->name = "tpm_nv_definespace_cmd"; in BuildDefineSpaceCommand()
135 AddVisibleField(cmd, "index", nv_index); in BuildDefineSpaceCommand()
136 AddVisibleField(cmd, "perm", nv_permission_attributes); in BuildDefineSpaceCommand()
137 AddVisibleField(cmd, "size", nv_datasize); in BuildDefineSpaceCommand()
139 AddInitializedField(cmd, nv_data_public, sizeof(uint16_t), in BuildDefineSpaceCommand()
141 AddInitializedField(cmd, nv_pcr_info_read, sizeof(uint16_t), 3); in BuildDefineSpaceCommand()
142 AddInitializedField(cmd, read_locality, sizeof(TPM_LOCALITY_SELECTION), in BuildDefineSpaceCommand()
144 AddInitializedField(cmd, nv_pcr_info_write, sizeof(uint16_t), 3); in BuildDefineSpaceCommand()
145 AddInitializedField(cmd, write_locality, sizeof(TPM_LOCALITY_SELECTION), in BuildDefineSpaceCommand()
147 AddInitializedField(cmd, nv_permission_tag, sizeof(TPM_STRUCTURE_TAG), in BuildDefineSpaceCommand()
149 return cmd; in BuildDefineSpaceCommand()
155 Command* cmd = newCommand(TPM_ORD_NV_WriteValue, 0); in BuildWriteCommand() local
156 cmd->name = "tpm_nv_write_cmd"; in BuildWriteCommand()
157 cmd->max_size = TPM_LARGE_ENOUGH_COMMAND_SIZE; in BuildWriteCommand()
158 AddVisibleField(cmd, "index", kTpmRequestHeaderLength); in BuildWriteCommand()
159 AddVisibleField(cmd, "length", kTpmRequestHeaderLength + 8); in BuildWriteCommand()
160 AddVisibleField(cmd, "data", kTpmRequestHeaderLength + 12); in BuildWriteCommand()
161 return cmd; in BuildWriteCommand()
166 Command* cmd = newCommand(TPM_ORD_NV_ReadValue, size); in BuildReadCommand() local
167 cmd->name = "tpm_nv_read_cmd"; in BuildReadCommand()
168 AddVisibleField(cmd, "index", kTpmRequestHeaderLength); in BuildReadCommand()
169 AddVisibleField(cmd, "length", kTpmRequestHeaderLength + 8); in BuildReadCommand()
170 return cmd; in BuildReadCommand()
175 Command* cmd = newCommand(TPM_ORD_PcrRead, size); in BuildPCRReadCommand() local
176 cmd->name = "tpm_pcr_read_cmd"; in BuildPCRReadCommand()
177 AddVisibleField(cmd, "pcrNum", kTpmRequestHeaderLength); in BuildPCRReadCommand()
178 return cmd; in BuildPCRReadCommand()
183 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); in BuildPPAssertCommand() local
184 cmd->name = "tpm_ppassert_cmd"; in BuildPPAssertCommand()
185 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildPPAssertCommand()
188 return cmd; in BuildPPAssertCommand()
193 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); in BuildPPEnableCommand() local
194 cmd->name = "tpm_ppenable_cmd"; in BuildPPEnableCommand()
195 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildPPEnableCommand()
198 return cmd; in BuildPPEnableCommand()
203 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); in BuildFinalizePPCommand() local
204 cmd->name = "tpm_finalizepp_cmd"; in BuildFinalizePPCommand()
205 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildFinalizePPCommand()
210 return cmd; in BuildFinalizePPCommand()
215 Command* cmd = newCommand(TSC_ORD_PhysicalPresence, size); in BuildPPLockCommand() local
216 cmd->name = "tpm_pplock_cmd"; in BuildPPLockCommand()
217 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildPPLockCommand()
220 return cmd; in BuildPPLockCommand()
225 Command* cmd = newCommand(TPM_ORD_Startup, size); in BuildStartupCommand() local
226 cmd->name = "tpm_startup_cmd"; in BuildStartupCommand()
227 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildStartupCommand()
230 return cmd; in BuildStartupCommand()
235 Command* cmd = newCommand(TPM_ORD_SaveState, size); in BuildSaveStateCommand() local
236 cmd->name = "tpm_savestate_cmd"; in BuildSaveStateCommand()
237 return cmd; in BuildSaveStateCommand()
242 Command* cmd = newCommand(TPM_ORD_Startup, size); in BuildResumeCommand() local
243 cmd->name = "tpm_resume_cmd"; in BuildResumeCommand()
244 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildResumeCommand()
247 return cmd; in BuildResumeCommand()
252 Command* cmd = newCommand(TPM_ORD_SelfTestFull, size); in BuildSelftestfullCommand() local
253 cmd->name = "tpm_selftestfull_cmd"; in BuildSelftestfullCommand()
254 return cmd; in BuildSelftestfullCommand()
259 Command* cmd = newCommand(TPM_ORD_ContinueSelfTest, size); in BuildContinueSelfTestCommand() local
260 cmd->name = "tpm_continueselftest_cmd"; in BuildContinueSelfTestCommand()
261 return cmd; in BuildContinueSelfTestCommand()
266 Command* cmd = newCommand(TPM_ORD_ReadPubek, size); in BuildReadPubekCommand() local
267 cmd->name = "tpm_readpubek_cmd"; in BuildReadPubekCommand()
268 return cmd; in BuildReadPubekCommand()
273 Command* cmd = newCommand(TPM_ORD_ForceClear, size); in BuildForceClearCommand() local
274 cmd->name = "tpm_forceclear_cmd"; in BuildForceClearCommand()
275 return cmd; in BuildForceClearCommand()
280 Command* cmd = newCommand(TPM_ORD_PhysicalEnable, size); in BuildPhysicalEnableCommand() local
281 cmd->name = "tpm_physicalenable_cmd"; in BuildPhysicalEnableCommand()
282 return cmd; in BuildPhysicalEnableCommand()
287 Command* cmd = newCommand(TPM_ORD_PhysicalDisable, size); in BuildPhysicalDisableCommand() local
288 cmd->name = "tpm_physicaldisable_cmd"; in BuildPhysicalDisableCommand()
289 return cmd; in BuildPhysicalDisableCommand()
294 Command* cmd = newCommand(TPM_ORD_PhysicalSetDeactivated, size); in BuildPhysicalSetDeactivatedCommand() local
295 cmd->name = "tpm_physicalsetdeactivated_cmd"; in BuildPhysicalSetDeactivatedCommand()
296 AddVisibleField(cmd, "deactivated", kTpmRequestHeaderLength); in BuildPhysicalSetDeactivatedCommand()
297 return cmd; in BuildPhysicalSetDeactivatedCommand()
302 Command* cmd = newCommand(TPM_ORD_Extend, size); in BuildExtendCommand() local
303 cmd->name = "tpm_extend_cmd"; in BuildExtendCommand()
304 AddVisibleField(cmd, "pcrNum", kTpmRequestHeaderLength); in BuildExtendCommand()
305 AddVisibleField(cmd, "inDigest", kTpmRequestHeaderLength + sizeof(uint32_t)); in BuildExtendCommand()
306 return cmd; in BuildExtendCommand()
315 Command* cmd = newCommand(TPM_ORD_GetCapability, size); in BuildGetFlagsCommand() local
316 cmd->name = "tpm_getflags_cmd"; in BuildGetFlagsCommand()
317 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildGetFlagsCommand()
319 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetFlagsCommand()
322 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetFlagsCommand()
325 return cmd; in BuildGetFlagsCommand()
334 Command* cmd = newCommand(TPM_ORD_GetCapability, size); in BuildGetSTClearFlagsCommand() local
335 cmd->name = "tpm_getstclearflags_cmd"; in BuildGetSTClearFlagsCommand()
336 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildGetSTClearFlagsCommand()
338 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetSTClearFlagsCommand()
341 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetSTClearFlagsCommand()
344 return cmd; in BuildGetSTClearFlagsCommand()
353 Command* cmd = newCommand(TPM_ORD_GetCapability, size); in BuildGetPermissionsCommand() local
354 cmd->name = "tpm_getpermissions_cmd"; in BuildGetPermissionsCommand()
355 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildGetPermissionsCommand()
357 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetPermissionsCommand()
360 AddVisibleField(cmd, "index", kTpmRequestHeaderLength + in BuildGetPermissionsCommand()
362 return cmd; in BuildGetPermissionsCommand()
371 Command* cmd = newCommand(TPM_ORD_GetCapability, size); in BuildGetOwnershipCommand() local
372 cmd->name = "tpm_getownership_cmd"; in BuildGetOwnershipCommand()
373 AddInitializedField(cmd, kTpmRequestHeaderLength, in BuildGetOwnershipCommand()
375 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetOwnershipCommand()
378 AddInitializedField(cmd, kTpmRequestHeaderLength + in BuildGetOwnershipCommand()
381 return cmd; in BuildGetOwnershipCommand()
386 Command* cmd = newCommand(TPM_ORD_GetRandom, size); in BuildGetRandomCommand() local
387 cmd->name = "tpm_get_random_cmd"; in BuildGetRandomCommand()
388 AddVisibleField(cmd, "bytesRequested", kTpmRequestHeaderLength); in BuildGetRandomCommand()
389 return cmd; in BuildGetRandomCommand()
408 int OutputBytes_(Command* cmd, Field* fld) { in OutputBytes_() argument
415 cursor = OutputBytes_(cmd, fld->next); in OutputBytes_()
455 void OutputBytes(Command* cmd) { in OutputBytes() argument
456 (void) OutputBytes_(cmd, cmd->fields); in OutputBytes()
459 void OutputFieldPointers(Command* cmd, Field* fld) { in OutputFieldPointers() argument
463 OutputFieldPointers(cmd, fld->next); in OutputFieldPointers()
472 void OutputCommands(Command* cmd) { in OutputCommands() argument
473 if (cmd == NULL) { in OutputCommands()
477 cmd->name, cmd->size == 0 ? cmd->max_size : cmd->size); in OutputCommands()
478 OutputFields(cmd->fields); in OutputCommands()
479 printf("} %s = {{", cmd->name); in OutputCommands()
480 OutputBytes(cmd); in OutputCommands()
482 OutputFieldPointers(cmd, cmd->fields); in OutputCommands()
485 OutputCommands(cmd->next); in OutputCommands()
523 static void FreeCommands(Command* cmd) { in FreeCommands() argument
524 if (cmd != NULL) { in FreeCommands()
525 Command* next_command = cmd->next; in FreeCommands()
526 FreeFields(cmd->fields); in FreeCommands()
527 free(cmd); in FreeCommands()
536 Command* cmd = builders[i](); in main() local
537 cmd->next = commands; in main()
538 commands = cmd; in main()