Lines Matching refs:dev
34 static int aac_src_get_sync_status(struct aac_dev *dev);
39 struct aac_dev *dev; in aac_src_intr_message() local
46 dev = ctx->dev; in aac_src_intr_message()
49 if (dev->msi_enabled) { in aac_src_intr_message()
52 bellbits = src_readl(dev, MUnit.ODR_MSI); in aac_src_intr_message()
60 bellbits = src_readl(dev, MUnit.ODR_R); in aac_src_intr_message()
63 src_writel(dev, MUnit.ODR_C, bellbits); in aac_src_intr_message()
64 src_readl(dev, MUnit.ODR_C); in aac_src_intr_message()
67 src_writel(dev, MUnit.ODR_C, bellbits); in aac_src_intr_message()
68 src_readl(dev, MUnit.ODR_C); in aac_src_intr_message()
83 if (!aac_sync_mode && !dev->msi_enabled) { in aac_src_intr_message()
84 src_writel(dev, MUnit.ODR_C, bellbits); in aac_src_intr_message()
85 src_readl(dev, MUnit.ODR_C); in aac_src_intr_message()
88 if (dev->sync_fib) { in aac_src_intr_message()
89 if (dev->sync_fib->callback) in aac_src_intr_message()
90 dev->sync_fib->callback(dev->sync_fib->callback_data, in aac_src_intr_message()
91 dev->sync_fib); in aac_src_intr_message()
92 spin_lock_irqsave(&dev->sync_fib->event_lock, sflags); in aac_src_intr_message()
93 if (dev->sync_fib->flags & FIB_CONTEXT_FLAG_WAIT) { in aac_src_intr_message()
94 dev->management_fib_count--; in aac_src_intr_message()
95 complete(&dev->sync_fib->event_wait); in aac_src_intr_message()
97 spin_unlock_irqrestore(&dev->sync_fib->event_lock, in aac_src_intr_message()
99 spin_lock_irqsave(&dev->sync_lock, sflags); in aac_src_intr_message()
100 if (!list_empty(&dev->sync_fib_list)) { in aac_src_intr_message()
101 entry = dev->sync_fib_list.next; in aac_src_intr_message()
102 dev->sync_fib = list_entry(entry, in aac_src_intr_message()
108 dev->sync_fib = NULL; in aac_src_intr_message()
110 spin_unlock_irqrestore(&dev->sync_lock, sflags); in aac_src_intr_message()
112 aac_adapter_sync_cmd(dev, SEND_SYNCHRONOUS_FIB, in aac_src_intr_message()
113 (u32)dev->sync_fib->hw_fib_pa, in aac_src_intr_message()
118 if (!dev->msi_enabled) in aac_src_intr_message()
125 if (dev->sa_firmware) { in aac_src_intr_message()
126 u32 events = src_readl(dev, MUnit.SCR0); in aac_src_intr_message()
128 aac_intr_normal(dev, events, 1, 0, NULL); in aac_src_intr_message()
129 writel(events, &dev->IndexRegs->Mailbox[0]); in aac_src_intr_message()
130 src_writel(dev, MUnit.IDR, 1 << 23); in aac_src_intr_message()
132 if (dev->aif_thread && dev->fsa_dev) in aac_src_intr_message()
133 aac_intr_normal(dev, 0, 2, 0, NULL); in aac_src_intr_message()
135 if (dev->msi_enabled) in aac_src_intr_message()
136 aac_src_access_devreg(dev, AAC_CLEAR_AIF_BIT); in aac_src_intr_message()
141 index = dev->host_rrq_idx[vector_no]; in aac_src_intr_message()
146 handle = le32_to_cpu((dev->host_rrq[index]) in aac_src_intr_message()
155 if (dev->msi_enabled && dev->max_msix > 1) in aac_src_intr_message()
156 atomic_dec(&dev->rrq_outstanding[vector_no]); in aac_src_intr_message()
157 aac_intr_normal(dev, handle, 0, isFastResponse, NULL); in aac_src_intr_message()
158 dev->host_rrq[index++] = 0; in aac_src_intr_message()
159 if (index == (vector_no + 1) * dev->vector_cap) in aac_src_intr_message()
160 index = vector_no * dev->vector_cap; in aac_src_intr_message()
161 dev->host_rrq_idx[vector_no] = index; in aac_src_intr_message()
174 static void aac_src_disable_interrupt(struct aac_dev *dev) in aac_src_disable_interrupt() argument
176 src_writel(dev, MUnit.OIMR, dev->OIMR = 0xffffffff); in aac_src_disable_interrupt()
184 static void aac_src_enable_interrupt_message(struct aac_dev *dev) in aac_src_enable_interrupt_message() argument
186 aac_src_access_devreg(dev, AAC_ENABLE_INTERRUPT); in aac_src_enable_interrupt_message()
209 static int src_sync_cmd(struct aac_dev *dev, u32 command, in src_sync_cmd() argument
220 writel(command, &dev->IndexRegs->Mailbox[0]); in src_sync_cmd()
224 writel(p1, &dev->IndexRegs->Mailbox[1]); in src_sync_cmd()
225 writel(p2, &dev->IndexRegs->Mailbox[2]); in src_sync_cmd()
226 writel(p3, &dev->IndexRegs->Mailbox[3]); in src_sync_cmd()
227 writel(p4, &dev->IndexRegs->Mailbox[4]); in src_sync_cmd()
232 if (!dev->msi_enabled) in src_sync_cmd()
233 src_writel(dev, in src_sync_cmd()
240 src_writel(dev, MUnit.OIMR, dev->OIMR = 0xffffffff); in src_sync_cmd()
246 src_readl(dev, MUnit.OIMR); in src_sync_cmd()
251 src_writel(dev, MUnit.IDR, INBOUNDDOORBELL_0 << SRC_IDR_SHIFT); in src_sync_cmd()
253 if ((!dev->sync_mode || command != SEND_SYNCHRONOUS_FIB) && in src_sync_cmd()
254 !dev->in_soft_reset) { in src_sync_cmd()
270 if (aac_src_get_sync_status(dev) & OUTBOUNDDOORBELL_0) { in src_sync_cmd()
274 if (dev->msi_enabled) in src_sync_cmd()
275 aac_src_access_devreg(dev, in src_sync_cmd()
278 src_writel(dev, in src_sync_cmd()
293 aac_adapter_enable_int(dev); in src_sync_cmd()
300 *status = readl(&dev->IndexRegs->Mailbox[0]); in src_sync_cmd()
302 *r1 = readl(&dev->IndexRegs->Mailbox[1]); in src_sync_cmd()
304 *r2 = readl(&dev->IndexRegs->Mailbox[2]); in src_sync_cmd()
306 *r3 = readl(&dev->IndexRegs->Mailbox[3]); in src_sync_cmd()
308 *r4 = readl(&dev->IndexRegs->Mailbox[4]); in src_sync_cmd()
310 dev->max_msix = in src_sync_cmd()
311 readl(&dev->IndexRegs->Mailbox[5]) & 0xFFFF; in src_sync_cmd()
315 if (!dev->msi_enabled) in src_sync_cmd()
316 src_writel(dev, in src_sync_cmd()
324 aac_adapter_enable_int(dev); in src_sync_cmd()
335 static void aac_src_interrupt_adapter(struct aac_dev *dev) in aac_src_interrupt_adapter() argument
337 src_sync_cmd(dev, BREAKPOINT_REQUEST, in aac_src_interrupt_adapter()
351 static void aac_src_notify_adapter(struct aac_dev *dev, u32 event) in aac_src_notify_adapter() argument
356 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
360 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
364 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
368 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
372 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
376 src_writel(dev, MUnit.ODR_C, in aac_src_notify_adapter()
392 static void aac_src_start_adapter(struct aac_dev *dev) in aac_src_start_adapter() argument
398 for (i = 0; i < dev->max_msix; i++) { in aac_src_start_adapter()
399 dev->host_rrq_idx[i] = i * dev->vector_cap; in aac_src_start_adapter()
400 atomic_set(&dev->rrq_outstanding[i], 0); in aac_src_start_adapter()
402 atomic_set(&dev->msix_counter, 0); in aac_src_start_adapter()
403 dev->fibs_pushed_no = 0; in aac_src_start_adapter()
405 init = dev->init; in aac_src_start_adapter()
406 if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) { in aac_src_start_adapter()
409 src_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, in aac_src_start_adapter()
410 lower_32_bits(dev->init_pa), in aac_src_start_adapter()
411 upper_32_bits(dev->init_pa), in aac_src_start_adapter()
419 src_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, in aac_src_start_adapter()
420 (u32)(ulong)dev->init_pa, 0, 0, 0, 0, 0, in aac_src_start_adapter()
433 static int aac_src_check_health(struct aac_dev *dev) in aac_src_check_health() argument
435 u32 status = src_readl(dev, MUnit.OMR); in aac_src_check_health()
472 static inline u32 aac_get_vector(struct aac_dev *dev) in aac_get_vector() argument
474 return atomic_inc_return(&dev->msix_counter)%dev->max_msix; in aac_get_vector()
485 struct aac_dev *dev = fib->dev; in aac_src_deliver_message() local
486 struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; in aac_src_deliver_message()
502 if (dev->msi_enabled && dev->max_msix > 1 && in aac_src_deliver_message()
505 if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) in aac_src_deliver_message()
506 && dev->sa_firmware) in aac_src_deliver_message()
507 vector_no = aac_get_vector(dev); in aac_src_deliver_message()
548 atomic_inc(&dev->rrq_outstanding[vector_no]); in aac_src_deliver_message()
557 src_writeq(dev, MUnit.IQN_L, (u64)address); in aac_src_deliver_message()
559 spin_lock_irqsave(&fib->dev->iq_lock, flags); in aac_src_deliver_message()
560 src_writel(dev, MUnit.IQN_H, in aac_src_deliver_message()
562 src_writel(dev, MUnit.IQN_L, address & 0xffffffff); in aac_src_deliver_message()
563 spin_unlock_irqrestore(&fib->dev->iq_lock, flags); in aac_src_deliver_message()
566 if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2 || in aac_src_deliver_message()
567 dev->comm_interface == AAC_COMM_MESSAGE_TYPE3) { in aac_src_deliver_message()
600 src_writeq(dev, MUnit.IQ_L, (u64)address); in aac_src_deliver_message()
602 spin_lock_irqsave(&fib->dev->iq_lock, flags); in aac_src_deliver_message()
603 src_writel(dev, MUnit.IQ_H, in aac_src_deliver_message()
605 src_writel(dev, MUnit.IQ_L, address & 0xffffffff); in aac_src_deliver_message()
606 spin_unlock_irqrestore(&fib->dev->iq_lock, flags); in aac_src_deliver_message()
618 static int aac_src_ioremap(struct aac_dev *dev, u32 size) in aac_src_ioremap() argument
621 iounmap(dev->regs.src.bar1); in aac_src_ioremap()
622 dev->regs.src.bar1 = NULL; in aac_src_ioremap()
623 iounmap(dev->regs.src.bar0); in aac_src_ioremap()
624 dev->base = dev->regs.src.bar0 = NULL; in aac_src_ioremap()
627 dev->regs.src.bar1 = ioremap(pci_resource_start(dev->pdev, 2), in aac_src_ioremap()
629 dev->base = NULL; in aac_src_ioremap()
630 if (dev->regs.src.bar1 == NULL) in aac_src_ioremap()
632 dev->base = dev->regs.src.bar0 = ioremap(dev->base_start, size); in aac_src_ioremap()
633 if (dev->base == NULL) { in aac_src_ioremap()
634 iounmap(dev->regs.src.bar1); in aac_src_ioremap()
635 dev->regs.src.bar1 = NULL; in aac_src_ioremap()
638 dev->IndexRegs = &((struct src_registers __iomem *) in aac_src_ioremap()
639 dev->base)->u.tupelo.IndexRegs; in aac_src_ioremap()
649 static int aac_srcv_ioremap(struct aac_dev *dev, u32 size) in aac_srcv_ioremap() argument
652 iounmap(dev->regs.src.bar0); in aac_srcv_ioremap()
653 dev->base = dev->regs.src.bar0 = NULL; in aac_srcv_ioremap()
657 dev->regs.src.bar1 = in aac_srcv_ioremap()
658 ioremap(pci_resource_start(dev->pdev, 2), AAC_MIN_SRCV_BAR1_SIZE); in aac_srcv_ioremap()
659 dev->base = NULL; in aac_srcv_ioremap()
660 if (dev->regs.src.bar1 == NULL) in aac_srcv_ioremap()
662 dev->base = dev->regs.src.bar0 = ioremap(dev->base_start, size); in aac_srcv_ioremap()
663 if (dev->base == NULL) { in aac_srcv_ioremap()
664 iounmap(dev->regs.src.bar1); in aac_srcv_ioremap()
665 dev->regs.src.bar1 = NULL; in aac_srcv_ioremap()
668 dev->IndexRegs = &((struct src_registers __iomem *) in aac_srcv_ioremap()
669 dev->base)->u.denali.IndexRegs; in aac_srcv_ioremap()
673 void aac_set_intx_mode(struct aac_dev *dev) in aac_set_intx_mode() argument
675 if (dev->msi_enabled) { in aac_set_intx_mode()
676 aac_src_access_devreg(dev, AAC_ENABLE_INTX); in aac_set_intx_mode()
677 dev->msi_enabled = 0; in aac_set_intx_mode()
682 static void aac_clear_omr(struct aac_dev *dev) in aac_clear_omr() argument
686 omr_value = src_readl(dev, MUnit.OMR); in aac_clear_omr()
697 src_writel(dev, MUnit.OMR, omr_value & AAC_INT_MODE_MSIX); in aac_clear_omr()
698 src_readl(dev, MUnit.OMR); in aac_clear_omr()
701 static void aac_dump_fw_fib_iop_reset(struct aac_dev *dev) in aac_dump_fw_fib_iop_reset() argument
708 supported_options3 = dev->supplement_adapter_info.supported_options3; in aac_dump_fw_fib_iop_reset()
712 aac_adapter_sync_cmd(dev, IOP_RESET_FW_FIB_DUMP, in aac_dump_fw_fib_iop_reset()
716 static bool aac_is_ctrl_up_and_running(struct aac_dev *dev) in aac_is_ctrl_up_and_running() argument
725 status = src_readl(dev, MUnit.OMR); in aac_is_ctrl_up_and_running()
747 static void aac_src_drop_io(struct aac_dev *dev) in aac_src_drop_io() argument
749 if (!dev->soft_reset_support) in aac_src_drop_io()
752 aac_adapter_sync_cmd(dev, DROP_IO, in aac_src_drop_io()
756 static void aac_notify_fw_of_iop_reset(struct aac_dev *dev) in aac_notify_fw_of_iop_reset() argument
758 aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 0, 0, 0, 0, 0, 0, NULL, in aac_notify_fw_of_iop_reset()
760 aac_src_drop_io(dev); in aac_notify_fw_of_iop_reset()
763 static void aac_send_iop_reset(struct aac_dev *dev) in aac_send_iop_reset() argument
765 aac_dump_fw_fib_iop_reset(dev); in aac_send_iop_reset()
767 aac_notify_fw_of_iop_reset(dev); in aac_send_iop_reset()
769 aac_set_intx_mode(dev); in aac_send_iop_reset()
771 aac_clear_omr(dev); in aac_send_iop_reset()
773 src_writel(dev, MUnit.IDR, IOP_SRC_RESET_MASK); in aac_send_iop_reset()
778 static void aac_send_hardware_soft_reset(struct aac_dev *dev) in aac_send_hardware_soft_reset() argument
782 aac_clear_omr(dev); in aac_send_hardware_soft_reset()
783 val = readl(((char *)(dev->base) + IBW_SWR_OFFSET)); in aac_send_hardware_soft_reset()
785 writel(val, ((char *)(dev->base) + IBW_SWR_OFFSET)); in aac_send_hardware_soft_reset()
789 static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) in aac_src_restart_adapter() argument
798 dev_err(&dev->pdev->dev, "adapter kernel panic'd %x.\n", bled); in aac_src_restart_adapter()
803 if (bled >= 2 && dev->sa_firmware && reset_type & HW_IOP_RESET) in aac_src_restart_adapter()
806 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; in aac_src_restart_adapter()
808 dev_err(&dev->pdev->dev, "Controller reset type is %d\n", reset_type); in aac_src_restart_adapter()
811 dev_info(&dev->pdev->dev, "Issuing IOP reset\n"); in aac_src_restart_adapter()
812 aac_send_iop_reset(dev); in aac_src_restart_adapter()
817 is_ctrl_up = aac_is_ctrl_up_and_running(dev); in aac_src_restart_adapter()
819 dev_err(&dev->pdev->dev, "IOP reset failed\n"); in aac_src_restart_adapter()
821 dev_info(&dev->pdev->dev, "IOP reset succeeded\n"); in aac_src_restart_adapter()
826 if (!dev->sa_firmware) { in aac_src_restart_adapter()
827 dev_err(&dev->pdev->dev, "ARC Reset attempt failed\n"); in aac_src_restart_adapter()
833 dev_info(&dev->pdev->dev, "Issuing SOFT reset\n"); in aac_src_restart_adapter()
834 aac_send_hardware_soft_reset(dev); in aac_src_restart_adapter()
835 dev->msi_enabled = 0; in aac_src_restart_adapter()
837 is_ctrl_up = aac_is_ctrl_up_and_running(dev); in aac_src_restart_adapter()
839 dev_err(&dev->pdev->dev, "SOFT reset failed\n"); in aac_src_restart_adapter()
843 dev_info(&dev->pdev->dev, "SOFT reset succeeded\n"); in aac_src_restart_adapter()
854 if (src_readl(dev, MUnit.OMR) & KERNEL_PANIC) in aac_src_restart_adapter()
864 static int aac_src_select_comm(struct aac_dev *dev, int comm) in aac_src_select_comm() argument
868 dev->a_ops.adapter_intr = aac_src_intr_message; in aac_src_select_comm()
869 dev->a_ops.adapter_deliver = aac_src_deliver_message; in aac_src_select_comm()
883 int aac_src_init(struct aac_dev *dev) in aac_src_init() argument
888 int instance = dev->id; in aac_src_init()
889 const char *name = dev->name; in aac_src_init()
891 dev->a_ops.adapter_ioremap = aac_src_ioremap; in aac_src_init()
892 dev->a_ops.adapter_comm = aac_src_select_comm; in aac_src_init()
894 dev->base_size = AAC_MIN_SRC_BAR0_SIZE; in aac_src_init()
895 if (aac_adapter_ioremap(dev, dev->base_size)) { in aac_src_init()
901 dev->a_ops.adapter_sync_cmd = src_sync_cmd; in aac_src_init()
902 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; in aac_src_init()
904 if (dev->init_reset) { in aac_src_init()
905 dev->init_reset = false; in aac_src_init()
906 if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) in aac_src_init()
913 status = src_readl(dev, MUnit.OMR); in aac_src_init()
915 if (aac_src_restart_adapter(dev, in aac_src_init()
916 aac_src_check_health(dev), IOP_HWSOFT_RESET)) in aac_src_init()
923 status = src_readl(dev, MUnit.OMR); in aac_src_init()
926 dev->name, instance); in aac_src_init()
934 dev->name, instance); in aac_src_init()
941 while (!((status = src_readl(dev, MUnit.OMR)) & in aac_src_init()
947 dev->name, instance, status); in aac_src_init()
956 if (likely(!aac_src_restart_adapter(dev, in aac_src_init()
957 aac_src_check_health(dev), IOP_HWSOFT_RESET))) in aac_src_init()
968 dev->a_ops.adapter_interrupt = aac_src_interrupt_adapter; in aac_src_init()
969 dev->a_ops.adapter_disable_int = aac_src_disable_interrupt; in aac_src_init()
970 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; in aac_src_init()
971 dev->a_ops.adapter_notify = aac_src_notify_adapter; in aac_src_init()
972 dev->a_ops.adapter_sync_cmd = src_sync_cmd; in aac_src_init()
973 dev->a_ops.adapter_check_health = aac_src_check_health; in aac_src_init()
974 dev->a_ops.adapter_restart = aac_src_restart_adapter; in aac_src_init()
975 dev->a_ops.adapter_start = aac_src_start_adapter; in aac_src_init()
981 aac_adapter_comm(dev, AAC_COMM_MESSAGE); in aac_src_init()
982 aac_adapter_disable_int(dev); in aac_src_init()
983 src_writel(dev, MUnit.ODR_C, 0xffffffff); in aac_src_init()
984 aac_adapter_enable_int(dev); in aac_src_init()
986 if (aac_init_adapter(dev) == NULL) in aac_src_init()
988 if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1) in aac_src_init()
991 dev->msi = !pci_enable_msi(dev->pdev); in aac_src_init()
993 dev->aac_msix[0].vector_no = 0; in aac_src_init()
994 dev->aac_msix[0].dev = dev; in aac_src_init()
996 if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, in aac_src_init()
997 IRQF_SHARED, "aacraid", &(dev->aac_msix[0])) < 0) { in aac_src_init()
999 if (dev->msi) in aac_src_init()
1000 pci_disable_msi(dev->pdev); in aac_src_init()
1006 dev->dbg_base = pci_resource_start(dev->pdev, 2); in aac_src_init()
1007 dev->dbg_base_mapped = dev->regs.src.bar1; in aac_src_init()
1008 dev->dbg_size = AAC_MIN_SRC_BAR1_SIZE; in aac_src_init()
1009 dev->a_ops.adapter_enable_int = aac_src_enable_interrupt_message; in aac_src_init()
1011 aac_adapter_enable_int(dev); in aac_src_init()
1013 if (!dev->sync_mode) { in aac_src_init()
1018 aac_src_start_adapter(dev); in aac_src_init()
1027 static int aac_src_wait_sync(struct aac_dev *dev, int *status) in aac_src_wait_sync() argument
1044 if (aac_src_get_sync_status(dev) & OUTBOUNDDOORBELL_0) { in aac_src_wait_sync()
1048 if (dev->msi_enabled) in aac_src_wait_sync()
1049 aac_src_access_devreg(dev, AAC_CLEAR_SYNC_BIT); in aac_src_wait_sync()
1051 src_writel(dev, MUnit.ODR_C, in aac_src_wait_sync()
1068 status[0] = readl(&dev->IndexRegs->Mailbox[0]); in aac_src_wait_sync()
1069 status[1] = readl(&dev->IndexRegs->Mailbox[1]); in aac_src_wait_sync()
1070 status[2] = readl(&dev->IndexRegs->Mailbox[2]); in aac_src_wait_sync()
1071 status[3] = readl(&dev->IndexRegs->Mailbox[3]); in aac_src_wait_sync()
1072 status[4] = readl(&dev->IndexRegs->Mailbox[4]); in aac_src_wait_sync()
1090 static int aac_src_soft_reset(struct aac_dev *dev) in aac_src_soft_reset() argument
1092 u32 status_omr = src_readl(dev, MUnit.OMR); in aac_src_soft_reset()
1114 dev->in_soft_reset = 1; in aac_src_soft_reset()
1115 dev->msi_enabled = status_omr & AAC_INT_MODE_MSIX; in aac_src_soft_reset()
1118 rc = aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, 0, 0, 0, in aac_src_soft_reset()
1124 if (aac_src_wait_sync(dev, status)) { in aac_src_soft_reset()
1138 dev->sa_firmware = 1; in aac_src_soft_reset()
1141 rc = aac_adapter_sync_cmd(dev, DROP_IO, 0, 0, 0, 0, 0, 0, in aac_src_soft_reset()
1148 if (aac_src_wait_sync(dev, status)) { in aac_src_soft_reset()
1154 dev_err(&dev->pdev->dev, "%s: %d outstanding I/O pending\n", in aac_src_soft_reset()
1158 rc = aac_src_check_health(dev); in aac_src_soft_reset()
1161 dev->in_soft_reset = 0; in aac_src_soft_reset()
1162 dev->msi_enabled = 0; in aac_src_soft_reset()
1164 dev_err(&dev->pdev->dev, "%s: %s status = %d", __func__, in aac_src_soft_reset()
1175 int aac_srcv_init(struct aac_dev *dev) in aac_srcv_init() argument
1180 int instance = dev->id; in aac_srcv_init()
1181 const char *name = dev->name; in aac_srcv_init()
1183 dev->a_ops.adapter_ioremap = aac_srcv_ioremap; in aac_srcv_init()
1184 dev->a_ops.adapter_comm = aac_src_select_comm; in aac_srcv_init()
1186 dev->base_size = AAC_MIN_SRCV_BAR0_SIZE; in aac_srcv_init()
1187 if (aac_adapter_ioremap(dev, dev->base_size)) { in aac_srcv_init()
1193 dev->a_ops.adapter_sync_cmd = src_sync_cmd; in aac_srcv_init()
1194 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; in aac_srcv_init()
1196 if (dev->init_reset) { in aac_srcv_init()
1197 dev->init_reset = false; in aac_srcv_init()
1198 if (aac_src_soft_reset(dev)) { in aac_srcv_init()
1199 aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET); in aac_srcv_init()
1208 status = src_readl(dev, MUnit.OMR); in aac_srcv_init()
1212 status = src_readl(dev, MUnit.OMR); in aac_srcv_init()
1215 dev->name, instance); in aac_srcv_init()
1229 status = src_readl(dev, MUnit.OMR); in aac_srcv_init()
1231 if (aac_src_restart_adapter(dev, in aac_srcv_init()
1232 aac_src_check_health(dev), IOP_HWSOFT_RESET)) in aac_srcv_init()
1239 status = src_readl(dev, MUnit.OMR); in aac_srcv_init()
1241 printk(KERN_ERR "%s%d: adapter self-test failed.\n", dev->name, instance); in aac_srcv_init()
1248 printk(KERN_ERR "%s%d: adapter monitor panic.\n", dev->name, instance); in aac_srcv_init()
1257 status = src_readl(dev, MUnit.OMR); in aac_srcv_init()
1265 dev->name, instance, status); in aac_srcv_init()
1274 if (likely(!aac_src_restart_adapter(dev, in aac_srcv_init()
1275 aac_src_check_health(dev), IOP_HWSOFT_RESET))) in aac_srcv_init()
1287 dev->a_ops.adapter_interrupt = aac_src_interrupt_adapter; in aac_srcv_init()
1288 dev->a_ops.adapter_disable_int = aac_src_disable_interrupt; in aac_srcv_init()
1289 dev->a_ops.adapter_enable_int = aac_src_disable_interrupt; in aac_srcv_init()
1290 dev->a_ops.adapter_notify = aac_src_notify_adapter; in aac_srcv_init()
1291 dev->a_ops.adapter_sync_cmd = src_sync_cmd; in aac_srcv_init()
1292 dev->a_ops.adapter_check_health = aac_src_check_health; in aac_srcv_init()
1293 dev->a_ops.adapter_restart = aac_src_restart_adapter; in aac_srcv_init()
1294 dev->a_ops.adapter_start = aac_src_start_adapter; in aac_srcv_init()
1300 aac_adapter_comm(dev, AAC_COMM_MESSAGE); in aac_srcv_init()
1301 aac_adapter_disable_int(dev); in aac_srcv_init()
1302 src_writel(dev, MUnit.ODR_C, 0xffffffff); in aac_srcv_init()
1303 aac_adapter_enable_int(dev); in aac_srcv_init()
1305 if (aac_init_adapter(dev) == NULL) in aac_srcv_init()
1307 if ((dev->comm_interface != AAC_COMM_MESSAGE_TYPE2) && in aac_srcv_init()
1308 (dev->comm_interface != AAC_COMM_MESSAGE_TYPE3)) in aac_srcv_init()
1310 if (dev->msi_enabled) in aac_srcv_init()
1311 aac_src_access_devreg(dev, AAC_ENABLE_MSIX); in aac_srcv_init()
1313 if (aac_acquire_irq(dev)) in aac_srcv_init()
1316 dev->dbg_base = pci_resource_start(dev->pdev, 2); in aac_srcv_init()
1317 dev->dbg_base_mapped = dev->regs.src.bar1; in aac_srcv_init()
1318 dev->dbg_size = AAC_MIN_SRCV_BAR1_SIZE; in aac_srcv_init()
1319 dev->a_ops.adapter_enable_int = aac_src_enable_interrupt_message; in aac_srcv_init()
1321 aac_adapter_enable_int(dev); in aac_srcv_init()
1323 if (!dev->sync_mode) { in aac_srcv_init()
1328 aac_src_start_adapter(dev); in aac_srcv_init()
1337 void aac_src_access_devreg(struct aac_dev *dev, int mode) in aac_src_access_devreg() argument
1343 src_writel(dev, in aac_src_access_devreg()
1345 dev->OIMR = (dev->msi_enabled ? in aac_src_access_devreg()
1351 src_writel(dev, in aac_src_access_devreg()
1353 dev->OIMR = AAC_INT_DISABLE_ALL); in aac_src_access_devreg()
1358 val = src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1360 src_writel(dev, MUnit.IDR, val); in aac_src_access_devreg()
1361 src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1364 src_writel(dev, MUnit.IOAR, val); in aac_src_access_devreg()
1365 val = src_readl(dev, MUnit.OIMR); in aac_src_access_devreg()
1366 src_writel(dev, in aac_src_access_devreg()
1373 val = src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1375 src_writel(dev, MUnit.IDR, val); in aac_src_access_devreg()
1376 src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1381 val = src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1383 src_writel(dev, MUnit.IDR, val); in aac_src_access_devreg()
1384 src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1389 val = src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1391 src_writel(dev, MUnit.IDR, val); in aac_src_access_devreg()
1392 src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1397 val = src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1399 src_writel(dev, MUnit.IDR, val); in aac_src_access_devreg()
1400 src_readl(dev, MUnit.IDR); in aac_src_access_devreg()
1403 src_writel(dev, MUnit.IOAR, val); in aac_src_access_devreg()
1404 src_readl(dev, MUnit.IOAR); in aac_src_access_devreg()
1405 val = src_readl(dev, MUnit.OIMR); in aac_src_access_devreg()
1406 src_writel(dev, MUnit.OIMR, in aac_src_access_devreg()
1415 static int aac_src_get_sync_status(struct aac_dev *dev) in aac_src_get_sync_status() argument
1420 msix_val = src_readl(dev, MUnit.ODR_MSI) & SRC_MSI_READ_MASK ? 1 : 0; in aac_src_get_sync_status()
1422 if (!dev->msi_enabled) { in aac_src_get_sync_status()
1429 legacy_val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT; in aac_src_get_sync_status()
1431 dev->msi_enabled = 1; in aac_src_get_sync_status()