summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-06-29 15:47:34 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-06-30 18:55:15 +0200
commit1b4d39428eac80bc76713b1f21a2c85e8900c1b8 (patch)
treee2b9dfea6be47c785fa55964950c691643d0a232 /payloads/libpayload/libc
parentde60c8899680f362a908d68efe9e4154ab3380be (diff)
libpayload: Make Kconfig bools use IS_ENABLED()
This will make the code work with the different styles of Kconfig (emit unset bools vs don't emit unset bools) Roughly, the patch does this, and a little bit of fixing up: perl -pi -e 's,ifdef (CONFIG_LP_.+?)\b,if IS_ENABLED\($1\),g' `find . -name *.[ch]` perl -pi -e 's,ifndef (CONFIG_LP_.+?)\b,if !IS_ENABLED\($1\),g' `find . -name *.[ch]` Change-Id: Ib8a839b056a1f806a8597052e1b571ea3d18a79f Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: http://review.coreboot.org/10711 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r--payloads/libpayload/libc/64bit_div.c2
-rw-r--r--payloads/libpayload/libc/console.c12
-rw-r--r--payloads/libpayload/libc/coreboot.c14
-rw-r--r--payloads/libpayload/libc/exec.c4
-rw-r--r--payloads/libpayload/libc/malloc.c18
-rw-r--r--payloads/libpayload/libc/time.c4
6 files changed, 27 insertions, 27 deletions
diff --git a/payloads/libpayload/libc/64bit_div.c b/payloads/libpayload/libc/64bit_div.c
index 615a2d8fdd..877cef26b6 100644
--- a/payloads/libpayload/libc/64bit_div.c
+++ b/payloads/libpayload/libc/64bit_div.c
@@ -30,7 +30,7 @@
#include <libpayload-config.h>
#include <stdlib.h>
-#ifndef CONFIG_LP_LITTLE_ENDIAN
+#if !IS_ENABLED(CONFIG_LP_LITTLE_ENDIAN)
#error this code is for little endian only
#endif
diff --git a/payloads/libpayload/libc/console.c b/payloads/libpayload/libc/console.c
index 7717daf5d1..caeb582945 100644
--- a/payloads/libpayload/libc/console.c
+++ b/payloads/libpayload/libc/console.c
@@ -99,16 +99,16 @@ int console_remove_output_driver(void *function)
void console_init(void)
{
-#ifdef CONFIG_LP_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
video_console_init();
#endif
-#ifdef CONFIG_LP_SERIAL_CONSOLE
+#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
serial_console_init();
#endif
-#ifdef CONFIG_LP_PC_KEYBOARD
+#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
keyboard_init();
#endif
-#ifdef CONFIG_LP_CBMEM_CONSOLE
+#if IS_ENABLED(CONFIG_LP_CBMEM_CONSOLE)
cbmem_console_init();
#endif
}
@@ -144,7 +144,7 @@ int puts(const char *s)
int havekey(void)
{
-#ifdef CONFIG_LP_USB
+#if IS_ENABLED(CONFIG_LP_USB)
usb_poll();
#endif
struct console_input_driver *in;
@@ -161,7 +161,7 @@ int havekey(void)
int getchar(void)
{
while (1) {
-#ifdef CONFIG_LP_USB
+#if IS_ENABLED(CONFIG_LP_USB)
usb_poll();
#endif
struct console_input_driver *in;
diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c
index 43a9f09f1c..8a5d3ae7f4 100644
--- a/payloads/libpayload/libc/coreboot.c
+++ b/payloads/libpayload/libc/coreboot.c
@@ -56,7 +56,7 @@ static void cb_parse_memory(void *ptr, struct sysinfo_t *info)
for (i = 0; i < count; i++) {
struct cb_memory_range *range = MEM_RANGE_PTR(mem, i);
-#ifdef CONFIG_LP_MEMMAP_RAM_ONLY
+#if IS_ENABLED(CONFIG_LP_MEMMAP_RAM_ONLY)
if (range->type != CB_MEM_RAM)
continue;
#endif
@@ -78,7 +78,7 @@ static void cb_parse_serial(void *ptr, struct sysinfo_t *info)
info->serial = ((struct cb_serial *)ptr);
}
-#ifdef CONFIG_LP_CHROMEOS
+#if IS_ENABLED(CONFIG_LP_CHROMEOS)
static void cb_parse_vboot_handoff(unsigned char *ptr, struct sysinfo_t *info)
{
struct lb_range *vbho = (struct lb_range *)ptr;
@@ -160,7 +160,7 @@ static void cb_parse_ram_code(unsigned char *ptr, struct sysinfo_t *info)
info->ram_code = ram_code->ram_code;
}
-#ifdef CONFIG_LP_NVRAM
+#if IS_ENABLED(CONFIG_LP_NVRAM)
static void cb_parse_optiontable(void *ptr, struct sysinfo_t *info)
{
/* ptr points to a coreboot table entry and is already virtual */
@@ -176,7 +176,7 @@ static void cb_parse_checksum(void *ptr, struct sysinfo_t *info)
}
#endif
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
static void cb_parse_framebuffer(void *ptr, struct sysinfo_t *info)
{
/* ptr points to a coreboot table entry and is already virtual */
@@ -307,7 +307,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
case CB_TAG_ASSEMBLER:
cb_parse_string(ptr, &info->assembler);
break;
-#ifdef CONFIG_LP_NVRAM
+#if IS_ENABLED(CONFIG_LP_NVRAM)
case CB_TAG_CMOS_OPTION_TABLE:
cb_parse_optiontable(ptr, info);
break;
@@ -315,7 +315,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
cb_parse_checksum(ptr, info);
break;
#endif
-#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
+#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
// FIXME we should warn on serial if coreboot set up a
// framebuffer buf the payload does not know about it.
case CB_TAG_FRAMEBUFFER:
@@ -325,7 +325,7 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info)
case CB_TAG_MAINBOARD:
info->mainboard = (struct cb_mainboard *)ptr;
break;
-#ifdef CONFIG_LP_CHROMEOS
+#if IS_ENABLED(CONFIG_LP_CHROMEOS)
case CB_TAG_GPIO:
cb_parse_gpios(ptr, info);
break;
diff --git a/payloads/libpayload/libc/exec.c b/payloads/libpayload/libc/exec.c
index 4360bd595c..d48d2132de 100644
--- a/payloads/libpayload/libc/exec.c
+++ b/payloads/libpayload/libc/exec.c
@@ -30,7 +30,7 @@
#include <libpayload-config.h>
#include <libpayload.h>
-#ifdef CONFIG_LP_ARCH_X86
+#if IS_ENABLED(CONFIG_LP_ARCH_X86)
extern void i386_do_exec(long addr, int argc, char **argv, int *ret);
#endif
@@ -46,7 +46,7 @@ int exec(long addr, int argc, char **argv)
{
int val = -1;
-#ifdef CONFIG_LP_ARCH_X86
+#if IS_ENABLED(CONFIG_LP_ARCH_X86)
i386_do_exec(addr, argc, argv, &val);
#endif
return val;
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c
index 3c35793bc5..7099e47ed4 100644
--- a/payloads/libpayload/libc/malloc.c
+++ b/payloads/libpayload/libc/malloc.c
@@ -47,7 +47,7 @@ struct memory_type {
void *start;
void *end;
struct align_region_t* align_regions;
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
int magic_initialized;
size_t minimal_free;
const char *name;
@@ -58,7 +58,7 @@ extern char _heap, _eheap; /* Defined in the ldscript. */
static struct memory_type default_type =
{ (void *)&_heap, (void *)&_eheap, NULL
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
, 0, 0, "HEAP"
#endif
};
@@ -104,7 +104,7 @@ void init_dma_memory(void *start, u32 size)
dma->end = start + size;
dma->align_regions = NULL;
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
dma->minimal_free = 0;
dma->magic_initialized = 0;
dma->name = "DMA";
@@ -139,7 +139,7 @@ static void *alloc(int len, struct memory_type *type)
if (!HAS_MAGIC(*ptr)) {
size_t size = (type->end - type->start) - HDRSIZE;
*ptr = FREE_BLOCK(size);
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
type->magic_initialized = 1;
type->minimal_free = size;
#endif
@@ -356,7 +356,7 @@ static struct align_region_t *allocate_region(int alignment, int num_elements,
struct align_region_t *r;
size_t extra_space;
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
printf("%s(old align_regions=%p, alignment=%u, num_elements=%u, size=%zu)\n",
__func__, type->align_regions, alignment, num_elements, size);
#endif
@@ -479,7 +479,7 @@ look_further:
{
if ((reg->alignment == align) && (reg->free >= (size + align - 1)/align))
{
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
printf(" found memalign region. %x free, %x required\n", reg->free, (size + align - 1)/align);
#endif
break;
@@ -488,12 +488,12 @@ look_further:
}
if (reg == 0)
{
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
printf(" need to allocate a new memalign region\n");
#endif
/* get align regions */
reg = allocate_region(align, large_request/align, size, type);
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
printf(" ... returned %p\n", reg);
#endif
}
@@ -539,7 +539,7 @@ void *dma_memalign(size_t align, size_t size)
}
/* This is for debugging purposes. */
-#ifdef CONFIG_LP_DEBUG_MALLOC
+#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC)
void print_malloc_map(void)
{
struct memory_type *type = heap;
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c
index 8d07c4f172..4109eab7d7 100644
--- a/payloads/libpayload/libc/time.c
+++ b/payloads/libpayload/libc/time.c
@@ -34,7 +34,7 @@
#include <libpayload-config.h>
#include <libpayload.h>
-#ifdef CONFIG_LP_ARCH_X86
+#if IS_ENABLED(CONFIG_LP_ARCH_X86)
#include <arch/rdtsc.h>
#endif
@@ -70,7 +70,7 @@ static void update_clock(void)
}
}
-#ifdef CONFIG_LP_NVRAM
+#if IS_ENABLED(CONFIG_LP_NVRAM)
static unsigned int day_of_year(int mon, int day, int year)
{