Source
1
1
// SPDX-License-Identifier: GPL-2.0
2
2
3
3
#include <linux/pci.h>
4
4
#include <linux/acpi.h>
5
5
#include <acpi/reboot.h>
6
6
7
+
#ifdef CONFIG_PCI
7
8
static void acpi_pci_reboot(struct acpi_generic_address *rr, u8 reset_value)
8
9
{
9
10
unsigned int devfn;
10
11
struct pci_bus *bus0;
11
12
12
13
/* The reset register can only live on bus 0. */
13
14
bus0 = pci_find_bus(0, 0);
14
15
if (!bus0)
15
16
return;
16
17
/* Form PCI device/function pair. */
17
18
devfn = PCI_DEVFN((rr->address >> 32) & 0xffff,
18
19
(rr->address >> 16) & 0xffff);
19
20
pr_debug("Resetting with ACPI PCI RESET_REG.\n");
20
21
/* Write the value that resets us. */
21
22
pci_bus_write_config_byte(bus0, devfn,
22
23
(rr->address & 0xffff), reset_value);
23
24
}
25
+
#else
26
+
static inline void acpi_pci_reboot(struct acpi_generic_address *rr,
27
+
u8 reset_value)
28
+
{
29
+
pr_warn_once("PCI configuration space access is not supported\n");
30
+
}
31
+
#endif
24
32
25
33
void acpi_reboot(void)
26
34
{
27
35
struct acpi_generic_address *rr;
28
36
u8 reset_value;
29
37
30
38
if (acpi_disabled)
31
39
return;
32
40
33
41
rr = &acpi_gbl_FADT.reset_register;