mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-11 08:25:53 +00:00
DM: ioc code cleanup
- make ioc_init/ioc_deinit take struct vmctx as argument - ioc_init return int instead of pointer to struct ioc_dev - add ioc_dev in vmctx to track ioc_dev - remove the atkbdc.h included in vmmapi.h Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Liu, Yuan1 <yuan1.liu@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Reviewed-by: Wang Yu <yu1.wang@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
parent
68900064f4
commit
bd86b66296
@ -781,7 +781,7 @@ main(int argc, char *argv[])
|
|||||||
pci_irq_init(ctx);
|
pci_irq_init(ctx);
|
||||||
atkbdc_init(ctx);
|
atkbdc_init(ctx);
|
||||||
ioapic_init(ctx);
|
ioapic_init(ctx);
|
||||||
ioc_init();
|
ioc_init(ctx);
|
||||||
|
|
||||||
vrtc_init(ctx);
|
vrtc_init(ctx);
|
||||||
sci_init(ctx);
|
sci_init(ctx);
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "ioc.h"
|
#include "ioc.h"
|
||||||
|
#include "vmmapi.h"
|
||||||
|
|
||||||
/* For debugging log to a file */
|
/* For debugging log to a file */
|
||||||
static int ioc_debug;
|
static int ioc_debug;
|
||||||
@ -1051,8 +1052,8 @@ ioc_parse(const char *opts)
|
|||||||
/*
|
/*
|
||||||
* IOC mediator main entry.
|
* IOC mediator main entry.
|
||||||
*/
|
*/
|
||||||
struct ioc_dev *
|
int
|
||||||
ioc_init(void)
|
ioc_init(struct vmctx *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ioc_dev *ioc;
|
struct ioc_dev *ioc;
|
||||||
@ -1161,7 +1162,9 @@ ioc_init(void)
|
|||||||
(void *)ioc) < 0)
|
(void *)ioc) < 0)
|
||||||
goto work_err;
|
goto work_err;
|
||||||
|
|
||||||
return ioc;
|
ctx->ioc_dev = ioc;
|
||||||
|
return 0;
|
||||||
|
|
||||||
work_err:
|
work_err:
|
||||||
pthread_mutex_destroy(&ioc->rx_mtx);
|
pthread_mutex_destroy(&ioc->rx_mtx);
|
||||||
pthread_cond_destroy(&ioc->rx_cond);
|
pthread_cond_destroy(&ioc->rx_cond);
|
||||||
@ -1179,15 +1182,17 @@ alloc_err:
|
|||||||
ioc_err:
|
ioc_err:
|
||||||
IOC_LOG_DEINIT;
|
IOC_LOG_DEINIT;
|
||||||
DPRINTF("%s", "ioc mediator startup failed!!\r\n");
|
DPRINTF("%s", "ioc mediator startup failed!!\r\n");
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called by DM in main entry.
|
* Called by DM in main entry.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ioc_deinit(struct ioc_dev *ioc)
|
ioc_deinit(struct vmctx *ctx)
|
||||||
{
|
{
|
||||||
|
struct ioc_dev *ioc = ctx->ioc_dev;
|
||||||
|
|
||||||
if (!ioc) {
|
if (!ioc) {
|
||||||
DPRINTF("%s", "ioc deinit parameter is NULL\r\n");
|
DPRINTF("%s", "ioc deinit parameter is NULL\r\n");
|
||||||
return;
|
return;
|
||||||
@ -1199,4 +1204,6 @@ ioc_deinit(struct ioc_dev *ioc)
|
|||||||
free(ioc->pool);
|
free(ioc->pool);
|
||||||
free(ioc);
|
free(ioc);
|
||||||
IOC_LOG_DEINIT;
|
IOC_LOG_DEINIT;
|
||||||
|
|
||||||
|
ctx->ioc_dev = NULL;
|
||||||
}
|
}
|
||||||
|
@ -710,9 +710,11 @@ struct ioc_dev {
|
|||||||
/* Parse IOC parameters */
|
/* Parse IOC parameters */
|
||||||
int ioc_parse(const char *opts);
|
int ioc_parse(const char *opts);
|
||||||
|
|
||||||
|
struct vmctx;
|
||||||
|
|
||||||
/* IOC mediator common ops */
|
/* IOC mediator common ops */
|
||||||
struct ioc_dev *ioc_init(void);
|
int ioc_init(struct vmctx *ctx);
|
||||||
void ioc_deinit(struct ioc_dev *dev);
|
void ioc_deinit(struct vmctx *ctx);
|
||||||
|
|
||||||
/* Build a cbc_request and send it to CBC protocol stack */
|
/* Build a cbc_request and send it to CBC protocol stack */
|
||||||
void ioc_build_request(struct ioc_dev *ioc, int32_t link_len, int32_t srv_len);
|
void ioc_build_request(struct ioc_dev *ioc, int32_t link_len, int32_t srv_len);
|
||||||
|
@ -62,6 +62,7 @@ struct vmctx {
|
|||||||
/* fields to track virtual devices */
|
/* fields to track virtual devices */
|
||||||
void *atkbdc_base;
|
void *atkbdc_base;
|
||||||
void *vrtc;
|
void *vrtc;
|
||||||
|
void *ioc_dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user