Print this page
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
9259 libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Revert "NEX-16819 loader UEFI support"
This reverts commit ec06b9fc617b99234e538bf2e7e4d02a24993e0c.
Reverting due to failures in the zfs-tests and the sharefs-tests
NEX-16819 loader UEFI support
Includes work by Toomas Soome <tsoome@me.com>
Upstream commits:
loader: pxe receive cleanup
9475 libefi: Do not return only if ReceiveFilter
installboot: should support efi system partition
8931 boot1.efi: scan all display modes rather than
loader: spinconsole updates
loader: gfx experiment to try GOP Blt() function.
sha1 build test
loader: add sha1 hash calculation
common/sha1: update for loader build
loader: biosdisk rework
uts: 32-bit kernel FB needs mapping in low memory
uts: add diag-device
uts: boot console mirror with diag-device
uts: enable very early console on ttya
kmdb: add diag-device as input/output device
uts: test VGA memory exclusion from mapping
uts: clear boot mapping and protect boot pages test
uts: add dboot map debug printf
uts: need to release FB pages in release_bootstrap()
uts: add screenmap ioctl
uts: update sys/queue.h
loader: add illumos uts/common to include path
loader: tem/gfx font cleanup
loader: vbe checks
uts: gfx_private set KD_TEXT when KD_RESETTEXT is
uts: gfx 8-bit update
loader: gfx 8-bit fix
loader: always set media size from partition.
uts: MB2 support for 32-bit kernel
loader: x86 should have tem 80x25
uts: x86 should have tem 80x25
uts: font update
loader: font update
uts: tem attributes
loader: tem.c comment added
uts: use font module
loader: add font module
loader: build rules for new font setup
uts: gfx_private update for new font structure
uts: early boot update for new font structure
uts: font update
uts: font build rules update for new fonts
uts: tem update to new font structure
loader: module.c needs to include tem_impl.h
uts: gfx_private 8x16 font rework
uts: make font_lookup public
loader: font rework
uts: font rework
libefi: efi_alloc_and_read should check for PMBR
uts: tem utf-8 support
loader: implement tem utf-8 support
loader: tem should be able to display UTF-8
7784 uts: console input should support utf-8
7796 uts: ldterm default to utf-8
uts: do not reset serial console
uts: set up colors even if tem is not console
uts: add type for early boot properties
uts: gfx_private experiment with drm and vga
uts: gfx_private should use setmode drm callback.
uts: identify FB types and set up gfx_private based
loader: replace gop and vesa with framebuffer
uts: boot needs simple tem to support mdb
uts: boot_keyboard should emit esc sequences for
uts: gfx_private FB showuld be written by line
kmdb: set terminal window size
uts: gfx_private needs to keep track of early boot FB
pnglite: move pnglite to usr/src/common
loader: gfx_fb
ficl-sys: add gfx primitives
loader: add illumos.png logo
ficl: add fb-putimage
loader: add png support
loader: add alpha blending for gfx_fb
loader: use term-drawrect for menu frame
ficl: add simple gfx words
uts: provide fb_info via fbgattr dev_specific array.
uts: gfx_private add alpha blending
uts: update sys/ascii.h
uts: tem OSC support (incomplete)
uts: implement env module support and use data from
uts: tem get colors from early boot data
loader: use crc32 from libstand (libz)
loader: optimize for size
loader: pass tem info to the environment
loader: import tem for loader console
loader: UEFI loader needs to set ISADIR based on
loader: need UEFI32 support
8918 loader.efi: add vesa edid support
uts: tem_safe_pix_clear_prom_output() should only
uts: tem_safe_pix_clear_entire_screen() should use
uts: tem_safe_check_first_time() should query cursor
uts: tem implement cls callback & visual_io v4
uts: gfx_vgatext use block cursor for vgatext
uts: gfx_private implement cls callback & visual_io
uts: gfx_private bitmap framebuffer implementation
uts: early start frame buffer console support
uts: font functions should check the input char
uts: font rendering should support 16/24/32bit depths
uts: use smallest font as fallback default.
uts: update terminal dimensions based on selected
7834 uts: vgatext should use gfx_private
uts: add spacing property to 8859-1.bdf
terminfo: add underline for sun-color
terminfo: sun-color has 16 colors
uts: add font load callback type
loader: do not repeat int13 calls with error 0x20 and
8905 loader: add skein/edonr support
8904 common/crypto: make skein and edonr loader
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/i86pc/io/consplat.c
+++ new/usr/src/uts/i86pc/io/consplat.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2012 Gary Mills
24 24 *
25 25 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 /*
30 30 * isa-specific console configuration routines
31 31 */
32 32
33 33 #include <sys/types.h>
34 34 #include <sys/param.h>
35 35 #include <sys/cmn_err.h>
36 36 #include <sys/systm.h>
37 37 #include <sys/conf.h>
|
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
38 38 #include <sys/debug.h>
39 39 #include <sys/ddi.h>
40 40 #include <sys/sunddi.h>
41 41 #include <sys/sunndi.h>
42 42 #include <sys/esunddi.h>
43 43 #include <sys/ddi_impldefs.h>
44 44 #include <sys/promif.h>
45 45 #include <sys/modctl.h>
46 46 #include <sys/termios.h>
47 47 #include <sys/pci.h>
48 +#include <sys/framebuffer.h>
49 +#include <sys/boot_console.h>
48 50 #if defined(__xpv)
49 51 #include <sys/hypervisor.h>
50 -#include <sys/boot_console.h>
51 52 #endif
52 53
53 54 extern int pseudo_isa;
54 55
55 56 int
56 57 plat_use_polled_debug()
57 58 {
58 59 return (0);
59 60 }
60 61
61 62 int
62 63 plat_support_serial_kbd_and_ms()
63 64 {
64 65 return (0);
65 66 }
66 67
67 68 #define A_CNT(arr) (sizeof (arr) / sizeof (arr[0]))
68 69
69 70 #ifndef CONS_INVALID
70 71 #define CONS_INVALID -1
71 72 #define CONS_SCREEN_TEXT 0
72 73 #define CONS_TTY 1
73 74 #define CONS_XXX 2 /* Unused */
74 75 #define CONS_USBSER 3
75 76 #define CONS_HYPERVISOR 4
76 77 #define CONS_SCREEN_GRAPHICS 5
77 78 #endif /* CONS_INVALID */
78 79
79 80 char *plat_fbpath(void);
80 81
81 82 static int
82 83 console_type(int *tnum)
83 84 {
84 85 static int boot_console = CONS_INVALID;
85 86 static int tty_num = 0;
86 87
87 88 char *cons;
88 89 dev_info_t *root;
89 90
90 91 /* If we already have determined the console, just return it. */
91 92 if (boot_console != CONS_INVALID) {
92 93 if (tnum != NULL)
93 94 *tnum = tty_num;
94 95 return (boot_console);
95 96 }
96 97
97 98 #if defined(__xpv)
98 99 if (!DOMAIN_IS_INITDOMAIN(xen_info) || bcons_hypervisor_redirect()) {
99 100 boot_console = CONS_HYPERVISOR;
100 101 if (tnum != NULL)
101 102 *tnum = tty_num;
102 103 return (boot_console);
103 104 }
104 105 #endif /* __xpv */
105 106
106 107 /*
107 108 * console is defined by "console" property, with
108 109 * fallback on the old "input-device" property.
109 110 * If "input-device" is not defined either, also check "output-device".
110 111 */
111 112 boot_console = CONS_SCREEN_TEXT; /* default is screen/kb */
112 113 root = ddi_root_node();
113 114 if ((ddi_prop_lookup_string(DDI_DEV_T_ANY, root,
114 115 DDI_PROP_DONTPASS, "console", &cons) == DDI_SUCCESS) ||
115 116 (ddi_prop_lookup_string(DDI_DEV_T_ANY, root,
116 117 DDI_PROP_DONTPASS, "input-device", &cons) == DDI_SUCCESS) ||
117 118 (ddi_prop_lookup_string(DDI_DEV_T_ANY, root,
118 119 DDI_PROP_DONTPASS, "output-device", &cons) == DDI_SUCCESS)) {
119 120 if (strlen(cons) == 4 && strncmp(cons, "tty", 3) == 0 &&
120 121 cons[3] >= 'a' && cons[3] <= 'd') {
121 122 boot_console = CONS_TTY;
122 123 tty_num = cons[3] - 'a';
123 124 } else if (strcmp(cons, "usb-serial") == 0) {
124 125 (void) i_ddi_attach_hw_nodes("xhci");
125 126 (void) i_ddi_attach_hw_nodes("ehci");
126 127 (void) i_ddi_attach_hw_nodes("uhci");
127 128 (void) i_ddi_attach_hw_nodes("ohci");
128 129 /*
129 130 * USB device enumerate asynchronously.
130 131 * Wait 2 seconds for USB serial devices to attach.
131 132 */
132 133 delay(drv_usectohz(2000000));
133 134 boot_console = CONS_USBSER;
134 135 #if defined(__xpv)
135 136 } else if (strcmp(cons, "hypervisor") == 0) {
136 137 boot_console = CONS_HYPERVISOR;
137 138 #endif /* __xpv */
138 139 }
139 140 ddi_prop_free(cons);
140 141 }
141 142
142 143 /*
143 144 * If the console is configured to use a framebuffer but none
144 145 * could be found, fallback to "ttya" since it's likely to exist
145 146 * and it matches longstanding behavior on SPARC.
146 147 */
147 148 if (boot_console == CONS_SCREEN_TEXT && plat_fbpath() == NULL) {
148 149 boot_console = CONS_TTY;
149 150 tty_num = 0;
150 151 }
151 152
152 153 if (tnum != NULL)
153 154 *tnum = tty_num;
154 155 return (boot_console);
155 156 }
156 157
157 158 int
158 159 plat_stdin_is_keyboard(void)
159 160 {
160 161 return (console_type(NULL) == CONS_SCREEN_TEXT);
161 162 }
162 163
163 164 int
164 165 plat_stdout_is_framebuffer(void)
165 166 {
166 167 return (console_type(NULL) == CONS_SCREEN_TEXT);
167 168 }
168 169
169 170 static char *
170 171 plat_devpath(char *name, char *path)
171 172 {
172 173 major_t major;
173 174 dev_info_t *dip, *pdip;
174 175
175 176 if ((major = ddi_name_to_major(name)) == (major_t)-1)
176 177 return (NULL);
177 178
178 179 if ((dip = devnamesp[major].dn_head) == NULL)
179 180 return (NULL);
180 181
181 182 pdip = ddi_get_parent(dip);
182 183 if (i_ddi_attach_node_hierarchy(pdip) != DDI_SUCCESS)
183 184 return (NULL);
184 185 if (ddi_initchild(pdip, dip) != DDI_SUCCESS)
185 186 return (NULL);
186 187
187 188 (void) ddi_pathname(dip, path);
188 189
189 190 return (path);
190 191 }
191 192
192 193 /*
193 194 * Return generic path to keyboard device from the alias.
194 195 */
195 196 char *
196 197 plat_kbdpath(void)
197 198 {
198 199 static char kbpath[MAXPATHLEN];
199 200
200 201 /*
201 202 * Hardcode to isa keyboard path
202 203 * XXX make it settable via bootprop?
203 204 */
204 205 if (pseudo_isa)
205 206 return ("/isa/i8042@1,60/keyboard@0");
206 207
207 208 if (plat_devpath("kb8042", kbpath) == NULL)
208 209 return (NULL);
209 210
210 211 return (kbpath);
211 212 }
212 213
213 214 /*
214 215 * NOTE: this function is duplicated here and in gfx_private/vgatext while
215 216 * we work on a set of commitable interfaces to sunpci.c.
216 217 *
217 218 * Use the class code to determine if the device is a PCI-to-PCI bridge.
218 219 * Returns: B_TRUE if the device is a bridge.
219 220 * B_FALSE if the device is not a bridge or the property cannot be
220 221 * retrieved.
221 222 */
222 223 static boolean_t
223 224 is_pci_bridge(dev_info_t *dip)
224 225 {
225 226 uint32_t class_code;
226 227
227 228 class_code = (uint32_t)ddi_prop_get_int(DDI_DEV_T_ANY, dip,
228 229 DDI_PROP_DONTPASS, "class-code", 0xffffffff);
229 230
230 231 if (class_code == 0xffffffff || class_code == DDI_PROP_NOT_FOUND)
231 232 return (B_FALSE);
232 233
233 234 class_code &= 0x00ffff00;
234 235 if (class_code == ((PCI_CLASS_BRIDGE << 16) | (PCI_BRIDGE_PCI << 8)))
235 236 return (B_TRUE);
236 237
237 238 return (B_FALSE);
238 239 }
239 240
240 241 /*
241 242 * Type for the parameter of find_fb_dev()
242 243 */
243 244 struct find_fb_dev_param
244 245 {
245 246 dev_info_t *found_dip; /* dip found for VGA console */
246 247 int vga_enable; /* check PCI_BCNF_BCNTRL_VGA_ENABLE or not */
247 248 };
248 249
249 250 /*
250 251 * The VGA device could be under a subtractive PCI bridge on some systems.
251 252 * Though the PCI_BCNF_BCNTRL_VGA_ENABLE bit is not set on such subtractive
252 253 * PCI bridge, the subtractive PCI bridge can forward VGA access if no other
253 254 * agent claims the access.
254 255 * The vga_enable element in param acts as a flag, if not set, ignore the
255 256 * checking for the PCI_BCNF_BCNTRL_VGA_ENABLE bit of the PCI bridge during
256 257 * the search.
257 258 */
258 259 static int
259 260 find_fb_dev(dev_info_t *dip, void *param)
260 261 {
261 262 struct find_fb_dev_param *p = param;
262 263 char *dev_type;
263 264 dev_info_t *pdip;
264 265 char *parent_type;
265 266
266 267 if (dip == ddi_root_node())
267 268 return (DDI_WALK_CONTINUE);
268 269
269 270 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
270 271 "device_type", &dev_type) != DDI_SUCCESS)
271 272 return (DDI_WALK_PRUNECHILD);
272 273
273 274 if ((strcmp(dev_type, "isa") == 0) || (strcmp(dev_type, "eisa") == 0)) {
274 275 ddi_prop_free(dev_type);
275 276 return (DDI_WALK_CONTINUE);
276 277 }
277 278
278 279 if ((strcmp(dev_type, "pci") == 0) ||
279 280 (strcmp(dev_type, "pciex") == 0)) {
280 281 ddi_acc_handle_t pci_conf;
281 282 uint16_t data16;
282 283 char *nodename;
283 284
284 285 ddi_prop_free(dev_type);
285 286
286 287 if (!p->vga_enable)
287 288 return (DDI_WALK_CONTINUE);
288 289
289 290 nodename = ddi_node_name(dip);
290 291
291 292 /*
292 293 * If the node is not a PCI-to-PCI bridge, continue traversing
293 294 * (it could be the root node), otherwise, check for the
294 295 * VGAEnable bit to be set in the Bridge Control Register.
295 296 */
296 297 if (strcmp(nodename, "pci") == 0) {
297 298 if (is_pci_bridge(dip) == B_FALSE)
298 299 return (DDI_WALK_CONTINUE);
299 300 }
300 301
301 302 if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS)
302 303 return (DDI_WALK_PRUNECHILD);
303 304
304 305 if (pci_config_setup(dip, &pci_conf) != DDI_SUCCESS)
305 306 return (DDI_WALK_PRUNECHILD);
306 307
307 308 data16 = pci_config_get16(pci_conf, PCI_BCNF_BCNTRL);
308 309 pci_config_teardown(&pci_conf);
309 310
310 311 if (data16 & PCI_BCNF_BCNTRL_VGA_ENABLE)
311 312 return (DDI_WALK_CONTINUE);
312 313
313 314 return (DDI_WALK_PRUNECHILD);
314 315 }
315 316
316 317 if (strcmp(dev_type, "display") != 0) {
317 318 ddi_prop_free(dev_type);
318 319 return (DDI_WALK_CONTINUE);
319 320 }
320 321
321 322 ddi_prop_free(dev_type);
322 323
323 324 if ((pdip = ddi_get_parent(dip)) == NULL)
324 325 return (DDI_WALK_PRUNECHILD);
325 326
326 327 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, pdip, DDI_PROP_DONTPASS,
327 328 "device_type", &parent_type) != DDI_SUCCESS)
328 329 return (DDI_WALK_PRUNECHILD);
329 330
330 331 if ((strcmp(parent_type, "isa") == 0) ||
331 332 (strcmp(parent_type, "eisa") == 0)) {
332 333 p->found_dip = dip;
333 334 ddi_prop_free(parent_type);
334 335 return (DDI_WALK_TERMINATE);
335 336 }
336 337
337 338 if ((strcmp(parent_type, "pci") == 0) ||
338 339 (strcmp(parent_type, "pciex") == 0)) {
339 340 ddi_acc_handle_t pci_conf;
340 341 uint16_t data16;
341 342
342 343 ddi_prop_free(parent_type);
343 344
344 345 if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS)
345 346 return (DDI_WALK_PRUNECHILD);
346 347
347 348 if (pci_config_setup(dip, &pci_conf) != DDI_SUCCESS)
348 349 return (DDI_WALK_PRUNECHILD);
349 350
350 351 data16 = pci_config_get16(pci_conf, PCI_CONF_COMM);
351 352 pci_config_teardown(&pci_conf);
352 353
353 354 if (!(data16 & PCI_COMM_IO))
354 355 return (DDI_WALK_PRUNECHILD);
355 356
356 357 p->found_dip = dip;
357 358 return (DDI_WALK_TERMINATE);
358 359 }
359 360
360 361 ddi_prop_free(parent_type);
361 362 return (DDI_WALK_PRUNECHILD);
362 363 }
363 364
364 365 /*
365 366 * The first round search is to find:
366 367 * 1) a VGA device.
367 368 * 2) a PCI VGA compatible device whose IO space is enabled
368 369 * and the VGA Enable bit of any PCI-PCI bridge above it is set.
369 370 * If the first round search succeeds, prune the second round search.
370 371 *
371 372 * The second round seach does not check the VGA Enable bit.
372 373 *
373 374 * Return the device path as the console fb path.
374 375 */
375 376 char *
376 377 plat_fbpath(void)
377 378 {
378 379 struct find_fb_dev_param param;
379 380 static char *fbpath = NULL;
380 381 static char fbpath_buf[MAXPATHLEN];
381 382
382 383 /* first round search */
383 384 param.found_dip = NULL;
384 385 param.vga_enable = 1;
385 386 ddi_walk_devs(ddi_root_node(), find_fb_dev, ¶m);
386 387
387 388 if (param.found_dip != NULL) {
388 389 (void) ddi_pathname(param.found_dip, fbpath_buf);
389 390 fbpath = fbpath_buf;
390 391 return (fbpath);
391 392 }
392 393
393 394 /*
394 395 * second round search, do not check the
395 396 * PCI_BCNF_BCNTRL_VGA_ENABLE bit
396 397 */
397 398 param.found_dip = NULL;
398 399 param.vga_enable = 0;
399 400 ddi_walk_devs(ddi_root_node(), find_fb_dev, ¶m);
400 401
401 402 if (param.found_dip == NULL)
402 403 return (NULL);
403 404
404 405 (void) ddi_pathname(param.found_dip, fbpath_buf);
405 406 fbpath = fbpath_buf;
406 407 return (fbpath);
407 408 }
408 409
409 410 char *
410 411 plat_mousepath(void)
411 412 {
412 413 static char mpath[MAXPATHLEN];
413 414
414 415 /*
415 416 * Hardcode to isa mouse path
416 417 * XXX make it settable via bootprop?
417 418 */
418 419 if (pseudo_isa)
419 420 return ("/isa/i8042@1,60/mouse@1");
420 421
421 422 if (plat_devpath("mouse8042", mpath) == NULL)
422 423 return (NULL);
423 424
424 425 return (mpath);
425 426 }
426 427
427 428 /* return path of first usb serial device */
428 429 static char *
429 430 plat_usbser_path(void)
430 431 {
431 432 extern dev_info_t *usbser_first_device(void);
432 433
433 434 dev_info_t *us_dip;
434 435 static char *us_path = NULL;
435 436
436 437 if (us_path)
437 438 return (us_path);
438 439
439 440 us_dip = usbser_first_device();
440 441 if (us_dip == NULL)
441 442 return (NULL);
442 443
443 444 us_path = kmem_alloc(MAXPATHLEN, KM_SLEEP);
444 445 (void) ddi_pathname(us_dip, us_path);
445 446 ndi_rele_devi(us_dip); /* held from usbser_first_device */
446 447 return (us_path);
447 448 }
448 449
449 450 static char *
450 451 plat_ttypath(int inum)
451 452 {
452 453 static char *defaultpath[] = {
453 454 "/isa/asy@1,3f8:a",
454 455 "/isa/asy@1,2f8:b",
455 456 "/isa/asy@1,3e8:c",
456 457 "/isa/asy@1,2e8:d"
457 458 };
458 459 static char path[MAXPATHLEN];
459 460 char *bp;
460 461 major_t major;
461 462 dev_info_t *dip;
462 463
463 464 if (pseudo_isa)
464 465 return (defaultpath[inum]);
465 466
466 467 if ((major = ddi_name_to_major("asy")) == (major_t)-1)
467 468 return (NULL);
468 469
469 470 if ((dip = devnamesp[major].dn_head) == NULL)
470 471 return (NULL);
471 472
472 473 for (; dip != NULL; dip = ddi_get_next(dip)) {
473 474 if (i_ddi_attach_node_hierarchy(dip) != DDI_SUCCESS)
474 475 return (NULL);
475 476
476 477 if (DEVI(dip)->devi_minor->ddm_name[0] == ('a' + (char)inum))
477 478 break;
478 479 }
479 480 if (dip == NULL)
480 481 return (NULL);
481 482
482 483 (void) ddi_pathname(dip, path);
483 484 bp = path + strlen(path);
484 485 (void) snprintf(bp, 3, ":%s", DEVI(dip)->devi_minor->ddm_name);
485 486
486 487 return (path);
487 488 }
488 489
489 490 /*
490 491 * Another possible enhancement could be to use properties
491 492 * for the port mapping rather than simply hard-code them.
492 493 */
493 494 char *
494 495 plat_stdinpath(void)
495 496 {
496 497 int tty_num = 0;
497 498
498 499 switch (console_type(&tty_num)) {
499 500 #if defined(__xpv)
500 501 case CONS_HYPERVISOR:
501 502 return ("/xpvd/xencons@0");
502 503 #endif /* __xpv */
503 504 case CONS_TTY:
504 505 return (plat_ttypath(tty_num));
505 506 case CONS_USBSER:
506 507 return (plat_usbser_path());
507 508 case CONS_SCREEN_TEXT:
508 509 default:
509 510 break;
510 511 };
511 512 return (plat_kbdpath());
512 513 }
513 514
514 515 char *
515 516 plat_stdoutpath(void)
516 517 {
517 518 int tty_num = 0;
518 519
519 520 switch (console_type(&tty_num)) {
520 521 #if defined(__xpv)
521 522 case CONS_HYPERVISOR:
522 523 return ("/xpvd/xencons@0");
523 524 #endif /* __xpv */
524 525 case CONS_TTY:
|
↓ open down ↓ |
464 lines elided |
↑ open up ↑ |
525 526 return (plat_ttypath(tty_num));
526 527 case CONS_USBSER:
527 528 return (plat_usbser_path());
528 529 case CONS_SCREEN_TEXT:
529 530 default:
530 531 break;
531 532 };
532 533 return (plat_fbpath());
533 534 }
534 535
536 +char *
537 +plat_diagpath(void)
538 +{
539 + dev_info_t *root;
540 + char *diag;
541 + int tty_num = -1;
542 +
543 + root = ddi_root_node();
544 +
545 + if (ddi_prop_lookup_string(DDI_DEV_T_ANY, root, DDI_PROP_DONTPASS,
546 + "diag-device", &diag) == DDI_SUCCESS) {
547 + if (strlen(diag) == 4 && strncmp(diag, "tty", 3) == 0 &&
548 + diag[3] >= 'a' && diag[3] <= 'd') {
549 + tty_num = diag[3] - 'a';
550 + }
551 + ddi_prop_free(diag);
552 + }
553 +
554 + if (tty_num != -1)
555 + return (plat_ttypath(tty_num));
556 + return (NULL);
557 +}
558 +
535 559 /*
536 560 * If VIS_PIXEL mode will be implemented on x86, these following
537 561 * functions should be re-considered. Now these functions are
538 562 * unused on x86.
539 563 */
540 564 void
565 +plat_tem_get_colors(uint8_t *fg, uint8_t *bg)
566 +{
567 + *fg = fb_info.fg_color;
568 + *bg = fb_info.bg_color;
569 +}
570 +
571 +void
541 572 plat_tem_get_inverses(int *inverse, int *inverse_screen)
542 573 {
543 - *inverse = 0;
544 - *inverse_screen = 0;
574 + *inverse = fb_info.inverse == B_TRUE? 1 : 0;
575 + *inverse_screen = fb_info.inverse_screen == B_TRUE? 1 : 0;
545 576 }
546 577
547 578 void
548 579 plat_tem_get_prom_font_size(int *charheight, int *windowtop)
549 580 {
550 - *charheight = 0;
551 - *windowtop = 0;
581 + *charheight = fb_info.font_height;
582 + *windowtop = fb_info.terminal_origin.y;
552 583 }
553 584
554 585 /*ARGSUSED*/
555 586 void
556 587 plat_tem_get_prom_size(size_t *height, size_t *width)
557 588 {
558 - panic("unimplemented at line %d of %s", __LINE__, __FILE__);
589 + *height = fb_info.terminal.y;
590 + *width = fb_info.terminal.x;
559 591 }
560 592
593 +/* this gets called once at boot time and only in case of VIS_PIXEL */
561 594 void
562 595 plat_tem_hide_prom_cursor(void)
563 596 {
564 - panic("unimplemented at line %d of %s", __LINE__, __FILE__);
597 + if (boot_console_type(NULL) == CONS_FRAMEBUFFER)
598 + boot_fb_cursor(B_FALSE);
565 599 }
566 600
567 601 /*ARGSUSED*/
568 602 void
569 603 plat_tem_get_prom_pos(uint32_t *row, uint32_t *col)
570 604 {
571 - panic("unimplemented at line %d of %s", __LINE__, __FILE__);
605 + *row = fb_info.cursor.pos.y;
606 + *col = fb_info.cursor.pos.x;
572 607 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX