ia64/xen-unstable

view xen/arch/ia64/xen/acpi.c @ 9768:63af1c14fa18

[IA64] missed chunk of Kevin's hypercall cleanup patch

Missed this chunk of Kevin's patch when merging with dom0vp changes

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Tue Apr 25 22:30:07 2006 -0600 (2006-04-25)
parents de2dc4e7966a
children 83e4d44e8aec
line source
1 /*
2 * acpi.c - Architecture-Specific Low-Level ACPI Support
3 *
4 * Copyright (C) 1999 VA Linux Systems
5 * Copyright (C) 1999,2000 Walt Drummond <drummond@valinux.com>
6 * Copyright (C) 2000, 2002-2003 Hewlett-Packard Co.
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Copyright (C) 2000 Intel Corp.
9 * Copyright (C) 2000,2001 J.I. Lee <jung-ik.lee@intel.com>
10 * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
11 * Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
12 * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
13 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
14 *
15 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 *
31 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 */
34 #include <linux/config.h>
35 #include <linux/module.h>
36 #include <linux/init.h>
37 #include <linux/kernel.h>
38 #include <linux/sched.h>
39 #include <linux/smp.h>
40 #include <linux/string.h>
41 #include <linux/types.h>
42 #include <linux/irq.h>
43 #include <linux/acpi.h>
44 #include <linux/efi.h>
45 #include <linux/mmzone.h>
46 #include <asm/io.h>
47 #include <asm/iosapic.h>
48 #include <asm/machvec.h>
49 #include <asm/page.h>
50 #include <asm/system.h>
51 #include <asm/numa.h>
52 #include <asm/sal.h>
53 //#include <asm/cyclone.h>
55 #define BAD_MADT_ENTRY(entry, end) ( \
56 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
57 ((acpi_table_entry_header *)entry)->length != sizeof(*entry))
59 #define PREFIX "ACPI: "
61 void (*pm_idle) (void);
62 EXPORT_SYMBOL(pm_idle);
63 void (*pm_power_off) (void);
65 unsigned char acpi_kbd_controller_present = 1;
66 unsigned char acpi_legacy_devices;
68 const char *
69 acpi_get_sysname (void)
70 {
71 /* #ifdef CONFIG_IA64_GENERIC */
72 unsigned long rsdp_phys;
73 struct acpi20_table_rsdp *rsdp;
74 struct acpi_table_xsdt *xsdt;
75 struct acpi_table_header *hdr;
77 rsdp_phys = acpi_find_rsdp();
78 if (!rsdp_phys) {
79 printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n");
80 return "dig";
81 }
83 rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
84 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
85 printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
86 return "dig";
87 }
89 xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
90 hdr = &xsdt->header;
91 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
92 printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
93 return "dig";
94 }
96 if (!strcmp(hdr->oem_id, "HP")) {
97 return "hpzx1";
98 }
99 else if (!strcmp(hdr->oem_id, "SGI")) {
100 return "sn2";
101 }
103 return "dig";
104 /*
105 #else
106 # if defined (CONFIG_IA64_HP_SIM)
107 return "hpsim";
108 # elif defined (CONFIG_IA64_HP_ZX1)
109 return "hpzx1";
110 # elif defined (CONFIG_IA64_SGI_SN2)
111 return "sn2";
112 # elif defined (CONFIG_IA64_DIG)
113 return "dig";
114 # else
115 # error Unknown platform. Fix acpi.c.
116 # endif
117 #endif
118 */
119 }
121 #ifdef CONFIG_ACPI_BOOT
123 #define ACPI_MAX_PLATFORM_INTERRUPTS 256
125 /* Array to record platform interrupt vectors for generic interrupt routing. */
126 int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
127 [0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
128 };
130 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
132 /*
133 * Interrupt routing API for device drivers. Provides interrupt vector for
134 * a generic platform event. Currently only CPEI is implemented.
135 */
136 int
137 acpi_request_vector (u32 int_type)
138 {
139 int vector = -1;
141 if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
142 /* corrected platform error interrupt */
143 vector = platform_intr_list[int_type];
144 } else
145 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
146 return vector;
147 }
149 char *
150 __acpi_map_table (unsigned long phys_addr, unsigned long size)
151 {
152 return __va(phys_addr);
153 }
155 /* --------------------------------------------------------------------------
156 Boot-time Table Parsing
157 -------------------------------------------------------------------------- */
159 static int total_cpus __initdata;
160 static int available_cpus __initdata;
161 struct acpi_table_madt * acpi_madt __initdata;
162 static u8 has_8259;
164 static int __init
165 acpi_parse_lapic_addr_ovr (
166 acpi_table_entry_header *header, const unsigned long end)
167 {
168 struct acpi_table_lapic_addr_ovr *lapic;
170 lapic = (struct acpi_table_lapic_addr_ovr *) header;
172 if (BAD_MADT_ENTRY(lapic, end))
173 return -EINVAL;
175 acpi_table_print_madt_entry(header);
177 if (lapic->address) {
178 iounmap((void *) ipi_base_addr);
179 ipi_base_addr = (void __iomem *) ioremap(lapic->address, 0);
180 }
181 return 0;
182 }
185 static int __init
186 acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
187 {
188 struct acpi_table_lsapic *lsapic;
190 lsapic = (struct acpi_table_lsapic *) header;
192 if (BAD_MADT_ENTRY(lsapic, end))
193 return -EINVAL;
195 acpi_table_print_madt_entry(header);
197 printk(KERN_INFO "CPU %d (0x%04x)", total_cpus, (lsapic->id << 8) | lsapic->eid);
199 if (!lsapic->flags.enabled)
200 printk(" disabled");
201 else {
202 printk(" enabled");
203 #ifdef CONFIG_SMP
204 if (available_cpus < NR_CPUS) {
205 smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
206 if (hard_smp_processor_id()
207 == (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
208 printk(" (BSP)");
209 ++available_cpus;
210 } else {
211 printk(" - however, ignored...");
212 }
213 #else
214 ++available_cpus;
215 #endif
216 }
218 printk("\n");
220 total_cpus++;
221 return 0;
222 }
225 static int __init
226 acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
227 {
228 struct acpi_table_lapic_nmi *lacpi_nmi;
230 lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
232 if (BAD_MADT_ENTRY(lacpi_nmi, end))
233 return -EINVAL;
235 acpi_table_print_madt_entry(header);
237 /* TBD: Support lapic_nmi entries */
238 return 0;
239 }
242 static int __init
243 acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
244 {
245 struct acpi_table_iosapic *iosapic;
247 iosapic = (struct acpi_table_iosapic *) header;
249 if (BAD_MADT_ENTRY(iosapic, end))
250 return -EINVAL;
252 acpi_table_print_madt_entry(header);
254 iosapic_init(iosapic->address, iosapic->global_irq_base);
256 return 0;
257 }
259 static int __init
260 acpi_parse_plat_int_src (
261 acpi_table_entry_header *header, const unsigned long end)
262 {
263 struct acpi_table_plat_int_src *plintsrc;
264 int vector;
266 plintsrc = (struct acpi_table_plat_int_src *) header;
268 if (BAD_MADT_ENTRY(plintsrc, end))
269 return -EINVAL;
271 acpi_table_print_madt_entry(header);
273 /*
274 * Get vector assignment for this interrupt, set attributes,
275 * and program the IOSAPIC routing table.
276 */
277 vector = iosapic_register_platform_intr(plintsrc->type,
278 plintsrc->global_irq,
279 plintsrc->iosapic_vector,
280 plintsrc->eid,
281 plintsrc->id,
282 (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
283 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
285 platform_intr_list[plintsrc->type] = vector;
286 return 0;
287 }
290 static int __init
291 acpi_parse_int_src_ovr (
292 acpi_table_entry_header *header, const unsigned long end)
293 {
294 struct acpi_table_int_src_ovr *p;
296 p = (struct acpi_table_int_src_ovr *) header;
298 if (BAD_MADT_ENTRY(p, end))
299 return -EINVAL;
301 acpi_table_print_madt_entry(header);
303 iosapic_override_isa_irq(p->bus_irq, p->global_irq,
304 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
305 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
306 return 0;
307 }
309 static int __init
310 acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
311 {
312 struct acpi_table_nmi_src *nmi_src;
314 nmi_src = (struct acpi_table_nmi_src*) header;
316 if (BAD_MADT_ENTRY(nmi_src, end))
317 return -EINVAL;
319 acpi_table_print_madt_entry(header);
321 /* TBD: Support nimsrc entries */
322 return 0;
323 }
324 /* Hook from generic ACPI tables.c */
325 void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
326 {
327 if (!strncmp(oem_id, "IBM", 3) &&
328 (!strncmp(oem_table_id, "SERMOW", 6))){
330 /* Unfortunatly ITC_DRIFT is not yet part of the
331 * official SAL spec, so the ITC_DRIFT bit is not
332 * set by the BIOS on this hardware.
333 */
334 sal_platform_features |= IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT;
336 #if 0
337 /*Start cyclone clock*/
338 cyclone_setup(0);
339 #endif
340 }
341 }
343 static int __init
344 acpi_parse_madt (unsigned long phys_addr, unsigned long size)
345 {
346 if (!phys_addr || !size)
347 return -EINVAL;
349 acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
351 /* remember the value for reference after free_initmem() */
352 #ifdef CONFIG_ITANIUM
353 has_8259 = 1; /* Firmware on old Itanium systems is broken */
354 #else
355 has_8259 = acpi_madt->flags.pcat_compat;
356 #endif
357 iosapic_system_init(has_8259);
359 /* Get base address of IPI Message Block */
361 if (acpi_madt->lapic_address)
362 ipi_base_addr = (void __iomem *) ioremap(acpi_madt->lapic_address, 0);
364 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
366 acpi_madt_oem_check(acpi_madt->header.oem_id,
367 acpi_madt->header.oem_table_id);
369 return 0;
370 }
372 #ifdef CONFIG_ACPI_NUMA
374 #undef SLIT_DEBUG
376 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
378 static int __initdata srat_num_cpus; /* number of cpus */
379 static u32 __initdata pxm_flag[PXM_FLAG_LEN];
380 #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
381 #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
382 /* maps to convert between proximity domain and logical node ID */
383 int __initdata pxm_to_nid_map[MAX_PXM_DOMAINS];
384 int __initdata nid_to_pxm_map[MAX_NUMNODES];
385 static struct acpi_table_slit __initdata *slit_table;
387 /*
388 * ACPI 2.0 SLIT (System Locality Information Table)
389 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
390 */
391 void __init
392 acpi_numa_slit_init (struct acpi_table_slit *slit)
393 {
394 u32 len;
396 len = sizeof(struct acpi_table_header) + 8
397 + slit->localities * slit->localities;
398 if (slit->header.length != len) {
399 printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
400 len, slit->header.length);
401 memset(numa_slit, 10, sizeof(numa_slit));
402 return;
403 }
404 slit_table = slit;
405 }
407 void __init
408 acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
409 {
410 /* record this node in proximity bitmap */
411 pxm_bit_set(pa->proximity_domain);
413 node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid);
414 /* nid should be overridden as logical node id later */
415 node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
416 srat_num_cpus++;
417 }
419 void __init
420 acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
421 {
422 unsigned long paddr, size;
423 u8 pxm;
424 struct node_memblk_s *p, *q, *pend;
426 pxm = ma->proximity_domain;
428 /* fill node memory chunk structure */
429 paddr = ma->base_addr_hi;
430 paddr = (paddr << 32) | ma->base_addr_lo;
431 size = ma->length_hi;
432 size = (size << 32) | ma->length_lo;
434 /* Ignore disabled entries */
435 if (!ma->flags.enabled)
436 return;
438 /* record this node in proximity bitmap */
439 pxm_bit_set(pxm);
441 /* Insertion sort based on base address */
442 pend = &node_memblk[num_node_memblks];
443 for (p = &node_memblk[0]; p < pend; p++) {
444 if (paddr < p->start_paddr)
445 break;
446 }
447 if (p < pend) {
448 for (q = pend - 1; q >= p; q--)
449 *(q + 1) = *q;
450 }
451 p->start_paddr = paddr;
452 p->size = size;
453 p->nid = pxm;
454 num_node_memblks++;
455 }
457 void __init
458 acpi_numa_arch_fixup (void)
459 {
460 int i, j, node_from, node_to;
462 /* If there's no SRAT, fix the phys_id */
463 if (srat_num_cpus == 0) {
464 node_cpuid[0].phys_id = hard_smp_processor_id();
465 return;
466 }
468 /* calculate total number of nodes in system from PXM bitmap */
469 numnodes = 0; /* init total nodes in system */
471 memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
472 memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
473 for (i = 0; i < MAX_PXM_DOMAINS; i++) {
474 if (pxm_bit_test(i)) {
475 pxm_to_nid_map[i] = numnodes;
476 node_set_online(numnodes);
477 nid_to_pxm_map[numnodes++] = i;
478 }
479 }
481 /* set logical node id in memory chunk structure */
482 for (i = 0; i < num_node_memblks; i++)
483 node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
485 /* assign memory bank numbers for each chunk on each node */
486 for (i = 0; i < numnodes; i++) {
487 int bank;
489 bank = 0;
490 for (j = 0; j < num_node_memblks; j++)
491 if (node_memblk[j].nid == i)
492 node_memblk[j].bank = bank++;
493 }
495 /* set logical node id in cpu structure */
496 for (i = 0; i < srat_num_cpus; i++)
497 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
499 printk(KERN_INFO "Number of logical nodes in system = %d\n", numnodes);
500 printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
502 if (!slit_table) return;
503 memset(numa_slit, -1, sizeof(numa_slit));
504 for (i=0; i<slit_table->localities; i++) {
505 if (!pxm_bit_test(i))
506 continue;
507 node_from = pxm_to_nid_map[i];
508 for (j=0; j<slit_table->localities; j++) {
509 if (!pxm_bit_test(j))
510 continue;
511 node_to = pxm_to_nid_map[j];
512 node_distance(node_from, node_to) =
513 slit_table->entry[i*slit_table->localities + j];
514 }
515 }
517 #ifdef SLIT_DEBUG
518 printk("ACPI 2.0 SLIT locality table:\n");
519 for (i = 0; i < numnodes; i++) {
520 for (j = 0; j < numnodes; j++)
521 printk("%03d ", node_distance(i,j));
522 printk("\n");
523 }
524 #endif
525 }
526 #endif /* CONFIG_ACPI_NUMA */
528 #if 0
529 unsigned int
530 acpi_register_gsi (u32 gsi, int polarity, int trigger)
531 {
532 return acpi_register_irq(gsi, polarity, trigger);
533 }
534 EXPORT_SYMBOL(acpi_register_gsi);
535 #endif
536 static int __init
537 acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
538 {
539 struct acpi_table_header *fadt_header;
540 struct fadt_descriptor_rev2 *fadt;
542 if (!phys_addr || !size)
543 return -EINVAL;
545 fadt_header = (struct acpi_table_header *) __va(phys_addr);
546 if (fadt_header->revision != 3)
547 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
549 fadt = (struct fadt_descriptor_rev2 *) fadt_header;
551 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
552 acpi_kbd_controller_present = 0;
554 if (fadt->iapc_boot_arch & BAF_LEGACY_DEVICES)
555 acpi_legacy_devices = 1;
557 #if 0
558 acpi_register_gsi(fadt->sci_int, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
559 #endif
560 return 0;
561 }
563 unsigned long __init
564 acpi_find_rsdp (void)
565 {
566 unsigned long rsdp_phys = 0;
568 if (efi.acpi20)
569 rsdp_phys = __pa(efi.acpi20);
570 else if (efi.acpi)
571 printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n");
572 return rsdp_phys;
573 }
575 int __init
576 acpi_boot_init (void)
577 {
579 /*
580 * MADT
581 * ----
582 * Parse the Multiple APIC Description Table (MADT), if exists.
583 * Note that this table provides platform SMP configuration
584 * information -- the successor to MPS tables.
585 */
587 if (acpi_table_parse(ACPI_APIC, acpi_parse_madt) < 1) {
588 printk(KERN_ERR PREFIX "Can't find MADT\n");
589 goto skip_madt;
590 }
592 /* Local APIC */
594 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
595 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
597 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
598 printk(KERN_ERR PREFIX "Error parsing MADT - no LSAPIC entries\n");
600 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
601 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
603 /* I/O APIC */
605 if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
606 printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
608 /* System-Level Interrupt Routing */
610 if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
611 printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
613 if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
614 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
616 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
617 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
618 skip_madt:
620 /*
621 * FADT says whether a legacy keyboard controller is present.
622 * The FADT also contains an SCI_INT line, by which the system
623 * gets interrupts such as power and sleep buttons. If it's not
624 * on a Legacy interrupt, it needs to be setup.
625 */
626 if (acpi_table_parse(ACPI_FADT, acpi_parse_fadt) < 1)
627 printk(KERN_ERR PREFIX "Can't find FADT\n");
629 #ifdef CONFIG_SMP
630 if (available_cpus == 0) {
631 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
632 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
633 smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
634 available_cpus = 1; /* We've got at least one of these, no? */
635 }
636 smp_boot_data.cpu_count = available_cpus;
638 smp_build_cpu_map();
639 # ifdef CONFIG_ACPI_NUMA
640 if (srat_num_cpus == 0) {
641 int cpu, i = 1;
642 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
643 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
644 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
645 }
646 build_cpu_to_node_map();
647 # endif
648 #endif
649 /* Make boot-up look pretty */
650 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
651 return 0;
652 }
653 #if 0
654 int
655 acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
656 {
657 int vector;
659 if (has_8259 && gsi < 16)
660 *irq = isa_irq_to_vector(gsi);
661 else {
662 vector = gsi_to_vector(gsi);
663 if (vector == -1)
664 return -1;
666 *irq = vector;
667 }
668 return 0;
669 }
671 int
672 acpi_register_irq (u32 gsi, u32 polarity, u32 trigger)
673 {
674 if (has_8259 && gsi < 16)
675 return isa_irq_to_vector(gsi);
677 return iosapic_register_intr(gsi,
678 (polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
679 (trigger == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
680 }
681 EXPORT_SYMBOL(acpi_register_irq);
682 #endif
683 #endif /* CONFIG_ACPI_BOOT */