x86: Unify arch/io.h and arch/romcc_io.h
Here's the great news: From now on you don't have to worry about
hitting the right io.h include anymore. Just forget about romcc_io.h
and use io.h instead. This cleanup has a number of advantages, like
you don't have to guard device/ includes for SMM and pre RAM
anymore. This allows to get rid of a number of ifdefs and will
generally make the code more readable and understandable.
Potentially in the future some of the code in the io.h __PRE_RAM__
path should move to device.h or other device/ includes instead,
but that's another incremental change.
Change-Id: I356f06110e2e355e9a5b4b08c132591f36fec7d9
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/2872
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
diff --git a/src/include/device/device.h b/src/include/device/device.h
index b248aaf..5219310 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -1,6 +1,7 @@
#ifndef DEVICE_H
#define DEVICE_H
+#ifndef __SMM__
#include <stdint.h>
#include <stddef.h>
#include <device/resource.h>
@@ -222,4 +223,7 @@
ROMSTAGE_CONST struct device * dev_find_slot_on_smbus (unsigned int bus,
unsigned int addr);
#endif
+#else /* __SMM__ */
+#include <arch/io.h>
+#endif /* __SMM__ */
#endif /* DEVICE_H */
diff --git a/src/include/device/pci.h b/src/include/device/pci.h
index 132c48c..1f47daf 100644
--- a/src/include/device/pci.h
+++ b/src/include/device/pci.h
@@ -20,7 +20,7 @@
#include <device/pci_def.h>
#include <device/resource.h>
#include <device/device.h>
-#ifndef __PRE_RAM__
+#if !defined(__PRE_RAM__) && !defined(__SMM__)
#include <device/pci_ops.h>
#include <device/pci_rom.h>
diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h
index 2efbf9d..20fbb99 100644
--- a/src/include/device/pci_ops.h
+++ b/src/include/device/pci_ops.h
@@ -1,6 +1,7 @@
#ifndef PCI_OPS_H
#define PCI_OPS_H
+#ifndef __SMM__
#include <stdint.h>
#include <device/device.h>
#include <arch/pci_ops.h>
@@ -20,5 +21,6 @@
void pci_mmio_write_config16(device_t dev, unsigned int where, u16 val);
void pci_mmio_write_config32(device_t dev, unsigned int where, u32 val);
#endif
+#endif
#endif /* PCI_OPS_H */
diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h
index 7eb2ac5..f97b05d 100644
--- a/src/include/device/pnp.h
+++ b/src/include/device/pnp.h
@@ -5,6 +5,7 @@
#include <device/device.h>
#include <device/pnp_def.h>
+#if !defined(__PRE_RAM__) && !defined(__SMM__)
/* Primitive PNP resource manipulation */
void pnp_write_config(device_t dev, u8 reg, u8 value);
u8 pnp_read_config(device_t dev, u8 reg);
@@ -50,4 +51,5 @@
void pnp_enable_devices(struct device *dev, struct device_operations *ops,
unsigned int functions, struct pnp_info *info);
+#endif
#endif /* DEVICE_PNP_H */