Root/
1 | |
2 | #include <linux/pci.h> |
3 | #include <linux/acpi.h> |
4 | #include <acpi/reboot.h> |
5 | |
6 | void 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 | |
18 | /* ACPI reset register was only introduced with v2 of the FADT */ |
19 | |
20 | if (acpi_gbl_FADT.header.revision < 2) |
21 | return; |
22 | |
23 | /* Is the reset register supported? The spec says we should be |
24 | * checking the bit width and bit offset, but Windows ignores |
25 | * these fields */ |
26 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)) |
27 | return; |
28 | |
29 | reset_value = acpi_gbl_FADT.reset_value; |
30 | |
31 | /* The reset register can only exist in I/O, Memory or PCI config space |
32 | * on a device on bus 0. */ |
33 | switch (rr->space_id) { |
34 | case ACPI_ADR_SPACE_PCI_CONFIG: |
35 | /* The reset register can only live on bus 0. */ |
36 | bus0 = pci_find_bus(0, 0); |
37 | if (!bus0) |
38 | return; |
39 | /* Form PCI device/function pair. */ |
40 | devfn = PCI_DEVFN((rr->address >> 32) & 0xffff, |
41 | (rr->address >> 16) & 0xffff); |
42 | printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG."); |
43 | /* Write the value that resets us. */ |
44 | pci_bus_write_config_byte(bus0, devfn, |
45 | (rr->address & 0xffff), reset_value); |
46 | break; |
47 | |
48 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
49 | case ACPI_ADR_SPACE_SYSTEM_IO: |
50 | printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); |
51 | acpi_reset(); |
52 | break; |
53 | } |
54 | } |
55 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9