xref: /onnv-gate/usr/src/psm/promif/ieee1275/sun4/prom_heartbeat.c (revision 11498:2fc576d74742)
1*11498SJerry.Gilliam@Sun.COM /*
2*11498SJerry.Gilliam@Sun.COM  * CDDL HEADER START
3*11498SJerry.Gilliam@Sun.COM  *
4*11498SJerry.Gilliam@Sun.COM  * The contents of this file are subject to the terms of the
5*11498SJerry.Gilliam@Sun.COM  * Common Development and Distribution License (the "License").
6*11498SJerry.Gilliam@Sun.COM  * You may not use this file except in compliance with the License.
7*11498SJerry.Gilliam@Sun.COM  *
8*11498SJerry.Gilliam@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*11498SJerry.Gilliam@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*11498SJerry.Gilliam@Sun.COM  * See the License for the specific language governing permissions
11*11498SJerry.Gilliam@Sun.COM  * and limitations under the License.
12*11498SJerry.Gilliam@Sun.COM  *
13*11498SJerry.Gilliam@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*11498SJerry.Gilliam@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*11498SJerry.Gilliam@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*11498SJerry.Gilliam@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*11498SJerry.Gilliam@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*11498SJerry.Gilliam@Sun.COM  *
19*11498SJerry.Gilliam@Sun.COM  * CDDL HEADER END
20*11498SJerry.Gilliam@Sun.COM  */
21*11498SJerry.Gilliam@Sun.COM /*
22*11498SJerry.Gilliam@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23*11498SJerry.Gilliam@Sun.COM  * Use is subject to license terms.
24*11498SJerry.Gilliam@Sun.COM  */
25*11498SJerry.Gilliam@Sun.COM 
26*11498SJerry.Gilliam@Sun.COM #include <sys/promif.h>
27*11498SJerry.Gilliam@Sun.COM #include <sys/promimpl.h>
28*11498SJerry.Gilliam@Sun.COM 
29*11498SJerry.Gilliam@Sun.COM /*
30*11498SJerry.Gilliam@Sun.COM  * Provide 10 millisecond heartbeat for the PROM. A client that has taken over
31*11498SJerry.Gilliam@Sun.COM  * the trap table and clock interrupts, but is not quite ready to take over the
32*11498SJerry.Gilliam@Sun.COM  * function of polling the input-device for an abort sequence (L1/A or BREAK)
33*11498SJerry.Gilliam@Sun.COM  * may use this function to instruct the PROM to poll the keyboard. If used,
34*11498SJerry.Gilliam@Sun.COM  * this function should be called every 10 milliseconds.
35*11498SJerry.Gilliam@Sun.COM  */
36*11498SJerry.Gilliam@Sun.COM int
prom_heartbeat(int msecs)37*11498SJerry.Gilliam@Sun.COM prom_heartbeat(int msecs)
38*11498SJerry.Gilliam@Sun.COM {
39*11498SJerry.Gilliam@Sun.COM 	cell_t ci[5];
40*11498SJerry.Gilliam@Sun.COM 
41*11498SJerry.Gilliam@Sun.COM 	ci[0] = p1275_ptr2cell("SUNW,heartbeat");	/* Service name */
42*11498SJerry.Gilliam@Sun.COM 	ci[1] = (cell_t)1;				/* #argument cells */
43*11498SJerry.Gilliam@Sun.COM 	ci[2] = (cell_t)1;				/* #result cells */
44*11498SJerry.Gilliam@Sun.COM 	ci[3] = p1275_int2cell(msecs);			/* Arg1: msecs */
45*11498SJerry.Gilliam@Sun.COM 	ci[4] = (cell_t)0;				/* Prime the result */
46*11498SJerry.Gilliam@Sun.COM 
47*11498SJerry.Gilliam@Sun.COM 	promif_preprom();
48*11498SJerry.Gilliam@Sun.COM 	(void) p1275_cif_handler(&ci);
49*11498SJerry.Gilliam@Sun.COM 	promif_postprom();
50*11498SJerry.Gilliam@Sun.COM 
51*11498SJerry.Gilliam@Sun.COM 	return (p1275_cell2int(ci[4]));			/* Res1: abort-flag */
52*11498SJerry.Gilliam@Sun.COM }
53