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