Commit Graph

693 Commits

Author SHA1 Message Date
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