OpenBIC
OpenSource Bridge-IC
intel_peci.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 PECI_H
18#define PECI_H
19
20#include <stdbool.h>
21#include <stdint.h>
22
23#define RDPKG_IDX_PKG_TEMP 0x02
24#define RDPKG_IDX_DIMM_TEMP 0x0E
25#define WRPKG_IDX_DIMM_TEMP 0x0E
26#define RDPKG_IDX_TJMAX_TEMP 0x10
27#define RDPKG_IDX_PWR_SKU_UNIT_READ 0x1E
28
29#define PECI_CC_SUCCESS 0x40
30
31enum {
55};
56
57typedef struct {
58 uint8_t time_unit;
59 uint8_t energy_unit;
60 uint8_t power_unit;
62
63bool check_dimm_present(uint8_t dimm_channel, uint8_t dimm_num, uint8_t *present_result);
64bool pal_get_power_sku_unit(uint8_t addr);
65bool pal_get_cpu_time(uint8_t addr, uint8_t cmd, uint8_t readlen, uint32_t *run_time);
66bool pal_get_cpu_energy(uint8_t addr, uint32_t *pkg_energy, uint32_t *run_time);
67void pal_cal_cpu_power(intel_peci_unit unit_info, uint32_t diff_energy, uint32_t diff_time,
68 int *reading);
69
70#endif
@ PECI_TEMP_CHANNEL2_DIMM1
Definition: intel_peci.h:41
@ PECI_MAX
Definition: intel_peci.h:54
@ PECI_TEMP_CPU_MARGIN
Definition: intel_peci.h:33
@ PECI_TEMP_CHANNEL4_DIMM0
Definition: intel_peci.h:44
@ PECI_TEMP_CHANNEL5_DIMM0
Definition: intel_peci.h:46
@ PECI_TEMP_CPU_TJMAX
Definition: intel_peci.h:35
@ PECI_TEMP_CHANNEL6_DIMM0
Definition: intel_peci.h:48
@ PECI_TEMP_CHANNEL0_DIMM1
Definition: intel_peci.h:37
@ PECI_TEMP_CPU
Definition: intel_peci.h:34
@ PECI_TEMP_CHANNEL0_DIMM0
Definition: intel_peci.h:36
@ PECI_TEMP_CHANNEL1_DIMM1
Definition: intel_peci.h:39
@ PECI_TEMP_CHANNEL4_DIMM1
Definition: intel_peci.h:45
@ PECI_TEMP_CHANNEL6_DIMM1
Definition: intel_peci.h:49
@ PECI_TEMP_CHANNEL5_DIMM1
Definition: intel_peci.h:47
@ PECI_PWR_CPU
Definition: intel_peci.h:53
@ PECI_UNKNOWN
Definition: intel_peci.h:32
@ PECI_TEMP_CHANNEL7_DIMM0
Definition: intel_peci.h:50
@ PECI_POWER_TOTAL_DIMM
Definition: intel_peci.h:52
@ PECI_TEMP_CHANNEL2_DIMM0
Definition: intel_peci.h:40
@ PECI_TEMP_CHANNEL3_DIMM1
Definition: intel_peci.h:43
@ PECI_TEMP_CHANNEL7_DIMM1
Definition: intel_peci.h:51
@ PECI_TEMP_CHANNEL3_DIMM0
Definition: intel_peci.h:42
@ PECI_TEMP_CHANNEL1_DIMM0
Definition: intel_peci.h:38
bool pal_get_cpu_energy(uint8_t addr, uint32_t *pkg_energy, uint32_t *run_time)
Definition: intel_peci.c:214
bool pal_get_cpu_time(uint8_t addr, uint8_t cmd, uint8_t readlen, uint32_t *run_time)
bool pal_get_power_sku_unit(uint8_t addr)
Definition: intel_peci.c:38
void pal_cal_cpu_power(intel_peci_unit unit_info, uint32_t diff_energy, uint32_t diff_time, int *reading)
Definition: intel_peci.c:265
bool check_dimm_present(uint8_t dimm_channel, uint8_t dimm_num, uint8_t *present_result)
Definition: intel_peci.c:85
uint8_t cmd
Definition: isl69259.c:1
uint8_t addr
Definition: isl69259.c:0
uint8_t reading[1]
Definition: pldm_monitor.h:3
Definition: intel_peci.h:57
uint8_t power_unit
Definition: intel_peci.h:60
uint8_t time_unit
Definition: intel_peci.h:58
uint8_t energy_unit
Definition: intel_peci.h:59