reboot.c 945 B

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