Changeset 1f1fa64 in mainline for uspace/lib


Ignore:
Timestamp:
2014-07-28T21:53:11Z (11 years ago)
Author:
Agnieszka Tabaka <nufcia@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c3b25985, f2f4c00
Parents:
cbfece7 (diff), 7eb6c96 (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.
Message:

Make MAC address change possible on ethip side. Merge mainline changes.

Location:
uspace/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    rcbfece7 r1f1fa64  
    3636/** @file
    3737 */
    38 
    39 #define _DDF_DATA_IMPLANT
    4038
    4139#include <assert.h>
     
    596594}
    597595
    598 /** Implant foreign driver-specific device data.
    599  *
    600  * XXX This is used to transition USB to new interface. Do not use
    601  * in new code. Use of this function must be removed.
    602  */
    603 void ddf_fun_data_implant(ddf_fun_t *fun, void *data)
    604 {
    605         assert(fun->driver_data == NULL);
    606         fun->driver_data = data;
    607 }
    608 
    609596/** Return driver-specific device data. */
    610597void *ddf_dev_data_get(ddf_dev_t *dev)
  • uspace/lib/drv/include/ddf/driver.h

    rcbfece7 r1f1fa64  
    111111} driver_t;
    112112
    113 /** XXX Only to transition USB */
    114 #ifdef _DDF_DATA_IMPLANT
    115 extern void ddf_fun_data_implant(ddf_fun_t *, void *);
    116 #endif
    117 
    118113extern int ddf_driver_main(const driver_t *);
    119114
  • uspace/lib/nic/src/nic_driver.c

    rcbfece7 r1f1fa64  
    4747#include <ops/nic.h>
    4848#include <errno.h>
     49
     50#include <io/log.h>
    4951
    5052#include "nic_driver.h"
     
    436438                int rc = nic_ev_addr_changed(nic_data->client_session,
    437439                    address);
     440                log_msg(LOG_DEFAULT, LVL_WARN, "rc=%d", rc);
     441
    438442                if (rc != EOK) {
    439443                        fibril_rwlock_write_unlock(&nic_data->main_lock);
  • uspace/lib/nic/src/nic_impl.c

    rcbfece7 r1f1fa64  
    179179
    180180        nic_data->send_frame(nic_data, data, size);
     181        fibril_rwlock_read_unlock(&nic_data->main_lock);
    181182        return EOK;
    182183}
  • uspace/lib/usbdev/include/usb/dev/hub.h

    rcbfece7 r1f1fa64  
    4444#include <usb/hc.h>
    4545
    46 extern int usb_hc_new_device_wrapper(ddf_dev_t *, usb_hc_connection_t *, usb_speed_t,
    47     int (*)(void *), void *, usb_address_t *, ddf_dev_ops_t *, void *,
    48     ddf_fun_t **);
     46extern int usb_hc_new_device_wrapper(ddf_dev_t *, ddf_fun_t *,
     47    usb_hc_connection_t *, usb_speed_t, int (*)(void *), void *,
     48    usb_address_t *, ddf_dev_ops_t *);
    4949
    5050/** Info about device attached to host controller.
  • uspace/lib/usbdev/include/usb/dev/recognise.h

    rcbfece7 r1f1fa64  
    5252
    5353extern int usb_device_register_child_in_devman(usb_pipe_t *ctrl_pipe,
    54     ddf_dev_t *, ddf_dev_ops_t *, void *, ddf_fun_t **);
     54    ddf_dev_t *, ddf_fun_t *, ddf_dev_ops_t *);
    5555
    5656#endif
  • uspace/lib/usbdev/src/hub.c

    rcbfece7 r1f1fa64  
    155155 *      request or requests for descriptors when creating match ids).
    156156 */
    157 int usb_hc_new_device_wrapper(ddf_dev_t *parent,
     157int usb_hc_new_device_wrapper(ddf_dev_t *parent, ddf_fun_t *fun,
    158158    usb_hc_connection_t *hc_conn, usb_speed_t dev_speed,
    159159    int (*enable_port)(void *arg), void *arg, usb_address_t *assigned_address,
    160     ddf_dev_ops_t *dev_ops, void *new_dev_data, ddf_fun_t **new_fun)
     160    ddf_dev_ops_t *dev_ops)
    161161{
    162         if ((new_fun == NULL) || (hc_conn == NULL))
     162        if (hc_conn == NULL)
    163163                return EINVAL;
    164164
     
    271271        /* Register the device with devman. */
    272272        /* FIXME: create device_register that will get opened ctrl pipe. */
    273         ddf_fun_t *child_fun;
    274273        rc = usb_device_register_child_in_devman(&ctrl_pipe,
    275             parent, dev_ops, new_dev_data, &child_fun);
     274            parent, fun, dev_ops);
    276275        if (rc != EOK) {
    277276                goto leave_release_free_address;
     
    280279        const usb_hub_attached_device_t new_device = {
    281280                .address = dev_addr,
    282                 .fun = child_fun,
     281                .fun = fun,
    283282        };
    284283
     
    288287        if (rc != EOK) {
    289288                /* The child function is already created. */
    290                 ddf_fun_destroy(child_fun);
    291289                rc = EDESTADDRREQ;
    292290                goto leave_release_free_address;
     
    296294                *assigned_address = dev_addr;
    297295        }
    298 
    299         *new_fun = child_fun;
    300296
    301297        rc = EOK;
  • uspace/lib/usbdev/src/recognise.c

    rcbfece7 r1f1fa64  
    3333 * Functions for recognition of attached devices.
    3434 */
    35 
    36 /** XXX Fix this */
    37 #define _DDF_DATA_IMPLANT
    3835
    3936#include <sys/types.h>
     
    318315 */
    319316int usb_device_register_child_in_devman(usb_pipe_t *ctrl_pipe,
    320     ddf_dev_t *parent, ddf_dev_ops_t *dev_ops, void *dev_data,
    321     ddf_fun_t **child_fun)
    322 {
    323         if (child_fun == NULL || ctrl_pipe == NULL)
     317    ddf_dev_t *parent, ddf_fun_t *fun, ddf_dev_ops_t *dev_ops)
     318{
     319        if (ctrl_pipe == NULL)
    324320                return EINVAL;
    325321       
    326         if (!dev_ops && dev_data) {
     322        if (!dev_ops && ddf_fun_data_get(fun) != NULL) {
    327323                usb_log_warning("Using standard fun ops with arbitrary "
    328324                    "driver data. This does not have to work.\n");
     
    334330            (size_t) atomic_preinc(&device_name_index);
    335331       
    336         ddf_fun_t *child = NULL;
    337332        int rc;
    338333       
     
    348343        }
    349344       
    350         child = ddf_fun_create(parent, fun_inner, child_name);
    351         if (child == NULL) {
    352                 rc = ENOMEM;
     345        rc = ddf_fun_set_name(fun, child_name);
     346        if (rc != EOK)
    353347                goto failure;
    354         }
    355348       
    356349        if (dev_ops != NULL)
    357                 ddf_fun_set_ops(child, dev_ops);
     350                ddf_fun_set_ops(fun, dev_ops);
    358351        else
    359                 ddf_fun_set_ops(child, &child_ops);
    360        
    361         ddf_fun_data_implant(child, dev_data);
     352                ddf_fun_set_ops(fun, &child_ops);
    362353       
    363354        /*
     
    365356         * driver data if there is no other data
    366357         */
    367         if (!dev_data) {
     358        if (ddf_fun_data_get(fun) == NULL) {
    368359                usb_hub_attached_device_t *new_device = ddf_fun_data_alloc(
    369                     child, sizeof(usb_hub_attached_device_t));
     360                    fun, sizeof(usb_hub_attached_device_t));
    370361                if (!new_device) {
    371362                        rc = ENOMEM;
     
    374365               
    375366                new_device->address = ctrl_pipe->wire->address;
    376                 new_device->fun = child;
     367                new_device->fun = fun;
    377368        }
    378369       
     
    384375       
    385376        list_foreach(match_ids.ids, link, match_id_t, match_id) {
    386                 rc = ddf_fun_add_match_id(child, match_id->id, match_id->score);
     377                rc = ddf_fun_add_match_id(fun, match_id->id, match_id->score);
    387378                if (rc != EOK) {
    388379                        clean_match_ids(&match_ids);
     
    393384        clean_match_ids(&match_ids);
    394385       
    395         rc = ddf_fun_bind(child);
     386        rc = ddf_fun_bind(fun);
    396387        if (rc != EOK)
    397388                goto failure;
    398389       
    399         *child_fun = child;
    400390        return EOK;
    401391       
    402392failure:
    403         if (child != NULL) {
    404                 /* This takes care of match_id deallocation as well. */
    405                 ddf_fun_destroy(child);
    406         }
    407        
    408393        return rc;
    409394}
Note: See TracChangeset for help on using the changeset viewer.