OpenBIC
OpenSource Bridge-IC
pm8702.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 PM8702_H
18#define PM8702_H
19#include "mctp.h"
20#include "plat_def.h"
21
22#ifdef ENABLE_PM8702
23
24/*CCI (pm8702 vendor CMD) */
25#define pm8702_I2C_OFFSET_READ 0xc401
26#define PM8702_HBO_STATUS 0xCD00
27#define PM8702_HBO_TRANSFER_FW 0xCD01
28#define PM8702_HBO_ACTIVATE_FW 0xCD02
29#define PM8702_READ_DIMM_TEMP 0xC531
30
31/*CCI (pm8702 vendor CMD) Request paypload length */
32#define I2C_OFFSET_READ_REQ_PL_LEN 20 /*Size Bytes*/
33#define HBO_STATUS_REQ_PL_LEN 0
34#define HBO_TRANSFER_FW_REQ_PL_LEN 256
35#define HBO_ACTIVATE_FW_REQ_PL_LEN 2
36#define READ_DIMM_TEMP_REQ_PL_LEN 0
37
38/*CCI (pm8702 vendor CMD) Response paypload length */
39#define DIMM_TEMP_READ_RESP_PL_LEN 2 /*Size Bytes*/
40#define DIMM_TEMP_RESP_PL_LEN 84
41
42/*PM8702_I2C_OFFSET_READ parameters */
43#define ADDR_SIZE_7_BIT 0x00
44#define ADDR_SIZE_10_BIT 0x01
45
46#define OFFSET_SIZE_8_BIT 0x01
47#define OFFSET_SIZE_16_BIT 0x02
48
49#define I2C_READ_TIMEOUT_MS 1000
50#define DIMM_TEMP_REG_OFFSET 0x0005 /*Refer to JEDEC SPD*/
51
52/*PM8702 0xC531 return code */
53#define DIMM_ERROR_VALUE 0x80
54
55typedef struct __attribute__((__packed__)) {
56 uint8_t addr_size;
57 uint8_t rsvd_0;
58 uint16_t address;
59 uint8_t offset_size;
60 uint8_t rsvd_1;
61 uint16_t offset;
62 uint32_t timeout_offset;
63 uint32_t read_bytes;
64 uint32_t timeout_ms;
65} i2c_offset_read_req;
66
67typedef struct _pm8702_hbo_status_resp {
68 uint16_t cmd_opcode;
69 uint8_t percent_complete : 7;
70 uint8_t bo_run : 1;
71 uint8_t reserved;
72 uint16_t return_code;
73 uint16_t vendor_status;
74} pm8702_hbo_status_resp;
75
76typedef struct _pm8702_command_info {
77 uint16_t cmd_opcode;
78 int payload_len;
79 int response_len;
80} pm8702_command_info;
81
82typedef struct __attribute__((__packed__)) {
83 uint8_t compnt_type;
84 uint8_t dimm_id;
85 uint8_t temp_sensor_id;
86 uint8_t rsvd_0;
87 uint32_t rsvd_1;
88 uint32_t rsvd_2;
89 uint32_t rsvd_3;
90 uint8_t temp_int;
91 uint8_t temp_dec;
92 uint16_t rsvd_4;
93} dimm_slot_info; //0xc531
94
95typedef struct __attribute__((__packed__)) {
96 uint8_t dimm_num;
97 uint8_t flag;
98 uint16_t rsvd;
99} dimm_info_header; //0xc531
100
101typedef enum _pm8702_access {
102 chip_temp,
103 dimm_temp,
104 dimm_temp_from_pioneer,
105} pm8702_access;
106
107bool pm8702_get_dimm_temp(void *mctp_p, mctp_ext_params ext_params, uint16_t address,
108 int16_t *interger, int16_t *fraction);
109bool pm8702_cmd_handler(void *mctp_inst, mctp_ext_params ext_params, uint16_t opcode,
110 uint8_t *data_buf, int data_len, uint8_t *response, uint8_t *response_len);
111bool pm8702_read_dimm_temp_from_pioneer(void *mctp_p, mctp_ext_params ext_params, int dimm_id,
112 int16_t *temp_int, int16_t *temp_dec);
113
114#endif
115
116#endif
uint16_t data_len
Definition: ipmb.h:14
uint32_t reserved
Definition: plat_ncsi.h:4
uint32_t offset
Definition: pldm_firmware_update.h:0
Definition: pldm_smbios.h:61
Definition: mctp.h:98
uint8_t rsvd
Definition: plat_pldm.h:4