Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1049
-gerrit
commit e41c6774598194a89f16c7e27dae56140dd5f9fc
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Tue May 15 14:18:59 2012 -0700
Provide functions to access arbitrary GPIO pins and vectors
This change adds utility functions which allow to read any GPIO pin,
as well as a vector of GPIO pin values.
As presented, these functions will be available to Sandy Bridge and
Ivy Bridge systems only.
There is no error checking: trying to read GPIO pin number which
exceeds actual number of pins will return zero, trying to read GPIO
which is not actually configured as such will return unpredictable
value.
When reading a GPIO pin vector, the pin numbers are passed in an
array, terminated by -1. For instance, to read GPIO pins 4, 2, 15 as a
three bit number GPIO4 * 4 + GPIO2 * 2 + GPIO15 * 1, one should pass
pointer to array of {4, 2, 15, -1}.
Change-Id: I042c12dbcb3c46d14ed864a48fc37d54355ced7d
Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
---
src/southbridge/intel/bd82x6x/gpio.c | 37 ++++++++++++++++++++++++++++++++++
src/southbridge/intel/bd82x6x/gpio.h | 8 +++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/src/southbridge/intel/bd82x6x/gpio.c b/src/southbridge/intel/bd82x6x/gpio.c
index 598726a..2ba34ea 100644
--- a/src/southbridge/intel/bd82x6x/gpio.c
+++ b/src/southbridge/intel/bd82x6x/gpio.c
@@ -25,6 +25,8 @@
#include "pch.h"
#include "gpio.h"
+#define MAX_GPIO_NUMBER 75 /* zero based */
+
void setup_pch_gpios(const struct pch_gpio_map *gpio)
{
u16 gpiobase = pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffc;
@@ -63,3 +65,38 @@ void setup_pch_gpios(const struct pch_gpio_map *gpio)
if (gpio->set3.reset)
outl(*((u32*)gpio->set3.reset), gpiobase + GP_RST_SEL3);
}
+
+int get_gpio(int gpio_num)
+{
+ static const int gpio_reg_offsets[] = {0xc, 0x38, 0x48};
+ u16 gpio_base = pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffc;
+ int index, bit;
+
+ if (gpio_num > MAX_GPIO_NUMBER)
+ return 0; /* Just ignore wrong gpio numbers. */
+
+ index = gpio_num / 32;
+ bit = gpio_num % 32;
+
+ return (inl(gpio_base + gpio_reg_offsets[index]) >> bit) & 1;
+}
+
+/*
+ * get a number comprised of multiple GPIO values. gpio_num_array points to
+ * the array of gpio pin numbers to scan, terminated by -1.
+ */
+unsigned get_gpios(const int *gpio_num_array)
+{
+ int gpio;
+ unsigned bitmask = 1;
+ unsigned vector = 0;
+
+ while (bitmask &&
+ ((gpio = *gpio_num_array++) != -1)) {
+ vector <<= 1;
+ if (get_gpio(gpio))
+ vector |= bitmask;
+ bitmask <<= 1;
+ }
+ return vector;
+}
diff --git a/src/southbridge/intel/bd82x6x/gpio.h b/src/southbridge/intel/bd82x6x/gpio.h
index 214947f..44e808a 100644
--- a/src/southbridge/intel/bd82x6x/gpio.h
+++ b/src/southbridge/intel/bd82x6x/gpio.h
@@ -150,4 +150,12 @@ struct pch_gpio_map {
/* Configure GPIOs with mainboard provided settings */
void setup_pch_gpios(const struct pch_gpio_map *gpio);
+/* get GPIO pin value */
+int get_gpio(int gpio_num);
+/*
+ * get a number comprised of multiple GPIO values. gpio_num_array points to
+ * the array of gpio pin numbers to scan, terminated by -1.
+ */
+unsigned get_gpios(const int *gpio_num_array);
+
#endif
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1038
-gerrit
commit 813532b8352bd643fb507c472d518fafebf1edfe
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Fri May 11 12:58:11 2012 -0700
chromeos: Fix compilation of coreboot-utils package
The ChromeOS build system provides a set of CXXFLAGS, however those do
not contain -DCOMPACT. This breaks the compilation of cbfstool in
coreboot-utils.
This fix overrides CXXFLAGS so that coreboot-utils compiles again.
Change-Id: If9495bdd815fe2cdaeba5386afa953558742467b
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
util/cbfstool/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
index 0b61342..7d667f8 100644
--- a/util/cbfstool/Makefile
+++ b/util/cbfstool/Makefile
@@ -3,7 +3,7 @@ obj ?= $(shell pwd)
HOSTCXX ?= g++
HOSTCC ?= gcc
CFLAGS ?= -g -Wall
-CXXFLAGS ?=-DCOMPACT $(CFLAGS)
+CXXFLAGS +=-DCOMPACT $(CFLAGS)
LDFLAGS ?= -g
BINARY:=$(obj)/cbfstool
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1037
-gerrit
commit b071aa230fe252af638aed7d0bfc979cb914b93e
Author: Patrick Georgi <patrick(a)georgi-clan.de>
Date: Mon May 21 20:10:04 2012 +0200
abuild: Disable abuild-level parallelism for now
It still failed because make touches files it isn't
supposed to touch.
Change-Id: I5a6ceaa9d5da212c1e34b121cf39fa9d27964747
Signed-off-by: Patrick Georgi <patrick(a)georgi-clan.de>
---
util/abuild/abuild | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/util/abuild/abuild b/util/abuild/abuild
index 481fbc2..65d9cea 100755
--- a/util/abuild/abuild
+++ b/util/abuild/abuild
@@ -309,6 +309,7 @@ function build_target
HOSTCC='gcc'
printf "Building $VENDOR/$MAINBOARD; "
+ mkdir -p $TOP/$TARGET/${VENDOR}_${MAINBOARD}
XMLFILE=$TOP/$TARGET/${VENDOR}_${MAINBOARD}/abuild.xml
xml "<mainboard>"
@@ -606,12 +607,12 @@ USE_XARGS=0
if [ "$cpus" != "1" ]; then
if [ "$target" = "" ]; then
# Test if xargs supports the non-standard -P flag
- echo | xargs -P 0$cpus -n 1 echo 2>/dev/null >/dev/null && USE_XARGS=1
+ # FIXME: disabled until we managed to eliminate all the make(1) quirks
+ echo | xargs -P 0$cpus -n 1 echo 2>/dev/null >/dev/null # && USE_XARGS=1
fi
fi
if [ "$USE_XARGS" = "0" ]; then
-export MAKEFLAGS="-j $cpus"
build_all_targets()
{
for VENDOR in $( vendors ); do
@@ -673,6 +674,7 @@ if [ "$target" != "" ]; then
else
build_all_targets
rm -f $REAL_XMLFILE
+ XMLFILE=$REAL_XMLFILE
xml '<?xml version="1.0" encoding="utf-8"?>'
xml '<abuild>'
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1052
-gerrit
commit 2f5cfccdbbf588e1a6243080d357cc73cc20fb88
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Wed May 23 14:20:18 2012 -0700
ChromeOS: Remove remnants of FDT support
Originally, on ChromeBooks, coreboot would provide a modified
u-boot device tree (FDT) to u-boot in CBMEM. However, u-boot
can now create all the information it needs from the coreboot
table and add it to its device tree itself. This means we can
drop this (anyways unused) code.
Change-Id: I4ab20bbb8525e7349b18764aa202bbe81958d06a
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
src/vendorcode/google/chromeos/gnvs.c | 42 ---------------------------------
src/vendorcode/google/chromeos/gnvs.h | 1 -
2 files changed, 0 insertions(+), 43 deletions(-)
diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c
index 6b545f4..024dbf8 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -34,48 +34,6 @@ void chromeos_init_vboot(chromeos_acpi_t *chromeos)
memcpy(vboot_data->mehh, me_hash_saved, sizeof(vboot_data->mehh));
}
-void chromeos_set_vboot_data_ptr(void *blob)
-{
- /* This code has to be rewritten to pass the vboot table
- * pointer through the coreboot table instead of the
- * FDT, since FDT support was rejected upstream. For now
- * just make the code available for reference.
- */
-#if 0 // CONFIG_ADD_FDT
- int node_offset, addr_cell_len;
- const u32 *cell;
- uintptr_t table_addr = (uintptr_t)vboot_data;
- u32 table_addr32;
- u64 table_addr64;
- void *table_ptr;
-
- cell = fdt_getprop(blob, 0, "#address-cells", NULL);
- if (cell && *cell == 2) {
- addr_cell_len = 8;
- table_addr64 = cpu_to_fdt64(table_addr);
- table_ptr = &table_addr64;
- } else {
- addr_cell_len = 4;
- table_addr32 = cpu_to_fdt32(table_addr);
- table_ptr = &table_addr32;
- }
-
- node_offset = fdt_path_offset(blob, "/chromeos-config");
- if (node_offset < 0) {
- printk(BIOS_ERR,
- "Couldn't find /chromeos-config in the fdt.\n");
- return;
- }
-
- if (fdt_setprop(blob, node_offset, "gnvs-vboot-table",
- table_ptr, addr_cell_len) < 0) {
- printk(BIOS_ERR, "Couldn't set gnvs-vboot-table.\n");
- }
-#else
- printk(BIOS_ERR, "Can't set gnvs-vboot-table.\n");
-#endif
-}
-
void chromeos_set_me_hash(u32 *hash, int len)
{
if ((len*sizeof(u32)) > sizeof(vboot_data->mehh))
diff --git a/src/vendorcode/google/chromeos/gnvs.h b/src/vendorcode/google/chromeos/gnvs.h
index 36922ba..6dd740f 100644
--- a/src/vendorcode/google/chromeos/gnvs.h
+++ b/src/vendorcode/google/chromeos/gnvs.h
@@ -63,7 +63,6 @@ typedef struct {
extern chromeos_acpi_t *vboot_data;
void chromeos_init_vboot(chromeos_acpi_t *chromeos);
-void chromeos_set_vboot_data_ptr(void *);
void chromeos_set_me_hash(u32*, int);
#endif
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1051
-gerrit
commit 941d3ed66a17dc667ade5cc5bfaeee3207d0eeee
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Wed May 23 14:16:47 2012 -0700
Sandybridge: Remove remnants of FDT support from MRC cache code
Originally, ChromeBooks would get the offset of the MRC cache
from an entry in the u-boot device tree. Not everyone wants to
use u-boot on Sandybridge systems, however.
Since the new code (based on Kconfig) is now fully working, we
can drop the u-boot device tree remnants.
Change-Id: I4e012ea981f16dce9a4d155254facd29874b28ef
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
src/northbridge/intel/sandybridge/mrccache.c | 80 ++++----------------------
1 files changed, 11 insertions(+), 69 deletions(-)
diff --git a/src/northbridge/intel/sandybridge/mrccache.c b/src/northbridge/intel/sandybridge/mrccache.c
index aad2b91..d774ff0 100644
--- a/src/northbridge/intel/sandybridge/mrccache.c
+++ b/src/northbridge/intel/sandybridge/mrccache.c
@@ -28,19 +28,6 @@
#include "sandybridge.h"
#include <spi.h>
#include <spi_flash.h>
-/* Using the FDT FMAP for finding the MRC cache area requires including FDT
- * support in coreboot, which we would like to avoid. There are a number of
- * options:
- * - Have each mainboard Kconfig supply a hard-coded offset
- * - For ChromeOS devices: implement native FMAP
- * - For non-ChromeOS devices: use CBFS
- * For now let's leave this code in here until the issue is sorted out in
- * a way that works for everyone.
- */
-#undef USE_FDT_FMAP_FOR_MRC_CACHE
-#ifdef USE_FDT_FMAP_FOR_MRC_CACHE
-#include <fdt/libfdt.h>
-#endif
struct mrc_data_container *next_mrc_block(struct mrc_data_container *mrc_cache)
{
@@ -61,64 +48,19 @@ int is_mrc_cache(struct mrc_data_container *mrc_cache)
return (!!mrc_cache) && (mrc_cache->mrc_signature == MRC_DATA_SIGNATURE);
}
+/* Right now, the offsets for the MRC cache area are hard-coded in the
+ * northbridge Kconfig. In order to make this more flexible, there are
+ * a number of options:
+ * - Have each mainboard Kconfig supply a hard-coded offset
+ * - For ChromeOS devices: implement native FMAP
+ * - For non-ChromeOS devices: use CBFS
+ */
u32 get_mrc_cache_region(struct mrc_data_container **mrc_region_ptr)
{
- u8 *mrc_region;
- u32 region_size;
-#ifdef USE_FDT_FMAP_FOR_MRC_CACHE
- u32 *data;
- const struct fdt_header *fdt_header;
- const struct fdt_property *fdtp;
- int offset, len;
- const char *compatible = "chromeos,flashmap";
- const char *subnode = "rw-mrc-cache";
- const char *property = "reg";
- u64 flashrom_base = 0;
-
- fdt_header = cbfs_find_file(CONFIG_FDT_FILE_NAME, CBFS_TYPE_FDT);
-
- if (!fdt_header) {
- printk(BIOS_ERR, "%s: no FDT found!\n", __func__);
- return 0;
- }
-
- offset = fdt_node_offset_by_compatible(fdt_header, 0, compatible);
- if (offset < 0) {
- printk(BIOS_ERR, "%s: no %s node found!\n",
- __func__, compatible);
- return 0;
- }
-
- if (fdt_get_base_addr(fdt_header, offset, &flashrom_base) < 0) {
- printk(BIOS_ERR, "%s: no base address in node name!\n",
- __func__);
- return 0;
- }
-
- offset = fdt_subnode_offset(fdt_header, offset, subnode);
- if (offset < 0) {
- printk(BIOS_ERR, "%s: no %s found!\n", __func__, subnode);
- return 0;
- }
-
- fdtp = fdt_get_property(fdt_header, offset, property, &len);
- if (!fdtp || (len != 8)) {
- printk(BIOS_ERR, "%s: property %s at %p, len %d!\n",
- __func__, property, fdtp, len);
- return 0;
- }
-
- data = (u32 *)fdtp->data;
-
- // Calculate actual address of the MRC cache in memory
- region_size = fdt32_to_cpu(data[1]);
- mrc_region = (u8*)((unsigned long)flashrom_base + fdt32_to_cpu(data[0]));
-#else
- region_size = CONFIG_MRC_CACHE_SIZE;
- mrc_region = (u8*)(CONFIG_MRC_CACHE_BASE + CONFIG_MRC_CACHE_LOCATION);
-#endif
- *mrc_region_ptr = (struct mrc_data_container *)mrc_region;
+ u32 region_size = CONFIG_MRC_CACHE_SIZE;
+ *mrc_region_ptr = (struct mrc_data_container *)
+ (CONFIG_MRC_CACHE_BASE + CONFIG_MRC_CACHE_LOCATION);
return region_size;
}
@@ -182,7 +124,7 @@ struct mrc_data_container *find_current_mrc_cache(void)
entry_id++;
mrc_cache = mrc_next;
mrc_next = next_mrc_block(mrc_cache);
- /* Stay in the mrcdata region defined in fdt */
+ /* Stay in the mrc data region */
if ((void*)mrc_next >= (void*)(mrc_region + region_size))
break;
}
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1049
-gerrit
commit 61899d3c0595c73c0e2502a5af2215682dc28144
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Tue May 15 14:18:59 2012 -0700
Provide functions to access arbitrary GPIO pins and vectors
This change adds utility functions which allow to read any GPIO pin,
as well as a vector of GPIO pin values.
As presented, these functions will be available to Sandy Bridge and
Ivy Bridge systems only.
There is no error checking: trying to read GPIO pin number which
exceeds actual number of pins will return zero, trying to read GPIO
which is not actually configured as such will return unpredictable
value.
When reading a GPIO pin vector, the pin numbers are passed in an
array, terminated by -1. For instance, to read GPIO pins 4, 2, 15 as a
three bit number GPIO4 * 4 + GPIO2 * 2 + GPIO15 * 1, one should pass
pointer to array of {4, 2, 15, -1}.
Change-Id: I042c12dbcb3c46d14ed864a48fc37d54355ced7d
Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
---
src/southbridge/intel/bd82x6x/gpio.c | 37 ++++++++++++++++++++++++++++++++++
src/southbridge/intel/bd82x6x/gpio.h | 8 +++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/src/southbridge/intel/bd82x6x/gpio.c b/src/southbridge/intel/bd82x6x/gpio.c
index 598726a..2ba34ea 100644
--- a/src/southbridge/intel/bd82x6x/gpio.c
+++ b/src/southbridge/intel/bd82x6x/gpio.c
@@ -25,6 +25,8 @@
#include "pch.h"
#include "gpio.h"
+#define MAX_GPIO_NUMBER 75 /* zero based */
+
void setup_pch_gpios(const struct pch_gpio_map *gpio)
{
u16 gpiobase = pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffc;
@@ -63,3 +65,38 @@ void setup_pch_gpios(const struct pch_gpio_map *gpio)
if (gpio->set3.reset)
outl(*((u32*)gpio->set3.reset), gpiobase + GP_RST_SEL3);
}
+
+int get_gpio(int gpio_num)
+{
+ static const int gpio_reg_offsets[] = {0xc, 0x38, 0x48};
+ u16 gpio_base = pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffc;
+ int index, bit;
+
+ if (gpio_num > MAX_GPIO_NUMBER)
+ return 0; /* Just ignore wrong gpio numbers. */
+
+ index = gpio_num / 32;
+ bit = gpio_num % 32;
+
+ return (inl(gpio_base + gpio_reg_offsets[index]) >> bit) & 1;
+}
+
+/*
+ * get a number comprised of multiple GPIO values. gpio_num_array points to
+ * the array of gpio pin numbers to scan, terminated by -1.
+ */
+unsigned get_gpios(const int *gpio_num_array)
+{
+ int gpio;
+ unsigned bitmask = 1;
+ unsigned vector = 0;
+
+ while (bitmask &&
+ ((gpio = *gpio_num_array++) != -1)) {
+ vector <<= 1;
+ if (get_gpio(gpio))
+ vector |= bitmask;
+ bitmask <<= 1;
+ }
+ return vector;
+}
diff --git a/src/southbridge/intel/bd82x6x/gpio.h b/src/southbridge/intel/bd82x6x/gpio.h
index 214947f..44e808a 100644
--- a/src/southbridge/intel/bd82x6x/gpio.h
+++ b/src/southbridge/intel/bd82x6x/gpio.h
@@ -150,4 +150,12 @@ struct pch_gpio_map {
/* Configure GPIOs with mainboard provided settings */
void setup_pch_gpios(const struct pch_gpio_map *gpio);
+/* get GPIO pin value */
+int get_gpio(int gpio_num);
+/*
+ * get a number comprised of multiple GPIO values. gpio_num_array points to
+ * the array of gpio pin numbers to scan, terminated by -1.
+ */
+unsigned get_gpios(const int *gpio_num_array);
+
#endif