io = rm.claimIOResource(owner, iobase, iolength);
io = claimPorts(rm, owner, iobase, iolength);
	public RTL8139Core(RTL8139Driver driver, ResourceOwner owner, PCIDevice device, Flags flags) throws DriverException, ResourceNotFreeException {		if (!(flags instanceof RTL8139Flags))			throw new DriverException("Wrong flags to the RTL8139 driver");		this.driver = driver;		this.flags = (RTL8139Flags) flags;		final int irq = getIRQ(device, this.flags);		// Get the start of the IO address space		this.iobase = getIOBase(device, this.flags);		final int iolength = getIOLength(device, this.flags);		//    log.debug("RTL8139 driver iobase "+iobase+" irq "+irq);		final ResourceManager rm;		try {			rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME);		} catch (NameNotFoundException ex) {			throw new DriverException("Cannot find ResourceManager");		}		this.irq = rm.claimIRQ(owner, irq, this, true);		try {			io = rm.claimIOResource(owner, iobase, iolength);		} catch (ResourceNotFreeException ex) {			this.irq.release();			throw ex;		}		this.rxRing = new RTL8139RxRing(RX_FRAMES, rm);		for (int i = 0; i < txBuffers.length; i++) {			txBuffers[i] = new RTL8139TxBuffer(rm);			setReg32(REG_TX_ADDR0 + (4 * i), Address.as32bit(txBuffers[i].getFirstDPDAddress()));		}		powerUpDevice();		reset();		byte[] adr1 = i2bsLoHi(getReg32(REG_MAC0));		byte[] adr2 = i2bsLoHi(getReg32(REG_MAC0 + 4));		final byte[] hwAddrArr = new byte[ETH_ALEN];		hwAddrArr[0] = adr1[0];		hwAddrArr[1] = adr1[1];		hwAddrArr[2] = adr1[2];		hwAddrArr[3] = adr1[3];		hwAddrArr[4] = adr2[0];		hwAddrArr[5] = adr2[1];		this.hwAddress = new EthernetAddress(hwAddrArr, 0);		// disable multicast		setReg32(REG_MAR0, 0);		setReg32(REG_MAR0 + 4, 0);		log.debug("Found " + flags.getName() + " IRQ=" + irq + ", IOBase=0x" + NumberUtils.hex(iobase) + ", MAC Address=" + hwAddress);	}