reboot.c 877 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. 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. void machine_halt(void)
  34. {
  35. }