ACPI: Bug compatibility for Windows on the ACPI reboot vector
[deliverable/linux.git] / drivers / acpi / reboot.c
CommitLineData
4d387043
AD
1
2#include <linux/pci.h>
3#include <linux/acpi.h>
4#include <acpi/reboot.h>
5
6void acpi_reboot(void)
7{
8 struct acpi_generic_address *rr;
9 struct pci_bus *bus0;
10 u8 reset_value;
11 unsigned int devfn;
12
13 if (acpi_disabled)
14 return;
15
16 rr = &acpi_gbl_FADT.reset_register;
17
6734fe57
MG
18 /* Is the reset register supported? The spec says we should be
19 * checking the bit width and bit offset, but Windows ignores
20 * these fields */
21 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER))
4d387043
AD
22 return;
23
24 reset_value = acpi_gbl_FADT.reset_value;
25
26 /* The reset register can only exist in I/O, Memory or PCI config space
27 * on a device on bus 0. */
28 switch (rr->space_id) {
29 case ACPI_ADR_SPACE_PCI_CONFIG:
30 /* The reset register can only live on bus 0. */
31 bus0 = pci_find_bus(0, 0);
32 if (!bus0)
33 return;
34 /* Form PCI device/function pair. */
35 devfn = PCI_DEVFN((rr->address >> 32) & 0xffff,
36 (rr->address >> 16) & 0xffff);
37 printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG.");
38 /* Write the value that resets us. */
39 pci_bus_write_config_byte(bus0, devfn,
40 (rr->address & 0xffff), reset_value);
41 break;
42
43 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
44 case ACPI_ADR_SPACE_SYSTEM_IO:
45 printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n");
2ee62612 46 acpi_reset();
4d387043
AD
47 break;
48 }
4d387043 49}
This page took 0.326656 seconds and 5 git commands to generate.