ia64/xen-unstable

view xen/include/xen/acpi.h @ 19800:78962f85c562

IOMMU: Add two generic functions to vendor neutral interface

Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 19 08:41:50 2009 +0100 (2009-06-19)
parents 89e50c449307
children aa472909b39c
line source
1 /*
2 * acpi.h - ACPI Interface
3 *
4 * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
5 *
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 */
25 #ifndef _LINUX_ACPI_H
26 #define _LINUX_ACPI_H
28 #ifndef _LINUX
29 #define _LINUX
30 #endif
32 #include <xen/list.h>
34 #include <acpi/acpi.h>
35 #include <acpi/acpi_bus.h>
36 #include <acpi/acpi_drivers.h>
37 #include <asm/acpi.h>
39 #ifdef CONFIG_ACPI_BOOT
41 enum acpi_irq_model_id {
42 ACPI_IRQ_MODEL_PIC = 0,
43 ACPI_IRQ_MODEL_IOAPIC,
44 ACPI_IRQ_MODEL_IOSAPIC,
45 ACPI_IRQ_MODEL_COUNT
46 };
48 extern enum acpi_irq_model_id acpi_irq_model;
50 enum acpi_madt_entry_id {
51 ACPI_MADT_LAPIC = 0,
52 ACPI_MADT_IOAPIC,
53 ACPI_MADT_INT_SRC_OVR,
54 ACPI_MADT_NMI_SRC,
55 ACPI_MADT_LAPIC_NMI,
56 ACPI_MADT_LAPIC_ADDR_OVR,
57 ACPI_MADT_IOSAPIC,
58 ACPI_MADT_LSAPIC,
59 ACPI_MADT_PLAT_INT_SRC,
60 ACPI_MADT_ENTRY_COUNT
61 };
63 typedef struct {
64 u16 polarity:2;
65 u16 trigger:2;
66 u16 reserved:12;
67 } __attribute__ ((packed)) acpi_interrupt_flags;
69 struct acpi_table_lapic {
70 struct acpi_subtable_header header;
71 u8 acpi_id;
72 u8 id;
73 struct {
74 u32 enabled:1;
75 u32 reserved:31;
76 } flags;
77 } __attribute__ ((packed));
79 struct acpi_table_ioapic {
80 struct acpi_subtable_header header;
81 u8 id;
82 u8 reserved;
83 u32 address;
84 u32 global_irq_base;
85 } __attribute__ ((packed));
87 struct acpi_table_int_src_ovr {
88 struct acpi_subtable_header header;
89 u8 bus;
90 u8 bus_irq;
91 u32 global_irq;
92 acpi_interrupt_flags flags;
93 } __attribute__ ((packed));
95 struct acpi_table_nmi_src {
96 struct acpi_subtable_header header;
97 acpi_interrupt_flags flags;
98 u32 global_irq;
99 } __attribute__ ((packed));
101 struct acpi_table_lapic_nmi {
102 struct acpi_subtable_header header;
103 u8 acpi_id;
104 acpi_interrupt_flags flags;
105 u8 lint;
106 } __attribute__ ((packed));
108 struct acpi_table_lapic_addr_ovr {
109 struct acpi_subtable_header header;
110 u8 reserved[2];
111 u64 address;
112 } __attribute__ ((packed));
114 struct acpi_table_iosapic {
115 struct acpi_subtable_header header;
116 u8 id;
117 u8 reserved;
118 u32 global_irq_base;
119 u64 address;
120 } __attribute__ ((packed));
122 struct acpi_table_lsapic {
123 struct acpi_subtable_header header;
124 u8 acpi_id;
125 u8 id;
126 u8 eid;
127 u8 reserved[3];
128 struct {
129 u32 enabled:1;
130 u32 reserved:31;
131 } flags;
132 } __attribute__ ((packed));
134 struct acpi_table_plat_int_src {
135 struct acpi_subtable_header header;
136 acpi_interrupt_flags flags;
137 u8 type; /* See acpi_interrupt_type */
138 u8 id;
139 u8 eid;
140 u8 iosapic_vector;
141 u32 global_irq;
142 u32 reserved;
143 } __attribute__ ((packed));
145 enum acpi_interrupt_id {
146 ACPI_INTERRUPT_PMI = 1,
147 ACPI_INTERRUPT_INIT,
148 ACPI_INTERRUPT_CPEI,
149 ACPI_INTERRUPT_COUNT
150 };
152 #define ACPI_SPACE_MEM 0
154 /*
155 * Simple Boot Flags
156 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
157 */
158 struct acpi_table_sbf
159 {
160 u8 sbf_signature[4];
161 u32 sbf_len;
162 u8 sbf_revision;
163 u8 sbf_csum;
164 u8 sbf_oemid[6];
165 u8 sbf_oemtable[8];
166 u8 sbf_revdata[4];
167 u8 sbf_creator[4];
168 u8 sbf_crearev[4];
169 u8 sbf_cmos;
170 u8 sbf_spare[3];
171 } __attribute__ ((packed));
173 enum acpi_srat_entry_id {
174 ACPI_SRAT_PROCESSOR_AFFINITY = 0,
175 ACPI_SRAT_MEMORY_AFFINITY,
176 ACPI_SRAT_ENTRY_COUNT
177 };
179 enum acpi_address_range_id {
180 ACPI_ADDRESS_RANGE_MEMORY = 1,
181 ACPI_ADDRESS_RANGE_RESERVED = 2,
182 ACPI_ADDRESS_RANGE_ACPI = 3,
183 ACPI_ADDRESS_RANGE_NVS = 4,
184 ACPI_ADDRESS_RANGE_COUNT
185 };
187 /* DMA Remapping Reporting Table (DMAR) */
189 #define DMAR_FLAGS_INTR_REMAP 0x1 /* intr remap supported */
191 struct acpi_dmar_entry_header {
192 u16 type;
193 u16 length;
194 } __attribute__((packed));
196 enum acpi_dmar_entry_type {
197 ACPI_DMAR_DRHD = 0,
198 ACPI_DMAR_RMRR,
199 ACPI_DMAR_ATSR,
200 ACPI_DMAR_ENTRY_COUNT
201 };
203 #define DRHD_FLAGS_INCLUDE_ALL 0x1 /* drhd remaps remaining devices */
204 struct acpi_table_drhd {
205 struct acpi_dmar_entry_header header;
206 u8 flags;
207 u8 reserved;
208 u16 segment;
209 u64 address; /* register base address for this drhd */
210 } __attribute__ ((packed));
212 struct acpi_table_rmrr {
213 struct acpi_dmar_entry_header header;
214 u16 reserved;
215 u16 segment;
216 u64 base_address;
217 u64 end_address;
218 } __attribute__ ((packed));
220 struct acpi_table_atsr {
221 struct acpi_dmar_entry_header header;
222 u8 flags;
223 u8 reserved;
224 u16 segment;
225 } __attribute__ ((packed));
227 enum acpi_dev_scope_type {
228 ACPI_DEV_ENDPOINT=0x01, /* PCI Endpoing device */
229 ACPI_DEV_P2PBRIDGE, /* PCI-PCI Bridge */
230 ACPI_DEV_IOAPIC, /* IOAPIC device*/
231 ACPI_DEV_MSI_HPET, /* MSI capable HPET*/
232 ACPI_DEV_ENTRY_COUNT
233 };
235 struct acpi_dev_scope {
236 u8 dev_type;
237 u8 length;
238 u8 reserved[2];
239 u8 enum_id;
240 u8 start_bus;
241 } __attribute__((packed));
243 struct acpi_pci_path {
244 u8 dev;
245 u8 fn;
246 } __attribute__((packed));
248 typedef int (*acpi_madt_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
250 typedef int (*acpi_table_handler) (struct acpi_table_header *table);
252 typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
254 unsigned int acpi_get_processor_id (unsigned int cpu);
255 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
256 int acpi_boot_init (void);
257 int acpi_boot_table_init (void);
258 int acpi_numa_init (void);
260 int acpi_table_init (void);
261 int acpi_table_parse(char *id, acpi_table_handler handler);
262 int acpi_table_parse_entries(char *id, unsigned long table_size,
263 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
264 int acpi_table_parse_madt(enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
265 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
266 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
267 void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
269 /* the following four functions are architecture-dependent */
270 void acpi_numa_slit_init (struct acpi_table_slit *slit);
271 void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
272 void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
273 void acpi_numa_arch_fixup(void);
275 #ifdef CONFIG_ACPI_HOTPLUG_CPU
276 /* Arch dependent functions for cpu hotplug support */
277 int acpi_map_lsapic(acpi_handle handle, int *pcpu);
278 int acpi_unmap_lsapic(int cpu);
279 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
281 extern int acpi_mp_config;
283 extern u32 pci_mmcfg_base_addr;
285 extern int sbf_port ;
287 #else /*!CONFIG_ACPI_BOOT*/
289 #define acpi_mp_config 0
291 static inline int acpi_boot_init(void)
292 {
293 return 0;
294 }
296 static inline int acpi_boot_table_init(void)
297 {
298 return 0;
299 }
301 #endif /*!CONFIG_ACPI_BOOT*/
303 unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
304 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
306 /*
307 * This function undoes the effect of one call to acpi_register_gsi().
308 * If this matches the last registration, any IRQ resources for gsi
309 * are freed.
310 */
311 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
312 void acpi_unregister_gsi (u32 gsi);
313 #endif
315 #ifdef CONFIG_ACPI_PCI
317 struct acpi_prt_entry {
318 struct list_head node;
319 struct acpi_pci_id id;
320 u8 pin;
321 struct {
322 acpi_handle handle;
323 u32 index;
324 } link;
325 u32 irq;
326 };
328 struct acpi_prt_list {
329 int count;
330 struct list_head entries;
331 };
333 extern struct acpi_prt_list acpi_prt;
335 struct pci_dev;
337 int acpi_pci_irq_enable (struct pci_dev *dev);
338 void acpi_penalize_isa_irq(int irq);
340 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
341 void acpi_pci_irq_disable (struct pci_dev *dev);
342 #endif
344 struct acpi_pci_driver {
345 struct acpi_pci_driver *next;
346 int (*add)(acpi_handle handle);
347 void (*remove)(acpi_handle handle);
348 };
350 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
351 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
353 #endif /*CONFIG_ACPI_PCI*/
355 #ifdef CONFIG_ACPI_EC
357 extern int ec_read(u8 addr, u8 *val);
358 extern int ec_write(u8 addr, u8 val);
360 #endif /*CONFIG_ACPI_EC*/
362 #ifdef CONFIG_ACPI_INTERPRETER
364 extern int acpi_blacklisted(void);
365 extern void acpi_bios_year(char *s);
367 #else /*!CONFIG_ACPI_INTERPRETER*/
369 static inline int acpi_blacklisted(void)
370 {
371 return 0;
372 }
374 #endif /*!CONFIG_ACPI_INTERPRETER*/
376 #ifdef CONFIG_ACPI_CSTATE
377 /*
378 * Set highest legal C-state
379 * 0: C0 okay, but not C1
380 * 1: C1 okay, but not C2
381 * 2: C2 okay, but not C3 etc.
382 */
384 extern unsigned int max_cstate;
386 static inline unsigned int acpi_get_cstate_limit(void)
387 {
388 return max_cstate;
389 }
390 static inline void acpi_set_cstate_limit(unsigned int new_limit)
391 {
392 max_cstate = new_limit;
393 return;
394 }
395 #else
396 static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
397 static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
398 #endif
400 #ifdef CONFIG_ACPI_NUMA
401 int acpi_get_pxm(acpi_handle handle);
402 #else
403 static inline int acpi_get_pxm(acpi_handle handle)
404 {
405 return 0;
406 }
407 #endif
409 extern int pnpacpi_disabled;
411 void acpi_reboot(void);
413 #endif /*_LINUX_ACPI_H*/