11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
15 #include <linux/stddef.h>
17 #include <linux/ptrace.h>
19 #include <linux/tty.h>
22 #include <linux/reboot.h>
24 #include <linux/pci.h>
25 #include <generated/utsrelease.h>
26 #include <linux/adb.h>
27 #include <linux/module.h>
36 #include <asm/pgtable.h>
38 #include <asm/pci-bridge.h>
40 #include <asm/machdep.h>
43 #include <asm/sections.h>
45 #include <asm/i8259.h>
58 static struct mpic *chrp_mpic;
67 static unsigned int __iomem *briq_SPOR;
73 static const char *gg2_memtypes[4] = {
74 "FPM",
"SDRAM",
"EDO",
"BEDO"
76 static const char *gg2_cachesizes[4] = {
77 "256 KB",
"512 KB",
"1 MB",
"Reserved"
79 static const char *gg2_cachetypes[4] = {
80 "Asynchronous",
"Reserved",
"Flow-Through Synchronous",
81 "Pipelined Synchronous"
83 static const char *gg2_cachemodes[4] = {
84 "Disabled",
"Write-Through",
"Copy-Back",
"Transparent Mode"
87 static const char *chrp_names[] = {
101 const char *
model =
"";
106 seq_printf(m,
"machine\t\t: CHRP %s\n", model);
109 if (model && !
strncmp(model,
"IBM,LongTrail", 13)) {
114 for (i = 0; i < (sdramen ? 4 : 6); i++) {
120 switch ((t>>8) & 0x1f) {
143 seq_printf(m,
"memory bank %d\t: %s %s\n", i, model,
144 gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
149 gg2_cachesizes[(t>>7) & 3],
150 gg2_cachetypes[(t>>2) & 3],
151 gg2_cachemodes[t & 3]);
180 sio_write(device, 0x07);
181 active = sio_read(0x30);
182 level0 = sio_read(0x70);
183 type0 = sio_read(0x71);
184 if (level0 != level || type0 != type || !active) {
186 "remapping to level %d, type %d, active\n",
187 name, level0, type0, !active ?
"in" :
"", level, type);
188 sio_write(0x01, 0x30);
189 sio_write(level, 0x70);
190 sio_write(type, 0x71);
194 static void __init sio_init(
void)
204 if (model && !
strncmp(model,
"IBM,LongTrail", 13)) {
206 sio_fixup_irq(
"keyboard", 0, 1, 2);
208 sio_fixup_irq(
"mouse", 1, 12, 2);
215 static void __init pegasos_set_l2cr(
void)
228 printk (
"Pegasos l2cr : no cpu l2cr property found\n");
231 if (!((*l2cr) & 0x80000000)) {
232 printk (
"Pegasos l2cr : L2 cache was not active, "
235 _set_L2CR((*l2cr) | 0x80000000);
242 static void briq_restart(
char *
cmd)
256 static void chrp_init_early(
void)
261 if (
strstr(cmd_line,
"console="))
272 if (
strcmp(property,
"Pegasos2"))
285 if (
strcmp(property,
"serial"))
295 if (!
strcmp(property,
"failsafe") || !
strcmp(property,
"serial"))
311 if (machine &&
strncmp(machine,
"Pegasos", 7) == 0) {
313 }
else if (machine &&
strncmp(machine,
"IBM", 3) == 0) {
315 }
else if (machine &&
strncmp(machine,
"MOT", 3) == 0) {
317 }
else if (machine &&
strncmp(machine,
"TotalImpact,BRIQ-1", 18) == 0) {
320 briq_SPOR =
ioremap(0xff0000e8, 4);
321 ppc_md.restart = briq_restart;
334 if (
rtas_token(
"get-time-of-day") != RTAS_UNKNOWN_SERVICE) {
363 if (
ppc_md.progress)
ppc_md.progress(
"Linux/PPC "UTS_RELEASE
"\n", 0x0);
366 static void chrp_8259_cascade(
unsigned int irq,
struct irq_desc *
desc)
371 if (cascade_irq !=
NO_IRQ)
380 static void __init chrp_find_openpic(
void)
384 int isu_size, idu_size;
385 const unsigned int *iranges, *opprop =
NULL;
387 unsigned long opaddr;
398 if (opprop && oplen >= na *
sizeof(
unsigned int)) {
399 opaddr = opprop[na-1];
400 oplen /= na *
sizeof(
unsigned int);
416 len /= 2 *
sizeof(
unsigned int);
424 " OpenPIC (%d < %d)\n", oplen, len);
430 if (len > 0 && iranges[1] != 0) {
432 iranges[0], iranges[0] + iranges[1] - 1);
433 idu_size = iranges[1];
436 isu_size = iranges[3];
438 chrp_mpic =
mpic_alloc(np, opaddr, MPIC_NO_RESET,
439 isu_size, 0,
" MPIC ");
440 if (chrp_mpic ==
NULL) {
445 for (i = 1; i < len; ++
i) {
449 iranges[0], iranges[0] + iranges[1] - 1,
461 #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
462 static struct irqaction xmon_irqaction = {
464 .name =
"XMON break",
468 static void __init chrp_find_8259(
void)
471 unsigned long chrp_int_ack = 0;
475 for_each_node_by_type(np,
"interrupt-controller")
484 if (pic ==
NULL && chrp_mpic !=
NULL) {
486 " assuming no legacy interrupts\n");
496 for_each_node_by_name(np,
"pci") {
498 "8259-interrupt-acknowledge",
NULL);
508 " address, polling\n");
515 if (chrp_mpic !=
NULL) {
517 if (cascade_irq ==
NO_IRQ)
520 irq_set_chained_handler(cascade_irq,
527 #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
537 if (chrp_mpic !=
NULL)
544 #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
547 for_each_node_by_name(kbd,
"keyboard")
553 setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
572 ppc_md.progress(
" Have fun! ", 0x7777);
575 static int __init chrp_probe(
void)
577 char *
dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
578 "device_type",
NULL);
581 if (
strcmp(dtype,
"chrp"))
596 .init_early = chrp_init_early,