From b3b114c28f6e7c11b327fce84d93141498d5f665 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 24 Jun 2017 14:00:01 -0600 Subject: src/device: add IS_ENABLED() around Kconfig symbol references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/20338 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Patrick Georgi --- src/device/device.c | 10 +++++----- src/device/oprom/realmode/x86.c | 10 +++++----- src/device/oprom/realmode/x86_interrupts.c | 2 +- src/device/pci_device.c | 18 +++++++++--------- src/device/pci_early.c | 2 +- src/device/pci_rom.c | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/device/device.c b/src/device/device.c index 0231ec72c9..35f5909c6f 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -46,7 +46,7 @@ #include #include #include -#if CONFIG_ARCH_X86 +#if IS_ENABLED(CONFIG_ARCH_X86) #include #endif #include @@ -102,7 +102,7 @@ void dev_finalize_chips(void) DECLARE_SPIN_LOCK(dev_lock) -#if CONFIG_GFXUMA +#if IS_ENABLED(CONFIG_GFXUMA) /* IGD UMA memory */ uint64_t uma_memory_base = 0; uint64_t uma_memory_size = 0; @@ -1130,7 +1130,7 @@ static void init_dev(struct device *dev) return; if (!dev->initialized && dev->ops && dev->ops->init) { -#if CONFIG_HAVE_MONOTONIC_TIMER +#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER) struct stopwatch sw; stopwatch_init(&sw); #endif @@ -1142,7 +1142,7 @@ static void init_dev(struct device *dev) printk(BIOS_DEBUG, "%s init ...\n", dev_path(dev)); dev->initialized = 1; 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), stopwatch_duration_usecs(&sw)); #endif @@ -1178,7 +1178,7 @@ void dev_initialize(void) printk(BIOS_INFO, "Initializing devices...\n"); -#if CONFIG_ARCH_X86 +#if IS_ENABLED(CONFIG_ARCH_X86) /* Ensure EBDA is prepared before Option ROMs. */ setup_default_ebda(); #endif diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index 69ac1fe23d..d9fac36b66 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -212,7 +212,7 @@ static void setup_realmode_idt(void) 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; static int mode_info_valid; @@ -268,7 +268,7 @@ void vbe_set_graphics(void) } vbe_set_mode(&mode_info); -#if CONFIG_BOOTSPLASH +#if IS_ENABLED(CONFIG_BOOTSPLASH) struct jpeg_decdata *decdata; unsigned char *jpeg = cbfs_boot_map_with_leak("bootsplash.jpg", 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); 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) vbe_set_graphics(); #endif } -#if CONFIG_GEODE_VSA +#if IS_ENABLED(CONFIG_GEODE_VSA) #define VSA2_BUFFER 0x60000 #define VSA2_ENTRY_POINT 0x60020 @@ -459,7 +459,7 @@ int asmlinkage interrupt_handler(u32 intnumber, cs = cs_ip >> 16; 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: eax: %08x ebx: %08x ecx: %08x edx: %08x\n", eax, ebx, ecx, edx); diff --git a/src/device/oprom/realmode/x86_interrupts.c b/src/device/oprom/realmode/x86_interrupts.c index 05cdd4a0c2..7ec77f8b9d 100644 --- a/src/device/oprom/realmode/x86_interrupts.c +++ b/src/device/oprom/realmode/x86_interrupts.c @@ -212,7 +212,7 @@ int int1a_handler(void) 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", func, bus, devfn, reg, X86_ECX); #endif diff --git a/src/device/pci_device.c b/src/device/pci_device.c index e42315166d..75e9a7910d 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -664,7 +664,7 @@ void pci_dev_set_subsystem(struct device *dev, unsigned vendor, unsigned device) ((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 = -1; @@ -677,7 +677,7 @@ static int should_run_oprom(struct device *dev) */ should_run = display_init_required(); -#if CONFIG_CHROMEOS +#if IS_ENABLED(CONFIG_CHROMEOS) if (!should_run) should_run = vboot_wants_oprom(); #endif @@ -706,7 +706,7 @@ static int should_load_oprom(struct device *dev) /** Default handler: only runs the relevant PCI BIOS. */ void pci_dev_init(struct device *dev) { -#if CONFIG_VGA_ROM_RUN +#if IS_ENABLED(CONFIG_VGA_ROM_RUN) struct rom_header *rom, *ram; /* 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) { -#if CONFIG_PCIX_PLUGIN_SUPPORT +#if IS_ENABLED(CONFIG_PCIX_PLUGIN_SUPPORT) unsigned int pcixpos; pcixpos = pci_find_capability(dev, PCI_CAP_ID_PCIX); if (pcixpos) { @@ -791,7 +791,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev) return &default_pcix_ops_bus; } #endif -#if CONFIG_HYPERTRANSPORT_PLUGIN_SUPPORT +#if IS_ENABLED(CONFIG_HYPERTRANSPORT_PLUGIN_SUPPORT) unsigned int htpos = 0; while ((htpos = pci_find_next_capability(dev, PCI_CAP_ID_HT, htpos))) { u16 flags; @@ -804,7 +804,7 @@ static struct device_operations *get_pci_bridge_ops(device_t dev) } } #endif -#if CONFIG_PCIEXP_PLUGIN_SUPPORT +#if IS_ENABLED(CONFIG_PCIEXP_PLUGIN_SUPPORT) unsigned int pciexpos; pciexpos = pci_find_capability(dev, PCI_CAP_ID_PCIE); if (pciexpos) { @@ -894,7 +894,7 @@ static void set_pci_ops(struct device *dev) goto bad; dev->ops = get_pci_bridge_ops(dev); break; -#if CONFIG_CARDBUS_PLUGIN_SUPPORT +#if IS_ENABLED(CONFIG_CARDBUS_PLUGIN_SUPPORT) case PCI_HEADER_TYPE_CARDBUS: dev->ops = &default_cardbus_ops_bus; break; @@ -1445,7 +1445,7 @@ int get_pci_irq_pins(device_t dev, device_t *parent_bdg) return target_pin; } -#if CONFIG_PC80_SYSTEM +#if IS_ENABLED(CONFIG_PC80_SYSTEM) /** * Assign IRQ numbers. * @@ -1494,7 +1494,7 @@ void pci_assign_irqs(unsigned bus, unsigned slot, printk(BIOS_DEBUG, " Readback = %d\n", irq); #endif -#if CONFIG_PC80_SYSTEM +#if IS_ENABLED(CONFIG_PC80_SYSTEM) /* Change to level triggered. */ i8259_configure_irq_trigger(pIntAtoD[line - 1], IRQ_LEVEL_TRIGGERED); diff --git a/src/device/pci_early.c b/src/device/pci_early.c index 71077385ab..6baebe0c28 100644 --- a/src/device/pci_early.c +++ b/src/device/pci_early.c @@ -71,7 +71,7 @@ unsigned pci_find_capability(pci_devfn_t dev, unsigned cap) #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) { diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index a3f5775a1b..6456d17d6d 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -63,7 +63,7 @@ struct rom_header *pci_rom_probe(struct device *dev) rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS); 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) rom_address = 0xc0000; else @@ -149,7 +149,7 @@ struct rom_header *pci_rom_load(struct device *dev, * devices have a mismatch between the hardware and the ROM. */ 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). */ if (dev != vga_pri) return NULL; /* Only one VGA supported. */ #endif -- cgit v1.2.3