diff options
author | randyf <none@none> | 2007-10-20 16:00:42 -0700 |
---|---|---|
committer | randyf <none@none> | 2007-10-20 16:00:42 -0700 |
commit | 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd (patch) | |
tree | 358c576f885c00d42a760d9e35e5b66e77209fe2 /usr/src/uts/i86pc/io/pci/pci.c | |
parent | 10b3fbf593a6678eec9b50a01903ef4eb73111e4 (diff) | |
download | illumos-gate-2df1fe9ca32bb227b9158c67f5c00b54c20b10fd.tar.gz |
PSARC/2005/469 X86 Energy Star compliance
PSARC/2006/632 PSMI extension for state save and restore
6330209 nge needs to support DDI_SUSPEND/DDI_RESUME
6381827 Suspend to RAM on x86
6393154 audio810 needs to support DDI_SUSPEND/DDI_RESUME
6397047 fd, fdc needs to support Suspend/Resume
6401974 cannot enter S3 with ohci PME enable set on Tyan 2865 with Sun or Tyan 2.01 BIOS
6422613 memscrubber doesn't re-acquire lock before CALLB_CPR_EXIT
6455736 ata/dadk/cmdk should support DDI_SUSPEND/DDI_RESUME
6511370 CPR on SPARC regression
6586018 TODOP Macros in i86pc/sys/machclock.h not in sun4u/sun4v equivilent (Sparc only)
6610124 It takes more than 3 minutes after printing "pci_pre_resume nv_sata:0"
6617143 powerd/pmconfig emits a different default message for an existing on or off action.
--HG--
rename : usr/src/cmd/power/power.conf => usr/src/cmd/power/power.conf.sparc
Diffstat (limited to 'usr/src/uts/i86pc/io/pci/pci.c')
-rw-r--r-- | usr/src/uts/i86pc/io/pci/pci.c | 68 |
1 files changed, 50 insertions, 18 deletions
diff --git a/usr/src/uts/i86pc/io/pci/pci.c b/usr/src/uts/i86pc/io/pci/pci.c index 1af5ca17fb..7cd0b38d4e 100644 --- a/usr/src/uts/i86pc/io/pci/pci.c +++ b/usr/src/uts/i86pc/io/pci/pci.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -221,6 +221,16 @@ pci_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) */ int instance = ddi_get_instance(devi); pci_state_t *pcip = NULL; + switch (cmd) { + case DDI_ATTACH: + break; + + case DDI_RESUME: + return (DDI_SUCCESS); + + default: + return (DDI_FAILURE); + } if (ddi_prop_update_string(DDI_DEV_T_NONE, devi, "device_type", "pci") != DDI_PROP_SUCCESS) { @@ -285,23 +295,30 @@ pci_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) pci_state_t *pcip; pcip = ddi_get_soft_state(pci_statep, ddi_get_instance(devi)); - if (pcip->pci_fmcap & DDI_FM_ERRCB_CAPABLE) { - ddi_fm_handler_unregister(devi); - pci_ereport_teardown(devi); - } - mutex_destroy(&pcip->pci_peek_poke_mutex); - mutex_destroy(&pcip->pci_err_mutex); - ddi_fm_fini(devi); - /* Uninitialize pcitool support. */ - pcitool_uninit(devi); - /* Uninitialize hotplug support on this bus. */ - (void) pcihp_uninit(devi); + switch (cmd) { + case DDI_DETACH: + if (pcip->pci_fmcap & DDI_FM_ERRCB_CAPABLE) { + ddi_fm_handler_unregister(devi); + pci_ereport_teardown(devi); + } + mutex_destroy(&pcip->pci_peek_poke_mutex); + mutex_destroy(&pcip->pci_err_mutex); + ddi_fm_fini(devi); /* Uninitialize pcitool support. */ + pcitool_uninit(devi); - ddi_soft_state_free(pci_statep, instance); + /* Uninitialize hotplug support on this bus. */ + (void) pcihp_uninit(devi); - return (DDI_SUCCESS); + ddi_soft_state_free(pci_statep, instance); + + return (DDI_SUCCESS); + case DDI_SUSPEND: + return (DDI_SUCCESS); + default: + return (DDI_FAILURE); + } } static int @@ -510,6 +527,7 @@ pci_ctlops(dev_info_t *dip, dev_info_t *rdip, int rn; int totreg; pci_state_t *pcip; + struct attachspec *asp; switch (ctlop) { case DDI_CTLOPS_REPORTDEV: @@ -537,8 +555,8 @@ pci_ctlops(dev_info_t *dip, dev_info_t *rdip, *(int *)result = 0; if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, rdip, - DDI_PROP_DONTPASS, "reg", (int **)&drv_regp, - ®len) != DDI_PROP_SUCCESS) { + DDI_PROP_DONTPASS, "reg", (int **)&drv_regp, + ®len) != DDI_PROP_SUCCESS) { return (DDI_FAILURE); } @@ -578,6 +596,21 @@ pci_ctlops(dev_info_t *dip, dev_info_t *rdip, pci_common_peekpoke, &pcip->pci_err_mutex, &pcip->pci_peek_poke_mutex)); + /* for now only X86 systems support PME wakeup from suspended state */ + case DDI_CTLOPS_ATTACH: + asp = (struct attachspec *)arg; + if (asp->cmd == DDI_RESUME && asp->when == DDI_PRE) + if (pci_pre_resume(rdip) != DDI_SUCCESS) + return (DDI_FAILURE); + return (ddi_ctlops(dip, rdip, ctlop, arg, result)); + + case DDI_CTLOPS_DETACH: + asp = (struct attachspec *)arg; + if (asp->cmd == DDI_SUSPEND && asp->when == DDI_POST) + if (pci_post_suspend(rdip) != DDI_SUCCESS) + return (DDI_FAILURE); + return (ddi_ctlops(dip, rdip, ctlop, arg, result)); + default: return (ddi_ctlops(dip, rdip, ctlop, arg, result)); } @@ -679,8 +712,7 @@ pci_initchild(dev_info_t *child) * Support for the "command-preserve" property. */ command_preserve = ddi_prop_get_int(DDI_DEV_T_ANY, child, - DDI_PROP_DONTPASS, - "command-preserve", 0); + DDI_PROP_DONTPASS, "command-preserve", 0); command = pci_config_get16(config_handle, PCI_CONF_COMM); command &= (command_preserve | PCI_COMM_BACK2BACK_ENAB); command |= (pci_command_default & ~command_preserve); |