aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-ia64/vmx_platform.h
blob: 878961ef0413505e038e646342e3e2ea30fe3951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * vmx_platform.h: VMX platform support
 * Copyright (c) 2004, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307 USA.
 *
 */
#ifndef __ASM_IA64_VMX_PLATFORM_H__
#define __ASM_IA64_VMX_PLATFORM_H__

#include <public/xen.h>
#include <public/hvm/params.h>
#include <asm/hvm/vioapic.h>
struct mmio_list;
typedef struct virtual_platform_def {
    unsigned long          buffered_io_va;
    spinlock_t             buffered_io_lock;
    unsigned long       shared_page_va;
    unsigned long       pib_base;
    unsigned char       xtp;
    unsigned long       params[HVM_NR_PARAMS];
    struct mmio_list    *mmio;
    /* One IOSAPIC now... */
    struct vioapic      vioapic;
} vir_plat_t;

static inline int __fls(uint32_t word)
{
    long double d = word;
    long exp;

    __asm__ __volatile__ ("getf.exp %0=%1" : "=r"(exp) : "f"(d));
    return word ? (exp - 0xffff) : -1;
}

/* This is a connect structure between vIOSAPIC model and vLSAPIC model.
 * vlapic is required by vIOSAPIC model to manipulate pending bits, and
 * we just map them into vpd here
 */
typedef struct vlapic {
    struct vcpu	*vcpu;	/* Link to current vcpu */
} vlapic_t;

extern uint64_t dummy_tmr[];
#define VLAPIC_ID(l) (uint16_t)(((l)->vcpu->arch.privregs->lid) >> 16)
#define VLAPIC_IRR(l) ((l)->vcpu->arch.privregs->irr[0])
struct vlapic *apic_round_robin(struct domain *d, uint8_t vector, uint32_t bitmap);
extern int vmx_vlapic_set_irq(struct vcpu *v, uint8_t vec, uint8_t trig);
static inline int vlapic_set_irq(struct vlapic *t, uint8_t vec, uint8_t trig)
{
    return vmx_vlapic_set_irq(t->vcpu, vec, trig);
}

enum ioapic_irq_destination_types {
	dest_Fixed = 0,
	dest_LowestPrio = 1,
	dest_SMI = 2,
	dest__reserved_1 = 3,
	dest_NMI = 4,
	dest_INIT = 5,
	dest__reserved_2 = 6,
	dest_ExtINT = 7
};

#define vlapic_enabled(l) 1

#define VLAPIC_DELIV_MODE_FIXED		0x0
#define VLAPIC_DELIV_MODE_REDIR		0x1
#define VLAPIC_DELIV_MODE_LPRI		VLAPIC_DELIV_MODE_REDIR
#define VLAPIC_DELIV_MODE_PMI		0x2
#define VLAPIC_DELIV_MODE_SMI		0x2 /* For IA32 */
#define VLAPIC_DELIV_MODE_RESERVED	0x3
#define VLAPIC_DELIV_MODE_NMI		0x4
#define VLAPIC_DELIV_MODE_INIT		0x5
#define VLAPIC_DELIV_MODE_STARTUP	0x6 /* For IA32 */
#define VLAPIC_DELIV_MODE_EXT		0x7

#endif