Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10157
-gerrit
commit fb111646e00881e78dc4cc1889e67d81ecce4225
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri May 8 17:14:15 2015 -0500
vboot: allow for dynamic work buffers
The vboot library currently relies on link-time known
address and sizes of the work buffer. Not all platforms
can provide such semantics. Therefore, add an option
to use cbmem for the work buffer. This implies such platforms
can only do verification of the firmware after main memory
has been initialized.
Change-Id: If0b0f6b2a187b5c1fb56af08b6cb384a935be096
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/cbmem.h | 2 ++
src/vendorcode/google/chromeos/vboot2/Kconfig | 10 ++++++++++
src/vendorcode/google/chromeos/vboot2/common.c | 14 ++++++++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index c5cd52a..07e5645 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -84,6 +84,7 @@
#define CBMEM_ID_STAGEx_CACHE 0x57a9e100
#define CBMEM_ID_TIMESTAMP 0x54494d45
#define CBMEM_ID_VBOOT_HANDOFF 0x780074f0
+#define CBMEM_ID_VBOOT_WORKBUF 0x78007343
#define CBMEM_ID_WIFI_CALIBRATION 0x57494649
#ifndef __ASSEMBLER__
@@ -128,6 +129,7 @@
{ CBMEM_ID_SPINTABLE, "SPIN TABLE " }, \
{ CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \
{ CBMEM_ID_VBOOT_HANDOFF, "VBOOT " }, \
+ { CBMEM_ID_VBOOT_WORKBUF, "VBOOT WORK " }, \
{ CBMEM_ID_WIFI_CALIBRATION, "WIFI CLBR " },
struct cbmem_entry;
diff --git a/src/vendorcode/google/chromeos/vboot2/Kconfig b/src/vendorcode/google/chromeos/vboot2/Kconfig
index bb6c1ad..a086785 100644
--- a/src/vendorcode/google/chromeos/vboot2/Kconfig
+++ b/src/vendorcode/google/chromeos/vboot2/Kconfig
@@ -101,3 +101,13 @@ config VBOOT_BOOT_LOADER_INDEX
help
This is the index of the bootloader component in the verified
firmware block.
+
+config VBOOT_DYNAMIC_WORK_BUFFER
+ bool "Vboot's work buffer is dynamically allocated."
+ default n
+ depends on VBOOT_VERIFY_FIRMWARE
+ help
+ This option is used when there isn't enough pre-main memory
+ ram to allocate the vboot work buffer. That means vboot verification
+ is after memory init and requires main memory to back the work
+ buffer.
diff --git a/src/vendorcode/google/chromeos/vboot2/common.c b/src/vendorcode/google/chromeos/vboot2/common.c
index 289005c..deb0c88 100644
--- a/src/vendorcode/google/chromeos/vboot2/common.c
+++ b/src/vendorcode/google/chromeos/vboot2/common.c
@@ -18,6 +18,7 @@
*/
#include <cbfs.h>
+#include <cbmem.h>
#include <console/console.h>
#include <reset.h>
#include "../chromeos.h"
@@ -25,14 +26,23 @@
#include "../vboot_handoff.h"
#include "misc.h"
+static const size_t vb_work_buf_size = 16 * KiB;
+
struct vb2_working_data * const vboot_get_working_data(void)
{
- return (struct vb2_working_data *)_vboot2_work;
+ if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
+ /* cbmem_add() does a cbmem_find() first. */
+ return cbmem_add(CBMEM_ID_VBOOT_WORKBUF, vb_work_buf_size);
+ else
+ return (struct vb2_working_data *)_vboot2_work;
}
size_t vb2_working_data_size(void)
{
- return _vboot2_work_size;
+ if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
+ return vb_work_buf_size;
+ else
+ return _vboot2_work_size;
}
void *vboot_get_work_buffer(struct vb2_working_data *wd)
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10175
-gerrit
commit 95fb3e7926cf493b3e70b36f2f9a33fb421df983
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon May 11 14:19:37 2015 -0500
imd: don't recover on limit == 0
If the limit of the large starting region was set with
a NULL pointer then the limit field will be 0. If the
limit is zero then no attempt to recover is necessary
as there is no region to recover.
This prevented an early call cbmem_find() from hanging a
rambi device. The config was with vboot enabled and was
way before memory init in the sequence.
Change-Id: I7163d93c31ecef2c108a6dde0206dc0b6f158b5c
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/lib/imd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lib/imd.c b/src/lib/imd.c
index 02fc2b3..612e3f1 100644
--- a/src/lib/imd.c
+++ b/src/lib/imd.c
@@ -411,6 +411,9 @@ void imd_handle_init_partial_recovery(struct imd *imd)
struct imd_root_pointer *rp;
struct imdr *imdr;
+ if (imd->lg.limit == 0)
+ return;
+
imd_handle_init(imd, (void *)imd->lg.limit);
/* Initialize root pointer for the large regions. */
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10157
-gerrit
commit d3e17dda2cf9d9befc62af51cb5b7790729c1bd1
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri May 8 17:14:15 2015 -0500
vboot: allow for dynamic work buffers
The vboot library currently relies on link-time known
address and sizes of the work buffer. Not all platforms
can provide such semantics. Therefore, add an option
to use cbmem for the work buffer. This implies such platforms
can only do verification of the firmware after main memory
has been initialized.
Change-Id: If0b0f6b2a187b5c1fb56af08b6cb384a935be096
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/include/cbmem.h | 2 ++
src/vendorcode/google/chromeos/vboot2/Kconfig | 10 ++++++++++
src/vendorcode/google/chromeos/vboot2/common.c | 14 ++++++++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index c5cd52a..07e5645 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -84,6 +84,7 @@
#define CBMEM_ID_STAGEx_CACHE 0x57a9e100
#define CBMEM_ID_TIMESTAMP 0x54494d45
#define CBMEM_ID_VBOOT_HANDOFF 0x780074f0
+#define CBMEM_ID_VBOOT_WORKBUF 0x78007343
#define CBMEM_ID_WIFI_CALIBRATION 0x57494649
#ifndef __ASSEMBLER__
@@ -128,6 +129,7 @@
{ CBMEM_ID_SPINTABLE, "SPIN TABLE " }, \
{ CBMEM_ID_TIMESTAMP, "TIME STAMP " }, \
{ CBMEM_ID_VBOOT_HANDOFF, "VBOOT " }, \
+ { CBMEM_ID_VBOOT_WORKBUF, "VBOOT WORK " }, \
{ CBMEM_ID_WIFI_CALIBRATION, "WIFI CLBR " },
struct cbmem_entry;
diff --git a/src/vendorcode/google/chromeos/vboot2/Kconfig b/src/vendorcode/google/chromeos/vboot2/Kconfig
index bb6c1ad..a086785 100644
--- a/src/vendorcode/google/chromeos/vboot2/Kconfig
+++ b/src/vendorcode/google/chromeos/vboot2/Kconfig
@@ -101,3 +101,13 @@ config VBOOT_BOOT_LOADER_INDEX
help
This is the index of the bootloader component in the verified
firmware block.
+
+config VBOOT_DYNAMIC_WORK_BUFFER
+ bool "Vboot's work buffer is dynamically allocated."
+ default n
+ depends on VBOOT_VERIFY_FIRMWARE
+ help
+ This option is used when there isn't enough pre-main memory
+ ram to allocate the vboot work buffer. That means vboot verification
+ is after memory init and requires main memory to back the work
+ buffer.
diff --git a/src/vendorcode/google/chromeos/vboot2/common.c b/src/vendorcode/google/chromeos/vboot2/common.c
index 289005c..deb0c88 100644
--- a/src/vendorcode/google/chromeos/vboot2/common.c
+++ b/src/vendorcode/google/chromeos/vboot2/common.c
@@ -18,6 +18,7 @@
*/
#include <cbfs.h>
+#include <cbmem.h>
#include <console/console.h>
#include <reset.h>
#include "../chromeos.h"
@@ -25,14 +26,23 @@
#include "../vboot_handoff.h"
#include "misc.h"
+static const size_t vb_work_buf_size = 16 * KiB;
+
struct vb2_working_data * const vboot_get_working_data(void)
{
- return (struct vb2_working_data *)_vboot2_work;
+ if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
+ /* cbmem_add() does a cbmem_find() first. */
+ return cbmem_add(CBMEM_ID_VBOOT_WORKBUF, vb_work_buf_size);
+ else
+ return (struct vb2_working_data *)_vboot2_work;
}
size_t vb2_working_data_size(void)
{
- return _vboot2_work_size;
+ if (IS_ENABLED(CONFIG_VBOOT_DYNAMIC_WORK_BUFFER))
+ return vb_work_buf_size;
+ else
+ return _vboot2_work_size;
}
void *vboot_get_work_buffer(struct vb2_working_data *wd)
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/10144
-gerrit
commit b097745c6ec0db5d2a7b1713b5a96c2bde799b5d
Author: Dave Frodin <dave.frodin(a)se-eng.com>
Date: Fri May 8 07:20:48 2015 -0600
Add a function to do indexed I/O reads/writes
There are multiple superio functions defined to
do indexed I/O reads and writes. These generic
functions will replace them in a follow on patch.
Change-Id: I491a40e51d304496c5ec45a8171370b281669048
Signed-off-by: Dave Frodin <dave.frodin(a)se-eng.com>
---
src/arch/x86/lib/Makefile.inc | 2 ++
src/arch/x86/lib/io_index.c | 33 +++++++++++++++++++++++++++++++++
src/include/io_index.h | 23 +++++++++++++++++++++++
3 files changed, 58 insertions(+)
diff --git a/src/arch/x86/lib/Makefile.inc b/src/arch/x86/lib/Makefile.inc
index c7e8b62..ea1430d 100644
--- a/src/arch/x86/lib/Makefile.inc
+++ b/src/arch/x86/lib/Makefile.inc
@@ -2,6 +2,7 @@
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
romstage-y += cbfs_and_run.c
+romstage-y += io_index.c
romstage-y += memset.c
romstage-y += memcpy.c
romstage-y += memmove.c
@@ -13,6 +14,7 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
ramstage-y += c_start.S
ramstage-y += cpu.c
+ramstage-y += io_index.c
ramstage-y += pci_ops_conf1.c
ramstage-$(CONFIG_MMCONF_SUPPORT) += pci_ops_mmconf.c
ramstage-y += exception.c
diff --git a/src/arch/x86/lib/io_index.c b/src/arch/x86/lib/io_index.c
new file mode 100644
index 0000000..a8e4b2d
--- /dev/null
+++ b/src/arch/x86/lib/io_index.c
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 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; 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 <arch/io.h>
+#include <io_index.h>
+
+u8 io_read_index(u16 port, u8 reg)
+{
+ outb(reg, port);
+ return inb(port + 1);
+}
+
+void io_write_index(u16 port, u8 reg, u8 value)
+{
+ outb(reg, port);
+ outb(value, port + 1);
+}
diff --git a/src/include/io_index.h b/src/include/io_index.h
new file mode 100644
index 0000000..04be707
--- /dev/null
+++ b/src/include/io_index.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 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; 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 <stdint.h>
+
+u8 io_read_index(u16 port, u8 reg);
+void io_write_index(u16 port, u8 reg, u8 value);