Changeset eaa0c3f in mainline for uspace/lib
- Timestamp:
- 2012-01-21T23:55:03Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c38e417
- Parents:
- 86c71de (diff), e98fe28c (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/lib
- Files:
-
- 13 edited
-
c/include/ipc/devman.h (modified) (1 diff)
-
c/include/ipc/net.h (modified) (1 diff)
-
c/include/ipc/net_net.h (modified) (1 diff)
-
drv/generic/driver.c (modified) (2 diffs)
-
drv/include/ddf/driver.h (modified) (1 diff)
-
net/generic/net_remote.c (modified) (1 diff)
-
net/include/net_interface.h (modified) (1 diff)
-
net/include/nil_remote.h (modified) (1 diff)
-
net/nil/nil_remote.c (modified) (2 diffs)
-
nic/include/nic.h (modified) (1 diff)
-
nic/include/nic_driver.h (modified) (1 diff)
-
nic/src/nic_driver.c (modified) (7 diffs)
-
nic/src/nic_impl.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/devman.h
r86c71de reaa0c3f 146 146 typedef enum { 147 147 DRIVER_DEV_ADD = IPC_FIRST_USER_METHOD, 148 DRIVER_DEV_ADDED,149 148 DRIVER_DEV_REMOVE, 150 149 DRIVER_DEV_GONE, -
uspace/lib/c/include/ipc/net.h
r86c71de reaa0c3f 305 305 * 306 306 */ 307 #define IPC_GET_DEVICE_HANDLE(call) (( devman_handle_t) IPC_GET_ARG2(call))307 #define IPC_GET_DEVICE_HANDLE(call) ((service_id_t) IPC_GET_ARG2(call)) 308 308 309 309 /** Return the device driver service message argument. -
uspace/lib/c/include/ipc/net_net.h
r86c71de reaa0c3f 54 54 NET_NET_GET_DEVICES_COUNT, 55 55 /** Return names and device IDs of all devices */ 56 NET_NET_GET_DEVICES, 57 /** Notify the networking service about a ready device */ 58 NET_NET_DRIVER_READY 56 NET_NET_GET_DEVICES 59 57 } net_messages; 60 58 -
uspace/lib/drv/generic/driver.c
r86c71de reaa0c3f 303 303 } 304 304 305 static void driver_dev_added(ipc_callid_t iid, ipc_call_t *icall)306 {307 fibril_mutex_lock(&devices_mutex);308 ddf_dev_t *dev = driver_get_device(IPC_GET_ARG1(*icall));309 fibril_mutex_unlock(&devices_mutex);310 311 if (dev != NULL && driver->driver_ops->device_added != NULL)312 driver->driver_ops->device_added(dev);313 }314 315 305 static void driver_dev_remove(ipc_callid_t iid, ipc_call_t *icall) 316 306 { … … 460 450 case DRIVER_DEV_ADD: 461 451 driver_dev_add(callid, &call); 462 break;463 case DRIVER_DEV_ADDED:464 async_answer_0(callid, EOK);465 driver_dev_added(callid, &call);466 452 break; 467 453 case DRIVER_DEV_REMOVE: -
uspace/lib/drv/include/ddf/driver.h
r86c71de reaa0c3f 145 145 /** Ask driver to offline a specific function */ 146 146 int (*fun_offline)(ddf_fun_t *); 147 148 /**149 * Notification that the device was succesfully added.150 * The driver can do any blocking operation without151 * blocking the device manager.152 *153 * XXX REMOVE THIS154 */155 void (*device_added)(ddf_dev_t *dev);156 147 } driver_ops_t; 157 148 -
uspace/lib/net/generic/net_remote.c
r86c71de reaa0c3f 167 167 } 168 168 169 int net_driver_ready(async_sess_t *sess, devman_handle_t handle)170 {171 async_exch_t *exch = async_exchange_begin(sess);172 int rc = async_req_1_0(exch, NET_NET_DRIVER_READY, handle);173 async_exchange_end(exch);174 175 return rc;176 }177 178 169 /** @} 179 170 */ -
uspace/lib/net/include/net_interface.h
r86c71de reaa0c3f 52 52 extern int net_get_devices_req(async_sess_t *, measured_string_t **, size_t *, 53 53 uint8_t **); 54 extern int net_driver_ready(async_sess_t *, devman_handle_t);55 54 extern async_sess_t *net_connect_module(void); 56 55 -
uspace/lib/net/include/nil_remote.h
r86c71de reaa0c3f 34 34 #define __NET_NIL_REMOTE_H__ 35 35 36 #include <ipc/loc.h> 36 37 #include <net/device.h> 37 38 #include <net/packet.h> -
uspace/lib/net/nil/nil_remote.c
r86c71de reaa0c3f 36 36 */ 37 37 38 #include <ipc/loc.h> 38 39 #include <nil_remote.h> 39 40 #include <generic.h> … … 123 124 124 125 int nil_device_req(async_sess_t *sess, nic_device_id_t device_id, 125 devman_handle_t handle, size_t mtu)126 service_id_t sid, size_t mtu) 126 127 { 127 128 async_exch_t *exch = async_exchange_begin(sess); 128 129 int rc = async_req_3_0(exch, NET_NIL_DEVICE, (sysarg_t) device_id, 129 (sysarg_t) handle, (sysarg_t) mtu);130 (sysarg_t) sid, (sysarg_t) mtu); 130 131 async_exchange_end(exch); 131 132 return rc; -
uspace/lib/nic/include/nic.h
r86c71de reaa0c3f 219 219 extern void nic_set_poll_handlers(nic_t *, 220 220 poll_mode_change_handler, poll_request_handler); 221 222 /* Functions called in device_added */223 extern int nic_ready(nic_t *);224 221 225 222 /* General driver functions */ -
uspace/lib/nic/include/nic_driver.h
r86c71de reaa0c3f 80 80 /** Device's default MAC address (assigned the first time, used in STOP) */ 81 81 nic_address_t default_mac; 82 /** Session to SERVICE_NETWORKING */83 async_sess_t *net_session;84 82 /** Session to SERVICE_ETHERNET or SERVICE_NILDUMMY */ 85 83 async_sess_t *nil_session; -
uspace/lib/nic/src/nic_driver.c
r86c71de reaa0c3f 49 49 #include <devman.h> 50 50 #include <ddf/interrupt.h> 51 #include <net_interface.h>52 51 #include <ops/nic.h> 53 52 #include <errno.h> … … 89 88 nic_iface_t *iface) 90 89 { 91 if (driver_ops) {92 if (!driver_ops->device_added)93 driver_ops->device_added = nic_device_added_impl;94 }95 96 90 if (dev_ops) { 97 91 if (!dev_ops->open) … … 429 423 430 424 /** 431 * Connect to the NET and IRQ services. This function should be called only from425 * Connect to IRC service. This function should be called only from 432 426 * the add_device handler, thus no locking is required. 433 427 * … … 436 430 * @return EOK If connection was successful. 437 431 * @return EINVAL If the IRC service cannot be determined. 438 * @return EREFUSED If NET orIRC service cannot be connected.432 * @return EREFUSED If IRC service cannot be connected. 439 433 */ 440 434 int nic_connect_to_services(nic_t *nic_data) 441 435 { 442 /* NET service */443 nic_data->net_session = service_connect_blocking(EXCHANGE_SERIALIZE,444 SERVICE_NETWORKING, 0, 0);445 if (nic_data->net_session == NULL)446 return errno;447 448 436 /* IRC service */ 449 437 sysarg_t apic; … … 462 450 463 451 return EOK; 464 }465 466 /** Notify the NET service that the device is ready467 *468 * @param nic NICF structure469 *470 * @return EOK on success471 *472 */473 int nic_ready(nic_t *nic)474 {475 fibril_rwlock_read_lock(&nic->main_lock);476 477 async_sess_t *session = nic->net_session;478 devman_handle_t handle = nic->dev->handle;479 480 fibril_rwlock_read_unlock(&nic->main_lock);481 482 if (session == NULL)483 return EINVAL;484 485 return net_driver_ready(session, handle);486 452 } 487 453 … … 726 692 nic_data->device_id = NIC_DEVICE_INVALID_ID; 727 693 nic_data->state = NIC_STATE_STOPPED; 728 nic_data->net_session = NULL;729 694 nic_data->nil_session = NULL; 730 695 nic_data->irc_session = NULL; … … 781 746 */ 782 747 static void nic_destroy(nic_t *nic_data) { 783 if (nic_data->net_session != NULL) {784 async_hangup(nic_data->net_session);785 }786 787 748 if (nic_data->nil_session != NULL) { 788 749 async_hangup(nic_data->nil_session); -
uspace/lib/nic/src/nic_impl.c
r86c71de reaa0c3f 85 85 } 86 86 if (state == NIC_STATE_ACTIVE) { 87 if (nic_data->nil_session == NULL || nic_data->net_session == NULL 88 || nic_data->device_id < 0) { 87 if (nic_data->nil_session == NULL || nic_data->device_id < 0) { 89 88 fibril_rwlock_write_unlock(&nic_data->main_lock); 90 89 return EINVAL; … … 805 804 } 806 805 807 /** Default implementation of the device_added method808 *809 * Just calls nic_ready.810 *811 * @param dev812 *813 */814 void nic_device_added_impl(ddf_dev_t *dev)815 {816 nic_ready((nic_t *) dev->driver_data);817 }818 819 806 /** 820 807 * Default handler for unknown methods (outside of the NIC interface).
Note:
See TracChangeset
for help on using the changeset viewer.
