1*1991Sheppo /* 2*1991Sheppo * CDDL HEADER START 3*1991Sheppo * 4*1991Sheppo * The contents of this file are subject to the terms of the 5*1991Sheppo * Common Development and Distribution License (the "License"). 6*1991Sheppo * You may not use this file except in compliance with the License. 7*1991Sheppo * 8*1991Sheppo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1991Sheppo * or http://www.opensolaris.org/os/licensing. 10*1991Sheppo * See the License for the specific language governing permissions 11*1991Sheppo * and limitations under the License. 12*1991Sheppo * 13*1991Sheppo * When distributing Covered Code, include this CDDL HEADER in each 14*1991Sheppo * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1991Sheppo * If applicable, add the following below this CDDL HEADER, with the 16*1991Sheppo * fields enclosed by brackets "[]" replaced with your own identifying 17*1991Sheppo * information: Portions Copyright [yyyy] [name of copyright owner] 18*1991Sheppo * 19*1991Sheppo * CDDL HEADER END 20*1991Sheppo */ 21*1991Sheppo 22*1991Sheppo /* 23*1991Sheppo * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24*1991Sheppo * Use is subject to license terms. 25*1991Sheppo */ 26*1991Sheppo 27*1991Sheppo #pragma ident "%Z%%M% %I% %E% SMI" 28*1991Sheppo 29*1991Sheppo #include <sys/promif_impl.h> 30*1991Sheppo #include <sys/hypervisor_api.h> 31*1991Sheppo 32*1991Sheppo /* 33*1991Sheppo * Wrappers to get/set the API version with Hypervisor. 34*1991Sheppo */ 35*1991Sheppo 36*1991Sheppo int promif_set_sun4v_api_version(void * p)37*1991Sheppopromif_set_sun4v_api_version(void *p) 38*1991Sheppo { 39*1991Sheppo cell_t *ci = (cell_t *)p; 40*1991Sheppo uint64_t api_group; 41*1991Sheppo uint64_t major; 42*1991Sheppo uint64_t minor; 43*1991Sheppo uint64_t status; 44*1991Sheppo uint64_t supported_minor; 45*1991Sheppo 46*1991Sheppo ASSERT(ci[1] == 3); 47*1991Sheppo ASSERT(ci[2] == 2); 48*1991Sheppo 49*1991Sheppo api_group = (uint64_t)p1275_cell2int(ci[3]); 50*1991Sheppo major = (uint64_t)p1275_cell2int(ci[4]); 51*1991Sheppo minor = (uint64_t)p1275_cell2int(ci[5]); 52*1991Sheppo 53*1991Sheppo status = hv_api_set_version(api_group, major, minor, &supported_minor); 54*1991Sheppo 55*1991Sheppo ci[6] = p1275_int2cell(status); 56*1991Sheppo ci[7] = p1275_int2cell(supported_minor); 57*1991Sheppo 58*1991Sheppo return ((status == H_EOK) ? 0 : -1); 59*1991Sheppo } 60*1991Sheppo 61*1991Sheppo int promif_get_sun4v_api_version(void * p)62*1991Sheppopromif_get_sun4v_api_version(void *p) 63*1991Sheppo { 64*1991Sheppo cell_t *ci = (cell_t *)p; 65*1991Sheppo uint64_t api_group; 66*1991Sheppo uint64_t major; 67*1991Sheppo uint64_t minor; 68*1991Sheppo uint64_t status; 69*1991Sheppo 70*1991Sheppo ASSERT(ci[1] == 1); 71*1991Sheppo ASSERT(ci[2] == 3); 72*1991Sheppo 73*1991Sheppo api_group = (uint64_t)p1275_cell2int(ci[3]); 74*1991Sheppo 75*1991Sheppo status = hv_api_get_version(api_group, &major, &minor); 76*1991Sheppo 77*1991Sheppo ci[4] = p1275_int2cell(status); 78*1991Sheppo ci[5] = p1275_int2cell(major); 79*1991Sheppo ci[6] = p1275_int2cell(minor); 80*1991Sheppo 81*1991Sheppo return ((status == H_EOK) ? 0 : -1); 82*1991Sheppo } 83