the following patch was just integrated into master:
commit 77ffa0d3ad7686a9e697bf1fa05966f019249483
Author: Gabe Black <gabeblack(a)google.com>
Date: Mon Sep 30 21:25:49 2013 -0700
UART 8250: Unconditionally provide register constants and use UART8250 prefix.
The register indexes and bitfield masks were guarded by the UART8250 config
options, but it might be (is) necessary to use them in a driver that is
UART8250 like without actually using the 8250 driver itself. To avoid any name
collision with other drivers, also change the constant prefix from UART_ to
UART8250_.
Change-Id: Ie606d9e0329132961c3004688176204a829569dc
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://chromium-review.googlesource.com/171336
Reviewed-by: Ronald Minnich <rminnich(a)chromium.org>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
(cherry picked from commit a93900be8d8a8260db49e30737608f9161fbf249)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
Reviewed-on: http://review.coreboot.org/6715
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
See http://review.coreboot.org/6715 for details.
-gerrit
the following patch was just integrated into master:
commit 3905e3d47c773e2c9664f09b7209711764683da6
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Thu Aug 29 16:01:05 2013 -0700
delay: Have mdelay() / delay() available in romstage, too
Some drivers (like the I2C TPM driver) call mdelay instead of
udelay. While it's a shame that these chips are so slow, the
overhead of having those functions available in romstage is
minimal.
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Change-Id: I1fa888fc5ca4489def16ac92e2f8260ccc26d792
Reviewed-on: https://chromium-review.googlesource.com/167542
Reviewed-by: Stefan Reinauer <reinauer(a)google.com>
Tested-by: Stefan Reinauer <reinauer(a)google.com>
Commit-Queue: Stefan Reinauer <reinauer(a)google.com>
(cherry picked from commit 7083b6b843d803bd4ddbd8a5aaf9c5c05bad2044)
Signed-off-by: Isaac Christensen <isaac.christensen(a)se-eng.com>
Reviewed-on: http://review.coreboot.org/6531
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
See http://review.coreboot.org/6531 for details.
-gerrit
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6762
-gerrit
commit 7c6d7e10ae398e1634d39c58174120c8b55a82e8
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Tue Aug 26 00:12:03 2014 +1000
util/intelgpio: Handy tool to build gpio.h from dumped values
This purpose of this tool is to build the 'gpio.h' header from dumped
values out of the inteltool.
NOTFORMERGE: incomplete.. RFC
Change-Id: I2812a3546849347567efe71c714fefe39e02e5d7
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
.gitignore | 1 +
util/intelgpio/Makefile | 47 +++++++++++++
util/intelgpio/intelgpio.c | 162 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 210 insertions(+)
diff --git a/.gitignore b/.gitignore
index 203ad9a..0a05520 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@ util/ifdtool/ifdtool
util/ifdfake/ifdfake
util/inteltool/.dependencies
util/inteltool/inteltool
+util/intelgpio/intelgpio
util/k8resdump/k8resdump
util/lbtdump/lbtdump
util/mptable/mptable
diff --git a/util/intelgpio/Makefile b/util/intelgpio/Makefile
new file mode 100644
index 0000000..6347bfc
--- /dev/null
+++ b/util/intelgpio/Makefile
@@ -0,0 +1,47 @@
+#
+# Makefile for intelgpio utility
+#
+# Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.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.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+PROGRAM = intelgpio
+
+CC ?= clang
+INSTALL ?= /usr/bin/install
+PREFIX ?= /usr/local
+CFLAGS ?= -O2 -g -Wall -W
+LDFLAGS +=
+
+OBJS = intelgpio.o
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+
+clean:
+ rm -f $(PROGRAM) *.o *~
+
+install: $(PROGRAM)
+ mkdir -p $(DESTDIR)$(PREFIX)/sbin
+ $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
+ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
+ $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
+
+.PHONY: all clean
+
+-include .dependencies
diff --git a/util/intelgpio/intelgpio.c b/util/intelgpio/intelgpio.c
new file mode 100644
index 0000000..c5aad77
--- /dev/null
+++ b/util/intelgpio/intelgpio.c
@@ -0,0 +1,162 @@
+/*
+ * inteltool - Prepare gpio.h file from register dumps from inteltool.
+ *
+ * Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.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.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define INTELGPIO_VERSION "0.1"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+static const __attribute__((unused)) char *mode[] = {"MODE_NATIVE", "MODE_GPIO", "mode"};
+static const __attribute__((unused)) char *dir[] = {"DIR_OUTPUT", "DIR_INPUT", "direction"};
+static const __attribute__((unused)) char *invert[] = {"NO_INVERT", "GPIO_INVERT", "invert"};
+static const __attribute__((unused)) char *level[] = {"LEVEL_LOW", "LEVEL_HIGH", "level"};
+static const __attribute__((unused)) char *blink[] = {"NO_BLINK", "BLINK", "blink"};
+static const __attribute__((unused)) char *reset[] = {"RESET_PWROK", "RESET_RSMRST", "reset"};
+
+static void print_version(void)
+{
+ printf("intelgpio v%s -- ", INTELGPIO_VERSION);
+ printf("Copyright (C) 2014 Edward O'Callaghan\n\n");
+ printf(
+ "This program is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, version 2 of the License.\n\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n");
+}
+
+static void print_usage(const char *name)
+{
+ printf("usage: %s [-vh?sdmlia]\n", name);
+ printf("\n"
+ " -v | --version: print the version\n"
+ " -h | --help: print this help\n\n"
+ " -s | --set= GPIO register set\n"
+ " -d | --direction= direction val\n"
+ " -m | --mode= mode val\n"
+ " -l | --level= level val\n"
+ " -i | --invert= invert val\n"
+ " -a | --all: all register sets 1,2,3\n"
+ "\n");
+ exit(1);
+}
+
+static void print_gpio_config(const char *type[], uint8_t set, uint32_t gpioval) {
+ unsigned int i;
+ uint8_t pin;
+// char pin_flag;
+
+ printf("const struct pch_gpio_set%i pch_gpio_set%i_%s = {\n", set, set, type[2]);
+ for (i = 0; i < 32; i++) {
+ pin = ((set - 1) * 32 + i);
+// pin_flag = (pin < 10 ? ' ': '\0');
+// printf("\t.gpio%i%c = GPIO_%s,\n", pin, pin_flag
+ printf("\t.gpio%i = GPIO_%s,\n", pin
+ , type[(gpioval >> i) & 1]);
+ }
+ printf("};\n\n");
+}
+
+// TODO write to file.. or keep as stdout???
+static void write_gpio_header(uint8_t set, uint32_t mv, uint32_t dv, uint32_t lv, uint32_t iv)
+{
+ // TODO: check bounds on mode, dir, level & invert for sane values??
+ print_gpio_config(mode, set, mv);
+ print_gpio_config(dir, set, dv);
+ print_gpio_config(level, set, lv);
+ if (set == 1)
+ print_gpio_config(invert, set, iv);
+}
+
+int main(int argc, char *argv[])
+{
+ int opt, option_index = 0;
+ uint8_t dump_set = 0, dump_all_sets = 0;
+ uint32_t direction = 0, mode = 0, level = 0, invert = 0;
+
+ static struct option long_options[] = {
+ {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'h'},
+ {"set", required_argument, 0, 's'},
+ {"direction", required_argument, 0, 'd'},
+ {"mode", required_argument, 0, 'm'},
+ {"level", required_argument, 0, 'l'},
+ {"invert", required_argument, 0, 'i'},
+ {"all", 0, 0, 'a'},
+ {0, 0, 0, 0}
+ };
+
+ while ((opt = getopt_long(argc, argv, "vh?s:d:m:l:i:a",
+ long_options, &option_index)) != EOF) {
+ switch (opt) {
+ case 'v':
+ print_version();
+ exit(0);
+ break;
+ case 's':
+ dump_set = atoi(optarg);
+ break;
+ case 'd':
+ direction = strtol(optarg, NULL, 16);
+ break;
+ case 'm':
+ mode = strtol(optarg, NULL, 16);
+ break;
+ case 'l':
+ level = strtol(optarg, NULL, 16);
+ break;
+ case 'i':
+ invert = strtol(optarg, NULL, 16);
+ break;
+ case 'a':
+ dump_all_sets = 1;
+ break;
+ case 'h':
+ case '?':
+ default:
+ print_usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+// FIXME: do this properly.. should also print out the struct packing at
+// the end of gpio.h also while in the 'all' mode of operation..
+ if (dump_all_sets) {
+ write_gpio_header(1, mode, direction, level, invert);
+ write_gpio_header(2, mode, direction, level, invert);
+ write_gpio_header(3, mode, direction, level, invert);
+ }
+
+// FIXME: check if mode, direction, level and invert were /all/ set..
+ if (!((dump_set < 1) || (dump_set > 3))) {
+ write_gpio_header(dump_set, mode, direction, level, invert);
+ } else {
+ print_usage(argv[0]);
+ exit(0);
+ }
+
+ return 0;
+}
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6762
-gerrit
commit b3f885a088a5ba6eedfa369a31d8b365d9c4fdba
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Tue Aug 26 00:12:03 2014 +1000
util/intelgpio: Handy tool to build gpio.h from dumped values
This purpose of this tool is to build the 'gpio.h' header from dumped
values out of the inteltool.
NOTFORMERGE: incomplete.. RFC
Change-Id: I2812a3546849347567efe71c714fefe39e02e5d7
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
.gitignore | 1 +
util/intelgpio/Makefile | 47 +++++++++++++
util/intelgpio/intelgpio.c | 160 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 208 insertions(+)
diff --git a/.gitignore b/.gitignore
index 203ad9a..0a05520 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,6 +71,7 @@ util/ifdtool/ifdtool
util/ifdfake/ifdfake
util/inteltool/.dependencies
util/inteltool/inteltool
+util/intelgpio/intelgpio
util/k8resdump/k8resdump
util/lbtdump/lbtdump
util/mptable/mptable
diff --git a/util/intelgpio/Makefile b/util/intelgpio/Makefile
new file mode 100644
index 0000000..6347bfc
--- /dev/null
+++ b/util/intelgpio/Makefile
@@ -0,0 +1,47 @@
+#
+# Makefile for intelgpio utility
+#
+# Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.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.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+PROGRAM = intelgpio
+
+CC ?= clang
+INSTALL ?= /usr/bin/install
+PREFIX ?= /usr/local
+CFLAGS ?= -O2 -g -Wall -W
+LDFLAGS +=
+
+OBJS = intelgpio.o
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+
+clean:
+ rm -f $(PROGRAM) *.o *~
+
+install: $(PROGRAM)
+ mkdir -p $(DESTDIR)$(PREFIX)/sbin
+ $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
+ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
+ $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
+
+.PHONY: all clean
+
+-include .dependencies
diff --git a/util/intelgpio/intelgpio.c b/util/intelgpio/intelgpio.c
new file mode 100644
index 0000000..d0c3adc
--- /dev/null
+++ b/util/intelgpio/intelgpio.c
@@ -0,0 +1,160 @@
+/*
+ * inteltool - Prepare gpio.h file from register dumps from inteltool.
+ *
+ * Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
+ * Copyright (C) 2014 Nicolas Reinecke <nr(a)das-labor.org>
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define INTELGPIO_VERSION "0.1"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+static const __attribute__((unused)) char *mode[] = {"MODE_NATIVE", "MODE_GPIO", "mode"};
+static const __attribute__((unused)) char *dir[] = {"DIR_OUTPUT", "DIR_INPUT", "dir"};
+static const __attribute__((unused)) char *invert[] = {"NO_INVERT", "GPIO_INVERT", "invert"};
+static const __attribute__((unused)) char *level[] = {"LEVEL_LOW", "LEVEL_HIGH", "level"};
+static const __attribute__((unused)) char *blink[] = {"NO_BLINK", "BLINK", "blink"};
+static const __attribute__((unused)) char *reset[] = {"RESET_PWROK", "RESET_RSMRST", "reset"};
+
+static void print_version(void)
+{
+ printf("intelgpio v%s -- ", INTELGPIO_VERSION);
+ printf("Copyright (C) 2014 Edward O'Callaghan,\n");
+ printf("\t\t Copyright (C) 2014 Nicolas Reinecke.\n\n");
+ printf(
+ "This program is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, version 2 of the License.\n\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n");
+}
+
+static void print_usage(const char *name)
+{
+ printf("usage: %s [-vh?sdmlia]\n", name);
+ printf("\n"
+ " -v | --version: print the version\n"
+ " -h | --help: print this help\n\n"
+ " -s | --set= GPIO register set\n"
+ " -d | --direction= direction val\n"
+ " -m | --mode= mode val\n"
+ " -l | --level= level val\n"
+ " -i | --invert= invert val\n"
+ " -a | --all: all register sets 1,2,3\n"
+ "\n");
+ exit(1);
+}
+
+static void print_gpio_config(const char *type[], uint8_t set, uint32_t gpioval) {
+ unsigned int i;
+ uint8_t pin = 1, pin_flag = 1;
+ printf("const struct pch_gpio_set%i pch_gpio_set%i_%s = {\n", set, set, type[2]);
+ for (i = 0; i < 32; i++) {
+ pin = ((set - 1 ) * 32 + i);
+ pin_flag = (((set - 1 ) * 32 ) + i < 10 ? ' ': '\0');
+ printf("\t.gpio%i%c = GPIO_%s,\n", pin, pin_flag
+ , type[(gpioval >> i) & 1]);
+ }
+ printf("}\n\n");
+}
+
+// TODO write to file.. or keep as stdout???
+static void write_gpio_header(uint8_t set, uint32_t mv, uint32_t dv, uint32_t lv, uint32_t iv)
+{
+ // TODO: check bounds on mode, dir, level & invert for sane values??
+ print_gpio_config(mode, set, mv);
+ print_gpio_config(dir, set, dv);
+ print_gpio_config(level, set, lv);
+ if (set == 1)
+ print_gpio_config(invert, set, iv);
+}
+
+int main(int argc, char *argv[])
+{
+ int opt, option_index = 0;
+ uint8_t dump_set = 0, dump_all_sets = 0;
+ uint32_t direction = 0, mode = 0, level = 0, invert = 0;
+
+ static struct option long_options[] = {
+ {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'h'},
+ {"set", required_argument, 0, 's'},
+ {"direction", required_argument, 0, 'd'},
+ {"mode", required_argument, 0, 'm'},
+ {"level", required_argument, 0, 'l'},
+ {"invert", required_argument, 0, 'i'},
+ {"all", 0, 0, 'a'},
+ {0, 0, 0, 0}
+ };
+
+ while ((opt = getopt_long(argc, argv, "vh?s:d:m:l:i:a",
+ long_options, &option_index)) != EOF) {
+ switch (opt) {
+ case 'v':
+ print_version();
+ exit(0);
+ break;
+ case 's':
+ dump_set = atoi(optarg);
+ break;
+ case 'd':
+ direction = strtol(optarg, NULL, 16);
+ break;
+ case 'm':
+ mode = strtol(optarg, NULL, 16);
+ break;
+ case 'l':
+ level = strtol(optarg, NULL, 16);
+ break;
+ case 'i':
+ invert = strtol(optarg, NULL, 16);
+ break;
+ case 'a':
+ dump_all_sets = 1;
+ break;
+ case 'h':
+ case '?':
+ default:
+ print_usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+// FIXME: do this properly..
+ if (dump_all_sets) {
+ write_gpio_header(1, mode, direction, level, invert);
+ write_gpio_header(2, mode, direction, level, invert);
+ write_gpio_header(3, mode, direction, level, invert);
+ }
+
+// FIXME: check if mode, direction, level and invert were /all/ set..
+ if (!((dump_set < 1) || (dump_set > 3))) {
+ write_gpio_header(dump_set, mode, direction, level, invert);
+ } else {
+ print_usage(argv[0]);
+ exit(0);
+ }
+
+ return 0;
+}
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6762
-gerrit
commit d0e7f17a054239f8876ddf3a1d73c01d6574363b
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Tue Aug 26 00:12:03 2014 +1000
util/intelgpio: Handy tool to build gpio.h from dumped values
This purpose of this tool is to build the 'gpio.h' header from dumped
values out of the inteltool.
NOTFORMERGE: incomplete.. RFC
Change-Id: I2812a3546849347567efe71c714fefe39e02e5d7
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
util/intelgpio/Makefile | 47 +++++++++++++
util/intelgpio/intelgpio.c | 160 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 207 insertions(+)
diff --git a/util/intelgpio/Makefile b/util/intelgpio/Makefile
new file mode 100644
index 0000000..6347bfc
--- /dev/null
+++ b/util/intelgpio/Makefile
@@ -0,0 +1,47 @@
+#
+# Makefile for intelgpio utility
+#
+# Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.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.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+PROGRAM = intelgpio
+
+CC ?= clang
+INSTALL ?= /usr/bin/install
+PREFIX ?= /usr/local
+CFLAGS ?= -O2 -g -Wall -W
+LDFLAGS +=
+
+OBJS = intelgpio.o
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+
+clean:
+ rm -f $(PROGRAM) *.o *~
+
+install: $(PROGRAM)
+ mkdir -p $(DESTDIR)$(PREFIX)/sbin
+ $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
+ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
+ $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
+
+.PHONY: all clean
+
+-include .dependencies
diff --git a/util/intelgpio/intelgpio.c b/util/intelgpio/intelgpio.c
new file mode 100644
index 0000000..7d9914c
--- /dev/null
+++ b/util/intelgpio/intelgpio.c
@@ -0,0 +1,160 @@
+/*
+ * inteltool - Prepare gpio.h file from register dumps from inteltool.
+ *
+ * Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
+ * Copyright (C) 2014 Nicolas Reinecke <nr(a)das-labor.org>
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define INTELGPIO_VERSION "0.1"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+static const __attribute__((unused)) char *mode[] = {"MODE_NATIVE", "MODE_GPIO", "mode"};
+static const __attribute__((unused)) char *dir[] = {"DIR_OUTPUT", "DIR_INPUT", "dir"};
+static const __attribute__((unused)) char *invert[] = {"NO_INVERT", "GPIO_INVERT", "invert"};
+static const __attribute__((unused)) char *level[] = {"LEVEL_LOW", "LEVEL_HIGH", "level"};
+static const __attribute__((unused)) char *blink[] = {"NO_BLINK", "BLINK", "blink"};
+static const __attribute__((unused)) char *reset[] = {"RESET_PWROK", "RESET_RSMRST", "reset"};
+
+static void print_version(void)
+{
+ printf("intelgpio v%s -- ", INTELGPIO_VERSION);
+ printf("Copyright (C) 2014 Edward O'Callaghan,\n");
+ printf("\t\t Copyright (C) 2014 Nicolas Reinecke.\n\n");
+ printf(
+ "This program is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, version 2 of the License.\n\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n");
+}
+
+static void print_usage(const char *name)
+{
+ printf("usage: %s [-vh?sdmlia]\n", name);
+ printf("\n"
+ " -v | --version: print the version\n"
+ " -h | --help: print this help\n\n"
+ " -s | --set= GPIO register set\n"
+ " -d | --direction= direction val\n"
+ " -m | --mode= mode val\n"
+ " -l | --level= level val\n"
+ " -i | --invert= invert val\n"
+ " -a | --all: all register sets 1,2,3\n"
+ "\n");
+ exit(1);
+}
+
+static void print_gpio_config(const char *type[], uint8_t set, uint32_t gpioval) {
+ unsigned int i;
+ uint8_t pin = 1, pin_flag = 1;
+ printf("const struct pch_gpio_set%i pch_gpio_set%i_%s = {\n", set, set, type[2]);
+ for (i = 0; i < 32; i++) {
+ pin = ((set - 1 ) * 32 + i);
+ pin_flag = (((set - 1 ) * 32 ) + i < 10 ? ' ': '\0');
+ printf("\t.gpio%i%c = GPIO_%s,\n", pin, pin_flag
+ , type[(gpioval >> i) & 1]);
+ }
+ printf("}\n\n");
+}
+
+// TODO write to file.. or keep as stdout???
+static void write_gpio_header(uint8_t set, uint32_t mv, uint32_t dv, uint32_t lv, uint32_t iv)
+{
+ // TODO: check bounds on mode, dir, level & invert for sane values??
+ print_gpio_config(mode, set, mv);
+ print_gpio_config(dir, set, dv);
+ print_gpio_config(level, set, lv);
+ if (set == 1)
+ print_gpio_config(invert, set, iv);
+}
+
+int main(int argc, char *argv[])
+{
+ int opt, option_index = 0;
+ uint8_t dump_set = 0, dump_all_sets = 0;
+ uint32_t direction = 0, mode = 0, level = 0, invert = 0;
+
+ static struct option long_options[] = {
+ {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'h'},
+ {"set", required_argument, 0, 's'},
+ {"direction", required_argument, 0, 'd'},
+ {"mode", required_argument, 0, 'm'},
+ {"level", required_argument, 0, 'l'},
+ {"invert", required_argument, 0, 'i'},
+ {"all", 0, 0, 'a'},
+ {0, 0, 0, 0}
+ };
+
+ // TODO: handle hex values..
+ while ((opt = getopt_long(argc, argv, "vh?s:d:m:l:i:a",
+ long_options, &option_index)) != EOF) {
+ switch (opt) {
+ case 'v':
+ print_version();
+ exit(0);
+ break;
+ case 's':
+ dump_set = atoi(optarg);
+ break;
+ case 'd':
+ direction = atoi(optarg);
+ break;
+ case 'm':
+ mode = atoi(optarg);
+ break;
+ case 'l':
+ level = atoi(optarg);
+ break;
+ case 'i':
+ invert = atoi(optarg);
+ break;
+ case 'a':
+ dump_all_sets = 1;
+ break;
+ case 'h':
+ case '?':
+ default:
+ print_usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+
+ if (dump_all_sets) {
+ write_gpio_header(1, mode, direction, level, invert);
+ write_gpio_header(2, mode, direction, level, invert);
+ write_gpio_header(3, mode, direction, level, invert);
+ }
+
+ if (!((dump_set < 1) || (dump_set > 3))) {
+ write_gpio_header(dump_set, mode, direction, level, invert);
+ } else {
+ print_usage(argv[0]);
+ exit(0);
+ }
+
+ return 0;
+}
Edward O'Callaghan (eocallaghan(a)alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6762
-gerrit
commit 064ed26052797e97e421767880f63ed70f366f05
Author: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Date: Tue Aug 26 00:12:03 2014 +1000
util/intelgpio: Handy tool to build gpio.h from dumped values
This purpose of this tool is to build the 'gpio.h' header from dumped
values out of the inteltool.
NOTFORMERGE: incomplete..
Change-Id: I2812a3546849347567efe71c714fefe39e02e5d7
Signed-off-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
---
util/intelgpio/Makefile | 47 ++++++++++++++++
util/intelgpio/intelgpio.c | 131 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 178 insertions(+)
diff --git a/util/intelgpio/Makefile b/util/intelgpio/Makefile
new file mode 100644
index 0000000..6347bfc
--- /dev/null
+++ b/util/intelgpio/Makefile
@@ -0,0 +1,47 @@
+#
+# Makefile for intelgpio utility
+#
+# Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.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.
+#
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+PROGRAM = intelgpio
+
+CC ?= clang
+INSTALL ?= /usr/bin/install
+PREFIX ?= /usr/local
+CFLAGS ?= -O2 -g -Wall -W
+LDFLAGS +=
+
+OBJS = intelgpio.o
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+
+clean:
+ rm -f $(PROGRAM) *.o *~
+
+install: $(PROGRAM)
+ mkdir -p $(DESTDIR)$(PREFIX)/sbin
+ $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
+ mkdir -p $(DESTDIR)$(PREFIX)/share/man/man8
+ $(INSTALL) -p -m644 $(PROGRAM).8 $(DESTDIR)$(PREFIX)/share/man/man8
+
+.PHONY: all clean
+
+-include .dependencies
diff --git a/util/intelgpio/intelgpio.c b/util/intelgpio/intelgpio.c
new file mode 100644
index 0000000..a73965f
--- /dev/null
+++ b/util/intelgpio/intelgpio.c
@@ -0,0 +1,131 @@
+/*
+ * inteltool - Prepare gpio.h file from register dumps from inteltool.
+ *
+ * Copyright (C) 2014 Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
+ * Copyright (C) 2014 Nicolas Reinecke <nr(a)das-labor.org>
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#define INTELGPIO_VERSION "0.1"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+static const __attribute__((unused)) char *mode[] = {"MODE_NATIVE", "MODE_GPIO", "mode"};
+static const __attribute__((unused)) char *dir[] = {"DIR_OUTPUT", "DIR_INPUT", "dir"};
+static const __attribute__((unused)) char *invert[] = {"NO_INVERT", "GPIO_INVERT", "invert"};
+static const __attribute__((unused)) char *level[] = {"LEVEL_LOW", "LEVEL_HIGH", "level"};
+static const __attribute__((unused)) char *blink[] = {"NO_BLINK", "BLINK", "blink"};
+static const __attribute__((unused)) char *reset[] = {"RESET_PWROK", "RESET_RSMRST", "reset"};
+
+static void print_version(void)
+{
+ printf("intelgpio v%s -- ", INTELGPIO_VERSION);
+ printf("Copyright (C) 2014 Edward O'Callaghan,\n");
+ printf("\t\t Copyright (C) 2014 Nicolas Reinecke.\n\n");
+ printf(
+ "This program is free software: you can redistribute it and/or modify\n"
+ "it under the terms of the GNU General Public License as published by\n"
+ "the Free Software Foundation, version 2 of the License.\n\n"
+ "This program is distributed in the hope that it will be useful,\n"
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "GNU General Public License for more details.\n\n"
+ "You should have received a copy of the GNU General Public License\n"
+ "along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n");
+}
+
+static void print_usage(const char *name)
+{
+ printf("usage: %s [-vh?sa]\n", name);
+ printf("\n"
+ " -v | --version: print the version\n"
+ " -h | --help: print this help\n\n"
+ " -s | --set: GPIO register set\n"
+ " -a | --all: all register sets 1,2,3\n"
+ "\n");
+ exit(1);
+}
+
+static void print_gpio_config(const char *type[], uint8_t set, uint32_t gpioval) {
+ unsigned int i;
+ printf("const struct pch_gpio_set%i pch_gpio_set%i_%s = {\n", set, set, type[2]);
+ for (i = 0; i < 32; i++)
+ printf("\t.gpio%i%c = GPIO_%s,\n", ((set - 1 ) * 32 + i), (((set - 1 ) * 32 ) + i < 10 ? ' ': '\0'), type[(gpioval >> i) & 1]);
+ printf("}\n\n");
+}
+
+static void write_gpio_header(int set)
+{
+ print_gpio_config(mode, set, 0x3962a5ff);
+ print_gpio_config(dir, set, 0x8ebf6aff);
+ print_gpio_config(level, set, 0x66957f3b);
+ if (set == 1)
+ print_gpio_config(invert, set, 0x00002082);
+}
+
+int main(int argc, char *argv[])
+{
+ int opt, option_index = 0;
+ int dump_set = 0, dump_all_sets = 0;
+
+ static struct option long_options[] = {
+ {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'h'},
+ {"set", required_argument, 0, 's'},
+ {"all", 0, 0, 'a'},
+ {0, 0, 0, 0}
+ };
+
+ while ((opt = getopt_long(argc, argv, "vh?sa",
+ long_options, &option_index)) != EOF) {
+ switch (opt) {
+ case 'v':
+ print_version();
+ exit(0);
+ break;
+ case 's':
+ dump_set = atoi(optarg);
+ break;
+ case 'a':
+ dump_all_sets = 1;
+ break;
+ case 'h':
+ case '?':
+ default:
+ print_usage(argv[0]);
+ exit(0);
+ break;
+ }
+ }
+
+
+ if (dump_all_sets) {
+ write_gpio_header(1);
+ write_gpio_header(2);
+ write_gpio_header(3);
+ }
+
+ if (!((dump_set < 1) || (dump_set > 3))) {
+ write_gpio_header(dump_set);
+ } else {
+ print_usage(argv[0]);
+ exit(0);
+ }
+
+ return 0;
+}
the following patch was just integrated into master:
commit 69e66d10deba392341a9d389fbf8d29987a6b424
Author: Nicolas Reinecke <nr(a)das-labor.org>
Date: Sun Aug 24 22:12:37 2014 +0200
lenovo/t520: update Kconfig
override default ivy VGA_BIOS_ID
add model & part number
Remove ARCH_X86 as is in,
fd33781 Move ARCH_* from board/Kconfig to cpu or soc Kconfig.
Change-Id: I61dc6434de7af2d8672f784df87a8b9d3f0fb068
Signed-off-by: Nicolas Reinecke <nr(a)das-labor.org>
Reviewed-on: http://review.coreboot.org/6759
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
See http://review.coreboot.org/6759 for details.
-gerrit
the following patch was just integrated into master:
commit a41e5c7dc53b8849172dd357cf9f500cac19a897
Author: Nicolas Reinecke <nr(a)das-labor.org>
Date: Sun Aug 24 19:49:35 2014 +0200
lenovo/t520: fix PCIe interrupt and function disable config
Change-Id: I33e71c0a246583885368dc3d3af761c190b2fb5c
Signed-off-by: Nicolas Reinecke <nr(a)das-labor.org>
Reviewed-on: http://review.coreboot.org/6758
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
See http://review.coreboot.org/6758 for details.
-gerrit