Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: zynqmp: Add helper API to self discovery the device

Add API to get SoC version and family info.

Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Harsh Jain and committed by
Herbert Xu
465d7831 c7a768f5

+50
+31
drivers/firmware/xilinx/zynqmp-crypto.c
··· 57 57 return zynqmp_pm_invoke_fn(PM_SECURE_SHA, NULL, 4, upper_addr, lower_addr, size, flags); 58 58 } 59 59 EXPORT_SYMBOL_GPL(zynqmp_pm_sha_hash); 60 + 61 + /** 62 + * xlnx_get_crypto_dev_data() - Get crypto dev data of platform 63 + * @feature_map: List of available feature map of all platform 64 + * 65 + * Return: Returns crypto dev data, either address crypto dev or ERR PTR 66 + */ 67 + void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map) 68 + { 69 + struct xlnx_feature *feature; 70 + u32 pm_family_code; 71 + int ret; 72 + 73 + /* Get the Family code and sub family code of platform */ 74 + ret = zynqmp_pm_get_family_info(&pm_family_code); 75 + if (ret < 0) 76 + return ERR_PTR(ret); 77 + 78 + feature = feature_map; 79 + for (; feature->family; feature++) { 80 + if (feature->family == pm_family_code) { 81 + ret = zynqmp_pm_feature(feature->feature_id); 82 + if (ret < 0) 83 + return ERR_PTR(ret); 84 + 85 + return feature->data; 86 + } 87 + } 88 + return ERR_PTR(-ENODEV); 89 + } 90 + EXPORT_SYMBOL_GPL(xlnx_get_crypto_dev_data);
+19
include/linux/firmware/xlnx-zynqmp-crypto.h
··· 9 9 #ifndef __FIRMWARE_XLNX_ZYNQMP_CRYPTO_H__ 10 10 #define __FIRMWARE_XLNX_ZYNQMP_CRYPTO_H__ 11 11 12 + /** 13 + * struct xlnx_feature - Feature data 14 + * @family: Family code of platform 15 + * @subfamily: Subfamily code of platform 16 + * @feature_id: Feature id of module 17 + * @data: Collection of all supported platform data 18 + */ 19 + struct xlnx_feature { 20 + u32 family; 21 + u32 feature_id; 22 + void *data; 23 + }; 24 + 12 25 #if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE) 13 26 int zynqmp_pm_aes_engine(const u64 address, u32 *out); 14 27 int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags); 28 + void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map); 15 29 #else 16 30 static inline int zynqmp_pm_aes_engine(const u64 address, u32 *out) 17 31 { ··· 36 22 const u32 flags) 37 23 { 38 24 return -ENODEV; 25 + } 26 + 27 + static inline void *xlnx_get_crypto_dev_data(struct xlnx_feature *feature_map) 28 + { 29 + return ERR_PTR(-ENODEV); 39 30 } 40 31 #endif 41 32