Skip to content

Commit e96fe06

Browse files
jsun26inteljren1
authored andcommitted
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>
1 parent b50fcc0 commit e96fe06

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

devicemodel/hw/acpi/acpi.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct basl_fio {
118118
#define EFFLUSH(x) fflush(x)
119119

120120
static int
121-
basl_fwrite_rsdp(FILE *fp)
121+
basl_fwrite_rsdp(FILE *fp, struct vmctx *ctx)
122122
{
123123
EFPRINTF(fp, "/*\n");
124124
EFPRINTF(fp, " * dm RSDP template\n");
@@ -141,7 +141,7 @@ basl_fwrite_rsdp(FILE *fp)
141141
}
142142

143143
static int
144-
basl_fwrite_rsdt(FILE *fp)
144+
basl_fwrite_rsdt(FILE *fp, struct vmctx *ctx)
145145
{
146146
EFPRINTF(fp, "/*\n");
147147
EFPRINTF(fp, " * dm RSDT template\n");
@@ -174,7 +174,7 @@ basl_fwrite_rsdt(FILE *fp)
174174
}
175175

176176
static int
177-
basl_fwrite_xsdt(FILE *fp)
177+
basl_fwrite_xsdt(FILE *fp, struct vmctx *ctx)
178178
{
179179
EFPRINTF(fp, "/*\n");
180180
EFPRINTF(fp, " * dm XSDT template\n");
@@ -207,7 +207,7 @@ basl_fwrite_xsdt(FILE *fp)
207207
}
208208

209209
static int
210-
basl_fwrite_madt(FILE *fp)
210+
basl_fwrite_madt(FILE *fp, struct vmctx *ctx)
211211
{
212212
int i;
213213

@@ -291,7 +291,7 @@ basl_fwrite_madt(FILE *fp)
291291
}
292292

293293
static int
294-
basl_fwrite_fadt(FILE *fp)
294+
basl_fwrite_fadt(FILE *fp, struct vmctx *ctx)
295295
{
296296
EFPRINTF(fp, "/*\n");
297297
EFPRINTF(fp, " * dm FADT template\n");
@@ -505,7 +505,7 @@ basl_fwrite_fadt(FILE *fp)
505505
}
506506

507507
static int
508-
basl_fwrite_hpet(FILE *fp)
508+
basl_fwrite_hpet(FILE *fp, struct vmctx *ctx)
509509
{
510510
EFPRINTF(fp, "/*\n");
511511
EFPRINTF(fp, " * dm HPET template\n");
@@ -547,7 +547,7 @@ basl_fwrite_hpet(FILE *fp)
547547
}
548548

549549
static int
550-
basl_fwrite_mcfg(FILE *fp)
550+
basl_fwrite_mcfg(FILE *fp, struct vmctx *ctx)
551551
{
552552
EFPRINTF(fp, "/*\n");
553553
EFPRINTF(fp, " * dm MCFG template\n");
@@ -577,7 +577,7 @@ basl_fwrite_mcfg(FILE *fp)
577577
}
578578

579579
static int
580-
basl_fwrite_nhlt(FILE *fp)
580+
basl_fwrite_nhlt(FILE *fp, struct vmctx *ctx)
581581
{
582582
int offset, len;
583583
uint8_t data;
@@ -634,7 +634,7 @@ basl_fwrite_nhlt(FILE *fp)
634634
}
635635

636636
static int
637-
basl_fwrite_facs(FILE *fp)
637+
basl_fwrite_facs(FILE *fp, struct vmctx *ctx)
638638
{
639639
EFPRINTF(fp, "/*\n");
640640
EFPRINTF(fp, " * dm FACS template\n");
@@ -729,7 +729,7 @@ dsdt_fixed_mem32(uint32_t base, uint32_t length)
729729
}
730730

731731
static int
732-
basl_fwrite_dsdt(FILE *fp)
732+
basl_fwrite_dsdt(FILE *fp, struct vmctx *ctx)
733733
{
734734
dsdt_fp = fp;
735735
dsdt_error = 0;
@@ -852,15 +852,17 @@ basl_load(struct vmctx *ctx, int fd, uint64_t off)
852852
}
853853

854854
static int
855-
basl_compile(struct vmctx *ctx, int (*fwrite_section)(FILE *), uint64_t offset)
855+
basl_compile(struct vmctx *ctx,
856+
int (*fwrite_section)(FILE *, struct vmctx *),
857+
uint64_t offset)
856858
{
857859
struct basl_fio io[2];
858860
static char iaslbuf[3*MAXPATHLEN + 10];
859861
int err;
860862

861863
err = basl_start(&io[0], &io[1]);
862864
if (!err) {
863-
err = (*fwrite_section)(io[0].fp);
865+
err = (*fwrite_section)(io[0].fp, ctx);
864866

865867
if (!err) {
866868
/*
@@ -947,7 +949,7 @@ basl_make_templates(void)
947949
}
948950

949951
static struct {
950-
int (*wsect)(FILE *fp);
952+
int (*wsect)(FILE *fp, struct vmctx *ctx);
951953
uint64_t offset;
952954
bool valid;
953955
} basl_ftables[] = {

0 commit comments

Comments
 (0)