chrp_setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  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. * bootup setup stuff..
  10. */
  11. #include <linux/config.h>
  12. #include <linux/errno.h>
  13. #include <linux/sched.h>
  14. #include <linux/kernel.h>
  15. #include <linux/mm.h>
  16. #include <linux/stddef.h>
  17. #include <linux/unistd.h>
  18. #include <linux/ptrace.h>
  19. #include <linux/slab.h>
  20. #include <linux/user.h>
  21. #include <linux/a.out.h>
  22. #include <linux/tty.h>
  23. #include <linux/major.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/reboot.h>
  26. #include <linux/init.h>
  27. #include <linux/pci.h>
  28. #include <linux/version.h>
  29. #include <linux/adb.h>
  30. #include <linux/module.h>
  31. #include <linux/delay.h>
  32. #include <linux/ide.h>
  33. #include <linux/console.h>
  34. #include <linux/seq_file.h>
  35. #include <linux/root_dev.h>
  36. #include <linux/initrd.h>
  37. #include <linux/module.h>
  38. #include <asm/io.h>
  39. #include <asm/pgtable.h>
  40. #include <asm/prom.h>
  41. #include <asm/gg2.h>
  42. #include <asm/pci-bridge.h>
  43. #include <asm/dma.h>
  44. #include <asm/machdep.h>
  45. #include <asm/irq.h>
  46. #include <asm/hydra.h>
  47. #include <asm/sections.h>
  48. #include <asm/time.h>
  49. #include <asm/btext.h>
  50. #include <asm/i8259.h>
  51. #include <asm/open_pic.h>
  52. #include <asm/xmon.h>
  53. #include "mem_pieces.h"
  54. unsigned long chrp_get_rtc_time(void);
  55. int chrp_set_rtc_time(unsigned long nowtime);
  56. void chrp_calibrate_decr(void);
  57. long chrp_time_init(void);
  58. void chrp_find_bridges(void);
  59. void chrp_event_scan(void);
  60. void rtas_display_progress(char *, unsigned short);
  61. void rtas_indicator_progress(char *, unsigned short);
  62. void btext_progress(char *, unsigned short);
  63. extern int of_show_percpuinfo(struct seq_file *, int);
  64. int _chrp_type;
  65. EXPORT_SYMBOL(_chrp_type);
  66. /*
  67. * XXX this should be in xmon.h, but putting it there means xmon.h
  68. * has to include <linux/interrupt.h> (to get irqreturn_t), which
  69. * causes all sorts of problems. -- paulus
  70. */
  71. extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
  72. extern dev_t boot_dev;
  73. extern PTE *Hash, *Hash_end;
  74. extern unsigned long Hash_size, Hash_mask;
  75. extern int probingmem;
  76. extern unsigned long loops_per_jiffy;
  77. static int max_width;
  78. #ifdef CONFIG_SMP
  79. extern struct smp_ops_t chrp_smp_ops;
  80. #endif
  81. static const char *gg2_memtypes[4] = {
  82. "FPM", "SDRAM", "EDO", "BEDO"
  83. };
  84. static const char *gg2_cachesizes[4] = {
  85. "256 KB", "512 KB", "1 MB", "Reserved"
  86. };
  87. static const char *gg2_cachetypes[4] = {
  88. "Asynchronous", "Reserved", "Flow-Through Synchronous",
  89. "Pipelined Synchronous"
  90. };
  91. static const char *gg2_cachemodes[4] = {
  92. "Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
  93. };
  94. int
  95. chrp_show_cpuinfo(struct seq_file *m)
  96. {
  97. int i, sdramen;
  98. unsigned int t;
  99. struct device_node *root;
  100. const char *model = "";
  101. root = find_path_device("/");
  102. if (root)
  103. model = get_property(root, "model", NULL);
  104. seq_printf(m, "machine\t\t: CHRP %s\n", model);
  105. /* longtrail (goldengate) stuff */
  106. if (!strncmp(model, "IBM,LongTrail", 13)) {
  107. /* VLSI VAS96011/12 `Golden Gate 2' */
  108. /* Memory banks */
  109. sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL)
  110. >>31) & 1;
  111. for (i = 0; i < (sdramen ? 4 : 6); i++) {
  112. t = in_le32(gg2_pci_config_base+
  113. GG2_PCI_DRAM_BANK0+
  114. i*4);
  115. if (!(t & 1))
  116. continue;
  117. switch ((t>>8) & 0x1f) {
  118. case 0x1f:
  119. model = "4 MB";
  120. break;
  121. case 0x1e:
  122. model = "8 MB";
  123. break;
  124. case 0x1c:
  125. model = "16 MB";
  126. break;
  127. case 0x18:
  128. model = "32 MB";
  129. break;
  130. case 0x10:
  131. model = "64 MB";
  132. break;
  133. case 0x00:
  134. model = "128 MB";
  135. break;
  136. default:
  137. model = "Reserved";
  138. break;
  139. }
  140. seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
  141. gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
  142. }
  143. /* L2 cache */
  144. t = in_le32(gg2_pci_config_base+GG2_PCI_CC_CTRL);
  145. seq_printf(m, "board l2\t: %s %s (%s)\n",
  146. gg2_cachesizes[(t>>7) & 3],
  147. gg2_cachetypes[(t>>2) & 3],
  148. gg2_cachemodes[t & 3]);
  149. }
  150. return 0;
  151. }
  152. /*
  153. * Fixes for the National Semiconductor PC78308VUL SuperI/O
  154. *
  155. * Some versions of Open Firmware incorrectly initialize the IRQ settings
  156. * for keyboard and mouse
  157. */
  158. static inline void __init sio_write(u8 val, u8 index)
  159. {
  160. outb(index, 0x15c);
  161. outb(val, 0x15d);
  162. }
  163. static inline u8 __init sio_read(u8 index)
  164. {
  165. outb(index, 0x15c);
  166. return inb(0x15d);
  167. }
  168. static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
  169. u8 type)
  170. {
  171. u8 level0, type0, active;
  172. /* select logical device */
  173. sio_write(device, 0x07);
  174. active = sio_read(0x30);
  175. level0 = sio_read(0x70);
  176. type0 = sio_read(0x71);
  177. if (level0 != level || type0 != type || !active) {
  178. printk(KERN_WARNING "sio: %s irq level %d, type %d, %sactive: "
  179. "remapping to level %d, type %d, active\n",
  180. name, level0, type0, !active ? "in" : "", level, type);
  181. sio_write(0x01, 0x30);
  182. sio_write(level, 0x70);
  183. sio_write(type, 0x71);
  184. }
  185. }
  186. static void __init sio_init(void)
  187. {
  188. struct device_node *root;
  189. if ((root = find_path_device("/")) &&
  190. !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) {
  191. /* logical device 0 (KBC/Keyboard) */
  192. sio_fixup_irq("keyboard", 0, 1, 2);
  193. /* select logical device 1 (KBC/Mouse) */
  194. sio_fixup_irq("mouse", 1, 12, 2);
  195. }
  196. }
  197. static void __init pegasos_set_l2cr(void)
  198. {
  199. struct device_node *np;
  200. /* On Pegasos, enable the l2 cache if needed, as the OF forgets it */
  201. if (_chrp_type != _CHRP_Pegasos)
  202. return;
  203. /* Enable L2 cache if needed */
  204. np = find_type_devices("cpu");
  205. if (np != NULL) {
  206. unsigned int *l2cr = (unsigned int *)
  207. get_property (np, "l2cr", NULL);
  208. if (l2cr == NULL) {
  209. printk ("Pegasos l2cr : no cpu l2cr property found\n");
  210. return;
  211. }
  212. if (!((*l2cr) & 0x80000000)) {
  213. printk ("Pegasos l2cr : L2 cache was not active, "
  214. "activating\n");
  215. _set_L2CR(0);
  216. _set_L2CR((*l2cr) | 0x80000000);
  217. }
  218. }
  219. }
  220. void __init chrp_setup_arch(void)
  221. {
  222. struct device_node *device;
  223. /* init to some ~sane value until calibrate_delay() runs */
  224. loops_per_jiffy = 50000000/HZ;
  225. #ifdef CONFIG_BLK_DEV_INITRD
  226. /* this is fine for chrp */
  227. initrd_below_start_ok = 1;
  228. if (initrd_start)
  229. ROOT_DEV = Root_RAM0;
  230. else
  231. #endif
  232. ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
  233. /* On pegasos, enable the L2 cache if not already done by OF */
  234. pegasos_set_l2cr();
  235. /* Lookup PCI host bridges */
  236. chrp_find_bridges();
  237. #ifndef CONFIG_PPC64BRIDGE
  238. /*
  239. * Temporary fixes for PCI devices.
  240. * -- Geert
  241. */
  242. hydra_init(); /* Mac I/O */
  243. #endif /* CONFIG_PPC64BRIDGE */
  244. /*
  245. * Fix the Super I/O configuration
  246. */
  247. sio_init();
  248. /* Get the event scan rate for the rtas so we know how
  249. * often it expects a heartbeat. -- Cort
  250. */
  251. if ( rtas_data ) {
  252. struct property *p;
  253. device = find_devices("rtas");
  254. for ( p = device->properties;
  255. p && strncmp(p->name, "rtas-event-scan-rate", 20);
  256. p = p->next )
  257. /* nothing */ ;
  258. if ( p && *(unsigned long *)p->value ) {
  259. ppc_md.heartbeat = chrp_event_scan;
  260. ppc_md.heartbeat_reset = (HZ/(*(unsigned long *)p->value)*30)-1;
  261. ppc_md.heartbeat_count = 1;
  262. printk("RTAS Event Scan Rate: %lu (%lu jiffies)\n",
  263. *(unsigned long *)p->value, ppc_md.heartbeat_reset );
  264. }
  265. }
  266. pci_create_OF_bus_map();
  267. }
  268. void
  269. chrp_event_scan(void)
  270. {
  271. unsigned char log[1024];
  272. unsigned long ret = 0;
  273. /* XXX: we should loop until the hardware says no more error logs -- Cort */
  274. call_rtas( "event-scan", 4, 1, &ret, 0xffffffff, 0,
  275. __pa(log), 1024 );
  276. ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
  277. }
  278. void
  279. chrp_restart(char *cmd)
  280. {
  281. printk("RTAS system-reboot returned %d\n",
  282. call_rtas("system-reboot", 0, 1, NULL));
  283. for (;;);
  284. }
  285. void
  286. chrp_power_off(void)
  287. {
  288. /* allow power on only with power button press */
  289. printk("RTAS power-off returned %d\n",
  290. call_rtas("power-off", 2, 1, NULL,0xffffffff,0xffffffff));
  291. for (;;);
  292. }
  293. void
  294. chrp_halt(void)
  295. {
  296. chrp_power_off();
  297. }
  298. /*
  299. * Finds the open-pic node and sets OpenPIC_Addr based on its reg property.
  300. * Then checks if it has an interrupt-ranges property. If it does then
  301. * we have a distributed open-pic, so call openpic_set_sources to tell
  302. * the openpic code where to find the interrupt source registers.
  303. */
  304. static void __init chrp_find_openpic(void)
  305. {
  306. struct device_node *np;
  307. int len, i;
  308. unsigned int *iranges;
  309. void __iomem *isu;
  310. np = find_type_devices("open-pic");
  311. if (np == NULL || np->n_addrs == 0)
  312. return;
  313. printk(KERN_INFO "OpenPIC at %x (size %x)\n",
  314. np->addrs[0].address, np->addrs[0].size);
  315. OpenPIC_Addr = ioremap(np->addrs[0].address, 0x40000);
  316. if (OpenPIC_Addr == NULL) {
  317. printk(KERN_ERR "Failed to map OpenPIC!\n");
  318. return;
  319. }
  320. iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
  321. if (iranges == NULL || len < 2 * sizeof(unsigned int))
  322. return; /* not distributed */
  323. /*
  324. * The first pair of cells in interrupt-ranges refers to the
  325. * IDU; subsequent pairs refer to the ISUs.
  326. */
  327. len /= 2 * sizeof(unsigned int);
  328. if (np->n_addrs < len) {
  329. printk(KERN_ERR "Insufficient addresses for distributed"
  330. " OpenPIC (%d < %d)\n", np->n_addrs, len);
  331. return;
  332. }
  333. if (iranges[1] != 0) {
  334. printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
  335. iranges[0], iranges[0] + iranges[1] - 1);
  336. openpic_set_sources(iranges[0], iranges[1], NULL);
  337. }
  338. for (i = 1; i < len; ++i) {
  339. iranges += 2;
  340. printk(KERN_INFO "OpenPIC irqs %d..%d in ISU at %x (%x)\n",
  341. iranges[0], iranges[0] + iranges[1] - 1,
  342. np->addrs[i].address, np->addrs[i].size);
  343. isu = ioremap(np->addrs[i].address, np->addrs[i].size);
  344. if (isu != NULL)
  345. openpic_set_sources(iranges[0], iranges[1], isu);
  346. else
  347. printk(KERN_ERR "Failed to map OpenPIC ISU at %x!\n",
  348. np->addrs[i].address);
  349. }
  350. }
  351. #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
  352. static struct irqaction xmon_irqaction = {
  353. .handler = xmon_irq,
  354. .mask = CPU_MASK_NONE,
  355. .name = "XMON break",
  356. };
  357. #endif
  358. void __init chrp_init_IRQ(void)
  359. {
  360. struct device_node *np;
  361. unsigned long chrp_int_ack = 0;
  362. unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
  363. #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
  364. struct device_node *kbd;
  365. #endif
  366. for (np = find_devices("pci"); np != NULL; np = np->next) {
  367. unsigned int *addrp = (unsigned int *)
  368. get_property(np, "8259-interrupt-acknowledge", NULL);
  369. if (addrp == NULL)
  370. continue;
  371. chrp_int_ack = addrp[prom_n_addr_cells(np)-1];
  372. break;
  373. }
  374. if (np == NULL)
  375. printk(KERN_ERR "Cannot find PCI interrupt acknowledge address\n");
  376. chrp_find_openpic();
  377. if (OpenPIC_Addr) {
  378. prom_get_irq_senses(init_senses, NUM_8259_INTERRUPTS, NR_IRQS);
  379. OpenPIC_InitSenses = init_senses;
  380. OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS;
  381. openpic_init(NUM_8259_INTERRUPTS);
  382. /* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
  383. openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
  384. i8259_irq);
  385. }
  386. i8259_init(chrp_int_ack, 0);
  387. #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
  388. /* see if there is a keyboard in the device tree
  389. with a parent of type "adb" */
  390. for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next)
  391. if (kbd->parent && kbd->parent->type
  392. && strcmp(kbd->parent->type, "adb") == 0)
  393. break;
  394. if (kbd)
  395. setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
  396. #endif
  397. }
  398. void __init
  399. chrp_init2(void)
  400. {
  401. #ifdef CONFIG_NVRAM
  402. chrp_nvram_init();
  403. #endif
  404. request_region(0x20,0x20,"pic1");
  405. request_region(0xa0,0x20,"pic2");
  406. request_region(0x00,0x20,"dma1");
  407. request_region(0x40,0x20,"timer");
  408. request_region(0x80,0x10,"dma page reg");
  409. request_region(0xc0,0x20,"dma2");
  410. if (ppc_md.progress)
  411. ppc_md.progress(" Have fun! ", 0x7777);
  412. }
  413. static struct device_node *memory_node;
  414. static int __init get_mem_prop(char *name, struct mem_pieces *mp)
  415. {
  416. struct reg_property *rp;
  417. int i, s;
  418. unsigned int *ip;
  419. int nac = prom_n_addr_cells(memory_node);
  420. int nsc = prom_n_size_cells(memory_node);
  421. ip = (unsigned int *) get_property(memory_node, name, &s);
  422. if (ip == NULL) {
  423. printk(KERN_ERR "error: couldn't get %s property on /memory\n",
  424. name);
  425. return 0;
  426. }
  427. s /= (nsc + nac) * 4;
  428. rp = mp->regions;
  429. for (i = 0; i < s; ++i, ip += nac+nsc) {
  430. if (nac >= 2 && ip[nac-2] != 0)
  431. continue;
  432. rp->address = ip[nac-1];
  433. if (nsc >= 2 && ip[nac+nsc-2] != 0)
  434. rp->size = ~0U;
  435. else
  436. rp->size = ip[nac+nsc-1];
  437. ++rp;
  438. }
  439. mp->n_regions = rp - mp->regions;
  440. /* Make sure the pieces are sorted. */
  441. mem_pieces_sort(mp);
  442. mem_pieces_coalesce(mp);
  443. return 1;
  444. }
  445. static unsigned long __init chrp_find_end_of_memory(void)
  446. {
  447. unsigned long a, total;
  448. struct mem_pieces phys_mem;
  449. /*
  450. * Find out where physical memory is, and check that it
  451. * starts at 0 and is contiguous. It seems that RAM is
  452. * always physically contiguous on Power Macintoshes.
  453. *
  454. * Supporting discontiguous physical memory isn't hard,
  455. * it just makes the virtual <-> physical mapping functions
  456. * more complicated (or else you end up wasting space
  457. * in mem_map).
  458. */
  459. memory_node = find_devices("memory");
  460. if (memory_node == NULL || !get_mem_prop("reg", &phys_mem)
  461. || phys_mem.n_regions == 0)
  462. panic("No RAM??");
  463. a = phys_mem.regions[0].address;
  464. if (a != 0)
  465. panic("RAM doesn't start at physical address 0");
  466. total = phys_mem.regions[0].size;
  467. if (phys_mem.n_regions > 1) {
  468. printk("RAM starting at 0x%x is not contiguous\n",
  469. phys_mem.regions[1].address);
  470. printk("Using RAM from 0 to 0x%lx\n", total-1);
  471. }
  472. return total;
  473. }
  474. void __init
  475. chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
  476. unsigned long r6, unsigned long r7)
  477. {
  478. struct device_node *root = find_path_device ("/");
  479. char *machine = NULL;
  480. #ifdef CONFIG_BLK_DEV_INITRD
  481. /* take care of initrd if we have one */
  482. if ( r6 )
  483. {
  484. initrd_start = r6 + KERNELBASE;
  485. initrd_end = r6 + r7 + KERNELBASE;
  486. }
  487. #endif /* CONFIG_BLK_DEV_INITRD */
  488. ISA_DMA_THRESHOLD = ~0L;
  489. DMA_MODE_READ = 0x44;
  490. DMA_MODE_WRITE = 0x48;
  491. isa_io_base = CHRP_ISA_IO_BASE; /* default value */
  492. ppc_do_canonicalize_irqs = 1;
  493. if (root)
  494. machine = get_property(root, "model", NULL);
  495. if (machine && strncmp(machine, "Pegasos", 7) == 0) {
  496. _chrp_type = _CHRP_Pegasos;
  497. } else if (machine && strncmp(machine, "IBM", 3) == 0) {
  498. _chrp_type = _CHRP_IBM;
  499. } else if (machine && strncmp(machine, "MOT", 3) == 0) {
  500. _chrp_type = _CHRP_Motorola;
  501. } else {
  502. /* Let's assume it is an IBM chrp if all else fails */
  503. _chrp_type = _CHRP_IBM;
  504. }
  505. ppc_md.setup_arch = chrp_setup_arch;
  506. ppc_md.show_percpuinfo = of_show_percpuinfo;
  507. ppc_md.show_cpuinfo = chrp_show_cpuinfo;
  508. ppc_md.init_IRQ = chrp_init_IRQ;
  509. if (_chrp_type == _CHRP_Pegasos)
  510. ppc_md.get_irq = i8259_irq;
  511. else
  512. ppc_md.get_irq = openpic_get_irq;
  513. ppc_md.init = chrp_init2;
  514. ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
  515. ppc_md.restart = chrp_restart;
  516. ppc_md.power_off = chrp_power_off;
  517. ppc_md.halt = chrp_halt;
  518. ppc_md.time_init = chrp_time_init;
  519. ppc_md.set_rtc_time = chrp_set_rtc_time;
  520. ppc_md.get_rtc_time = chrp_get_rtc_time;
  521. ppc_md.calibrate_decr = chrp_calibrate_decr;
  522. ppc_md.find_end_of_memory = chrp_find_end_of_memory;
  523. if (rtas_data) {
  524. struct device_node *rtas;
  525. unsigned int *p;
  526. rtas = find_devices("rtas");
  527. if (rtas != NULL) {
  528. if (get_property(rtas, "display-character", NULL)) {
  529. ppc_md.progress = rtas_display_progress;
  530. p = (unsigned int *) get_property
  531. (rtas, "ibm,display-line-length", NULL);
  532. if (p)
  533. max_width = *p;
  534. } else if (get_property(rtas, "set-indicator", NULL))
  535. ppc_md.progress = rtas_indicator_progress;
  536. }
  537. }
  538. #ifdef CONFIG_BOOTX_TEXT
  539. if (ppc_md.progress == NULL && boot_text_mapped)
  540. ppc_md.progress = btext_progress;
  541. #endif
  542. #ifdef CONFIG_SMP
  543. smp_ops = &chrp_smp_ops;
  544. #endif /* CONFIG_SMP */
  545. /*
  546. * Print the banner, then scroll down so boot progress
  547. * can be printed. -- Cort
  548. */
  549. if (ppc_md.progress) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0);
  550. }
  551. void
  552. rtas_display_progress(char *s, unsigned short hex)
  553. {
  554. int width;
  555. char *os = s;
  556. if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) )
  557. return;
  558. width = max_width;
  559. while ( *os )
  560. {
  561. if ( (*os == '\n') || (*os == '\r') )
  562. width = max_width;
  563. else
  564. width--;
  565. call_rtas( "display-character", 1, 1, NULL, *os++ );
  566. /* if we overwrite the screen length */
  567. if ( width == 0 )
  568. while ( (*os != 0) && (*os != '\n') && (*os != '\r') )
  569. os++;
  570. }
  571. /*while ( width-- > 0 )*/
  572. call_rtas( "display-character", 1, 1, NULL, ' ' );
  573. }
  574. void
  575. rtas_indicator_progress(char *s, unsigned short hex)
  576. {
  577. call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex);
  578. }
  579. #ifdef CONFIG_BOOTX_TEXT
  580. void
  581. btext_progress(char *s, unsigned short hex)
  582. {
  583. prom_print(s);
  584. prom_print("\n");
  585. }
  586. #endif /* CONFIG_BOOTX_TEXT */