ia64/xen-unstable

view xen/include/xen/acpi.h @ 19810:aa472909b39c

vtd: IO NUMA support

This patch adds VT-d RHSA processing for IO NUMA support. The basic
idea is to parse ACPI RHSA structure to obtain VT-d HW to proximity
domain mapping. This mapping is then used when allocating pages for
Vt-d HW data structures.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 23 11:14:24 2009 +0100 (2009-06-23)
parents 89e50c449307
children
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_RHSA,
201 ACPI_DMAR_ENTRY_COUNT
202 };
204 #define DRHD_FLAGS_INCLUDE_ALL 0x1 /* drhd remaps remaining devices */
205 struct acpi_table_drhd {
206 struct acpi_dmar_entry_header header;
207 u8 flags;
208 u8 reserved;
209 u16 segment;
210 u64 address; /* register base address for this drhd */
211 } __attribute__ ((packed));
213 struct acpi_table_rmrr {
214 struct acpi_dmar_entry_header header;
215 u16 reserved;
216 u16 segment;
217 u64 base_address;
218 u64 end_address;
219 } __attribute__ ((packed));
221 struct acpi_table_atsr {
222 struct acpi_dmar_entry_header header;
223 u8 flags;
224 u8 reserved;
225 u16 segment;
226 } __attribute__ ((packed));
228 struct acpi_table_rhsa {
229 struct acpi_dmar_entry_header header;
230 u32 domain;
231 u64 address; /* register base address for this drhd */
232 } __attribute__ ((packed));
234 enum acpi_dev_scope_type {
235 ACPI_DEV_ENDPOINT=0x01, /* PCI Endpoing device */
236 ACPI_DEV_P2PBRIDGE, /* PCI-PCI Bridge */
237 ACPI_DEV_IOAPIC, /* IOAPIC device*/
238 ACPI_DEV_MSI_HPET, /* MSI capable HPET*/
239 ACPI_DEV_ENTRY_COUNT
240 };
242 struct acpi_dev_scope {
243 u8 dev_type;
244 u8 length;
245 u8 reserved[2];
246 u8 enum_id;
247 u8 start_bus;
248 } __attribute__((packed));
250 struct acpi_pci_path {
251 u8 dev;
252 u8 fn;
253 } __attribute__((packed));
255 typedef int (*acpi_madt_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
257 typedef int (*acpi_table_handler) (struct acpi_table_header *table);
259 typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
261 unsigned int acpi_get_processor_id (unsigned int cpu);
262 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
263 int acpi_boot_init (void);
264 int acpi_boot_table_init (void);
265 int acpi_numa_init (void);
267 int acpi_table_init (void);
268 int acpi_table_parse(char *id, acpi_table_handler handler);
269 int acpi_table_parse_entries(char *id, unsigned long table_size,
270 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
271 int acpi_table_parse_madt(enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
272 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
273 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
274 void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
276 /* the following four functions are architecture-dependent */
277 void acpi_numa_slit_init (struct acpi_table_slit *slit);
278 void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
279 void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
280 void acpi_numa_arch_fixup(void);
282 #ifdef CONFIG_ACPI_HOTPLUG_CPU
283 /* Arch dependent functions for cpu hotplug support */
284 int acpi_map_lsapic(acpi_handle handle, int *pcpu);
285 int acpi_unmap_lsapic(int cpu);
286 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
288 extern int acpi_mp_config;
290 extern u32 pci_mmcfg_base_addr;
292 extern int sbf_port ;
294 #else /*!CONFIG_ACPI_BOOT*/
296 #define acpi_mp_config 0
298 static inline int acpi_boot_init(void)
299 {
300 return 0;
301 }
303 static inline int acpi_boot_table_init(void)
304 {
305 return 0;
306 }
308 #endif /*!CONFIG_ACPI_BOOT*/
310 unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
311 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
313 /*
314 * This function undoes the effect of one call to acpi_register_gsi().
315 * If this matches the last registration, any IRQ resources for gsi
316 * are freed.
317 */
318 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
319 void acpi_unregister_gsi (u32 gsi);
320 #endif
322 #ifdef CONFIG_ACPI_PCI
324 struct acpi_prt_entry {
325 struct list_head node;
326 struct acpi_pci_id id;
327 u8 pin;
328 struct {
329 acpi_handle handle;
330 u32 index;
331 } link;
332 u32 irq;
333 };
335 struct acpi_prt_list {
336 int count;
337 struct list_head entries;
338 };
340 extern struct acpi_prt_list acpi_prt;
342 struct pci_dev;
344 int acpi_pci_irq_enable (struct pci_dev *dev);
345 void acpi_penalize_isa_irq(int irq);
347 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
348 void acpi_pci_irq_disable (struct pci_dev *dev);
349 #endif
351 struct acpi_pci_driver {
352 struct acpi_pci_driver *next;
353 int (*add)(acpi_handle handle);
354 void (*remove)(acpi_handle handle);
355 };
357 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
358 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
360 #endif /*CONFIG_ACPI_PCI*/
362 #ifdef CONFIG_ACPI_EC
364 extern int ec_read(u8 addr, u8 *val);
365 extern int ec_write(u8 addr, u8 val);
367 #endif /*CONFIG_ACPI_EC*/
369 #ifdef CONFIG_ACPI_INTERPRETER
371 extern int acpi_blacklisted(void);
372 extern void acpi_bios_year(char *s);
374 #else /*!CONFIG_ACPI_INTERPRETER*/
376 static inline int acpi_blacklisted(void)
377 {
378 return 0;
379 }
381 #endif /*!CONFIG_ACPI_INTERPRETER*/
383 #ifdef CONFIG_ACPI_CSTATE
384 /*
385 * Set highest legal C-state
386 * 0: C0 okay, but not C1
387 * 1: C1 okay, but not C2
388 * 2: C2 okay, but not C3 etc.
389 */
391 extern unsigned int max_cstate;
393 static inline unsigned int acpi_get_cstate_limit(void)
394 {
395 return max_cstate;
396 }
397 static inline void acpi_set_cstate_limit(unsigned int new_limit)
398 {
399 max_cstate = new_limit;
400 return;
401 }
402 #else
403 static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
404 static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
405 #endif
407 #ifdef CONFIG_ACPI_NUMA
408 int acpi_get_pxm(acpi_handle handle);
409 #else
410 static inline int acpi_get_pxm(acpi_handle handle)
411 {
412 return 0;
413 }
414 #endif
416 extern int pnpacpi_disabled;
418 void acpi_reboot(void);
420 #endif /*_LINUX_ACPI_H*/