Commit 881ad474 authored by Mark Haverkamp's avatar Mark Haverkamp Committed by James Bottomley

[PATCH] 2.6 aacraid: Interrupt function cleanup

This patch updates the adapter health check function and cleans up some
unused interrupt related functions and macros.
Signed-off-by: default avatarMark Haverkamp <markh@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 28d44db5
...@@ -421,8 +421,6 @@ struct adapter_ops ...@@ -421,8 +421,6 @@ struct adapter_ops
{ {
void (*adapter_interrupt)(struct aac_dev *dev); void (*adapter_interrupt)(struct aac_dev *dev);
void (*adapter_notify)(struct aac_dev *dev, u32 event); void (*adapter_notify)(struct aac_dev *dev, u32 event);
void (*adapter_enable_int)(struct aac_dev *dev, u32 event);
void (*adapter_disable_int)(struct aac_dev *dev, u32 event);
int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 *status); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 *status);
int (*adapter_check_health)(struct aac_dev *dev); int (*adapter_check_health)(struct aac_dev *dev);
}; };
...@@ -881,23 +879,12 @@ struct aac_dev ...@@ -881,23 +879,12 @@ struct aac_dev
u8 dac_support; u8 dac_support;
}; };
#define AllocateAndMapFibSpace(dev, MapFibContext) \
(dev)->a_ops.AllocateAndMapFibSpace(dev, MapFibContext)
#define UnmapAndFreeFibSpace(dev, MapFibContext) \
(dev)->a_ops.UnmapAndFreeFibSpace(dev, MapFibContext)
#define aac_adapter_interrupt(dev) \ #define aac_adapter_interrupt(dev) \
(dev)->a_ops.adapter_interrupt(dev) (dev)->a_ops.adapter_interrupt(dev)
#define aac_adapter_notify(dev, event) \ #define aac_adapter_notify(dev, event) \
(dev)->a_ops.adapter_notify(dev, event) (dev)->a_ops.adapter_notify(dev, event)
#define aac_adapter_enable_int(dev, event) \
(dev)->a_ops.adapter_enable_int(dev, event)
#define aac_adapter_disable_int(dev, event) \
dev->a_ops.adapter_disable_int(dev, event)
#define aac_adapter_check_health(dev) \ #define aac_adapter_check_health(dev) \
(dev)->a_ops.adapter_check_health(dev) (dev)->a_ops.adapter_check_health(dev)
......
...@@ -87,66 +87,6 @@ static irqreturn_t aac_rkt_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -87,66 +87,6 @@ static irqreturn_t aac_rkt_intr(int irq, void *dev_id, struct pt_regs *regs)
return IRQ_NONE; return IRQ_NONE;
} }
/**
* aac_rkt_enable_interrupt - Enable event reporting
* @dev: Adapter
* @event: Event to enable
*
* Enable event reporting from the i960 for a given event.
*/
static void aac_rkt_enable_interrupt(struct aac_dev * dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_1);
break;
case HostNormRespQue:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_2);
break;
case AdapNormCmdNotFull:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_3);
break;
case AdapNormRespNotFull:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_4);
break;
}
}
/**
* aac_rkt_disable_interrupt - Disable event reporting
* @dev: Adapter
* @event: Event to enable
*
* Disable event reporting from the i960 for a given event.
*/
static void aac_rkt_disable_interrupt(struct aac_dev *dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
dev->irq_mask |= (OUTBOUNDDOORBELL_1);
break;
case HostNormRespQue:
dev->irq_mask |= (OUTBOUNDDOORBELL_2);
break;
case AdapNormCmdNotFull:
dev->irq_mask |= (OUTBOUNDDOORBELL_3);
break;
case AdapNormRespNotFull:
dev->irq_mask |= (OUTBOUNDDOORBELL_4);
break;
}
}
/** /**
* rkt_sync_cmd - send a command and wait * rkt_sync_cmd - send a command and wait
* @dev: Adapter * @dev: Adapter
...@@ -180,7 +120,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status) ...@@ -180,7 +120,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status)
/* /*
* Disable doorbell interrupts * Disable doorbell interrupts
*/ */
rkt_writeb(dev, MUnit.OIMR, dev->OIMR |= 0x04); rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xff);
/* /*
* Force the completion of the mask register write before issuing * Force the completion of the mask register write before issuing
* the interrupt. * the interrupt.
...@@ -221,12 +161,13 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status) ...@@ -221,12 +161,13 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status)
/* /*
* Restore interrupt mask even though we timed out * Restore interrupt mask even though we timed out
*/ */
rkt_writeb(dev, MUnit.OIMR, dev->OIMR &= 0xfb); rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xfb);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
/* /*
* Pull the synch status from Mailbox 0. * Pull the synch status from Mailbox 0.
*/ */
if (status)
*status = le32_to_cpu(rkt_readl(dev, IndexRegs.Mailbox[0])); *status = le32_to_cpu(rkt_readl(dev, IndexRegs.Mailbox[0]));
/* /*
* Clear the synch command doorbell. * Clear the synch command doorbell.
...@@ -235,7 +176,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status) ...@@ -235,7 +176,7 @@ static int rkt_sync_cmd(struct aac_dev *dev, u32 command, u32 p1, u32 *status)
/* /*
* Restore interrupt mask * Restore interrupt mask
*/ */
rkt_writeb(dev, MUnit.OIMR, dev->OIMR &= 0xfb); rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xfb);
return 0; return 0;
} }
...@@ -334,7 +275,7 @@ static void aac_rkt_start_adapter(struct aac_dev *dev) ...@@ -334,7 +275,7 @@ static void aac_rkt_start_adapter(struct aac_dev *dev)
*/ */
static int aac_rkt_check_health(struct aac_dev *dev) static int aac_rkt_check_health(struct aac_dev *dev)
{ {
long status = rkt_readl(dev, IndexRegs.Mailbox[7]); u32 status = le32_to_cpu(rkt_readl(dev, MUnit.OMRx[0]));
/* /*
* Check to see if the board failed any self tests. * Check to see if the board failed any self tests.
...@@ -344,32 +285,40 @@ static int aac_rkt_check_health(struct aac_dev *dev) ...@@ -344,32 +285,40 @@ static int aac_rkt_check_health(struct aac_dev *dev)
/* /*
* Check to see if the board panic'd. * Check to see if the board panic'd.
*/ */
if (status & KERNEL_PANIC) if (status & KERNEL_PANIC) {
{ char * buffer;
char * buffer = kmalloc(512, GFP_KERNEL|__GFP_DMA);
struct POSTSTATUS { struct POSTSTATUS {
u32 Post_Command; u32 Post_Command;
u32 Post_Address; u32 Post_Address;
} * post = kmalloc(sizeof(struct POSTSTATUS), GFP_KERNEL); } * post;
dma_addr_t paddr = pci_map_single(dev->pdev, post, sizeof(struct POSTSTATUS), 2); dma_addr_t paddr, baddr;
dma_addr_t baddr = pci_map_single(dev->pdev, buffer, 512, 1); int ret;
u32 status = -1;
int ret = -2; if ((status & 0xFF000000L) == 0xBC000000L)
return (status >> 16) & 0xFF;
buffer = pci_alloc_consistent(dev->pdev, 512, &baddr);
ret = -2;
if (buffer == NULL)
return ret;
post = pci_alloc_consistent(dev->pdev,
sizeof(struct POSTSTATUS), &paddr);
if (post == NULL) {
pci_free_consistent(dev->pdev, 512, buffer, baddr);
return ret;
}
memset(buffer, 0, 512); memset(buffer, 0, 512);
post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS); post->Post_Command = cpu_to_le32(COMMAND_POST_RESULTS);
post->Post_Address = cpu_to_le32(baddr); post->Post_Address = cpu_to_le32(baddr);
rkt_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr)); rkt_writel(dev, MUnit.IMRx[0], cpu_to_le32(paddr));
rkt_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status); rkt_sync_cmd(dev, COMMAND_POST_RESULTS, baddr, &status);
pci_unmap_single(dev->pdev, paddr, sizeof(struct POSTSTATUS),2); pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS),
kfree(post); post, paddr);
if ((buffer[0] == '0') && (buffer[1] == 'x')) { if ((buffer[0] == '0') && (buffer[1] == 'x')) {
ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10);
ret <<= 4; ret <<= 4;
ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10);
} }
pci_unmap_single(dev->pdev, baddr, 512, 1); pci_free_consistent(dev->pdev, 512, buffer, baddr);
kfree(buffer);
return ret; return ret;
} }
/* /*
...@@ -455,8 +404,6 @@ int aac_rkt_init(struct aac_dev *dev) ...@@ -455,8 +404,6 @@ int aac_rkt_init(struct aac_dev *dev)
* Fill in the function dispatch table. * Fill in the function dispatch table.
*/ */
dev->a_ops.adapter_interrupt = aac_rkt_interrupt_adapter; dev->a_ops.adapter_interrupt = aac_rkt_interrupt_adapter;
dev->a_ops.adapter_enable_int = aac_rkt_enable_interrupt;
dev->a_ops.adapter_disable_int = aac_rkt_disable_interrupt;
dev->a_ops.adapter_notify = aac_rkt_notify_adapter; dev->a_ops.adapter_notify = aac_rkt_notify_adapter;
dev->a_ops.adapter_sync_cmd = rkt_sync_cmd; dev->a_ops.adapter_sync_cmd = rkt_sync_cmd;
dev->a_ops.adapter_check_health = aac_rkt_check_health; dev->a_ops.adapter_check_health = aac_rkt_check_health;
......
...@@ -87,66 +87,6 @@ static irqreturn_t aac_rx_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -87,66 +87,6 @@ static irqreturn_t aac_rx_intr(int irq, void *dev_id, struct pt_regs *regs)
return IRQ_NONE; return IRQ_NONE;
} }
/**
* aac_rx_enable_interrupt - Enable event reporting
* @dev: Adapter
* @event: Event to enable
*
* Enable event reporting from the i960 for a given event.
*/
static void aac_rx_enable_interrupt(struct aac_dev * dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_1);
break;
case HostNormRespQue:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_2);
break;
case AdapNormCmdNotFull:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_3);
break;
case AdapNormRespNotFull:
dev->irq_mask &= ~(OUTBOUNDDOORBELL_4);
break;
}
}
/**
* aac_rx_disable_interrupt - Disable event reporting
* @dev: Adapter
* @event: Event to enable
*
* Disable event reporting from the i960 for a given event.
*/
static void aac_rx_disable_interrupt(struct aac_dev *dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
dev->irq_mask |= (OUTBOUNDDOORBELL_1);
break;
case HostNormRespQue:
dev->irq_mask |= (OUTBOUNDDOORBELL_2);
break;
case AdapNormCmdNotFull:
dev->irq_mask |= (OUTBOUNDDOORBELL_3);
break;
case AdapNormRespNotFull:
dev->irq_mask |= (OUTBOUNDDOORBELL_4);
break;
}
}
/** /**
* rx_sync_cmd - send a command and wait * rx_sync_cmd - send a command and wait
* @dev: Adapter * @dev: Adapter
...@@ -454,8 +394,6 @@ int aac_rx_init(struct aac_dev *dev) ...@@ -454,8 +394,6 @@ int aac_rx_init(struct aac_dev *dev)
* Fill in the function dispatch table. * Fill in the function dispatch table.
*/ */
dev->a_ops.adapter_interrupt = aac_rx_interrupt_adapter; dev->a_ops.adapter_interrupt = aac_rx_interrupt_adapter;
dev->a_ops.adapter_enable_int = aac_rx_enable_interrupt;
dev->a_ops.adapter_disable_int = aac_rx_disable_interrupt;
dev->a_ops.adapter_notify = aac_rx_notify_adapter; dev->a_ops.adapter_notify = aac_rx_notify_adapter;
dev->a_ops.adapter_sync_cmd = rx_sync_cmd; dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
dev->a_ops.adapter_check_health = aac_rx_check_health; dev->a_ops.adapter_check_health = aac_rx_check_health;
......
...@@ -81,68 +81,6 @@ static irqreturn_t aac_sa_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -81,68 +81,6 @@ static irqreturn_t aac_sa_intr(int irq, void *dev_id, struct pt_regs *regs)
return IRQ_NONE; return IRQ_NONE;
} }
/**
* aac_sa_enable_interrupt - enable an interrupt event
* @dev: Which adapter to enable.
* @event: Which adapter event.
*
* This routine will enable the corresponding adapter event to cause an interrupt on
* the host.
*/
void aac_sa_enable_interrupt(struct aac_dev *dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, DOORBELL_1);
break;
case HostNormRespQue:
sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, DOORBELL_2);
break;
case AdapNormCmdNotFull:
sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, DOORBELL_3);
break;
case AdapNormRespNotFull:
sa_writew(dev, SaDbCSR.PRICLEARIRQMASK, DOORBELL_4);
break;
}
}
/**
* aac_sa_disable_interrupt - disable an interrupt event
* @dev: Which adapter to enable.
* @event: Which adapter event.
*
* This routine will enable the corresponding adapter event to cause an interrupt on
* the host.
*/
void aac_sa_disable_interrupt (struct aac_dev *dev, u32 event)
{
switch (event) {
case HostNormCmdQue:
sa_writew(dev, SaDbCSR.PRISETIRQMASK, DOORBELL_1);
break;
case HostNormRespQue:
sa_writew(dev, SaDbCSR.PRISETIRQMASK, DOORBELL_2);
break;
case AdapNormCmdNotFull:
sa_writew(dev, SaDbCSR.PRISETIRQMASK, DOORBELL_3);
break;
case AdapNormRespNotFull:
sa_writew(dev, SaDbCSR.PRISETIRQMASK, DOORBELL_4);
break;
}
}
/** /**
* aac_sa_notify_adapter - handle adapter notification * aac_sa_notify_adapter - handle adapter notification
* @dev: Adapter that notification is for * @dev: Adapter that notification is for
...@@ -401,8 +339,6 @@ int aac_sa_init(struct aac_dev *dev) ...@@ -401,8 +339,6 @@ int aac_sa_init(struct aac_dev *dev)
*/ */
dev->a_ops.adapter_interrupt = aac_sa_interrupt_adapter; dev->a_ops.adapter_interrupt = aac_sa_interrupt_adapter;
dev->a_ops.adapter_enable_int = aac_sa_enable_interrupt;
dev->a_ops.adapter_disable_int = aac_sa_disable_interrupt;
dev->a_ops.adapter_notify = aac_sa_notify_adapter; dev->a_ops.adapter_notify = aac_sa_notify_adapter;
dev->a_ops.adapter_sync_cmd = sa_sync_cmd; dev->a_ops.adapter_sync_cmd = sa_sync_cmd;
dev->a_ops.adapter_check_health = aac_sa_check_health; dev->a_ops.adapter_check_health = aac_sa_check_health;
......
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