DM: add vmctx as write dsdt func ptr parameter

Some ACPI objects is per-vm and per-cpu specific so we need to pass
vmctx as function parameter when we write objects into DSDT table.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Victor Sun 2018-04-07 10:45:32 +08:00 committed by lijinxia
parent b2341b7806
commit 7667d44354

View File

@ -118,7 +118,7 @@ struct basl_fio {
#define EFFLUSH(x) fflush(x) #define EFFLUSH(x) fflush(x)
static int static int
basl_fwrite_rsdp(FILE *fp) basl_fwrite_rsdp(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm RSDP template\n"); EFPRINTF(fp, " * dm RSDP template\n");
@ -141,7 +141,7 @@ basl_fwrite_rsdp(FILE *fp)
} }
static int static int
basl_fwrite_rsdt(FILE *fp) basl_fwrite_rsdt(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm RSDT template\n"); EFPRINTF(fp, " * dm RSDT template\n");
@ -174,7 +174,7 @@ basl_fwrite_rsdt(FILE *fp)
} }
static int static int
basl_fwrite_xsdt(FILE *fp) basl_fwrite_xsdt(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm XSDT template\n"); EFPRINTF(fp, " * dm XSDT template\n");
@ -207,7 +207,7 @@ basl_fwrite_xsdt(FILE *fp)
} }
static int static int
basl_fwrite_madt(FILE *fp) basl_fwrite_madt(FILE *fp, struct vmctx *ctx)
{ {
int i; int i;
@ -291,7 +291,7 @@ basl_fwrite_madt(FILE *fp)
} }
static int static int
basl_fwrite_fadt(FILE *fp) basl_fwrite_fadt(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm FADT template\n"); EFPRINTF(fp, " * dm FADT template\n");
@ -505,7 +505,7 @@ basl_fwrite_fadt(FILE *fp)
} }
static int static int
basl_fwrite_hpet(FILE *fp) basl_fwrite_hpet(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm HPET template\n"); EFPRINTF(fp, " * dm HPET template\n");
@ -547,7 +547,7 @@ basl_fwrite_hpet(FILE *fp)
} }
static int static int
basl_fwrite_mcfg(FILE *fp) basl_fwrite_mcfg(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm MCFG template\n"); EFPRINTF(fp, " * dm MCFG template\n");
@ -577,7 +577,7 @@ basl_fwrite_mcfg(FILE *fp)
} }
static int static int
basl_fwrite_nhlt(FILE *fp) basl_fwrite_nhlt(FILE *fp, struct vmctx *ctx)
{ {
int offset, len; int offset, len;
uint8_t data; uint8_t data;
@ -634,7 +634,7 @@ basl_fwrite_nhlt(FILE *fp)
} }
static int static int
basl_fwrite_facs(FILE *fp) basl_fwrite_facs(FILE *fp, struct vmctx *ctx)
{ {
EFPRINTF(fp, "/*\n"); EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * dm FACS template\n"); EFPRINTF(fp, " * dm FACS template\n");
@ -729,7 +729,7 @@ dsdt_fixed_mem32(uint32_t base, uint32_t length)
} }
static int static int
basl_fwrite_dsdt(FILE *fp) basl_fwrite_dsdt(FILE *fp, struct vmctx *ctx)
{ {
dsdt_fp = fp; dsdt_fp = fp;
dsdt_error = 0; dsdt_error = 0;
@ -852,7 +852,9 @@ basl_load(struct vmctx *ctx, int fd, uint64_t off)
} }
static int static int
basl_compile(struct vmctx *ctx, int (*fwrite_section)(FILE *), uint64_t offset) basl_compile(struct vmctx *ctx,
int (*fwrite_section)(FILE *, struct vmctx *),
uint64_t offset)
{ {
struct basl_fio io[2]; struct basl_fio io[2];
static char iaslbuf[3*MAXPATHLEN + 10]; static char iaslbuf[3*MAXPATHLEN + 10];
@ -860,7 +862,7 @@ basl_compile(struct vmctx *ctx, int (*fwrite_section)(FILE *), uint64_t offset)
err = basl_start(&io[0], &io[1]); err = basl_start(&io[0], &io[1]);
if (!err) { if (!err) {
err = (*fwrite_section)(io[0].fp); err = (*fwrite_section)(io[0].fp, ctx);
if (!err) { if (!err) {
/* /*
@ -947,7 +949,7 @@ basl_make_templates(void)
} }
static struct { static struct {
int (*wsect)(FILE *fp); int (*wsect)(FILE *fp, struct vmctx *ctx);
uint64_t offset; uint64_t offset;
bool valid; bool valid;
} basl_ftables[] = { } basl_ftables[] = {