1/****************************************************************************** 2 * save_types.h 3 * 4 * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp> 5 * VA Linux Systems Japan K.K. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to 9 * deal in the Software without restriction, including without limitation the 10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 11 * sell copies of the Software, and to permit persons to whom the Software is 12 * furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 * DEALINGS IN THE SOFTWARE. 24 */ 25 26#ifndef __XEN_PUBLIC_HVM_SAVE_IA64_H__ 27#define __XEN_PUBLIC_HVM_SAVE_IA64_H__ 28 29#include "../../hvm/save.h" 30#include "../../arch-ia64.h" 31 32/* 33 * Save/restore header: general info about the save file. 34 */ 35 36/* x86 uses 0x54381286 */ 37#define HVM_FILE_MAGIC 0x343641492f6e6558UL /* "Xen/IA64" */ 38#define HVM_FILE_VERSION 0x0000000000000001UL 39 40struct hvm_save_header { 41 uint64_t magic; /* Must be HVM_FILE_MAGIC */ 42 uint64_t version; /* File format version */ 43 uint64_t changeset; /* Version of Xen that saved this file */ 44 uint64_t cpuid[5]; /* CPUID[0x01][%eax] on the saving machine */ 45}; 46 47DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header); 48 49/* 50 * CPU 51 */ 52struct hvm_hw_ia64_cpu { 53 uint64_t ipsr; 54}; 55DECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_ia64_cpu); 56 57/* 58 * CPU 59 */ 60struct hvm_hw_ia64_vpd { 61 struct vpd vpd; 62}; 63DECLARE_HVM_SAVE_TYPE(VPD, 3, struct hvm_hw_ia64_vpd); 64 65/* 66 * device dependency 67 * vacpi => viosapic => vlsapic 68 */ 69/* 70 * vlsapic 71 */ 72struct hvm_hw_ia64_vlsapic { 73 uint64_t insvc[4]; 74 uint64_t vhpi; // ??? should this be saved in vpd 75 uint8_t xtp; 76 uint8_t pal_init_pending; 77 uint8_t pad[2]; 78}; 79DECLARE_HVM_SAVE_TYPE(VLSAPIC, 4, struct hvm_hw_ia64_vlsapic); 80/* set 81 * unconditionaly set v->arch.irq_new_peding = 1 82 * unconditionaly set v->arch.irq_new_condition = 0 83 */ 84 85/* 86 * vtime 87 */ 88/* itc, itm, itv are saved by arch vcpu context */ 89struct hvm_hw_ia64_vtime { 90 uint64_t itc; 91 uint64_t itm; 92 93 uint64_t last_itc; 94 uint64_t pending; 95}; 96DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime); 97/* 98 * calculate v->vtm.vtm_offset 99 * ??? Or should vtm_offset be set by leave_hypervisor_tail()? 100 * start vtm_timer if necessary by vtm_set_itm(). 101 * ??? Or should vtm_timer be set by leave_hypervisor_tail()? 102 * 103 * ??? or should be done by schedule_tail() 104 * => schedule_tail() should do. 105 */ 106 107/* 108 * viosapic 109 */ 110#define VIOSAPIC_NUM_PINS 48 111 112/* To share VT-d code which uses vioapic_redir_entry. 113 * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry 114 * instead of viosapic_redir_entry. 115 */ 116union vioapic_redir_entry 117{ 118 uint64_t bits; 119 struct { 120 uint8_t vector; 121 122 uint8_t delivery_mode : 3; 123 uint8_t reserve1 : 1; 124 uint8_t delivery_status: 1; 125 uint8_t polarity : 1; 126 uint8_t reserve2 : 1; 127 uint8_t trig_mode : 1; 128 129 uint8_t mask : 1; 130 uint8_t reserve3 : 7; 131 132 uint8_t reserved[3]; 133 uint16_t dest_id; 134 } fields; 135}; 136 137struct hvm_hw_ia64_viosapic { 138 uint64_t irr; 139 uint64_t isr; 140 uint32_t ioregsel; 141 uint32_t pad; 142 uint64_t lowest_vcpu_id; 143 uint64_t base_address; 144 union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; 145}; 146DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic); 147 148/* 149 * vacpi 150 * PM timer 151 */ 152struct vacpi_regs { 153 union { 154 struct { 155 uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */ 156 uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */ 157 }; 158 uint32_t evt_blk; 159 }; 160 uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */ 161}; 162 163struct hvm_hw_ia64_vacpi { 164 struct vacpi_regs regs; 165}; 166DECLARE_HVM_SAVE_TYPE(VACPI, 7, struct hvm_hw_ia64_vacpi); 167/* update last_gtime and setup timer of struct vacpi */ 168 169/* 170 * opt_feature: identity mapping of region 4, 5 and 7. 171 * With the c/s 16396:d2935f9c217f of xen-ia64-devel.hg, 172 * opt_feature hypercall supports only region 4,5,7 identity mappings. 173 * structure hvm_hw_ia64_identity_mappings only supports them. 174 * The new structure, struct hvm_hw_ia64_identity_mappings, is created to 175 * avoid to keep up with change of the xen/ia64 internal structure, struct 176 * opt_feature. 177 * 178 * If it is enhanced in the future, new structure will be created. 179 */ 180struct hvm_hw_ia64_identity_mapping { 181 uint64_t on; /* on/off */ 182 uint64_t pgprot; /* The page protection bit mask of the pte. */ 183 uint64_t key; /* A protection key. */ 184}; 185 186struct hvm_hw_ia64_identity_mappings { 187 struct hvm_hw_ia64_identity_mapping im_reg4;/* Region 4 identity mapping */ 188 struct hvm_hw_ia64_identity_mapping im_reg5;/* Region 5 identity mapping */ 189 struct hvm_hw_ia64_identity_mapping im_reg7;/* Region 7 identity mapping */ 190}; 191DECLARE_HVM_SAVE_TYPE(OPT_FEATURE_IDENTITY_MAPPINGS, 8, struct hvm_hw_ia64_identity_mappings); 192 193/* 194 * Largest type-code in use 195 */ 196#define HVM_SAVE_CODE_MAX 8 197 198#endif /* __XEN_PUBLIC_HVM_SAVE_IA64_H__ */ 199 200/* 201 * Local variables: 202 * mode: C 203 * c-set-style: "BSD" 204 * c-basic-offset: 4 205 * tab-width: 4 206 * indent-tabs-mode: nil 207 * End: 208 */ 209