Add Google ChromeOS vendor support
[coreboot.git] / src / vendorcode / google / chromeos / gnvs.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 The ChromiumOS Authors.  All rights reserved.
5  *
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.
9  *
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.
14  *
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
18  */
19
20 #ifndef __VENDORCODE_GOOGLE_CHROMEOS_GNVS_H
21 #define __VENDORCODE_GOOGLE_CHROMEOS_GNVS_H
22
23 #define BOOT_REASON_OTHER       0
24 #define BOOT_REASON_S3DIAG      9
25
26 #define CHSW_RECOVERY_X86       (1 << 1)
27 #define CHSW_RECOVERY_EC        (1 << 2)
28 #define CHSW_DEVELOPER_SWITCH   (1 << 5)
29 #define CHSW_FIRMWARE_WP_DIS    (1 << 9)
30
31 #define ACTIVE_MAINFW_RECOVERY  0
32 #define ACTIVE_MAINFW_RW_A      1
33 #define ACTIVE_MAINFW_RW_B      2
34
35 #define ACTIVE_MAINFW_TYPE_RECOVERY     0
36 #define ACTIVE_MAINFW_TYPE_NORMAL       1
37 #define ACTIVE_MAINFW_TYPE_DEVELOPER    2
38
39 #define RECOVERY_REASON_NONE    0
40 #define RECOVERY_REASON_ME      1
41 // TODO(reinauer) other recovery reasons?
42
43 #define ACTIVE_ECFW_RO          0
44 #define ACTIVE_ECFW_RW          1
45
46 typedef struct {
47         /* ChromeOS specific */
48         u32     vbt0;           // 00 boot reason
49         u32     vbt1;           // 04 active main firmware
50         u32     vbt2;           // 08 active ec firmware
51         u16     vbt3;           // 0c CHSW
52         u8      vbt4[256];      // 0e HWID
53         u8      vbt5[64];       // 10e FWID
54         u8      vbt6[64];       // 14e FRID - 275
55         u32     vbt7;           // 18e active main firmware type
56         u32     vbt8;           // 192 recovery reason
57         u32     vbt9;           // 196 fmap base address
58         u8      vdat[3072];     // 19a
59         u32     vbt10;          // d9a smbios bios version
60         u32     mehh[8];        // d9e management engine hash
61                                 // dbe
62 } __attribute__((packed)) chromeos_acpi_t;
63
64 extern chromeos_acpi_t *vboot_data;
65 void chromeos_init_vboot(chromeos_acpi_t *chromeos);
66 void chromeos_set_vboot_data_ptr(void *);
67 void chromeos_set_me_hash(u32*, int);
68
69 #endif