1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: 17: 18: 19:
20:
21: #include "sysinit.h"
22: #include "kernel.h"
23: #include <tk/sysdef.h>
24: #include <sys/sysinfo.h>
25: #include <sys/rominfo.h>
26: #include <sys/util.h>
27: #include <device/devconf.h>
28: #include <libstr.h>
29:
30: 31: 32: 33: 34: 35:
36: EXPORT void DispProgress( W n )
37: {
38: }
39:
40:
41:
42: 43: 44: 45: 46:
47: EXPORT ER ROM_startup( void )
48: {
49: W val[L_DEVCONF_VAL];
50: W n;
51:
52:
53: SCInfo.sysconf = ROMInfo->sysconf;
54: SCInfo.devconf = ROMInfo->devconf;
55:
56:
57: n = GetDevConf(DCTAG_DEBUGMODE, val);
58: SCInfo.bm.c.debug = ( n >= 1 && val[0] > 0 )? 1: 0;
59:
60:
61: SCInfo.bootdev[0] = '\0';
62:
63: return E_OK;
64: }
65:
66: 67: 68:
69: LOCAL void setExcStack( UW mode, UW stack )
70: {
71: Asm(" msr cpsr_c, %1 \n"
72: " mov sp, %0 \n"
73: " msr cpsr_c, %2 "
74: :: "l"(stack), "r"(mode|PSR_I|PSR_F), "i"(PSR_SVC|PSR_I|PSR_F));
75: }
76:
77: 78: 79:
80: #define SYSCONF_VAL_MAX (16)
81:
82: EXPORT ER init_device( void )
83: {
84: IMPORT void CountWaitUsec( void );
85:
86:
87: IMPORT UW lowmem_top;
88:
89: W n, v[SYSCONF_VAL_MAX];
90:
91:
92: CountWaitUsec();
93:
94:
95: lowmem_top = (lowmem_top + 3) & ~0x00000003U;
96: n = GetSysConf(SCTAG_ABTSTKSZ, v);
97: n = ( n < 1 )? 64: v[0];
98: lowmem_top += (n + 3) & ~0x00000003U;
99: setExcStack(PSR_ABT, lowmem_top);
100:
101: n = GetSysConf(SCTAG_UNDSTKSZ, v);
102: n = ( n < 1 )? 64: v[0];
103: lowmem_top += (n + 3) & ~0x00000003U;
104: setExcStack(PSR_UND, lowmem_top);
105:
106: n = GetSysConf(SCTAG_IRQSTKSZ, v);
107: n = ( n < 1 )? 512: v[0];
108: lowmem_top += (n + 3) & ~0x00000003U;
109: setExcStack(PSR_IRQ, lowmem_top);
110:
111: n = GetSysConf(SCTAG_FIQSTKSZ, v);
112: n = ( n < 1 )? 128: v[0];
113: lowmem_top += (n + 3) & ~0x00000003U;
114: setExcStack(PSR_FIQ, lowmem_top);
115:
116: return E_OK;
117: }
118:
119:
120: 121: 122: 123:
124: EXPORT ER start_device( void )
125: {
126: return E_OK;
127: }
128:
129:
130: 131: 132: 133: 134:
135: EXPORT ER finish_device( void )
136: {
137: return E_OK;
138: }
139:
140:
141: 142: 143:
144:
145: 146: 147: 148: 149: 150: 151: 152:
153: EXPORT ER restart_device( W mode )
154: {
155: if ( mode == -1 ) {
156:
157: #if USE_KERNEL_MESSAGE
158: tm_putstring((UB*)"\n<< SYSTEM RESTART >>\n");
159: #endif
160: tm_exit(-1);
161: return E_OBJ;
162: }
163:
164: if ( mode == -3 ) {
165:
166: UB bdcmd[4 + L_DEVNM] = "bd ";
167: #if USE_KERNEL_MESSAGE
168: tm_putstring((UB*)"\n<< SYSTEM REBOOT >>\n");
169: #endif
170: STRNCAT((char*)bdcmd, (char*)SCInfo.bootdev, L_DEVNM);
171: tm_command(bdcmd);
172: return E_OBJ;
173: }
174:
175: if ( mode == -2 ) {
176: return E_NOSPT;
177: }
178:
179: if ( (mode & 0xff000000) == 0xff000000 ) {
180:
181: return E_NOSPT;
182: }
183:
184: return E_PAR;
185: }