Skip to content

Commit 36ad7d2

Browse files
Sinan Kayarafaeljw
authored andcommitted
ACPI: Move PCI reset to a separate function
Getting ready to factor out PCI specific code when CONFIG_PCI is unset. Create a acpi_pci_reset() that kick starts PCI specific reset. Signed-off-by: Sinan Kaya <okaya@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 7566ec3 commit 36ad7d2

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

‎drivers/acpi/reboot.c‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,27 @@
44
#include <linux/acpi.h>
55
#include <acpi/reboot.h>
66

7+
static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value)
8+
{
9+
unsigned int devfn;
10+
struct pci_bus *bus0;
11+
12+
/* The reset register can only live on bus 0. */
13+
bus0 = pci_find_bus(0, 0);
14+
if (!bus0)
15+
return;
16+
/* Form PCI device/function pair. */
17+
devfn = PCI_DEVFN((rr->address >> 32) & 0xffff,
18+
(rr->address >> 16) & 0xffff);
19+
pr_debug("Resetting with ACPI PCI RESET_REG.\n");
20+
/* Write the value that resets us. */
21+
pci_bus_write_config_byte(bus0, devfn,
22+
(rr->address & 0xffff), reset_value);
23+
}
24+
725
void acpi_reboot(void)
826
{
927
struct acpi_generic_address *rr;
10-
struct pci_bus *bus0;
11-
unsigned int devfn;
1228
u8 reset_value;
1329

1430
if (acpi_disabled)
@@ -33,17 +49,7 @@ void acpi_reboot(void)
3349
* on a device on bus 0. */
3450
switch (rr->space_id) {
3551
case ACPI_ADR_SPACE_PCI_CONFIG:
36-
/* The reset register can only live on bus 0. */
37-
bus0 = pci_find_bus(0, 0);
38-
if (!bus0)
39-
return;
40-
/* Form PCI device/function pair. */
41-
devfn = PCI_DEVFN((rr->address >> 32) & 0xffff,
42-
(rr->address >> 16) & 0xffff);
43-
printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG.\n");
44-
/* Write the value that resets us. */
45-
pci_bus_write_config_byte(bus0, devfn,
46-
(rr->address & 0xffff), reset_value);
52+
acpi_pci_reboot(rr, reset_value);
4753
break;
4854

4955
case ACPI_ADR_SPACE_SYSTEM_MEMORY:

0 commit comments

Comments
 (0)