diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-20 19:59:26 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-20 19:59:26 -0400 |
commit | c73fcc846c91f53fd2c67fd9c6c04888a9e5892e (patch) | |
tree | 31faa68b4176636756926535a0f50ff780973275 /arch/sparc64/prom | |
parent | ede13d81b4dda409a6d271b34b8e2ec9383e255d (diff) |
[SPARC]: Fix serial console device detection.
The current scheme works on static interpretation of text names, which
is wrong.
The output-device setting, for example, must be resolved via an alias
or similar to a full path name to the console device.
Paths also contain an optional set of 'options', which starts with a
colon at the end of the path. The option area is used to specify
which of two serial ports ('a' or 'b') the path refers to when a
device node drives multiple ports. 'a' is assumed if the option
specification is missing.
This was caught by the UltraSPARC-T1 simulator. The 'output-device'
property was set to 'ttya' and we didn't pick upon the fact that this
is an OBP alias set to '/virtual-devices/console'. Instead we saw it
as the first serial console device, instead of the hypervisor console.
The infrastructure is now there to take advantage of this to resolve
the console correctly even in multi-head situations in fbcon too.
Thanks to Greg Onufer for the bug report.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/prom')
-rw-r--r-- | arch/sparc64/prom/console.c | 85 | ||||
-rw-r--r-- | arch/sparc64/prom/misc.c | 4 | ||||
-rw-r--r-- | arch/sparc64/prom/tree.c | 8 |
3 files changed, 10 insertions, 87 deletions
diff --git a/arch/sparc64/prom/console.c b/arch/sparc64/prom/console.c index 7c25c54cefdc..3fafa9a8b50b 100644 --- a/arch/sparc64/prom/console.c +++ b/arch/sparc64/prom/console.c | |||
@@ -73,88 +73,3 @@ prom_puts(const char *s, int len) | |||
73 | P1275_INOUT(3,1), | 73 | P1275_INOUT(3,1), |
74 | prom_stdout, s, P1275_SIZE(len)); | 74 | prom_stdout, s, P1275_SIZE(len)); |
75 | } | 75 | } |
76 | |||
77 | /* Query for input device type */ | ||
78 | enum prom_input_device | ||
79 | prom_query_input_device(void) | ||
80 | { | ||
81 | int st_p; | ||
82 | char propb[64]; | ||
83 | |||
84 | st_p = prom_inst2pkg(prom_stdin); | ||
85 | if(prom_node_has_property(st_p, "keyboard")) | ||
86 | return PROMDEV_IKBD; | ||
87 | prom_getproperty(st_p, "device_type", propb, sizeof(propb)); | ||
88 | if(strncmp(propb, "serial", 6)) | ||
89 | return PROMDEV_I_UNK; | ||
90 | /* FIXME: Is there any better way how to find out? */ | ||
91 | memset(propb, 0, sizeof(propb)); | ||
92 | st_p = prom_finddevice ("/options"); | ||
93 | prom_getproperty(st_p, "input-device", propb, sizeof(propb)); | ||
94 | |||
95 | /* | ||
96 | * If we get here with propb == 'keyboard', we are on ttya, as | ||
97 | * the PROM defaulted to this due to 'no input device'. | ||
98 | */ | ||
99 | if (!strncmp(propb, "keyboard", 8)) | ||
100 | return PROMDEV_ITTYA; | ||
101 | |||
102 | if (!strncmp (propb, "rsc", 3)) | ||
103 | return PROMDEV_IRSC; | ||
104 | |||
105 | if (!strncmp (propb, "virtual-console", 3)) | ||
106 | return PROMDEV_IVCONS; | ||
107 | |||
108 | if (strncmp (propb, "tty", 3) || !propb[3]) | ||
109 | return PROMDEV_I_UNK; | ||
110 | |||
111 | switch (propb[3]) { | ||
112 | case 'a': return PROMDEV_ITTYA; | ||
113 | case 'b': return PROMDEV_ITTYB; | ||
114 | default: return PROMDEV_I_UNK; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /* Query for output device type */ | ||
119 | |||
120 | enum prom_output_device | ||
121 | prom_query_output_device(void) | ||
122 | { | ||
123 | int st_p; | ||
124 | char propb[64]; | ||
125 | int propl; | ||
126 | |||
127 | st_p = prom_inst2pkg(prom_stdout); | ||
128 | propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb)); | ||
129 | if (propl >= 0 && propl == sizeof("display") && | ||
130 | strncmp("display", propb, sizeof("display")) == 0) | ||
131 | return PROMDEV_OSCREEN; | ||
132 | if(strncmp("serial", propb, 6)) | ||
133 | return PROMDEV_O_UNK; | ||
134 | /* FIXME: Is there any better way how to find out? */ | ||
135 | memset(propb, 0, sizeof(propb)); | ||
136 | st_p = prom_finddevice ("/options"); | ||
137 | prom_getproperty(st_p, "output-device", propb, sizeof(propb)); | ||
138 | |||
139 | /* | ||
140 | * If we get here with propb == 'screen', we are on ttya, as | ||
141 | * the PROM defaulted to this due to 'no input device'. | ||
142 | */ | ||
143 | if (!strncmp(propb, "screen", 6)) | ||
144 | return PROMDEV_OTTYA; | ||
145 | |||
146 | if (!strncmp (propb, "rsc", 3)) | ||
147 | return PROMDEV_ORSC; | ||
148 | |||
149 | if (!strncmp (propb, "virtual-console", 3)) | ||
150 | return PROMDEV_OVCONS; | ||
151 | |||
152 | if (strncmp (propb, "tty", 3) || !propb[3]) | ||
153 | return PROMDEV_O_UNK; | ||
154 | |||
155 | switch (propb[3]) { | ||
156 | case 'a': return PROMDEV_OTTYA; | ||
157 | case 'b': return PROMDEV_OTTYB; | ||
158 | default: return PROMDEV_O_UNK; | ||
159 | } | ||
160 | } | ||
diff --git a/arch/sparc64/prom/misc.c b/arch/sparc64/prom/misc.c index 33c5b7da31e5..68c83ad04ad9 100644 --- a/arch/sparc64/prom/misc.c +++ b/arch/sparc64/prom/misc.c | |||
@@ -72,7 +72,7 @@ void prom_cmdline(void) | |||
72 | 72 | ||
73 | local_irq_save(flags); | 73 | local_irq_save(flags); |
74 | 74 | ||
75 | if (!serial_console && prom_palette) | 75 | if (prom_palette) |
76 | prom_palette(1); | 76 | prom_palette(1); |
77 | 77 | ||
78 | #ifdef CONFIG_SMP | 78 | #ifdef CONFIG_SMP |
@@ -85,7 +85,7 @@ void prom_cmdline(void) | |||
85 | smp_release(); | 85 | smp_release(); |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | if (!serial_console && prom_palette) | 88 | if (prom_palette) |
89 | prom_palette(0); | 89 | prom_palette(0); |
90 | 90 | ||
91 | local_irq_restore(flags); | 91 | local_irq_restore(flags); |
diff --git a/arch/sparc64/prom/tree.c b/arch/sparc64/prom/tree.c index 17b7ecfe7ca9..b2c5b12c9818 100644 --- a/arch/sparc64/prom/tree.c +++ b/arch/sparc64/prom/tree.c | |||
@@ -304,3 +304,11 @@ prom_pathtoinode(const char *path) | |||
304 | if (node == -1) return 0; | 304 | if (node == -1) return 0; |
305 | return node; | 305 | return node; |
306 | } | 306 | } |
307 | |||
308 | int prom_ihandle2path(int handle, char *buffer, int bufsize) | ||
309 | { | ||
310 | return p1275_cmd("instance-to-path", | ||
311 | P1275_ARG(1,P1275_ARG_OUT_BUF)| | ||
312 | P1275_INOUT(3, 1), | ||
313 | handle, buffer, P1275_SIZE(bufsize)); | ||
314 | } | ||