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 11
23#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
24
25#include "plat_pldm_sensor.h"
26
40};
41
64};
65
75};
76
77typedef struct vr_mapping_sensor {
78 uint8_t index;
79 uint8_t sensor_id;
80 uint8_t *sensor_name;
82
83typedef struct vr_mapping_status {
84 uint8_t index;
85 uint16_t pmbus_reg;
88
90
91typedef struct _vr_pre_proc_arg {
92 void *mutex;
93 uint8_t vr_page;
95
99
100bool plat_get_vout_min(uint8_t rail, uint16_t *millivolt);
101bool plat_get_vout_max(uint8_t rail, uint16_t *millivolt);
102bool plat_set_vout_min(uint8_t rail, uint16_t *millivolt);
103bool plat_set_vout_max(uint8_t rail, uint16_t *millivolt);
104bool pre_vr_read(sensor_cfg *cfg, void *args);
105bool post_vr_read(sensor_cfg *cfg, void *args, int *reading);
106bool is_mb_dc_on();
107void *vr_mutex_get(enum VR_INDEX_E vr_index);
108void vr_mutex_init(void);
109bool vr_rail_name_get(uint8_t rail, uint8_t **name);
110bool vr_rail_enum_get(uint8_t *name, uint8_t *num);
112void user_settings_init(void);
113bool plat_get_vout_command(uint8_t rail, uint16_t *millivolt);
114bool plat_set_vout_command(uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm);
115bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status);
116bool plat_clear_vr_status(uint8_t rail);
117bool vr_status_name_get(uint8_t rail, uint8_t **name);
118bool vr_status_enum_get(uint8_t *name, uint8_t *num);
119
120#endif
vr_pre_proc_arg vr_pre_read_args[]
Definition: plat_hook.c:962
bool is_mb_dc_on()
Definition: plat_hook.c:1249
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_vout_user_settings user_settings
Definition: plat_hook.c:236
struct vr_mapping_status vr_mapping_status
vr_mapping_sensor vr_rail_table[]
Definition: plat_hook.c:154
bool plat_get_vout_max(uint8_t rail, uint16_t *millivolt)
bool plat_get_vout_command(uint8_t rail, uint16_t *millivolt)
Definition: plat_hook.c:490
void vr_mutex_init(void)
Definition: plat_hook.c:139
struct vr_mapping_sensor vr_mapping_sensor
bool plat_set_vout_max(uint8_t rail, uint16_t *millivolt)
bool vr_vout_user_settings_get(void *user_settings)
Definition: plat_hook.c:271
VR_RAIL_E
Definition: plat_hook.h:42
@ VR_RAIL_E_P0V8_VDDA_PCIE
Definition: plat_hook.h:61
@ VR_RAIL_E_P0V75_VDDPHY_HBM1_3_5
Definition: plat_hook.h:60
@ VR_RAIL_E_P0V75_TRVDD_ZONEA
Definition: plat_hook.h:49
@ VR_RAIL_E_P0V75_VDDPHY_HBM0_2_4
Definition: plat_hook.h:54
@ VR_RAIL_E_P0V75_TRVDD_ZONEB
Definition: plat_hook.h:51
@ VR_RAIL_E_OSFP_P3V3
Definition: plat_hook.h:43
@ VR_RAIL_E_P1V1_VDDC_HBM1_3_5
Definition: plat_hook.h:59
@ VR_RAIL_E_P1V8_VPP_HBM1_3_5
Definition: plat_hook.h:56
@ VR_RAIL_E_P0V85
Definition: plat_hook.h:44
@ VR_RAIL_E_P0V75_PVDD_CH_S
Definition: plat_hook.h:47
@ VR_RAIL_E_P1V8_VPP_HBM0_2_4
Definition: plat_hook.h:50
@ VR_RAIL_E_P0V75_PVDD_CH_N
Definition: plat_hook.h:45
@ VR_RAIL_E_P0V75_MAX_PHY_S
Definition: plat_hook.h:48
@ VR_RAIL_E_P0V9_TRVDD_ZONEB
Definition: plat_hook.h:57
@ VR_RAIL_E_MAX
Definition: plat_hook.h:63
@ VR_RAIL_E_P1V1_VDDC_HBM0_2_4
Definition: plat_hook.h:53
@ VR_RAIL_E_P1V2_VDDHTX_PCIE
Definition: plat_hook.h:62
@ VR_RAIL_E_P0V9_TRVDD_ZONEA
Definition: plat_hook.h:55
@ VR_RAIL_E_P0V4_VDDQL_HBM1_3_5
Definition: plat_hook.h:58
@ VR_RAIL_E_P0V4_VDDQL_HBM0_2_4
Definition: plat_hook.h:52
@ VR_RAIL_E_P0V75_MAX_PHY_N
Definition: plat_hook.h:46
bool vr_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:205
VR_INDEX_E
Definition: plat_hook.h:27
@ VR_INDEX_E_P1V1_VDDC_HBM0_HBM2_HBM4
Definition: plat_hook.h:34
@ VR_INDEX_E_P0V85
Definition: plat_hook.h:29
@ VR_INDEX_E_P0V75_CH_S
Definition: plat_hook.h:31
@ VR_INDEX_E_P0V9_TRVDD_ZONEA
Definition: plat_hook.h:35
@ VR_INDEX_E_P0V75_TRVDD_ZONEA
Definition: plat_hook.h:32
@ VR_INDEX_E_P0V75_CH_N
Definition: plat_hook.h:30
@ VR_INDEX_E_P0V9_TRVDD_ZONEB
Definition: plat_hook.h:36
@ VR_INDEX_E_P0V75_TRVDD_ZONEB
Definition: plat_hook.h:33
@ VR_INDEX_E_P1V1_VDDC_HBM1_HBM3_HBM5
Definition: plat_hook.h:37
@ VR_INDEX_E_OSFP_P3V3
Definition: plat_hook.h:28
@ VR_INDEX_E_VDDA_PCIE
Definition: plat_hook.h:38
@ VR_INDEX_MAX
Definition: plat_hook.h:39
bool plat_get_vout_min(uint8_t rail, uint16_t *millivolt)
bool vr_status_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:255
bool plat_set_vout_command(uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm)
Definition: plat_hook.c:552
bool vr_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:239
bool plat_set_vout_min(uint8_t rail, uint16_t *millivolt)
void user_settings_init(void)
Definition: plat_hook.c:359
bool plat_clear_vr_status(uint8_t rail)
Definition: plat_hook.c:430
bool post_vr_read(sensor_cfg *cfg, void *args, int *reading)
Definition: plat_hook.c:110
void * vr_mutex_get(enum VR_INDEX_E vr_index)
Definition: plat_hook.c:68
bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
Definition: plat_hook.c:365
VR_STAUS_E
Definition: plat_hook.h:66
@ VR_STAUS_E_STATUS_INPUT
Definition: plat_hook.h:71
@ VR_STAUS_E_STATUS_IOUT
Definition: plat_hook.h:70
@ VR_STAUS_E_STATUS_CML
Definition: plat_hook.h:73
@ VR_STAUS_E_MAX
Definition: plat_hook.h:74
@ VR_STAUS_E_STATUS_BYTE
Definition: plat_hook.h:67
@ VR_STAUS_E_STATUS_TEMPERATURE
Definition: plat_hook.h:72
@ VR_STAUS_E_STATUS_VOUT
Definition: plat_hook.h:69
@ VR_STAUS_E_STATUS_WORD
Definition: plat_hook.h:68
bool vr_status_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:218
uint8_t reading[1]
Definition: pldm_monitor.h:3
Definition: sensor.h:255
Definition: plat_hook.h:22
void * mutex
Definition: plat_hook.h:92
uint8_t vr_page
Definition: plat_hook.h:25
Definition: sensor.h:777
Definition: sensor.h:773
Definition: plat_hook.h:77
uint8_t * sensor_name
Definition: plat_hook.h:80
uint8_t sensor_id
Definition: plat_hook.h:79
uint8_t index
Definition: plat_hook.h:78
Definition: plat_hook.h:83
uint8_t * vr_status_name
Definition: plat_hook.h:86
uint16_t pmbus_reg
Definition: plat_hook.h:85
uint8_t index
Definition: plat_hook.h:84
name
Definition: plat_i2c.h:24