diff options
author | Tom Rini <trini@konsulko.com> | 2022-12-23 07:46:41 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-12-23 07:46:41 -0500 |
commit | e1befc8512fe4f67056a6e4b5cd2ab936abc35c6 (patch) | |
tree | af932c91d36669a26ef3b1c1ee71f8810b969ffb | |
parent | 24a0a00f07fcbf4f8ca64cb13b2fa7d624ca6af9 (diff) | |
parent | fe8a4ed011107319d7b19d12118b0e5a6bfcd932 (diff) | |
download | u-boot-e1befc8512fe4f67056a6e4b5cd2ab936abc35c6.zip u-boot-e1befc8512fe4f67056a6e4b5cd2ab936abc35c6.tar.gz u-boot-e1befc8512fe4f67056a6e4b5cd2ab936abc35c6.tar.bz2 |
Merge tag 'tpm-23122022' of https://source.denx.de/u-boot/custodians/u-boot-tpmWIP/23Dec2022
OP-TEE autodiscovery
-rw-r--r-- | drivers/tee/optee/core.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 9240277..b21031d 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -102,13 +102,14 @@ static int bind_service_list(struct udevice *dev, struct tee_shm *service_list, return 0; } -static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm_size, u32 tee_sess) +static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm_size, u32 tee_sess, + unsigned int pta_cmd) { struct tee_invoke_arg arg = { }; struct tee_param param = { }; int ret = 0; - arg.func = PTA_CMD_GET_DEVICES; + arg.func = pta_cmd; arg.session = tee_sess; /* Fill invoke cmd params */ @@ -118,7 +119,7 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm ret = tee_invoke_func(dev, &arg, 1, ¶m); if (ret || (arg.ret && arg.ret != TEE_ERROR_SHORT_BUFFER)) { - dev_err(dev, "PTA_CMD_GET_DEVICES invoke function err: 0x%x\n", arg.ret); + dev_err(dev, "Enumeration command 0x%x failed: 0x%x\n", pta_cmd, arg.ret); return -EINVAL; } @@ -127,12 +128,13 @@ static int __enum_services(struct udevice *dev, struct tee_shm *shm, size_t *shm return 0; } -static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *count, u32 tee_sess) +static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *count, u32 tee_sess, + unsigned int pta_cmd) { size_t shm_size = 0; int ret; - ret = __enum_services(dev, NULL, &shm_size, tee_sess); + ret = __enum_services(dev, NULL, &shm_size, tee_sess, pta_cmd); if (ret) return ret; @@ -142,7 +144,7 @@ static int enum_services(struct udevice *dev, struct tee_shm **shm, size_t *coun return ret; } - ret = __enum_services(dev, *shm, &shm_size, tee_sess); + ret = __enum_services(dev, *shm, &shm_size, tee_sess, pta_cmd); if (!ret) *count = shm_size / sizeof(struct tee_optee_ta_uuid); @@ -174,20 +176,32 @@ static int bind_service_drivers(struct udevice *dev) struct tee_shm *service_list = NULL; size_t service_count; u32 tee_sess; - int ret; + int ret, ret2; ret = open_enum_session(dev, &tee_sess); if (ret) return ret; - ret = enum_services(dev, &service_list, &service_count, tee_sess); + ret = enum_services(dev, &service_list, &service_count, tee_sess, + PTA_CMD_GET_DEVICES); if (!ret) ret = bind_service_list(dev, service_list, service_count); tee_shm_free(service_list); + + ret2 = enum_services(dev, &service_list, &service_count, tee_sess, + PTA_CMD_GET_DEVICES_SUPP); + if (!ret2) + ret2 = bind_service_list(dev, service_list, service_count); + + tee_shm_free(service_list); + tee_close_session(dev, tee_sess); - return ret; + if (ret) + return ret; + + return ret2; } /** @@ -834,7 +848,7 @@ static int optee_probe(struct udevice *dev) */ ret = device_bind_driver(dev, "optee-rng", "optee-rng", NULL); if (ret) - return ret; + dev_warn(dev, "ftpm_tee failed to bind: %d\n", ret); } return 0; |