OpenBIC
OpenSource Bridge-IC
plat_power_seq.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_PWRSEQ_H
18#define PLAT_PWRSEQ_H
19
20#include "hal_gpio.h"
21#include "plat_gpio.h"
22
23#define MAX_E1S_IDX 5
24#define OPA_MAX_E1S_IDX 3
25#define ALL_E1S 0xFF
26#define POWER_SEQ_CTRL_STACK_SIZE 1000
27#define CHKPWR_DELAY_MSEC 100
28#define RETIMER_DELAY_MSEC 2000
29#define DEV_RESET_DELAY_USEC 100
30
36};
37
48};
49
61};
62
66 CHECK_POWER_SEQ_03 = OPA_PWRGD_P1V8_VR,
67 CHECK_POWER_SEQ_04 = OPA_PWRGD_P0V9_VR,
68 CHECK_POWER_SEQ_05 = OPA_PWRGD_EXP_PWR,
69 CHECK_POWER_SEQ_06 = OPA_CLKBUF_RTM_OE_N,
70 CHECK_POWER_SEQ_07 = OPA_RESET_BIC_RTM_N,
71 CHECK_POWER_SEQ_08 = OPA_PERST_BIC_RTM_N,
72};
73
74typedef enum {
78
80 uint8_t present;
85 uint8_t clkbuf_oe_en;
89
92
93bool get_e1s_present(uint8_t index);
94bool get_e1s_power_good(uint8_t index);
96uint8_t get_e1s_pcie_reset_status(uint8_t index);
98void set_sequence_status(uint8_t index, bool status);
99bool is_all_sequence_done(uint8_t status);
100bool is_retimer_done(void);
101void abort_e1s_power_thread(uint8_t index);
102void e1s_power_on_thread(uint8_t index, uint8_t initial_stage);
103void e1s_power_off_thread(uint8_t index);
104void control_power_on_sequence(void *initial_stage, void *arvg0, void *arvg1);
106void control_power_stage(uint8_t control_mode, uint8_t control_seq);
107int check_power_stage(uint8_t check_mode, uint8_t check_seq);
108bool e1s_power_on_handler(uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio,
109 uint8_t device_index);
110bool e1s_power_off_handler(uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio,
111 uint8_t device_index);
112bool power_on_handler(uint8_t initial_stage);
113bool power_off_handler(uint8_t initial_stage);
114bool notify_cpld_e1s_present(uint8_t index, uint8_t present);
117
118#endif
uint8_t status
Definition: mctp_ctrl.h:1
#define PWRGD_P12V_MAIN
Definition: plat_gpio.h:474
#define FM_EXP_MAIN_PWR_EN
Definition: plat_gpio.h:473
void control_power_on_sequence(void *initial_stage, void *arvg0, void *arvg1)
Definition: plat_power_seq.c:1139
void control_power_stage(uint8_t control_mode, uint8_t control_seq)
Definition: plat_power_seq.c:292
void control_power_off_sequence()
Definition: plat_power_seq.c:1153
void e1s_power_off_thread(uint8_t index)
Definition: plat_power_seq.c:729
bool power_on_handler(uint8_t initial_stage)
Definition: plat_power_seq.c:817
void set_sequence_status(uint8_t index, bool status)
POWER_OFF_STAGE
Definition: plat_power_seq.h:50
@ RETIMER_POWER_OFF_STAGE0
Definition: plat_power_seq.h:55
@ E1S_POWER_OFF_STAGE3
Definition: plat_power_seq.h:54
@ E1S_POWER_OFF_STAGE2
Definition: plat_power_seq.h:53
@ BOARD_POWER_OFF_STAGE0
Definition: plat_power_seq.h:58
@ RETIMER_POWER_OFF_STAGE2
Definition: plat_power_seq.h:57
@ BOARD_POWER_OFF_STAGE1
Definition: plat_power_seq.h:59
@ RETIMER_POWER_OFF_STAGE1
Definition: plat_power_seq.h:56
@ E1S_POWER_OFF_STAGE1
Definition: plat_power_seq.h:52
@ E1S_POWER_OFF_STAGE0
Definition: plat_power_seq.h:51
@ BOARD_POWER_OFF_STAGE2
Definition: plat_power_seq.h:60
void init_sequence_status()
Definition: plat_power_seq.c:201
struct _e1s_power_control_gpio e1s_power_control_gpio
void e1s_power_on_thread(uint8_t index, uint8_t initial_stage)
Definition: plat_power_seq.c:700
bool notify_cpld_e1s_present(uint8_t index, uint8_t present)
Definition: plat_power_seq.c:343
bool e1s_power_off_handler(uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio, uint8_t device_index)
Definition: plat_power_seq.c:544
void abort_cpu_perst_low_thread()
Definition: plat_power_seq.c:791
e1s_power_control_gpio opa_e1s_power_control_gpio[]
Definition: plat_power_seq.c:47
bool is_retimer_done(void)
Definition: plat_power_seq.c:287
bool get_edge_power_good()
Definition: plat_power_seq.c:162
uint8_t get_e1s_pcie_reset_status(uint8_t index)
Definition: plat_power_seq.c:182
CONTROL_POWER_MODE
Definition: plat_power_seq.h:31
@ DISABLE_POWER_MODE
Definition: plat_power_seq.h:34
@ HIGH_DISABLE_POWER_MODE
Definition: plat_power_seq.h:35
@ ENABLE_POWER_MODE
Definition: plat_power_seq.h:32
@ LOW_ENABLE_POWER_MODE
Definition: plat_power_seq.h:33
bool e1s_power_on_handler(uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio, uint8_t device_index)
Definition: plat_power_seq.c:427
bool power_off_handler(uint8_t initial_stage)
Definition: plat_power_seq.c:983
e1s_power_control_gpio opb_e1s_power_control_gpio[]
Definition: plat_power_seq.c:74
POWER_ON_STAGE
Definition: plat_power_seq.h:38
@ RETIMER_POWER_ON_STAGE0
Definition: plat_power_seq.h:42
@ E1S_POWER_ON_STAGE2
Definition: plat_power_seq.h:46
@ BOARD_POWER_ON_STAGE1
Definition: plat_power_seq.h:40
@ E1S_POWER_ON_STAGE1
Definition: plat_power_seq.h:45
@ BOARD_POWER_ON_STAGE2
Definition: plat_power_seq.h:41
@ E1S_POWER_ON_STAGE3
Definition: plat_power_seq.h:47
@ E1S_POWER_ON_STAGE0
Definition: plat_power_seq.h:44
@ RETIMER_POWER_ON_STAGE1
Definition: plat_power_seq.h:43
@ BOARD_POWER_ON_STAGE0
Definition: plat_power_seq.h:39
bool is_all_sequence_done(uint8_t status)
Definition: plat_power_seq.c:244
bool get_e1s_power_good(uint8_t index)
Definition: plat_power_seq.c:140
E1S_POWER_ON_STATUS
Definition: plat_power_seq.h:74
@ E1S_PERST_SUCCESS
Definition: plat_power_seq.h:76
@ E1S_POWER_SUCCESS
Definition: plat_power_seq.h:75
void cpu_perst_low_thread()
Definition: plat_power_seq.c:799
void abort_e1s_power_thread(uint8_t index)
Definition: plat_power_seq.c:692
CHECK_POWER_SEQ_NUM_MAPPING
Definition: plat_power_seq.h:63
@ CHECK_POWER_SEQ_03
Definition: plat_power_seq.h:66
@ CHECK_POWER_SEQ_01
Definition: plat_power_seq.h:64
@ CHECK_POWER_SEQ_06
Definition: plat_power_seq.h:69
@ CHECK_POWER_SEQ_05
Definition: plat_power_seq.h:68
@ CHECK_POWER_SEQ_07
Definition: plat_power_seq.h:70
@ CHECK_POWER_SEQ_02
Definition: plat_power_seq.h:65
@ CHECK_POWER_SEQ_08
Definition: plat_power_seq.h:71
@ CHECK_POWER_SEQ_04
Definition: plat_power_seq.h:67
bool get_e1s_present(uint8_t index)
Definition: plat_power_seq.c:117
int check_power_stage(uint8_t check_mode, uint8_t check_seq)
Definition: plat_power_seq.c:313
Definition: plat_power_seq.h:79
uint8_t p12v_efuse_enable
Definition: plat_power_seq.h:81
uint8_t present
Definition: plat_power_seq.h:80
uint8_t cpu_pcie_reset
Definition: plat_power_seq.h:86
uint8_t clkbuf_oe_en
Definition: plat_power_seq.h:85
uint8_t p3v3_efuse_power_good
Definition: plat_power_seq.h:84
uint8_t p12v_efuse_power_good
Definition: plat_power_seq.h:82
uint8_t p3v3_efuse_enable
Definition: plat_power_seq.h:83
uint8_t e1s_pcie_reset
Definition: plat_power_seq.h:87