@@ -31,6 +31,7 @@
#include <linux/cpu.h>
#include <linux/fs.h>
#include <linux/mm.h>
+#include <linux/tables.h>
#include <asm/microcode_intel.h>
#include <asm/cpu_device_id.h>
@@ -91,15 +92,14 @@ static bool __init check_loader_disabled_bsp(void)
return *res;
}
-extern struct builtin_fw __start_builtin_fw[];
-extern struct builtin_fw __end_builtin_fw[];
+DECLARE_LINKTABLE_RO(struct builtin_fw, builtin_fw);
bool get_builtin_firmware(struct cpio_data *cd, const char *name)
{
#ifdef CONFIG_FW_LOADER
- struct builtin_fw *b_fw;
+ const struct builtin_fw *b_fw;
- for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
+ LINKTABLE_FOR_EACH(b_fw, builtin_fw) {
if (!strcmp(name, b_fw->name)) {
cd->size = b_fw->size;
cd->data = b_fw->data;
@@ -30,6 +30,7 @@
#include <linux/syscore_ops.h>
#include <linux/reboot.h>
#include <linux/security.h>
+#include <linux/tables.h>
#include <generated/utsrelease.h>
@@ -43,15 +44,14 @@ MODULE_LICENSE("GPL");
#ifdef CONFIG_FW_LOADER
-extern struct builtin_fw __start_builtin_fw[];
-extern struct builtin_fw __end_builtin_fw[];
+DEFINE_LINKTABLE_RO(struct builtin_fw, builtin_fw);
static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
void *buf, size_t size)
{
- struct builtin_fw *b_fw;
+ const struct builtin_fw *b_fw;
- for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
+ LINKTABLE_FOR_EACH(b_fw, builtin_fw) {
if (strcmp(name, b_fw->name) == 0) {
fw->size = b_fw->size;
fw->data = b_fw->data;
@@ -67,9 +67,9 @@ static bool fw_get_builtin_firmware(struct firmware *fw, const char *name,
static bool fw_is_builtin_firmware(const struct firmware *fw)
{
- struct builtin_fw *b_fw;
+ const struct builtin_fw *b_fw;
- for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++)
+ LINKTABLE_FOR_EACH(b_fw, builtin_fw)
if (fw->data == b_fw->data)
return true;
@@ -155,6 +155,7 @@ quiet_cmd_fwbin = MK_FW $@
ASM_ALIGN=$(if $(CONFIG_64BIT),3,2); \
PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \
echo "/* Generated by firmware/Makefile */" > $@;\
+ echo "\#include <asm/tables.h>" >>$@;\
echo " .section .rodata" >>$@;\
echo " .p2align $${ASM_ALIGN}" >>$@;\
echo "_fw_$${FWSTR}_bin:" >>$@;\
@@ -164,7 +165,7 @@ quiet_cmd_fwbin = MK_FW $@
echo " .p2align $${ASM_ALIGN}" >>$@;\
echo "_fw_$${FWSTR}_name:" >>$@;\
echo " .string \"$$FWNAME\"" >>$@;\
- echo " .section .builtin_fw,\"a\",$${PROGBITS}" >>$@;\
+ echo " set_section_tbl_type(SECTION_TBL_RO, builtin_fw, SECTION_ORDER_ANY, a,$${PROGBITS})" >>$@;\
echo " .p2align $${ASM_ALIGN}" >>$@;\
echo " $${ASM_WORD} _fw_$${FWSTR}_name" >>$@;\
echo " $${ASM_WORD} _fw_$${FWSTR}_bin" >>$@;\
@@ -316,13 +316,6 @@
VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
} \
\
- /* Built-in firmware blobs */ \
- .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
- VMLINUX_SYMBOL(__start_builtin_fw) = .; \
- *(.builtin_fw) \
- VMLINUX_SYMBOL(__end_builtin_fw) = .; \
- } \
- \
TRACEDATA \
\
/* Kernel symbol table: Normal symbols */ \