OpenBIC
OpenSource Bridge-IC
plat_hook.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_HOOK_H
18#define PLAT_HOOK_H
19
20#include "sensor.h"
21
22#define VR_MAX_NUM 2
23#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
24
25#include "plat_pldm_sensor.h"
26
31};
32
39};
40
50};
51
56};
57
58typedef struct vr_mapping_sensor {
59 uint8_t index;
60 uint8_t sensor_id;
61 uint8_t *sensor_name;
62 int peak_value;
64
65typedef struct vr_vout_user_settings {
66 uint16_t vout[VR_RAIL_E_MAX];
68
70
71typedef struct vr_mapping_status {
72 uint8_t index;
73 uint16_t pmbus_reg;
74 uint8_t *vr_status_name;
76
78
79typedef struct _vr_pre_proc_arg {
80 void *mutex;
81 uint8_t vr_page;
83
84typedef struct temp_mapping_sensor {
85 uint8_t index;
86 uint8_t sensor_id;
87 uint8_t *sensor_name;
89
91
92typedef struct temp_threshold_mapping_sensor {
93 uint8_t temp_index_threshold_type; //PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
94 uint8_t temp_threshold_type;
95 uint8_t sensor_id;
96 uint8_t *temp_threshold_name;
98
100
101bool temp_sensor_rail_name_get(uint8_t rail, uint8_t **name);
102bool temp_sensor_rail_enum_get(uint8_t *name, uint8_t *num);
103bool pre_vr_read(sensor_cfg *cfg, void *args);
104bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading);
105void *vr_mutex_get(enum VR_INDEX_E vr_index);
106void vr_mutex_init(void);
107bool vr_rail_name_get(uint8_t rail, uint8_t **name);
108bool vr_rail_enum_get(uint8_t *name, uint8_t *num);
109
110#endif
vr_pre_proc_arg vr_pre_read_args[]
Definition: plat_hook.c:962
struct _vr_pre_proc_arg vr_pre_proc_arg
bool pre_vr_read(sensor_cfg *cfg, void *args)
Definition: plat_hook.c:988
struct vr_mapping_status vr_mapping_status
struct temp_mapping_sensor temp_mapping_sensor
vr_mapping_sensor vr_rail_table[]
Definition: plat_hook.c:736
struct vr_vout_user_settings vr_vout_user_settings
bool temp_sensor_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:399
void vr_mutex_init(void)
Definition: plat_hook.c:721
struct vr_mapping_sensor vr_mapping_sensor
PLAT_TEMP_INDEX_E
Definition: plat_hook.h:78
@ TEMP_INDEX_MAX
Definition: plat_hook.h:85
bool temp_sensor_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:412
struct temp_threshold_mapping_sensor temp_threshold_mapping_sensor
VR_RAIL_E
Definition: plat_hook.h:43
@ VR_RAIL_E_MAX
Definition: plat_hook.h:64
bool vr_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:788
VR_INDEX_E
Definition: plat_hook.h:28
@ VR_INDEX_MAX
Definition: plat_hook.h:40
bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading)
Definition: plat_hook.c:548
bool vr_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:839
temp_threshold_mapping_sensor temp_threshold_table[]
void * vr_mutex_get(enum VR_INDEX_E vr_index)
Definition: plat_hook.c:506
VR_STAUS_E
Definition: plat_hook.h:67
@ VR_STAUS_E_STATUS_INPUT
Definition: plat_hook.h:72
@ VR_STAUS_E_STATUS_IOUT
Definition: plat_hook.h:71
@ VR_STAUS_E_STATUS_CML
Definition: plat_hook.h:74
@ VR_STAUS_E_MAX
Definition: plat_hook.h:75
@ VR_STAUS_E_STATUS_BYTE
Definition: plat_hook.h:68
@ VR_STAUS_E_STATUS_TEMPERATURE
Definition: plat_hook.h:73
@ VR_STAUS_E_STATUS_VOUT
Definition: plat_hook.h:70
@ VR_STAUS_E_STATUS_WORD
Definition: plat_hook.h:69
vr_vout_user_settings user_settings
Definition: plat_hook.c:821
uint8_t reading[1]
Definition: pldm_monitor.h:3
@ TEMP_INDEX_THERMAL_SENSOR_1_TEMP_C
Definition: plat_hook.h:53
@ TEMP_INDEX_THERMAL_SENSOR_2_TEMP_C
Definition: plat_hook.h:54
@ VR_RAIL_E_P0V825_A1
Definition: plat_hook.h:36
@ VR_RAIL_E_P0V825_A2
Definition: plat_hook.h:37
@ VR_RAIL_E_P0V895_PEX
Definition: plat_hook.h:34
@ VR_RAIL_E_P0V825_A0
Definition: plat_hook.h:35
@ VR_INDEX_E_P0V825
Definition: plat_hook.h:29
@ VR_INDEX_E_P0V895
Definition: plat_hook.h:28
Definition: sensor.h:261
Definition: plat_hook.h:22
uint8_t vr_page
Definition: plat_hook.h:25
void * mutex
Definition: plat_hook.h:212
Definition: plat_hook.h:216
uint8_t index
Definition: plat_hook.h:217
uint8_t * sensor_name
Definition: plat_hook.h:219
uint8_t sensor_id
Definition: plat_hook.h:218
Definition: plat_hook.h:245
uint8_t sensor_id
Definition: plat_hook.h:248
uint8_t temp_threshold_type
Definition: plat_hook.h:247
uint8_t temp_index_threshold_type
Definition: plat_hook.h:246
uint8_t * temp_threshold_name
Definition: plat_hook.h:249
Definition: plat_hook.h:190
int peak_value
Definition: plat_hook.h:194
uint8_t sensor_id
Definition: plat_hook.h:192
uint8_t * sensor_name
Definition: plat_hook.h:193
uint8_t index
Definition: plat_hook.h:191
Definition: plat_hook.h:203
uint8_t * vr_status_name
Definition: plat_hook.h:206
uint16_t pmbus_reg
Definition: plat_hook.h:205
uint8_t index
Definition: plat_hook.h:204
Definition: plat_hook.h:197
uint16_t vout[VR_RAIL_E_MAX]
Definition: plat_hook.h:198
name
Definition: plat_i2c.h:24