promif_io.c revision 1b83305cfc332b1e19ad6a194b73b2975e6bf79a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/promif_impl.h>
#include <sys/hypervisor_api.h>
#ifndef _KMDB
#endif
/*
* Definitions for using Polled I/O.
*
* The usage of Polled I/O is different when we are in kmdb. In that case,
* we can not directly invoke the polled I/O functions and we have to use
* debugger.
*
* When we are not in kmdb then we can directly call the polled I/O functions
* but we have to enter the polled I/O mode first. After using polled I/O
* the polled I/O mode is time consuming so this should be avoided when
* possible.
*/
#ifdef _KMDB
extern struct cons_polledio *kmdb_kdi_get_polled_io(void);
#define PROMIF_PIO (kmdb_kdi_get_polled_io())
{ \
}
#define PROMIF_PIO_ENTER(pio)
#define PROMIF_PIO_EXIT(pio)
#else /* _KMDB */
#define PROMIF_PIO (cons_polledio)
#define PROMIF_PIO_ENTER(pio) \
}
#define PROMIF_PIO_EXIT(pio) \
}
#endif /* _KMDB */
/* cached copies of IO params */
int
promif_instance_to_package(void *p)
{
return (0);
}
/* This function is not used but it is convenient for debugging I/O problems */
static void
/* LINTED */
promif_hv_print(char *str)
{
for (i = 0; i < len; i++) {
/* try forever */;
}
}
static void
promif_pio_enter(void)
{
}
static void
promif_pio_exit(void)
{
}
static int
{
int rlen;
int (*getchar)(cons_polledio_arg_t);
return (0);
return (0);
rlen++;
continue;
}
if (!wait)
break;
}
return (rlen);
}
static int
{
int rlen;
return (0);
return (rlen);
}
char
promif_getchar(void)
{
char c;
return (c);
}
int
promif_write(void *p)
{
char *buf;
/* only support stdout (console) */
/* return the length written */
return (0);
}
int
promif_read(void *p)
{
char *buf;
/* unpack arguments */
/* only support stdin (console) */
/* return the length read */
return (0);
}
static pnode_t
{
/* only support stdin and stdout */
return (pstdin);
return (pstdout);
return (OBP_BADNODE);
}
#ifdef _KMDB
void
{
}
#else
void
promif_io_init(void)
{
/*
* Cache the mapping between the stdin and stdout
* ihandles and their respective phandles.
*/
pstdin = prom_stdin_node();
pstdout = prom_stdout_node();
istdin = prom_stdin_ihandle();
}
int
promif_instance_to_path(void *p)
{
char *buf;
int rlen;
char *regval;
char name[OBP_MAXPROPNAME];
char scratch[OBP_MAXPATHLEN];
int rvlen;
*buf = '\0';
while (node != prom_rootnode()) {
prom_printf("instance_to_path: no name property "
"node=0x%x\n", node);
return (-1);
}
/* construct the unit address from the 'reg' property */
return (-1);
/*
* Make sure we don't get dispatched onto a different
* cpu if we happen to sleep. See kern_postprom().
*/
}
return (0);
}
#endif /* _KMDB */