Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /* $Id: misc.c,v 1.10 1998/07/21 10:36:29 jj Exp $ * misc.c: Miscellaneous prom functions that don't belong * anywhere else. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ #include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> #include <asm/openprom.h> #include <asm/oplib.h> /* Reset and reboot the machine with the command 'bcommand'. */ void prom_reboot(char *bcommand) { p1275_cmd ("boot", P1275_ARG(0,P1275_ARG_IN_STRING)| P1275_INOUT(1,0), bcommand); } /* Forth evaluate the expression contained in 'fstring'. */ void prom_feval(char *fstring) { if(!fstring || fstring[0] == 0) return; p1275_cmd ("interpret", P1275_ARG(0,P1275_ARG_IN_STRING)| P1275_INOUT(1,1), fstring); } /* We want to do this more nicely some day. */ #ifdef CONFIG_SUN_CONSOLE extern void (*prom_palette)(int); extern int serial_console; #endif /* Drop into the prom, with the chance to continue with the 'go' * prom command. */ /* XXX Fix the pre and post calls as it locks up my Ultra at the moment -DaveM */ void prom_cmdline(void) { extern void kernel_enter_debugger(void); /* extern void install_obp_ticker(void); */ /* extern void install_linux_ticker(void); */ unsigned long flags; /* kernel_enter_debugger(); */ #ifdef CONFIG_SUN_CONSOLE if(!serial_console && prom_palette) prom_palette (1); #endif /* install_obp_ticker(); */ save_flags(flags); cli(); p1275_cmd ("enter", P1275_INOUT(0,0)); restore_flags(flags); /* install_linux_ticker(); */ #ifdef CONFIG_SUN_CONSOLE if(!serial_console && prom_palette) prom_palette (0); #endif } /* Drop into the prom, but completely terminate the program. * No chance of continuing. */ void prom_halt(void) { again: p1275_cmd ("exit", P1275_INOUT(0,0)); goto again; /* PROM is out to get me -DaveM */ } /* Set prom sync handler to call function 'funcp'. */ void prom_setsync(sync_func_t funcp) { if(!funcp) return; p1275_cmd ("set-callback", P1275_ARG(0,P1275_ARG_IN_FUNCTION)| P1275_INOUT(1,1), funcp); } /* Get the idprom and stuff it into buffer 'idbuf'. Returns the * format type. 'num_bytes' is the number of bytes that your idbuf * has space for. Returns 0xff on error. */ unsigned char prom_get_idprom(char *idbuf, int num_bytes) { int len; len = prom_getproplen(prom_root_node, "idprom"); if((len>num_bytes) || (len==-1)) return 0xff; if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes)) return idbuf[0]; return 0xff; } /* Get the major prom version number. */ int prom_version(void) { return PROM_P1275; } /* Get the prom plugin-revision. */ int prom_getrev(void) { return prom_rev; } /* Get the prom firmware print revision. */ int prom_getprev(void) { return prom_prev; } /* Install Linux trap table so PROM uses that instead of it's own. */ void prom_set_trap_table(unsigned long tba) { p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba); } #ifdef __SMP__ void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0) { p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, o0); } #endif |