dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / psm / promif / ieee1275 / sun4u / prom_opl.c
blob62f067fcb8291c13af10f97bb149b4aed7273a6d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include <sys/promif.h>
29 #include <sys/promimpl.h>
32 * This file implements promif routines for OPL-specific OBP client
33 * interfaces defined in FWARC/2005/268.
37 * prom_opl_get_tod - this function gets time-of-day and stick value from OBP.
38 * Please, see "The OPL OBP functional specification" for details.
41 void
42 prom_opl_get_tod(time_t *time, int64_t *stickval)
44 cell_t ci[5];
46 ci[0] = p1275_ptr2cell("FJSV,get-tod"); /* Service name */
47 ci[1] = (cell_t)0; /* #argument cells */
48 ci[2] = (cell_t)2; /* #result cells */
49 ci[3] = (cell_t)0; /* The result: STICK */
50 ci[4] = (cell_t)0; /* The result: time */
52 promif_preprom();
53 (void) p1275_cif_handler(&ci);
54 promif_postprom();
56 *stickval = ci[3];
57 *time = ci[4];
61 * prom_opl_set_diff - this function updates time difference
62 * w.r.t. SP/OBP reference time.
63 * Please, see "The OPL OBP functional specification" for details.
66 void
67 prom_opl_set_diff(int64_t diff)
69 cell_t ci[4];
71 ci[0] = p1275_ptr2cell("FJSV,set-domain-time"); /* Service name */
72 ci[1] = (cell_t)1; /* #argument cells */
73 ci[2] = (cell_t)0; /* #result cells */
74 ci[3] = (cell_t)diff; /* Arg1: time diff */
76 promif_preprom();
77 (void) p1275_cif_handler(&ci);
78 promif_postprom();
81 int
82 prom_attach_notice(int boardnum)
84 int rv;
85 cell_t ci[5];
87 ci[0] = p1275_ptr2cell("FJSV,attach-notice");
88 ci[1] = (cell_t)1;
89 ci[2] = (cell_t)1;
90 ci[3] = (cell_t)boardnum;
92 promif_preprom();
93 rv = p1275_cif_handler(&ci);
94 promif_postprom();
96 return ((rv) ? -1 : p1275_cell2int(ci[4]));
99 int
100 prom_detach_notice(int boardnum)
102 int rv;
103 cell_t ci[5];
105 ci[0] = p1275_ptr2cell("FJSV,detach-notice");
106 ci[1] = (cell_t)1;
107 ci[2] = (cell_t)1;
108 ci[3] = (cell_t)boardnum;
110 promif_preprom();
111 rv = p1275_cif_handler(&ci);
112 promif_postprom();
114 return ((rv) ? -1 : p1275_cell2int(ci[4]));
118 prom_opl_switch_console(int lsb_id)
120 cell_t ci[5];
121 int rv;
123 ci[0] = p1275_ptr2cell("FJSV,switch-console"); /* name */
124 ci[1] = (cell_t)1; /* #argument cells */
125 ci[2] = (cell_t)1; /* #result cells */
126 /* target tty-port# */
127 ci[3] = p1275_int2cell(lsb_id);
129 promif_preprom();
130 rv = p1275_cif_handler(&ci);
131 promif_postprom();
133 if (rv != 0) {
134 return (rv);
136 return (p1275_cell2int(ci[4])); /* Res1: Catch result */