Fix loading the hwpmc module when ACPI is enabled
In 0a9a4d2cd6
a check for OPT_ACPI was added to the hwpmc Makefile
to fix loading the module in a kernel where ACPI has been disabled.
This broke loading the module when ACPI was enabled in the build as
OPT_ACPI isn't a Makefile macro so was always disabled.
Move this check to the C files where the DEV_ACPI macro does exist.
Reviewed by: gnn
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D37773
This commit is contained in:
parent
c1a2798faa
commit
751d88119f
@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2021 ARM Ltd
|
||||
* Copyright (c) 2021-2022 Arm Ltd
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_acpi.h"
|
||||
|
||||
/*
|
||||
* This depends on ACPI, but is built unconditionally in the hwpmc module.
|
||||
*/
|
||||
#ifdef DEV_ACPI
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -831,3 +835,4 @@ static driver_t cmn600_acpi_driver = {
|
||||
|
||||
DRIVER_MODULE(cmn600, acpi, cmn600_acpi_driver, 0, 0);
|
||||
MODULE_VERSION(cmn600, 1);
|
||||
#endif /* DEV_ACPI */
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2003-2008 Joseph Koshy
|
||||
* Copyright (c) 2007 The FreeBSD Foundation
|
||||
* Copyright (c) 2021 ARM Ltd
|
||||
* Copyright (c) 2021-2022 ARM Ltd
|
||||
*
|
||||
* Portions of this software were developed by A. Joseph Koshy under
|
||||
* sponsorship from the FreeBSD Foundation and Google, Inc.
|
||||
@ -35,6 +35,12 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_acpi.h"
|
||||
|
||||
/*
|
||||
* This depends on ACPI, but is built unconditionally in the hwpmc module.
|
||||
*/
|
||||
#ifdef DEV_ACPI
|
||||
#include <sys/param.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
@ -824,3 +830,4 @@ pmc_cmn600_finalize(struct pmc_mdep *md)
|
||||
}
|
||||
|
||||
MODULE_DEPEND(pmc, cmn600, 1, 1, 1);
|
||||
#endif /* DEV_ACPI */
|
||||
|
@ -2,6 +2,7 @@
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2021 Ampere Computing LLC
|
||||
* Copyright (c) 2022 Arm Ltd
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -33,6 +34,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include "opt_hwpmc_hooks.h"
|
||||
#include "opt_acpi.h"
|
||||
|
||||
/*
|
||||
* This depends on ACPI, but is built unconditionally in the hwpmc module.
|
||||
*/
|
||||
#ifdef DEV_ACPI
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/module.h>
|
||||
@ -275,3 +280,4 @@ DRIVER_MODULE(pmu_dmc620, acpi, pmu_dmc620_acpi_driver, 0, 0);
|
||||
/* Reverse dependency. hwpmc needs DMC-620 on ARM64. */
|
||||
MODULE_DEPEND(pmc, pmu_dmc620, 1, 1, 1);
|
||||
MODULE_VERSION(pmu_dmc620, 1);
|
||||
#endif /* DEV_ACPI */
|
||||
|
@ -12,11 +12,9 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user