Damien Zammit (damien(a)zamaudio.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10073
-gerrit
commit 5646b02df644de6da82c0adfee1059afa48c562e
Author: Damien Zammit <damien(a)zamaudio.com>
Date: Sun May 3 21:34:38 2015 +1000
northbridge/intel/pineview: Add minimal Pineview northbridge
Based on i945. Tested on Intel D510MO mainboard,
board boots to UART console with this code.
Change-Id: I1d92a1aa6d6d767bda8379807dc26b50b9de75c9
Signed-off-by: Damien Zammit <damien(a)zamaudio.com>
---
src/northbridge/intel/pineview/Kconfig | 39 ++++++++++
src/northbridge/intel/pineview/Makefile.inc | 24 ++++++
src/northbridge/intel/pineview/acpi.c | 67 ++++++++++++++++
src/northbridge/intel/pineview/bootblock.c | 8 ++
src/northbridge/intel/pineview/iomap.h | 27 +++++++
src/northbridge/intel/pineview/pineview.h | 116 ++++++++++++++++++++++++++++
src/northbridge/intel/pineview/ram_calc.c | 58 ++++++++++++++
7 files changed, 339 insertions(+)
diff --git a/src/northbridge/intel/pineview/Kconfig b/src/northbridge/intel/pineview/Kconfig
new file mode 100644
index 0000000..6253b84
--- /dev/null
+++ b/src/northbridge/intel/pineview/Kconfig
@@ -0,0 +1,39 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2007-2009 coresystems GmbH
+## Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+##
+## 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.
+##
+
+config NORTHBRIDGE_INTEL_PINEVIEW
+ bool
+
+if NORTHBRIDGE_INTEL_PINEVIEW
+
+config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select MMCONF_SUPPORT
+ select MMCONF_SUPPORT_DEFAULT
+ select HAVE_DEBUG_RAM_SETUP
+ select LAPIC_MONOTONIC_TIMER
+ select VGA
+ select PER_DEVICE_ACPI_TABLES
+
+config BOOTBLOCK_NORTHBRIDGE_INIT
+ string
+ default "northbridge/intel/pineview/bootblock.c"
+
+config VGA_BIOS_ID
+ string
+ default "8086,a001"
+
+endif
diff --git a/src/northbridge/intel/pineview/Makefile.inc b/src/northbridge/intel/pineview/Makefile.inc
new file mode 100644
index 0000000..9330b17
--- /dev/null
+++ b/src/northbridge/intel/pineview/Makefile.inc
@@ -0,0 +1,24 @@
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2007-2009 coresystems GmbH
+# Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+#
+# 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.
+#
+
+ifeq ($(CONFIG_NORTHBRIDGE_INTEL_PINEVIEW),y)
+
+ramstage-y += ram_calc.c
+ramstage-y += acpi.c
+
+romstage-y += ram_calc.c
+
+endif
diff --git a/src/northbridge/intel/pineview/acpi.c b/src/northbridge/intel/pineview/acpi.c
new file mode 100644
index 0000000..f29d235
--- /dev/null
+++ b/src/northbridge/intel/pineview/acpi.c
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+ *
+ * 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.
+ */
+
+#include <arch/acpigen.h>
+#include <arch/acpi.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <northbridge/intel/pineview/pineview.h>
+#include <types.h>
+
+unsigned long acpi_fill_mcfg(unsigned long current)
+{
+ device_t dev;
+ u32 pciexbar = 0;
+ u32 pciexbar_reg;
+ u32 reg32;
+ int max_buses;
+ const struct {
+ u16 num_buses;
+ u32 addr_mask;
+ } busmask[] = {
+ {256, 0xff000000},
+ {128, 0xf8000000},
+ {64, 0xfc000000},
+ {0, 0},
+ };
+
+ dev = dev_find_slot(0, PCI_DEVFN(0,0));
+ if (!dev)
+ return current;
+
+ pciexbar_reg = pci_read_config32(dev, PCIEXBAR);
+
+ // MMCFG not supported or not enabled.
+ if (!(pciexbar_reg & (1 << 0))) {
+ printk(BIOS_WARNING, "WARNING: MMCONF not set\n");
+ return current;
+ }
+
+ reg32 = (pciexbar_reg >> 1) & 3;
+ pciexbar = pciexbar_reg & busmask[reg32].addr_mask;
+ max_buses = busmask[reg32].num_buses;
+
+ if (!pciexbar) {
+ printk(BIOS_WARNING, "WARNING: pciexbar invalid\n");
+ return current;
+ }
+
+ current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *) current,
+ pciexbar, 0x0, 0x0, max_buses - 1);
+
+ return current;
+}
diff --git a/src/northbridge/intel/pineview/bootblock.c b/src/northbridge/intel/pineview/bootblock.c
new file mode 100644
index 0000000..1c04c28
--- /dev/null
+++ b/src/northbridge/intel/pineview/bootblock.c
@@ -0,0 +1,8 @@
+#include <arch/io.h>
+#define PCIEXBAR 0x60
+
+static void bootblock_northbridge_init(void)
+{
+ pci_io_write_config32(PCI_DEV(0,0,0), PCIEXBAR,
+ CONFIG_MMCONF_BASE_ADDRESS | 4 | 1);
+}
diff --git a/src/northbridge/intel/pineview/iomap.h b/src/northbridge/intel/pineview/iomap.h
new file mode 100644
index 0000000..6cced82
--- /dev/null
+++ b/src/northbridge/intel/pineview/iomap.h
@@ -0,0 +1,27 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef PINEVIEW_IOMAP_H
+#define PINEVIEW_IOMAP_H
+
+/* 4 KB per PCIe device */
+#define DEFAULT_PCIEXBAR CONFIG_MMCONF_BASE_ADDRESS
+
+#define DEFAULT_MCHBAR 0xfed14000 /* 16 KB */
+#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
+#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
+
+#endif /* PINEVIEW_IOMAP_H */
diff --git a/src/northbridge/intel/pineview/pineview.h b/src/northbridge/intel/pineview/pineview.h
new file mode 100644
index 0000000..4b3b0b1
--- /dev/null
+++ b/src/northbridge/intel/pineview/pineview.h
@@ -0,0 +1,116 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef NORTHBRIDGE_INTEL_PINEVIEW_H
+#define NORTHBRIDGE_INTEL_PINEVIEW_H
+
+#include <northbridge/intel/pineview/iomap.h>
+#include <southbridge/intel/i82801gx/i82801gx.h>
+
+/* Device 0:0.0 PCI configuration space (Host Bridge) */
+
+#define EPBAR 0x40
+#define MCHBAR 0x48
+#define PCIEXBAR 0x60
+#define DMIBAR 0x68
+#define PMIOBAR 0x78
+
+#define GGC 0x52 /* GMCH Graphics Control */
+
+#define DEVEN 0x54 /* Device Enable */
+#define DEVEN_D0F0 (1 << 0)
+#define DEVEN_D1F0 (1 << 1)
+#define DEVEN_D2F0 (1 << 3)
+#define DEVEN_D2F1 (1 << 4)
+
+#ifndef BOARD_DEVEN
+#define BOARD_DEVEN ( DEVEN_D0F0 | DEVEN_D2F0 | DEVEN_D2F1 )
+#endif /* BOARD_DEVEN */
+
+#define PAM0 0x90
+#define PAM1 0x91
+#define PAM2 0x92
+#define PAM3 0x93
+#define PAM4 0x94
+#define PAM5 0x95
+#define PAM6 0x96
+
+#define LAC 0x97 /* Legacy Access Control */
+#define REMAPBASE 0x98
+#define REMAPLIMIT 0x9a
+#define SMRAM 0x9d /* System Management RAM Control */
+#define ESMRAM 0x9e /* Extended System Management RAM Control */
+
+#define TOM 0xa0
+#define TOUUD 0xa2
+#define GBSM 0xa4
+#define BGSM 0xa8
+#define TSEGMB 0xac
+#define TOLUD 0xb0 /* Top of Low Used Memory */
+#define ERRSTS 0xc8
+#define ERRCMD 0xca
+#define SMICMD 0xcc
+#define SCICMD 0xce
+#define CGDIS 0xd8
+#define SKPAD 0xdc /* Scratchpad Data */
+#define CAPID0 0xe0
+#define DEV0T 0xf0
+#define MSLCK 0xf4
+#define MID0 0xf8
+#define DEBUP0 0xfc
+
+/* Device 0:1.0 PCI configuration space (PCI Express) */
+
+#define BCTRL1 0x3e /* 16bit */
+#define PEGSTS 0x214 /* 32bit */
+
+
+/* Device 0:2.0 PCI configuration space (Graphics Device) */
+
+#define GMADR 0x18
+#define GTTADR 0x1c
+#define BSM 0x5c
+#define GCFC 0xf0 /* Graphics Clock Frequency & Gating Control */
+
+
+/*
+ * MCHBAR
+ */
+
+#define MCHBAR8(x) *((volatile u8 *)(DEFAULT_MCHBAR + x))
+#define MCHBAR16(x) *((volatile u16 *)(DEFAULT_MCHBAR + x))
+#define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x))
+
+/*
+ * EPBAR - Egress Port Root Complex Register Block
+ */
+
+#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
+#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
+#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
+
+/*
+ * DMIBAR
+ */
+
+#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
+#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
+#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
+
+/* provided by mainboard code */
+void setup_ich7_gpios(void);
+
+#endif /* NORTHBRIDGE_INTEL_PINEVIEW_H */
diff --git a/src/northbridge/intel/pineview/ram_calc.c b/src/northbridge/intel/pineview/ram_calc.c
new file mode 100644
index 0000000..e9f8eed
--- /dev/null
+++ b/src/northbridge/intel/pineview/ram_calc.c
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007-2009 coresystems GmbH
+ * Copyright (C) 2015 Damien Zammit <damien(a)zamaudio.com>
+ *
+ * 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.
+ */
+
+/* Use simple device model for this file even in ramstage */
+#define __SIMPLE_DEVICE__
+
+#include <arch/io.h>
+#include <cbmem.h>
+#include <northbridge/intel/pineview/pineview.h>
+
+static void *find_ramtop(void)
+{
+ uint32_t tom;
+
+ if (pci_read_config8(PCI_DEV(0, 0x0, 0), DEVEN) & (DEVEN_D2F0 | DEVEN_D2F1)) {
+ /* IGD enabled, get top of Memory from BSM register */
+ tom = pci_read_config32(PCI_DEV(0,2,0), BSM);
+ } else
+ tom = (pci_read_config8(PCI_DEV(0,0,0), TOLUD) & 0xf7) << 24;
+
+ /* if TSEG enabled subtract size */
+ switch(pci_read_config8(PCI_DEV(0, 0, 0), ESMRAM) & 0x07) {
+ case 0x01:
+ /* 1MB TSEG */
+ tom -= 0x100000;
+ break;
+ case 0x03:
+ /* 2MB TSEG */
+ tom -= 0x200000;
+ break;
+ case 0x05:
+ /* 8MB TSEG */
+ tom -= 0x800000;
+ break;
+ default:
+ /* TSEG either disabled or invalid */
+ break;
+ }
+ return (void *)tom;
+}
+
+void *cbmem_top(void)
+{
+ return find_ramtop();
+}
the following patch was just integrated into master:
commit 6f1e074c3d5a6703149f314f392ec9d386953f60
Author: Martin Roth <martinroth(a)google.com>
Date: Thu Oct 29 12:43:10 2015 -0600
Documentation: coreboot Gerrit Etiquette and Guidelines
As the community has grown, so has the need to formalize some of the
guidelines that the community lives by. When the community was small,
it was easy to communicate these things just from one person to another.
Now, with more people joining the community every day, it seems that
it's time to write some of these things down, allowing people to
understand our policies immediately instead of making them learn our
practices as they make mistakes.
As it says in the document:
The following rules are the requirements for behavior in the coreboot
codebase in gerrit. These have mainly been unwritten rules up to this
point, and should be familiar to most users who have been active in
coreboot for a period of time. Following these rules will help reduce
friction in the community.
Change-Id: If80e933fcfb04b86fd5efe6423cda448118d7a3c
Signed-off-by: Martin Roth <martinroth(a)google.com>
Reviewed-on: http://review.coreboot.org/12256
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
See http://review.coreboot.org/12256 for details.
-gerrit
Ben Gardner (gardner.ben(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12511
-gerrit
commit e76c8e47c841486b2600d8100a90a7833a01a139
Author: Ben Gardner <gardner.ben(a)gmail.com>
Date: Mon Nov 23 20:47:59 2015 -0600
FSP 1.0: Fix CAR issues - broken timestamps and console
FSP 1.0 has a fixed-size temporary cache size and address and the entire
cache is migrated in the FSP FspInitEntry() function.
Previous code expected the symbol _car_data_start to be the same as
CONFIG_DCACHE_RAM_BASE and _car_data_end to be the same as
_preram_cbmem_console.
FSP 1.0 is the only one that migrates _preram_cbmem_console.
Others leave that where it is and extract the early console data in
cbmemc_reinit(). Special handling is needed to handle that.
Commit dd6fa93d broke both assumptions and so broke the timestamp table
and console.
The fix is to use CONFIG_DCACHE_RAM_BASE when calculating the offset and
to use _preram_cbmem_console instead of _car_data_end for the console
check.
Change-Id: I6db109269b3537f7cb1300357c483ff2a745ffa7
Signed-off-by: Ben Gardner <gardner.ben(a)gmail.com>
---
src/cpu/x86/car.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index 36c5cf0..fda3f7d 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -18,6 +18,7 @@
#include <console/console.h>
#include <cbmem.h>
#include <arch/early_variables.h>
+#include <symbols.h>
#if IS_ENABLED(CONFIG_PLATFORM_USES_FSP1_0)
#include <drivers/intel/fsp1_0/fsp_util.h>
@@ -63,15 +64,16 @@ void *car_get_var_ptr(void *var)
#if IS_ENABLED(CONFIG_PLATFORM_USES_FSP1_0)
migrated_base=(char *)find_saved_temp_mem(
*(void **)CBMEM_FSP_HOB_PTR);
+ /* FSP 1.0 migrates the entire DCACHE RAM */
+ offset = (char *)var - (char *)CONFIG_DCACHE_RAM_BASE;
#else
migrated_base = cbmem_find(CBMEM_ID_CAR_GLOBALS);
+ offset = (char *)var - (char *)_car_start;
#endif
if (migrated_base == NULL)
die( "CAR: Could not find migration base!\n");
- offset = (char *)var - (char *)_car_start;
-
return &migrated_base[offset];
}
@@ -89,15 +91,19 @@ void *car_sync_var_ptr(void *var)
if (mig_var == var)
return mig_var;
- /* It's already pointing outside car.global_data. */
- if (*mig_var < _car_start || *mig_var > _car_end)
+ /*
+ * Migrate the cbmem console pointer for FSP 1.0 platforms. Otherwise,
+ * keep console buffer in CAR until cbmemc_reinit() moves it.
+ */
+ if (*mig_var == _preram_cbmem_console) {
+ if (IS_ENABLED(CONFIG_PLATFORM_USES_FSP1_0))
+ *mig_var += (char *)mig_var - (char *)var;
return mig_var;
+ }
-#if !IS_ENABLED(CONFIG_PLATFORM_USES_FSP1_0)
- /* Keep console buffer in CAR until cbmemc_reinit() moves it. */
- if (*mig_var == _car_end)
+ /* It's already pointing outside car.global_data. */
+ if (*mig_var < _car_start || *mig_var > _car_end)
return mig_var;
-#endif
/* Move the pointer by the same amount the variable storing it was
* moved by.
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12524
-gerrit
commit b2dc193d7c6f2a6c4c75bc188e2699cc0eddd196
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Mon Nov 23 16:18:12 2015 -0800
libpayload: Remove redundant 8250 MMIO32 UART driver
The more generic 8250 driver can handle both port-mapped and memory-
mapped 8250-compatible UARTs, with different register sizes. Thus, a
separate driver for MMIO32 is not needed.
The generic 8250 driver was tested to work for both output and input,
on Apollolake SoC, which only presents an MMIO32 UART.
Change-Id: Idab766588ddd097649a37de92394b0078ecc660a
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
payloads/libpayload/Kconfig | 10 +-
payloads/libpayload/drivers/Makefile.inc | 1 -
payloads/libpayload/drivers/serial/8250_mmio32.c | 113 -----------------------
3 files changed, 2 insertions(+), 122 deletions(-)
diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index 024fa15..5e02624 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -200,21 +200,15 @@ config SERIAL_CONSOLE
default y
config 8250_SERIAL_CONSOLE
- bool "8250, 16450, 16550, 16550A compatible serial port driver"
+ bool "8250-compatible serial port driver (including IO and MMIO)"
depends on SERIAL_CONSOLE
- default y if ARCH_X86
- default n if !ARCH_X86
+ default y
config S5P_SERIAL_CONSOLE
bool "Exynos SOC, S5P compatible serial port driver"
depends on SERIAL_CONSOLE
default n
-config 8250_MMIO32_SERIAL_CONSOLE
- bool "Memory-mapped 8250-compatible serial port driver with 32-bit regs"
- depends on SERIAL_CONSOLE
- default n
-
config IPQ806X_SERIAL_CONSOLE
bool "IPQ806x SOC compatible serial port driver"
depends on SERIAL_CONSOLE
diff --git a/payloads/libpayload/drivers/Makefile.inc b/payloads/libpayload/drivers/Makefile.inc
index 083f122..be43b35 100644
--- a/payloads/libpayload/drivers/Makefile.inc
+++ b/payloads/libpayload/drivers/Makefile.inc
@@ -35,7 +35,6 @@ libc-$(CONFIG_LP_SPEAKER) += speaker.c
libc-$(CONFIG_LP_8250_SERIAL_CONSOLE) += serial/8250.c
libc-$(CONFIG_LP_S5P_SERIAL_CONSOLE) += serial/s5p.c
-libc-$(CONFIG_LP_8250_MMIO32_SERIAL_CONSOLE) += serial/8250_mmio32.c
libc-$(CONFIG_LP_IPQ806X_SERIAL_CONSOLE) += serial/ipq806x.c
libc-$(CONFIG_LP_BG4CD_SERIAL_CONSOLE) += serial/bg4cd.c
libc-$(CONFIG_LP_PC_KEYBOARD) += keyboard.c
diff --git a/payloads/libpayload/drivers/serial/8250_mmio32.c b/payloads/libpayload/drivers/serial/8250_mmio32.c
deleted file mode 100644
index 285f7f6..0000000
--- a/payloads/libpayload/drivers/serial/8250_mmio32.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <libpayload.h>
-#include <stdint.h>
-
-struct mmio32_uart {
- union {
- uint32_t thr; // Transmit holding register.
- uint32_t rbr; // Receive buffer register.
- uint32_t dll; // Divisor latch lsb.
- };
- union {
- uint32_t ier; // Interrupt enable register.
- uint32_t dlm; // Divisor latch msb.
- };
- union {
- uint32_t iir; // Interrupt identification register.
- uint32_t fcr; // FIFO control register.
- };
- uint32_t lcr; // Line control register.
- uint32_t mcr; // Modem control register.
- uint32_t lsr; // Line status register.
- uint32_t msr; // Modem status register.
-} __attribute__ ((packed));
-
-enum {
- LSR_DR = 0x1 << 0, // Data ready.
- LSR_OE = 0x1 << 1, // Overrun.
- LSR_PE = 0x1 << 2, // Parity error.
- LSR_FE = 0x1 << 3, // Framing error.
- LSR_BI = 0x1 << 4, // Break.
- LSR_THRE = 0x1 << 5, // Xmit holding register empty.
- LSR_TEMT = 0x1 << 6, // Xmitter empty.
- LSR_ERR = 0x1 << 7 // Error.
-};
-
-static struct mmio32_uart *uart = NULL;
-
-void serial_putchar(unsigned int c)
-{
- while (!(readl(&uart->lsr) & LSR_THRE))
- /* wait for transmit register to clear */;
-
- writel((char)c, &uart->thr);
- if (c == '\n')
- serial_putchar('\r');
-}
-
-int serial_havechar(void)
-{
- uint8_t lsr = readl(&uart->lsr);
- return (lsr & LSR_DR) == LSR_DR;
-}
-
-int serial_getchar(void)
-{
- while (!serial_havechar())
- /* wait for character */;
-
- return readl(&uart->rbr);
-}
-
-static struct console_output_driver mmio32_serial_output = {
- .putchar = &serial_putchar
-};
-
-static struct console_input_driver mmio32_serial_input = {
- .havekey = &serial_havechar,
- .getchar = &serial_getchar
-};
-
-void serial_init(void)
-{
- if (!lib_sysinfo.serial || !lib_sysinfo.serial->baseaddr)
- return;
-
- uart = (struct mmio32_uart *)(uintptr_t)lib_sysinfo.serial->baseaddr;
-}
-
-void serial_console_init(void)
-{
- serial_init();
-
- if (uart) {
- console_add_output_driver(&mmio32_serial_output);
- console_add_input_driver(&mmio32_serial_input);
- }
-}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12524
-gerrit
commit ff7c3f12bf9991be6308b1a96c97c886bffea451
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Mon Nov 23 16:18:12 2015 -0800
libpayload: Remove redundant 8250 MMIO32 UART driver
The more generic 8250 driver can handle both port-mapped and memory-
mapped 8250-compatible UARTs, with different register sizes. Thus, a
separate driver for MMIO32 is not needed.
The generic 8250 driver was tested to work for both output and input,
on Apollolake SoC, which only presents an MMIO32 UART.
Change-Id: Idab766588ddd097649a37de92394b0078ecc660a
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
payloads/libpayload/Kconfig | 10 +-
payloads/libpayload/drivers/serial/8250_mmio32.c | 113 -----------------------
2 files changed, 2 insertions(+), 121 deletions(-)
diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index 024fa15..5e02624 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -200,21 +200,15 @@ config SERIAL_CONSOLE
default y
config 8250_SERIAL_CONSOLE
- bool "8250, 16450, 16550, 16550A compatible serial port driver"
+ bool "8250-compatible serial port driver (including IO and MMIO)"
depends on SERIAL_CONSOLE
- default y if ARCH_X86
- default n if !ARCH_X86
+ default y
config S5P_SERIAL_CONSOLE
bool "Exynos SOC, S5P compatible serial port driver"
depends on SERIAL_CONSOLE
default n
-config 8250_MMIO32_SERIAL_CONSOLE
- bool "Memory-mapped 8250-compatible serial port driver with 32-bit regs"
- depends on SERIAL_CONSOLE
- default n
-
config IPQ806X_SERIAL_CONSOLE
bool "IPQ806x SOC compatible serial port driver"
depends on SERIAL_CONSOLE
diff --git a/payloads/libpayload/drivers/serial/8250_mmio32.c b/payloads/libpayload/drivers/serial/8250_mmio32.c
deleted file mode 100644
index 285f7f6..0000000
--- a/payloads/libpayload/drivers/serial/8250_mmio32.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <libpayload.h>
-#include <stdint.h>
-
-struct mmio32_uart {
- union {
- uint32_t thr; // Transmit holding register.
- uint32_t rbr; // Receive buffer register.
- uint32_t dll; // Divisor latch lsb.
- };
- union {
- uint32_t ier; // Interrupt enable register.
- uint32_t dlm; // Divisor latch msb.
- };
- union {
- uint32_t iir; // Interrupt identification register.
- uint32_t fcr; // FIFO control register.
- };
- uint32_t lcr; // Line control register.
- uint32_t mcr; // Modem control register.
- uint32_t lsr; // Line status register.
- uint32_t msr; // Modem status register.
-} __attribute__ ((packed));
-
-enum {
- LSR_DR = 0x1 << 0, // Data ready.
- LSR_OE = 0x1 << 1, // Overrun.
- LSR_PE = 0x1 << 2, // Parity error.
- LSR_FE = 0x1 << 3, // Framing error.
- LSR_BI = 0x1 << 4, // Break.
- LSR_THRE = 0x1 << 5, // Xmit holding register empty.
- LSR_TEMT = 0x1 << 6, // Xmitter empty.
- LSR_ERR = 0x1 << 7 // Error.
-};
-
-static struct mmio32_uart *uart = NULL;
-
-void serial_putchar(unsigned int c)
-{
- while (!(readl(&uart->lsr) & LSR_THRE))
- /* wait for transmit register to clear */;
-
- writel((char)c, &uart->thr);
- if (c == '\n')
- serial_putchar('\r');
-}
-
-int serial_havechar(void)
-{
- uint8_t lsr = readl(&uart->lsr);
- return (lsr & LSR_DR) == LSR_DR;
-}
-
-int serial_getchar(void)
-{
- while (!serial_havechar())
- /* wait for character */;
-
- return readl(&uart->rbr);
-}
-
-static struct console_output_driver mmio32_serial_output = {
- .putchar = &serial_putchar
-};
-
-static struct console_input_driver mmio32_serial_input = {
- .havekey = &serial_havechar,
- .getchar = &serial_getchar
-};
-
-void serial_init(void)
-{
- if (!lib_sysinfo.serial || !lib_sysinfo.serial->baseaddr)
- return;
-
- uart = (struct mmio32_uart *)(uintptr_t)lib_sysinfo.serial->baseaddr;
-}
-
-void serial_console_init(void)
-{
- serial_init();
-
- if (uart) {
- console_add_output_driver(&mmio32_serial_output);
- console_add_input_driver(&mmio32_serial_input);
- }
-}
Timothy Pearson (tpearson(a)raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12054
-gerrit
commit a25c18d5035e65f859e14e875eb470489cc75470
Author: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
Date: Thu Aug 20 15:53:25 2015 -0500
northbridge/amd/amdfam10: Work around sporadic lockups when CC6 enabled
Change-Id: If31140651f25f9c524a824b2da552ce3690eae18
Signed-off-by: Timothy Pearson <tpearson(a)raptorengineeringinc.com>
---
src/northbridge/amd/amdfam10/northbridge.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index 60ad8c4..3177a5f 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -812,6 +812,20 @@ static void amdfam10_domain_read_resources(device_t dev)
else
qword = 0x1000000;
+ /* FIXME
+ * The BKDG appears to be incorrect as to the location of the CC6 save region
+ * lower boundary on non-interleaved systems, causing lockups on attempted write
+ * to the CC6 save region.
+ *
+ * For now, work around by allocating the maximum possible CC6 save region size.
+ *
+ * Determine if this is a BKDG error or a setup problem and remove this warning!
+ */
+ qword = (0x1 << 27);
+ max_range_limit = (((uint64_t)(pci_read_config32(get_node_pci(max_node, 1), 0x124) & 0x1fffff)) << 27) - 1;
+
+ printk(BIOS_INFO, "Reserving CC6 save segment base: %08llx size: %08llx\n", (max_range_limit + 1), qword);
+
/* Reserve the CC6 save segment */
reserved_ram_resource(dev, 8, (max_range_limit + 1) >> 10, qword >> 10);
}