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>
This commit is contained in:
parent
de60c88996
commit
1b4d39428e
@ -55,7 +55,8 @@ subdirs-$(CONFIG_LP_CURSES) += curses
|
||||
subdirs-$(CONFIG_LP_CBFS) += libcbfs
|
||||
subdirs-$(CONFIG_LP_LZMA) += liblzma
|
||||
|
||||
INCLUDES := -Iinclude -Iinclude/$(ARCHDIR-y) -I$(obj)
|
||||
INCLUDES := -Iinclude -Iinclude/$(ARCHDIR-y) -I$(obj) -include include/kconfig.h
|
||||
|
||||
CFLAGS = $(EXTRA_CFLAGS) $(INCLUDES) -Os -pipe -nostdinc -ggdb3
|
||||
CFLAGS += -nostdlib -fno-builtin -ffreestanding -fomit-frame-pointer
|
||||
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
@ -48,7 +48,7 @@ void start_main(void)
|
||||
lib_get_sysinfo();
|
||||
|
||||
/* Optionally set up the consoles. */
|
||||
#ifndef CONFIG_LP_SKIP_CONSOLE_INIT
|
||||
#if !IS_ENABLED(CONFIG_LP_SKIP_CONSOLE_INIT)
|
||||
console_init();
|
||||
#endif
|
||||
|
||||
|
@ -123,7 +123,7 @@ void start_main(void)
|
||||
|
||||
post_sysinfo_scan_mmu_setup();
|
||||
|
||||
#ifndef CONFIG_LP_SKIP_CONSOLE_INIT
|
||||
#if !IS_ENABLED(CONFIG_LP_SKIP_CONSOLE_INIT)
|
||||
console_init();
|
||||
#endif
|
||||
|
||||
|
@ -38,7 +38,7 @@ void start_main(void)
|
||||
lib_get_sysinfo();
|
||||
|
||||
/* Optionally set up the consoles. */
|
||||
#ifndef CONFIG_LP_SKIP_CONSOLE_INIT
|
||||
#if !IS_ENABLED(CONFIG_LP_SKIP_CONSOLE_INIT)
|
||||
console_init();
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,7 @@ void start_main(void)
|
||||
lib_get_sysinfo();
|
||||
|
||||
/* Optionally set up the consoles. */
|
||||
#ifndef CONFIG_LP_SKIP_CONSOLE_INIT
|
||||
#if !IS_ENABLED(CONFIG_LP_SKIP_CONSOLE_INIT)
|
||||
console_init();
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,7 @@ static void mb_parse_mmap(struct multiboot_header *table,
|
||||
while(ptr < (start + table->mmap_length)) {
|
||||
struct multiboot_mmap *mmap = (struct multiboot_mmap *) ptr;
|
||||
|
||||
#ifdef CONFIG_LP_MEMMAP_RAM_ONLY
|
||||
#if IS_ENABLED(CONFIG_LP_MEMMAP_RAM_ONLY)
|
||||
/* 1 == normal RAM. Ignore everything else for now */
|
||||
|
||||
if (mmap->type == 1) {
|
||||
@ -56,7 +56,7 @@ static void mb_parse_mmap(struct multiboot_header *table,
|
||||
|
||||
if (++info->n_memranges == SYSINFO_MAX_MEM_RANGES)
|
||||
return;
|
||||
#ifdef CONFIG_LP_MEMMAP_RAM_ONLY
|
||||
#if IS_ENABLED(CONFIG_LP_MEMMAP_RAM_ONLY)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -83,7 +83,7 @@ int init_x86rom_cbfs_media(struct cbfs_media *media) {
|
||||
struct cbfs_header *header = (struct cbfs_header*)
|
||||
*(uint32_t*)(0xfffffffc);
|
||||
if (CBFS_HEADER_MAGIC != ntohl(header->magic)) {
|
||||
#if defined(CONFIG_LP_ROM_SIZE)
|
||||
#if IS_ENABLED(CONFIG_LP_ROM_SIZE)
|
||||
printk(BIOS_ERR, "Invalid CBFS master header at %p\n", header);
|
||||
media->context = (void*)CONFIG_LP_ROM_SIZE;
|
||||
#else
|
||||
@ -92,7 +92,7 @@ int init_x86rom_cbfs_media(struct cbfs_media *media) {
|
||||
} else {
|
||||
uint32_t romsize = ntohl(header->romsize);
|
||||
media->context = (void*)romsize;
|
||||
#if defined(CONFIG_LP_ROM_SIZE)
|
||||
#if IS_ENABLED(CONFIG_LP_ROM_SIZE)
|
||||
if (CONFIG_LP_ROM_SIZE != romsize)
|
||||
printk(BIOS_INFO, "Warning: rom size unmatch (%d/%d)\n",
|
||||
CONFIG_LP_ROM_SIZE, romsize);
|
||||
|
@ -38,7 +38,7 @@
|
||||
*/
|
||||
struct sysinfo_t lib_sysinfo = {
|
||||
.cpu_khz = 200,
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
.ser_ioport = CONFIG_LP_SERIAL_IOBASE,
|
||||
#else
|
||||
.ser_ioport = 0x3f8,
|
||||
@ -52,7 +52,7 @@ int lib_get_sysinfo(void)
|
||||
/* Get the CPU speed (for delays). */
|
||||
lib_sysinfo.cpu_khz = get_cpu_speed();
|
||||
|
||||
#ifdef CONFIG_LP_MULTIBOOT
|
||||
#if IS_ENABLED(CONFIG_LP_MULTIBOOT)
|
||||
/* Get the information from the multiboot tables,
|
||||
* if they exist */
|
||||
get_multiboot_info(&lib_sysinfo);
|
||||
|
@ -30,7 +30,7 @@ typedef unsigned int u_int;
|
||||
|
||||
/* Moved from libpayload.h */
|
||||
|
||||
#ifdef CONFIG_LP_LITTLE_ENDIAN
|
||||
#if IS_ENABLED(CONFIG_LP_LITTLE_ENDIAN)
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
|
@ -45,7 +45,7 @@ static int _halfdelay = 0;
|
||||
|
||||
/* ============== Serial ==================== */
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
/* We treat serial like a vt100 terminal. For now we
|
||||
do the cooking in here, but we should probably eventually
|
||||
pass it to dedicated vt100 code */
|
||||
@ -146,12 +146,13 @@ static int cook_serial(unsigned char ch)
|
||||
|
||||
static int curses_getchar(int _delay)
|
||||
{
|
||||
#if defined(CONFIG_LP_USB_HID) || defined(CONFIG_LP_PC_KEYBOARD) || defined(CONFIG_LP_SERIAL_CONSOLE)
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HID) || IS_ENABLED(CONFIG_LP_PC_KEYBOARD) || \
|
||||
IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
unsigned short c;
|
||||
#endif
|
||||
|
||||
do {
|
||||
#ifdef CONFIG_LP_USB_HID
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HID)
|
||||
usb_poll();
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
usbhid_havechar()) {
|
||||
@ -159,7 +160,7 @@ static int curses_getchar(int _delay)
|
||||
if (c != 0) return c;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_PC_KEYBOARD
|
||||
#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
keyboard_havechar()) {
|
||||
c = keyboard_getchar();
|
||||
@ -167,7 +168,7 @@ static int curses_getchar(int _delay)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if ((curses_flags & F_ENABLE_SERIAL) &&
|
||||
serial_havechar()) {
|
||||
c = serial_getchar();
|
||||
@ -225,7 +226,7 @@ int nocbreak(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
|
||||
void curses_enable_vga(int state)
|
||||
{
|
||||
if (state)
|
||||
@ -243,7 +244,7 @@ void curses_enable_vga(int state) { }
|
||||
int curses_vga_enabled(void) { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
void curses_enable_serial(int state)
|
||||
{
|
||||
if (state)
|
||||
|
@ -70,13 +70,13 @@
|
||||
|
||||
/* Flags used to determine what output methods are available */
|
||||
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
#define F_ENABLE_CONSOLE 0x01
|
||||
#else
|
||||
#define F_ENABLE_CONSOLE 0x00
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
#define F_ENABLE_SERIAL 0x02
|
||||
#else
|
||||
#define F_ENABLE_SERIAL 0x00
|
||||
|
@ -66,8 +66,8 @@ chtype fallback_acs_map[128] =
|
||||
'|', '<', '>', '*', '!', 'f', 'o', ' ',
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#ifdef CONFIG_LP_SERIAL_ACS_FALLBACK
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_ACS_FALLBACK)
|
||||
chtype serial_acs_map[128];
|
||||
#else
|
||||
/* See acsc of vt100. */
|
||||
@ -93,7 +93,7 @@ chtype serial_acs_map[128] =
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
/* See acsc of linux. */
|
||||
chtype console_acs_map[128] =
|
||||
{
|
||||
@ -122,10 +122,10 @@ void PDC_gotoyx(int row, int col)
|
||||
{
|
||||
PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
serial_set_cursor(col, row);
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
video_console_set_cursor(col, row);
|
||||
#endif
|
||||
}
|
||||
@ -139,7 +139,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
|
||||
|
||||
PDC_LOG(("PDC_transform_line() - called: line %d, len %d, curses_flags %d\n", lineno, len, curses_flags));
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
int serial_is_bold = 0;
|
||||
int serial_is_reverse = 0;
|
||||
int serial_is_altcharset = 0;
|
||||
@ -157,7 +157,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
|
||||
{
|
||||
ch = srcp[j];
|
||||
attr = ch;
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL) {
|
||||
if (attr & A_BOLD) {
|
||||
if (!serial_is_bold) {
|
||||
@ -222,7 +222,7 @@ void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
unsigned char c = pdc_atrtab[srcp[j] >> PDC_ATTR_SHIFT];
|
||||
|
||||
if (curses_flags & F_ENABLE_CONSOLE) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
unsigned long pdc_key_modifiers = 0L;
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
/* We treat serial like a vt100 terminal. For now we
|
||||
do the cooking in here, but we should probably eventually
|
||||
pass it to dedicated vt100 code */
|
||||
@ -108,7 +108,7 @@ void PDC_set_keyboard_binary(bool on)
|
||||
|
||||
bool PDC_check_key(void)
|
||||
{
|
||||
#ifdef CONFIG_LP_USB_HID
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HID)
|
||||
usb_poll();
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
usbhid_havechar()) {
|
||||
@ -116,14 +116,14 @@ bool PDC_check_key(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_PC_KEYBOARD
|
||||
#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
keyboard_havechar()) {
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if ((curses_flags & F_ENABLE_SERIAL) &&
|
||||
serial_havechar()) {
|
||||
return TRUE;
|
||||
@ -139,7 +139,7 @@ int PDC_get_key(void)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
#ifdef CONFIG_LP_USB_HID
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HID)
|
||||
usb_poll();
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
usbhid_havechar()) {
|
||||
@ -147,14 +147,14 @@ int PDC_get_key(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_PC_KEYBOARD
|
||||
#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD)
|
||||
if ((curses_flags & F_ENABLE_CONSOLE) &&
|
||||
keyboard_havechar() && (c==0)) {
|
||||
c = keyboard_getchar();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if ((curses_flags & F_ENABLE_SERIAL) &&
|
||||
serial_havechar() && (c==0)) {
|
||||
c = cook_serial(serial_getchar());
|
||||
|
@ -72,7 +72,7 @@ int PDC_scr_open(int argc, char **argv)
|
||||
SP->lines = PDC_get_rows();
|
||||
SP->cols = PDC_get_columns();
|
||||
|
||||
#ifdef CONFIG_LP_SPEAKER
|
||||
#if IS_ENABLED(CONFIG_LP_SPEAKER)
|
||||
SP->audible = TRUE;
|
||||
#endif
|
||||
|
||||
|
@ -13,12 +13,12 @@ int PDC_curs_set(int visibility)
|
||||
ret_vis = SP->visibility;
|
||||
SP->visibility = visibility;
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL) {
|
||||
serial_cursor_enable(visibility);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_CONSOLE) {
|
||||
video_console_cursor_enable(visibility);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ void PDC_beep(void)
|
||||
{
|
||||
PDC_LOG(("PDC_beep() - called\n"));
|
||||
|
||||
#ifdef CONFIG_LP_SPEAKER
|
||||
#if IS_ENABLED(CONFIG_LP_SPEAKER)
|
||||
speaker_tone(1760, 500); /* 1760 == note A6 */
|
||||
#endif
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ chtype fallback_acs_map[128] =
|
||||
'|', '<', '>', '*', '!', 'f', 'o', ' ',
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#ifdef CONFIG_LP_SERIAL_ACS_FALLBACK
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_ACS_FALLBACK)
|
||||
chtype serial_acs_map[128];
|
||||
#else
|
||||
/* See acsc of vt100. */
|
||||
@ -138,7 +138,7 @@ chtype serial_acs_map[128] =
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
/* See acsc of linux. */
|
||||
chtype console_acs_map[128] =
|
||||
{
|
||||
@ -191,7 +191,7 @@ NCURSES_CH_T _nc_render(WINDOW *win, NCURSES_CH_T ch)
|
||||
int beep(void)
|
||||
{
|
||||
/* TODO: Flash the screen if beeping fails? */
|
||||
#ifdef CONFIG_LP_SPEAKER
|
||||
#if IS_ENABLED(CONFIG_LP_SPEAKER)
|
||||
speaker_tone(1760, 500); /* 1760 == note A6 */
|
||||
#endif
|
||||
return OK;
|
||||
@ -202,12 +202,12 @@ int cbreak(void) { /* TODO */ return 0; }
|
||||
// int color_content(short color, short *r, short *g, short *b) {}
|
||||
int curs_set(int on)
|
||||
{
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL) {
|
||||
serial_cursor_enable(on);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_CONSOLE) {
|
||||
video_console_cursor_enable(on);
|
||||
}
|
||||
@ -315,12 +315,12 @@ WINDOW *initscr(void)
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
acs_map[i] = (chtype) i | A_ALTCHARSET;
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL) {
|
||||
serial_clear();
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_CONSOLE) {
|
||||
/* Clear the screen and kill the cursor */
|
||||
|
||||
@ -719,7 +719,7 @@ int whline(WINDOW *win, chtype ch, int n)
|
||||
(((c) & 0x4400) >> 2) | ((c) & 0xAA00) | (((c) & 0x1100) << 2)
|
||||
int wnoutrefresh(WINDOW *win)
|
||||
{
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
// FIXME.
|
||||
int serial_is_bold = 0;
|
||||
int serial_is_reverse = 0;
|
||||
@ -732,7 +732,7 @@ int wnoutrefresh(WINDOW *win)
|
||||
int x, y;
|
||||
chtype ch;
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
serial_end_bold();
|
||||
serial_end_altcharset();
|
||||
#endif
|
||||
@ -744,7 +744,7 @@ int wnoutrefresh(WINDOW *win)
|
||||
|
||||
/* Position the serial cursor */
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL)
|
||||
serial_set_cursor(win->_begy + y, win->_begx +
|
||||
win->_line[y].firstchar);
|
||||
@ -753,7 +753,7 @@ int wnoutrefresh(WINDOW *win)
|
||||
for (x = win->_line[y].firstchar; x <= win->_line[y].lastchar; x++) {
|
||||
attr_t attr = win->_line[y].text[x].attr;
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL) {
|
||||
ch = win->_line[y].text[x].chars[0];
|
||||
|
||||
@ -819,7 +819,7 @@ int wnoutrefresh(WINDOW *win)
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
unsigned int c =
|
||||
((int)color_pairs[PAIR_NUMBER(attr)]) << 8;
|
||||
|
||||
@ -860,12 +860,12 @@ int wnoutrefresh(WINDOW *win)
|
||||
win->_line[y].lastchar = _NOCHANGE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_SERIAL)
|
||||
serial_set_cursor(win->_begy + win->_cury, win->_begx + win->_curx);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VIDEO_CONSOLE)
|
||||
if (curses_flags & F_ENABLE_CONSOLE)
|
||||
video_console_set_cursor(win->_begx + win->_curx, win->_begy + win->_cury);
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@ struct layout_maps {
|
||||
static struct layout_maps *map;
|
||||
|
||||
static struct layout_maps keyboard_layouts[] = {
|
||||
#ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_US
|
||||
#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_US)
|
||||
{ .country = "us", .map = {
|
||||
{ /* No modifier */
|
||||
0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
|
||||
@ -97,7 +97,7 @@ static struct layout_maps keyboard_layouts[] = {
|
||||
}
|
||||
}},
|
||||
#endif
|
||||
#ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_DE
|
||||
#if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_DE)
|
||||
{ .country = "de", .map = {
|
||||
{ /* No modifier */
|
||||
0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
|
||||
|
@ -60,7 +60,7 @@
|
||||
* doesn't try to do this on its own.
|
||||
*/
|
||||
#define RTC_PORT_STANDARD 0x70
|
||||
#ifdef CONFIG_LP_RTC_PORT_EXTENDED_VIA
|
||||
#if IS_ENABLED(CONFIG_LP_RTC_PORT_EXTENDED_VIA)
|
||||
#define RTC_PORT_EXTENDED 0x74
|
||||
#else
|
||||
#define RTC_PORT_EXTENDED 0x72
|
||||
|
@ -39,7 +39,7 @@ static int serial_is_mem_mapped = 0;
|
||||
|
||||
static uint8_t serial_read_reg(int offset)
|
||||
{
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if (!serial_is_mem_mapped)
|
||||
return inb(IOBASE + offset);
|
||||
else
|
||||
@ -49,7 +49,7 @@ static uint8_t serial_read_reg(int offset)
|
||||
|
||||
static void serial_write_reg(uint8_t val, int offset)
|
||||
{
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if (!serial_is_mem_mapped)
|
||||
outb(val, IOBASE + offset);
|
||||
else
|
||||
@ -57,7 +57,7 @@ static void serial_write_reg(uint8_t val, int offset)
|
||||
writeb(val, MEMBASE + offset);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_SET_SPEED
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
|
||||
static void serial_hardware_init(int speed, int word_bits,
|
||||
int parity, int stop_bits)
|
||||
{
|
||||
@ -104,7 +104,7 @@ void serial_init(void)
|
||||
(lib_sysinfo.serial->type == CB_SERIAL_TYPE_MEMORY_MAPPED);
|
||||
|
||||
if (!serial_is_mem_mapped) {
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if ((inb(IOBASE + 0x05) == 0xFF) &&
|
||||
(inb(IOBASE + 0x06) == 0xFF)) {
|
||||
return;
|
||||
@ -118,7 +118,7 @@ void serial_init(void)
|
||||
|
||||
serial_hardware_is_present = 1;
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_SET_SPEED
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
|
||||
serial_hardware_init(CONFIG_LP_SERIAL_BAUD_RATE, 8, 0, 1);
|
||||
#endif
|
||||
}
|
||||
@ -138,7 +138,7 @@ void serial_putchar(unsigned int c)
|
||||
{
|
||||
if (!serial_hardware_is_present)
|
||||
return;
|
||||
#ifndef CONFIG_LP_PL011_SERIAL_CONSOLE
|
||||
#if !IS_ENABLED(CONFIG_LP_PL011_SERIAL_CONSOLE)
|
||||
while ((serial_read_reg(0x05) & 0x20) == 0) ;
|
||||
#endif
|
||||
serial_write_reg(c, 0x00);
|
||||
|
@ -41,7 +41,7 @@ static uint8_t serial_read_reg(int offset)
|
||||
{
|
||||
offset *= lib_sysinfo.serial->regwidth;
|
||||
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if (!serial_is_mem_mapped)
|
||||
return inb(IOBASE + offset);
|
||||
else
|
||||
@ -53,7 +53,7 @@ static void serial_write_reg(uint8_t val, int offset)
|
||||
{
|
||||
offset *= lib_sysinfo.serial->regwidth;
|
||||
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if (!serial_is_mem_mapped)
|
||||
outb(val, IOBASE + offset);
|
||||
else
|
||||
@ -61,7 +61,7 @@ static void serial_write_reg(uint8_t val, int offset)
|
||||
writeb(val, MEMBASE + offset);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_SET_SPEED
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
|
||||
static void serial_hardware_init(int speed, int word_bits,
|
||||
int parity, int stop_bits)
|
||||
{
|
||||
@ -106,7 +106,7 @@ void serial_init(void)
|
||||
(lib_sysinfo.serial->type == CB_SERIAL_TYPE_MEMORY_MAPPED);
|
||||
|
||||
if (!serial_is_mem_mapped) {
|
||||
#ifdef CONFIG_LP_IO_ADDRESS_SPACE
|
||||
#if IS_ENABLED(CONFIG_LP_IO_ADDRESS_SPACE)
|
||||
if ((inb(IOBASE + 0x05) == 0xFF) &&
|
||||
(inb(IOBASE + 0x06) == 0xFF)) {
|
||||
printf("IO space mapped serial not present.");
|
||||
@ -118,7 +118,7 @@ void serial_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_SERIAL_SET_SPEED
|
||||
#if IS_ENABLED(CONFIG_LP_SERIAL_SET_SPEED)
|
||||
serial_hardware_init(CONFIG_LP_SERIAL_BAUD_RATE, 8, 0, 1);
|
||||
#endif
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
|
||||
switch (port->signature) {
|
||||
case HBA_PxSIG_ATA:
|
||||
printf("ahci: ATA drive on port #%d.\n", portnum);
|
||||
#ifdef CONFIG_LP_STORAGE_ATA
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_ATA)
|
||||
dev->ata_dev.identify = ahci_identify_device;
|
||||
dev->ata_dev.read_sectors = ahci_ata_read_sectors;
|
||||
return ata_attach_device(&dev->ata_dev, PORT_TYPE_SATA);
|
||||
@ -160,7 +160,7 @@ static int ahci_dev_init(hba_ctrl_t *const ctrl,
|
||||
break;
|
||||
case HBA_PxSIG_ATAPI:
|
||||
printf("ahci: ATAPI drive on port #%d.\n", portnum);
|
||||
#ifdef CONFIG_LP_STORAGE_ATAPI
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_ATAPI)
|
||||
dev->atapi_dev.identify = ahci_identify_device;
|
||||
dev->atapi_dev.packet_read_cmd = ahci_packet_read_cmd;
|
||||
return atapi_attach_device(&dev->atapi_dev, PORT_TYPE_SATA);
|
||||
@ -217,7 +217,7 @@ static void ahci_port_probe(hba_ctrl_t *const ctrl,
|
||||
ahci_dev_init(ctrl, port, portnum);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_STORAGE_AHCI_ONLY_TESTED
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI_ONLY_TESTED)
|
||||
static u32 working_controllers[] = {
|
||||
0x8086 | 0x2929 << 16, /* Mobile ICH9 */
|
||||
0x8086 | 0x1e03 << 16, /* Mobile Panther Point PCH */
|
||||
@ -233,7 +233,7 @@ static void ahci_init_pci(pcidev_t dev)
|
||||
const u16 vendor = pci_read_config16(dev, 0x00);
|
||||
const u16 device = pci_read_config16(dev, 0x02);
|
||||
|
||||
#ifdef CONFIG_LP_STORAGE_AHCI_ONLY_TESTED
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI_ONLY_TESTED)
|
||||
const u32 vendor_device = pci_read_config32(dev, 0x0);
|
||||
for (i = 0; i < ARRAY_SIZE(working_controllers); ++i)
|
||||
if (vendor_device == working_controllers[i])
|
||||
|
@ -56,7 +56,7 @@ ssize_t ahci_ata_read_sectors(ata_dev_t *const ata_dev,
|
||||
printf("ahci: Sector count too high (max. 256).\n");
|
||||
count = 256;
|
||||
}
|
||||
#ifdef CONFIG_LP_STORAGE_64BIT_LBA
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
|
||||
} else if (ata_dev->read_cmd == ATA_READ_DMA_EXT) {
|
||||
if (start >= (1ULL << 48)) {
|
||||
printf("ahci: Sector is not 48-bit addressable.\n");
|
||||
@ -84,7 +84,7 @@ ssize_t ahci_ata_read_sectors(ata_dev_t *const ata_dev,
|
||||
dev->cmdtable->fis[ 6] = (start >> 16) & 0xff;
|
||||
dev->cmdtable->fis[ 7] = FIS_H2D_DEV_LBA;
|
||||
dev->cmdtable->fis[ 8] = (start >> 24) & 0xff;
|
||||
#ifdef CONFIG_LP_STORAGE_64BIT_LBA
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
|
||||
if (ata_dev->read_cmd == ATA_READ_DMA_EXT) {
|
||||
dev->cmdtable->fis[ 9] = (start >> 32) & 0xff;
|
||||
dev->cmdtable->fis[10] = (start >> 40) & 0xff;
|
||||
|
@ -212,7 +212,7 @@ int ata_attach_device(ata_dev_t *const dev, const storage_port_t port_type)
|
||||
ata_strncpy(model, id + 27, sizeof(model));
|
||||
printf("ata: Identified %s [%s]\n", model, fw);
|
||||
|
||||
#ifdef CONFIG_LP_STORAGE_64BIT_LBA
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
|
||||
if (id[ATA_CMDS_AND_FEATURE_SETS + 1] & (1 << 10)) {
|
||||
printf("ata: Support for LBA-48 enabled.\n");
|
||||
dev->read_cmd = ATA_READ_DMA_EXT;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <libpayload.h>
|
||||
#ifdef CONFIG_LP_STORAGE_AHCI
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI)
|
||||
# include <storage/ahci.h>
|
||||
#endif
|
||||
#include <storage/storage.h>
|
||||
@ -110,7 +110,7 @@ ssize_t storage_read_blocks512(const size_t dev_num,
|
||||
*/
|
||||
void storage_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_LP_STORAGE_AHCI
|
||||
#if IS_ENABLED(CONFIG_LP_STORAGE_AHCI)
|
||||
ahci_initialize();
|
||||
#endif
|
||||
}
|
||||
|
@ -873,7 +873,7 @@ ehci_init (unsigned long physical_bar)
|
||||
return controller;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
hci_t *
|
||||
ehci_pci_init (pcidev_t addr)
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ ohci_init (unsigned long physical_bar)
|
||||
return controller;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
hci_t *
|
||||
ohci_pci_init (pcidev_t addr)
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
|
||||
break;
|
||||
case hid_device:
|
||||
usb_debug ("HID\n");
|
||||
#ifdef CONFIG_LP_USB_HID
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HID)
|
||||
dev->init = usb_hid_init;
|
||||
return dev->address;
|
||||
#else
|
||||
@ -548,7 +548,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
|
||||
break;
|
||||
case msc_device:
|
||||
usb_debug ("MSC\n");
|
||||
#ifdef CONFIG_LP_USB_MSC
|
||||
#if IS_ENABLED(CONFIG_LP_USB_MSC)
|
||||
dev->init = usb_msc_init;
|
||||
return dev->address;
|
||||
#else
|
||||
@ -558,7 +558,7 @@ set_address (hci_t *controller, usb_speed speed, int hubport, int hubaddr)
|
||||
case hub_device:
|
||||
if (speed < SUPER_SPEED) {
|
||||
usb_debug ("hub (2.0)\n");
|
||||
#ifdef CONFIG_LP_USB_HUB
|
||||
#if IS_ENABLED(CONFIG_LP_USB_HUB)
|
||||
dev->init = usb_hub_init;
|
||||
return dev->address;
|
||||
#else
|
||||
|
@ -138,7 +138,7 @@ struct layout_maps {
|
||||
static const struct layout_maps *map;
|
||||
|
||||
static const struct layout_maps keyboard_layouts[] = {
|
||||
// #ifdef CONFIG_LP_PC_KEYBOARD_LAYOUT_US
|
||||
// #if IS_ENABLED(CONFIG_LP_PC_KEYBOARD_LAYOUT_US)
|
||||
{ .country = "us", .map = {
|
||||
{ /* No modifier */
|
||||
-1, -1, -1, -1, 'a', 'b', 'c', 'd',
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "dwc2.h"
|
||||
#include <usb/usbdisk.h>
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
/**
|
||||
* Initializes USB controller attached to PCI
|
||||
*
|
||||
@ -72,7 +72,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
|
||||
pciid >> 16, pciid & 0xFFFF, func);
|
||||
switch (prog_if) {
|
||||
case 0x00:
|
||||
#ifdef CONFIG_LP_USB_UHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_UHCI)
|
||||
usb_debug("UHCI controller\n");
|
||||
uhci_pci_init (pci_device);
|
||||
#else
|
||||
@ -81,7 +81,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
#ifdef CONFIG_LP_USB_OHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_OHCI)
|
||||
usb_debug("OHCI controller\n");
|
||||
ohci_pci_init(pci_device);
|
||||
#else
|
||||
@ -90,7 +90,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
#ifdef CONFIG_LP_USB_EHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_EHCI)
|
||||
usb_debug("EHCI controller\n");
|
||||
ehci_pci_init(pci_device);
|
||||
#else
|
||||
@ -99,7 +99,7 @@ static int usb_controller_initialize(int bus, int dev, int func)
|
||||
break;
|
||||
|
||||
case 0x30:
|
||||
#ifdef CONFIG_LP_USB_XHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_XHCI)
|
||||
usb_debug("xHCI controller\n");
|
||||
xhci_pci_init(pci_device);
|
||||
#else
|
||||
@ -166,7 +166,7 @@ static void usb_scan_pci_bus(int bus)
|
||||
*/
|
||||
int usb_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
usb_scan_pci_bus(0);
|
||||
#endif
|
||||
return 0;
|
||||
@ -175,19 +175,19 @@ int usb_initialize(void)
|
||||
hci_t *usb_add_mmio_hc(hc_type type, void *bar)
|
||||
{
|
||||
switch (type) {
|
||||
#ifdef CONFIG_LP_USB_OHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_OHCI)
|
||||
case OHCI:
|
||||
return ohci_init((unsigned long)bar);
|
||||
#endif
|
||||
#ifdef CONFIG_LP_USB_EHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_EHCI)
|
||||
case EHCI:
|
||||
return ehci_init((unsigned long)bar);
|
||||
#endif
|
||||
#ifdef CONFIG_LP_USB_DWC2
|
||||
#if IS_ENABLED(CONFIG_LP_USB_DWC2)
|
||||
case DWC2:
|
||||
return dwc2_init(bar);
|
||||
#endif
|
||||
#ifdef CONFIG_LP_USB_XHCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_XHCI)
|
||||
case XHCI:
|
||||
return xhci_init((unsigned long)bar);
|
||||
#endif
|
||||
|
@ -88,7 +88,7 @@ xhci_init_cycle_ring(transfer_ring_t *const tr, const size_t ring_size)
|
||||
}
|
||||
|
||||
/* On Panther Point: switch ports shared with EHCI to xHCI */
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
static void
|
||||
xhci_switch_ppt_ports(pcidev_t addr)
|
||||
{
|
||||
@ -112,7 +112,7 @@ xhci_switch_ppt_ports(pcidev_t addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
/* On Panther Point: switch all ports back to EHCI */
|
||||
static void
|
||||
xhci_switchback_ppt_ports(pcidev_t addr)
|
||||
@ -296,7 +296,7 @@ _free_xhci:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
hci_t *
|
||||
xhci_pci_init (pcidev_t addr)
|
||||
{
|
||||
@ -411,7 +411,7 @@ xhci_shutdown(hci_t *const controller)
|
||||
xhci_t *const xhci = XHCI_INST(controller);
|
||||
xhci_stop(controller);
|
||||
|
||||
#ifdef CONFIG_LP_USB_PCI
|
||||
#if IS_ENABLED(CONFIG_LP_USB_PCI)
|
||||
if (controller->pcidev)
|
||||
xhci_switchback_ppt_ports(controller->pcidev);
|
||||
#endif
|
||||
|
@ -31,27 +31,27 @@
|
||||
#include <libpayload.h>
|
||||
#include <video_console.h>
|
||||
|
||||
#ifdef CONFIG_LP_GEODELX_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_GEODELX_VIDEO_CONSOLE)
|
||||
extern struct video_console geodelx_video_console;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
|
||||
extern struct video_console coreboot_video_console;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
|
||||
extern struct video_console vga_video_console;
|
||||
#endif
|
||||
|
||||
static struct video_console *console_list[] =
|
||||
{
|
||||
#ifdef CONFIG_LP_GEODELX_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_GEODELX_VIDEO_CONSOLE)
|
||||
&geodelx_video_console,
|
||||
#endif
|
||||
#ifdef CONFIG_LP_COREBOOT_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CONSOLE)
|
||||
&coreboot_video_console,
|
||||
#endif
|
||||
#ifdef CONFIG_LP_VGA_VIDEO_CONSOLE
|
||||
#if IS_ENABLED(CONFIG_LP_VGA_VIDEO_CONSOLE)
|
||||
&vga_video_console,
|
||||
#endif
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ static inline uint64_t swap_bytes64(uint64_t in)
|
||||
|
||||
/* Endian functions from glibc 2.9 / BSD "endian.h" */
|
||||
|
||||
#if defined CONFIG_LP_BIG_ENDIAN
|
||||
#if IS_ENABLED(CONFIG_LP_BIG_ENDIAN)
|
||||
|
||||
#define htobe16(in) (in)
|
||||
#define htobe32(in) (in)
|
||||
@ -63,7 +63,7 @@ static inline uint64_t swap_bytes64(uint64_t in)
|
||||
#define htole32(in) swap_bytes32(in)
|
||||
#define htole64(in) swap_bytes64(in)
|
||||
|
||||
#elif defined CONFIG_LP_LITTLE_ENDIAN
|
||||
#elif IS_ENABLED(CONFIG_LP_LITTLE_ENDIAN)
|
||||
|
||||
#define htobe16(in) swap_bytes16(in)
|
||||
#define htobe32(in) swap_bytes32(in)
|
||||
|
@ -45,7 +45,7 @@
|
||||
* @defgroup malloc Memory allocation functions
|
||||
* @{
|
||||
*/
|
||||
#if defined(CONFIG_LP_DEBUG_MALLOC) && !defined(IN_MALLOC_C)
|
||||
#if IS_ENABLED(CONFIG_LP_DEBUG_MALLOC) && !defined(IN_MALLOC_C)
|
||||
#define free(p) \
|
||||
({ \
|
||||
extern void print_malloc_map(void); \
|
||||
@ -217,7 +217,7 @@ void srand(unsigned int seed);
|
||||
void halt(void) __attribute__ ((noreturn));
|
||||
void exit(int status) __attribute__ ((noreturn));
|
||||
#define abort() halt() /**< Alias for the halt() function */
|
||||
#ifdef CONFIG_LP_REMOTEGDB
|
||||
#if IS_ENABLED(CONFIG_LP_REMOTEGDB)
|
||||
/* Override abort()/halt() to trap into GDB if it is enabled. */
|
||||
#define halt() do { gdb_enter(); halt(); } while (0)
|
||||
#endif
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#ifndef CONFIG_LP_STORAGE_64BIT_LBA
|
||||
#if !IS_ENABLED(CONFIG_LP_STORAGE_64BIT_LBA)
|
||||
typedef u32 lba_t;
|
||||
#else
|
||||
typedef u64 lba_t;
|
||||
|
@ -66,7 +66,7 @@ struct sysinfo_t {
|
||||
u32 cmos_range_start;
|
||||
u32 cmos_range_end;
|
||||
u32 cmos_checksum_location;
|
||||
#ifdef CONFIG_LP_CHROMEOS
|
||||
#if IS_ENABLED(CONFIG_LP_CHROMEOS)
|
||||
u32 vbnv_start;
|
||||
u32 vbnv_size;
|
||||
#endif
|
||||
@ -86,7 +86,7 @@ struct sysinfo_t {
|
||||
|
||||
struct cb_framebuffer *framebuffer;
|
||||
|
||||
#ifdef CONFIG_LP_CHROMEOS
|
||||
#if IS_ENABLED(CONFIG_LP_CHROMEOS)
|
||||
int num_gpios;
|
||||
struct cb_gpio gpios[SYSINFO_MAX_GPIOS];
|
||||
int num_macs;
|
||||
@ -99,14 +99,14 @@ struct sysinfo_t {
|
||||
struct cb_header *header;
|
||||
struct cb_mainboard *mainboard;
|
||||
|
||||
#ifdef CONFIG_LP_CHROMEOS
|
||||
#if IS_ENABLED(CONFIG_LP_CHROMEOS)
|
||||
void *vboot_handoff;
|
||||
u32 vboot_handoff_size;
|
||||
void *vdat_addr;
|
||||
u32 vdat_size;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LP_ARCH_X86
|
||||
#if IS_ENABLED(CONFIG_LP_ARCH_X86)
|
||||
int x86_rom_var_mtrr_index;
|
||||
#endif
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#ifdef LIBPAYLOAD
|
||||
# include <libpayload-config.h>
|
||||
# ifdef CONFIG_LP_LZMA
|
||||
# if IS_ENABLED(CONFIG_LP_LZMA)
|
||||
# include <lzma.h>
|
||||
# define CBFS_CORE_WITH_LZMA
|
||||
# endif
|
||||
|
@ -121,7 +121,7 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
|
||||
|
||||
// TODO Add a "size" in CBFS header for a platform independent way to
|
||||
// determine the end of CBFS data.
|
||||
#if defined(CONFIG_LP_ARCH_X86) && CONFIG_LP_ARCH_X86
|
||||
#if IS_ENABLED(CONFIG_LP_ARCH_X86)
|
||||
// resolve actual length of ROM used for CBFS components
|
||||
// the bootblock size was not taken into account
|
||||
romsize -= ntohl(header->bootblocksize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user