OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [sparc/] [prom/] [misc.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
/* $Id: misc.c,v 1.1 2005-12-20 09:49:32 jcastillo Exp $
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/config.h>
9
#include <asm/openprom.h>
10
#include <asm/oplib.h>
11
 
12
/* Reset and reboot the machine with the command 'bcommand'. */
13
void
14
prom_reboot(char *bcommand)
15
{
16
        (*(romvec->pv_reboot))(bcommand);
17
        /* Never get here. */
18
        return;
19
}
20
 
21
/* Forth evaluate the expression contained in 'fstring'. */
22
void
23
prom_feval(char *fstring)
24
{
25
        if(!fstring || fstring[0] == 0) return;
26
        if(prom_vers == PROM_V0)
27
                (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
28
        else
29
                (*(romvec->pv_fortheval.v2_eval))(fstring);
30
        return;
31
}
32
 
33
/* We want to do this more nicely some day. */
34
#if CONFIG_SUN_CONSOLE
35
extern void console_restore_palette(void);
36
extern void set_palette(void);
37
extern int serial_console;
38
#endif
39
 
40
/* Drop into the prom, with the chance to continue with the 'go'
41
 * prom command.
42
 */
43
void
44
prom_halt(void)
45
{
46
        extern void kernel_enter_debugger(void);
47
        extern void install_obp_ticker(void);
48
        extern void install_linux_ticker(void);
49
 
50
        kernel_enter_debugger();
51
#if CONFIG_SUN_CONSOLE
52
        if(!serial_console)
53
                console_restore_palette ();
54
#endif
55
        install_obp_ticker();
56
        (*(romvec->pv_abort))();
57
        install_linux_ticker();
58
#if CONFIG_SUN_CONSOLE
59
        if(!serial_console)
60
                set_palette ();
61
#endif
62
        return;
63
}
64
 
65
/* Drop into the prom, but completely terminate the program.
66
 * No chance of continuing.
67
 */
68
void
69
prom_die(void)
70
{
71
        (*(romvec->pv_halt))();
72
        /* Never get here. */
73
        return;
74
}
75
 
76
typedef void (*sfunc_t)(void);
77
 
78
/* Set prom sync handler to call function 'funcp'. */
79
void
80
prom_setsync(sfunc_t funcp)
81
{
82
#if CONFIG_AP1000
83
  printk("not doing setsync\n");
84
  return;
85
#endif
86
        if(!funcp) return;
87
        *romvec->pv_synchook = funcp;
88
        return;
89
}
90
 
91
/* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
92
 * format type.  'num_bytes' is the number of bytes that your idbuf
93
 * has space for.  Returns 0xff on error.
94
 */
95
unsigned char
96
prom_getidp(char *idbuf, int num_bytes)
97
{
98
        int len;
99
 
100
        len = prom_getproplen(prom_root_node, "idprom");
101
        if((len>num_bytes) || (len==-1)) return 0xff;
102
        if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
103
                return idbuf[0];
104
 
105
        return 0xff;
106
}
107
 
108
/* Get the major prom version number. */
109
int
110
prom_version(void)
111
{
112
        return romvec->pv_romvers;
113
}
114
 
115
/* Get the prom plugin-revision. */
116
int
117
prom_getrev(void)
118
{
119
        return prom_rev;
120
}
121
 
122
/* Get the prom firmware print revision. */
123
int
124
prom_getprev(void)
125
{
126
        return prom_prev;
127
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.