firmware: move the firmware table out from lib
authorWendy Liang <jliang@xilinx.com>
Mon, 1 Aug 2016 17:58:16 +0000 (10:58 -0700)
committerWendy Liang <jliang@xilinx.com>
Thu, 13 Oct 2016 05:01:45 +0000 (22:01 -0700)
Move the predefined firmware table out from the library.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/common/firmware.c

index d296992a63546b47c95209ca76aaa5652e4a5204..d05a8f9c307470a8bf686881435accc719e3ef4b 100644 (file)
 #include <string.h>
 #include "openamp/firmware.h"
 
-/* Start and end addresses of firmware image for remotes. These are defined in the
- * object files that are obtained by converting the remote ELF Image into object
- * files. These symbols are not used for remotes.
- */
-extern unsigned char _binary_firmware1_start;
-extern unsigned char _binary_firmware1_end;
-
-extern unsigned char _binary_firmware2_start;
-extern unsigned char _binary_firmware2_end;
-
-#define FIRMWARE1_START  (void *)&_binary_firmware1_start
-#define FIRMWARE1_END    (void *)&_binary_firmware1_end
-
-#define FIRMWARE2_START  (void *)&_binary_firmware2_start
-#define FIRMWARE2_END    (void *)&_binary_firmware2_end
-
-/* Init firmware table */
-
-const struct firmware_info fw_table[] = { {"firmware1",
-                                          (unsigned int)FIRMWARE1_START,
-                                          (unsigned int)FIRMWARE1_END},
-{"firmware2", (unsigned int)FIRMWARE2_START,
- (unsigned int)FIRMWARE2_END}
-};
-
 /**
  * config_get_firmware
  *
@@ -83,12 +58,14 @@ const struct firmware_info fw_table[] = { {"firmware1",
  *
  */
 
+extern struct firmware_info fw_table[];
+extern int fw_table_size;
+
 int config_get_firmware(char *fw_name, unsigned int *start_addr,
                        unsigned int *size)
 {
-       unsigned int idx;
-       for (idx = 0; idx < sizeof(fw_table) / (sizeof(struct firmware_info));
-            idx++) {
+       int idx;
+       for (idx = 0; idx < fw_table_size; idx++) {
                if (!strncmp((char *)fw_table[idx].name, fw_name, sizeof(fw_table[idx].name))) {
                        *start_addr = fw_table[idx].start_addr;
                        *size =