IOC mediator: Implement state transfer framework

Implements state transfer framework to support IOC lifecycle virtualization.
Four states will be involved in this framework includes INIT, ACTIVE,SUSPENDING and
SUSPENDED.

Signed-off-by: Liu Yuan <yuan1.liu@intel.com>
Reviewed-by: Wang Yu <yu1.wang@intel.com>
Reviewed-by: Liu Shuo <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Liu Yuan
2018-05-17 16:06:59 +08:00
committed by lijinxia
parent 92da8f4954
commit 11208dd6d5
2 changed files with 198 additions and 3 deletions

View File

@@ -526,6 +526,7 @@ enum ioc_ch_id {
IOC_NATIVE_RAW10, /* Native /dev/cbc-raw10 */
IOC_NATIVE_RAW11, /* Native /dev/cbc-raw11 */
IOC_VIRTUAL_UART, /* Virtual UART */
IOC_LOCAL_EVENT, /* Local channel for IOC event */
IOC_NATIVE_DUMMY0, /* Native fake lifecycle channel */
IOC_NATIVE_DUMMY1, /* Native fake signal channel */
IOC_NATIVE_DUMMY2, /* Native Fake oem raw channel */
@@ -575,8 +576,8 @@ enum cbc_queue_type {
*/
enum cbc_request_type {
CBC_REQ_T_PROT, /* CBC protocol request */
CBC_REQ_T_VMM_S3, /* VMM suspend request */
CBC_REQ_T_VMM_S5, /* VMM shutdown request */
CBC_REQ_T_SUSPEND, /* CBC suspend request */
CBC_REQ_T_SHUTDOWN, /* CBC shutdown request */
CBC_REQ_T_SOC /* SOC state update request */
};
@@ -656,6 +657,28 @@ struct cbc_request {
SIMPLEQ_ENTRY(cbc_request) me_queue;
};
/*
* IOC state types.
*/
enum ioc_state_type {
IOC_S_INIT,
IOC_S_ACTIVE,
IOC_S_SUSPENDING,
IOC_S_SUSPENDED
};
/*
* IOC event types.
*/
enum ioc_event_type {
IOC_E_INVALID,
IOC_E_HB_ACTIVE,
IOC_E_RAM_REFRESH,
IOC_E_HB_INACTIVE,
IOC_E_SHUTDOWN,
IOC_E_RESUME
};
/*
* CBC packet is mainly structure for CBC protocol process.
*/
@@ -684,6 +707,8 @@ struct ioc_dev {
char name[16]; /* Core thread name */
int closing; /* Close IOC mediator device flag */
int epfd; /* Epoll fd */
int32_t evt_fd; /* Pipe write fd to trigger one event */
enum ioc_state_type state; /* IOC state type */
struct epoll_event *evts; /* Epoll events table */
struct cbc_request *pool; /* CBC requests pool */
struct cbc_ring ring; /* Ring buffer */
@@ -708,6 +733,16 @@ struct ioc_dev {
void (*ioc_dev_tx)(struct cbc_pkt *pkt);
};
/*
* IOC state information.
*/
struct ioc_state_info {
enum ioc_state_type cur_stat;
enum ioc_state_type next_stat;
enum ioc_event_type evt;
int32_t (*handler)(struct ioc_dev *ioc);
};
/* Parse IOC parameters */
int ioc_parse(const char *opts);