4748 lines
129 KiB
C
4748 lines
129 KiB
C
/*++
|
||
|
||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
||
Module Name:
|
||
|
||
minitape.h
|
||
|
||
Abstract:
|
||
|
||
Type definitions for minitape drivers.
|
||
|
||
Revision History:
|
||
|
||
--*/
|
||
|
||
#ifndef _MINITAPE_
|
||
#define _MINITAPE_
|
||
|
||
#include "stddef.h"
|
||
|
||
#define ASSERT( exp )
|
||
|
||
#if DBG
|
||
|
||
#define DebugPrint(x) ScsiDebugPrint x
|
||
|
||
#else
|
||
|
||
#define DebugPrint(x)
|
||
|
||
#endif // DBG
|
||
|
||
#ifndef IN
|
||
#define IN
|
||
#endif
|
||
|
||
#ifndef OUT
|
||
#define OUT
|
||
#endif
|
||
|
||
#ifndef OPTIONAL
|
||
#define OPTIONAL
|
||
#endif
|
||
|
||
#ifndef NOTHING
|
||
#define NOTHING
|
||
#endif
|
||
|
||
#ifndef CRITICAL
|
||
#define CRITICAL
|
||
#endif
|
||
|
||
#ifndef ANYSIZE_ARRAY
|
||
#define ANYSIZE_ARRAY 1 // winnt
|
||
#endif
|
||
|
||
// begin_winnt
|
||
|
||
#if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
|
||
#define RESTRICTED_POINTER __restrict
|
||
#else
|
||
#define RESTRICTED_POINTER
|
||
#endif
|
||
|
||
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
|
||
#define UNALIGNED __unaligned
|
||
#if defined(_WIN64)
|
||
#define UNALIGNED64 __unaligned
|
||
#else
|
||
#define UNALIGNED64
|
||
#endif
|
||
#else
|
||
#define UNALIGNED
|
||
#define UNALIGNED64
|
||
#endif
|
||
|
||
|
||
#if defined(_WIN64) || defined(_M_ALPHA)
|
||
#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
|
||
#define MEMORY_ALLOCATION_ALIGNMENT 16
|
||
#else
|
||
#define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
|
||
#define MEMORY_ALLOCATION_ALIGNMENT 8
|
||
#endif
|
||
|
||
//
|
||
// TYPE_ALIGNMENT will return the alignment requirements of a given type for
|
||
// the current platform.
|
||
//
|
||
|
||
#ifdef __cplusplus
|
||
#if _MSC_VER >= 1300
|
||
#define TYPE_ALIGNMENT( t ) __alignof(t)
|
||
#endif
|
||
#else
|
||
#define TYPE_ALIGNMENT( t ) \
|
||
FIELD_OFFSET( struct { char x; t test; }, test )
|
||
#endif
|
||
|
||
#if defined(_WIN64)
|
||
|
||
#define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( ULONG ) ? \
|
||
TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( ULONG ))
|
||
|
||
#define PROBE_ALIGNMENT32( _s ) TYPE_ALIGNMENT( ULONG )
|
||
|
||
#else
|
||
|
||
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG )
|
||
|
||
#endif
|
||
|
||
//
|
||
// C_ASSERT() can be used to perform many compile-time assertions:
|
||
// type sizes, field offsets, etc.
|
||
//
|
||
// An assertion failure results in error C2118: negative subscript.
|
||
//
|
||
|
||
#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
|
||
|
||
#if !defined(_MAC) && (defined(_M_MRX000) || defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_VER >= 1100) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
|
||
#define POINTER_64 __ptr64
|
||
typedef unsigned __int64 POINTER_64_INT;
|
||
#if defined(_WIN64)
|
||
#define POINTER_32 __ptr32
|
||
#else
|
||
#define POINTER_32
|
||
#endif
|
||
#else
|
||
#if defined(_MAC) && defined(_MAC_INT_64)
|
||
#define POINTER_64 __ptr64
|
||
typedef unsigned __int64 POINTER_64_INT;
|
||
#else
|
||
#define POINTER_64
|
||
typedef unsigned long POINTER_64_INT;
|
||
#endif
|
||
#define POINTER_32
|
||
#endif
|
||
|
||
#if defined(_IA64_) || defined(_AMD64_)
|
||
#define FIRMWARE_PTR
|
||
#else
|
||
#define FIRMWARE_PTR POINTER_32
|
||
#endif
|
||
|
||
#include <basetsd.h>
|
||
|
||
// end_winnt
|
||
|
||
#ifndef CONST
|
||
#define CONST const
|
||
#endif
|
||
|
||
// begin_winnt
|
||
|
||
#if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS)
|
||
#define DECLSPEC_IMPORT __declspec(dllimport)
|
||
#else
|
||
#define DECLSPEC_IMPORT
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_NORETURN
|
||
#if (_MSC_VER >= 1200) && !defined(MIDL_PASS)
|
||
#define DECLSPEC_NORETURN __declspec(noreturn)
|
||
#else
|
||
#define DECLSPEC_NORETURN
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_ALIGN
|
||
#if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
||
#define DECLSPEC_ALIGN(x) __declspec(align(x))
|
||
#else
|
||
#define DECLSPEC_ALIGN(x)
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_CACHEALIGN
|
||
#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_UUID
|
||
#if (_MSC_VER >= 1100) && defined (__cplusplus)
|
||
#define DECLSPEC_UUID(x) __declspec(uuid(x))
|
||
#else
|
||
#define DECLSPEC_UUID(x)
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_NOVTABLE
|
||
#if (_MSC_VER >= 1100) && defined(__cplusplus)
|
||
#define DECLSPEC_NOVTABLE __declspec(novtable)
|
||
#else
|
||
#define DECLSPEC_NOVTABLE
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_SELECTANY
|
||
#if (_MSC_VER >= 1100)
|
||
#define DECLSPEC_SELECTANY __declspec(selectany)
|
||
#else
|
||
#define DECLSPEC_SELECTANY
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef NOP_FUNCTION
|
||
#if (_MSC_VER >= 1210)
|
||
#define NOP_FUNCTION __noop
|
||
#else
|
||
#define NOP_FUNCTION (void)0
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_ADDRSAFE
|
||
#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
|
||
#define DECLSPEC_ADDRSAFE __declspec(address_safe)
|
||
#else
|
||
#define DECLSPEC_ADDRSAFE
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef FORCEINLINE
|
||
#if (_MSC_VER >= 1200)
|
||
#define FORCEINLINE __forceinline
|
||
#else
|
||
#define FORCEINLINE __inline
|
||
#endif
|
||
#endif
|
||
|
||
#ifndef DECLSPEC_DEPRECATED
|
||
#if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
||
#define DECLSPEC_DEPRECATED __declspec(deprecated)
|
||
#define DEPRECATE_SUPPORTED
|
||
#else
|
||
#define DECLSPEC_DEPRECATED
|
||
#undef DEPRECATE_SUPPORTED
|
||
#endif
|
||
#endif
|
||
|
||
// end_winnt
|
||
|
||
#ifdef DEPRECATE_DDK_FUNCTIONS
|
||
#ifdef _NTDDK_
|
||
#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
|
||
#ifdef DEPRECATE_SUPPORTED
|
||
#define PRAGMA_DEPRECATED_DDK 1
|
||
#endif
|
||
#else
|
||
#define DECLSPEC_DEPRECATED_DDK
|
||
#define PRAGMA_DEPRECATED_DDK 1
|
||
#endif
|
||
#else
|
||
#define DECLSPEC_DEPRECATED_DDK
|
||
#define PRAGMA_DEPRECATED_DDK 0
|
||
#endif
|
||
|
||
//
|
||
// Void
|
||
//
|
||
// begin_winnt
|
||
|
||
typedef void *PVOID;
|
||
typedef void * POINTER_64 PVOID64;
|
||
|
||
// end_winnt
|
||
|
||
#if defined(_M_IX86)
|
||
#define FASTCALL _fastcall
|
||
#else
|
||
#define FASTCALL
|
||
#endif
|
||
|
||
|
||
//
|
||
// Basics
|
||
//
|
||
|
||
#ifndef VOID
|
||
#define VOID void
|
||
typedef char CHAR;
|
||
typedef short SHORT;
|
||
typedef long LONG;
|
||
#endif
|
||
|
||
//
|
||
// UNICODE (Wide Character) types
|
||
//
|
||
|
||
#ifndef _MAC
|
||
typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
|
||
#else
|
||
// some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char
|
||
typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
|
||
#endif
|
||
|
||
typedef WCHAR *PWCHAR;
|
||
typedef WCHAR *LPWCH, *PWCH;
|
||
typedef CONST WCHAR *LPCWCH, *PCWCH;
|
||
typedef WCHAR *NWPSTR;
|
||
typedef WCHAR *LPWSTR, *PWSTR;
|
||
typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
|
||
|
||
typedef CONST WCHAR *LPCWSTR, *PCWSTR;
|
||
typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
|
||
|
||
//
|
||
// ANSI (Multi-byte Character) types
|
||
//
|
||
typedef CHAR *PCHAR;
|
||
typedef CHAR *LPCH, *PCH;
|
||
|
||
typedef CONST CHAR *LPCCH, *PCCH;
|
||
typedef CHAR *NPSTR;
|
||
typedef CHAR *LPSTR, *PSTR;
|
||
typedef CONST CHAR *LPCSTR, *PCSTR;
|
||
|
||
//
|
||
// Neutral ANSI/UNICODE types and macros
|
||
//
|
||
#ifdef UNICODE // r_winnt
|
||
|
||
#ifndef _TCHAR_DEFINED
|
||
typedef WCHAR TCHAR, *PTCHAR;
|
||
typedef WCHAR TUCHAR, *PTUCHAR;
|
||
#define _TCHAR_DEFINED
|
||
#endif /* !_TCHAR_DEFINED */
|
||
|
||
typedef LPWSTR LPTCH, PTCH;
|
||
typedef LPWSTR PTSTR, LPTSTR;
|
||
typedef LPCWSTR PCTSTR, LPCTSTR;
|
||
typedef LPUWSTR PUTSTR, LPUTSTR;
|
||
typedef LPCUWSTR PCUTSTR, LPCUTSTR;
|
||
typedef LPWSTR LP;
|
||
#define __TEXT(quote) L##quote // r_winnt
|
||
|
||
#else /* UNICODE */ // r_winnt
|
||
|
||
#ifndef _TCHAR_DEFINED
|
||
typedef char TCHAR, *PTCHAR;
|
||
typedef unsigned char TUCHAR, *PTUCHAR;
|
||
#define _TCHAR_DEFINED
|
||
#endif /* !_TCHAR_DEFINED */
|
||
|
||
typedef LPSTR LPTCH, PTCH;
|
||
typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
|
||
typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
|
||
#define __TEXT(quote) quote // r_winnt
|
||
|
||
#endif /* UNICODE */ // r_winnt
|
||
#define TEXT(quote) __TEXT(quote) // r_winnt
|
||
|
||
|
||
// end_winnt
|
||
|
||
typedef double DOUBLE;
|
||
|
||
typedef struct _QUAD { // QUAD is for those times we want
|
||
double DoNotUseThisField; // an 8 byte aligned 8 byte long structure
|
||
} QUAD; // which is NOT really a floating point
|
||
// number. Use DOUBLE if you want an FP
|
||
// number.
|
||
|
||
//
|
||
// Pointer to Basics
|
||
//
|
||
|
||
typedef SHORT *PSHORT; // winnt
|
||
typedef LONG *PLONG; // winnt
|
||
typedef QUAD *PQUAD;
|
||
|
||
//
|
||
// Unsigned Basics
|
||
//
|
||
|
||
// Tell windef.h that some types are already defined.
|
||
#define BASETYPES
|
||
|
||
typedef unsigned char UCHAR;
|
||
typedef unsigned short USHORT;
|
||
typedef unsigned long ULONG;
|
||
typedef QUAD UQUAD;
|
||
|
||
//
|
||
// Pointer to Unsigned Basics
|
||
//
|
||
|
||
typedef UCHAR *PUCHAR;
|
||
typedef USHORT *PUSHORT;
|
||
typedef ULONG *PULONG;
|
||
typedef UQUAD *PUQUAD;
|
||
|
||
//
|
||
// Signed characters
|
||
//
|
||
|
||
typedef signed char SCHAR;
|
||
typedef SCHAR *PSCHAR;
|
||
|
||
#ifndef NO_STRICT
|
||
#ifndef STRICT
|
||
#define STRICT 1
|
||
#endif
|
||
#endif
|
||
|
||
//
|
||
// Handle to an Object
|
||
//
|
||
|
||
// begin_winnt
|
||
|
||
#ifdef STRICT
|
||
typedef void *HANDLE;
|
||
#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
|
||
#else
|
||
typedef PVOID HANDLE;
|
||
#define DECLARE_HANDLE(name) typedef HANDLE name
|
||
#endif
|
||
typedef HANDLE *PHANDLE;
|
||
|
||
//
|
||
// Flag (bit) fields
|
||
//
|
||
|
||
typedef UCHAR FCHAR;
|
||
typedef USHORT FSHORT;
|
||
typedef ULONG FLONG;
|
||
|
||
// Component Object Model defines, and macros
|
||
|
||
#ifndef _HRESULT_DEFINED
|
||
#define _HRESULT_DEFINED
|
||
typedef LONG HRESULT;
|
||
|
||
#endif // !_HRESULT_DEFINED
|
||
|
||
#ifdef __cplusplus
|
||
#define EXTERN_C extern "C"
|
||
#else
|
||
#define EXTERN_C extern
|
||
#endif
|
||
|
||
#if defined(_WIN32) || defined(_MPPC_)
|
||
|
||
// Win32 doesn't support __export
|
||
|
||
#ifdef _68K_
|
||
#define STDMETHODCALLTYPE __cdecl
|
||
#else
|
||
#define STDMETHODCALLTYPE __stdcall
|
||
#endif
|
||
#define STDMETHODVCALLTYPE __cdecl
|
||
|
||
#define STDAPICALLTYPE __stdcall
|
||
#define STDAPIVCALLTYPE __cdecl
|
||
|
||
#else
|
||
|
||
#define STDMETHODCALLTYPE __export __stdcall
|
||
#define STDMETHODVCALLTYPE __export __cdecl
|
||
|
||
#define STDAPICALLTYPE __export __stdcall
|
||
#define STDAPIVCALLTYPE __export __cdecl
|
||
|
||
#endif
|
||
|
||
|
||
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
|
||
#define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
|
||
|
||
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
|
||
#define STDMETHODIMP_(type) type STDMETHODCALLTYPE
|
||
|
||
// The 'V' versions allow Variable Argument lists.
|
||
|
||
#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
|
||
#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
|
||
|
||
#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
|
||
#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
|
||
|
||
// end_winnt
|
||
|
||
|
||
//
|
||
// Low order two bits of a handle are ignored by the system and available
|
||
// for use by application code as tag bits. The remaining bits are opaque
|
||
// and used to store a serial number and table index.
|
||
//
|
||
|
||
#define OBJ_HANDLE_TAGBITS 0x00000003L
|
||
|
||
//
|
||
// Cardinal Data Types [0 - 2**N-2)
|
||
//
|
||
|
||
typedef char CCHAR; // winnt
|
||
typedef short CSHORT;
|
||
typedef ULONG CLONG;
|
||
|
||
typedef CCHAR *PCCHAR;
|
||
typedef CSHORT *PCSHORT;
|
||
typedef CLONG *PCLONG;
|
||
|
||
|
||
//
|
||
// __int64 is only supported by 2.0 and later midl.
|
||
// __midl is set by the 2.0 midl and not by 1.0 midl.
|
||
//
|
||
|
||
#define _ULONGLONG_
|
||
#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
|
||
typedef __int64 LONGLONG;
|
||
typedef unsigned __int64 ULONGLONG;
|
||
|
||
#define MAXLONGLONG (0x7fffffffffffffff)
|
||
#else
|
||
|
||
#if defined(_MAC) && defined(_MAC_INT_64)
|
||
typedef __int64 LONGLONG;
|
||
typedef unsigned __int64 ULONGLONG;
|
||
|
||
#define MAXLONGLONG (0x7fffffffffffffff)
|
||
#else
|
||
typedef double LONGLONG;
|
||
typedef double ULONGLONG;
|
||
#endif //_MAC and int64
|
||
|
||
#endif
|
||
|
||
typedef LONGLONG *PLONGLONG;
|
||
typedef ULONGLONG *PULONGLONG;
|
||
|
||
// Update Sequence Number
|
||
|
||
typedef LONGLONG USN;
|
||
|
||
#if defined(MIDL_PASS)
|
||
typedef struct _LARGE_INTEGER {
|
||
#else // MIDL_PASS
|
||
typedef union _LARGE_INTEGER {
|
||
struct {
|
||
ULONG LowPart;
|
||
LONG HighPart;
|
||
};
|
||
struct {
|
||
ULONG LowPart;
|
||
LONG HighPart;
|
||
} u;
|
||
#endif //MIDL_PASS
|
||
LONGLONG QuadPart;
|
||
} LARGE_INTEGER;
|
||
|
||
typedef LARGE_INTEGER *PLARGE_INTEGER;
|
||
|
||
#if defined(MIDL_PASS)
|
||
typedef struct _ULARGE_INTEGER {
|
||
#else // MIDL_PASS
|
||
typedef union _ULARGE_INTEGER {
|
||
struct {
|
||
ULONG LowPart;
|
||
ULONG HighPart;
|
||
};
|
||
struct {
|
||
ULONG LowPart;
|
||
ULONG HighPart;
|
||
} u;
|
||
#endif //MIDL_PASS
|
||
ULONGLONG QuadPart;
|
||
} ULARGE_INTEGER;
|
||
|
||
typedef ULARGE_INTEGER *PULARGE_INTEGER;
|
||
|
||
|
||
//
|
||
// Boolean
|
||
//
|
||
|
||
typedef UCHAR BOOLEAN; // winnt
|
||
typedef BOOLEAN *PBOOLEAN; // winnt
|
||
|
||
|
||
//
|
||
// Constants
|
||
//
|
||
|
||
#define FALSE 0
|
||
#define TRUE 1
|
||
|
||
#ifndef NULL
|
||
#ifdef __cplusplus
|
||
#define NULL 0
|
||
#define NULL64 0
|
||
#else
|
||
#define NULL ((void *)0)
|
||
#define NULL64 ((void * POINTER_64)0)
|
||
#endif
|
||
#endif // NULL
|
||
|
||
|
||
//
|
||
// Macros used to eliminate compiler warning generated when formal
|
||
// parameters or local variables are not declared.
|
||
//
|
||
// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
|
||
// referenced but will be once the module is completely developed.
|
||
//
|
||
// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
|
||
// referenced but will be once the module is completely developed.
|
||
//
|
||
// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
|
||
//
|
||
// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
|
||
// eventually be made into a null macro to help determine whether there
|
||
// is unfinished work.
|
||
//
|
||
|
||
#if ! defined(lint)
|
||
#define UNREFERENCED_PARAMETER(P) (P)
|
||
#define DBG_UNREFERENCED_PARAMETER(P) (P)
|
||
#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
|
||
|
||
#else // lint
|
||
|
||
// Note: lint -e530 says don't complain about uninitialized variables for
|
||
// this varible. Error 527 has to do with unreachable code.
|
||
// -restore restores checking to the -save state
|
||
|
||
#define UNREFERENCED_PARAMETER(P) \
|
||
/*lint -save -e527 -e530 */ \
|
||
{ \
|
||
(P) = (P); \
|
||
} \
|
||
/*lint -restore */
|
||
#define DBG_UNREFERENCED_PARAMETER(P) \
|
||
/*lint -save -e527 -e530 */ \
|
||
{ \
|
||
(P) = (P); \
|
||
} \
|
||
/*lint -restore */
|
||
#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
|
||
/*lint -save -e527 -e530 */ \
|
||
{ \
|
||
(V) = (V); \
|
||
} \
|
||
/*lint -restore */
|
||
|
||
#endif // lint
|
||
|
||
//
|
||
// Macro used to eliminate compiler warning 4715 within a switch statement
|
||
// when all possible cases have already been accounted for.
|
||
//
|
||
// switch (a & 3) {
|
||
// case 0: return 1;
|
||
// case 1: return Foo();
|
||
// case 2: return Bar();
|
||
// case 3: return 1;
|
||
// DEFAULT_UNREACHABLE;
|
||
//
|
||
|
||
#if (_MSC_VER > 1200)
|
||
#define DEFAULT_UNREACHABLE default: __assume(0)
|
||
#else
|
||
|
||
//
|
||
// Older compilers do not support __assume(), and there is no other free
|
||
// method of eliminating the warning.
|
||
//
|
||
|
||
#define DEFAULT_UNREACHABLE
|
||
|
||
#endif
|
||
|
||
// end_winnt
|
||
|
||
//
|
||
// Define standard min and max macros
|
||
//
|
||
|
||
#ifndef NOMINMAX
|
||
|
||
#ifndef min
|
||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||
#endif
|
||
|
||
#ifndef max
|
||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||
#endif
|
||
|
||
#endif // NOMINMAX
|
||
|
||
|
||
|
||
//
|
||
// IOCTL_TAPE_ERASE definitions
|
||
//
|
||
|
||
#define TAPE_ERASE_SHORT 0L
|
||
#define TAPE_ERASE_LONG 1L
|
||
|
||
typedef struct _TAPE_ERASE {
|
||
ULONG Type;
|
||
BOOLEAN Immediate;
|
||
} TAPE_ERASE, *PTAPE_ERASE;
|
||
|
||
//
|
||
// IOCTL_TAPE_PREPARE definitions
|
||
//
|
||
|
||
#define TAPE_LOAD 0L
|
||
#define TAPE_UNLOAD 1L
|
||
#define TAPE_TENSION 2L
|
||
#define TAPE_LOCK 3L
|
||
#define TAPE_UNLOCK 4L
|
||
#define TAPE_FORMAT 5L
|
||
|
||
typedef struct _TAPE_PREPARE {
|
||
ULONG Operation;
|
||
BOOLEAN Immediate;
|
||
} TAPE_PREPARE, *PTAPE_PREPARE;
|
||
|
||
//
|
||
// IOCTL_TAPE_WRITE_MARKS definitions
|
||
//
|
||
|
||
#define TAPE_SETMARKS 0L
|
||
#define TAPE_FILEMARKS 1L
|
||
#define TAPE_SHORT_FILEMARKS 2L
|
||
#define TAPE_LONG_FILEMARKS 3L
|
||
|
||
typedef struct _TAPE_WRITE_MARKS {
|
||
ULONG Type;
|
||
ULONG Count;
|
||
BOOLEAN Immediate;
|
||
} TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
|
||
|
||
//
|
||
// IOCTL_TAPE_GET_POSITION definitions
|
||
//
|
||
|
||
#define TAPE_ABSOLUTE_POSITION 0L
|
||
#define TAPE_LOGICAL_POSITION 1L
|
||
#define TAPE_PSEUDO_LOGICAL_POSITION 2L
|
||
|
||
typedef struct _TAPE_GET_POSITION {
|
||
ULONG Type;
|
||
ULONG Partition;
|
||
LARGE_INTEGER Offset;
|
||
} TAPE_GET_POSITION, *PTAPE_GET_POSITION;
|
||
|
||
//
|
||
// IOCTL_TAPE_SET_POSITION definitions
|
||
//
|
||
|
||
#define TAPE_REWIND 0L
|
||
#define TAPE_ABSOLUTE_BLOCK 1L
|
||
#define TAPE_LOGICAL_BLOCK 2L
|
||
#define TAPE_PSEUDO_LOGICAL_BLOCK 3L
|
||
#define TAPE_SPACE_END_OF_DATA 4L
|
||
#define TAPE_SPACE_RELATIVE_BLOCKS 5L
|
||
#define TAPE_SPACE_FILEMARKS 6L
|
||
#define TAPE_SPACE_SEQUENTIAL_FMKS 7L
|
||
#define TAPE_SPACE_SETMARKS 8L
|
||
#define TAPE_SPACE_SEQUENTIAL_SMKS 9L
|
||
|
||
typedef struct _TAPE_SET_POSITION {
|
||
ULONG Method;
|
||
ULONG Partition;
|
||
LARGE_INTEGER Offset;
|
||
BOOLEAN Immediate;
|
||
} TAPE_SET_POSITION, *PTAPE_SET_POSITION;
|
||
|
||
//
|
||
// IOCTL_TAPE_GET_DRIVE_PARAMS definitions
|
||
//
|
||
|
||
//
|
||
// Definitions for FeaturesLow parameter
|
||
//
|
||
|
||
#define TAPE_DRIVE_FIXED 0x00000001
|
||
#define TAPE_DRIVE_SELECT 0x00000002
|
||
#define TAPE_DRIVE_INITIATOR 0x00000004
|
||
|
||
#define TAPE_DRIVE_ERASE_SHORT 0x00000010
|
||
#define TAPE_DRIVE_ERASE_LONG 0x00000020
|
||
#define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040
|
||
#define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080
|
||
|
||
#define TAPE_DRIVE_TAPE_CAPACITY 0x00000100
|
||
#define TAPE_DRIVE_TAPE_REMAINING 0x00000200
|
||
#define TAPE_DRIVE_FIXED_BLOCK 0x00000400
|
||
#define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800
|
||
|
||
#define TAPE_DRIVE_WRITE_PROTECT 0x00001000
|
||
#define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000
|
||
|
||
#define TAPE_DRIVE_ECC 0x00010000
|
||
#define TAPE_DRIVE_COMPRESSION 0x00020000
|
||
#define TAPE_DRIVE_PADDING 0x00040000
|
||
#define TAPE_DRIVE_REPORT_SMKS 0x00080000
|
||
|
||
#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000
|
||
#define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000
|
||
#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000
|
||
|
||
#define TAPE_DRIVE_EJECT_MEDIA 0x01000000
|
||
#define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000
|
||
#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000
|
||
|
||
#define TAPE_DRIVE_RESERVED_BIT 0x80000000 //don't use this bit!
|
||
// //can't be a low features bit!
|
||
// //reserved; high features only
|
||
|
||
//
|
||
// Definitions for FeaturesHigh parameter
|
||
//
|
||
|
||
#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
|
||
#define TAPE_DRIVE_TENSION 0x80000002
|
||
#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
|
||
#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
|
||
|
||
#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
|
||
#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
|
||
#define TAPE_DRIVE_TENSION_IMMED 0x80000040
|
||
#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
|
||
|
||
#define TAPE_DRIVE_SET_ECC 0x80000100
|
||
#define TAPE_DRIVE_SET_COMPRESSION 0x80000200
|
||
#define TAPE_DRIVE_SET_PADDING 0x80000400
|
||
#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
|
||
|
||
#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
|
||
#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
|
||
#define TAPE_DRIVE_LOGICAL_BLK 0x80004000
|
||
#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
|
||
|
||
#define TAPE_DRIVE_END_OF_DATA 0x80010000
|
||
#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
|
||
#define TAPE_DRIVE_FILEMARKS 0x80040000
|
||
#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
|
||
|
||
#define TAPE_DRIVE_SETMARKS 0x80100000
|
||
#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
|
||
#define TAPE_DRIVE_REVERSE_POSITION 0x80400000
|
||
#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
|
||
|
||
#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
|
||
#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
|
||
#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
|
||
#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
|
||
|
||
#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
|
||
#define TAPE_DRIVE_FORMAT 0xA0000000
|
||
#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
|
||
#define TAPE_DRIVE_HIGH_FEATURES 0x80000000 //mask for high features flag
|
||
|
||
typedef struct _TAPE_GET_DRIVE_PARAMETERS {
|
||
BOOLEAN ECC;
|
||
BOOLEAN Compression;
|
||
BOOLEAN DataPadding;
|
||
BOOLEAN ReportSetmarks;
|
||
ULONG DefaultBlockSize;
|
||
ULONG MaximumBlockSize;
|
||
ULONG MinimumBlockSize;
|
||
ULONG MaximumPartitionCount;
|
||
ULONG FeaturesLow;
|
||
ULONG FeaturesHigh;
|
||
ULONG EOTWarningZoneSize;
|
||
} TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
|
||
|
||
//
|
||
// IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions
|
||
//
|
||
|
||
typedef struct _TAPE_SET_DRIVE_PARAMETERS {
|
||
BOOLEAN ECC;
|
||
BOOLEAN Compression;
|
||
BOOLEAN DataPadding;
|
||
BOOLEAN ReportSetmarks;
|
||
ULONG EOTWarningZoneSize;
|
||
} TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
|
||
|
||
//
|
||
// IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions
|
||
//
|
||
|
||
typedef struct _TAPE_GET_MEDIA_PARAMETERS {
|
||
LARGE_INTEGER Capacity;
|
||
LARGE_INTEGER Remaining;
|
||
ULONG BlockSize;
|
||
ULONG PartitionCount;
|
||
BOOLEAN WriteProtected;
|
||
} TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
|
||
|
||
//
|
||
// IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions
|
||
//
|
||
|
||
typedef struct _TAPE_SET_MEDIA_PARAMETERS {
|
||
ULONG BlockSize;
|
||
} TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
|
||
|
||
//
|
||
// IOCTL_TAPE_CREATE_PARTITION definitions
|
||
//
|
||
|
||
#define TAPE_FIXED_PARTITIONS 0L
|
||
#define TAPE_SELECT_PARTITIONS 1L
|
||
#define TAPE_INITIATOR_PARTITIONS 2L
|
||
|
||
typedef struct _TAPE_CREATE_PARTITION {
|
||
ULONG Method;
|
||
ULONG Count;
|
||
ULONG Size;
|
||
} TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
|
||
|
||
|
||
//
|
||
// WMI Methods
|
||
//
|
||
#define TAPE_QUERY_DRIVE_PARAMETERS 0L
|
||
#define TAPE_QUERY_MEDIA_CAPACITY 1L
|
||
#define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L
|
||
#define TAPE_QUERY_IO_ERROR_DATA 3L
|
||
#define TAPE_QUERY_DEVICE_ERROR_DATA 4L
|
||
|
||
typedef struct _TAPE_WMI_OPERATIONS {
|
||
ULONG Method;
|
||
ULONG DataBufferSize;
|
||
PVOID DataBuffer;
|
||
} TAPE_WMI_OPERATIONS, *PTAPE_WMI_OPERATIONS;
|
||
|
||
//
|
||
// Type of drive errors
|
||
//
|
||
typedef enum _TAPE_DRIVE_PROBLEM_TYPE {
|
||
TapeDriveProblemNone, TapeDriveReadWriteWarning,
|
||
TapeDriveReadWriteError, TapeDriveReadWarning,
|
||
TapeDriveWriteWarning, TapeDriveReadError,
|
||
TapeDriveWriteError, TapeDriveHardwareError,
|
||
TapeDriveUnsupportedMedia, TapeDriveScsiConnectionError,
|
||
TapeDriveTimetoClean, TapeDriveCleanDriveNow,
|
||
TapeDriveMediaLifeExpired, TapeDriveSnappedTape
|
||
} TAPE_DRIVE_PROBLEM_TYPE;
|
||
|
||
|
||
|
||
typedef struct _TAPE_STATISTICS {
|
||
ULONG Version;
|
||
ULONG Flags;
|
||
LARGE_INTEGER RecoveredWrites;
|
||
LARGE_INTEGER UnrecoveredWrites;
|
||
LARGE_INTEGER RecoveredReads;
|
||
LARGE_INTEGER UnrecoveredReads;
|
||
UCHAR CompressionRatioReads;
|
||
UCHAR CompressionRatioWrites;
|
||
} TAPE_STATISTICS, *PTAPE_STATISTICS;
|
||
|
||
#define RECOVERED_WRITES_VALID 0x00000001
|
||
#define UNRECOVERED_WRITES_VALID 0x00000002
|
||
#define RECOVERED_READS_VALID 0x00000004
|
||
#define UNRECOVERED_READS_VALID 0x00000008
|
||
#define WRITE_COMPRESSION_INFO_VALID 0x00000010
|
||
#define READ_COMPRESSION_INFO_VALID 0x00000020
|
||
|
||
typedef struct _TAPE_GET_STATISTICS {
|
||
ULONG Operation;
|
||
} TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
|
||
|
||
#define TAPE_RETURN_STATISTICS 0L
|
||
#define TAPE_RETURN_ENV_INFO 1L
|
||
#define TAPE_RESET_STATISTICS 2L
|
||
|
||
//
|
||
// IOCTL_STORAGE_GET_MEDIA_TYPES_EX will return an array of DEVICE_MEDIA_INFO
|
||
// structures, one per supported type, embedded in the GET_MEDIA_TYPES struct.
|
||
//
|
||
|
||
typedef enum _STORAGE_MEDIA_TYPE {
|
||
//
|
||
// Following are defined in ntdddisk.h in the MEDIA_TYPE enum
|
||
//
|
||
// Unknown, // Format is unknown
|
||
// F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
|
||
// F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
|
||
// F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
|
||
// F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
|
||
// F3_720_512, // 3.5", 720KB, 512 bytes/sector
|
||
// F5_360_512, // 5.25", 360KB, 512 bytes/sector
|
||
// F5_320_512, // 5.25", 320KB, 512 bytes/sector
|
||
// F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
|
||
// F5_180_512, // 5.25", 180KB, 512 bytes/sector
|
||
// F5_160_512, // 5.25", 160KB, 512 bytes/sector
|
||
// RemovableMedia, // Removable media other than floppy
|
||
// FixedMedia, // Fixed hard disk media
|
||
// F3_120M_512, // 3.5", 120M Floppy
|
||
// F3_640_512, // 3.5" , 640KB, 512 bytes/sector
|
||
// F5_640_512, // 5.25", 640KB, 512 bytes/sector
|
||
// F5_720_512, // 5.25", 720KB, 512 bytes/sector
|
||
// F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
|
||
// F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
|
||
// F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
|
||
// F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
|
||
// F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
|
||
// F8_256_128, // 8", 256KB, 128 bytes/sector
|
||
// F3_200Mb_512, // 3.5", 200M Floppy (HiFD)
|
||
//
|
||
|
||
DDS_4mm = 0x20, // Tape - DAT DDS1,2,... (all vendors)
|
||
MiniQic, // Tape - miniQIC Tape
|
||
Travan, // Tape - Travan TR-1,2,3,...
|
||
QIC, // Tape - QIC
|
||
MP_8mm, // Tape - 8mm Exabyte Metal Particle
|
||
AME_8mm, // Tape - 8mm Exabyte Advanced Metal Evap
|
||
AIT1_8mm, // Tape - 8mm Sony AIT
|
||
DLT, // Tape - DLT Compact IIIxt, IV
|
||
NCTP, // Tape - Philips NCTP
|
||
IBM_3480, // Tape - IBM 3480
|
||
IBM_3490E, // Tape - IBM 3490E
|
||
IBM_Magstar_3590, // Tape - IBM Magstar 3590
|
||
IBM_Magstar_MP, // Tape - IBM Magstar MP
|
||
STK_DATA_D3, // Tape - STK Data D3
|
||
SONY_DTF, // Tape - Sony DTF
|
||
DV_6mm, // Tape - 6mm Digital Video
|
||
DMI, // Tape - Exabyte DMI and compatibles
|
||
SONY_D2, // Tape - Sony D2S and D2L
|
||
CLEANER_CARTRIDGE, // Cleaner - All Drive types that support Drive Cleaners
|
||
CD_ROM, // Opt_Disk - CD
|
||
CD_R, // Opt_Disk - CD-Recordable (Write Once)
|
||
CD_RW, // Opt_Disk - CD-Rewriteable
|
||
DVD_ROM, // Opt_Disk - DVD-ROM
|
||
DVD_R, // Opt_Disk - DVD-Recordable (Write Once)
|
||
DVD_RW, // Opt_Disk - DVD-Rewriteable
|
||
MO_3_RW, // Opt_Disk - 3.5" Rewriteable MO Disk
|
||
MO_5_WO, // Opt_Disk - MO 5.25" Write Once
|
||
MO_5_RW, // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW)
|
||
MO_5_LIMDOW, // Opt_Disk - MO 5.25" Rewriteable (LIMDOW)
|
||
PC_5_WO, // Opt_Disk - Phase Change 5.25" Write Once Optical
|
||
PC_5_RW, // Opt_Disk - Phase Change 5.25" Rewriteable
|
||
PD_5_RW, // Opt_Disk - PhaseChange Dual Rewriteable
|
||
ABL_5_WO, // Opt_Disk - Ablative 5.25" Write Once Optical
|
||
PINNACLE_APEX_5_RW, // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical
|
||
SONY_12_WO, // Opt_Disk - Sony 12" Write Once
|
||
PHILIPS_12_WO, // Opt_Disk - Philips/LMS 12" Write Once
|
||
HITACHI_12_WO, // Opt_Disk - Hitachi 12" Write Once
|
||
CYGNET_12_WO, // Opt_Disk - Cygnet/ATG 12" Write Once
|
||
KODAK_14_WO, // Opt_Disk - Kodak 14" Write Once
|
||
MO_NFR_525, // Opt_Disk - Near Field Recording (Terastor)
|
||
NIKON_12_RW, // Opt_Disk - Nikon 12" Rewriteable
|
||
IOMEGA_ZIP, // Mag_Disk - Iomega Zip
|
||
IOMEGA_JAZ, // Mag_Disk - Iomega Jaz
|
||
SYQUEST_EZ135, // Mag_Disk - Syquest EZ135
|
||
SYQUEST_EZFLYER, // Mag_Disk - Syquest EzFlyer
|
||
SYQUEST_SYJET, // Mag_Disk - Syquest SyJet
|
||
AVATAR_F2, // Mag_Disk - 2.5" Floppy
|
||
MP2_8mm, // Tape - 8mm Hitachi
|
||
DST_S, // Ampex DST Small Tapes
|
||
DST_M, // Ampex DST Medium Tapes
|
||
DST_L, // Ampex DST Large Tapes
|
||
VXATape_1, // Ecrix 8mm Tape
|
||
VXATape_2, // Ecrix 8mm Tape
|
||
STK_9840, // STK 9840
|
||
LTO_Ultrium, // IBM, HP, Seagate LTO Ultrium
|
||
LTO_Accelis, // IBM, HP, Seagate LTO Accelis
|
||
DVD_RAM, // Opt_Disk - DVD-RAM
|
||
AIT_8mm, // AIT2 or higher
|
||
ADR_1, // OnStream ADR Mediatypes
|
||
ADR_2
|
||
} STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
|
||
|
||
#define MEDIA_ERASEABLE 0x00000001
|
||
#define MEDIA_WRITE_ONCE 0x00000002
|
||
#define MEDIA_READ_ONLY 0x00000004
|
||
#define MEDIA_READ_WRITE 0x00000008
|
||
|
||
#define MEDIA_WRITE_PROTECTED 0x00000100
|
||
#define MEDIA_CURRENTLY_MOUNTED 0x80000000
|
||
|
||
//
|
||
// Define the different storage bus types
|
||
// Bus types below 128 (0x80) are reserved for Microsoft use
|
||
//
|
||
|
||
typedef enum _STORAGE_BUS_TYPE {
|
||
BusTypeUnknown = 0x00,
|
||
BusTypeScsi,
|
||
BusTypeAtapi,
|
||
BusTypeAta,
|
||
BusType1394,
|
||
BusTypeSsa,
|
||
BusTypeFibre,
|
||
BusTypeUsb,
|
||
BusTypeRAID,
|
||
BusTypeMaxReserved = 0x7F
|
||
} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
|
||
|
||
typedef struct _DEVICE_MEDIA_INFO {
|
||
union {
|
||
struct {
|
||
LARGE_INTEGER Cylinders;
|
||
STORAGE_MEDIA_TYPE MediaType;
|
||
ULONG TracksPerCylinder;
|
||
ULONG SectorsPerTrack;
|
||
ULONG BytesPerSector;
|
||
ULONG NumberMediaSides;
|
||
ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
|
||
} DiskInfo;
|
||
|
||
struct {
|
||
LARGE_INTEGER Cylinders;
|
||
STORAGE_MEDIA_TYPE MediaType;
|
||
ULONG TracksPerCylinder;
|
||
ULONG SectorsPerTrack;
|
||
ULONG BytesPerSector;
|
||
ULONG NumberMediaSides;
|
||
ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
|
||
} RemovableDiskInfo;
|
||
|
||
struct {
|
||
STORAGE_MEDIA_TYPE MediaType;
|
||
ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
|
||
ULONG CurrentBlockSize;
|
||
STORAGE_BUS_TYPE BusType;
|
||
|
||
//
|
||
// Bus specific information describing the medium supported.
|
||
//
|
||
|
||
union {
|
||
struct {
|
||
UCHAR MediumType;
|
||
UCHAR DensityCode;
|
||
} ScsiInformation;
|
||
} BusSpecificData;
|
||
|
||
} TapeInfo;
|
||
} DeviceSpecific;
|
||
} DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
|
||
|
||
typedef struct _GET_MEDIA_TYPES {
|
||
ULONG DeviceType; // FILE_DEVICE_XXX values
|
||
ULONG MediaInfoCount;
|
||
DEVICE_MEDIA_INFO MediaInfo[1];
|
||
} GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
|
||
|
||
|
||
//
|
||
// IOCTL_STORAGE_PREDICT_FAILURE
|
||
//
|
||
// input - none
|
||
//
|
||
// output - STORAGE_PREDICT_FAILURE structure
|
||
// PredictFailure returns zero if no failure predicted and non zero
|
||
// if a failure is predicted.
|
||
//
|
||
// VendorSpecific returns 512 bytes of vendor specific information
|
||
// if a failure is predicted
|
||
//
|
||
typedef struct _STORAGE_PREDICT_FAILURE
|
||
{
|
||
ULONG PredictFailure;
|
||
UCHAR VendorSpecific[512];
|
||
} STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
|
||
|
||
|
||
#define MAXIMUM_CDB_SIZE 12
|
||
|
||
//
|
||
// SCSI I/O Request Block
|
||
//
|
||
|
||
typedef struct _SCSI_REQUEST_BLOCK {
|
||
USHORT Length; // offset 0
|
||
UCHAR Function; // offset 2
|
||
UCHAR SrbStatus; // offset 3
|
||
UCHAR ScsiStatus; // offset 4
|
||
UCHAR PathId; // offset 5
|
||
UCHAR TargetId; // offset 6
|
||
UCHAR Lun; // offset 7
|
||
UCHAR QueueTag; // offset 8
|
||
UCHAR QueueAction; // offset 9
|
||
UCHAR CdbLength; // offset a
|
||
UCHAR SenseInfoBufferLength; // offset b
|
||
ULONG SrbFlags; // offset c
|
||
ULONG DataTransferLength; // offset 10
|
||
ULONG TimeOutValue; // offset 14
|
||
PVOID DataBuffer; // offset 18
|
||
PVOID SenseInfoBuffer; // offset 1c
|
||
struct _SCSI_REQUEST_BLOCK *NextSrb; // offset 20
|
||
PVOID OriginalRequest; // offset 24
|
||
PVOID SrbExtension; // offset 28
|
||
union {
|
||
ULONG InternalStatus; // offset 2c
|
||
ULONG QueueSortKey; // offset 2c
|
||
};
|
||
|
||
#if defined(_WIN64)
|
||
|
||
//
|
||
// Force PVOID alignment of Cdb
|
||
//
|
||
|
||
ULONG Reserved;
|
||
|
||
#endif
|
||
|
||
UCHAR Cdb[16]; // offset 30
|
||
} SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
|
||
|
||
#define SCSI_REQUEST_BLOCK_SIZE sizeof(SCSI_REQUEST_BLOCK)
|
||
|
||
//
|
||
// SCSI I/O Request Block for WMI Requests
|
||
//
|
||
|
||
typedef struct _SCSI_WMI_REQUEST_BLOCK {
|
||
USHORT Length;
|
||
UCHAR Function; // SRB_FUNCTION_WMI
|
||
UCHAR SrbStatus;
|
||
UCHAR WMISubFunction;
|
||
UCHAR PathId; // If SRB_WMI_FLAGS_ADAPTER_REQUEST is set in
|
||
UCHAR TargetId; // WMIFlags then PathId, TargetId and Lun are
|
||
UCHAR Lun; // reserved fields.
|
||
UCHAR Reserved1;
|
||
UCHAR WMIFlags;
|
||
UCHAR Reserved2[2];
|
||
ULONG SrbFlags;
|
||
ULONG DataTransferLength;
|
||
ULONG TimeOutValue;
|
||
PVOID DataBuffer;
|
||
PVOID DataPath;
|
||
PVOID Reserved3;
|
||
PVOID OriginalRequest;
|
||
PVOID SrbExtension;
|
||
ULONG Reserved4;
|
||
UCHAR Reserved5[16];
|
||
} SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
|
||
|
||
//
|
||
// SRB Functions
|
||
//
|
||
|
||
#define SRB_FUNCTION_EXECUTE_SCSI 0x00
|
||
#define SRB_FUNCTION_CLAIM_DEVICE 0x01
|
||
#define SRB_FUNCTION_IO_CONTROL 0x02
|
||
#define SRB_FUNCTION_RECEIVE_EVENT 0x03
|
||
#define SRB_FUNCTION_RELEASE_QUEUE 0x04
|
||
#define SRB_FUNCTION_ATTACH_DEVICE 0x05
|
||
#define SRB_FUNCTION_RELEASE_DEVICE 0x06
|
||
#define SRB_FUNCTION_SHUTDOWN 0x07
|
||
#define SRB_FUNCTION_FLUSH 0x08
|
||
#define SRB_FUNCTION_ABORT_COMMAND 0x10
|
||
#define SRB_FUNCTION_RELEASE_RECOVERY 0x11
|
||
#define SRB_FUNCTION_RESET_BUS 0x12
|
||
#define SRB_FUNCTION_RESET_DEVICE 0x13
|
||
#define SRB_FUNCTION_TERMINATE_IO 0x14
|
||
#define SRB_FUNCTION_FLUSH_QUEUE 0x15
|
||
#define SRB_FUNCTION_REMOVE_DEVICE 0x16
|
||
#define SRB_FUNCTION_WMI 0x17
|
||
#define SRB_FUNCTION_LOCK_QUEUE 0x18
|
||
#define SRB_FUNCTION_UNLOCK_QUEUE 0x19
|
||
#define SRB_FUNCTION_RESET_LOGICAL_UNIT 0x20
|
||
|
||
//
|
||
// SRB Status
|
||
//
|
||
|
||
#define SRB_STATUS_PENDING 0x00
|
||
#define SRB_STATUS_SUCCESS 0x01
|
||
#define SRB_STATUS_ABORTED 0x02
|
||
#define SRB_STATUS_ABORT_FAILED 0x03
|
||
#define SRB_STATUS_ERROR 0x04
|
||
#define SRB_STATUS_BUSY 0x05
|
||
#define SRB_STATUS_INVALID_REQUEST 0x06
|
||
#define SRB_STATUS_INVALID_PATH_ID 0x07
|
||
#define SRB_STATUS_NO_DEVICE 0x08
|
||
#define SRB_STATUS_TIMEOUT 0x09
|
||
#define SRB_STATUS_SELECTION_TIMEOUT 0x0A
|
||
#define SRB_STATUS_COMMAND_TIMEOUT 0x0B
|
||
#define SRB_STATUS_MESSAGE_REJECTED 0x0D
|
||
#define SRB_STATUS_BUS_RESET 0x0E
|
||
#define SRB_STATUS_PARITY_ERROR 0x0F
|
||
#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
|
||
#define SRB_STATUS_NO_HBA 0x11
|
||
#define SRB_STATUS_DATA_OVERRUN 0x12
|
||
#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
|
||
#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
|
||
#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
|
||
#define SRB_STATUS_REQUEST_FLUSHED 0x16
|
||
#define SRB_STATUS_INVALID_LUN 0x20
|
||
#define SRB_STATUS_INVALID_TARGET_ID 0x21
|
||
#define SRB_STATUS_BAD_FUNCTION 0x22
|
||
#define SRB_STATUS_ERROR_RECOVERY 0x23
|
||
#define SRB_STATUS_NOT_POWERED 0x24
|
||
|
||
//
|
||
// This value is used by the port driver to indicate that a non-scsi-related
|
||
// error occured. Miniports must never return this status.
|
||
//
|
||
|
||
#define SRB_STATUS_INTERNAL_ERROR 0x30
|
||
|
||
//
|
||
// Srb status values 0x38 through 0x3f are reserved for internal port driver
|
||
// use.
|
||
//
|
||
|
||
|
||
|
||
//
|
||
// SRB Status Masks
|
||
//
|
||
|
||
#define SRB_STATUS_QUEUE_FROZEN 0x40
|
||
#define SRB_STATUS_AUTOSENSE_VALID 0x80
|
||
|
||
#define SRB_STATUS(Status) (Status & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN))
|
||
|
||
//
|
||
// SRB Flag Bits
|
||
//
|
||
|
||
#define SRB_FLAGS_QUEUE_ACTION_ENABLE 0x00000002
|
||
#define SRB_FLAGS_DISABLE_DISCONNECT 0x00000004
|
||
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER 0x00000008
|
||
|
||
#define SRB_FLAGS_BYPASS_FROZEN_QUEUE 0x00000010
|
||
#define SRB_FLAGS_DISABLE_AUTOSENSE 0x00000020
|
||
#define SRB_FLAGS_DATA_IN 0x00000040
|
||
#define SRB_FLAGS_DATA_OUT 0x00000080
|
||
#define SRB_FLAGS_NO_DATA_TRANSFER 0x00000000
|
||
#define SRB_FLAGS_UNSPECIFIED_DIRECTION (SRB_FLAGS_DATA_IN | SRB_FLAGS_DATA_OUT)
|
||
|
||
#define SRB_FLAGS_NO_QUEUE_FREEZE 0x00000100
|
||
#define SRB_FLAGS_ADAPTER_CACHE_ENABLE 0x00000200
|
||
#define SRB_FLAGS_FREE_SENSE_BUFFER 0x00000400
|
||
|
||
#define SRB_FLAGS_IS_ACTIVE 0x00010000
|
||
#define SRB_FLAGS_ALLOCATED_FROM_ZONE 0x00020000
|
||
#define SRB_FLAGS_SGLIST_FROM_POOL 0x00040000
|
||
#define SRB_FLAGS_BYPASS_LOCKED_QUEUE 0x00080000
|
||
|
||
#define SRB_FLAGS_NO_KEEP_AWAKE 0x00100000
|
||
#define SRB_FLAGS_PORT_DRIVER_ALLOCSENSE 0x00200000
|
||
#define SRB_FLAGS_PORT_DRIVER_SENSEHASPORT 0x00400000
|
||
#define SRB_FLAGS_DONT_START_NEXT_PACKET 0x00800000
|
||
|
||
#define SRB_FLAGS_PORT_DRIVER_RESERVED 0x0F000000
|
||
#define SRB_FLAGS_CLASS_DRIVER_RESERVED 0xF0000000
|
||
|
||
#if DBG==1
|
||
//
|
||
// A signature used to validate the scsi port number
|
||
// at the end of a sense buffer.
|
||
//
|
||
#define SCSI_PORT_SIGNATURE 0x54524f50
|
||
#endif
|
||
|
||
//
|
||
// Queue Action
|
||
//
|
||
|
||
#define SRB_SIMPLE_TAG_REQUEST 0x20
|
||
#define SRB_HEAD_OF_QUEUE_TAG_REQUEST 0x21
|
||
#define SRB_ORDERED_QUEUE_TAG_REQUEST 0x22
|
||
|
||
#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01
|
||
|
||
|
||
#ifndef _NTDDK_
|
||
#define SCSIPORT_API DECLSPEC_IMPORT
|
||
#else
|
||
#define SCSIPORT_API
|
||
#endif
|
||
|
||
|
||
SCSIPORT_API
|
||
VOID
|
||
ScsiDebugPrint(
|
||
ULONG DebugPrintLevel,
|
||
PCCHAR DebugMessage,
|
||
...
|
||
);
|
||
|
||
|
||
//
|
||
// Command Descriptor Block. Passed by SCSI controller chip over the SCSI bus
|
||
//
|
||
|
||
typedef union _CDB {
|
||
|
||
//
|
||
// Generic 6-Byte CDB
|
||
//
|
||
|
||
struct _CDB6GENERIC {
|
||
UCHAR OperationCode;
|
||
UCHAR Immediate : 1;
|
||
UCHAR CommandUniqueBits : 4;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR CommandUniqueBytes[3];
|
||
UCHAR Link : 1;
|
||
UCHAR Flag : 1;
|
||
UCHAR Reserved : 4;
|
||
UCHAR VendorUnique : 2;
|
||
} CDB6GENERIC, *PCDB6GENERIC;
|
||
|
||
//
|
||
// Standard 6-byte CDB
|
||
//
|
||
|
||
struct _CDB6READWRITE {
|
||
UCHAR OperationCode; // 0x08, 0x0A - SCSIOP_READ, SCSIOP_WRITE
|
||
UCHAR LogicalBlockMsb1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR LogicalBlockMsb0;
|
||
UCHAR LogicalBlockLsb;
|
||
UCHAR TransferBlocks;
|
||
UCHAR Control;
|
||
} CDB6READWRITE, *PCDB6READWRITE;
|
||
|
||
//
|
||
// SCSI-1 Inquiry CDB
|
||
//
|
||
|
||
struct _CDB6INQUIRY {
|
||
UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR PageCode;
|
||
UCHAR IReserved;
|
||
UCHAR AllocationLength;
|
||
UCHAR Control;
|
||
} CDB6INQUIRY, *PCDB6INQUIRY;
|
||
|
||
//
|
||
// SCSI-3 Inquiry CDB
|
||
//
|
||
|
||
struct _CDB6INQUIRY3 {
|
||
UCHAR OperationCode; // 0x12 - SCSIOP_INQUIRY
|
||
UCHAR EnableVitalProductData : 1;
|
||
UCHAR CommandSupportData : 1;
|
||
UCHAR Reserved1 : 6;
|
||
UCHAR PageCode;
|
||
UCHAR Reserved2;
|
||
UCHAR AllocationLength;
|
||
UCHAR Control;
|
||
} CDB6INQUIRY3, *PCDB6INQUIRY3;
|
||
|
||
struct _CDB6VERIFY {
|
||
UCHAR OperationCode; // 0x13 - SCSIOP_VERIFY
|
||
UCHAR Fixed : 1;
|
||
UCHAR ByteCompare : 1;
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved : 2;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR VerificationLength[3];
|
||
UCHAR Control;
|
||
} CDB6VERIFY, *PCDB6VERIFY;
|
||
|
||
//
|
||
// SCSI Format CDB
|
||
//
|
||
|
||
struct _CDB6FORMAT {
|
||
UCHAR OperationCode; // 0x04 - SCSIOP_FORMAT_UNIT
|
||
UCHAR FormatControl : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR FReserved1;
|
||
UCHAR InterleaveMsb;
|
||
UCHAR InterleaveLsb;
|
||
UCHAR FReserved2;
|
||
} CDB6FORMAT, *PCDB6FORMAT;
|
||
|
||
//
|
||
// Standard 10-byte CDB
|
||
|
||
struct _CDB10 {
|
||
UCHAR OperationCode;
|
||
UCHAR RelativeAddress : 1;
|
||
UCHAR Reserved1 : 2;
|
||
UCHAR ForceUnitAccess : 1;
|
||
UCHAR DisablePageOut : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR LogicalBlockByte0;
|
||
UCHAR LogicalBlockByte1;
|
||
UCHAR LogicalBlockByte2;
|
||
UCHAR LogicalBlockByte3;
|
||
UCHAR Reserved2;
|
||
UCHAR TransferBlocksMsb;
|
||
UCHAR TransferBlocksLsb;
|
||
UCHAR Control;
|
||
} CDB10, *PCDB10;
|
||
|
||
//
|
||
// Standard 12-byte CDB
|
||
//
|
||
|
||
struct _CDB12 {
|
||
UCHAR OperationCode;
|
||
UCHAR RelativeAddress : 1;
|
||
UCHAR Reserved1 : 2;
|
||
UCHAR ForceUnitAccess : 1;
|
||
UCHAR DisablePageOut : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR LogicalBlock[4];
|
||
UCHAR TransferLength[4];
|
||
UCHAR Reserved2;
|
||
UCHAR Control;
|
||
} CDB12, *PCDB12;
|
||
|
||
|
||
|
||
//
|
||
// CD Rom Audio CDBs
|
||
//
|
||
|
||
struct _PAUSE_RESUME {
|
||
UCHAR OperationCode; // 0x4B - SCSIOP_PAUSE_RESUME
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[6];
|
||
UCHAR Action;
|
||
UCHAR Control;
|
||
} PAUSE_RESUME, *PPAUSE_RESUME;
|
||
|
||
//
|
||
// Read Table of Contents
|
||
//
|
||
|
||
struct _READ_TOC {
|
||
UCHAR OperationCode; // 0x43 - SCSIOP_READ_TOC
|
||
UCHAR Reserved0 : 1;
|
||
UCHAR Msf : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Format2 : 4;
|
||
UCHAR Reserved2 : 4;
|
||
UCHAR Reserved3[3];
|
||
UCHAR StartingTrack;
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control : 6;
|
||
UCHAR Format : 2;
|
||
} READ_TOC, *PREAD_TOC;
|
||
|
||
struct _READ_DISK_INFORMATION {
|
||
UCHAR OperationCode; // 0x51 - SCSIOP_READ_DISC_INFORMATION
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[5];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} READ_DISK_INFORMATION, *PREAD_DISK_INFORMATION;
|
||
|
||
struct _READ_TRACK_INFORMATION {
|
||
UCHAR OperationCode; // 0x52 - SCSIOP_READ_TRACK_INFORMATION
|
||
UCHAR Track : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR Lun : 3;
|
||
UCHAR BlockAddress[4]; // or Track Number
|
||
UCHAR Reserved3;
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} READ_TRACK_INFORMATION, *PREAD_TRACK_INFORMATION;
|
||
|
||
struct _RESERVE_TRACK_RZONE {
|
||
UCHAR OperationCode; // 0x53 - SCSIOP_RESERVE_TRACK_RZONE
|
||
UCHAR Reserved1[4];
|
||
UCHAR ReservationSize[4];
|
||
UCHAR Control;
|
||
} RESERVE_TRACK_RZONE, *PRESERVE_TRACK_RZONE;
|
||
|
||
struct _SEND_OPC_INFORMATION {
|
||
UCHAR OperationCode; // 0x54 - SCSIOP_SEND_OPC_INFORMATION
|
||
UCHAR DoOpc : 1; // perform OPC
|
||
UCHAR Reserved : 7;
|
||
UCHAR Reserved1[5];
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR Reserved2;
|
||
} SEND_OPC_INFORMATION, *PSEND_OPC_INFORMATION;
|
||
|
||
struct _CLOSE_TRACK {
|
||
UCHAR OperationCode; // 0x5B - SCSIOP_CLOSE_TRACK_SESSION
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved1 : 7;
|
||
UCHAR Track : 1;
|
||
UCHAR Session : 1;
|
||
UCHAR Reserved2 : 6;
|
||
UCHAR Reserved3;
|
||
UCHAR TrackNumber[2];
|
||
UCHAR Reserved4[3];
|
||
UCHAR Control;
|
||
} CLOSE_TRACK, *PCLOSE_TRACK;
|
||
|
||
struct _SEND_CUE_SHEET {
|
||
UCHAR OperationCode; // 0x5D - SCSIOP_SEND_CUE_SHEET
|
||
UCHAR Reserved[5];
|
||
UCHAR CueSheetSize[3];
|
||
UCHAR Control;
|
||
} SEND_CUE_SHEET, *PSEND_CUE_SHEET;
|
||
|
||
struct _READ_HEADER {
|
||
UCHAR OperationCode; // 0x44 - SCSIOP_READ_HEADER
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR Msf : 1;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR Lun : 3;
|
||
UCHAR LogicalBlockAddress[4];
|
||
UCHAR Reserved3;
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} READ_HEADER, *PREAD_HEADER;
|
||
|
||
struct _PLAY_AUDIO {
|
||
UCHAR OperationCode; // 0x45 - SCSIOP_PLAY_AUDIO
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR StartingBlockAddress[4];
|
||
UCHAR Reserved2;
|
||
UCHAR PlayLength[2];
|
||
UCHAR Control;
|
||
} PLAY_AUDIO, *PPLAY_AUDIO;
|
||
|
||
struct _PLAY_AUDIO_MSF {
|
||
UCHAR OperationCode; // 0x47 - SCSIOP_PLAY_AUDIO_MSF
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2;
|
||
UCHAR StartingM;
|
||
UCHAR StartingS;
|
||
UCHAR StartingF;
|
||
UCHAR EndingM;
|
||
UCHAR EndingS;
|
||
UCHAR EndingF;
|
||
UCHAR Control;
|
||
} PLAY_AUDIO_MSF, *PPLAY_AUDIO_MSF;
|
||
|
||
struct _PLAY_CD {
|
||
UCHAR OperationCode; // 0xBC - SCSIOP_PLAY_CD
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR CMSF : 1; // LBA = 0, MSF = 1
|
||
UCHAR ExpectedSectorType : 3;
|
||
UCHAR Lun : 3;
|
||
|
||
union {
|
||
struct _LBA {
|
||
UCHAR StartingBlockAddress[4];
|
||
UCHAR PlayLength[4];
|
||
} LBA;
|
||
|
||
struct _MSF {
|
||
UCHAR Reserved1;
|
||
UCHAR StartingM;
|
||
UCHAR StartingS;
|
||
UCHAR StartingF;
|
||
UCHAR EndingM;
|
||
UCHAR EndingS;
|
||
UCHAR EndingF;
|
||
UCHAR Reserved2;
|
||
} MSF;
|
||
};
|
||
|
||
UCHAR Audio : 1;
|
||
UCHAR Composite : 1;
|
||
UCHAR Port1 : 1;
|
||
UCHAR Port2 : 1;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR Speed : 1;
|
||
UCHAR Control;
|
||
} PLAY_CD, *PPLAY_CD;
|
||
|
||
struct _SCAN_CD {
|
||
UCHAR OperationCode; // 0xBA - SCSIOP_SCAN_CD
|
||
UCHAR RelativeAddress : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Direct : 1;
|
||
UCHAR Lun : 3;
|
||
UCHAR StartingAddress[4];
|
||
UCHAR Reserved2[3];
|
||
UCHAR Reserved3 : 6;
|
||
UCHAR Type : 2;
|
||
UCHAR Reserved4;
|
||
UCHAR Control;
|
||
} SCAN_CD, *PSCAN_CD;
|
||
|
||
struct _STOP_PLAY_SCAN {
|
||
UCHAR OperationCode; // 0x4E - SCSIOP_STOP_PLAY_SCAN
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[7];
|
||
UCHAR Control;
|
||
} STOP_PLAY_SCAN, *PSTOP_PLAY_SCAN;
|
||
|
||
|
||
//
|
||
// Read SubChannel Data
|
||
//
|
||
|
||
struct _SUBCHANNEL {
|
||
UCHAR OperationCode; // 0x42 - SCSIOP_READ_SUB_CHANNEL
|
||
UCHAR Reserved0 : 1;
|
||
UCHAR Msf : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2 : 6;
|
||
UCHAR SubQ : 1;
|
||
UCHAR Reserved3 : 1;
|
||
UCHAR Format;
|
||
UCHAR Reserved4[2];
|
||
UCHAR TrackNumber;
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} SUBCHANNEL, *PSUBCHANNEL;
|
||
|
||
//
|
||
// Read CD. Used by Atapi for raw sector reads.
|
||
//
|
||
|
||
struct _READ_CD {
|
||
UCHAR OperationCode; // 0xBE - SCSIOP_READ_CD
|
||
UCHAR RelativeAddress : 1;
|
||
UCHAR Reserved0 : 1;
|
||
UCHAR ExpectedSectorType : 3;
|
||
UCHAR Lun : 3;
|
||
UCHAR StartingLBA[4];
|
||
UCHAR TransferBlocks[3];
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR ErrorFlags : 2;
|
||
UCHAR IncludeEDC : 1;
|
||
UCHAR IncludeUserData : 1;
|
||
UCHAR HeaderCode : 2;
|
||
UCHAR IncludeSyncData : 1;
|
||
UCHAR SubChannelSelection : 3;
|
||
UCHAR Reserved3 : 5;
|
||
UCHAR Control;
|
||
} READ_CD, *PREAD_CD;
|
||
|
||
struct _READ_CD_MSF {
|
||
UCHAR OperationCode; // 0xB9 - SCSIOP_READ_CD_MSF
|
||
UCHAR RelativeAddress : 1;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR ExpectedSectorType : 3;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2;
|
||
UCHAR StartingM;
|
||
UCHAR StartingS;
|
||
UCHAR StartingF;
|
||
UCHAR EndingM;
|
||
UCHAR EndingS;
|
||
UCHAR EndingF;
|
||
UCHAR Reserved3;
|
||
UCHAR Reserved4 : 1;
|
||
UCHAR ErrorFlags : 2;
|
||
UCHAR IncludeEDC : 1;
|
||
UCHAR IncludeUserData : 1;
|
||
UCHAR HeaderCode : 2;
|
||
UCHAR IncludeSyncData : 1;
|
||
UCHAR SubChannelSelection : 3;
|
||
UCHAR Reserved5 : 5;
|
||
UCHAR Control;
|
||
} READ_CD_MSF, *PREAD_CD_MSF;
|
||
|
||
//
|
||
// Plextor Read CD-DA
|
||
//
|
||
|
||
struct _PLXTR_READ_CDDA {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR Reserved0 : 5;
|
||
UCHAR LogicalUnitNumber :3;
|
||
UCHAR LogicalBlockByte0;
|
||
UCHAR LogicalBlockByte1;
|
||
UCHAR LogicalBlockByte2;
|
||
UCHAR LogicalBlockByte3;
|
||
UCHAR TransferBlockByte0;
|
||
UCHAR TransferBlockByte1;
|
||
UCHAR TransferBlockByte2;
|
||
UCHAR TransferBlockByte3;
|
||
UCHAR SubCode;
|
||
UCHAR Control;
|
||
} PLXTR_READ_CDDA, *PPLXTR_READ_CDDA;
|
||
|
||
//
|
||
// NEC Read CD-DA
|
||
//
|
||
|
||
struct _NEC_READ_CDDA {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR Reserved0;
|
||
UCHAR LogicalBlockByte0;
|
||
UCHAR LogicalBlockByte1;
|
||
UCHAR LogicalBlockByte2;
|
||
UCHAR LogicalBlockByte3;
|
||
UCHAR Reserved1;
|
||
UCHAR TransferBlockByte0;
|
||
UCHAR TransferBlockByte1;
|
||
UCHAR Control;
|
||
} NEC_READ_CDDA, *PNEC_READ_CDDA;
|
||
|
||
//
|
||
// Mode sense
|
||
//
|
||
|
||
struct _MODE_SENSE {
|
||
UCHAR OperationCode; // 0x1A - SCSIOP_MODE_SENSE
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Dbd : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR PageCode : 6;
|
||
UCHAR Pc : 2;
|
||
UCHAR Reserved3;
|
||
UCHAR AllocationLength;
|
||
UCHAR Control;
|
||
} MODE_SENSE, *PMODE_SENSE;
|
||
|
||
struct _MODE_SENSE10 {
|
||
UCHAR OperationCode; // 0x5A - SCSIOP_MODE_SENSE10
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Dbd : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR PageCode : 6;
|
||
UCHAR Pc : 2;
|
||
UCHAR Reserved3[4];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} MODE_SENSE10, *PMODE_SENSE10;
|
||
|
||
//
|
||
// Mode select
|
||
//
|
||
|
||
struct _MODE_SELECT {
|
||
UCHAR OperationCode; // 0x15 - SCSIOP_MODE_SELECT
|
||
UCHAR SPBit : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR PFBit : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[2];
|
||
UCHAR ParameterListLength;
|
||
UCHAR Control;
|
||
} MODE_SELECT, *PMODE_SELECT;
|
||
|
||
struct _MODE_SELECT10 {
|
||
UCHAR OperationCode; // 0x55 - SCSIOP_MODE_SELECT10
|
||
UCHAR SPBit : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR PFBit : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[5];
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR Control;
|
||
} MODE_SELECT10, *PMODE_SELECT10;
|
||
|
||
struct _LOCATE {
|
||
UCHAR OperationCode; // 0x2B - SCSIOP_LOCATE
|
||
UCHAR Immediate : 1;
|
||
UCHAR CPBit : 1;
|
||
UCHAR BTBit : 1;
|
||
UCHAR Reserved1 : 2;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved3;
|
||
UCHAR LogicalBlockAddress[4];
|
||
UCHAR Reserved4;
|
||
UCHAR Partition;
|
||
UCHAR Control;
|
||
} LOCATE, *PLOCATE;
|
||
|
||
struct _LOGSENSE {
|
||
UCHAR OperationCode; // 0x4D - SCSIOP_LOG_SENSE
|
||
UCHAR SPBit : 1;
|
||
UCHAR PPCBit : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR PageCode : 6;
|
||
UCHAR PCBit : 2;
|
||
UCHAR Reserved2;
|
||
UCHAR Reserved3;
|
||
UCHAR ParameterPointer[2];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} LOGSENSE, *PLOGSENSE;
|
||
|
||
struct _LOGSELECT {
|
||
UCHAR OperationCode; // 0x4C - SCSIOP_LOG_SELECT
|
||
UCHAR SPBit : 1;
|
||
UCHAR PCRBit : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved : 6;
|
||
UCHAR PCBit : 2;
|
||
UCHAR Reserved2[4];
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR Control;
|
||
} LOGSELECT, *PLOGSELECT;
|
||
|
||
struct _PRINT {
|
||
UCHAR OperationCode; // 0x0A - SCSIOP_PRINT
|
||
UCHAR Reserved : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR TransferLength[3];
|
||
UCHAR Control;
|
||
} PRINT, *PPRINT;
|
||
|
||
struct _SEEK {
|
||
UCHAR OperationCode; // 0x2B - SCSIOP_SEEK
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR LogicalBlockAddress[4];
|
||
UCHAR Reserved2[3];
|
||
UCHAR Control;
|
||
} SEEK, *PSEEK;
|
||
|
||
struct _ERASE {
|
||
UCHAR OperationCode; // 0x19 - SCSIOP_ERASE
|
||
UCHAR Long : 1;
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[3];
|
||
UCHAR Control;
|
||
} ERASE, *PERASE;
|
||
|
||
struct _START_STOP {
|
||
UCHAR OperationCode; // 0x1B - SCSIOP_START_STOP_UNIT
|
||
UCHAR Immediate: 1;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[2];
|
||
UCHAR Start : 1;
|
||
UCHAR LoadEject : 1;
|
||
UCHAR Reserved3 : 6;
|
||
UCHAR Control;
|
||
} START_STOP, *PSTART_STOP;
|
||
|
||
struct _MEDIA_REMOVAL {
|
||
UCHAR OperationCode; // 0x1E - SCSIOP_MEDIUM_REMOVAL
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR Reserved2[2];
|
||
|
||
UCHAR Prevent : 1;
|
||
UCHAR Persistant : 1;
|
||
UCHAR Reserved3 : 6;
|
||
|
||
UCHAR Control;
|
||
} MEDIA_REMOVAL, *PMEDIA_REMOVAL;
|
||
|
||
//
|
||
// Tape CDBs
|
||
//
|
||
|
||
struct _SEEK_BLOCK {
|
||
UCHAR OperationCode; // 0x0C - SCSIOP_SEEK_BLOCK
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved1 : 7;
|
||
UCHAR BlockAddress[3];
|
||
UCHAR Link : 1;
|
||
UCHAR Flag : 1;
|
||
UCHAR Reserved2 : 4;
|
||
UCHAR VendorUnique : 2;
|
||
} SEEK_BLOCK, *PSEEK_BLOCK;
|
||
|
||
struct _REQUEST_BLOCK_ADDRESS {
|
||
UCHAR OperationCode; // 0x02 - SCSIOP_REQUEST_BLOCK_ADDR
|
||
UCHAR Reserved1[3];
|
||
UCHAR AllocationLength;
|
||
UCHAR Link : 1;
|
||
UCHAR Flag : 1;
|
||
UCHAR Reserved2 : 4;
|
||
UCHAR VendorUnique : 2;
|
||
} REQUEST_BLOCK_ADDRESS, *PREQUEST_BLOCK_ADDRESS;
|
||
|
||
struct _PARTITION {
|
||
UCHAR OperationCode; // 0x0D - SCSIOP_PARTITION
|
||
UCHAR Immediate : 1;
|
||
UCHAR Sel: 1;
|
||
UCHAR PartitionSelect : 6;
|
||
UCHAR Reserved1[3];
|
||
UCHAR Control;
|
||
} PARTITION, *PPARTITION;
|
||
|
||
struct _WRITE_TAPE_MARKS {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR Immediate : 1;
|
||
UCHAR WriteSetMarks: 1;
|
||
UCHAR Reserved : 3;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR TransferLength[3];
|
||
UCHAR Control;
|
||
} WRITE_TAPE_MARKS, *PWRITE_TAPE_MARKS;
|
||
|
||
struct _SPACE_TAPE_MARKS {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR Code : 3;
|
||
UCHAR Reserved : 2;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR NumMarksMSB ;
|
||
UCHAR NumMarks;
|
||
UCHAR NumMarksLSB;
|
||
union {
|
||
UCHAR value;
|
||
struct {
|
||
UCHAR Link : 1;
|
||
UCHAR Flag : 1;
|
||
UCHAR Reserved : 4;
|
||
UCHAR VendorUnique : 2;
|
||
} Fields;
|
||
} Byte6;
|
||
} SPACE_TAPE_MARKS, *PSPACE_TAPE_MARKS;
|
||
|
||
//
|
||
// Read tape position
|
||
//
|
||
|
||
struct _READ_POSITION {
|
||
UCHAR Operation; // 0x43 - SCSIOP_READ_POSITION
|
||
UCHAR BlockType:1;
|
||
UCHAR Reserved1:4;
|
||
UCHAR Lun:3;
|
||
UCHAR Reserved2[7];
|
||
UCHAR Control;
|
||
} READ_POSITION, *PREAD_POSITION;
|
||
|
||
//
|
||
// ReadWrite for Tape
|
||
//
|
||
|
||
struct _CDB6READWRITETAPE {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR VendorSpecific : 5;
|
||
UCHAR Reserved : 3;
|
||
UCHAR TransferLenMSB;
|
||
UCHAR TransferLen;
|
||
UCHAR TransferLenLSB;
|
||
UCHAR Link : 1;
|
||
UCHAR Flag : 1;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR VendorUnique : 2;
|
||
} CDB6READWRITETAPE, *PCDB6READWRITETAPE;
|
||
|
||
//
|
||
// Medium changer CDB's
|
||
//
|
||
|
||
struct _INIT_ELEMENT_STATUS {
|
||
UCHAR OperationCode; // 0x07 - SCSIOP_INIT_ELEMENT_STATUS
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNubmer : 3;
|
||
UCHAR Reserved2[3];
|
||
UCHAR Reserved3 : 7;
|
||
UCHAR NoBarCode : 1;
|
||
} INIT_ELEMENT_STATUS, *PINIT_ELEMENT_STATUS;
|
||
|
||
struct _INITIALIZE_ELEMENT_RANGE {
|
||
UCHAR OperationCode; // 0xE7 - SCSIOP_INIT_ELEMENT_RANGE
|
||
UCHAR Range : 1;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR LogicalUnitNubmer : 3;
|
||
UCHAR FirstElementAddress[2];
|
||
UCHAR Reserved2[2];
|
||
UCHAR NumberOfElements[2];
|
||
UCHAR Reserved3;
|
||
UCHAR Reserved4 : 7;
|
||
UCHAR NoBarCode : 1;
|
||
} INITIALIZE_ELEMENT_RANGE, *PINITIALIZE_ELEMENT_RANGE;
|
||
|
||
struct _POSITION_TO_ELEMENT {
|
||
UCHAR OperationCode; // 0x2B - SCSIOP_POSITION_TO_ELEMENT
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR TransportElementAddress[2];
|
||
UCHAR DestinationElementAddress[2];
|
||
UCHAR Reserved2[2];
|
||
UCHAR Flip : 1;
|
||
UCHAR Reserved3 : 7;
|
||
UCHAR Control;
|
||
} POSITION_TO_ELEMENT, *PPOSITION_TO_ELEMENT;
|
||
|
||
struct _MOVE_MEDIUM {
|
||
UCHAR OperationCode; // 0xA5 - SCSIOP_MOVE_MEDIUM
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR TransportElementAddress[2];
|
||
UCHAR SourceElementAddress[2];
|
||
UCHAR DestinationElementAddress[2];
|
||
UCHAR Reserved2[2];
|
||
UCHAR Flip : 1;
|
||
UCHAR Reserved3 : 7;
|
||
UCHAR Control;
|
||
} MOVE_MEDIUM, *PMOVE_MEDIUM;
|
||
|
||
struct _EXCHANGE_MEDIUM {
|
||
UCHAR OperationCode; // 0xA6 - SCSIOP_EXCHANGE_MEDIUM
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR TransportElementAddress[2];
|
||
UCHAR SourceElementAddress[2];
|
||
UCHAR Destination1ElementAddress[2];
|
||
UCHAR Destination2ElementAddress[2];
|
||
UCHAR Flip1 : 1;
|
||
UCHAR Flip2 : 1;
|
||
UCHAR Reserved3 : 6;
|
||
UCHAR Control;
|
||
} EXCHANGE_MEDIUM, *PEXCHANGE_MEDIUM;
|
||
|
||
struct _READ_ELEMENT_STATUS {
|
||
UCHAR OperationCode; // 0xB8 - SCSIOP_READ_ELEMENT_STATUS
|
||
UCHAR ElementType : 4;
|
||
UCHAR VolTag : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR StartingElementAddress[2];
|
||
UCHAR NumberOfElements[2];
|
||
UCHAR Reserved1;
|
||
UCHAR AllocationLength[3];
|
||
UCHAR Reserved2;
|
||
UCHAR Control;
|
||
} READ_ELEMENT_STATUS, *PREAD_ELEMENT_STATUS;
|
||
|
||
struct _SEND_VOLUME_TAG {
|
||
UCHAR OperationCode; // 0xB6 - SCSIOP_SEND_VOLUME_TAG
|
||
UCHAR ElementType : 4;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR StartingElementAddress[2];
|
||
UCHAR Reserved2;
|
||
UCHAR ActionCode : 5;
|
||
UCHAR Reserved3 : 3;
|
||
UCHAR Reserved4[2];
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR Reserved5;
|
||
UCHAR Control;
|
||
} SEND_VOLUME_TAG, *PSEND_VOLUME_TAG;
|
||
|
||
struct _REQUEST_VOLUME_ELEMENT_ADDRESS {
|
||
UCHAR OperationCode; // Unknown -- vendor-unique?
|
||
UCHAR ElementType : 4;
|
||
UCHAR VolTag : 1;
|
||
UCHAR LogicalUnitNumber : 3;
|
||
UCHAR StartingElementAddress[2];
|
||
UCHAR NumberElements[2];
|
||
UCHAR Reserved1;
|
||
UCHAR AllocationLength[3];
|
||
UCHAR Reserved2;
|
||
UCHAR Control;
|
||
} REQUEST_VOLUME_ELEMENT_ADDRESS, *PREQUEST_VOLUME_ELEMENT_ADDRESS;
|
||
|
||
//
|
||
// Atapi 2.5 Changer 12-byte CDBs
|
||
//
|
||
|
||
struct _LOAD_UNLOAD {
|
||
UCHAR OperationCode; // 0xA6 - SCSIOP_LOAD_UNLOAD_SLOT
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[2];
|
||
UCHAR Start : 1;
|
||
UCHAR LoadEject : 1;
|
||
UCHAR Reserved3: 6;
|
||
UCHAR Reserved4[3];
|
||
UCHAR Slot;
|
||
UCHAR Reserved5[3];
|
||
} LOAD_UNLOAD, *PLOAD_UNLOAD;
|
||
|
||
struct _MECH_STATUS {
|
||
UCHAR OperationCode; // 0xBD - SCSIOP_MECHANISM_STATUS
|
||
UCHAR Reserved : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved1[6];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Reserved2[1];
|
||
UCHAR Control;
|
||
} MECH_STATUS, *PMECH_STATUS;
|
||
|
||
//
|
||
// C/DVD 0.9 CDBs
|
||
//
|
||
|
||
struct _SYNCHRONIZE_CACHE10 {
|
||
|
||
UCHAR OperationCode; // 0x35 - SCSIOP_SYNCHRONIZE_CACHE
|
||
|
||
UCHAR RelAddr : 1;
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved : 3;
|
||
UCHAR Lun : 3;
|
||
|
||
UCHAR LogicalBlockAddress[4]; // Unused - set to zero
|
||
UCHAR Reserved2;
|
||
UCHAR BlockCount[2]; // Unused - set to zero
|
||
UCHAR Control;
|
||
} SYNCHRONIZE_CACHE10, *PSYNCHRONIZE_CACHE10;
|
||
|
||
struct _GET_EVENT_STATUS_NOTIFICATION {
|
||
UCHAR OperationCode; // 0x4A - SCSIOP_GET_EVENT_STATUS_NOTIFICATION
|
||
|
||
UCHAR Immediate : 1;
|
||
UCHAR Reserved : 4;
|
||
UCHAR Lun : 3;
|
||
|
||
UCHAR Reserved2[2];
|
||
UCHAR NotificationClassRequest;
|
||
UCHAR Reserved3[2];
|
||
UCHAR EventListLength[2];
|
||
|
||
UCHAR Control;
|
||
} GET_EVENT_STATUS_NOTIFICATION, *PGET_EVENT_STATUS_NOTIFICATION;
|
||
|
||
struct _READ_DVD_STRUCTURE {
|
||
UCHAR OperationCode; // 0xAD - SCSIOP_READ_DVD_STRUCTURE
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR RMDBlockNumber[4];
|
||
UCHAR LayerNumber;
|
||
UCHAR Format;
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Reserved3 : 6;
|
||
UCHAR AGID : 2;
|
||
UCHAR Control;
|
||
} READ_DVD_STRUCTURE, *PREAD_DVD_STRUCTURE;
|
||
|
||
struct _SEND_DVD_STRUCTURE {
|
||
UCHAR OperationCode; // 0xBF - SCSIOP_SEND_DVD_STRUCTURE
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[5];
|
||
UCHAR Format;
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR Reserved3;
|
||
UCHAR Control;
|
||
} SEND_DVD_STRUCTURE, *PSEND_DVD_STRUCTURE;
|
||
|
||
struct _SEND_KEY {
|
||
UCHAR OperationCode; // 0xA3 - SCSIOP_SEND_KEY
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[6];
|
||
UCHAR ParameterListLength[2];
|
||
UCHAR KeyFormat : 6;
|
||
UCHAR AGID : 2;
|
||
UCHAR Control;
|
||
} SEND_KEY, *PSEND_KEY;
|
||
|
||
struct _REPORT_KEY {
|
||
UCHAR OperationCode; // 0xA4 - SCSIOP_REPORT_KEY
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR LogicalBlockAddress[4]; // for title key
|
||
UCHAR Reserved2[2];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR KeyFormat : 6;
|
||
UCHAR AGID : 2;
|
||
UCHAR Control;
|
||
} REPORT_KEY, *PREPORT_KEY;
|
||
|
||
struct _SET_READ_AHEAD {
|
||
UCHAR OperationCode; // 0xA7 - SCSIOP_SET_READ_AHEAD
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR TriggerLBA[4];
|
||
UCHAR ReadAheadLBA[4];
|
||
UCHAR Reserved2;
|
||
UCHAR Control;
|
||
} SET_READ_AHEAD, *PSET_READ_AHEAD;
|
||
|
||
struct _READ_FORMATTED_CAPACITIES {
|
||
UCHAR OperationCode; // 0x23 - SCSIOP_READ_FORMATTED_CAPACITY
|
||
UCHAR Reserved1 : 5;
|
||
UCHAR Lun : 3;
|
||
UCHAR Reserved2[5];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} READ_FORMATTED_CAPACITIES, *PREAD_FORMATTED_CAPACITIES;
|
||
|
||
//
|
||
// SCSI-3
|
||
//
|
||
|
||
struct _REPORT_LUNS {
|
||
UCHAR OperationCode; // 0xA0 - SCSIOP_REPORT_LUNS
|
||
UCHAR Reserved1[5];
|
||
UCHAR AllocationLength[4];
|
||
UCHAR Reserved2[1];
|
||
UCHAR Control;
|
||
} REPORT_LUNS, *PREPORT_LUNS;
|
||
|
||
struct _PERSISTENT_RESERVE_IN {
|
||
UCHAR OperationCode; // 0x5E - SCSIOP_PERSISTENT_RESERVE_IN
|
||
UCHAR ServiceAction : 5;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Reserved2[5];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} PERSISTENT_RESERVE_IN, *PPERSISTENT_RESERVE_IN;
|
||
|
||
struct _PERSISTENT_RESERVE_OUT {
|
||
UCHAR OperationCode; // 0x5F - SCSIOP_PERSISTENT_RESERVE_OUT
|
||
UCHAR ServiceAction : 5;
|
||
UCHAR Reserved1 : 3;
|
||
UCHAR Type : 4;
|
||
UCHAR Scope : 4;
|
||
UCHAR Reserved2[4];
|
||
UCHAR ParameterListLength[2]; // 0x18
|
||
UCHAR Control;
|
||
} PERSISTENT_RESERVE_OUT, *PPERSISTENT_RESERVE_OUT;
|
||
|
||
//
|
||
// MMC / SFF-8090 commands
|
||
//
|
||
|
||
struct _GET_CONFIGURATION {
|
||
UCHAR OperationCode; // 0x46 - SCSIOP_GET_CONFIGURATION
|
||
UCHAR RequestType : 1; // SCSI_GET_CONFIGURATION_REQUEST_TYPE_*
|
||
UCHAR Reserved1 : 7; // includes obsolete LUN field
|
||
UCHAR StartingFeature[2];
|
||
UCHAR Reserved2[3];
|
||
UCHAR AllocationLength[2];
|
||
UCHAR Control;
|
||
} GET_CONFIGURATION, *PGET_CONFIGURATION;
|
||
|
||
struct _SET_CD_SPEED {
|
||
UCHAR OperationCode; // 0xB8 - SCSIOP_SET_CD_SPEED
|
||
UCHAR Reserved1;
|
||
UCHAR ReadSpeed[2]; // 1x == (75 * 2352)
|
||
UCHAR WriteSpeed[2]; // 1x == (75 * 2352)
|
||
UCHAR Reserved2[5];
|
||
UCHAR Control;
|
||
} SET_CD_SPEED, *PSET_CD_SPEED;
|
||
|
||
ULONG AsUlong[4];
|
||
UCHAR AsByte[16];
|
||
|
||
} CDB, *PCDB;
|
||
|
||
////////////////////////////////////////////////////////////////////////////////
|
||
//
|
||
// GET_EVENT_STATUS_NOTIFICATION
|
||
//
|
||
|
||
|
||
#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_MASK 0x02
|
||
#define NOTIFICATION_POWER_MANAGEMENT_CLASS_MASK 0x04
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK 0x08
|
||
#define NOTIFICATION_MEDIA_STATUS_CLASS_MASK 0x10
|
||
#define NOTIFICATION_MULTI_HOST_CLASS_MASK 0x20
|
||
#define NOTIFICATION_DEVICE_BUSY_CLASS_MASK 0x40
|
||
|
||
|
||
#define NOTIFICATION_NO_CLASS_EVENTS 0x0
|
||
#define NOTIFICATION_OPERATIONAL_CHANGE_CLASS_EVENTS 0x1
|
||
#define NOTIFICATION_POWER_MANAGEMENT_CLASS_EVENTS 0x2
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS 0x3
|
||
#define NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS 0x4
|
||
#define NOTIFICATION_MULTI_HOST_CLASS_EVENTS 0x5
|
||
#define NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS 0x6
|
||
|
||
typedef struct _NOTIFICATION_EVENT_STATUS_HEADER {
|
||
UCHAR EventDataLength[2];
|
||
|
||
UCHAR NotificationClass : 3;
|
||
UCHAR Reserved : 4;
|
||
UCHAR NEA : 1;
|
||
|
||
UCHAR SupportedEventClasses;
|
||
UCHAR ClassEventData[0];
|
||
} NOTIFICATION_EVENT_STATUS_HEADER, *PNOTIFICATION_EVENT_STATUS_HEADER;
|
||
|
||
#define NOTIFICATION_OPERATIONAL_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_REQUESTED 0x1
|
||
#define NOTIFICATION_OPERATIONAL_EVENT_CHANGE_OCCURRED 0x2
|
||
|
||
#define NOTIFICATION_OPERATIONAL_STATUS_AVAILABLE 0x0
|
||
#define NOTIFICATION_OPERATIONAL_STATUS_TEMPORARY_BUSY 0x1
|
||
#define NOTIFICATION_OPERATIONAL_STATUS_EXTENDED_BUSY 0x2
|
||
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_NONE
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_CHANGE 0x1
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_FEATURE_ADDED 0x2
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_UNIT_RESET 0x3
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_FIRMWARE_CHANGED 0x4
|
||
#define NOTIFICATION_OPERATIONAL_OPCODE_INQUIRY_CHANGED 0x5
|
||
|
||
//
|
||
// Class event data may be one (or none) of the following:
|
||
//
|
||
|
||
typedef struct _NOTIFICATION_OPERATIONAL_STATUS { // event class == 0x1
|
||
UCHAR OperationalEvent : 4;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR OperationalStatus : 4;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR PersistentPrevented : 1;
|
||
UCHAR Operation[2];
|
||
} NOTIFICATION_OPERATIONAL_STATUS, *PNOTIFICATION_OPERATIONAL_STATUS;
|
||
|
||
|
||
#define NOTIFICATION_POWER_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_POWER_EVENT_CHANGE_SUCCEEDED 0x1
|
||
#define NOTIFICATION_POWER_EVENT_CHANGE_FAILED 0x2
|
||
|
||
#define NOTIFICATION_POWER_STATUS_ACTIVE 0x1
|
||
#define NOTIFICATION_POWER_STATUS_IDLE 0x2
|
||
#define NOTIFICATION_POWER_STATUS_STANDBY 0x3
|
||
#define NOTIFICATION_POWER_STATUS_SLEEP 0x4
|
||
|
||
typedef struct _NOTIFICATION_POWER_STATUS { // event class == 0x2
|
||
UCHAR PowerEvent : 4;
|
||
UCHAR Reserved : 4;
|
||
UCHAR PowerStatus;
|
||
UCHAR Reserved2[2];
|
||
} NOTIFICATION_POWER_STATUS, *PNOTIFICATION_POWER_STATUS;
|
||
|
||
#define NOTIFICATION_EXTERNAL_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN 0x1
|
||
#define NOTIFICATION_EXTERNAL_EVENT_BUTTON_UP 0x2
|
||
#define NOTIFICATION_EXTERNAL_EVENT_EXTERNAL 0x3 // respond with GET_CONFIGURATION?
|
||
|
||
#define NOTIFICATION_EXTERNAL_STATUS_READY 0x0
|
||
#define NOTIFICATION_EXTERNAL_STATUS_PREVENT 0x1
|
||
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_NONE 0x0000
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_QUEUE_OVERRUN 0x0001
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_PLAY 0x0101
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_REWIND_BACK 0x0102
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_FAST_FORWARD 0x0103
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_PAUSE 0x0104
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_STOP 0x0106
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_LOW 0x0200
|
||
#define NOTIFICATION_EXTERNAL_REQUEST_ASCII_HIGH 0x02ff
|
||
|
||
typedef struct _NOTIFICATION_EXTERNAL_STATUS { // event class == 0x3
|
||
UCHAR ExternalEvent : 4;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR ExternalStatus : 4;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR PersistentPrevented : 1;
|
||
UCHAR Request[2];
|
||
} NOTIFICATION_EXTERNAL_STATUS, *PNOTIFICATION_EXTERNAL_STATUS;
|
||
|
||
#define NOTIFICATION_MEDIA_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST 0x1
|
||
#define NOTIFICATION_MEDIA_EVENT_NEW_MEDIA 0x2
|
||
#define NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL 0x3
|
||
#define NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE 0x4
|
||
|
||
typedef struct _NOTIFICATION_MEDIA_STATUS { // event class == 0x4
|
||
UCHAR MediaEvent : 4;
|
||
UCHAR Reserved : 4;
|
||
|
||
union {
|
||
UCHAR PowerStatus; // OBSOLETE -- was improperly named in NT5 headers
|
||
UCHAR MediaStatus; // Use this for currently reserved fields
|
||
struct {
|
||
UCHAR DoorTrayOpen : 1;
|
||
UCHAR MediaPresent : 1;
|
||
UCHAR ReservedX : 6; // do not reference this directly!
|
||
};
|
||
};
|
||
UCHAR StartSlot;
|
||
UCHAR EndSlot;
|
||
} NOTIFICATION_MEDIA_STATUS, *PNOTIFICATION_MEDIA_STATUS;
|
||
|
||
#define NOTIFICATION_MULTI_HOST_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_REQUEST 0x1
|
||
#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_GRANT 0x2
|
||
#define NOTIFICATION_MULTI_HOST_EVENT_CONTROL_RELEASE 0x3
|
||
|
||
#define NOTIFICATION_MULTI_HOST_STATUS_READY 0x0
|
||
#define NOTIFICATION_MULTI_HOST_STATUS_PREVENT 0x1
|
||
|
||
#define NOTIFICATION_MULTI_HOST_PRIORITY_NO_REQUESTS 0x0
|
||
#define NOTIFICATION_MULTI_HOST_PRIORITY_LOW 0x1
|
||
#define NOTIFICATION_MULTI_HOST_PRIORITY_MEDIUM 0x2
|
||
#define NOTIFICATION_MULTI_HOST_PRIORITY_HIGH 0x3
|
||
|
||
typedef struct _NOTIFICATION_MULTI_HOST_STATUS { // event class == 0x5
|
||
UCHAR MultiHostEvent : 4;
|
||
UCHAR Reserved1 : 4;
|
||
UCHAR MultiHostStatus : 4;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR PersistentPrevented : 1;
|
||
UCHAR Priority[2];
|
||
} NOTIFICATION_MULTI_HOST_STATUS, *PNOTIFICATION_MULTI_HOST_STATUS;
|
||
|
||
#define NOTIFICATION_BUSY_EVENT_NO_CHANGE 0x0
|
||
#define NOTIFICATION_BUSY_EVENT_BUSY 0x1
|
||
|
||
#define NOTIFICATION_BUSY_STATUS_NO_EVENT 0x0
|
||
#define NOTIFICATION_BUSY_STATUS_POWER 0x1
|
||
#define NOTIFICATION_BUSY_STATUS_IMMEDIATE 0x2
|
||
#define NOTIFICATION_BUSY_STATUS_DEFERRED 0x3
|
||
|
||
typedef struct _NOTIFICATION_BUSY_STATUS { // event class == 0x6
|
||
UCHAR DeviceBusyEvent : 4;
|
||
UCHAR Reserved : 4;
|
||
|
||
UCHAR DeviceBusyStatus;
|
||
UCHAR Time[2];
|
||
} NOTIFICATION_BUSY_STATUS, *PNOTIFICATION_BUSY_STATUS;
|
||
////////////////////////////////////////////////////////////////////////////////
|
||
|
||
//
|
||
// Read DVD Structure Definitions and Constants
|
||
//
|
||
|
||
#define DVD_FORMAT_LEAD_IN 0x00
|
||
#define DVD_FORMAT_COPYRIGHT 0x01
|
||
#define DVD_FORMAT_DISK_KEY 0x02
|
||
#define DVD_FORMAT_BCA 0x03
|
||
#define DVD_FORMAT_MANUFACTURING 0x04
|
||
|
||
typedef struct _READ_DVD_STRUCTURES_HEADER {
|
||
UCHAR Length[2];
|
||
UCHAR Reserved[2];
|
||
|
||
UCHAR Data[0];
|
||
} READ_DVD_STRUCTURES_HEADER, *PREAD_DVD_STRUCTURES_HEADER;
|
||
|
||
//
|
||
// DiskKey, BCA & Manufacturer information will provide byte arrays as their
|
||
// data.
|
||
//
|
||
|
||
//
|
||
// CDVD 0.9 Send & Report Key Definitions and Structures
|
||
//
|
||
|
||
#define DVD_REPORT_AGID 0x00
|
||
#define DVD_CHALLENGE_KEY 0x01
|
||
#define DVD_KEY_1 0x02
|
||
#define DVD_KEY_2 0x03
|
||
#define DVD_TITLE_KEY 0x04
|
||
#define DVD_REPORT_ASF 0x05
|
||
#define DVD_INVALIDATE_AGID 0x3F
|
||
|
||
typedef struct _CDVD_KEY_HEADER {
|
||
UCHAR DataLength[2];
|
||
UCHAR Reserved[2];
|
||
UCHAR Data[0];
|
||
} CDVD_KEY_HEADER, *PCDVD_KEY_HEADER;
|
||
|
||
typedef struct _CDVD_REPORT_AGID_DATA {
|
||
UCHAR Reserved1[3];
|
||
UCHAR Reserved2 : 6;
|
||
UCHAR AGID : 2;
|
||
} CDVD_REPORT_AGID_DATA, *PCDVD_REPORT_AGID_DATA;
|
||
|
||
typedef struct _CDVD_CHALLENGE_KEY_DATA {
|
||
UCHAR ChallengeKeyValue[10];
|
||
UCHAR Reserved[2];
|
||
} CDVD_CHALLENGE_KEY_DATA, *PCDVD_CHALLENGE_KEY_DATA;
|
||
|
||
typedef struct _CDVD_KEY_DATA {
|
||
UCHAR Key[5];
|
||
UCHAR Reserved[3];
|
||
} CDVD_KEY_DATA, *PCDVD_KEY_DATA;
|
||
|
||
typedef struct _CDVD_REPORT_ASF_DATA {
|
||
UCHAR Reserved1[3];
|
||
UCHAR Success : 1;
|
||
UCHAR Reserved2 : 7;
|
||
} CDVD_REPORT_ASF_DATA, *PCDVD_REPORT_ASF_DATA;
|
||
|
||
typedef struct _CDVD_TITLE_KEY_HEADER {
|
||
UCHAR DataLength[2];
|
||
UCHAR Reserved1[1];
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR CGMS : 2;
|
||
UCHAR CP_SEC : 1;
|
||
UCHAR CPM : 1;
|
||
UCHAR Zero : 1;
|
||
CDVD_KEY_DATA TitleKey;
|
||
} CDVD_TITLE_KEY_HEADER, *PCDVD_TITLE_KEY_HEADER;
|
||
|
||
//
|
||
// Read Formatted Capacity Data - returned in Big Endian Format
|
||
//
|
||
|
||
typedef struct _FORMATTED_CAPACITY_DESCRIPTOR {
|
||
UCHAR NumberOfBlocks[4];
|
||
UCHAR Maximum : 1;
|
||
UCHAR Valid : 1;
|
||
UCHAR BlockLength[3];
|
||
} FORMATTED_CAPACITY_DESCRIPTOR, *PFORMATTED_CAPACITY_DESCRIPTOR;
|
||
|
||
typedef struct _FORMATTED_CAPACITY_LIST {
|
||
UCHAR Reserved[3];
|
||
UCHAR CapacityListLength;
|
||
FORMATTED_CAPACITY_DESCRIPTOR Descriptors[0];
|
||
} FORMATTED_CAPACITY_LIST, *PFORMATTED_CAPACITY_LIST;
|
||
|
||
//
|
||
// PLAY_CD definitions and constants
|
||
//
|
||
|
||
#define CD_EXPECTED_SECTOR_ANY 0x0
|
||
#define CD_EXPECTED_SECTOR_CDDA 0x1
|
||
#define CD_EXPECTED_SECTOR_MODE1 0x2
|
||
#define CD_EXPECTED_SECTOR_MODE2 0x3
|
||
#define CD_EXPECTED_SECTOR_MODE2_FORM1 0x4
|
||
#define CD_EXPECTED_SECTOR_MODE2_FORM2 0x5
|
||
|
||
//
|
||
// Read Disk Information Definitions and Capabilities
|
||
//
|
||
|
||
#define DISK_STATUS_EMPTY 0x00
|
||
#define DISK_STATUS_INCOMPLETE 0x01
|
||
#define DISK_STATUS_COMPLETE 0x02
|
||
|
||
#define LAST_SESSION_EMPTY 0x00
|
||
#define LAST_SESSION_INCOMPLETE 0x01
|
||
#define LAST_SESSION_COMPLETE 0x03
|
||
|
||
#define DISK_TYPE_CDDA 0x01
|
||
#define DISK_TYPE_CDI 0x10
|
||
#define DISK_TYPE_XA 0x20
|
||
#define DISK_TYPE_UNDEFINED 0xFF
|
||
|
||
typedef struct _OPC_TABLE_ENTRY {
|
||
UCHAR Speed[2];
|
||
UCHAR OPCValue[6];
|
||
} OPC_TABLE_ENTRY, *POPC_TABLE_ENTRY;
|
||
|
||
typedef struct _DISK_INFORMATION {
|
||
UCHAR Length[2];
|
||
|
||
UCHAR DiskStatus : 2;
|
||
UCHAR LastSessionStatus : 2;
|
||
UCHAR Erasable : 1;
|
||
UCHAR Reserved1 : 3;
|
||
|
||
UCHAR FirstTrackNumber;
|
||
UCHAR NumberOfSessions;
|
||
UCHAR LastSessionFirstTrack;
|
||
UCHAR LastSessionLastTrack;
|
||
|
||
UCHAR Reserved2 : 5;
|
||
UCHAR GEN : 1;
|
||
UCHAR DBC_V : 1;
|
||
UCHAR DID_V : 1;
|
||
|
||
UCHAR DiskType;
|
||
UCHAR Reserved3[3];
|
||
|
||
UCHAR DiskIdentification[4];
|
||
UCHAR LastSessionLeadIn[4]; // MSF
|
||
UCHAR LastPossibleStartTime[4]; // MSF
|
||
UCHAR DiskBarCode[8];
|
||
|
||
UCHAR Reserved4;
|
||
UCHAR NumberOPCEntries;
|
||
OPC_TABLE_ENTRY OPCTable[0];
|
||
} DISK_INFORMATION, *PDISK_INFORMATION;
|
||
|
||
//
|
||
// Read Header definitions and structures
|
||
//
|
||
|
||
typedef struct _DATA_BLOCK_HEADER {
|
||
UCHAR DataMode;
|
||
UCHAR Reserved[4];
|
||
union {
|
||
UCHAR LogicalBlockAddress[4];
|
||
struct {
|
||
UCHAR Reserved;
|
||
UCHAR M;
|
||
UCHAR S;
|
||
UCHAR F;
|
||
} MSF;
|
||
};
|
||
} DATA_BLOCK_HEADER, *PDATA_BLOCK_HEADER;
|
||
|
||
#define DATA_BLOCK_MODE0 0x0
|
||
#define DATA_BLOCK_MODE1 0x1
|
||
#define DATA_BLOCK_MODE2 0x2
|
||
|
||
//
|
||
// Read TOC Format Codes
|
||
//
|
||
|
||
#define READ_TOC_FORMAT_TOC 0x00
|
||
#define READ_TOC_FORMAT_SESSION 0x01
|
||
#define READ_TOC_FORMAT_FULL_TOC 0x02
|
||
#define READ_TOC_FORMAT_PMA 0x03
|
||
#define READ_TOC_FORMAT_ATIP 0x04
|
||
|
||
typedef struct _TRACK_INFORMATION {
|
||
UCHAR Length[2];
|
||
UCHAR TrackNumber;
|
||
UCHAR SessionNumber;
|
||
UCHAR Reserved1;
|
||
UCHAR TrackMode : 4;
|
||
UCHAR Copy : 1;
|
||
UCHAR Damage : 1;
|
||
UCHAR Reserved2 : 2;
|
||
UCHAR DataMode : 4;
|
||
UCHAR FP : 1;
|
||
UCHAR Packet : 1;
|
||
UCHAR Blank : 1;
|
||
UCHAR RT : 1;
|
||
UCHAR NWA_V : 1;
|
||
UCHAR Reserved3 : 7;
|
||
UCHAR TrackStartAddress[4];
|
||
UCHAR NextWritableAddress[4];
|
||
UCHAR FreeBlocks[4];
|
||
UCHAR FixedPacketSize[4];
|
||
} TRACK_INFORMATION, *PTRACK_INFORMATION;
|
||
|
||
|
||
|
||
//
|
||
// Command Descriptor Block constants.
|
||
//
|
||
|
||
#define CDB6GENERIC_LENGTH 6
|
||
#define CDB10GENERIC_LENGTH 10
|
||
#define CDB12GENERIC_LENGTH 12
|
||
|
||
#define SETBITON 1
|
||
#define SETBITOFF 0
|
||
|
||
//
|
||
// Mode Sense/Select page constants.
|
||
//
|
||
|
||
#define MODE_PAGE_ERROR_RECOVERY 0x01
|
||
#define MODE_PAGE_DISCONNECT 0x02
|
||
#define MODE_PAGE_FORMAT_DEVICE 0x03
|
||
#define MODE_PAGE_RIGID_GEOMETRY 0x04
|
||
#define MODE_PAGE_FLEXIBILE 0x05 // disk
|
||
#define MODE_PAGE_WRITE_PARAMETERS 0x05 // cdrom
|
||
#define MODE_PAGE_VERIFY_ERROR 0x07
|
||
#define MODE_PAGE_CACHING 0x08
|
||
#define MODE_PAGE_PERIPHERAL 0x09
|
||
#define MODE_PAGE_CONTROL 0x0A
|
||
#define MODE_PAGE_MEDIUM_TYPES 0x0B
|
||
#define MODE_PAGE_NOTCH_PARTITION 0x0C
|
||
#define MODE_PAGE_CD_AUDIO_CONTROL 0x0E
|
||
#define MODE_PAGE_DATA_COMPRESS 0x0F
|
||
#define MODE_PAGE_DEVICE_CONFIG 0x10
|
||
#define MODE_PAGE_MEDIUM_PARTITION 0x11
|
||
#define MODE_PAGE_CDVD_FEATURE_SET 0x18
|
||
#define MODE_PAGE_POWER_CONDITION 0x1A
|
||
#define MODE_PAGE_FAULT_REPORTING 0x1C
|
||
#define MODE_PAGE_CDVD_INACTIVITY 0x1D // cdrom
|
||
#define MODE_PAGE_ELEMENT_ADDRESS 0x1D
|
||
#define MODE_PAGE_TRANSPORT_GEOMETRY 0x1E
|
||
#define MODE_PAGE_DEVICE_CAPABILITIES 0x1F
|
||
#define MODE_PAGE_CAPABILITIES 0x2A // cdrom
|
||
|
||
#define MODE_SENSE_RETURN_ALL 0x3f
|
||
|
||
#define MODE_SENSE_CURRENT_VALUES 0x00
|
||
#define MODE_SENSE_CHANGEABLE_VALUES 0x40
|
||
#define MODE_SENSE_DEFAULT_VAULES 0x80
|
||
#define MODE_SENSE_SAVED_VALUES 0xc0
|
||
|
||
|
||
//
|
||
// SCSI CDB operation codes
|
||
//
|
||
|
||
// 6-byte commands:
|
||
#define SCSIOP_TEST_UNIT_READY 0x00
|
||
#define SCSIOP_REZERO_UNIT 0x01
|
||
#define SCSIOP_REWIND 0x01
|
||
#define SCSIOP_REQUEST_BLOCK_ADDR 0x02
|
||
#define SCSIOP_REQUEST_SENSE 0x03
|
||
#define SCSIOP_FORMAT_UNIT 0x04
|
||
#define SCSIOP_READ_BLOCK_LIMITS 0x05
|
||
#define SCSIOP_REASSIGN_BLOCKS 0x07
|
||
#define SCSIOP_INIT_ELEMENT_STATUS 0x07
|
||
#define SCSIOP_READ6 0x08
|
||
#define SCSIOP_RECEIVE 0x08
|
||
#define SCSIOP_WRITE6 0x0A
|
||
#define SCSIOP_PRINT 0x0A
|
||
#define SCSIOP_SEND 0x0A
|
||
#define SCSIOP_SEEK6 0x0B
|
||
#define SCSIOP_TRACK_SELECT 0x0B
|
||
#define SCSIOP_SLEW_PRINT 0x0B
|
||
#define SCSIOP_SEEK_BLOCK 0x0C
|
||
#define SCSIOP_PARTITION 0x0D
|
||
#define SCSIOP_READ_REVERSE 0x0F
|
||
#define SCSIOP_WRITE_FILEMARKS 0x10
|
||
#define SCSIOP_FLUSH_BUFFER 0x10
|
||
#define SCSIOP_SPACE 0x11
|
||
#define SCSIOP_INQUIRY 0x12
|
||
#define SCSIOP_VERIFY6 0x13
|
||
#define SCSIOP_RECOVER_BUF_DATA 0x14
|
||
#define SCSIOP_MODE_SELECT 0x15
|
||
#define SCSIOP_RESERVE_UNIT 0x16
|
||
#define SCSIOP_RELEASE_UNIT 0x17
|
||
#define SCSIOP_COPY 0x18
|
||
#define SCSIOP_ERASE 0x19
|
||
#define SCSIOP_MODE_SENSE 0x1A
|
||
#define SCSIOP_START_STOP_UNIT 0x1B
|
||
#define SCSIOP_STOP_PRINT 0x1B
|
||
#define SCSIOP_LOAD_UNLOAD 0x1B
|
||
#define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
|
||
#define SCSIOP_SEND_DIAGNOSTIC 0x1D
|
||
#define SCSIOP_MEDIUM_REMOVAL 0x1E
|
||
|
||
// 10-byte commands
|
||
#define SCSIOP_READ_FORMATTED_CAPACITY 0x23
|
||
#define SCSIOP_READ_CAPACITY 0x25
|
||
#define SCSIOP_READ 0x28
|
||
#define SCSIOP_WRITE 0x2A
|
||
#define SCSIOP_SEEK 0x2B
|
||
#define SCSIOP_LOCATE 0x2B
|
||
#define SCSIOP_POSITION_TO_ELEMENT 0x2B
|
||
#define SCSIOP_WRITE_VERIFY 0x2E
|
||
#define SCSIOP_VERIFY 0x2F
|
||
#define SCSIOP_SEARCH_DATA_HIGH 0x30
|
||
#define SCSIOP_SEARCH_DATA_EQUAL 0x31
|
||
#define SCSIOP_SEARCH_DATA_LOW 0x32
|
||
#define SCSIOP_SET_LIMITS 0x33
|
||
#define SCSIOP_READ_POSITION 0x34
|
||
#define SCSIOP_SYNCHRONIZE_CACHE 0x35
|
||
#define SCSIOP_COMPARE 0x39
|
||
#define SCSIOP_COPY_COMPARE 0x3A
|
||
#define SCSIOP_WRITE_DATA_BUFF 0x3B
|
||
#define SCSIOP_READ_DATA_BUFF 0x3C
|
||
#define SCSIOP_CHANGE_DEFINITION 0x40
|
||
#define SCSIOP_READ_SUB_CHANNEL 0x42
|
||
#define SCSIOP_READ_TOC 0x43
|
||
#define SCSIOP_READ_HEADER 0x44
|
||
#define SCSIOP_PLAY_AUDIO 0x45
|
||
#define SCSIOP_GET_CONFIGURATION 0x46
|
||
#define SCSIOP_PLAY_AUDIO_MSF 0x47
|
||
#define SCSIOP_PLAY_TRACK_INDEX 0x48
|
||
#define SCSIOP_PLAY_TRACK_RELATIVE 0x49
|
||
#define SCSIOP_GET_EVENT_STATUS 0x4A
|
||
#define SCSIOP_PAUSE_RESUME 0x4B
|
||
#define SCSIOP_LOG_SELECT 0x4C
|
||
#define SCSIOP_LOG_SENSE 0x4D
|
||
#define SCSIOP_STOP_PLAY_SCAN 0x4E
|
||
#define SCSIOP_READ_DISK_INFORMATION 0x51
|
||
#define SCSIOP_READ_TRACK_INFORMATION 0x52
|
||
#define SCSIOP_RESERVE_TRACK_RZONE 0x53
|
||
#define SCSIOP_SEND_OPC_INFORMATION 0x54 // optimum power calibration
|
||
#define SCSIOP_MODE_SELECT10 0x55
|
||
#define SCSIOP_MODE_SENSE10 0x5A
|
||
#define SCSIOP_CLOSE_TRACK_SESSION 0x5B
|
||
#define SCSIOP_READ_BUFFER_CAPACITY 0x5C
|
||
#define SCSIOP_SEND_CUE_SHEET 0x5D
|
||
#define SCSIOP_PERSISTENT_RESERVE_IN 0x5E
|
||
#define SCSIOP_PERSISTENT_RESERVE_OUT 0x5F
|
||
|
||
// 12-byte commands
|
||
#define SCSIOP_REPORT_LUNS 0xA0
|
||
#define SCSIOP_BLANK 0xA1
|
||
#define SCSIOP_SEND_KEY 0xA3
|
||
#define SCSIOP_REPORT_KEY 0xA4
|
||
#define SCSIOP_MOVE_MEDIUM 0xA5
|
||
#define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
|
||
#define SCSIOP_EXCHANGE_MEDIUM 0xA6
|
||
#define SCSIOP_SET_READ_AHEAD 0xA7
|
||
#define SCSIOP_READ_DVD_STRUCTURE 0xAD
|
||
#define SCSIOP_REQUEST_VOL_ELEMENT 0xB5
|
||
#define SCSIOP_SEND_VOLUME_TAG 0xB6
|
||
#define SCSIOP_READ_ELEMENT_STATUS 0xB8
|
||
#define SCSIOP_READ_CD_MSF 0xB9
|
||
#define SCSIOP_SCAN_CD 0xBA
|
||
#define SCSIOP_SET_CD_SPEED 0xBB
|
||
#define SCSIOP_PLAY_CD 0xBC
|
||
#define SCSIOP_MECHANISM_STATUS 0xBD
|
||
#define SCSIOP_READ_CD 0xBE
|
||
#define SCSIOP_SEND_DVD_STRUCTURE 0xBF
|
||
#define SCSIOP_INIT_ELEMENT_RANGE 0xE7
|
||
|
||
//
|
||
// If the IMMED bit is 1, status is returned as soon
|
||
// as the operation is initiated. If the IMMED bit
|
||
// is 0, status is not returned until the operation
|
||
// is completed.
|
||
//
|
||
|
||
#define CDB_RETURN_ON_COMPLETION 0
|
||
#define CDB_RETURN_IMMEDIATE 1
|
||
|
||
|
||
//
|
||
// Inquiry buffer structure. This is the data returned from the target
|
||
// after it receives an inquiry.
|
||
//
|
||
// This structure may be extended by the number of bytes specified
|
||
// in the field AdditionalLength. The defined size constant only
|
||
// includes fields through ProductRevisionLevel.
|
||
//
|
||
// The NT SCSI drivers are only interested in the first 36 bytes of data.
|
||
//
|
||
|
||
#define INQUIRYDATABUFFERSIZE 36
|
||
|
||
typedef struct _INQUIRYDATA {
|
||
UCHAR DeviceType : 5;
|
||
UCHAR DeviceTypeQualifier : 3;
|
||
UCHAR DeviceTypeModifier : 7;
|
||
UCHAR RemovableMedia : 1;
|
||
union {
|
||
UCHAR Versions;
|
||
struct {
|
||
UCHAR ANSIVersion : 3;
|
||
UCHAR ECMAVersion : 3;
|
||
UCHAR ISOVersion : 2;
|
||
};
|
||
};
|
||
UCHAR ResponseDataFormat : 4;
|
||
UCHAR HiSupport : 1;
|
||
UCHAR NormACA : 1;
|
||
UCHAR TerminateTask : 1;
|
||
UCHAR AERC : 1;
|
||
UCHAR AdditionalLength;
|
||
UCHAR Reserved;
|
||
UCHAR Addr16 : 1; // defined only for SIP devices.
|
||
UCHAR Addr32 : 1; // defined only for SIP devices.
|
||
UCHAR AckReqQ: 1; // defined only for SIP devices.
|
||
UCHAR MediumChanger : 1;
|
||
UCHAR MultiPort : 1;
|
||
UCHAR ReservedBit2 : 1;
|
||
UCHAR EnclosureServices : 1;
|
||
UCHAR ReservedBit3 : 1;
|
||
UCHAR SoftReset : 1;
|
||
UCHAR CommandQueue : 1;
|
||
UCHAR TransferDisable : 1; // defined only for SIP devices.
|
||
UCHAR LinkedCommands : 1;
|
||
UCHAR Synchronous : 1; // defined only for SIP devices.
|
||
UCHAR Wide16Bit : 1; // defined only for SIP devices.
|
||
UCHAR Wide32Bit : 1; // defined only for SIP devices.
|
||
UCHAR RelativeAddressing : 1;
|
||
UCHAR VendorId[8];
|
||
UCHAR ProductId[16];
|
||
UCHAR ProductRevisionLevel[4];
|
||
UCHAR VendorSpecific[20];
|
||
UCHAR Reserved3[40];
|
||
} INQUIRYDATA, *PINQUIRYDATA;
|
||
|
||
//
|
||
// Inquiry defines. Used to interpret data returned from target as result
|
||
// of inquiry command.
|
||
//
|
||
// DeviceType field
|
||
//
|
||
|
||
#define DIRECT_ACCESS_DEVICE 0x00 // disks
|
||
#define SEQUENTIAL_ACCESS_DEVICE 0x01 // tapes
|
||
#define PRINTER_DEVICE 0x02 // printers
|
||
#define PROCESSOR_DEVICE 0x03 // scanners, printers, etc
|
||
#define WRITE_ONCE_READ_MULTIPLE_DEVICE 0x04 // worms
|
||
#define READ_ONLY_DIRECT_ACCESS_DEVICE 0x05 // cdroms
|
||
#define SCANNER_DEVICE 0x06 // scanners
|
||
#define OPTICAL_DEVICE 0x07 // optical disks
|
||
#define MEDIUM_CHANGER 0x08 // jukebox
|
||
#define COMMUNICATION_DEVICE 0x09 // network
|
||
#define LOGICAL_UNIT_NOT_PRESENT_DEVICE 0x7F
|
||
|
||
#define DEVICE_QUALIFIER_ACTIVE 0x00
|
||
#define DEVICE_QUALIFIER_NOT_ACTIVE 0x01
|
||
#define DEVICE_QUALIFIER_NOT_SUPPORTED 0x03
|
||
|
||
//
|
||
// DeviceTypeQualifier field
|
||
//
|
||
|
||
#define DEVICE_CONNECTED 0x00
|
||
|
||
//
|
||
// Vital Product Data Pages
|
||
//
|
||
|
||
//
|
||
// Unit Serial Number Page (page code 0x80)
|
||
//
|
||
// Provides a product serial number for the target or the logical unit.
|
||
//
|
||
|
||
typedef struct _VPD_MEDIA_SERIAL_NUMBER_PAGE {
|
||
UCHAR DeviceType : 5;
|
||
UCHAR DeviceTypeQualifier : 3;
|
||
UCHAR PageCode;
|
||
UCHAR Reserved;
|
||
UCHAR PageLength;
|
||
UCHAR SerialNumber[0];
|
||
} VPD_MEDIA_SERIAL_NUMBER_PAGE, *PVPD_MEDIA_SERIAL_NUMBER_PAGE;
|
||
|
||
typedef struct _VPD_SERIAL_NUMBER_PAGE {
|
||
UCHAR DeviceType : 5;
|
||
UCHAR DeviceTypeQualifier : 3;
|
||
UCHAR PageCode;
|
||
UCHAR Reserved;
|
||
UCHAR PageLength;
|
||
UCHAR SerialNumber[0];
|
||
} VPD_SERIAL_NUMBER_PAGE, *PVPD_SERIAL_NUMBER_PAGE;
|
||
|
||
//
|
||
// Device Identification Page (page code 0x83)
|
||
// Provides the means to retrieve zero or more identification descriptors
|
||
// applying to the logical unit.
|
||
//
|
||
|
||
typedef enum _VPD_CODE_SET {
|
||
VpdCodeSetReserved = 0,
|
||
VpdCodeSetBinary = 1,
|
||
VpdCodeSetAscii = 2
|
||
} VPD_CODE_SET, *PVPD_CODE_SET;
|
||
|
||
typedef enum _VPD_ASSOCIATION {
|
||
VpdAssocDevice = 0,
|
||
VpdAssocPort = 1,
|
||
VpdAssocReserved1 = 3,
|
||
VpdAssocReserved2 = 4
|
||
} VPD_ASSOCIATION, *PVPD_ASSOCIATION;
|
||
|
||
typedef enum _VPD_IDENTIFIER_TYPE {
|
||
VpdIdentifierTypeVendorSpecific = 0,
|
||
VpdIdentifierTypeVendorId = 1,
|
||
VpdIdentifierTypeEUI64 = 2,
|
||
VpdIdentifierTypeFCPHName = 3,
|
||
VpdIdentifierTypePortRelative = 4
|
||
} VPD_IDENTIFIER_TYPE, *PVPD_IDENTIFIER_TYPE;
|
||
|
||
typedef struct _VPD_IDENTIFICATION_DESCRIPTOR {
|
||
UCHAR CodeSet : 4; // VPD_CODE_SET
|
||
UCHAR Reserved : 4;
|
||
UCHAR IdentifierType : 4; // VPD_IDENTIFIER_TYPE
|
||
UCHAR Association : 2;
|
||
UCHAR Reserved2 : 2;
|
||
UCHAR Reserved3;
|
||
UCHAR IdentifierLength;
|
||
UCHAR Identifier[0];
|
||
} VPD_IDENTIFICATION_DESCRIPTOR, *PVPD_IDENTIFICATION_DESCRIPTOR;
|
||
|
||
typedef struct _VPD_IDENTIFICATION_PAGE {
|
||
UCHAR DeviceType : 5;
|
||
UCHAR DeviceTypeQualifier : 3;
|
||
UCHAR PageCode;
|
||
UCHAR Reserved;
|
||
UCHAR PageLength;
|
||
|
||
|
||
//
|
||
// The following field is actually a variable length array of identification
|
||
// descriptors. Unfortunately there's no C notation for an array of
|
||
// variable length structures so we're forced to just pretend.
|
||
//
|
||
|
||
// VPD_IDENTIFICATION_DESCRIPTOR Descriptors[0];
|
||
UCHAR Descriptors[0];
|
||
} VPD_IDENTIFICATION_PAGE, *PVPD_IDENTIFICATION_PAGE;
|
||
|
||
//
|
||
// Supported Vital Product Data Pages Page (page code 0x00)
|
||
// Contains a list of the vital product data page cods supported by the target
|
||
// or logical unit.
|
||
//
|
||
|
||
typedef struct _VPD_SUPPORTED_PAGES_PAGE {
|
||
UCHAR DeviceType : 5;
|
||
UCHAR DeviceTypeQualifier : 3;
|
||
UCHAR PageCode;
|
||
UCHAR Reserved;
|
||
UCHAR PageLength;
|
||
UCHAR SupportedPageList[0];
|
||
} VPD_SUPPORTED_PAGES_PAGE, *PVPD_SUPPORTED_PAGES_PAGE;
|
||
|
||
|
||
#define VPD_MAX_BUFFER_SIZE 0xff
|
||
|
||
#define VPD_SUPPORTED_PAGES 0x00
|
||
#define VPD_SERIAL_NUMBER 0x80
|
||
#define VPD_DEVICE_IDENTIFIERS 0x83
|
||
#define VPD_MEDIA_SERIAL_NUMBER 0x84
|
||
|
||
//
|
||
// Persistent Reservation Definitions.
|
||
//
|
||
|
||
//
|
||
// PERSISTENT_RESERVE_* definitions
|
||
//
|
||
|
||
#define RESERVATION_ACTION_READ_KEYS 0x00
|
||
#define RESERVATION_ACTION_READ_RESERVATIONS 0x01
|
||
|
||
#define RESERVATION_ACTION_REGISTER 0x00
|
||
#define RESERVATION_ACTION_RESERVE 0x01
|
||
#define RESERVATION_ACTION_RELEASE 0x02
|
||
#define RESERVATION_ACTION_CLEAR 0x03
|
||
#define RESERVATION_ACTION_PREEMPT 0x04
|
||
#define RESERVATION_ACTION_PREEMPT_ABORT 0x05
|
||
#define RESERVATION_ACTION_REGISTER_IGNORE_EXISTING 0x06
|
||
|
||
#define RESERVATION_SCOPE_LU 0x00
|
||
#define RESERVATION_SCOPE_ELEMENT 0x02
|
||
|
||
#define RESERVATION_TYPE_WRITE_EXCLUSIVE 0x01
|
||
#define RESERVATION_TYPE_EXCLUSIVE 0x03
|
||
#define RESERVATION_TYPE_WRITE_EXCLUSIVE_REGISTRANTS 0x05
|
||
#define RESERVATION_TYPE_EXCLUSIVE_REGISTRANTS 0x06
|
||
|
||
//
|
||
// Structures for reserve in command.
|
||
//
|
||
|
||
typedef struct {
|
||
UCHAR Generation[4];
|
||
UCHAR AdditionalLength[4];
|
||
UCHAR ReservationKeyList[0][8];
|
||
} PRI_REGISTRATION_LIST, *PPRI_REGISTRATION_LIST;
|
||
|
||
typedef struct {
|
||
UCHAR ReservationKey[8];
|
||
UCHAR ScopeSpecificAddress[4];
|
||
UCHAR Reserved;
|
||
UCHAR Type : 4;
|
||
UCHAR Scope : 4;
|
||
UCHAR Obsolete[2];
|
||
} PRI_RESERVATION_DESCRIPTOR, *PPRI_RESERVATION_DESCRIPTOR;
|
||
|
||
typedef struct {
|
||
UCHAR Generation[4];
|
||
UCHAR AdditionalLength[4];
|
||
PRI_RESERVATION_DESCRIPTOR Reservations[0];
|
||
} PRI_RESERVATION_LIST, *PPRI_RESERVATION_LIST;
|
||
|
||
//
|
||
// Structures for reserve out command.
|
||
//
|
||
|
||
typedef struct {
|
||
UCHAR ReservationKey[8];
|
||
UCHAR ServiceActionReservationKey[8];
|
||
UCHAR ScopeSpecificAddress[4];
|
||
UCHAR ActivatePersistThroughPowerLoss : 1;
|
||
UCHAR Reserved1 : 7;
|
||
UCHAR Reserved2;
|
||
UCHAR Obsolete[2];
|
||
} PRO_PARAMETER_LIST, *PPRO_PARAMETER_LIST;
|
||
|
||
|
||
//
|
||
// Sense Data Format
|
||
//
|
||
|
||
typedef struct _SENSE_DATA {
|
||
UCHAR ErrorCode:7;
|
||
UCHAR Valid:1;
|
||
UCHAR SegmentNumber;
|
||
UCHAR SenseKey:4;
|
||
UCHAR Reserved:1;
|
||
UCHAR IncorrectLength:1;
|
||
UCHAR EndOfMedia:1;
|
||
UCHAR FileMark:1;
|
||
UCHAR Information[4];
|
||
UCHAR AdditionalSenseLength;
|
||
UCHAR CommandSpecificInformation[4];
|
||
UCHAR AdditionalSenseCode;
|
||
UCHAR AdditionalSenseCodeQualifier;
|
||
UCHAR FieldReplaceableUnitCode;
|
||
UCHAR SenseKeySpecific[3];
|
||
} SENSE_DATA, *PSENSE_DATA;
|
||
|
||
//
|
||
// Default request sense buffer size
|
||
//
|
||
|
||
#define SENSE_BUFFER_SIZE 18
|
||
|
||
//
|
||
// Maximum request sense buffer size
|
||
//
|
||
|
||
#define MAX_SENSE_BUFFER_SIZE 255
|
||
|
||
//
|
||
// Maximum number of additional sense bytes.
|
||
//
|
||
|
||
#define MAX_ADDITIONAL_SENSE_BYTES (MAX_SENSE_BUFFER_SIZE - SENSE_BUFFER_SIZE)
|
||
|
||
//
|
||
// Sense codes
|
||
//
|
||
|
||
#define SCSI_SENSE_NO_SENSE 0x00
|
||
#define SCSI_SENSE_RECOVERED_ERROR 0x01
|
||
#define SCSI_SENSE_NOT_READY 0x02
|
||
#define SCSI_SENSE_MEDIUM_ERROR 0x03
|
||
#define SCSI_SENSE_HARDWARE_ERROR 0x04
|
||
#define SCSI_SENSE_ILLEGAL_REQUEST 0x05
|
||
#define SCSI_SENSE_UNIT_ATTENTION 0x06
|
||
#define SCSI_SENSE_DATA_PROTECT 0x07
|
||
#define SCSI_SENSE_BLANK_CHECK 0x08
|
||
#define SCSI_SENSE_UNIQUE 0x09
|
||
#define SCSI_SENSE_COPY_ABORTED 0x0A
|
||
#define SCSI_SENSE_ABORTED_COMMAND 0x0B
|
||
#define SCSI_SENSE_EQUAL 0x0C
|
||
#define SCSI_SENSE_VOL_OVERFLOW 0x0D
|
||
#define SCSI_SENSE_MISCOMPARE 0x0E
|
||
#define SCSI_SENSE_RESERVED 0x0F
|
||
|
||
//
|
||
// Additional tape bit
|
||
//
|
||
|
||
#define SCSI_ILLEGAL_LENGTH 0x20
|
||
#define SCSI_EOM 0x40
|
||
#define SCSI_FILE_MARK 0x80
|
||
|
||
//
|
||
// Additional Sense codes
|
||
//
|
||
|
||
#define SCSI_ADSENSE_NO_SENSE 0x00
|
||
#define SCSI_ADSENSE_NO_SEEK_COMPLETE 0x02
|
||
#define SCSI_ADSENSE_LUN_NOT_READY 0x04
|
||
#define SCSI_ADSENSE_WRITE_ERROR 0x0C
|
||
#define SCSI_ADSENSE_TRACK_ERROR 0x14
|
||
#define SCSI_ADSENSE_SEEK_ERROR 0x15
|
||
#define SCSI_ADSENSE_REC_DATA_NOECC 0x17
|
||
#define SCSI_ADSENSE_REC_DATA_ECC 0x18
|
||
#define SCSI_ADSENSE_ILLEGAL_COMMAND 0x20
|
||
#define SCSI_ADSENSE_ILLEGAL_BLOCK 0x21
|
||
#define SCSI_ADSENSE_INVALID_CDB 0x24
|
||
#define SCSI_ADSENSE_INVALID_LUN 0x25
|
||
#define SCSI_ADSENSE_WRITE_PROTECT 0x27
|
||
#define SCSI_ADSENSE_MEDIUM_CHANGED 0x28
|
||
#define SCSI_ADSENSE_BUS_RESET 0x29
|
||
#define SCSI_ADSENSE_INSUFFICIENT_TIME_FOR_OPERATION 0x2E
|
||
#define SCSI_ADSENSE_INVALID_MEDIA 0x30
|
||
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE 0x3a
|
||
#define SCSI_ADSENSE_POSITION_ERROR 0x3b
|
||
#define SCSI_ADSENSE_OPERATOR_REQUEST 0x5a // see below
|
||
#define SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED 0x5d
|
||
#define SCSI_ADSENSE_ILLEGAL_MODE_FOR_THIS_TRACK 0x64
|
||
#define SCSI_ADSENSE_COPY_PROTECTION_FAILURE 0x6f
|
||
#define SCSI_ADSENSE_POWER_CALIBRATION_ERROR 0x73
|
||
#define SCSI_ADSENSE_VENDOR_UNIQUE 0x80 // and higher
|
||
#define SCSI_ADSENSE_MUSIC_AREA 0xA0
|
||
#define SCSI_ADSENSE_DATA_AREA 0xA1
|
||
#define SCSI_ADSENSE_VOLUME_OVERFLOW 0xA7
|
||
|
||
// for legacy apps:
|
||
#define SCSI_ADWRITE_PROTECT SCSI_ADSENSE_WRITE_PROTECT
|
||
#define SCSI_FAILURE_PREDICTION_THRESHOLD_EXCEEDED SCSI_ADSENSE_FAILURE_PREDICTION_THRESHOLD_EXCEEDED
|
||
|
||
|
||
//
|
||
// SCSI_ADSENSE_LUN_NOT_READY (0x04) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_CAUSE_NOT_REPORTABLE 0x00
|
||
#define SCSI_SENSEQ_BECOMING_READY 0x01
|
||
#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED 0x02
|
||
#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED 0x03
|
||
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS 0x04
|
||
#define SCSI_SENSEQ_REBUILD_IN_PROGRESS 0x05
|
||
#define SCSI_SENSEQ_RECALCULATION_IN_PROGRESS 0x06
|
||
#define SCSI_SENSEQ_OPERATION_IN_PROGRESS 0x07
|
||
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS 0x08
|
||
|
||
//
|
||
// SCSI_ADSENSE_WRITE_ERROR (0x0C) qualifiers
|
||
//
|
||
#define SCSI_SENSEQ_LOSS_OF_STREAMING 0x09
|
||
#define SCSI_SENSEQ_PADDING_BLOCKS_ADDED 0x0A
|
||
|
||
|
||
//
|
||
// SCSI_ADSENSE_NO_SENSE (0x00) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_FILEMARK_DETECTED 0x01
|
||
#define SCSI_SENSEQ_END_OF_MEDIA_DETECTED 0x02
|
||
#define SCSI_SENSEQ_SETMARK_DETECTED 0x03
|
||
#define SCSI_SENSEQ_BEGINNING_OF_MEDIA_DETECTED 0x04
|
||
|
||
//
|
||
// SCSI_ADSENSE_ILLEGAL_BLOCK (0x21) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_ILLEGAL_ELEMENT_ADDR 0x01
|
||
|
||
//
|
||
// SCSI_ADSENSE_POSITION_ERROR (0x3b) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_DESTINATION_FULL 0x0d
|
||
#define SCSI_SENSEQ_SOURCE_EMPTY 0x0e
|
||
|
||
//
|
||
// SCSI_ADSENSE_INVALID_MEDIA (0x30) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_INCOMPATIBLE_MEDIA_INSTALLED 0x00
|
||
#define SCSI_SENSEQ_UNKNOWN_FORMAT 0x01
|
||
#define SCSI_SENSEQ_INCOMPATIBLE_FORMAT 0x02
|
||
#define SCSI_SENSEQ_CLEANING_CARTRIDGE_INSTALLED 0x03
|
||
|
||
//
|
||
// SCSI_ADSENSE_OPERATOR_REQUEST (0x5a) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_STATE_CHANGE_INPUT 0x00 // generic request
|
||
#define SCSI_SENSEQ_MEDIUM_REMOVAL 0x01
|
||
#define SCSI_SENSEQ_WRITE_PROTECT_ENABLE 0x02
|
||
#define SCSI_SENSEQ_WRITE_PROTECT_DISABLE 0x03
|
||
|
||
//
|
||
// SCSI_ADSENSE_COPY_PROTECTION_FAILURE (0x6f) qualifiers
|
||
//
|
||
#define SCSI_SENSEQ_AUTHENTICATION_FAILURE 0x00
|
||
#define SCSI_SENSEQ_KEY_NOT_PRESENT 0x01
|
||
#define SCSI_SENSEQ_KEY_NOT_ESTABLISHED 0x02
|
||
#define SCSI_SENSEQ_READ_OF_SCRAMBLED_SECTOR_WITHOUT_AUTHENTICATION 0x03
|
||
#define SCSI_SENSEQ_MEDIA_CODE_MISMATCHED_TO_LOGICAL_UNIT 0x04
|
||
#define SCSI_SENSEQ_LOGICAL_UNIT_RESET_COUNT_ERROR 0x05
|
||
|
||
//
|
||
// SCSI_ADSENSE_POWER_CALIBRATION_ERROR (0x73) qualifiers
|
||
//
|
||
|
||
#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ALMOST_FULL 0x01
|
||
#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_FULL 0x02
|
||
#define SCSI_SENSEQ_POWER_CALIBRATION_AREA_ERROR 0x03
|
||
#define SCSI_SENSEQ_PMA_RMA_UPDATE_FAILURE 0x04
|
||
#define SCSI_SENSEQ_PMA_RMA_IS_FULL 0x05
|
||
#define SCSI_SENSEQ_PMA_RMA_ALMOST_FULL 0x06
|
||
|
||
|
||
|
||
//
|
||
// Read Capacity Data - returned in Big Endian format
|
||
//
|
||
|
||
typedef struct _READ_CAPACITY_DATA {
|
||
ULONG LogicalBlockAddress;
|
||
ULONG BytesPerBlock;
|
||
} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
|
||
|
||
//
|
||
// Read Block Limits Data - returned in Big Endian format
|
||
// This structure returns the maximum and minimum block
|
||
// size for a TAPE device.
|
||
//
|
||
|
||
typedef struct _READ_BLOCK_LIMITS {
|
||
UCHAR Reserved;
|
||
UCHAR BlockMaximumSize[3];
|
||
UCHAR BlockMinimumSize[2];
|
||
} READ_BLOCK_LIMITS_DATA, *PREAD_BLOCK_LIMITS_DATA;
|
||
|
||
|
||
//
|
||
// Mode data structures.
|
||
//
|
||
|
||
//
|
||
// Define Mode parameter header.
|
||
//
|
||
|
||
typedef struct _MODE_PARAMETER_HEADER {
|
||
UCHAR ModeDataLength;
|
||
UCHAR MediumType;
|
||
UCHAR DeviceSpecificParameter;
|
||
UCHAR BlockDescriptorLength;
|
||
}MODE_PARAMETER_HEADER, *PMODE_PARAMETER_HEADER;
|
||
|
||
typedef struct _MODE_PARAMETER_HEADER10 {
|
||
UCHAR ModeDataLength[2];
|
||
UCHAR MediumType;
|
||
UCHAR DeviceSpecificParameter;
|
||
UCHAR Reserved[2];
|
||
UCHAR BlockDescriptorLength[2];
|
||
}MODE_PARAMETER_HEADER10, *PMODE_PARAMETER_HEADER10;
|
||
|
||
#define MODE_FD_SINGLE_SIDE 0x01
|
||
#define MODE_FD_DOUBLE_SIDE 0x02
|
||
#define MODE_FD_MAXIMUM_TYPE 0x1E
|
||
#define MODE_DSP_FUA_SUPPORTED 0x10
|
||
#define MODE_DSP_WRITE_PROTECT 0x80
|
||
|
||
//
|
||
// Define the mode parameter block.
|
||
//
|
||
|
||
typedef struct _MODE_PARAMETER_BLOCK {
|
||
UCHAR DensityCode;
|
||
UCHAR NumberOfBlocks[3];
|
||
UCHAR Reserved;
|
||
UCHAR BlockLength[3];
|
||
}MODE_PARAMETER_BLOCK, *PMODE_PARAMETER_BLOCK;
|
||
|
||
//
|
||
// Define Disconnect-Reconnect page.
|
||
//
|
||
|
||
typedef struct _MODE_DISCONNECT_PAGE {
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved : 1;
|
||
UCHAR PageSavable : 1;
|
||
UCHAR PageLength;
|
||
UCHAR BufferFullRatio;
|
||
UCHAR BufferEmptyRatio;
|
||
UCHAR BusInactivityLimit[2];
|
||
UCHAR BusDisconnectTime[2];
|
||
UCHAR BusConnectTime[2];
|
||
UCHAR MaximumBurstSize[2];
|
||
UCHAR DataTransferDisconnect : 2;
|
||
UCHAR Reserved2[3];
|
||
}MODE_DISCONNECT_PAGE, *PMODE_DISCONNECT_PAGE;
|
||
|
||
//
|
||
// Define mode caching page.
|
||
//
|
||
|
||
typedef struct _MODE_CACHING_PAGE {
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved : 1;
|
||
UCHAR PageSavable : 1;
|
||
UCHAR PageLength;
|
||
UCHAR ReadDisableCache : 1;
|
||
UCHAR MultiplicationFactor : 1;
|
||
UCHAR WriteCacheEnable : 1;
|
||
UCHAR Reserved2 : 5;
|
||
UCHAR WriteRetensionPriority : 4;
|
||
UCHAR ReadRetensionPriority : 4;
|
||
UCHAR DisablePrefetchTransfer[2];
|
||
UCHAR MinimumPrefetch[2];
|
||
UCHAR MaximumPrefetch[2];
|
||
UCHAR MaximumPrefetchCeiling[2];
|
||
}MODE_CACHING_PAGE, *PMODE_CACHING_PAGE;
|
||
|
||
//
|
||
// Define write parameters cdrom page
|
||
//
|
||
typedef struct _MODE_CDROM_WRITE_PARAMETERS_PAGE {
|
||
UCHAR PageLength; // 0x32 ??
|
||
UCHAR WriteType : 4;
|
||
UCHAR TestWrite : 1;
|
||
UCHAR LinkSizeValid : 1;
|
||
UCHAR BufferUnderrunFreeEnabled : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR TrackMode : 4;
|
||
UCHAR Copy : 1;
|
||
UCHAR FixedPacket : 1;
|
||
UCHAR MultiSession : 2;
|
||
UCHAR DataBlockType : 4;
|
||
UCHAR Reserved3 : 4;
|
||
UCHAR LinkSize;
|
||
UCHAR Reserved4;
|
||
UCHAR HostApplicationCode : 6;
|
||
UCHAR Reserved5 : 2;
|
||
UCHAR SessionFormat;
|
||
UCHAR Reserved6;
|
||
UCHAR PacketSize[4];
|
||
UCHAR AudioPauseLength[2];
|
||
UCHAR Reserved7 : 7;
|
||
UCHAR MediaCatalogNumberValid : 1;
|
||
UCHAR MediaCatalogNumber[13];
|
||
UCHAR MediaCatalogNumberZero;
|
||
UCHAR MediaCatalogNumberAFrame;
|
||
UCHAR Reserved8 : 7;
|
||
UCHAR ISRCValid : 1;
|
||
UCHAR ISRCCountry[2];
|
||
UCHAR ISRCOwner[3];
|
||
UCHAR ISRCRecordingYear[2];
|
||
UCHAR ISRCSerialNumber[5];
|
||
UCHAR ISRCZero;
|
||
UCHAR ISRCAFrame;
|
||
UCHAR ISRCReserved;
|
||
UCHAR SubHeaderData[4];
|
||
} MODE_CDROM_WRITE_PARAMETERS_PAGE, *PMODE_CDROM_WRITE_PARAMETERS_PAGE;
|
||
|
||
//
|
||
// Define mode flexible disk page.
|
||
//
|
||
|
||
typedef struct _MODE_FLEXIBLE_DISK_PAGE {
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved : 1;
|
||
UCHAR PageSavable : 1;
|
||
UCHAR PageLength;
|
||
UCHAR TransferRate[2];
|
||
UCHAR NumberOfHeads;
|
||
UCHAR SectorsPerTrack;
|
||
UCHAR BytesPerSector[2];
|
||
UCHAR NumberOfCylinders[2];
|
||
UCHAR StartWritePrecom[2];
|
||
UCHAR StartReducedCurrent[2];
|
||
UCHAR StepRate[2];
|
||
UCHAR StepPluseWidth;
|
||
UCHAR HeadSettleDelay[2];
|
||
UCHAR MotorOnDelay;
|
||
UCHAR MotorOffDelay;
|
||
UCHAR Reserved2 : 5;
|
||
UCHAR MotorOnAsserted : 1;
|
||
UCHAR StartSectorNumber : 1;
|
||
UCHAR TrueReadySignal : 1;
|
||
UCHAR StepPlusePerCyclynder : 4;
|
||
UCHAR Reserved3 : 4;
|
||
UCHAR WriteCompenstation;
|
||
UCHAR HeadLoadDelay;
|
||
UCHAR HeadUnloadDelay;
|
||
UCHAR Pin2Usage : 4;
|
||
UCHAR Pin34Usage : 4;
|
||
UCHAR Pin1Usage : 4;
|
||
UCHAR Pin4Usage : 4;
|
||
UCHAR MediumRotationRate[2];
|
||
UCHAR Reserved4[2];
|
||
}MODE_FLEXIBLE_DISK_PAGE, *PMODE_FLEXIBLE_DISK_PAGE;
|
||
|
||
//
|
||
// Define mode format page.
|
||
//
|
||
|
||
typedef struct _MODE_FORMAT_PAGE {
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved : 1;
|
||
UCHAR PageSavable : 1;
|
||
UCHAR PageLength;
|
||
UCHAR TracksPerZone[2];
|
||
UCHAR AlternateSectorsPerZone[2];
|
||
UCHAR AlternateTracksPerZone[2];
|
||
UCHAR AlternateTracksPerLogicalUnit[2];
|
||
UCHAR SectorsPerTrack[2];
|
||
UCHAR BytesPerPhysicalSector[2];
|
||
UCHAR Interleave[2];
|
||
UCHAR TrackSkewFactor[2];
|
||
UCHAR CylinderSkewFactor[2];
|
||
UCHAR Reserved2 : 4;
|
||
UCHAR SurfaceFirst : 1;
|
||
UCHAR RemovableMedia : 1;
|
||
UCHAR HardSectorFormating : 1;
|
||
UCHAR SoftSectorFormating : 1;
|
||
UCHAR Reserved3[3];
|
||
}MODE_FORMAT_PAGE, *PMODE_FORMAT_PAGE;
|
||
|
||
//
|
||
// Define rigid disk driver geometry page.
|
||
//
|
||
|
||
typedef struct _MODE_RIGID_GEOMETRY_PAGE {
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved : 1;
|
||
UCHAR PageSavable : 1;
|
||
UCHAR PageLength;
|
||
UCHAR NumberOfCylinders[3];
|
||
UCHAR NumberOfHeads;
|
||
UCHAR StartWritePrecom[3];
|
||
UCHAR StartReducedCurrent[3];
|
||
UCHAR DriveStepRate[2];
|
||
UCHAR LandZoneCyclinder[3];
|
||
UCHAR RotationalPositionLock : 2;
|
||
UCHAR Reserved2 : 6;
|
||
UCHAR RotationOffset;
|
||
UCHAR Reserved3;
|
||
UCHAR RoataionRate[2];
|
||
UCHAR Reserved4[2];
|
||
}MODE_RIGID_GEOMETRY_PAGE, *PMODE_RIGID_GEOMETRY_PAGE;
|
||
|
||
//
|
||
// Define read write recovery page
|
||
//
|
||
|
||
typedef struct _MODE_READ_WRITE_RECOVERY_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR PSBit : 1;
|
||
UCHAR PageLength;
|
||
UCHAR DCRBit : 1;
|
||
UCHAR DTEBit : 1;
|
||
UCHAR PERBit : 1;
|
||
UCHAR EERBit : 1;
|
||
UCHAR RCBit : 1;
|
||
UCHAR TBBit : 1;
|
||
UCHAR ARRE : 1;
|
||
UCHAR AWRE : 1;
|
||
UCHAR ReadRetryCount;
|
||
UCHAR Reserved4[4];
|
||
UCHAR WriteRetryCount;
|
||
UCHAR Reserved5[3];
|
||
|
||
} MODE_READ_WRITE_RECOVERY_PAGE, *PMODE_READ_WRITE_RECOVERY_PAGE;
|
||
|
||
//
|
||
// Define read recovery page - cdrom
|
||
//
|
||
|
||
typedef struct _MODE_READ_RECOVERY_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR PSBit : 1;
|
||
UCHAR PageLength;
|
||
UCHAR DCRBit : 1;
|
||
UCHAR DTEBit : 1;
|
||
UCHAR PERBit : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR RCBit : 1;
|
||
UCHAR TBBit : 1;
|
||
UCHAR Reserved3 : 2;
|
||
UCHAR ReadRetryCount;
|
||
UCHAR Reserved4[4];
|
||
|
||
} MODE_READ_RECOVERY_PAGE, *PMODE_READ_RECOVERY_PAGE;
|
||
|
||
|
||
//
|
||
// Define Informational Exception Control Page. Used for failure prediction
|
||
//
|
||
|
||
typedef struct _MODE_INFO_EXCEPTIONS
|
||
{
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR PSBit : 1;
|
||
|
||
UCHAR PageLength;
|
||
|
||
union
|
||
{
|
||
UCHAR Flags;
|
||
struct
|
||
{
|
||
UCHAR LogErr : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR Test : 1;
|
||
UCHAR Dexcpt : 1;
|
||
UCHAR Reserved3 : 3;
|
||
UCHAR Perf : 1;
|
||
};
|
||
};
|
||
|
||
UCHAR ReportMethod : 4;
|
||
UCHAR Reserved4 : 4;
|
||
|
||
UCHAR IntervalTimer[4];
|
||
UCHAR ReportCount[4];
|
||
|
||
} MODE_INFO_EXCEPTIONS, *PMODE_INFO_EXCEPTIONS;
|
||
|
||
//
|
||
// Begin C/DVD 0.9 definitions
|
||
//
|
||
|
||
//
|
||
// Power Condition Mode Page Format
|
||
//
|
||
|
||
typedef struct _POWER_CONDITION_PAGE {
|
||
UCHAR PageCode : 6; // 0x1A
|
||
UCHAR Reserved : 1;
|
||
UCHAR PSBit : 1;
|
||
UCHAR PageLength; // 0x0A
|
||
UCHAR Reserved2;
|
||
|
||
UCHAR Standby : 1;
|
||
UCHAR Idle : 1;
|
||
UCHAR Reserved3 : 6;
|
||
|
||
UCHAR IdleTimer[4];
|
||
UCHAR StandbyTimer[4];
|
||
} POWER_CONDITION_PAGE, *PPOWER_CONDITION_PAGE;
|
||
|
||
//
|
||
// CD-Audio Control Mode Page Format
|
||
//
|
||
|
||
typedef struct _CDDA_OUTPUT_PORT {
|
||
UCHAR ChannelSelection : 4;
|
||
UCHAR Reserved : 4;
|
||
UCHAR Volume;
|
||
} CDDA_OUTPUT_PORT, *PCDDA_OUTPUT_PORT;
|
||
|
||
|
||
typedef struct _CDAUDIO_CONTROL_PAGE {
|
||
UCHAR PageCode : 6; // 0x0E
|
||
UCHAR Reserved : 1;
|
||
UCHAR PSBit : 1;
|
||
|
||
UCHAR PageLength; // 0x0E
|
||
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR StopOnTrackCrossing : 1; // Default 0
|
||
UCHAR Immediate : 1; // Always 1
|
||
UCHAR Reserved3 : 5;
|
||
|
||
UCHAR Reserved4[3];
|
||
UCHAR Obsolete[2];
|
||
|
||
CDDA_OUTPUT_PORT CDDAOutputPorts[4];
|
||
|
||
} CDAUDIO_CONTROL_PAGE, *PCDAUDIO_CONTROL_PAGE;
|
||
|
||
#define CDDA_CHANNEL_MUTED 0x0
|
||
#define CDDA_CHANNEL_ZERO 0x1
|
||
#define CDDA_CHANNEL_ONE 0x2
|
||
#define CDDA_CHANNEL_TWO 0x4
|
||
#define CDDA_CHANNEL_THREE 0x8
|
||
|
||
//
|
||
// C/DVD Feature Set Support & Version Page
|
||
//
|
||
|
||
typedef struct _CDVD_FEATURE_SET_PAGE {
|
||
UCHAR PageCode : 6; // 0x18
|
||
UCHAR Reserved : 1;
|
||
UCHAR PSBit : 1;
|
||
|
||
UCHAR PageLength; // 0x16
|
||
|
||
UCHAR CDAudio[2];
|
||
UCHAR EmbeddedChanger[2];
|
||
UCHAR PacketSMART[2];
|
||
UCHAR PersistantPrevent[2];
|
||
UCHAR EventStatusNotification[2];
|
||
UCHAR DigitalOutput[2];
|
||
UCHAR CDSequentialRecordable[2];
|
||
UCHAR DVDSequentialRecordable[2];
|
||
UCHAR RandomRecordable[2];
|
||
UCHAR KeyExchange[2];
|
||
UCHAR Reserved2[2];
|
||
} CDVD_FEATURE_SET_PAGE, *PCDVD_FEATURE_SET_PAGE;
|
||
|
||
//
|
||
// CDVD Inactivity Time-out Page Format
|
||
//
|
||
|
||
typedef struct _CDVD_INACTIVITY_TIMEOUT_PAGE {
|
||
UCHAR PageCode : 6; // 0x1D
|
||
UCHAR Reserved : 1;
|
||
UCHAR PSBit : 1;
|
||
|
||
UCHAR PageLength; // 0x08
|
||
UCHAR Reserved2[2];
|
||
|
||
UCHAR SWPP : 1;
|
||
UCHAR DISP : 1;
|
||
UCHAR Reserved3 : 6;
|
||
|
||
UCHAR Reserved4;
|
||
UCHAR GroupOneMinimumTimeout[2];
|
||
UCHAR GroupTwoMinimumTimeout[2];
|
||
} CDVD_INACTIVITY_TIMEOUT_PAGE, *PCDVD_INACTIVITY_TIMEOUT_PAGE;
|
||
|
||
//
|
||
// CDVD Capabilities & Mechanism Status Page
|
||
//
|
||
|
||
#define CDVD_LMT_CADDY 0
|
||
#define CDVD_LMT_TRAY 1
|
||
#define CDVD_LMT_POPUP 2
|
||
#define CDVD_LMT_RESERVED1 3
|
||
#define CDVD_LMT_CHANGER_INDIVIDUAL 4
|
||
#define CDVD_LMT_CHANGER_CARTRIDGE 5
|
||
#define CDVD_LMT_RESERVED2 6
|
||
#define CDVD_LMT_RESERVED3 7
|
||
|
||
|
||
typedef struct _CDVD_CAPABILITIES_PAGE {
|
||
UCHAR PageCode : 6; // 0x2A
|
||
UCHAR Reserved : 1;
|
||
UCHAR PSBit : 1; // offset 0
|
||
|
||
UCHAR PageLength; // 0x18 // offset 1
|
||
|
||
UCHAR CDRRead : 1;
|
||
UCHAR CDERead : 1;
|
||
UCHAR Method2 : 1;
|
||
UCHAR DVDROMRead : 1;
|
||
UCHAR DVDRRead : 1;
|
||
UCHAR DVDRAMRead : 1;
|
||
UCHAR Reserved2 : 2; // offset 2
|
||
|
||
UCHAR CDRWrite : 1;
|
||
UCHAR CDEWrite : 1;
|
||
UCHAR TestWrite : 1;
|
||
UCHAR Reserved3 : 1;
|
||
UCHAR DVDRWrite : 1;
|
||
UCHAR DVDRAMWrite : 1;
|
||
UCHAR Reserved4 : 2; // offset 3
|
||
|
||
UCHAR AudioPlay : 1;
|
||
UCHAR Composite : 1;
|
||
UCHAR DigitalPortOne : 1;
|
||
UCHAR DigitalPortTwo : 1;
|
||
UCHAR Mode2Form1 : 1;
|
||
UCHAR Mode2Form2 : 1;
|
||
UCHAR MultiSession : 1;
|
||
UCHAR Reserved5 : 1; // offset 4
|
||
|
||
UCHAR CDDA : 1;
|
||
UCHAR CDDAAccurate : 1;
|
||
UCHAR RWSupported : 1;
|
||
UCHAR RWDeinterleaved : 1;
|
||
UCHAR C2Pointers : 1;
|
||
UCHAR ISRC : 1;
|
||
UCHAR UPC : 1;
|
||
UCHAR ReadBarCodeCapable : 1; // offset 5
|
||
|
||
UCHAR Lock : 1;
|
||
UCHAR LockState : 1;
|
||
UCHAR PreventJumper : 1;
|
||
UCHAR Eject : 1;
|
||
UCHAR Reserved6 : 1;
|
||
UCHAR LoadingMechanismType : 3; // offset 6
|
||
|
||
UCHAR SeparateVolume : 1;
|
||
UCHAR SeperateChannelMute : 1;
|
||
UCHAR SupportsDiskPresent : 1;
|
||
UCHAR SWSlotSelection : 1;
|
||
UCHAR SideChangeCapable : 1;
|
||
UCHAR RWInLeadInReadable : 1;
|
||
UCHAR Reserved7 : 2; // offset 7
|
||
|
||
UCHAR ObsoleteReserved[2]; // offset 8
|
||
UCHAR NumberVolumeLevels[2]; // offset 10
|
||
UCHAR BufferSize[2]; // offset 12
|
||
UCHAR ObsoleteReserved2[2]; // offset 14
|
||
UCHAR ObsoleteReserved3; // offset 16
|
||
|
||
UCHAR Reserved8 : 1;
|
||
UCHAR BCK : 1;
|
||
UCHAR RCK : 1;
|
||
UCHAR LSBF : 1;
|
||
UCHAR Length : 2;
|
||
UCHAR Reserved9 : 2; // offset 17
|
||
|
||
UCHAR ObsoleteReserved4[2]; // offset 18
|
||
UCHAR ObsoleteReserved11[2]; // offset 20
|
||
|
||
//
|
||
// NOTE: This mode page is two bytes too small in the release
|
||
// version of the Windows2000 DDK. it also incorrectly
|
||
// put the CopyManagementRevision at offset 20 instead
|
||
// of offset 22, so fix that with a nameless union (for
|
||
// backwards-compatibility with those who "fixed" it on
|
||
// their own by looking at Reserved10[]).
|
||
//
|
||
|
||
union {
|
||
UCHAR CopyManagementRevision[2]; // offset 22
|
||
UCHAR Reserved10[2];
|
||
};
|
||
//UCHAR Reserved12[2]; // offset 24
|
||
|
||
} CDVD_CAPABILITIES_PAGE, *PCDVD_CAPABILITIES_PAGE;
|
||
|
||
|
||
typedef struct _LUN_LIST {
|
||
UCHAR LunListLength[4]; // sizeof LunSize * 8
|
||
UCHAR Reserved[4];
|
||
UCHAR Lun[0][8]; // 4 level of addressing. 2 bytes each.
|
||
} LUN_LIST, *PLUN_LIST;
|
||
|
||
|
||
#define LOADING_MECHANISM_CADDY 0x00
|
||
#define LOADING_MECHANISM_TRAY 0x01
|
||
#define LOADING_MECHANISM_POPUP 0x02
|
||
#define LOADING_MECHANISM_INDIVIDUAL_CHANGER 0x04
|
||
#define LOADING_MECHANISM_CARTRIDGE_CHANGER 0x05
|
||
|
||
//
|
||
// end C/DVD 0.9 mode page definitions
|
||
|
||
//
|
||
// Mode parameter list block descriptor -
|
||
// set the block length for reading/writing
|
||
//
|
||
//
|
||
|
||
#define MODE_BLOCK_DESC_LENGTH 8
|
||
#define MODE_HEADER_LENGTH 4
|
||
#define MODE_HEADER_LENGTH10 8
|
||
|
||
typedef struct _MODE_PARM_READ_WRITE {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader; // List Header Format
|
||
MODE_PARAMETER_BLOCK ParameterListBlock; // List Block Descriptor
|
||
|
||
} MODE_PARM_READ_WRITE_DATA, *PMODE_PARM_READ_WRITE_DATA;
|
||
|
||
|
||
//
|
||
// Tape definitions
|
||
//
|
||
|
||
typedef struct _TAPE_POSITION_DATA {
|
||
UCHAR Reserved1:2;
|
||
UCHAR BlockPositionUnsupported:1;
|
||
UCHAR Reserved2:3;
|
||
UCHAR EndOfPartition:1;
|
||
UCHAR BeginningOfPartition:1;
|
||
UCHAR PartitionNumber;
|
||
USHORT Reserved3;
|
||
UCHAR FirstBlock[4];
|
||
UCHAR LastBlock[4];
|
||
UCHAR Reserved4;
|
||
UCHAR NumberOfBlocks[3];
|
||
UCHAR NumberOfBytes[4];
|
||
} TAPE_POSITION_DATA, *PTAPE_POSITION_DATA;
|
||
|
||
//
|
||
// This structure is used to convert little endian
|
||
// ULONGs to SCSI CDB big endians values.
|
||
//
|
||
|
||
typedef union _EIGHT_BYTE {
|
||
|
||
struct {
|
||
UCHAR Byte0;
|
||
UCHAR Byte1;
|
||
UCHAR Byte2;
|
||
UCHAR Byte3;
|
||
UCHAR Byte4;
|
||
UCHAR Byte5;
|
||
UCHAR Byte6;
|
||
UCHAR Byte7;
|
||
};
|
||
|
||
ULONGLONG AsULongLong;
|
||
} EIGHT_BYTE, *PEIGHT_BYTE;
|
||
|
||
typedef union _FOUR_BYTE {
|
||
|
||
struct {
|
||
UCHAR Byte0;
|
||
UCHAR Byte1;
|
||
UCHAR Byte2;
|
||
UCHAR Byte3;
|
||
};
|
||
|
||
ULONG AsULong;
|
||
} FOUR_BYTE, *PFOUR_BYTE;
|
||
|
||
typedef union _TWO_BYTE {
|
||
|
||
struct {
|
||
UCHAR Byte0;
|
||
UCHAR Byte1;
|
||
};
|
||
|
||
USHORT AsUShort;
|
||
} TWO_BYTE, *PTWO_BYTE;
|
||
|
||
//
|
||
// Byte reversing macro for converting
|
||
// between big- and little-endian formats
|
||
//
|
||
|
||
#define REVERSE_BYTES_QUAD(Destination, Source) { \
|
||
PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination); \
|
||
PEIGHT_BYTE s = (PEIGHT_BYTE)(Source); \
|
||
d->Byte7 = s->Byte0; \
|
||
d->Byte6 = s->Byte1; \
|
||
d->Byte5 = s->Byte2; \
|
||
d->Byte4 = s->Byte3; \
|
||
d->Byte3 = s->Byte4; \
|
||
d->Byte2 = s->Byte5; \
|
||
d->Byte1 = s->Byte6; \
|
||
d->Byte0 = s->Byte7; \
|
||
}
|
||
|
||
#define REVERSE_BYTES(Destination, Source) { \
|
||
PFOUR_BYTE d = (PFOUR_BYTE)(Destination); \
|
||
PFOUR_BYTE s = (PFOUR_BYTE)(Source); \
|
||
d->Byte3 = s->Byte0; \
|
||
d->Byte2 = s->Byte1; \
|
||
d->Byte1 = s->Byte2; \
|
||
d->Byte0 = s->Byte3; \
|
||
}
|
||
|
||
#define REVERSE_BYTES_SHORT(Destination, Source) { \
|
||
PTWO_BYTE d = (PTWO_BYTE)(Destination); \
|
||
PTWO_BYTE s = (PTWO_BYTE)(Source); \
|
||
d->Byte1 = s->Byte0; \
|
||
d->Byte0 = s->Byte1; \
|
||
}
|
||
|
||
//
|
||
// Byte reversing macro for converting
|
||
// USHORTS from big to little endian in place
|
||
//
|
||
|
||
#define REVERSE_SHORT(Short) { \
|
||
UCHAR tmp; \
|
||
PTWO_BYTE w = (PTWO_BYTE)(Short); \
|
||
tmp = w->Byte0; \
|
||
w->Byte0 = w->Byte1; \
|
||
w->Byte1 = tmp; \
|
||
}
|
||
|
||
//
|
||
// Byte reversing macro for convering
|
||
// ULONGS between big & little endian in place
|
||
//
|
||
|
||
#define REVERSE_LONG(Long) { \
|
||
UCHAR tmp; \
|
||
PFOUR_BYTE l = (PFOUR_BYTE)(Long); \
|
||
tmp = l->Byte3; \
|
||
l->Byte3 = l->Byte0; \
|
||
l->Byte0 = tmp; \
|
||
tmp = l->Byte2; \
|
||
l->Byte2 = l->Byte1; \
|
||
l->Byte1 = tmp; \
|
||
}
|
||
|
||
//
|
||
// This macro has the effect of Bit = log2(Data)
|
||
//
|
||
|
||
#define WHICH_BIT(Data, Bit) { \
|
||
UCHAR tmp; \
|
||
for (tmp = 0; tmp < 32; tmp++) { \
|
||
if (((Data) >> tmp) == 1) { \
|
||
break; \
|
||
} \
|
||
} \
|
||
ASSERT(tmp != 32); \
|
||
(Bit) = tmp; \
|
||
}
|
||
|
||
|
||
#if defined DebugPrint
|
||
#undef DebugPrint
|
||
#endif
|
||
|
||
#if DBG
|
||
|
||
#define DebugPrint(x) TapeDebugPrint x
|
||
|
||
#else
|
||
|
||
#define DebugPrint(x)
|
||
|
||
#endif // DBG
|
||
|
||
//
|
||
// Define Device Configuration Page
|
||
//
|
||
|
||
typedef struct _MODE_DEVICE_CONFIGURATION_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR PS : 1;
|
||
UCHAR PageLength;
|
||
UCHAR ActiveFormat : 5;
|
||
UCHAR CAFBit : 1;
|
||
UCHAR CAPBit : 1;
|
||
UCHAR Reserved2 : 1;
|
||
UCHAR ActivePartition;
|
||
UCHAR WriteBufferFullRatio;
|
||
UCHAR ReadBufferEmptyRatio;
|
||
UCHAR WriteDelayTime[2];
|
||
UCHAR REW : 1;
|
||
UCHAR RBO : 1;
|
||
UCHAR SOCF : 2;
|
||
UCHAR AVC : 1;
|
||
UCHAR RSmk : 1;
|
||
UCHAR BIS : 1;
|
||
UCHAR DBR : 1;
|
||
UCHAR GapSize;
|
||
UCHAR Reserved3 : 3;
|
||
UCHAR SEW : 1;
|
||
UCHAR EEG : 1;
|
||
UCHAR EODdefined : 3;
|
||
UCHAR BufferSize[3];
|
||
UCHAR DCAlgorithm;
|
||
UCHAR Reserved4;
|
||
|
||
} MODE_DEVICE_CONFIGURATION_PAGE, *PMODE_DEVICE_CONFIGURATION_PAGE;
|
||
|
||
//
|
||
// Define Medium Partition Page
|
||
//
|
||
|
||
typedef struct _MODE_MEDIUM_PARTITION_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 1;
|
||
UCHAR PSBit : 1;
|
||
UCHAR PageLength;
|
||
UCHAR MaximumAdditionalPartitions;
|
||
UCHAR AdditionalPartitionDefined;
|
||
UCHAR Reserved2 : 3;
|
||
UCHAR PSUMBit : 2;
|
||
UCHAR IDPBit : 1;
|
||
UCHAR SDPBit : 1;
|
||
UCHAR FDPBit : 1;
|
||
UCHAR MediumFormatRecognition;
|
||
UCHAR Reserved3[2];
|
||
UCHAR Partition0Size[2];
|
||
UCHAR Partition1Size[2];
|
||
|
||
} MODE_MEDIUM_PARTITION_PAGE, *PMODE_MEDIUM_PARTITION_PAGE;
|
||
|
||
//
|
||
// Define Data Compression Page
|
||
//
|
||
|
||
typedef struct _MODE_DATA_COMPRESSION_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 2;
|
||
UCHAR PageLength;
|
||
UCHAR Reserved2 : 6;
|
||
UCHAR DCC : 1;
|
||
UCHAR DCE : 1;
|
||
UCHAR Reserved3 : 5;
|
||
UCHAR RED : 2;
|
||
UCHAR DDE : 1;
|
||
UCHAR CompressionAlgorithm[4];
|
||
UCHAR DecompressionAlgorithm[4];
|
||
UCHAR Reserved4[4];
|
||
|
||
} MODE_DATA_COMPRESSION_PAGE, *PMODE_DATA_COMPRESSION_PAGE;
|
||
|
||
//
|
||
// Define capabilites and mechanical status page.
|
||
//
|
||
|
||
typedef struct _MODE_CAPABILITIES_PAGE {
|
||
|
||
UCHAR PageCode : 6;
|
||
UCHAR Reserved1 : 2;
|
||
UCHAR PageLength;
|
||
UCHAR Reserved2[2];
|
||
UCHAR RO : 1;
|
||
UCHAR Reserved3 : 4;
|
||
UCHAR SPREV : 1;
|
||
UCHAR Reserved4 : 2;
|
||
UCHAR Reserved5 : 3;
|
||
UCHAR EFMT : 1;
|
||
UCHAR Reserved6 : 1;
|
||
UCHAR QFA : 1;
|
||
UCHAR Reserved7 : 2;
|
||
UCHAR LOCK : 1;
|
||
UCHAR LOCKED : 1;
|
||
UCHAR PREVENT : 1;
|
||
UCHAR UNLOAD : 1;
|
||
UCHAR Reserved8 : 2;
|
||
UCHAR ECC : 1;
|
||
UCHAR CMPRS : 1;
|
||
UCHAR Reserved9 : 1;
|
||
UCHAR BLK512 : 1;
|
||
UCHAR BLK1024 : 1;
|
||
UCHAR Reserved10 : 4;
|
||
UCHAR SLOWB : 1;
|
||
UCHAR MaximumSpeedSupported[2];
|
||
UCHAR MaximumStoredDefectedListEntries[2];
|
||
UCHAR ContinuousTransferLimit[2];
|
||
UCHAR CurrentSpeedSelected[2];
|
||
UCHAR BufferSize[2];
|
||
UCHAR Reserved11[2];
|
||
|
||
} MODE_CAPABILITIES_PAGE, *PMODE_CAPABILITIES_PAGE;
|
||
|
||
typedef struct _MODE_CAP_PAGE {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_PARAMETER_BLOCK ParameterListBlock;
|
||
MODE_CAPABILITIES_PAGE CapabilitiesPage;
|
||
|
||
} MODE_CAP_PAGE, *PMODE_CAP_PAGE;
|
||
|
||
|
||
|
||
//
|
||
// Mode parameter list header and medium partition page -
|
||
// used in creating partitions
|
||
//
|
||
|
||
typedef struct _MODE_MEDIUM_PART_PAGE {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
|
||
|
||
} MODE_MEDIUM_PART_PAGE, *PMODE_MEDIUM_PART_PAGE;
|
||
|
||
typedef struct _MODE_MEDIUM_PART_PAGE_PLUS {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_PARAMETER_BLOCK ParameterListBlock;
|
||
MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
|
||
|
||
} MODE_MEDIUM_PART_PAGE_PLUS, *PMODE_MEDIUM_PART_PAGE_PLUS;
|
||
|
||
|
||
|
||
//
|
||
// Mode parameters for retrieving tape or media information
|
||
//
|
||
|
||
typedef struct _MODE_TAPE_MEDIA_INFORMATION {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_PARAMETER_BLOCK ParameterListBlock;
|
||
MODE_MEDIUM_PARTITION_PAGE MediumPartPage;
|
||
|
||
} MODE_TAPE_MEDIA_INFORMATION, *PMODE_TAPE_MEDIA_INFORMATION;
|
||
|
||
//
|
||
// Mode parameter list header and device configuration page -
|
||
// used in retrieving device configuration information
|
||
//
|
||
|
||
typedef struct _MODE_DEVICE_CONFIG_PAGE {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage;
|
||
|
||
} MODE_DEVICE_CONFIG_PAGE, *PMODE_DEVICE_CONFIG_PAGE;
|
||
|
||
typedef struct _MODE_DEVICE_CONFIG_PAGE_PLUS {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_PARAMETER_BLOCK ParameterListBlock;
|
||
MODE_DEVICE_CONFIGURATION_PAGE DeviceConfigPage;
|
||
|
||
} MODE_DEVICE_CONFIG_PAGE_PLUS, *PMODE_DEVICE_CONFIG_PAGE_PLUS ;
|
||
|
||
//
|
||
// Mode parameter list header and data compression page -
|
||
// used in retrieving data compression information
|
||
//
|
||
|
||
typedef struct _MODE_DATA_COMPRESS_PAGE {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_DATA_COMPRESSION_PAGE DataCompressPage;
|
||
|
||
} MODE_DATA_COMPRESS_PAGE, *PMODE_DATA_COMPRESS_PAGE;
|
||
|
||
typedef struct _MODE_DATA_COMPRESS_PAGE_PLUS {
|
||
|
||
MODE_PARAMETER_HEADER ParameterListHeader;
|
||
MODE_PARAMETER_BLOCK ParameterListBlock;
|
||
MODE_DATA_COMPRESSION_PAGE DataCompressPage;
|
||
|
||
} MODE_DATA_COMPRESS_PAGE_PLUS, *PMODE_DATA_COMPRESS_PAGE_PLUS;
|
||
|
||
|
||
|
||
//
|
||
// Tape/Minitape definition.
|
||
//
|
||
|
||
typedef
|
||
BOOLEAN
|
||
(*TAPE_VERIFY_INQUIRY_ROUTINE)(
|
||
IN PINQUIRYDATA InquiryData,
|
||
IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage
|
||
);
|
||
|
||
typedef
|
||
VOID
|
||
(*TAPE_EXTENSION_INIT_ROUTINE)(
|
||
IN PVOID MinitapeExtension,
|
||
IN PINQUIRYDATA InquiryData,
|
||
IN PMODE_CAPABILITIES_PAGE ModeCapabilitiesPage
|
||
);
|
||
|
||
typedef enum _TAPE_STATUS {
|
||
TAPE_STATUS_SEND_SRB_AND_CALLBACK,
|
||
TAPE_STATUS_CALLBACK,
|
||
TAPE_STATUS_CHECK_TEST_UNIT_READY,
|
||
|
||
TAPE_STATUS_SUCCESS,
|
||
TAPE_STATUS_INSUFFICIENT_RESOURCES,
|
||
TAPE_STATUS_NOT_IMPLEMENTED,
|
||
TAPE_STATUS_INVALID_DEVICE_REQUEST,
|
||
TAPE_STATUS_INVALID_PARAMETER,
|
||
|
||
TAPE_STATUS_MEDIA_CHANGED,
|
||
TAPE_STATUS_BUS_RESET,
|
||
TAPE_STATUS_SETMARK_DETECTED,
|
||
TAPE_STATUS_FILEMARK_DETECTED,
|
||
TAPE_STATUS_BEGINNING_OF_MEDIA,
|
||
TAPE_STATUS_END_OF_MEDIA,
|
||
TAPE_STATUS_BUFFER_OVERFLOW,
|
||
TAPE_STATUS_NO_DATA_DETECTED,
|
||
TAPE_STATUS_EOM_OVERFLOW,
|
||
TAPE_STATUS_NO_MEDIA,
|
||
TAPE_STATUS_IO_DEVICE_ERROR,
|
||
TAPE_STATUS_UNRECOGNIZED_MEDIA,
|
||
|
||
TAPE_STATUS_DEVICE_NOT_READY,
|
||
TAPE_STATUS_MEDIA_WRITE_PROTECTED,
|
||
TAPE_STATUS_DEVICE_DATA_ERROR,
|
||
TAPE_STATUS_NO_SUCH_DEVICE,
|
||
TAPE_STATUS_INVALID_BLOCK_LENGTH,
|
||
TAPE_STATUS_IO_TIMEOUT,
|
||
TAPE_STATUS_DEVICE_NOT_CONNECTED,
|
||
TAPE_STATUS_DATA_OVERRUN,
|
||
TAPE_STATUS_DEVICE_BUSY,
|
||
TAPE_STATUS_REQUIRES_CLEANING,
|
||
TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED
|
||
|
||
} TAPE_STATUS, *PTAPE_STATUS;
|
||
|
||
typedef
|
||
VOID
|
||
(*TAPE_ERROR_ROUTINE)(
|
||
IN PVOID MinitapeExtension,
|
||
IN PSCSI_REQUEST_BLOCK Srb,
|
||
IN OUT PTAPE_STATUS TapeStatus
|
||
);
|
||
|
||
#define TAPE_RETRY_MASK 0x0000FFFF
|
||
#define IGNORE_ERRORS 0x00010000
|
||
#define RETURN_ERRORS 0x00020000
|
||
|
||
typedef
|
||
TAPE_STATUS
|
||
(*TAPE_PROCESS_COMMAND_ROUTINE)(
|
||
IN OUT PVOID MinitapeExtension,
|
||
IN OUT PVOID CommandExtension,
|
||
IN OUT PVOID CommandParameters,
|
||
IN OUT PSCSI_REQUEST_BLOCK Srb,
|
||
IN ULONG CallNumber,
|
||
IN TAPE_STATUS StatusOfLastCommand,
|
||
IN OUT PULONG RetryFlags
|
||
);
|
||
|
||
//
|
||
// NT 4.0 miniclass drivers will be using this.
|
||
//
|
||
|
||
typedef struct _TAPE_INIT_DATA {
|
||
TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry;
|
||
BOOLEAN QueryModeCapabilitiesPage ;
|
||
ULONG MinitapeExtensionSize;
|
||
TAPE_EXTENSION_INIT_ROUTINE ExtensionInit; /* OPTIONAL */
|
||
ULONG DefaultTimeOutValue; /* OPTIONAL */
|
||
TAPE_ERROR_ROUTINE TapeError; /* OPTIONAL */
|
||
ULONG CommandExtensionSize;
|
||
TAPE_PROCESS_COMMAND_ROUTINE CreatePartition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE Erase;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetPosition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetStatus;
|
||
TAPE_PROCESS_COMMAND_ROUTINE Prepare;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetPosition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE WriteMarks;
|
||
TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite;
|
||
} TAPE_INIT_DATA, *PTAPE_INIT_DATA;
|
||
|
||
typedef struct _TAPE_INIT_DATA_EX {
|
||
|
||
//
|
||
// Size of this structure.
|
||
//
|
||
|
||
ULONG InitDataSize;
|
||
|
||
//
|
||
// Keep the 4.0 init data as is, so support of these
|
||
// drivers can be as seamless as possible.
|
||
//
|
||
|
||
TAPE_VERIFY_INQUIRY_ROUTINE VerifyInquiry;
|
||
BOOLEAN QueryModeCapabilitiesPage ;
|
||
ULONG MinitapeExtensionSize;
|
||
TAPE_EXTENSION_INIT_ROUTINE ExtensionInit; /* OPTIONAL */
|
||
ULONG DefaultTimeOutValue; /* OPTIONAL */
|
||
TAPE_ERROR_ROUTINE TapeError; /* OPTIONAL */
|
||
ULONG CommandExtensionSize;
|
||
TAPE_PROCESS_COMMAND_ROUTINE CreatePartition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE Erase;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetDriveParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetMediaParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetPosition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE GetStatus;
|
||
TAPE_PROCESS_COMMAND_ROUTINE Prepare;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetDriveParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetMediaParameters;
|
||
TAPE_PROCESS_COMMAND_ROUTINE SetPosition;
|
||
TAPE_PROCESS_COMMAND_ROUTINE WriteMarks;
|
||
TAPE_PROCESS_COMMAND_ROUTINE PreProcessReadWrite;
|
||
|
||
//
|
||
// New entry points / information for 5.0
|
||
//
|
||
// Returns supported media types for the device.
|
||
//
|
||
|
||
TAPE_PROCESS_COMMAND_ROUTINE TapeGetMediaTypes;
|
||
|
||
//
|
||
// Indicates the number of different types the drive supports.
|
||
//
|
||
|
||
ULONG MediaTypesSupported;
|
||
|
||
//
|
||
// Entry point for all WMI operations that the driver/device supports.
|
||
//
|
||
|
||
TAPE_PROCESS_COMMAND_ROUTINE TapeWMIOperations;
|
||
ULONG Reserved[2];
|
||
} TAPE_INIT_DATA_EX, *PTAPE_INIT_DATA_EX;
|
||
|
||
SCSIPORT_API
|
||
ULONG
|
||
TapeClassInitialize(
|
||
IN PVOID Argument1,
|
||
IN PVOID Argument2,
|
||
IN PTAPE_INIT_DATA_EX TapeInitData
|
||
);
|
||
|
||
SCSIPORT_API
|
||
BOOLEAN
|
||
TapeClassAllocateSrbBuffer(
|
||
IN OUT PSCSI_REQUEST_BLOCK Srb,
|
||
IN ULONG SrbBufferSize
|
||
);
|
||
|
||
SCSIPORT_API
|
||
VOID
|
||
TapeClassZeroMemory(
|
||
IN OUT PVOID Buffer,
|
||
IN ULONG BufferSize
|
||
);
|
||
|
||
SCSIPORT_API
|
||
ULONG
|
||
TapeClassCompareMemory(
|
||
IN OUT PVOID Source1,
|
||
IN OUT PVOID Source2,
|
||
IN ULONG Length
|
||
);
|
||
|
||
SCSIPORT_API
|
||
LARGE_INTEGER
|
||
TapeClassLiDiv(
|
||
IN LARGE_INTEGER Dividend,
|
||
IN LARGE_INTEGER Divisor
|
||
);
|
||
|
||
SCSIPORT_API
|
||
VOID
|
||
TapeDebugPrint(
|
||
ULONG DebugPrintLevel,
|
||
PCCHAR DebugMessage,
|
||
...
|
||
);
|
||
|
||
|
||
//
|
||
// defines for QIC tape density codes
|
||
//
|
||
|
||
#define QIC_XX 0 // ????
|
||
#define QIC_24 5 // 0x05
|
||
#define QIC_120 15 // 0x0F
|
||
#define QIC_150 16 // 0x10
|
||
#define QIC_525 17 // 0x11
|
||
#define QIC_1350 18 // 0x12
|
||
#define QIC_1000 21 // 0x15
|
||
#define QIC_1000C 30 // 0x1E
|
||
#define QIC_2100 31 // 0x1F
|
||
#define QIC_2GB 34 // 0x22
|
||
#define QIC_5GB 40 // 0x28
|
||
|
||
//
|
||
// defines for QIC tape media codes
|
||
//
|
||
|
||
#define DCXXXX 0
|
||
#define DC300 1
|
||
#define DC300XLP 2
|
||
#define DC615 3
|
||
#define DC600 4
|
||
#define DC6037 5
|
||
#define DC6150 6
|
||
#define DC6250 7
|
||
#define DC6320 8
|
||
#define DC6525 9
|
||
#define DC9135SL 33 //0x21
|
||
#define DC9210 34 //0x22
|
||
#define DC9135 35 //0x23
|
||
#define DC9100 36 //0x24
|
||
#define DC9120 37 //0x25
|
||
#define DC9120SL 38 //0x26
|
||
#define DC9164 39 //0x27
|
||
#define DCXXXXFW 48 //0x30
|
||
#define DC9200SL 49 //0x31
|
||
#define DC9210XL 50 //0x32
|
||
#define DC10GB 51 //0x33
|
||
#define DC9200 52 //0x34
|
||
#define DC9120XL 53 //0x35
|
||
#define DC9210SL 54 //0x36
|
||
#define DC9164XL 55 //0x37
|
||
#define DC9200XL 64 //0x40
|
||
#define DC9400 65 //0x41
|
||
#define DC9500 66 //0x42
|
||
#define DC9500SL 70 //0x46
|
||
|
||
//
|
||
// defines for translation reference point
|
||
//
|
||
|
||
#define NOT_FROM_BOT 0
|
||
#define FROM_BOT 1
|
||
|
||
//
|
||
// info/structure returned by/from
|
||
// TapeLogicalBlockToPhysicalBlock( )
|
||
//
|
||
|
||
typedef struct _TAPE_PHYS_POSITION {
|
||
ULONG SeekBlockAddress;
|
||
ULONG SpaceBlockCount;
|
||
} TAPE_PHYS_POSITION, PTAPE_PHYS_POSITION;
|
||
|
||
//
|
||
// function prototypes
|
||
//
|
||
|
||
TAPE_PHYS_POSITION
|
||
TapeClassLogicalBlockToPhysicalBlock(
|
||
IN UCHAR DensityCode,
|
||
IN ULONG LogicalBlockAddress,
|
||
IN ULONG BlockLength,
|
||
IN BOOLEAN FromBOT
|
||
);
|
||
|
||
ULONG
|
||
TapeClassPhysicalBlockToLogicalBlock(
|
||
IN UCHAR DensityCode,
|
||
IN ULONG PhysicalBlockAddress,
|
||
IN ULONG BlockLength,
|
||
IN BOOLEAN FromBOT
|
||
);
|
||
|
||
|
||
//
|
||
// LOG SENSE Page codes
|
||
//
|
||
#define TapeAlertLogPage 0x2E
|
||
|
||
//
|
||
// Type of tape drive alert information
|
||
// supported by the drive.
|
||
// For example, if the type is TapeAlertInfoNone, the drive doesn't
|
||
// support any alert info. Need to use read\write error counters
|
||
// to predict drive problems. If the type is TapeAlertInfoRequestSense,
|
||
// request sense command can be used to determine drive problems.
|
||
//
|
||
typedef enum _TAPE_ALERT_INFO_TYPE {
|
||
TapeAlertInfoNone,
|
||
TapeAlertInfoRequestSense,
|
||
TapeAlertInfoLogPage
|
||
} TAPE_ALERT_INFO_TYPE;
|
||
|
||
//
|
||
// Tape alert information
|
||
//
|
||
#define READ_WARNING 1
|
||
#define WRITE_WARNING 2
|
||
#define HARD_ERROR 3
|
||
#define MEDIA_ERROR 4
|
||
#define READ_FAILURE 5
|
||
#define WRITE_FAILURE 6
|
||
#define MEDIA_LIFE 7
|
||
#define NOT_DATA_GRADE 8
|
||
#define WRITE_PROTECT 9
|
||
#define NO_REMOVAL 10
|
||
#define CLEANING_MEDIA 11
|
||
#define UNSUPPORTED_FORMAT 12
|
||
#define SNAPPED_TAPE 13
|
||
#define CLEAN_NOW 20
|
||
#define CLEAN_PERIODIC 21
|
||
#define EXPIRED_CLEANING_MEDIA 22
|
||
#define HARDWARE_A 30
|
||
#define HARDWARE_B 31
|
||
#define INTERFACE_ERROR 32
|
||
#define EJECT_MEDIA 33
|
||
#define DOWNLOAD_FAIL 34
|
||
|
||
//
|
||
// The following structs are duplicated from wmidata.h
|
||
// wmidata.h is generated from wmicore.mof file. Should
|
||
// the MOF file change for these structs, the corresponding
|
||
// change should be made in these structs also.
|
||
// Since minidrivers do not have access wmidata.h, we need
|
||
// to duplicate it here.
|
||
//
|
||
// ISSUE : 02/28/2000 - nramas : Should find a better way to
|
||
// handle the above. Duplication will cause problems in keeping
|
||
// these definitions in sync.
|
||
//
|
||
typedef struct _WMI_TAPE_DRIVE_PARAMETERS
|
||
{
|
||
// Maximum block size supported
|
||
ULONG MaximumBlockSize;
|
||
|
||
// Minimum block size supported
|
||
ULONG MinimumBlockSize;
|
||
|
||
// Default block size supported
|
||
ULONG DefaultBlockSize;
|
||
|
||
// Maximum number of partitions allowed.
|
||
ULONG MaximumPartitionCount;
|
||
|
||
// TRUE if drive supports compression.
|
||
BOOLEAN CompressionCapable;
|
||
|
||
// TRUE if compression is enabled.
|
||
BOOLEAN CompressionEnabled;
|
||
|
||
// TRUE if drive reports setmarks
|
||
BOOLEAN ReportSetmarks;
|
||
|
||
// TRUE if drive supports hardware error correction
|
||
BOOLEAN HardwareErrorCorrection;
|
||
} WMI_TAPE_DRIVE_PARAMETERS, *PWMI_TAPE_DRIVE_PARAMETERS;
|
||
|
||
typedef struct _WMI_TAPE_MEDIA_PARAMETERS
|
||
{
|
||
// Maximum capacity of the media
|
||
ULONGLONG MaximumCapacity;
|
||
|
||
// Available capacity of the media
|
||
ULONGLONG AvailableCapacity;
|
||
|
||
// Current blocksize
|
||
ULONG BlockSize;
|
||
|
||
// Current number of partitions
|
||
ULONG PartitionCount;
|
||
|
||
// TRUEif media is write protected
|
||
BOOLEAN MediaWriteProtected;
|
||
} WMI_TAPE_MEDIA_PARAMETERS, *PWMI_TAPE_MEDIA_PARAMETERS;
|
||
|
||
|
||
typedef struct _WMI_TAPE_PROBLEM_WARNING
|
||
{
|
||
// Tape drive problem warning event
|
||
ULONG DriveProblemType;
|
||
|
||
// Tape drive problem data
|
||
UCHAR TapeData[512];
|
||
} WMI_TAPE_PROBLEM_WARNING, *PWMI_TAPE_PROBLEM_WARNING;
|
||
|
||
typedef struct _WMI_TAPE_PROBLEM_IO_ERROR
|
||
{
|
||
// Read errors corrected without much delay
|
||
ULONG ReadCorrectedWithoutDelay;
|
||
|
||
// Read errors corrected with substantial delay
|
||
ULONG ReadCorrectedWithDelay;
|
||
|
||
// Total number of Read errors
|
||
ULONG ReadTotalErrors;
|
||
|
||
// Total number of read errors that were corrected
|
||
ULONG ReadTotalCorrectedErrors;
|
||
|
||
// Total number of uncorrected read errors
|
||
ULONG ReadTotalUncorrectedErrors;
|
||
|
||
// Number of times correction algorithm was processed for read
|
||
ULONG ReadCorrectionAlgorithmProcessed;
|
||
|
||
// Write errors corrected without much delay
|
||
ULONG WriteCorrectedWithoutDelay;
|
||
|
||
// Write errors corrected with substantial delay
|
||
ULONG WriteCorrectedWithDelay;
|
||
|
||
// Total number of Read errors
|
||
ULONG WriteTotalErrors;
|
||
|
||
// Total number of write errors that were corrected
|
||
ULONG WriteTotalCorrectedErrors;
|
||
|
||
// Total number of uncorrected write errors
|
||
ULONG WriteTotalUncorrectedErrors;
|
||
|
||
// Number of times correction algorithm was processed for write
|
||
ULONG WriteCorrectionAlgorithmProcessed;
|
||
|
||
// Errors not related to medium
|
||
ULONG NonMediumErrors;
|
||
} WMI_TAPE_PROBLEM_IO_ERROR, *PWMI_TAPE_PROBLEM_IO_ERROR;
|
||
|
||
typedef struct _WMI_TAPE_PROBLEM_DEVICE_ERROR
|
||
{
|
||
|
||
// WARNING : Drive is experiencing read problem.
|
||
BOOLEAN ReadWarning;
|
||
|
||
// WARNING : Drive is experiencing write problem.
|
||
BOOLEAN WriteWarning;
|
||
|
||
// Drive hardware problem
|
||
BOOLEAN HardError;
|
||
|
||
// Critical Error : Too many read errors.
|
||
BOOLEAN ReadFailure;
|
||
|
||
// Critical Error : Too many write errors.
|
||
BOOLEAN WriteFailure;
|
||
|
||
// Tape format not supported
|
||
BOOLEAN UnsupportedFormat;
|
||
|
||
// Tape is snapped. Replace media
|
||
BOOLEAN TapeSnapped;
|
||
|
||
// Drive Requires Cleaning
|
||
BOOLEAN DriveRequiresCleaning;
|
||
|
||
// It's time to clean the drive
|
||
BOOLEAN TimetoCleanDrive;
|
||
|
||
// Hardware error. Check drive
|
||
BOOLEAN DriveHardwareError;
|
||
|
||
// Some error in cabling, or connection.
|
||
BOOLEAN ScsiInterfaceError;
|
||
|
||
// Critical Error : Media life expired.
|
||
BOOLEAN MediaLife;
|
||
} WMI_TAPE_PROBLEM_DEVICE_ERROR, *PWMI_TAPE_PROBLEM_DEVICE_ERROR;
|
||
|
||
|
||
#endif /* _MINITAPE_ */
|