17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5110e73f9Sschwartz * Common Development and Distribution License (the "License"). 6110e73f9Sschwartz * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21110e73f9Sschwartz 227c478bd9Sstevel@tonic-gate /* 23*34f94fbcSWENTAO YANG * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_HYPERVISOR_API_H 277c478bd9Sstevel@tonic-gate #define _SYS_HYPERVISOR_API_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * sun4v Hypervisor API 317c478bd9Sstevel@tonic-gate * 327c478bd9Sstevel@tonic-gate * Reference: api.pdf Revision 0.12 dated May 12, 2004. 337c478bd9Sstevel@tonic-gate * io-api.txt version 1.11 dated 10/19/2004 347c478bd9Sstevel@tonic-gate */ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 377c478bd9Sstevel@tonic-gate extern "C" { 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * Trap types 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate #define FAST_TRAP 0x80 /* Function # in %o5 */ 447c478bd9Sstevel@tonic-gate #define CPU_TICK_NPT 0x81 457c478bd9Sstevel@tonic-gate #define CPU_STICK_NPT 0x82 467c478bd9Sstevel@tonic-gate #define MMU_MAP_ADDR 0x83 477c478bd9Sstevel@tonic-gate #define MMU_UNMAP_ADDR 0x84 482f0fcb93SJason Beloro #define MMU_MAP_TTE 0x86 497c478bd9Sstevel@tonic-gate 501ae08745Sheppo #define CORE_TRAP 0xff 511ae08745Sheppo 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * Error returns in %o0. 547c478bd9Sstevel@tonic-gate * (Additional result is returned in %o1.) 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate #define H_EOK 0 /* Successful return */ 577c478bd9Sstevel@tonic-gate #define H_ENOCPU 1 /* Invalid CPU id */ 587c478bd9Sstevel@tonic-gate #define H_ENORADDR 2 /* Invalid real address */ 597c478bd9Sstevel@tonic-gate #define H_ENOINTR 3 /* Invalid interrupt id */ 607c478bd9Sstevel@tonic-gate #define H_EBADPGSZ 4 /* Invalid pagesize encoding */ 617c478bd9Sstevel@tonic-gate #define H_EBADTSB 5 /* Invalid TSB description */ 627c478bd9Sstevel@tonic-gate #define H_EINVAL 6 /* Invalid argument */ 637c478bd9Sstevel@tonic-gate #define H_EBADTRAP 7 /* Invalid function number */ 647c478bd9Sstevel@tonic-gate #define H_EBADALIGN 8 /* Invalid address alignment */ 657c478bd9Sstevel@tonic-gate #define H_EWOULDBLOCK 9 /* Cannot complete operation */ 667c478bd9Sstevel@tonic-gate /* without blocking */ 677c478bd9Sstevel@tonic-gate #define H_ENOACCESS 10 /* No access to resource */ 687c478bd9Sstevel@tonic-gate #define H_EIO 11 /* I/O error */ 697c478bd9Sstevel@tonic-gate #define H_ECPUERROR 12 /* CPU is in error state */ 707c478bd9Sstevel@tonic-gate #define H_ENOTSUPPORTED 13 /* Function not supported */ 717c478bd9Sstevel@tonic-gate #define H_ENOMAP 14 /* Mapping is not valid, */ 727c478bd9Sstevel@tonic-gate /* no translation exists */ 73c56c1e58Sgirish #define H_EBUSY 17 /* Resource busy */ 741ae08745Sheppo #define H_ETOOMANY 15 /* Hard resource limit exceeded */ 751ae08745Sheppo #define H_ECHANNEL 16 /* Illegal LDC channel */ 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #define H_BREAK -1 /* Console Break */ 787c478bd9Sstevel@tonic-gate #define H_HUP -2 /* Console Break */ 79e5900f74Sha137994 80e5900f74Sha137994 /* 81e5900f74Sha137994 * Mondo CPU ID argument processing. 82e5900f74Sha137994 */ 83e5900f74Sha137994 #define HV_SEND_MONDO_ENTRYDONE 0xffff 84e5900f74Sha137994 857c478bd9Sstevel@tonic-gate /* 867c478bd9Sstevel@tonic-gate * Function numbers for FAST_TRAP. 877c478bd9Sstevel@tonic-gate */ 887c478bd9Sstevel@tonic-gate #define HV_MACH_EXIT 0x00 897c478bd9Sstevel@tonic-gate #define HV_MACH_DESC 0x01 901ae08745Sheppo #define HV_MACH_SIR 0x02 913c431bb5Swentaoy #define MACH_SET_WATCHDOG 0x05 921ae08745Sheppo 931ae08745Sheppo #define HV_CPU_START 0x10 941ae08745Sheppo #define HV_CPU_STOP 0x11 957c478bd9Sstevel@tonic-gate #define HV_CPU_YIELD 0x12 961ae08745Sheppo #define HV_CPU_QCONF 0x14 977c478bd9Sstevel@tonic-gate #define HV_CPU_STATE 0x17 981ae08745Sheppo #define HV_CPU_SET_RTBA 0x18 991ae08745Sheppo 1007c478bd9Sstevel@tonic-gate #define MMU_TSB_CTX0 0x20 1017c478bd9Sstevel@tonic-gate #define MMU_TSB_CTXNON0 0x21 1027c478bd9Sstevel@tonic-gate #define MMU_DEMAP_PAGE 0x22 1037c478bd9Sstevel@tonic-gate #define MMU_DEMAP_CTX 0x23 1047c478bd9Sstevel@tonic-gate #define MMU_DEMAP_ALL 0x24 1057c478bd9Sstevel@tonic-gate #define MAP_PERM_ADDR 0x25 1067c478bd9Sstevel@tonic-gate #define MMU_SET_INFOPTR 0x26 1071ae08745Sheppo #define MMU_ENABLE 0x27 1087c478bd9Sstevel@tonic-gate #define UNMAP_PERM_ADDR 0x28 1091ae08745Sheppo 1107c478bd9Sstevel@tonic-gate #define HV_MEM_SCRUB 0x31 1117c478bd9Sstevel@tonic-gate #define HV_MEM_SYNC 0x32 1121ae08745Sheppo 1137c478bd9Sstevel@tonic-gate #define HV_INTR_SEND 0x42 1141ae08745Sheppo 1157c478bd9Sstevel@tonic-gate #define TOD_GET 0x50 1167c478bd9Sstevel@tonic-gate #define TOD_SET 0x51 1171ae08745Sheppo 1181ae08745Sheppo #define CONS_GETCHAR 0x60 1191ae08745Sheppo #define CONS_PUTCHAR 0x61 120136097ceSjb145095 #define CONS_READ 0x62 121136097ceSjb145095 #define CONS_WRITE 0x63 1227c478bd9Sstevel@tonic-gate 1233b890a5bSjb145095 #define SOFT_STATE_SET 0x70 1243b890a5bSjb145095 #define SOFT_STATE_GET 0x71 1253b890a5bSjb145095 1267c478bd9Sstevel@tonic-gate #define TTRACE_BUF_CONF 0x90 1277c478bd9Sstevel@tonic-gate #define TTRACE_BUF_INFO 0x91 1287c478bd9Sstevel@tonic-gate #define TTRACE_ENABLE 0x92 1297c478bd9Sstevel@tonic-gate #define TTRACE_FREEZE 0x93 1307c478bd9Sstevel@tonic-gate #define DUMP_BUF_UPDATE 0x94 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate #define HVIO_INTR_DEVINO2SYSINO 0xa0 1337c478bd9Sstevel@tonic-gate #define HVIO_INTR_GETVALID 0xa1 1347c478bd9Sstevel@tonic-gate #define HVIO_INTR_SETVALID 0xa2 1357c478bd9Sstevel@tonic-gate #define HVIO_INTR_GETSTATE 0xa3 1367c478bd9Sstevel@tonic-gate #define HVIO_INTR_SETSTATE 0xa4 1377c478bd9Sstevel@tonic-gate #define HVIO_INTR_GETTARGET 0xa5 1387c478bd9Sstevel@tonic-gate #define HVIO_INTR_SETTARGET 0xa6 1397c478bd9Sstevel@tonic-gate 1401ae08745Sheppo #define VINTR_GET_COOKIE 0xa7 1411ae08745Sheppo #define VINTR_SET_COOKIE 0xa8 1421ae08745Sheppo #define VINTR_GET_VALID 0xa9 1431ae08745Sheppo #define VINTR_SET_VALID 0xaa 1441ae08745Sheppo #define VINTR_GET_STATE 0xab 1451ae08745Sheppo #define VINTR_SET_STATE 0xac 1461ae08745Sheppo #define VINTR_GET_TARGET 0xad 1471ae08745Sheppo #define VINTR_SET_TARGET 0xae 1481ae08745Sheppo 1491ae08745Sheppo #define LDC_TX_QCONF 0xe0 1501ae08745Sheppo #define LDC_TX_QINFO 0xe1 1511ae08745Sheppo #define LDC_TX_GET_STATE 0xe2 1521ae08745Sheppo #define LDC_TX_SET_QTAIL 0xe3 1531ae08745Sheppo #define LDC_RX_QCONF 0xe4 1541ae08745Sheppo #define LDC_RX_QINFO 0xe5 1551ae08745Sheppo #define LDC_RX_GET_STATE 0xe6 1561ae08745Sheppo #define LDC_RX_SET_QHEAD 0xe7 1571ae08745Sheppo 1581ae08745Sheppo #define LDC_SET_MAP_TABLE 0xea 1591ae08745Sheppo #define LDC_GET_MAP_TABLE 0xeb 1601ae08745Sheppo #define LDC_COPY 0xec 1611ae08745Sheppo #define LDC_MAPIN 0xed 1621ae08745Sheppo #define LDC_UNMAP 0xee 1631ae08745Sheppo #define LDC_REVOKE 0xef 164*34f94fbcSWENTAO YANG #define LDC_MAPIN_SIZE_MAX 0x187 1651ae08745Sheppo 1667c478bd9Sstevel@tonic-gate #ifdef SET_MMU_STATS 1677c478bd9Sstevel@tonic-gate #define MMU_STAT_AREA 0xfc 1687c478bd9Sstevel@tonic-gate #endif /* SET_MMU_STATS */ 1697c478bd9Sstevel@tonic-gate 1704df55fdeSJanie Lu #define HV_MACH_PRI 0x170 1714df55fdeSJanie Lu #define HV_REBOOT_DATA_SET 0x172 1724df55fdeSJanie Lu 1738d26100cSWyllys Ingersoll #define HV_TPM_GET 0x176 1748d26100cSWyllys Ingersoll #define HV_TPM_PUT 0x177 1758d26100cSWyllys Ingersoll 1762f0fcb93SJason Beloro #define HV_TM_ENABLE 0x180 1772f0fcb93SJason Beloro 178023e71deSHaik Aftandilian #define GUEST_SUSPEND 0x181 179023e71deSHaik Aftandilian #define TICK_SET_NPT 0x182 180023e71deSHaik Aftandilian #define STICK_SET_NPT 0x183 181023e71deSHaik Aftandilian 18269cd775fSschwartz #define HV_RA2PA 0x200 18369cd775fSschwartz #define HV_HPRIV 0x201 18469cd775fSschwartz 1857c478bd9Sstevel@tonic-gate /* 1861ae08745Sheppo * Function numbers for CORE_TRAP. 1871ae08745Sheppo */ 1881ae08745Sheppo #define API_SET_VERSION 0x00 1891ae08745Sheppo #define API_PUT_CHAR 0x01 1901ae08745Sheppo #define API_EXIT 0x02 1911ae08745Sheppo #define API_GET_VERSION 0x03 1921ae08745Sheppo 1931ae08745Sheppo 1941ae08745Sheppo /* 1953b890a5bSjb145095 * Definitions for MACH_SOFT_STATE routines 1963b890a5bSjb145095 */ 1973b890a5bSjb145095 1983b890a5bSjb145095 #define SIS_NORMAL 0x01 1993b890a5bSjb145095 #define SIS_TRANSITION 0x02 2003b890a5bSjb145095 2013b890a5bSjb145095 /* 2027c478bd9Sstevel@tonic-gate * Bits for MMU functions flags argument: 2037c478bd9Sstevel@tonic-gate * arg3 of MMU_MAP_ADDR 2047c478bd9Sstevel@tonic-gate * arg3 of MMU_DEMAP_CTX 2057c478bd9Sstevel@tonic-gate * arg2 of MMU_DEMAP_ALL 2067c478bd9Sstevel@tonic-gate */ 2077c478bd9Sstevel@tonic-gate #define MAP_DTLB 0x1 2087c478bd9Sstevel@tonic-gate #define MAP_ITLB 0x2 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * Interrupt state manipulation definitions. 2137c478bd9Sstevel@tonic-gate */ 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate #define HV_INTR_IDLE_STATE 0 2167c478bd9Sstevel@tonic-gate #define HV_INTR_RECEIVED_STATE 1 2177c478bd9Sstevel@tonic-gate #define HV_INTR_DELIVERED_STATE 2 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #define HV_INTR_NOTVALID 0 2207c478bd9Sstevel@tonic-gate #define HV_INTR_VALID 1 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #ifndef _ASM 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate /* 2257c478bd9Sstevel@tonic-gate * TSB description structure for MMU_TSB_CTX0 and MMU_TSB_CTXNON0. 2267c478bd9Sstevel@tonic-gate */ 2277c478bd9Sstevel@tonic-gate typedef struct hv_tsb_info { 2287c478bd9Sstevel@tonic-gate uint16_t hvtsb_idxpgsz; /* page size used to index TSB */ 2297c478bd9Sstevel@tonic-gate uint16_t hvtsb_assoc; /* TSB associativity */ 2307c478bd9Sstevel@tonic-gate uint32_t hvtsb_ntte; /* TSB size (#TTE entries) */ 2317c478bd9Sstevel@tonic-gate uint32_t hvtsb_ctx_index; /* context reg index */ 2327c478bd9Sstevel@tonic-gate uint32_t hvtsb_pgszs; /* sizes in use */ 2337c478bd9Sstevel@tonic-gate uint64_t hvtsb_pa; /* real address of TSB base */ 2347c478bd9Sstevel@tonic-gate uint64_t hvtsb_rsvd; /* reserved */ 2357c478bd9Sstevel@tonic-gate } hv_tsb_info_t; 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate #define HVTSB_SHARE_INDEX ((uint32_t)-1) 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #ifdef SET_MMU_STATS 2407c478bd9Sstevel@tonic-gate #ifndef TTE4V_NPGSZ 2417c478bd9Sstevel@tonic-gate #define TTE4V_NPGSZ 8 2427c478bd9Sstevel@tonic-gate #endif /* TTE4V_NPGSZ */ 2437c478bd9Sstevel@tonic-gate /* 2447c478bd9Sstevel@tonic-gate * MMU statistics structure for MMU_STAT_AREA 2457c478bd9Sstevel@tonic-gate */ 2467c478bd9Sstevel@tonic-gate struct mmu_stat_one { 2477c478bd9Sstevel@tonic-gate uint64_t hit_ctx0[TTE4V_NPGSZ]; 2487c478bd9Sstevel@tonic-gate uint64_t hit_ctxn0[TTE4V_NPGSZ]; 2497c478bd9Sstevel@tonic-gate uint64_t tsb_miss; 2507c478bd9Sstevel@tonic-gate uint64_t tlb_miss; /* miss, no TSB set */ 2517c478bd9Sstevel@tonic-gate uint64_t map_ctx0[TTE4V_NPGSZ]; 2527c478bd9Sstevel@tonic-gate uint64_t map_ctxn0[TTE4V_NPGSZ]; 2537c478bd9Sstevel@tonic-gate }; 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate struct mmu_stat { 2567c478bd9Sstevel@tonic-gate struct mmu_stat_one immu_stat; 2577c478bd9Sstevel@tonic-gate struct mmu_stat_one dmmu_stat; 2587c478bd9Sstevel@tonic-gate uint64_t set_ctx0; 2597c478bd9Sstevel@tonic-gate uint64_t set_ctxn0; 2607c478bd9Sstevel@tonic-gate }; 2617c478bd9Sstevel@tonic-gate #endif /* SET_MMU_STATS */ 2627c478bd9Sstevel@tonic-gate 2631ae08745Sheppo #endif /* ! _ASM */ 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate /* 2667c478bd9Sstevel@tonic-gate * CPU States 2677c478bd9Sstevel@tonic-gate */ 2687c478bd9Sstevel@tonic-gate #define CPU_STATE_INVALID 0x0 2691ae08745Sheppo #define CPU_STATE_STOPPED 0x1 /* cpu not started */ 2701ae08745Sheppo #define CPU_STATE_RUNNING 0x2 /* cpu running guest code */ 2717c478bd9Sstevel@tonic-gate #define CPU_STATE_ERROR 0x3 /* cpu is in the error state */ 2727c478bd9Sstevel@tonic-gate #define CPU_STATE_LAST_PUBLIC CPU_STATE_ERROR /* last valid state */ 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate /* 2757c478bd9Sstevel@tonic-gate * MMU fault status area 2767c478bd9Sstevel@tonic-gate */ 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate #define MMFSA_TYPE_ 0x00 /* fault type */ 2797c478bd9Sstevel@tonic-gate #define MMFSA_ADDR_ 0x08 /* fault address */ 2807c478bd9Sstevel@tonic-gate #define MMFSA_CTX_ 0x10 /* fault context */ 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate #define MMFSA_I_ 0x00 /* start of fields for I */ 2837c478bd9Sstevel@tonic-gate #define MMFSA_I_TYPE (MMFSA_I_ + MMFSA_TYPE_) /* instruction fault type */ 2847c478bd9Sstevel@tonic-gate #define MMFSA_I_ADDR (MMFSA_I_ + MMFSA_ADDR_) /* instruction fault address */ 2857c478bd9Sstevel@tonic-gate #define MMFSA_I_CTX (MMFSA_I_ + MMFSA_CTX_) /* instruction fault context */ 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate #define MMFSA_D_ 0x40 /* start of fields for D */ 2887c478bd9Sstevel@tonic-gate #define MMFSA_D_TYPE (MMFSA_D_ + MMFSA_TYPE_) /* data fault type */ 2897c478bd9Sstevel@tonic-gate #define MMFSA_D_ADDR (MMFSA_D_ + MMFSA_ADDR_) /* data fault address */ 2907c478bd9Sstevel@tonic-gate #define MMFSA_D_CTX (MMFSA_D_ + MMFSA_CTX_) /* data fault context */ 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate #define MMFSA_F_FMISS 1 /* fast miss */ 2937c478bd9Sstevel@tonic-gate #define MMFSA_F_FPROT 2 /* fast protection */ 2947c478bd9Sstevel@tonic-gate #define MMFSA_F_MISS 3 /* mmu miss */ 2957c478bd9Sstevel@tonic-gate #define MMFSA_F_INVRA 4 /* invalid RA */ 2967c478bd9Sstevel@tonic-gate #define MMFSA_F_PRIV 5 /* privilege violation */ 2977c478bd9Sstevel@tonic-gate #define MMFSA_F_PROT 6 /* protection violation */ 2987c478bd9Sstevel@tonic-gate #define MMFSA_F_NFO 7 /* NFO access */ 2997c478bd9Sstevel@tonic-gate #define MMFSA_F_SOPG 8 /* so page */ 3007c478bd9Sstevel@tonic-gate #define MMFSA_F_INVVA 9 /* invalid VA */ 3017c478bd9Sstevel@tonic-gate #define MMFSA_F_INVASI 10 /* invalid ASI */ 3027c478bd9Sstevel@tonic-gate #define MMFSA_F_NCATM 11 /* non-cacheable atomic */ 3037c478bd9Sstevel@tonic-gate #define MMFSA_F_PRVACT 12 /* privileged action */ 3047c478bd9Sstevel@tonic-gate #define MMFSA_F_WPT 13 /* watchpoint hit */ 3057c478bd9Sstevel@tonic-gate #define MMFSA_F_UNALIGN 14 /* unaligned access */ 3067c478bd9Sstevel@tonic-gate #define MMFSA_F_INVPGSZ 15 /* invalid page size */ 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate #define MMFSA_SIZE 0x80 /* in bytes, 64 byte aligned */ 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate /* 3117c478bd9Sstevel@tonic-gate * MMU fault status - MMFSA_IFS and MMFSA_DFS 3127c478bd9Sstevel@tonic-gate */ 3137c478bd9Sstevel@tonic-gate #define MMFS_FV 0x00000001 3147c478bd9Sstevel@tonic-gate #define MMFS_OW 0x00000002 3157c478bd9Sstevel@tonic-gate #define MMFS_W 0x00000004 3167c478bd9Sstevel@tonic-gate #define MMFS_PR 0x00000008 3177c478bd9Sstevel@tonic-gate #define MMFS_CT 0x00000030 3187c478bd9Sstevel@tonic-gate #define MMFS_E 0x00000040 3197c478bd9Sstevel@tonic-gate #define MMFS_FT 0x00003f80 3207c478bd9Sstevel@tonic-gate #define MMFS_ME 0x00004000 3217c478bd9Sstevel@tonic-gate #define MMFS_TM 0x00008000 3227c478bd9Sstevel@tonic-gate #define MMFS_ASI 0x00ff0000 3237c478bd9Sstevel@tonic-gate #define MMFS_NF 0x01000000 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * DMA sync parameter definitions 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate #define HVIO_DMA_SYNC_DIR_TO_DEV 0x01 3297c478bd9Sstevel@tonic-gate #define HVIO_DMA_SYNC_DIR_FROM_DEV 0x02 3307c478bd9Sstevel@tonic-gate 3311ae08745Sheppo /* 3321ae08745Sheppo * LDC Channel States 3331ae08745Sheppo */ 3341ae08745Sheppo #define LDC_CHANNEL_DOWN 0x0 3351ae08745Sheppo #define LDC_CHANNEL_UP 0x1 3361ae08745Sheppo #define LDC_CHANNEL_RESET 0x2 3371ae08745Sheppo 338*34f94fbcSWENTAO YANG /* 339*34f94fbcSWENTAO YANG * LDC mapin table types 340*34f94fbcSWENTAO YANG */ 341*34f94fbcSWENTAO YANG #define LDC_MAPIN_TYPE_REGULAR 0x1 /* 8K page-size table */ 342*34f94fbcSWENTAO YANG #define LDC_MAPIN_TYPE_LARGE 0x2 /* Large page-size table */ 343*34f94fbcSWENTAO YANG 3447c478bd9Sstevel@tonic-gate #ifndef _ASM 3457c478bd9Sstevel@tonic-gate 3467c478bd9Sstevel@tonic-gate extern uint64_t hv_mmu_map_perm_addr(void *, int, uint64_t, int); 3477c478bd9Sstevel@tonic-gate extern uint64_t hv_mmu_unmap_perm_addr(void *, int, int); 3481ae08745Sheppo extern uint64_t hv_mach_exit(uint64_t exit_code); 3491ae08745Sheppo extern uint64_t hv_mach_sir(void); 3501ae08745Sheppo 3511ae08745Sheppo extern uint64_t hv_cpu_start(uint64_t cpuid, uint64_t pc, uint64_t rtba, 3521ae08745Sheppo uint64_t arg); 3531ae08745Sheppo extern uint64_t hv_cpu_stop(uint64_t cpuid); 3541ae08745Sheppo extern uint64_t hv_cpu_set_rtba(uint64_t *rtba); 3551ae08745Sheppo 3567c478bd9Sstevel@tonic-gate extern uint64_t hv_set_ctx0(uint64_t, uint64_t); 3577c478bd9Sstevel@tonic-gate extern uint64_t hv_set_ctxnon0(uint64_t, uint64_t); 3581ae08745Sheppo extern uint64_t hv_mmu_fault_area_conf(void *raddr); 3597c478bd9Sstevel@tonic-gate #ifdef SET_MMU_STATS 3607c478bd9Sstevel@tonic-gate extern uint64_t hv_mmu_set_stat_area(uint64_t, uint64_t); 3617c478bd9Sstevel@tonic-gate #endif /* SET_MMU_STATS */ 3627c478bd9Sstevel@tonic-gate 3637c478bd9Sstevel@tonic-gate extern uint64_t hv_cpu_qconf(int queue, uint64_t paddr, int size); 3641ae08745Sheppo extern uint64_t hv_cpu_yield(void); 3657c478bd9Sstevel@tonic-gate extern uint64_t hv_cpu_state(uint64_t cpuid, uint64_t *cpu_state); 3667c478bd9Sstevel@tonic-gate extern uint64_t hv_mem_scrub(uint64_t real_addr, uint64_t length, 3677c478bd9Sstevel@tonic-gate uint64_t *scrubbed_len); 3687c478bd9Sstevel@tonic-gate extern uint64_t hv_mem_sync(uint64_t real_addr, uint64_t length, 3697c478bd9Sstevel@tonic-gate uint64_t *flushed_len); 3702f0fcb93SJason Beloro extern uint64_t hv_tm_enable(uint64_t enable); 3717c478bd9Sstevel@tonic-gate 3727c478bd9Sstevel@tonic-gate extern uint64_t hv_service_recv(uint64_t s_id, uint64_t buf_pa, 3737c478bd9Sstevel@tonic-gate uint64_t size, uint64_t *recv_bytes); 3747c478bd9Sstevel@tonic-gate extern uint64_t hv_service_send(uint64_t s_id, uint64_t buf_pa, 3757c478bd9Sstevel@tonic-gate uint64_t size, uint64_t *send_bytes); 3767c478bd9Sstevel@tonic-gate extern uint64_t hv_service_getstatus(uint64_t s_id, uint64_t *vreg); 377c9b9f191Swh94709 extern uint64_t hv_service_setstatus(uint64_t s_id, uint64_t bits); 3787c478bd9Sstevel@tonic-gate extern uint64_t hv_service_clrstatus(uint64_t s_id, uint64_t bits); 3797c478bd9Sstevel@tonic-gate extern uint64_t hv_mach_desc(uint64_t buffer_ra, uint64_t *buffer_sizep); 3807c478bd9Sstevel@tonic-gate 3817c478bd9Sstevel@tonic-gate extern uint64_t hv_ttrace_buf_info(uint64_t *, uint64_t *); 3827c478bd9Sstevel@tonic-gate extern uint64_t hv_ttrace_buf_conf(uint64_t, uint64_t, uint64_t *); 3837c478bd9Sstevel@tonic-gate extern uint64_t hv_ttrace_enable(uint64_t, uint64_t *); 3847c478bd9Sstevel@tonic-gate extern uint64_t hv_ttrace_freeze(uint64_t, uint64_t *); 3857c478bd9Sstevel@tonic-gate extern uint64_t hv_dump_buf_update(uint64_t, uint64_t, uint64_t *); 3863c431bb5Swentaoy extern uint64_t hv_mach_set_watchdog(uint64_t, uint64_t *); 3877c478bd9Sstevel@tonic-gate 3887c478bd9Sstevel@tonic-gate extern int64_t hv_cnputchar(uint8_t); 3897c478bd9Sstevel@tonic-gate extern int64_t hv_cngetchar(uint8_t *); 390136097ceSjb145095 extern int64_t hv_cnwrite(uint64_t, uint64_t, uint64_t *); 391136097ceSjb145095 extern int64_t hv_cnread(uint64_t, uint64_t, int64_t *); 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate extern uint64_t hv_tod_get(uint64_t *seconds); 3947c478bd9Sstevel@tonic-gate extern uint64_t hv_tod_set(uint64_t); 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_devino_to_sysino(uint64_t dev_hdl, uint32_t devino, 3977c478bd9Sstevel@tonic-gate uint64_t *sysino); 3987c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_getvalid(uint64_t sysino, 3997c478bd9Sstevel@tonic-gate int *intr_valid_state); 4007c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_setvalid(uint64_t sysino, 4017c478bd9Sstevel@tonic-gate int intr_valid_state); 4027c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_getstate(uint64_t sysino, 4037c478bd9Sstevel@tonic-gate int *intr_state); 4047c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_setstate(uint64_t sysino, int intr_state); 4057c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_gettarget(uint64_t sysino, uint32_t *cpuid); 4067c478bd9Sstevel@tonic-gate extern uint64_t hvio_intr_settarget(uint64_t sysino, uint32_t cpuid); 4073b890a5bSjb145095 extern uint64_t hv_soft_state_set(uint64_t state, uint64_t string_ra); 4083b890a5bSjb145095 extern uint64_t hv_soft_state_get(uint64_t string_ra, uint64_t *state); 409110e73f9Sschwartz 4101ae08745Sheppo extern uint64_t hv_ldc_tx_qconf(uint64_t channel, uint64_t ra_base, 4111ae08745Sheppo uint64_t nentries); 4121ae08745Sheppo extern uint64_t hv_ldc_tx_qinfo(uint64_t channel, uint64_t *ra_base, 4131ae08745Sheppo uint64_t *nentries); 4141ae08745Sheppo extern uint64_t hv_ldc_tx_get_state(uint64_t channel, uint64_t *headp, 4151ae08745Sheppo uint64_t *tailp, uint64_t *state); 4161ae08745Sheppo extern uint64_t hv_ldc_tx_set_qtail(uint64_t channel, uint64_t tail); 4171ae08745Sheppo extern uint64_t hv_ldc_rx_qconf(uint64_t channel, uint64_t ra_base, 4181ae08745Sheppo uint64_t nentries); 4191ae08745Sheppo extern uint64_t hv_ldc_rx_qinfo(uint64_t channel, uint64_t *ra_base, 4201ae08745Sheppo uint64_t *nentries); 4211ae08745Sheppo extern uint64_t hv_ldc_rx_get_state(uint64_t channel, uint64_t *headp, 4221ae08745Sheppo uint64_t *tailp, uint64_t *state); 4231ae08745Sheppo extern uint64_t hv_ldc_rx_set_qhead(uint64_t channel, uint64_t head); 4241ae08745Sheppo 4251ae08745Sheppo extern uint64_t hv_ldc_set_map_table(uint64_t channel, uint64_t tbl_ra, 4261ae08745Sheppo uint64_t tbl_entries); 4271ae08745Sheppo extern uint64_t hv_ldc_get_map_table(uint64_t channel, uint64_t *tbl_ra, 4281ae08745Sheppo uint64_t *tbl_entries); 4291ae08745Sheppo extern uint64_t hv_ldc_copy(uint64_t channel, uint64_t request, 4301ae08745Sheppo uint64_t cookie, uint64_t raddr, uint64_t length, uint64_t *lengthp); 4311ae08745Sheppo extern uint64_t hv_ldc_mapin(uint64_t channel, uint64_t cookie, 4321ae08745Sheppo uint64_t *raddr, uint64_t *perm); 4331ae08745Sheppo extern uint64_t hv_ldc_unmap(uint64_t raddr); 4344bac2208Snarayan extern uint64_t hv_ldc_revoke(uint64_t channel, uint64_t cookie, 4354bac2208Snarayan uint64_t revoke_cookie); 436*34f94fbcSWENTAO YANG extern uint64_t hv_ldc_mapin_size_max(uint64_t tbl_type, uint64_t *sz); 4371ae08745Sheppo extern uint64_t hv_api_get_version(uint64_t api_group, uint64_t *majorp, 4381ae08745Sheppo uint64_t *minorp); 4391ae08745Sheppo extern uint64_t hv_api_set_version(uint64_t api_group, uint64_t major, 4401ae08745Sheppo uint64_t minor, uint64_t *supported_minor); 4411ae08745Sheppo 4421ae08745Sheppo extern uint64_t hvldc_intr_getcookie(uint64_t dev_hdl, uint32_t devino, 4431ae08745Sheppo uint64_t *cookie); 4441ae08745Sheppo extern uint64_t hvldc_intr_setcookie(uint64_t dev_hdl, uint32_t devino, 4451ae08745Sheppo uint64_t cookie); 4461ae08745Sheppo extern uint64_t hvldc_intr_getvalid(uint64_t dev_hdl, uint32_t devino, 4471ae08745Sheppo int *intr_valid_state); 4481ae08745Sheppo extern uint64_t hvldc_intr_setvalid(uint64_t dev_hdl, uint32_t devino, 4491ae08745Sheppo int intr_valid_state); 4501ae08745Sheppo extern uint64_t hvldc_intr_getstate(uint64_t dev_hdl, uint32_t devino, 4511ae08745Sheppo int *intr_state); 4521ae08745Sheppo extern uint64_t hvldc_intr_setstate(uint64_t dev_hdl, uint32_t devino, 4531ae08745Sheppo int intr_state); 4541ae08745Sheppo extern uint64_t hvldc_intr_gettarget(uint64_t dev_hdl, uint32_t devino, 4551ae08745Sheppo uint32_t *cpuid); 4561ae08745Sheppo extern uint64_t hvldc_intr_settarget(uint64_t dev_hdl, uint32_t devino, 4571ae08745Sheppo uint32_t cpuid); 4584df55fdeSJanie Lu extern uint64_t hv_mach_pri(uint64_t buffer_ra, uint64_t *buffer_sizep); 4594df55fdeSJanie Lu extern uint64_t hv_reboot_data_set(uint64_t buffer_ra, uint64_t buffer_len); 4601ae08745Sheppo 461023e71deSHaik Aftandilian extern uint64_t hv_guest_suspend(void); 462023e71deSHaik Aftandilian extern uint64_t hv_tick_set_npt(uint64_t npt); 463023e71deSHaik Aftandilian extern uint64_t hv_stick_set_npt(uint64_t npt); 464023e71deSHaik Aftandilian 4651ae08745Sheppo #endif /* ! _ASM */ 4661ae08745Sheppo 4677c478bd9Sstevel@tonic-gate 4687c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4697c478bd9Sstevel@tonic-gate } 4707c478bd9Sstevel@tonic-gate #endif 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate #endif /* _SYS_HYPERVISOR_API_H */ 473