~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sparc/prom/misc_32.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * misc.c:  Miscellaneous prom functions that don't belong
  4  *          anywhere else.
  5  *
  6  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  7  */
  8 
  9 #include <linux/types.h>
 10 #include <linux/kernel.h>
 11 #include <linux/sched.h>
 12 #include <linux/module.h>
 13 
 14 #include <asm/openprom.h>
 15 #include <asm/oplib.h>
 16 #include <asm/auxio.h>
 17 
 18 extern void restore_current(void);
 19 
 20 DEFINE_SPINLOCK(prom_lock);
 21 
 22 /* Reset and reboot the machine with the command 'bcommand'. */
 23 void
 24 prom_reboot(char *bcommand)
 25 {
 26         unsigned long flags;
 27         spin_lock_irqsave(&prom_lock, flags);
 28         (*(romvec->pv_reboot))(bcommand);
 29         /* Never get here. */
 30         restore_current();
 31         spin_unlock_irqrestore(&prom_lock, flags);
 32 }
 33 
 34 /* Forth evaluate the expression contained in 'fstring'. */
 35 void
 36 prom_feval(char *fstring)
 37 {
 38         unsigned long flags;
 39         if(!fstring || fstring[0] == 0)
 40                 return;
 41         spin_lock_irqsave(&prom_lock, flags);
 42         if(prom_vers == PROM_V0)
 43                 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
 44         else
 45                 (*(romvec->pv_fortheval.v2_eval))(fstring);
 46         restore_current();
 47         spin_unlock_irqrestore(&prom_lock, flags);
 48 }
 49 EXPORT_SYMBOL(prom_feval);
 50 
 51 /* Drop into the prom, with the chance to continue with the 'go'
 52  * prom command.
 53  */
 54 void
 55 prom_cmdline(void)
 56 {
 57         unsigned long flags;
 58 
 59         spin_lock_irqsave(&prom_lock, flags);
 60         (*(romvec->pv_abort))();
 61         restore_current();
 62         spin_unlock_irqrestore(&prom_lock, flags);
 63         set_auxio(AUXIO_LED, 0);
 64 }
 65 
 66 /* Drop into the prom, but completely terminate the program.
 67  * No chance of continuing.
 68  */
 69 void __noreturn
 70 prom_halt(void)
 71 {
 72         unsigned long flags;
 73 again:
 74         spin_lock_irqsave(&prom_lock, flags);
 75         (*(romvec->pv_halt))();
 76         /* Never get here. */
 77         restore_current();
 78         spin_unlock_irqrestore(&prom_lock, flags);
 79         goto again; /* PROM is out to get me -DaveM */
 80 }
 81 
 82 typedef void (*sfunc_t)(void);
 83 
 84 /* Set prom sync handler to call function 'funcp'. */
 85 void
 86 prom_setsync(sfunc_t funcp)
 87 {
 88         if(!funcp) return;
 89         *romvec->pv_synchook = funcp;
 90 }
 91 
 92 /* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
 93  * format type.  'num_bytes' is the number of bytes that your idbuf
 94  * has space for.  Returns 0xff on error.
 95  */
 96 unsigned char
 97 prom_get_idprom(char *idbuf, int num_bytes)
 98 {
 99         int len;
100 
101         len = prom_getproplen(prom_root_node, "idprom");
102         if((len>num_bytes) || (len==-1)) return 0xff;
103         if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
104                 return idbuf[0];
105 
106         return 0xff;
107 }
108 
109 /* Get the major prom version number. */
110 int
111 prom_version(void)
112 {
113         return romvec->pv_romvers;
114 }
115 
116 /* Get the prom plugin-revision. */
117 int
118 prom_getrev(void)
119 {
120         return prom_rev;
121 }
122 
123 /* Get the prom firmware print revision. */
124 int
125 prom_getprev(void)
126 {
127         return prom_prev;
128 }
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php