locking: Convert raw_rwlock functions to arch_rwlock
[safe/jmp/linux-2.6] / arch / alpha / kernel / sys_marvel.c
index 8047278..0bb3b5c 100644 (file)
@@ -22,6 +22,8 @@
 #include <asm/core_marvel.h>
 #include <asm/hwrpb.h>
 #include <asm/tlbflush.h>
+#include <asm/vga.h>
+#include <asm/rtc.h>
 
 #include "proto.h"
 #include "err_impl.h"
@@ -38,7 +40,7 @@
  * Interrupt handling.
  */
 static void 
-io7_device_interrupt(unsigned long vector, struct pt_regs * regs)
+io7_device_interrupt(unsigned long vector)
 {
        unsigned int pid;
        unsigned int irq;
@@ -64,7 +66,7 @@ io7_device_interrupt(unsigned long vector, struct pt_regs * regs)
        irq &= MARVEL_IRQ_VEC_IRQ_MASK;         /* not too many bits */
        irq |= pid << MARVEL_IRQ_VEC_PE_SHIFT;  /* merge the pid     */
 
-       handle_irq(irq, regs);
+       handle_irq(irq);
 }
 
 static volatile unsigned long *
@@ -79,7 +81,7 @@ io7_get_irq_ctl(unsigned int irq, struct io7 **pio7)
        if (!(io7 = marvel_find_io7(pid))) {
                printk(KERN_ERR 
                       "%s for nonexistent io7 -- vec %x, pid %d\n",
-                      __FUNCTION__, irq, pid);
+                      __func__, irq, pid);
                return NULL;
        }
 
@@ -89,7 +91,7 @@ io7_get_irq_ctl(unsigned int irq, struct io7 **pio7)
        if (irq >= 0x180) {
                printk(KERN_ERR 
                       "%s for invalid irq -- pid %d adjusted irq %x\n",
-                      __FUNCTION__, pid, irq);
+                      __func__, pid, irq);
                return NULL;
        }
 
@@ -109,8 +111,8 @@ io7_enable_irq(unsigned int irq)
 
        ctl = io7_get_irq_ctl(irq, &io7);
        if (!ctl || !io7) {
-               printk(KERN_ERR "%s: get_ctl failed for irq %x\n", 
-                      __FUNCTION__, irq);
+               printk(KERN_ERR "%s: get_ctl failed for irq %x\n",
+                      __func__, irq);
                return;
        }
                
@@ -129,8 +131,8 @@ io7_disable_irq(unsigned int irq)
 
        ctl = io7_get_irq_ctl(irq, &io7);
        if (!ctl || !io7) {
-               printk(KERN_ERR "%s: get_ctl failed for irq %x\n", 
-                      __FUNCTION__, irq);
+               printk(KERN_ERR "%s: get_ctl failed for irq %x\n",
+                      __func__, irq);
                return;
        }
                
@@ -167,8 +169,8 @@ marvel_irq_noop_return(unsigned int irq)
        return 0; 
 }
 
-static struct hw_interrupt_type marvel_legacy_irq_type = {
-       .typename       = "LEGACY",
+static struct irq_chip marvel_legacy_irq_type = {
+       .name           = "LEGACY",
        .startup        = marvel_irq_noop_return,
        .shutdown       = marvel_irq_noop,
        .enable         = marvel_irq_noop,
@@ -177,8 +179,8 @@ static struct hw_interrupt_type marvel_legacy_irq_type = {
        .end            = marvel_irq_noop,
 };
 
-static struct hw_interrupt_type io7_lsi_irq_type = {
-       .typename       = "LSI",
+static struct irq_chip io7_lsi_irq_type = {
+       .name           = "LSI",
        .startup        = io7_startup_irq,
        .shutdown       = io7_disable_irq,
        .enable         = io7_enable_irq,
@@ -187,8 +189,8 @@ static struct hw_interrupt_type io7_lsi_irq_type = {
        .end            = io7_end_irq,
 };
 
-static struct hw_interrupt_type io7_msi_irq_type = {
-       .typename       = "MSI",
+static struct irq_chip io7_msi_irq_type = {
+       .name           = "MSI",
        .startup        = io7_startup_irq,
        .shutdown       = io7_disable_irq,
        .enable         = io7_enable_irq,
@@ -271,8 +273,8 @@ init_one_io7_msi(struct io7 *io7, unsigned int which, unsigned int where)
 
 static void __init
 init_io7_irqs(struct io7 *io7, 
-             struct hw_interrupt_type *lsi_ops,
-             struct hw_interrupt_type *msi_ops)
+             struct irq_chip *lsi_ops,
+             struct irq_chip *msi_ops)
 {
        long base = (io7->pe << MARVEL_IRQ_VEC_PE_SHIFT) + 16;
        long i;
@@ -303,7 +305,7 @@ init_io7_irqs(struct io7 *io7,
        /* Set up the lsi irqs.  */
        for (i = 0; i < 128; ++i) {
                irq_desc[base + i].status = IRQ_DISABLED | IRQ_LEVEL;
-               irq_desc[base + i].handler = lsi_ops;
+               irq_desc[base + i].chip = lsi_ops;
        }
 
        /* Disable the implemented irqs in hardware.  */
@@ -317,7 +319,7 @@ init_io7_irqs(struct io7 *io7,
        /* Set up the msi irqs.  */
        for (i = 128; i < (128 + 512); ++i) {
                irq_desc[base + i].status = IRQ_DISABLED | IRQ_LEVEL;
-               irq_desc[base + i].handler = msi_ops;
+               irq_desc[base + i].chip = msi_ops;
        }
 
        for (i = 0; i < 16; ++i)
@@ -335,7 +337,7 @@ marvel_init_irq(void)
        /* Reserve the legacy irqs.  */
        for (i = 0; i < 16; ++i) {
                irq_desc[i].status = IRQ_DISABLED;
-               irq_desc[i].handler = &marvel_legacy_irq_type;
+               irq_desc[i].chip = &marvel_legacy_irq_type;
        }
 
        /* Init the io7 irqs.  */
@@ -373,12 +375,11 @@ marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
                irq += 0x80;                    /* offset for lsi       */
 
 #if 1
-               printk("PCI:%d:%d:%d (hose %d) [%s] is using MSI\n",
+               printk("PCI:%d:%d:%d (hose %d) is using MSI\n",
                       dev->bus->number, 
                       PCI_SLOT(dev->devfn), 
                       PCI_FUNC(dev->devfn),
-                      hose->index,
-                      pci_pretty_name (dev));
+                      hose->index);
                printk("  %d message(s) from 0x%04x\n", 
                       1 << ((msg_ctl & PCI_MSI_FLAGS_QSIZE) >> 4),
                       msg_dat);
@@ -413,22 +414,70 @@ marvel_init_pci(void)
 
        pci_probe_only = 1;
        common_init_pci();
-
-#ifdef CONFIG_VGA_HOSE
        locate_and_init_vga(NULL);
-#endif
 
        /* Clear any io7 errors.  */
        for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; ) 
                io7_clear_errors(io7);
 }
 
-static void
+static void __init
 marvel_init_rtc(void)
 {
        init_rtc_irq();
 }
 
+struct marvel_rtc_time {
+       struct rtc_time *time;
+       int retval;
+};
+
+#ifdef CONFIG_SMP
+static void
+smp_get_rtc_time(void *data)
+{
+       struct marvel_rtc_time *mrt = data;
+       mrt->retval = __get_rtc_time(mrt->time);
+}
+
+static void
+smp_set_rtc_time(void *data)
+{
+       struct marvel_rtc_time *mrt = data;
+       mrt->retval = __set_rtc_time(mrt->time);
+}
+#endif
+
+static unsigned int
+marvel_get_rtc_time(struct rtc_time *time)
+{
+#ifdef CONFIG_SMP
+       struct marvel_rtc_time mrt;
+
+       if (smp_processor_id() != boot_cpuid) {
+               mrt.time = time;
+               smp_call_function_single(boot_cpuid, smp_get_rtc_time, &mrt, 1);
+               return mrt.retval;
+       }
+#endif
+       return __get_rtc_time(time);
+}
+
+static int
+marvel_set_rtc_time(struct rtc_time *time)
+{
+#ifdef CONFIG_SMP
+       struct marvel_rtc_time mrt;
+
+       if (smp_processor_id() != boot_cpuid) {
+               mrt.time = time;
+               smp_call_function_single(boot_cpuid, smp_set_rtc_time, &mrt, 1);
+               return mrt.retval;
+       }
+#endif
+       return __set_rtc_time(time);
+}
+
 static void
 marvel_smp_callin(void)
 {
@@ -469,7 +518,9 @@ marvel_smp_callin(void)
 struct alpha_machine_vector marvel_ev7_mv __initmv = {
        .vector_name            = "MARVEL/EV7",
        DO_EV7_MMU,
-       DO_DEFAULT_RTC,
+       .rtc_port               = 0x70,
+       .rtc_get_time           = marvel_get_rtc_time,
+       .rtc_set_time           = marvel_set_rtc_time,
        DO_MARVEL_IO,
        .machine_check          = marvel_machine_check,
        .max_isa_dma_address    = ALPHA_MAX_ISA_DMA_ADDRESS,