Files
haiku-beta6/src/add-ons/kernel/generic/scsi_periph/sync.c
T
Bruno G. Albuquerque e62e6bd5a7 Implemented support for hardware cache flush. This is based on code I originally
did for yellowTAB GmbH when I worked for then and is being used under permission.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19840 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-01-17 01:39:59 +00:00

48 lines
1.0 KiB
C

/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Bruno Albuquerque, [email protected]
*
* Copyright 2004-2006 yellowTAB GMbH. This file is
* based on work I did for ZETA while employed by
* yellowTAB and is used under permission.
*
*/
#include "scsi_periph_int.h"
#include <bus/scsi/scsi_cmds.h>
#include <string.h>
err_res
periph_synchronize_cache(scsi_periph_device_info *device, scsi_ccb *request)
{
scsi_cmd_sync_cache* cmd = (scsi_cmd_sync_cache*)request->cdb;
request->flags = SCSI_DIR_NONE;
request->data = NULL;
request->sg_list = NULL;
request->data_len = 0;
request->timeout = device->std_timeout;
request->sort = -1;
memset(cmd, 0, sizeof(*cmd));
cmd->opcode = SCSI_OP_SYNCHRONIZE_CACHE;
cmd->immed = 0;
// TODO(bga): Maybe we will actually want to set those one day...
cmd->nblocks_high = 0;
cmd->nblocks_low = 0;
request->cdb_len = sizeof(*cmd);
device->scsi->sync_io(request);
return periph_check_error(device, request);
}