aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/prom
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-09 05:52:44 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:12:03 -0500
commitd82ace7dc4073b090a55b9740700e32b9a9ae302 (patch)
treed5aa8e10664b05bbfe31eacf95e2066c03cab102 /arch/sparc64/prom
parent1d2f1f90a1e004b0c1b8a73ed4394a93f09104b3 (diff)
[SPARC64]: Detect sun4v early in boot process.
We look for "SUNW,sun4v" in the 'compatible' property of the root OBP device tree node. Protect every %ver register access, to make sure it is not touched on sun4v, as %ver is hyperprivileged there. Lock kernel TLB entries using hypervisor calls instead of calls into OBP. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/prom')
-rw-r--r--arch/sparc64/prom/init.c20
-rw-r--r--arch/sparc64/prom/tree.c9
2 files changed, 14 insertions, 15 deletions
diff --git a/arch/sparc64/prom/init.c b/arch/sparc64/prom/init.c
index f3cc2d8578b2..095755e428a6 100644
--- a/arch/sparc64/prom/init.c
+++ b/arch/sparc64/prom/init.c
@@ -18,7 +18,6 @@ enum prom_major_version prom_vers;
18unsigned int prom_rev, prom_prev; 18unsigned int prom_rev, prom_prev;
19 19
20/* The root node of the prom device tree. */ 20/* The root node of the prom device tree. */
21int prom_root_node;
22int prom_stdin, prom_stdout; 21int prom_stdin, prom_stdout;
23int prom_chosen_node; 22int prom_chosen_node;
24 23
@@ -41,26 +40,22 @@ void __init prom_init(void *cif_handler, void *cif_stack)
41 40
42 prom_cif_init(cif_handler, cif_stack); 41 prom_cif_init(cif_handler, cif_stack);
43 42
44 prom_root_node = prom_getsibling(0);
45 if((prom_root_node == 0) || (prom_root_node == -1))
46 prom_halt();
47
48 prom_chosen_node = prom_finddevice(prom_chosen_path); 43 prom_chosen_node = prom_finddevice(prom_chosen_path);
49 if (!prom_chosen_node || prom_chosen_node == -1) 44 if (!prom_chosen_node || prom_chosen_node == -1)
50 prom_halt(); 45 prom_halt();
51 46
52 prom_stdin = prom_getint (prom_chosen_node, "stdin"); 47 prom_stdin = prom_getint(prom_chosen_node, "stdin");
53 prom_stdout = prom_getint (prom_chosen_node, "stdout"); 48 prom_stdout = prom_getint(prom_chosen_node, "stdout");
54 49
55 node = prom_finddevice("/openprom"); 50 node = prom_finddevice("/openprom");
56 if (!node || node == -1) 51 if (!node || node == -1)
57 prom_halt(); 52 prom_halt();
58 53
59 prom_getstring (node, "version", buffer, sizeof (buffer)); 54 prom_getstring(node, "version", buffer, sizeof (buffer));
60 55
61 prom_printf ("\n"); 56 prom_printf("\n");
62 57
63 if (strncmp (buffer, "OBP ", 4)) 58 if (strncmp(buffer, "OBP ", 4))
64 goto strange_version; 59 goto strange_version;
65 60
66 /* 61 /*
@@ -70,7 +65,7 @@ void __init prom_init(void *cif_handler, void *cif_stack)
70 * accordingly. -spot 65 * accordingly. -spot
71 */ 66 */
72 67
73 if (strncmp (buffer, "OBP ", 5)) 68 if (strncmp(buffer, "OBP ", 5))
74 bufadjust = 4; 69 bufadjust = 4;
75 else 70 else
76 bufadjust = 5; 71 bufadjust = 5;
@@ -87,7 +82,8 @@ void __init prom_init(void *cif_handler, void *cif_stack)
87 prom_rev = ints[1]; 82 prom_rev = ints[1];
88 prom_prev = (ints[0] << 16) | (ints[1] << 8) | ints[2]; 83 prom_prev = (ints[0] << 16) | (ints[1] << 8) | ints[2];
89 84
90 printk ("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + bufadjust); 85 printk("PROMLIB: Sun IEEE Boot Prom %s\n", buffer + bufadjust);
86 printk("PROMLIB: Root node compatible: %s\n", prom_root_compatible);
91 87
92 /* Initialization successful. */ 88 /* Initialization successful. */
93 return; 89 return;
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc64/prom/tree.c
index b1ff9e87dcc6..49075abd7cbc 100644
--- a/arch/sparc64/prom/tree.c
+++ b/arch/sparc64/prom/tree.c
@@ -51,7 +51,7 @@ prom_getparent(int node)
51__inline__ int 51__inline__ int
52__prom_getsibling(int node) 52__prom_getsibling(int node)
53{ 53{
54 return p1275_cmd ("peer", P1275_INOUT(1, 1), node); 54 return p1275_cmd(prom_peer_name, P1275_INOUT(1, 1), node);
55} 55}
56 56
57__inline__ int 57__inline__ int
@@ -59,9 +59,12 @@ prom_getsibling(int node)
59{ 59{
60 int sibnode; 60 int sibnode;
61 61
62 if(node == -1) return 0; 62 if (node == -1)
63 return 0;
63 sibnode = __prom_getsibling(node); 64 sibnode = __prom_getsibling(node);
64 if(sibnode == -1) return 0; 65 if (sibnode == -1)
66 return 0;
67
65 return sibnode; 68 return sibnode;
66} 69}
67 70