Commit Graph

762 Commits

Author SHA1 Message Date
Scott Long
5be4c55fea Add proper debugging infrastructure for acpi_hpet.c. 2005-11-01 15:57:15 +00:00
Poul-Henning Kamp
4fa7241fd4 Add a basic HPET timecounter.
It has -200 quality for now so it will not get automatically selected.
2005-10-31 21:39:50 +00:00
Robert Watson
5bb84bc84b Normalize a significant number of kernel malloc type names:
- Prefer '_' to ' ', as it results in more easily parsed results in
  memory monitoring tools such as vmstat.

- Remove punctuation that is incompatible with using memory type names
  as file names, such as '/' characters.

- Disambiguate some collisions by adding subsystem prefixes to some
  memory types.

- Generally prefer lower case to upper case.

- If the same type is defined in multiple architecture directories,
  attempt to use the same name in additional cases.

Not all instances were caught in this change, so more work is required to
finish this conversion.  Similar changes are required for UMA zone names.
2005-10-31 15:41:29 +00:00
Nate Lawson
80f006a1e3 If we're trying to use C2/3 and reads from the register are returning
immediately, back off to the next higher Cx sleep state.  Some machines
with a Via chipset report a valid C3 but a register read doesn't actually
halt the CPU.  This would cause the machine to appear unresponsive as it
repeatedly called cpu_idle() which immediately returned.  Causing interrupts
(i.e. by pressing the power button) would cause the system to make forward
progress, showing that it wasn't actually hung.

Also, enable interrupts a little earlier.  We don't need them disabled
to calculate the delta time for the read.

Reported by:	silby
MFC after:	2 weeks
2005-10-25 21:15:47 +00:00
Nate Lawson
c395e805cd Invert the check logic. No functional change, but I prefer this version. 2005-10-24 18:30:57 +00:00
Nate Lawson
895e60b801 If no AC line devices are found, go ahead and notify devd that the system
is on AC power (i.e. not a laptop).  This allows power_profile to run once
for desktop systems as well, for instance, to set C3 or CPU frequency.

MFC after:	2 weeks
2005-10-24 05:34:21 +00:00
Nate Lawson
49ab824149 Add prototype to be consistent. 2005-10-23 19:31:18 +00:00
Nate Lawson
893f750a5c Add a hack to get around PCI link devices that report "present" but not
"functional" (i.e., if they are disabled).  We should probe them anyway
since we may enable them later.

Tested by:	thompsa
MFC after:	3 days
2005-10-23 00:28:39 +00:00
Nate Lawson
a7e59a7679 Import ACPI smart battery support. Newer systems (Acer, mostly) do not
support the CM-battery interface.  Smart batteries can eventually be
supported without ACPI via a separate SMBus interface.  The ACPI interface
uses the embedded controller for reading/writing to the SMBus, and normal
ASL definitions for locating the battery controller (since SMBus can't be
enumerated.)  Also import definitions for the smart battery interface.

This was written by Hans Petter Selasky with minor cleanups from myself.

Submitted by:	Hans Petter Selasky <hselasky / c2i.net>
2005-10-23 00:20:13 +00:00
Nate Lawson
9aa72f7404 Cleanups and support code for importing smart battery support.
* Use ACPI_BATT_UNKNOWN instead of constants
* Use maxunit instead of a count of devices since we may have sparse
  battery devices in the future.  Only userland should be using unit
  numbers anyway, so provide a translation function.  (Kernel use of
  batteries should be restricted to looking up a device_t and calling
  methods directly.
* Don't check acpi_BatteryIsPresent() in acpi_battery.  Leave it up to
  the hardware-specific driver (i.e. cmbat) since smart batteries seem
  to not report the "battery present" flag.
* Convert mA to mW if the battery uses those units.  CM-batteries only
  used mW so this deficiency went unnoticed.
* Clean strings reported in the battery info from any control chars.
* Only dereference the unit from ioctl_arg if the full struct is present.
  Unit wouldn't have been used later if it wasn't present but this is
  cleaner.  Translate the unit if it's not ACPI_BATTERY_ALL_UNITS.
* bzero structs before returning them to usermode for future compat.

Most of this work was submitted by Hans Petter Selasky and then majorly
reworked by myself.

Submitted by:	Hans Petter Selasky <hselasky / c2i.net>
2005-10-23 00:16:41 +00:00
Warner Losh
dca2069084 Commit a workaround to a problem with resource allocation. This helps
with some Dell servers that booted w/o a problem[*] on 5.4, but failed
with 6.0-BETA.

On the PCI bus, when we do lazy resource allocation, we narrow the
range requested as we pass through bridges to reflect how the bridges
are programmed and what addresses they pass.  However, when we're
doing an allocation on a bus that's directly connected to a host
bridge, no such translation can take place.  We already had a fallback
range for memory requests, but none for ioports.  As such, provide a
fallback for I/O ports so we don't allocate location 0, which will
have undesired side effects when the resources are actually used.

This fixes a problem with booting a Dell server with usb in the
kernel.  However, it is an unsatisfying solution.  I don't like the
hard coded value, and I think we should start narrowing the resources
returned to not be in the so-called isa alias area (where the ranage &
0x0300 must be 0 iirc).  Doing such filtering will have to wait for
another day.

This may be a good 6 candidate, maybe after its had a chance to be
refined.

Tested by: glebius@
2005-09-16 07:02:29 +00:00
David E. O'Brien
2a191126de Canonize the include of acpi.h. 2005-09-11 18:39:03 +00:00
Alexander Kabaev
83582626ad Unbreak compiles with ACPI_DEBUG. 2005-08-26 02:21:02 +00:00
Hajimu UMEMOTO
b3130703e6 get current temperature from _TMP during passive cooling is active.
it makes CPU freq transition smooth.
2005-08-25 11:31:30 +00:00
Hajimu UMEMOTO
9b96aa9ad7 initialize only ACPI_BUFFER to avoid race condition with passive
cooling thread which refers psv, tc1, tc2 and tsp.  The previous
code made the period where sc->tz_zone.tsp was zero, and it caused
panic at msleep().

Reported by:	keramida
Tested by:	keramida
2005-08-25 10:50:36 +00:00
Hajimu UMEMOTO
c219fd0c5e don't raise cpu speed over the value when passive cooling is in
effect.  since CPU speed is restored by degrees, we cannot use
the facility of saving cpu speed by CPUFREQ_set() effectively.
so, we need to save the value when passive cooling is in effect.

Repoeted by:	Kevin Oberman <oberman__at__es.net>
2005-08-17 17:01:25 +00:00
Nate Lawson
84cdcfb36f Modify the fix in rev 1.16 slightly. Instead of setting the cap to zero,
just skip summing it if it's unknown.

MFC after:	1 day
2005-08-11 17:12:57 +00:00
Nate Lawson
9396c1b2d1 When summing capacities, skip info from batteries that weren't present.
Previously, we used all info (including -1 or "not present") which would
keep the system from reaching 100% when charging.

Reported by:	Eric Anderson
MFC after:	2 days
2005-08-05 17:00:58 +00:00
Hajimu UMEMOTO
fa4679950b don't do mutex locking around kthread_create() call.
Reported by:	Maxim Maximov <mcsi__at__mcsi.pp.ru>
2005-08-04 18:34:26 +00:00
Nate Lawson
e4515dd568 Add descriptions for the sysctls.
MFC after:	1 day
2005-07-28 19:34:51 +00:00
Nate Lawson
50d0e47aa7 Zero the _BST, _BIF, and battinfo allocations. This is needed since we
later sum capacities for all batteries, even those that weren't actually
present.  We only need to do this for _BST but do it for all of them.

Reported by:	Eric Anderson
MFC after:	1 day
2005-07-28 18:19:50 +00:00
John Baldwin
b88076fede Correct the order of some if tests so that we don't complain about being
unable to route an IRQ when we do route an IRQ ok but bootverbose is off.

Reported by:	Ben Kaduk minimarmot at gmail dot com
2005-07-27 15:21:32 +00:00
Nate Lawson
f4e31e2e89 Correct minor output bug. When the battery being queried is charging or
the overall discharge rate is 0, mark the battery remaining time as
"unknown", not 0.

Reported by:	Eric Kjeldergaard
MFC after:	4 days
2005-07-25 17:44:10 +00:00
Nate Lawson
76f6fe4f31 Rewrite the acpi_battery interface to allow for other battery types
(i.e., smart battery) and fix various bugs found during the cleanup.

API changes:
* kernel access:
Access to individual batteries is now via devclass_find("battery").
Introduce new methods ACPI_BATT_GET_STATUS (for _BST-formatted data) and
ACPI_BATT_GET_INFO (for _BIF-formatted data).  The helper function
acpi_battery_get_battinfo() now takes a device_t instead of a unit #
argument.  If dev is NULL, this signifies all batteries.

* ioctl access:
The ACPIIO_BATT_GET_TYPE and ACPIIO_BATT_GET_BATTDESC ioctls have been
removed.  Since there is now no need for a mapping between "virtual" unit
and physical unit, usermode programs can just specify the unit directly and
skip the old translation steps.  In fact, acpiconf(8) was actually already
doing this and virtual unit was the same as physical unit in all cases
since there was previously only one battery type (acpi_cmbat).  Additionally,
we now map the ACPIIO_BATT_GET_BIF and ACPIIO_BATT_GET_BST ioctls for all
batteries, if they provide the associated methods.

* apm compatibility device/ioctls:  no change
* sysctl:  no change

Since most third-party applications use the apm(4) compat interface, there
should be very few affected applications (if any).

Reviewed by:	bruno
MFC after:	5 days
2005-07-23 19:36:00 +00:00
Nate Lawson
a3ab9d1e3e Standardize __FBSDID identifiers.
MFC after:	2 days
2005-07-22 23:10:02 +00:00
Hajimu UMEMOTO
e71de913d8 Implement passive cooling. It is enabled for tz0 by default where
it is available.

Reviewed by:	njl
2005-07-18 20:12:23 +00:00
David Malone
d446f3569c Add a quirk for a motherboard whose acpi timer runs too fast.
Approved by:	re (scottl)
Approved by:	nate
MFC after:	2 weeks
2005-06-26 18:19:14 +00:00
Warner Losh
f09aa88c33 In newbus land, ivars can only be accessed for direct child, or when
the driver has unholy private knowledge of its great-*cgrandchildren.
The ACPI allocation routine lacked such knowledge when it tried to do
a default allocation for all descendants, rather than just its
immeidate children, so would access grandchild's ivar in an unsafe
way.  This could lead to a panic when devices were present which had
no addresses setup by the BIOS, but which were later allocated in a
lazy manner via pci_alloc_map.  As such, only do the default
allocation adjustments for immediate children.  The manner that
acpi_sysres_find accesses the resource list, used later in
acpi_alloc_resource, is safe and proper so no additional test is
needed there.

This fixes a panic when probing an disabled ata controller on some
newer intel blades.

Reported by: dwhite
2005-06-03 20:12:12 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Nate Lawson
1c9ec53854 If devclass_get_devices() returns success but a count of 0, free the
pointer.  If kernel malloc(0) returns a valid pointer, it needs to be
freed.  If it returns NULL, it's ok to free this also.

Submitted by:	pjd
Reviewed by:	imp, dfr
Obtained from:	Coverity Prevent
2005-05-20 05:00:43 +00:00
Takanori Watanabe
b4b4c81522 Use General definition for general notify. 2005-05-19 09:13:26 +00:00
Nate Lawson
a6761eb377 If there is a problem during probe, be sure to free up any resources
allocated for it.  The normal exit case handles this correctly so we
use it as well for errors.

Submitted by:	pjd
Obtained from:	Coverity Prevent
2005-05-12 22:35:08 +00:00
Mark Santcroos
8518ed9ecd Simplify the ACPI taskqueue implementation. Use a thread queue type instead
of swi. This allows us to use the taskqueue_thread_* functions instead of
rolling our own. It also avoids a double trip through the queue.

Submitted by:	njl
Reviewed by:	sam
2005-05-09 07:34:04 +00:00
Nate Lawson
98cc161947 Add the tunable "debug.acpi.max_threads" to allow users to set the
number of task threads to start on boot.  Go back to a default of 3
threads to work around lost battery state problems.  Users that need
a setting of 1 can set this via the tunable.  I am investigating the
underlying issues and this tunable can be removed once they are solved.

MFC after:	2 days
2005-04-21 06:13:48 +00:00
Mark Santcroos
b3919c8d96 Use AcpiUtStrupr() instead of strupr() as the latter will disappear in
future versions of acpica.

MFC after:	2 weeks
2005-04-14 06:50:13 +00:00
John Baldwin
b460c6f86b Probe PCI link devices early so that we turn them all off via _DIS before
we start turning any of them back on again.  This works around a bug in
some BIOSen that alias two different link devices for APIC vs ATPIC modes
onto the same physical hardware link.

Submitted by:	njl
Tested by:	Antoine Brodin antoine dot brodin at laposte dot net
2005-04-14 06:45:24 +00:00
Nate Lawson
0a133d67f3 Set CPU speed to 100% in acpi_throttle attach. This is needed for some
systems that boot with this value at the lowest setting.  Change the
default boot config back to "leave frequency as BIOS set it".  Also, fix
buglet where acpi_throttle wouldn't be used if p4tcc was present but
disabled by the user.

MFC after:	1 week
2005-04-10 20:04:30 +00:00
Nate Lawson
f2d942579b Advertise that we can handle unified SMP control of processor power
states, idling, etc.  This has been supported since the cpufreq import.
2005-04-10 19:21:42 +00:00
Nate Lawson
bce9288570 Fix support for _PDC by using the proper version/length format for the
buffer.  Also, reference the Intel document where the _PDC values were
found.  This now supports ACPI-assisted SpeedStep on my borrowed T42.
2005-04-10 19:07:08 +00:00
Nate Lawson
cb3f3e5c9b Revert part of 1.19. We do want to set the count to 0 since otherwise
it would give false info to other parts of the driver.
2005-04-07 17:33:22 +00:00
John Baldwin
fbe648c9b8 Don't free the _PSS buffer until after we check to see if we have no valid
states as otherwise we will try to free the buffer twice.
2005-04-05 19:39:44 +00:00
Nate Lawson
b29224c2a0 Add the acpi_get_features() method. This method is called on child drivers
to see what features they may support before calling identify/probe/attach.
This is necessary because the ACPI 3.0 spec requires driver support be
advertised before running any methods.  For now, the flags are as specified
in for the _PDC and _OSC methods but we can support private flags as needed.

Add an implementation of this for acpi_cpu.  It checks all its children
(notably cpufreq drivers) and calls the _PDC method to report the results.
2005-04-04 15:46:57 +00:00
Nate Lawson
965a34fb62 Always free the returned env pointer even it doesn't indicate we're in
verbose mode.

Found by:	Coverity Prevent (via sam)
2005-03-31 19:07:26 +00:00
Nate Lawson
ca2c69c8ef Clean up resources properly if acpi_perf fails to attach. First, change
acpi_bus_alloc_gas() to delete the resource it set if alloc fails.  Then,
change acpi_perf to delete the resource after releasing it if alloc fails.
This should make probe and attach both fully restartable if either fails.
2005-03-27 22:38:28 +00:00
Nate Lawson
b8a1664840 Serialize task queue by starting only one thread instead of three. This
may help with various interdependencies between subsystems.  More testing
is needed to understand what the underlying issues are here.

Tested by:	Juho Vuori
MFC after:	2 days
2005-03-27 21:30:33 +00:00
Nate Lawson
43ce1c7762 If a device_add_child fails (i.e. low memory situation), be sure to free
the unused ivars also.

Submitted by:	pjd
Obtained from:	Coverity Prevent analysis
2005-03-27 03:37:43 +00:00
Nate Lawson
55fa5feab7 Check for invalid frequencies after parsing the package. Keep a running
count of valid frequencies and use that as the final package count, don't
give up when the first invalid state is found.  Also, add 0x9999 and expand
our upper check to >= 0xffff Mhz [2].

Submitted by:	Bruno Ducrot, Jung-uk Kim [2]
2005-03-26 17:30:34 +00:00
Nate Lawson
8b28b622f7 Add support for bus_delete_resource() and make acpi_bus_alloc_gas() do
this before setting a new resource.
2005-03-22 20:00:57 +00:00
Nate Lawson
6638c61aa6 Attach acpi_perf early. Especially when it is being used to provide info
to other devices, it needs to be attached first.  (Multi-pass newbus
probes would be a better solution.)
2005-03-20 03:51:18 +00:00
Nate Lawson
e33bea8d9e Add the acpi_ec_read and write methods. This allows an external driver
(like an EC/SMbus controller) to access the EC address space.  Access
is synchronized by the EcLock/Unlock routines in EcSpaceHandler().

Tested by:	Hans Petter Selasky
2005-03-20 01:27:27 +00:00
Poul-Henning Kamp
be1bf4d2b8 s/SLIST/STAILQ/
/imp/a\
pointy hat
.
2005-03-18 11:57:44 +00:00
Nate Lawson
8f76495941 Introduce a general name for the previously cmbat-only ioctls. It has the
same value as the previous ioctls so no binary change.  Also, make a few
style changes to reduce diffs to my tree.

Loosely based on code from:	Hans Petter Selasky
2005-03-17 22:42:49 +00:00
John Baldwin
18e6466b0f - If we fail to find an entry in the PRT, output a warning message.
- Fix a bug in the same condition where we forgot to drop the ACPI pcib
  lock.  This fixes hangs after the pcib0 attach on some machines.

Tested by:	sos (2)
2005-03-08 17:22:11 +00:00
Nate Lawson
5e517fee01 On i386 platforms at least, ACPI throttling is accomplished by the chipset
modulating the STPCLK# pin based on the duty cycle.  Since p4tcc uses the
same mechanism (but internal to the CPU), we triggered a hang on some
systems at low frequencies when both were in use.  Now, disable
acpi_throttle when p4tcc is also present.

Tested by:	Kevin Oberman
2005-03-04 18:59:54 +00:00
Nate Lawson
0716d65cef Check for some impossible frequencies that some systems use to indicate
they don't actually support Px states.
2005-03-04 05:29:56 +00:00
David E. O'Brien
dad97fee58 Fix SCM ID's. 2005-03-02 09:22:34 +00:00
Nate Lawson
2d81061879 Protect acpivar.h with _KERNEL. No user parts inside currently. 2005-03-02 04:36:24 +00:00
Nate Lawson
a885159fea Protect against multiple includes and use _KERNEL to protect the PCI fns. 2005-02-28 05:39:34 +00:00
Nate Lawson
97d31723e7 Make a pass through all drivers checking specs for desired behavior on
SMP systems.  It appears all drivers except ichss should attach to each
CPU and that settings should be performed on each CPU.  Add comments about
this.  Also, add a guard for p4tcc's identify method being called more than
once.
2005-02-27 02:43:02 +00:00
Nate Lawson
f81de92f96 Don't bother with cpufreq_register if we're info-only.
Suggested by:	Jung-uk Kim
2005-02-26 22:09:05 +00:00
Nate Lawson
ac8671f18f Remove unused variable.
Noticed by:	Coverity tool
2005-02-25 22:01:58 +00:00
Nate Lawson
f45fc848c5 Instead of assuming units of bytes, it seems more likely that this is
a bitfield.
2005-02-25 16:57:34 +00:00
Nate Lawson
2fe912df6b If a register width is less than 8, assume the BIOS author thought it was
in units of bytes and adjust accordingly.  This is found at least on the
Sony PCG-505BX.
2005-02-23 03:20:00 +00:00
John Baldwin
af2b9fec22 Add a entry for the Compaq R3000Z to indicate that it has the weird MADT
IRQ 0 quirk.
2005-02-22 21:54:20 +00:00
John Baldwin
373dd87688 - Add a new quirk to indicate that pin 0 of the first I/O APIC is really
IRQ 0 and not an ExtINT pin.  The MADT enumerators ignore the PC-AT flag
  and ignore overrides that map IRQ 0 to pin 2 when this quirk is present.
- Add a block comment above the quirks to document each quirk so that we
  can use more verbose descriptions quirks.

MFC after:	2 weeks
2005-02-22 21:52:52 +00:00
Nate Lawson
0db8fa8984 Increase the maximum to wait for a transition from 1 to 10 ms. In some
modes, systems may take longer.  If the status values don't match, try
matching just the lowest 8 bits if no bits above 8 are set in the desired
value.  The IBM R32 has other bits set in the status register that are
irrelevant to the expected value.
2005-02-22 06:34:53 +00:00
Nate Lawson
0dc1b976eb Support disabling individual cpufreq drivers with hints, e.g.,
hint.ichss.0.disabled="1"
2005-02-22 06:31:45 +00:00
Nate Lawson
a1adf35e65 Set the start of the cooling time later on, when we're actually performing
the switch.  Other interim tests (i.e., for minimum runtime) could
invalidate the start time.  This fixes transitions to cooler states in that
now they go to the next active state (_AC0 -> _AC1) instead of going
straight to off (_AC0 -> off).

Submitted by:	Alexandre "Sunny" Kovalenko (Alex.Kovalenko / verizon.net)
2005-02-22 00:40:13 +00:00
Nate Lawson
1395b555de Since the GPE handler is directly called by ACPI-CA and it may have unknown
locks held, specify the ACPI_ISR flag to keep it from acquiring any more
mutexes (which could potentially sleep.)  This should fix "could sleep"
warning messages on the following path:

    msleep()
    AcpiOsWaitSemaphore()
    AcpiUtAcquireMutex()
    AcpiDisableGpe()
    EcGpeHandler()
    AcpiEvGpeDispatch()
    AcpiEvGpeDetect()
    AcpiEvGpeDetect()
    AcpiEvSciXruptHandler()
2005-02-21 23:38:41 +00:00
Nate Lawson
28d7170f1c Add a new field to struct cf_setting for special values. These are driver-
specific values that other components may want to use.  Add support to
acpi_perf(4) to export the control and status values via this field.
2005-02-19 06:13:26 +00:00
Nate Lawson
e94a0c1a18 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.
2005-02-18 00:23:36 +00:00
Nate Lawson
8f118e25ec Check for the address space type first before validating it. In particular,
we want to return EOPNOTSUPP for FFixedHW no matter what the address.

Submitted by:	Bruno Ducrot
2005-02-17 19:00:14 +00:00
Nate Lawson
ededc31dd1 The correct error value for not having enough storage is E2BIG, not
ENOMEM.  The manpage and ichss(4) are correct.
2005-02-17 01:02:58 +00:00
Nate Lawson
39da3eb359 Allow users to manually override quirks with the tunable "debug.acpi.quirks".
Suggested by:	Jung-uk Kim
2005-02-13 20:10:28 +00:00
Nate Lawson
e22cd41c01 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.
2005-02-13 18:49:48 +00:00
Nate Lawson
3bd74b84f5 Be sure to register with cpufreq(4). On systems that only supported
throttling, neglecting to do this kept the sysctls from appearing.
Attach an acpi_throttle device to each CPU that supports it.
Don't add a device if the P_BLK is invalid or if _PTC is not present.
This removes extraneous probe/attach failure messages on some machines.
Make the cpu throttle state local to the softc to account for partial
successes when changing the clock rate on MP machines.
2005-02-13 05:34:52 +00:00
Nate Lawson
8b39b8ce63 Attach an acpi_perf device for every processor that offers the right
methods.
2005-02-13 05:25:27 +00:00
Nate Lawson
8b888c66d7 Remove handling _PSS notifies from acpi_cpu and let acpi_perf handle them. 2005-02-07 04:03:06 +00:00
Nate Lawson
8c5468e3f5 Remove acpi throttling support from the acpi_cpu(4) driver now that this
is supported by acpi_throttle(4).
2005-02-06 21:10:19 +00:00
Nate Lawson
7150dfc7e5 Break out acpi throttling support into a new relative cpufreq driver,
acpi_throttle(4).
2005-02-06 21:09:51 +00:00
Nate Lawson
3cc2f17689 Notify the OS that we're taking over Px states in acpi_perf(4) instead of
doing it in the cpu driver.  The previous code was incorrect anyway since
this value controls Px states, not throttling as the comment said.  Since
we didn't support Px states before, there was no impact.  Also, note that
we delay the write to SMI_CMD until after booting is complete since it
sometimes triggers a change in the frequency and we want to have all
drivers ready to detect/handle this.
2005-02-06 20:12:28 +00:00
Nate Lawson
3045c8af3f Staticize the legacy cpu devclasses and revert the name for the acpi_cpu
devclass.  As pointed out by dfr@, devclasses don't have to share the same
linkage if multiple drivers have the same name.  Newbus should match the
devclasses based on name and allocate non-conflicting unit numbers.
2005-02-06 07:36:08 +00:00
Nate Lawson
76ce4cc456 Convert to the new GAS APIs to allow for detach in the future. Also, check
the PERF_CTRL register in our probe method so that we can tell earlier
that another driver should handle this device due to FFixedHW.  This avoids
scaring users when attach failed when we really wanted probe to fail.
2005-02-05 22:30:57 +00:00
Nate Lawson
f4eb041868 Convert to the new GAS API so that we can free registers in the future. 2005-02-05 22:29:03 +00:00
Nate Lawson
e1c4bf3f42 Convert the acpi_bus_alloc_gas() and acpi_PkgGas() APIs to output the memory
type.  This is needed if the resource is to be released later.  The RID is
still also present, though less necessary since rman_get_rid() can be used
to obtain it from the resource.
2005-02-05 22:28:36 +00:00
Nate Lawson
26d5f7dfa7 Don't print out a failure message when an attach for FFixedHW fails.
Instead, just fail to attach so another hardware-specific driver can
claim the device.  Also, clean up some small memory leaks in the failure
case.
2005-02-04 18:09:01 +00:00
Nate Lawson
b68b14adaf Return a special status of "not supported" for functional fixed hardware
since this type of register should be handled by another driver.
2005-02-04 18:07:03 +00:00
Nate Lawson
7d3a06201d Make the devclass static for now until deciding whether to share them. 2005-02-04 07:25:44 +00:00
Nate Lawson
6cb2040baf Add the ACPI Performance states driver. This driver offers two or more
settings as exported via the ACPI _PSS method.  OEMs use this interface
to encapsulate chipset or processor-specific methods (e.g., SpeedStep or
Powernow) and export their settings in a standard way.  On systems that
have valid ACPI Performance states and a hardware-specific driver (e.g.,
ichss), acpi_perf(4) is preferred.
2005-02-04 05:45:07 +00:00
Nate Lawson
98aa9cd052 Update the CPU attachments to return CPU_IVAR_PCPU as well as pass on
appropriate requests to any children.
2005-02-04 05:36:40 +00:00
Nate Lawson
286fceb541 Consistently use pcib for a printf. 2005-01-27 20:49:59 +00:00
John Baldwin
b0977ecfd7 Don't create new-bus resources for ACPI extended IRQ resources that are
producers rather than consumers as new-bus resources only handle consumed
resources.  We already do this for the other ACPI resource types that
support the producer/consumer attribute.
2005-01-18 20:21:36 +00:00
John Baldwin
5e15a08100 For the sake of consistency, look up link devices relative to the root
object (/) rather than the pci bus object when walking the _PRT to force
attach devices.  We already look up relative to the root object when doing
interrupt routing.

Suggested by:	njl
2005-01-18 20:20:32 +00:00
John Baldwin
94b3af82c1 - Add support for link devices where _CRS just outright fails to execute.
For such devices, we require _PRS to exist and we warn if any of the
  resources in _PRS are not IRQ resources (since we'll have no way of knowing
  which of those resources to use without a working _CRS).  When it does
  come time to set resources, we build up a resource buffer from scratch
  as we do for devices with _CRS that only have IRQ resources.
- Fix a bug with setting extended IRQ resources where we set the IRQ value
  in the wrong resource structure meaning that whichever IRQ was listed in
  _PRS was used instead.  This might fix some weird issues on certain boxes
  where IRQs > 16 don't seem to work when using ACPI.
- Fix a bug with how we walked the resource buffer after _SRS to call
  config_intr() in that the 'end' variable was not properly updated, so we
  could either terminate the loop early or loop after the end of the
  buffer.

Tested by:	pjd
2005-01-18 20:18:46 +00:00
Nate Lawson
33332dc271 In total violation of at least 4 sections in the ACPI spec, some systems
place device objects in \ (in this case, PCI links.)  Work around this by
starting our probe from \.  To avoid attaching system scope objects,
explicitly skip them.  (I think it's an ACPI-CA bug that \_SB and \_TZ have
device and thermal object types.)  Thanks to pjd@ for testing.

MFC after:	2 weeks
2005-01-08 09:10:20 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Nate Lawson
2f3f3112c8 Minor cleanup: Reduce stack usage in probe method. Outdent probe. Use
TRUE/FALSE instead of 1/0 for booleans.  Remove trailing and extra whitespace.
2004-12-27 05:42:32 +00:00
Nate Lawson
d05fa56bb3 Remove trailing whitespace. 2004-12-27 05:36:47 +00:00
Nate Lawson
8c702862e4 Only use the current value if there's one IRQ. Some systems return
multiple IRQs (which is nonsense for _CRS) when the link hasn't been
programmed.  Before, this was a KASSERT.  A ServerWorks system was
seen returning IRQs of 0, 2 in response to _CRS before link setup.
Thanks to sam@ for quick testing and turnaround on this.

Tested by:	sam
2004-12-20 10:46:56 +00:00
Nate Lawson
54640fac34 Only report a critical battery level once until it's gone non-critical.
An improvement would be to check all batteries for critical state before
printing a message.

Reported by:	Kevin Oberman (oberman at es net)
2004-12-20 05:03:41 +00:00