/* IONetworkController methods. */ IOReturn NullEthernet::enable(IONetworkInterface *netif) { const IONetworkMedium *selectedMedium; IOReturn result = kIOReturnError; DebugLog("enable() ===>\n"); if (m_isEnabled) { DebugLog("Interface already enabled.\n"); result = kIOReturnSuccess; goto done; } selectedMedium = getSelectedMedium(); if (!selectedMedium) { DebugLog("No medium selected. Falling back to autonegotiation.\n"); selectedMedium = m_mediumTable[MEDIUM_INDEX_AUTO]; } selectMedium(selectedMedium); setLinkStatus(kIONetworkLinkValid); m_isEnabled = true; result = kIOReturnSuccess; DebugLog("enable() <===\n"); done: return result; }
K3bDevice::Device* K3bMediaSelectionDialog::selectMedium( int type, int state, QWidget* parent, const QString& title, const QString& text, bool* canceled ) { return selectMedium( type, state, K3bMedium::CONTENT_ALL, parent, title, text, canceled ); }
IOReturn AttansicL2Ethernet::enable(IONetworkInterface *netif) { DbgPrint("enable()\n"); u32 val; at_adapter *adapter=&adapter_; if (!adapter->pdev || (!adapter->pdev->isOpen () && (adapter->pdev->open(this)) == 0)) { DbgPrint( "failed to open PCI device.\n"); return kIOReturnError; } // hardware init if (at_init_hw(&adapter->hw)) { ErrPrint("Couldn't init hw\n"); //stop(provider); return kIOReturnError; } // hardware has been reset, we need to reload some things init_ring_ptrs(adapter); at_configure(adapter); //PHY medium selection const IONetworkMedium *medium = getSelectedMedium(); if (!medium) { DbgPrint("Selected medium is NULL, forcing to autonegotiation\n"); medium = mediumTable[MEDIUM_INDEX_AUTO]; } else { DbgPrint("Selected medium index %d\n", medium->getIndex()); } selectMedium(medium); transmitQueue_->setCapacity(kTransmitQueueCapacity); transmitQueue_->start(); // Enable interrupts. val = AT_READ_REG(&adapter->hw, REG_MASTER_CTRL); AT_WRITE_REG(&adapter->hw, REG_MASTER_CTRL, val|MASTER_CTRL_MANUAL_INT); at_irq_enable(adapter); return kIOReturnSuccess; }
IOReturn AgereET131x::enable(IONetworkInterface * netif) { //IOLog("AgereET131x::enable()\n"); if (pciDevice->open(this) == false) return kIOReturnError; /************************************************************************** Enable the Tx and Rx DMA engines (if not already enabled) *************************************************************************/ rx_dma_enable( ); tx_dma_enable(); /************************************************************************** Enable device interrupts *************************************************************************/ enable_interrupts(); MP_SET_FLAG( &adapter, fMP_ADAPTER_INTERRUPT_IN_USE ); /************************************************************************** We're ready to move some data, so start the queue *************************************************************************/ selectMedium(getSelectedMedium()); watchdogSource->setTimeoutMS(1000); transmitQueue->start(); workLoop->enableAllInterrupts(); enabledForNetif = true; return kIOReturnSuccess; }
bool RTL8139::enableAdapter( UInt32 level ) { UInt16 isr; bool success = false; ELG( 0, level, 'enbA', "RTL8139::enableAdapter - level" ); DEBUG_LOG( "enableAdapter() ===>\n" ); DEBUG_LOG( "enable level %ld\n", level); switch ( level ) { case kActivationLevel1: // Open our provider (IOPCIDevice): if ( (0 == pciNub) || (false == pciNub->open( this )) ) break; // Perform a full initialization sequence: if ( initAdapter( kFullInitialization ) != true ) break; // Program the physical layer / transceiver: if ( selectMedium( getSelectedMedium() ) != kIOReturnSuccess ) break; // Start the periodic timer: timerSrc->setTimeoutMS( kWatchdogTimerPeriod ); // ??? do this in Level 2??? // Unless we wait and ack PUN/LinkChg interrupts, the receiver // will not work. This creates a problem when DB_HALT debug // flag is set, since we will break into the debugger right // away after this function returns. But we won't be able to // attach since the receiver is deaf. I have no idea why this // workaround (discovered through experimentation) is needed. for ( int i = 0; i < 100; i++ ) { isr = csrRead16( RTL_ISR ); if ( isr & R_ISR_PUN ) { csrWrite16( RTL_ISR, R_ISR_PUN ); ELG( i, isr, 'enbA', "RTL8139::enableAdapter - cleared PUN interrupt" ); DEBUG_LOG( "cleared PUN interrupt %x in %d\n", isr, i ); break; } IOSleep( 10 ); }/* end FOR */ success = true; break; case kActivationLevel2: workLoop->enableAllInterrupts(); success = true; break; }/* end SWITCH */ if ( false == success ) IOLog( "enable level %u failed\n", (unsigned int)level ); DEBUG_LOG( "enableAdapter() <===\n" ); return success; }/* end enableAdapter */