chrp_setup.c 16 KB

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