Changes in uspace/drv/nic/rtl8169/driver.c [b7fd2a0:dd8ab1c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/rtl8169/driver.c
rb7fd2a0 rdd8ab1c 52 52 FIBRIL_MUTEX_INITIALIZE(irq_reg_lock); 53 53 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,54 static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr); 55 static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info); 56 static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state); 57 static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed, 58 58 nic_channel_mode_t *duplex, nic_role_t *role); 59 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,59 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed, 60 60 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,61 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 62 62 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,63 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 64 64 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,65 static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement); 66 static int rtl8169_autoneg_disable(ddf_fun_t *fun); 67 static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 68 68 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);69 static int rtl8169_autoneg_restart(ddf_fun_t *fun); 70 static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode); 71 static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode); 72 static int rtl8169_on_activated(nic_t *nic_data); 73 static int rtl8169_on_stopped(nic_t *nic_data); 74 74 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size); 75 75 static 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);76 static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle); 77 77 static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr); 78 78 static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr); 79 79 80 80 static 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);81 static int rtl8169_get_resource_info(ddf_dev_t *dev); 82 static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources); 83 83 static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev); 84 84 85 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,85 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 86 86 const nic_address_t *, size_t); 87 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,87 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 88 88 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);89 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode); 90 90 91 91 static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr); … … 161 161 static ddf_dev_ops_t rtl8169_dev_ops; 162 162 163 static errno_t rtl8169_dev_add(ddf_dev_t *dev);163 static int rtl8169_dev_add(ddf_dev_t *dev); 164 164 165 165 /** Basic driver operations for RTL8169 driver */ … … 174 174 }; 175 175 176 static errno_t rtl8169_get_resource_info(ddf_dev_t *dev)176 static int rtl8169_get_resource_info(ddf_dev_t *dev) 177 177 { 178 178 assert(dev); … … 185 185 186 186 /* 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); 188 188 if (rc != EOK) 189 189 return rc; 190 190 191 191 /* 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); 193 193 hw_res_list_parsed_clean(&hw_res_parsed); 194 194 … … 196 196 } 197 197 198 static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t198 static int rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t 199 199 *hw_resources) 200 200 { … … 229 229 } 230 230 231 static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169)232 { 233 errno_t rc;231 static int rtl8169_allocate_buffers(rtl8169_t *rtl8169) 232 { 233 int rc; 234 234 235 235 ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings"); … … 334 334 } 335 335 336 static errno_t rtl8169_dev_initialize(ddf_dev_t *dev)337 { 338 errno_t ret;336 static int rtl8169_dev_initialize(ddf_dev_t *dev) 337 { 338 int ret; 339 339 340 340 rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev); … … 360 360 } 361 361 362 inline static errno_t rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle)362 inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 363 363 { 364 364 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 368 368 rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR; 369 369 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), 371 371 rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle); 372 372 … … 374 374 } 375 375 376 static errno_t rtl8169_dev_add(ddf_dev_t *dev)376 static int rtl8169_dev_add(ddf_dev_t *dev) 377 377 { 378 378 ddf_fun_t *fun; 379 379 nic_address_t nic_addr; 380 errno_t rc;380 int rc; 381 381 382 382 assert(dev); … … 481 481 } 482 482 483 static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)483 static int rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 484 484 { 485 485 nic_t *nic_data = nic_get_from_ddf_fun(fun); 486 486 rtl8169_t *rtl8169 = nic_get_specific(nic_data); 487 errno_t rc;487 int rc; 488 488 489 489 fibril_mutex_lock(&rtl8169->rx_lock); … … 502 502 } 503 503 504 static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)504 static int rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info) 505 505 { 506 506 nic_t *nic_data = nic_get_from_ddf_fun(fun); … … 528 528 } 529 529 530 static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)530 static int rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 531 531 { 532 532 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 541 541 } 542 542 543 static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,543 static int rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed, 544 544 nic_channel_mode_t *duplex, nic_role_t *role) 545 545 { … … 563 563 } 564 564 565 static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,565 static int rtl8169_set_operation_mode(ddf_fun_t *fun, int speed, 566 566 nic_channel_mode_t duplex, nic_role_t role) 567 567 { … … 594 594 } 595 595 596 static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,596 static int rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 597 597 nic_result_t *we_receive, uint16_t *time) 598 598 { … … 600 600 } 601 601 602 static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,602 static int rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 603 603 uint16_t time) 604 604 { … … 606 606 } 607 607 608 static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)608 static int rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 609 609 { 610 610 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 630 630 } 631 631 632 static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun)632 static int rtl8169_autoneg_disable(ddf_fun_t *fun) 633 633 { 634 634 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 641 641 } 642 642 643 static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,643 static int rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 644 644 uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result) 645 645 { … … 647 647 } 648 648 649 static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun)649 static int rtl8169_autoneg_restart(ddf_fun_t *fun) 650 650 { 651 651 rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun)); … … 657 657 } 658 658 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)659 static int rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 660 { 661 return EOK; 662 } 663 664 static int rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 665 665 { 666 666 return EOK; … … 691 691 } 692 692 693 static errno_t rtl8169_on_activated(nic_t *nic_data)694 { 695 errno_t rc;693 static int rtl8169_on_activated(nic_t *nic_data) 694 { 695 int rc; 696 696 uint64_t tmp; 697 697 … … 753 753 } 754 754 755 static errno_t rtl8169_on_stopped(nic_t *nic_data)755 static int rtl8169_on_stopped(nic_t *nic_data) 756 756 { 757 757 ddf_msg(LVL_NOTE, "Stopping device"); … … 819 819 } 820 820 821 static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,821 static int rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 822 822 const nic_address_t *addr, size_t addr_count) 823 823 { … … 871 871 } 872 872 873 static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,873 static int rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 874 874 const nic_address_t *addr, size_t addr_count) 875 875 { … … 915 915 } 916 916 917 static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)917 static int rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode) 918 918 { 919 919 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 1208 1208 int main(void) 1209 1209 { 1210 errno_t rc = nic_driver_init(NAME);1210 int rc = nic_driver_init(NAME); 1211 1211 if (rc != EOK) 1212 1212 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.