An HP-UX 11.0 DLKM PCI interface device driver I have written does not
have its attach() routine called when it is loaded, not even when
ioscan is run. If I statically link the driver into the kernel, the
attach() is still not called. Below are stripped down versions of
the load() and attach() routines that I am using to track down the
problem (the stripped down versions don't work either). Although the
driver is intended to interact with PCI cards (MOD_WSIO_PCI is
specified in mod_wsio_attach_list_add()), these stripped down
versions will let me code MOD_WSIO_CORE at will, which I did as an
experiment. With MOD_WSIO_CORE, attach() IS called (but only when
ioscan is run), but when MOD_WSIO_PCI is coded, attach() is never
called. When I reboot the machine, enter the interactive boot-up
menu, and have it display various system info, the PCI card (an OHCI
USB host controller) shows up in the list of PCI cards. The box is a
32-bit B132L workstation. This is my first interface driver. My
only other driver (under HP-UX) has been a (successful) dynamically
loadable pseudo driver.

The msg_printf() output when MOD_WSIO_PCI is specified:
> Sep 10 21:47:32 devbox vmunix: mydriver_load: routine entered...
> Sep 10 21:47:32 devbox vmunix: mydriver_load: wsio_install_driver rc==1.
> Sep 10 21:47:32 devbox vmunix: mydriver_load: mod_wsio_attach_list_add rc == 0.
> Sep 10 21:48:01 devbox vmunix: mydriver_unload: entered...
> Sep 10 21:48:01 devbox vmunix: mydriver_unload: mod_wsio_attach_list_remove rc == 0.


The msg_printf() output when MOD_WSIO_CORE is specified:
> Sep 10 21:08:40 devbox vmunix: mydriver_load: routine entered...
> Sep 10 21:08:40 devbox vmunix: mydriver_load: wsio_install_driver rc==1.
> Sep 10 21:08:40 devbox vmunix: mydriver_load: mod_wsio_attach_list_add rc == 0.
> Sep 10 21:08:45 devbox vmunix: mydriver_attach: routine entered; id == 0x84.
> Sep 10 21:08:45 devbox vmunix: mydriver_unload: entered...
> Sep 10 21:08:45 devbox vmunix: mydriver_unload: mod_wsio_attach_list_remove rc == 0.


The load() and attach() routines:
/*---------------------------------------------------------------------*/
#define MOD_WSIO_CORE 0x1
#define MOD_WSIO_EISA 0x2
#define MOD_WSIO_PCI 0x4
int mydriver_load(arg)
void *arg;
{
int rc;

msg_printf("mydriver_load: routine entered...\n");
if (arg == NULL)
{
msg_printf("mydriver_load: ERROR --- arg is NULL.\n");
return(EINVAL);
}

mydriver_wsio_drv_info.drv_info = (drv_info_t *)arg;
rc = wsio_install_driver(&mydriver_wsio_drv_info);
msg_printf("mydriver_load: wsio_install_driver rc==%d.\n", rc);
if (rc == 0)
{
/* note that 0 means failure and 1 means success! */
return(ENXIO);
}

rc = mod_wsio_attach_list_add(MOD_WSIO_PCI, mydriver_attach);
msg_printf("mydriver_load: mod_wsio_attach_list_add rc == %d.\n",rc);

return(0);
}
/*---------------------------------------------------------------------*/
/* This stripped down version doesn't try to claim any
devices, it merely indicates if attach() was called. */
int mydriver_attach(id, isc)
unsigned int id;
struct isc_table_type *isc;
{
msg_printf("mydriver_attach: routine entered; id == 0x%x.\n", id);
return(0);
}
/*---------------------------------------------------------------------*/

Thanks for any information anyone can provide.

Mike