Changes in uspace/drv/nic/rtl8139/driver.c [b7fd2a0:cde999a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/rtl8139/driver.c
rb7fd2a0 rcde999a 280 280 } 281 281 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,282 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *); 283 static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info); 284 static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state); 285 static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed, 286 286 nic_channel_mode_t *duplex, nic_role_t *role); 287 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,287 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed, 288 288 nic_channel_mode_t duplex, nic_role_t); 289 289 290 static errno_t rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*,290 static int rtl8139_pause_get(ddf_fun_t*, nic_result_t*, nic_result_t*, 291 291 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,292 static int rtl8139_pause_set(ddf_fun_t*, int, int, uint16_t); 293 294 static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement); 295 static int rtl8139_autoneg_disable(ddf_fun_t *fun); 296 static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement, 297 297 uint32_t *their_advertisement, nic_result_t *result, 298 298 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,299 static int rtl8139_autoneg_restart(ddf_fun_t *fun); 300 301 static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode); 302 static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode); 303 304 static int rtl8139_wol_virtue_add(nic_t *nic_data, 305 305 const nic_wol_virtue_t *virtue); 306 306 static void rtl8139_wol_virtue_rem(nic_t *nic_data, 307 307 const nic_wol_virtue_t *virtue); 308 308 309 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,309 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode, 310 310 const struct timeval *period); 311 311 static void rtl8139_poll(nic_t *nic_data); … … 334 334 static ddf_dev_ops_t rtl8139_dev_ops; 335 335 336 static errno_t rtl8139_dev_add(ddf_dev_t *dev);336 static int rtl8139_dev_add(ddf_dev_t *dev); 337 337 338 338 /** Basic driver operations for RTL8139 driver */ … … 348 348 349 349 /* 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);350 static int rtl8139_on_activated(nic_t *nic_data); 351 static int rtl8139_on_stopped(nic_t *nic_data); 352 352 static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size); 353 353 … … 846 846 * @return An error code otherwise. 847 847 */ 848 inline static errno_t rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle)848 inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 849 849 { 850 850 rtl8139_t *rtl8139 = nic_get_specific(nic_data); … … 857 857 rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR; 858 858 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), 860 860 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle); 861 861 … … 904 904 * @return EOK if activated successfully, error code otherwise 905 905 */ 906 static errno_t rtl8139_on_activated(nic_t *nic_data)906 static int rtl8139_on_activated(nic_t *nic_data) 907 907 { 908 908 assert(nic_data); … … 919 919 rtl8139_hw_int_set(rtl8139); 920 920 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); 922 922 if (rc != EOK) { 923 923 rtl8139_on_stopped(nic_data); … … 935 935 * @return EOK if succeed, error code otherwise 936 936 */ 937 static errno_t rtl8139_on_stopped(nic_t *nic_data)937 static int rtl8139_on_stopped(nic_t *nic_data) 938 938 { 939 939 assert(nic_data); … … 955 955 956 956 957 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,957 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 958 958 const nic_address_t *, size_t); 959 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,959 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 960 960 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);961 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode); 962 962 963 963 … … 1027 1027 * @return EOK if succeed, error code otherwise 1028 1028 */ 1029 static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t1029 static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t 1030 1030 *hw_resources) 1031 1031 { … … 1067 1067 * @return EOK if succeed, error code otherwise 1068 1068 */ 1069 static errno_t rtl8139_get_resource_info(ddf_dev_t *dev)1069 static int rtl8139_get_resource_info(ddf_dev_t *dev) 1070 1070 { 1071 1071 assert(dev); … … 1078 1078 1079 1079 /* 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); 1081 1081 if (rc != EOK) 1082 1082 return rc; 1083 1083 1084 1084 /* 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); 1086 1086 hw_res_list_parsed_clean(&hw_res_parsed); 1087 1087 … … 1098 1098 * @return EOK in the case of success, error code otherwise 1099 1099 */ 1100 static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139)1100 static int rtl8139_buffers_create(rtl8139_t *rtl8139) 1101 1101 { 1102 1102 size_t i = 0; 1103 errno_t rc;1103 int rc; 1104 1104 1105 1105 ddf_msg(LVL_DEBUG, "Creating buffers"); … … 1149 1149 * @return EOK if succeed, error code otherwise 1150 1150 */ 1151 static errno_t rtl8139_device_initialize(ddf_dev_t *dev)1151 static int rtl8139_device_initialize(ddf_dev_t *dev) 1152 1152 { 1153 1153 ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev)); 1154 1154 1155 errno_t ret = EOK;1155 int ret = EOK; 1156 1156 1157 1157 ddf_msg(LVL_DEBUG, "rtl8139: creating device data"); … … 1208 1208 * @return EOK if successed, error code otherwise 1209 1209 */ 1210 static errno_t rtl8139_pio_enable(ddf_dev_t *dev)1210 static int rtl8139_pio_enable(ddf_dev_t *dev) 1211 1211 { 1212 1212 ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev)); … … 1258 1258 * @return EOK if added successfully, error code otherwise 1259 1259 */ 1260 errno_t rtl8139_dev_add(ddf_dev_t *dev)1260 int rtl8139_dev_add(ddf_dev_t *dev) 1261 1261 { 1262 1262 ddf_fun_t *fun; … … 1266 1266 1267 1267 /* Init device structure for rtl8139 */ 1268 errno_t rc = rtl8139_device_initialize(dev);1268 int rc = rtl8139_device_initialize(dev); 1269 1269 if (rc != EOK) 1270 1270 return rc; … … 1341 1341 * @return EOK if succeed, error code otherwise 1342 1342 */ 1343 static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)1343 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 1344 1344 { 1345 1345 assert(fun); … … 1352 1352 rtl8139_lock_all(rtl8139); 1353 1353 1354 errno_t rc = nic_report_address(nic_data, addr);1354 int rc = nic_report_address(nic_data, addr); 1355 1355 if ( rc != EOK) { 1356 1356 rtl8139_unlock_all(rtl8139); … … 1371 1371 * @return EOK 1372 1372 */ 1373 static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)1373 static int rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info) 1374 1374 { 1375 1375 assert(fun); … … 1406 1406 * @return EOK 1407 1407 */ 1408 static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)1408 static int rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 1409 1409 { 1410 1410 assert(fun); … … 1425 1425 /** Get operation mode of the device 1426 1426 */ 1427 static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,1427 static int rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed, 1428 1428 nic_channel_mode_t *duplex, nic_role_t *role) 1429 1429 { … … 1502 1502 * @return EOK if succeed 1503 1503 */ 1504 static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,1504 static int rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send, 1505 1505 nic_result_t *we_receive, uint16_t *time) 1506 1506 { … … 1537 1537 * @return EOK if succeed, INVAL if the pause frame has no sence 1538 1538 */ 1539 static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,1539 static int rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive, 1540 1540 uint16_t time) 1541 1541 { … … 1567 1567 * 1568 1568 */ 1569 static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,1569 static int rtl8139_set_operation_mode(ddf_fun_t *fun, int speed, 1570 1570 nic_channel_mode_t duplex, nic_role_t role) 1571 1571 { … … 1611 1611 * @returns EOK if advertisement mode set successfully 1612 1612 */ 1613 static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)1613 static int rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 1614 1614 { 1615 1615 assert(fun); … … 1657 1657 * @returns EOK 1658 1658 */ 1659 static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun)1659 static int rtl8139_autoneg_disable(ddf_fun_t *fun) 1660 1660 { 1661 1661 assert(fun); … … 1708 1708 * @returns EOK 1709 1709 */ 1710 static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,1710 static int rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement, 1711 1711 uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result) 1712 1712 { … … 1745 1745 * @returns EOK 1746 1746 */ 1747 static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun)1747 static int rtl8139_autoneg_restart(ddf_fun_t *fun) 1748 1748 { 1749 1749 assert(fun); … … 1793 1793 * @returns EOK 1794 1794 */ 1795 static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,1795 static int rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode, 1796 1796 const nic_address_t *addr, size_t addr_cnt) 1797 1797 { … … 1851 1851 * @returns EOK 1852 1852 */ 1853 static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,1853 static int rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode, 1854 1854 const nic_address_t *addr, size_t addr_count) 1855 1855 { … … 1894 1894 * @returns EOK 1895 1895 */ 1896 static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)1896 static int rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode) 1897 1897 { 1898 1898 assert(nic_data); … … 1922 1922 * @param[out] mode The current mode 1923 1923 */ 1924 static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)1924 static int rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 1925 1925 { 1926 1926 assert(fun); … … 1947 1947 * @returns EOK of mode was set 1948 1948 */ 1949 static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)1949 static int rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 1950 1950 { 1951 1951 assert(fun); … … 1979 1979 * @returns ELIMIT if no more methods of this kind can be enabled 1980 1980 */ 1981 static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,1981 static int rtl8139_wol_virtue_add(nic_t *nic_data, 1982 1982 const nic_wol_virtue_t *virtue) 1983 1983 { … … 2058 2058 * @returns ENOTSUP if the mode is not supported 2059 2059 */ 2060 static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,2060 static int rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode, 2061 2061 const struct timeval *period) 2062 2062 { 2063 2063 assert(nic_data); 2064 errno_t rc = EOK;2064 int rc = EOK; 2065 2065 2066 2066 rtl8139_t *rtl8139 = nic_get_specific(nic_data); … … 2143 2143 printf("%s: HelenOS RTL8139 network adapter driver\n", NAME); 2144 2144 2145 errno_t rc = nic_driver_init(NAME);2145 int rc = nic_driver_init(NAME); 2146 2146 if (rc != EOK) 2147 2147 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.