Exemplo n.º 1
0
static int
ndis_probe_pccard(device_t dev)
{
	struct drvdb_ent *db;
	struct driver_object *drv;

	drv = windrv_lookup(0, "PCCARD Bus");
	if (drv == NULL)
		return (ENXIO);

	db = windrv_match((matchfuncptr)ndis_devcompare_pccard, dev);
	if (db == NULL)
		return (ENXIO);
	return (windrv_create_pdo(drv, dev));
}
Exemplo n.º 2
0
static int
ndisusb_attach(device_t self)
{
	const struct drvdb_ent	*db;
	struct ndisusb_softc *dummy = device_get_softc(self);
	struct usb_attach_arg *uaa = device_get_ivars(self);
	struct ndis_softc	*sc;
	struct ndis_usb_type	*t;
	driver_object		*drv;
	int			devidx = 0;

	device_set_usb_desc(self);
	db = uaa->driver_ivar;
	sc = (struct ndis_softc *)dummy;
	sc->ndis_dev = self;
	mtx_init(&sc->ndisusb_mtx, "NDIS USB", MTX_NETWORK_LOCK, MTX_DEF);
	sc->ndis_dobj = db->windrv_object;
	sc->ndis_regvals = db->windrv_regvals;
	sc->ndis_iftype = PNPBus;
	sc->ndisusb_dev = uaa->device;

	/* Create PDO for this device instance */

	drv = windrv_lookup(0, "USB Bus");
	windrv_create_pdo(drv, self);

	/* Figure out exactly which device we matched. */

	t = db->windrv_devlist;

	while (t->ndis_name != NULL) {
		if ((uaa->info.idVendor == t->ndis_vid) &&
		    (uaa->info.idProduct == t->ndis_did)) {
			sc->ndis_devidx = devidx;
			break;
		}
		t++;
		devidx++;
	}

	if (ndis_attach(self) != 0)
		return (ENXIO);

	return (0);
}
Exemplo n.º 3
0
static int
ndisusb_match(device_t self)
{
	struct drvdb_ent *db;
	struct usb_attach_arg *uaa = device_get_ivars(self);

	if (windrv_lookup(0, "USB Bus") == NULL)
		return (UMATCH_NONE);

	if (uaa->iface != NULL)
		return (UMATCH_NONE);

	db = windrv_match((matchfuncptr)ndisusb_devcompare, self);
	if (db == NULL)
		return (UMATCH_NONE);

	return (UMATCH_VENDOR_PRODUCT);
}
Exemplo n.º 4
0
static int
ndis_probe_usb(device_t dev)
{
	struct usb_attach_arg *uaa;
	struct drvdb_ent *db;

	uaa = device_get_ivars(dev);
	if (uaa->usb_mode != USB_MODE_HOST ||
	    uaa->info.bConfigIndex != NDISUSB_CONFIG_NO ||
	    uaa->info.bIfaceIndex != NDISUSB_IFACE_INDEX ||
	    windrv_lookup(0, "USB Bus") == NULL)
		return (ENXIO);

	db = windrv_match((matchfuncptr)ndis_devcompare_usb, dev);
	if (db == NULL)
		return (ENXIO);
	uaa->driver_ivar = db;

	return (0);
}
Exemplo n.º 5
0
/*
 * Probe for an NDIS device. Check the PCI vendor and device
 * IDs against our list and return a device name if we find a match.
 */
static int
ndis_probe_pccard(device_t dev)
{
	driver_object		*drv;
	struct drvdb_ent	*db;

	drv = windrv_lookup(0, "PCCARD Bus");
	if (drv == NULL)
		return(ENXIO);

	db = windrv_match((matchfuncptr)ndis_devcompare, dev);

	if (db != NULL) {
		/* Create PDO for this device instance */
		windrv_create_pdo(drv, dev);
		return(0);
	}

	return(ENXIO);
}
Exemplo n.º 6
0
static int
ndis_attach_usb(device_t dev)
{
	const struct drvdb_ent *db;
	struct ndisusb_softc *dummy;
	struct usb_attach_arg *uaa;
	struct ndis_softc *sc;
	struct ndis_device_type *t;
	struct driver_object *drv;
	int devidx = 0;

	device_set_usb_desc(dev);
	dummy = device_get_softc(dev);
	uaa = device_get_ivars(dev);
	db = uaa->driver_ivar;
	sc = (struct ndis_softc *)dummy;
	sc->ndis_dev = dev;
	mtx_init(&sc->ndisusb_mtx, "NDIS USB", MTX_NETWORK_LOCK, MTX_DEF);
	sc->ndis_dobj = db->windrv_object;
	sc->ndis_regvals = db->windrv_regvals;
	sc->ndis_bus_type = NDIS_PNPBUS;
	sc->ndisusb_dev = uaa->device;

	drv = windrv_lookup(0, "USB Bus");
	windrv_create_pdo(drv, dev);

	/* Figure out exactly which device we matched. */
	for (t = db->windrv_devlist; t->name != NULL; t++, devidx++) {
		if ((uaa->info.idVendor == t->vendor) &&
		    (uaa->info.idProduct == t->device)) {
			sc->ndis_devidx = devidx;
			break;
		}
	}

	if (ndis_attach(dev) != 0)
		return (ENXIO);

	return (0);
}
Exemplo n.º 7
0
/*static*/ int
ndis_probe_pci(device_t parent, cfdata_t match, void *aux)
{
	struct pci_attach_args *pa = aux;
	int vendor  = PCI_VENDOR(pa->pa_id);
	int product = PCI_PRODUCT(pa->pa_id);
	
	struct ndis_pci_type *t = ndis_devs;
	driver_object        *drv = NULL;	/* = windrv_lookup(0, "PCI Bus");**/
		
#ifdef NDIS_DBG
	printf("in ndis_probe_pci\n");
	printf("vendor = %x, product = %x\n", vendor, product);
#endif
	
	while(t->ndis_name != NULL) {
#ifdef NDIS_DBG
			printf("t->ndis_vid = %x, t->ndis_did = %x\n",
			       t->ndis_vid, t->ndis_did);
#endif
		if((vendor  == t->ndis_vid) && (product == t->ndis_did)) {
#ifdef _MODULE	
			ndisdrv_modevent(NULL, MOD_LOAD);
			//kthread_create(load_ndisdrv, NULL);
#endif /* _MODULE */
				
			drv = windrv_lookup(0, "PCI Bus");
			printf("Matching vendor: %x, product: %x, name: %s\n", vendor, product, t->ndis_name);
			windrv_create_pdo(drv, parent);
			return 1;
		}
		t++;
	}
	
	return 0;  /* dosen't match */
}
Exemplo n.º 8
0
static int
ndisusb_attach(device_t self)
{
	struct drvdb_ent	*db;
	struct ndisusb_softc *dummy = device_get_softc(self);
	struct usb_attach_arg *uaa = device_get_ivars(self);
	struct ndis_softc	*sc;
	struct ndis_usb_type	*t;
	driver_object		*drv;
	int			devidx = 0;
	usbd_status		status;

	wlan_serialize_enter();
	sc = (struct ndis_softc *)dummy;

	if (uaa->device == NULL) {
		wlan_serialize_exit();
		return ENXIO;
	}

	db = windrv_match((matchfuncptr)ndisusb_devcompare, self);
	if (db == NULL) {
		wlan_serialize_exit();
		return (ENXIO);
	}

	sc->ndis_dev = self;
	sc->ndis_dobj = db->windrv_object;
	sc->ndis_regvals = db->windrv_regvals;
	sc->ndis_iftype = PNPBus;

	/* Create PDO for this device instance */

	drv = windrv_lookup(0, "USB Bus");
	windrv_create_pdo(drv, self);

	status = usbd_set_config_no(uaa->device, NDISUSB_CONFIG_NO, 0);
	if (status != USBD_NORMAL_COMPLETION) {
		device_printf(self, "setting config no failed\n");
		wlan_serialize_exit();
		return (ENXIO);
	}

	/* Figure out exactly which device we matched. */

	t = db->windrv_devlist;

	while (t->ndis_name != NULL) {
		if ((uaa->vendor == t->ndis_vid) &&
		    (uaa->product == t->ndis_did)) {
			sc->ndis_devidx = devidx;
			break;
		}
		t++;
		devidx++;
	}

	if (ndis_attach(self) != 0) {
		wlan_serialize_exit();
		return ENXIO;
	}

	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, uaa->device, self);

	wlan_serialize_exit();
	return 0;
}