import less(1)
[unleashed/tickless.git] / usr / src / psm / promif / ieee1275 / sun4v / prom_sun4v_api_version.c
blobafb7ed7c46851ab94e9a4d8f924f05c1122963b5
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>
30 #include <sys/hypervisor_api.h>
33 * This interface allows the client to negotiate a major/minor
34 * version number for the specified sun4v API group.
36 uint64_t
37 prom_set_sun4v_api_version(uint64_t api_group, uint64_t major, uint64_t minor,
38 uint64_t *supported_minor)
40 cell_t ci[8];
42 if (prom_test("SUNW,set-sun4v-api-version") != 0)
43 return (H_EBADTRAP);
45 ci[0] = p1275_ptr2cell("SUNW,set-sun4v-api-version"); /* Service */
46 ci[1] = (cell_t)3; /* #argument cells */
47 ci[2] = (cell_t)2; /* #result cells */
48 ci[3] = (cell_t)api_group; /* Arg1: api_group */
49 ci[4] = (cell_t)major; /* Arg2: major */
50 ci[5] = (cell_t)minor; /* Arg3: minor */
51 ci[6] = (cell_t)-1; /* Res1: status */
52 ci[7] = (cell_t)-1; /* Res2: Supported minor */
54 promif_preprom();
55 (void) p1275_cif_handler(&ci);
56 promif_postprom();
58 *supported_minor = (uint64_t)(ci[7]);
59 return ((uint64_t)(ci[6]));
63 * This interface allows the client to get the currently negotiated
64 * major/minor version number associated with the specified sun4v
65 * API group.
67 uint64_t
68 prom_get_sun4v_api_version(uint64_t api_group, uint64_t *major, uint64_t *minor)
70 cell_t ci[7];
72 if (prom_test("SUNW,get-sun4v-api-version") != 0)
73 return (H_EBADTRAP);
75 ci[0] = p1275_ptr2cell("SUNW,get-sun4v-api-version"); /* Service */
76 ci[1] = (cell_t)1; /* #argument cells */
77 ci[2] = (cell_t)3; /* #result cells */
78 ci[3] = (cell_t)api_group; /* Arg1: api_group */
79 ci[4] = (cell_t)-1; /* Res1: status */
80 ci[5] = (cell_t)-1; /* Res2: major number */
81 ci[6] = (cell_t)-1; /* Res3: minor number */
83 promif_preprom();
84 (void) p1275_cif_handler(&ci);
85 promif_postprom();
87 *major = (uint64_t)(ci[5]);
88 *minor = (uint64_t)(ci[6]);
89 return ((uint64_t)(ci[4]));