reboot.c 974 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include <linux/module.h>
  2. #include <linux/smp.h>
  3. #include <linux/delay.h>
  4. #include <linux/platform.h>
  5. #include <asm/io.h>
  6. #include "piix4.h"
  7. void (*pm_power_off)(void);
  8. EXPORT_SYMBOL(pm_power_off);
  9. void machine_restart(char * __unused)
  10. {
  11. #ifdef CONFIG_SMP
  12. smp_send_stop();
  13. #endif
  14. /*
  15. * Visual Workstations restart after this
  16. * register is poked on the PIIX4
  17. */
  18. outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
  19. }
  20. EXPORT_SYMBOL(machine_restart);
  21. void machine_power_off(void)
  22. {
  23. unsigned short pm_status;
  24. extern unsigned int pci_bus0;
  25. while ((pm_status = inw(PMSTS_PORT)) & 0x100)
  26. outw(pm_status, PMSTS_PORT);
  27. outw(PM_SUSPEND_ENABLE, PMCNTRL_PORT);
  28. mdelay(10);
  29. #define PCI_CONF1_ADDRESS(bus, devfn, reg) \
  30. (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
  31. outl(PCI_CONF1_ADDRESS(pci_bus0, SPECIAL_DEV, SPECIAL_REG), 0xCF8);
  32. outl(PIIX_SPECIAL_STOP, 0xCFC);
  33. }
  34. EXPORT_SYMBOL(machine_power_off);
  35. void machine_halt(void)
  36. {
  37. }
  38. EXPORT_SYMBOL(machine_halt);