Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/smp.h> |
| 3 | #include <linux/delay.h> |
| 4 | #include <linux/platform.h> |
| 5 | |
| 6 | #include <asm/io.h> |
| 7 | #include "piix4.h" |
| 8 | |
| 9 | void (*pm_power_off)(void); |
Alexey Dobriyan | 35e422c | 2005-07-15 03:56:32 -0700 | [diff] [blame] | 10 | EXPORT_SYMBOL(pm_power_off); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Eric W. Biederman | 36cf446 | 2005-08-06 13:45:10 -0600 | [diff] [blame] | 12 | void machine_shutdown(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | { |
| 14 | #ifdef CONFIG_SMP |
| 15 | smp_send_stop(); |
| 16 | #endif |
Eric W. Biederman | 36cf446 | 2005-08-06 13:45:10 -0600 | [diff] [blame] | 17 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Eric W. Biederman | 36cf446 | 2005-08-06 13:45:10 -0600 | [diff] [blame] | 19 | void machine_emergency_restart(void) |
| 20 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | /* |
| 22 | * Visual Workstations restart after this |
| 23 | * register is poked on the PIIX4 |
| 24 | */ |
| 25 | outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT); |
| 26 | } |
| 27 | |
Eric W. Biederman | 36cf446 | 2005-08-06 13:45:10 -0600 | [diff] [blame] | 28 | void machine_restart(char * __unused) |
| 29 | { |
| 30 | machine_shutdown(); |
| 31 | machine_emergency_restart(); |
| 32 | } |
| 33 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | void machine_power_off(void) |
| 35 | { |
| 36 | unsigned short pm_status; |
| 37 | extern unsigned int pci_bus0; |
| 38 | |
| 39 | while ((pm_status = inw(PMSTS_PORT)) & 0x100) |
| 40 | outw(pm_status, PMSTS_PORT); |
| 41 | |
| 42 | outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT); |
| 43 | |
| 44 | mdelay(10); |
| 45 | |
| 46 | #define PCI_CONF1_ADDRESS(bus, devfn, reg) \ |
| 47 | (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) |
| 48 | |
| 49 | outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8); |
| 50 | outl(PIIX_SPECIAL_STOP, 0xCFC); |
| 51 | } |
| 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | void machine_halt(void) |
| 54 | { |
| 55 | } |
| 56 | |