Hi all,

I have written a PCI-device driver according to the informations from
SUN's "Device Driver Tutorial" and "Writing Device Drivers". Everything
seems fine so far, except that I see calls to the function I specified
as "attach" entry point for instances that are not in the machine.

In my case I have one single PCIe adapter in the system:

# prtconf | grep 9902,101
             pci9902,101, instance #1 (driver not attached)

# add_drv -v -m '* 0666 root sys' -i \"pci9902,101\" dis_dx
exit status = 0
Driver (dis_dx) installed.

# prtconf -D | grep 9902,101
             pci9902,101, instance #1 (driver name: dis_dx)

Everything looks good, except that I see another (failing) call to
attach for instance #0 in the log files.

Oct 14 17:51:08 linden-5 dis_dx: [ID 950500 kern.notice] attaching
instance 1
[...]
Oct 14 17:51:08 linden-5 dis_dx: [ID 365881 kern.info] dx_attach
successful (driver instance 1 attached)
[...]
Oct 14 17:51:08 linden-5 dis_dx: [ID 950500 kern.notice] attaching
instance 0
[...]
Oct 14 17:51:08 linden-5 dis_dx: [ID 314806 kern.warning] WARNING:
_dx_interrupt_setup failed (ddi_intr_get_supported_types failed, rc = 1)
Oct 14 17:51:08 linden-5 dis_dx: [ID 128744 kern.warning] WARNING:
dx_attach failed (failed to setup interrupt, rc = 1)

As you can see there is a attach for instance #0 although there shows no
instance #0 up in prtconf.

I also played with dtrace but it only tells me that the successful
attach for instance #1 returns successful (return 0) before the attach
for instance #0 is executed (timestamp 1784202... < 1784207...).

-bash-3.2# ./tmp/add_drv_dx.d
dtrace: script './tmp/add_drv_dx.d' matched 2 probes
CPU     ID                    FUNCTION:NAME
   0  51191                  dx_attach:entry    17841985697735
               genunix`devi_attach+0x87
               genunix`attach_node+0x123
               genunix`i_ndi_config_node+0xe1
               genunix`i_ddi_attachchild+0x67
               genunix`devi_attach_node+0xfd
               genunix`config_immediate_children+0xf2
               genunix`devi_config_common+0x9f
               genunix`mt_config_thread+0x5c
               unix`thread_start+0x8

   0  51192                 dx_attach:return                 0
17842023752250
   2  51191                  dx_attach:entry    17842076118796
               genunix`devi_attach+0x87
               genunix`attach_node+0x123
               genunix`i_ndi_config_node+0xe1
               genunix`i_ddi_attachchild+0x67
               genunix`devi_attach_node+0xfd
               genunix`config_immediate_children+0xf2
               genunix`devi_config_common+0x9f
               genunix`mt_config_thread+0x5c
               unix`thread_start+0x8

   2  51192                 dx_attach:return                 1
17842076381481


And last but not least, in an other system with two instances (#0 and
#1) I have seen three calls to attach: one for #0, one for #1 and one
for the non-existent #3.

Can someone explain this behavior?

Regards,
Christian

-- 
Christian Kaiser, Software Engineer, Dolphin Interconnect Solutions
http//www.dolphinics.com


_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to