summaryrefslogtreecommitdiff
path: root/libdde-linux26/include/linux/firmware.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-27 22:15:01 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-07-27 22:15:01 +0000
commit7996a3d79d55b7f879dfd62e202bbfe2963718d3 (patch)
tree8d9f6759fec4099b9be503c11c7ed174f7204980 /libdde-linux26/include/linux/firmware.h
parent4fbe7358c7747a9165f776eb19addbb9baf7def2 (diff)
really properly move files
Diffstat (limited to 'libdde-linux26/include/linux/firmware.h')
-rw-r--r--libdde-linux26/include/linux/firmware.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/libdde-linux26/include/linux/firmware.h b/libdde-linux26/include/linux/firmware.h
new file mode 100644
index 00000000..06e7a1ce
--- /dev/null
+++ b/libdde-linux26/include/linux/firmware.h
@@ -0,0 +1,75 @@
+#ifndef _LINUX_FIRMWARE_H
+#define _LINUX_FIRMWARE_H
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+
+#define FIRMWARE_NAME_MAX 30
+#define FW_ACTION_NOHOTPLUG 0
+#define FW_ACTION_HOTPLUG 1
+
+struct firmware {
+ size_t size;
+ const u8 *data;
+};
+
+struct device;
+
+struct builtin_fw {
+ char *name;
+ void *data;
+ unsigned long size;
+};
+
+/* We have to play tricks here much like stringify() to get the
+ __COUNTER__ macro to be expanded as we want it */
+#define __fw_concat1(x, y) x##y
+#define __fw_concat(x, y) __fw_concat1(x, y)
+
+#define DECLARE_BUILTIN_FIRMWARE(name, blob) \
+ DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
+
+#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \
+ static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
+ __used __section(.builtin_fw) = { name, blob, size }
+
+#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
+int request_firmware(const struct firmware **fw, const char *name,
+ struct device *device);
+int request_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context));
+
+void release_firmware(const struct firmware *fw);
+#else
+#ifdef DDE_LINUX
+#include <ddekit/printf.h>
+#endif
+static inline int request_firmware(const struct firmware **fw,
+ const char *name,
+ struct device *device)
+{
+#ifdef DDE_LINUX
+ ddekit_printf("firmware %s requested, but not implemented\n", name);
+#endif
+ return -EINVAL;
+}
+static inline int request_firmware_nowait(
+ struct module *module, int uevent,
+ const char *name, struct device *device, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+#ifdef DDE_LINUX
+ ddekit_printf("firmware %s requested, but not implemented\n", name);
+#endif
+ return -EINVAL;
+}
+
+static inline void release_firmware(const struct firmware *fw)
+{
+}
+#endif
+
+#endif