fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / i386 / kernel / mca.c
index a03d368..b83672b 100644 (file)
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/mca.h>
+#include <linux/kprobes.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <linux/proc_fs.h>
 #include <linux/mman.h>
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/ioport.h>
 
 static unsigned char which_scsi = 0;
 
+int MCA_bus = 0;
+EXPORT_SYMBOL(MCA_bus);
+
 /*
  * Motherboard register spinlock. Untested on SMP at the moment, but
  * are there any MCA SMP boxes?
  *
  * Yes - Alan
  */
-spinlock_t mca_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(mca_lock);
 
 /* Build the status info for the adapter */
 
@@ -119,17 +122,17 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) {
 
 /*--------------------------------------------------------------------*/
 
-struct resource mca_standard_resources[] = {
-       { "system control port B (MCA)", 0x60, 0x60 },
-       { "arbitration (MCA)", 0x90, 0x90 },
-       { "card Select Feedback (MCA)", 0x91, 0x91 },
-       { "system Control port A (MCA)", 0x92, 0x92 },
-       { "system board setup (MCA)", 0x94, 0x94 },
-       { "POS (MCA)", 0x96, 0x97 },
-       { "POS (MCA)", 0x100, 0x107 }
+static struct resource mca_standard_resources[] = {
+       { .start = 0x60, .end = 0x60, .name = "system control port B (MCA)" },
+       { .start = 0x90, .end = 0x90, .name = "arbitration (MCA)" },
+       { .start = 0x91, .end = 0x91, .name = "card Select Feedback (MCA)" },
+       { .start = 0x92, .end = 0x92, .name = "system Control port A (MCA)" },
+       { .start = 0x94, .end = 0x94, .name = "system board setup (MCA)" },
+       { .start = 0x96, .end = 0x97, .name = "POS (MCA)" },
+       { .start = 0x100, .end = 0x107, .name = "POS (MCA)" }
 };
 
-#define MCA_STANDARD_RESOURCES (sizeof(mca_standard_resources)/sizeof(struct resource))
+#define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources)
 
 /**
  *     mca_read_and_store_pos - read the POS registers into a memory buffer
@@ -258,16 +261,16 @@ static int __init mca_init(void)
 
        /* Make sure the MCA bus is present */
 
-       if(!MCA_bus)
-               return -ENODEV;
-
-       printk(KERN_INFO "Micro Channel bus detected.\n");
-
-       if(mca_system_init()) {
+       if (mca_system_init()) {
                printk(KERN_ERR "MCA bus system initialisation failed\n");
                return -ENODEV;
        }
 
+       if (!MCA_bus)
+               return -ENODEV;
+
+       printk(KERN_INFO "Micro Channel bus detected.\n");
+
        /* All MCA systems have at least a primary bus */
        bus = mca_attach_bus(MCA_PRIMARY_BUS);
        if (!bus)
@@ -280,10 +283,9 @@ static int __init mca_init(void)
        bus->f.mca_transform_memory = mca_dummy_transform_memory;
 
        /* get the motherboard device */
-       mca_dev = kmalloc(sizeof(struct mca_device), GFP_KERNEL);
+       mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL);
        if(unlikely(!mca_dev))
                goto out_nomem;
-       memset(mca_dev, 0, sizeof(struct mca_device));
 
        /*
         * We do not expect many MCA interrupts during initialization,
@@ -307,11 +309,9 @@ static int __init mca_init(void)
        mca_dev->slot = MCA_MOTHERBOARD;
        mca_register_device(MCA_PRIMARY_BUS, mca_dev);
 
-       mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+       mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
        if(unlikely(!mca_dev))
                goto out_unlock_nomem;
-       memset(mca_dev, 0, sizeof(struct mca_device));
-
 
        /* Put motherboard into video setup mode, read integrated video
         * POS registers, and turn motherboard setup off.
@@ -346,10 +346,9 @@ static int __init mca_init(void)
        }
        if(which_scsi) {
                /* found a scsi card */
-               mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+               mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
                if(unlikely(!mca_dev))
                        goto out_unlock_nomem;
-               memset(mca_dev, 0, sizeof(struct mca_device));
 
                for(j = 0; j < 8; j++)
                        mca_dev->pos[j] = pos[j];
@@ -375,10 +374,9 @@ static int __init mca_init(void)
                if(!mca_read_and_store_pos(pos))
                        continue;
 
-               mca_dev = kmalloc(sizeof(struct mca_device), GFP_ATOMIC);
+               mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
                if(unlikely(!mca_dev))
                        goto out_unlock_nomem;
-               memset(mca_dev, 0, sizeof(struct mca_device));
 
                for(j=0; j<8; j++)
                        mca_dev->pos[j]=pos[j];
@@ -412,7 +410,8 @@ subsys_initcall(mca_init);
 
 /*--------------------------------------------------------------------*/
 
-static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
+static __kprobes void
+mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
 {
        int slot = mca_dev->slot;
 
@@ -442,7 +441,7 @@ static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
 
 /*--------------------------------------------------------------------*/
 
-static int mca_handle_nmi_callback(struct device *dev, void *data)
+static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
 {
        struct mca_device *mca_dev = to_mca_device(dev);
        unsigned char pos5;
@@ -460,7 +459,7 @@ static int mca_handle_nmi_callback(struct device *dev, void *data)
        return 0;
 }
 
-void mca_handle_nmi(void)
+void __kprobes mca_handle_nmi(void)
 {
        /* First try - scan the various adapters and see if a specific
         * adapter was responsible for the error.