Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 rdd8ab1c  
    5252FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
    5353
    54 static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
    55 static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
    56 static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
    57 static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
     54static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
     55static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
     56static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
     57static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
    5858    nic_channel_mode_t *duplex, nic_role_t *role);
    59 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     59static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
    6060    nic_channel_mode_t duplex, nic_role_t role);
    61 static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     61static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    6262    nic_result_t *we_receive, uint16_t *time);
    63 static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     63static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    6464    uint16_t time);
    65 static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
    66 static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun);
    67 static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     65static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
     66static int rtl8169_autoneg_disable(ddf_fun_t *fun);
     67static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    6868    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result);
    69 static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun);
    70 static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
    71 static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
    72 static errno_t rtl8169_on_activated(nic_t *nic_data);
    73 static errno_t rtl8169_on_stopped(nic_t *nic_data);
     69static int rtl8169_autoneg_restart(ddf_fun_t *fun);
     70static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
     71static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
     72static int rtl8169_on_activated(nic_t *nic_data);
     73static int rtl8169_on_stopped(nic_t *nic_data);
    7474static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
    7575static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev);
    76 static inline errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
     76static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle);
    7777static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
    7878static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
    7979
    8080static void rtl8169_reset(rtl8169_t *rtl8169);
    81 static errno_t rtl8169_get_resource_info(ddf_dev_t *dev);
    82 static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
     81static int rtl8169_get_resource_info(ddf_dev_t *dev);
     82static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
    8383static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev);
    8484
    85 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     85static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    8686    const nic_address_t *, size_t);
    87 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     87static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    8888    const nic_address_t *addr, size_t addr_count);
    89 static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
     89static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
    9090
    9191static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr);
     
    161161static ddf_dev_ops_t rtl8169_dev_ops;
    162162
    163 static errno_t rtl8169_dev_add(ddf_dev_t *dev);
     163static int rtl8169_dev_add(ddf_dev_t *dev);
    164164
    165165/** Basic driver operations for RTL8169 driver */
     
    174174};
    175175
    176 static errno_t rtl8169_get_resource_info(ddf_dev_t *dev)
     176static int rtl8169_get_resource_info(ddf_dev_t *dev)
    177177{
    178178        assert(dev);
     
    185185
    186186        /* Get hw resources form parent driver */
    187         errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
     187        int rc = nic_get_resources(nic_data, &hw_res_parsed);
    188188        if (rc != EOK)
    189189                return rc;
    190190
    191191        /* Fill resources information to the device */
    192         errno_t ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);
     192        int ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);
    193193        hw_res_list_parsed_clean(&hw_res_parsed);
    194194
     
    196196}
    197197
    198 static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     198static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
    199199    *hw_resources)
    200200{
     
    229229}
    230230
    231 static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169)
    232 {
    233         errno_t rc;
     231static int rtl8169_allocate_buffers(rtl8169_t *rtl8169)
     232{
     233        int rc;
    234234
    235235        ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings");
     
    334334}
    335335
    336 static errno_t rtl8169_dev_initialize(ddf_dev_t *dev)
    337 {
    338         errno_t ret;
     336static int rtl8169_dev_initialize(ddf_dev_t *dev)
     337{
     338        int ret;
    339339
    340340        rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev);
     
    360360}
    361361
    362 inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     362inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    363363{
    364364        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    368368        rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
    369369        rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR;
    370         errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
     370        int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    371371            rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle);
    372372
     
    374374}
    375375
    376 static errno_t rtl8169_dev_add(ddf_dev_t *dev)
     376static int rtl8169_dev_add(ddf_dev_t *dev)
    377377{
    378378        ddf_fun_t *fun;
    379379        nic_address_t nic_addr;
    380         errno_t rc;
     380        int rc;
    381381
    382382        assert(dev);
     
    481481}
    482482
    483 static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
     483static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
    484484{
    485485        nic_t *nic_data = nic_get_from_ddf_fun(fun);
    486486        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
    487         errno_t rc;
     487        int rc;
    488488
    489489        fibril_mutex_lock(&rtl8169->rx_lock);
     
    502502}
    503503
    504 static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
     504static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
    505505{
    506506        nic_t *nic_data = nic_get_from_ddf_fun(fun);
     
    528528}
    529529
    530 static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     530static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    531531{
    532532        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    541541}
    542542
    543 static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
     543static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
    544544    nic_channel_mode_t *duplex, nic_role_t *role)
    545545{
     
    563563}
    564564
    565 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
     565static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
    566566    nic_channel_mode_t duplex, nic_role_t role)
    567567{
     
    594594}
    595595
    596 static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     596static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    597597    nic_result_t *we_receive, uint16_t *time)
    598598{
     
    600600}
    601601
    602 static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     602static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    603603    uint16_t time)
    604604{
     
    606606}
    607607
    608 static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
     608static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
    609609{
    610610        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    630630}
    631631
    632 static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun)
     632static int rtl8169_autoneg_disable(ddf_fun_t *fun)
    633633{
    634634        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    641641}
    642642
    643 static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     643static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    644644    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
    645645{
     
    647647}
    648648
    649 static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun)
     649static int rtl8169_autoneg_restart(ddf_fun_t *fun)
    650650{
    651651        rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
     
    657657}
    658658
    659 static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
    660 {
    661         return EOK;
    662 }
    663 
    664 static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
     659static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
     660{
     661        return EOK;
     662}
     663
     664static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
    665665{
    666666        return EOK;
     
    691691}
    692692
    693 static errno_t rtl8169_on_activated(nic_t *nic_data)
    694 {
    695         errno_t rc;
     693static int rtl8169_on_activated(nic_t *nic_data)
     694{
     695        int rc;
    696696        uint64_t tmp;
    697697
     
    753753}
    754754
    755 static errno_t rtl8169_on_stopped(nic_t *nic_data)
     755static int rtl8169_on_stopped(nic_t *nic_data)
    756756{
    757757        ddf_msg(LVL_NOTE, "Stopping device");
     
    819819}
    820820
    821 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     821static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    822822    const nic_address_t *addr, size_t addr_count)
    823823{
     
    871871}
    872872
    873 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     873static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    874874    const nic_address_t *addr, size_t addr_count)
    875875{
     
    915915}
    916916
    917 static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
     917static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
    918918{
    919919        rtl8169_t *rtl8169 = nic_get_specific(nic_data);
     
    12081208int main(void)
    12091209{
    1210         errno_t rc = nic_driver_init(NAME);
     1210        int rc = nic_driver_init(NAME);
    12111211        if (rc != EOK)
    12121212                return rc;
Note: See TracChangeset for help on using the changeset viewer.