arch/x86/include: Use IS_ENABLED() macro

Change-Id: I0f9a92e595ec765d47f89f0023ff69636ee406af
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/19761
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
This commit is contained in:
Nico Huber 2017-05-18 15:56:22 +02:00 committed by Nico Huber
parent 746aa054e2
commit 1b2d95feb3
5 changed files with 23 additions and 42 deletions

View File

@ -46,7 +46,7 @@ static void bootblock_mainboard_init(void)
}
#endif
#if CONFIG_USE_OPTION_TABLE
#if IS_ENABLED(CONFIG_USE_OPTION_TABLE)
static void sanitize_cmos(void)
{
if (cmos_error() || !cmos_chksum_valid()

View File

@ -188,7 +188,7 @@ struct thread;
struct cpu_info {
struct device *cpu;
unsigned int index;
#if CONFIG_COOP_MULTITASKING
#if IS_ENABLED(CONFIG_COOP_MULTITASKING)
struct thread *thread;
#endif
};

View File

@ -21,9 +21,9 @@
#include "registers.h"
/* setup interrupt handlers for mainboard */
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
#if IS_ENABLED(CONFIG_PCI_OPTION_ROM_RUN_REALMODE)
extern void mainboard_interrupt_handlers(int intXX, int (*intXX_func)(void));
#elif CONFIG_PCI_OPTION_ROM_RUN_YABEL
#elif IS_ENABLED(CONFIG_PCI_OPTION_ROM_RUN_YABEL)
#include <device/oprom/yabel/biosemu.h>
#else
static inline void mainboard_interrupt_handlers(int intXX,

View File

@ -16,15 +16,21 @@
#include <arch/io.h>
static inline __attribute__((always_inline))
unsigned int pci_io_encode_addr(pci_devfn_t dev, unsigned int where)
{
if (IS_ENABLED(CONFIG_PCI_IO_CFG_EXT)) {
// seg == 0
return dev >> 4 | (where & 0xff) | ((where & 0xf00) << 16);
} else {
return dev >> 4 | where;
}
}
static inline __attribute__((always_inline))
uint8_t pci_io_read_config8(pci_devfn_t dev, unsigned int where)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16); //seg == 0
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inb(0xCFC + (addr & 3));
}
@ -32,12 +38,7 @@ uint8_t pci_io_read_config8(pci_devfn_t dev, unsigned int where)
static inline __attribute__((always_inline))
uint16_t pci_io_read_config16(pci_devfn_t dev, unsigned int where)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16);
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inw(0xCFC + (addr & 2));
}
@ -45,12 +46,7 @@ uint16_t pci_io_read_config16(pci_devfn_t dev, unsigned int where)
static inline __attribute__((always_inline))
uint32_t pci_io_read_config32(pci_devfn_t dev, unsigned int where)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16);
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
return inl(0xCFC);
}
@ -58,12 +54,7 @@ uint32_t pci_io_read_config32(pci_devfn_t dev, unsigned int where)
static inline __attribute__((always_inline))
void pci_io_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16);
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outb(value, 0xCFC + (addr & 3));
}
@ -71,12 +62,7 @@ void pci_io_write_config8(pci_devfn_t dev, unsigned int where, uint8_t value)
static inline __attribute__((always_inline))
void pci_io_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16);
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outw(value, 0xCFC + (addr & 2));
}
@ -84,12 +70,7 @@ void pci_io_write_config16(pci_devfn_t dev, unsigned int where, uint16_t value)
static inline __attribute__((always_inline))
void pci_io_write_config32(pci_devfn_t dev, unsigned int where, uint32_t value)
{
unsigned int addr;
#if !CONFIG_PCI_IO_CFG_EXT
addr = (dev>>4) | where;
#else
addr = (dev>>4) | (where & 0xff) | ((where & 0xf00)<<16);
#endif
unsigned int addr = pci_io_encode_addr(dev, where);
outl(0x80000000 | (addr & ~3), 0xCF8);
outl(value, 0xCFC);
}

View File

@ -27,7 +27,7 @@
* CAUTION: If you change this, pirq_routing will not work correctly*/
#define MAX_INTX_ENTRIES 4
#if CONFIG_GENERATE_PIRQ_TABLE
#if IS_ENABLED(CONFIG_GENERATE_PIRQ_TABLE)
#include <stdint.h>
#define PIRQ_SIGNATURE (('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
@ -60,7 +60,7 @@ unsigned long copy_pirq_routing_table(unsigned long addr,
const struct irq_routing_table *routing_table);
unsigned long write_pirq_routing_table(unsigned long start);
#if CONFIG_PIRQ_ROUTE
#if IS_ENABLED(CONFIG_PIRQ_ROUTE)
void pirq_assign_irqs(const unsigned char pirq[CONFIG_MAX_PIRQ_LINKS]);
#endif