1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * CDDL HEADER START
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * The contents of this file are subject to the terms of the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Common Development and Distribution License (the "License").
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * You may not use this file except in compliance with the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * See the License for the specific language governing permissions
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * and limitations under the License.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * When distributing Covered Code, include this CDDL HEADER in each
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * If applicable, add the following below this CDDL HEADER, with the
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * fields enclosed by brackets "[]" replaced with your own identifying
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * information: Portions Copyright [yyyy] [name of copyright owner]
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * CDDL HEADER END
de81a4f48d467f6d0263221cbf4a199b6a925948jm * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Use is subject to license terms.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#pragma ident "%Z%%M% %I% %E% SMI"
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * Definitions for using Polled I/O.
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * The usage of Polled I/O is different when we are in kmdb. In that case,
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * we can not directly invoke the polled I/O functions and we have to use
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * the kmdb DPI interface. Also we don't need to enter/exit the polled I/O
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * mode because this is already managed by kmdb when entering/exiting the
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * debugger.
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * When we are not in kmdb then we can directly call the polled I/O functions
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * but we have to enter the polled I/O mode first. After using polled I/O
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * functions we have to exit the polled I/O mode. Note that entering/exiting
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * the polled I/O mode is time consuming so this should be avoided when
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm * possible.
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajmextern struct cons_polledio *kmdb_kdi_get_polled_io(void);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajmextern uintptr_t kmdb_dpi_call(uintptr_t, uint_t, const uintptr_t *);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm (void) (kmdb_dpi_call((uintptr_t)fn, 2, (uintptr_t *)args)); \
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm#else /* _KMDB */
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm#endif /* _KMDB */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#define PROM_REG_TO_UNIT_ADDR(r) ((r) & ~(0xful << 28))
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo/* cached copies of IO params */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (0);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm/* This function is not used but it is convenient for debugging I/O problems */
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajmstatic void
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm/* LINTED */
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm for (i = 0; i < len; i++) {
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm /* try forever */;
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajmstatic void
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajmstatic void
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm if ((ischar = promif_polledio->cons_polledio_ischar) == NULL)
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm return (0);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm if ((getchar = promif_polledio->cons_polledio_getchar) == NULL)
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm return (0);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm if ((putchar = promif_polledio->cons_polledio_putchar) == NULL)
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm return (0);
1b83305cfc332b1e19ad6a194b73b2975e6bf79ajm return (c);
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* only support stdout (console) */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* return the length written */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (0);
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* unpack arguments */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* only support stdin (console) */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* return the length read */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (0);
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* only support stdin and stdout */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppopromif_io_init(ihandle_t in, ihandle_t out, phandle_t pin, phandle_t pout)
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * Cache the mapping between the stdin and stdout
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo * ihandles and their respective phandles.
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (-1);
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo /* construct the unit address from the 'reg' property */
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (-1);
a47315d76ac34b1416ba8bd333c4d3b7ee54a56bjm * Make sure we don't get dispatched onto a different
a47315d76ac34b1416ba8bd333c4d3b7ee54a56bjm * cpu if we happen to sleep. See kern_postprom().
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo return (0);
1ae0874509b6811fdde1dfd46f0d93fd09867a3fheppo#endif /* _KMDB */