[Fwd: cvs commit: src/sys/dev/acpica acpi_perf.c src/sys/kern kern_cpu.c]

Nate Lawson nate at root.org
Sun Feb 13 18:59:24 GMT 2005


The commit below allows acpi_perf(4) to attach to FFixedHW devices and 
export settings to other drivers (say, EST and Powernow).  The code 
snippet for foo_probe() to do this is as follows:

/* Find an acpi_perf child under our common parent. */
device_t child;
child = device_find_child(device_get_parent(dev), "acpi_perf", -1);
if (child == NULL || !device_is_attached(child))
     ... do whatever you can from static tables or fail ...

/* Get its settings so we know what frequencies it offers. */
error = CPUFREQ_DRV_SETTINGS(child, sets, &count, &type);
if (error)
     ... fall back to static tables ...

/*
  * If the device is not offering info, it thinks it can control
  * settings itself.  We fail out of our probe in this case since
  * it is already in charge.
  */
if ((type & CPUFREQ_FLAG_INFO_ONLY) == 0)
     return (ENXIO);

/* Loop through all settings and match up to our levels */
for ()
     powernow_sets[i].freq = sets[i].freq
     powernow_sets[i].power = sets[i].power;
     ...


-------- Original Message --------
njl         2005-02-13 18:49:48 UTC

   FreeBSD src repository

   Modified files:
     sys/dev/acpica       acpi_perf.c
     sys/kern             kern_cpu.c
   Log:
   Add support for the CPUFREQ_FLAG_INFO_ONLY flag.  Devices that report 
this
   are not added to the list(s) of available settings.  However, other 
drivers
   can call the CPUFREQ_DRV_SETTINGS() method on those devices directly to
   get info about available settings.

   Update the acpi_perf(4) driver to use this flag in the presence of
   "functional fixed hardware."  Thus, future drivers like Powernow can
   query acpi_perf for platform info but perform frequency transitions
   themselves.

   Revision  Changes    Path
   1.7       +39 -12    src/sys/dev/acpica/acpi_perf.c
   1.4       +8 -1      src/sys/kern/kern_cpu.c


-- 
Nate


More information about the freebsd-current mailing list