1 /*
   2  * CDDL HEADER START
   3  *
   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.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * Hypervisor calls called by niu leaf driver.
  31 */
  32 
  33 #include <sys/asm_linkage.h>
  34 #include <sys/hypervisor_api.h>
  35 
  36 /*
  37  * NIU HV API v1.1 definitions
  38  */
  39 #define N2NIU_VR_GETINFO        0x148
  40 #define N2NIU_VR_GET_RX_MAP     0x14d
  41 #define N2NIU_VR_GET_TX_MAP     0x14e
  42 #define N2NIU_VRRX_SET_INO      0x150
  43 #define N2NIU_VRTX_SET_INO      0x151
  44 
  45 
  46 #if defined(lint) || defined(__lint)
  47 
  48 /*ARGSUSED*/
  49 uint64_t
  50 vdds_hv_niu_vr_getinfo(uint32_t cookie, uint64_t *real_start, uint64_t *size)
  51 { return (0); }
  52 
  53 /*ARGSUSED*/
  54 uint64_t
  55 vdds_hv_niu_vr_get_rxmap(uint32_t cookie, uint64_t *dma_map)
  56 { return (0); }
  57 
  58 /*ARGSUSED*/
  59 uint64_t
  60 vdds_hv_niu_vr_get_txmap(uint32_t cookie, uint64_t *dma_map)
  61 { return (0); }
  62 
  63 /*ARGSUSED*/
  64 uint64_t
  65 vdds_hv_niu_vrtx_set_ino(uint32_t cookie, uint64_t vch_idx, uint32_t ino)
  66 { return (0); }
  67 
  68 /*ARGSUSED*/
  69 uint64_t
  70 vdds_hv_niu_vrrx_set_ino(uint32_t cookie, uint64_t vch_idx, uint32_t ino)
  71 { return (0); }
  72 
  73 #else   /* lint || __lint */
  74 
  75         /*
  76          * vdds_hv_niu_vr_getinfo(uint32_t cookie, uint64_t &real_start,
  77          *     uint64_t &size)
  78          */
  79         ENTRY(vdds_hv_niu_vr_getinfo)
  80         mov     %o1, %g1
  81         mov     %o2, %g2
  82         mov     N2NIU_VR_GETINFO, %o5
  83         ta      FAST_TRAP
  84         stx     %o1, [%g1]
  85         retl
  86         stx     %o2, [%g2]
  87         SET_SIZE(vdds_hv_niu_vr_getinfo)
  88 
  89         /*
  90          * vdds_hv_niu_vr_get_rxmap(uint32_t cookie, uint64_t *dma_map)
  91          */
  92         ENTRY(vdds_hv_niu_vr_get_rxmap)
  93         mov     %o1, %g1
  94         mov     N2NIU_VR_GET_RX_MAP, %o5
  95         ta      FAST_TRAP
  96         retl
  97         stx     %o1, [%g1]
  98         SET_SIZE(vdds_hv_niu_vr_get_rxmap)
  99 
 100         /*
 101          * vdds_hv_niu_vr_get_txmap(uint32_t cookie, uint64_t *dma_map)
 102          */
 103         ENTRY(vdds_hv_niu_vr_get_txmap)
 104         mov     %o1, %g1
 105         mov     N2NIU_VR_GET_TX_MAP, %o5
 106         ta      FAST_TRAP
 107         retl
 108         stx     %o1, [%g1]
 109         SET_SIZE(vdds_hv_niu_vr_get_txmap)
 110 
 111         /*
 112          * vdds_hv_niu_vrrx_set_ino(uint32_t cookie, uint64_t vch_idx, uint32_t ino)
 113          */
 114         ENTRY(vdds_hv_niu_vrrx_set_ino)
 115         mov     N2NIU_VRRX_SET_INO, %o5
 116         ta      FAST_TRAP
 117         retl
 118         nop
 119         SET_SIZE(vdds_hv_niu_vrrx_set_ino)
 120 
 121         /*
 122          * vdds_hv_niu_vrtx_set_ino(uint32_t cookie, uint64_t vch_idx, uint32_t ino)
 123          */
 124         ENTRY(vdds_hv_niu_vrtx_set_ino)
 125         mov     N2NIU_VRTX_SET_INO, %o5
 126         ta      FAST_TRAP
 127         retl
 128         nop
 129         SET_SIZE(vdds_hv_niu_vrtx_set_ino)
 130 
 131 #endif  /* lint || __lint */