Commit e3415d56 authored by Takayoshi Kouchi's avatar Takayoshi Kouchi Committed by David Mosberger

[PATCH] ia64: IRQ cleanup patch for 2.5.30

This is updated cleanup patch against 2.5.30 (+ David's and Kimi's patch).

1) reformatted the source according to the recommendation,
2) fixed remaining iosapic_register_irq -> iosapic_register_intr in acpi.c
3) updated iosapic.c comment
4) made irq variables from int to unsigned int in iosapic.c, irq.c

While I'm looking at set_irq_affinity_info() in irq.c,
I found parse_hex_value is defined to return unsigned int while
it returns -EFAULT. 4) includes a fix for this.
parent f841051b
......@@ -47,9 +47,9 @@
#define PREFIX "ACPI: "
asm (".weak iosapic_register_irq");
asm (".weak iosapic_register_legacy_irq");
asm (".weak iosapic_register_platform_irq");
asm (".weak iosapic_register_intr");
asm (".weak iosapic_override_isa_irq");
asm (".weak iosapic_register_platform_intr");
asm (".weak iosapic_init");
asm (".weak iosapic_version");
......@@ -173,10 +173,10 @@ acpi_dispose_crs (acpi_buffer *buf)
#ifdef CONFIG_ACPI_BOOT
#define ACPI_MAX_PLATFORM_IRQS 256
#define ACPI_MAX_PLATFORM_INTERRUPTS 256
/* Array to record platform interrupt vectors for generic interrupt routing. */
int platform_irq_list[ACPI_MAX_PLATFORM_IRQS] = { [0 ... ACPI_MAX_PLATFORM_IRQS - 1] = -1 };
int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = { [0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1 };
enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
......@@ -189,9 +189,9 @@ acpi_request_vector (u32 int_type)
{
int vector = -1;
if (int_type < ACPI_MAX_PLATFORM_IRQS) {
if (int_type < ACPI_MAX_PLATFORM_INTERRUPTS) {
/* correctable platform error interrupt */
vector = platform_irq_list[int_type];
vector = platform_intr_list[int_type];
} else
printk("acpi_request_vector(): invalid interrupt type\n");
return vector;
......@@ -210,6 +210,7 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
static int total_cpus __initdata;
static int available_cpus __initdata;
struct acpi_table_madt * acpi_madt __initdata;
static u8 has_8259;
static int __init
......@@ -284,7 +285,7 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header)
static int __init
acpi_find_iosapic (int global_vector, u32 *irq_base, char **iosapic_address)
acpi_find_iosapic (unsigned int gsi, u32 *gsi_base, char **iosapic_address)
{
struct acpi_table_iosapic *iosapic;
int ver;
......@@ -292,7 +293,7 @@ acpi_find_iosapic (int global_vector, u32 *irq_base, char **iosapic_address)
char *p;
char *end;
if (!irq_base || !iosapic_address)
if (!gsi_base || !iosapic_address)
return -ENODEV;
p = (char *) (acpi_madt + 1);
......@@ -302,13 +303,13 @@ acpi_find_iosapic (int global_vector, u32 *irq_base, char **iosapic_address)
if (*p == ACPI_MADT_IOSAPIC) {
iosapic = (struct acpi_table_iosapic *) p;
*irq_base = iosapic->global_irq_base;
*gsi_base = iosapic->global_irq_base;
*iosapic_address = ioremap(iosapic->address, 0);
ver = iosapic_version(*iosapic_address);
max_pin = (ver >> 16) & 0xff;
if ((global_vector - *irq_base) <= max_pin)
if ((gsi - *gsi_base) <= max_pin)
return 0; /* Found it! */
}
p += p[1];
......@@ -347,7 +348,7 @@ acpi_parse_plat_int_src (acpi_table_entry_header *header)
{
struct acpi_table_plat_int_src *plintsrc;
int vector;
u32 irq_base;
u32 gsi_base;
char *iosapic_address;
plintsrc = (struct acpi_table_plat_int_src *) header;
......@@ -356,31 +357,31 @@ acpi_parse_plat_int_src (acpi_table_entry_header *header)
acpi_table_print_madt_entry(header);
if (!iosapic_register_platform_irq) {
printk(KERN_WARNING PREFIX "No ACPI platform IRQ support\n");
if (!iosapic_register_platform_intr) {
printk(KERN_WARNING PREFIX "No ACPI platform interrupt support\n");
return -ENODEV;
}
if (acpi_find_iosapic(plintsrc->global_irq, &irq_base, &iosapic_address)) {
if (acpi_find_iosapic(plintsrc->global_irq, &gsi_base, &iosapic_address)) {
printk(KERN_WARNING PREFIX "IOSAPIC not found\n");
return -ENODEV;
}
/*
* Get vector assignment for this IRQ, set attributes, and program the
* IOSAPIC routing table.
* Get vector assignment for this interrupt, set attributes,
* and program the IOSAPIC routing table.
*/
vector = iosapic_register_platform_irq(plintsrc->type,
plintsrc->global_irq,
plintsrc->iosapic_vector,
plintsrc->eid,
plintsrc->id,
(plintsrc->flags.polarity == 1) ? 1 : 0,
(plintsrc->flags.trigger == 1) ? 1 : 0,
irq_base,
iosapic_address);
platform_irq_list[plintsrc->type] = vector;
vector = iosapic_register_platform_intr(plintsrc->type,
plintsrc->global_irq,
plintsrc->iosapic_vector,
plintsrc->eid,
plintsrc->id,
(plintsrc->flags.polarity == 1) ? 1 : 0,
(plintsrc->flags.trigger == 1) ? 1 : 0,
gsi_base,
iosapic_address);
platform_intr_list[plintsrc->type] = vector;
return 0;
}
......@@ -397,12 +398,12 @@ acpi_parse_int_src_ovr (acpi_table_entry_header *header)
acpi_table_print_madt_entry(header);
/* Ignore if the platform doesn't support overrides */
if (!iosapic_register_legacy_irq)
if (!iosapic_override_isa_irq)
return 0;
iosapic_register_legacy_irq(p->bus_irq, p->global_irq,
(p->flags.polarity == 1) ? 1 : 0,
(p->flags.trigger == 1) ? 1 : 0);
iosapic_override_isa_irq(p->bus_irq, p->global_irq,
(p->flags.polarity == 1) ? 1 : 0,
(p->flags.trigger == 1) ? 1 : 0);
return 0;
}
......@@ -431,6 +432,9 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
/* remember the value for reference after free_initmem() */
has_8259 = acpi_madt->flags.pcat_compat;
/* Get base address of IPI Message Block */
if (acpi_madt->lapic_address)
......@@ -440,11 +444,14 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
return 0;
}
static int __init
acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
{
struct acpi_table_header *fadt_header;
fadt_descriptor_rev2 *fadt;
u32 sci_irq, gsi_base;
char *iosapic_address;
if (!phys_addr || !size)
return -EINVAL;
......@@ -458,9 +465,20 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
acpi_kbd_controller_present = 0;
if (!iosapic_register_intr)
return 0; /* just ignore the rest */
sci_irq = fadt->sci_int;
if (has_8259 && sci_irq < 16)
return 0; /* legacy, no setup required */
if (!acpi_find_iosapic(sci_irq, &gsi_base, &iosapic_address))
iosapic_register_intr(sci_irq, 0, 0, gsi_base, iosapic_address);
return 0;
}
unsigned long __init
acpi_find_rsdp (void)
{
......@@ -482,12 +500,12 @@ static int __init
acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
{
acpi_ser_t *spcr;
unsigned long global_int;
unsigned int gsi;
if (!phys_addr || !size)
return -EINVAL;
if (!iosapic_register_irq)
if (!iosapic_register_intr)
return -ENODEV;
/*
......@@ -500,6 +518,7 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
*/
spcr = (acpi_ser_t *) __va(phys_addr);
setup_serial_acpi(spcr);
if (spcr->length < sizeof(acpi_ser_t))
......@@ -509,22 +528,22 @@ acpi_parse_spcr (unsigned long phys_addr, unsigned long size)
if ((spcr->base_addr.space_id != ACPI_SERIAL_PCICONF_SPACE) &&
(spcr->int_type == ACPI_SERIAL_INT_SAPIC))
{
u32 irq_base;
u32 gsi_base;
char *iosapic_address;
int vector;
/* We have a UART in memory space with an SAPIC interrupt */
global_int = ((spcr->global_int[3] << 24) |
(spcr->global_int[2] << 16) |
(spcr->global_int[1] << 8) |
(spcr->global_int[0]) );
gsi = ( (spcr->global_int[3] << 24) |
(spcr->global_int[2] << 16) |
(spcr->global_int[1] << 8) |
(spcr->global_int[0]) );
/* Which iosapic does this IRQ belong to? */
/* Which iosapic does this interrupt belong to? */
if (!acpi_find_iosapic(global_int, &irq_base, &iosapic_address))
vector = iosapic_register_irq(global_int, 1, 1,
irq_base, iosapic_address);
if (!acpi_find_iosapic(gsi, &gsi_base, &iosapic_address))
vector = iosapic_register_intr(gsi, 1, 1,
gsi_base, iosapic_address);
}
return 0;
}
......@@ -583,7 +602,12 @@ acpi_boot_init (char *cmdline)
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
skip_madt:
/* FADT says whether a legacy keyboard controller is present. */
/*
* FADT says whether a legacy keyboard controller is present.
* The FADT also contains an SCI_INT line, by which the system
* gets interrupts such as power and sleep buttons. If it's not
* on a Legacy interrupt, it needs to be setup.
*/
if (acpi_table_parse(ACPI_FACP, acpi_parse_fadt) < 1)
printk(KERN_ERR PREFIX "Can't find FADT\n");
......@@ -631,7 +655,7 @@ acpi_get_prt (struct pci_vector_struct **vectors, int *count)
*count = 0;
if (acpi_prt.count < 0) {
printk(KERN_ERR PREFIX "No PCI IRQ routing entries\n");
printk(KERN_ERR PREFIX "No PCI interrupt routing entries\n");
return -ENODEV;
}
......@@ -669,4 +693,13 @@ acpi_get_interrupt_model (int *type)
return 0;
}
int
acpi_irq_to_vector (u32 irq)
{
if (has_8259 && irq < 16)
return isa_irq_to_vector(irq);
return gsi_to_vector(irq);
}
#endif /* CONFIG_ACPI_BOOT */
This diff is collapsed.
......@@ -802,8 +802,7 @@ static struct proc_dir_entry * irq_dir [NR_IRQS];
#define HEX_DIGITS 8
static unsigned int parse_hex_value (const char *buffer,
unsigned long count, unsigned long *ret)
static int parse_hex_value (const char *buffer, unsigned long count, unsigned long *ret)
{
unsigned char hexnum [HEX_DIGITS];
unsigned long value;
......@@ -846,11 +845,11 @@ static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 };
void set_irq_affinity_info(int irq, int hwid, int redir)
void set_irq_affinity_info (unsigned int irq, int hwid, int redir)
{
unsigned long mask = 1UL<<cpu_logical_id(hwid);
if (irq >= 0 && irq < NR_IRQS) {
if (irq < NR_IRQS) {
irq_affinity[irq] = mask;
irq_redir[irq] = (char) (redir & 0xff);
}
......@@ -861,14 +860,15 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off,
{
if (count < HEX_DIGITS+3)
return -EINVAL;
return sprintf (page, "%s%08lx\n", irq_redir[(long)data] ? "r " : "",
irq_affinity[(long)data]);
return sprintf (page, "%s%08lx\n", irq_redir[(unsigned long)data] ? "r " : "",
irq_affinity[(unsigned long)data]);
}
static int irq_affinity_write_proc (struct file *file, const char *buffer,
unsigned long count, void *data)
{
int irq = (long) data, full_count = count, err;
unsigned int irq = (unsigned long) data;
int full_count = count, err;
unsigned long new_value;
const char *buf = buffer;
int redir;
......@@ -884,6 +884,8 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
redir = 0;
err = parse_hex_value(buf, count, &new_value);
if (err)
return err;
/*
* Do not allow disabling IRQs completely - it's a too easy
......@@ -893,7 +895,7 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
if (!(new_value & cpu_online_map))
return -EINVAL;
irq_desc(irq)->handler->set_affinity(irq | (redir?(1<<31):0), new_value);
irq_desc(irq)->handler->set_affinity(irq | (redir? IA64_IRQ_REDIRECTED : 0), new_value);
return full_count;
}
......@@ -912,7 +914,8 @@ static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
unsigned long count, void *data)
{
unsigned long *mask = (unsigned long *) data, full_count = count, err;
unsigned long *mask = (unsigned long *) data;
int full_count = count, err;
unsigned long new_value;
err = parse_hex_value(buffer, count, &new_value);
......@@ -946,7 +949,7 @@ static void register_irq_proc (unsigned int irq)
if (entry) {
entry->nlink = 1;
entry->data = (void *)(long)irq;
entry->data = (void *)(unsigned long)irq;
entry->read_proc = irq_affinity_read_proc;
entry->write_proc = irq_affinity_write_proc;
}
......
......@@ -54,20 +54,15 @@ __u8 isa_irq_to_vector_map[16] = {
0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21
};
/*
* GSI to IA-64 vector translation table.
*/
__u8 gsi_to_vector_map[255];
int
ia64_alloc_irq (void)
ia64_alloc_vector (void)
{
static int next_irq = IA64_FIRST_DEVICE_VECTOR;
static int next_vector = IA64_FIRST_DEVICE_VECTOR;
if (next_irq > IA64_LAST_DEVICE_VECTOR)
if (next_vector > IA64_LAST_DEVICE_VECTOR)
/* XXX could look for sharable vectors instead of panic'ing... */
panic("ia64_alloc_irq: out of interrupt vectors!");
return next_irq++;
panic("ia64_alloc_vector: out of interrupt vectors!");
return next_vector++;
}
extern unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs);
......
......@@ -100,7 +100,8 @@ const char *acpi_get_sysname (void);
int acpi_boot_init (char *cdline);
int acpi_request_vector (u32 int_type);
int acpi_get_prt (struct pci_vector_struct **vectors, int *count);
int acpi_get_interrupt_model(int *type);
int acpi_get_interrupt_model (int *type);
int acpi_irq_to_vector (u32 irq);
#ifdef CONFIG_DISCONTIGMEM
#define NODE_ARRAY_INDEX(x) ((x) / 8) /* 8 bits/char */
......
......@@ -53,6 +53,10 @@ typedef u8 ia64_vector;
#define IA64_IPI_RESCHEDULE 0xfd /* SMP reschedule */
#define IA64_IPI_VECTOR 0xfe /* inter-processor interrupt vector */
/* Used for encoding redirected irqs */
#define IA64_IRQ_REDIRECTED (1 << 31)
/* IA64 inter-cpu interrupt related definitions */
#define IA64_IPI_DEFAULT_BASE_ADDR 0xfee00000
......@@ -68,14 +72,12 @@ enum {
extern __u8 isa_irq_to_vector_map[16];
#define isa_irq_to_vector(x) isa_irq_to_vector_map[(x)]
extern __u8 gsi_to_vector_map[255];
#define gsi_to_vector(x) gsi_to_vector_map[(x)]
extern unsigned long ipi_base_addr;
extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */
extern int ia64_alloc_irq (void); /* allocate a free irq */
extern int ia64_alloc_vector (void); /* allocate a free vector */
extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
extern void register_percpu_irq (ia64_vector vec, struct irqaction *action);
......
......@@ -51,17 +51,24 @@
#ifndef __ASSEMBLY__
extern void __init iosapic_init (unsigned long address, unsigned int base_irq,
int pcat_compat);
extern int iosapic_register_irq (u32 global_vector, unsigned long polarity,
unsigned long edge_triggered, u32 base_irq,
char *iosapic_address);
extern void iosapic_register_legacy_irq (unsigned long irq, unsigned long pin,
unsigned long polarity, unsigned long trigger);
extern int iosapic_register_platform_irq (u32 int_type, u32 global_vector, u32 iosapic_vector,
u16 eid, u16 id, unsigned long polarity,
unsigned long edge_triggered, u32 base_irq,
char *iosapic_address);
extern void __devinit iosapic_init (unsigned long address,
unsigned int gsi_base,
int pcat_compat);
extern int gsi_to_vector (unsigned int gsi);
extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
unsigned long edge_triggered,
u32 gsi_base, char *iosapic_address);
extern void iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
unsigned long polarity,
unsigned long edge_triggered);
extern int iosapic_register_platform_intr (u32 int_type,
unsigned int gsi,
int pmi_vector,
u16 eid, u16 id,
unsigned long polarity,
unsigned long edge_triggered,
unsigned int gsi_base,
char *iosapic_address);
extern unsigned int iosapic_version (char *addr);
extern void iosapic_pci_fixup (int);
......
......@@ -27,6 +27,6 @@ irq_cannonicalize (int irq)
extern void disable_irq (unsigned int);
extern void disable_irq_nosync (unsigned int);
extern void enable_irq (unsigned int);
extern void set_irq_affinity_info (int irq, int dest, int redir);
extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
#endif /* _ASM_IA64_IRQ_H */
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