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 "plat_i3c.h"
21
22#define DIMM_SPD_A_G_ADDR (0xA0 >> 1)
23#define DIMM_SPD_B_H_ADDR (0xA2 >> 1)
24#define DIMM_SPD_C_I_ADDR (0xA4 >> 1)
25#define DIMM_SPD_D_J_ADDR (0xA6 >> 1)
26#define DIMM_SPD_E_K_ADDR (0xA8 >> 1)
27#define DIMM_SPD_F_L_ADDR (0xAA >> 1)
28
29#define DIMM_PMIC_A_G_ADDR 0x48
30#define DIMM_PMIC_B_H_ADDR 0x49
31#define DIMM_PMIC_C_I_ADDR 0x4A
32#define DIMM_PMIC_D_J_ADDR 0x4B
33#define DIMM_PMIC_E_K_ADDR 0x4C
34#define DIMM_PMIC_F_L_ADDR 0x4D
35
36#define CPLD_ADDR 0x21
37
38#define MAX_LEN_I3C_GET_PMIC_ERR 47
39#define MAX_LEN_I3C_GET_PMIC_PWR 1
40#define MAX_LEN_I3C_GET_SPD_TEMP 2
41
42#define DIMM_I3C_MUX_CONTROL_OFFSET 0x0C
43#define I3C_MUX_BIC_TO_DIMMA_TO_F 0x02
44#define I3C_MUX_BIC_TO_DIMMG_TO_L 0x03
45#define I3C_MUX_CPU_TO_DIMM 0x00
46
47#define DIMM_I3C_MUX_STATUS_OFFSET 0x0D
48#define I3C_MUX_STATUS_ENABLE_FUNCTION_CHECK 7
49#define I3C_MUX_STATUS_PD_SPD_1_REMOTE_EN 6
50#define I3C_MUX_STATUS_PD_SPD_2_REMOTE_EN 5
51#define I3C_MUX_STATUS_SPD_MASK 0x60
52
53#define I3C_DIMM_MUTEX_TIMEOUT_MS 1000
54#define GET_DIMM_INFO_TIME_MS 1000
55#define GET_DIMM_INFO_STACK_SIZE 2304
56
57typedef struct dimm_info {
58 uint8_t is_present;
63
77};
78
92};
93
94enum DIMM_ID {
109};
110
114};
115
117 DIMM_SPD = 0x00,
119 DIMM_PMIC = 0x02,
120};
121extern struct k_mutex i3c_dimm_mutex;
122extern uint8_t spd_i3c_addr_list[];
123extern uint8_t pmic_i3c_addr_list[];
124
127uint8_t sensor_num_map_dimm_id(uint8_t sensor_num);
128int pal_get_spd_temp(uint8_t sensor_num, uint8_t *data);
129int pal_get_pmic_pwr(uint8_t sensor_num, uint8_t *data);
130void clear_unaccessible_dimm_data(uint8_t dimm_id);
131int switch_i3c_dimm_mux(uint8_t i3c_ctrl_mux_data);
132int check_i3c_dimm_mux(uint8_t *status_data);
133int all_brocast_ccc(I3C_MSG *i3c_msg);
135uint8_t get_dimm_present(uint8_t dimm_id);
136
137#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
uint8_t pmic_pwr_data[MAX_LEN_I3C_GET_PMIC_PWR]
Definition: plat_dimm.h:74
bool is_ready_monitor
Definition: plat_dimm.h:81
uint8_t is_present
Definition: plat_dimm.h:58
uint8_t spd_temp_data[MAX_LEN_I3C_GET_SPD_TEMP]
Definition: plat_dimm.h:75
struct dimm_info dimm_info
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
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 get_dimm_info_handler()
Definition: plat_dimm.c:114
uint8_t pmic_i3c_addr_list[MAX_COUNT_DIMM/2]
Definition: plat_dimm.c:41
DIMM_ID
Definition: plat_dimm.h:43
@ DIMM_ID_UNKNOWN
Definition: plat_dimm.h:50
uint8_t spd_i3c_addr_list[MAX_COUNT_DIMM/2]
Definition: plat_dimm.c:43
int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position)
Definition: plat_dimm.c:248
struct k_mutex i3c_dimm_mutex
Definition: plat_dimm.c:29
uint8_t get_dimm_present(uint8_t dimm_id)
Definition: plat_dimm.c:493
#define MAX_LEN_I3C_GET_PMIC_PWR
Definition: plat_dimm.h:39
int pal_get_pmic_pwr(uint8_t sensor_num, uint8_t *data)
Definition: i3c_dimm.c:26
int pal_get_spd_temp(uint8_t sensor_num, uint8_t *data)
Definition: i3c_dimm.c:31
NUMBER_DIMM_TEMP
Definition: plat_dimm.h:64
@ NUM_DIMM_D_TEMP
Definition: plat_dimm.h:68
@ NUM_DIMM_A_TEMP
Definition: plat_dimm.h:65
@ NUM_DIMM_G_TEMP
Definition: plat_dimm.h:71
@ NUM_DIMM_I_TEMP
Definition: plat_dimm.h:73
@ NUM_DIMM_C_TEMP
Definition: plat_dimm.h:67
@ NUM_DIMM_B_TEMP
Definition: plat_dimm.h:66
@ NUM_DIMM_E_TEMP
Definition: plat_dimm.h:69
@ NUM_DIMM_H_TEMP
Definition: plat_dimm.h:72
@ NUM_DIMM_F_TEMP
Definition: plat_dimm.h:70
@ NUM_DIMM_J_TEMP
Definition: plat_dimm.h:74
@ NUM_DIMM_K_TEMP
Definition: plat_dimm.h:75
@ NUM_DIMM_L_TEMP
Definition: plat_dimm.h:76
int check_i3c_dimm_mux(uint8_t *status_data)
Definition: plat_dimm.c:386
int init_dimm_prsnt_status()
Definition: plat_dimm.c:428
@ DIMM_ID_H
Definition: plat_dimm.h:102
@ DIMM_ID_C
Definition: plat_dimm.h:97
@ DIMM_ID_E
Definition: plat_dimm.h:99
@ DIMM_ID_K
Definition: plat_dimm.h:105
@ DIMM_ID_J
Definition: plat_dimm.h:104
@ DIMM_ID_A
Definition: plat_dimm.h:95
@ DIMM_ID_B
Definition: plat_dimm.h:96
@ DIMM_ID_D
Definition: plat_dimm.h:98
@ DIMM_ID_L
Definition: plat_dimm.h:106
@ DIMM_ID_G
Definition: plat_dimm.h:101
@ DIMM_ID_F
Definition: plat_dimm.h:100
@ DIMM_ID_MAX
Definition: plat_dimm.h:107
@ DIMM_ID_I
Definition: plat_dimm.h:103
#define MAX_LEN_I3C_GET_SPD_TEMP
Definition: plat_dimm.h:40
DIMM_PRSNT_STATUS
Definition: plat_dimm.h:111
@ DIMM_PRSNT
Definition: plat_dimm.h:112
@ DIMM_NOT_PRSNT
Definition: plat_dimm.h:113
NUMBER_DIMM_PMIC_PWR
Definition: plat_dimm.h:79
@ NUM_DIMM_E_PMIC_PWR
Definition: plat_dimm.h:84
@ NUM_DIMM_G_PMIC_PWR
Definition: plat_dimm.h:86
@ NUM_DIMM_F_PMIC_PWR
Definition: plat_dimm.h:85
@ NUM_DIMM_C_PMIC_PWR
Definition: plat_dimm.h:82
@ NUM_DIMM_J_PMIC_PWR
Definition: plat_dimm.h:89
@ NUM_DIMM_B_PMIC_PWR
Definition: plat_dimm.h:81
@ NUM_DIMM_I_PMIC_PWR
Definition: plat_dimm.h:88
@ NUM_DIMM_K_PMIC_PWR
Definition: plat_dimm.h:90
@ NUM_DIMM_H_PMIC_PWR
Definition: plat_dimm.h:87
@ NUM_DIMM_L_PMIC_PWR
Definition: plat_dimm.h:91
@ NUM_DIMM_D_PMIC_PWR
Definition: plat_dimm.h:83
@ NUM_DIMM_A_PMIC_PWR
Definition: plat_dimm.h:80