Vadim Bendebury | 5679752 | 2015-05-20 10:32:25 -0700 | [diff] [blame] | 1 | // This file was extracted from the TCG Published |
| 2 | // Trusted Platform Module Library |
| 3 | // Part 3: Commands |
| 4 | // Family "2.0" |
| 5 | // Level 00 Revision 01.16 |
| 6 | // October 30, 2014 |
| 7 | |
| 8 | #include "InternalRoutines.h" |
| 9 | #include "PP_Commands_fp.h" |
| 10 | TPM_RC |
| 11 | TPM2_PP_Commands( |
| 12 | PP_Commands_In *in // IN: input parameter list |
| 13 | ) |
| 14 | { |
| 15 | UINT32 i; |
| 16 | |
| 17 | TPM_RC result; |
| 18 | |
| 19 | // The command needs NV update. Check if NV is available. |
| 20 | // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at |
| 21 | // this point |
| 22 | result = NvIsAvailable(); |
| 23 | if(result != TPM_RC_SUCCESS) return result; |
| 24 | |
| 25 | // Internal Data Update |
| 26 | |
| 27 | // Process set list |
| 28 | for(i = 0; i < in->setList.count; i++) |
| 29 | // If command is implemented, set it as PP required. If the input |
| 30 | // command is not a PP command, it will be ignored at |
| 31 | // PhysicalPresenceCommandSet(). |
| 32 | if(CommandIsImplemented(in->setList.commandCodes[i])) |
| 33 | PhysicalPresenceCommandSet(in->setList.commandCodes[i]); |
| 34 | |
| 35 | // Process clear list |
| 36 | for(i = 0; i < in->clearList.count; i++) |
| 37 | // If command is implemented, clear it as PP required. If the input |
| 38 | // command is not a PP command, it will be ignored at |
| 39 | // PhysicalPresenceCommandClear(). If the input command is |
| 40 | // TPM2_PP_Commands, it will be ignored as well |
| 41 | if(CommandIsImplemented(in->clearList.commandCodes[i])) |
| 42 | PhysicalPresenceCommandClear(in->clearList.commandCodes[i]); |
| 43 | |
| 44 | // Save the change of PP list |
| 45 | NvWriteReserved(NV_PP_LIST, &gp.ppList); |
| 46 | |
| 47 | return TPM_RC_SUCCESS; |
| 48 | } |