diff options
author | David Woodhouse <dwmw2@infradead.org> | 2008-05-23 08:52:42 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2008-07-10 09:30:13 -0400 |
commit | 5658c769443d543728b6c5c673dffc2df8676317 (patch) | |
tree | 539477c713c5d231fd3112e4bd8ae8aff4acefa7 /include | |
parent | b7a39bd0afc4021e8ad2b1189e884551e147427f (diff) |
firmware: allow firmware files to be built into kernel image
Some drivers have their own hacks to bypass the kernel's firmware loader
and build their firmware into the kernel; this renders those unnecessary.
Other drivers don't use the firmware loader at all, because they always
want the firmware to be available. This allows them to start using the
firmware loader.
A third set of drivers already use the firmware loader, but can't be
used without help from userspace, which sometimes requires an initrd.
This allows them to work in a static kernel.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 7 | ||||
-rw-r--r-- | include/linux/firmware.h | 21 |
2 files changed, 28 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f054778e916c..8d71a40625f3 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -86,6 +86,13 @@ | |||
86 | VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ | 86 | VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ |
87 | } \ | 87 | } \ |
88 | \ | 88 | \ |
89 | /* Built-in firmware blobs */ \ | ||
90 | .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ | ||
91 | VMLINUX_SYMBOL(__start_builtin_fw) = .; \ | ||
92 | *(.builtin_fw) \ | ||
93 | VMLINUX_SYMBOL(__end_builtin_fw) = .; \ | ||
94 | } \ | ||
95 | \ | ||
89 | /* RapidIO route ops */ \ | 96 | /* RapidIO route ops */ \ |
90 | .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \ | 97 | .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \ |
91 | VMLINUX_SYMBOL(__start_rio_route_ops) = .; \ | 98 | VMLINUX_SYMBOL(__start_rio_route_ops) = .; \ |
diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 88718d60153c..c8ecf5b2a207 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h | |||
@@ -1,7 +1,10 @@ | |||
1 | #ifndef _LINUX_FIRMWARE_H | 1 | #ifndef _LINUX_FIRMWARE_H |
2 | #define _LINUX_FIRMWARE_H | 2 | #define _LINUX_FIRMWARE_H |
3 | |||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/compiler.h> | ||
7 | |||
5 | #define FIRMWARE_NAME_MAX 30 | 8 | #define FIRMWARE_NAME_MAX 30 |
6 | #define FW_ACTION_NOHOTPLUG 0 | 9 | #define FW_ACTION_NOHOTPLUG 0 |
7 | #define FW_ACTION_HOTPLUG 1 | 10 | #define FW_ACTION_HOTPLUG 1 |
@@ -13,6 +16,24 @@ struct firmware { | |||
13 | 16 | ||
14 | struct device; | 17 | struct device; |
15 | 18 | ||
19 | struct builtin_fw { | ||
20 | char *name; | ||
21 | void *data; | ||
22 | unsigned long size; | ||
23 | }; | ||
24 | |||
25 | /* We have to play tricks here much like stringify() to get the | ||
26 | __COUNTER__ macro to be expanded as we want it */ | ||
27 | #define __fw_concat1(x, y) x##y | ||
28 | #define __fw_concat(x, y) __fw_concat1(x, y) | ||
29 | |||
30 | #define DECLARE_BUILTIN_FIRMWARE(name, blob) \ | ||
31 | DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob)) | ||
32 | |||
33 | #define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size) \ | ||
34 | static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \ | ||
35 | __used __section(.builtin_fw) = { name, blob, size } | ||
36 | |||
16 | #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) | 37 | #if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE)) |
17 | int request_firmware(const struct firmware **fw, const char *name, | 38 | int request_firmware(const struct firmware **fw, const char *name, |
18 | struct device *device); | 39 | struct device *device); |