// SPDX-License-Identifier: GPL-2.01/*2* misc.c: Miscellaneous prom functions that don't belong3* anywhere else.4*5* Copyright (C) 1995 David S. Miller ([email protected])6*/78#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>1617/* Reset and reboot the machine with the command 'bcommand'. */18void19prom_reboot(char *bcommand)20{21unsigned long flags;22local_irq_save(flags);23(*(romvec->pv_reboot))(bcommand);24local_irq_restore(flags);25}2627/* Drop into the prom, with the chance to continue with the 'go'28* prom command.29*/30void31prom_cmdline(void)32{33}3435/* Drop into the prom, but completely terminate the program.36* No chance of continuing.37*/38void39prom_halt(void)40{41unsigned long flags;42again:43local_irq_save(flags);44(*(romvec->pv_halt))();45local_irq_restore(flags);46goto again; /* PROM is out to get me -DaveM */47}4849typedef void (*sfunc_t)(void);5051/* Get the idprom and stuff it into buffer 'idbuf'. Returns the52* format type. 'num_bytes' is the number of bytes that your idbuf53* has space for. Returns 0xff on error.54*/55unsigned char56prom_get_idprom(char *idbuf, int num_bytes)57{58int i, oldsfc;59GET_SFC(oldsfc);60SET_SFC(FC_CONTROL);61for(i=0;i<num_bytes; i++)62{63/* There is a problem with the GET_CONTROL_BYTE64macro; defining the extra variable65gets around it.66*/67int c;68GET_CONTROL_BYTE(SUN3_IDPROM_BASE + i, c);69idbuf[i] = c;70}71SET_SFC(oldsfc);72return idbuf[0];73}7475/* Get the major prom version number. */76int77prom_version(void)78{79return romvec->pv_romvers;80}8182/* Get the prom plugin-revision. */83int84prom_getrev(void)85{86return prom_rev;87}8889/* Get the prom firmware print revision. */90int91prom_getprev(void)92{93return prom_prev;94}959697