Commit fdfec545 authored by Len Brown's avatar Len Brown

Merge intel.com:/home/lenb/bk/linux-2.6.3

into intel.com:/home/lenb/src/linux-acpi-test-2.6.3
parents f4d86110 f817979f
...@@ -818,6 +818,11 @@ S: 1382 Bordeaux Drive ...@@ -818,6 +818,11 @@ S: 1382 Bordeaux Drive
S: Sunnyvale, CA 94087 S: Sunnyvale, CA 94087
S: USA S: USA
N: Bruno Ducrot
E: ducrot@poupinou.org
D: CPUFreq and ACPI bugfixes.
S: Mougin, France
N: Don Dugger N: Don Dugger
E: n0ano@valinux.com E: n0ano@valinux.com
D: Linux/IA-64 D: Linux/IA-64
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <asm/io_apic.h> #include <asm/io_apic.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h>
#include <asm/mpspec.h> #include <asm/mpspec.h>
#if defined (CONFIG_X86_LOCAL_APIC) #if defined (CONFIG_X86_LOCAL_APIC)
...@@ -45,8 +46,8 @@ ...@@ -45,8 +46,8 @@
int acpi_noirq __initdata = 0; /* skip ACPI IRQ initialization */ int acpi_noirq __initdata = 0; /* skip ACPI IRQ initialization */
int acpi_ht __initdata = 1; /* enable HT */ int acpi_ht __initdata = 1; /* enable HT */
int acpi_lapic = 0; int acpi_lapic;
int acpi_ioapic = 0; int acpi_ioapic;
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Boot-time Configuration Boot-time Configuration
...@@ -471,7 +472,7 @@ acpi_boot_init (void) ...@@ -471,7 +472,7 @@ acpi_boot_init (void)
* and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
*/ */
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr); result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
return result; return result;
...@@ -479,7 +480,8 @@ acpi_boot_init (void) ...@@ -479,7 +480,8 @@ acpi_boot_init (void)
mp_register_lapic_address(acpi_lapic_addr); mp_register_lapic_address(acpi_lapic_addr);
result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic); result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
MAX_APICS);
if (!result) { if (!result) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n"); printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
...@@ -491,7 +493,7 @@ acpi_boot_init (void) ...@@ -491,7 +493,7 @@ acpi_boot_init (void)
return result; return result;
} }
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi); result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
...@@ -528,8 +530,8 @@ acpi_boot_init (void) ...@@ -528,8 +530,8 @@ acpi_boot_init (void)
return 1; return 1;
} }
result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic); result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
if (!result) { if (!result) {
printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
return -ENODEV; return -ENODEV;
} }
...@@ -541,14 +543,14 @@ acpi_boot_init (void) ...@@ -541,14 +543,14 @@ acpi_boot_init (void)
/* Build a default routing table for legacy (ISA) interrupts. */ /* Build a default routing table for legacy (ISA) interrupts. */
mp_config_acpi_legacy_irqs(); mp_config_acpi_legacy_irqs();
result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr); result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
return result; return result;
} }
result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src); result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
......
This diff is collapsed.
...@@ -191,8 +191,6 @@ acpi_parse_lsapic (acpi_table_entry_header *header) ...@@ -191,8 +191,6 @@ acpi_parse_lsapic (acpi_table_entry_header *header)
if (!lsapic->flags.enabled) if (!lsapic->flags.enabled)
printk(" disabled"); printk(" disabled");
else if (available_cpus >= NR_CPUS)
printk(" ignored (increase NR_CPUS)");
else { else {
printk(" enabled"); printk(" enabled");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -395,12 +393,6 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma) ...@@ -395,12 +393,6 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
size = ma->length_hi; size = ma->length_hi;
size = (size << 32) | ma->length_lo; size = (size << 32) | ma->length_lo;
if (num_memblks >= NR_MEMBLKS) {
printk(KERN_ERR "Too many mem chunks in SRAT. Ignoring %ld MBytes at %lx\n",
size/(1024*1024), paddr);
return;
}
/* Ignore disabled entries */ /* Ignore disabled entries */
if (!ma->flags.enabled) if (!ma->flags.enabled)
return; return;
...@@ -552,29 +544,29 @@ acpi_boot_init (void) ...@@ -552,29 +544,29 @@ acpi_boot_init (void)
/* Local APIC */ /* Local APIC */
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr) < 0) if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic) < 1) if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n"); printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi) < 0) if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* I/O APIC */ /* I/O APIC */
if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic) < 1) if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n"); printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
/* System-Level Interrupt Routing */ /* System-Level Interrupt Routing */
if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src) < 0) if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n"); printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr) < 0) if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src) < 0) if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
skip_madt: skip_madt:
......
...@@ -114,7 +114,7 @@ static struct iosapic { ...@@ -114,7 +114,7 @@ static struct iosapic {
char *addr; /* base address of IOSAPIC */ char *addr; /* base address of IOSAPIC */
unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */ unsigned int gsi_base; /* first GSI assigned to this IOSAPIC */
unsigned short num_rte; /* number of RTE in this IOSAPIC */ unsigned short num_rte; /* number of RTE in this IOSAPIC */
} iosapic_lists[256]; } iosapic_lists[NR_IOSAPICS];
static int num_iosapic; static int num_iosapic;
......
...@@ -51,8 +51,8 @@ ...@@ -51,8 +51,8 @@
int acpi_noirq __initdata = 0; /* skip ACPI IRQ initialization */ int acpi_noirq __initdata = 0; /* skip ACPI IRQ initialization */
int acpi_ht __initdata = 1; /* enable HT */ int acpi_ht __initdata = 1; /* enable HT */
int acpi_lapic = 0; int acpi_lapic;
int acpi_ioapic = 0; int acpi_ioapic;
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Boot-time Configuration Boot-time Configuration
...@@ -439,7 +439,7 @@ acpi_boot_init (void) ...@@ -439,7 +439,7 @@ acpi_boot_init (void)
* and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
*/ */
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr); result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
return result; return result;
...@@ -447,7 +447,8 @@ acpi_boot_init (void) ...@@ -447,7 +447,8 @@ acpi_boot_init (void)
mp_register_lapic_address(acpi_lapic_addr); mp_register_lapic_address(acpi_lapic_addr);
result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic); result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
MAX_APICS);
if (!result) { if (!result) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n"); printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
...@@ -459,7 +460,7 @@ acpi_boot_init (void) ...@@ -459,7 +460,7 @@ acpi_boot_init (void)
return result; return result;
} }
result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi); result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
...@@ -496,8 +497,8 @@ acpi_boot_init (void) ...@@ -496,8 +497,8 @@ acpi_boot_init (void)
return 1; return 1;
} }
result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic); result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
if (!result) { if (!result) {
printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
return -ENODEV; return -ENODEV;
} }
...@@ -509,14 +510,15 @@ acpi_boot_init (void) ...@@ -509,14 +510,15 @@ acpi_boot_init (void)
/* Build a default routing table for legacy (ISA) interrupts. */ /* Build a default routing table for legacy (ISA) interrupts. */
mp_config_acpi_legacy_irqs(); mp_config_acpi_legacy_irqs();
result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr); result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n"); printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
return result; return result;
} }
result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src); result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
NR_IRQ_VECTORS);
if (result < 0) { if (result < 0) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
......
This diff is collapsed.
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acmacros.h>
extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler); extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
void __init void __init
acpi_table_print_srat_entry ( acpi_table_print_srat_entry (
...@@ -46,9 +47,9 @@ acpi_table_print_srat_entry ( ...@@ -46,9 +47,9 @@ acpi_table_print_srat_entry (
{ {
struct acpi_table_processor_affinity *p = struct acpi_table_processor_affinity *p =
(struct acpi_table_processor_affinity*) header; (struct acpi_table_processor_affinity*) header;
printk(KERN_INFO PREFIX "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
p->apic_id, p->lsapic_eid, p->proximity_domain, p->apic_id, p->lsapic_eid, p->proximity_domain,
p->flags.enabled?"enabled":"disabled"); p->flags.enabled?"enabled":"disabled"));
} }
break; break;
...@@ -56,11 +57,11 @@ acpi_table_print_srat_entry ( ...@@ -56,11 +57,11 @@ acpi_table_print_srat_entry (
{ {
struct acpi_table_memory_affinity *p = struct acpi_table_memory_affinity *p =
(struct acpi_table_memory_affinity*) header; (struct acpi_table_memory_affinity*) header;
printk(KERN_INFO PREFIX "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo, p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
p->memory_type, p->proximity_domain, p->memory_type, p->proximity_domain,
p->flags.enabled ? "enabled" : "disabled", p->flags.enabled ? "enabled" : "disabled",
p->flags.hot_pluggable ? " hot-pluggable" : ""); p->flags.hot_pluggable ? " hot-pluggable" : ""));
} }
break; break;
...@@ -97,7 +98,7 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size) ...@@ -97,7 +98,7 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
static int __init static int __init
acpi_parse_processor_affinity (acpi_table_entry_header *header) acpi_parse_processor_affinity (acpi_table_entry_header *header)
{ {
struct acpi_table_processor_affinity *processor_affinity = NULL; struct acpi_table_processor_affinity *processor_affinity;
processor_affinity = (struct acpi_table_processor_affinity*) header; processor_affinity = (struct acpi_table_processor_affinity*) header;
if (!processor_affinity) if (!processor_affinity)
...@@ -115,7 +116,7 @@ acpi_parse_processor_affinity (acpi_table_entry_header *header) ...@@ -115,7 +116,7 @@ acpi_parse_processor_affinity (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_memory_affinity (acpi_table_entry_header *header) acpi_parse_memory_affinity (acpi_table_entry_header *header)
{ {
struct acpi_table_memory_affinity *memory_affinity = NULL; struct acpi_table_memory_affinity *memory_affinity;
memory_affinity = (struct acpi_table_memory_affinity*) header; memory_affinity = (struct acpi_table_memory_affinity*) header;
if (!memory_affinity) if (!memory_affinity)
...@@ -133,7 +134,7 @@ acpi_parse_memory_affinity (acpi_table_entry_header *header) ...@@ -133,7 +134,7 @@ acpi_parse_memory_affinity (acpi_table_entry_header *header)
static int __init static int __init
acpi_parse_srat (unsigned long phys_addr, unsigned long size) acpi_parse_srat (unsigned long phys_addr, unsigned long size)
{ {
struct acpi_table_srat *srat = NULL; struct acpi_table_srat *srat;
if (!phys_addr || !size) if (!phys_addr || !size)
return -EINVAL; return -EINVAL;
...@@ -149,10 +150,11 @@ acpi_parse_srat (unsigned long phys_addr, unsigned long size) ...@@ -149,10 +150,11 @@ acpi_parse_srat (unsigned long phys_addr, unsigned long size)
int __init int __init
acpi_table_parse_srat ( acpi_table_parse_srat (
enum acpi_srat_entry_id id, enum acpi_srat_entry_id id,
acpi_madt_entry_handler handler) acpi_madt_entry_handler handler,
unsigned int max_entries)
{ {
return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat), return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
id, handler); id, handler, max_entries);
} }
...@@ -166,9 +168,11 @@ acpi_numa_init() ...@@ -166,9 +168,11 @@ acpi_numa_init()
if (result > 0) { if (result > 0) {
result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
acpi_parse_processor_affinity); acpi_parse_processor_affinity,
NR_CPUS);
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
acpi_parse_memory_affinity); acpi_parse_memory_affinity,
NR_MEMBLKS);
} else { } else {
/* FIXME */ /* FIXME */
printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result); printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
......
...@@ -315,7 +315,6 @@ acpi_pci_irq_enable ( ...@@ -315,7 +315,6 @@ acpi_pci_irq_enable (
{ {
int irq = 0; int irq = 0;
u8 pin = 0; u8 pin = 0;
static u16 irq_mask = 0;
ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
...@@ -372,10 +371,13 @@ acpi_pci_irq_enable ( ...@@ -372,10 +371,13 @@ acpi_pci_irq_enable (
* Make sure all (legacy) PCI IRQs are set as level-triggered. * Make sure all (legacy) PCI IRQs are set as level-triggered.
*/ */
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if ((dev->irq < 16) && !((1 << dev->irq) & irq_mask)) { {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Setting IRQ %d as level-triggered\n", dev->irq)); static u16 irq_mask;
irq_mask |= (1 << dev->irq); if ((dev->irq < 16) && !((1 << dev->irq) & irq_mask)) {
eisa_set_level_irq(dev->irq); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Setting IRQ %d as level-triggered\n", dev->irq));
irq_mask |= (1 << dev->irq);
eisa_set_level_irq(dev->irq);
}
} }
#endif #endif
#ifdef CONFIG_IOSAPIC #ifdef CONFIG_IOSAPIC
......
This diff is collapsed.
...@@ -302,13 +302,14 @@ acpi_table_parse_madt_family ( ...@@ -302,13 +302,14 @@ acpi_table_parse_madt_family (
enum acpi_table_id id, enum acpi_table_id id,
unsigned long madt_size, unsigned long madt_size,
int entry_id, int entry_id,
acpi_madt_entry_handler handler) acpi_madt_entry_handler handler,
unsigned int max_entries)
{ {
void *madt = NULL; void *madt = NULL;
acpi_table_entry_header *entry = NULL; acpi_table_entry_header *entry;
unsigned long count = 0; unsigned int count = 0;
unsigned long madt_end = 0; unsigned long madt_end;
unsigned int i = 0; unsigned int i;
if (!handler) if (!handler)
return -EINVAL; return -EINVAL;
...@@ -342,13 +343,18 @@ acpi_table_parse_madt_family ( ...@@ -342,13 +343,18 @@ acpi_table_parse_madt_family (
((unsigned long) madt + madt_size); ((unsigned long) madt + madt_size);
while (((unsigned long) entry) < madt_end) { while (((unsigned long) entry) < madt_end) {
if (entry->type == entry_id) { if (entry->type == entry_id &&
count++; (!max_entries || count++ < max_entries))
handler(entry); handler(entry);
}
entry = (acpi_table_entry_header *) entry = (acpi_table_entry_header *)
((unsigned long) entry + entry->length); ((unsigned long) entry + entry->length);
} }
if (max_entries && count > max_entries) {
printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
"%i found\n", acpi_table_signatures[id], entry_id,
count - max_entries, count);
}
return count; return count;
} }
...@@ -357,10 +363,11 @@ acpi_table_parse_madt_family ( ...@@ -357,10 +363,11 @@ acpi_table_parse_madt_family (
int __init int __init
acpi_table_parse_madt ( acpi_table_parse_madt (
enum acpi_madt_entry_id id, enum acpi_madt_entry_id id,
acpi_madt_entry_handler handler) acpi_madt_entry_handler handler,
unsigned int max_entries)
{ {
return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt), return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
id, handler); id, handler, max_entries);
} }
...@@ -585,4 +592,3 @@ acpi_table_init (void) ...@@ -585,4 +592,3 @@ acpi_table_init (void)
return 0; return 0;
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* toshiba_acpi.c - Toshiba Laptop ACPI Extras * toshiba_acpi.c - Toshiba Laptop ACPI Extras
* *
* *
* Copyright (C) 2002-2003 John Belmonte * Copyright (C) 2002-2004 John Belmonte
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* *
*/ */
#define TOSHIBA_ACPI_VERSION "0.16" #define TOSHIBA_ACPI_VERSION "0.17"
#define PROC_INTERFACE_VERSION 1 #define PROC_INTERFACE_VERSION 1
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -48,9 +48,15 @@ MODULE_AUTHOR("John Belmonte"); ...@@ -48,9 +48,15 @@ MODULE_AUTHOR("John Belmonte");
MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver"); MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define MY_LOGPREFIX "toshiba_acpi: "
#define MY_ERR KERN_ERR MY_LOGPREFIX
#define MY_NOTICE KERN_NOTICE MY_LOGPREFIX
#define MY_INFO KERN_INFO MY_LOGPREFIX
/* Toshiba ACPI method paths */ /* Toshiba ACPI method paths */
#define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM" #define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM"
#define METHOD_HCI "\\_SB_.VALD.GHCI" #define METHOD_HCI_1 "\\_SB_.VALD.GHCI"
#define METHOD_HCI_2 "\\_SB_.VALZ.GHCI"
#define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" #define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX"
/* Toshiba HCI interface definitions /* Toshiba HCI interface definitions
...@@ -120,6 +126,16 @@ snscanf(const char* str, int n, const char* format, ...) ...@@ -120,6 +126,16 @@ snscanf(const char* str, int n, const char* format, ...)
/* acpi interface wrappers /* acpi interface wrappers
*/ */
static int
is_valid_acpi_path(const char* methodName)
{
acpi_handle handle;
acpi_status status;
status = acpi_get_handle(0, (char*)methodName, &handle);
return !ACPI_FAILURE(status);
}
static int static int
write_acpi_int(const char* methodName, int val) write_acpi_int(const char* methodName, int val)
{ {
...@@ -154,6 +170,8 @@ read_acpi_int(const char* methodName, int* pVal) ...@@ -154,6 +170,8 @@ read_acpi_int(const char* methodName, int* pVal)
} }
#endif #endif
static const char* method_hci /*= 0*/;
/* Perform a raw HCI call. Here we don't care about input or output buffer /* Perform a raw HCI call. Here we don't care about input or output buffer
* format. * format.
*/ */
...@@ -177,7 +195,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) ...@@ -177,7 +195,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
results.length = sizeof(out_objs); results.length = sizeof(out_objs);
results.pointer = out_objs; results.pointer = out_objs;
status = acpi_evaluate_object(0, METHOD_HCI, &params, status = acpi_evaluate_object(0, (char*)method_hci, &params,
&results); &results);
if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
for (i = 0; i < out_objs->package.count; ++i) { for (i = 0; i < out_objs->package.count; ++i) {
...@@ -215,7 +233,7 @@ hci_read1(u32 reg, u32* out1, u32* result) ...@@ -215,7 +233,7 @@ hci_read1(u32 reg, u32* out1, u32* result)
return status; return status;
} }
static struct proc_dir_entry* toshiba_proc_dir; static struct proc_dir_entry* toshiba_proc_dir /*= 0*/;
static int force_fan; static int force_fan;
static int last_key_event; static int last_key_event;
static int key_event_valid; static int key_event_valid;
...@@ -270,7 +288,7 @@ read_lcd(char* p) ...@@ -270,7 +288,7 @@ read_lcd(char* p)
p += sprintf(p, "brightness_levels: %d\n", p += sprintf(p, "brightness_levels: %d\n",
HCI_LCD_BRIGHTNESS_LEVELS); HCI_LCD_BRIGHTNESS_LEVELS);
} else { } else {
p += sprintf(p, "ERROR\n"); printk(MY_ERR "Error reading LCD brightness\n");
} }
return p; return p;
...@@ -310,7 +328,7 @@ read_video(char* p) ...@@ -310,7 +328,7 @@ read_video(char* p)
p += sprintf(p, "crt_out: %d\n", is_crt); p += sprintf(p, "crt_out: %d\n", is_crt);
p += sprintf(p, "tv_out: %d\n", is_tv); p += sprintf(p, "tv_out: %d\n", is_tv);
} else { } else {
p += sprintf(p, "ERROR\n"); printk(MY_ERR "Error reading video out status\n");
} }
return p; return p;
...@@ -320,25 +338,31 @@ static unsigned long ...@@ -320,25 +338,31 @@ static unsigned long
write_video(const char* buffer, unsigned long count) write_video(const char* buffer, unsigned long count)
{ {
int value; int value;
const char* buffer_end = buffer + count; int remain = count;
int lcd_out = -1; int lcd_out = -1;
int crt_out = -1; int crt_out = -1;
int tv_out = -1; int tv_out = -1;
u32 hci_result; u32 hci_result;
int video_out; int video_out;
/* scan expression. Multiple expressions may be delimited with ; */ /* scan expression. Multiple expressions may be delimited with ;
do { *
if (snscanf(buffer, count, " lcd_out : %i", &value) == 1) * NOTE: to keep scanning simple, invalid fields are ignored
*/
while (remain) {
if (snscanf(buffer, remain, " lcd_out : %i", &value) == 1)
lcd_out = value & 1; lcd_out = value & 1;
else if (snscanf(buffer, count, " crt_out : %i", &value) == 1) else if (snscanf(buffer, remain, " crt_out : %i", &value) == 1)
crt_out = value & 1; crt_out = value & 1;
else if (snscanf(buffer, count, " tv_out : %i", &value) == 1) else if (snscanf(buffer, remain, " tv_out : %i", &value) == 1)
tv_out = value & 1; tv_out = value & 1;
/* advance to one character past the next ; */ /* advance to one character past the next ; */
do ++buffer; do {
while ((buffer < buffer_end) && (*(buffer-1) != ';')); ++buffer;
} while (buffer < buffer_end); --remain;
}
while (remain && *(buffer-1) != ';');
}
hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result); hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result);
if (hci_result == HCI_SUCCESS) { if (hci_result == HCI_SUCCESS) {
...@@ -353,6 +377,8 @@ write_video(const char* buffer, unsigned long count) ...@@ -353,6 +377,8 @@ write_video(const char* buffer, unsigned long count)
* video setting if something changed. */ * video setting if something changed. */
if (new_video_out != video_out) if (new_video_out != video_out)
write_acpi_int(METHOD_VIDEO_OUT, new_video_out); write_acpi_int(METHOD_VIDEO_OUT, new_video_out);
} else {
return -EFAULT;
} }
return count; return count;
...@@ -369,7 +395,7 @@ read_fan(char* p) ...@@ -369,7 +395,7 @@ read_fan(char* p)
p += sprintf(p, "running: %d\n", (value > 0)); p += sprintf(p, "running: %d\n", (value > 0));
p += sprintf(p, "force_on: %d\n", force_fan); p += sprintf(p, "force_on: %d\n", force_fan);
} else { } else {
p += sprintf(p, "ERROR\n"); printk(MY_ERR "Error reading fan status\n");
} }
return p; return p;
...@@ -413,8 +439,9 @@ read_keys(char* p) ...@@ -413,8 +439,9 @@ read_keys(char* p)
* some machines where system events sporadically * some machines where system events sporadically
* become disabled. */ * become disabled. */
hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result); hci_write1(HCI_SYSTEM_EVENT, 1, &hci_result);
printk(MY_NOTICE "Re-enabled hotkeys\n");
} else { } else {
p += sprintf(p, "ERROR\n"); printk(MY_ERR "Error reading hotkey status\n");
goto end; goto end;
} }
} }
...@@ -465,7 +492,7 @@ ProcItem proc_items[] = ...@@ -465,7 +492,7 @@ ProcItem proc_items[] =
{ 0 , 0 , 0 }, { 0 , 0 , 0 },
}; };
static acpi_status static acpi_status __init
add_device(void) add_device(void)
{ {
struct proc_dir_entry* proc; struct proc_dir_entry* proc;
...@@ -483,7 +510,7 @@ add_device(void) ...@@ -483,7 +510,7 @@ add_device(void)
return(AE_OK); return(AE_OK);
} }
static acpi_status static acpi_status __exit
remove_device(void) remove_device(void)
{ {
ProcItem* item; ProcItem* item;
...@@ -497,15 +524,19 @@ static int __init ...@@ -497,15 +524,19 @@ static int __init
toshiba_acpi_init(void) toshiba_acpi_init(void)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
int value;
u32 hci_result; u32 hci_result;
/* simple device detection: try reading an HCI register */ /* simple device detection: look for HCI method */
hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); if (is_valid_acpi_path(METHOD_HCI_1))
if (hci_result != HCI_SUCCESS) method_hci = METHOD_HCI_1;
else if (is_valid_acpi_path(METHOD_HCI_2))
method_hci = METHOD_HCI_2;
else
return -ENODEV; return -ENODEV;
printk("Toshiba Laptop ACPI Extras version %s\n", TOSHIBA_ACPI_VERSION); printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n",
TOSHIBA_ACPI_VERSION);
printk(MY_INFO " HCI method: %s\n", method_hci);
force_fan = 0; force_fan = 0;
key_event_valid = 0; key_event_valid = 0;
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#define ACPI_PROCESSOR_MAX_C2_LATENCY 100 #define ACPI_PROCESSOR_MAX_C2_LATENCY 100
#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000 #define ACPI_PROCESSOR_MAX_C3_LATENCY 1000
#define ACPI_PROCESSOR_MAX_PERFORMANCE 8
#define ACPI_PROCESSOR_MAX_THROTTLING 16 #define ACPI_PROCESSOR_MAX_THROTTLING 16
#define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */ #define ACPI_PROCESSOR_MAX_THROTTLE 250 /* 25% */
#define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4 #define ACPI_PROCESSOR_MAX_DUTY_WIDTH 4
...@@ -67,20 +65,22 @@ struct acpi_processor_px { ...@@ -67,20 +65,22 @@ struct acpi_processor_px {
acpi_integer status; /* success indicator */ acpi_integer status; /* success indicator */
}; };
#define ACPI_PDC_REVISION_ID 0x1
struct acpi_processor_performance { struct acpi_processor_performance {
int state; unsigned int state;
int platform_limit; unsigned int platform_limit;
u16 control_register; struct acpi_pct_register control_register;
u16 status_register; struct acpi_pct_register status_register;
u8 control_register_bit_width; unsigned int state_count;
u8 status_register_bit_width; struct acpi_processor_px *states;
int state_count;
struct acpi_processor_px states[ACPI_PROCESSOR_MAX_PERFORMANCE]; /* the _PDC objects passed by the driver, if any */
struct cpufreq_frequency_table freq_table[ACPI_PROCESSOR_MAX_PERFORMANCE]; struct acpi_object_list *pdc;
struct acpi_processor *pr;
}; };
/* Throttling Control */ /* Throttling Control */
struct acpi_processor_tx { struct acpi_processor_tx {
...@@ -133,11 +133,11 @@ struct acpi_processor { ...@@ -133,11 +133,11 @@ struct acpi_processor {
struct acpi_processor_limit limit; struct acpi_processor_limit limit;
}; };
extern int acpi_processor_get_platform_limit (
struct acpi_processor* pr);
extern int acpi_processor_register_performance ( extern int acpi_processor_register_performance (
struct acpi_processor_performance * performance, struct acpi_processor_performance * performance,
struct acpi_processor ** pr, unsigned int cpu);
extern void acpi_processor_unregister_performance (
struct acpi_processor_performance * performance,
unsigned int cpu); unsigned int cpu);
#endif #endif
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#ifdef CONFIG_IOSAPIC #ifdef CONFIG_IOSAPIC
#define NR_IOSAPICS 256
extern void __init iosapic_system_init (int pcat_compat); extern void __init iosapic_system_init (int pcat_compat);
extern void __init iosapic_init (unsigned long address, extern void __init iosapic_init (unsigned long address,
unsigned int gsi_base); unsigned int gsi_base);
......
...@@ -355,8 +355,8 @@ int acpi_numa_init (void); ...@@ -355,8 +355,8 @@ int acpi_numa_init (void);
int acpi_table_init (void); int acpi_table_init (void);
int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler); int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler); int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler); int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
void acpi_table_print_madt_entry (acpi_table_entry_header *madt); void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
void acpi_table_print_srat_entry (acpi_table_entry_header *srat); void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment