summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2013-03-14 09:16:41 (GMT)
committerGabe Black <gabeblack@chromium.org>2013-03-14 11:57:09 (GMT)
commit04430a2d05273b4a9ab171f0275e828a6bbe6430 (patch)
treef8513df6fed92d0338b1549f403123865f646330
parent61aff8115c3674f49cd678064e79a94255607d99 (diff)
downloaddepthcharge-factory-spring-3842.B.tar.gz
depthcharge-factory-spring-3842.B.tar.xz
Modularize setting up data for crossystem.factory-spring-3842.B
Setting up the crossystem data isn't always necessary, and exactly how it works can vary from system to system. BUG=chrome-os-partner:16688 TEST=Built and booted on Link and ran crossystem to verify that the data looked reasonable. BRANCH=None Change-Id: I3e56573f901c7d5c5d15f1a02ab154fbed1ba0fb Signed-off-by: Gabe Black <gabeblack@google.com>
-rw-r--r--board/daisy/defconfig1
-rw-r--r--board/fox/defconfig1
-rw-r--r--board/link/defconfig1
-rw-r--r--board/lumpy/defconfig1
-rw-r--r--src/arch/x86/zimage.c4
-rw-r--r--src/vboot/Kconfig17
-rw-r--r--src/vboot/Makefile.inc2
-rw-r--r--src/vboot/crossystem/Makefile.inc22
-rw-r--r--src/vboot/crossystem/acpi.c (renamed from src/vboot/util/acpi.c)3
-rw-r--r--src/vboot/crossystem/crossystem.h30
-rw-r--r--src/vboot/crossystem/fdt.c39
-rw-r--r--src/vboot/crossystem/stub.c32
-rw-r--r--src/vboot/stages.c5
-rw-r--r--src/vboot/util/Makefile.inc1
-rw-r--r--src/vboot/util/acpi.h2
15 files changed, 150 insertions, 11 deletions
diff --git a/board/daisy/defconfig b/board/daisy/defconfig
index 88b17c2..10a1f02 100644
--- a/board/daisy/defconfig
+++ b/board/daisy/defconfig
@@ -11,6 +11,7 @@ CONFIG_EC_SOFTWARE_SYNC=y
CONFIG_RO_NORMAL_SUPPORT=y
CONFIG_VIRTUAL_DEV_SWITCH=y
+CONFIG_CROSSYSTEM_FDT=y
CONFIG_NV_STORAGE_MKBP=y
# Kernel format
diff --git a/board/fox/defconfig b/board/fox/defconfig
index 6c3943b..10dddd5 100644
--- a/board/fox/defconfig
+++ b/board/fox/defconfig
@@ -7,6 +7,7 @@ CONFIG_FMAP_OFFSET=0x610000
# Vboot
CONFIG_RO_NORMAL_SUPPORT=y
+CONFIG_CROSSYSTEM_ACPI=y
CONFIG_NV_STORAGE_CMOS=y
# Kernel format
diff --git a/board/link/defconfig b/board/link/defconfig
index ee6bfb1..492c2a2 100644
--- a/board/link/defconfig
+++ b/board/link/defconfig
@@ -10,6 +10,7 @@ CONFIG_OPROM_MATTERS=y
CONFIG_RO_NORMAL_SUPPORT=y
CONFIG_VIRTUAL_DEV_SWITCH=y
+CONFIG_CROSSYSTEM_ACPI=y
CONFIG_NV_STORAGE_CMOS=y
# Kernel format
diff --git a/board/lumpy/defconfig b/board/lumpy/defconfig
index 1983e47..1f01f66 100644
--- a/board/lumpy/defconfig
+++ b/board/lumpy/defconfig
@@ -8,6 +8,7 @@ CONFIG_FMAP_OFFSET=0x610000
CONFIG_OPROM_MATTERS=y
CONFIG_RO_NORMAL_SUPPORT=y
+CONFIG_CROSSYSTEM_ACPI=y
CONFIG_NV_STORAGE_CMOS=y
# Kernel format
diff --git a/src/arch/x86/zimage.c b/src/arch/x86/zimage.c
index 659c44f..1164b67 100644
--- a/src/arch/x86/zimage.c
+++ b/src/arch/x86/zimage.c
@@ -26,9 +26,5 @@
int boot(void *kernel, char *cmd_line, void *params, void *loader)
{
- // Update the crossystem data in the ACPI tables.
- if (acpi_update_data())
- return 1;
-
return boot_x86_linux(params, cmd_line, kernel);
}
diff --git a/src/vboot/Kconfig b/src/vboot/Kconfig
index 96c4b64..51153f7 100644
--- a/src/vboot/Kconfig
+++ b/src/vboot/Kconfig
@@ -74,3 +74,20 @@ config NV_STORAGE_MKBP
The nonvolatile data is stored by the ChromeOS EC.
endchoice
+
+choice
+ prompt "Crossystem data mechanism"
+ default CROSSYSTEM_STUB
+ help
+ The mechanism for passing data to crossystem.
+
+config CROSSYSTEM_STUB
+ bool "stub"
+
+config CROSSYSTEM_ACPI
+ bool "ACPI"
+
+config CROSSYSTEM_FDT
+ bool "FDT"
+
+endchoice
diff --git a/src/vboot/Makefile.inc b/src/vboot/Makefile.inc
index ba801ff..1623430 100644
--- a/src/vboot/Makefile.inc
+++ b/src/vboot/Makefile.inc
@@ -17,7 +17,7 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-subdirs-y := callbacks stages util
+subdirs-y := callbacks crossystem stages util
depthcharge-y += stages.c
diff --git a/src/vboot/crossystem/Makefile.inc b/src/vboot/crossystem/Makefile.inc
new file mode 100644
index 0000000..bbd4e02
--- /dev/null
+++ b/src/vboot/crossystem/Makefile.inc
@@ -0,0 +1,22 @@
+##
+## This file is part of the depthcharge project.
+##
+## Copyright 2013 Google Inc.
+##
+## 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
+##
+
+depthcharge-$(CONFIG_CROSSYSTEM_ACPI) += acpi.c
+depthcharge-$(CONFIG_CROSSYSTEM_FDT) += fdt.c
+depthcharge-$(CONFIG_CROSSYSTEM_STUB) += stub.c
diff --git a/src/vboot/util/acpi.c b/src/vboot/crossystem/acpi.c
index 1fb6dfa..d861965 100644
--- a/src/vboot/util/acpi.c
+++ b/src/vboot/crossystem/acpi.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "image/fmap.h"
+#include "vboot/crossystem/crossystem.h"
#include "vboot/util/acpi.h"
#include "vboot/util/commonparams.h"
#include "vboot/util/flag.h"
@@ -39,7 +40,7 @@ enum {
VDAT_RECOVERY = 0xFF
};
-int acpi_update_data(void)
+int crossystem_setup(void)
{
chromeos_acpi_t *acpi_table = (chromeos_acpi_t *)lib_sysinfo.vdat_addr;
VbSharedDataHeader *vdat = (VbSharedDataHeader *)&acpi_table->vdat;
diff --git a/src/vboot/crossystem/crossystem.h b/src/vboot/crossystem/crossystem.h
new file mode 100644
index 0000000..e95b0ea
--- /dev/null
+++ b/src/vboot/crossystem/crossystem.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __VBOOT_CROSSYSTEM_CROSSYSTEM_H__
+#define __VBOOT_CROSSYSTEM_CROSSYSTEM_H__
+
+// Setup the crossystem data. This should be done as late as possible to
+// ensure the data used is up to date.
+int crossystem_setup(void);
+
+#endif /* __VBOOT_CROSSYSTEM_CROSSYSTEM_H__ */
diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c
new file mode 100644
index 0000000..96cc62d
--- /dev/null
+++ b/src/vboot/crossystem/fdt.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include "base/device_tree.h"
+#include "vboot/crossystem/crossystem.h"
+
+static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *data)
+{
+ return 0;
+}
+
+static DeviceTreeFixup crossystem_fixup = {
+ &install_crossystem_data
+};
+
+int crossystem_setup(void)
+{
+ list_insert_after(&crossystem_fixup.list_node, &device_tree_fixups);
+ return 0;
+}
diff --git a/src/vboot/crossystem/stub.c b/src/vboot/crossystem/stub.c
new file mode 100644
index 0000000..d10443c
--- /dev/null
+++ b/src/vboot/crossystem/stub.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <libpayload.h>
+
+#include "vboot/crossystem/crossystem.h"
+
+int crossystem_setup(void)
+{
+ printf("%s not implemented.\n", __func__);
+ return 0;
+}
+
diff --git a/src/vboot/stages.c b/src/vboot/stages.c
index dbeda28..a8e0817 100644
--- a/src/vboot/stages.c
+++ b/src/vboot/stages.c
@@ -36,6 +36,7 @@
#include "image/symbols.h"
#include "vboot/boot.h"
#include "vboot/stages.h"
+#include "vboot/crossystem/crossystem.h"
#include "vboot/util/commonparams.h"
#include "vboot/util/ec.h"
#include "vboot/util/flag.h"
@@ -201,8 +202,8 @@ int vboot_select_and_load_kernel(void)
cmd_line_buf, sizeof(cmd_line_buf)))
return 1;
- if (boot(kernel, cmd_line_buf, params, loader))
+ if (crossystem_setup())
return 1;
- return 0;
+ return boot(kernel, cmd_line_buf, params, loader);
}
diff --git a/src/vboot/util/Makefile.inc b/src/vboot/util/Makefile.inc
index 421b2b3..3c85619 100644
--- a/src/vboot/util/Makefile.inc
+++ b/src/vboot/util/Makefile.inc
@@ -17,7 +17,6 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-depthcharge-y += acpi.c
depthcharge-y += commonparams.c
depthcharge-y += flag.c
depthcharge-y += memory.c
diff --git a/src/vboot/util/acpi.h b/src/vboot/util/acpi.h
index 9a1e966..2fe743e 100644
--- a/src/vboot/util/acpi.h
+++ b/src/vboot/util/acpi.h
@@ -88,6 +88,4 @@ typedef struct {
// 0xdbe
} __attribute__((packed)) chromeos_acpi_t;
-int acpi_update_data(void);
-
#endif /* __VBOOT_UTIL_ACPI_H__ */