OpenBIC
OpenSource Bridge-IC
hal_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 HAL_PECI_H
18#define HAL_PECI_H
19
20#define DEBUG_PECI 0
21
22/* Completion Code mask to check retry needs */
23#define PECI_DEV_CC_RETRY_CHECK_MASK 0xf0
24#define PECI_DEV_CC_NEED_RETRY 0x80
25#define IS_PECI_CC_NEED_RETRY(cc) \
26 (((cc) & PECI_DEV_CC_RETRY_CHECK_MASK) == PECI_DEV_CC_NEED_RETRY) ? true : false
27#define PECI_DEV_RETRY_BIT 0x01
28#define PECI_DEV_RETRY_TIMEOUT 700 // ms
29#define PECI_DEV_RETRY_INTERVAL_MAX_MSEC 100
30#define PECI_DEV_RETRY_INTERVAL_MIN_MSEC 1
31
56};
57
58int peci_init();
59int peci_ping(uint8_t address);
60int peci_read(uint8_t cmd, uint8_t address, uint8_t u8Index, uint16_t u16Param, uint8_t u8ReadLen,
61 uint8_t *readBuf);
62int peci_write(uint8_t cmd, uint8_t address, uint8_t u8ReadLen, uint8_t *readBuf,
63 uint8_t u8WriteLen, uint8_t *writeBuf);
64bool peci_retry_read(uint8_t cmd, uint8_t address, uint8_t u8Index, uint16_t u16Param,
65 uint8_t u8ReadLen, uint8_t *readBuf);
66
67#endif
int peci_ping(uint8_t address)
Definition: hal_peci.c:58
int peci_read(uint8_t cmd, uint8_t address, uint8_t u8Index, uint16_t u16Param, uint8_t u8ReadLen, uint8_t *readBuf)
Definition: hal_peci.c:149
int peci_init()
Definition: hal_peci.c:33
peci_cmd
Definition: hal_peci.h:32
@ PECI_RD_PCI_CFG_LOCAL0_CMD
Definition: hal_peci.h:51
@ PECI_PING_CMD
Definition: hal_peci.h:33
@ PECI_GET_TEMP0_CMD
Definition: hal_peci.h:34
@ PECI_RD_IAMSR0_CMD
Definition: hal_peci.h:45
@ PECI_RD_PKG_CFG1_CMD
Definition: hal_peci.h:42
@ PECI_WR_PCI_CFG1_CMD
Definition: hal_peci.h:39
@ PECI_CRASHDUMP_CMD
Definition: hal_peci.h:40
@ PECI_RD_PCI_CFG0_CMD
Definition: hal_peci.h:36
@ PECI_RD_PCI_CFG_LOCAL1_CMD
Definition: hal_peci.h:52
@ PECI_GET_DIB_CMD
Definition: hal_peci.h:55
@ PECI_RD_ENDPOINT_CFG_CMD
Definition: hal_peci.h:49
@ PECI_WR_ENDPOINT_CFG_CMD
Definition: hal_peci.h:50
@ PECI_WR_PKG_CFG1_CMD
Definition: hal_peci.h:44
@ PECI_WR_PKG_CFG0_CMD
Definition: hal_peci.h:43
@ PECI_WR_PCI_CFG_LOCAL1_CMD
Definition: hal_peci.h:54
@ PECI_RD_IAMSR1_CMD
Definition: hal_peci.h:46
@ PECI_WR_IAMSR0_CMD
Definition: hal_peci.h:47
@ PECI_RD_PKG_CFG0_CMD
Definition: hal_peci.h:41
@ PECI_WR_PCI_CFG0_CMD
Definition: hal_peci.h:38
@ PECI_RD_PCI_CFG1_CMD
Definition: hal_peci.h:37
@ PECI_WR_IAMSR1_CMD
Definition: hal_peci.h:48
@ PECI_GET_TEMP1_CMD
Definition: hal_peci.h:35
@ PECI_WR_PCI_CFG_LOCAL0_CMD
Definition: hal_peci.h:53
int peci_write(uint8_t cmd, uint8_t address, uint8_t u8ReadLen, uint8_t *readBuf, uint8_t u8WriteLen, uint8_t *writeBuf)
Definition: hal_peci.c:189
bool peci_retry_read(uint8_t cmd, uint8_t address, uint8_t u8Index, uint16_t u16Param, uint8_t u8ReadLen, uint8_t *readBuf)
uint8_t cmd
Definition: isl69259.c:1