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/6066
-gerrit
commit a1466e45035c982b203d3cfc6b6ac4501788890b
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Jun 18 00:43:35 2014 +0300
util/cbmem: Workaround for IS_ENABLED()
Our include files reference CONFIG_xxx declarations, which we should
ignore for utility build.
We cannot include kconfig.h to get IS_ENABLED() as that file
would require build/config.h and we do not want to enforce a build
of the firmware to be able to build the utility.
Since we do not include build/config.h each occurence of CONFIG_xxx
in the included header files is undefined and will be treated as
disabled.
Change-Id: I74f1627fc3f294410db8ce486ab553dac9e967f4
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
util/cbmem/cbmem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 9ad1214..fabede3 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -36,6 +36,7 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define MAP_BYTES (1024*1024)
+#define IS_ENABLED(x) (defined (x) && (x))
#include "boot/coreboot_tables.h"
Dave Frodin (dave.frodin(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5963
-gerrit
commit b29fcd7126af59eb407774e15002ce692eb85f7b
Author: Dave Frodin <dave.frodin(a)se-eng.com>
Date: Mon Jun 9 12:33:24 2014 -0600
superio/nuvoton: Adds a function to route pins 41-48 to UARTD
Pins 41-48 default to being GPIs. This switches the internal
mux to connect them to UARTD.
Change-Id: I61393b8c35cbc664f6520f60eed09ba4bbede0dc
Signed-off-by: Dave Frodin <dave.frodin(a)se-eng.com>
---
src/superio/nuvoton/nct5104d/Makefile.inc | 1 +
src/superio/nuvoton/nct5104d/early_init.c | 56 +++++++++++++++++++++++++++++++
src/superio/nuvoton/nct5104d/nct5104d.h | 8 +++--
3 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/src/superio/nuvoton/nct5104d/Makefile.inc b/src/superio/nuvoton/nct5104d/Makefile.inc
index fcb5ec2..b6278ba 100644
--- a/src/superio/nuvoton/nct5104d/Makefile.inc
+++ b/src/superio/nuvoton/nct5104d/Makefile.inc
@@ -19,3 +19,4 @@
##
ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT5104D) += superio.c
+romstage-$(CONFIG_SUPERIO_NUVOTON_NCT5104D) += early_init.c
diff --git a/src/superio/nuvoton/nct5104d/early_init.c b/src/superio/nuvoton/nct5104d/early_init.c
new file mode 100644
index 0000000..c9a408e
--- /dev/null
+++ b/src/superio/nuvoton/nct5104d/early_init.c
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Sage Electronic Engineering, LLC
+ *
+ * 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.
+ *
+ * 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 <arch/io.h>
+#include <device/pnp.h>
+#include <stdint.h>
+#include "nct5104d.h"
+
+#define NUVOTON_ENTRY_KEY 0x87
+#define NUVOTON_EXIT_KEY 0xAA
+
+/* Enable configuration: pass entry key '0x87' into index port dev
+ * two times. */
+static void pnp_enter_conf_state(device_t dev)
+{
+ u16 port = dev >> 8;
+ outb(NUVOTON_ENTRY_KEY, port);
+ outb(NUVOTON_ENTRY_KEY, port);
+}
+
+/* Disable configuration: pass exit key '0xAA' into index port dev. */
+static void pnp_exit_conf_state(device_t dev)
+{
+ u16 port = dev >> 8;
+ outb(NUVOTON_EXIT_KEY, port);
+}
+
+/* Route UARTD to pins 41-48 */
+void nct5104d_enable_uartd(device_t dev)
+{
+ u8 tmp;
+ u16 port = dev >> 8;
+ pnp_enter_conf_state(dev);
+ outb(0x1c, port);
+ tmp = inb(port + 1);
+ tmp |= 0x04;
+ outb(tmp, port + 1);
+ pnp_exit_conf_state(dev);
+}
diff --git a/src/superio/nuvoton/nct5104d/nct5104d.h b/src/superio/nuvoton/nct5104d/nct5104d.h
index b72dda0..74df793 100644
--- a/src/superio/nuvoton/nct5104d/nct5104d.h
+++ b/src/superio/nuvoton/nct5104d/nct5104d.h
@@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef SUPERIO_NUVOTON_NCT5104D_NCT5104D_H
-#define SUPERIO_NUVOTON_NCT5104D_NCT5104D_H
+#ifndef SUPERIO_NUVOTON_NCT5104D_H
+#define SUPERIO_NUVOTON_NCT5104D_H
/* Logical Device Numbers (LDN). */
#define NCT5104D_FDC 0x00 /* FDC - not pinned out */
@@ -42,4 +42,6 @@
#define NCT5104D_GPIO1 ((1 << 8) | NCT5104D_GPIO_V)
#define NCT5104D_GPIO6 ((6 << 8) | NCT5104D_GPIO_V)
-#endif /* SUPERIO_NUVOTON_NCT5104D_NCT5104D_H */
+void nct5104d_enable_uartd(device_t dev);
+
+#endif /* SUPERIO_NUVOTON_NCT5104D_H */