OpenBIC
OpenSource Bridge-IC
plat_sensor_table.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PLAT_SENSOR_TABLE_H
18#define PLAT_SENSOR_TABLE_H
19
20#include <stdint.h>
21#include "sensor.h"
22#include "common_i2c_mux.h"
23
24#define MUTEX_LOCK_INTERVAL_MS 1000
25#define MEB_CXL_BUS I2C_BUS2
26
27/* define config for sensors */
28#define TMP75_IN_ADDR (0x90 >> 1)
29#define TMP75_OUT_ADDR (0x92 >> 1)
30#define TMP75_TEMP_OFFSET 0x00
31#define MPS_MP5990_ADDR (0x80 >> 1)
32#define E1S_ADDR (0xD4 >> 1)
33#define E1S_OFFSET 0x00
34#define SQ52205_1_ADDR (0x80 >> 1)
35#define SQ52205_2_ADDR (0x82 >> 1)
36#define SQ52205_3_ADDR (0x88 >> 1)
37#define SQ52205_4_ADDR (0x8A >> 1)
38
39/* threshold sensor number, 1 based */
40#define SENSOR_NUM_TEMP_TMP75_IN 0x01
41#define SENSOR_NUM_TEMP_TMP75_OUT 0x02
42#define SENSOR_NUM_TEMP_PU4 0x03
43#define SENSOR_NUM_TEMP_E1S_1 0x34
44#define SENSOR_NUM_TEMP_E1S_2 0x35
45#define SENSOR_NUM_TEMP_E1S_3 0x36
46#define SENSOR_NUM_TEMP_E1S_4 0x37
47
48#define SENSOR_NUM_VOL_P12V_AUX 0x04
49#define SENSOR_NUM_VOL_P3V3_AUX 0x05
50#define SENSOR_NUM_VOL_P1V2_AUX 0x06
51#define SENSOR_NUM_VOL_P3V3 0x07
52#define SENSOR_NUM_VOL_P12V_AUX_CARD01 0x08
53#define SENSOR_NUM_VOL_P12V_AUX_CARD02 0x09
54#define SENSOR_NUM_VOL_P12V_AUX_CARD03 0x0A
55#define SENSOR_NUM_VOL_P12V_AUX_CARD04 0x0B
56#define SENSOR_NUM_VOL_P12V_AUX_CARD05 0x0C
57#define SENSOR_NUM_VOL_P12V_AUX_CARD06 0x0D
58#define SENSOR_NUM_VOL_P12V_AUX_CARD07 0x0E
59#define SENSOR_NUM_VOL_P12V_AUX_CARD08 0x0F
60#define SENSOR_NUM_VOL_P12V_AUX_CARD09 0x10
61#define SENSOR_NUM_VOL_P12V_AUX_CARD10 0x11
62#define SENSOR_NUM_VOL_P12V_AUX_CARD11 0x12
63#define SENSOR_NUM_VOL_P12V_AUX_CARD12 0x13
64#define SENSOR_NUM_VOL_P12V_AUX_CARD13 0x14
65#define SENSOR_NUM_VOL_P12V_AUX_CARD14 0x15
66
67#define SENSOR_NUM_CUR_P12V_AUX 0x16
68#define SENSOR_NUM_CUR_P12V_AUX_CARD01 0x17
69#define SENSOR_NUM_CUR_P12V_AUX_CARD02 0x18
70#define SENSOR_NUM_CUR_P12V_AUX_CARD03 0x19
71#define SENSOR_NUM_CUR_P12V_AUX_CARD04 0x1A
72#define SENSOR_NUM_CUR_P12V_AUX_CARD05 0x1B
73#define SENSOR_NUM_CUR_P12V_AUX_CARD06 0x1C
74#define SENSOR_NUM_CUR_P12V_AUX_CARD07 0x1D
75#define SENSOR_NUM_CUR_P12V_AUX_CARD08 0x1E
76#define SENSOR_NUM_CUR_P12V_AUX_CARD09 0x1F
77#define SENSOR_NUM_CUR_P12V_AUX_CARD10 0x20
78#define SENSOR_NUM_CUR_P12V_AUX_CARD11 0x21
79#define SENSOR_NUM_CUR_P12V_AUX_CARD12 0x22
80#define SENSOR_NUM_CUR_P12V_AUX_CARD13 0x23
81#define SENSOR_NUM_CUR_P12V_AUX_CARD14 0x24
82
83#define SENSOR_NUM_PWR_P12V_AUX 0x25
84#define SENSOR_NUM_PWR_P12V_AUX_CARD01 0x26
85#define SENSOR_NUM_PWR_P12V_AUX_CARD02 0x27
86#define SENSOR_NUM_PWR_P12V_AUX_CARD03 0x28
87#define SENSOR_NUM_PWR_P12V_AUX_CARD04 0x29
88#define SENSOR_NUM_PWR_P12V_AUX_CARD05 0x2A
89#define SENSOR_NUM_PWR_P12V_AUX_CARD06 0x2B
90#define SENSOR_NUM_PWR_P12V_AUX_CARD07 0x2C
91#define SENSOR_NUM_PWR_P12V_AUX_CARD08 0x2D
92#define SENSOR_NUM_PWR_P12V_AUX_CARD09 0x2E
93#define SENSOR_NUM_PWR_P12V_AUX_CARD10 0x2F
94#define SENSOR_NUM_PWR_P12V_AUX_CARD11 0x30
95#define SENSOR_NUM_PWR_P12V_AUX_CARD12 0x31
96#define SENSOR_NUM_PWR_P12V_AUX_CARD13 0x32
97#define SENSOR_NUM_PWR_P12V_AUX_CARD14 0x33
98
100#define CXL_TMP75_IN_ADDR (0x92 >> 1)
101#define CXL_CTRL_ADDR (0x98 >> 1)
102#define CXL_U6_INA233_ADDR (0x8A >> 1)
103#define CXL_U7_INA233_ADDR (0x80 >> 1)
104#define CXL_VR_A0V8_ADDR (0xC8 >> 1)
105#define CXL_VR_A0V9_ADDR (0xC8 >> 1)
106#define CXL_VR_D0V8_ADDR (0xB0 >> 1)
107#define CXL_VR_VDDQAB_ADDR (0xB0 >> 1)
108#define CXL_VR_VDDQCD_ADDR (0xB4 >> 1)
109#define CXL_U8_LTC2991_ADDR (0x90 >> 1)
110#define CXL_DIMMA_TEMP_ADDR 0x18
111#define CXL_DIMMB_TEMP_ADDR 0x19
112#define CXL_DIMMC_TEMP_ADDR 0x1A
113#define CXL_DIMMD_TEMP_ADDR 0x1B
114
115#define CHIP_TEMP_OFFSET 0x00
116#define DIMM_TEMP_OFFSET 0x01
117
119/* E1.S */
120#define SENSOR_NUM_TEMP_JCN_E1S_0 0x01
121#define SENSOR_NUM_TEMP_JCN_E1S_1 0x02
122
123/* CXL */
124#define SENSOR_NUM_TEMP_CXL_TMP75_IN 0x01
125#define SENSOR_NUM_TEMP_CXL_CTRL 0x02
126
127#define SENSOR_NUM_VOL_P12V_STBY_4CP 0x03
128#define SENSOR_NUM_VOL_P3V3_STBY_4CP 0x04
129#define SENSOR_NUM_VOL_P5V_STBY 0x05
130#define SENSOR_NUM_VOL_P1V8_ASIC 0x06
131#define SENSOR_NUM_VOL_P12V_STBY 0x07
132#define SENSOR_NUM_VOL_P3V3_STBY 0x08
133#define SENSOR_NUM_VOL_PVPP_AB 0x09
134#define SENSOR_NUM_VOL_PVTT_AB 0x0A
135#define SENSOR_NUM_VOL_PVPP_CD 0x0B
136#define SENSOR_NUM_VOL_PVTT_CD 0x0C
137#define SENSOR_NUM_VOL_P0V8_ASICA 0x0D
138#define SENSOR_NUM_VOL_P0V9_ASICA 0x0E
139#define SENSOR_NUM_VOL_P0V8_ASICD 0x0F
140#define SENSOR_NUM_VOL_PVDDQ_AB 0x10
141#define SENSOR_NUM_VOL_PVDDQ_CD 0x11
142
143#define SENSOR_NUM_CUR_P12V_STBY_4CP 0x12
144#define SENSOR_NUM_CUR_P3V3_STBY_4CP 0x13
145#define SENSOR_NUM_CUR_P0V8_ASICA 0x14
146#define SENSOR_NUM_CUR_P0V9_ASICA 0x15
147#define SENSOR_NUM_CUR_P0V8_ASICD 0x16
148#define SENSOR_NUM_CUR_PVDDQ_AB 0x17
149#define SENSOR_NUM_CUR_PVDDQ_CD 0x18
150
151#define SENSOR_NUM_PWR_P12V_STBY_4CP 0x19
152#define SENSOR_NUM_PWR_P3V3_STBY_4CP 0x1A
153#define SENSOR_NUM_PWR_P0V8_ASICA 0x1B
154#define SENSOR_NUM_PWR_P0V9_ASICA 0x1C
155#define SENSOR_NUM_PWR_P0V8_ASICD 0x1D
156#define SENSOR_NUM_PWR_PVDDQ_AB 0x1E
157#define SENSOR_NUM_PWR_PVDDQ_CD 0x1F
158
159#define SENSOR_NUM_TEMP_CXL 0x20
160#define SENSOR_NUM_TEMP_CXL_DIMMA 0x21
161#define SENSOR_NUM_TEMP_CXL_DIMMB 0x22
162#define SENSOR_NUM_TEMP_CXL_DIMMC 0x23
163#define SENSOR_NUM_TEMP_CXL_DIMMD 0x24
164
165/**********************Event**********************/
166#define SENSOR_NUM_SYSTEM_STATUS 0x10
167
168#define PCIE_CARD_POWER_GOOD_TIME_DEFAULT 0
169#define PCIE_CARD_SENSOR_POLL_DELAY_MS 10000
170
171typedef struct _sensor_poll_delay_cfg {
176
177extern const int CXL_SENSOR_CONFIG_SIZE;
178
179void load_sensor_config(void);
180bool is_dc_access(uint8_t sensor_num);
181bool is_e1s_access(uint8_t sensor_num);
182bool is_cxl_access(uint8_t cxl_id);
183struct k_mutex *get_i2c_mux_mutex(uint8_t i2c_bus);
184bool get_pcie_card_mux_config(uint8_t cxl_id, uint8_t sensor_num, mux_config *card_mux_cfg,
185 mux_config *cxl_mux_cfg);
186sensor_cfg *get_cxl_sensor_cfg_info(uint8_t cxl_id, uint8_t *cfg_count);
188bool is_time_to_poll_card_sensor(uint8_t pcie_card_id);
189
190#endif
void load_sensor_config(void)
Definition: sensor.c:1405
struct k_mutex * get_i2c_mux_mutex(uint8_t i2c_bus)
Definition: plat_hook.c:901
sensor_cfg * get_common_sensor_cfg_info(uint8_t sensor_num)
Definition: sensor.c:763
bool is_dc_access(uint8_t sensor_num)
Definition: plat_sensor_table.c:1564
bool is_time_to_poll_card_sensor(uint8_t card_id)
Definition: plat_sensor_table.c:1636
struct _sensor_poll_delay_cfg sensor_poll_delay_cfg
bool is_cxl_access(uint8_t cxl_id)
Definition: plat_sensor_table.c:1994
bool get_pcie_card_mux_config(uint8_t cxl_id, uint8_t sensor_num, mux_config *card_mux_cfg, mux_config *cxl_mux_cfg)
Definition: plat_sensor_table.c:2098
sensor_cfg * get_cxl_sensor_cfg_info(uint8_t cxl_id, uint8_t *cfg_count)
Definition: plat_sensor_table.c:1895
const int CXL_SENSOR_CONFIG_SIZE
Definition: plat_sensor_table.c:1745
bool is_e1s_access(uint8_t sensor_num)
Definition: plat_sensor_table.c:1921
uint8_t sensor_num
Definition: storage_handler.h:6
Definition: common_i2c_mux.h:23
Definition: sensor.h:255
Definition: plat_sensor_table.h:291
int64_t card_first_power_good_time
Definition: plat_sensor_table.h:294
bool is_last_time_power_good
Definition: plat_sensor_table.h:293
uint8_t pcie_card_id
Definition: plat_sensor_table.h:172