Changeset c7e162a in rtems-libbsd


Ignore:
Timestamp:
Apr 26, 2018, 1:19:42 PM (18 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
3fac9e9
Parents:
4b14263
Message:

mmc: Optimize mmc_wait_for_req()

Use a self-contained RTEMS binary semaphore instead of msleep() and
wakeup(). This is itself more efficient and in addition allows the use
of mmc_wakeup() in interrupt context.

Location:
freebsd/sys/dev/mmc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/dev/mmc/mmc.c

    r4b14263 rc7e162a  
    395395mmc_wakeup(struct mmc_request *req)
    396396{
     397#ifndef __rtems__
    397398        struct mmc_softc *sc;
    398399
     
    402403        MMC_UNLOCK(sc);
    403404        wakeup(req);
     405#else /* __rtems__ */
     406        rtems_binary_semaphore_post(&req->req_done);
     407#endif /* __rtems__ */
    404408}
    405409
     
    408412{
    409413
     414#ifdef __rtems__
     415        rtems_binary_semaphore_init(&req->req_done, "mmc_req_done");
     416#endif /* __rtems__ */
    410417        req->done = mmc_wakeup;
    411418        req->done_data = sc;
     
    419426        }
    420427        MMCBR_REQUEST(device_get_parent(sc->dev), sc->dev, req);
     428#ifndef __rtems__
    421429        MMC_LOCK(sc);
    422430        while ((req->flags & MMC_REQ_DONE) == 0)
    423431                msleep(req, &sc->sc_mtx, 0, "mmcreq", 0);
    424432        MMC_UNLOCK(sc);
     433#else /* __rtems__ */
     434        rtems_binary_semaphore_wait(&req->req_done);
     435        rtems_binary_semaphore_destroy(&req->req_done);
     436#endif /* __rtems__ */
    425437        if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
    426438                device_printf(sc->dev, "CMD%d RESULT: %d\n",
  • freebsd/sys/dev/mmc/mmcreg.h

    r4b14263 rc7e162a  
    5555#ifndef DEV_MMC_MMCREG_H
    5656#define DEV_MMC_MMCREG_H
     57#ifdef __rtems__
     58#include <rtems/thread.h>
     59#endif /* __rtems__ */
    5760
    5861/*
     
    174177        void (*done)(struct mmc_request *); /* Completion function */
    175178        void *done_data;                /* requestor set data */
     179#ifndef __rtems__
    176180        uint32_t flags;
    177181#define MMC_REQ_DONE    1
     182#else /* __rtems__ */
     183        rtems_binary_semaphore req_done;
     184#endif /* __rtems__ */
    178185};
    179186
Note: See TracChangeset for help on using the changeset viewer.