Jonathan Liu has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/35808 )
Change subject: Fix compilation if CONFIG_INTERNAL=no ......................................................................
Fix compilation if CONFIG_INTERNAL=no
Change-Id: Id9e07332003832465a0eccf1d89e73d15abb35c0 Signed-off-by: Jonathan Liu net147@gmail.com --- M libflashrom.c M physmap.c 2 files changed, 12 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/08/35808/1
diff --git a/libflashrom.c b/libflashrom.c index dbc5129..f3e69ff 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -171,18 +171,21 @@ struct flashrom_board_info *flashrom_supported_boards(void) { int boards_known_size = 0; +#if CONFIG_INTERNAL == 1 int i = 0; const struct board_info *binfo = boards_known;
while ((binfo++)->vendor) ++boards_known_size; binfo = boards_known; +#endif /* add place for {0} */ ++boards_known_size;
struct flashrom_board_info *supported_boards = - malloc(boards_known_size * sizeof(*binfo)); + malloc(boards_known_size * sizeof(*supported_boards));
+#if CONFIG_INTERNAL == 1 if (supported_boards != NULL) { for (; i < boards_known_size; ++i) { supported_boards[i].vendor = binfo[i].vendor; @@ -192,6 +195,7 @@ } else { msg_gerr("Memory allocation error!\n"); } +#endif
return supported_boards; } @@ -203,18 +207,21 @@ struct flashrom_chipset_info *flashrom_supported_chipsets(void) { int chipset_enables_size = 0; +#if CONFIG_INTERNAL == 1 int i = 0; const struct penable *chipset = chipset_enables;
while ((chipset++)->vendor_name) ++chipset_enables_size; chipset = chipset_enables; +#endif /* add place for {0}*/ ++chipset_enables_size;
struct flashrom_chipset_info *supported_chipsets = malloc(chipset_enables_size * sizeof(*supported_chipsets));
+#if CONFIG_INTERNAL == 1 if (supported_chipsets != NULL) { for (; i < chipset_enables_size; ++i) { supported_chipsets[i].vendor = chipset[i].vendor_name; @@ -226,6 +233,7 @@ } else { msg_gerr("Memory allocation error!\n"); } +#endif
return supported_chipsets; } diff --git a/physmap.c b/physmap.c index ad38ad3..c6a2076 100644 --- a/physmap.c +++ b/physmap.c @@ -430,6 +430,7 @@ return 0; }
+#if CONFIG_INTERNAL == 1 int setup_cpu_msr(int cpu) { char msrfilename[64]; @@ -464,6 +465,8 @@ /* Clear MSR file descriptor. */ fd_msr = -1; } +#endif + #elif defined(__OpenBSD__) && defined (__i386__) /* This does only work for certain AMD Geode LX systems see amdmsr(4). */ #include <sys/ioctl.h> #include <machine/amdmsr.h>