2 * Copyright 1996 The Australian National University.
3 * Copyright 1996 Fujitsu Laboratories Limited
5 * This software may be distributed under the terms of the Gnu
6 * Public License version 2 or later
9 * Initialize the AP1000 hardware: BIF, MSC+, MC+, etc.
12 #include <linux/sched.h>
14 #include <linux/malloc.h>
15 #include <linux/mpp.h>
17 #include <asm/ap1000/apservice.h>
18 #include <asm/ap1000/apreg.h>
22 /* these make using CellOS code easier */
27 unsigned _cid
, _ncel
, _ncelx
, _ncely
, _cidx
, _cidy
;
29 /* yuck - needed for sun4c! */
30 static unsigned char dummy
;
31 unsigned char *auxio_register
= &dummy
;
34 extern struct cap_init cap_init
;
36 static void unexpected_irq(int irq
, void *dev_id
, struct pt_regs
*regs
)
38 ap_panic("** unexpected interrupt %d **\n",irq
);
41 static void ap_other_irqs(void)
43 request_irq(3, unexpected_irq
, SA_INTERRUPT
, "unused", 0);
44 request_irq(5, unexpected_irq
, SA_INTERRUPT
, "unused", 0);
45 request_irq(12, unexpected_irq
, SA_INTERRUPT
, "unused", 0);
46 request_irq(15, unexpected_irq
, SA_INTERRUPT
, "unused", 0);
49 int ap_memory_size(void)
51 if ((MSC_IN(MSC_SIMMCHK
) & MSC_SIMMCHK_MASK
) == 0) {
57 static void show_registers(void)
59 extern struct pt_regs
*bif_pt_regs
;
61 show_regs(bif_pt_regs
);
63 printk("unable to show registers\n");
67 static void check_alive(void)
69 printk("Cell %d is alive\n",mpp_cid());
74 static void show_task(struct task_struct
*t
)
76 printk("cell=%3d uid=%5d pid=%5d utime=%3d stime=%3d etime=%3d name=%s\n",
82 (jiffies
- (int)t
->start_time
) / 100,
86 static void show_ptasks(void)
88 extern struct task_struct
*task
[];
89 struct task_struct
*p
;
93 read_lock(&tasklist_lock
);
95 struct task_struct
**tp
= p
->tarray_ptr
;
97 if(tp
>= &task
[MPP_TASK_BASE
]) {
102 read_unlock(&tasklist_lock
);
105 printk("no parallel tasks on cell %d\n",mpp_cid());
108 static void show_utasks(void)
110 extern struct task_struct
*task
[];
111 struct task_struct
*p
;
115 read_lock(&tasklist_lock
);
122 read_unlock(&tasklist_lock
);
125 printk("no user tasks on cell %d\n",mpp_cid());
129 static void show_otasks(void)
131 extern struct task_struct
*task
[];
132 struct task_struct
*p
;
135 extern int ap_current_uid
;
137 read_lock(&tasklist_lock
);
139 if(p
->uid
== ap_current_uid
) {
144 read_unlock(&tasklist_lock
);
147 printk("no tasks on cell %d\n",mpp_cid());
158 void mpp_hw_init(void)
160 extern void show_state(void);
161 extern void breakpoint(void);
162 extern void ctrl_alt_del(void);
163 extern void mac_print_state(void);
164 extern void show_debug_keys(void);
166 bif_add_debug_key('c',check_alive
,"check if a cell is alive");
167 bif_add_debug_key('k',show_debug_keys
,"show the kernel debug keys");
168 bif_add_debug_key('p',show_registers
,"show register info");
169 bif_add_debug_key('p',show_registers
,"show register info");
170 bif_add_debug_key('m',show_mem
,"detailed memory stats");
171 bif_add_debug_key('s',show_state
,"detailed process stats");
172 bif_add_debug_key('D',ap_start_debugger
,"launch the kernel debugger");
173 bif_add_debug_key('i',breakpoint
,"send a breakpoint");
174 bif_add_debug_key('r',ctrl_alt_del
,"run shutdown (doesn't work)");
175 bif_add_debug_key('P',show_ptasks
,"show running parallel tasks");
176 bif_add_debug_key('U',show_utasks
,"show all user tasks");
177 bif_add_debug_key('O',show_otasks
,"show own user tasks");
178 bif_add_debug_key('^',do_panic
,"panic :-)");
181 cap_cid0
= BIF_IN(BIF_CIDR1
);
182 cap_ncel0
= cap_init
.numcells
;
186 _ncelx
= _ncel
<8?_ncel
:8;
187 _ncely
= ((_ncel
-1) / _ncelx
) + 1;
188 _cidx
= _cid
% _ncelx
;
189 _cidy
= _cid
/ _ncelx
;