View | Details | Raw Unified | Return to bug 204413 | Differences between
and this patch

Collapse All | Expand All

(-)a/drivers/pci/pci.c (-1 / +8 lines)
Lines 1981-1987 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); Link Here
1981
 */
1981
 */
1982
void pcie_clear_root_pme_status(struct pci_dev *dev)
1982
void pcie_clear_root_pme_status(struct pci_dev *dev)
1983
{
1983
{
1984
	pcie_capability_set_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
1984
	int ret;
1985
1986
	ret = pcie_capability_set_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
1987
	if (ret)
1988
		dev_info(&dev->dev, "%s: returned %d\n", __func__, ret);
1985
}
1989
}
1986
1990
1987
/**
1991
/**
Lines 2003-2008 bool pci_check_pme_status(struct pci_dev *dev) Link Here
2003
2007
2004
	pmcsr_pos = dev->pm_cap + PCI_PM_CTRL;
2008
	pmcsr_pos = dev->pm_cap + PCI_PM_CTRL;
2005
	pci_read_config_word(dev, pmcsr_pos, &pmcsr);
2009
	pci_read_config_word(dev, pmcsr_pos, &pmcsr);
2010
	dev_info(&dev->dev, "%s: pmcsr=0x%04x\n", __func__, pmcsr);
2006
	if (!(pmcsr & PCI_PM_CTRL_PME_STATUS))
2011
	if (!(pmcsr & PCI_PM_CTRL_PME_STATUS))
2007
		return false;
2012
		return false;
2008
2013
Lines 2108-2113 static void __pci_pme_active(struct pci_dev *dev, bool enable) Link Here
2108
		return;
2113
		return;
2109
2114
2110
	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
2115
	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
2116
	if (!enable)
2117
		dev_info(&dev->dev, "disabling PME, current status=0x%04x\n", pmcsr);
2111
	/* Clear PME_Status by writing 1 to it and enable PME# */
2118
	/* Clear PME_Status by writing 1 to it and enable PME# */
2112
	pmcsr |= PCI_PM_CTRL_PME_STATUS | PCI_PM_CTRL_PME_ENABLE;
2119
	pmcsr |= PCI_PM_CTRL_PME_STATUS | PCI_PM_CTRL_PME_ENABLE;
2113
	if (!enable)
2120
	if (!enable)
(-)a/drivers/pci/pcie/pme.c (-2 / +17 lines)
Lines 203-209 static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) Link Here
203
203
204
 out:
204
 out:
205
	if (!found)
205
	if (!found)
206
		pci_info(port, "Spurious native interrupt!\n");
206
		pci_info(port, "Spurious native interrupt from device %02x:%02x.%d!\n",
207
			 busnr, PCI_SLOT(devfn), PCI_FUNC(devfn));
207
}
208
}
208
209
209
/**
210
/**
Lines 215-221 static void pcie_pme_work_fn(struct work_struct *work) Link Here
215
	struct pcie_pme_service_data *data =
216
	struct pcie_pme_service_data *data =
216
			container_of(work, struct pcie_pme_service_data, work);
217
			container_of(work, struct pcie_pme_service_data, work);
217
	struct pci_dev *port = data->srv->port;
218
	struct pci_dev *port = data->srv->port;
219
	int count = 0;
218
	u32 rtsta;
220
	u32 rtsta;
221
	int ret;
219
222
220
	spin_lock_irq(&data->lock);
223
	spin_lock_irq(&data->lock);
221
224
Lines 223-229 static void pcie_pme_work_fn(struct work_struct *work) Link Here
223
		if (data->noirq)
226
		if (data->noirq)
224
			break;
227
			break;
225
228
226
		pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
229
		if (count++ > 5000) {
230
			dev_info(&port->dev, "breaking out of PME polling loop\n");
231
			break;
232
		}
233
234
		ret = pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
235
		dev_info(&port->dev, "ret=%d, rtsta=0x%08x\n", ret, rtsta);
227
		if (rtsta == (u32) ~0)
236
		if (rtsta == (u32) ~0)
228
			break;
237
			break;
229
238
Lines 233-238 static void pcie_pme_work_fn(struct work_struct *work) Link Here
233
			 * pending PMEs, the status will be set again.
242
			 * pending PMEs, the status will be set again.
234
			 */
243
			 */
235
			pcie_clear_root_pme_status(port);
244
			pcie_clear_root_pme_status(port);
245
			ret = pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
246
			dev_info(&port->dev, "after clearing: ret=%d, rtsta=0x%08x\n", ret, rtsta);
236
247
237
			spin_unlock_irq(&data->lock);
248
			spin_unlock_irq(&data->lock);
238
			pcie_pme_handle_request(port, rtsta & 0xffff);
249
			pcie_pme_handle_request(port, rtsta & 0xffff);
Lines 386-391 static int pcie_pme_suspend(struct pcie_device *srv) Link Here
386
	bool wakeup;
397
	bool wakeup;
387
	int ret;
398
	int ret;
388
399
400
	dev_info(&srv->port->dev, "PME suspend\n");
401
389
	if (device_may_wakeup(&port->dev)) {
402
	if (device_may_wakeup(&port->dev)) {
390
		wakeup = true;
403
		wakeup = true;
391
	} else {
404
	} else {
Lines 414-419 static int pcie_pme_resume(struct pcie_device *srv) Link Here
414
{
427
{
415
	struct pcie_pme_service_data *data = get_service_data(srv);
428
	struct pcie_pme_service_data *data = get_service_data(srv);
416
429
430
	dev_info(&srv->port->dev, "PME resume\n");
431
417
	spin_lock_irq(&data->lock);
432
	spin_lock_irq(&data->lock);
418
	if (data->noirq) {
433
	if (data->noirq) {
419
		struct pci_dev *port = srv->port;
434
		struct pci_dev *port = srv->port;

Return to bug 204413