Changeset 8e7c9fe in mainline for uspace/drv/bus/usb/usbmast


Ignore:
Timestamp:
2014-09-12T03:45:25Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c53b58e
Parents:
3eb0c85 (diff), 105d8d6 (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:

merge mainline changes

most usb changes were reverted. blink and usbmass were fixed
known problems:
ehci won't initialize
usbmast asserts on unmount (happens on mainline too)

Location:
uspace/drv/bus/usb/usbmast
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/bo_trans.h

    r3eb0c85 r8e7c9fe  
    4343#include <usb/dev/driver.h>
    4444#include "usbmast.h"
    45 
    46 #define BULK_IN_EP 0
    47 #define BULK_OUT_EP 1
    4845
    4946typedef enum cmd_status {
  • uspace/drv/bus/usb/usbmast/main.c

    r3eb0c85 r8e7c9fe  
    8282static int usbmast_bd_close(bd_srv_t *);
    8383static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
     84static int usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
    8485static int usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
    8586static int usbmast_bd_get_block_size(bd_srv_t *, size_t *);
     
    9091        .close = usbmast_bd_close,
    9192        .read_blocks = usbmast_bd_read_blocks,
     93        .sync_cache = usbmast_bd_sync_cache,
    9294        .write_blocks = usbmast_bd_write_blocks,
    9395        .get_block_size = usbmast_bd_get_block_size,
     
    344346}
    345347
     348/** Synchronize blocks to nonvolatile storage. */
     349static int usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
     350{
     351        usbmast_fun_t *mfun = bd_srv_usbmast(bd);
     352
     353        return usbmast_sync_cache(mfun, ba, cnt);
     354}
     355
    346356/** Write blocks to the device. */
    347357static int usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
  • uspace/drv/bus/usb/usbmast/scsi_ms.c

    r3eb0c85 r8e7c9fe  
    383383}
    384384
     385/** Perform SCSI Synchronize Cache command on USB mass storage device.
     386 *
     387 * @param mfun          Mass storage function
     388 * @param ba            Address of first block
     389 * @param nblocks       Number of blocks to read
     390 * @param data          Data to write
     391 *
     392 * @return              Error code
     393 */
     394int usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
     395{
     396        scsi_cmd_t cmd;
     397        scsi_cdb_sync_cache_10_t cdb;
     398        int rc;
     399
     400        if (ba > UINT32_MAX)
     401                return ELIMIT;
     402
     403        if (nblocks > UINT16_MAX)
     404                return ELIMIT;
     405
     406        memset(&cdb, 0, sizeof(cdb));
     407        cdb.op_code = SCSI_CMD_SYNC_CACHE_10;
     408        cdb.lba = host2uint32_t_be(ba);
     409        cdb.numlb = host2uint16_t_be(nblocks);
     410
     411        memset(&cmd, 0, sizeof(cmd));
     412        cmd.cdb = &cdb;
     413        cmd.cdb_size = sizeof(cdb);
     414
     415        rc = usbmast_run_cmd(mfun, &cmd);
     416
     417        if (rc != EOK) {
     418                usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.\n",
     419                   usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
     420                return rc;
     421        }
     422
     423        if (cmd.status != CMDS_GOOD) {
     424                usb_log_error("Synchronize Cache (10) command failed, device %s.\n",
     425                   usb_device_get_name(mfun->mdev->usb_dev));
     426                return EIO;
     427        }
     428
     429        return EOK;
     430}
     431
    385432/**
    386433 * @}
  • uspace/drv/bus/usb/usbmast/scsi_ms.h

    r3eb0c85 r8e7c9fe  
    6464extern int usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
    6565extern int usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
     66extern int usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
    6667extern const char *usbmast_scsi_dev_type_str(unsigned);
    6768
Note: See TracChangeset for help on using the changeset viewer.