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