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.3 1995/11/25 01:00:04 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 /* Drop into the prom, with the chance to continue with the 'go'
  33  * prom command.
  34  */
  35 void
  36 prom_halt(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  37 {
  38         (*(romvec->pv_abort))();
  39         return;
  40 }
  41 
  42 /* Drop into the prom, but completely terminate the program.
  43  * No chance of continuing.
  44  */
  45 void
  46 prom_die(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  47 {
  48         (*(romvec->pv_halt))();
  49         /* Never get here. */
  50         return;
  51 }
  52 
  53 typedef void (*sfunc_t)(void);
  54 
  55 /* Set prom sync handler to call function 'funcp'. */
  56 void
  57 prom_setsync(sfunc_t funcp)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         if(!funcp) return;
  60         *romvec->pv_synchook = funcp;
  61         return;
  62 }
  63 
  64 /* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
  65  * format type.  'num_bytes' is the number of bytes that your idbuf
  66  * has space for.  Returns 0xff on error.
  67  */
  68 unsigned char
  69 prom_getidp(char *idbuf, int num_bytes)
     /* [previous][next][first][last][top][bottom][index][help] */
  70 {
  71         int len;
  72 
  73         len = prom_getproplen(prom_root_node, "idprom");
  74         if((len>num_bytes) || (len==-1)) return 0xff;
  75         if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
  76                 return idbuf[0];
  77 
  78         return 0xff;
  79 }
  80 
  81 /* Get the major prom version number. */
  82 int
  83 prom_version(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  84 {
  85         return romvec->pv_romvers;
  86 }
  87 
  88 /* Get the prom plugin-revision. */
  89 int
  90 prom_getrev(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  91 {
  92         return prom_rev;
  93 }
  94 
  95 /* Get the prom firmware print revision. */
  96 int
  97 prom_getprev(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  98 {
  99         return prom_prev;
 100 }

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