dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / psm / promif / ieee1275 / common / prom_test.c
blob0e760c6b93a6f01f2c9923ba62b08fd7f203e563
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 2008 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 * Test for existance of a specific P1275 client interface service
34 int
35 prom_test(char *service)
37 cell_t ci[5];
39 ci[0] = p1275_ptr2cell("test"); /* Service name */
40 ci[1] = (cell_t)1; /* #argument cells */
41 ci[2] = (cell_t)1; /* #result cells */
42 ci[3] = p1275_ptr2cell(service); /* Arg1: requested svc name */
43 ci[4] = (cell_t)-1; /* Res1: Prime result */
45 promif_preprom();
46 (void) p1275_cif_handler(&ci);
47 promif_postprom();
49 return (p1275_cell2int(ci[4])); /* Res1: missing flag */
52 int
53 prom_test_method(char *method, pnode_t node)
55 cell_t ci[6];
56 int rv;
57 char buf[80];
59 if (prom_test("test-method") == 0) {
60 ci[0] = p1275_ptr2cell("test-method"); /* service */
61 ci[1] = (cell_t)2; /* #argument cells */
62 ci[2] = (cell_t)1; /* #result cells */
63 ci[3] = p1275_dnode2cell(node);
64 ci[4] = p1275_ptr2cell(method);
65 ci[5] = (cell_t)-1;
67 promif_preprom();
68 (void) p1275_cif_handler(&ci);
69 promif_postprom();
70 rv = p1275_cell2int(ci[5]);
71 } else {
72 (void) prom_sprintf(buf,
73 "\" %s\" h# %x find-method invert h# %p l!",
74 method, node, (void *)&rv);
75 prom_interpret(buf, 0, 0, 0, 0, 0);
77 return (rv);