reboot.c 1002 B

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