ia64/xen-unstable

view xen/arch/ia64/xen/acpi.c @ 16785:af3550f53874

[IA64] domheap: Don't pin xenheap down. Now it's unnecessary.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu Jan 17 12:05:43 2008 -0700 (2008-01-17)
parents f5d22922444d
children 13cba2e78a65
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/hw_irq.h>
54 #ifdef XEN
55 #include <xen/errno.h>
56 #include <xen/nodemask.h>
57 #endif
59 #define BAD_MADT_ENTRY(entry, end) ( \
60 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
61 ((acpi_table_entry_header *)entry)->length != sizeof(*entry))
63 #define PREFIX "ACPI: "
65 void (*pm_idle) (void);
66 EXPORT_SYMBOL(pm_idle);
67 void (*pm_power_off) (void);
69 unsigned char acpi_kbd_controller_present = 1;
70 unsigned char acpi_legacy_devices;
72 const char *
73 acpi_get_sysname (void)
74 {
75 /* #ifdef CONFIG_IA64_GENERIC */
76 unsigned long rsdp_phys;
77 struct acpi20_table_rsdp *rsdp;
78 struct acpi_table_xsdt *xsdt;
79 struct acpi_table_header *hdr;
81 rsdp_phys = acpi_find_rsdp();
82 if (!rsdp_phys) {
83 printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n");
84 return "dig";
85 }
87 rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
88 if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
89 printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
90 return "dig";
91 }
93 xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
94 hdr = &xsdt->header;
95 if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
96 printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
97 return "dig";
98 }
100 if (!strcmp(hdr->oem_id, "HP")) {
101 return "hpzx1";
102 }
103 else if (!strcmp(hdr->oem_id, "SGI")) {
104 return "sn2";
105 }
107 return "dig";
108 /*
109 #else
110 # if defined (CONFIG_IA64_HP_SIM)
111 return "hpsim";
112 # elif defined (CONFIG_IA64_HP_ZX1)
113 return "hpzx1";
114 # elif defined (CONFIG_IA64_SGI_SN2)
115 return "sn2";
116 # elif defined (CONFIG_IA64_DIG)
117 return "dig";
118 # else
119 # error Unknown platform. Fix acpi.c.
120 # endif
121 #endif
122 */
123 }
125 #ifdef CONFIG_ACPI_BOOT
127 #define ACPI_MAX_PLATFORM_INTERRUPTS 256
129 /* Array to record platform interrupt vectors for generic interrupt routing. */
130 int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
131 [0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
132 };
134 enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
136 /*
137 * Interrupt routing API for device drivers. Provides interrupt vector for
138 * a generic platform event. Currently only CPEI is implemented.
139 */
140 int
141 acpi_request_vector (u32 int_type)
142 {
143 int vector = -1;
145 if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
146 /* corrected platform error interrupt */
147 vector = platform_intr_list[int_type];
148 } else
149 printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
150 return vector;
151 }
153 char *
154 __acpi_map_table (unsigned long phys_addr, unsigned long size)
155 {
156 return __va(phys_addr);
157 }
159 /* --------------------------------------------------------------------------
160 Boot-time Table Parsing
161 -------------------------------------------------------------------------- */
163 static int total_cpus __initdata;
164 static int available_cpus __initdata;
165 struct acpi_table_madt * acpi_madt __initdata;
166 static u8 has_8259;
168 static int __init
169 acpi_parse_lapic_addr_ovr (
170 acpi_table_entry_header *header, const unsigned long end)
171 {
172 struct acpi_table_lapic_addr_ovr *lapic;
174 lapic = (struct acpi_table_lapic_addr_ovr *) header;
176 if (BAD_MADT_ENTRY(lapic, end))
177 return -EINVAL;
179 acpi_table_print_madt_entry(header);
181 if (lapic->address) {
182 iounmap((void *) ipi_base_addr);
183 ipi_base_addr = (void __iomem *) ioremap(lapic->address, 0);
184 }
185 return 0;
186 }
189 static int __init
190 acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
191 {
192 struct acpi_table_lsapic *lsapic;
194 lsapic = (struct acpi_table_lsapic *) header;
196 if (BAD_MADT_ENTRY(lsapic, end))
197 return -EINVAL;
199 acpi_table_print_madt_entry(header);
201 printk(KERN_INFO "CPU %d (0x%04x)", total_cpus, (lsapic->id << 8) | lsapic->eid);
203 if (!lsapic->flags.enabled)
204 printk(" disabled");
205 else {
206 printk(" enabled");
207 #ifdef CONFIG_SMP
208 if (available_cpus < NR_CPUS) {
209 smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
210 if (hard_smp_processor_id()
211 == (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
212 printk(" (BSP)");
213 ++available_cpus;
214 } else {
215 printk(" - however, ignored...");
216 }
217 #else
218 ++available_cpus;
219 #endif
220 }
222 printk("\n");
224 total_cpus++;
225 return 0;
226 }
229 static int __init
230 acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
231 {
232 struct acpi_table_lapic_nmi *lacpi_nmi;
234 lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
236 if (BAD_MADT_ENTRY(lacpi_nmi, end))
237 return -EINVAL;
239 acpi_table_print_madt_entry(header);
241 /* TBD: Support lapic_nmi entries */
242 return 0;
243 }
246 static int __init
247 acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
248 {
249 struct acpi_table_iosapic *iosapic;
251 iosapic = (struct acpi_table_iosapic *) header;
253 if (BAD_MADT_ENTRY(iosapic, end))
254 return -EINVAL;
256 acpi_table_print_madt_entry(header);
258 iosapic_init(iosapic->address, iosapic->global_irq_base);
260 return 0;
261 }
263 static int __init
264 acpi_parse_plat_int_src (
265 acpi_table_entry_header *header, const unsigned long end)
266 {
267 struct acpi_table_plat_int_src *plintsrc;
268 int vector;
270 plintsrc = (struct acpi_table_plat_int_src *) header;
272 if (BAD_MADT_ENTRY(plintsrc, end))
273 return -EINVAL;
275 acpi_table_print_madt_entry(header);
277 /*
278 * Get vector assignment for this interrupt, set attributes,
279 * and program the IOSAPIC routing table.
280 */
281 vector = iosapic_register_platform_intr(plintsrc->type,
282 plintsrc->global_irq,
283 plintsrc->iosapic_vector,
284 plintsrc->eid,
285 plintsrc->id,
286 (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
287 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
289 platform_intr_list[plintsrc->type] = vector;
290 return 0;
291 }
294 static int __init
295 acpi_parse_int_src_ovr (
296 acpi_table_entry_header *header, const unsigned long end)
297 {
298 struct acpi_table_int_src_ovr *p;
300 p = (struct acpi_table_int_src_ovr *) header;
302 if (BAD_MADT_ENTRY(p, end))
303 return -EINVAL;
305 acpi_table_print_madt_entry(header);
307 iosapic_override_isa_irq(p->bus_irq, p->global_irq,
308 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
309 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
310 return 0;
311 }
313 static int __init
314 acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
315 {
316 struct acpi_table_nmi_src *nmi_src;
318 nmi_src = (struct acpi_table_nmi_src*) header;
320 if (BAD_MADT_ENTRY(nmi_src, end))
321 return -EINVAL;
323 acpi_table_print_madt_entry(header);
325 /* TBD: Support nimsrc entries */
326 return 0;
327 }
328 /* Hook from generic ACPI tables.c */
329 void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
330 {
331 if (!strncmp(oem_id, "IBM", 3) &&
332 (!strncmp(oem_table_id, "SERMOW", 6))){
334 /* Unfortunatly ITC_DRIFT is not yet part of the
335 * official SAL spec, so the ITC_DRIFT bit is not
336 * set by the BIOS on this hardware.
337 */
338 sal_platform_features |= IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT;
340 #if 0
341 /*Start cyclone clock*/
342 cyclone_setup(0);
343 #endif
344 }
345 }
347 static int __init
348 acpi_parse_madt (unsigned long phys_addr, unsigned long size)
349 {
350 if (!phys_addr || !size)
351 return -EINVAL;
353 acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
355 /* remember the value for reference after free_initmem() */
356 #ifdef CONFIG_ITANIUM
357 has_8259 = 1; /* Firmware on old Itanium systems is broken */
358 #else
359 has_8259 = acpi_madt->flags.pcat_compat;
360 #endif
361 iosapic_system_init(has_8259);
363 /* Get base address of IPI Message Block */
365 if (acpi_madt->lapic_address)
366 ipi_base_addr = (void __iomem *) ioremap(acpi_madt->lapic_address, 0);
368 printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
370 acpi_madt_oem_check(acpi_madt->header.oem_id,
371 acpi_madt->header.oem_table_id);
373 return 0;
374 }
376 #ifdef CONFIG_ACPI_NUMA
378 #undef SLIT_DEBUG
380 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
382 static int __initdata srat_num_cpus; /* number of cpus */
383 static u32 __initdata pxm_flag[PXM_FLAG_LEN];
384 #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
385 #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
386 /* maps to convert between proximity domain and logical node ID */
387 int __initdata pxm_to_nid_map[MAX_PXM_DOMAINS];
388 int __initdata nid_to_pxm_map[MAX_NUMNODES];
389 static struct acpi_table_slit __initdata *slit_table;
391 #define NID_INVAL -1
392 #define PXM_INVAL -1
394 int __init pxm_to_node(int pxm)
395 {
396 if (pxm < 0)
397 return NID_INVAL;
398 return pxm_to_nid_map[pxm];
399 }
401 int __init node_to_pxm(int node)
402 {
403 if (node < 0)
404 return PXM_INVAL;
405 return nid_to_pxm_map[node];
406 }
409 /*
410 * ACPI 2.0 SLIT (System Locality Information Table)
411 * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
412 */
413 void __init
414 acpi_numa_slit_init (struct acpi_table_slit *slit)
415 {
416 u32 len;
418 len = sizeof(struct acpi_table_header) + 8
419 + slit->localities * slit->localities;
420 if (slit->header.length != len) {
421 printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
422 len, slit->header.length);
423 memset(numa_slit, 10, sizeof(numa_slit));
424 return;
425 }
426 slit_table = slit;
427 }
429 void __init
430 acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
431 {
432 /* record this node in proximity bitmap */
433 pxm_bit_set(pa->proximity_domain);
435 node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid);
436 /* nid should be overridden as logical node id later */
437 node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
438 srat_num_cpus++;
439 }
441 void __init
442 acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
443 {
444 unsigned long paddr, size;
445 u8 pxm;
446 struct node_memblk_s *p, *q, *pend;
448 pxm = ma->proximity_domain;
450 /* fill node memory chunk structure */
451 paddr = ma->base_addr_hi;
452 paddr = (paddr << 32) | ma->base_addr_lo;
453 size = ma->length_hi;
454 size = (size << 32) | ma->length_lo;
456 /* Ignore disabled entries */
457 if (!ma->flags.enabled)
458 return;
460 /* record this node in proximity bitmap */
461 pxm_bit_set(pxm);
463 /* Insertion sort based on base address */
464 pend = &node_memblk[num_node_memblks];
465 for (p = &node_memblk[0]; p < pend; p++) {
466 if (paddr < p->start_paddr)
467 break;
468 }
469 if (p < pend) {
470 for (q = pend - 1; q >= p; q--)
471 *(q + 1) = *q;
472 }
473 p->start_paddr = paddr;
474 p->size = size;
475 p->nid = pxm;
476 num_node_memblks++;
477 }
479 static unsigned int numnodes;
480 void __init
481 acpi_numa_arch_fixup (void)
482 {
483 int i, j, node_from, node_to;
485 /* If there's no SRAT, fix the phys_id */
486 if (srat_num_cpus == 0) {
487 node_cpuid[0].phys_id = hard_smp_processor_id();
488 return;
489 }
491 /* calculate total number of nodes in system from PXM bitmap */
492 numnodes = 0; /* init total nodes in system */
494 memset(pxm_to_nid_map, PXM_INVAL, sizeof(pxm_to_nid_map));
495 memset(nid_to_pxm_map, NID_INVAL, sizeof(nid_to_pxm_map));
496 for (i = 0; i < MAX_PXM_DOMAINS; i++) {
497 if (pxm_bit_test(i)) {
498 pxm_to_nid_map[i] = numnodes;
499 node_set_online(numnodes);
500 nid_to_pxm_map[numnodes++] = i;
501 }
502 }
504 /* set logical node id in memory chunk structure */
505 for (i = 0; i < num_node_memblks; i++)
506 node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
508 /* assign memory bank numbers for each chunk on each node */
509 for (i = 0; i < numnodes; i++) {
510 int bank;
512 bank = 0;
513 for (j = 0; j < num_node_memblks; j++)
514 if (node_memblk[j].nid == i)
515 node_memblk[j].bank = bank++;
516 }
518 /* set logical node id in cpu structure */
519 for (i = 0; i < srat_num_cpus; i++)
520 node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
522 printk(KERN_INFO "Number of logical nodes in system = %d\n", numnodes);
523 printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
525 if (!slit_table) return;
526 memset(numa_slit, -1, sizeof(numa_slit));
527 for (i=0; i<slit_table->localities; i++) {
528 if (!pxm_bit_test(i))
529 continue;
530 node_from = pxm_to_nid_map[i];
531 for (j=0; j<slit_table->localities; j++) {
532 if (!pxm_bit_test(j))
533 continue;
534 node_to = pxm_to_nid_map[j];
535 node_distance(node_from, node_to) =
536 slit_table->entry[i*slit_table->localities + j];
537 }
538 }
540 #ifdef SLIT_DEBUG
541 printk("ACPI 2.0 SLIT locality table:\n");
542 for (i = 0; i < numnodes; i++) {
543 for (j = 0; j < numnodes; j++)
544 printk("%03d ", node_distance(i,j));
545 printk("\n");
546 }
547 #endif
548 }
549 #endif /* CONFIG_ACPI_NUMA */
551 #if 0
552 unsigned int
553 acpi_register_gsi (u32 gsi, int polarity, int trigger)
554 {
555 return acpi_register_irq(gsi, polarity, trigger);
556 }
557 EXPORT_SYMBOL(acpi_register_gsi);
558 #endif
559 static int __init
560 acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
561 {
562 struct acpi_table_header *fadt_header;
563 struct fadt_descriptor_rev2 *fadt;
565 if (!phys_addr || !size)
566 return -EINVAL;
568 fadt_header = (struct acpi_table_header *) __va(phys_addr);
569 if (fadt_header->revision != 3)
570 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
572 fadt = (struct fadt_descriptor_rev2 *) fadt_header;
574 if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
575 acpi_kbd_controller_present = 0;
577 if (fadt->iapc_boot_arch & BAF_LEGACY_DEVICES)
578 acpi_legacy_devices = 1;
580 #if 0
581 acpi_register_gsi(fadt->sci_int, ACPI_ACTIVE_LOW, ACPI_LEVEL_SENSITIVE);
582 #endif
583 return 0;
584 }
586 unsigned long __init
587 acpi_find_rsdp (void)
588 {
589 unsigned long rsdp_phys = 0;
591 if (efi.acpi20)
592 rsdp_phys = __pa(efi.acpi20);
593 else if (efi.acpi)
594 printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n");
595 return rsdp_phys;
596 }
598 int __init
599 acpi_boot_init (void)
600 {
602 /*
603 * MADT
604 * ----
605 * Parse the Multiple APIC Description Table (MADT), if exists.
606 * Note that this table provides platform SMP configuration
607 * information -- the successor to MPS tables.
608 */
610 if (acpi_table_parse(ACPI_APIC, acpi_parse_madt) < 1) {
611 printk(KERN_ERR PREFIX "Can't find MADT\n");
612 goto skip_madt;
613 }
615 /* Local APIC */
617 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
618 printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
620 if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
621 printk(KERN_ERR PREFIX "Error parsing MADT - no LSAPIC entries\n");
623 if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
624 printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
626 /* I/O APIC */
628 if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
629 printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
631 /* System-Level Interrupt Routing */
633 if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
634 printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
636 if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
637 printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
639 if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
640 printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
641 skip_madt:
643 /*
644 * FADT says whether a legacy keyboard controller is present.
645 * The FADT also contains an SCI_INT line, by which the system
646 * gets interrupts such as power and sleep buttons. If it's not
647 * on a Legacy interrupt, it needs to be setup.
648 */
649 if (acpi_table_parse(ACPI_FADT, acpi_parse_fadt) < 1)
650 printk(KERN_ERR PREFIX "Can't find FADT\n");
652 #ifdef CONFIG_SMP
653 if (available_cpus == 0) {
654 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
655 printk(KERN_INFO "CPU 0 (0x%04x)\n", hard_smp_processor_id());
656 smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
657 available_cpus = 1; /* We've got at least one of these, no? */
658 }
659 smp_boot_data.cpu_count = available_cpus;
661 smp_build_cpu_map();
662 # ifdef CONFIG_ACPI_NUMA
663 if (srat_num_cpus == 0) {
664 int cpu, i = 1;
665 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
666 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
667 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
668 }
669 build_cpu_to_node_map();
670 # endif
671 #endif
672 /* Make boot-up look pretty */
673 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
674 return 0;
675 }
677 int
678 acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
679 {
680 int vector;
682 if (has_8259 && gsi < 16)
683 *irq = isa_irq_to_vector(gsi);
684 else {
685 vector = gsi_to_vector(gsi);
686 if (vector == -1)
687 return -1;
689 *irq = vector;
690 }
691 return 0;
692 }
693 #if 0
694 int
695 acpi_register_irq (u32 gsi, u32 polarity, u32 trigger)
696 {
697 if (has_8259 && gsi < 16)
698 return isa_irq_to_vector(gsi);
700 return iosapic_register_intr(gsi,
701 (polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
702 (trigger == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
703 }
704 EXPORT_SYMBOL(acpi_register_irq);
705 #endif
706 #endif /* CONFIG_ACPI_BOOT */