Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / dev / raid / asr / i2odpt.h
1 /* $FreeBSD: src/sys/dev/asr/i2odpt.h,v 1.1.2.1 2000/09/21 20:33:50 msmith Exp $ */
2 /* $DragonFly: src/sys/dev/raid/asr/i2odpt.h,v 1.2 2003/06/17 04:28:22 dillon Exp $ */
3 /****************************************************************
4  * Copyright (c) 1996-2000 Distributed Processing Technology Corporation
5  * Copyright (c) 2000 Adaptec Corporation.
6  * All rights reserved.
7  *
8  ****************************************************************/
9
10 #if !defined(I2O_DPT_HDR)
11 #define I2O_DPT_HDR
12
13 #define DPT_ORGANIZATION_ID 0x1B        /* For Private Messages */
14
15 /*
16  *      PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
17  *      PrivateMessageFrame.XFunctionCode = I2O_SCSI_SCB_EXEC
18  */
19
20 typedef struct _PRIVATE_SCSI_SCB_EXECUTE_MESSAGE {
21     I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
22 #   if (defined(sparc) || defined(_DPT_BIG_ENDIAN))
23         U32                   TID; /* Upper four bits currently are zero */
24 #   else
25         BF                    TID:16; /* Upper four bits currently are zero */
26         /* Command is interpreted by the host */
27         BF                    Interpret:1;
28         /* if TRUE, deal with Physical Firmware Array information */
29         BF                    Physical:1;
30         BF                    Reserved1:14;
31 #   endif
32     U8                        CDBLength;
33     U8                        Reserved;
34     I2O_SCB_FLAGS             SCBFlags;
35     U8                        CDB[  I2O_SCSI_CDB_LENGTH  ];
36     U32                       ByteCount;
37     I2O_SG_ELEMENT            SGL;
38 } PRIVATE_SCSI_SCB_EXECUTE_MESSAGE, * PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE;
39
40 /*
41  * Flash access and programming messages
42  *      PrivateMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE
43  *      PrivateMessageFrame.XFunctionCode = PRIVATE_FLAGS_REGION_*
44  *
45  *      SIZE    returns the total size of a region of flash
46  *      READ    copies a region (or portion thereof) into the buffer specified
47  *              by the SGL
48  *      WRITE   writes a region (or portion thereof) using the data specified
49  *              by the SGL
50  *
51  * Flash regions
52  *
53  *      0               operational-mode firmware
54  *      1               software (bios/utility)
55  *      2               oem nvram defaults
56  *      3               hba serial number
57  *      4               boot-mode firmware
58  *
59  * Any combination of RegionOffset and ByteCount can be specified providing
60  * they fit within the size of the specified region.
61  *
62  * Flash messages should be targeted to the Executive TID 0x000
63  */
64
65 #define PRIVATE_FLASH_REGION_SIZE       0x0100
66 #define PRIVATE_FLASH_REGION_READ       0x0101
67 #define PRIVATE_FLASH_REGION_WRITE      0x0102
68 #define PRIVATE_FLASH_REGION_CRC        0x0103
69
70 typedef struct _PRIVATE_FLASH_REGION_MESSAGE {
71     I2O_PRIVATE_MESSAGE_FRAME PrivateMessageFrame;
72     U32                       FlashRegion;
73     U32                       RegionOffset;
74     U32                       ByteCount;
75     I2O_SG_ELEMENT            SGL;
76 } PRIVATE_FLASH_REGION_MESSAGE, * PPRIVATE_FLASH_REGION_MESSAGE;
77
78 /* DPT Driver Printf message */
79
80 #define PRIVATE_DRIVER_PRINTF 0x0200
81
82 /* FwPrintFlags */
83 #define FW_FIRMWARE_FLAGS_NO_HEADER_B   0x00000001 /* Remove date header */
84
85 typedef struct _PRIVATE_DRIVER_PRINTF_MESSAGE {
86
87     I2O_PRIVATE_MESSAGE_FRAME   PrivateMessageFrame;
88
89     /* total bytes in PrintBuffer, including header */
90     U32                 PrintBufferByteCount;
91     /* exact data to be copied into the serial PrintBuffer */
92     U8                  PrintBuffer[1];
93
94 } PRIVATE_DRIVER_PRINTF_MESSAGE, * PPRIVATE_DRIVER_PRINTF_MESSAGE;
95
96 /* DPT Enable Diagnostics message 0x0201 */
97
98 #define PRIVATE_DIAG_ENABLE 0x0201
99
100 typedef struct _PRIVATE_DIAG_ENABLE_MESSAGE {
101         I2O_PRIVATE_MESSAGE_FRAME       PrivateMessageFrame;
102 } PRIVATE_DIAG_MESSAGE_FRAME, * PPRIVATE_DIAG_MESSAGE_FRAME;
103
104 /* DPT Driver Get/Put message */
105
106 #define PRIVATE_DRIVER_GET      0x300
107 #define PRIVATE_DRIVER_PUT      0x301
108
109 typedef struct _PRIVATE_DRIVER_GETPUT_MESSAGE
110 {
111         I2O_PRIVATE_MESSAGE_FRAME       PrivateMessageFrame;
112         U32                             Offset;
113         U32                             ByteCount;
114         I2O_SG_ELEMENT                  SGL;
115 } PRIVATE_DRIVER_GETPUT_MESSAGE, * PPRIVATE_DRIVER_GETPUT_MESSAGE;
116
117 /****************************************************************************/
118
119 /* DPT Peripheral Device Parameter Groups */
120
121 /****************************************************************************/
122
123 /* DPT Configuration and Operating Structures and Defines */
124
125 #define     I2O_DPT_DEVICE_INFO_GROUP_NO               0x8000
126
127 /* - 8000h - DPT Device Information Parameters Group defines */
128
129 /* Device Type */
130
131 #define I2O_DPT_DEVICE_TYPE_DIRECT        I2O_SCSI_DEVICE_TYPE_DIRECT
132 #define I2O_DPT_DEVICE_TYPE_SEQUENTIAL    I2O_SCSI_DEVICE_TYPE_SEQUENTIAL
133 #define I2O_DPT_DEVICE_TYPE_PRINTER       I2O_SCSI_DEVICE_TYPE_PRINTER
134 #define I2O_DPT_DEVICE_TYPE_PROCESSOR     I2O_SCSI_DEVICE_TYPE_PROCESSOR
135 #define I2O_DPT_DEVICE_TYPE_WORM          I2O_SCSI_DEVICE_TYPE_WORM
136 #define I2O_DPT_DEVICE_TYPE_CDROM         I2O_SCSI_DEVICE_TYPE_CDROM
137 #define I2O_DPT_DEVICE_TYPE_SCANNER       I2O_SCSI_DEVICE_TYPE_SCANNER
138 #define I2O_DPT_DEVICE_TYPE_OPTICAL       I2O_SCSI_DEVICE_TYPE_OPTICAL
139 #define I2O_DPT_DEVICE_TYPE_MEDIA_CHANGER I2O_SCSI_DEVICE_TYPE_MEDIA_CHANGER
140 #define I2O_DPT_DEVICE_TYPE_COMM          I2O_SCSI_DEVICE_TYPE_COMM
141 #define I2O_DPT_DEVICE_GRAPHICS_1         I2O_SCSI_DEVICE_GRAPHICS_1
142 #define I2O_DPT_DEVICE_GRAPHICS_2         I2O_SCSI_DEVICE_GRAPHICS_2
143 #define I2O_DPT_DEVICE_TYPE_ARRAY_CONT    I2O_SCSI_DEVICE_TYPE_ARRAY_CONT
144 #define I2O_DPT_DEVICE_TYPE_UNKNOWN       I2O_SCSI_DEVICE_TYPE_UNKNOWN
145
146 /* Flags */
147
148 #define I2O_DPT_PERIPHERAL_TYPE_FLAG      I2O_SCSI_PERIPHERAL_TYPE_FLAG
149 #define I2O_DPT_PERIPHERAL_TYPE_PARALLEL  I2O_SCSI_PERIPHERAL_TYPE_PARALLEL
150 #define I2O_DPT_PERIPHERAL_TYPE_SERIAL    I2O_SCSI_PERIPHERAL_TYPE_SERIAL
151
152 #define I2O_DPT_RESERVED_FLAG             I2O_SCSI_RESERVED_FLAG
153
154 #define I2O_DPT_DISCONNECT_FLAG           I2O_SCSI_DISCONNECT_FLAG
155 #define I2O_DPT_DISABLE_DISCONNECT        I2O_SCSI_DISABLE_DISCONNECT
156 #define I2O_DPT_ENABLE_DISCONNECT         I2O_SCSI_ENABLE_DISCONNECT
157
158 #define I2O_DPT_MODE_MASK                 I2O_SCSI_MODE_MASK
159 #define I2O_DPT_MODE_SET_DATA             I2O_SCSI_MODE_SET_DATA
160 #define I2O_DPT_MODE_SET_DEFAULT          I2O_SCSI_MODE_SET_DEFAULT
161 #define I2O_DPT_MODE_SET_SAFEST           I2O_SCSI_MODE_SET_SAFEST
162
163 #define I2O_DPT_DATA_WIDTH_MASK           I2O_SCSI_DATA_WIDTH_MASK
164 #define I2O_DPT_DATA_WIDTH_8              I2O_SCSI_DATA_WIDTH_8
165 #define I2O_DPT_DATA_WIDTH_16             I2O_SCSI_DATA_WIDTH_16
166 #define I2O_DPT_DATA_WIDTH_32             I2O_SCSI_DATA_WIDTH_32
167
168 #define I2O_DPT_SYNC_NEGOTIATION_FLAG     I2O_SCSI_SYNC_NEGOTIATION_FLAG
169 #define I2O_DPT_DISABLE_SYNC_NEGOTIATION  I2O_SCSI_DISABLE_SYNC_NEGOTIATION
170 #define I2O_DPT_ENABLE_SYNC_NEGOTIATION   I2O_SCSI_ENABLE_SYNC_NEGOTIATION
171
172 /* DPT Device Group 8000h - Device Information Parameter Group */
173
174 typedef struct _I2O_DPT_DEVICE_INFO_SCALAR {
175     U8          DeviceType;     /* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
176     U8          Flags;          /* Identical to I2O_SCSI_DEVICE_INFO SCALAR */
177     U16         Bus;
178     U32         Identifier;
179     U8          LunInfo[8]; /* SCSI-2 8-bit scalar LUN goes into offset 1 */
180
181 } I2O_DPT_DEVICE_INFO_SCALAR, *PI2O_DPT_DEVICE_INFO_SCALAR;
182
183 #define I2O_DPT_EXEC_IOP_BUFFERS_GROUP_NO    0x8000
184
185 /* DPT Exec Iop Buffers Group 8000h */
186
187 typedef struct _I2O_DPT_EXEC_IOP_BUFFERS_SCALAR {
188     U32      SerialOutputOffset;    /* offset from base address to header   */
189     U32      SerialOutputSize;      /* size of data buffer in bytes         */
190     U32      SerialHeaderSize;      /* size of data buffer header in bytes  */
191     U32      SerialFlagsSupported;  /* Mask of debug flags supported        */
192
193 } I2O_DPT_EXEC_IOP_BUFFERS_SCALAR, *PI2O_DPT_EXEC_IOP_BUFFERS_SCALAR;
194
195
196 #endif /* I2O_DPT_HDR */