OpenBIC
OpenSource Bridge-IC
pdr.h
Go to the documentation of this file.
1#ifndef PDR_H
2#define PDR_H
3
4#include <stdbool.h>
5#include <stdint.h>
6#include <sys/byteorder.h>
7
8#define TIMESTAMP104_SIZE 13 //A binary datetime type formatted as a series of 13 bytes
9#define NUMERIC_PDR_SIZE 108
10#define MAX_LANGUAGE_TAG_LEN 3 //name language tag: "en"
11#define MAX_AUX_SENSOR_NAME_LEN 40
12
13typedef float real32_t;
14typedef uint_least16_t char16_t;
15
16int pdr_init(void);
17
22};
23
29};
30
55};
56
57typedef struct __attribute__((packed)) {
58 uint32_t record_handle;
59 uint8_t PDR_header_version;
60 uint8_t PDR_type;
61 uint16_t record_change_number;
62 uint16_t data_length;
64
65typedef struct __attribute__((packed)) {
66 /*** PDR common header***/
67 PDR_common_header pdr_common_header;
68
69 /***numeric sensor format***/
70 uint16_t PLDM_terminus_handle;
71 uint16_t sensor_id;
72 uint16_t entity_type;
73 uint16_t entity_instance_number;
74 uint16_t container_id;
75 uint8_t sensor_init;
76 uint8_t sensor_auxiliary_names_pdr;
77 uint8_t base_unit;
78 int8_t unit_modifier;
79 uint8_t rate_unit;
80 uint8_t base_oem_unit_handle;
81 uint8_t aux_unit;
82 int8_t aux_unit_modifier;
83 uint8_t auxrate_unit;
84 uint8_t rel;
85 uint8_t aux_oem_unit_handle;
86 uint8_t is_linear;
87 uint8_t sensor_data_size;
88 real32_t resolution;
90 uint16_t accuracy;
91 uint8_t plus_tolerance;
92 uint8_t minus_tolerance;
93 uint32_t hysteresis;
94 uint8_t supported_thresholds;
95 uint8_t threshold_and_hysteresis_volatility;
96 real32_t state_transition_interval;
97 real32_t update_interval;
98 uint32_t max_readable;
99 uint32_t min_readable;
100 uint8_t range_field_format;
101 uint8_t range_field_support;
102 uint32_t nominal_value;
103 uint32_t normal_max;
104 uint32_t normal_min;
105 int32_t warning_high;
106 int32_t warning_low;
107 int32_t critical_high;
108 int32_t critical_low;
109 int32_t fatal_high;
110 int32_t fatal_low;
112
113typedef struct __attribute__((packed)) {
114 PDR_common_header pdr_common_header;
115 uint16_t terminus_handle;
116 uint16_t sensor_id;
117 uint8_t sensor_count;
118 uint8_t nameStringCount;
119 char nameLanguageTag[MAX_LANGUAGE_TAG_LEN];
122
123typedef struct __attribute__((packed)) {
124 PDR_common_header pdr_common_header;
125 uint16_t entity_type;
126 uint16_t entity_instance_number;
127 uint16_t container_id;
128 uint8_t shared_name_count;
129 uint8_t nameStringCount;
130 char nameLanguageTag[MAX_LANGUAGE_TAG_LEN];
131 char16_t entityName[];
133
134typedef struct __attribute__((packed)) {
135 uint8_t repository_state;
138 uint32_t record_count;
139 uint32_t repository_size;
140 uint32_t largest_record_size;
143
145uint32_t get_record_count();
146uint32_t plat_get_pdr_size(uint8_t pdr_type);
150int pldm_get_sensor_name_via_sensor_id(uint16_t sensor_id, char *sensor_name, size_t max_length);
156int change_pdr_table_critical_high_with_sensor_id(uint32_t sensorID, float critical_high);
157int change_pdr_table_critical_low_with_sensor_id(uint32_t sensorID, float critical_low);
158int get_pdr_table_critical_high_and_low_with_sensor_id(uint32_t sensorID, float *critical_high,
159 float *critical_low);
160int check_supported_threshold_with_sensor_id(uint32_t sensorID);
161
162#endif
PDR_numeric_sensor * numeric_sensor_table
Definition: pdr.c:17
PDR_entity_auxiliary_names * get_entity_auxiliary_names_table()
Definition: pdr.c:290
uint16_t plat_get_pdr_entity_aux_names_size()
Definition: pdr.c:277
uint16_t plat_get_disabled_sensor_count()
Definition: pdr.c:283
#define MAX_AUX_SENSOR_NAME_LEN
Definition: pdr.h:11
float real32_t
Definition: pdr.h:13
uint_least16_t char16_t
Definition: pdr.h:14
int change_pdr_table_critical_low_with_sensor_id(uint32_t sensorID, float critical_low)
Definition: pdr.c:312
int pldm_get_sensor_name_via_sensor_id(uint16_t sensor_id, char *sensor_name, size_t max_length)
Definition: pdr.c:175
int get_pdr_table_via_record_handle(uint8_t *record_data, uint32_t record_handle)
Definition: pdr.c:198
#define MAX_LANGUAGE_TAG_LEN
Definition: pdr.h:10
int get_pdr_table_critical_high_and_low_with_sensor_id(uint32_t sensorID, float *critical_high, float *critical_low)
Definition: pdr.c:329
pdr_repository_state
Definition: pdr.h:18
@ PDR_STATE_FAILED
Definition: pdr.h:21
@ PDR_STATE_AVAILABLE
Definition: pdr.h:19
@ PDR_STATE_UPDATE_IN_PROGRESS
Definition: pdr.h:20
PDR_common_header
Definition: pdr.h:63
void plat_init_entity_aux_names_pdr_table()
Definition: pdr.c:266
pldm_pdr_types
Definition: pdr.h:31
@ PLDM_OEM_ENTITY_ID_PDR
Definition: pdr.h:48
@ PLDM_EFFECTER_OEM_SEMANTIC_PDR
Definition: pdr.h:45
@ PLDM_PDR_ENTITY_ASSOCIATION
Definition: pdr.h:46
@ PLDM_NUMERIC_SENSOR_PDR
Definition: pdr.h:33
@ PLDM_PDR_FRU_RECORD_SET
Definition: pdr.h:51
@ PLDM_STATE_EFFECTER_INITIALIZATION_PDR
Definition: pdr.h:43
@ PLDM_OEM_PDR
Definition: pdr.h:54
@ PLDM_STATE_SENSOR_INITIALIZATION_PDR
Definition: pdr.h:36
@ PLDM_COMPACT_NUMERIC_SENSOR_PDR
Definition: pdr.h:52
@ PLDM_EFFECTER_AUXILIARY_NAMES_PDR
Definition: pdr.h:44
@ PLDM_STATE_EFFECTER_PDR
Definition: pdr.h:42
@ PLDM_STATE_SENSOR_PDR
Definition: pdr.h:35
@ PLDM_EVENT_LOG_PDR
Definition: pdr.h:50
@ PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR
Definition: pdr.h:41
@ PLDM_OEM_UNIT_PDR
Definition: pdr.h:38
@ PLDM_NUMERIC_EFFECTER_PDR
Definition: pdr.h:40
@ PLDM_OEM_STATE_SET_PDR
Definition: pdr.h:39
@ PLDM_OEM_DEVICE_PDR
Definition: pdr.h:53
@ PLDM_INTERRUPT_ASSOCIATION_PDR
Definition: pdr.h:49
@ PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR
Definition: pdr.h:34
@ PLDM_SENSOR_AUXILIARY_NAMES_PDR
Definition: pdr.h:37
@ PLDM_ENTITY_AUXILIARY_NAMES_PDR
Definition: pdr.h:47
@ PLDM_TERMINUS_LOCATOR_PDR
Definition: pdr.h:32
uint32_t plat_get_pdr_size(uint8_t pdr_type)
Definition: pdr.c:248
void plat_load_entity_aux_names_pdr_table(PDR_entity_auxiliary_names *entity_aux_name_table)
Definition: pdr.c:271
PDR_numeric_sensor
Definition: pdr.h:111
uint32_t get_record_count()
Definition: pdr.c:243
void plat_load_numeric_sensor_pdr_table(PDR_numeric_sensor *numeric_sensor_table)
Definition: pdr.c:254
PDR_INFO
Definition: pdr.h:142
#define TIMESTAMP104_SIZE
Definition: pdr.h:8
PDR_INFO * get_pdr_info()
Definition: pdr.c:129
PDR_sensor_auxiliary_names
Definition: pdr.h:121
PDR_entity_auxiliary_names
Definition: pdr.h:132
int pdr_init(void)
Definition: pdr.c:21
int check_supported_threshold_with_sensor_id(uint32_t sensorID)
Definition: pdr.c:348
void plat_load_aux_sensor_names_pdr_table(PDR_sensor_auxiliary_names *aux_sensor_name_table)
Definition: pdr.c:260
int change_pdr_table_critical_high_with_sensor_id(uint32_t sensorID, float critical_high)
Definition: pdr.c:295
PDR_SENSOR_INIT_STATE
Definition: pdr.h:24
@ PDR_SENSOR_ENABLE
Definition: pdr.h:27
@ PDR_SENSOR_NO_INIT
Definition: pdr.h:25
@ PDR_SENSOR_USEINIT_PDR
Definition: pdr.h:26
@ PDR_SENSOR_DISABLE
Definition: pdr.h:28
uint32_t offset
Definition: pldm_firmware_update.h:0
uint8_t data_transfer_handle_timeout
Definition: pldm_monitor.h:7
uint8_t repository_state
Definition: pldm_monitor.h:1
uint8_t record_data[NUMERIC_PDR_SIZE]
Definition: pldm_monitor.h:5
uint16_t record_change_number
Definition: pldm_monitor.h:4
uint16_t sensor_id
Definition: pldm_monitor.h:0
uint32_t record_count
Definition: pldm_monitor.h:4
uint8_t oem_update_time[TIMESTAMP104_SIZE]
Definition: pldm_monitor.h:3
uint32_t largest_record_size
Definition: pldm_monitor.h:6
uint8_t update_time[TIMESTAMP104_SIZE]
Definition: pldm_monitor.h:2
uint32_t record_handle
Definition: pldm_monitor.h:0
uint8_t sensor_data_size
Definition: pldm_monitor.h:1
uint32_t repository_size
Definition: pldm_monitor.h:5
uint32_t data_length
Definition: pldm_oem.h:1
bool sensor_init(void)
Definition: sensor.c:1343
Definition: pldm_smbios.h:61