reboot.c 974 B

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