diff options
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/include/arch/bootblock_romcc.h | 2 | ||||
-rw-r--r-- | src/arch/x86/include/arch/cpu.h | 2 | ||||
-rw-r--r-- | src/arch/x86/include/arch/interrupt.h | 4 | ||||
-rw-r--r-- | src/arch/x86/include/arch/pci_io_cfg.h | 53 | ||||
-rw-r--r-- | src/arch/x86/include/arch/pirq_routing.h | 4 |
5 files changed, 23 insertions, 42 deletions
diff --git a/src/arch/x86/include/arch/bootblock_romcc.h b/src/arch/x86/include/arch/bootblock_romcc.h index d6962d69f8..600d360749 100644 --- a/src/arch/x86/include/arch/bootblock_romcc.h +++ b/src/arch/x86/include/arch/bootblock_romcc.h @@ -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() diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 06e4435699..8a44ef96c0 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -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 }; diff --git a/src/arch/x86/include/arch/interrupt.h b/src/arch/x86/include/arch/interrupt.h index 90a29afd91..3373e8223b 100644 --- a/src/arch/x86/include/arch/interrupt.h +++ b/src/arch/x86/include/arch/interrupt.h @@ -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, diff --git a/src/arch/x86/include/arch/pci_io_cfg.h b/src/arch/x86/include/arch/pci_io_cfg.h index 8802cc0616..a09b488032 100644 --- a/src/arch/x86/include/arch/pci_io_cfg.h +++ b/src/arch/x86/include/arch/pci_io_cfg.h @@ -17,14 +17,20 @@ #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); } diff --git a/src/arch/x86/include/arch/pirq_routing.h b/src/arch/x86/include/arch/pirq_routing.h index acd456b173..ed80ce53ac 100644 --- a/src/arch/x86/include/arch/pirq_routing.h +++ b/src/arch/x86/include/arch/pirq_routing.h @@ -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 |