Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5346
-gerrit
commit 3fc671f7e4256aae58fb3a6a85d6304b04982a49
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Mon Apr 8 16:48:10 2013 -0700
Rename mainboard vendor Google to GOOGLE
This is what was built into all our products, so make sure
that no utilities get confused by a difference in spelling.
The linux kernel has DMI matching code for GOOGLE. Without
the proper spelling the drivers won't be bound correctly.
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
BUG=none
TEST=emerge-link chromeos-coreboot-link produces a bootable image
BRANCH=none
Change-Id: I96bf3e6076b05824825b46e5d8da5cf0c6e08507
Original-Change-Id: Icef8a5a6f976f9f87cb7e065284541ecaa213c1b
Reviewed-on: https://gerrit.chromium.org/gerrit/47607
Reviewed-by: Ronald G. Minnich <rminnich(a)chromium.org>
Commit-Queue: Stefan Reinauer <reinauer(a)google.com>
Tested-by: Stefan Reinauer <reinauer(a)google.com>
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/mainboard/google/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mainboard/google/Kconfig b/src/mainboard/google/Kconfig
index 85c8592..a66bcf2 100644
--- a/src/mainboard/google/Kconfig
+++ b/src/mainboard/google/Kconfig
@@ -60,6 +60,6 @@ source "src/mainboard/google/stout/Kconfig"
config MAINBOARD_VENDOR
string "Mainboard Vendor"
- default "Google"
+ default "GOOGLE"
endif # VENDOR_GOOGLE
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5257
-gerrit
commit 81cada3cbd92ec41d9dd126f525d443c3cbf3111
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Feb 14 00:30:04 2014 -0600
chromeos: provide option to dynamically allocate ram oops buffer
Fixing the location of the ram oops buffer can lead to certain
kernel and boot loaders being confused when there is a ram
reservation low in the address space. Alternatively provide
a mechanism to allocate the ram oops buffer in cbmem. As cbmem
is usually high in the address space it avoids low reservation
confusion.
The patch uncondtionally provides a GOOG9999 ACPI device with
a single memory resource describing the memory region used for
the ramoops region.
BUG=None
BRANCH=baytrail,haswell
TEST=Built and booted with and w/o dynamic ram oops. With
the corresponding kernel change things behave correctly.
Change-Id: Ide2bb4434768c9f9b90e125adae4324cb1d2d073
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/cbmem.h | 1 +
src/lib/cbmem_info.c | 1 +
src/vendorcode/google/chromeos/Kconfig | 7 +-
src/vendorcode/google/chromeos/Makefile.inc | 1 +
src/vendorcode/google/chromeos/acpi/chromeos.asl | 2 +
src/vendorcode/google/chromeos/acpi/gnvs.asl | 4 +-
src/vendorcode/google/chromeos/acpi/ramoops.asl | 43 ++++++++++
src/vendorcode/google/chromeos/chromeos.h | 15 ++++
src/vendorcode/google/chromeos/gnvs.c | 2 +
src/vendorcode/google/chromeos/gnvs.h | 4 +-
src/vendorcode/google/chromeos/ramoops.c | 99 ++++++++++++++++++++++++
11 files changed, 176 insertions(+), 3 deletions(-)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 7cb12b2..f103b30 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -62,6 +62,7 @@
#define CBMEM_ID_REFCODE 0x04efc0de
#define CBMEM_ID_REFCODE_CACHE 0x4efc0de5
#define CBMEM_ID_SMM_SAVE_SPACE 0x07e9acee
+#define CBMEM_ID_RAM_OOPS 0x05430095
#define CBMEM_ID_NONE 0x00000000
#define CBMEM_ID_AGESA_RUNTIME 0x41474553
#define CBMEM_ID_HOB_POINTER 0x484f4221
diff --git a/src/lib/cbmem_info.c b/src/lib/cbmem_info.c
index 339e6b9..42348e4 100644
--- a/src/lib/cbmem_info.c
+++ b/src/lib/cbmem_info.c
@@ -52,6 +52,7 @@ static struct cbmem_id_to_name {
{ CBMEM_ID_REFCODE, "REFCODE " },
{ CBMEM_ID_SMM_SAVE_SPACE, "SMM BACKUP " },
{ CBMEM_ID_REFCODE_CACHE, "REFCODE $ " },
+ { CBMEM_ID_RAM_OOPS, "RAMOOPS " },
};
void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig
index 2f17b7e..ed358f8 100644
--- a/src/vendorcode/google/chromeos/Kconfig
+++ b/src/vendorcode/google/chromeos/Kconfig
@@ -53,10 +53,15 @@ config CHROMEOS_RAMOOPS
bool "Reserve space for Chrome OS ramoops"
default y
+config CHROMEOS_RAMOOPS_DYNAMIC
+ bool "Allocate RAM oops buffer in cbmem"
+ default n
+ depends on CHROMEOS_RAMOOPS
+
config CHROMEOS_RAMOOPS_RAM_START
hex "Physical address of preserved RAM"
default 0x00f00000
- depends on CHROMEOS_RAMOOPS
+ depends on CHROMEOS_RAMOOPS && !CHROMEOS_RAMOOPS_DYNAMIC
config CHROMEOS_RAMOOPS_RAM_SIZE
hex "Size of preserved RAM"
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index 4fa22ea..007bd57 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -25,6 +25,7 @@ romstage-$(CONFIG_ARCH_X86) += vboot.c
ramstage-y += gnvs.c
romstage-y += fmap.c
ramstage-y += fmap.c
+ramstage-$(CONFIG_CHROMEOS_RAMOOPS) += ramoops.c
smm-y += fmap.c
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/chromeos.c),)
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/chromeos.c
diff --git a/src/vendorcode/google/chromeos/acpi/chromeos.asl b/src/vendorcode/google/chromeos/acpi/chromeos.asl
index 278296c..8f63f12 100644
--- a/src/vendorcode/google/chromeos/acpi/chromeos.asl
+++ b/src/vendorcode/google/chromeos/acpi/chromeos.asl
@@ -107,3 +107,5 @@ Device (CRHW)
Return (TSLM)
}
}
+
+#include "ramoops.asl"
diff --git a/src/vendorcode/google/chromeos/acpi/gnvs.asl b/src/vendorcode/google/chromeos/acpi/gnvs.asl
index dc4a0bf..5377a85 100644
--- a/src/vendorcode/google/chromeos/acpi/gnvs.asl
+++ b/src/vendorcode/google/chromeos/acpi/gnvs.asl
@@ -34,4 +34,6 @@ VBT9, 32, // 0x196 - FMAP base address
CHVD, 24576, // 0x19a - VDAT space filled by verified boot
VBTA, 32, // 0xd9a - pointer to smbios FWID
MEHH, 256, // 0xd9e - Management Engine Hash
- // 0xdbe
+RMOB, 32, // 0xdbe - RAM oops base address
+RMOL, 32, // 0xdc2 - RAM oops length
+ // 0xdc6
diff --git a/src/vendorcode/google/chromeos/acpi/ramoops.asl b/src/vendorcode/google/chromeos/acpi/ramoops.asl
new file mode 100644
index 0000000..e435489
--- /dev/null
+++ b/src/vendorcode/google/chromeos/acpi/ramoops.asl
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+Scope (\_SB)
+{
+ Device(RMOP)
+ {
+ Name (_HID, "GOOG9999")
+ Name (_CID, "GOOG9999")
+ Name (_UID, 1)
+
+ Name (RBUF, ResourceTemplate()
+ {
+ Memory32Fixed (ReadWrite, 0, 0, MRES)
+ })
+
+ Method (_CRS)
+ {
+ CreateDwordField (^RBUF, ^MRES._BAS, RBAS)
+ CreateDwordField (^RBUF, ^MRES._LEN, RLEN)
+ Store (\RMOB, RBAS)
+ Store (\RMOL, RLEN)
+ Return (^RBUF)
+ }
+ }
+}
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 7fe8f06..2a781ef 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -51,4 +51,19 @@ void init_chromeos(int bootmode);
int vboot_get_handoff_info(void **addr, uint32_t *size);
#endif
+#if CONFIG_CHROMEOS_RAMOOPS
+#include "gnvs.h"
+struct device;
+
+void chromeos_ram_oops_init(chromeos_acpi_t *chromeos);
+#if CONFIG_CHROMEOS_RAMOOPS_DYNAMIC
+static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {}
+#else /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
+void chromeos_reserve_ram_oops(struct device *dev, int idx);
+#endif /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
+#else /* !CONFIG_CHROMEOS_RAMOOPS */
+static inline void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) {}
+static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {}
+#endif /* CONFIG_CHROMEOS_RAMOOPS */
+
#endif
diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c
index 9f51097..528143c 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -72,6 +72,8 @@ void chromeos_init_vboot(chromeos_acpi_t *chromeos)
reason ? reason : ELOG_CROS_RECOVERY_MODE_BUTTON);
}
#endif
+
+ chromeos_ram_oops_init(chromeos);
}
void chromeos_set_me_hash(u32 *hash, int len)
diff --git a/src/vendorcode/google/chromeos/gnvs.h b/src/vendorcode/google/chromeos/gnvs.h
index 00fe443..fe7d77a 100644
--- a/src/vendorcode/google/chromeos/gnvs.h
+++ b/src/vendorcode/google/chromeos/gnvs.h
@@ -58,7 +58,9 @@ typedef struct {
u8 vdat[3072]; // 19a
u32 vbt10; // d9a smbios bios version
u32 mehh[8]; // d9e management engine hash
- // dbe
+ u32 ramoops_base; // dbe ramoops base address
+ u32 ramoops_len; // dc2 ramoops length
+ u8 pad[314]; // dc6-eff
} __attribute__((packed)) chromeos_acpi_t;
extern chromeos_acpi_t *vboot_data;
diff --git a/src/vendorcode/google/chromeos/ramoops.c b/src/vendorcode/google/chromeos/ramoops.c
new file mode 100644
index 0000000..500bc90
--- /dev/null
+++ b/src/vendorcode/google/chromeos/ramoops.c
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include <stddef.h>
+#include <stdint.h>
+#include <bootstate.h>
+#include <console/console.h>
+#include <cbmem.h>
+#include <device/device.h>
+#include "chromeos.h"
+
+static void set_ramoops(chromeos_acpi_t *chromeos, void *ram_oops, size_t size)
+{
+ if (chromeos == NULL) {
+ printk(BIOS_DEBUG, "chromeos gnvs is NULL. ramoops not set.\n");
+ return;
+ }
+
+ printk(BIOS_DEBUG, "Ramoops buffer: 0x%zx(a)0x%p.\n", size, ram_oops);
+ chromeos->ramoops_base = (uintptr_t)ram_oops;
+ chromeos->ramoops_len = size;
+}
+
+static void reserve_ram_oops_dynamic(chromeos_acpi_t *chromeos)
+{
+ const size_t size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
+ void *ram_oops;
+
+ if (!IS_ENABLED(CONFIG_CHROMEOS_RAMOOPS_DYNAMIC))
+ return;
+
+ ram_oops = cbmem_add(CBMEM_ID_RAM_OOPS, size);
+
+ set_ramoops(chromeos, ram_oops, size);
+}
+
+#if CONFIG_CHROMEOS_RAMOOPS_DYNAMIC
+static inline void set_global_chromeos_pointer(chromeos_acpi_t *chromeos) {}
+#else /* !CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
+
+static const unsigned long ramoops_base = CONFIG_CHROMEOS_RAMOOPS_RAM_START;
+static const unsigned long ramoops_size = CONFIG_CHROMEOS_RAMOOPS_RAM_SIZE;
+
+/*
+ * Save pointer to chromeos structure in memory. This is needed because the
+ * memory reservation is not done when chromeos_init() is called. However,
+ * the pointer to the chromeos_acpi_t structure is needed to update the
+ * fields with the rserved base and size.
+ */
+static chromeos_acpi_t *g_chromeos;
+
+static void set_global_chromeos_pointer(chromeos_acpi_t *chromeos)
+{
+ g_chromeos = chromeos;
+}
+
+static void update_gnvs(void *arg)
+{
+ chromeos_acpi_t **chromeos = arg;
+
+ set_ramoops(*chromeos, (void *)ramoops_base, ramoops_size);
+}
+
+static BOOT_STATE_CALLBACK(bscb_ramoops, update_gnvs, &g_chromeos);
+
+void chromeos_reserve_ram_oops(struct device *dev, int idx)
+{
+ const unsigned long base = ramoops_base >> 10;
+ const unsigned long size = ramoops_size >> 10;
+
+ reserved_ram_resource(dev, idx, base, size);
+
+ boot_state_sched_on_exit(&bscb_ramoops, BS_WRITE_TABLES);
+}
+#endif /* CONFIG_CHROMEOS_RAMOOPS_DYNAMIC */
+
+void chromeos_ram_oops_init(chromeos_acpi_t *chromeos)
+{
+ set_global_chromeos_pointer(chromeos);
+ reserve_ram_oops_dynamic(chromeos);
+}
+
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5329
-gerrit
commit 5a17088f0d682d0eb50632f8d898ec72942c8f7f
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Fri Feb 28 15:15:12 2014 +0200
OxPCIe uart: Move under drivers/uart
This driver is only a thin shell for uart8250mem and we could extend it
with further compatible PCI IDs from other vendors/brands.
Change-Id: Ic115b1baa0be0dbaa81e4a17a2e466019d3f4a67
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/drivers/Kconfig | 1 -
src/drivers/Makefile.inc | 1 -
src/drivers/oxford/Kconfig | 1 -
src/drivers/oxford/Makefile.inc | 1 -
src/drivers/oxford/oxpcie/Kconfig | 10 ---
src/drivers/oxford/oxpcie/Makefile.inc | 4 --
src/drivers/oxford/oxpcie/oxpcie.c | 73 --------------------
src/drivers/oxford/oxpcie/oxpcie_early.c | 111 -------------------------------
src/drivers/uart/Kconfig | 11 +++
src/drivers/uart/Makefile.inc | 5 ++
src/drivers/uart/oxpcie.c | 73 ++++++++++++++++++++
src/drivers/uart/oxpcie_early.c | 111 +++++++++++++++++++++++++++++++
12 files changed, 200 insertions(+), 202 deletions(-)
diff --git a/src/drivers/Kconfig b/src/drivers/Kconfig
index 5267ff8..1a5f8ff 100644
--- a/src/drivers/Kconfig
+++ b/src/drivers/Kconfig
@@ -27,7 +27,6 @@ source src/drivers/ics/Kconfig
source src/drivers/intel/Kconfig
source src/drivers/ipmi/Kconfig
source src/drivers/maxim/Kconfig
-source src/drivers/oxford/Kconfig
source src/drivers/parade/Kconfig
if PC80_SYSTEM
source src/drivers/pc80/Kconfig
diff --git a/src/drivers/Makefile.inc b/src/drivers/Makefile.inc
index 148e257..f11e4b8 100644
--- a/src/drivers/Makefile.inc
+++ b/src/drivers/Makefile.inc
@@ -25,7 +25,6 @@ subdirs-y += i2c
subdirs-y += intel
subdirs-y += maxim
subdirs-y += net
-subdirs-y += oxford
subdirs-y += parade
subdirs-y += realtek
subdirs-y += sil
diff --git a/src/drivers/oxford/Kconfig b/src/drivers/oxford/Kconfig
deleted file mode 100644
index cd7c27c..0000000
--- a/src/drivers/oxford/Kconfig
+++ /dev/null
@@ -1 +0,0 @@
-source src/drivers/oxford/oxpcie/Kconfig
diff --git a/src/drivers/oxford/Makefile.inc b/src/drivers/oxford/Makefile.inc
deleted file mode 100644
index 732face..0000000
--- a/src/drivers/oxford/Makefile.inc
+++ /dev/null
@@ -1 +0,0 @@
-subdirs-$(CONFIG_DRIVERS_OXFORD_OXPCIE) += oxpcie
diff --git a/src/drivers/oxford/oxpcie/Kconfig b/src/drivers/oxford/oxpcie/Kconfig
deleted file mode 100644
index c2ea7b6..0000000
--- a/src/drivers/oxford/oxpcie/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-config DRIVERS_OXFORD_OXPCIE
- bool "Oxford OXPCIe952"
- default n
- depends on PCI
- select DRIVERS_UART_8250MEM
- select EARLY_PCI_BRIDGE
- help
- Support for Oxford OXPCIe952 serial port PCIe cards.
- Currently only devices with the vendor ID 0x1415 and device ID
- 0xc158 or 0xc11b will work.
diff --git a/src/drivers/oxford/oxpcie/Makefile.inc b/src/drivers/oxford/oxpcie/Makefile.inc
deleted file mode 100644
index 5e3e6e5..0000000
--- a/src/drivers/oxford/oxpcie/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-ifeq ($(CONFIG_CONSOLE_SERIAL),y)
-ramstage-y += oxpcie_early.c oxpcie.c
-romstage-y += oxpcie_early.c
-endif
diff --git a/src/drivers/oxford/oxpcie/oxpcie.c b/src/drivers/oxford/oxpcie/oxpcie.c
deleted file mode 100644
index 76119d2..0000000
--- a/src/drivers/oxford/oxpcie/oxpcie.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2011 Google Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <device/device.h>
-#include <device/pci_def.h>
-#include <device/pci.h>
-#include <device/pci_ids.h>
-#include <console/console.h>
-#include <console/uart.h>
-#include <arch/io.h>
-
-static void oxford_oxpcie_enable(device_t dev)
-{
- printk(BIOS_DEBUG, "Initializing Oxford OXPCIe952\n");
-
- struct resource *res = find_resource(dev, 0x10);
- if (!res) {
- printk(BIOS_WARNING, "OXPCIe952: No UART resource found.\n");
- return;
- }
-
- printk(BIOS_DEBUG, "OXPCIe952: Class=%x Revision ID=%x\n",
- (read32(res->base) >> 8), (read32(res->base) & 0xff));
- printk(BIOS_DEBUG, "OXPCIe952: %d UARTs detected.\n",
- (read32(res->base + 4) & 3));
- printk(BIOS_DEBUG, "OXPCIe952: UART BAR: 0x%x\n", (u32)res->base);
-}
-
-
-static void oxford_oxpcie_set_resources(struct device *dev)
-{
- pci_dev_set_resources(dev);
-
- /* Re-initialize OXPCIe base address after set_resources */
- u32 mmio_base = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
- oxford_remap(mmio_base & ~0xf);
-}
-
-static struct device_operations oxford_oxpcie_ops = {
- .read_resources = pci_dev_read_resources,
- .set_resources = oxford_oxpcie_set_resources,
- .enable_resources = pci_dev_enable_resources,
- .init = oxford_oxpcie_enable,
- .scan_bus = 0,
-};
-
-static const struct pci_driver oxford_oxpcie_driver __pci_driver = {
- .ops = &oxford_oxpcie_ops,
- .vendor = 0x1415,
- .device = 0xc158,
-};
-
-static const struct pci_driver oxford_oxpcie_driver_2 __pci_driver = {
- .ops = &oxford_oxpcie_ops,
- .vendor = 0x1415,
- .device = 0xc11b,
-};
diff --git a/src/drivers/oxford/oxpcie/oxpcie_early.c b/src/drivers/oxford/oxpcie/oxpcie_early.c
deleted file mode 100644
index b81fa89..0000000
--- a/src/drivers/oxford/oxpcie/oxpcie_early.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2011 Google Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define __SIMPLE_DEVICE__
-
-#include <stdint.h>
-#include <stddef.h>
-#include <arch/io.h>
-#include <arch/early_variables.h>
-#include <boot/coreboot_tables.h>
-#include <console/uart.h>
-#include <device/pci.h>
-#include <device/pci_def.h>
-
-static unsigned int oxpcie_present CAR_GLOBAL;
-static ROMSTAGE_CONST u32 uart0_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x1000;
-static ROMSTAGE_CONST u32 uart1_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x2000;
-
-int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base)
-{
- pci_devfn_t device = PCI_DEV(bus, dev, 0);
-
- u32 id = pci_read_config32(device, PCI_VENDOR_ID);
- switch (id) {
- case 0xc1181415: /* e.g. Startech PEX1S1PMINI function 0 */
- /* On this device function 0 is the parallel port, and
- * function 3 is the serial port. So let's go look for
- * the UART.
- */
- device = PCI_DEV(bus, dev, 3);
- id = pci_read_config32(device, PCI_VENDOR_ID);
- if (id != 0xc11b1415)
- return -1;
- break;
- case 0xc11b1415: /* e.g. Startech PEX1S1PMINI function 3 */
- case 0xc1581415: /* e.g. Startech MPEX2S952 */
- break;
- default:
- /* No UART here. */
- return -1;
- }
-
- /* Sanity-check, we assume fixed location. */
- if (mmio_base != CONFIG_EARLY_PCI_MMIO_BASE)
- return -1;
-
- /* Setup base address on device */
- pci_write_config32(device, PCI_BASE_ADDRESS_0, mmio_base);
-
- /* Enable memory on device */
- u16 reg16 = pci_read_config16(device, PCI_COMMAND);
- reg16 |= PCI_COMMAND_MEMORY;
- pci_write_config16(device, PCI_COMMAND, reg16);
-
- car_set_var(oxpcie_present, 1);
- return 0;
-}
-
-static int oxpcie_uart_active(void)
-{
- return (car_get_var(oxpcie_present));
-}
-
-unsigned int uart_platform_base(int idx)
-{
- if (idx == 0 && oxpcie_uart_active())
- return uart0_base;
- if (idx == 1 && oxpcie_uart_active())
- return uart1_base;
- return 0;
-}
-
-#ifndef __PRE_RAM__
-void oxford_remap(u32 new_base)
-{
- uart0_base = new_base + 0x1000;
- uart1_base = new_base + 0x2000;
-}
-
-void uart_fill_lb(void *data)
-{
- struct lb_serial serial;
- serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
- serial.baseaddr = uart_platform_base(0);
- serial.baud = default_baudrate();
- lb_add_serial(&serial, data);
-
- lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
-}
-#endif
-
-unsigned int uart_platform_refclk(void)
-{
- return 62500000;
-}
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index 889c69a..a979437 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -21,6 +21,17 @@ config HAVE_UART_SPECIAL
bool
default n
+config DRIVERS_UART_OXPCIE
+ bool "Oxford OXPCIe952"
+ default n
+ depends on PCI
+ select DRIVERS_UART_8250MEM
+ select EARLY_PCI_BRIDGE
+ help
+ Support for Oxford OXPCIe952 serial port PCIe cards.
+ Currently only devices with the vendor ID 0x1415 and device ID
+ 0xc158 or 0xc11b will work.
+
config DRIVERS_UART_PL011
bool
default n
diff --git a/src/drivers/uart/Makefile.inc b/src/drivers/uart/Makefile.inc
index 286bff2..5164282 100644
--- a/src/drivers/uart/Makefile.inc
+++ b/src/drivers/uart/Makefile.inc
@@ -18,6 +18,11 @@ ramstage-y += uart8250mem.c
smm-$(CONFIG_DEBUG_SMI) += uart8250mem.c
endif
+ifeq ($(CONFIG_DRIVERS_UART_OXPCIE),y)
+ramstage-y += oxpcie_early.c oxpcie.c
+romstage-y += oxpcie_early.c
+endif
+
ifeq ($(CONFIG_DRIVERS_UART_PL011),y)
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += pl011.c
romstage-$(CONFIG_EARLY_CONSOLE) += pl011.c
diff --git a/src/drivers/uart/oxpcie.c b/src/drivers/uart/oxpcie.c
new file mode 100644
index 0000000..76119d2
--- /dev/null
+++ b/src/drivers/uart/oxpcie.c
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Google Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <device/device.h>
+#include <device/pci_def.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <console/console.h>
+#include <console/uart.h>
+#include <arch/io.h>
+
+static void oxford_oxpcie_enable(device_t dev)
+{
+ printk(BIOS_DEBUG, "Initializing Oxford OXPCIe952\n");
+
+ struct resource *res = find_resource(dev, 0x10);
+ if (!res) {
+ printk(BIOS_WARNING, "OXPCIe952: No UART resource found.\n");
+ return;
+ }
+
+ printk(BIOS_DEBUG, "OXPCIe952: Class=%x Revision ID=%x\n",
+ (read32(res->base) >> 8), (read32(res->base) & 0xff));
+ printk(BIOS_DEBUG, "OXPCIe952: %d UARTs detected.\n",
+ (read32(res->base + 4) & 3));
+ printk(BIOS_DEBUG, "OXPCIe952: UART BAR: 0x%x\n", (u32)res->base);
+}
+
+
+static void oxford_oxpcie_set_resources(struct device *dev)
+{
+ pci_dev_set_resources(dev);
+
+ /* Re-initialize OXPCIe base address after set_resources */
+ u32 mmio_base = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
+ oxford_remap(mmio_base & ~0xf);
+}
+
+static struct device_operations oxford_oxpcie_ops = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = oxford_oxpcie_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = oxford_oxpcie_enable,
+ .scan_bus = 0,
+};
+
+static const struct pci_driver oxford_oxpcie_driver __pci_driver = {
+ .ops = &oxford_oxpcie_ops,
+ .vendor = 0x1415,
+ .device = 0xc158,
+};
+
+static const struct pci_driver oxford_oxpcie_driver_2 __pci_driver = {
+ .ops = &oxford_oxpcie_ops,
+ .vendor = 0x1415,
+ .device = 0xc11b,
+};
diff --git a/src/drivers/uart/oxpcie_early.c b/src/drivers/uart/oxpcie_early.c
new file mode 100644
index 0000000..b81fa89
--- /dev/null
+++ b/src/drivers/uart/oxpcie_early.c
@@ -0,0 +1,111 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Google Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define __SIMPLE_DEVICE__
+
+#include <stdint.h>
+#include <stddef.h>
+#include <arch/io.h>
+#include <arch/early_variables.h>
+#include <boot/coreboot_tables.h>
+#include <console/uart.h>
+#include <device/pci.h>
+#include <device/pci_def.h>
+
+static unsigned int oxpcie_present CAR_GLOBAL;
+static ROMSTAGE_CONST u32 uart0_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x1000;
+static ROMSTAGE_CONST u32 uart1_base = CONFIG_EARLY_PCI_MMIO_BASE + 0x2000;
+
+int pci_early_device_probe(u8 bus, u8 dev, u32 mmio_base)
+{
+ pci_devfn_t device = PCI_DEV(bus, dev, 0);
+
+ u32 id = pci_read_config32(device, PCI_VENDOR_ID);
+ switch (id) {
+ case 0xc1181415: /* e.g. Startech PEX1S1PMINI function 0 */
+ /* On this device function 0 is the parallel port, and
+ * function 3 is the serial port. So let's go look for
+ * the UART.
+ */
+ device = PCI_DEV(bus, dev, 3);
+ id = pci_read_config32(device, PCI_VENDOR_ID);
+ if (id != 0xc11b1415)
+ return -1;
+ break;
+ case 0xc11b1415: /* e.g. Startech PEX1S1PMINI function 3 */
+ case 0xc1581415: /* e.g. Startech MPEX2S952 */
+ break;
+ default:
+ /* No UART here. */
+ return -1;
+ }
+
+ /* Sanity-check, we assume fixed location. */
+ if (mmio_base != CONFIG_EARLY_PCI_MMIO_BASE)
+ return -1;
+
+ /* Setup base address on device */
+ pci_write_config32(device, PCI_BASE_ADDRESS_0, mmio_base);
+
+ /* Enable memory on device */
+ u16 reg16 = pci_read_config16(device, PCI_COMMAND);
+ reg16 |= PCI_COMMAND_MEMORY;
+ pci_write_config16(device, PCI_COMMAND, reg16);
+
+ car_set_var(oxpcie_present, 1);
+ return 0;
+}
+
+static int oxpcie_uart_active(void)
+{
+ return (car_get_var(oxpcie_present));
+}
+
+unsigned int uart_platform_base(int idx)
+{
+ if (idx == 0 && oxpcie_uart_active())
+ return uart0_base;
+ if (idx == 1 && oxpcie_uart_active())
+ return uart1_base;
+ return 0;
+}
+
+#ifndef __PRE_RAM__
+void oxford_remap(u32 new_base)
+{
+ uart0_base = new_base + 0x1000;
+ uart1_base = new_base + 0x2000;
+}
+
+void uart_fill_lb(void *data)
+{
+ struct lb_serial serial;
+ serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
+ serial.baseaddr = uart_platform_base(0);
+ serial.baud = default_baudrate();
+ lb_add_serial(&serial, data);
+
+ lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
+}
+#endif
+
+unsigned int uart_platform_refclk(void)
+{
+ return 62500000;
+}