summaryrefslogtreecommitdiff
path: root/src/arch/i386/lib
diff options
context:
space:
mode:
authorYinghai Lu <yinghailu@gmail.com>2006-10-04 22:56:21 +0000
committerYinghai Lu <yinghailu@gmail.com>2006-10-04 22:56:21 +0000
commit5f9624d211a247c032a31b22c3b47158f7083c9e (patch)
treeebb62857cc949d561338d5b38b249523d700c714 /src/arch/i386/lib
parent93a5a194c5863262ed9b9fabc4cd40efcf1fddd9 (diff)
CONFIG_USE_PRINTK_IN_CAR and ht chain id for HTX support in
serengeti_cheeatah git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2439 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/arch/i386/lib')
-rw-r--r--src/arch/i386/lib/Config.lb6
-rw-r--r--src/arch/i386/lib/console.c2
-rw-r--r--src/arch/i386/lib/pci_ops_conf1.c4
-rw-r--r--src/arch/i386/lib/pci_ops_mmconf.c63
4 files changed, 73 insertions, 2 deletions
diff --git a/src/arch/i386/lib/Config.lb b/src/arch/i386/lib/Config.lb
index 023c0312ff..e7d895ccc2 100644
--- a/src/arch/i386/lib/Config.lb
+++ b/src/arch/i386/lib/Config.lb
@@ -1,13 +1,17 @@
uses CONFIG_USE_INIT
+uses CONFIG_USE_PRINTK_IN_CAR
object c_start.S
object cpu.c
object pci_ops_conf1.c
object pci_ops_conf2.c
+object pci_ops_mmconf.c
object pci_ops_auto.c
object exception.c
if CONFIG_USE_INIT
- initobject printk_init.o
+ if CONFIG_USE_PRINTK_IN_CAR
+ initobject printk_init.o
+ end
end
diff --git a/src/arch/i386/lib/console.c b/src/arch/i386/lib/console.c
index a1f5d6f2a4..262a0db2f4 100644
--- a/src/arch/i386/lib/console.c
+++ b/src/arch/i386/lib/console.c
@@ -1,6 +1,6 @@
#include <console/loglevel.h>
-#if CONFIG_USE_INIT == 0
+#if CONFIG_USE_PRINTK_IN_CAR == 0
static void __console_tx_byte(unsigned char byte)
{
uart_tx_byte(byte);
diff --git a/src/arch/i386/lib/pci_ops_conf1.c b/src/arch/i386/lib/pci_ops_conf1.c
index b4181e39bc..4c4cd672e6 100644
--- a/src/arch/i386/lib/pci_ops_conf1.c
+++ b/src/arch/i386/lib/pci_ops_conf1.c
@@ -8,7 +8,11 @@
* Functions for accessing PCI configuration space with type 1 accesses
*/
+#if PCI_IO_CFG_EXT == 0
#define CONFIG_CMD(bus,devfn, where) (0x80000000 | (bus << 16) | (devfn << 8) | (where & ~3))
+#else
+#define CONFIG_CMD(bus,devfn, where) (0x80000000 | (bus << 16) | (devfn << 8) | ((where & 0xff) & ~3) | ((where & 0xf00)<<16) )
+#endif
static uint8_t pci_conf1_read_config8(struct bus *pbus, int bus, int devfn, int where)
{
diff --git a/src/arch/i386/lib/pci_ops_mmconf.c b/src/arch/i386/lib/pci_ops_mmconf.c
new file mode 100644
index 0000000000..5095c31cd7
--- /dev/null
+++ b/src/arch/i386/lib/pci_ops_mmconf.c
@@ -0,0 +1,63 @@
+#if MMCONF_SUPPORT
+
+#include <console/console.h>
+#include <arch/io.h>
+#include <arch/pciconf.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+
+
+/*
+ * Functions for accessing PCI configuration space with mmconf accesses
+ */
+
+#define PCI_MMIO_ADDR(SEGBUS, DEVFN, WHERE) ( \
+ (((SEGBUS) & 0xFFF) << 20) | \
+ (((DEVFN) & 0xFF) << 12) | \
+ ((WHERE) & 0xFFF))
+
+#include <arch/mmio_conf.h>
+
+static uint8_t pci_mmconf_read_config8(struct bus *pbus, int bus, int devfn, int where)
+{
+ return (read8x(PCI_MMIO_ADDR(bus, devfn, where)));
+}
+
+static uint16_t pci_mmconf_read_config16(struct bus *pbus, int bus, int devfn, int where)
+{
+ return (read16x(PCI_MMIO_ADDR(bus, devfn, where)));
+}
+
+static uint32_t pci_mmconf_read_config32(struct bus *pbus, int bus, int devfn, int where)
+{
+ return (read32x(PCI_MMIO_ADDR(bus, devfn, where)));
+}
+
+static void pci_mmconf_write_config8(struct bus *pbus, int bus, int devfn, int where, uint8_t value)
+{
+ write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
+}
+
+static void pci_mmconf_write_config16(struct bus *pbus, int bus, int devfn, int where, uint16_t value)
+{
+ write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
+}
+
+static void pci_mmconf_write_config32(struct bus *pbus, int bus, int devfn, int where, uint32_t value)
+{
+ write8x(PCI_MMIO_ADDR(bus, devfn, where), value);
+}
+
+
+const struct pci_bus_operations pci_ops_mmconf =
+{
+ .read8 = pci_mmconf_read_config8,
+ .read16 = pci_mmconf_read_config16,
+ .read32 = pci_mmconf_read_config32,
+ .write8 = pci_mmconf_write_config8,
+ .write16 = pci_mmconf_write_config16,
+ .write32 = pci_mmconf_write_config32,
+};
+
+#endif