OpenBIC
OpenSource Bridge-IC
plat_dimm.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 PLAT_DIMM_H
18#define PLAT_DIMM_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include "plat_i3c.h"
23
24#define MAX_COUNT_DIMM 6
25
26#define I3C_MUX_TO_BIC 0x1
27#define I3C_MUX_TO_CPU 0x0
28#define DIMM_MUX_TO_DIMM_A0A1A3 0x0
29#define DIMM_MUX_TO_DIMM_A4A6A7 0x1
30#define I3C_DIMM_MUX_MUTEX_TIMEOUT_MS 1000
31
32#define GET_DIMM_INFO_TIME_MS 1000
33#define GET_DIMM_INFO_STACK_SIZE 2304
34
35#define MAX_LEN_ME_GET_PMIC_ERR 6
36
37#define MAX_LEN_I3C_GET_PMIC_ERR 47
38#define MAX_LEN_I3C_GET_PMIC_PWR 1
39#define MAX_LEN_I3C_GET_SPD_TEMP 2
40
41#define DIMM_I3C_MUX_CONTROL_OFFSET 0x0B
42
43enum DIMM_ID {
51};
52
57};
58
63};
64
66 DIMM_SPD = 0x00,
68 DIMM_PMIC = 0x02,
69};
70
71typedef struct dimm_info {
77
78extern struct k_mutex i3c_dimm_mux_mutex;
79extern uint8_t pmic_i3c_addr_list[MAX_COUNT_DIMM / 2];
80extern uint8_t spd_i3c_addr_list[MAX_COUNT_DIMM / 2];
81
83
86void init_i3c_dimm();
88void clear_unaccessible_dimm_data(uint8_t dimm_id);
89int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position);
91int all_brocast_ccc(I3C_MSG *i3c_msg);
92bool is_dimm_present(uint8_t dimm_id);
93bool is_dimm_init();
94uint8_t sensor_num_map_dimm_id(uint8_t sensor_num);
95int get_pmic_error_raw_data(int dimm_index, uint8_t *data);
96void get_pmic_power_raw_data(int dimm_index, uint8_t *data);
97void get_spd_temp_raw_data(int dimm_index, uint8_t *data);
98
99#endif
uint8_t data[]
Definition: isl69259.c:2
uint8_t sensor_num
Definition: storage_handler.h:6
Definition: hal_i3c.h:105
Definition: plat_dimm.h:71
bool is_present
Definition: plat_dimm.h:72
uint8_t pmic_pwr_data[MAX_LEN_I3C_GET_PMIC_PWR]
Definition: plat_dimm.h:74
uint8_t pmic_error_data[MAX_LEN_I3C_GET_PMIC_ERR]
Definition: plat_dimm.h:73
uint8_t spd_temp_data[MAX_LEN_I3C_GET_SPD_TEMP]
Definition: plat_dimm.h:75
bool is_dimm_present(uint8_t dimm_id)
Definition: plat_dimm.c:297
struct dimm_info dimm_info
struct k_mutex i3c_dimm_mux_mutex
Definition: plat_dimm.c:39
void get_pmic_power_raw_data(int dimm_index, uint8_t *data)
Definition: plat_dimm.c:349
void start_get_dimm_info_thread()
Definition: plat_dimm.c:50
int all_brocast_ccc(I3C_MSG *i3c_msg)
Definition: plat_dimm.c:307
DIMM_DEVICE_TYPE
Definition: plat_dimm.h:65
@ DIMM_PMIC
Definition: plat_dimm.h:68
@ DIMM_SPD
Definition: plat_dimm.h:66
@ DIMM_SPD_NVM
Definition: plat_dimm.h:67
I3C_PMIC_ADDR
Definition: plat_dimm.h:53
@ PMIC_A3_A7_ADDR
Definition: plat_dimm.h:56
@ PMIC_A0_A4_ADDR
Definition: plat_dimm.h:54
@ PMIC_A2_A6_ADDR
Definition: plat_dimm.h:55
#define MAX_LEN_I3C_GET_PMIC_PWR
Definition: plat_dimm.h:38
bool is_i3c_mux_to_bic()
Definition: plat_dimm.c:273
uint8_t sensor_num_map_dimm_id(uint8_t sensor_num)
Definition: plat_dimm.c:365
void clear_unaccessible_dimm_data(uint8_t dimm_id)
Definition: plat_dimm.c:444
void init_i3c_dimm()
Definition: plat_dimm.c:94
void get_dimm_info_handler()
Definition: plat_dimm.c:114
I3C_DIMM_SPD_ADDR
Definition: plat_dimm.h:59
@ DIMM_SPD_A2_A6_ADDR
Definition: plat_dimm.h:61
@ DIMM_SPD_A0_A4_ADDR
Definition: plat_dimm.h:60
@ DIMM_SPD_A3_A7_ADDR
Definition: plat_dimm.h:62
void get_spd_temp_raw_data(int dimm_index, uint8_t *data)
Definition: plat_dimm.c:357
uint8_t pmic_i3c_addr_list[MAX_COUNT_DIMM/2]
Definition: plat_dimm.c:41
dimm_info dimm_data[MAX_COUNT_DIMM]
Definition: plat_dimm.c:46
DIMM_ID
Definition: plat_dimm.h:43
@ DIMM_ID_A2
Definition: plat_dimm.h:45
@ DIMM_ID_A7
Definition: plat_dimm.h:49
@ DIMM_ID_UNKNOWN
Definition: plat_dimm.h:50
@ DIMM_ID_A6
Definition: plat_dimm.h:48
@ DIMM_ID_A0
Definition: plat_dimm.h:44
@ DIMM_ID_A3
Definition: plat_dimm.h:46
@ DIMM_ID_A4
Definition: plat_dimm.h:47
#define MAX_COUNT_DIMM
Definition: plat_dimm.h:24
#define MAX_LEN_I3C_GET_SPD_TEMP
Definition: plat_dimm.h:39
bool is_dimm_init()
Definition: plat_dimm.c:302
#define MAX_LEN_I3C_GET_PMIC_ERR
Definition: plat_dimm.h:37
uint8_t spd_i3c_addr_list[MAX_COUNT_DIMM/2]
Definition: plat_dimm.c:43
int get_pmic_error_raw_data(int dimm_index, uint8_t *data)
Definition: plat_dimm.c:326
void init_i3c_dimm_data()
Definition: plat_dimm.c:61
int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position)
Definition: plat_dimm.c:248