OpenBIC
OpenSource Bridge-IC
plat_pldm_sensor.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_PLDM_SENSOR_H
18#define PLAT_PLDM_SENSOR_H
19
20#include "pdr.h"
21
22#ifdef ENABLE_PLATFORM_PROVIDES_PLDM_SENSOR_STACKS
23#define ADC_SENSOR_STACK_SIZE 640
24#define VR_SENSOR_STACK_SIZE 1344
25#define MB_TEMP_SENSOR_STACK_SIZE 1152
26#define CPU_SENSOR_STACK_SIZE 1024
27#define INA233_SENSOR_STACK_SIZE 1344
28#define DIMM_SENSOR_STACK_SIZE 448
29#endif
30
31#define ADDR_TMP75_INLET (0x92 >> 1)
32#define ADDR_TMP75_OUTLET (0x98 >> 1)
33#define ADDR_TMP75_FIO (0x90 >> 1)
34#define ADDR_VR_CPU0 (0XEC >> 1)
35#define ADDR_VR_SOC (0XEC >> 1)
36#define ADDR_VR_CPU1 (0XC6 >> 1)
37#define ADDR_VR_PVDDIO (0XC6 >> 1)
38#define ADDR_VR_PVDD11 (0XE4 >> 1)
39
40#define ADDR_X8_INA233 (0x8A >> 1)
41#define ADDR_X16_INA233 (0x82 >> 1)
42#define ADDR_E1S_BOOT_INA233 (0x8A >> 1)
43#define ADDR_E1S_DATA_INA233 (0x80 >> 1)
44#define ADDR_X8_RETIMER (0x46 >> 1)
45#define ADDR_X16_RETIMER (0x40 >> 1)
46#define ADDR_NVME (0xD4 >> 1)
47
48#define OFFSET_TMP75_TEMP 0x00
49#define OFFSET_NVME_TEMP 0x00
50#define OFFSET_CARD_PRSNT 0x04
51
52#define NUM_SOC_PACKAGE_PWR 0x0055
53
54#define UPDATE_INTERVAL_1S 1
55#define UPDATE_INTERVAL_3S 3
56#define UPDATA_INTERNAL_1HR 3600
57
58#define VR_DEVICE_UNKNOWN 0xFF
59
60#define SENSOR_NUM_MB_INA233_E1S_DATA_VOLT_V 0x0033
61#define SENSOR_NUM_MB_INA233_X8_RTM_CURR_A 0x0045
62#define SENSOR_NUM_MB_INA233_E1S_DATA_CURR_A 0x0048
63#define SENSOR_NUM_MB_INA233_X8_RTM_PWR_W 0x0062
64#define SENSOR_NUM_MB_INA233_E1S_DATA_PWR_W 0x0065
65
74};
75
79};
80
81int plat_pldm_sensor_get_sensor_count(int thread_id);
82uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev);
92void plat_pldm_sensor_clear_vr_fault(uint8_t vr_addr, uint8_t vr_bus, uint8_t page_cnt);
93bool bootdrive_access(uint8_t sensor_num);
96
97#define MONITOR_PROCHOT_SENSOR_STACK_SIZE 1024
99
100#define PROCHOT_SENSOR_TABLE_LEN 18
101typedef struct _prochot_sensor_info {
102 uint16_t sensor_id;
103 uint16_t event_bit;
105
106#define MONITOR_PROCHOT_SENSOR_TIME_MS (1 * 1000) // 1s
108
109#endif
GET_VR_DEV_STATUS
Definition: plat_pldm_sensor.h:237
@ GET_VR_DEV_FAILED
Definition: plat_pldm_sensor.h:239
@ GET_VR_DEV_SUCCESS
Definition: plat_pldm_sensor.h:238
int plat_pldm_sensor_get_sensor_count(int thread_id)
Definition: plat_pldm_sensor.c:9227
SENSOR_THREAD_LIST
Definition: plat_pldm_sensor.h:228
@ MAX_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:234
@ VR_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:232
void plat_pldm_sensor_change_cpu_bus()
Definition: plat_pldm_sensor.c:6760
void plat_pldm_sensor_change_retimer_dev()
Definition: plat_pldm_sensor.c:6804
void plat_pldm_sensor_change_vr_dev()
Definition: plat_pldm_sensor.c:9659
uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev)
Definition: plat_pldm_sensor.c:6932
@ ADC_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:81
uint8_t sensor_num
Definition: storage_handler.h:6
Definition: plat_pldm_sensor.h:101
uint16_t sensor_id
Definition: plat_pldm_sensor.h:102
uint16_t event_bit
Definition: plat_pldm_sensor.h:103
@ DIMM_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:48
@ INA233_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:46
void monitor_prochot_sensor_handler()
Definition: plat_pldm_sensor.c:7120
void plat_pldm_sensor_clear_vr_fault(uint8_t vr_addr, uint8_t vr_bus, uint8_t page_cnt)
Definition: plat_pldm_sensor.c:6975
void plat_init_pldm_sensor_table()
Definition: plat_pldm_sensor.c:6376
void plat_pldm_sensor_change_ina_dev()
Definition: plat_pldm_sensor.c:6848
void plat_pldm_sensor_change_ssd_dev()
Definition: plat_pldm_sensor.c:6719
@ CPU_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:70
@ MB_TEMP_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:69
void plat_pldm_sensor_change_dimm_dev()
Definition: plat_pldm_sensor.c:6897
bool bootdrive_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:7075
void start_monitor_prochot_sensor_thread()
Definition: plat_pldm_sensor.c:7086
void set_bootdrive_exist_status()
Definition: plat_pldm_sensor.c:7048
struct _prochot_sensor_info prochot_sensor_info
bool get_bootdrive_exist_status()
Definition: plat_pldm_sensor.c:7070
void plat_init_pldm_disabled_sensors()
Definition: plat_pldm_sensor.c:6398
uint8_t plat_pldm_sensor_get_ina_dev()
Definition: plat_pldm_sensor.c:7007