Garret:

This is a PCIe device. The inum field is set to 0 and the flags are set to DDI_INTR_ALLOC_NORMAL. Here is the snippet of code that handles allocating the interrupt:


   st = ddi_intr_get_supported_types(dip, &types);
   if (st != DDI_SUCCESS) {
       log_error("Failed to discover supported interrupt types\n");
       goto pflash_attach_fail;
   }

   if (types & DDI_INTR_TYPE_MSI) {
       intr_type = DDI_INTR_TYPE_MSI;
   } else if (types & DDI_INTR_TYPE_FIXED) {
       intr_type = DDI_INTR_TYPE_FIXED;
   }

   /* Allocte the interrupt resources */
   #define NINTR 1

   st = ddi_intr_get_nintrs(dip, intr_type, &nintrs);
   if ((st != DDI_SUCCESS) || (nintrs < NINTR)) {
       log_crit("ddi_intr_get_nintrs() failed\n");
       goto pflash_attach_fail;
   }

   st = ddi_intr_get_navail(dip, intr_type, &navail);
   if ((st != DDI_SUCCESS) || (navail < NINTR)) {
       log_crit("ddi_intr_get_navail() failed\n");
       goto pflash_attach_fail;
   }

   intrh = kmem_zalloc(sizeof(ddi_intr_handle_t), KM_SLEEP);
   st = ddi_intr_alloc(dip, intrh, intr_type, 0, NINTR, &actual,
                       DDI_INTR_ALLOC_NORMAL);
   if (st != DDI_SUCCESS) {
       log_crit("Failed allocating interrupt (st: %d)\n", st);
       goto pflash_attach_fail;
   }

Thanks,
Josh



Garrett D'Amore wrote:
Josh Morris wrote:
Hello,

I am working on porting our device driver from OpenSolaris to Solaris 10 (x86) and having a problem enabling MSI interrupts. The DDI interrupt functions tell me MSI is a supported type, that the number of interrupts for the device is 1, and that the number of interrupts available is 1. Despite this ddi_intr_alloc() returns DDI_INTR_NOTFOUND. The same system with OpenSolaris works fine with MSI interrupts. Does anyone have any idea as to why the DDI_INTR_NOTFOUND is being returned? For what it's worth something is using MSI in the system, so I'm not sure why my driver can't:

I'd need to see your code to help you further. Are you using what flags are you using with interrupt allocation? Is this a PCIe device, or legacy PCI? What value are you using for the "inum" field?

I recommend looking at the interrupt allocation code from another device, such as rge, to see example code that works well.

   - Garrett

# echo ::interrupts | mdb -k
IRQ  Vector IPL Bus   Type  CPU Share APIC/INT# ISR(s)
6    0x42   5   ISA   Fixed 3   1     0x0/0x6   fdc_intr
9    0x81   9   PCI   Fixed 1   1     0x0/0x9   acpi_wrapper_isr
14   0x41   5   ISA   Fixed 2   1     0x0/0xe   ata_intr
16   0x84   9   PCI   Fixed 2   1     0x0/0x10  uhci_intr
18 0x86 9 PCI Fixed 2 3 0x0/0x12 ata_intr, uhci_intr, ata_intr
19   0x85   9   PCI   Fixed 3   1     0x0/0x13  uhci_intr
23   0x83   9   PCI   Fixed 1   1     0x0/0x17  ehci_intr
69   0x60   6   PCI   Fixed 0   1     0x2/0x5   e1000g_intr
88   0x82   7         MSI   3   1     -         pepb_intr_handler
89   0x30   4         MSI   0   1     -         pepb_intr_handler
160  0xa0   0         IPI   ALL 0     -         poke_cpu
192  0xc0   13        IPI   ALL 1     -         xc_serv
208  0xd0   14        IPI   ALL 1     -         kcpc_hw_overflow_intr
209  0xd1   14        IPI   ALL 1     -         cbe_fire
210  0xd3   14        IPI   ALL 1     -         cbe_fire
240  0xe0   15        IPI   ALL 1     -         xc_serv
241  0xe1   15        IPI   ALL 1     -         apic_error_intr

Thanks,

Josh Morris
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss



_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to