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