git: 0a9a4d2cd609 - main - arm64: Fix hwpmc module for OPT_ACPI isn't selected

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Wed, 31 Aug 2022 07:26:17 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a9a4d2cd60920d9f8c2dffb06b6b4186a5a2715

commit 0a9a4d2cd60920d9f8c2dffb06b6b4186a5a2715
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-08-29 09:50:52 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-08-31 07:25:39 +0000

    arm64: Fix hwpmc module for OPT_ACPI isn't selected
    
    Fixes: 59191f3573f6 ("Add support of ARM CMN-600 controller ...")
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 sys/dev/hwpmc/hwpmc_arm64.c | 6 ++++++
 sys/modules/hwpmc/Makefile  | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index ca346f2ac4df..ec796bcc8ff5 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include <machine/pmc_mdep.h>
 #include <machine/cpu.h>
 
+#include "opt_acpi.h"
+
 static int arm64_npmcs;
 
 struct arm64_event_code_map {
@@ -564,11 +566,13 @@ pmc_arm64_initialize(void)
 	/* One AArch64 CPU class */
 	classes = 1;
 
+#ifdef DEV_ACPI
 	/* Query presence of optional classes and set max class. */
 	if (pmc_cmn600_nclasses() > 0)
 		classes = MAX(classes, PMC_MDEP_CLASS_INDEX_CMN600);
 	if (pmc_dmc620_nclasses() > 0)
 		classes = MAX(classes, PMC_MDEP_CLASS_INDEX_DMC620_C);
+#endif
 
 	pmc_mdep = pmc_mdep_alloc(classes);
 
@@ -619,12 +623,14 @@ pmc_arm64_initialize(void)
 
 	pmc_mdep->pmd_npmc   += arm64_npmcs;
 
+#ifdef DEV_ACPI
 	if (pmc_cmn600_nclasses() > 0)
 		pmc_cmn600_initialize(pmc_mdep);
 	if (pmc_dmc620_nclasses() > 0) {
 		pmc_dmc620_initialize_cd2(pmc_mdep);
 		pmc_dmc620_initialize_c(pmc_mdep);
 	}
+#endif
 
 	return (pmc_mdep);
 }
diff --git a/sys/modules/hwpmc/Makefile b/sys/modules/hwpmc/Makefile
index 0db4c55e64f3..a72b3cf8d2fd 100644
--- a/sys/modules/hwpmc/Makefile
+++ b/sys/modules/hwpmc/Makefile
@@ -12,9 +12,11 @@ SRCS+=	vnode_if.h
 
 .if ${MACHINE_CPUARCH} == "aarch64"
 SRCS+=	hwpmc_arm64.c hwpmc_arm64_md.c
+.if !empty(OPT_ACPI)
 SRCS+=	cmn600.c hwpmc_cmn600.c
 SRCS+=	hwpmc_dmc620.c pmu_dmc620.c
 .endif
+.endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
 SRCS+=	hwpmc_amd.c hwpmc_core.c hwpmc_intel.c hwpmc_tsc.c