OpenBIC
OpenSource Bridge-IC
plat_power_seq.c File Reference
#include <zephyr.h>
#include <stdio.h>
#include <stdlib.h>
#include "ipmi.h"
#include "ipmb.h"
#include "libipmi.h"
#include "libutil.h"
#include "util_worker.h"
#include "power_status.h"
#include "plat_gpio.h"
#include "plat_isr.h"
#include "plat_sensor_table.h"
#include "plat_power_seq.h"
#include <logging/log.h>
Include dependency graph for plat_power_seq.c:

Functions

 LOG_MODULE_REGISTER (power_sequence)
 
 K_THREAD_STACK_EXTERN (e1s_power_thread)
 
 K_THREAD_STACK_ARRAY_DEFINE (e1s_power_threads, MAX_E1S_IDX, POWER_SEQ_CTRL_STACK_SIZE)
 
 K_THREAD_STACK_DEFINE (cpu_pcie_reset_thread, POWER_SEQ_CTRL_STACK_SIZE)
 
 K_MUTEX_DEFINE (cpld_e1s_prsnt_reg_mutex)
 
bool get_e1s_present (uint8_t index)
 
bool get_e1s_power_good (uint8_t index)
 
bool get_edge_power_good ()
 
uint8_t get_e1s_pcie_reset_status (uint8_t index)
 
void init_sequence_status ()
 
bool is_all_sequence_done (uint8_t status)
 
bool is_retimer_done (void)
 
void control_power_stage (uint8_t control_mode, uint8_t control_seq)
 
int check_power_stage (uint8_t check_mode, uint8_t check_seq)
 
bool notify_cpld_e1s_present (uint8_t index, uint8_t present)
 
bool e1s_power_on_handler (uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio, uint8_t device_index)
 
bool e1s_power_off_handler (uint8_t initial_stage, e1s_power_control_gpio *e1s_gpio, uint8_t device_index)
 
void control_e1s_power_on_sequence (void *pvParameters, void *initial_stage, void *arvg1)
 
void control_e1s_power_off_sequence (void *pvParameters, void *arvg0, void *arvg1)
 
void abort_e1s_power_thread (uint8_t index)
 
void e1s_power_on_thread (uint8_t index, uint8_t initial_stage)
 
void e1s_power_off_thread (uint8_t index)
 
void control_cpu_perst_low (void *arvg0, void *arvg1, void *arvg2)
 
void abort_cpu_perst_low_thread ()
 
void cpu_perst_low_thread ()
 
bool power_on_handler (uint8_t initial_stage)
 
bool power_off_handler (uint8_t initial_stage)
 
void control_power_on_sequence (void *initial_stage, void *arvg0, void *arvg1)
 
void control_power_off_sequence ()
 

Variables

struct k_thread e1s_power_thread_handler [MAX_E1S_IDX]
 
k_tid_t e1s_power_tid [MAX_E1S_IDX]
 
struct k_thread cpu_pcie_reset_thread_handler
 
k_tid_t cpu_pcie_reset_tid
 
e1s_power_control_gpio opa_e1s_power_control_gpio []
 
e1s_power_control_gpio opb_e1s_power_control_gpio []
 

Function Documentation

◆ abort_cpu_perst_low_thread()

void abort_cpu_perst_low_thread ( )

◆ abort_e1s_power_thread()

void abort_e1s_power_thread ( uint8_t  index)

◆ check_power_stage()

int check_power_stage ( uint8_t  check_mode,
uint8_t  check_seq 
)
Here is the call graph for this function:

◆ control_cpu_perst_low()

void control_cpu_perst_low ( void *  arvg0,
void *  arvg1,
void *  arvg2 
)

◆ control_e1s_power_off_sequence()

void control_e1s_power_off_sequence ( void *  pvParameters,
void *  arvg0,
void *  arvg1 
)

◆ control_e1s_power_on_sequence()

void control_e1s_power_on_sequence ( void *  pvParameters,
void *  initial_stage,
void *  arvg1 
)

◆ control_power_off_sequence()

void control_power_off_sequence ( )
Here is the call graph for this function:

◆ control_power_on_sequence()

void control_power_on_sequence ( void *  initial_stage,
void *  arvg0,
void *  arvg1 
)
Here is the call graph for this function:

◆ control_power_stage()

void control_power_stage ( uint8_t  control_mode,
uint8_t  control_seq 
)
Here is the call graph for this function:

◆ cpu_perst_low_thread()

void cpu_perst_low_thread ( )
Here is the call graph for this function:

◆ e1s_power_off_handler()

bool e1s_power_off_handler ( uint8_t  initial_stage,
e1s_power_control_gpio e1s_gpio,
uint8_t  device_index 
)

◆ e1s_power_off_thread()

void e1s_power_off_thread ( uint8_t  index)
Here is the call graph for this function:

◆ e1s_power_on_handler()

bool e1s_power_on_handler ( uint8_t  initial_stage,
e1s_power_control_gpio e1s_gpio,
uint8_t  device_index 
)

◆ e1s_power_on_thread()

void e1s_power_on_thread ( uint8_t  index,
uint8_t  initial_stage 
)
Here is the call graph for this function:

◆ get_e1s_pcie_reset_status()

uint8_t get_e1s_pcie_reset_status ( uint8_t  index)

◆ get_e1s_power_good()

bool get_e1s_power_good ( uint8_t  index)

◆ get_e1s_present()

bool get_e1s_present ( uint8_t  index)

◆ get_edge_power_good()

bool get_edge_power_good ( )

◆ init_sequence_status()

void init_sequence_status ( )

◆ is_all_sequence_done()

bool is_all_sequence_done ( uint8_t  status)

◆ is_retimer_done()

bool is_retimer_done ( void  )

◆ K_MUTEX_DEFINE()

K_MUTEX_DEFINE ( cpld_e1s_prsnt_reg_mutex  )

◆ K_THREAD_STACK_ARRAY_DEFINE()

K_THREAD_STACK_ARRAY_DEFINE ( e1s_power_threads  ,
MAX_E1S_IDX  ,
POWER_SEQ_CTRL_STACK_SIZE   
)

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( cpu_pcie_reset_thread  ,
POWER_SEQ_CTRL_STACK_SIZE   
)

◆ K_THREAD_STACK_EXTERN()

K_THREAD_STACK_EXTERN ( e1s_power_thread  )

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( power_sequence  )

◆ notify_cpld_e1s_present()

bool notify_cpld_e1s_present ( uint8_t  index,
uint8_t  present 
)

◆ power_off_handler()

static bool power_off_handler ( uint8_t  initial_stage)
Here is the call graph for this function:

◆ power_on_handler()

static bool power_on_handler ( uint8_t  initial_stage)
Here is the call graph for this function:

Variable Documentation

◆ cpu_pcie_reset_thread_handler

struct k_thread cpu_pcie_reset_thread_handler

◆ cpu_pcie_reset_tid

k_tid_t cpu_pcie_reset_tid

◆ e1s_power_thread_handler

struct k_thread e1s_power_thread_handler[MAX_E1S_IDX]

◆ e1s_power_tid

k_tid_t e1s_power_tid[MAX_E1S_IDX]

◆ opa_e1s_power_control_gpio

e1s_power_control_gpio opa_e1s_power_control_gpio[]
Initial value:
= {
[0] = { .present = OPA_E1S_0_PRSNT_N,
.p12v_efuse_enable = OPA_E1S_0_P12V_POWER_EN,
.p12v_efuse_power_good = OPA_PWRGD_P12V_E1S_0_R,
.p3v3_efuse_enable = OPA_E1S_0_P3V3_POWER_EN,
.p3v3_efuse_power_good = OPA_PWRGD_P3V3_E1S_0_R,
.clkbuf_oe_en = OPA_CLKBUF_E1S_0_OE_N,
.cpu_pcie_reset = OPA_RST_PCIE_EXP_PERST0_N,
.e1s_pcie_reset = OPA_PERST_E1S_0_N },
[1] = { .present = OPA_E1S_1_PRSNT_N,
.p12v_efuse_enable = OPA_E1S_1_P12V_POWER_EN,
.p12v_efuse_power_good = OPA_PWRGD_P12V_E1S_1_R,
.p3v3_efuse_enable = OPA_E1S_1_P3V3_POWER_EN,
.p3v3_efuse_power_good = OPA_PWRGD_P3V3_E1S_1_R,
.clkbuf_oe_en = OPA_CLKBUF_E1S_1_OE_N,
.cpu_pcie_reset = OPA_RST_PCIE_EXP_PERST0_N,
.e1s_pcie_reset = OPA_PERST_E1S_1_N },
[2] = { .present = OPA_E1S_2_PRSNT_N,
.p12v_efuse_enable = OPA_E1S_2_P12V_POWER_EN,
.p12v_efuse_power_good = OPA_PWRGD_P12V_E1S_2_R,
.p3v3_efuse_enable = OPA_E1S_2_P3V3_POWER_EN,
.p3v3_efuse_power_good = OPA_PWRGD_P3V3_E1S_2_R,
.clkbuf_oe_en = OPA_CLKBUF_E1S_2_OE_N,
.cpu_pcie_reset = OPA_RST_PCIE_EXP_PERST0_N,
.e1s_pcie_reset = OPA_PERST_E1S_2_N },
}

◆ opb_e1s_power_control_gpio

e1s_power_control_gpio opb_e1s_power_control_gpio[]