sati_start_stop_unit.h revision 230557
1272343Sngie/*-
2272343Sngie * This file is provided under a dual BSD/GPLv2 license.  When using or
3272343Sngie * redistributing this file, you may do so under either license.
4272343Sngie *
5272343Sngie * GPL LICENSE SUMMARY
6272343Sngie *
7272343Sngie * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8272343Sngie *
9272343Sngie * This program is free software; you can redistribute it and/or modify
10272343Sngie * it under the terms of version 2 of the GNU General Public License as
11272343Sngie * published by the Free Software Foundation.
12272343Sngie *
13272343Sngie * This program is distributed in the hope that it will be useful, but
14272343Sngie * WITHOUT ANY WARRANTY; without even the implied warranty of
15272343Sngie * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16272343Sngie * General Public License for more details.
17272343Sngie *
18272343Sngie * You should have received a copy of the GNU General Public License
19272343Sngie * along with this program; if not, write to the Free Software
20272343Sngie * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21272343Sngie * The full GNU General Public License is included in this distribution
22272343Sngie * in the file called LICENSE.GPL.
23272343Sngie *
24272343Sngie * BSD LICENSE
25272343Sngie *
26272343Sngie * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27272343Sngie * All rights reserved.
28272343Sngie *
29272343Sngie * Redistribution and use in source and binary forms, with or without
30272343Sngie * modification, are permitted provided that the following conditions
31272343Sngie * are met:
32272343Sngie *
33272343Sngie *   * Redistributions of source code must retain the above copyright
34272343Sngie *     notice, this list of conditions and the following disclaimer.
35272343Sngie *   * Redistributions in binary form must reproduce the above copyright
36272343Sngie *     notice, this list of conditions and the following disclaimer in
37272343Sngie *     the documentation and/or other materials provided with the
38272343Sngie *     distribution.
39272343Sngie *
40272343Sngie * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41272343Sngie * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42272343Sngie * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43272343Sngie * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44272343Sngie * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45272343Sngie * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46272343Sngie * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47272343Sngie * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48272343Sngie * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49272343Sngie * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50272343Sngie * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51272343Sngie *
52272343Sngie * $FreeBSD$
53272343Sngie */
54272343Sngie#ifndef _SATI_START_STOP_UNIT_H_
55272343Sngie#define _SATI_START_STOP_UNIT_H_
56272343Sngie
57272343Sngie/**
58272343Sngie * @file
59272343Sngie * @brief This file contains the method declarations and type definitions
60272343Sngie *        required to translate the SCSI start_stop_unit commands.
61272343Sngie */
62272343Sngie
63272343Sngie#include <dev/isci/scil/intel_scsi.h>
64272343Sngie#include <dev/isci/scil/sati_types.h>
65272343Sngie#include <dev/isci/scil/sati_translator_sequence.h>
66272343Sngie
67272343Sngie#define SATI_START_STOP_UNIT_POWER_CONDITION(cdb) \
68272343Sngie   (( sati_get_cdb_byte(cdb, 4) & SCSI_START_STOP_UNIT_POWER_CONDITION_MASK ) \
69272343Sngie    >> SCSI_START_STOP_UNIT_POWER_CONDITION_SHIFT)
70272343Sngie
71272343Sngie#define SATI_START_STOP_UNIT_START_BIT(cdb) \
72272343Sngie   (( sati_get_cdb_byte(cdb, 4) & SCSI_START_STOP_UNIT_START_BIT_MASK ) \
73272343Sngie    >> SCSI_START_STOP_UNIT_START_BIT_SHIFT)
74272343Sngie
75272343Sngie#define SATI_START_STOP_UNIT_LOEJ_BIT(cdb) \
76272343Sngie   (( sati_get_cdb_byte(cdb, 4) & SCSI_START_STOP_UNIT_LOEJ_BIT_MASK ) \
77272343Sngie    >> SCSI_START_STOP_UNIT_LOEJ_BIT_SHIFT)
78272343Sngie
79272343Sngie#define SATI_START_STOP_UNIT_NO_FLUSH_BIT(cdb) \
80272343Sngie   (( sati_get_cdb_byte(cdb, 4) & SCSI_START_STOP_UNIT_NO_FLUSH_MASK ) \
81272343Sngie    >> SCSI_START_STOP_UNIT_NO_FLUSH_SHIFT)
82272343Sngie
83272343Sngie#define SATI_START_STOP_UNIT_IMMED_BIT(cdb) \
84272343Sngie   (( sati_get_cdb_byte(cdb, 1) & SCSI_START_STOP_UNIT_IMMED_MASK ) \
85272343Sngie    >> SCSI_START_STOP_UNIT_IMMED_SHIFT)
86272343Sngie
87272343Sngie#define SATI_START_STOP_UNIT_POWER_CONDITION_MODIFIER(cdb) \
88   (( sati_get_cdb_byte(cdb, 3) & SCSI_START_STOP_UNIT_POWER_CONDITION_MODIFIER_MASK) \
89   >> SCSI_START_STOP_UNIT_POWER_CONDITION_MODIFIER_SHIFT)
90
91SATI_STATUS sati_start_stop_unit_translate_command(
92   SATI_TRANSLATOR_SEQUENCE_T * sequence,
93   void                       * scsi_io,
94   void                       * ata_io
95);
96
97SATI_STATUS sati_start_stop_unit_translate_response(
98   SATI_TRANSLATOR_SEQUENCE_T * sequence,
99   void                       * scsi_io,
100   void                       * ata_io
101);
102#endif // _SATI_START_STOP_UNIT_H_
103