32 #include <linux/kernel.h>
34 #include <linux/types.h>
35 #include <linux/pci.h>
40 #include <linux/time.h>
50 unsigned long bellbits;
63 rx_writel(dev, MUnit.ODR,DoorBellPrintfReady);
67 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdReady);
71 rx_writel(dev, MUnit.ODR,DoorBellAdapterNormRespReady);
75 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull);
78 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormCmdNotFull);
79 rx_writel(dev, MUnit.ODR, DoorBellAdapterNormRespNotFull);
86 static irqreturn_t aac_rx_intr_message(
int irq,
void *dev_id)
88 int isAif, isFastResponse, isSpecial;
92 Index =
rx_readl(dev, MUnit.OutboundQueue);
93 if (
likely(Index != 0xFFFFFFFFL)) {
95 isAif = isFastResponse = isSpecial = 0;
96 if (Index & 0x00000002L) {
98 if (Index == 0xFFFFFFFEL)
100 Index &= ~0x00000002
L;
102 if (Index & 0x00000001L)
109 isFastResponse,
NULL))) {
115 DoorBellAdapterNormRespReady);
118 Index =
rx_readl(dev, MUnit.OutboundQueue);
119 }
while (Index != 0xFFFFFFFFL);
130 static void aac_rx_disable_interrupt(
struct aac_dev *dev)
140 static void aac_rx_enable_interrupt_producer(
struct aac_dev *dev)
150 static void aac_rx_enable_interrupt_message(
struct aac_dev *dev)
265 static void aac_rx_interrupt_adapter(
struct aac_dev *dev)
267 rx_sync_cmd(dev,
BREAKPOINT_REQUEST, 0, 0, 0, 0, 0, 0,
NULL,
NULL,
NULL,
NULL,
NULL);
316 static void aac_rx_start_adapter(
struct aac_dev *dev)
334 static int aac_rx_check_health(
struct aac_dev *dev)
355 if (
likely((status & 0xFF000000L) == 0xBC000000L))
356 return (status >> 16) & 0xFF;
362 sizeof(
struct POSTSTATUS), &paddr);
375 if (
likely((buffer[0] ==
'0') && ((buffer[1] ==
'x') || (buffer[1] ==
'X')))) {
403 unsigned long qflags;
405 unsigned long nointr = 0;
412 spin_unlock_irqrestore(q->
lock, qflags);
425 static int aac_rx_deliver_message(
struct fib *
fib)
429 unsigned long qflags;
434 unsigned long count = 10000000
L;
437 spin_unlock_irqrestore(q->
lock, qflags);
439 Index =
rx_readl(dev, MUnit.InboundQueue);
441 Index =
rx_readl(dev, MUnit.InboundQueue);
442 if (
likely(Index != 0xFFFFFFFFL))
447 spin_unlock_irqrestore(q->
lock, qflags);
452 device = dev->
base + Index;
454 writel((
u32)(addr & 0xffffffff), device);
455 device +=
sizeof(
u32);
457 device +=
sizeof(
u32);
459 rx_writel(dev, MUnit.InboundQueue, Index);
481 static int aac_rx_restart_adapter(
struct aac_dev *dev,
int bled)
489 dev->
name, dev->
id, bled);
492 0, 0, 0, 0, 0, 0, &var,
NULL,
NULL,
NULL,
NULL);
493 if (!bled && (var != 0x00000001) && (var != 0x3803000F))
498 0, 0, 0, 0, 0, 0, &var,
NULL,
NULL,
NULL,
NULL);
503 if (bled || (var == 0x3803000F)) {
508 if (var != 0x00000001)
510 if (
rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC)
527 dev->
a_ops.adapter_enable_int = aac_rx_enable_interrupt_producer;
528 dev->
a_ops.adapter_intr = aac_rx_intr_producer;
532 dev->
a_ops.adapter_enable_int = aac_rx_enable_interrupt_message;
533 dev->
a_ops.adapter_intr = aac_rx_intr_message;
534 dev->
a_ops.adapter_deliver = aac_rx_deliver_message;
556 int instance = dev->
id;
565 dev->
a_ops.adapter_sync_cmd = rx_sync_cmd;
566 dev->
a_ops.adapter_enable_int = aac_rx_disable_interrupt;
569 !aac_rx_restart_adapter(dev, 0))
571 while ((++restart < 512) &&
572 (
rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL));
576 status =
rx_readl(dev, MUnit.OMRx[0]);
577 if (status & KERNEL_PANIC) {
578 if (aac_rx_restart_adapter(dev, aac_rx_check_health(dev)))
585 status =
rx_readl(dev, MUnit.OMRx[0]);
586 if (status & SELF_TEST_FAILED) {
604 (status & (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC))) ||
606 printk(
KERN_ERR "%s%d: adapter kernel failed to start, init status = %lx.\n",
607 dev->
name, instance, status);
611 ((status & (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC)) ||
613 ((startup_timeout > 60)
614 ? (startup_timeout - 60)
615 : (startup_timeout / 2))))) {
616 if (
likely(!aac_rx_restart_adapter(dev, aac_rx_check_health(dev))))
627 dev->
a_ops.adapter_interrupt = aac_rx_interrupt_adapter;
628 dev->
a_ops.adapter_disable_int = aac_rx_disable_interrupt;
629 dev->
a_ops.adapter_notify = aac_rx_notify_adapter;
630 dev->
a_ops.adapter_sync_cmd = rx_sync_cmd;
631 dev->
a_ops.adapter_check_health = aac_rx_check_health;
632 dev->
a_ops.adapter_restart = aac_rx_restart_adapter;
665 aac_rx_start_adapter(dev);
679 dev->
a_ops.adapter_ioremap = aac_rx_ioremap;