Changeset 2ff9876 in mainline for uspace/drv/nic/rtl8169/driver.c


Ignore:
Timestamp:
2014-08-12T21:44:45Z (10 years ago)
Author:
Agnieszka Tabaka <nufcia@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aa2f865
Parents:
2f11e6c9
Message:

Added cleanup routine, added support for setting broadcast mode programmatically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/rtl8169/driver.c

    r2f11e6c9 r2ff9876  
    328328}
    329329
     330static void rtl8169_dev_cleanup(ddf_dev_t *dev)
     331{
     332        assert(dev);
     333
     334        if (ddf_dev_data_get(dev))
     335                nic_unbind_and_destroy(dev);
     336}
     337
    330338static int rtl8169_dev_initialize(ddf_dev_t *dev)
    331339{
     
    349357failed:
    350358        ddf_msg(LVL_ERROR, "The device initialization failed");
    351 //      rtl8139_dev_cleanup(dev);
     359        rtl8169_dev_cleanup(dev);
    352360        return ret;
    353361
     
    464472err_pio:
    465473err_destroy:
    466         //rtl8169_dev_cleanup(dev);
     474        rtl8169_dev_cleanup(dev);
    467475        return rc;
    468476
     
    730738        /* Configure Receive Control Register */
    731739        uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
    732         rcr |= RCR_ACCEPT_ALL_PHYS | RCR_ACCEPT_PHYS_MATCH \
    733             | RCR_ACCEPT_BROADCAST | RCR_ACCEPT_ERROR \
    734             | RCR_ACCEPT_RUNT;
     740        rcr |= RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ERROR | RCR_ACCEPT_RUNT;
    735741        pio_write_32(rtl8169->regs + RCR, rcr);
    736742        pio_write_16(rtl8169->regs + RMS, BUFFER_SIZE);
     
    801807static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
    802808{
     809        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     810       
     811        /* Configure Receive Control Register */
     812        uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
     813        rcr |= RCR_ACCEPT_BROADCAST;           
     814        pio_write_32(rtl8169->regs + RCR, rcr);
    803815        return EOK;
    804816}
Note: See TracChangeset for help on using the changeset viewer.