Changeset 132ab5d1 in mainline for uspace/drv/nic
- Timestamp:
- 2018-01-30T03:20:45Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5a6cc679
- Parents:
- 8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/drv/nic
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ar9271/ar9271.c
r8bfb163 r132ab5d1 33 33 */ 34 34 35 #include <async.h> 35 36 #include <ieee80211.h> 36 37 #include <usb/classes/classes.h> … … 41 42 #include <ddf/interrupt.h> 42 43 #include <errno.h> 44 #include <str_error.h> 43 45 #include <nic.h> 44 46 #include <macros.h> 45 #include <thread.h>46 47 #include "ath_usb.h" 47 48 #include "wmi.h" … … 733 734 * @param ar9271 AR9271 device structure 734 735 * 735 * @return EOK if succeed, negativeerror code otherwise736 * @return EOK if succeed, error code otherwise 736 737 * 737 738 */ … … 784 785 free(buffer); 785 786 usb_log_error("Error while uploading firmware. " 786 "Error: % d\n", rc);787 "Error: %s\n", str_error_name(rc)); 787 788 return rc; 788 789 } … … 818 819 819 820 /* Wait until firmware is ready - wait for 1 second to be sure. */ 820 thread_sleep(1);821 async_sleep(1); 821 822 822 823 return rc; … … 836 837 if (rc != EOK) { 837 838 usb_log_error("Failed to create USB device: %s, " 838 "ERR_NUM = % d\n", err_msg, rc);839 "ERR_NUM = %s\n", err_msg, str_error_name(rc)); 839 840 return NULL; 840 841 } … … 853 854 if (rc != EOK) { 854 855 free(ar9271); 855 usb_log_error("Failed to initialize AR9271 structure: % d\n",856 rc);856 usb_log_error("Failed to initialize AR9271 structure: %s\n", 857 str_error_name(rc)); 857 858 return NULL; 858 859 } … … 876 877 * @param dev The device structure. 877 878 * 878 * @return EOK if succeed, negativeerror code otherwise879 * @return EOK if succeed, error code otherwise 879 880 */ 880 881 static int ar9271_add_device(ddf_dev_t *dev) -
uspace/drv/nic/ar9271/ath_usb.c
r8bfb163 r132ab5d1 35 35 #include <usb/dev/pipes.h> 36 36 #include <usb/debug.h> 37 #include < malloc.h>37 #include <stdlib.h> 38 38 #include <errno.h> 39 39 #include "ath_usb.h" … … 56 56 * @param usb_device Connected USB device. 57 57 * 58 * @return EOK if succeed, negativeerror code otherwise.58 * @return EOK if succeed, error code otherwise. 59 59 * 60 60 */ … … 107 107 * @param buffer_size Buffer size. 108 108 * 109 * @return EOK if succeed, negativeerror code otherwise.109 * @return EOK if succeed, error code otherwise. 110 110 * 111 111 */ … … 124 124 * @param transferred_size Real size of read data. 125 125 * 126 * @return EOK if succeed, negativeerror code otherwise.126 * @return EOK if succeed, error code otherwise. 127 127 * 128 128 */ … … 140 140 * @param buffer_size Buffer size. 141 141 * 142 * @return EOK if succeed, negativeerror code otherwise.142 * @return EOK if succeed, error code otherwise. 143 143 * 144 144 */ … … 173 173 * @param transferred_size Real size of read data. 174 174 * 175 * @return EOK if succeed, negativeerror code otherwise.175 * @return EOK if succeed, error code otherwise. 176 176 * 177 177 */ -
uspace/drv/nic/ar9271/htc.c
r8bfb163 r132ab5d1 36 36 #include <byteorder.h> 37 37 #include <errno.h> 38 #include <str_error.h> 38 39 #include "wmi.h" 39 40 #include "htc.h" … … 149 150 * @param endpoint_id Destination endpoint. 150 151 * 151 * @return EOK if succeed, negativeerror code otherwise.152 * @return EOK if succeed, error code otherwise. 152 153 * 153 154 */ … … 172 173 * @param endpoint_id Destination endpoint. 173 174 * 174 * @return EOK if succeed, negativeerror code otherwise.175 * @return EOK if succeed, error code otherwise. 175 176 * 176 177 */ … … 195 196 * @param transferred_size Real size of read data. 196 197 * 197 * @return EOK if succeed, negativeerror code otherwise.198 * @return EOK if succeed, error code otherwise. 198 199 * 199 200 */ … … 215 216 * @param transferred_size Real size of read data. 216 217 * 217 * @return EOK if succeed, negativeerror code otherwise.218 * @return EOK if succeed, error code otherwise. 218 219 * 219 220 */ … … 235 236 * 236 237 * @return EOK if succeed, EINVAL when failed to connect service, 237 * negativeerror code otherwise.238 * error code otherwise. 238 239 * 239 240 */ … … 264 265 if (rc != EOK) { 265 266 free(buffer); 266 usb_log_error("Failed to send HTC message. Error: % d\n", rc);267 usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc)); 267 268 return rc; 268 269 } … … 278 279 free(buffer); 279 280 usb_log_error("Failed to receive HTC service connect response. " 280 "Error: % d\n", rc);281 "Error: %s\n", str_error_name(rc)); 281 282 return rc; 282 283 } … … 308 309 * @param htc_device HTC device structure. 309 310 * 310 * @return EOK if succeed, negativeerror code otherwise.311 * @return EOK if succeed, error code otherwise. 311 312 * 312 313 */ … … 331 332 free(buffer); 332 333 usb_log_error("Failed to send HTC config message. " 333 "Error: % d\n", rc);334 "Error: %s\n", str_error_name(rc)); 334 335 return rc; 335 336 } … … 344 345 if (rc != EOK) { 345 346 usb_log_error("Failed to receive HTC config response message. " 346 "Error: % d\n", rc);347 "Error: %s\n", str_error_name(rc)); 347 348 } 348 349 … … 356 357 * @param htc_device HTC device structure. 357 358 * 358 * @return EOK if succeed, negativeerror code otherwise.359 * @return EOK if succeed, error code otherwise. 359 360 * 360 361 */ … … 376 377 if (rc != EOK) 377 378 usb_log_error("Failed to send HTC setup complete message. " 378 "Error: % d\n", rc);379 "Error: %s\n", str_error_name(rc)); 379 380 380 381 free(buffer); … … 390 391 * 391 392 * @return EOK if succeed, EINVAL if response error, 392 * negativeerror code otherwise.393 * error code otherwise. 393 394 * 394 395 */ … … 404 405 free(buffer); 405 406 usb_log_error("Failed to receive HTC check ready message. " 406 "Error: % d\n", rc);407 "Error: %s\n", str_error_name(rc)); 407 408 return rc; 408 409 } … … 426 427 * @param htc_device HTC device structure to be initialized. 427 428 * 428 * @return EOK if succeed, negativeerror code otherwise.429 * @return EOK if succeed, error code otherwise. 429 430 * 430 431 */ … … 447 448 * @param htc_device HTC device structure. 448 449 * 449 * @return EOK if succeed, negativeerror code otherwise.450 * @return EOK if succeed, error code otherwise. 450 451 * 451 452 */ -
uspace/drv/nic/ar9271/hw.c
r8bfb163 r132ab5d1 49 49 * 50 50 * @return EOK if succeed, ETIMEOUT on timeout, 51 * negativeerror code otherwise.51 * error code otherwise. 52 52 * 53 53 */ … … 215 215 * @param ar9271 Device structure. 216 216 * 217 * @return EOK if succeed, negativeerror code otherwise.217 * @return EOK if succeed, error code otherwise. 218 218 * 219 219 */ … … 636 636 * @param ar9271 Device structure. 637 637 * 638 * @return EOK if succeed, negativeerror code otherwise.638 * @return EOK if succeed, error code otherwise. 639 639 */ 640 640 int hw_init(ar9271_t *ar9271) -
uspace/drv/nic/ar9271/wmi.c
r8bfb163 r132ab5d1 35 35 #include <usb/debug.h> 36 36 #include <errno.h> 37 #include <malloc.h> 37 #include <str_error.h> 38 #include <stdlib.h> 38 39 #include <mem.h> 39 40 #include <byteorder.h> … … 46 47 * @param res Stored result. 47 48 * 48 * @return EOK if succeed, negativeerror code otherwise.49 * @return EOK if succeed, error code otherwise. 49 50 * 50 51 */ … … 78 79 * @param val Value to be written 79 80 * 80 * @return EOK if succeed, negativeerror code otherwise.81 * @return EOK if succeed, error code otherwise. 81 82 * 82 83 */ … … 111 112 * @param clear_bit Bit to be cleared. 112 113 * 113 * @return EOK if succeed, negativeerror code otherwise.114 * @return EOK if succeed, error code otherwise. 114 115 * 115 116 */ … … 145 146 * @param set_bit Bit to be set. 146 147 * 147 * @return EOK if succeed, negativeerror code otherwise.148 * @return EOK if succeed, error code otherwise. 148 149 * 149 150 */ … … 160 161 * @param clear_bit Bit to be cleared. 161 162 * 162 * @return EOK if succeed, negativeerror code otherwise.163 * @return EOK if succeed, error code otherwise. 163 164 * 164 165 */ … … 175 176 * @param elements Number of elements in array. 176 177 * 177 * @return EOK if succeed, negativeerror code otherwise.178 * @return EOK if succeed, error code otherwise. 178 179 * 179 180 */ … … 219 220 * @param response_buffer Buffer with response data. 220 221 * 221 * @return EOK if succeed, negativeerror code otherwise.222 * @return EOK if succeed, error code otherwise. 222 223 * 223 224 */ … … 245 246 if (rc != EOK) { 246 247 free(buffer); 247 usb_log_error("Failed to send WMI message. Error: % d\n", rc);248 usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc)); 248 249 return rc; 249 250 } … … 268 269 free(buffer); 269 270 usb_log_error("Failed to receive WMI message response. " 270 "Error: % d\n", rc);271 "Error: %s\n", str_error_name(rc)); 271 272 return rc; 272 273 } -
uspace/drv/nic/e1k/e1k.c
r8bfb163 r132ab5d1 33 33 */ 34 34 35 #include <async.h> 35 36 #include <assert.h> 36 37 #include <stdio.h> … … 38 39 #include <adt/list.h> 39 40 #include <align.h> 40 #include <thread.h>41 41 #include <byteorder.h> 42 42 #include <as.h> … … 372 372 fibril_mutex_unlock(&e1000->ctrl_lock); 373 373 374 thread_usleep(10);374 async_usleep(10); 375 375 376 376 fibril_mutex_lock(&e1000->ctrl_lock); … … 1237 1237 /** Handle device interrupt 1238 1238 * 1239 * @param iid IPC call id1240 1239 * @param icall IPC call structure 1241 1240 * @param dev E1000 device 1242 1241 * 1243 1242 */ 1244 static void e1000_interrupt_handler(ipc_call id_t iid, ipc_call_t *icall,1243 static void e1000_interrupt_handler(ipc_call_t *icall, 1245 1244 ddf_dev_t *dev) 1246 1245 { … … 1260 1259 * @param nic Driver data 1261 1260 * 1262 * @return IRQ capability handle if the handler was registered 1263 * @return Negative error code otherwise 1264 * 1265 */ 1266 inline static int e1000_register_int_handler(nic_t *nic) 1261 * @param[out] handle IRQ capability handle if the handler was registered 1262 * 1263 * @return An error code otherwise 1264 * 1265 */ 1266 inline static int 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 cap= register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,1278 e1000_interrupt_handler, &e1000_irq_code );1277 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq, 1278 e1000_interrupt_handler, &e1000_irq_code, handle); 1279 1279 1280 1280 fibril_mutex_unlock(&irq_reg_mutex); 1281 return cap;1281 return rc; 1282 1282 } 1283 1283 … … 1370 1370 * 1371 1371 * @return EOK if succeed 1372 * @return Negativeerror code otherwise1372 * @return An error code otherwise 1373 1373 * 1374 1374 */ … … 1524 1524 * 1525 1525 * @return EOK if succeed 1526 * @return Negativeerror code otherwise1526 * @return An error code otherwise 1527 1527 * 1528 1528 */ … … 1725 1725 1726 1726 /* Wait for the reset */ 1727 thread_usleep(20);1727 async_usleep(20); 1728 1728 1729 1729 /* check if RST_BIT cleared */ … … 1813 1813 * transfers to descriptors. 1814 1814 */ 1815 thread_usleep(100);1815 async_usleep(100); 1816 1816 1817 1817 return EOK; … … 1940 1940 * 1941 1941 * @return EOK if succeed 1942 * @return Negativeerror code otherwise1942 * @return An error code otherwise 1943 1943 * 1944 1944 */ … … 1965 1965 * 1966 1966 * @return EOK if succeed 1967 * @return Negativeerror code otherwise1967 * @return An error code otherwise 1968 1968 * 1969 1969 */ … … 1993 1993 * 1994 1994 * @return EOK if succeed 1995 * @return Negativeerror code otherwise1995 * @return An error code otherwise 1996 1996 * 1997 1997 */ … … 2107 2107 * 2108 2108 * @return EOK if successed 2109 * @return Negativeerror code otherwise2109 * @return An error code otherwise 2110 2110 * 2111 2111 */ … … 2165 2165 ddf_fun_set_ops(fun, &e1000_dev_ops); 2166 2166 2167 int irq_cap = e1000_register_int_handler(nic);2168 if (irq_cap < 0) {2169 rc = irq_cap;2167 int irq_cap; 2168 rc = e1000_register_int_handler(nic, &irq_cap); 2169 if (rc != EOK) { 2170 2170 goto err_fun_create; 2171 2171 } … … 2239 2239 uint32_t eerd = E1000_REG_READ(e1000, E1000_EERD); 2240 2240 while ((eerd & e1000->info.eerd_done) == 0) { 2241 thread_usleep(1);2241 async_usleep(1); 2242 2242 eerd = E1000_REG_READ(e1000, E1000_EERD); 2243 2243 } … … 2255 2255 * 2256 2256 * @return EOK if succeed 2257 * @return Negativeerror code otherwise2257 * @return An error code otherwise 2258 2258 * 2259 2259 */ … … 2289 2289 * 2290 2290 * @return EOK if succeed 2291 * @return Negativeerror code otherwise2291 * @return An error code otherwise 2292 2292 */ 2293 2293 static int e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr) -
uspace/drv/nic/ne2k/dp8390.c
r8bfb163 r132ab5d1 55 55 56 56 #include <assert.h> 57 #include <async.h> 57 58 #include <byteorder.h> 58 59 #include <errno.h> 59 60 #include <stdio.h> 60 61 #include <ddi.h> 61 #include <thread.h>62 62 #include "dp8390.h" 63 63 … … 172 172 /* Reset the ethernet card */ 173 173 uint8_t val = pio_read_8(ne2k->port + NE2K_RESET); 174 thread_usleep(2000);174 async_usleep(2000); 175 175 pio_write_8(ne2k->port + NE2K_RESET, val); 176 thread_usleep(2000);176 async_usleep(2000); 177 177 178 178 /* Reset the DP8390 */ -
uspace/drv/nic/ne2k/ne2k.c
r8bfb163 r132ab5d1 122 122 }; 123 123 124 static void ne2k_interrupt_handler(ipc_call id_t, ipc_call_t *, ddf_dev_t *);125 126 static int ne2k_register_interrupt(nic_t *nic_data )124 static void ne2k_interrupt_handler(ipc_call_t *, ddf_dev_t *); 125 126 static int ne2k_register_interrupt(nic_t *nic_data, cap_handle_t *handle) 127 127 { 128 128 ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data); … … 160 160 } 161 161 162 int irq_cap = register_interrupt_handler(nic_get_ddf_dev(nic_data), 163 ne2k->irq, ne2k_interrupt_handler, &ne2k->code); 164 return irq_cap; 162 return register_interrupt_handler(nic_get_ddf_dev(nic_data), 163 ne2k->irq, ne2k_interrupt_handler, &ne2k->code, handle); 165 164 } 166 165 … … 228 227 ne2k->probed = true; 229 228 230 int irq_cap = ne2k_register_interrupt(nic_data); 231 if (irq_cap < 0) 229 if (ne2k_register_interrupt(nic_data, NULL) != EOK) 232 230 return EINVAL; 233 231 … … 239 237 } 240 238 241 void ne2k_interrupt_handler(ipc_call id_t iid, ipc_call_t *call, ddf_dev_t *dev)239 void ne2k_interrupt_handler(ipc_call_t *call, ddf_dev_t *dev) 242 240 { 243 241 nic_t *nic_data = DRIVER_DATA(dev); 244 242 ne2k_interrupt(nic_data, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call)); 245 246 async_answer_0(iid, EOK);247 243 } 248 244 -
uspace/drv/nic/rtl8139/driver.c
r8bfb163 r132ab5d1 28 28 29 29 #include <assert.h> 30 #include <async.h> 30 31 #include <errno.h> 31 32 #include <align.h> 32 #include <thread.h>33 33 #include <byteorder.h> 34 34 #include <libarch/barrier.h> … … 217 217 * @param address The place to store the address 218 218 * 219 * @return EOK if succeed, negativeerror code otherwise219 * @return EOK if succeed, error code otherwise 220 220 */ 221 221 inline static void rtl8139_hw_get_addr(rtl8139_t *rtl8139, … … 435 435 memory_barrier(); 436 436 while(pio_read_8(io_base + CR) & CR_RST) { 437 thread_usleep(1);437 async_usleep(1); 438 438 read_barrier(); 439 439 } … … 816 816 /** Handle device interrupt 817 817 * 818 * @param iid The IPC call id819 818 * @param icall The IPC call structure 820 819 * @param dev The rtl8139 device 821 820 * 822 821 */ 823 static void rtl8139_interrupt_handler(ipc_callid_t iid, ipc_call_t *icall, 824 ddf_dev_t *dev) 822 static void rtl8139_interrupt_handler(ipc_call_t *icall, ddf_dev_t *dev) 825 823 { 826 824 assert(dev); … … 844 842 * @param nic_data The driver data 845 843 * 846 * @return IRQ capability handle if the handler was registered. 847 * @return Negative error code otherwise. 848 */ 849 inline static int rtl8139_register_int_handler(nic_t *nic_data) 844 * @param[out] handle IRQ capability handle if the handler was registered. 845 * 846 * @return An error code otherwise. 847 */ 848 inline static int rtl8139_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 850 849 { 851 850 rtl8139_t *rtl8139 = nic_get_specific(nic_data); … … 858 857 rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR; 859 858 rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR; 860 int cap= register_interrupt_handler(nic_get_ddf_dev(nic_data),861 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code );859 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 860 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code, handle); 862 861 863 862 RTL8139_IRQ_STRUCT_UNLOCK(); 864 863 865 return cap;864 return rc; 866 865 } 867 866 … … 1026 1025 * @param hw_resources Devices hardware resources 1027 1026 * 1028 * @return EOK if succeed, negativeerror code otherwise1027 * @return EOK if succeed, error code otherwise 1029 1028 */ 1030 1029 static int rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t … … 1066 1065 * @param dev The device structure 1067 1066 * 1068 * @return EOK if succeed, negativeerror code otherwise1067 * @return EOK if succeed, error code otherwise 1069 1068 */ 1070 1069 static int rtl8139_get_resource_info(ddf_dev_t *dev) … … 1148 1147 * @param dev The device information 1149 1148 * 1150 * @return EOK if succeed, negativeerror code otherwise1149 * @return EOK if succeed, error code otherwise 1151 1150 */ 1152 1151 static int rtl8139_device_initialize(ddf_dev_t *dev) … … 1207 1206 * @param dev The RTL8139 device. 1208 1207 * 1209 * @return EOK if successed, negativeerror code otherwise1208 * @return EOK if successed, error code otherwise 1210 1209 */ 1211 1210 static int rtl8139_pio_enable(ddf_dev_t *dev) … … 1257 1256 * @param dev The RTL8139 device. 1258 1257 * 1259 * @return EOK if added successfully, negativeerror code otherwise1258 * @return EOK if added successfully, error code otherwise 1260 1259 */ 1261 1260 int rtl8139_dev_add(ddf_dev_t *dev) … … 1289 1288 1290 1289 /* Register interrupt handler */ 1291 int irq_cap = rtl8139_register_int_handler(nic_data);1292 if (irq_cap < 0) {1293 rc = irq_cap;1290 int irq_cap; 1291 rc = rtl8139_register_int_handler(nic_data, &irq_cap); 1292 if (rc != EOK) { 1294 1293 goto err_pio; 1295 1294 } … … 1340 1339 * @param max_len Maximal addresss length to store 1341 1340 * 1342 * @return EOK if succeed, negativeerror code otherwise1341 * @return EOK if succeed, error code otherwise 1343 1342 */ 1344 1343 static int rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr) -
uspace/drv/nic/rtl8139/general.c
r8bfb163 r132ab5d1 81 81 * @param time The requested time 82 82 * 83 * @return EOK if succeed, negativeerror code otherwise83 * @return EOK if succeed, error code otherwise 84 84 */ 85 85 int rtl8139_timer_act_init(rtl8139_timer_act_t * ta, uint32_t timer_freq, -
uspace/drv/nic/rtl8169/driver.c
r8bfb163 r132ab5d1 28 28 29 29 #include <assert.h> 30 #include <async.h> 30 31 #include <errno.h> 32 #include <str_error.h> 31 33 #include <align.h> 32 34 #include <byteorder.h> … … 34 36 35 37 #include <as.h> 36 #include <thread.h>37 38 #include <ddf/log.h> 38 39 #include <ddf/interrupt.h> … … 42 43 #include <nic.h> 43 44 #include <pci_dev_iface.h> 44 45 #include <sysinfo.h>46 #include <ipc/ns.h>47 45 48 46 #include <str.h> … … 75 73 static int rtl8169_on_stopped(nic_t *nic_data); 76 74 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size); 77 static void rtl8169_irq_handler(ipc_callid_t iid, ipc_call_t *icall, 78 ddf_dev_t *dev); 79 static inline int rtl8169_register_int_handler(nic_t *nic_data); 75 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev); 76 static inline int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle); 80 77 static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr); 81 78 static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr); … … 363 360 } 364 361 365 inline static int rtl8169_register_int_handler(nic_t *nic_data )362 inline static int rtl8169_register_int_handler(nic_t *nic_data, cap_handle_t *handle) 366 363 { 367 364 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 371 368 rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR; 372 369 rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR; 373 int irq_cap= register_interrupt_handler(nic_get_ddf_dev(nic_data),374 rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code );375 376 return irq_cap;370 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 371 rtl8169->irq, rtl8169_irq_handler, &rtl8169_irq_code, handle); 372 373 return rc; 377 374 } 378 375 … … 431 428 goto err_pio; 432 429 433 int irq_cap = rtl8169_register_int_handler(nic_data);434 if (irq_cap < 0) {435 rc = irq_cap;436 ddf_msg(LVL_ERROR, "Failed to register IRQ handler (% d)", rc);430 int irq_cap; 431 rc = rtl8169_register_int_handler(nic_data, &irq_cap); 432 if (rc != EOK) { 433 ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%s)", str_error_name(rc)); 437 434 goto err_irq; 438 435 } … … 710 707 rc = rtl8169_allocate_buffers(rtl8169); 711 708 if (rc != EOK) { 712 ddf_msg(LVL_ERROR, "Error allocating buffers: % d", rc);709 ddf_msg(LVL_ERROR, "Error allocating buffers: %s", str_error_name(rc)); 713 710 return 0; 714 711 } … … 767 764 memory_barrier(); 768 765 while (pio_read_8(rtl8169->regs + CR) & CR_RST) { 769 thread_usleep(1);766 async_usleep(1); 770 767 read_barrier(); 771 768 } … … 1035 1032 } 1036 1033 1037 static void rtl8169_irq_handler(ipc_callid_t iid, ipc_call_t *icall, 1038 ddf_dev_t *dev) 1034 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 1039 1035 { 1040 1036 assert(dev); … … 1181 1177 do { 1182 1178 phyar = pio_read_32(rtl8169->regs + PHYAR); 1183 thread_usleep(20);1179 async_usleep(20); 1184 1180 } while ((phyar & PHYAR_RW_WRITE) == 0); 1185 1181 … … 1199 1195 do { 1200 1196 phyar = pio_read_32(rtl8169->regs + PHYAR); 1201 thread_usleep(20);1197 async_usleep(20); 1202 1198 } while ((phyar & PHYAR_RW_WRITE) != 0); 1203 1199 1204 thread_usleep(20);1200 async_usleep(20); 1205 1201 } 1206 1202
Note:
See TracChangeset
for help on using the changeset viewer.