Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __QCOM_MDT_LOADER_H__
0003 #define __QCOM_MDT_LOADER_H__
0004 
0005 #include <linux/types.h>
0006 
0007 #define QCOM_MDT_TYPE_MASK  (7 << 24)
0008 #define QCOM_MDT_TYPE_HASH  (2 << 24)
0009 #define QCOM_MDT_RELOCATABLE    BIT(27)
0010 
0011 struct device;
0012 struct firmware;
0013 struct qcom_scm_pas_metadata;
0014 
0015 #if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
0016 
0017 ssize_t qcom_mdt_get_size(const struct firmware *fw);
0018 int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw,
0019               const char *fw_name, int pas_id, phys_addr_t mem_phys,
0020               struct qcom_scm_pas_metadata *pas_metadata_ctx);
0021 int qcom_mdt_load(struct device *dev, const struct firmware *fw,
0022           const char *fw_name, int pas_id, void *mem_region,
0023           phys_addr_t mem_phys, size_t mem_size,
0024           phys_addr_t *reloc_base);
0025 
0026 int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
0027               const char *fw_name, int pas_id, void *mem_region,
0028               phys_addr_t mem_phys, size_t mem_size,
0029               phys_addr_t *reloc_base);
0030 void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len,
0031                  const char *fw_name, struct device *dev);
0032 
0033 #else /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
0034 
0035 static inline ssize_t qcom_mdt_get_size(const struct firmware *fw)
0036 {
0037     return -ENODEV;
0038 }
0039 
0040 static inline int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw,
0041                     const char *fw_name, int pas_id, phys_addr_t mem_phys,
0042                     struct qcom_scm_pas_metadata *pas_metadata_ctx)
0043 {
0044     return -ENODEV;
0045 }
0046 
0047 static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw,
0048                 const char *fw_name, int pas_id,
0049                 void *mem_region, phys_addr_t mem_phys,
0050                 size_t mem_size, phys_addr_t *reloc_base)
0051 {
0052     return -ENODEV;
0053 }
0054 
0055 static inline int qcom_mdt_load_no_init(struct device *dev,
0056                     const struct firmware *fw,
0057                     const char *fw_name, int pas_id,
0058                     void *mem_region, phys_addr_t mem_phys,
0059                     size_t mem_size,
0060                     phys_addr_t *reloc_base)
0061 {
0062     return -ENODEV;
0063 }
0064 
0065 static inline void *qcom_mdt_read_metadata(const struct firmware *fw,
0066                        size_t *data_len, const char *fw_name,
0067                        struct device *dev)
0068 {
0069     return ERR_PTR(-ENODEV);
0070 }
0071 
0072 #endif /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
0073 
0074 #endif