Ignore:
File:
1 edited

Legend:

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

    r9d58539 r56fd7cf  
    2727 */
    2828
     29/* XXX Fix this */
     30#define _DDF_DATA_IMPLANT
     31
    2932#include <assert.h>
    3033#include <errno.h>
     
    4447#include <sysinfo.h>
    4548#include <ipc/ns.h>
    46 
    47 #include <net_checksum.h>
    4849
    4950#include <str.h>
     
    214215        rtl8139_regs_lock(rtl8139->io_port);
    215216
     217        async_sess_t *pci_sess =
     218                ddf_dev_parent_sess_get(nic_get_ddf_dev(rtl8139->nic_data));
     219
    216220        if (bit_val) {
    217                 async_sess_t *pci_sess =
    218                         nic_get_ddf_dev(rtl8139->nic_data)->parent_sess;
    219221                uint8_t pmen;
    220222                pci_config_space_read_8(pci_sess, 0x55, &pmen);
    221223                pci_config_space_write_8(pci_sess, 0x55, pmen | 1 | (1 << 7));
    222224        } else {
    223                 async_sess_t *pci_sess =
    224                         nic_get_ddf_dev(rtl8139->nic_data)->parent_sess;
    225225                uint8_t pmen;
    226226                pci_config_space_read_8(pci_sess, 0x55, &pmen);
     
    10541054        assert(dev);
    10551055
    1056         if (dev->driver_data)
     1056        if (ddf_dev_data_get(dev))
    10571057                nic_unbind_and_destroy(dev);
    1058 
    1059         if (dev->parent_sess != NULL) {
    1060                 async_hangup(dev->parent_sess);
    1061                 dev->parent_sess = NULL;
    1062         }
    10631058}
    10641059
     
    10821077
    10831078        if (hw_resources->irqs.count != 1) {
    1084                 ddf_msg(LVL_ERROR, "%s device: unexpected irq count", dev->name);
     1079                ddf_msg(LVL_ERROR, "%s device: unexpected irq count", ddf_dev_get_name(dev));
    10851080                return EINVAL;
    10861081        };
    10871082        if (hw_resources->io_ranges.count != 1) {
    1088                 ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", dev->name);
     1083                ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", ddf_dev_get_name(dev));
    10891084                return EINVAL;
    10901085        }
    10911086
    10921087        rtl8139->irq = hw_resources->irqs.irqs[0];
    1093         ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", dev->name, rtl8139->irq);
     1088        ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", ddf_dev_get_name(dev), rtl8139->irq);
    10941089
    10951090        rtl8139->io_addr = IOADDR_TO_PTR(hw_resources->io_ranges.ranges[0].address);
    10961091        if (hw_resources->io_ranges.ranges[0].size < RTL8139_IO_SIZE) {
    10971092                ddf_msg(LVL_ERROR, "i/o range assigned to the device "
    1098                     "%s is too small.", dev->name);
     1093                    "%s is too small.", ddf_dev_get_name(dev));
    10991094                return EINVAL;
    11001095        }
    1101         ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", dev->name, rtl8139->io_addr);
     1096        ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", ddf_dev_get_name(dev), rtl8139->io_addr);
    11021097
    11031098        return EOK;
     
    11941189static int rtl8139_device_initialize(ddf_dev_t *dev)
    11951190{
    1196         ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", dev->name);
     1191        ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
    11971192
    11981193        int ret = EOK;
     
    12031198        rtl8139_t *rtl8139 = rtl8139_create_dev_data(dev);
    12041199        if (rtl8139 == NULL) {
    1205                 ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", dev->name);
     1200                ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", ddf_dev_get_name(dev));
    12061201                return ENOMEM;
    12071202        }
     
    12481243static int rtl8139_pio_enable(ddf_dev_t *dev)
    12491244{
    1250         ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", dev->name);
     1245        ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
    12511246
    12521247        rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_dev(dev));
     
    12551250        if (pio_enable(rtl8139->io_addr, RTL8139_IO_SIZE, &rtl8139->io_port)) {
    12561251                ddf_msg(LVL_ERROR, "Cannot gain the port %lx for device %s.", rtl8139->io_addr,
    1257                     dev->name);
     1252                    ddf_dev_get_name(dev));
    12581253                return EADDRNOTAVAIL;
    12591254        }
     
    13011296
    13021297        assert(dev);
    1303         ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)", dev->name, dev->handle);
     1298        ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %d)",
     1299            ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
    13041300
    13051301        /* Init device structure for rtl8139 */
     
    13421338        }
    13431339        nic_set_ddf_fun(nic_data, fun);
    1344         fun->ops = &rtl8139_dev_ops;
    1345         fun->driver_data = nic_data;
     1340        ddf_fun_set_ops(fun, &rtl8139_dev_ops);
     1341        ddf_fun_data_implant(fun, nic_data);
    13461342
    13471343        rc = ddf_fun_bind(fun);
     
    13571353
    13581354        ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
    1359             dev->name);
     1355            ddf_dev_get_name(dev));
    13601356
    13611357        return EOK;
Note: See TracChangeset for help on using the changeset viewer.