diff options
Diffstat (limited to 'common/extension.c')
-rw-r--r-- | common/extension.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/common/extension.c b/common/extension.c index d28bfad337..acc084127f 100644 --- a/common/extension.c +++ b/common/extension.c @@ -34,3 +34,44 @@ uint32_t extension_route_command(uint16_t command_code, *out_size = 0; return VENDOR_RC_NO_SUCH_COMMAND; } + +uint32_t usb_extension_route_command(uint16_t command_code, + void *buffer, + size_t in_size, + size_t *out_size) +{ + int is_allowed = 0; + + switch (command_code) { +#ifdef CR50_DEV + case VENDOR_CC_IMMEDIATE_RESET: + case VENDOR_CC_TURN_UPDATE_ON: +#endif /* defined(CR50_DEV) */ + case EXTENSION_POST_RESET: /* Always need to be able to reset. */ + is_allowed = 1; + break; + + default: + break; + } + + if (is_allowed) + return extension_route_command(command_code, buffer, in_size, + out_size); + + /* Otherwise, we don't allow this command. */ + CPRINTF("%s: ignoring vendor cmd %d\n", __func__, command_code); + *out_size = 0; + return VENDOR_RC_NO_SUCH_COMMAND; +} + +uint32_t tpm_extension_route_command(uint16_t command_code, + void *buffer, + size_t in_size, + size_t *out_size) +{ + /* + * TODO(aaboagye): Determine what commands (if any) should be filtered. + */ + return extension_route_command(command_code, buffer, in_size, out_size); +} |