ia64/xen-unstable

view tools/ioemu/hw/ioapic.h @ 6432:b54144915ae6

merge?
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 25 16:26:30 2005 +0000 (2005-08-25)
parents 3428d58a85e1 6e899a3840b2
children 0610add7c3fe
line source
1 /////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2001 MandrakeSoft S.A.
4 //
5 // MandrakeSoft S.A.
6 // 43, rue d'Aboukir
7 // 75002 Paris - France
8 // http://www.linux-mandrake.com/
9 // http://www.mandrakesoft.com/
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Lesser General Public
13 // License as published by the Free Software Foundation; either
14 // version 2 of the License, or (at your option) any later version.
15 //
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public
22 // License along with this library; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 //
26 #ifndef __IOAPIC_H
27 #define __IOAPIC_H
29 #include "xenctrl.h"
30 #include <io/ioreq.h>
31 #include <io/vmx_vlapic.h>
33 #define IOAPIC_NUM_PINS 24
34 #define IOAPIC_VERSION_ID 0x11
35 #define IOAPIC_LEVEL_TRIGGER 1
36 #define APIC_DM_FIXED 0
37 #define APIC_DM_LOWPRI 1
41 #ifdef CONFIG_SMP
42 #define LOCK_PREFIX "lock ; "
43 #else
44 #define LOCK_PREFIX ""
45 #endif
47 #ifdef __I386__
48 #define __OS "q"
49 #define __OP "r"
50 #else
51 #define __OS "l" /* Operation Suffix */
52 #define __OP "e" /* Operand Prefix */
53 #endif
55 #define ADDR (*(volatile long *) addr)
56 #if 0
57 #endif
58 extern void *shared_page;
59 extern FILE *logfile;
60 #ifdef __BIGENDIAN__
61 typedef union RedirStatus
62 {
63 uint64_t value;
64 struct {
65 uint8_t dest_id;
66 uint8_t reserved[4];
67 uint8_t reserve:7;
68 uint8_t mask:1; /* interrupt mask*/
69 uint8_t trigmod:1;
70 uint8_t remoteirr:1;
71 uint8_t polarity:1;
72 uint8_t delivestatus:1;
73 uint8_t destmode:1;
74 uint8_t deliver_mode:3;
75 uint8_t vector;
76 }RedirForm;
77 }RedirStatus;
78 #else
79 typedef union RedirStatus
80 {
81 uint64_t value;
82 struct {
83 uint8_t vector;
84 uint8_t deliver_mode:3;
85 uint8_t destmode:1;
86 uint8_t delivestatus:1;
87 uint8_t polarity:1;
88 uint8_t remoteirr:1;
89 uint8_t trigmod:1;
90 uint8_t mask:1; /* interrupt mask*/
91 uint8_t reserve:7;
92 uint8_t reserved[4];
93 uint8_t dest_id;
94 }RedirForm;
95 }RedirStatus;
96 #endif
97 /*
98 * IOAPICState stands for a instance of a IOAPIC
99 */
101 /* FIXME tmp before working with Local APIC */
102 #define IOAPIC_MEM_LENGTH 0x100
103 #define IOAPIC_ENABLE_MASK 0x0
104 #define IOAPIC_ENABLE_FLAG (1 << IOAPIC_ENABLE_MASK)
105 #define MAX_LAPIC_NUM 32
107 struct IOAPICState{
108 uint32_t INTR;
109 uint32_t id;
110 uint32_t arb_id;
111 uint32_t flags;
112 unsigned long base_address;
113 uint32_t irr;
114 uint32_t isr; /* This is used for level trigger */
115 uint8_t vector_irr[256];
116 RedirStatus redirtbl[IOAPIC_NUM_PINS];
117 uint32_t ioregsel;
118 uint32_t lapic_count;
119 vlapic_info *lapic_info[MAX_LAPIC_NUM];
120 };
121 #define IOAPIC_REG_APIC_ID 0x0
122 #define IOAPIC_REG_VERSION 0x1
123 #define IOAPIC_REG_ARB_ID 0x2
124 #define IOAPICEnabled(s) (s->flags & IOAPIC_ENABLE_FLAG)
126 typedef struct IOAPICState IOAPICState;
128 #endif