1177162Sjkoshy/******************************************************************************
2145256Sjkoshy * save_types.h
3145256Sjkoshy *
4145256Sjkoshy * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
5145256Sjkoshy *                    VA Linux Systems Japan K.K.
6145256Sjkoshy *
7145256Sjkoshy * Permission is hereby granted, free of charge, to any person obtaining a copy
8145256Sjkoshy * of this software and associated documentation files (the "Software"), to
9145256Sjkoshy * deal in the Software without restriction, including without limitation the
10145256Sjkoshy * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11145256Sjkoshy * sell copies of the Software, and to permit persons to whom the Software is
12231871Sbrueffer * furnished to do so, subject to the following conditions:
13231871Sbrueffer *
14231871Sbrueffer * The above copyright notice and this permission notice shall be included in
15231871Sbrueffer * all copies or substantial portions of the Software.
16231871Sbrueffer *
17231871Sbrueffer * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18231871Sbrueffer * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19231871Sbrueffer * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20231871Sbrueffer * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21231871Sbrueffer * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22231871Sbrueffer * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23145256Sjkoshy * DEALINGS IN THE SOFTWARE.
24145256Sjkoshy */
25145256Sjkoshy
26183597Sjkoshy#ifndef __XEN_PUBLIC_HVM_SAVE_IA64_H__
27206622Suqs#define __XEN_PUBLIC_HVM_SAVE_IA64_H__
28145256Sjkoshy
29145256Sjkoshy#include "../../hvm/save.h"
30183107Sjkoshy#include "../../arch-ia64.h"
31183084Sjkoshy
32183084Sjkoshy/*
33183084Sjkoshy * Save/restore header: general info about the save file.
34145256Sjkoshy */
35145256Sjkoshy
36145256Sjkoshy/* x86 uses 0x54381286 */
37145256Sjkoshy#define HVM_FILE_MAGIC   0x343641492f6e6558UL   /* "Xen/IA64" */
38145256Sjkoshy#define HVM_FILE_VERSION 0x0000000000000001UL
39145256Sjkoshy
40145256Sjkoshystruct hvm_save_header {
41145256Sjkoshy    uint64_t magic;             /* Must be HVM_FILE_MAGIC */
42147586Sru    uint64_t version;           /* File format version */
43145256Sjkoshy    uint64_t changeset;         /* Version of Xen that saved this file */
44145256Sjkoshy    uint64_t cpuid[5];          /* CPUID[0x01][%eax] on the saving machine */
45145256Sjkoshy};
46145256Sjkoshy
47145256SjkoshyDECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
48183084Sjkoshy
49145256Sjkoshy/*
50145256Sjkoshy * CPU
51145256Sjkoshy */
52145256Sjkoshystruct hvm_hw_ia64_cpu {
53145256Sjkoshy    uint64_t    ipsr;
54145256Sjkoshy};
55145256SjkoshyDECLARE_HVM_SAVE_TYPE(CPU, 2, struct hvm_hw_ia64_cpu);
56145256Sjkoshy
57145440Sjkoshy/*
58145440Sjkoshy * CPU
59145440Sjkoshy */
60145440Sjkoshystruct hvm_hw_ia64_vpd {
61145440Sjkoshy    struct vpd      vpd;
62145440Sjkoshy};
63145440SjkoshyDECLARE_HVM_SAVE_TYPE(VPD, 3, struct hvm_hw_ia64_vpd);
64183084Sjkoshy
65183084Sjkoshy/*
66183084Sjkoshy * device dependency
67183084Sjkoshy * vacpi => viosapic => vlsapic
68183084Sjkoshy */
69183084Sjkoshy/*
70183084Sjkoshy * vlsapic
71183084Sjkoshy */
72183084Sjkoshystruct hvm_hw_ia64_vlsapic {
73183084Sjkoshy    uint64_t insvc[4];
74183084Sjkoshy    uint64_t vhpi; // ??? should this be saved in vpd
75183084Sjkoshy    uint8_t xtp;
76183084Sjkoshy    uint8_t pal_init_pending;
77183084Sjkoshy    uint8_t pad[2];
78183084Sjkoshy};
79183084SjkoshyDECLARE_HVM_SAVE_TYPE(VLSAPIC, 4, struct hvm_hw_ia64_vlsapic);
80183084Sjkoshy/* set
81183084Sjkoshy * unconditionaly set v->arch.irq_new_peding = 1
82183084Sjkoshy * unconditionaly set v->arch.irq_new_condition = 0
83183084Sjkoshy */
84145256Sjkoshy
85145256Sjkoshy/*
86145256Sjkoshy * vtime
87145256Sjkoshy */
88145256Sjkoshy/* itc, itm, itv are saved by arch vcpu context */
89145256Sjkoshystruct hvm_hw_ia64_vtime {
90145256Sjkoshy    uint64_t itc;
91145256Sjkoshy    uint64_t itm;
92196446Sjkoshy
93145256Sjkoshy    uint64_t last_itc;
94145256Sjkoshy    uint64_t pending;
95145256Sjkoshy};
96145256SjkoshyDECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime);
97145256Sjkoshy/*
98196446Sjkoshy * calculate v->vtm.vtm_offset
99147586Sru * ??? Or should vtm_offset be set by leave_hypervisor_tail()?
100145256Sjkoshy * start vtm_timer if necessary by vtm_set_itm().
101145256Sjkoshy * ??? Or should vtm_timer be set by leave_hypervisor_tail()?
102147586Sru *
103145256Sjkoshy * ??? or should be done by schedule_tail()
104145256Sjkoshy *        => schedule_tail() should do.
105145256Sjkoshy */
106145256Sjkoshy
107145256Sjkoshy/*
108145256Sjkoshy * viosapic
109145256Sjkoshy */
110145256Sjkoshy#define VIOSAPIC_NUM_PINS     48
111145256Sjkoshy
112145256Sjkoshy/* To share VT-d code which uses vioapic_redir_entry.
113145256Sjkoshy * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry
114147586Sru * instead of viosapic_redir_entry.
115145256Sjkoshy */
116147586Sruunion vioapic_redir_entry
117145256Sjkoshy{
118147586Sru    uint64_t bits;
119145256Sjkoshy    struct {
120145256Sjkoshy        uint8_t vector;
121145256Sjkoshy
122145256Sjkoshy        uint8_t delivery_mode  : 3;
123145256Sjkoshy        uint8_t reserve1       : 1;
124183534Sjkoshy        uint8_t delivery_status: 1;
125145256Sjkoshy        uint8_t polarity       : 1;
126145256Sjkoshy        uint8_t reserve2       : 1;
127145256Sjkoshy        uint8_t trig_mode      : 1;
128183534Sjkoshy
129145256Sjkoshy        uint8_t mask           : 1;
130145256Sjkoshy        uint8_t reserve3       : 7;
131145256Sjkoshy
132183534Sjkoshy        uint8_t reserved[3];
133145256Sjkoshy        uint16_t dest_id;
134145256Sjkoshy    } fields;
135183534Sjkoshy};
136145256Sjkoshy
137145256Sjkoshystruct hvm_hw_ia64_viosapic {
138183534Sjkoshy    uint64_t    irr;
139145256Sjkoshy    uint64_t    isr;
140145256Sjkoshy    uint32_t    ioregsel;
141183534Sjkoshy    uint32_t    pad;
142145256Sjkoshy    uint64_t    lowest_vcpu_id;
143145256Sjkoshy    uint64_t    base_address;
144183534Sjkoshy    union vioapic_redir_entry  redirtbl[VIOSAPIC_NUM_PINS];
145145256Sjkoshy};
146145256SjkoshyDECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic);
147145256Sjkoshy
148183534Sjkoshy/*
149145256Sjkoshy * vacpi
150145256Sjkoshy * PM timer
151183534Sjkoshy */
152145256Sjkoshystruct vacpi_regs {
153145256Sjkoshy    union {
154183534Sjkoshy        struct {
155145256Sjkoshy            uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */
156145256Sjkoshy            uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */
157145256Sjkoshy        };
158183534Sjkoshy        uint32_t evt_blk;
159145256Sjkoshy    };
160145256Sjkoshy    uint32_t tmr_val;   /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */
161183534Sjkoshy};
162145256Sjkoshy
163145256Sjkoshystruct hvm_hw_ia64_vacpi {
164183534Sjkoshy    struct vacpi_regs   regs;
165145256Sjkoshy};
166145256SjkoshyDECLARE_HVM_SAVE_TYPE(VACPI, 7, struct hvm_hw_ia64_vacpi);
167183534Sjkoshy/* update last_gtime and setup timer of struct vacpi */
168145256Sjkoshy
169145256Sjkoshy/*
170183534Sjkoshy * opt_feature: identity mapping of region 4, 5 and 7.
171145256Sjkoshy * With the c/s 16396:d2935f9c217f of xen-ia64-devel.hg,
172145256Sjkoshy * opt_feature hypercall supports only region 4,5,7 identity mappings.
173183534Sjkoshy * structure hvm_hw_ia64_identity_mappings only supports them.
174145256Sjkoshy * The new structure, struct hvm_hw_ia64_identity_mappings, is created to
175145256Sjkoshy * avoid to keep up with change of the xen/ia64 internal structure, struct
176145256Sjkoshy * opt_feature.
177183534Sjkoshy *
178145256Sjkoshy * If it is enhanced in the future, new structure will be created.
179145256Sjkoshy */
180145256Sjkoshystruct hvm_hw_ia64_identity_mapping {
181183534Sjkoshy    uint64_t on;        /* on/off */
182145256Sjkoshy    uint64_t pgprot;    /* The page protection bit mask of the pte. */
183145256Sjkoshy    uint64_t key;       /* A protection key. */
184183534Sjkoshy};
185145256Sjkoshy
186145256Sjkoshystruct hvm_hw_ia64_identity_mappings {
187145256Sjkoshy    struct hvm_hw_ia64_identity_mapping im_reg4;/* Region 4 identity mapping */
188183534Sjkoshy    struct hvm_hw_ia64_identity_mapping im_reg5;/* Region 5 identity mapping */
189145256Sjkoshy    struct hvm_hw_ia64_identity_mapping im_reg7;/* Region 7 identity mapping */
190145256Sjkoshy};
191183534SjkoshyDECLARE_HVM_SAVE_TYPE(OPT_FEATURE_IDENTITY_MAPPINGS, 8, struct hvm_hw_ia64_identity_mappings);
192145256Sjkoshy
193145256Sjkoshy/*
194145256Sjkoshy * Largest type-code in use
195183534Sjkoshy */
196145256Sjkoshy#define HVM_SAVE_CODE_MAX       8
197145256Sjkoshy
198145256Sjkoshy#endif /* __XEN_PUBLIC_HVM_SAVE_IA64_H__ */
199183534Sjkoshy
200145256Sjkoshy/*
201145256Sjkoshy * Local variables:
202145256Sjkoshy * mode: C
203183534Sjkoshy * c-set-style: "BSD"
204145256Sjkoshy * c-basic-offset: 4
205145256Sjkoshy * tab-width: 4
206145256Sjkoshy * indent-tabs-mode: nil
207147586Sru * End:
208145256Sjkoshy */
209145256Sjkoshy