2 * Copyright 2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Bruno Albuquerque, bga@bug-br.org.br
8 * Copyright 2004-2006 yellowTAB GMbH. This file is
9 * based on work I did for ZETA while employed by
10 * yellowTAB and is used under permission.
14 #include "scsi_periph_int.h"
16 #include <scsi_cmds.h>
22 periph_synchronize_cache(scsi_periph_device_info
*device
, scsi_ccb
*request
)
24 scsi_cmd_sync_cache
* cmd
= (scsi_cmd_sync_cache
*)request
->cdb
;
26 request
->flags
= SCSI_DIR_NONE
;
29 request
->sg_list
= NULL
;
30 request
->data_length
= 0;
31 request
->timeout
= device
->std_timeout
;
34 memset(cmd
, 0, sizeof(*cmd
));
36 cmd
->opcode
= SCSI_OP_SYNCHRONIZE_CACHE
;
39 // TODO: Maybe we will actually want to set this one day...
42 request
->cdb_length
= sizeof(*cmd
);
44 device
->scsi
->sync_io(request
);
46 return periph_check_error(device
, request
);