root/arch/sparc/prom/misc.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. prom_reboot
  2. prom_feval
  3. prom_halt
  4. prom_die
  5. prom_setsync
  6. prom_getidp
  7. prom_version
  8. prom_getrev
  9. prom_getprev

   1 /* $Id: misc.c,v 1.5 1996/02/02 03:37:44 davem Exp $
   2  * misc.c:  Miscellaneous prom functions that don't belong
   3  *          anywhere else.
   4  *
   5  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
   6  */
   7 
   8 #include <asm/openprom.h>
   9 #include <asm/oplib.h>
  10 
  11 /* Reset and reboot the machine with the command 'bcommand'. */
  12 void
  13 prom_reboot(char *bcommand)
     /* [previous][next][first][last][top][bottom][index][help] */
  14 {
  15         (*(romvec->pv_reboot))(bcommand);
  16         /* Never get here. */
  17         return;
  18 }
  19 
  20 /* Forth evaluate the expression contained in 'fstring'. */
  21 void
  22 prom_feval(char *fstring)
     /* [previous][next][first][last][top][bottom][index][help] */
  23 {
  24         if(!fstring || fstring[0] == 0) return;
  25         if(prom_vers == PROM_V0)
  26                 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
  27         else
  28                 (*(romvec->pv_fortheval.v2_eval))(fstring);
  29         return;
  30 }
  31 
  32 /* We want to do this more nicely some day. */
  33 extern void console_restore_palette(void);
  34 extern void set_palette(void);
  35 
  36 /* Drop into the prom, with the chance to continue with the 'go'
  37  * prom command.
  38  */
  39 void
  40 prom_halt(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  41 {
  42         console_restore_palette ();
  43         (*(romvec->pv_abort))();
  44         set_palette ();
  45         return;
  46 }
  47 
  48 /* Drop into the prom, but completely terminate the program.
  49  * No chance of continuing.
  50  */
  51 void
  52 prom_die(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54         (*(romvec->pv_halt))();
  55         /* Never get here. */
  56         return;
  57 }
  58 
  59 typedef void (*sfunc_t)(void);
  60 
  61 /* Set prom sync handler to call function 'funcp'. */
  62 void
  63 prom_setsync(sfunc_t funcp)
     /* [previous][next][first][last][top][bottom][index][help] */
  64 {
  65         if(!funcp) return;
  66         *romvec->pv_synchook = funcp;
  67         return;
  68 }
  69 
  70 /* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
  71  * format type.  'num_bytes' is the number of bytes that your idbuf
  72  * has space for.  Returns 0xff on error.
  73  */
  74 unsigned char
  75 prom_getidp(char *idbuf, int num_bytes)
     /* [previous][next][first][last][top][bottom][index][help] */
  76 {
  77         int len;
  78 
  79         len = prom_getproplen(prom_root_node, "idprom");
  80         if((len>num_bytes) || (len==-1)) return 0xff;
  81         if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
  82                 return idbuf[0];
  83 
  84         return 0xff;
  85 }
  86 
  87 /* Get the major prom version number. */
  88 int
  89 prom_version(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  90 {
  91         return romvec->pv_romvers;
  92 }
  93 
  94 /* Get the prom plugin-revision. */
  95 int
  96 prom_getrev(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  97 {
  98         return prom_rev;
  99 }
 100 
 101 /* Get the prom firmware print revision. */
 102 int
 103 prom_getprev(void)
     /* [previous][next][first][last][top][bottom][index][help] */
 104 {
 105         return prom_prev;
 106 }

/* [previous][next][first][last][top][bottom][index][help] */