bhyve: Build the HPET ACPI table on amd64 only

There is no HPET on arm64 and vm_get_hpet_capabilities() is not
implemented there.  Move the vm_get_hpet_capabilities() call into
build_hpet(): I cannot see a downside, and doing so eliminates a global
variable and reduces the amount of code that needs to be conditionally
compiled.  No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40990

(cherry picked from commit 83b003fbe9)
This commit is contained in:
Mark Johnston 2023-10-04 12:28:28 -04:00
parent 15181b7302
commit a43a3efa5a

View file

@ -71,7 +71,6 @@
static int basl_keep_temps;
static int basl_verbose_iasl;
static int basl_ncpu;
static uint32_t hpet_capabilities;
/*
* Contains the full pathname of the template to be passed
@ -218,6 +217,7 @@ basl_fwrite_dsdt(FILE *fp)
pci_write_dsdt();
#ifdef __amd64__
dsdt_line("");
dsdt_line(" Scope (_SB.PC00)");
dsdt_line(" {");
@ -233,6 +233,7 @@ basl_fwrite_dsdt(FILE *fp)
dsdt_line(" })");
dsdt_line(" }");
dsdt_line(" }");
#endif
vmgenc_write_dsdt();
@ -530,11 +531,18 @@ build_fadt(struct vmctx *const ctx)
return (0);
}
#ifdef __amd64__
static int
build_hpet(struct vmctx *const ctx)
{
ACPI_TABLE_HPET hpet;
struct basl_table *table;
uint32_t hpet_capabilities;
int err;
err = vm_get_hpet_capabilities(ctx, &hpet_capabilities);
if (err != 0)
return (err);
BASL_EXEC(basl_table_create(&table, ctx, ACPI_SIG_HPET,
BASL_TABLE_ALIGNMENT));
@ -551,6 +559,7 @@ build_hpet(struct vmctx *const ctx)
return (0);
}
#endif
static int
build_madt(struct vmctx *const ctx)
@ -720,14 +729,8 @@ build_spcr(struct vmctx *const ctx)
int
acpi_build(struct vmctx *ctx, int ncpu)
{
int err;
basl_ncpu = ncpu;
err = vm_get_hpet_capabilities(ctx, &hpet_capabilities);
if (err != 0)
return (err);
/*
* For debug, allow the user to have iasl compiler output sent
* to stdout rather than /dev/null
@ -756,7 +759,9 @@ acpi_build(struct vmctx *ctx, int ncpu)
BASL_EXEC(build_rsdp(ctx));
BASL_EXEC(build_fadt(ctx));
BASL_EXEC(build_madt(ctx));
#ifdef __amd64__
BASL_EXEC(build_hpet(ctx));
#endif
BASL_EXEC(build_mcfg(ctx));
BASL_EXEC(build_facs(ctx));
BASL_EXEC(build_spcr(ctx));