Beispiel #1
0
int ni52_probe(struct device *dev)
{
  int *port, ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0};
  int base_addr = dev->base_addr;

  if (base_addr > 0x1ff)		/* Check a single specified location. */
    if( (inb(base_addr+NI52_MAGIC1) == NI52_MAGICVAL1) &&
        (inb(base_addr+NI52_MAGIC2) == NI52_MAGICVAL2))
      return ni52_probe1(dev, base_addr);
  else if (base_addr > 0)		/* Don't probe at all. */
    return ENXIO;

  for (port = ports; *port; port++) {
    int ioaddr = *port;
    if (check_region(ioaddr, NI52_TOTAL_SIZE))
      continue;
    if( !(inb(ioaddr+NI52_MAGIC1) == NI52_MAGICVAL1) || 
        !(inb(ioaddr+NI52_MAGIC2) == NI52_MAGICVAL2))
      continue;

    dev->base_addr = ioaddr;
    if (ni52_probe1(dev, ioaddr) == 0)
      return 0;
  }

  dev->base_addr = base_addr;
  return ENODEV;
}
Beispiel #2
0
struct net_device * __init ni52_probe(int unit)
{
	struct net_device *dev = alloc_etherdev(sizeof(struct priv));
	static const int ports[] = {0x300, 0x280, 0x360, 0x320, 0x340, 0};
	const int *port;
	struct priv *p;
	int err = 0;

	if (!dev)
		return ERR_PTR(-ENOMEM);

	p = netdev_priv(dev);

	if (unit >= 0) {
		sprintf(dev->name, "eth%d", unit);
		netdev_boot_setup_check(dev);
		io = dev->base_addr;
		irq = dev->irq;
		memstart = dev->mem_start;
		memend = dev->mem_end;
	}

	if (io > 0x1ff)	{	/*                                    */
		err = ni52_probe1(dev, io);
	} else if (io > 0) {		/*                     */
		err = -ENXIO;
	} else {
		for (port = ports; *port && ni52_probe1(dev, *port) ; port++)
			;
		if (*port)
			goto got_it;
#ifdef FULL_IO_PROBE
		for (io = 0x200; io < 0x400 && ni52_probe1(dev, io); io += 8)
			;
		if (io < 0x400)
			goto got_it;
#endif
		err = -ENODEV;
	}
	if (err)
		goto out;
got_it:
	err = register_netdev(dev);
	if (err)
		goto out1;
	return dev;
out1:
	iounmap(p->mapped);
	release_region(dev->base_addr, NI52_TOTAL_SIZE);
out:
	free_netdev(dev);
	return ERR_PTR(err);
}
Beispiel #3
0
/**********************************************
 * probe the ni5210-card
 */
int __init ni52_probe(struct net_device *dev)
{
#ifndef MODULE
	int *port;
	static int ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0};
#endif
	int base_addr = dev->base_addr;

	SET_MODULE_OWNER(dev);

	if (base_addr > 0x1ff)		/* Check a single specified location. */
		return ni52_probe1(dev, base_addr);
	else if (base_addr > 0)		/* Don't probe at all. */
		return -ENXIO;

#ifdef MODULE
	printk("%s: no autoprobing allowed for modules.\n",dev->name);
#else
	for (port = ports; *port; port++) {
		int ioaddr = *port;
		dev->base_addr = ioaddr;
		if (ni52_probe1(dev, ioaddr) == 0)
			return 0;
	}

#ifdef FULL_IO_PROBE
	for(dev->base_addr=0x200; dev->base_addr<0x400; dev->base_addr+=8)
		if (ni52_probe1(dev, dev->base_addr) == 0)
			return 0;
#endif

#endif

	dev->base_addr = base_addr;
	return -ENODEV;
}