TT-System-Firmware APIs 19.17.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
bh_fwtable.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Tenstorrent AI ULC
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef BH_FWTABLE_H
7#define BH_FWTABLE_H
8
9#include <stdbool.h>
10#include <stdint.h>
11#include <zephyr/device.h>
12#include <zephyr/sys/util.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/*
19 * The generated nanopb headers only exist when the bh_fwtable driver is built.
20 * SMC recovery builds disable the driver (see drivers/misc/bh_fwtable/Kconfig),
21 * but still pull in this header transitively for the plain chip enums below
22 * (e.g. PcbType via regulator.h).
23 */
24#ifdef CONFIG_BH_FWTABLE
25#include "fw_table.pb.h"
26#include "flash_info.pb.h"
27#include "read_only.pb.h"
28#endif
29
30const struct _FwTable *tt_bh_fwtable_get_fw_table(const struct device *dev);
31const struct _FlashInfoTable *tt_bh_fwtable_get_flash_info_table(const struct device *dev);
32const struct _ReadOnly *tt_bh_fwtable_get_read_only_table(const struct device *dev);
34
35/* Board type values extracted from board_id (bits 36-55, up to 5 hex digits) */
36#define BOARDTYPE_FROM_BOARD_ID(board_id) ((uint32_t)(((board_id) >> 36) & 0xFFFFF))
37/*
38 * Extended board IDs encode the part number in the upper 8 hex digits. The
39 * board type occupies the middle 5 hex digits of that part number.
40 */
41#define BOARDTYPE_FROM_EXTENDED_BOARD_ID(board_id_high, board_id) \
42 ((uint32_t)(((((uint32_t)(board_id_high) << 16) | \
43 (uint32_t)((uint64_t)(board_id) >> 48)) >> \
44 4) & \
45 0xFFFFF))
46#define BOARDTYPE_ORION_SLT 0x37
47#define BOARDTYPE_P100A 0x43
48#define BOARDTYPE_P150A 0x40
49#define BOARDTYPE_P150 0x41
50#define BOARDTYPE_P150C 0x42
51#define BOARDTYPE_P300 0x44
52#define BOARDTYPE_P300A 0x45
53#define BOARDTYPE_P300C 0x46
54#define BOARDTYPE_UBB 0x47
55#define BOARDTYPE_GALAXY2 0x78
56#define BOARDTYPE_GALAXY_CF 0x202
57
67
72void tt_bh_fwtable_apply_ccfgovr(const struct device *dev);
73
74/*
75 * Outcome of the boot-time ccfgovr merge, one 2-bit state per bank, as
76 * returned by tt_bh_fwtable_get_ccfgovr_state() and published in
77 * TAG_CCFGOVR_STATE.
78 */
79#define BH_FWTABLE_CCFGOVR_BANK_EMPTY 0U /* no plausible header */
80#define BH_FWTABLE_CCFGOVR_BANK_STANDBY 1U /* plausible header, never loaded */
81#define BH_FWTABLE_CCFGOVR_BANK_REJECTED 2U /* failed CRC or protobuf decode */
82#define BH_FWTABLE_CCFGOVR_BANK_APPLIED 3U
83
84#define BH_FWTABLE_CCFGOVR_STATE_BANK_A GENMASK(1, 0)
85#define BH_FWTABLE_CCFGOVR_STATE_BANK_B GENMASK(3, 2)
86/* The applied bank has a non-empty override body */
87#define BH_FWTABLE_CCFGOVR_STATE_HAS_OVERRIDES BIT(4)
88
90/* Sequence number of the applied bank; 0 when no bank was applied */
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif /* BH_FWTABLE_H*/
uint32_t tt_bh_fwtable_get_asic_location(const struct device *dev)
Definition bh_fwtable.c:181
uint64_t tt_bh_fwtable_get_legacy_board_id(const struct device *dev)
Definition bh_fwtable.c:84
const struct _FlashInfoTable * tt_bh_fwtable_get_flash_info_table(const struct device *dev)
Definition bh_fwtable.c:64
void tt_bh_fwtable_apply_ccfgovr(const struct device *dev)
uint32_t tt_bh_fwtable_get_ccfgovr_state(const struct device *dev)
Definition bh_fwtable.c:161
PcbType tt_bh_fwtable_get_pcb_type(const struct device *dev)
Definition bh_fwtable.c:101
bool tt_bh_fwtable_is_p300_left_chip(void)
Definition bh_fwtable.c:176
uint32_t tt_bh_fwtable_get_board_type(const struct device *dev)
Definition bh_fwtable.c:145
const struct _ReadOnly * tt_bh_fwtable_get_read_only_table(const struct device *dev)
Definition bh_fwtable.c:74
PcbType
Definition bh_fwtable.h:58
@ PcbTypeP100
Definition bh_fwtable.h:60
@ PcbTypeUBB
Definition bh_fwtable.h:63
@ PcbTypeOrionSLT
Definition bh_fwtable.h:59
@ PcbTypeP150
Definition bh_fwtable.h:61
@ PcbTypeUnknown
Definition bh_fwtable.h:65
@ PcbTypeP300
Definition bh_fwtable.h:62
@ PcbTypeGalaxy2
Definition bh_fwtable.h:64
const struct _FwTable * tt_bh_fwtable_get_fw_table(const struct device *dev)
Definition bh_fwtable.c:54
uint32_t tt_bh_fwtable_get_ccfgovr_seq(const struct device *dev)
Definition bh_fwtable.c:168
__UINT32_TYPE__ uint32_t
__UINT64_TYPE__ uint64_t