summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_perf.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-02-18 00:23:36 +0000
committernjl <njl@FreeBSD.org>2005-02-18 00:23:36 +0000
commit18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a (patch)
treef4abd78e49b192efb6c1137801aa4a380e6e4218 /sys/dev/acpica/acpi_perf.c
parentc54115d548403a18776fc113c093f02b9b1b7cd6 (diff)
downloadFreeBSD-src-18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a.zip
FreeBSD-src-18a69f46e3ac23cb04aa2d1abf75f3aebf0c4e9a.tar.gz
Introduce a new method, cpufreq_drv_type(), that returns the type of the
driver. This used to be handled by cpufreq_drv_settings() but it's useful to get the type/flags separately from getting the settings. (For example, you don't have to pass an array of cf_setting just to find the driver type.) Use this new method in our in-tree drivers to detect reliably if acpi_perf is present and owns the hardware. This simplifies logic in drivers as well as fixing a bug introduced in my last commit where too many drivers attached.
Diffstat (limited to 'sys/dev/acpica/acpi_perf.c')
-rw-r--r--sys/dev/acpica/acpi_perf.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index 1956d7b..539a06a 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -101,9 +101,10 @@ static void acpi_px_available(struct acpi_perf_softc *sc);
static void acpi_px_startup(void *arg);
static void acpi_px_notify(ACPI_HANDLE h, UINT32 notify, void *context);
static int acpi_px_settings(device_t dev, struct cf_setting *sets,
- int *count, int *type);
+ int *count);
static int acpi_px_set(device_t dev, const struct cf_setting *set);
static int acpi_px_get(device_t dev, struct cf_setting *set);
+static int acpi_px_type(device_t dev, int *type);
static device_method_t acpi_perf_methods[] = {
/* Device interface */
@@ -115,6 +116,7 @@ static device_method_t acpi_perf_methods[] = {
/* cpufreq interface */
DEVMETHOD(cpufreq_drv_set, acpi_px_set),
DEVMETHOD(cpufreq_drv_get, acpi_px_get),
+ DEVMETHOD(cpufreq_drv_type, acpi_px_type),
DEVMETHOD(cpufreq_drv_settings, acpi_px_settings),
{0, 0}
};
@@ -392,7 +394,7 @@ acpi_px_to_set(device_t dev, struct acpi_px *px, struct cf_setting *set)
}
static int
-acpi_px_settings(device_t dev, struct cf_setting *sets, int *count, int *type)
+acpi_px_settings(device_t dev, struct cf_setting *sets, int *count)
{
struct acpi_perf_softc *sc;
int x, y;
@@ -408,9 +410,6 @@ acpi_px_settings(device_t dev, struct cf_setting *sets, int *count, int *type)
for (x = sc->px_max_avail; x < sc->px_count; x++, y++)
acpi_px_to_set(dev, &sc->px_states[x], &sets[y]);
*count = sc->px_count - sc->px_max_avail;
- *type = CPUFREQ_TYPE_ABSOLUTE;
- if (sc->info_only)
- *type |= CPUFREQ_FLAG_INFO_ONLY;
return (0);
}
@@ -502,3 +501,18 @@ acpi_px_get(device_t dev, struct cf_setting *set)
return (0);
}
+
+static int
+acpi_px_type(device_t dev, int *type)
+{
+ struct acpi_perf_softc *sc;
+
+ if (type == NULL)
+ return (EINVAL);
+ sc = device_get_softc(dev);
+
+ *type = CPUFREQ_TYPE_ABSOLUTE;
+ if (sc->info_only)
+ *type |= CPUFREQ_FLAG_INFO_ONLY;
+ return (0);
+}
OpenPOWER on IntegriCloud