diff options
author | Tom Rini <trini@konsulko.com> | 2018-11-30 17:09:50 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-11-30 17:09:50 -0500 |
commit | 172e3c11901229f0fb88317ac73a47d944a74f46 (patch) | |
tree | 15b0252705fe2ee78d7501c79a2161a172e2c75b /include | |
parent | daec1fd482b5ea735d70676a1909aec4355bbf86 (diff) | |
parent | 1678754f5e2cbc14f9612e953b39cc08ada66866 (diff) | |
download | u-boot-172e3c11901229f0fb88317ac73a47d944a74f46.tar.gz u-boot-172e3c11901229f0fb88317ac73a47d944a74f46.tar.xz u-boot-172e3c11901229f0fb88317ac73a47d944a74f46.zip |
Merge tag 'pull-30nov18' of git://git.denx.de/u-boot-dm
Fix sound on sandbox
Convert TPM fully to DM
Tidy up sandbox I2C emulation
Add a 'make qcheck' target for faster testing
A few other misc things
(dropped the final patch which breaks clang for some reason)
Diffstat (limited to 'include')
-rw-r--r-- | include/dm/device.h | 25 | ||||
-rw-r--r-- | include/dm/ofnode.h | 2 | ||||
-rw-r--r-- | include/dm/uclass-id.h | 3 | ||||
-rw-r--r-- | include/dm/uclass-internal.h | 17 | ||||
-rw-r--r-- | include/i2c.h | 21 | ||||
-rw-r--r-- | include/log.h | 2 | ||||
-rw-r--r-- | include/malloc.h | 1 | ||||
-rw-r--r-- | include/sound.h | 4 | ||||
-rw-r--r-- | include/tpm-common.h | 36 | ||||
-rw-r--r-- | include/tpm-v1.h | 97 | ||||
-rw-r--r-- | include/tpm-v2.h | 49 |
11 files changed, 203 insertions, 54 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index 847934425b..27a6d7b9fd 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -525,6 +525,8 @@ int device_find_next_child(struct udevice **devp); * This is used to locate an existing child of a device which is of a given * uclass. * + * The device is NOT probed + * * @parent: Parent device to search * @uclass_id: Uclass to look for * @devp: Returns device found, if any @@ -535,6 +537,29 @@ int device_find_first_inactive_child(struct udevice *parent, struct udevice **devp); /** + * device_find_first_child_by_uclass() - Find the first child of a device in uc + * + * @parent: Parent device to search + * @uclass_id: Uclass to look for + * @devp: Returns first child device in that uclass, if any + * @return 0 if found, else -ENODEV + */ +int device_find_first_child_by_uclass(struct udevice *parent, + enum uclass_id uclass_id, + struct udevice **devp); + +/** + * device_find_child_by_name() - Find a child by device name + * + * @parent: Parent device to search + * @name: Name to look for + * @devp: Returns device found, if any + * @return 0 if found, else -ENODEV + */ +int device_find_child_by_name(struct udevice *parent, const char *name, + struct udevice **devp); + +/** * device_has_children() - check if a device has any children * * @dev: Device to check diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 92539b8b5f..d206ee2caa 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -333,7 +333,7 @@ ofnode ofnode_get_parent(ofnode node); * ofnode_get_name() - get the name of a node * * @node: valid node to look up - * @return name or node + * @return name of node */ const char *ofnode_get_name(ofnode node); diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index c91dca1f82..a5fcb69dba 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -21,10 +21,10 @@ enum uclass_id { UCLASS_TEST_DUMMY, UCLASS_SPI_EMUL, /* sandbox SPI device emulator */ UCLASS_I2C_EMUL, /* sandbox I2C device emulator */ + UCLASS_I2C_EMUL_PARENT, /* parent for I2C device emulators */ UCLASS_PCI_EMUL, /* sandbox PCI device emulator */ UCLASS_USB_EMUL, /* sandbox USB bus device emulator */ UCLASS_AXI_EMUL, /* sandbox AXI bus device emulator */ - UCLASS_SIMPLE_BUS, /* bus with child devices */ /* U-Boot uclasses start here - in alphabetical order */ UCLASS_ADC, /* Analog-to-digital converter */ @@ -78,6 +78,7 @@ enum uclass_id { UCLASS_RTC, /* Real time clock device */ UCLASS_SCSI, /* SCSI device */ UCLASS_SERIAL, /* Serial UART */ + UCLASS_SIMPLE_BUS, /* Bus with child devices */ UCLASS_SMEM, /* Shared memory interface */ UCLASS_SPI, /* SPI bus */ UCLASS_SPMI, /* System Power Management Interface bus */ diff --git a/include/dm/uclass-internal.h b/include/dm/uclass-internal.h index 30d5a4fb9b..8a4839ee88 100644 --- a/include/dm/uclass-internal.h +++ b/include/dm/uclass-internal.h @@ -143,6 +143,23 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node, struct udevice **devp); /** + * uclass_find_device_by_phandle() - Find a uclass device by phandle + * + * This searches the devices in the uclass for one with the given phandle. + * + * The device is NOT probed, it is merely returned. + * + * @id: ID to look up + * @parent: Parent device containing the phandle pointer + * @name: Name of property in the parent device node + * @devp: Returns pointer to device (there is only one for each node) + * @return 0 if OK, -ENOENT if there is no @name present in the node, other + * -ve on error + */ +int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, + const char *name, struct udevice **devp); + +/** * uclass_bind_device() - Associate device with a uclass * * Connect the device into uclass's list of devices. diff --git a/include/i2c.h b/include/i2c.h index d33f827500..ccffc19552 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -536,6 +536,27 @@ int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip); */ void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs); +/** + * i2c_emul_find() - Find an emulator for an i2c sandbox device + * + * This looks at the device's 'emul' phandle + * + * @dev: Device to find an emulator for + * @emulp: Returns the associated emulator, if found * + * @return 0 if OK, -ENOENT or -ENODEV if not found + */ +int i2c_emul_find(struct udevice *dev, struct udevice **emulp); + +/** + * i2c_emul_get_device() - Find the device being emulated + * + * Given an emulator this returns the associated device + * + * @emul: Emulator for the device + * @return device that @emul is emulating + */ +struct udevice *i2c_emul_get_device(struct udevice *emul); + #ifndef CONFIG_DM_I2C /* diff --git a/include/log.h b/include/log.h index c88a1b5eb4..0f2bc19477 100644 --- a/include/log.h +++ b/include/log.h @@ -114,7 +114,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file, /* Emit a log record if the level is less that the maximum */ #define log(_cat, _level, _fmt, _args...) ({ \ int _l = _level; \ - if (_l <= _LOG_MAX_LEVEL) \ + if (CONFIG_IS_ENABLED(LOG) && _l <= _LOG_MAX_LEVEL) \ _log((enum log_category_t)(_cat), _l, __FILE__, __LINE__, \ __func__, \ pr_fmt(_fmt), ##_args); \ diff --git a/include/malloc.h b/include/malloc.h index 8175c75920..b714fedf45 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -880,6 +880,7 @@ static inline void free(void *ptr) {} void *calloc(size_t nmemb, size_t size); void *memalign_simple(size_t alignment, size_t bytes); void *realloc_simple(void *ptr, size_t size); +void malloc_simple_info(void); #else # ifdef USE_DL_PREFIX diff --git a/include/sound.h b/include/sound.h index 3269f2371c..77bfe6a93b 100644 --- a/include/sound.h +++ b/include/sound.h @@ -31,11 +31,13 @@ struct sound_codec_info { /* * Generates square wave sound data for 1 second * + * @param sample_rate Sample rate in Hz * @param data data buffer pointer * @param size size of the buffer * @param freq frequency of the wave */ -void sound_create_square_wave(unsigned short *data, int size, uint32_t freq); +void sound_create_square_wave(uint sample_rate, unsigned short *data, int size, + uint freq); /* * Initialises audio sub system diff --git a/include/tpm-common.h b/include/tpm-common.h index 5f8bc6bc52..3d88b44db7 100644 --- a/include/tpm-common.h +++ b/include/tpm-common.h @@ -26,6 +26,8 @@ enum tpm_duration { /* Max buffer size supported by our tpm */ #define TPM_DEV_BUFSIZE 1260 +#define TPM_PCR_MINIMUM_DIGEST_SIZE 20 + /** * enum tpm_version - The version of the TPM stack to be used * @TPM_V1: Use TPM v1.x stack @@ -174,12 +176,40 @@ struct tpm_ops { int do_##cmd(cmd_tbl_t *cmdtp, int flag, \ int argc, char * const argv[]) \ { \ + struct udevice *dev; \ + int rc; \ + \ + rc = get_tpm(&dev); \ + if (rc) \ + return rc; \ if (argc != 1) \ return CMD_RET_USAGE; \ - return report_return_code(cmd()); \ + return report_return_code(cmd(dev)); \ } /** + * tpm_open() - Request access to locality 0 for the caller + * + * After all commands have been completed the caller is supposed to + * call tpm_close(). + * + * @dev - TPM device + * Returns 0 on success, -ve on failure. + */ +int tpm_open(struct udevice *dev); + +/** + * tpm_close() - Close the current session + * + * Releasing the locked locality. Returns 0 on success, -ve 1 on + * failure (in case lock removal did not succeed). + * + * @dev - TPM device + * Returns 0 on success, -ve on failure. + */ +int tpm_close(struct udevice *dev); + +/** * tpm_get_desc() - Get a text description of the TPM * * @dev: Device to check @@ -202,6 +232,7 @@ int tpm_get_desc(struct udevice *dev, char *buf, int size); * Note that the outgoing data is inspected to determine command type * (ordinal) and a timeout is used for that command type. * + * @dev - TPM device * @sendbuf - buffer of the data to send * @send_size size of the data to send * @recvbuf - memory to save the response to @@ -216,9 +247,10 @@ int tpm_xfer(struct udevice *dev, const u8 *sendbuf, size_t send_size, /** * Initialize TPM device. It must be called before any TPM commands. * + * @dev - TPM device * @return 0 on success, non-0 on error. */ -int tpm_init(void); +int tpm_init(struct udevice *dev); /** * Retrieve the array containing all the v1 (resp. v2) commands. diff --git a/include/tpm-v1.h b/include/tpm-v1.h index be2eca946f..45b7a4831d 100644 --- a/include/tpm-v1.h +++ b/include/tpm-v1.h @@ -282,64 +282,72 @@ struct __packed tpm_nv_data_public { /** * Issue a TPM_Startup command. * + * @param dev TPM device * @param mode TPM startup mode * @return return code of the operation */ -u32 tpm_startup(enum tpm_startup_type mode); +u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode); /** * Issue a TPM_SelfTestFull command. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_self_test_full(void); +u32 tpm_self_test_full(struct udevice *dev); /** * Issue a TPM_ContinueSelfTest command. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_continue_self_test(void); +u32 tpm_continue_self_test(struct udevice *dev); /** * Issue a TPM_NV_DefineSpace command. The implementation is limited * to specify TPM_NV_ATTRIBUTES and size of the area. The area index * could be one of the special value listed in enum tpm_nv_index. * + * @param dev TPM device * @param index index of the area * @param perm TPM_NV_ATTRIBUTES of the area * @param size size of the area * @return return code of the operation */ -u32 tpm_nv_define_space(u32 index, u32 perm, u32 size); +u32 tpm_nv_define_space(struct udevice *dev, u32 index, u32 perm, u32 size); /** * Issue a TPM_NV_ReadValue command. This implementation is limited * to read the area from offset 0. The area index could be one of * the special value listed in enum tpm_nv_index. * + * @param dev TPM device * @param index index of the area * @param data output buffer of the area contents * @param count size of output buffer * @return return code of the operation */ -u32 tpm_nv_read_value(u32 index, void *data, u32 count); +u32 tpm_nv_read_value(struct udevice *dev, u32 index, void *data, u32 count); /** * Issue a TPM_NV_WriteValue command. This implementation is limited * to write the area from offset 0. The area index could be one of * the special value listed in enum tpm_nv_index. * + * @param dev TPM device * @param index index of the area * @param data input buffer to be wrote to the area * @param length length of data bytes of input buffer * @return return code of the operation */ -u32 tpm_nv_write_value(u32 index, const void *data, u32 length); +u32 tpm_nv_write_value(struct udevice *dev, u32 index, const void *data, + u32 length); /** * Issue a TPM_Extend command. * + * @param dev TPM device * @param index index of the PCR * @param in_digest 160-bit value representing the event to be * recorded @@ -347,69 +355,78 @@ u32 tpm_nv_write_value(u32 index, const void *data, u32 length); * command * @return return code of the operation */ -u32 tpm_extend(u32 index, const void *in_digest, void *out_digest); +u32 tpm_extend(struct udevice *dev, u32 index, const void *in_digest, + void *out_digest); /** * Issue a TPM_PCRRead command. * + * @param dev TPM device * @param index index of the PCR * @param data output buffer for contents of the named PCR * @param count size of output buffer * @return return code of the operation */ -u32 tpm_pcr_read(u32 index, void *data, size_t count); +u32 tpm_pcr_read(struct udevice *dev, u32 index, void *data, size_t count); /** * Issue a TSC_PhysicalPresence command. TPM physical presence flag * is bit-wise OR'ed of flags listed in enum tpm_physical_presence. * + * @param dev TPM device * @param presence TPM physical presence flag * @return return code of the operation */ -u32 tpm_tsc_physical_presence(u16 presence); +u32 tpm_tsc_physical_presence(struct udevice *dev, u16 presence); /** * Issue a TPM_ReadPubek command. * + * @param dev TPM device * @param data output buffer for the public endorsement key * @param count size of output buffer * @return return code of the operation */ -u32 tpm_read_pubek(void *data, size_t count); +u32 tpm_read_pubek(struct udevice *dev, void *data, size_t count); /** * Issue a TPM_ForceClear command. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_force_clear(void); +u32 tpm_force_clear(struct udevice *dev); /** * Issue a TPM_PhysicalEnable command. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_physical_enable(void); +u32 tpm_physical_enable(struct udevice *dev); /** * Issue a TPM_PhysicalDisable command. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_physical_disable(void); +u32 tpm_physical_disable(struct udevice *dev); /** * Issue a TPM_PhysicalSetDeactivated command. * + * @param dev TPM device * @param state boolean state of the deactivated flag * @return return code of the operation */ -u32 tpm_physical_set_deactivated(u8 state); +u32 tpm_physical_set_deactivated(struct udevice *dev, u8 state); /** * Issue a TPM_GetCapability command. This implementation is limited * to query sub_cap index that is 4-byte wide. * + * @param dev TPM device * @param cap_area partition of capabilities * @param sub_cap further definition of capability, which is * limited to be 4-byte wide @@ -417,15 +434,17 @@ u32 tpm_physical_set_deactivated(u8 state); * @param count size of output buffer * @return return code of the operation */ -u32 tpm_get_capability(u32 cap_area, u32 sub_cap, void *cap, size_t count); +u32 tpm_get_capability(struct udevice *dev, u32 cap_area, u32 sub_cap, + void *cap, size_t count); /** * Issue a TPM_FlushSpecific command for a AUTH resource. * + * @param dev TPM device * @param auth_handle handle of the auth session * @return return code of the operation */ -u32 tpm_terminate_auth_session(u32 auth_handle); +u32 tpm_terminate_auth_session(struct udevice *dev, u32 auth_handle); /** * Issue a TPM_OIAP command to setup an object independent authorization @@ -434,22 +453,25 @@ u32 tpm_terminate_auth_session(u32 auth_handle); * If there was already an OIAP session active it is terminated and a new * session is set up. * + * @param dev TPM device * @param auth_handle pointer to the (new) auth handle or NULL. * @return return code of the operation */ -u32 tpm_oiap(u32 *auth_handle); +u32 tpm_oiap(struct udevice *dev, u32 *auth_handle); /** * Ends an active OIAP session. * + * @param dev TPM device * @return return code of the operation */ -u32 tpm_end_oiap(void); +u32 tpm_end_oiap(struct udevice *dev); /** * Issue a TPM_LoadKey2 (Auth1) command using an OIAP session for authenticating * the usage of the parent key. * + * @param dev TPM device * @param parent_handle handle of the parent key. * @param key pointer to the key structure (TPM_KEY or TPM_KEY12). * @param key_length size of the key structure @@ -457,13 +479,15 @@ u32 tpm_end_oiap(void); * @param key_handle pointer to the key handle * @return return code of the operation */ -u32 tpm_load_key2_oiap(u32 parent_handle, const void *key, size_t key_length, - const void *parent_key_usage_auth, u32 *key_handle); +u32 tpm_load_key2_oiap(struct udevice *dev, u32 parent_handle, const void *key, + size_t key_length, const void *parent_key_usage_auth, + u32 *key_handle); /** * Issue a TPM_GetPubKey (Auth1) command using an OIAP session for * authenticating the usage of the key. * + * @param dev TPM device * @param key_handle handle of the key * @param usage_auth usage auth for the key * @param pubkey pointer to the pub key buffer; may be NULL if the pubkey @@ -473,45 +497,51 @@ u32 tpm_load_key2_oiap(u32 parent_handle, const void *key, size_t key_length, * of the stored TPM_PUBKEY structure (iff pubkey != NULL). * @return return code of the operation */ -u32 tpm_get_pub_key_oiap(u32 key_handle, const void *usage_auth, void *pubkey, +u32 tpm_get_pub_key_oiap(struct udevice *dev, u32 key_handle, + const void *usage_auth, void *pubkey, size_t *pubkey_len); /** * Get the TPM permanent flags value * + * @param dev TPM device * @param pflags Place to put permanent flags * @return return code of the operation */ -u32 tpm_get_permanent_flags(struct tpm_permanent_flags *pflags); +u32 tpm_get_permanent_flags(struct udevice *dev, + struct tpm_permanent_flags *pflags); /** * Get the TPM permissions * + * @param dev TPM device * @param perm Returns permissions value * @return return code of the operation */ -u32 tpm_get_permissions(u32 index, u32 *perm); +u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm); /** * Flush a resource with a given handle and type from the TPM * + * @param dev TPM device * @param key_handle handle of the resource * @param resource_type type of the resource * @return return code of the operation */ -u32 tpm_flush_specific(u32 key_handle, u32 resource_type); +u32 tpm_flush_specific(struct udevice *dev, u32 key_handle, u32 resource_type); #ifdef CONFIG_TPM_LOAD_KEY_BY_SHA1 /** * Search for a key by usage AuthData and the hash of the parent's pub key. * + * @param dev TPM device * @param auth Usage auth of the key to search for * @param pubkey_digest SHA1 hash of the pub key structure of the key * @param[out] handle The handle of the key (Non-null iff found) * @return 0 if key was found in TPM; != 0 if not. */ -u32 tpm_find_key_sha1(const u8 auth[20], const u8 pubkey_digest[20], - u32 *handle); +u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], + const u8 pubkey_digest[20], u32 *handle); #endif /* CONFIG_TPM_LOAD_KEY_BY_SHA1 */ /** @@ -519,38 +549,43 @@ u32 tpm_find_key_sha1(const u8 auth[20], const u8 pubkey_digest[20], * that the TPM may legally return fewer bytes than requested by retrying * until @p count bytes have been received. * + * @param dev TPM device * @param data output buffer for the random bytes * @param count size of output buffer * @return return code of the operation */ -u32 tpm_get_random(void *data, u32 count); +u32 tpm_get_random(struct udevice *dev, void *data, u32 count); /** * tpm_finalise_physical_presence() - Finalise physical presence * + * @param dev TPM device * @return return code of the operation (0 = success) */ -u32 tpm_finalise_physical_presence(void); +u32 tpm_finalise_physical_presence(struct udevice *dev); /** * tpm_nv_set_locked() - lock the non-volatile space * + * @param dev TPM device * @return return code of the operation (0 = success) */ -u32 tpm_nv_set_locked(void); +u32 tpm_nv_set_locked(struct udevice *dev); /** * tpm_set_global_lock() - set the global lock * + * @param dev TPM device * @return return code of the operation (0 = success) */ -u32 tpm_set_global_lock(void); +u32 tpm_set_global_lock(struct udevice *dev); /** * tpm_resume() - start up the TPM from resume (after suspend) * + * @param dev TPM device * @return return code of the operation (0 = success) */ -u32 tpm_resume(void); +u32 tpm_resume(struct udevice *dev); #endif /* __TPM_V1_H */ diff --git a/include/tpm-v2.h b/include/tpm-v2.h index c77b416182..2f2e66de19 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -131,45 +131,51 @@ enum tpm2_algorithms { /** * Issue a TPM2_Startup command. * + * @dev TPM device * @mode TPM startup mode * * @return code of the operation */ -u32 tpm2_startup(enum tpm2_startup_types mode); +u32 tpm2_startup(struct udevice *dev, enum tpm2_startup_types mode); /** * Issue a TPM2_SelfTest command. * + * @dev TPM device * @full_test Asking to perform all tests or only the untested ones * * @return code of the operation */ -u32 tpm2_self_test(enum tpm2_yes_no full_test); +u32 tpm2_self_test(struct udevice *dev, enum tpm2_yes_no full_test); /** * Issue a TPM2_Clear command. * + * @dev TPM device * @handle Handle * @pw Password * @pw_sz Length of the password * * @return code of the operation */ -u32 tpm2_clear(u32 handle, const char *pw, const ssize_t pw_sz); +u32 tpm2_clear(struct udevice *dev, u32 handle, const char *pw, + const ssize_t pw_sz); /** * Issue a TPM2_PCR_Extend command. * + * @dev TPM device * @index Index of the PCR * @digest Value representing the event to be recorded * * @return code of the operation */ -u32 tpm2_pcr_extend(u32 index, const uint8_t *digest); +u32 tpm2_pcr_extend(struct udevice *dev, u32 index, const uint8_t *digest); /** * Issue a TPM2_PCR_Read command. * + * @dev TPM device * @idx Index of the PCR * @idx_min_sz Minimum size in bytes of the pcrSelect array * @data Output buffer for contents of the named PCR @@ -177,13 +183,14 @@ u32 tpm2_pcr_extend(u32 index, const uint8_t *digest); * * @return code of the operation */ -u32 tpm2_pcr_read(u32 idx, unsigned int idx_min_sz, void *data, - unsigned int *updates); +u32 tpm2_pcr_read(struct udevice *dev, u32 idx, unsigned int idx_min_sz, + void *data, unsigned int *updates); /** * Issue a TPM2_GetCapability command. This implementation is limited * to query property index that is 4-byte wide. * + * @dev TPM device * @capability Partition of capabilities * @property Further definition of capability, limited to be 4 bytes wide * @buf Output buffer for capability information @@ -191,22 +198,24 @@ u32 tpm2_pcr_read(u32 idx, unsigned int idx_min_sz, void *data, * * @return code of the operation */ -u32 tpm2_get_capability(u32 capability, u32 property, void *buf, - size_t prop_count); +u32 tpm2_get_capability(struct udevice *dev, u32 capability, u32 property, + void *buf, size_t prop_count); /** * Issue a TPM2_DictionaryAttackLockReset command. * + * @dev TPM device * @pw Password * @pw_sz Length of the password * * @return code of the operation */ -u32 tpm2_dam_reset(const char *pw, const ssize_t pw_sz); +u32 tpm2_dam_reset(struct udevice *dev, const char *pw, const ssize_t pw_sz); /** * Issue a TPM2_DictionaryAttackParameters command. * + * @dev TPM device * @pw Password * @pw_sz Length of the password * @max_tries Count of authorizations before lockout @@ -215,13 +224,15 @@ u32 tpm2_dam_reset(const char *pw, const ssize_t pw_sz); * * @return code of the operation */ -u32 tpm2_dam_parameters(const char *pw, const ssize_t pw_sz, - unsigned int max_tries, unsigned int recovery_time, +u32 tpm2_dam_parameters(struct udevice *dev, const char *pw, + const ssize_t pw_sz, unsigned int max_tries, + unsigned int recovery_time, unsigned int lockout_recovery); /** * Issue a TPM2_HierarchyChangeAuth command. * + * @dev TPM device * @handle Handle * @newpw New password * @newpw_sz Length of the new password @@ -230,12 +241,14 @@ u32 tpm2_dam_parameters(const char *pw, const ssize_t pw_sz, * * @return code of the operation */ -int tpm2_change_auth(u32 handle, const char *newpw, const ssize_t newpw_sz, - const char *oldpw, const ssize_t oldpw_sz); +int tpm2_change_auth(struct udevice *dev, u32 handle, const char *newpw, + const ssize_t newpw_sz, const char *oldpw, + const ssize_t oldpw_sz); /** * Issue a TPM_PCR_SetAuthPolicy command. * + * @dev TPM device * @pw Platform password * @pw_sz Length of the password * @index Index of the PCR @@ -243,12 +256,13 @@ int tpm2_change_auth(u32 handle, const char *newpw, const ssize_t newpw_sz, * * @return code of the operation */ -u32 tpm2_pcr_setauthpolicy(const char *pw, const ssize_t pw_sz, u32 index, - const char *key); +u32 tpm2_pcr_setauthpolicy(struct udevice *dev, const char *pw, + const ssize_t pw_sz, u32 index, const char *key); /** * Issue a TPM_PCR_SetAuthValue command. * + * @dev TPM device * @pw Platform password * @pw_sz Length of the password * @index Index of the PCR @@ -257,7 +271,8 @@ u32 tpm2_pcr_setauthpolicy(const char *pw, const ssize_t pw_sz, u32 index, * * @return code of the operation */ -u32 tpm2_pcr_setauthvalue(const char *pw, const ssize_t pw_sz, u32 index, - const char *key, const ssize_t key_sz); +u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw, + const ssize_t pw_sz, u32 index, const char *key, + const ssize_t key_sz); #endif /* __TPM_V2_H */ |