Changes in uspace/drv/nic/rtl8169/driver.c [dd8ab1c:d51838f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/rtl8169/driver.c
rdd8ab1c rd51838f 28 28 29 29 #include <assert.h> 30 #include <async.h>31 30 #include <errno.h> 32 #include <str_error.h>33 31 #include <align.h> 34 32 #include <byteorder.h> … … 36 34 37 35 #include <as.h> 36 #include <thread.h> 38 37 #include <ddf/log.h> 39 38 #include <ddf/interrupt.h> … … 43 42 #include <nic.h> 44 43 #include <pci_dev_iface.h> 44 45 #include <sysinfo.h> 46 #include <ipc/ns.h> 45 47 46 48 #include <str.h> … … 73 75 static int rtl8169_on_stopped(nic_t *nic_data); 74 76 static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size); 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); 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); 77 80 static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr); 78 81 static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr); … … 360 363 } 361 364 362 inline static int rtl8169_register_int_handler(nic_t *nic_data , cap_handle_t *handle)365 inline static int rtl8169_register_int_handler(nic_t *nic_data) 363 366 { 364 367 rtl8169_t *rtl8169 = nic_get_specific(nic_data); … … 368 371 rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR; 369 372 rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR; 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;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; 374 377 } 375 378 … … 428 431 goto err_pio; 429 432 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));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); 434 437 goto err_irq; 435 438 } … … 707 710 rc = rtl8169_allocate_buffers(rtl8169); 708 711 if (rc != EOK) { 709 ddf_msg(LVL_ERROR, "Error allocating buffers: % s", str_error_name(rc));712 ddf_msg(LVL_ERROR, "Error allocating buffers: %d", rc); 710 713 return 0; 711 714 } … … 764 767 memory_barrier(); 765 768 while (pio_read_8(rtl8169->regs + CR) & CR_RST) { 766 async_usleep(1);769 thread_usleep(1); 767 770 read_barrier(); 768 771 } … … 1032 1035 } 1033 1036 1034 static void rtl8169_irq_handler(ipc_call_t *icall, ddf_dev_t *dev) 1037 static void rtl8169_irq_handler(ipc_callid_t iid, ipc_call_t *icall, 1038 ddf_dev_t *dev) 1035 1039 { 1036 1040 assert(dev); … … 1177 1181 do { 1178 1182 phyar = pio_read_32(rtl8169->regs + PHYAR); 1179 async_usleep(20);1183 thread_usleep(20); 1180 1184 } while ((phyar & PHYAR_RW_WRITE) == 0); 1181 1185 … … 1195 1199 do { 1196 1200 phyar = pio_read_32(rtl8169->regs + PHYAR); 1197 async_usleep(20);1201 thread_usleep(20); 1198 1202 } while ((phyar & PHYAR_RW_WRITE) != 0); 1199 1203 1200 async_usleep(20);1204 thread_usleep(20); 1201 1205 } 1202 1206
Note:
See TracChangeset
for help on using the changeset viewer.