2 * Note that prom_init() and anything called from prom_init()
3 * may be running at an address that is different from the address
4 * that it was linked at. References to static data items are
5 * handled by compiling this file with -mrelocatable-lib.
8 #include <linux/config.h>
9 #include <linux/kernel.h>
10 #include <linux/string.h>
11 #include <linux/init.h>
12 #include <linux/version.h>
13 #include <linux/threads.h>
14 #include <linux/spinlock.h>
15 #include <linux/ioport.h>
16 #include <linux/pci.h>
17 #include <linux/slab.h>
19 #include <asm/sections.h>
25 #include <asm/bootx.h>
26 #include <asm/system.h>
28 #include <asm/pgtable.h>
29 #include <asm/bitops.h>
30 #include <asm/bootinfo.h>
31 #include <asm/btext.h>
32 #include <asm/pci-bridge.h>
33 #include <asm/open_pic.h>
34 #include <asm/cacheflush.h>
36 #ifdef CONFIG_LOGO_LINUX_CLUT224
37 #include <linux/linux_logo.h>
38 extern const struct linux_logo logo_linux_clut224;
42 * Properties whose value is longer than this get excluded from our
43 * copy of the device tree. This way we don't waste space storing
44 * things like "driver,AAPL,MacOS,PowerPC" properties. But this value
45 * does need to be big enough to ensure that we don't lose things
46 * like the interrupt-map property on a PCI-PCI bridge.
48 #define MAX_PROPERTY_LENGTH 4096
50 #ifndef FB_MAX /* avoid pulling in all of the fb stuff */
54 #define ALIGNUL(x) (((x) + sizeof(unsigned long)-1) & -sizeof(unsigned long))
69 struct pci_reg_property {
70 struct pci_address addr;
76 struct pci_address addr;
82 struct isa_reg_property {
89 struct pci_address addr;
95 static void prom_exit(void);
96 static void *call_prom(const char *service, int nargs, int nret, ...);
97 static void *call_prom_ret(const char *service, int nargs, int nret,
99 static void prom_print_hex(unsigned int v);
100 static int prom_set_color(ihandle ih, int i, int r, int g, int b);
101 static int prom_next_node(phandle *nodep);
102 static unsigned long check_display(unsigned long mem);
103 static void setup_disp_fake_bi(ihandle dp);
104 static unsigned long copy_device_tree(unsigned long mem_start,
105 unsigned long mem_end);
106 static unsigned long inspect_node(phandle node, struct device_node *dad,
107 unsigned long mem_start, unsigned long mem_end,
108 struct device_node ***allnextpp);
109 static void prom_hold_cpus(unsigned long mem);
110 static void prom_instantiate_rtas(void);
111 static void * early_get_property(unsigned long base, unsigned long node,
114 prom_entry prom __initdata = 0;
115 ihandle prom_chosen __initdata = 0;
116 ihandle prom_stdout __initdata = 0;
118 char *prom_display_paths[FB_MAX] __initdata = { 0, };
119 phandle prom_display_nodes[FB_MAX] __initdata;
120 unsigned int prom_num_displays __initdata = 0;
121 static char *of_stdout_device __initdata = 0;
122 static ihandle prom_disp_node __initdata = 0;
124 unsigned int rtas_data; /* physical pointer */
125 unsigned int rtas_entry; /* physical pointer */
126 unsigned int rtas_size;
127 unsigned int old_rtas;
129 boot_infos_t *boot_infos;
132 struct device_node *allnodes;
139 struct prom_args args;
141 args.service = "exit";
145 for (;;) /* should never get here */
150 call_prom(const char *service, int nargs, int nret, ...)
154 struct prom_args prom_args;
156 prom_args.service = service;
157 prom_args.nargs = nargs;
158 prom_args.nret = nret;
159 va_start(list, nret);
160 for (i = 0; i < nargs; ++i)
161 prom_args.args[i] = va_arg(list, void *);
163 for (i = 0; i < nret; ++i)
164 prom_args.args[i + nargs] = 0;
166 return prom_args.args[nargs];
170 call_prom_ret(const char *service, int nargs, int nret, void **rets, ...)
174 struct prom_args prom_args;
176 prom_args.service = service;
177 prom_args.nargs = nargs;
178 prom_args.nret = nret;
179 va_start(list, rets);
180 for (i = 0; i < nargs; ++i)
181 prom_args.args[i] = va_arg(list, void *);
183 for (i = 0; i < nret; ++i)
184 prom_args.args[i + nargs] = 0;
186 for (i = 1; i < nret; ++i)
187 rets[i-1] = prom_args.args[nargs + i];
188 return prom_args.args[nargs];
192 prom_print(const char *msg)
196 if (prom_stdout == 0)
199 for (p = msg; *p != 0; p = q) {
200 for (q = p; *q != 0 && *q != '\n'; ++q)
203 call_prom("write", 3, 1, prom_stdout, p, q - p);
206 call_prom("write", 3, 1, prom_stdout, "\r\n", 2);
212 prom_print_hex(unsigned int v)
217 for (i = 0; i < 8; ++i) {
218 c = (v >> ((7-i)*4)) & 0xf;
219 c += (c >= 10)? ('a' - 10): '0';
228 prom_set_color(ihandle ih, int i, int r, int g, int b)
230 struct prom_args prom_args;
232 prom_args.service = "call-method";
235 prom_args.args[0] = "color!";
236 prom_args.args[1] = ih;
237 prom_args.args[2] = (void *) i;
238 prom_args.args[3] = (void *) b;
239 prom_args.args[4] = (void *) g;
240 prom_args.args[5] = (void *) r;
242 return (int) prom_args.args[6];
246 prom_next_node(phandle *nodep)
250 if ((node = *nodep) != 0
251 && (*nodep = call_prom("child", 1, 1, node)) != 0)
253 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
256 if ((node = call_prom("parent", 1, 1, node)) == 0)
258 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
265 * Set up a hash table with a set of entries in it to map the
266 * first 64MB of RAM. This is used on 64-bit machines since
267 * some of them don't have BATs.
270 static inline void make_pte(unsigned long htab, unsigned int hsize,
271 unsigned int va, unsigned int pa, int mode)
274 unsigned int hash, i, vsid;
276 vsid = ((va >> 28) * 0x111) << 12;
277 hash = ((va ^ vsid) >> 5) & 0x7fff80;
278 pteg = (unsigned int *)(htab + (hash & (hsize - 1)));
279 for (i = 0; i < 8; ++i, pteg += 4) {
280 if ((pteg[1] & 1) == 0) {
281 pteg[1] = vsid | ((va >> 16) & 0xf80) | 1;
288 extern unsigned long _SDR1;
290 extern unsigned long Hash_size;
293 prom_alloc_htab(void)
300 * Because of OF bugs we can't use the "claim" client
301 * interface to allocate memory for the hash table.
302 * This code is only used on 64-bit PPCs, and the only
303 * 64-bit PPCs at the moment are RS/6000s, and their
304 * OF is based at 0xc00000 (the 12M point), so we just
305 * arbitrarily use the 0x800000 - 0xc00000 region for the
309 hsize = 4 << 20; /* POWER4 has no BATs */
311 call_prom("claim", 3, 1, htab, hsize, 0);
312 Hash = (void *)(htab + KERNELBASE);
314 _SDR1 = htab + __ilog2(hsize) - 18;
317 * Put in PTEs for the first 64MB of RAM
319 memset((void *)htab, 0, hsize);
320 for (addr = 0; addr < 0x4000000; addr += 0x1000)
321 make_pte(htab, hsize, addr + KERNELBASE, addr,
322 _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX);
323 #if 0 /* DEBUG stuff mapping the SCC */
324 make_pte(htab, hsize, 0x80013000, 0x80013000,
325 _PAGE_ACCESSED | _PAGE_NO_CACHE | _PAGE_GUARDED | PP_RWXX);
328 #endif /* CONFIG_POWER4 */
332 * If we have a display that we don't know how to drive,
333 * we will want to try to execute OF's open method for it
334 * later. However, OF will probably fall over if we do that
335 * we've taken over the MMU.
336 * So we check whether we will need to open the display,
337 * and if so, open it now.
339 static unsigned long __init
340 check_display(unsigned long mem)
345 char type[16], *path;
346 static unsigned char default_colors[] = {
364 const unsigned char *clut;
368 for (node = 0; prom_next_node(&node); ) {
370 call_prom("getprop", 4, 1, node, "device_type",
372 if (strcmp(type, "display") != 0)
374 /* It seems OF doesn't null-terminate the path :-( */
376 memset(path, 0, 256);
377 if ((int) call_prom("package-to-path", 3, 1,
378 node, path, 255) < 0)
382 * If this display is the device that OF is using for stdout,
383 * move it to the front of the list.
385 mem += strlen(path) + 1;
386 i = prom_num_displays++;
387 if (of_stdout_device != 0 && i > 0
388 && strcmp(of_stdout_device, path) == 0) {
390 prom_display_paths[i]
391 = prom_display_paths[i-1];
392 prom_display_nodes[i]
393 = prom_display_nodes[i-1];
396 prom_display_paths[i] = path;
397 prom_display_nodes[i] = node;
399 prom_disp_node = node;
400 if (prom_num_displays >= FB_MAX)
404 for (j=0; j<prom_num_displays; j++) {
405 path = prom_display_paths[j];
406 prom_print("opening display ");
408 ih = call_prom("open", 1, 1, path);
409 if (ih == 0 || ih == (ihandle) -1) {
410 prom_print("... failed\n");
411 for (i=j+1; i<prom_num_displays; i++) {
412 prom_display_paths[i-1] = prom_display_paths[i];
413 prom_display_nodes[i-1] = prom_display_nodes[i];
415 if (--prom_num_displays > 0) {
416 prom_disp_node = prom_display_nodes[j];
419 prom_disp_node = NULL;
422 prom_print("... ok\n");
424 * Setup a usable color table when the appropriate
425 * method is available.
426 * Should update this to use set-colors.
428 clut = default_colors;
429 for (i = 0; i < 32; i++, clut += 3)
430 if (prom_set_color(ih, i, clut[0], clut[1],
434 #ifdef CONFIG_LOGO_LINUX_CLUT224
435 clut = PTRRELOC(logo_linux_clut224.clut);
436 for (i = 0; i < logo_linux_clut224.clutsize;
438 if (prom_set_color(ih, i + 32, clut[0],
439 clut[1], clut[2]) != 0)
441 #endif /* CONFIG_LOGO_LINUX_CLUT224 */
448 /* This function will enable the early boot text when doing OF booting. This
449 * way, xmon output should work too
452 setup_disp_fake_bi(ihandle dp)
454 #ifdef CONFIG_BOOTX_TEXT
455 int width = 640, height = 480, depth = 8, pitch;
457 struct pci_reg_property addrs[8];
460 char *getprop = "getprop";
462 prom_print("Initializing fake screen: ");
464 memset(name, 0, sizeof(name));
465 call_prom(getprop, 4, 1, dp, "name", name, sizeof(name));
466 name[sizeof(name)-1] = 0;
469 call_prom(getprop, 4, 1, dp, "width", &width, sizeof(width));
470 call_prom(getprop, 4, 1, dp, "height", &height, sizeof(height));
471 call_prom(getprop, 4, 1, dp, "depth", &depth, sizeof(depth));
472 pitch = width * ((depth + 7) / 8);
473 call_prom(getprop, 4, 1, dp, "linebytes",
474 &pitch, sizeof(pitch));
476 pitch = 0x1000; /* for strange IBM display */
478 call_prom(getprop, 4, 1, dp, "address",
479 &address, sizeof(address));
481 /* look for an assigned address with a size of >= 1MB */
482 naddrs = (int) call_prom(getprop, 4, 1, dp,
483 "assigned-addresses",
484 addrs, sizeof(addrs));
485 naddrs /= sizeof(struct pci_reg_property);
486 for (i = 0; i < naddrs; ++i) {
487 if (addrs[i].size_lo >= (1 << 20)) {
488 address = addrs[i].addr.a_lo;
489 /* use the BE aperture if possible */
490 if (addrs[i].size_lo >= (16 << 20))
491 address += (8 << 20);
496 prom_print("Failed to get address\n");
500 /* kludge for valkyrie */
501 if (strcmp(name, "valkyrie") == 0)
505 #if CONFIG_TASK_SIZE > 0x80000000
506 #error CONFIG_TASK_SIZE cannot be above 0x80000000 with BOOTX_TEXT on G5
509 extern boot_infos_t disp_bi;
510 unsigned long va, pa, i, offset;
512 pa = address & 0xfffff000ul;
513 offset = address & 0x00000fff;
515 for (i=0; i<0x4000; i++) {
516 make_pte((unsigned long)Hash - KERNELBASE, Hash_size, va, pa,
517 _PAGE_ACCESSED | _PAGE_NO_CACHE |
518 _PAGE_GUARDED | PP_RWXX);
522 btext_setup_display(width, height, depth, pitch, 0x90000000 | offset);
523 disp_bi.dispDeviceBase = (u8 *)address;
525 #else /* CONFIG_POWER4 */
526 btext_setup_display(width, height, depth, pitch, address);
528 #endif /* CONFIG_POWER4 */
529 #endif /* CONFIG_BOOTX_TEXT */
533 * Make a copy of the device tree from the PROM.
535 static unsigned long __init
536 copy_device_tree(unsigned long mem_start, unsigned long mem_end)
539 unsigned long new_start;
540 struct device_node **allnextp;
542 root = call_prom("peer", 1, 1, (phandle)0);
543 if (root == (phandle)0) {
544 prom_print("couldn't get device tree root\n");
547 allnextp = &allnodes;
548 mem_start = ALIGNUL(mem_start);
549 new_start = inspect_node(root, 0, mem_start, mem_end, &allnextp);
554 static unsigned long __init
555 inspect_node(phandle node, struct device_node *dad,
556 unsigned long mem_start, unsigned long mem_end,
557 struct device_node ***allnextpp)
561 struct device_node *np;
562 struct property *pp, **prev_propp;
563 char *prev_name, *namep;
566 np = (struct device_node *) mem_start;
567 mem_start += sizeof(struct device_node);
568 memset(np, 0, sizeof(*np));
570 **allnextpp = PTRUNRELOC(np);
571 *allnextpp = &np->allnext;
573 np->parent = PTRUNRELOC(dad);
574 /* we temporarily use the `next' field as `last_child'. */
576 dad->child = PTRUNRELOC(np);
578 dad->next->sibling = PTRUNRELOC(np);
582 /* get and store all properties */
583 prev_propp = &np->properties;
586 pp = (struct property *) mem_start;
587 namep = (char *) (pp + 1);
588 pp->name = PTRUNRELOC(namep);
589 if ((int) call_prom("nextprop", 3, 1, node, prev_name,
592 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
594 valp = (unsigned char *) mem_start;
595 pp->value = PTRUNRELOC(valp);
597 call_prom("getprop", 4, 1, node, namep,
598 valp, mem_end - mem_start);
601 #ifdef MAX_PROPERTY_LENGTH
602 if (pp->length > MAX_PROPERTY_LENGTH)
603 continue; /* ignore this property */
605 mem_start = ALIGNUL(mem_start + pp->length);
606 *prev_propp = PTRUNRELOC(pp);
607 prev_propp = &pp->next;
609 if (np->node != NULL) {
610 /* Add a "linux,phandle" property" */
611 pp = (struct property *) mem_start;
612 *prev_propp = PTRUNRELOC(pp);
613 prev_propp = &pp->next;
614 namep = (char *) (pp + 1);
615 pp->name = PTRUNRELOC(namep);
616 strcpy(namep, "linux,phandle");
617 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
618 pp->value = (unsigned char *) PTRUNRELOC(&np->node);
619 pp->length = sizeof(np->node);
623 /* get the node's full name */
624 l = (int) call_prom("package-to-path", 3, 1, node,
625 (char *) mem_start, mem_end - mem_start);
627 np->full_name = PTRUNRELOC((char *) mem_start);
628 *(char *)(mem_start + l) = 0;
629 mem_start = ALIGNUL(mem_start + l + 1);
632 /* do all our children */
633 child = call_prom("child", 1, 1, node);
634 while (child != (void *)0) {
635 mem_start = inspect_node(child, np, mem_start, mem_end,
637 child = call_prom("peer", 1, 1, child);
643 unsigned long smp_chrp_cpu_nr __initdata = 0;
646 * With CHRP SMP we need to use the OF to start the other
647 * processors so we can't wait until smp_boot_cpus (the OF is
648 * trashed by then) so we have to put the processors into
649 * a holding pattern controlled by the kernel (not OF) before
652 * This uses a chunk of high memory, puts some holding pattern
653 * code there and sends the other processors off to there until
654 * smp_boot_cpus tells them to do something. We do that by using
655 * physical address 0x0. The holding pattern checks that address
656 * until its cpu # is there, when it is that cpu jumps to
657 * __secondary_start(). smp_boot_cpus() takes care of setting those
660 * We also use physical address 0x4 here to tell when a cpu
661 * is in its holding pattern code.
665 * Note that we have to do this if we have more than one CPU,
666 * even if this is a UP kernel. Otherwise when we trash OF
667 * the other CPUs will start executing some random instructions
668 * and crash the system. -- paulus
671 prom_hold_cpus(unsigned long mem)
673 extern void __secondary_hold(void);
677 char type[16], *path;
681 * XXX: hack to make sure we're chrp, assume that if we're
682 * chrp we have a device_type property -- Cort
684 node = call_prom("finddevice", 1, 1, "/");
685 if ((int)call_prom("getprop", 4, 1, node,
686 "device_type",type, sizeof(type)) <= 0)
689 /* copy the holding pattern code to someplace safe (0) */
690 /* the holding pattern is now within the first 0x100
691 bytes of the kernel image -- paulus */
692 memcpy((void *)0, _stext, 0x100);
693 flush_icache_range(0, 0x100);
696 *(unsigned long *)(0x0) = 0;
697 asm volatile("dcbf 0,%0": : "r" (0) : "memory");
698 for (node = 0; prom_next_node(&node); ) {
700 call_prom("getprop", 4, 1, node, "device_type",
702 if (strcmp(type, "cpu") != 0)
705 memset(path, 0, 256);
706 if ((int) call_prom("package-to-path", 3, 1,
707 node, path, 255) < 0)
710 call_prom("getprop", 4, 1, node, "reg", ®, sizeof(reg));
711 cpu = smp_chrp_cpu_nr++;
713 smp_hw_index[cpu] = reg;
714 #endif /* CONFIG_SMP */
715 /* XXX: hack - don't start cpu 0, this cpu -- Cort */
718 prom_print("starting cpu ");
721 call_prom("start-cpu", 3, 0, node,
722 (char *)__secondary_hold - _stext, cpu);
724 for ( i = 0 ; (i < 10000) && (*(ulong *)(0x4) == 0); i++ )
726 if (*(ulong *)(0x4) == cpu)
729 prom_print("failed: ");
730 prom_print_hex(*(ulong *)0x4);
737 prom_instantiate_rtas(void)
741 struct prom_args prom_args;
743 prom_rtas = call_prom("finddevice", 1, 1, "/rtas");
744 if (prom_rtas == (void *) -1)
748 call_prom("getprop", 4, 1, prom_rtas,
749 "rtas-size", &rtas_size, sizeof(rtas_size));
750 prom_print("instantiating rtas");
751 if (rtas_size == 0) {
755 * Ask OF for some space for RTAS.
756 * Actually OF has bugs so we just arbitrarily
757 * use memory at the 6MB point.
761 prom_print_hex(rtas_data);
764 prom_rtas = call_prom("open", 1, 1, "/rtas");
766 prom_args.service = "call-method";
769 prom_args.args[0] = "instantiate-rtas";
770 prom_args.args[1] = prom_rtas;
771 prom_args.args[2] = (void *) rtas_data;
774 if (prom_args.args[3] == 0)
775 i = (unsigned int)prom_args.args[4];
777 if ((rtas_entry == -1) || (rtas_entry == 0))
778 prom_print(" failed\n");
780 prom_print(" done\n");
784 * We enter here early on, when the Open Firmware prom is still
785 * handling exceptions and the MMU hash table for us.
788 prom_init(int r3, int r4, prom_entry pp)
792 unsigned long offset = reloc_offset();
799 phys = (unsigned long) &_stext;
801 /* First get a handle for the stdout device */
803 prom_chosen = call_prom("finddevice", 1, 1,
805 if (prom_chosen == (void *)-1)
807 if ((int) call_prom("getprop", 4, 1, prom_chosen,
808 "stdout", &prom_stdout,
809 sizeof(prom_stdout)) <= 0)
812 /* Get the full OF pathname of the stdout device */
813 mem = (unsigned long) klimit + offset;
816 call_prom("instance-to-path", 3, 1, prom_stdout, p, 255);
817 of_stdout_device = p;
818 mem += strlen(p) + 1;
820 /* Get the boot device and translate it to a full OF pathname. */
822 l = (int) call_prom("getprop", 4, 1, prom_chosen,
823 "bootpath", p, 1<<20);
825 p[l] = 0; /* should already be null-terminated */
826 bootpath = PTRUNRELOC(p);
830 call_prom("canon", 3, 1, p, d, 1<<20);
831 bootdevice = PTRUNRELOC(d);
832 mem = ALIGNUL(mem + strlen(d) + 1);
835 prom_instantiate_rtas();
839 * Find out how much memory we have and allocate a
840 * suitably-sized hash table.
844 mem = check_display(mem);
846 prom_print("copying OF device tree...");
847 mem = copy_device_tree(mem, mem + (1<<20));
848 prom_print("done\n");
852 klimit = (char *) (mem - offset);
854 /* If we are already running at 0xc0000000, we assume we were
855 * loaded by an OF bootloader which did set a BAT for us.
856 * This breaks OF translate so we force phys to be 0.
859 prom_print("(already at 0xc0000000) phys=0\n");
861 } else if ((int) call_prom("getprop", 4, 1, prom_chosen, "mmu",
862 &prom_mmu, sizeof(prom_mmu)) <= 0) {
863 prom_print(" no MMU found\n");
864 } else if ((int)call_prom_ret("call-method", 4, 4, result, "translate",
865 prom_mmu, &_stext, 1) != 0) {
866 prom_print(" (translate failed)\n");
868 /* We assume the phys. address size is 3 cells */
869 phys = (unsigned long)result[2];
872 if (prom_disp_node != 0)
873 setup_disp_fake_bi(prom_disp_node);
875 /* Use quiesce call to get OF to shut down any devices it's using */
876 prom_print("Calling quiesce ...\n");
877 call_prom("quiesce", 0, 0);
879 /* Relocate various pointers which will be used once the
880 kernel is running at the address it was linked at. */
881 for (i = 0; i < prom_num_displays; ++i)
882 prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);
884 prom_print("returning 0x");
885 prom_print_hex(phys);
886 prom_print("from prom_init\n");
893 * early_get_property is used to access the device tree image prepared
894 * by BootX very early on, before the pointers in it have been relocated.
897 early_get_property(unsigned long base, unsigned long node, char *prop)
899 struct device_node *np = (struct device_node *)(base + node);
902 for (pp = np->properties; pp != 0; pp = pp->next) {
903 pp = (struct property *) (base + (unsigned long)pp);
904 if (strcmp((char *)((unsigned long)pp->name + base),
906 return (void *)((unsigned long)pp->value + base);
912 /* Is boot-info compatible ? */
913 #define BOOT_INFO_IS_COMPATIBLE(bi) ((bi)->compatible_version <= BOOT_INFO_VERSION)
914 #define BOOT_INFO_IS_V2_COMPATIBLE(bi) ((bi)->version >= 2)
915 #define BOOT_INFO_IS_V4_COMPATIBLE(bi) ((bi)->version >= 4)
918 bootx_init(unsigned long r4, unsigned long phys)
920 boot_infos_t *bi = (boot_infos_t *) r4;
922 unsigned long ptr, x;
925 boot_infos = PTRUNRELOC(bi);
926 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
927 bi->logicalDisplayBase = 0;
929 #ifdef CONFIG_BOOTX_TEXT
933 * Test if boot-info is compatible. Done only in config
934 * CONFIG_BOOTX_TEXT since there is nothing much we can do
935 * with an incompatible version, except display a message
936 * and eventually hang the processor...
938 * I'll try to keep enough of boot-info compatible in the
939 * future to always allow display of this message;
941 if (!BOOT_INFO_IS_COMPATIBLE(bi)) {
942 btext_drawstring(" !!! WARNING - Incompatible version of BootX !!!\n\n\n");
945 #endif /* CONFIG_BOOTX_TEXT */
947 /* New BootX enters kernel with MMU off, i/os are not allowed
948 here. This hack will have been done by the boostrap anyway.
950 if (bi->version < 4) {
952 * XXX If this is an iMac, turn off the USB controller.
954 model = (char *) early_get_property
955 (r4 + bi->deviceTreeOffset, 4, "model");
957 && (strcmp(model, "iMac,1") == 0
958 || strcmp(model, "PowerMac1,1") == 0)) {
959 out_le32((unsigned *)0x80880008, 1); /* XXX */
963 /* Move klimit to enclose device tree, args, ramdisk, etc... */
964 if (bi->version < 5) {
965 space = bi->deviceTreeOffset + bi->deviceTreeSize;
967 space = bi->ramDisk + bi->ramDiskSize;
969 space = bi->totalParamsSize;
970 klimit = PTRUNRELOC((char *) bi + space);
972 /* New BootX will have flushed all TLBs and enters kernel with
973 MMU switched OFF, so this should not be useful anymore.
975 if (bi->version < 4) {
977 * Touch each page to make sure the PTEs for them
978 * are in the hash table - the aim is to try to avoid
979 * getting DSI exceptions while copying the kernel image.
981 for (ptr = ((unsigned long) &_stext) & PAGE_MASK;
982 ptr < (unsigned long)bi + space; ptr += PAGE_SIZE)
983 x = *(volatile unsigned long *)ptr;
986 #ifdef CONFIG_BOOTX_TEXT
988 * Note that after we call btext_prepare_BAT, we can't do
989 * prom_draw*, flushscreen or clearscreen until we turn the MMU
990 * on, since btext_prepare_BAT sets disp_bi.logicalDisplayBase
991 * to a virtual address.