summaryrefslogtreecommitdiff
path: root/src/devices/oprom
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/oprom')
-rw-r--r--src/devices/oprom/yabel/device.c18
-rw-r--r--src/devices/oprom/yabel/interrupt.c23
-rw-r--r--src/devices/oprom/yabel/io.c12
-rw-r--r--src/devices/oprom/yabel/mem.c4
4 files changed, 29 insertions, 28 deletions
diff --git a/src/devices/oprom/yabel/device.c b/src/devices/oprom/yabel/device.c
index dd078c72c6..82595945a8 100644
--- a/src/devices/oprom/yabel/device.c
+++ b/src/devices/oprom/yabel/device.c
@@ -37,7 +37,7 @@ typedef struct {
u64 size;
} __attribute__ ((__packed__)) assigned_address_t;
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
/* coreboot version */
static void
@@ -110,7 +110,7 @@ biosemu_dev_get_addr_info(void)
}
// store last entry index of translate_address_array
taa_last_entry = taa_index - 1;
-#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
+#if CONFIG_X86EMU_DEBUG
//dump translate_address_array
printf("translate_address_array: \n");
translate_address_t ta;
@@ -194,7 +194,7 @@ biosemu_dev_get_addr_info(void)
}
// store last entry index of translate_address_array
taa_last_entry = taa_index - 1;
-#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
+#if CONFIG_X86EMU_DEBUG
//dump translate_address_array
printf("translate_address_array: \n");
translate_address_t ta;
@@ -226,7 +226,7 @@ biosemu_add_special_memory(u32 start, u32 size)
translate_address_array[taa_index].address_offset = 0;
}
-#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if !CONFIG_PCI_OPTION_ROM_RUN_YABEL
// to simulate accesses to legacy VGA Memory (0xA0000-0xBFFFF)
// we look for the first prefetchable memory BAR, if no prefetchable BAR found,
// we use the first memory BAR
@@ -288,7 +288,7 @@ biosemu_dev_get_device_vendor_id(void)
{
u32 pci_config_0;
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_config_0 = pci_read_config32(bios_device.dev, 0x0);
#else
pci_config_0 =
@@ -350,7 +350,7 @@ biosemu_dev_check_exprom(unsigned long rom_base_addr)
memcpy(&pci_ds, (void *) (rom_base_addr + pci_ds_offset),
sizeof(pci_ds));
clr_ci();
-#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
+#if CONFIG_X86EMU_DEBUG
DEBUG_PRINTF("PCI Data Structure @%lx:\n",
rom_base_addr + pci_ds_offset);
dump((void *) &pci_ds, sizeof(pci_ds));
@@ -412,7 +412,7 @@ biosemu_dev_init(struct device * device)
DEBUG_PRINTF("%s\n", __func__);
memset(&bios_device, 0, sizeof(bios_device));
-#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if !CONFIG_PCI_OPTION_ROM_RUN_YABEL
bios_device.ihandle = of_open(device_name);
if (bios_device.ihandle == 0) {
DEBUG_PRINTF("%s is no valid device!\n", device_name);
@@ -423,7 +423,7 @@ biosemu_dev_init(struct device * device)
bios_device.dev = device;
#endif
biosemu_dev_get_addr_info();
-#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if !CONFIG_PCI_OPTION_ROM_RUN_YABEL
biosemu_dev_find_vmem_addr();
biosemu_dev_get_puid();
#endif
@@ -440,7 +440,7 @@ biosemu_dev_translate_address(int type, unsigned long * addr)
{
int i = 0;
translate_address_t ta;
-#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if !CONFIG_PCI_OPTION_ROM_RUN_YABEL
/* we dont need this hack for coreboot... we can access legacy areas */
//check if it is an access to legacy VGA Mem... if it is, map the address
//to the vmem BAR and then translate it...
diff --git a/src/devices/oprom/yabel/interrupt.c b/src/devices/oprom/yabel/interrupt.c
index af79379f67..e5b4a3cff4 100644
--- a/src/devices/oprom/yabel/interrupt.c
+++ b/src/devices/oprom/yabel/interrupt.c
@@ -24,7 +24,7 @@
#include <x86emu/x86emu.h>
#include "../x86emu/prim_ops.h"
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/pci.h>
#include <device/pci_ops.h>
#endif
@@ -343,7 +343,7 @@ handleInt1a(void)
DEBUG_PRINTF_INTR("%s(): function: %x: PCI Find Device\n",
__func__, M.x86.R_AX);
/* FixME: support SI != 0 */
-#if defined(CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES) && CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES==1
+#if CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES
dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0);
if (dev != 0) {
DEBUG_PRINTF_INTR
@@ -384,7 +384,7 @@ handleInt1a(void)
offs = M.x86.R_DI;
DEBUG_PRINTF_INTR("%s(): function: %x: PCI Config Read from device: bus: %02x, devfn: %02x, offset: %02x\n",
__func__, M.x86.R_AX, bus, devfn, offs);
-#if defined(CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES) && CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES==1
+#if CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES
dev = dev_find_slot(bus, devfn);
DEBUG_PRINTF_INTR("%s(): function: %x: dev_find_slot() returned: %s\n",
__func__, M.x86.R_AX, dev_path(dev));
@@ -408,7 +408,7 @@ handleInt1a(void)
switch (M.x86.R_AX) {
case 0xb108:
M.x86.R_CL =
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_read_config8(dev, offs);
#else
(u8) rtas_pci_config_read(bios_device.
@@ -423,7 +423,7 @@ handleInt1a(void)
break;
case 0xb109:
M.x86.R_CX =
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_read_config16(dev, offs);
#else
(u16) rtas_pci_config_read(bios_device.
@@ -438,7 +438,7 @@ handleInt1a(void)
break;
case 0xb10a:
M.x86.R_ECX =
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_read_config32(dev, offs);
#else
(u32) rtas_pci_config_read(bios_device.
@@ -476,7 +476,7 @@ handleInt1a(void)
} else {
switch (M.x86.R_AX) {
case 0xb10b:
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_write_config8(bios_device.dev, offs, M.x86.R_CL);
#else
rtas_pci_config_write(bios_device.puid, 1, bus,
@@ -488,7 +488,7 @@ handleInt1a(void)
M.x86.R_CL);
break;
case 0xb10c:
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_write_config16(bios_device.dev, offs, M.x86.R_CX);
#else
rtas_pci_config_write(bios_device.puid, 2, bus,
@@ -500,7 +500,7 @@ handleInt1a(void)
M.x86.R_CX);
break;
case 0xb10d:
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
pci_write_config32(bios_device.dev, offs, M.x86.R_ECX);
#else
rtas_pci_config_write(bios_device.puid, 4, bus,
@@ -576,8 +576,9 @@ handleInterrupt(int intNum)
int_handled = 1;
break;
case PMM_INT_NUM:
- /* the selfdefined PMM INT number, this is called by the code in PMM struct, it
- * is handled by pmm_handleInt()
+ /* The self-defined PMM INT number, this is called by
+ * the code in PMM struct, and it is handled by
+ * pmm_handleInt()
*/
pmm_handleInt();
int_handled = 1;
diff --git a/src/devices/oprom/yabel/io.c b/src/devices/oprom/yabel/io.c
index 20340470b0..00bb1a0d2f 100644
--- a/src/devices/oprom/yabel/io.c
+++ b/src/devices/oprom/yabel/io.c
@@ -19,13 +19,13 @@
#include <x86emu/x86emu.h>
#include "io.h"
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/resource.h>
#endif
-#ifdef CONFIG_ARCH_X86
+#if CONFIG_ARCH_X86
#include <arch/io.h>
#else
// these are not used, only needed for linking, must be overridden using X86emu_setupPioFuncs
@@ -76,7 +76,7 @@ inl(u16 port)
}
#endif
-#if defined(CONFIG_YABEL_DIRECTHW) && (CONFIG_YABEL_DIRECTHW == 1)
+#if CONFIG_YABEL_DIRECTHW
u8 my_inb(X86EMU_pioAddr addr)
{
u8 val;
@@ -455,7 +455,7 @@ pci_cfg_read(X86EMU_pioAddr addr, u8 size)
offs += (addr - 0xCFC); // if addr is not 0xcfc, the offset is moved accordingly
DEBUG_PRINTF_INTR("%s(): PCI Config Read from device: bus: %02x, devfn: %02x, offset: %02x\n",
__func__, bus, devfn, offs);
-#if defined(CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES) && CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES==1
+#if CONFIG_YABEL_PCI_ACCESS_OTHER_DEVICES
dev = dev_find_slot(bus, devfn);
DEBUG_PRINTF_INTR("%s(): dev_find_slot() returned: %s\n",
__func__, dev_path(dev));
@@ -475,7 +475,7 @@ pci_cfg_read(X86EMU_pioAddr addr, u8 size)
HALT_SYS();
return 0;
} else {
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
switch (size) {
case 1:
rval = pci_read_config8(dev, offs);
@@ -526,7 +526,7 @@ pci_cfg_write(X86EMU_pioAddr addr, u32 val, u8 size)
bus, devfn >> 3, devfn & 7, offs);
HALT_SYS();
} else {
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
switch (size) {
case 1:
pci_write_config8(bios_device.dev, offs, val);
diff --git a/src/devices/oprom/yabel/mem.c b/src/devices/oprom/yabel/mem.c
index 8ca42b0e90..4b4a552813 100644
--- a/src/devices/oprom/yabel/mem.c
+++ b/src/devices/oprom/yabel/mem.c
@@ -19,9 +19,9 @@
#include "mem.h"
#include "compat/time.h"
-#if !defined(CONFIG_YABEL_DIRECTHW) || (!CONFIG_YABEL_DIRECTHW)
+#if !CONFIG_YABEL_DIRECTHW || !CONFIG_YABEL_DIRECTHW
-#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
+#if CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/resource.h>
#endif