OpenBIC
OpenSource Bridge-IC
plat_class.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_CLASS_H
18#define PLAT_CLASS_H
19
20#include "hal_i2c.h"
21
22#define CPLD_BUS I2C_BUS10
23#define CPLD_ADDR (0xA0 >> 1)
24#define CPLD_SSD_POWER_FAULT_REG 0x0F
25#define CPLD_SSD_POWER_GOOD_TIMEOUT 0x10
26
27#define SSD_COUNT 4
28#define E1S_PRESENT 0x00
29#define E1S_NOT_PRESENT 0x01
30#define E1S_0_1_PRESENT 0x03
31#define E1S_0_PRESENT 0x07
32#define NIC_PRESENT 0x09
33#define E1S_1_PRESENT 0x0B
34#define CXL_PRESENT 0x0E
35#define NO_DEVICE_PRESENT 0x0F
36
37#define PCIE_CARD_POWER_GOOD_BIT BIT(0)
38
47};
48
65};
66
77};
78
83};
84
94};
95
97 uint8_t cpld_offset;
99 uint8_t value_bit;
102};
103
105
107uint8_t prsnt_status_to_card_type(uint8_t presence_status);
108int get_pcie_card_type(uint8_t card_id, uint8_t *card_type);
109int get_pcie_device_type(uint8_t card_id, uint8_t device_id, uint8_t *device_type);
110int pcie_card_id_to_cxl_id(uint8_t pcie_card_id, uint8_t *cxl_id);
111int cxl_id_to_pcie_card_id(uint8_t cxl_id, uint8_t *pcie_card_id);
112bool is_cxl_present();
113uint8_t get_board_revision();
114int get_pcie_card_power_status(uint8_t pcie_card_id);
118
119#endif
uint8_t get_board_revision()
Definition: plat_class.c:431
void init_accl_presence_check_work()
Definition: plat_class.c:558
int init_platform_config()
Definition: expansion_board.c:43
PCIE_DEVICE_ID
Definition: plat_class.h:132
@ PCIE_DEVICE_ID2
Definition: plat_class.h:134
@ PCIE_DEVICE_ID3
Definition: plat_class.h:135
@ PCIE_DEVICE_ID1
Definition: plat_class.h:133
PCIE_CARD_TYPE
Definition: plat_class.h:85
@ CXL_CARD
Definition: plat_class.h:91
@ E1S_CARD
Definition: plat_class.h:86
@ NIC_CARD
Definition: plat_class.h:90
@ UNKNOWN_CARD
Definition: plat_class.h:93
@ E1S_0_CARD
Definition: plat_class.h:87
@ CARD_NOT_PRESENT
Definition: plat_class.h:92
@ E1S_0_1_CARD
Definition: plat_class.h:89
@ E1S_1_CARD
Definition: plat_class.h:88
void set_reset_smb4_mux_pin()
Definition: plat_class.c:415
int get_pcie_card_type(uint8_t card_id, uint8_t *card_type)
Definition: plat_class.c:277
uint8_t prsnt_status_to_card_type(uint8_t presence_status)
Definition: plat_class.c:245
CXL_CARD_ID
Definition: plat_class.h:67
@ CXL_CARD_5
Definition: plat_class.h:72
@ CXL_CARD_7
Definition: plat_class.h:74
@ CXL_CARD_2
Definition: plat_class.h:69
@ CXL_CARD_1
Definition: plat_class.h:68
@ CXL_CARD_8
Definition: plat_class.h:75
@ CXL_CARD_4
Definition: plat_class.h:71
@ CXL_CARD_MAX
Definition: plat_class.h:76
@ CXL_CARD_6
Definition: plat_class.h:73
@ CXL_CARD_3
Definition: plat_class.h:70
BOARD_REVERSION
Definition: plat_class.h:39
@ REV_EVT1
Definition: plat_class.h:40
@ REV_PVT
Definition: plat_class.h:43
@ REV_UNKNOWN
Definition: plat_class.h:46
@ REV_DVT
Definition: plat_class.h:42
@ REV_MP
Definition: plat_class.h:44
@ REV_PRE_DVT
Definition: plat_class.h:45
@ REV_EVT2
Definition: plat_class.h:41
struct PCIE_CARD_INFO pcie_card_info[CARD_INDEX_MAX]
Definition: plat_class.c:42
int pcie_card_id_to_cxl_id(uint8_t pcie_card_id, uint8_t *cxl_id)
Definition: plat_class.c:115
int get_pcie_card_power_status(uint8_t pcie_card_id)
Definition: plat_class.c:376
int cxl_id_to_pcie_card_id(uint8_t cxl_id, uint8_t *pcie_card_id)
Definition: plat_class.c:152
void check_pcie_card_type()
Definition: plat_class.c:230
int get_pcie_device_type(uint8_t card_id, uint8_t device_id, uint8_t *device_type)
Definition: plat_class.c:290
bool is_cxl_present()
Definition: plat_class.c:351
CARD_INFO_INDEX
Definition: plat_class.h:49
@ CARD_10_INDEX
Definition: plat_class.h:59
@ CARD_13_INDEX
Definition: plat_class.h:62
@ CARD_8_INDEX
Definition: plat_class.h:57
@ CARD_12_INDEX
Definition: plat_class.h:61
@ CARD_14_INDEX
Definition: plat_class.h:63
@ CARD_5_INDEX
Definition: plat_class.h:54
@ CARD_6_INDEX
Definition: plat_class.h:55
@ CARD_4_INDEX
Definition: plat_class.h:53
@ CARD_11_INDEX
Definition: plat_class.h:60
@ CARD_2_INDEX
Definition: plat_class.h:51
@ CARD_3_INDEX
Definition: plat_class.h:52
@ CARD_1_INDEX
Definition: plat_class.h:50
@ CARD_INDEX_MAX
Definition: plat_class.h:64
@ CARD_9_INDEX
Definition: plat_class.h:58
@ CARD_7_INDEX
Definition: plat_class.h:56
device_id
Definition: power_shell.h:28
Definition: plat_class.h:96
uint8_t card_device_type
Definition: plat_class.h:101
uint8_t cpld_offset
Definition: plat_class.h:97
uint8_t value_bit
Definition: plat_class.h:99
uint8_t power_status_offset
Definition: plat_class.h:98
uint8_t value_shift_bit
Definition: plat_class.h:100