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 <pmbus.h>
22
23/* define config for sensors */
24#define TMP75_ADDR (0x9A >> 1)
25#define HSC_ADDR (0x26 >> 1)
26#define NVME_ADDR (0xD4 >> 1)
27
28#define I2C_ADDR_M2_INA231 (0x8A >> 1)
29#define I2C_ADDR_M2_ISL28022 (0x8A >> 1)
30#define I2C_ADDR_M2_FPGA (0x80 >> 1)
31#define I2C_ADDR_M2_DDR (0x88 >> 1)
32#define I2C_ADDR_M2_TMP75 (0x9C >> 1)
33#define I2C_ADDR_M2_EEPROM (0xA0 >> 1)
34
35#define INA231_POWER_REG 0x03
36#define INA231_BUS_VOLTAGE_REG 0x02
37#define NVME_TEMP_REG 0x00
38
39/* ISL28022 ReadType define region start */
40#define ISL28022_CONFIG_REG 0
41#define ISL28022_BUS_VOLTAGE_REG 2
42#define ISL28022_POWER_REG 3
43#define ISL28022_CURRENT_REG 4
44#define ISL28022_CALIBRATION_REG 5
45
46/* define config for sensors */
47#define ASIC_OFFSET 0x00 // TBU
48#define TMP75_TEMP_OFFSET 0x00
49#define INA233_CALIBRATION_OFFSET 0xD4
50#define VR_PAGE_OFFSET 0x00
51#define SMBUS_VOL_CMD 0x8B
52#define SMBUS_CUR_CMD 0x8C
53#define SMBUS_TEMP_CMD 0x8D
54#define SMBUS_PWR_CMD 0x96
55
56// #TMP
57
59// ADM1278 ReadType define region Start
60
61#define ADM1278_VIN_REG PMBUS_READ_VIN
62#define ADM1278_IOUT_REG PMBUS_READ_IOUT
63#define ADM1278_TEMP_REG PMBUS_READ_TEMPERATURE_1
64#define ADM1278_PIN_REG PMBUS_READ_PIN
65#define ADM1278_PMON_CONF_REG 0xD4
66
67#define ADM1278_PMON_CONF_REG_TEMP1_EN 0x08
68#define ADM1278_PMON_CONF_REG_PWR_AVG 0x38
69
70/* sensor number */
71/*************************************************************************************************/
72/************************************** temperature **********************************************/
73/*************************************************************************************************/
74#define SENSOR_NUM_T_MB_OUTLET_TEMP_T 0x50
75
76/*************************************************************************************************/
77/************************************* adc voltage ***********************************************/
78/*************************************************************************************************/
79#define SENSOR_NUM_V_12_AUX 0x51
80#define SENSOR_NUM_V_12_EDGE 0x52
81#define SENSOR_NUM_V_3_3_AUX 0x53
82#define SENSOR_NUM_V_1_2_STBY 0x58
83
84/*************************************************************************************************/
85/************************************* HSC ***********************************************/
86/*************************************************************************************************/
87#define SENSOR_NUM_V_HSC_IN 0x54
88#define SENSOR_NUM_I_HSC_OUT 0x55
89#define SENSOR_NUM_P_HSC_IN 0x56
90#define SENSOR_NUM_T_HSC 0x57
91/*************************************************************************************************/
92/***************************************** M.2 ***************************************************/
93/*************************************************************************************************/
94/* sensor number prefix of M.2 devices */
95#define PREFIX_MASK 0xF8
96
97#define PREFIX_M2A 0x60
98#define PREFIX_M2B 0x68
99#define PREFIX_M2C 0x70
100#define PREFIX_M2D 0x78
101#define PREFIX_M2E 0xFF
102#define PREFIX_M2F 0xFF
103
104/* sensor number suffix of M.2 devices */
105#define SUFFIX_INA231_PWR 0x00
106#define SUFFIX_INA231_VOL 0x01
107#define SUFFIX_NVME_TEMP 0x02
108#define SUFFIX_ADC_12V_VOL 0x03
109#define SUFFIX_ADC_3V3_VOL 0x04
110
111#define SENSOR_NUM_INA231_PWR_M2A (PREFIX_M2A | SUFFIX_INA231_PWR)
112#define SENSOR_NUM_INA231_VOL_M2A (PREFIX_M2A | SUFFIX_INA231_VOL)
113#define SENSOR_NUM_NVME_TEMP_M2A (PREFIX_M2A | SUFFIX_NVME_TEMP)
114#define SENSOR_NUM_ADC_3V3_VOL_M2A (PREFIX_M2A | SUFFIX_ADC_3V3_VOL)
115#define SENSOR_NUM_ADC_12V_VOL_M2A (PREFIX_M2A | SUFFIX_ADC_12V_VOL)
116
117#define SENSOR_NUM_INA231_PWR_M2B (PREFIX_M2B | SUFFIX_INA231_PWR)
118#define SENSOR_NUM_INA231_VOL_M2B (PREFIX_M2B | SUFFIX_INA231_VOL)
119#define SENSOR_NUM_NVME_TEMP_M2B (PREFIX_M2B | SUFFIX_NVME_TEMP)
120#define SENSOR_NUM_ADC_3V3_VOL_M2B (PREFIX_M2B | SUFFIX_ADC_3V3_VOL)
121#define SENSOR_NUM_ADC_12V_VOL_M2B (PREFIX_M2B | SUFFIX_ADC_12V_VOL)
122
123#define SENSOR_NUM_INA231_PWR_M2C (PREFIX_M2C | SUFFIX_INA231_PWR)
124#define SENSOR_NUM_INA231_VOL_M2C (PREFIX_M2C | SUFFIX_INA231_VOL)
125#define SENSOR_NUM_NVME_TEMP_M2C (PREFIX_M2C | SUFFIX_NVME_TEMP)
126#define SENSOR_NUM_ADC_3V3_VOL_M2C (PREFIX_M2C | SUFFIX_ADC_3V3_VOL)
127#define SENSOR_NUM_ADC_12V_VOL_M2C (PREFIX_M2C | SUFFIX_ADC_12V_VOL)
128
129#define SENSOR_NUM_INA231_PWR_M2D (PREFIX_M2D | SUFFIX_INA231_PWR)
130#define SENSOR_NUM_INA231_VOL_M2D (PREFIX_M2D | SUFFIX_INA231_VOL)
131#define SENSOR_NUM_NVME_TEMP_M2D (PREFIX_M2D | SUFFIX_NVME_TEMP)
132#define SENSOR_NUM_ADC_3V3_VOL_M2D (PREFIX_M2D | SUFFIX_ADC_3V3_VOL)
133#define SENSOR_NUM_ADC_12V_VOL_M2D (PREFIX_M2D | SUFFIX_ADC_12V_VOL)
134
135#define SENSOR_NUM_INA231_PWR_M2E (PREFIX_M2E | SUFFIX_INA231_PWR)
136#define SENSOR_NUM_INA231_VOL_M2E (PREFIX_M2E | SUFFIX_INA231_VOL)
137#define SENSOR_NUM_NVME_TEMP_M2E (PREFIX_M2E | SUFFIX_NVME_TEMP)
138
139#define SENSOR_NUM_INA231_PWR_M2F (PREFIX_M2F | SUFFIX_INA231_PWR)
140#define SENSOR_NUM_INA231_VOL_M2F (PREFIX_M2F | SUFFIX_INA231_VOL)
141#define SENSOR_NUM_NVME_TEMP_M2F (PREFIX_M2F | SUFFIX_NVME_TEMP)
142
143uint8_t plat_get_config_size();
144void load_sensor_config(void);
145#endif
void load_sensor_config(void)
Definition: sensor.c:1405
uint8_t plat_get_config_size()
Definition: sensor.c:1400