Commit Graph

21 Commits

Author SHA1 Message Date
Nate Lawson
d4b9ff9179 Move flags into a private ivar so it can't collide with device flags.
Unify the code to disable GPEs with the enable code.  Shutdown is handled
the same way.  ACPI now does all wake/sleep prep for child devices so
now they no longer need to call external functions in the suspend/resume
path.  Add the flags to non-ACPI busses (i.e., pci).
2004-06-30 16:08:03 +00:00
Nate Lawson
30d577a014 Attach the correct handle, not the one that was just deleted. Also,
remove some duplicated code.
2004-06-24 01:57:31 +00:00
John Baldwin
81bb99d26b Now that we associate a device_t with ACPI device handles, lookup the
device associated with any PCI devices that are enumerated in the ACPI
tree when adding children to an ACPI PCI bus and remove the duplicate
ACPI-only device_t and replace the device_t associated with the handle with
the ACPI and PCI aware device_t.
2004-06-23 15:08:40 +00:00
Nate Lawson
1f36889f63 Remove accidental change. 2004-06-07 21:44:01 +00:00
Nate Lawson
45e556cc69 Avoid printing extraneous warning messages when trying to switch a device
which doesn't support ACPI power states.  Return AE_NOT_FOUND for these
cases and don't print the warning message.  Also, print the name of the
handle instead of device when unable to switch states.  The device is often
not attached at this point and so its name is NULL, which doesn't help
debugging.
2004-06-07 21:39:15 +00:00
Nate Lawson
5acd02180c Style cleanups, don't set the device description before the probe routine
has completed successfully.
2004-05-29 04:32:50 +00:00
Nate Lawson
869ec176fc Make unnecessary globals static and remove unused includes.
Pointed out by:	cscout
2004-05-06 02:18:58 +00:00
Warner Losh
1c168bb710 Fix two typos from PR: 65694
1) In pci.c, we need to check the child device's state, not the parent
   device's state.
2) In acpi_pci.c, we have to run the power state change after the acpi
   method when the old_state is > new state, not the other way around.

Submitted by: Dmitry Remesov
PR: 65694
2004-04-26 02:11:38 +00:00
Nate Lawson
916dc0e20c Only try to set the ACPI power state if the handle is valid. There was
probably no problem with this except it may have had the side effect of
registering a NULL consumer.
2004-04-14 17:46:21 +00:00
Nate Lawson
64278df5e0 Add MODULE_DEPEND entries so some of these drivers can eventually be
loaded separately from ACPI (i.e., embedded use).
2004-04-09 18:14:32 +00:00
Warner Losh
cd8b53ed2d Omnibus PCI commit:
o Save and restore bars for suspend/resume as well as for D3->D0
	  transitions.
	o preallocate resources that the PCI devices use to avoid resource
	  conflicts
	o lazy allocation of resources not allocated by the BIOS.
	o set unattached drivers to state D3.  Set power state to D0
	  before probe/attach.  Right now there's two special cases
	  for this (display and memory devices) that need work in other
	  areas of the tree.

Please report any bugs to me.
2004-04-09 15:44:34 +00:00
John Baldwin
5233e9ffda Implement an ACPI-aware pci_set_powerstate() method for PCI busses that
are enumerated in the ACPI device tree.  In addition to the normal PCI
powerstate functionality, the ACPI _PSx methods are executed and ACPI
PowerResources are switched on and off via the acpi_pwr_switch_consumer()
function.

Glanced at by:	imp, njl
2004-04-07 19:42:21 +00:00
Nate Lawson
63600cc345 Staticize pnp methods, style fixes. Remove unused variable to unbreak
kernel build.
2004-03-31 17:35:28 +00:00
Takanori Watanabe
cd284d7a6a Add ACPI path in location string for ACPI namespace aware PCI device. 2004-03-31 17:27:19 +00:00
Nate Lawson
c310653ea1 Change to acpi_{Get,Set}Integer to provide both methods. Convert all
callers to the new API.

Submitted by:	Mark Santcroos <marks@ripe.net>
2004-03-03 18:34:42 +00:00
Mitsuru IWASAKI
526b5e659d Add pci_resume() to reestablish interrupt routing after
suspend/resume.
Especially after hibernation, interrupt routing went back to initial
status on some machines.
2003-09-17 08:32:44 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Thomas Moestl
3920999db7 Add a new PCI interface method, assign_interrupt, to determine the
interrupt to be used for a device. This is intended solely for internal
use of PCI bus implementations, and exists so that PCI bus drivers
implementing special interrupt assignment methods which require
additional work at the bus level to work right can be easily derived
from the generic driver (or any other one) without resorting to hacks.

It will be used in the sparc64 ofw_pcibus driver, which will be
committed shortly.

Make use of this method in the generic implementation, and add it to
the method table of bus drivers derived from the PCI one.

Reviewed by:	imp, -hackers
2003-07-01 14:08:33 +00:00
Warner Losh
5794c59372 Move the pnp and location info into the common pci bus. Make all known
pci busses implement this.

Also minor comment smithing in cardbus.  Fix copyright to this year
with my name on it since I've been doing a lot to this file.

Reviewed by: jhb
2003-02-17 21:20:35 +00:00
John Baldwin
1d62131385 - Make pci_load_vendor_data() static and do it during MOD_LOAD instead of
when the first PCI bus attaches.
- Create /dev/pci during MOD_LOAD as well.
- Destroy /dev/pci during MOD_UNLOAD (not that you can kldunload pci, but
  might as well get the code right)
2002-09-04 03:13:16 +00:00
John Baldwin
28bf1fad05 Add an ACPI PCI bus driver that is a subclass of the generic PCI bus
driver.  This driver overrides the probe, attach, and read_ivar methods.

If the parent bridge is an ACPI PCI bridge, then the probe routine will
match, otherwise it will fail.  It tests this by seeing if it can get
the ACPI_HANDLE ivar from the bridge device.

In the attach routine, it uses pci_add_children() to add all the child
devices (but with a slightly larger ivar so it can store ACPI_HANDLE's
for child devices) and then walks through the ACPI namespace below the
bus device to cache ACPI_HANDLE's for all child devices present in the
namespace.  It does this by comparing the pci slot and function to the
address encoded in _ADR of the devices in the ACPI namespace.

The read_ivar routine passes most requests off to pci_read_ivar()
and adds a new request so that the ACPI_HANDLE for a child device can
be read.

To add proper power support the power methods can be overridden as well,
but that is not currently implemented.  Also, there are cases where a
device may show in the ACPI namespace as a PCI device that the PCI probe
does not find.  Currently such devices are ignored.

Tested on:	i386, ia64
2002-08-26 17:55:42 +00:00