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

Macros

#define OPA_E1S_POWER_FAULT_HANDLER(device, power)
 
#define OPB_E1S_POWER_FAULT_HANDLER(device, power)
 

Functions

 LOG_MODULE_REGISTER (plat_isr)
 
 K_THREAD_STACK_DEFINE (power_thread, POWER_SEQ_CTRL_STACK_SIZE)
 
 OPA_E1S_POWER_FAULT_HANDLER (0, P12V)
 
 OPA_E1S_POWER_FAULT_HANDLER (1, P12V)
 
 OPA_E1S_POWER_FAULT_HANDLER (2, P12V)
 
 OPA_E1S_POWER_FAULT_HANDLER (0, P3V3)
 
 OPA_E1S_POWER_FAULT_HANDLER (1, P3V3)
 
 OPA_E1S_POWER_FAULT_HANDLER (2, P3V3)
 
 OPB_E1S_POWER_FAULT_HANDLER (0, P12V)
 
 OPB_E1S_POWER_FAULT_HANDLER (1, P12V)
 
 OPB_E1S_POWER_FAULT_HANDLER (2, P12V)
 
 OPB_E1S_POWER_FAULT_HANDLER (3, P12V)
 
 OPB_E1S_POWER_FAULT_HANDLER (4, P12V)
 
 OPB_E1S_POWER_FAULT_HANDLER (0, P3V3)
 
 OPB_E1S_POWER_FAULT_HANDLER (1, P3V3)
 
 OPB_E1S_POWER_FAULT_HANDLER (2, P3V3)
 
 OPB_E1S_POWER_FAULT_HANDLER (3, P3V3)
 
 OPB_E1S_POWER_FAULT_HANDLER (4, P3V3)
 
void control_power_sequence ()
 
void init_power_on_thread (uint8_t initial_stage)
 
void init_power_off_thread ()
 
void abort_power_thread ()
 
void ISR_FM_EXP_MAIN_PWR_EN ()
 
void ISR_CPU_PCIE_PERST ()
 
void ISR_E1S_0_INA233_ALERT ()
 
void ISR_E1S_1_INA233_ALERT ()
 
void ISR_E1S_2_INA233_ALERT ()
 
void ISR_E1S_3_INA233_ALERT ()
 
void ISR_E1S_4_INA233_ALERT ()
 
void ISR_E1S_P12V_EDGE_INA233_ALERT ()
 
void ISR_E1S_P12V_MAIN_INA233_ALERT ()
 
void ISR_E1S_0_PRSNT_N ()
 
void ISR_E1S_1_PRSNT_N ()
 
void ISR_E1S_2_PRSNT_N ()
 
void ISR_E1S_3_PRSNT_N ()
 
void ISR_E1S_4_PRSNT_N ()
 

Variables

struct k_thread power_thread_handler
 
k_tid_t power_tid
 

Macro Definition Documentation

◆ OPA_E1S_POWER_FAULT_HANDLER

#define OPA_E1S_POWER_FAULT_HANDLER (   device,
  power 
)
Value:
void OPA_ISR_E1S_##device##_##power##_POWER_FAULT() \
{ \
uint8_t log = 0; \
log = gpio_get(OPA_PWRGD_##power##_E1S_##device##_R); \
LOG_DBG("OPA GPIO = %d, OPA = %d", OPA_PWRGD_##power##_E1S_##device##_R, log); \
if ((gpio_get(OPA_PWRGD_##power##_E1S_##device##_R) == POWER_OFF) && \
(gpio_get(OPA_E1S_##device##_##power##_POWER_EN) == POWER_ON)) { \
send_system_status_event(IPMI_EVENT_TYPE_SENSOR_SPECIFIC, \
IPMI_EVENT_OFFSET_SYS_E1S_##power##_FAULT, \
E1S_##device); \
is_e1s_##power##_fault_assert[E1S_##device] = true; \
} else { \
if ((gpio_get(OPA_E1S_##device##_##power##_POWER_EN) == POWER_ON) && \
(gpio_get(OPA_PWRGD_##power##_E1S_##device##_R) == POWER_ON)) { \
if (is_e1s_##power##_fault_assert[E1S_##device]) { \
send_system_status_event( \
IPMI_EVENT_OFFSET_SYS_E1S_##power##_FAULT, \
E1S_##device); \
is_e1s_##power##_fault_assert[E1S_##device] = false; \
} \
} \
} \
}
int gpio_get(uint8_t gpio_num)
Definition: hal_gpio.c:261
@ POWER_OFF
Definition: hal_gpio.h:119
@ POWER_ON
Definition: hal_gpio.h:118
#define IPMI_EVENT_TYPE_SENSOR_SPECIFIC
Definition: libipmi.h:60
#define IPMI_OEM_EVENT_TYPE_DEASSERT
Definition: libipmi.h:62
double power(double x, int y)
Definition: libutil.c:147

◆ OPB_E1S_POWER_FAULT_HANDLER

#define OPB_E1S_POWER_FAULT_HANDLER (   device,
  power 
)
Value:
void OPB_ISR_E1S_##device##_##power##_POWER_FAULT() \
{ \
uint8_t log = 0; \
log = gpio_get(OPB_PWRGD_##power##_E1S_##device##_R); \
LOG_DBG("OPB GPIO = %d, OPB = %d", OPB_PWRGD_##power##_E1S_##device##_R, log); \
if ((gpio_get(OPB_PWRGD_##power##_E1S_##device##_R) == POWER_OFF) && \
(gpio_get(OPB_##power##_E1S_##device##_EN_R) == POWER_ON)) { \
send_system_status_event(IPMI_EVENT_TYPE_SENSOR_SPECIFIC, \
IPMI_EVENT_OFFSET_SYS_E1S_##power##_FAULT, \
E1S_##device); \
is_e1s_##power##_fault_assert[E1S_##device] = true; \
} else { \
if ((gpio_get(OPB_##power##_E1S_##device##_EN_R) == POWER_ON) && \
(gpio_get(OPB_PWRGD_##power##_E1S_##device##_R) == POWER_ON)) { \
if (is_e1s_##power##_fault_assert[E1S_##device]) { \
send_system_status_event( \
IPMI_EVENT_OFFSET_SYS_E1S_##power##_FAULT, \
E1S_##device); \
is_e1s_##power##_fault_assert[E1S_##device] = false; \
} \
} \
} \
}

Function Documentation

◆ abort_power_thread()

void abort_power_thread ( )

◆ control_power_sequence()

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

◆ init_power_off_thread()

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

◆ init_power_on_thread()

void init_power_on_thread ( uint8_t  initial_stage)
Here is the call graph for this function:

◆ ISR_CPU_PCIE_PERST()

void ISR_CPU_PCIE_PERST ( )

◆ ISR_E1S_0_INA233_ALERT()

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

◆ ISR_E1S_0_PRSNT_N()

void ISR_E1S_0_PRSNT_N ( )

◆ ISR_E1S_1_INA233_ALERT()

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

◆ ISR_E1S_1_PRSNT_N()

void ISR_E1S_1_PRSNT_N ( )

◆ ISR_E1S_2_INA233_ALERT()

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

◆ ISR_E1S_2_PRSNT_N()

void ISR_E1S_2_PRSNT_N ( )

◆ ISR_E1S_3_INA233_ALERT()

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

◆ ISR_E1S_3_PRSNT_N()

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

◆ ISR_E1S_4_INA233_ALERT()

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

◆ ISR_E1S_4_PRSNT_N()

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

◆ ISR_E1S_P12V_EDGE_INA233_ALERT()

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

◆ ISR_E1S_P12V_MAIN_INA233_ALERT()

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

◆ ISR_FM_EXP_MAIN_PWR_EN()

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

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( power_thread  ,
POWER_SEQ_CTRL_STACK_SIZE   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_isr  )

◆ OPA_E1S_POWER_FAULT_HANDLER() [1/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPA_E1S_POWER_FAULT_HANDLER() [2/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPA_E1S_POWER_FAULT_HANDLER() [3/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPA_E1S_POWER_FAULT_HANDLER() [4/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPA_E1S_POWER_FAULT_HANDLER() [5/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPA_E1S_POWER_FAULT_HANDLER() [6/6]

OPA_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [1/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [2/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [3/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [4/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [5/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [6/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [7/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [8/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [9/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P12V   
)

◆ OPB_E1S_POWER_FAULT_HANDLER() [10/10]

OPB_E1S_POWER_FAULT_HANDLER ( ,
P3V3   
)

Variable Documentation

◆ power_thread_handler

struct k_thread power_thread_handler

◆ power_tid

k_tid_t power_tid