Changeset f58154c5 in mainline for uspace/drv/ohci/endpoint_list.c


Ignore:
Timestamp:
2011-05-18T10:59:50Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17fc40c
Parents:
b2995c3 (diff), aeca5a3 (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:

Minor fixes and comments

UHCI: use provided barrier defines (buffer allocator should be able to use cacheable memory)
libusb: make usb enumeration routine follow USB spec more closely (wait periods)
OHCI: handle hw errors
OHCI: use provided barrier defines (buffer allocator should be able to use cacheable memory)
OHCI: reduce maximum buffer size for one transaction, this relaxes requirements on allocator providing hw accessible buffers.(memory does not have to be continuous) The only requirement that stays is the 32bit pointers limit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/endpoint_list.c

    rb2995c3 rf58154c5  
    3434#include <errno.h>
    3535#include <usb/debug.h>
     36#include <arch/barrier.h>
    3637
    3738#include "endpoint_list.h"
     
    4344 * @return Error code
    4445 *
    45  * Allocates memory for internal qh_t structure.
     46 * Allocates memory for internal ed_t structure.
    4647 */
    4748int endpoint_list_init(endpoint_list_t *instance, const char *name)
     
    6869 * @param[in] instance List to lead.
    6970 * @param[in] next List to append.
    70  * @return Error code
    7171 *
    72  * Does not check whether this replaces an existing list .
     72 * Does not check whether this replaces an existing list.
    7373 */
    7474void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next)
     
    7979}
    8080/*----------------------------------------------------------------------------*/
    81 /** Submit transfer endpoint to the list and queue.
     81/** Add endpoint to the list and queue.
    8282 *
    8383 * @param[in] instance List to use.
    84  * @param[in] endpoint Transfer endpoint to submit.
    85  * @return Error code
     84 * @param[in] endpoint Endpoint to add.
    8685 *
    8786 * The endpoint is added to the end of the list and queue.
     
    9998        /* Add to the hardware queue. */
    10099        if (list_empty(&instance->endpoint_list)) {
    101                 /* There is nothing scheduled */
     100                /* There are no active EDs */
    102101                last_ed = instance->list_head;
    103102        } else {
    104                 /* There is something scheduled */
     103                /* There are active EDs, get the last one */
    105104                hcd_endpoint_t *last = list_get_instance(
    106105                    instance->endpoint_list.prev, hcd_endpoint_t, link);
     106                assert(last);
    107107                last_ed = last->ed;
    108108        }
    109         /* keep link */
     109        /* Keep link */
    110110        hcd_ep->ed->next = last_ed->next;
     111        /* Make sure ED is written to the memory */
     112        write_barrier();
     113
     114        /* Add ed to the hw queue */
    111115        ed_append_ed(last_ed, hcd_ep->ed);
     116        /* Make sure ED is updated */
     117        write_barrier();
    112118
    113         asm volatile ("": : :"memory");
    114 
    115         /* Add to the driver list */
     119        /* Add to the sw list */
    116120        list_append(&hcd_ep->link, &instance->endpoint_list);
    117121
     
    129133}
    130134/*----------------------------------------------------------------------------*/
    131 #if 0
    132 /** Create list for finished endpoints.
     135/** Remove endpoint from the list and queue.
    133136 *
    134137 * @param[in] instance List to use.
    135  * @param[in] done list to fill
    136  */
    137 void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done)
    138 {
    139         assert(instance);
    140         assert(done);
    141 
    142         fibril_mutex_lock(&instance->guard);
    143         usb_log_debug2("Checking list %s for completed endpointes(%d).\n",
    144             instance->name, list_count(&instance->endpoint_list));
    145         link_t *current = instance->endpoint_list.next;
    146         while (current != &instance->endpoint_list) {
    147                 link_t *next = current->next;
    148                 hcd_endpoint_t *endpoint =
    149                     list_get_instance(current, hcd_endpoint_t, link);
    150 
    151                 if (endpoint_is_complete(endpoint)) {
    152                         /* Save for post-processing */
    153                         endpoint_list_remove_endpoint(instance, endpoint);
    154                         list_append(current, done);
    155                 }
    156                 current = next;
    157         }
    158         fibril_mutex_unlock(&instance->guard);
    159 }
    160 /*----------------------------------------------------------------------------*/
    161 /** Walk the list and abort all endpointes.
    162  *
    163  * @param[in] instance List to use.
    164  */
    165 void endpoint_list_abort_all(endpoint_list_t *instance)
    166 {
    167         fibril_mutex_lock(&instance->guard);
    168         while (!list_empty(&instance->endpoint_list)) {
    169                 link_t *current = instance->endpoint_list.next;
    170                 hcd_endpoint_t *endpoint =
    171                     list_get_instance(current, hcd_endpoint_t, link);
    172                 endpoint_list_remove_endpoint(instance, endpoint);
    173                 hcd_endpoint_finish_error(endpoint, EIO);
    174         }
    175         fibril_mutex_unlock(&instance->guard);
    176 }
    177 #endif
    178 /*----------------------------------------------------------------------------*/
    179 /** Remove a transfer endpoint from the list and queue.
    180  *
    181  * @param[in] instance List to use.
    182  * @param[in] endpoint Transfer endpoint to remove.
    183  * @return Error code
    184  *
    185  * Does not lock the transfer list, caller is responsible for that.
     138 * @param[in] endpoint Endpoint to remove.
    186139 */
    187140void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)
     
    212165        assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(hcd_ep->ed));
    213166        prev_ed->next = hcd_ep->ed->next;
     167        /* Make sure ED is updated */
     168        write_barrier();
    214169
    215         asm volatile ("": : :"memory");
    216170        usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n",
    217171            hcd_ep, qpos, instance->name, hcd_ep->ed->next);
Note: See TracChangeset for help on using the changeset viewer.