gbb_header.h revision a2db67d204c0dd3d152ff54958bf42c5dbe394ff
1/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 *
5 * Data structure of Google Binary Block (GBB)
6 */
7
8#ifndef VBOOT_REFERENCE_GBB_HEADER_H_
9#define VBOOT_REFERENCE_GBB_HEADER_H_
10
11#include "sysincludes.h"
12
13#define GBB_HEADER_SIZE    128
14
15#define GBB_SIGNATURE      "$GBB"
16#define GBB_SIGNATURE_SIZE 4
17
18/*
19 * GBB version constants.
20 *
21 * If the major version is different than the reader can handle, it shouldn't
22 * attempt to parse the GBB.
23 *
24 * If the minor version is different, the reader can still parse it.  If the
25 * minor version is greater than expected, new fields were added in a way which
26 * does not interfere with the old fields.  If it's less than expected, some of
27 * the fields expected by the reader aren't initialized, and the reader should
28 * return default values for those fields.
29 */
30#define GBB_MAJOR_VER      1
31#define GBB_MINOR_VER      1
32
33/* Maximum length of a HWID in bytes, counting terminating null. */
34#define GBB_HWID_MAX_SIZE  256
35
36/* Flags for .flags field */
37/* Reduce the dev screen delay to 2 sec from 30 sec to speedup factory. */
38#define GBB_FLAG_DEV_SCREEN_SHORT_DELAY   0x00000001
39/*
40 * BIOS should load option ROMs from arbitrary PCI devices. We'll never enable
41 * this ourselves because it executes non-verified code, but if a customer
42 * wants to void their warranty and set this flag in the read-only flash, they
43 * should be able to do so.
44 */
45#define GBB_FLAG_LOAD_OPTION_ROMS         0x00000002
46/*
47 * The factory flow may need the BIOS to boot a non-ChromeOS kernel if the
48 * dev-switch is on. This flag allows that.
49 */
50#define GBB_FLAG_ENABLE_ALTERNATE_OS      0x00000004
51/* Force dev switch on, regardless of physical/keyboard dev switch position. */
52#define GBB_FLAG_FORCE_DEV_SWITCH_ON      0x00000008
53/* Allow booting from USB in dev mode even if dev_boot_usb=0. */
54#define GBB_FLAG_FORCE_DEV_BOOT_USB       0x00000010
55/* Disable firmware rollback protection. */
56#define GBB_FLAG_DISABLE_FW_ROLLBACK_CHECK  0x00000020
57/* Allow Enter key to trigger dev->tonorm screen transition */
58#define GBB_FLAG_ENTER_TRIGGERS_TONORM    0x00000040
59/* Allow booting Legacy OSes in dev mode even if dev_boot_legacy=0. */
60#define GBB_FLAG_FORCE_DEV_BOOT_LEGACY    0x00000080
61/* Allow booting using alternate keys for FAFT servo testing */
62#define GBB_FLAG_FAFT_KEY_OVERIDE         0x00000100
63
64#ifdef __cplusplus
65extern "C" {
66#endif  /* __cplusplus */
67
68typedef struct GoogleBinaryBlockHeader
69{
70	/* Fields present in version 1.0 */
71	uint8_t  signature[GBB_SIGNATURE_SIZE]; /* GBB_SIGNATURE "$GBB" */
72	uint16_t major_version;   /* See GBB_MAJOR_VER */
73	uint16_t minor_version;   /* See GBB_MINOR_VER */
74	uint32_t header_size;     /* size of GBB header in bytes */
75	uint32_t flags;  /* Flags (see GBB_FLAG_*), should be 0 for 1.0. */
76	/* Offsets (from start of header) and sizes (in bytes) of components */
77	uint32_t hwid_offset;		/* HWID */
78	uint32_t hwid_size;
79	uint32_t rootkey_offset;	/* Root key */
80	uint32_t rootkey_size;
81	uint32_t bmpfv_offset;		/* BMP FV */
82	uint32_t bmpfv_size;
83	uint32_t recovery_key_offset;	/* Recovery key */
84	uint32_t recovery_key_size;
85
86	uint8_t  pad[80]; /* To match GBB_HEADER_SIZE.  Initialize to 0. */
87} __attribute__((packed)) GoogleBinaryBlockHeader;
88
89#ifdef __cplusplus
90}
91#endif  /* __cplusplus */
92
93#endif  /* VBOOT_REFERENCE_GBB_HEADER_H_ */
94