1 /*
2  *  arch/ppc/platforms/setup.c
3  *
4  *  Copyright (C) 1995  Linus Torvalds
5  *  Adapted from 'alpha' version by Gary Thomas
6  *  Modified by Cort Dougan (cort@cs.nmt.edu)
7  */
8 
9 /*
10  * bootup setup stuff..
11  */
12 
13 #include <linux/config.h>
14 #include <linux/errno.h>
15 #include <linux/sched.h>
16 #include <linux/kernel.h>
17 #include <linux/mm.h>
18 #include <linux/stddef.h>
19 #include <linux/unistd.h>
20 #include <linux/ptrace.h>
21 #include <linux/slab.h>
22 #include <linux/user.h>
23 #include <linux/a.out.h>
24 #include <linux/tty.h>
25 #include <linux/major.h>
26 #include <linux/interrupt.h>
27 #include <linux/reboot.h>
28 #include <linux/init.h>
29 #include <linux/pci.h>
30 #include <linux/version.h>
31 #include <linux/adb.h>
32 #include <linux/module.h>
33 #include <linux/delay.h>
34 #include <linux/ide.h>
35 #include <linux/irq.h>
36 #include <linux/console.h>
37 #include <linux/seq_file.h>
38 
39 #include <asm/processor.h>
40 #include <asm/io.h>
41 #include <asm/pgtable.h>
42 #include <asm/prom.h>
43 #include <asm/gg2.h>
44 #include <asm/pci-bridge.h>
45 #include <asm/dma.h>
46 #include <asm/machdep.h>
47 #include <asm/irq.h>
48 #include <asm/hydra.h>
49 #include <asm/keyboard.h>
50 #include <asm/sections.h>
51 #include <asm/time.h>
52 #include <asm/btext.h>
53 #include <asm/i8259.h>
54 #include <asm/open_pic.h>
55 
56 #ifdef CONFIG_SERIAL
57 #include <linux/serial.h>
58 #include <linux/serialP.h>
59 #endif
60 
61 unsigned long chrp_get_rtc_time(void);
62 int chrp_set_rtc_time(unsigned long nowtime);
63 void chrp_calibrate_decr(void);
64 long chrp_time_init(void);
65 
66 void chrp_find_bridges(void);
67 void chrp_event_scan(void);
68 void rtas_display_progress(char *, unsigned short);
69 void rtas_indicator_progress(char *, unsigned short);
70 void btext_progress(char *, unsigned short);
71 
72 extern unsigned long pmac_find_end_of_memory(void);
73 extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
74 extern int pckbd_getkeycode(unsigned int scancode);
75 extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
76 			   char raw_mode);
77 extern char pckbd_unexpected_up(unsigned char keycode);
78 extern void pckbd_leds(unsigned char leds);
79 extern void pckbd_init_hw(void);
80 extern unsigned char pckbd_sysrq_xlate[128];
81 extern void select_adb_keyboard(void);
82 extern int of_show_percpuinfo(struct seq_file *, int);
83 
84 extern kdev_t boot_dev;
85 
86 extern unsigned long loops_per_jiffy;
87 
88 static int max_width __chrpdata;
89 int chrp_is_briq __chrpdata;
90 unsigned int* briq_SPOR __chrpdata; /* To be replaced by RTAS when available */
91 
92 #ifdef CONFIG_SMP
93 extern struct smp_ops_t chrp_smp_ops;
94 #endif
95 
96 static const char *gg2_memtypes[4] = {
97 	"FPM", "SDRAM", "EDO", "BEDO"
98 };
99 static const char *gg2_cachesizes[4] = {
100 	"256 KB", "512 KB", "1 MB", "Reserved"
101 };
102 static const char *gg2_cachetypes[4] = {
103 	"Asynchronous", "Reserved", "Flow-Through Synchronous",
104 	"Pipelined Synchronous"
105 };
106 static const char *gg2_cachemodes[4] = {
107 	"Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
108 };
109 
110 int __chrp
chrp_show_cpuinfo(struct seq_file * m)111 chrp_show_cpuinfo(struct seq_file *m)
112 {
113 	int i, sdramen;
114 	unsigned int t;
115 	struct device_node *root;
116 	const char *model = "";
117 
118 	root = find_path_device("/");
119 	if (root)
120 		model = get_property(root, "model", NULL);
121 	seq_printf(m, "machine\t\t: CHRP %s\n", model);
122 
123 	/* longtrail (goldengate) stuff */
124 	if (model && !strncmp(model, "IBM,LongTrail", 13)) {
125 		/* VLSI VAS96011/12 `Golden Gate 2' */
126 		/* Memory banks */
127 		sdramen = (in_le32((unsigned *)(gg2_pci_config_base+
128 						GG2_PCI_DRAM_CTRL))
129 			   >>31) & 1;
130 		for (i = 0; i < (sdramen ? 4 : 6); i++) {
131 			t = in_le32((unsigned *)(gg2_pci_config_base+
132 						 GG2_PCI_DRAM_BANK0+
133 						 i*4));
134 			if (!(t & 1))
135 				continue;
136 			switch ((t>>8) & 0x1f) {
137 			case 0x1f:
138 				model = "4 MB";
139 				break;
140 			case 0x1e:
141 				model = "8 MB";
142 				break;
143 			case 0x1c:
144 				model = "16 MB";
145 				break;
146 			case 0x18:
147 				model = "32 MB";
148 				break;
149 			case 0x10:
150 				model = "64 MB";
151 				break;
152 			case 0x00:
153 				model = "128 MB";
154 				break;
155 			default:
156 				model = "Reserved";
157 				break;
158 			}
159 			seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
160 				   gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
161 		}
162 		/* L2 cache */
163 		t = in_le32((unsigned *)(gg2_pci_config_base+GG2_PCI_CC_CTRL));
164 		seq_printf(m, "board l2\t: %s %s (%s)\n",
165 			   gg2_cachesizes[(t>>7) & 3],
166 			   gg2_cachetypes[(t>>2) & 3],
167 			   gg2_cachemodes[t & 3]);
168 	}
169 	return 0;
170 }
171 
172 /*
173  *  Fixes for the National Semiconductor PC78308VUL SuperI/O
174  *
175  *  Some versions of Open Firmware incorrectly initialize the IRQ settings
176  *  for keyboard and mouse
177  */
sio_write(u8 val,u8 index)178 static inline void __init sio_write(u8 val, u8 index)
179 {
180 	outb(index, 0x15c);
181 	outb(val, 0x15d);
182 }
183 
sio_read(u8 index)184 static inline u8 __init sio_read(u8 index)
185 {
186 	outb(index, 0x15c);
187 	return inb(0x15d);
188 }
189 
sio_fixup_irq(const char * name,u8 device,u8 level,u8 type)190 static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
191 				     u8 type)
192 {
193 	u8 level0, type0, active;
194 
195 	/* select logical device */
196 	sio_write(device, 0x07);
197 	active = sio_read(0x30);
198 	level0 = sio_read(0x70);
199 	type0 = sio_read(0x71);
200 	if (level0 != level || type0 != type || !active) {
201 		printk(KERN_WARNING "sio: %s irq level %d, type %d, %sactive: "
202 		       "remapping to level %d, type %d, active\n",
203 		       name, level0, type0, !active ? "in" : "", level, type);
204 		sio_write(0x01, 0x30);
205 		sio_write(level, 0x70);
206 		sio_write(type, 0x71);
207 	}
208 }
209 
sio_init(void)210 static void __init sio_init(void)
211 {
212 	struct device_node *root;
213 	const char *model;
214 
215 	root = find_path_device("/");
216 	if (!root)
217 		return;
218 
219 	model = get_property(root, "model", NULL);
220 	if (model && !strncmp(model, "IBM,LongTrail", 13)) {
221 		/* logical device 0 (KBC/Keyboard) */
222 		sio_fixup_irq("keyboard", 0, 1, 2);
223 		/* select logical device 1 (KBC/Mouse) */
224 		sio_fixup_irq("mouse", 1, 12, 2);
225 	}
226 
227 }
228 
229 
230 void __init
chrp_setup_arch(void)231 chrp_setup_arch(void)
232 {
233 	struct device_node *device;
234 
235 	/* init to some ~sane value until calibrate_delay() runs */
236 	loops_per_jiffy = 50000000/HZ;
237 
238 #ifdef CONFIG_BLK_DEV_INITRD
239 	/* this is fine for chrp */
240 	initrd_below_start_ok = 1;
241 
242 	if (initrd_start)
243 		ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
244 	else
245 #endif
246 		ROOT_DEV = to_kdev_t(0x0802); /* sda2 (sda1 is for the kernel) */
247 
248 	/* Lookup PCI host bridges */
249 	chrp_find_bridges();
250 
251 #ifndef CONFIG_PPC64BRIDGE
252 	/*
253 	 *  Temporary fixes for PCI devices.
254 	 *  -- Geert
255 	 */
256 	hydra_init();		/* Mac I/O */
257 
258 #endif /* CONFIG_PPC64BRIDGE */
259 
260 	/*
261 	 *  Fix the Super I/O configuration
262 	 */
263 	sio_init();
264 
265 	/*
266 	 *  Setup the console operations
267 	 */
268 #ifdef CONFIG_DUMMY_CONSOLE
269 	conswitchp = &dummy_con;
270 #endif
271 
272 	/* Get the event scan rate for the rtas so we know how
273 	 * often it expects a heartbeat. -- Cort
274 	 */
275 	if (rtas_data) {
276 		struct property *p;
277 		unsigned long rate, count;
278 		device = find_devices("rtas");
279 		for ( p = device->properties;
280 		      p && strncmp(p->name, "rtas-event-scan-rate", 20);
281 		      p = p->next )
282 			/* nothing */ ;
283 		if (p && (rate = *(unsigned long *)p->value) > 0) {
284 			/*
285 			 * The value is the number of times per minute.
286 			 * For now assign the full workload here to cpu 0.
287 			 *
288 			 * We now split the rate and spread the heartbeats
289 			 * when we kick secondary cpus so we can spread
290 			 * the calls evenly.
291 			 */
292 			ppc_md.heartbeat = chrp_event_scan;
293 
294 			count = (60*HZ) / rate;
295 			if (!count)        /* XXX insane */
296 				count = 1;
297 
298 			heartbeat_reset(0) = count;
299 			heartbeat_count(0) = 1;
300 
301 			printk("RTAS Event Scan Rate: %lu calls/minute "
302 			       "(every %lu jiffies)\n", rate, count );
303 		}
304 	}
305 
306 	pci_create_OF_bus_map();
307 }
308 
309 void __chrp
chrp_event_scan(void)310 chrp_event_scan(void)
311 {
312 	unsigned char log[1024];
313 	unsigned long ret = 0;
314 	/* XXX: we should loop until the hardware says no more error logs -- Cort */
315 	call_rtas( "event-scan", 4, 1, &ret, 0xffffffff, 0,
316 		   __pa(log), 1024 );
317 }
318 
319 void __chrp
chrp_restart(char * cmd)320 chrp_restart(char *cmd)
321 {
322 	printk("RTAS system-reboot returned %d\n",
323 	       call_rtas("system-reboot", 0, 1, NULL));
324 	for (;;);
325 }
326 
327 void __chrp
chrp_power_off(void)328 chrp_power_off(void)
329 {
330 	/* allow power on only with power button press */
331 	printk("RTAS power-off returned %d\n",
332 	       call_rtas("power-off", 2, 1, NULL,0xffffffff,0xffffffff));
333 	for (;;);
334 }
335 
336 void __chrp
chrp_halt(void)337 chrp_halt(void)
338 {
339 	chrp_power_off();
340 }
341 
342 u_int __chrp
chrp_irq_cannonicalize(u_int irq)343 chrp_irq_cannonicalize(u_int irq)
344 {
345 	if (irq == 2)
346 		return 9;
347 	return irq;
348 }
349 
350 static void __chrp
briq_restart(char * cmd)351 briq_restart(char *cmd)
352 {
353 	cli();
354 	if (briq_SPOR)
355 		out_be32(briq_SPOR, 0);
356 	for(;;) ;
357 }
358 
359 /*
360  * Finds the open-pic node and sets OpenPIC_Addr based on its reg property.
361  * Then checks if it has an interrupt-ranges property.  If it does then
362  * we have a distributed open-pic, so call openpic_set_sources to tell
363  * the openpic code where to find the interrupt source registers.
364  */
chrp_find_openpic(void)365 static void __init chrp_find_openpic(void)
366 {
367 	struct device_node *np;
368 	int len, i;
369 	unsigned int *iranges;
370 	void *isu;
371 
372 	np = find_type_devices("open-pic");
373 	if (np == NULL || np->n_addrs == 0)
374 		return;
375 	printk(KERN_INFO "OpenPIC at %x (size %x)\n",
376 	       np->addrs[0].address, np->addrs[0].size);
377 	OpenPIC_Addr = ioremap(np->addrs[0].address, 0x40000);
378 	if (OpenPIC_Addr == NULL) {
379 		printk(KERN_ERR "Failed to map OpenPIC!\n");
380 		return;
381 	}
382 
383 	iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
384 	if (iranges == NULL || len < 2 * sizeof(unsigned int))
385 		return;		/* not distributed */
386 
387 	/*
388 	 * The first pair of cells in interrupt-ranges refers to the
389 	 * IDU; subsequent pairs refer to the ISUs.
390 	 */
391 	len /= 2 * sizeof(unsigned int);
392 	if (np->n_addrs < len) {
393 		printk(KERN_ERR "Insufficient addresses for distributed"
394 		       " OpenPIC (%d < %d)\n", np->n_addrs, len);
395 		return;
396 	}
397 	if (iranges[1] != 0) {
398 		printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
399 		       iranges[0], iranges[0] + iranges[1] - 1);
400 		openpic_set_sources(iranges[0], iranges[1], NULL);
401 	}
402 	for (i = 1; i < len; ++i) {
403 		iranges += 2;
404 		printk(KERN_INFO "OpenPIC irqs %d..%d in ISU at %x (%x)\n",
405 		       iranges[0], iranges[0] + iranges[1] - 1,
406 		       np->addrs[i].address, np->addrs[i].size);
407 		isu = ioremap(np->addrs[i].address, np->addrs[i].size);
408 		if (isu != NULL)
409 			openpic_set_sources(iranges[0], iranges[1], isu);
410 		else
411 			printk(KERN_ERR "Failed to map OpenPIC ISU at %x!\n",
412 			       np->addrs[i].address);
413 	}
414 }
415 
416 static void __init
chrp_init_irq_openpic(unsigned long intack)417 chrp_init_irq_openpic(unsigned long intack)
418 {
419 	int i;
420 	unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
421 
422 	chrp_find_openpic();
423 
424 	prom_get_irq_senses(init_senses, NUM_8259_INTERRUPTS, NR_IRQS);
425 	OpenPIC_InitSenses = init_senses;
426 	OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS;
427 
428 	openpic_init(NUM_8259_INTERRUPTS);
429 	/* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
430 	openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
431 			       i8259_irq);
432 
433 	for (i = 0; i < NUM_8259_INTERRUPTS; i++)
434 		irq_desc[i].handler = &i8259_pic;
435 	i8259_init(intack);
436 }
437 
438 static void __init
chrp_init_irq_8259(unsigned long intack)439 chrp_init_irq_8259(unsigned long intack)
440 {
441 	int i;
442 
443 	ppc_md.get_irq = i8259_irq;
444 	for (i = 0; i < NUM_8259_INTERRUPTS; i++)
445 		irq_desc[i].handler = &i8259_pic;
446 	i8259_init(intack);
447 }
448 
chrp_init_IRQ(void)449 void __init chrp_init_IRQ(void)
450 {
451 	struct device_node *np;
452 	unsigned long intack = 0;
453 	struct device_node *main_irq_ctrler = NULL;
454 #if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) && defined(XMON)
455 	struct device_node *kbd;
456 #endif
457 
458 	for (np = find_devices("pci"); np != NULL; np = np->next) {
459 		unsigned int *addrp = (unsigned int *)
460 			get_property(np, "8259-interrupt-acknowledge", NULL);
461 		if (addrp == NULL)
462 			continue;
463 		intack = addrp[prom_n_addr_cells(np)-1];
464 		break;
465 	}
466 	if (np == NULL)
467 		printk("Cannot find pci to get ack address\n");
468 
469 	/* Look for the node of the toplevel interrupt controller.
470 	 * If we don't find it, we assume openpic
471 	 */
472 	np = find_path_device("/chosen");
473 	if (np) {
474 		phandle *irq_ctrler_ph =
475 			(phandle *)get_property(np, "interrupt-controller", NULL);
476 		if (irq_ctrler_ph)
477 			main_irq_ctrler = find_phandle(*irq_ctrler_ph);
478 	}
479 
480 	if (main_irq_ctrler && device_is_compatible(main_irq_ctrler, "8259"))
481 		chrp_init_irq_8259(intack);
482 	else
483 		chrp_init_irq_openpic(intack);
484 
485 #if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) && defined(XMON)
486 	/* see if there is a keyboard in the device tree
487 	   with a parent of type "adb" */
488 	for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next)
489 		if (kbd->parent && kbd->parent->type
490 		    && strcmp(kbd->parent->type, "adb") == 0)
491 			break;
492 	if (kbd)
493 		request_irq(HYDRA_INT_ADB_NMI, xmon_irq, 0, "XMON break", 0);
494 #endif
495 }
496 
497 void __init
chrp_init2(void)498 chrp_init2(void)
499 {
500 
501 	if (chrp_is_briq)
502 		briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4);
503 #ifdef CONFIG_NVRAM
504 /* Fix me: currently, a lot of pmac_nvram routines are marked __pmac, and
505  * blindly calling pmac_nvram_init() on chrp cause bad results.
506  * Among others, it cracks on briQ.
507  * Please implement a CHRP specific version. --BenH
508  */
509 	if (!chrp_is_briq)
510 		pmac_nvram_init();
511 #endif
512 	/* This is to be replaced by RTAS when available */
513 
514 	request_region(0x20,0x20,"pic1");
515 	request_region(0xa0,0x20,"pic2");
516 	request_region(0x00,0x20,"dma1");
517 	request_region(0x40,0x20,"timer");
518 	request_region(0x80,0x10,"dma page reg");
519 	request_region(0xc0,0x20,"dma2");
520 
521 	if (ppc_md.progress)
522 		ppc_md.progress("  Have fun!    ", 0x7777);
523 
524 #if defined(CONFIG_VT) && (defined(CONFIG_ADB_KEYBOARD) || defined(CONFIG_INPUT))
525 	/* see if there is a keyboard in the device tree
526 	   with a parent of type "adb" */
527 	{
528 		struct device_node *kbd;
529 
530 		for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) {
531 			if (kbd->parent && kbd->parent->type
532 			    && strcmp(kbd->parent->type, "adb") == 0) {
533 				select_adb_keyboard();
534 				break;
535 			}
536 		}
537 	}
538 #endif /* CONFIG_VT && (CONFIG_ADB_KEYBOARD || CONFIG_INPUT) */
539 }
540 
541 void __init
chrp_init(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)542 chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
543 	  unsigned long r6, unsigned long r7)
544 {
545 	struct device_node *root = find_path_device("/");
546 	char *machine;
547 
548 #ifdef CONFIG_BLK_DEV_INITRD
549 	/* take care of initrd if we have one */
550 	if ( r6 )
551 	{
552 		initrd_start = r6 + KERNELBASE;
553 		initrd_end = r6 + r7 + KERNELBASE;
554 	}
555 #endif /* CONFIG_BLK_DEV_INITRD */
556 
557 	ISA_DMA_THRESHOLD = ~0L;
558 	DMA_MODE_READ = 0x44;
559 	DMA_MODE_WRITE = 0x48;
560 	isa_io_base = CHRP_ISA_IO_BASE;		/* default value */
561 
562 	/* Check if it's a briq */
563 	machine = get_property(root, "model", NULL);
564 	chrp_is_briq = machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0;
565 #ifdef CONFIG_SERIAL
566 	if (chrp_is_briq) {
567 		/* briQ has a different serial clock */
568 		extern struct serial_state rs_table[];
569 		rs_table[0].baud_base = (7372800 / 16);
570 		rs_table[1].baud_base = (7372800 / 16);
571 	}
572 #endif /* CONFIG_SERIAL */
573 
574 	ppc_md.setup_arch     = chrp_setup_arch;
575 	ppc_md.show_percpuinfo = of_show_percpuinfo;
576 	ppc_md.show_cpuinfo   = chrp_show_cpuinfo;
577 	ppc_md.irq_cannonicalize = chrp_irq_cannonicalize;
578 	ppc_md.init_IRQ       = chrp_init_IRQ;
579 	ppc_md.get_irq        = openpic_get_irq;
580 
581 	ppc_md.init           = chrp_init2;
582 
583 	ppc_md.restart        = chrp_is_briq ? briq_restart : chrp_restart;
584 	ppc_md.power_off      = chrp_power_off;
585 	ppc_md.halt           = chrp_halt;
586 
587 	ppc_md.time_init      = chrp_time_init;
588 	ppc_md.set_rtc_time   = chrp_set_rtc_time;
589 	ppc_md.get_rtc_time   = chrp_get_rtc_time;
590 	ppc_md.calibrate_decr = chrp_calibrate_decr;
591 
592 	ppc_md.find_end_of_memory = pmac_find_end_of_memory;
593 
594 #ifdef CONFIG_VT
595 	/* these are adjusted in chrp_init2 if we have an ADB keyboard */
596 	ppc_md.kbd_setkeycode    = pckbd_setkeycode;
597 	ppc_md.kbd_getkeycode    = pckbd_getkeycode;
598 	ppc_md.kbd_translate     = pckbd_translate;
599 	ppc_md.kbd_unexpected_up = pckbd_unexpected_up;
600 	if (!chrp_is_briq) {
601 		ppc_md.kbd_leds          = pckbd_leds;
602 		ppc_md.kbd_init_hw       = pckbd_init_hw;
603 	}
604 #ifdef CONFIG_MAGIC_SYSRQ
605 	ppc_md.ppc_kbd_sysrq_xlate	 = pckbd_sysrq_xlate;
606 	SYSRQ_KEY = 0x54;
607 #endif /* CONFIG_MAGIC_SYSRQ */
608 #endif /* CONFIG_VT */
609 
610 	if (rtas_data) {
611 		struct device_node *rtas;
612 		unsigned int *p;
613 
614 		rtas = find_devices("rtas");
615 		if (rtas != NULL) {
616 			if (get_property(rtas, "display-character", NULL)) {
617 				ppc_md.progress = rtas_display_progress;
618 				p = (unsigned int *) get_property
619 				       (rtas, "ibm,display-line-length", NULL);
620 				if (p)
621 					max_width = *p;
622 			} else if (get_property(rtas, "set-indicator", NULL))
623 				ppc_md.progress = rtas_indicator_progress;
624 		}
625 	}
626 #ifdef CONFIG_BOOTX_TEXT
627 	if (ppc_md.progress == NULL && boot_text_mapped)
628 		ppc_md.progress = btext_progress;
629 #endif
630 
631 #ifdef CONFIG_SMP
632 	ppc_md.smp_ops = &chrp_smp_ops;
633 #endif /* CONFIG_SMP */
634 
635 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
636 #endif
637 
638 	/*
639 	 * Print the banner, then scroll down so boot progress
640 	 * can be printed.  -- Cort
641 	 */
642 	if ( ppc_md.progress ) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0);
643 }
644 
645 void __chrp
rtas_display_progress(char * s,unsigned short hex)646 rtas_display_progress(char *s, unsigned short hex)
647 {
648 	int width;
649 	char *os = s;
650 
651 	if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) )
652 		return;
653 
654 	width = max_width;
655 	while ( *os )
656 	{
657 		if ( (*os == '\n') || (*os == '\r') )
658 			width = max_width;
659 		else
660 			width--;
661 		call_rtas( "display-character", 1, 1, NULL, *os++ );
662 		/* if we overwrite the screen length */
663 		if ( width == 0 )
664 			while ( (*os != 0) && (*os != '\n') && (*os != '\r') )
665 				os++;
666 	}
667 
668 	/*while ( width-- > 0 )*/
669 	call_rtas( "display-character", 1, 1, NULL, ' ' );
670 }
671 
672 void __chrp
rtas_indicator_progress(char * s,unsigned short hex)673 rtas_indicator_progress(char *s, unsigned short hex)
674 {
675 	call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex);
676 }
677 
678 #ifdef CONFIG_BOOTX_TEXT
679 void
btext_progress(char * s,unsigned short hex)680 btext_progress(char *s, unsigned short hex)
681 {
682 	prom_print(s);
683 	prom_print("\n");
684 }
685 #endif /* CONFIG_BOOTX_TEXT */
686