Changeset 91b60499 in mainline for uspace/drv/nic/e1k/e1k.c


Ignore:
Timestamp:
2017-09-30T06:29:42Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
300f4c4
Parents:
d076f16 (diff), 6636fb19 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge support for capabilities from lp:~jakub/helenos/caps

This commit introduces capabilities as task-local names for references to kernel
objects. Kernel objects are reference-counted wrappers for a select group of
objects allocated in and by the kernel that can be made accessible to userspace
in a controlled way via integer handles.

So far, a kernel object encapsulates either an irq_t or a phone_t.

Support for the former lead to the removal of kernel-assigned devnos and
unsecure deregistration of IRQs in which a random task was able to unregister
some other task's IRQ.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/e1k/e1k.c

    rd076f16 r91b60499  
    12531253 * @param nic Driver data
    12541254 *
    1255  * @return EOK if the handler was registered
     1255 * @return IRQ capability handle if the handler was registered
    12561256 * @return Negative error code otherwise
    12571257 *
     
    12681268        e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC;
    12691269       
    1270         int rc = register_interrupt_handler(nic_get_ddf_dev(nic),
    1271             e1000->irq, e1000_interrupt_handler, &e1000_irq_code);
     1270        int cap = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
     1271            e1000_interrupt_handler, &e1000_irq_code);
    12721272       
    12731273        fibril_mutex_unlock(&irq_reg_mutex);
    1274         return rc;
     1274        return cap;
    12751275}
    12761276
     
    21522152        ddf_fun_set_ops(fun, &e1000_dev_ops);
    21532153       
    2154         rc = e1000_register_int_handler(nic);
    2155         if (rc != EOK)
     2154        int irq_cap = e1000_register_int_handler(nic);
     2155        if (irq_cap < 0) {
     2156                rc = irq_cap;
    21562157                goto err_fun_create;
     2158        }
    21572159       
    21582160        rc = e1000_initialize_rx_structure(nic);
     
    21892191        e1000_uninitialize_rx_structure(nic);
    21902192err_irq:
    2191         unregister_interrupt_handler(dev, DRIVER_DATA_DEV(dev)->irq);
     2193        unregister_interrupt_handler(dev, irq_cap);
    21922194err_fun_create:
    21932195        ddf_fun_destroy(fun);
Note: See TracChangeset for help on using the changeset viewer.