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