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

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