aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/sun3x/prom.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-05-07 23:37:51 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-07 23:37:51 -0400
commit02bbc0f09c90cefdb2837605c96a66c5ce4ba2e1 (patch)
tree04ef573cd4de095c500c9fc3477f4278c0b36300 /arch/m68k/sun3x/prom.c
parent7487a2245b8841c77ba9db406cf99a483b9334e9 (diff)
parent5b94f675f57e4ff16c8fda09088d7480a84dcd91 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'arch/m68k/sun3x/prom.c')
-rw-r--r--arch/m68k/sun3x/prom.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 574cf06df9e4..48f8eb7b1565 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -34,100 +34,101 @@ 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[];
77
78static void sun3x_prom_write(struct console *co, const char *s, 76static void sun3x_prom_write(struct console *co, const char *s,
79 unsigned int count) 77 unsigned int count)
80{ 78{
81 while (count--) { 79 while (count--) {
82 if (*s == '\n') 80 if (*s == '\n')
83 sun3x_putchar('\r'); 81 sun3x_putchar('\r');
84 sun3x_putchar(*s++); 82 sun3x_putchar(*s++);
85 } 83 }
86} 84}
87 85
88/* debug console - write-only */ 86/* debug console - write-only */
89 87
90static struct console sun3x_debug = { 88static struct console sun3x_debug = {
91 .name = "debug", 89 .name = "debug",
92 .write = sun3x_prom_write, 90 .write = sun3x_prom_write,
93 .flags = CON_PRINTBUFFER, 91 .flags = CON_PRINTBUFFER,
94 .index = -1, 92 .index = -1,
95}; 93};
96 94
97void sun3x_prom_init(void) 95void sun3x_prom_init(void)
98{ 96{
99 /* Read the vector table */ 97 /* Read the vector table */
100 98
101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); 99 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); 100 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); 101 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); 102 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); 103 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); 104 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE; 105 romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
108 106
109 idprom_init(); 107 idprom_init();
110 108
111 if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) { 109 if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
112 printk("Warning: machine reports strange type %02x\n", 110 printk("Warning: machine reports strange type %02x\n",
113 idprom->id_machtype); 111 idprom->id_machtype);
114 printk("Pretending it's a 3/80, but very afraid...\n"); 112 printk("Pretending it's a 3/80, but very afraid...\n");
115 idprom->id_machtype = SM_SUN3X | SM_3_80; 113 idprom->id_machtype = SM_SUN3X | SM_3_80;
116 } 114 }
117 115
118 /* point trap #14 at abort. 116 /* point trap #14 at abort.
119 * XXX this is futile since we restore the vbr first - oops 117 * XXX this is futile since we restore the vbr first - oops
120 */ 118 */
121 vectors[VEC_TRAP14] = sun3x_prom_abort; 119 vectors[VEC_TRAP14] = sun3x_prom_abort;
122 120}
123 /* If debug=prom was specified, start the debug console */
124
125 if (!strcmp(m68k_debug_device, "prom"))
126 register_console(&sun3x_debug);
127
128 121
122static int __init sun3x_debug_setup(char *arg)
123{
124 /* If debug=prom was specified, start the debug console */
125 if (MACH_IS_SUN3X && !strcmp(arg, "prom"))
126 register_console(&sun3x_debug);
127 return 0;
129} 128}
130 129
130early_param("debug", sun3x_debug_setup);
131
131/* some prom functions to export */ 132/* some prom functions to export */
132int prom_getintdefault(int node, char *property, int deflt) 133int prom_getintdefault(int node, char *property, int deflt)
133{ 134{
@@ -141,7 +142,6 @@ int prom_getbool (int node, char *prop)
141 142
142void prom_printf(char *fmt, ...) 143void prom_printf(char *fmt, ...)
143{ 144{
144
145} 145}
146 146
147void prom_halt (void) 147void prom_halt (void)
@@ -159,7 +159,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
159 int i; 159 int i;
160 160
161 /* make a copy of the idprom structure */ 161 /* make a copy of the idprom structure */
162 for(i = 0; i < num_bytes; i++) 162 for (i = 0; i < num_bytes; i++)
163 idbuf[i] = ((char *)SUN3X_IDPROM)[i]; 163 idbuf[i] = ((char *)SUN3X_IDPROM)[i];
164 164
165 return idbuf[0]; 165 return idbuf[0];