Software APIs
chip_info.h
1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_
6#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_
7
8#include <stdint.h>
9
11
12/**
13 * A truncated commit hash from the open-source OpenTitan repo that can be
14 * used to reproduce the ROM binary.
15 */
16typedef struct chip_info_scm_revision {
17 /**
18 * Least significant word of the truncated commit hash.
19 */
21 /**
22 * Most significant word of the truncated commit hash.
23 */
25} chip_info_scm_revision_t;
26
27typedef struct chip_info {
28 /**
29 * Truncated commit hash.
30 */
31 chip_info_scm_revision_t scm_revision;
32 /**
33 * Chip info format version.
34 *
35 * The chip info struct is placed at the end of the ROM. Placing this field at
36 * the end of the struct places the version word at the last addressable ROM
37 * address, which gives later boot stages a fixed address to look for this
38 * field. See `sw/device/silicon_creator/rom/rom.ld` for details.
39 */
40 uint32_t version;
41} chip_info_t;
42OT_ASSERT_MEMBER_OFFSET(chip_info_t, scm_revision, 0);
43OT_ASSERT_MEMBER_OFFSET(chip_info_t, version, 8);
44OT_ASSERT_SIZE(chip_info_t, 12);
45
46enum {
47 /**
48 * Chip info format version 1 value.
49 */
50 kChipInfoVersion1 = 0x4efecea6,
51};
52
53/**
54 * Extern declaration for the `kChipInfo` instance placed at the end of ROM.
55 *
56 * The actual definition is in an auto-generated file.
57 */
58extern const chip_info_t kChipInfo;
59
60#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_