diff options
author | Sumit Garg <sumit.garg@linaro.org> | 2019-01-29 00:49:35 -0500 |
---|---|---|
committer | Jens Wiklander <jens.wiklander@linaro.org> | 2019-02-01 09:12:46 -0500 |
commit | 0fc1db9d105915021260eb241661b8e96f5c0f1a (patch) | |
tree | 5e5d608e2a01aaeec416ade44d47036638ad7289 /scripts/mod/file2alias.c | |
parent | 42bf4152d8a79f89f5456dee63a1f364fbce2dd6 (diff) |
tee: add bus driver framework for TEE based devices
Introduce a generic TEE bus driver concept for TEE based kernel drivers
which would like to communicate with TEE based devices/services. Also
add support in module device table for these new TEE based devices.
In this TEE bus concept, devices/services are identified via Universally
Unique Identifier (UUID) and drivers register a table of device UUIDs
which they can support.
So this TEE bus framework registers following apis:
- match(): Iterates over the driver UUID table to find a corresponding
match for device UUID. If a match is found, then this particular device
is probed via corresponding probe api registered by the driver. This
process happens whenever a device or a driver is registered with TEE
bus.
- uevent(): Notifies user-space (udev) whenever a new device is registered
on this bus for auto-loading of modularized drivers.
Also this framework allows for device enumeration to be specific to
corresponding TEE implementation like OP-TEE etc.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'scripts/mod/file2alias.c')
-rw-r--r-- | scripts/mod/file2alias.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index a37af7d71973..d0e41723627f 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -37,6 +37,9 @@ typedef unsigned char __u8; | |||
37 | typedef struct { | 37 | typedef struct { |
38 | __u8 b[16]; | 38 | __u8 b[16]; |
39 | } uuid_le; | 39 | } uuid_le; |
40 | typedef struct { | ||
41 | __u8 b[16]; | ||
42 | } uuid_t; | ||
40 | 43 | ||
41 | /* Big exception to the "don't include kernel headers into userspace, which | 44 | /* Big exception to the "don't include kernel headers into userspace, which |
42 | * even potentially has different endianness and word sizes, since | 45 | * even potentially has different endianness and word sizes, since |
@@ -1287,6 +1290,21 @@ static int do_typec_entry(const char *filename, void *symval, char *alias) | |||
1287 | return 1; | 1290 | return 1; |
1288 | } | 1291 | } |
1289 | 1292 | ||
1293 | /* Looks like: tee:uuid */ | ||
1294 | static int do_tee_entry(const char *filename, void *symval, char *alias) | ||
1295 | { | ||
1296 | DEF_FIELD(symval, tee_client_device_id, uuid); | ||
1297 | |||
1298 | sprintf(alias, "tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | ||
1299 | uuid.b[0], uuid.b[1], uuid.b[2], uuid.b[3], uuid.b[4], | ||
1300 | uuid.b[5], uuid.b[6], uuid.b[7], uuid.b[8], uuid.b[9], | ||
1301 | uuid.b[10], uuid.b[11], uuid.b[12], uuid.b[13], uuid.b[14], | ||
1302 | uuid.b[15]); | ||
1303 | |||
1304 | add_wildcard(alias); | ||
1305 | return 1; | ||
1306 | } | ||
1307 | |||
1290 | /* Does namelen bytes of name exactly match the symbol? */ | 1308 | /* Does namelen bytes of name exactly match the symbol? */ |
1291 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1309 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
1292 | { | 1310 | { |
@@ -1357,6 +1375,7 @@ static const struct devtable devtable[] = { | |||
1357 | {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, | 1375 | {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, |
1358 | {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, | 1376 | {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, |
1359 | {"typec", SIZE_typec_device_id, do_typec_entry}, | 1377 | {"typec", SIZE_typec_device_id, do_typec_entry}, |
1378 | {"tee", SIZE_tee_client_device_id, do_tee_entry}, | ||
1360 | }; | 1379 | }; |
1361 | 1380 | ||
1362 | /* Create MODULE_ALIAS() statements. | 1381 | /* Create MODULE_ALIAS() statements. |