Changes in uspace/drv/nic/e1k/e1k.c [cde999a:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/e1k/e1k.c
rcde999a rb7fd2a0 179 179 FIBRIL_MUTEX_INITIALIZE(irq_reg_mutex); 180 180 181 static int e1000_get_address(e1000_t *, nic_address_t *);181 static errno_t e1000_get_address(e1000_t *, nic_address_t *); 182 182 static void e1000_eeprom_get_address(e1000_t *, nic_address_t *); 183 static int e1000_set_addr(ddf_fun_t *, const nic_address_t *);184 185 static int e1000_defective_get_mode(ddf_fun_t *, uint32_t *);186 static int e1000_defective_set_mode(ddf_fun_t *, uint32_t);187 188 static int e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);189 static int e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);190 static int e1000_get_operation_mode(ddf_fun_t *, int *,183 static errno_t e1000_set_addr(ddf_fun_t *, const nic_address_t *); 184 185 static errno_t e1000_defective_get_mode(ddf_fun_t *, uint32_t *); 186 static errno_t e1000_defective_set_mode(ddf_fun_t *, uint32_t); 187 188 static errno_t e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *); 189 static errno_t e1000_get_device_info(ddf_fun_t *, nic_device_info_t *); 190 static errno_t e1000_get_operation_mode(ddf_fun_t *, int *, 191 191 nic_channel_mode_t *, nic_role_t *); 192 static int e1000_set_operation_mode(ddf_fun_t *, int,192 static errno_t e1000_set_operation_mode(ddf_fun_t *, int, 193 193 nic_channel_mode_t, nic_role_t); 194 static int e1000_autoneg_enable(ddf_fun_t *, uint32_t);195 static int e1000_autoneg_disable(ddf_fun_t *);196 static int e1000_autoneg_restart(ddf_fun_t *);197 198 static int e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);194 static errno_t e1000_autoneg_enable(ddf_fun_t *, uint32_t); 195 static errno_t e1000_autoneg_disable(ddf_fun_t *); 196 static errno_t e1000_autoneg_restart(ddf_fun_t *); 197 198 static errno_t e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool); 199 199 200 200 /** Network interface options for E1000 card driver */ … … 219 219 static ddf_dev_ops_t e1000_dev_ops; 220 220 221 static int e1000_dev_add(ddf_dev_t *);221 static errno_t e1000_dev_add(ddf_dev_t *); 222 222 223 223 /** Basic driver operations for E1000 driver */ … … 233 233 234 234 /* The default implementation callbacks */ 235 static int e1000_on_activating(nic_t *);236 static int e1000_on_stopping(nic_t *);235 static errno_t e1000_on_activating(nic_t *); 236 static errno_t e1000_on_stopping(nic_t *); 237 237 static void e1000_send_frame(nic_t *, void *, size_t); 238 238 … … 288 288 * 289 289 */ 290 static int e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)290 static errno_t e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info) 291 291 { 292 292 assert(dev); … … 316 316 * 317 317 */ 318 static int e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)318 static errno_t e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state) 319 319 { 320 320 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 335 335 * 336 336 */ 337 static int e1000_get_operation_mode(ddf_fun_t *fun, int *speed,337 static errno_t e1000_get_operation_mode(ddf_fun_t *fun, int *speed, 338 338 nic_channel_mode_t *duplex, nic_role_t *role) 339 339 { … … 386 386 * 387 387 */ 388 static int e1000_set_operation_mode(ddf_fun_t *fun, int speed,388 static errno_t e1000_set_operation_mode(ddf_fun_t *fun, int speed, 389 389 nic_channel_mode_t duplex, nic_role_t role) 390 390 { … … 434 434 * 435 435 */ 436 static int e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)436 static errno_t e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement) 437 437 { 438 438 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 462 462 * 463 463 */ 464 static int e1000_autoneg_disable(ddf_fun_t *fun)464 static errno_t e1000_autoneg_disable(ddf_fun_t *fun) 465 465 { 466 466 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 490 490 * 491 491 */ 492 static int e1000_autoneg_restart(ddf_fun_t *dev)492 static errno_t e1000_autoneg_restart(ddf_fun_t *dev) 493 493 { 494 494 return e1000_autoneg_enable(dev, 0); … … 501 501 * 502 502 */ 503 static int e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)503 static errno_t e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode) 504 504 { 505 505 e1000_t *e1000 = DRIVER_DATA_FUN(fun); … … 522 522 * 523 523 */ 524 static int e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)524 static errno_t e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode) 525 525 { 526 526 e1000_t *e1000 = DRIVER_DATA_FUN(fun); 527 int rc = EOK;527 errno_t rc = EOK; 528 528 529 529 fibril_mutex_lock(&e1000->rx_lock); … … 827 827 * 828 828 */ 829 static int e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,829 static errno_t e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode, 830 830 const nic_address_t *addr, size_t addr_cnt) 831 831 { 832 832 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 833 int rc = EOK;833 errno_t rc = EOK; 834 834 835 835 fibril_mutex_lock(&e1000->rx_lock); … … 881 881 * 882 882 */ 883 static int e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,883 static errno_t e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode, 884 884 const nic_address_t *addr, size_t addr_cnt) 885 885 { 886 886 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 887 int rc = EOK;887 errno_t rc = EOK; 888 888 889 889 fibril_mutex_lock(&e1000->rx_lock); … … 937 937 * 938 938 */ 939 static int e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)939 static errno_t e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode) 940 940 { 941 941 e1000_t *e1000 = DRIVER_DATA_NIC(nic); 942 int rc = EOK;942 errno_t rc = EOK; 943 943 944 944 fibril_mutex_lock(&e1000->rx_lock); … … 1048 1048 * 1049 1049 */ 1050 static int e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,1050 static errno_t e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add, 1051 1051 bool strip) 1052 1052 { … … 1264 1264 * 1265 1265 */ 1266 inline static int e1000_register_int_handler(nic_t *nic, cap_handle_t *handle)1266 inline static errno_t e1000_register_int_handler(nic_t *nic, cap_handle_t *handle) 1267 1267 { 1268 1268 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1275 1275 e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC; 1276 1276 1277 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,1277 errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq, 1278 1278 e1000_interrupt_handler, &e1000_irq_code, handle); 1279 1279 … … 1319 1319 * 1320 1320 */ 1321 static int e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,1321 static errno_t e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode, 1322 1322 const struct timeval *period) 1323 1323 { … … 1373 1373 * 1374 1374 */ 1375 static int e1000_initialize_rx_structure(nic_t *nic)1375 static errno_t e1000_initialize_rx_structure(nic_t *nic) 1376 1376 { 1377 1377 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1379 1379 1380 1380 e1000->rx_ring_virt = AS_AREA_ANY; 1381 int rc = dmamem_map_anonymous(1381 errno_t rc = dmamem_map_anonymous( 1382 1382 E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t), 1383 1383 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, … … 1567 1567 * 1568 1568 */ 1569 static int e1000_initialize_tx_structure(e1000_t *e1000)1569 static errno_t e1000_initialize_tx_structure(e1000_t *e1000) 1570 1570 { 1571 1571 size_t i; … … 1579 1579 e1000->tx_frame_virt = NULL; 1580 1580 1581 int rc = dmamem_map_anonymous(1581 errno_t rc = dmamem_map_anonymous( 1582 1582 E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t), 1583 1583 DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, … … 1718 1718 * 1719 1719 */ 1720 static int e1000_reset(nic_t *nic)1720 static errno_t e1000_reset(nic_t *nic) 1721 1721 { 1722 1722 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1749 1749 * 1750 1750 */ 1751 static int e1000_on_activating(nic_t *nic)1751 static errno_t e1000_on_activating(nic_t *nic) 1752 1752 { 1753 1753 assert(nic); … … 1761 1761 e1000_enable_interrupts(e1000); 1762 1762 1763 int rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq);1763 errno_t rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq); 1764 1764 if (rc != EOK) { 1765 1765 e1000_disable_interrupts(e1000); … … 1795 1795 * 1796 1796 */ 1797 static int e1000_on_down_unlocked(nic_t *nic)1797 static errno_t e1000_on_down_unlocked(nic_t *nic) 1798 1798 { 1799 1799 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1826 1826 * 1827 1827 */ 1828 static int e1000_on_down(nic_t *nic)1828 static errno_t e1000_on_down(nic_t *nic) 1829 1829 { 1830 1830 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1834 1834 fibril_mutex_lock(&e1000->ctrl_lock); 1835 1835 1836 int rc = e1000_on_down_unlocked(nic);1836 errno_t rc = e1000_on_down_unlocked(nic); 1837 1837 1838 1838 fibril_mutex_unlock(&e1000->ctrl_lock); … … 1851 1851 * 1852 1852 */ 1853 static int e1000_on_stopping(nic_t *nic)1853 static errno_t e1000_on_stopping(nic_t *nic) 1854 1854 { 1855 1855 e1000_t *e1000 = DRIVER_DATA_NIC(nic); … … 1859 1859 fibril_mutex_lock(&e1000->ctrl_lock); 1860 1860 1861 int rc = e1000_on_down_unlocked(nic);1861 errno_t rc = e1000_on_down_unlocked(nic); 1862 1862 if (rc == EOK) 1863 1863 rc = e1000_reset(nic); … … 1943 1943 * 1944 1944 */ 1945 static int e1000_fill_resource_info(ddf_dev_t *dev,1945 static errno_t e1000_fill_resource_info(ddf_dev_t *dev, 1946 1946 const hw_res_list_parsed_t *hw_resources) 1947 1947 { … … 1968 1968 * 1969 1969 */ 1970 static int e1000_get_resource_info(ddf_dev_t *dev)1970 static errno_t e1000_get_resource_info(ddf_dev_t *dev) 1971 1971 { 1972 1972 assert(dev != NULL); … … 1977 1977 1978 1978 /* Get hw resources form parent driver */ 1979 int rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed);1979 errno_t rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed); 1980 1980 if (rc != EOK) 1981 1981 return rc; … … 1996 1996 * 1997 1997 */ 1998 static int e1000_device_initialize(ddf_dev_t *dev)1998 static errno_t e1000_device_initialize(ddf_dev_t *dev) 1999 1999 { 2000 2000 /* Allocate driver data for the device. */ … … 2012 2012 2013 2013 /* Obtain and fill hardware resources info */ 2014 int rc = e1000_get_resource_info(dev);2014 errno_t rc = e1000_get_resource_info(dev); 2015 2015 if (rc != EOK) { 2016 2016 ddf_msg(LVL_ERROR, "Cannot obtain hardware resources"); … … 2110 2110 * 2111 2111 */ 2112 static int e1000_pio_enable(ddf_dev_t *dev)2112 static errno_t e1000_pio_enable(ddf_dev_t *dev) 2113 2113 { 2114 2114 e1000_t *e1000 = DRIVER_DATA_DEV(dev); 2115 2115 2116 int rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE,2116 errno_t rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE, 2117 2117 &e1000->reg_base_virt); 2118 2118 if (rc != EOK) … … 2127 2127 * 2128 2128 */ 2129 int e1000_dev_add(ddf_dev_t *dev)2129 errno_t e1000_dev_add(ddf_dev_t *dev) 2130 2130 { 2131 2131 ddf_fun_t *fun; 2132 2132 2133 2133 /* Initialize device structure for E1000 */ 2134 int rc = e1000_device_initialize(dev);2134 errno_t rc = e1000_device_initialize(dev); 2135 2135 if (rc != EOK) 2136 2136 return rc; … … 2258 2258 * 2259 2259 */ 2260 static int e1000_get_address(e1000_t *e1000, nic_address_t *address)2260 static errno_t e1000_get_address(e1000_t *e1000, nic_address_t *address) 2261 2261 { 2262 2262 fibril_mutex_lock(&e1000->rx_lock); … … 2291 2291 * @return An error code otherwise 2292 2292 */ 2293 static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)2293 static errno_t e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr) 2294 2294 { 2295 2295 nic_t *nic = NIC_DATA_FUN(fun); … … 2299 2299 fibril_mutex_lock(&e1000->tx_lock); 2300 2300 2301 int rc = nic_report_address(nic, addr);2301 errno_t rc = nic_report_address(nic, addr); 2302 2302 if (rc == EOK) 2303 2303 e1000_write_receive_address(e1000, 0, addr, false);
Note:
See TracChangeset
for help on using the changeset viewer.