Common code changes:
o while clenaing up the alpha irq handling hardirq_enter/exit become
irq_enter/exit. Such two functions was used only by irq_enter/exit and
the irq_enter/exit in linux/irq.h didn't compile for alpha
that takes the local_irq_count information in a per CPU cacheline
aligned data structure (not an array as in i386) and uses a
spinlock for the global_irq_lock. (btw the cpuinfo struct is
64byte aligned while the l1 cacheline is large 32bytes, maybe it's
the bcache that's 64byte aligned? I have not changed the alignment
because I am trusting it make sense to take it 64byte aligned.)
o while porting more quirks from the 2.2.x pci alpha code
I had to export pdev_fixup_irq because I must avoid
to reassing the irq for some device and for this reason I can't
use the plain pci_fixup_irqs unconditional loop.
o cleanedup the cache.h stuff. All function are shared across
i386 and alpha (and others). All can be overridden by a
special asm/cache.h. Now there is also a ____cacheline_aligned
that can be used to enforce a struct to have a size multiple
of SMP_CACHE_BYTES (I am not 100% sure if the old good gcc
complains about alignment larger than 16 bytes hmmm, if so with
the 2.7.2 gcc the *cacheline_aligned macros should defined as a a
noop). I used ____cacheline_aligned somewhere in the alpha port
(ipi message struct) and for irq_desc_t.
alpha specific changes:
o fixes compilation troubles introduced in late 2.3.30pre due
missing common_kill_arch.
o cleanedup alpha irq handling putting alpha in sync with
linux/irq.h and asm/hw_irq.h. Right now I am sharing the
irq_desc_t from linux/irq.h, but I think I'll need more fields
per irq to do scale irqs across multiple CPUs in software so
probably the irq_desc_t should become a per-arch thing in the
future?
o for the tsunami the dim register enforces masking also on the
lower bits (irqs < 16) so I changed the mask callback to
take care of this.
Patch against 2.3.30pre6:
diff -urN 2.3.30pre6/arch/alpha/kernel/irq.c a/arch/alpha/kernel/irq.c
--- 2.3.30pre6/arch/alpha/kernel/irq.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/irq.c Sun Dec 5 15:28:11 1999
@@ -22,15 +22,15 @@
#include <linux/random.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/irq.h>
#include <asm/system.h>
#include <asm/io.h>
-#include <asm/irq.h>
#include <asm/bitops.h>
#include <asm/machvec.h>
+#include <asm/spinlock.h>
#include "proto.h"
-#include "irq_impl.h"
#define vulp volatile unsigned long *
#define vuip volatile unsigned int *
@@ -182,7 +182,8 @@
*/
static struct irqaction timer_irq = { NULL, 0, 0, NULL, NULL, NULL};
-static struct irqaction *irq_action[NR_IRQS];
+spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
+irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = { [0 ... NR_IRQS-1] = {0,} };
static inline void
@@ -230,12 +231,7 @@
int
check_irq(unsigned int irq)
{
- struct irqaction **p;
-
- p = irq_action + irq;
- if (*p == NULL)
- return 0;
- return -EBUSY;
+ return irq_desc[irq].action ? -EBUSY : 0;
}
int
@@ -253,7 +249,7 @@
if (!handler)
return -EINVAL;
- p = irq_action + irq;
+ p = &irq_desc[irq].action;
action = *p;
if (action) {
/* Can't share interrupts unless both agree to */
@@ -314,14 +310,14 @@
printk("Trying to free reserved IRQ %d\n", irq);
return;
}
- for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
+ for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
if (action->dev_id != dev_id)
continue;
/* Found it - now free it */
save_and_cli(flags);
*p = action->next;
- if (!irq[irq_action])
+ if (!irq_desc[irq].action)
mask_irq(irq);
restore_flags(flags);
kfree(action);
@@ -344,7 +340,7 @@
#endif
for (i = 0; i < NR_IRQS; i++) {
- action = irq_action[i];
+ action = irq_desc[i].action;
if (!action)
continue;
p += sprintf(p, "%3d: ",i);
@@ -541,63 +537,6 @@
}
}
-#undef INIT_STUCK
-#define INIT_STUCK (1<<26)
-
-#undef STUCK
-#define STUCK \
- if (!--stuck) { \
- printk("irq_enter stuck (irq=%d, cpu=%d, global=%d)\n", \
- irq, cpu, global_irq_holder); \
- stuck = INIT_STUCK; \
- }
-
-#undef VERBOSE_IRQLOCK_DEBUGGING
-
-void
-irq_enter(int cpu, int irq)
-{
-#ifdef VERBOSE_IRQLOCK_DEBUGGING
- extern void smp_show_backtrace_all_cpus(void);
-#endif
- int stuck = INIT_STUCK;
-
- hardirq_enter(cpu, irq);
- barrier();
- while (spin_is_locked(&global_irq_lock)) {
- if (cpu == global_irq_holder) {
- int globl_locked = spin_is_locked(&global_irq_lock);
- int globl_icount = atomic_read(&global_irq_count);
- int local_count = local_irq_count(cpu);
-
- /* It is very important that we load the state
- variables before we do the first call to
- printk() as printk() could end up changing
- them... */
-
- printk("CPU[%d]: where [%p] glocked[%d] gicnt[%d]"
- " licnt[%d]\n",
- cpu, previous_irqholder, globl_locked,
- globl_icount, local_count);
-#ifdef VERBOSE_IRQLOCK_DEBUGGING
- printk("Performing backtrace on all CPUs,"
- " write this down!\n");
- smp_show_backtrace_all_cpus();
-#endif
- break;
- }
- STUCK;
- barrier();
- }
-}
-
-void
-irq_exit(int cpu, int irq)
-{
- hardirq_exit(cpu, irq);
- release_irqlock(cpu);
-}
-
static void
show(char * str, void *where)
{
@@ -698,12 +637,6 @@
}
#endif
}
-
-#else /* !__SMP__ */
-
-#define irq_enter(cpu, irq) (++local_irq_count(cpu))
-#define irq_exit(cpu, irq) (--local_irq_count(cpu))
-
#endif /* __SMP__ */
static void
@@ -720,7 +653,7 @@
printk("PC = %016lx PS=%04lx\n", regs->pc, regs->ps);
printk("Expecting: ");
for (i = 0; i < ACTUAL_NR_IRQS; i++)
- if ((action = irq_action[i]))
+ if ((action = irq_desc[i].action))
while (action->handler) {
printk("[%s:%d] ", action->name, i);
action = action->next;
@@ -774,7 +707,7 @@
irq_enter(cpu, irq);
kstat.irqs[cpu][irq] += 1;
- action = irq_action[irq];
+ action = irq_desc[irq].action;
/*
* For normal interrupts, we mask it out, and then ACK it.
@@ -823,7 +756,7 @@
if (!(PROBE_MASK & (1UL << i))) {
continue;
}
- action = irq_action[i];
+ action = irq_desc[i].action;
if (!action) {
enable_irq(i);
irqs |= (1UL << i);
diff -urN 2.3.30pre6/arch/alpha/kernel/irq_impl.h a/arch/alpha/kernel/irq_impl.h
--- 2.3.30pre6/arch/alpha/kernel/irq_impl.h Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/irq_impl.h Thu Jan 1 01:00:00 1970
@@ -1,87 +0,0 @@
-/*
- * linux/arch/alpha/kernel/irq.h
- *
- * Copyright (C) 1995 Linus Torvalds
- * Copyright (C) 1998 Richard Henderson
- *
- * This file contains declarations and inline functions for interfacing
- * with the IRQ handling routines in irq.c.
- */
-
-#include <linux/config.h>
-
-#define STANDARD_INIT_IRQ_PROLOG \
- outb(0, DMA1_RESET_REG); \
- outb(0, DMA2_RESET_REG); \
- outb(0, DMA1_CLR_MASK_REG); \
- outb(0, DMA2_CLR_MASK_REG)
-
-extern unsigned long _alpha_irq_masks[2];
-#define alpha_irq_mask _alpha_irq_masks[0]
-
-extern void common_ack_irq(unsigned long irq);
-extern void isa_device_interrupt(unsigned long vector, struct pt_regs * regs);
-extern void srm_device_interrupt(unsigned long vector, struct pt_regs * regs);
-
-extern void handle_irq(int irq, int ack, struct pt_regs * regs);
-
-#define RTC_IRQ 8
-#ifdef CONFIG_RTC
-#define TIMER_IRQ 0 /* timer is the pit */
-#else
-#define TIMER_IRQ RTC_IRQ /* timer is the rtc */
-#endif
-
-/*
- * PROBE_MASK is the bitset of irqs that we consider for autoprobing.
- */
-
-/* NOTE: we only handle the first 64 IRQs in this code. */
-
-/* The normal mask includes all the IRQs except timer IRQ 0. */
-#define _PROBE_MASK(nr_irqs) \
- (((nr_irqs > 63) ? ~0UL : ((1UL << (nr_irqs & 63)) - 1)) & ~1UL)
-
-/* Mask out unused timer irq 0 and RTC irq 8. */
-#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL)
-
-/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */
-#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL)
-
-/* Leave timer IRQ 0 in the mask. */
-#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL)
-
-/* Do not probe/enable beyond the PCI devices. */
-#define TSUNAMI_PROBE_MASK _PROBE_MASK(48)
-
-#if defined(CONFIG_ALPHA_GENERIC)
-# define PROBE_MASK alpha_mv.irq_probe_mask
-#elif defined(CONFIG_ALPHA_P2K)
-# define PROBE_MASK P2K_PROBE_MASK
-#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT)
-# define PROBE_MASK ALCOR_PROBE_MASK
-#elif defined(CONFIG_ALPHA_RUFFIAN)
-# define PROBE_MASK RUFFIAN_PROBE_MASK
-#elif defined(CONFIG_ALPHA_DP264)
-# define PROBE_MASK TSUNAMI_PROBE_MASK
-#else
-# define PROBE_MASK _PROBE_MASK(NR_IRQS)
-#endif
-
-
-extern char _stext;
-static inline void alpha_do_profile (unsigned long pc)
-{
- if (prof_buffer && current->pid) {
- pc -= (unsigned long) &_stext;
- pc >>= prof_shift;
- /*
- * Don't ignore out-of-bounds PC values silently,
- * put them into the last histogram slot, so if
- * present, they will show up as a sharp peak.
- */
- if (pc > prof_len - 1)
- pc = prof_len - 1;
- atomic_inc((atomic_t *)&prof_buffer[pc]);
- }
-}
diff -urN 2.3.30pre6/arch/alpha/kernel/pci.c a/arch/alpha/kernel/pci.c
--- 2.3.30pre6/arch/alpha/kernel/pci.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/pci.c Sun Dec 5 15:23:32 1999
@@ -57,11 +57,32 @@
dev->class = PCI_CLASS_BRIDGE_ISA;
}
+static void __init
+quirk_vga_enable_rom(struct pci_dev *dev)
+{
+ /* If it's a VGA, enable its BIOS ROM at C0000.
+ But if its a Cirrus 543x/544x DISABLE it, since
+ enabling ROM disables the memory... */
+ if ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA &&
+ /* But if its a Cirrus 543x/544x DISABLE it */
+ (dev->vendor != PCI_VENDOR_ID_CIRRUS ||
+ (dev->device < 0x00a0) || (dev->device > 0x00ac)))
+ {
+ u32 reg;
+
+ pci_read_config_dword(dev, dev->rom_base_reg, ®);
+ reg |= PCI_ROM_ADDRESS_ENABLE;
+ pci_write_config_dword(dev, dev->rom_base_reg, reg);
+ dev->resource[PCI_ROM_RESOURCE].flags |= PCI_ROM_ADDRESS_ENABLE;
+ }
+}
+
struct pci_fixup pcibios_fixups[] __initdata = {
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375,
quirk_eisa_bridge },
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378,
quirk_isa_bridge },
+ { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, quirk_vga_enable_rom },
{ 0 }
};
@@ -71,7 +92,7 @@
#define MB (1024*KB)
#define GB (1024*MB)
-void __init
+void
pcibios_align_resource(void *data, struct resource *res, unsigned long size)
{
struct pci_dev * dev = data;
@@ -145,13 +166,13 @@
static void __init
pcibios_assign_special(struct pci_dev * dev)
{
+ int i;
+
/* The first three resources of an IDE controler are often magic,
so leave them unchanged. This is true, for instance, of the
Contaq 82C693 as seen on SX164 and DP264. */
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE) {
- int i;
-
/* Resource 1 of IDE controller is the address of HD_CMD
register which actually occupies a single byte (0x3f6
for ide0) in reported 0x3f4-3f7 range. We have to fix
@@ -163,6 +184,16 @@
if (dev->resource[i].flags && dev->resource[i].start)
pci_claim_resource(dev, i);
}
+ /*
+ * We don't have code that will init the CYPRESS bridge correctly
+ * so we do the next best thing, and depend on the previous
+ * console code to do the right thing, and ignore it here... :-\
+ */
+ else if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
+ dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
+ for (i = 0; i < PCI_NUM_RESOURCES; i++)
+ if (dev->resource[i].flags && dev->resource[i].start)
+ pci_claim_resource(dev, i);
}
@@ -285,6 +316,31 @@
}
void __init
+pcibios_fixup_irqs(void)
+{
+ struct pci_dev *dev;
+ for (dev = pci_devices; dev; dev = dev->next)
+ {
+ if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) &&
+ (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA))
+ continue;
+
+ /*
+ * We don't have code that will init the CYPRESS bridge
+ * correctly so we do the next best thing, and depend on
+ * the previous console code to do the right thing, and
+ * ignore it here... :-\
+ */
+ if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
+ dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
+ continue;
+
+ pdev_fixup_irq(dev,
+ alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+ }
+}
+
+void __init
common_init_pci(void)
{
struct pci_controler *hose;
@@ -303,7 +359,7 @@
pci_assign_unassigned_resources(alpha_mv.min_io_address,
alpha_mv.min_mem_address);
- pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq);
+ pcibios_fixup_irqs();
pci_set_bus_ranges();
}
diff -urN 2.3.30pre6/arch/alpha/kernel/smp.c a/arch/alpha/kernel/smp.c
--- 2.3.30pre6/arch/alpha/kernel/smp.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/smp.c Sun Dec 5 15:31:24 1999
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
+#include <linux/irq.h>
#include <asm/hwrpb.h>
#include <asm/ptrace.h>
@@ -32,7 +33,6 @@
#include <asm/unistd.h>
#include "proto.h"
-#include "irq_impl.h"
#define DEBUG_SMP 0
@@ -47,8 +47,8 @@
/* A collection of single bit ipi messages. */
static struct {
- unsigned long bits __cacheline_aligned;
-} ipi_data[NR_CPUS];
+ unsigned long bits ____cacheline_aligned;
+} ipi_data[NR_CPUS] __cacheline_aligned;
enum ipi_message_type {
IPI_RESCHEDULE,
@@ -56,7 +56,7 @@
IPI_CPU_STOP,
};
-spinlock_t kernel_flag __cacheline_aligned = SPIN_LOCK_UNLOCKED;
+spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;
/* Set to a secondary's cpuid when it comes online. */
static unsigned long smp_secondary_alive;
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_alcor.c a/arch/alpha/kernel/sys_alcor.c
--- 2.3.30pre6/arch/alpha/kernel/sys_alcor.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_alcor.c Sun Dec 5 15:20:06 1999
@@ -27,7 +27,7 @@
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_cabriolet.c
a/arch/alpha/kernel/sys_cabriolet.c
--- 2.3.30pre6/arch/alpha/kernel/sys_cabriolet.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_cabriolet.c Sun Dec 5 15:44:02 1999
@@ -31,7 +31,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -298,7 +298,6 @@
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: cabriolet_map_irq,
pci_swizzle: common_swizzle,
};
@@ -327,7 +326,6 @@
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: cabriolet_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: eb66p_map_irq,
pci_swizzle: common_swizzle,
};
@@ -356,7 +354,6 @@
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
@@ -385,7 +382,6 @@
init_irq: cabriolet_init_irq,
init_pit: common_init_pit,
init_pci: alphapc164_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: alphapc164_map_irq,
pci_swizzle: common_swizzle,
};
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_dp264.c a/arch/alpha/kernel/sys_dp264.c
--- 2.3.30pre6/arch/alpha/kernel/sys_dp264.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_dp264.c Sun Dec 5 15:32:25 1999
@@ -27,7 +27,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -39,28 +39,30 @@
static void
dp264_update_irq_hw(unsigned long irq, unsigned long mask, int unmask_p)
{
- if (irq >= 16) {
- volatile unsigned long *csr;
+ volatile unsigned long *csr;
- if (TSUNAMI_bootcpu < 2)
- if (!TSUNAMI_bootcpu)
- csr = &TSUNAMI_cchip->dim0.csr;
- else
- csr = &TSUNAMI_cchip->dim1.csr;
+ if (TSUNAMI_bootcpu < 2) {
+ if (!TSUNAMI_bootcpu)
+ csr = &TSUNAMI_cchip->dim0.csr;
else
- if (TSUNAMI_bootcpu == 2)
- csr = &TSUNAMI_cchip->dim2.csr;
- else
- csr = &TSUNAMI_cchip->dim3.csr;
-
- *csr = ~mask;
- mb();
- *csr;
+ csr = &TSUNAMI_cchip->dim1.csr;
+ } else {
+ if (TSUNAMI_bootcpu == 2)
+ csr = &TSUNAMI_cchip->dim2.csr;
+ else
+ csr = &TSUNAMI_cchip->dim3.csr;
+ }
+
+ *csr = ~mask;
+ mb();
+ *csr;
+
+ if (irq < 16) {
+ if (irq >= 8)
+ outb(mask >> 8, 0xA1); /* ISA PIC2 */
+ else
+ outb(mask, 0x21); /* ISA PIC1 */
}
- else if (irq >= 8)
- outb(mask >> 8, 0xA1); /* ISA PIC2 */
- else
- outb(mask, 0x21); /* ISA PIC1 */
}
static void
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_eb64p.c a/arch/alpha/kernel/sys_eb64p.c
--- 2.3.30pre6/arch/alpha/kernel/sys_eb64p.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_eb64p.c Sun Dec 5 15:43:49 1999
@@ -28,7 +28,7 @@
#include <asm/core_lca.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -212,7 +212,6 @@
init_irq: eb64p_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: eb64p_map_irq,
pci_swizzle: common_swizzle,
};
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_eiger.c a/arch/alpha/kernel/sys_eiger.c
--- 2.3.30pre6/arch/alpha/kernel/sys_eiger.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_eiger.c Sun Dec 5 15:20:06 1999
@@ -29,7 +29,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_jensen.c a/arch/alpha/kernel/sys_jensen.c
--- 2.3.30pre6/arch/alpha/kernel/sys_jensen.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_jensen.c Sun Dec 5 15:20:06 1999
@@ -28,7 +28,7 @@
#include <asm/pgtable.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_miata.c a/arch/alpha/kernel/sys_miata.c
--- 2.3.30pre6/arch/alpha/kernel/sys_miata.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_miata.c Sun Dec 5 15:20:06 1999
@@ -25,7 +25,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_mikasa.c a/arch/alpha/kernel/sys_mikasa.c
--- 2.3.30pre6/arch/alpha/kernel/sys_mikasa.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_mikasa.c Sun Dec 5 15:44:15 1999
@@ -28,7 +28,7 @@
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -223,7 +223,6 @@
init_irq: mikasa_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: mikasa_map_irq,
pci_swizzle: common_swizzle,
};
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_nautilus.c
a/arch/alpha/kernel/sys_nautilus.c
--- 2.3.30pre6/arch/alpha/kernel/sys_nautilus.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_nautilus.c Sun Dec 5 15:20:06 1999
@@ -45,7 +45,7 @@
#include <asm/hwrpb.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_noritake.c
a/arch/alpha/kernel/sys_noritake.c
--- 2.3.30pre6/arch/alpha/kernel/sys_noritake.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_noritake.c Sun Dec 5 15:44:28 1999
@@ -29,7 +29,7 @@
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -283,7 +283,6 @@
init_irq: noritake_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noritake_map_irq,
pci_swizzle: noritake_swizzle,
};
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_rawhide.c a/arch/alpha/kernel/sys_rawhide.c
--- 2.3.30pre6/arch/alpha/kernel/sys_rawhide.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_rawhide.c Sun Dec 5 15:20:06 1999
@@ -25,7 +25,7 @@
#include <asm/core_mcpcia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_ruffian.c a/arch/alpha/kernel/sys_ruffian.c
--- 2.3.30pre6/arch/alpha/kernel/sys_ruffian.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_ruffian.c Sun Dec 5 15:20:06 1999
@@ -26,7 +26,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_rx164.c a/arch/alpha/kernel/sys_rx164.c
--- 2.3.30pre6/arch/alpha/kernel/sys_rx164.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_rx164.c Sun Dec 5 15:20:06 1999
@@ -26,7 +26,7 @@
#include <asm/core_polaris.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_sable.c a/arch/alpha/kernel/sys_sable.c
--- 2.3.30pre6/arch/alpha/kernel/sys_sable.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_sable.c Sun Dec 5 15:44:40 1999
@@ -26,7 +26,7 @@
#include <asm/core_t2.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -283,7 +283,6 @@
init_irq: sable_init_irq,
init_pit: common_init_pit,
init_pci: common_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: sable_map_irq,
pci_swizzle: common_swizzle,
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_sio.c a/arch/alpha/kernel/sys_sio.c
--- 2.3.30pre6/arch/alpha/kernel/sys_sio.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_sio.c Sun Dec 5 15:44:54 1999
@@ -30,7 +30,7 @@
#include <asm/core_lca.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
@@ -359,7 +359,6 @@
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
@@ -392,7 +391,6 @@
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
@@ -434,7 +432,6 @@
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: p2k_map_irq,
pci_swizzle: common_swizzle,
@@ -467,7 +464,6 @@
init_irq: sio_init_irq,
init_pit: common_init_pit,
init_pci: noname_init_pci,
- kill_arch: common_kill_arch,
pci_map_irq: noname_map_irq,
pci_swizzle: common_swizzle,
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_sx164.c a/arch/alpha/kernel/sys_sx164.c
--- 2.3.30pre6/arch/alpha/kernel/sys_sx164.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_sx164.c Sun Dec 5 15:20:06 1999
@@ -26,7 +26,7 @@
#include <asm/core_pyxis.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/sys_takara.c a/arch/alpha/kernel/sys_takara.c
--- 2.3.30pre6/arch/alpha/kernel/sys_takara.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/sys_takara.c Sun Dec 5 15:20:06 1999
@@ -25,7 +25,7 @@
#include <asm/core_cia.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
#include "pci_impl.h"
#include "machvec_impl.h"
diff -urN 2.3.30pre6/arch/alpha/kernel/time.c a/arch/alpha/kernel/time.c
--- 2.3.30pre6/arch/alpha/kernel/time.c Sat Dec 4 04:45:46 1999
+++ a/arch/alpha/kernel/time.c Sun Dec 5 15:20:06 1999
@@ -40,7 +40,7 @@
#include <linux/timex.h>
#include "proto.h"
-#include "irq_impl.h"
+#include <asm/hw_irq.h>
extern rwlock_t xtime_lock;
extern volatile unsigned long lost_ticks; /* kernel/sched.c */
diff -urN 2.3.30pre6/drivers/net/rrunner.c a/drivers/net/rrunner.c
--- 2.3.30pre6/drivers/net/rrunner.c Sun Nov 21 03:20:18 1999
+++ a/drivers/net/rrunner.c Sun Dec 5 15:20:07 1999
@@ -32,10 +32,10 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/mm.h>
+#include <linux/cache.h>
#include <net/sock.h>
#include <asm/system.h>
-#include <asm/cache.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
diff -urN 2.3.30pre6/drivers/pci/setup.c a/drivers/pci/setup.c
--- 2.3.30pre6/drivers/pci/setup.c Sat Dec 4 04:45:47 1999
+++ a/drivers/pci/setup.c Sun Dec 5 15:20:08 1999
@@ -16,8 +16,7 @@
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/ioport.h>
-
-#include <asm/cache.h>
+#include <linux/cache.h>
#define DEBUG_CONFIG 0
@@ -271,7 +270,7 @@
pbus_set_ranges(bus, NULL);
}
-static void
+void __init
pdev_fixup_irq(struct pci_dev *dev,
u8 (*swizzle)(struct pci_dev *, u8 *),
int (*map_irq)(struct pci_dev *, u8, u8))
diff -urN 2.3.30pre6/include/asm-alpha/cache.h a/include/asm-alpha/cache.h
--- 2.3.30pre6/include/asm-alpha/cache.h Tue Sep 14 14:33:21 1999
+++ a/include/asm-alpha/cache.h Sun Dec 5 15:20:08 1999
@@ -10,6 +10,4 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-
#endif
diff -urN 2.3.30pre6/include/asm-alpha/hardirq.h a/include/asm-alpha/hardirq.h
--- 2.3.30pre6/include/asm-alpha/hardirq.h Thu Dec 2 03:08:05 1999
+++ a/include/asm-alpha/hardirq.h Sun Dec 5 15:36:33 1999
@@ -28,8 +28,8 @@
#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
#define hardirq_endlock(cpu) ((void) 0)
-#define hardirq_enter(cpu, irq) (local_irq_count(cpu)++)
-#define hardirq_exit(cpu, irq) (local_irq_count(cpu)--)
+#define irq_enter(cpu, irq) (local_irq_count(cpu)++)
+#define irq_exit(cpu, irq) (local_irq_count(cpu)--)
#define synchronize_irq() barrier()
@@ -52,13 +52,16 @@
}
}
-static inline void hardirq_enter(int cpu, int irq)
+static inline void irq_enter(int cpu, int irq)
{
++local_irq_count(cpu);
atomic_inc(&global_irq_count);
+
+ while (spin_is_locked(&global_irq_lock))
+ barrier();
}
-static inline void hardirq_exit(int cpu, int irq)
+static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count(cpu);
@@ -66,11 +69,10 @@
static inline int hardirq_trylock(int cpu)
{
- return (!atomic_read(&global_irq_count)
- && !spin_is_locked(&global_irq_lock));
+ return !local_irq_count(cpu) && !spin_is_locked(&global_irq_lock);
}
-#define hardirq_endlock(cpu) ((void)0)
+#define hardirq_endlock(cpu) do { } while (0)
extern void synchronize_irq(void);
diff -urN 2.3.30pre6/include/asm-alpha/hw_irq.h a/include/asm-alpha/hw_irq.h
--- 2.3.30pre6/include/asm-alpha/hw_irq.h Thu Jan 1 01:00:00 1970
+++ a/include/asm-alpha/hw_irq.h Sun Dec 5 15:38:27 1999
@@ -0,0 +1,91 @@
+#ifndef _ALPHA_HW_IRQ_H
+#define _ALPHA_HW_IRQ_H
+/*
+ * linux/arch/alpha/kernel/irq.h
+ *
+ * Copyright (C) 1995 Linus Torvalds
+ * Copyright (C) 1998 Richard Henderson
+ *
+ * This file contains declarations and inline functions for interfacing
+ * with the IRQ handling routines in irq.c.
+ */
+
+#include <linux/config.h>
+
+#define STANDARD_INIT_IRQ_PROLOG \
+ outb(0, DMA1_RESET_REG); \
+ outb(0, DMA2_RESET_REG); \
+ outb(0, DMA1_CLR_MASK_REG); \
+ outb(0, DMA2_CLR_MASK_REG)
+
+extern unsigned long _alpha_irq_masks[2];
+#define alpha_irq_mask _alpha_irq_masks[0]
+
+extern void common_ack_irq(unsigned long irq);
+extern void isa_device_interrupt(unsigned long vector, struct pt_regs * regs);
+extern void srm_device_interrupt(unsigned long vector, struct pt_regs * regs);
+
+extern void handle_irq(int irq, int ack, struct pt_regs * regs);
+
+#define RTC_IRQ 8
+#ifdef CONFIG_RTC
+#define TIMER_IRQ 0 /* timer is the pit */
+#else
+#define TIMER_IRQ RTC_IRQ /* timer is the rtc */
+#endif
+
+/*
+ * PROBE_MASK is the bitset of irqs that we consider for autoprobing.
+ */
+
+/* NOTE: we only handle the first 64 IRQs in this code. */
+
+/* The normal mask includes all the IRQs except timer IRQ 0. */
+#define _PROBE_MASK(nr_irqs) \
+ (((nr_irqs > 63) ? ~0UL : ((1UL << (nr_irqs & 63)) - 1)) & ~1UL)
+
+/* Mask out unused timer irq 0 and RTC irq 8. */
+#define P2K_PROBE_MASK (_PROBE_MASK(16) & ~0x101UL)
+
+/* Mask out unused timer irq 0, "irqs" 20-30, and the EISA cascade. */
+#define ALCOR_PROBE_MASK (_PROBE_MASK(48) & ~0xfff000000001UL)
+
+/* Leave timer IRQ 0 in the mask. */
+#define RUFFIAN_PROBE_MASK (_PROBE_MASK(48) | 1UL)
+
+/* Do not probe/enable beyond the PCI devices. */
+#define TSUNAMI_PROBE_MASK _PROBE_MASK(48)
+
+#if defined(CONFIG_ALPHA_GENERIC)
+# define PROBE_MASK alpha_mv.irq_probe_mask
+#elif defined(CONFIG_ALPHA_P2K)
+# define PROBE_MASK P2K_PROBE_MASK
+#elif defined(CONFIG_ALPHA_ALCOR) || defined(CONFIG_ALPHA_XLT)
+# define PROBE_MASK ALCOR_PROBE_MASK
+#elif defined(CONFIG_ALPHA_RUFFIAN)
+# define PROBE_MASK RUFFIAN_PROBE_MASK
+#elif defined(CONFIG_ALPHA_DP264)
+# define PROBE_MASK TSUNAMI_PROBE_MASK
+#else
+# define PROBE_MASK _PROBE_MASK(NR_IRQS)
+#endif
+
+
+extern char _stext;
+static inline void alpha_do_profile (unsigned long pc)
+{
+ if (prof_buffer && current->pid) {
+ pc -= (unsigned long) &_stext;
+ pc >>= prof_shift;
+ /*
+ * Don't ignore out-of-bounds PC values silently,
+ * put them into the last histogram slot, so if
+ * present, they will show up as a sharp peak.
+ */
+ if (pc > prof_len - 1)
+ pc = prof_len - 1;
+ atomic_inc((atomic_t *)&prof_buffer[pc]);
+ }
+}
+
+#endif
diff -urN 2.3.30pre6/include/asm-alpha/irq.h a/include/asm-alpha/irq.h
--- 2.3.30pre6/include/asm-alpha/irq.h Sat Dec 4 04:45:47 1999
+++ a/include/asm-alpha/irq.h Sun Dec 5 15:36:33 1999
@@ -67,9 +67,6 @@
extern void disable_irq_nosync(unsigned int);
extern void enable_irq(unsigned int);
-extern void irq_enter(int cpu, int irq);
-extern void irq_exit(int cpu, int irq);
-
struct pt_regs;
extern void (*perf_irq)(unsigned long, struct pt_regs *);
diff -urN 2.3.30pre6/include/asm-i386/cache.h a/include/asm-i386/cache.h
--- 2.3.30pre6/include/asm-i386/cache.h Tue Sep 14 14:33:21 1999
+++ a/include/asm-i386/cache.h Sun Dec 5 15:20:10 1999
@@ -11,16 +11,4 @@
#define L1_CACHE_BYTES 16
#endif
-#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
-
-#define SMP_CACHE_BYTES L1_CACHE_BYTES
-
-#ifdef MODULE
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-#else
-#define __cacheline_aligned \
- __attribute__((__aligned__(L1_CACHE_BYTES), \
- __section__(".data.cacheline_aligned")))
-#endif
-
#endif
diff -urN 2.3.30pre6/include/asm-i386/hardirq.h a/include/asm-i386/hardirq.h
--- 2.3.30pre6/include/asm-i386/hardirq.h Sat Dec 4 18:18:08 1999
+++ a/include/asm-i386/hardirq.h Sun Dec 5 15:20:10 1999
@@ -17,8 +17,8 @@
#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
#define hardirq_endlock(cpu) do { } while (0)
-#define hardirq_enter(cpu) (local_irq_count[cpu]++)
-#define hardirq_exit(cpu) (local_irq_count[cpu]--)
+#define irq_enter(cpu, irq) (local_irq_count[cpu]++)
+#define irq_exit(cpu, irq) (local_irq_count[cpu]--)
#define synchronize_irq() barrier()
@@ -39,13 +39,17 @@
}
}
-static inline void hardirq_enter(int cpu)
+static inline void irq_enter(int cpu, int irq)
{
++local_irq_count[cpu];
atomic_inc(&global_irq_count);
+
+ while (test_bit(0,&global_irq_lock)) {
+ /* nothing */;
+ }
}
-static inline void hardirq_exit(int cpu)
+static inline void irq_exit(int cpu, int irq)
{
atomic_dec(&global_irq_count);
--local_irq_count[cpu];
diff -urN 2.3.30pre6/include/linux/bootmem.h a/include/linux/bootmem.h
--- 2.3.30pre6/include/linux/bootmem.h Sat Dec 4 04:45:48 1999
+++ a/include/linux/bootmem.h Sun Dec 5 15:36:53 1999
@@ -3,7 +3,7 @@
#include <asm/pgtable.h>
#include <asm/dma.h>
-#include <asm/cache.h>
+#include <linux/cache.h>
#include <linux/init.h>
/*
diff -urN 2.3.30pre6/include/linux/cache.h a/include/linux/cache.h
--- 2.3.30pre6/include/linux/cache.h Thu Jan 1 01:00:00 1970
+++ a/include/linux/cache.h Sun Dec 5 15:20:10 1999
@@ -0,0 +1,28 @@
+#ifndef __LINUX_CACHE_H
+#define __LINUX_CACHE_H
+
+#include <asm/cache.h>
+
+#ifndef L1_CACHE_ALIGN
+#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+#endif
+
+#ifndef SMP_CACHE_BYTES
+#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#endif
+
+#ifndef ____cacheline_aligned
+#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
+#endif
+
+#ifndef __cacheline_aligned
+#ifdef MODULE
+#define __cacheline_aligned ____cacheline_aligned
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(SMP_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+#endif /* __cacheline_aligned */
+
+#endif /* __LINUX_CACHE_H */
diff -urN 2.3.30pre6/include/linux/fs.h a/include/linux/fs.h
--- 2.3.30pre6/include/linux/fs.h Sat Dec 4 04:45:48 1999
+++ a/include/linux/fs.h Sun Dec 5 15:36:33 1999
@@ -18,10 +18,10 @@
#include <linux/list.h>
#include <linux/dcache.h>
#include <linux/stat.h>
+#include <linux/cache.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
-#include <asm/cache.h>
struct poll_table_struct;
diff -urN 2.3.30pre6/include/linux/irq.h a/include/linux/irq.h
--- 2.3.30pre6/include/linux/irq.h Sat Dec 4 18:20:27 1999
+++ a/include/linux/irq.h Sun Dec 5 15:38:41 1999
@@ -42,7 +42,7 @@
independent code */
struct irqaction *action; /* IRQ action list */
unsigned int depth; /* Disable depth for nested irq
disables */
-} irq_desc_t;
+} ____cacheline_aligned irq_desc_t;
#include <asm/hw_irq.h> /* the arch dependent stuff */
@@ -51,27 +51,6 @@
extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
extern spinlock_t irq_controller_lock;
extern int setup_irq(unsigned int , struct irqaction * );
-
-#ifdef __SMP__
-
-#include <asm/atomic.h>
-
-static inline void irq_enter(int cpu, unsigned int irq)
-{
- hardirq_enter(cpu);
- while (test_bit(0,&global_irq_lock)) {
- /* nothing */;
- }
-}
-
-static inline void irq_exit(int cpu, unsigned int irq)
-{
- hardirq_exit(cpu);
-}
-#else
-#define irq_enter(cpu, irq) (++local_irq_count[cpu])
-#define irq_exit(cpu, irq) (--local_irq_count[cpu])
-#endif
extern hw_irq_controller no_irq_type; /* needed in every arch ? */
diff -urN 2.3.30pre6/include/linux/pci.h a/include/linux/pci.h
--- 2.3.30pre6/include/linux/pci.h Sat Dec 4 04:45:48 1999
+++ a/include/linux/pci.h Sun Dec 5 15:36:33 1999
@@ -478,6 +478,8 @@
int pci_claim_resource(struct pci_dev *, int);
void pci_assign_unassigned_resources(u32 min_io, u32 min_mem);
void pci_set_bus_ranges(void);
+void pdev_fixup_irq(struct pci_dev *, u8 (*)(struct pci_dev *, u8 *),
+ int (*)(struct pci_dev *, u8, u8));
void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
int (*)(struct pci_dev *, u8, u8));
diff -urN 2.3.30pre6/include/linux/slab.h a/include/linux/slab.h
--- 2.3.30pre6/include/linux/slab.h Sat Dec 4 18:18:11 1999
+++ a/include/linux/slab.h Sun Dec 5 15:36:33 1999
@@ -12,7 +12,7 @@
typedef struct kmem_cache_s kmem_cache_t;
#include <linux/mm.h>
-#include <asm/cache.h>
+#include <linux/cache.h>
/* flags for kmem_cache_alloc() */
#define SLAB_BUFFER GFP_BUFFER
Andrea