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 8
25#define DIMM_INDEX_BYTE 5
26#define DIMM_STATUS_BYTE 7
27#define DIMM_INDEX_MIN 0
28#define DIMM_INDEX_MAX 7
29#define DIMM_PRESENT 0x1
30
31#define DIMM_I3C_MUX_CONTROL_OFFSET 0x0B
32
33#define GET_DIMM_INFO_TIME_MS 1000
34#define GET_DIMM_INFO_STACK_SIZE 2304
35
36#define I3C_MUX_TO_CPU 0x0
37#define I3C_MUX_TO_BIC 0x1
38#define I3C_DIMM_MUTEX_TIMEOUT_MS 1000
39
40#define I3C_HUB_TO_DIMMABCD 0x7F
41#define I3C_HUB_TO_DIMMEFGH 0xBF
42
43#define MAX_LEN_I3C_GET_PMIC_ERR 47
44#define MAX_LEN_I3C_GET_PMIC_PWR 1
45#define MAX_LEN_I3C_GET_SPD_TEMP 2
46
47enum DIMM_ID {
57};
58
64};
65
71};
72
74 DIMM_SPD = 0x00,
76 DIMM_PMIC = 0x02,
77};
78
79typedef struct dimm_info {
80 bool is_present;
86
87extern struct k_mutex i3c_dimm_mutex;
88extern uint8_t pmic_i3c_addr_list[MAX_COUNT_DIMM / 2];
89extern uint8_t spd_i3c_addr_list[MAX_COUNT_DIMM / 2];
90
92
96bool is_dimm_ready_monitor(uint8_t dimm_id);
98bool get_dimm_presence_status(uint8_t dimm_id);
99void set_dimm_presence_status(uint8_t index, uint8_t status);
100uint8_t sensor_num_map_dimm_id(uint8_t sensor_num);
101int switch_i3c_dimm_mux(uint8_t i3c_mux_position);
102int all_brocast_ccc(I3C_MSG *i3c_msg);
103int get_pmic_error_raw_data(int dimm_index, uint8_t *data);
104void get_pmic_power_raw_data(int dimm_index, uint8_t *data);
105void get_spd_temp_raw_data(int dimm_index, uint8_t *data);
106void clear_unaccessible_dimm_data(uint8_t dimm_id);
107
108#endif
uint8_t data[]
Definition: isl69259.c:2
uint8_t status
Definition: mctp_ctrl.h:1
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
bool is_ready_monitor
Definition: plat_dimm.h:81
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
struct dimm_info dimm_info
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
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
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
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
int switch_i3c_dimm_mux(uint8_t i3c_mux_position, uint8_t dimm_mux_position)
Definition: plat_dimm.c:248
@ PMIC_A1_A5_ADDR
Definition: plat_dimm.h:61
#define MAX_LEN_I3C_GET_PMIC_PWR
Definition: plat_dimm.h:44
void set_dimm_presence_status(uint8_t index, uint8_t status)
Definition: plat_dimm.c:284
struct k_mutex i3c_dimm_mutex
Definition: plat_dimm.c:29
bool is_dimm_ready_monitor(uint8_t dimm_id)
Definition: plat_dimm.c:56
bool is_dimm_prsnt_inited()
Definition: plat_dimm.c:51
@ DIMM_SPD_A1_A5_ADDR
Definition: plat_dimm.h:68
bool get_dimm_presence_status(uint8_t dimm_id)
Definition: plat_dimm.c:279
@ DIMM_ID_A1
Definition: plat_dimm.h:49
@ DIMM_ID_A5
Definition: plat_dimm.h:53
#define MAX_COUNT_DIMM
Definition: plat_dimm.h:24
void init_i3c_dimm_prsnt_status()
Definition: plat_dimm.c:245
#define MAX_LEN_I3C_GET_SPD_TEMP
Definition: plat_dimm.h:45
#define MAX_LEN_I3C_GET_PMIC_ERR
Definition: plat_dimm.h:43