src/device: add IS_ENABLED() around Kconfig symbol references

Some of these can be changed from #if to if(), but that will happen
in a follow-on commmit.

Change-Id: I66cde1adcf373889b03f144793c0b4f46d21ca31
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/20338
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2017-06-24 14:00:01 -06:00
parent ebade5dec9
commit b3b114c28f
6 changed files with 23 additions and 23 deletions

View File

@ -46,7 +46,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <smp/spinlock.h> #include <smp/spinlock.h>
#if CONFIG_ARCH_X86 #if IS_ENABLED(CONFIG_ARCH_X86)
#include <arch/ebda.h> #include <arch/ebda.h>
#endif #endif
#include <timer.h> #include <timer.h>
@ -102,7 +102,7 @@ void dev_finalize_chips(void)
DECLARE_SPIN_LOCK(dev_lock) DECLARE_SPIN_LOCK(dev_lock)
#if CONFIG_GFXUMA #if IS_ENABLED(CONFIG_GFXUMA)
/* IGD UMA memory */ /* IGD UMA memory */
uint64_t uma_memory_base = 0; uint64_t uma_memory_base = 0;
uint64_t uma_memory_size = 0; uint64_t uma_memory_size = 0;
@ -1130,7 +1130,7 @@ static void init_dev(struct device *dev)
return; return;
if (!dev->initialized && dev->ops && dev->ops->init) { if (!dev->initialized && dev->ops && dev->ops->init) {
#if CONFIG_HAVE_MONOTONIC_TIMER #if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
struct stopwatch sw; struct stopwatch sw;
stopwatch_init(&sw); stopwatch_init(&sw);
#endif #endif
@ -1142,7 +1142,7 @@ static void init_dev(struct device *dev)
printk(BIOS_DEBUG, "%s init ...\n", dev_path(dev)); printk(BIOS_DEBUG, "%s init ...\n", dev_path(dev));
dev->initialized = 1; dev->initialized = 1;
dev->ops->init(dev); dev->ops->init(dev);
#if CONFIG_HAVE_MONOTONIC_TIMER #if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
printk(BIOS_DEBUG, "%s init finished in %ld usecs\n", dev_path(dev), printk(BIOS_DEBUG, "%s init finished in %ld usecs\n", dev_path(dev),
stopwatch_duration_usecs(&sw)); stopwatch_duration_usecs(&sw));
#endif #endif
@ -1178,7 +1178,7 @@ void dev_initialize(void)
printk(BIOS_INFO, "Initializing devices...\n"); printk(BIOS_INFO, "Initializing devices...\n");
#if CONFIG_ARCH_X86 #if IS_ENABLED(CONFIG_ARCH_X86)
/* Ensure EBDA is prepared before Option ROMs. */ /* Ensure EBDA is prepared before Option ROMs. */
setup_default_ebda(); setup_default_ebda();
#endif #endif

View File

@ -212,7 +212,7 @@ static void setup_realmode_idt(void)
write_idt_stub((void *)0xffe6e, 0x1a); write_idt_stub((void *)0xffe6e, 0x1a);
} }
#if CONFIG_FRAMEBUFFER_SET_VESA_MODE #if IS_ENABLED(CONFIG_FRAMEBUFFER_SET_VESA_MODE)
vbe_mode_info_t mode_info; vbe_mode_info_t mode_info;
static int mode_info_valid; static int mode_info_valid;
@ -268,7 +268,7 @@ void vbe_set_graphics(void)
} }
vbe_set_mode(&mode_info); vbe_set_mode(&mode_info);
#if CONFIG_BOOTSPLASH #if IS_ENABLED(CONFIG_BOOTSPLASH)
struct jpeg_decdata *decdata; struct jpeg_decdata *decdata;
unsigned char *jpeg = cbfs_boot_map_with_leak("bootsplash.jpg", unsigned char *jpeg = cbfs_boot_map_with_leak("bootsplash.jpg",
CBFS_TYPE_BOOTSPLASH, CBFS_TYPE_BOOTSPLASH,
@ -349,13 +349,13 @@ void run_bios(struct device *dev, unsigned long addr)
realmode_call(addr + 0x0003, num_dev, 0xffff, 0x0000, 0xffff, 0x0, 0x0); realmode_call(addr + 0x0003, num_dev, 0xffff, 0x0000, 0xffff, 0x0, 0x0);
printk(BIOS_DEBUG, "... Option ROM returned.\n"); printk(BIOS_DEBUG, "... Option ROM returned.\n");
#if CONFIG_FRAMEBUFFER_SET_VESA_MODE #if IS_ENABLED(CONFIG_FRAMEBUFFER_SET_VESA_MODE)
if ((dev->class >> 8)== PCI_CLASS_DISPLAY_VGA) if ((dev->class >> 8)== PCI_CLASS_DISPLAY_VGA)
vbe_set_graphics(); vbe_set_graphics();
#endif #endif
} }
#if CONFIG_GEODE_VSA #if IS_ENABLED(CONFIG_GEODE_VSA)
#define VSA2_BUFFER 0x60000 #define VSA2_BUFFER 0x60000
#define VSA2_ENTRY_POINT 0x60020 #define VSA2_ENTRY_POINT 0x60020
@ -459,7 +459,7 @@ int asmlinkage interrupt_handler(u32 intnumber,
cs = cs_ip >> 16; cs = cs_ip >> 16;
flags = stackflags; flags = stackflags;
#if CONFIG_REALMODE_DEBUG #if IS_ENABLED(CONFIG_REALMODE_DEBUG)
printk(BIOS_DEBUG, "oprom: INT# 0x%x\n", intnumber); printk(BIOS_DEBUG, "oprom: INT# 0x%x\n", intnumber);
printk(BIOS_DEBUG, "oprom: eax: %08x ebx: %08x ecx: %08x edx: %08x\n", printk(BIOS_DEBUG, "oprom: eax: %08x ebx: %08x ecx: %08x edx: %08x\n",
eax, ebx, ecx, edx); eax, ebx, ecx, edx);

View File

@ -212,7 +212,7 @@ int int1a_handler(void)
break; break;
} }
#if CONFIG_REALMODE_DEBUG #if IS_ENABLED(CONFIG_REALMODE_DEBUG)
printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%x\n", printk(BIOS_DEBUG, "0x%x: bus %d devfn 0x%x reg 0x%x val 0x%x\n",
func, bus, devfn, reg, X86_ECX); func, bus, devfn, reg, X86_ECX);
#endif #endif

View File

@ -664,7 +664,7 @@ void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device)
((device & 0xffff) << 16) | (vendor & 0xffff)); ((device & 0xffff) << 16) | (vendor & 0xffff));
} }
#if CONFIG_VGA_ROM_RUN #if IS_ENABLED(CONFIG_VGA_ROM_RUN)
static int should_run_oprom(struct device *dev) static int should_run_oprom(struct device *dev)
{ {
static int should_run = -1; static int should_run = -1;
@ -677,7 +677,7 @@ static int should_run_oprom(struct device *dev)
*/ */
should_run = display_init_required(); should_run = display_init_required();
#if CONFIG_CHROMEOS #if IS_ENABLED(CONFIG_CHROMEOS)
if (!should_run) if (!should_run)
should_run = vboot_wants_oprom(); should_run = vboot_wants_oprom();
#endif #endif
@ -706,7 +706,7 @@ static int should_load_oprom(struct device *dev)
/** Default handler: only runs the relevant PCI BIOS. */ /** Default handler: only runs the relevant PCI BIOS. */
void pci_dev_init(struct device *dev) void pci_dev_init(struct device *dev)
{ {
#if CONFIG_VGA_ROM_RUN #if IS_ENABLED(CONFIG_VGA_ROM_RUN)
struct rom_header *rom, *ram; struct rom_header *rom, *ram;
/* Only execute VGA ROMs. */ /* Only execute VGA ROMs. */
@ -783,7 +783,7 @@ struct device_operations default_pci_ops_bus = {
*/ */
static struct device_operations *get_pci_bridge_ops(device_t dev) static struct device_operations *get_pci_bridge_ops(device_t dev)
{ {
#if CONFIG_PCIX_PLUGIN_SUPPORT #if IS_ENABLED(CONFIG_PCIX_PLUGIN_SUPPORT)
unsigned int pcixpos; unsigned int pcixpos;
pcixpos = pci_find_capability(dev, PCI_CAP_ID_PCIX); pcixpos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
if (pcixpos) { if (pcixpos) {
@ -791,7 +791,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev)
return &default_pcix_ops_bus; return &default_pcix_ops_bus;
} }
#endif #endif
#if CONFIG_HYPERTRANSPORT_PLUGIN_SUPPORT #if IS_ENABLED(CONFIG_HYPERTRANSPORT_PLUGIN_SUPPORT)
unsigned int htpos = 0; unsigned int htpos = 0;
while ((htpos = pci_find_next_capability(dev, PCI_CAP_ID_HT, htpos))) { while ((htpos = pci_find_next_capability(dev, PCI_CAP_ID_HT, htpos))) {
u16 flags; u16 flags;
@ -804,7 +804,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev)
} }
} }
#endif #endif
#if CONFIG_PCIEXP_PLUGIN_SUPPORT #if IS_ENABLED(CONFIG_PCIEXP_PLUGIN_SUPPORT)
unsigned int pciexpos; unsigned int pciexpos;
pciexpos = pci_find_capability(dev, PCI_CAP_ID_PCIE); pciexpos = pci_find_capability(dev, PCI_CAP_ID_PCIE);
if (pciexpos) { if (pciexpos) {
@ -894,7 +894,7 @@ static void set_pci_ops(struct device *dev)
goto bad; goto bad;
dev->ops = get_pci_bridge_ops(dev); dev->ops = get_pci_bridge_ops(dev);
break; break;
#if CONFIG_CARDBUS_PLUGIN_SUPPORT #if IS_ENABLED(CONFIG_CARDBUS_PLUGIN_SUPPORT)
case PCI_HEADER_TYPE_CARDBUS: case PCI_HEADER_TYPE_CARDBUS:
dev->ops = &default_cardbus_ops_bus; dev->ops = &default_cardbus_ops_bus;
break; break;
@ -1445,7 +1445,7 @@ int get_pci_irq_pins(device_t dev, device_t *parent_bdg)
return target_pin; return target_pin;
} }
#if CONFIG_PC80_SYSTEM #if IS_ENABLED(CONFIG_PC80_SYSTEM)
/** /**
* Assign IRQ numbers. * Assign IRQ numbers.
* *
@ -1494,7 +1494,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot,
printk(BIOS_DEBUG, " Readback = %d\n", irq); printk(BIOS_DEBUG, " Readback = %d\n", irq);
#endif #endif
#if CONFIG_PC80_SYSTEM #if IS_ENABLED(CONFIG_PC80_SYSTEM)
/* Change to level triggered. */ /* Change to level triggered. */
i8259_configure_irq_trigger(pIntAtoD[line - 1], i8259_configure_irq_trigger(pIntAtoD[line - 1],
IRQ_LEVEL_TRIGGERED); IRQ_LEVEL_TRIGGERED);

View File

@ -71,7 +71,7 @@ unsigned pci_find_capability(pci_devfn_t dev, unsigned cap)
#endif /* __PRE_RAM__ */ #endif /* __PRE_RAM__ */
#if CONFIG_EARLY_PCI_BRIDGE #if IS_ENABLED(CONFIG_EARLY_PCI_BRIDGE)
static void pci_bridge_reset_secondary(device_t p2p_bridge) static void pci_bridge_reset_secondary(device_t p2p_bridge)
{ {

View File

@ -63,7 +63,7 @@ struct rom_header *pci_rom_probe(struct device *dev)
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS); rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
if (rom_address == 0x00000000 || rom_address == 0xffffffff) { if (rom_address == 0x00000000 || rom_address == 0xffffffff) {
#if CONFIG_BOARD_EMULATION_QEMU_X86 #if IS_ENABLED(CONFIG_BOARD_EMULATION_QEMU_X86)
if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA) if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
rom_address = 0xc0000; rom_address = 0xc0000;
else else
@ -149,7 +149,7 @@ struct rom_header *pci_rom_load(struct device *dev,
* devices have a mismatch between the hardware and the ROM. * devices have a mismatch between the hardware and the ROM.
*/ */
if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) { if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) {
#if !CONFIG_MULTIPLE_VGA_ADAPTERS #if !IS_ENABLED(CONFIG_MULTIPLE_VGA_ADAPTERS)
extern device_t vga_pri; /* Primary VGA device (device.c). */ extern device_t vga_pri; /* Primary VGA device (device.c). */
if (dev != vga_pri) return NULL; /* Only one VGA supported. */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */
#endif #endif