fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / fc4 / soc.c
index 3f8b4c1..b09dfc7 100644 (file)
@@ -32,7 +32,7 @@ static char *version =
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/init.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/errno.h>
@@ -106,8 +106,8 @@ static void soc_reset(fc_channel *fc)
 static inline void soc_solicited (struct soc *s)
 {
        fc_hdr fchdr;
-       soc_rsp *hwrsp;
-       soc_cq *sw_cq;
+       soc_rsp __iomem *hwrsp;
+       soc_cq_rsp *sw_cq;
        int token;
        int status;
        fc_channel *fc;
@@ -115,12 +115,12 @@ static inline void soc_solicited (struct soc *s)
        sw_cq = &s->rsp[SOC_SOLICITED_RSP_Q];
 
        if (sw_cq->pool == NULL)
-               sw_cq->pool = (soc_req *)
+               sw_cq->pool = (soc_req __iomem *)
                        (s->xram + xram_get_32low ((xram_p)&sw_cq->hw_cq->address));
        sw_cq->in = xram_get_8 ((xram_p)&sw_cq->hw_cq->in);
        SOD (("soc_solicited, %d pkts arrived\n", (sw_cq->in-sw_cq->out) & sw_cq->last))
        for (;;) {
-               hwrsp = (soc_rsp *)sw_cq->pool + sw_cq->out;
+               hwrsp = (soc_rsp __iomem *)sw_cq->pool + sw_cq->out;
                token = xram_get_32low ((xram_p)&hwrsp->shdr.token);
                status = xram_get_32low ((xram_p)&hwrsp->status);
                fc = (fc_channel *)(&s->port[(token >> 11) & 1]);
@@ -185,8 +185,8 @@ static inline void soc_request (struct soc *s, u32 cmd)
 
 static inline void soc_unsolicited (struct soc *s)
 {
-       soc_rsp *hwrsp, *hwrspc;
-       soc_cq *sw_cq;
+       soc_rsp __iomem *hwrsp, *hwrspc;
+       soc_cq_rsp *sw_cq;
        int count;
        int status;
        int flags;
@@ -194,14 +194,14 @@ static inline void soc_unsolicited (struct soc *s)
 
        sw_cq = &s->rsp[SOC_UNSOLICITED_RSP_Q];
        if (sw_cq->pool == NULL)
-               sw_cq->pool = (soc_req *)
+               sw_cq->pool = (soc_req __iomem *)
                        (s->xram + (xram_get_32low ((xram_p)&sw_cq->hw_cq->address)));
 
        sw_cq->in = xram_get_8 ((xram_p)&sw_cq->hw_cq->in);
        SOD (("soc_unsolicited, %d packets arrived\n", (sw_cq->in - sw_cq->out) & sw_cq->last))
        while (sw_cq->in != sw_cq->out) {
                /* ...real work per entry here... */
-               hwrsp = (soc_rsp *)sw_cq->pool + sw_cq->out;
+               hwrsp = (soc_rsp __iomem *)sw_cq->pool + sw_cq->out;
 
                hwrspc = NULL;
                flags = xram_get_16 ((xram_p)&hwrsp->shdr.flags);
@@ -239,7 +239,7 @@ static inline void soc_unsolicited (struct soc *s)
                                        return;
                        }
                        if (sw_cq->out == sw_cq->last)
-                               hwrspc = (soc_rsp *)sw_cq->pool;
+                               hwrspc = (soc_rsp __iomem *)sw_cq->pool;
                        else
                                hwrspc = hwrsp + 1;
                }
@@ -334,7 +334,7 @@ update_out:
        }
 }
 
-static irqreturn_t soc_intr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t soc_intr(int irq, void *dev_id)
 {
        u32 cmd;
        unsigned long flags;
@@ -359,7 +359,7 @@ static int soc_hw_enque (fc_channel *fc, fcp_cmnd *fcmd)
        soc_port *port = (soc_port *)fc;
        struct soc *s = port->s;
        int qno;
-       soc_cq *sw_cq;
+       soc_cq_req *sw_cq;
        int cq_next_in;
        soc_req *request;
        fc_hdr *fch;
@@ -556,10 +556,9 @@ static inline void soc_init(struct sbus_dev *sdev, int no)
        int size, i;
        int irq;
        
-       s = kmalloc (sizeof (struct soc), GFP_KERNEL);
+       s = kzalloc (sizeof (struct soc), GFP_KERNEL);
        if (s == NULL)
                return;
-       memset (s, 0, sizeof(struct soc));
        spin_lock_init(&s->lock);
        s->soc_no = no;
 
@@ -638,13 +637,13 @@ static inline void soc_init(struct sbus_dev *sdev, int no)
        
        irq = sdev->irqs[0];
 
-       if (request_irq (irq, soc_intr, SA_SHIRQ, "SOC", (void *)s)) {
+       if (request_irq (irq, soc_intr, IRQF_SHARED, "SOC", (void *)s)) {
                soc_printk ("Cannot order irq %d to go\n", irq);
                socs = s->next;
                return;
        }
 
-       SOD(("SOC uses IRQ%s\n", __irq_itoa(irq)))
+       SOD(("SOC uses IRQ %d\n", irq))
        
        s->port[0].fc.irq = irq;
        s->port[1].fc.irq = irq;
@@ -671,10 +670,10 @@ static inline void soc_init(struct sbus_dev *sdev, int no)
        cq[0].address = s->req_dvma;
        s->req[1].pool = s->req[0].pool + SOC_CQ_REQ0_SIZE;
        
-       s->req[0].hw_cq = (soc_hw_cq *)(s->xram + SOC_CQ_REQ_OFFSET);
-       s->req[1].hw_cq = (soc_hw_cq *)(s->xram + SOC_CQ_REQ_OFFSET + sizeof(soc_hw_cq));
-       s->rsp[0].hw_cq = (soc_hw_cq *)(s->xram + SOC_CQ_RSP_OFFSET);
-       s->rsp[1].hw_cq = (soc_hw_cq *)(s->xram + SOC_CQ_RSP_OFFSET + sizeof(soc_hw_cq));
+       s->req[0].hw_cq = (soc_hw_cq __iomem *)(s->xram + SOC_CQ_REQ_OFFSET);
+       s->req[1].hw_cq = (soc_hw_cq __iomem *)(s->xram + SOC_CQ_REQ_OFFSET + sizeof(soc_hw_cq));
+       s->rsp[0].hw_cq = (soc_hw_cq __iomem *)(s->xram + SOC_CQ_RSP_OFFSET);
+       s->rsp[1].hw_cq = (soc_hw_cq __iomem *)(s->xram + SOC_CQ_RSP_OFFSET + sizeof(soc_hw_cq));
        
        cq[1].address = cq[0].address + (SOC_CQ_REQ0_SIZE * sizeof(soc_req));
        cq[4].address = 1;