2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <console/console.h>
25 chromeos_acpi_t *vboot_data;
26 static u32 me_hash_saved[8];
28 void chromeos_init_vboot(chromeos_acpi_t *chromeos)
30 vboot_data = chromeos;
32 /* Copy saved ME hash into NVS */
33 memcpy(vboot_data->mehh, me_hash_saved, sizeof(vboot_data->mehh));
36 void chromeos_set_vboot_data_ptr(void *blob)
38 /* This code has to be rewritten to pass the vboot table
39 * pointer through the coreboot table instead of the
40 * FDT, since FDT support was rejected upstream. For now
41 * just make the code available for reference.
43 #if 0 // CONFIG_ADD_FDT
44 int node_offset, addr_cell_len;
46 uintptr_t table_addr = (uintptr_t)vboot_data;
51 cell = fdt_getprop(blob, 0, "#address-cells", NULL);
52 if (cell && *cell == 2) {
54 table_addr64 = cpu_to_fdt64(table_addr);
55 table_ptr = &table_addr64;
58 table_addr32 = cpu_to_fdt32(table_addr);
59 table_ptr = &table_addr32;
62 node_offset = fdt_path_offset(blob, "/chromeos-config");
63 if (node_offset < 0) {
65 "Couldn't find /chromeos-config in the fdt.\n");
69 if (fdt_setprop(blob, node_offset, "gnvs-vboot-table",
70 table_ptr, addr_cell_len) < 0) {
71 printk(BIOS_ERR, "Couldn't set gnvs-vboot-table.\n");
74 printk(BIOS_ERR, "Can't set gnvs-vboot-table.\n");
78 void chromeos_set_me_hash(u32 *hash, int len)
80 if ((len*sizeof(u32)) > sizeof(vboot_data->mehh))
83 /* Copy to NVS or save until it is ready */
85 memcpy(vboot_data->mehh, hash, len*sizeof(u32));
87 memcpy(me_hash_saved, hash, len*sizeof(u32));