source: trunk/packages/xen-3.1/xen-3.1/xen/include/asm-x86/hvm/irq.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 3.9 KB
Line 
1/******************************************************************************
2 * irq.h
3 *
4 * Interrupt distribution and delivery logic.
5 *
6 * Copyright (c) 2006, K A Fraser, XenSource Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place - Suite 330, Boston, MA 02111-1307 USA.
20 */
21
22#ifndef __ASM_X86_HVM_IRQ_H__
23#define __ASM_X86_HVM_IRQ_H__
24
25#include <xen/types.h>
26#include <xen/spinlock.h>
27#include <asm/hvm/vpic.h>
28#include <asm/hvm/vioapic.h>
29#include <public/hvm/save.h>
30
31
32struct hvm_irq {
33    /*
34     * Virtual interrupt wires for a single PCI bus.
35     * Indexed by: device*4 + INTx#.
36     */
37    struct hvm_hw_pci_irqs pci_intx;
38
39    /*
40     * Virtual interrupt wires for ISA devices.
41     * Indexed by ISA IRQ (assumes no ISA-device IRQ sharing).
42     */
43    struct hvm_hw_isa_irqs isa_irq;
44
45    /*
46     * PCI-ISA interrupt router.
47     * Each PCI <device:INTx#> is 'wire-ORed' into one of four links using
48     * the traditional 'barber's pole' mapping ((device + INTx#) & 3).
49     * The router provides a programmable mapping from each link to a GSI.
50     */
51    struct hvm_hw_pci_link pci_link;
52
53    /* Virtual interrupt and via-link for paravirtual platform driver. */
54    uint32_t callback_via_asserted;
55    union {
56        enum {
57            HVMIRQ_callback_none,
58            HVMIRQ_callback_gsi,
59            HVMIRQ_callback_pci_intx
60        } callback_via_type;
61        uint32_t pad; /* So the next field will be aligned */
62    };
63    union {
64        uint32_t gsi;
65        struct { uint8_t dev, intx; } pci;
66    } callback_via;
67
68    /* Number of INTx wires asserting each PCI-ISA link. */
69    u8 pci_link_assert_count[4];
70
71    /*
72     * Number of wires asserting each GSI.
73     *
74     * GSIs 0-15 are the ISA IRQs. ISA devices map directly into this space
75     * except ISA IRQ 0, which is connected to GSI 2.
76     * PCI links map into this space via the PCI-ISA bridge.
77     *
78     * GSIs 16+ are used only be PCI devices. The mapping from PCI device to
79     * GSI is as follows: ((device*4 + device/8 + INTx#) & 31) + 16
80     */
81    u8 gsi_assert_count[VIOAPIC_NUM_PINS];
82
83    /*
84     * GSIs map onto PIC/IO-APIC in the usual way:
85     *  0-7:  Master 8259 PIC, IO-APIC pins 0-7
86     *  8-15: Slave  8259 PIC, IO-APIC pins 8-15
87     *  16+ : IO-APIC pins 16+
88     */
89
90    /* Last VCPU that was delivered a LowestPrio interrupt. */
91    u8 round_robin_prev_vcpu;
92};
93
94#define hvm_pci_intx_gsi(dev, intx)  \
95    (((((dev)<<2) + ((dev)>>3) + (intx)) & 31) + 16)
96#define hvm_pci_intx_link(dev, intx) \
97    (((dev) + (intx)) & 3)
98
99#define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2)
100
101/* Modify state of a PCI INTx wire. */
102void hvm_pci_intx_assert(
103    struct domain *d, unsigned int device, unsigned int intx);
104void hvm_pci_intx_deassert(
105    struct domain *d, unsigned int device, unsigned int intx);
106
107/* Modify state of an ISA device's IRQ wire. */
108void hvm_isa_irq_assert(
109    struct domain *d, unsigned int isa_irq);
110void hvm_isa_irq_deassert(
111    struct domain *d, unsigned int isa_irq);
112
113void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq);
114
115void hvm_set_callback_irq_level(void);
116void hvm_set_callback_via(struct domain *d, uint64_t via);
117
118int cpu_get_interrupt(struct vcpu *v, int *type);
119int cpu_has_pending_irq(struct vcpu *v);
120int get_isa_irq_vector(struct vcpu *vcpu, int irq, int type);
121int is_isa_irq_masked(struct vcpu *v, int isa_irq);
122
123#endif /* __ASM_X86_HVM_IRQ_H__ */
Note: See TracBrowser for help on using the repository browser.