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#include "plat_def.h"
8#include "libutil.h"
9
10#define TIMESTAMP104_SIZE 13 //A binary datetime type formatted as a series of 13 bytes
11#define NUMERIC_PDR_SIZE 108
12#define MAX_LANGUAGE_TAG_LEN 3 //name language tag: "en"
13
14#ifndef MAX_AUX_SENSOR_NAME_LEN
15#define MAX_AUX_SENSOR_NAME_LEN 40
16#endif
17
18typedef float real32_t;
19
20int pdr_init(void);
21
26};
27
33};
34
59};
60
61typedef struct __attribute__((packed)) {
62 uint32_t record_handle;
63 uint8_t PDR_header_version;
64 uint8_t PDR_type;
65 uint16_t record_change_number;
66 uint16_t data_length;
68
69typedef struct __attribute__((packed)) {
70 /*** PDR common header***/
71 PDR_common_header pdr_common_header;
72
73 /***numeric sensor format***/
74 uint16_t PLDM_terminus_handle;
75 uint16_t sensor_id;
76 uint16_t entity_type;
77 uint16_t entity_instance_number;
78 uint16_t container_id;
79 uint8_t sensor_init;
80 uint8_t sensor_auxiliary_names_pdr;
81 uint8_t base_unit;
82 int8_t unit_modifier;
83 uint8_t rate_unit;
84 uint8_t base_oem_unit_handle;
85 uint8_t aux_unit;
86 int8_t aux_unit_modifier;
87 uint8_t auxrate_unit;
88 uint8_t rel;
89 uint8_t aux_oem_unit_handle;
90 uint8_t is_linear;
91 uint8_t sensor_data_size;
92 real32_t resolution;
94 uint16_t accuracy;
95 uint8_t plus_tolerance;
96 uint8_t minus_tolerance;
97 uint32_t hysteresis;
98 uint8_t supported_thresholds;
99 uint8_t threshold_and_hysteresis_volatility;
100 real32_t state_transition_interval;
101 real32_t update_interval;
102 uint32_t max_readable;
103 uint32_t min_readable;
104 uint8_t range_field_format;
105 uint8_t range_field_support;
106 uint32_t nominal_value;
107 uint32_t normal_max;
108 uint32_t normal_min;
109 int32_t warning_high;
110 int32_t warning_low;
111 int32_t critical_high;
112 int32_t critical_low;
113 int32_t fatal_high;
114 int32_t fatal_low;
116
117typedef struct __attribute__((packed)) {
118 PDR_common_header pdr_common_header;
119 uint16_t terminus_handle;
120 uint16_t sensor_id;
121 uint8_t sensor_count;
122 uint8_t nameStringCount;
123 char nameLanguageTag[MAX_LANGUAGE_TAG_LEN];
126
127typedef struct __attribute__((packed)) {
128 PDR_common_header pdr_common_header;
129 uint16_t entity_type;
130 uint16_t entity_instance_number;
131 uint16_t container_id;
132 uint8_t shared_name_count;
133 uint8_t nameStringCount;
134 char nameLanguageTag[MAX_LANGUAGE_TAG_LEN];
135 char16_t entityName[];
137
138typedef struct __attribute__((packed)) {
139 uint8_t repository_state;
142 uint32_t record_count;
143 uint32_t repository_size;
144 uint32_t largest_record_size;
147
149uint32_t get_record_count();
150uint32_t plat_get_pdr_size(uint8_t pdr_type);
154int pldm_get_sensor_name_via_sensor_id(uint16_t sensor_id, char *sensor_name, size_t max_length);
160int change_pdr_table_critical_high_with_sensor_id(uint32_t sensorID, float critical_high);
161int change_pdr_table_critical_low_with_sensor_id(uint32_t sensorID, float critical_low);
162int get_pdr_table_critical_high_and_low_with_sensor_id(uint32_t sensorID, float *critical_high,
163 float *critical_low);
164int check_supported_threshold_with_sensor_id(uint32_t sensorID);
165
166#endif
uint_least16_t char16_t
Definition: libutil.h:86
PDR_numeric_sensor * numeric_sensor_table
Definition: pdr.c:16
PDR_entity_auxiliary_names * get_entity_auxiliary_names_table()
Definition: pdr.c:314
uint16_t plat_get_pdr_entity_aux_names_size()
Definition: pdr.c:301
uint16_t plat_get_disabled_sensor_count()
Definition: pdr.c:307
#define MAX_AUX_SENSOR_NAME_LEN
Definition: pdr.h:15
float real32_t
Definition: pdr.h:18
int change_pdr_table_critical_low_with_sensor_id(uint32_t sensorID, float critical_low)
Definition: pdr.c:336
int pldm_get_sensor_name_via_sensor_id(uint16_t sensor_id, char *sensor_name, size_t max_length)
Definition: pdr.c:174
int get_pdr_table_via_record_handle(uint8_t *record_data, uint32_t record_handle)
Definition: pdr.c:222
#define MAX_LANGUAGE_TAG_LEN
Definition: pdr.h:12
int get_pdr_table_critical_high_and_low_with_sensor_id(uint32_t sensorID, float *critical_high, float *critical_low)
Definition: pdr.c:353
pdr_repository_state
Definition: pdr.h:22
@ PDR_STATE_FAILED
Definition: pdr.h:25
@ PDR_STATE_AVAILABLE
Definition: pdr.h:23
@ PDR_STATE_UPDATE_IN_PROGRESS
Definition: pdr.h:24
PDR_common_header
Definition: pdr.h:67
void plat_init_entity_aux_names_pdr_table()
Definition: pdr.c:290
pldm_pdr_types
Definition: pdr.h:35
@ PLDM_OEM_ENTITY_ID_PDR
Definition: pdr.h:52
@ PLDM_EFFECTER_OEM_SEMANTIC_PDR
Definition: pdr.h:49
@ PLDM_PDR_ENTITY_ASSOCIATION
Definition: pdr.h:50
@ PLDM_NUMERIC_SENSOR_PDR
Definition: pdr.h:37
@ PLDM_PDR_FRU_RECORD_SET
Definition: pdr.h:55
@ PLDM_STATE_EFFECTER_INITIALIZATION_PDR
Definition: pdr.h:47
@ PLDM_OEM_PDR
Definition: pdr.h:58
@ PLDM_STATE_SENSOR_INITIALIZATION_PDR
Definition: pdr.h:40
@ PLDM_COMPACT_NUMERIC_SENSOR_PDR
Definition: pdr.h:56
@ PLDM_EFFECTER_AUXILIARY_NAMES_PDR
Definition: pdr.h:48
@ PLDM_STATE_EFFECTER_PDR
Definition: pdr.h:46
@ PLDM_STATE_SENSOR_PDR
Definition: pdr.h:39
@ PLDM_EVENT_LOG_PDR
Definition: pdr.h:54
@ PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR
Definition: pdr.h:45
@ PLDM_OEM_UNIT_PDR
Definition: pdr.h:42
@ PLDM_NUMERIC_EFFECTER_PDR
Definition: pdr.h:44
@ PLDM_OEM_STATE_SET_PDR
Definition: pdr.h:43
@ PLDM_OEM_DEVICE_PDR
Definition: pdr.h:57
@ PLDM_INTERRUPT_ASSOCIATION_PDR
Definition: pdr.h:53
@ PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR
Definition: pdr.h:38
@ PLDM_SENSOR_AUXILIARY_NAMES_PDR
Definition: pdr.h:41
@ PLDM_ENTITY_AUXILIARY_NAMES_PDR
Definition: pdr.h:51
@ PLDM_TERMINUS_LOCATOR_PDR
Definition: pdr.h:36
uint32_t plat_get_pdr_size(uint8_t pdr_type)
Definition: pdr.c:272
void plat_load_entity_aux_names_pdr_table(PDR_entity_auxiliary_names *entity_aux_name_table)
Definition: pdr.c:295
PDR_numeric_sensor
Definition: pdr.h:115
uint32_t get_record_count()
Definition: pdr.c:267
void plat_load_numeric_sensor_pdr_table(PDR_numeric_sensor *numeric_sensor_table)
Definition: pdr.c:278
PDR_INFO
Definition: pdr.h:146
#define TIMESTAMP104_SIZE
Definition: pdr.h:10
PDR_INFO * get_pdr_info()
Definition: pdr.c:128
PDR_sensor_auxiliary_names
Definition: pdr.h:125
PDR_entity_auxiliary_names
Definition: pdr.h:136
int pdr_init(void)
Definition: pdr.c:20
int check_supported_threshold_with_sensor_id(uint32_t sensorID)
Definition: pdr.c:372
void plat_load_aux_sensor_names_pdr_table(PDR_sensor_auxiliary_names *aux_sensor_name_table)
Definition: pdr.c:284
int change_pdr_table_critical_high_with_sensor_id(uint32_t sensorID, float critical_high)
Definition: pdr.c:319
PDR_SENSOR_INIT_STATE
Definition: pdr.h:28
@ PDR_SENSOR_ENABLE
Definition: pdr.h:31
@ PDR_SENSOR_NO_INIT
Definition: pdr.h:29
@ PDR_SENSOR_USEINIT_PDR
Definition: pdr.h:30
@ PDR_SENSOR_DISABLE
Definition: pdr.h:32
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:1351
Definition: pldm_smbios.h:61