Changes in uspace/lib/nic/src/nic_driver.c [4c5deac:acdb5bac] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nic/src/nic_driver.c
r4c5deac racdb5bac 42 42 #include <stdio.h> 43 43 #include <str_error.h> 44 #include <ipc/services.h> 45 #include <ipc/ns.h> 46 #include <ipc/irc.h> 44 47 #include <sysinfo.h> 45 48 #include <as.h> … … 249 252 250 253 /* Connect to the parent's driver. */ 251 parent_sess = ddf_dev_parent_sess_create(dev );254 parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 252 255 if (parent_sess == NULL) 253 256 return EPARTY; … … 375 378 } 376 379 380 381 /** 382 * Enable interrupts for this driver. 383 * 384 * @param nic_data 385 * @param irq The IRQ number for this device 386 */ 387 void nic_enable_interrupt(nic_t *nic_data, int irq) 388 { 389 async_exch_t *exch = async_exchange_begin(nic_data->irc_session); 390 async_msg_1(exch, IRC_ENABLE_INTERRUPT, irq); 391 async_exchange_end(exch); 392 } 393 394 /** 395 * Disable interrupts for this driver. 396 * 397 * @param nic_data 398 * @param irq The IRQ number for this device 399 */ 400 void nic_disable_interrupt(nic_t *nic_data, int irq) 401 { 402 async_exch_t *exch = async_exchange_begin(nic_data->irc_session); 403 async_msg_1(exch, IRC_CLEAR_INTERRUPT, irq); 404 async_exchange_end(exch); 405 } 406 377 407 /** Get the polling mode information from the device 378 408 * … … 390 420 return nic_data->poll_mode; 391 421 }; 422 423 /** 424 * Connect to IRC service. This function should be called only from 425 * the add_device handler, thus no locking is required. 426 * 427 * @param nic_data 428 * 429 * @return EOK If connection was successful. 430 * @return EINVAL If the IRC service cannot be determined. 431 * @return EREFUSED If IRC service cannot be connected. 432 */ 433 int nic_connect_to_services(nic_t *nic_data) 434 { 435 /* IRC service */ 436 sysarg_t apic; 437 sysarg_t i8259; 438 services_t irc_service = -1; 439 if (((sysinfo_get_value("apic", &apic) == EOK) && (apic)) || 440 ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259))) 441 irc_service = SERVICE_IRC; 442 else 443 return EINVAL; 444 445 nic_data->irc_session = service_connect_blocking(EXCHANGE_SERIALIZE, 446 irc_service, 0, 0); 447 if (nic_data->irc_session == NULL) 448 return errno; 449 450 return EOK; 451 } 392 452 393 453 /** Inform the NICF about poll mode … … 436 496 int rc = nic_ev_addr_changed(nic_data->client_session, 437 497 address); 438 439 498 if (rc != EOK) { 440 499 fibril_rwlock_write_unlock(&nic_data->main_lock); … … 485 544 if (!addr) 486 545 return; 546 if (!nic_data) 547 memset(addr, 0, sizeof(nic_address_t)); 487 548 488 549 memcpy(addr, &nic_data->mac, sizeof(nic_address_t)); … … 607 668 nic_data->state = NIC_STATE_STOPPED; 608 669 nic_data->client_session = NULL; 670 nic_data->irc_session = NULL; 609 671 nic_data->poll_mode = NIC_POLL_IMMEDIATE; 610 672 nic_data->default_poll_mode = NIC_POLL_IMMEDIATE; … … 913 975 nic_t *nic_get_from_ddf_fun(ddf_fun_t *fun) 914 976 { 915 return (nic_t *) ddf_ dev_data_get(ddf_fun_get_dev(fun));977 return (nic_t *) ddf_fun_data_get(fun); 916 978 } 917 979
Note:
See TracChangeset
for help on using the changeset viewer.