Skip to content

Commit 8606b69

Browse files
committed
lib: tenstorrent: bh_arc: remove native sim macros
Remove macros that were used for native sim builds to exclude certain code. Signed-off-by: Alex Apostolu <aapostolu@tenstorrent.com>
1 parent 5ce0898 commit 8606b69

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

lib/tenstorrent/bh_arc/cat.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,12 @@ typedef union {
4646

4747
#ifndef CONFIG_TT_SMC_RECOVERY
4848

49-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
50-
51-
static const struct device *const pvt = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(pvt));
49+
static const struct device *const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt));
50+
static uint8_t cat_ts_avg_buf[sizeof(struct sensor_value)];
5251

5352
SENSOR_DT_READ_IODEV(cat_ts_avg_iodev, DT_NODELABEL(pvt), {SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0});
54-
5553
RTIO_DEFINE(cat_ts_avg_ctx, 1, 1);
5654

57-
static uint8_t cat_ts_avg_buf[sizeof(struct sensor_value)];
58-
59-
#endif
60-
6155
#endif /* CONFIG_TT_SMC_RECOVERY */
6256

6357
/* catmon trim codes run from 0: 196C+ to 63: -56C+, evenly spaced 4C */
@@ -168,7 +162,6 @@ static float CalibrateCAT(void)
168162
float catmon_temp = TrimCodeToTemp(code);
169163
float ts_temp = 0;
170164

171-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
172165
q31_t avg_tmp;
173166
const struct sensor_decoder_api *decoder;
174167

@@ -179,7 +172,6 @@ static float CalibrateCAT(void)
179172
NULL, 1, &avg_tmp);
180173

181174
ts_temp = Q31_TO_TEMP(avg_tmp);
182-
#endif
183175

184176
float catmon_error = catmon_temp - ts_temp;
185177

lib/tenstorrent/bh_arc/pvt.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include <zephyr/drivers/sensor.h>
2222
#include <zephyr/drivers/sensor/tenstorrent/pvt_tt_bh.h>
2323

24-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
25-
2624
static const struct device *const pvt = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(pvt));
2725

2826
SENSOR_DT_READ_IODEV(vm_iodev, DT_NODELABEL(pvt), {SENSOR_CHAN_PVT_TT_BH_VM, 0},
@@ -126,5 +124,3 @@ static uint8_t read_vm_handler(const union request *request, struct response *re
126124
REGISTER_MESSAGE(TT_SMC_MSG_READ_TS, read_ts_handler);
127125
REGISTER_MESSAGE(TT_SMC_MSG_READ_PD, read_pd_handler);
128126
REGISTER_MESSAGE(TT_SMC_MSG_READ_VM, read_vm_handler);
129-
130-
#endif

lib/tenstorrent/bh_arc/telemetry_internal.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
static int64_t last_update_time;
1616
static TelemetryInternalData internal_data;
1717

18-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
19-
static const struct device *const pvt = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(pvt));
18+
static const struct device *const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt));
19+
static uint8_t ts_avg_buf[sizeof(struct sensor_value)];
2020

2121
SENSOR_DT_READ_IODEV(ts_avg_iodev, DT_NODELABEL(pvt), {SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0});
22-
2322
RTIO_DEFINE(ts_avg_ctx, 1, 1);
2423

25-
static uint8_t ts_avg_buf[sizeof(struct sensor_value)];
26-
#endif
2724

2825
/**
2926
* @brief Read telemetry values that are shared by multiple components
@@ -39,7 +36,6 @@ void ReadTelemetryInternal(int64_t max_staleness, TelemetryInternalData *data)
3936
int64_t reftime = last_update_time;
4037

4138
if (k_uptime_delta(&reftime) >= max_staleness) {
42-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
4339
q31_t avg_tmp;
4440
const struct sensor_decoder_api *decoder;
4541

@@ -49,16 +45,13 @@ void ReadTelemetryInternal(int64_t max_staleness, TelemetryInternalData *data)
4945
decoder->decode(ts_avg_buf,
5046
(struct sensor_chan_spec){SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0}, NULL, 1,
5147
&avg_tmp);
52-
#endif
5348

5449
/* Get all dynamically updated values */
5550
internal_data.vcore_voltage = get_vcore();
5651
AVSReadCurrent(AVS_VCORE_RAIL, &internal_data.vcore_current);
5752
internal_data.vcore_power =
5853
internal_data.vcore_current * internal_data.vcore_voltage * 0.001f;
59-
#ifdef CONFIG_DT_HAS_TENSTORRENT_BH_PVT_ENABLED
6054
internal_data.asic_temperature = Q31_TO_TEMP(avg_tmp);
61-
#endif
6255

6356
/* reftime was updated to the current uptime by the k_uptime_delta() call */
6457
last_update_time = reftime;

0 commit comments

Comments
 (0)