linux/arch/m68k/sun3/prom/misc.c
<<
>>
Prefs
   1/*
   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 <linux/types.h>
   9#include <linux/kernel.h>
  10#include <linux/sched.h>
  11#include <asm/sun3-head.h>
  12#include <asm/idprom.h>
  13#include <asm/openprom.h>
  14#include <asm/oplib.h>
  15#include <asm/movs.h>
  16
  17/* Reset and reboot the machine with the command 'bcommand'. */
  18void
  19prom_reboot(char *bcommand)
  20{
  21        unsigned long flags;
  22        local_irq_save(flags);
  23        (*(romvec->pv_reboot))(bcommand);
  24        local_irq_restore(flags);
  25}
  26
  27/* Drop into the prom, with the chance to continue with the 'go'
  28 * prom command.
  29 */
  30void
  31prom_cmdline(void)
  32{
  33}
  34
  35/* Drop into the prom, but completely terminate the program.
  36 * No chance of continuing.
  37 */
  38void
  39prom_halt(void)
  40{
  41        unsigned long flags;
  42again:
  43        local_irq_save(flags);
  44        (*(romvec->pv_halt))();
  45        local_irq_restore(flags);
  46        goto again; /* PROM is out to get me -DaveM */
  47}
  48
  49typedef void (*sfunc_t)(void);
  50
  51/* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
  52 * format type.  'num_bytes' is the number of bytes that your idbuf
  53 * has space for.  Returns 0xff on error.
  54 */
  55unsigned char
  56prom_get_idprom(char *idbuf, int num_bytes)
  57{
  58        int i, oldsfc;
  59        GET_SFC(oldsfc);
  60        SET_SFC(FC_CONTROL);
  61        for(i=0;i<num_bytes; i++)
  62        {
  63                /* There is a problem with the GET_CONTROL_BYTE
  64                macro; defining the extra variable
  65                gets around it.
  66                */
  67                int c;
  68                GET_CONTROL_BYTE(SUN3_IDPROM_BASE + i, c);
  69                idbuf[i] = c;
  70        }
  71        SET_SFC(oldsfc);
  72        return idbuf[0];
  73}
  74
  75/* Get the major prom version number. */
  76int
  77prom_version(void)
  78{
  79        return romvec->pv_romvers;
  80}
  81
  82/* Get the prom plugin-revision. */
  83int
  84prom_getrev(void)
  85{
  86        return prom_rev;
  87}
  88
  89/* Get the prom firmware print revision. */
  90int
  91prom_getprev(void)
  92{
  93        return prom_prev;
  94}
  95