aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/sun3x
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k/sun3x')
-rw-r--r--arch/m68k/sun3x/prom.c127
1 files changed, 62 insertions, 65 deletions
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 574cf06df9e4..f23d4255a6fa 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -34,43 +34,43 @@ e_vector *sun3x_prom_vbr;
34/* Handle returning to the prom */ 34/* Handle returning to the prom */
35void sun3x_halt(void) 35void sun3x_halt(void)
36{ 36{
37 unsigned long flags; 37 unsigned long flags;
38 38
39 /* Disable interrupts while we mess with things */ 39 /* Disable interrupts while we mess with things */
40 local_irq_save(flags); 40 local_irq_save(flags);
41 41
42 /* Restore prom vbr */ 42 /* Restore prom vbr */
43 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 43 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
44 44
45 /* Restore prom NMI clock */ 45 /* Restore prom NMI clock */
46// sun3x_disable_intreg(5); 46// sun3x_disable_intreg(5);
47 sun3_enable_irq(7); 47 sun3_enable_irq(7);
48 48
49 /* Let 'er rip */ 49 /* Let 'er rip */
50 __asm__ volatile ("trap #14" : : ); 50 asm volatile ("trap #14");
51 51
52 /* Restore everything */ 52 /* Restore everything */
53 sun3_disable_irq(7); 53 sun3_disable_irq(7);
54 sun3_enable_irq(5); 54 sun3_enable_irq(5);
55 55
56 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors)); 56 asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
57 local_irq_restore(flags); 57 local_irq_restore(flags);
58} 58}
59 59
60void sun3x_reboot(void) 60void sun3x_reboot(void)
61{ 61{
62 /* This never returns, don't bother saving things */ 62 /* This never returns, don't bother saving things */
63 local_irq_disable(); 63 local_irq_disable();
64 64
65 /* Restore prom vbr */ 65 /* Restore prom vbr */
66 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 66 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
67 67
68 /* Restore prom NMI clock */ 68 /* Restore prom NMI clock */
69 sun3_disable_irq(5); 69 sun3_disable_irq(5);
70 sun3_enable_irq(7); 70 sun3_enable_irq(7);
71 71
72 /* Let 'er rip */ 72 /* Let 'er rip */
73 (*romvec->pv_reboot)("vmlinux"); 73 (*romvec->pv_reboot)("vmlinux");
74} 74}
75 75
76extern char m68k_debug_device[]; 76extern char m68k_debug_device[];
@@ -78,54 +78,52 @@ extern char m68k_debug_device[];
78static void sun3x_prom_write(struct console *co, const char *s, 78static void sun3x_prom_write(struct console *co, const char *s,
79 unsigned int count) 79 unsigned int count)
80{ 80{
81 while (count--) { 81 while (count--) {
82 if (*s == '\n') 82 if (*s == '\n')
83 sun3x_putchar('\r'); 83 sun3x_putchar('\r');
84 sun3x_putchar(*s++); 84 sun3x_putchar(*s++);
85 } 85 }
86} 86}
87 87
88/* debug console - write-only */ 88/* debug console - write-only */
89 89
90static struct console sun3x_debug = { 90static struct console sun3x_debug = {
91 .name = "debug", 91 .name = "debug",
92 .write = sun3x_prom_write, 92 .write = sun3x_prom_write,
93 .flags = CON_PRINTBUFFER, 93 .flags = CON_PRINTBUFFER,
94 .index = -1, 94 .index = -1,
95}; 95};
96 96
97void sun3x_prom_init(void) 97void sun3x_prom_init(void)
98{ 98{
99 /* Read the vector table */ 99 /* Read the vector table */
100 100
101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); 101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); 102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); 103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); 104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); 105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); 106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE; 107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
108 108
109 idprom_init(); 109 idprom_init();
110 110
111 if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) { 111 if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
112 printk("Warning: machine reports strange type %02x\n", 112 printk("Warning: machine reports strange type %02x\n",
113 idprom->id_machtype); 113 idprom->id_machtype);
114 printk("Pretending it's a 3/80, but very afraid...\n"); 114 printk("Pretending it's a 3/80, but very afraid...\n");
115 idprom->id_machtype = SM_SUN3X | SM_3_80; 115 idprom->id_machtype = SM_SUN3X | SM_3_80;
116 } 116 }
117 117
118 /* point trap #14 at abort. 118 /* point trap #14 at abort.
119 * XXX this is futile since we restore the vbr first - oops 119 * XXX this is futile since we restore the vbr first - oops
120 */ 120 */
121 vectors[VEC_TRAP14] = sun3x_prom_abort; 121 vectors[VEC_TRAP14] = sun3x_prom_abort;
122 122
123 /* If debug=prom was specified, start the debug console */ 123 /* If debug=prom was specified, start the debug console */
124 124
125 if (!strcmp(m68k_debug_device, "prom")) 125 if (!strcmp(m68k_debug_device, "prom"))
126 register_console(&sun3x_debug); 126 register_console(&sun3x_debug);
127
128
129} 127}
130 128
131/* some prom functions to export */ 129/* some prom functions to export */
@@ -141,7 +139,6 @@ int prom_getbool (int node, char *prop)
141 139
142void prom_printf(char *fmt, ...) 140void prom_printf(char *fmt, ...)
143{ 141{
144
145} 142}
146 143
147void prom_halt (void) 144void prom_halt (void)
@@ -159,7 +156,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
159 int i; 156 int i;
160 157
161 /* make a copy of the idprom structure */ 158 /* make a copy of the idprom structure */
162 for(i = 0; i < num_bytes; i++) 159 for (i = 0; i < num_bytes; i++)
163 idbuf[i] = ((char *)SUN3X_IDPROM)[i]; 160 idbuf[i] = ((char *)SUN3X_IDPROM)[i];
164 161
165 return idbuf[0]; 162 return idbuf[0];