/*1* misc.c: Miscellaneous prom functions that don't belong2* anywhere else.3*4* Copyright (C) 1995 David S. Miller ([email protected])5*/67#include <linux/types.h>8#include <linux/kernel.h>9#include <linux/sched.h>10#include <asm/sun3-head.h>11#include <asm/idprom.h>12#include <asm/openprom.h>13#include <asm/oplib.h>14#include <asm/movs.h>1516/* Reset and reboot the machine with the command 'bcommand'. */17void18prom_reboot(char *bcommand)19{20unsigned long flags;21local_irq_save(flags);22(*(romvec->pv_reboot))(bcommand);23local_irq_restore(flags);24}2526/* Drop into the prom, with the chance to continue with the 'go'27* prom command.28*/29void30prom_cmdline(void)31{32}3334/* Drop into the prom, but completely terminate the program.35* No chance of continuing.36*/37void38prom_halt(void)39{40unsigned long flags;41again:42local_irq_save(flags);43(*(romvec->pv_halt))();44local_irq_restore(flags);45goto again; /* PROM is out to get me -DaveM */46}4748typedef void (*sfunc_t)(void);4950/* Get the idprom and stuff it into buffer 'idbuf'. Returns the51* format type. 'num_bytes' is the number of bytes that your idbuf52* has space for. Returns 0xff on error.53*/54unsigned char55prom_get_idprom(char *idbuf, int num_bytes)56{57int i, oldsfc;58GET_SFC(oldsfc);59SET_SFC(FC_CONTROL);60for(i=0;i<num_bytes; i++)61{62/* There is a problem with the GET_CONTROL_BYTE63macro; defining the extra variable64gets around it.65*/66int c;67GET_CONTROL_BYTE(SUN3_IDPROM_BASE + i, c);68idbuf[i] = c;69}70SET_SFC(oldsfc);71return idbuf[0];72}7374/* Get the major prom version number. */75int76prom_version(void)77{78return romvec->pv_romvers;79}8081/* Get the prom plugin-revision. */82int83prom_getrev(void)84{85return prom_rev;86}8788/* Get the prom firmware print revision. */89int90prom_getprev(void)91{92return prom_prev;93}949596