|
|
#include <util/mod/moddefs.h>#define DRVNAME "e3B - 3Com EtherLink II series MDI driver" STATIC int e3B_load(), e3B_unload(), e3B_verify(); MOD_ACDRV_WRAPPER(e3B, e3B_load, e3B_unload, NULL, e3B_verify, DRVNAME);
STATIC int e3B_load() { int ret = 0;
if ((ret = e3Binit()) != 0) { e3Buninit(); } return(ret); }
STATIC int e3B_unload() { e3Buninit(); return(0); }
e3Buninit() { register int i;
for (i = 0; i < e3B_nunit && e3Bcookie; i++) { if ((caddr_t)e3Bcookie[i] != (caddr_t)NULL) cm_intr_detach(e3Bcookie[i]); if (e3Bdev[i].tid) { untimeout(e3Bdev[i].tid); /* cancel watchdog routine */ } } if (e3Bcookie) kmem_free((void *)e3Bcookie, (sizeof(void **) * e3B_nunit)); if (e3Bdev) kmem_free((void *)e3Bdev, (sizeof(struct e3Bdevice) * e3B_nunit)); }
DDI 7 MDI drivers must also call mdi_get_unit(D3mdi) from the _load( ) entry point routine to identify the driver instance that has been configured:
cm_args.cm_key = cm_getbrdkey("e3B", i);if (mdi_get_unit(cm_args.cm_key, &unit) == B_FALSE) { e3Bdev[i].unit = (uint_t) -1; continue; } e3Bdev[i].unit = unit;
For more examples, see HDK code samples in HDK code samples.