the following patch was just integrated into master:
commit 6555dcc1828a30615b98652cccd80f707550a7fe
Author: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Date: Fri Mar 9 12:30:07 2012 +0100
Add preprocessing capabilities to the cbfs-files mechanism
It's now possible to generate files that are about to be added to
CBFS by specifying "sourcefile:method" as real file name.
This makes the build system use the cbfs-files-preprocessor-$(method)
function to create a file from sourcefile. That generated file is
then added to CBFS.
The first method to be defined is "nvramtool". It expects a plain text
specification of the CMOS configuration and emits the binary format
suitable for cmos.default.
Change-Id: I33a142718fc7238eaf5317b0ed62b4726d9b48f2
Signed-off-by: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Build-Tested: build bot (Jenkins) at Tue Apr 3 16:44:03 2012, giving +1
Reviewed-By: Stefan Reinauer <stefan.reinauer(a)coreboot.org> at Tue Apr 3 18:33:22 2012, giving +2
See http://review.coreboot.org/847 for details.
-gerrit
the following patch was just integrated into master:
commit aa1c0e6a1ba943f011cdf84354c3811b7111bac0
Author: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Date: Fri Mar 9 10:53:52 2012 +0100
Add nvramtool to coreboot build system
This way we can depend on it during build.
Change-Id: I7e773c6a029e376e3d70d0a8c9e96ffe0c2cf82e
Signed-off-by: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Build-Tested: build bot (Jenkins) at Tue Apr 3 16:16:36 2012, giving +1
Reviewed-By: Stefan Reinauer <stefan.reinauer(a)coreboot.org> at Tue Apr 3 18:32:23 2012, giving +2
See http://review.coreboot.org/845 for details.
-gerrit
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/847
-gerrit
commit 6555dcc1828a30615b98652cccd80f707550a7fe
Author: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Date: Fri Mar 9 12:30:07 2012 +0100
Add preprocessing capabilities to the cbfs-files mechanism
It's now possible to generate files that are about to be added to
CBFS by specifying "sourcefile:method" as real file name.
This makes the build system use the cbfs-files-preprocessor-$(method)
function to create a file from sourcefile. That generated file is
then added to CBFS.
The first method to be defined is "nvramtool". It expects a plain text
specification of the CMOS configuration and emits the binary format
suitable for cmos.default.
Change-Id: I33a142718fc7238eaf5317b0ed62b4726d9b48f2
Signed-off-by: Patrick Georgi <Patrick.Georgi(a)secunet.com>
---
Makefile.inc | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 470077e..81d40df 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -79,12 +79,26 @@ $(obj)/$(1).ramstage.o: src/$(1).asl $(obj)/config.h
endef
#######################################################################
+# Parse plaintext cmos defaults into binary format
+# arg1: source file
+# arg2: binary file name
+cbfs-files-processor-nvramtool= \
+ $(eval $(2): $(1) $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout | $(objutil)/nvramtool/nvramtool ; \
+ printf " CREATE $(2) (from $(1))\n"; $(objutil)/nvramtool/nvramtool -y $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout -D $(2).tmp -p $(1) && mv $(2).tmp $(2))
+
+#######################################################################
# Add handler for arbitrary files in CBFS
$(call add-special-class,cbfs-files)
cbfs-files-handler= \
+ $(eval tmp-cbfs-method:=$(word 2, $(subst :, ,$($(2)-file)))) \
+ $(eval $(2)-file:=$(word 1, $(subst :, ,$($(2)-file)))) \
$(if $(wildcard $(1)$($(2)-file)), \
$(eval tmp-cbfs-file:= $(wildcard $(1)$($(2)-file))), \
$(eval tmp-cbfs-file:= $($(2)-file))) \
+ $(if $(tmp-cbfs-method), \
+ $(eval tmp-old-cbfs-file:=$(tmp-cbfs-file)) \
+ $(eval tmp-cbfs-file:=$(shell mktemp $(obj)/mainboard/$(MAINBOARDDIR)/cbfs-file.XXXXXX).out) \
+ $(call cbfs-files-processor-$(tmp-cbfs-method),$(tmp-old-cbfs-file),$(tmp-cbfs-file))) \
$(eval cbfs-files += $(tmp-cbfs-file)|$(2)|$($(2)-type)|$($(2)-position)) \
$(eval $(2)-name:=) \
$(eval $(2)-type:=) \
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/845
-gerrit
commit aa1c0e6a1ba943f011cdf84354c3811b7111bac0
Author: Patrick Georgi <Patrick.Georgi(a)secunet.com>
Date: Fri Mar 9 10:53:52 2012 +0100
Add nvramtool to coreboot build system
This way we can depend on it during build.
Change-Id: I7e773c6a029e376e3d70d0a8c9e96ffe0c2cf82e
Signed-off-by: Patrick Georgi <Patrick.Georgi(a)secunet.com>
---
Makefile.inc | 2 +-
util/nvramtool/Makefile.inc | 48 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 857ad16..470077e 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -40,7 +40,7 @@ PHONY+= clean-abuild coreboot lint lint-stable
# root source directories of coreboot
subdirs-y := src/lib src/boot src/console src/devices src/ec src/southbridge
subdirs-y += src/northbridge src/superio src/drivers src/cpu src/vendorcode
-subdirs-y += util/cbfstool util/sconfig
+subdirs-y += util/cbfstool util/sconfig util/nvramtool
subdirs-y += src/arch/$(ARCHDIR-y)
subdirs-y += src/mainboard/$(MAINBOARDDIR)
subdirs-y += src/vendorcode
diff --git a/util/nvramtool/Makefile.inc b/util/nvramtool/Makefile.inc
new file mode 100644
index 0000000..25d447d
--- /dev/null
+++ b/util/nvramtool/Makefile.inc
@@ -0,0 +1,48 @@
+##
+## Integration of nvramtool into the coreboot build system
+##
+## (C) 2005-2008 coresystems GmbH
+## written by Stefan Reinauer <stepan(a)coresystems.de>
+## (C) 2012 secunet Security Networks AG
+##
+## 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
+##
+
+OS_ARCH = $(shell uname)
+NVRAMTOOLFLAGS := -I$(top)/util/nvramtool
+ifeq ($(OS_ARCH), Darwin)
+NVRAMTOOLFLAGS += -framework DirectHW
+endif
+ifeq ($(OS_ARCH), NetBSD)
+NVRAMTOOLFLAGS += -l$(shell uname -p)
+endif
+
+nvramtoolobj :=
+nvramtoolobj += cli/nvramtool.o cli/opts.o
+nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o
+nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-text.o accessors/layout-bin.o lbtable.o
+nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-hw-unix.o accessors/cmos-mem.o
+
+$(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli:
+ mkdir -p $@
+
+$(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c
+ printf " HOSTCC $(subst $(objutil)/,,$(@))\n"
+ $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $<
+
+$(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj))
+ printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
+ $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj))
+
+
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/844
-gerrit
commit 77a6780c39fbea5ccd89663cb65e80f95bde7310
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Mon Apr 2 13:35:09 2012 -0700
Add support for Intel Turbo feature
Change-Id: I166ead7c219083006c2b05859eb18749c6fbe832
Signed-off-by: Duncan Laurie <dlaurie(a)google.com>
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
src/cpu/intel/turbo/Makefile.inc | 1 +
src/cpu/intel/turbo/turbo.c | 90 ++++++++++++++++++++++++++++++++++++++
src/include/cpu/intel/turbo.h | 44 ++++++++++++++++++
3 files changed, 135 insertions(+), 0 deletions(-)
diff --git a/src/cpu/intel/turbo/Makefile.inc b/src/cpu/intel/turbo/Makefile.inc
new file mode 100644
index 0000000..48ec55d
--- /dev/null
+++ b/src/cpu/intel/turbo/Makefile.inc
@@ -0,0 +1 @@
+ramstage-y += turbo.c
diff --git a/src/cpu/intel/turbo/turbo.c b/src/cpu/intel/turbo/turbo.c
new file mode 100644
index 0000000..779550e
--- /dev/null
+++ b/src/cpu/intel/turbo/turbo.c
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ *
+ * 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 <console/console.h>
+#include <cpu/intel/turbo.h>
+#include <cpu/x86/msr.h>
+#include <arch/cpu.h>
+
+static int turbo_state = TURBO_UNKNOWN;
+
+static const char *turbo_state_desc[] = {
+ [TURBO_UNKNOWN] = "unknown",
+ [TURBO_UNAVAILABLE] = "unavailable",
+ [TURBO_DISABLED] = "available but hidden",
+ [TURBO_ENABLED] = "available and visible"
+};
+
+/*
+ * Determine the current state of Turbo and cache it for later.
+ * Turbo is a package level config so it does not need to be
+ * enabled on every core.
+ */
+int get_turbo_state(void)
+{
+ struct cpuid_result cpuid_regs;
+ int turbo_en, turbo_cap;
+ msr_t msr;
+
+ /* Return cached state if available */
+ if (turbo_state != TURBO_UNKNOWN)
+ return turbo_state;
+
+ cpuid_regs = cpuid(CPUID_LEAF_PM);
+ turbo_cap = !!(cpuid_regs.eax & PM_CAP_TURBO_MODE);
+
+ msr = rdmsr(MSR_IA32_MISC_ENABLES);
+ turbo_en = !(msr.hi & H_MISC_DISABLE_TURBO);
+
+ if (!turbo_cap && turbo_en) {
+ /* Unavailable */
+ turbo_state = TURBO_UNAVAILABLE;
+ } else if (!turbo_cap && !turbo_en) {
+ /* Available but disabled */
+ turbo_state = TURBO_DISABLED;
+ } else if (turbo_cap && turbo_en) {
+ /* Available */
+ turbo_state = TURBO_ENABLED;
+ }
+
+ printk(BIOS_INFO, "Turbo is %s\n", turbo_state_desc[turbo_state]);
+ return turbo_state;
+}
+
+/*
+ * Try to enable Turbo mode.
+ */
+void enable_turbo(void)
+{
+ msr_t msr;
+
+ /* Only possible if turbo is available but hidden */
+ if (get_turbo_state() == TURBO_DISABLED) {
+ /* Clear Turbo Disable bit in Misc Enables */
+ msr = rdmsr(MSR_IA32_MISC_ENABLES);
+ msr.hi &= ~H_MISC_DISABLE_TURBO;
+ wrmsr(MSR_IA32_MISC_ENABLES, msr);
+
+ /* Update cached turbo state */
+ turbo_state = TURBO_ENABLED;
+ printk(BIOS_INFO, "Turbo has been enabled\n");
+ }
+}
diff --git a/src/include/cpu/intel/turbo.h b/src/include/cpu/intel/turbo.h
new file mode 100644
index 0000000..b60c8cf
--- /dev/null
+++ b/src/include/cpu/intel/turbo.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ *
+ * 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
+ */
+
+#ifndef _CPU_INTEL_TURBO_H
+#define _CPU_INTEL_TURBO_H
+
+#define CPUID_LEAF_PM 6
+#define PM_CAP_TURBO_MODE (1 << 1)
+
+#define MSR_IA32_MISC_ENABLES 0x1a0
+#define H_MISC_DISABLE_TURBO (1 << 6)
+
+enum {
+ TURBO_UNKNOWN,
+ TURBO_UNAVAILABLE,
+ TURBO_DISABLED,
+ TURBO_ENABLED,
+};
+
+/* Return current turbo state */
+int get_turbo_state(void);
+
+/* Enable turbo */
+void enable_turbo(void);
+
+#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/844
-gerrit
commit d2dad4a17955030a9632c41fd3a3e581667cd423
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Mon Apr 2 13:35:09 2012 -0700
Add support for Intel Turbo feature
Change-Id: I166ead7c219083006c2b05859eb18749c6fbe832
Signed-off-by: Duncan Laurie <dlaurie(a)google.com>
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
src/cpu/intel/turbo/Makefile.inc | 1 +
src/cpu/intel/turbo/turbo.c | 90 ++++++++++++++++++++++++++++++++++++++
src/include/cpu/intel/turbo.h | 44 ++++++++++++++++++
3 files changed, 135 insertions(+), 0 deletions(-)
diff --git a/src/cpu/intel/turbo/Makefile.inc b/src/cpu/intel/turbo/Makefile.inc
new file mode 100644
index 0000000..48ec55d
--- /dev/null
+++ b/src/cpu/intel/turbo/Makefile.inc
@@ -0,0 +1 @@
+ramstage-y += turbo.c
diff --git a/src/cpu/intel/turbo/turbo.c b/src/cpu/intel/turbo/turbo.c
new file mode 100644
index 0000000..779550e
--- /dev/null
+++ b/src/cpu/intel/turbo/turbo.c
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ *
+ * 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 <console/console.h>
+#include <cpu/intel/turbo.h>
+#include <cpu/x86/msr.h>
+#include <arch/cpu.h>
+
+static int turbo_state = TURBO_UNKNOWN;
+
+static const char *turbo_state_desc[] = {
+ [TURBO_UNKNOWN] = "unknown",
+ [TURBO_UNAVAILABLE] = "unavailable",
+ [TURBO_DISABLED] = "available but hidden",
+ [TURBO_ENABLED] = "available and visible"
+};
+
+/*
+ * Determine the current state of Turbo and cache it for later.
+ * Turbo is a package level config so it does not need to be
+ * enabled on every core.
+ */
+int get_turbo_state(void)
+{
+ struct cpuid_result cpuid_regs;
+ int turbo_en, turbo_cap;
+ msr_t msr;
+
+ /* Return cached state if available */
+ if (turbo_state != TURBO_UNKNOWN)
+ return turbo_state;
+
+ cpuid_regs = cpuid(CPUID_LEAF_PM);
+ turbo_cap = !!(cpuid_regs.eax & PM_CAP_TURBO_MODE);
+
+ msr = rdmsr(MSR_IA32_MISC_ENABLES);
+ turbo_en = !(msr.hi & H_MISC_DISABLE_TURBO);
+
+ if (!turbo_cap && turbo_en) {
+ /* Unavailable */
+ turbo_state = TURBO_UNAVAILABLE;
+ } else if (!turbo_cap && !turbo_en) {
+ /* Available but disabled */
+ turbo_state = TURBO_DISABLED;
+ } else if (turbo_cap && turbo_en) {
+ /* Available */
+ turbo_state = TURBO_ENABLED;
+ }
+
+ printk(BIOS_INFO, "Turbo is %s\n", turbo_state_desc[turbo_state]);
+ return turbo_state;
+}
+
+/*
+ * Try to enable Turbo mode.
+ */
+void enable_turbo(void)
+{
+ msr_t msr;
+
+ /* Only possible if turbo is available but hidden */
+ if (get_turbo_state() == TURBO_DISABLED) {
+ /* Clear Turbo Disable bit in Misc Enables */
+ msr = rdmsr(MSR_IA32_MISC_ENABLES);
+ msr.hi &= ~H_MISC_DISABLE_TURBO;
+ wrmsr(MSR_IA32_MISC_ENABLES, msr);
+
+ /* Update cached turbo state */
+ turbo_state = TURBO_ENABLED;
+ printk(BIOS_INFO, "Turbo has been enabled\n");
+ }
+}
diff --git a/src/include/cpu/intel/turbo.h b/src/include/cpu/intel/turbo.h
new file mode 100644
index 0000000..b60c8cf
--- /dev/null
+++ b/src/include/cpu/intel/turbo.h
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
+ *
+ * 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
+ */
+
+#ifndef _CPU_INTEL_TURBO_H
+#define _CPU_INTEL_TURBO_H
+
+#define CPUID_LEAF_PM 6
+#define PM_CAP_TURBO_MODE (1 << 1)
+
+#define MSR_IA32_MISC_ENABLES 0x1a0
+#define H_MISC_DISABLE_TURBO (1 << 6)
+
+enum {
+ TURBO_UNKNOWN,
+ TURBO_UNAVAILABLE,
+ TURBO_DISABLED,
+ TURBO_ENABLED,
+};
+
+/* Return current turbo state */
+int get_turbo_state(void);
+
+/* Enable turbo */
+void enable_turbo(void);
+
+#endif