Exemplo n.º 1
0
Arquivo: main.c Projeto: Hooman3/minix
/*===========================================================================*
 *				shutdown 				     *
 *===========================================================================*/
void minix_shutdown(minix_timer_t *tp)
{
/* This function is called from prepare_shutdown or stop_sequence to bring 
 * down MINIX.
 */
  int how;

#ifdef CONFIG_SMP
  /* 
   * FIXME
   *
   * we will need to stop timers on all cpus if SMP is enabled and put them in
   * such a state that we can perform the whole boot process once restarted from
   * monitor again
   */
  if (ncpus > 1)
	  smp_shutdown_aps();
#endif
  hw_intr_disable_all();
  stop_local_timer();

  how = tp ? tmr_arg(tp)->ta_int : 0;

  /* Show shutdown message */
  direct_cls();
  if((how & RB_POWERDOWN) == RB_POWERDOWN)
	direct_print("MINIX has halted and will now power off.\n");
  else if(how & RB_HALT)
	direct_print("MINIX has halted. "
		     "It is safe to turn off your computer.\n");
  else
	direct_print("MINIX will now reset.\n");
  arch_shutdown(how);
}
Exemplo n.º 2
0
void
poweroff(void)
{

/*
 * The am335x can signal an external power management chip to cut the power
 * by toggling the PMIC_POWER_EN pin. It might fail if there isn't an
 * external PMIC or if the PMIC hasn't been configured to respond to toggles.
 * The only way to pull the pin low is via ALARM2 (see TRM 20.3.3.8).
 * At this point PM should have already signaled readclock to set the alarm.
 */
#ifdef AM335X

	/* Powers down the SoC within 3 seconds */
	direct_print("PMIC Power-Off in 3 Seconds\n");

	/* rtc was frozen to prevent premature power-off, unfreeze it now */
	omap3_rtc_run();

	/* wait for the alarm to go off and PMIC to disable power to SoC */
	while (1);

#endif /* AM335X */

	/* fallback option: hang */
	direct_print("Unable to power-off this device.");
	while (1);
}
Exemplo n.º 3
0
__dead void arch_shutdown(int how)
{
	unsigned char unused_ch;
	/* Mask all interrupts, including the clock. */
	outb( INT_CTLMASK, ~0);

	/* Empty buffer */
	while(direct_read_char(&unused_ch))
		;

	if(kinfo.minix_panicing) {
		/* Printing is done synchronously over serial. */
		if (kinfo.do_serial_debug)
			reset();

		/* Print accumulated diagnostics buffer and reset. */
		direct_cls();
		direct_print("Minix panic. System diagnostics buffer:\n\n");
		direct_print(kmess.kmess_buf);
		direct_print("\nSystem has panicked, press any key to reboot");
		while (!direct_read_char(&unused_ch))
			;
		reset();
	}

	switch (how) {
		case RBT_HALT:
			/* Hang */
			for (; ; ) halt_cpu();
			NOT_REACHABLE;
			
		case RBT_POWEROFF:
			/* Power off if possible, hang otherwise */
			poweroff();
			NOT_REACHABLE;

		default:
		case RBT_DEFAULT:	
		case RBT_REBOOT:
		case RBT_RESET:
			/* Reset the system by forcing a processor shutdown. 
			 * First stop the BIOS memory test by setting a soft
			 * reset flag.
			 */
			reset();
			NOT_REACHABLE;
	}

	NOT_REACHABLE;
}
Exemplo n.º 4
0
void
reset(void)
{
	bsp_reset(); /* should not exit */
	direct_print("Reset not supported.");
	while (1);
}
Exemplo n.º 5
0
void
reset(void)
{
	omap3_reset();
	direct_print("Reset not supported.");
	while (1);
}
Exemplo n.º 6
0
void
poweroff(void)
{
	bsp_poweroff();
	/* fallback option: hang */
	direct_print("Unable to power-off this device.");
	while (1);
}
Exemplo n.º 7
0
/*===========================================================================*
 *				shutdown 				     *
 *===========================================================================*/
void minix_shutdown(timer_t *tp)
{
/* This function is called from prepare_shutdown or stop_sequence to bring 
 * down MINIX. How to shutdown is in the argument: RBT_HALT (return to the
 * monitor), RBT_RESET (hard reset). 
 */
  int how;

#ifdef CONFIG_SMP
  /* 
   * FIXME
   *
   * we will need to stop timers on all cpus if SMP is enabled and put them in
   * such a state that we can perform the whole boot process once restarted from
   * monitor again
   */
  if (ncpus > 1)
	  smp_shutdown_aps();
#endif
  hw_intr_disable_all();
  stop_local_timer();

  how = tp ? tmr_arg(tp)->ta_int : RBT_PANIC;

  /* Show shutdown message */
  direct_cls();
  switch(how) {
  case RBT_HALT:
	direct_print("MINIX has halted. "
		     "It is safe to turn off your computer.\n");
	break;
  case RBT_POWEROFF:
	direct_print("MINIX has halted and will now power off.\n");
	break;
  case RBT_DEFAULT:
  case RBT_REBOOT:
  case RBT_RESET:
  default:
	direct_print("MINIX will now reset.\n");
	break;
  }
  arch_shutdown(how);
}