Exemple #1
0
/* Reboots the machine via the keyboard controller. */
void
shutdown_reboot (void)
{
  printf ("Rebooting...\n");
  
#ifdef FILESYS
  enum intr_level old_level = intr_enable ();
  filesys_done ();
  intr_set_level (old_level);
#endif

    /* See [kbd] for details on how to program the keyboard
     * controller. */
  for (;;)
    {
      int i;

      /* Poll keyboard controller's status byte until
       * 'input buffer empty' is reported. */
      for (i = 0; i < 0x10000; i++)
        {
          if ((inb (CONTROL_REG) & 0x02) == 0)
            break;
          timer_udelay (2);
        }

      timer_udelay (50);

      /* Pulse bit 0 of the output port P2 of the keyboard controller.
       * This will reset the CPU. */
      outb (CONTROL_REG, 0xfe);
      timer_udelay (50);
    }
}
Exemple #2
0
/*! Reboots the machine via the keyboard controller. */
void shutdown_reboot(void) {
    printf("Rebooting...\n");

    /* See [kbd] for details on how to program the keyboard controller. */
    for (;;) {
        int i;

        /* Poll keyboard controller's status byte until 'input buffer empty'
           is reported. */
        for (i = 0; i < 0x10000; i++) {
            if ((inb(CONTROL_REG) & 0x02) == 0)
                break;
            timer_udelay(2);
        }

        timer_udelay(50);

        /* Pulse bit 0 of the output port P2 of the keyboard controller.
           This will reset the CPU. */
        outb(CONTROL_REG, 0xfe);
        timer_udelay(50);
    }
}