Line 0
Link Here
|
|
|
1 |
|
2 |
#include <linux/pci.h> |
3 |
#include <linux/acpi.h> |
4 |
#include <acpi/reboot.h> |
5 |
#include <linux/dmi.h> |
6 |
|
7 |
/* Actually this shouldn't be __cpuinitdata, would be better to fix the |
8 |
callers to only run once -AK */ |
9 |
static struct dmi_system_id __cpuinitdata reg_reboot_dmi_table[] = { |
10 |
{ NULL, "ASUS M6NE", { |
11 |
DMI_MATCH(DMI_BIOS_VERSION,"0208"), |
12 |
DMI_MATCH(DMI_PRODUCT_NAME,"M6Ne")}, (void *)0}, |
13 |
{} |
14 |
}; |
15 |
|
16 |
void acpi_reboot(void) |
17 |
{ |
18 |
struct acpi_generic_address *rr; |
19 |
struct pci_bus *bus0; |
20 |
u8 reset_value; |
21 |
unsigned int devfn; |
22 |
|
23 |
if (acpi_disabled) |
24 |
return; |
25 |
|
26 |
rr = &acpi_gbl_FADT.reset_register; |
27 |
|
28 |
if (!dmi_check_system(reg_reboot_dmi_table)) { |
29 |
/* |
30 |
* If the laptop falls into the DMI check table, it is |
31 |
* unnecessary to check the RESET_REG flag again. |
32 |
*/ |
33 |
/* Is the reset register supported? */ |
34 |
if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
35 |
rr->bit_width != 8 || rr->bit_offset != 0) |
36 |
return; |
37 |
} |
38 |
|
39 |
reset_value = acpi_gbl_FADT.reset_value; |
40 |
|
41 |
/* The reset register can only exist in I/O, Memory or PCI config space |
42 |
* on a device on bus 0. */ |
43 |
switch (rr->space_id) { |
44 |
case ACPI_ADR_SPACE_PCI_CONFIG: |
45 |
/* The reset register can only live on bus 0. */ |
46 |
bus0 = pci_find_bus(0, 0); |
47 |
if (!bus0) |
48 |
return; |
49 |
/* Form PCI device/function pair. */ |
50 |
devfn = PCI_DEVFN((rr->address >> 32) & 0xffff, |
51 |
(rr->address >> 16) & 0xffff); |
52 |
printk(KERN_DEBUG "Resetting with ACPI PCI RESET_REG."); |
53 |
/* Write the value that resets us. */ |
54 |
pci_bus_write_config_byte(bus0, devfn, |
55 |
(rr->address & 0xffff), reset_value); |
56 |
break; |
57 |
|
58 |
case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
59 |
case ACPI_ADR_SPACE_SYSTEM_IO: |
60 |
printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); |
61 |
acpi_hw_low_level_write(8, reset_value, rr); |
62 |
break; |
63 |
} |
64 |
/* Wait ten seconds */ |
65 |
acpi_os_stall(10000000); |
66 |
} |