OpenBIC
OpenSource Bridge-IC
vistara.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 VISTARA_H
18#define VISTARA_H
19
20#ifdef ENABLE_VISTARA
21#include "cci.h"
22#include <sys/byteorder.h>
23
24#define READ_DDR_TEMP_REQ_LEN 0
25#define READ_DDR_TEMP_RESP_LEN 32
26
27#define VISTARA_SPD_DDR4_TOTAL_BYTES 512
28#define VISTARA_SPD_CHUNK_DEFAULT 64
29#define VISTARA_SPD_MODULE_SN_OFF 325
30#define VISTARA_SPD_MODULE_SN_LEN 4
31#define VISTARA_CCI_BUFFER_SIZE 256
32
33enum VISTARA_CCI_CMD_OEM_OPCODE {
34 CCI_OEM_OP_READ_DDR_TEMP = 0xC531,
35 CCI_OEM_OP_DIMM_SPD_READ = 0xC510,
36};
37
38enum VISTARA_SENSOR_TYPE {
39 DDR_TEMP,
40};
41
42enum VISTARA_DIMM_ID {
43 DIMMA_ID = 0,
44 DIMMB_ID,
45 DIMMC_ID,
46 DIMMD_ID,
47 MAX_DIMM_ID,
48};
49
50typedef struct {
51 uint8_t temp_valid;
52 uint8_t dimm_id;
53 uint8_t spd_id;
54 uint8_t reserved;
55 uint8_t dimm_temp[4];
56} read_ddr_temp_resp;
57
58struct vistara_dimm_spd_read_args {
59 uint32_t spd_id;
60 uint32_t offset;
61 uint32_t num_bytes;
62};
63
64static inline size_t vistara_encode_dimm_spd_read(uint8_t dst[12],
65 const struct vistara_dimm_spd_read_args *a)
66{
67 sys_put_le32(a->spd_id, &dst[0]);
68 sys_put_le32(a->offset, &dst[4]);
69 sys_put_le32(a->num_bytes, &dst[8]);
70 return 12;
71}
72
73uint8_t plat_get_cxl_eid(uint8_t cxl_id);
74void plat_set_dimm_cache(uint8_t *resp_buf, uint8_t cxl_id, uint8_t status);
75float plat_get_dimm_cache(uint8_t cxl_id, uint8_t dimm_id);
76bool vistara_cci_command(uint8_t cxl_eid, mctp_cci_msg cci_msg, uint8_t *resp, uint8_t resp_len);
77bool vistara_read_ddr_temp(uint8_t cxl_eid, uint8_t *resp);
78int vistara_read_dimm_spd_chunk_eid(uint8_t cxl_eid, uint8_t dimm_idx, uint16_t offset,
79 uint8_t length, uint8_t *out);
80bool vistara_read_dimm_spd_ddr4(uint8_t cxl_eid, uint8_t dimm_idx,
81 uint8_t out512[VISTARA_SPD_DDR4_TOTAL_BYTES]);
82#endif
83#endif
uint8_t status
Definition: mctp_ctrl.h:1
uint32_t reserved
Definition: plat_ncsi.h:4
uint32_t offset
Definition: pldm_firmware_update.h:0
uint32_t length
Definition: pldm_firmware_update.h:1
Definition: cci.h:71
uint8_t plat_get_cxl_eid(uint8_t cxl_id)
Definition: plat_mctp.c:439
void plat_set_dimm_cache(uint8_t *resp_buf, uint8_t cxl_id, uint8_t status)
Definition: plat_pldm_sensor.c:6756
float plat_get_dimm_cache(uint8_t cxl_id, uint8_t dimm_id)
Definition: plat_pldm_sensor.c:6742