mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-30 18:05:48 +01:00 
			
		
		
		
	efi_loader: startup the tpm device when installing the protocol
Due to U-Boot's lazy binding mentality the TPM is probed but not properly initialized. The user can startup the device from the command line e.g 'tpm2 startup TPM2_SU_CLEAR'. However we can initialize the TPM during the TCG protocol installation, which is easier to use overall. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
		
				
					committed by
					
						 Heinrich Schuchardt
						Heinrich Schuchardt
					
				
			
			
				
	
			
			
			
						parent
						
							5ba0397049
						
					
				
				
					commit
					d6b55a420c
				
			| @@ -18,6 +18,7 @@ | |||||||
| #include <smbios.h> | #include <smbios.h> | ||||||
| #include <version_string.h> | #include <version_string.h> | ||||||
| #include <tpm-v2.h> | #include <tpm-v2.h> | ||||||
|  | #include <tpm_api.h> | ||||||
| #include <u-boot/hash-checksum.h> | #include <u-boot/hash-checksum.h> | ||||||
| #include <u-boot/sha1.h> | #include <u-boot/sha1.h> | ||||||
| #include <u-boot/sha256.h> | #include <u-boot/sha256.h> | ||||||
| @@ -1943,6 +1944,7 @@ efi_status_t efi_tcg2_register(void) | |||||||
| 	efi_status_t ret = EFI_SUCCESS; | 	efi_status_t ret = EFI_SUCCESS; | ||||||
| 	struct udevice *dev; | 	struct udevice *dev; | ||||||
| 	struct efi_event *event; | 	struct efi_event *event; | ||||||
|  | 	u32 err; | ||||||
|  |  | ||||||
| 	ret = platform_get_tpm2_device(&dev); | 	ret = platform_get_tpm2_device(&dev); | ||||||
| 	if (ret != EFI_SUCCESS) { | 	if (ret != EFI_SUCCESS) { | ||||||
| @@ -1950,6 +1952,13 @@ efi_status_t efi_tcg2_register(void) | |||||||
| 		return EFI_SUCCESS; | 		return EFI_SUCCESS; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/* initialize the TPM as early as possible. */ | ||||||
|  | 	err = tpm_startup(dev, TPM_ST_CLEAR); | ||||||
|  | 	if (err) { | ||||||
|  | 		log_err("TPM startup failed\n"); | ||||||
|  | 		goto fail; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	ret = efi_init_event_log(); | 	ret = efi_init_event_log(); | ||||||
| 	if (ret != EFI_SUCCESS) | 	if (ret != EFI_SUCCESS) | ||||||
| 		goto fail; | 		goto fail; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user