xref: /onnv-gate/usr/src/cmd/mdb/intel/kmdb/kmdb_promif_isadep.c (revision 1563:ed581eb74860)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*1563Slq150181  * Common Development and Distribution License (the "License").
6*1563Slq150181  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*1563Slq150181 
220Sstevel@tonic-gate /*
23*1563Slq150181  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * "PROM" interface
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <sys/promif.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include <kmdb/kmdb_promif_impl.h>
370Sstevel@tonic-gate #include <kmdb/kmdb_kdi.h>
380Sstevel@tonic-gate #include <kmdb/kmdb_dpi.h>
390Sstevel@tonic-gate #include <mdb/mdb_err.h>
400Sstevel@tonic-gate #include <mdb/mdb_debug.h>
410Sstevel@tonic-gate #include <mdb/mdb_string.h>
420Sstevel@tonic-gate #include <mdb/mdb.h>
430Sstevel@tonic-gate 
440Sstevel@tonic-gate struct boot_syscalls *kmdb_sysp;
450Sstevel@tonic-gate 
460Sstevel@tonic-gate ssize_t
kmdb_prom_obp_writer(caddr_t buf,size_t len)470Sstevel@tonic-gate kmdb_prom_obp_writer(caddr_t buf, size_t len)
480Sstevel@tonic-gate {
490Sstevel@tonic-gate 	int i;
500Sstevel@tonic-gate 
510Sstevel@tonic-gate 	for (i = 0; i < len; i++)
520Sstevel@tonic-gate 		prom_putchar(*buf++);
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 	return (len);
550Sstevel@tonic-gate }
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /*ARGSUSED*/
580Sstevel@tonic-gate ihandle_t
kmdb_prom_get_handle(char * name)590Sstevel@tonic-gate kmdb_prom_get_handle(char *name)
600Sstevel@tonic-gate {
610Sstevel@tonic-gate 	/* no handles here */
620Sstevel@tonic-gate 	return (0);
630Sstevel@tonic-gate }
640Sstevel@tonic-gate 
650Sstevel@tonic-gate char *
kmdb_prom_get_ddi_prop(kmdb_auxv_t * kav,char * propname)66*1563Slq150181 kmdb_prom_get_ddi_prop(kmdb_auxv_t *kav, char *propname)
670Sstevel@tonic-gate {
680Sstevel@tonic-gate 	int i;
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	if (kav->kav_pcache != NULL) {
710Sstevel@tonic-gate 		for (i = 0; i < kav->kav_nprops; i++) {
720Sstevel@tonic-gate 			kmdb_auxv_nv_t *nv = &kav->kav_pcache[i];
730Sstevel@tonic-gate 			if (strcmp(nv->kanv_name, propname) == 0)
740Sstevel@tonic-gate 				return (nv->kanv_val);
750Sstevel@tonic-gate 		}
760Sstevel@tonic-gate 	}
770Sstevel@tonic-gate 
780Sstevel@tonic-gate 	return (NULL);
790Sstevel@tonic-gate }
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /*ARGSUSED*/
820Sstevel@tonic-gate void
kmdb_prom_free_ddi_prop(char * val)83*1563Slq150181 kmdb_prom_free_ddi_prop(char *val)
840Sstevel@tonic-gate {
850Sstevel@tonic-gate }
860Sstevel@tonic-gate 
870Sstevel@tonic-gate int
kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t * kav)880Sstevel@tonic-gate kmdb_prom_stdout_is_framebuffer(kmdb_auxv_t *kav)
890Sstevel@tonic-gate {
900Sstevel@tonic-gate 	char *dev;
910Sstevel@tonic-gate 
920Sstevel@tonic-gate 	/*
930Sstevel@tonic-gate 	 * We can't use the official promif version, as we need to ensure that
940Sstevel@tonic-gate 	 * property lookups come from our property cache.
950Sstevel@tonic-gate 	 */
960Sstevel@tonic-gate 
97*1563Slq150181 	if ((dev = kmdb_prom_get_ddi_prop(kav, "output-device")) == NULL)
980Sstevel@tonic-gate 		return (0);
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate 	return (strcmp(dev, "screen") == 0);
1010Sstevel@tonic-gate }
102