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 12
23#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
24
25#include "plat_pldm_sensor.h"
26
41};
42
67};
68
78};
79
80typedef struct vr_mapping_status {
81 uint8_t index;
82 uint16_t pmbus_reg;
83 uint8_t *vr_status_name;
85
86typedef struct _vr_pre_proc_arg {
87 void *mutex;
88 uint8_t vr_page;
90
91typedef struct vr_mapping_sensor {
92 uint8_t index;
93 uint8_t sensor_id;
94 uint8_t *sensor_name;
95 int peak_value;
97
98bool pre_vr_read(sensor_cfg *cfg, void *args);
99bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading);
100bool is_mb_dc_on();
101void *vr_mutex_get(enum VR_INDEX_E vr_index);
102void vr_mutex_init(void);
103bool vr_rail_name_get(uint8_t rail, uint8_t **name);
104bool vr_status_name_get(uint8_t rail, uint8_t **name);
105bool vr_rail_enum_get(uint8_t *name, uint8_t *num);
106bool vr_status_enum_get(uint8_t *name, uint8_t *num);
107bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status);
108bool plat_clear_vr_status(uint8_t rail);
109#endif
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_mapping_status vr_mapping_status
void vr_mutex_init(void)
Definition: plat_hook.c:721
struct vr_mapping_sensor vr_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 vr_status_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:855
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
bool plat_clear_vr_status(uint8_t rail)
Definition: plat_hook.c:1877
void * vr_mutex_get(enum VR_INDEX_E vr_index)
Definition: plat_hook.c:506
bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
Definition: plat_hook.c:1812
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
bool vr_status_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:801
uint8_t reading[1]
Definition: pldm_monitor.h:3
@ VR_RAIL_E_ASIC_P0V85_HAMSA_VDD
Definition: plat_hook.h:57
@ VR_RAIL_E_ASIC_P0V75_MAX_S_VDD
Definition: plat_hook.h:63
@ VR_RAIL_E_ASIC_P0V4_VDDQL_HBM0246
Definition: plat_hook.h:60
@ VR_RAIL_E_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE
Definition: plat_hook.h:56
@ VR_RAIL_E_ASIC_P0V75_VDDPHY_HBM1357
Definition: plat_hook.h:49
@ VR_RAIL_E_ASIC_P0V75_OWL_E_VDD
Definition: plat_hook.h:50
@ VR_RAIL_E_ASIC_P1V8_VPP_HBM0246
Definition: plat_hook.h:59
@ VR_RAIL_E_ASIC_P0V4_VDDQL_HBM1357
Definition: plat_hook.h:51
@ VR_RAIL_E_ASIC_P0V9_OWL_E_TRVDD
Definition: plat_hook.h:46
@ VR_RAIL_EASIC_P0V75_VDDPHY_HBM0246
Definition: plat_hook.h:61
@ VR_RAIL_E_ASIC_P1V8_VPP_HBM1357
Definition: plat_hook.h:53
@ VR_RAIL_E_ASIC_P0V85_MEDHA0_VDD
Definition: plat_hook.h:44
@ VR_RAIL_E_ASIC_P0V75_OWL_W_VDD
Definition: plat_hook.h:62
@ VR_RAIL_E_ASIC_P0V75_OWL_E_TRVDD
Definition: plat_hook.h:47
@ VR_RAIL_E_ASIC_P1V1_VDDQC_HBM1357
Definition: plat_hook.h:52
@ VR_RAIL_E_ASIC_P0V85_MEDHA1_VDD
Definition: plat_hook.h:45
@ VR_RAIL_E_ASIC_P0V75_MAX_M_VDD
Definition: plat_hook.h:48
@ VR_RAIL_E_ASIC_P0V75_OWL_W_TRVDD
Definition: plat_hook.h:65
@ VR_RAIL_E_ASIC_P0V8_HAMSA_AVDD_PCIE
Definition: plat_hook.h:55
@ VR_RAIL_E_ASIC_P1V1_VDDQC_HBM0246
Definition: plat_hook.h:58
@ VR_RAIL_E_ASIC_P0V75_MAX_N_VDD
Definition: plat_hook.h:54
@ VR_RAIL_E_ASIC_P0V9_OWL_W_TRVDD
Definition: plat_hook.h:64
@ VR_INDEX_E_2
Definition: plat_hook.h:29
@ VR_INDEX_E_10
Definition: plat_hook.h:37
@ VR_INDEX_E_11
Definition: plat_hook.h:38
@ VR_INDEX_E_4
Definition: plat_hook.h:31
@ VR_INDEX_E_9
Definition: plat_hook.h:36
@ VR_INDEX_E_3
Definition: plat_hook.h:30
@ VR_INDEX_E_12
Definition: plat_hook.h:39
@ VR_INDEX_E_6
Definition: plat_hook.h:33
@ VR_INDEX_E_8
Definition: plat_hook.h:35
@ VR_INDEX_E_1
Definition: plat_hook.h:28
@ VR_INDEX_E_7
Definition: plat_hook.h:34
@ VR_INDEX_E_5
Definition: plat_hook.h:32
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: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
name
Definition: plat_i2c.h:24