Commit Graph

757 Commits

Author SHA1 Message Date
Nate Lawson
4c452688a9 Check in file missed in last commit. It made it into the MFC properly
though.
2006-06-12 17:13:57 +00:00
Nate Lawson
d85e6785c5 By default, don't disable ACPI during reboot. This appears to hang some
systems.  Introduce a new sysctl "hw.acpi.disable_on_reboot" that allows
users to re-enable the old behavior in case it's needed for some systems.
We never disable in the power-off path.

Original approach submitted by Alexander Logvinov <abuse@akavia.ru> with
reworking by Jung-uk Kim and myself.
2006-06-11 20:31:41 +00:00
Nate Lawson
197b4dcc64 Minor sysctl cleanup. The RW flag means read|write and so it is redundant
to add the RD flag.  Also, the debug node does not need to be writable.
2006-06-10 08:04:38 +00:00
Nate Lawson
c73930f3d6 Clean up many of the debugging messages and move them under bootverbose.
Move the code for printing timer statistics into a test function instead of
an ifdef (accessible via the debug.acpi.hpet_test tunable).  Also use defines
for register offsets instead of magic values.

Courtesy of:	slow flight to HK
2006-06-04 08:04:19 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
John Baldwin
70bc2d3f4f Fixup some comments to allow for the fact that PCI domains are not specific
to Alpha hoses.
2006-05-11 22:13:21 +00:00
Nate Lawson
da72d149ef Don't attach special devices in the order they appear in the AML tree.
If the embedded controller exists before the sysresource devices, for
example, it will be attached first.  Instead, let the normal device
order function work as we first desired. [1]

There still remained a problem where we couldn't allocate resources in
acpi0 that were passed up by the sysresource pseudo-devices.  These
devices had to probe/attach first to give their resources to acpi, then
acpi would allocate them before probing/attaching other devices.  To
work around this, we attach them from acpi_sysres_alloc().  A better
approach would be to implement multi-pass probe/attach in newbus but
that's a much bigger task.

Suggested by:	jhb [1]
Hardware from:	Centaur Technologies
MFC after:	1 week
2006-05-07 03:28:10 +00:00
Jung-uk Kim
2237f11344 Remove unnecessary assignment.
Coverity ID:	553
Found by:	Coverity Prevent
2006-04-21 19:06:29 +00:00
Warner Losh
c3f861f491 Set the rid for the resoruce obtained from rman_reserve_resource. 2006-04-20 04:21:27 +00:00
Maxim Konovalov
a5e8745ad9 o Correct a path to include. 2006-04-16 15:35:12 +00:00
Mitsuru IWASAKI
1b9518293e Oops, untested code was included accidentally.
Fixed.
2006-04-15 16:10:53 +00:00
Mitsuru IWASAKI
858a52f464 Import ACPI Dock Station support. Note that this is still very young.
Additional detach implementaions (or maybe improvement) for other
deivce drivers is required.

Reviewed by:	njl, imp
MFC after:	1 week
2006-04-15 12:31:34 +00:00
Nate Lawson
483568c509 Fix an off-by-one error in the port range detection. Cleanup some old
whitespace.
2006-04-04 02:22:38 +00:00
Scott Long
cadfc102f1 Revert to using acpi_max_threads instead of the hardcoded value of '3'. 2006-03-30 19:22:45 +00:00
Nate Lawson
6e8e1dbdba Fix printf arg on 64-bit arch by casting to an int. The IO port is never
more than a couple digits anyway.

Pointy hat to:	njl
2006-03-29 18:47:59 +00:00
Nate Lawson
dbcb35ffb9 Add a blacklist for bad IO ports that AML should never touch. It seems
some systems were designed so that AML writes to various resources shared
with OS drivers, including the RTC, PIC, PCI, etc.  These writes could
collide with writes by the OS and should never be performed.  For now, we
print a message if such an access occurs, but do not block it.  To block
the access, the tunable "debug.acpi.block_bad_io" can be set to 1.  In the
future, we will flip the switch and this will become the default.

Information about this problem was found in Microsoft KB 283649.  They
block IO accesses if the BIOS indicates via _OSI that it is Windows 2001
or higher.  They always block accesses to the PIC, cascaded PIC, and ELCRs,
no matter how old the BIOS.
2006-03-29 06:41:56 +00:00
Nate Lawson
87a500cd3b Add reset register support. This is the only method to reboot some new
systems (blade servers).  On most systems, this is implemented as an IO
write to the SMI port and the BIOS generates the actual reset.

PR:		kern/94939
Submitted by:	dodell@ixsystems.com
Reviewed by:	jhb
MFC after:	3 weeks
2006-03-29 06:30:47 +00:00
Nate Lawson
987b1ad6d5 Remove unused variable.
Coverity ID:	548
Found by:	Coverity Prevent
2006-02-21 03:16:58 +00:00
Nate Lawson
6dd47e5b2a Remove unused variable.
Coverity ID:	546
Found by:	Coverity Prevent
2006-02-21 03:15:26 +00:00
John Baldwin
14450110f3 Make the ACPI and OpenFirmware PCI bus drivers subclasses of the generic
PCI bus driver.
2006-01-20 22:01:34 +00:00
Scott Long
0f92108d32 Add the following to the taskqueue api:
taskqueue_start_threads(struct taskqueue **, int count, int pri,
			const char *name, ...);

This allows the creation of 1 or more threads that will service a single
taskqueue.  Also rework the taskqueue_create() API to remove the API change
that was introduced a while back.  Creating a taskqueue doesn't rely on
the presence of a process structure, and the proc mechanics are much better
encapsulated in taskqueue_start_threads().  Also clean up the
taskqueue_terminate() and taskqueue_free() functions to safely drain
pending tasks and remove all associated threads.

The TASKQUEUE_DEFINE and TASKQUEUE_DEFINE_THREAD macros have been changed
to use the new API, but drivers compiled against the old definitions will
still work.  Thus, recompiling drivers is not a strict requirement.
2006-01-14 01:55:24 +00:00
Bruno Ducrot
ab033fa0e3 * fix bst.status. We mark some bits, but forgot to reset all of them
before.  The symptom is that the battery inform us its charge and discharge
  at the same time...

* fix bst.rate to correctly output the (dis)charging rate.  We'll use
  the current average over one minute command and not the at_rate command.
  Note that this method is not correct if the capacity_mode is set, but
  since we don't set it ourself, it is not a problem.

  The at_rate do not give the actual rate but is used to compute the
  estimated time for (dis)charging a battery.  We should actually
  write an estimation of the actual rate using at_rate cmd and then
  perform a read to the various estimators.

Approved by:	njl
MFC after:	2 days
2006-01-12 21:56:37 +00:00
John Baldwin
04dda605c5 - Make pcib_devclass private to sys/dev/pci/pci_pci.c and change all the
various pcib drivers to use their own private devclass_t variables for
  their modules.
- Use the DEFINE_CLASS_0() macro to declare drivers for the various pcib
  drivers while I'm here.
2006-01-06 19:22:19 +00:00
John Baldwin
8dc0e02023 Be a little more forgiving of lame BIOS writers. If a link device that
doesn't have any actual interrupts is listed in a _PRT entry, only print
a warning rather than panic'ing when we walk the _PRT's to build up count
of entries that reference a given link (the counts are used as weights so
that we can attempt to balance the load across IRQs used by link devices).
Instead, only panic if we attempt to use the _PRT entry to route an
interrupt for a device.

PR:		i386/89545
Tested by:	anders
2006-01-06 16:14:32 +00:00
John Baldwin
8294689115 Release the pci_link acpi serial lock if a link device has no actual links.
MFC after:	3 days
2006-01-03 20:19:34 +00:00
Tom Rhodes
09c00166e4 Make tv_sec a time_t on all platforms but alpha. Brings us more in line with
POSIX.  This also makes the struct correct we ever implement an i386-time64
architecture.  Not that we need too.

Reviewed by:	imp, brooks
Approved by:	njl (acpica), des (no objects, touches procfs)
Tested with:	make universe
2005-12-24 22:22:17 +00:00
John Baldwin
a1ee13ef19 Attach to the vgapci device rather than pci. 2005-12-20 22:42:16 +00:00
John Baldwin
4f9795b9fe Add a new method PCI_FIND_EXTCAP() to the pci bus interface that is used
to search for a specific extended capability.  If the specified capability
is found for the given device, then the function returns success and
optionally returns the offset of that capability.  If the capability is
not found, the function returns an error.
2005-12-20 19:57:47 +00:00
Bruno Ducrot
f9ead0fcbe Don't flood kernel logs with "invalid _PSS package" messages.
Approved by:	njl, imp (mentor)
2005-12-12 11:15:20 +00:00
Nate Lawson
31bef809aa Revert two changes I was testing regarding polling delay. 2005-12-06 14:51:55 +00:00
Nate Lawson
c4a9fa4529 Add KTR support and move some performance debugging variables in the EC
to KTR.  We're reusing the KTR_DEV level.
2005-12-06 14:47:28 +00:00
John Baldwin
f9959468bb If pci_link has been disabled via the acpi_disable tunable, then bail
immediately from acpi_pci_link_route_interrupt() since we aren't going
to have a valid pci_link device to talk to try to route interrupts.  This
fixes a page fault if you disable just pci_link.  Note that trying to use
ACPI without pci_link is probably not advised however.

MFC after:	1 week
Tested by:	Eugene Grosbein eugen at kuzbass dot ru
2005-12-05 19:50:00 +00:00
John Baldwin
d37d99c4aa Force any hardwire-routed interrupts to level trigger and active low
polarity.  Some machines route PCI IRQs to an ISA IRQ but fail to include
an interrupt override entry to set the polarity and trigger of the given
ISA IRQ in their MADT table.

PR:		usb/74989
Reported by:	Julien Gabel jpeg at thilelli dot net
MFC after:	1 week
2005-12-03 21:17:17 +00:00
John Baldwin
80f049d359 Add a missing newline to a printf.
MFC after:	1 week
2005-12-02 13:35:14 +00:00
Nate Lawson
c02106f3cc Add a locking stub to call acpi_cmbat_get_bif() now that it is directly
run from the taskqueue.  There should probably be a better way to do this
later, but this suffices for now.

Submitted by:	yongari
2005-11-26 07:36:53 +00:00
Nate Lawson
1f6e47a324 Only copy out the battery status/info if there was no error. 2005-11-24 05:23:56 +00:00
John Baldwin
ef2cda76c0 - Quiet the pci_link(4) devices so that they don't show up in dmesg now.
- Improve panic message if we fail to read the PCI bus number from a bridge
  device.
- Don't try to lookup a BIOS IRQ for a link unless the link is routed via
  an ISA IRQ since BIOSen currently only route PCI link devices via ISA
  IRQs.

Tested by:	Mathieu Prevot bsdhack at club-internet dot fr
MFC after:	1 week
2005-11-23 16:36:13 +00:00
Nate Lawson
2010798dab Try to fix problems with periodic hangs by never directly calling _BIF.
Instead, re-evaluate _BIF only when we get a notify and use the cached
results.  We also still evaluate _BIF once on boot.  Also, optimize the
init loop a little by only querying for a particular info if it's not valid.

MFC after:	2 days
2005-11-23 00:57:51 +00:00
Nate Lawson
f08e63dc4d Simplify checks for valid battery info via DeMorgan's Rule. No
functional change.
2005-11-23 00:53:01 +00:00
Hajimu UMEMOTO
4796860760 Cache the result of battery info retrieval from smbat as well
as cmbat.

Reviewed by:	njl
MFC after:	3 days
2005-11-22 03:34:09 +00:00
John Baldwin
a4104d1c3b Fix the code to look up the BIOS IRQ for a given link device by reading
the IRQ set by the BIOS in existing devices to actually get the correct
bus number of the child PCI bus.  I was not reading the bus number from
the bridge device correctly.  The __BUS_ACCESSOR() macros (from which
pcib_get_bus() is built) assume that the passed in argument is a child
device.  However, at the time I'm reading the bus there is no child
device yet, so I was passing in the pcib device as the child device.
The parent of the pcib device probably returned an error in the case of
a host bridge, thus resulting in random stack garbage for the bus number.
For PCI-PCI bridges, the bus number being used was actually the subvendor
of the PCI-PCI bridge device itself.

MFC after:	1 week
2005-11-21 22:01:16 +00:00
John Baldwin
3a6497c102 *sigh* Revert stuff that wasn't supposed to be committed. The
acpi_resource change was a minor nit offered as an early candidate for
the recent ACPICA import problem and the acpi.c change is one I need to
test still that makes the ordered probing of system devices actually work
as advertised (probe devices in order based on the type of device rather
than in the order we encounter them in the device tree).
2005-11-07 21:52:06 +00:00
John Baldwin
f25bdd3bb3 Work around at least one busted BIOS. If we get a source index in a _PRT
entry that is not zero, assume that it is really a hard-wired IRQ (commonly
used for APIC routing) and not a source index.  In practice, we've only
ever seen source indices of 0 for legitimate non-hard-wired _PRT entries.

Reviewed by:	njl
Tested by:	Alex Lyashkov shadow at psoft dot net
MFC after:	2 weeks
2005-11-07 21:48:45 +00:00
Jung-uk Kim
e8d472a7af Catch up with ACPI-CA 20051021 import 2005-11-01 22:44:08 +00:00
Scott Long
6a4810bd6d Move HPET debugging under ACPI_TIMER in order to save a bitfield. 2005-11-01 20:41:43 +00:00
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