Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 rcde999a  
    280280}
    281281
    282 static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
    283 static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
    284 static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
    285 static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
     282static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
     283static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
     284static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
     285static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
    286286    nic_channel_mode_t *duplex, nic_role_t *role);
    287 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     287static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
    288288    nic_channel_mode_t duplex, nic_role_t);
    289289
    290 static errno_t rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,
     290static int rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,
    291291    uint16_t *);
    292 static errno_t rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);
    293 
    294 static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
    295 static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun);
    296 static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
     292static int rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t);
     293
     294static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
     295static int rtl8139_autoneg_disable(ddf_fun_t *fun);
     296static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
    297297    uint32_t *their_advertisement, nic_result_t *result,
    298298    nic_result_t *their_result);
    299 static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun);
    300 
    301 static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
    302 static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
    303 
    304 static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
     299static int rtl8139_autoneg_restart(ddf_fun_t *fun);
     300
     301static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
     302static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
     303
     304static int rtl8139_wol_virtue_add(nic_t *nic_data,
    305305        const nic_wol_virtue_t *virtue);
    306306static void rtl8139_wol_virtue_rem(nic_t *nic_data,
    307307        const nic_wol_virtue_t *virtue);
    308308
    309 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     309static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
    310310    const struct timeval *period);
    311311static void rtl8139_poll(nic_t *nic_data);
     
    334334static ddf_dev_ops_t rtl8139_dev_ops;
    335335
    336 static errno_t rtl8139_dev_add(ddf_dev_t *dev);
     336static int rtl8139_dev_add(ddf_dev_t *dev);
    337337
    338338/** Basic driver operations for RTL8139 driver */
     
    348348
    349349/* The default implementation callbacks */
    350 static errno_t rtl8139_on_activated(nic_t *nic_data);
    351 static errno_t rtl8139_on_stopped(nic_t *nic_data);
     350static int rtl8139_on_activated(nic_t *nic_data);
     351static int rtl8139_on_stopped(nic_t *nic_data);
    352352static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size);
    353353
     
    846846 *  @return An error code otherwise.
    847847 */
    848 inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
     848inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)
    849849{
    850850        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    857857        rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
    858858        rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR;
    859         errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
     859        int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
    860860            rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle);
    861861
     
    904904 *  @return EOK if activated successfully, error code otherwise
    905905 */
    906 static errno_t rtl8139_on_activated(nic_t *nic_data)
     906static int rtl8139_on_activated(nic_t *nic_data)
    907907{
    908908        assert(nic_data);
     
    919919        rtl8139_hw_int_set(rtl8139);
    920920
    921         errno_t rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
     921        int rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
    922922        if (rc != EOK) {
    923923                rtl8139_on_stopped(nic_data);
     
    935935 *  @return EOK if succeed, error code otherwise
    936936 */
    937 static errno_t rtl8139_on_stopped(nic_t *nic_data)
     937static int rtl8139_on_stopped(nic_t *nic_data)
    938938{
    939939        assert(nic_data);
     
    955955
    956956
    957 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     957static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    958958    const nic_address_t *, size_t);
    959 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     959static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    960960    const nic_address_t *addr, size_t addr_count);
    961 static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
     961static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
    962962
    963963
     
    10271027 *  @return EOK if succeed, error code otherwise
    10281028 */
    1029 static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
     1029static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
    10301030    *hw_resources)
    10311031{
     
    10671067 *  @return EOK if succeed, error code otherwise
    10681068 */
    1069 static errno_t rtl8139_get_resource_info(ddf_dev_t *dev)
     1069static int rtl8139_get_resource_info(ddf_dev_t *dev)
    10701070{
    10711071        assert(dev);
     
    10781078
    10791079        /* Get hw resources form parent driver */
    1080         errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
     1080        int rc = nic_get_resources(nic_data, &hw_res_parsed);
    10811081        if (rc != EOK)
    10821082                return rc;
    10831083
    10841084        /* Fill resources information to the device */
    1085         errno_t ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);
     1085        int ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);
    10861086        hw_res_list_parsed_clean(&hw_res_parsed);
    10871087
     
    10981098 * @return EOK in the case of success, error code otherwise
    10991099 */
    1100 static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139)
     1100static int rtl8139_buffers_create(rtl8139_t *rtl8139)
    11011101{
    11021102        size_t i = 0;
    1103         errno_t rc;
     1103        int rc;
    11041104
    11051105        ddf_msg(LVL_DEBUG, "Creating buffers");
     
    11491149 *  @return EOK if succeed, error code otherwise
    11501150 */
    1151 static errno_t rtl8139_device_initialize(ddf_dev_t *dev)
     1151static int rtl8139_device_initialize(ddf_dev_t *dev)
    11521152{
    11531153        ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
    11541154
    1155         errno_t ret = EOK;
     1155        int ret = EOK;
    11561156
    11571157        ddf_msg(LVL_DEBUG, "rtl8139: creating device data");
     
    12081208 * @return EOK if successed, error code otherwise
    12091209 */
    1210 static errno_t rtl8139_pio_enable(ddf_dev_t *dev)
     1210static int rtl8139_pio_enable(ddf_dev_t *dev)
    12111211{
    12121212        ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
     
    12581258 * @return EOK if added successfully, error code otherwise
    12591259 */
    1260 errno_t rtl8139_dev_add(ddf_dev_t *dev)
     1260int rtl8139_dev_add(ddf_dev_t *dev)
    12611261{
    12621262        ddf_fun_t *fun;
     
    12661266
    12671267        /* Init device structure for rtl8139 */
    1268         errno_t rc = rtl8139_device_initialize(dev);
     1268        int rc = rtl8139_device_initialize(dev);
    12691269        if (rc != EOK)
    12701270                return rc;
     
    13411341 *  @return EOK if succeed, error code otherwise
    13421342 */
    1343 static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
     1343static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
    13441344{
    13451345        assert(fun);
     
    13521352        rtl8139_lock_all(rtl8139);
    13531353
    1354         errno_t rc = nic_report_address(nic_data, addr);
     1354        int rc = nic_report_address(nic_data, addr);
    13551355        if ( rc != EOK) {
    13561356                rtl8139_unlock_all(rtl8139);
     
    13711371 *  @return EOK
    13721372 */
    1373 static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
     1373static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
    13741374{
    13751375        assert(fun);
     
    14061406 *  @return EOK
    14071407 */
    1408 static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
     1408static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
    14091409{
    14101410        assert(fun);
     
    14251425/** Get operation mode of the device
    14261426 */
    1427 static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
     1427static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
    14281428    nic_channel_mode_t *duplex, nic_role_t *role)
    14291429{
     
    15021502 *  @return EOK if succeed
    15031503 */
    1504 static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
     1504static int rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
    15051505    nic_result_t *we_receive, uint16_t *time)
    15061506{
     
    15371537 *  @return EOK if succeed, INVAL if the pause frame has no sence
    15381538 */
    1539 static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
     1539static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
    15401540    uint16_t time)
    15411541{
     
    15671567 *
    15681568 */
    1569 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
     1569static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
    15701570    nic_channel_mode_t duplex, nic_role_t role)
    15711571{
     
    16111611 *  @returns EOK if advertisement mode set successfully
    16121612 */
    1613 static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
     1613static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
    16141614{
    16151615        assert(fun);
     
    16571657 *  @returns EOK
    16581658 */
    1659 static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun)
     1659static int rtl8139_autoneg_disable(ddf_fun_t *fun)
    16601660{
    16611661        assert(fun);
     
    17081708 *  @returns EOK
    17091709 */
    1710 static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
     1710static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
    17111711    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
    17121712{
     
    17451745 *  @returns EOK
    17461746 */
    1747 static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun)
     1747static int rtl8139_autoneg_restart(ddf_fun_t *fun)
    17481748{
    17491749        assert(fun);
     
    17931793 *  @returns EOK
    17941794 */
    1795 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
     1795static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
    17961796    const nic_address_t *addr, size_t addr_cnt)
    17971797{
     
    18511851 *  @returns EOK
    18521852 */
    1853 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
     1853static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
    18541854    const nic_address_t *addr, size_t addr_count)
    18551855{
     
    18941894 *  @returns EOK
    18951895 */
    1896 static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
     1896static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
    18971897{
    18981898        assert(nic_data);
     
    19221922 *  @param[out] mode    The current mode
    19231923 */
    1924 static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
     1924static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
    19251925{
    19261926        assert(fun);
     
    19471947 *  @returns EOK of mode was set
    19481948 */
    1949 static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
     1949static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
    19501950{
    19511951        assert(fun);
     
    19791979 *  @returns ELIMIT if no more methods of this kind can be enabled
    19801980 */
    1981 static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
     1981static int rtl8139_wol_virtue_add(nic_t *nic_data,
    19821982        const nic_wol_virtue_t *virtue)
    19831983{
     
    20582058 *  @returns ENOTSUP if the mode is not supported
    20592059 */
    2060 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
     2060static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
    20612061    const struct timeval *period)
    20622062{
    20632063        assert(nic_data);
    2064         errno_t rc = EOK;
     2064        int rc = EOK;
    20652065
    20662066        rtl8139_t *rtl8139 = nic_get_specific(nic_data);
     
    21432143        printf("%s: HelenOS RTL8139 network adapter driver\n", NAME);
    21442144
    2145         errno_t rc = nic_driver_init(NAME);
     2145        int rc = nic_driver_init(NAME);
    21462146        if (rc != EOK)
    21472147                return rc;
Note: See TracChangeset for help on using the changeset viewer.