Changes in uspace/drv/nic/e1k/e1k.c [d51838f:582a0b8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/e1k/e1k.c
rd51838f r582a0b8 40 40 #include <thread.h> 41 41 #include <byteorder.h> 42 #include <irc.h> 42 43 #include <as.h> 43 44 #include <ddi.h> 44 45 #include <ddf/log.h> 45 46 #include <ddf/interrupt.h> 46 #include <device/hw_res.h>47 47 #include <device/hw_res_parsed.h> 48 48 #include <pci_dev_iface.h> … … 116 116 /** E1000 device data */ 117 117 typedef struct { 118 /** DDF device */119 ddf_dev_t *dev;120 /** Parent session */121 async_sess_t *parent_sess;122 118 /** Device configuration */ 123 119 e1000_info_t info; … … 369 365 if (ctrl & CTRL_SLU) { 370 366 ctrl &= ~(CTRL_SLU); 371 E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);372 367 fibril_mutex_unlock(&e1000->ctrl_lock); 373 374 368 thread_usleep(10); 375 376 369 fibril_mutex_lock(&e1000->ctrl_lock); 377 ctrl = E1000_REG_READ(e1000, E1000_CTRL);378 370 ctrl |= CTRL_SLU; 379 E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);380 371 } 381 372 382 373 fibril_mutex_unlock(&e1000->ctrl_lock); 374 375 e1000_link_restart(e1000); 383 376 } 384 377 … … 1260 1253 * @param nic Driver data 1261 1254 * 1262 * @return IRQ capability handleif the handler was registered1255 * @return EOK if the handler was registered 1263 1256 * @return Negative error code otherwise 1264 1257 * … … 1275 1268 e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC; 1276 1269 1277 int cap = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,1278 e1000 _interrupt_handler, &e1000_irq_code);1270 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), 1271 e1000->irq, e1000_interrupt_handler, &e1000_irq_code); 1279 1272 1280 1273 fibril_mutex_unlock(&irq_reg_mutex); 1281 return cap;1274 return rc; 1282 1275 } 1283 1276 … … 1761 1754 e1000_enable_interrupts(e1000); 1762 1755 1763 int rc = hw_res_enable_interrupt(e1000->parent_sess,e1000->irq);1756 int rc = irc_enable_interrupt(e1000->irq); 1764 1757 if (rc != EOK) { 1765 1758 e1000_disable_interrupts(e1000); … … 1806 1799 e1000_disable_rx(e1000); 1807 1800 1808 hw_res_disable_interrupt(e1000->parent_sess,e1000->irq);1801 irc_disable_interrupt(e1000->irq); 1809 1802 e1000_disable_interrupts(e1000); 1810 1803 … … 1888 1881 1889 1882 memset(e1000, 0, sizeof(e1000_t)); 1890 e1000->dev = dev;1891 1883 1892 1884 nic_set_specific(nic, e1000); … … 2003 1995 ddf_msg(LVL_ERROR, "Unable to allocate device softstate"); 2004 1996 return ENOMEM; 2005 }2006 2007 e1000->parent_sess = ddf_dev_parent_sess_get(dev);2008 if (e1000->parent_sess == NULL) {2009 ddf_msg(LVL_ERROR, "Failed connecting parent device.");2010 return EIO;2011 1997 } 2012 1998 … … 2130 2116 { 2131 2117 ddf_fun_t *fun; 2118 assert(dev); 2132 2119 2133 2120 /* Initialize device structure for E1000 */ … … 2165 2152 ddf_fun_set_ops(fun, &e1000_dev_ops); 2166 2153 2167 int irq_cap = e1000_register_int_handler(nic); 2168 if (irq_cap < 0) { 2169 rc = irq_cap; 2154 rc = e1000_register_int_handler(nic); 2155 if (rc != EOK) 2170 2156 goto err_fun_create; 2171 }2172 2157 2173 2158 rc = e1000_initialize_rx_structure(nic); … … 2204 2189 e1000_uninitialize_rx_structure(nic); 2205 2190 err_irq: 2206 unregister_interrupt_handler(dev, irq_cap);2191 unregister_interrupt_handler(dev, DRIVER_DATA_DEV(dev)->irq); 2207 2192 err_fun_create: 2208 2193 ddf_fun_destroy(fun);
Note:
See TracChangeset
for help on using the changeset viewer.