.. | .. |
---|
27 | 27 | * firmware file lookup on storage is avoided. Used for calls where the |
---|
28 | 28 | * file may be too big, or where the driver takes charge of its own |
---|
29 | 29 | * firmware caching mechanism. |
---|
30 | | - * @FW_OPT_NOFALLBACK: Disable the fallback mechanism. Takes precedence over |
---|
31 | | - * &FW_OPT_UEVENT and &FW_OPT_USERHELPER. |
---|
| 30 | + * @FW_OPT_NOFALLBACK_SYSFS: Disable the sysfs fallback mechanism. Takes |
---|
| 31 | + * precedence over &FW_OPT_UEVENT and &FW_OPT_USERHELPER. |
---|
| 32 | + * @FW_OPT_FALLBACK_PLATFORM: Enable fallback to device fw copy embedded in |
---|
| 33 | + * the platform's main firmware. If both this fallback and the sysfs |
---|
| 34 | + * fallback are enabled, then this fallback will be tried first. |
---|
| 35 | + * @FW_OPT_PARTIAL: Allow partial read of firmware instead of needing to read |
---|
| 36 | + * entire file. |
---|
32 | 37 | */ |
---|
33 | 38 | enum fw_opt { |
---|
34 | | - FW_OPT_UEVENT = BIT(0), |
---|
35 | | - FW_OPT_NOWAIT = BIT(1), |
---|
36 | | - FW_OPT_USERHELPER = BIT(2), |
---|
37 | | - FW_OPT_NO_WARN = BIT(3), |
---|
38 | | - FW_OPT_NOCACHE = BIT(4), |
---|
39 | | - FW_OPT_NOFALLBACK = BIT(5), |
---|
| 39 | + FW_OPT_UEVENT = BIT(0), |
---|
| 40 | + FW_OPT_NOWAIT = BIT(1), |
---|
| 41 | + FW_OPT_USERHELPER = BIT(2), |
---|
| 42 | + FW_OPT_NO_WARN = BIT(3), |
---|
| 43 | + FW_OPT_NOCACHE = BIT(4), |
---|
| 44 | + FW_OPT_NOFALLBACK_SYSFS = BIT(5), |
---|
| 45 | + FW_OPT_FALLBACK_PLATFORM = BIT(6), |
---|
| 46 | + FW_OPT_PARTIAL = BIT(7), |
---|
40 | 47 | }; |
---|
41 | 48 | |
---|
42 | 49 | enum fw_status { |
---|
.. | .. |
---|
64 | 71 | void *data; |
---|
65 | 72 | size_t size; |
---|
66 | 73 | size_t allocated_size; |
---|
67 | | -#ifdef CONFIG_FW_LOADER_USER_HELPER |
---|
| 74 | + size_t offset; |
---|
| 75 | + u32 opt_flags; |
---|
| 76 | +#ifdef CONFIG_FW_LOADER_PAGED_BUF |
---|
68 | 77 | bool is_paged_buf; |
---|
69 | | - bool need_uevent; |
---|
70 | 78 | struct page **pages; |
---|
71 | 79 | int nr_pages; |
---|
72 | 80 | int page_array_size; |
---|
| 81 | +#endif |
---|
| 82 | +#ifdef CONFIG_FW_LOADER_USER_HELPER |
---|
| 83 | + bool need_uevent; |
---|
73 | 84 | struct list_head pending_list; |
---|
74 | 85 | #endif |
---|
75 | 86 | const char *fw_name; |
---|
.. | .. |
---|
138 | 149 | __fw_state_set(fw_priv, FW_STATUS_DONE); |
---|
139 | 150 | } |
---|
140 | 151 | |
---|
141 | | -int assign_fw(struct firmware *fw, struct device *device, |
---|
142 | | - enum fw_opt opt_flags); |
---|
| 152 | +int assign_fw(struct firmware *fw, struct device *device); |
---|
| 153 | + |
---|
| 154 | +#ifdef CONFIG_FW_LOADER_PAGED_BUF |
---|
| 155 | +void fw_free_paged_buf(struct fw_priv *fw_priv); |
---|
| 156 | +int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); |
---|
| 157 | +int fw_map_paged_buf(struct fw_priv *fw_priv); |
---|
| 158 | +bool fw_is_paged_buf(struct fw_priv *fw_priv); |
---|
| 159 | +#else |
---|
| 160 | +static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {} |
---|
| 161 | +static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; } |
---|
| 162 | +static inline int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; } |
---|
| 163 | +static inline bool fw_is_paged_buf(struct fw_priv *fw_priv) { return false; } |
---|
| 164 | +#endif |
---|
143 | 165 | |
---|
144 | 166 | #endif /* __FIRMWARE_LOADER_H */ |
---|