[ALSA] hda-codec - Fix connection list parsing
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / message / fusion / mptctl.h
blob518996e03481088f81ae3ce3ad165c205fb0c4a9
1 /*
2 * linux/drivers/message/fusion/mptioctl.h
3 * Fusion MPT misc device (ioctl) driver.
4 * For use with PCI chip/adapter(s):
5 * LSIFC9xx/LSI409xx Fibre Channel
6 * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
8 * Copyright (c) 1999-2005 LSI Logic Corporation
9 * (mailto:mpt_linux_developer@lsil.com)
12 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; version 2 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 NO WARRANTY
24 THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
25 CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
26 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
27 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
28 solely responsible for determining the appropriateness of using and
29 distributing the Program and assumes all risks associated with its
30 exercise of rights under this Agreement, including but not limited to
31 the risks and costs of program errors, damage to or loss of data,
32 programs or equipment, and unavailability or interruption of operations.
34 DISCLAIMER OF LIABILITY
35 NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
38 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
39 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
40 USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
41 HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
43 You should have received a copy of the GNU General Public License
44 along with this program; if not, write to the Free Software
45 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
48 #ifndef MPTCTL_H_INCLUDED
49 #define MPTCTL_H_INCLUDED
50 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
54 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
58 #define MPT_MISCDEV_BASENAME "mptctl"
59 #define MPT_MISCDEV_PATHNAME "/dev/" MPT_MISCDEV_BASENAME
61 #define MPT_PRODUCT_LENGTH 12
64 * Generic MPT Control IOCTLs and structures
66 #define MPT_MAGIC_NUMBER 'm'
68 #define MPTRWPERF _IOWR(MPT_MAGIC_NUMBER,0,struct mpt_raw_r_w)
70 #define MPTFWDOWNLOAD _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer)
71 #define MPTCOMMAND _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command)
73 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
74 #define MPTFWDOWNLOAD32 _IOWR(MPT_MAGIC_NUMBER,15,struct mpt_fw_xfer32)
75 #define MPTCOMMAND32 _IOWR(MPT_MAGIC_NUMBER,20,struct mpt_ioctl_command32)
76 #endif
78 #define MPTIOCINFO _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
79 #define MPTIOCINFO1 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
80 #define MPTIOCINFO2 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
81 #define MPTTARGETINFO _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
82 #define MPTTEST _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
83 #define MPTEVENTQUERY _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
84 #define MPTEVENTENABLE _IOWR(MPT_MAGIC_NUMBER,22,struct mpt_ioctl_eventenable)
85 #define MPTEVENTREPORT _IOWR(MPT_MAGIC_NUMBER,23,struct mpt_ioctl_eventreport)
86 #define MPTHARDRESET _IOWR(MPT_MAGIC_NUMBER,24,struct mpt_ioctl_diag_reset)
87 #define MPTFWREPLACE _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
90 * SPARC PLATFORM REMARKS:
91 * IOCTL data structures that contain pointers
92 * will have different sizes in the driver and applications
93 * (as the app. will not use 8-byte pointers).
94 * Apps should use MPTFWDOWNLOAD and MPTCOMMAND.
95 * The driver will convert data from
96 * mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
97 * internally.
99 * If data structures change size, must handle as in IOCGETINFO.
101 struct mpt_fw_xfer {
102 unsigned int iocnum; /* IOC unit number */
103 unsigned int fwlen;
104 void __user *bufp; /* Pointer to firmware buffer */
107 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
108 struct mpt_fw_xfer32 {
109 unsigned int iocnum;
110 unsigned int fwlen;
111 u32 bufp;
113 #endif /*}*/
116 * IOCTL header structure.
117 * iocnum - must be defined.
118 * port - must be defined for all IOCTL commands other than MPTIOCINFO
119 * maxDataSize - ignored on MPTCOMMAND commands
120 * - ignored on MPTFWREPLACE commands
121 * - on query commands, reports the maximum number of bytes to be returned
122 * to the host driver (count includes the header).
123 * That is, set to sizeof(struct mpt_ioctl_iocinfo) for fixed sized commands.
124 * Set to sizeof(struct mpt_ioctl_targetinfo) + datasize for variable
125 * sized commands. (MPTTARGETINFO, MPTEVENTREPORT)
127 typedef struct _mpt_ioctl_header {
128 unsigned int iocnum; /* IOC unit number */
129 unsigned int port; /* IOC port number */
130 int maxDataSize; /* Maximum Num. bytes to transfer on read */
131 } mpt_ioctl_header;
134 * Issue a diagnostic reset
136 struct mpt_ioctl_diag_reset {
137 mpt_ioctl_header hdr;
142 * PCI bus/device/function information structure.
144 struct mpt_ioctl_pci_info {
145 union {
146 struct {
147 unsigned int deviceNumber : 5;
148 unsigned int functionNumber : 3;
149 unsigned int busNumber : 24;
150 } bits;
151 unsigned int asUlong;
152 } u;
155 struct mpt_ioctl_pci_info2 {
156 union {
157 struct {
158 unsigned int deviceNumber : 5;
159 unsigned int functionNumber : 3;
160 unsigned int busNumber : 24;
161 } bits;
162 unsigned int asUlong;
163 } u;
164 int segmentID;
168 * Adapter Information Page
169 * Read only.
170 * Data starts at offset 0xC
172 #define MPT_IOCTL_INTERFACE_FC (0x01)
173 #define MPT_IOCTL_INTERFACE_SCSI (0x00)
174 #define MPT_IOCTL_VERSION_LENGTH (32)
176 struct mpt_ioctl_iocinfo {
177 mpt_ioctl_header hdr;
178 int adapterType; /* SCSI or FCP */
179 int port; /* port number */
180 int pciId; /* PCI Id. */
181 int hwRev; /* hardware revision */
182 int subSystemDevice; /* PCI subsystem Device ID */
183 int subSystemVendor; /* PCI subsystem Vendor ID */
184 int numDevices; /* number of devices */
185 int FWVersion; /* FW Version (integer) */
186 int BIOSVersion; /* BIOS Version (integer) */
187 char driverVersion[MPT_IOCTL_VERSION_LENGTH]; /* Driver Version (string) */
188 char busChangeEvent;
189 char hostId;
190 char rsvd[2];
191 struct mpt_ioctl_pci_info2 pciInfo; /* Added Rev 2 */
194 struct mpt_ioctl_iocinfo_rev1 {
195 mpt_ioctl_header hdr;
196 int adapterType; /* SCSI or FCP */
197 int port; /* port number */
198 int pciId; /* PCI Id. */
199 int hwRev; /* hardware revision */
200 int subSystemDevice; /* PCI subsystem Device ID */
201 int subSystemVendor; /* PCI subsystem Vendor ID */
202 int numDevices; /* number of devices */
203 int FWVersion; /* FW Version (integer) */
204 int BIOSVersion; /* BIOS Version (integer) */
205 char driverVersion[MPT_IOCTL_VERSION_LENGTH]; /* Driver Version (string) */
206 char busChangeEvent;
207 char hostId;
208 char rsvd[2];
209 struct mpt_ioctl_pci_info pciInfo; /* Added Rev 1 */
212 /* Original structure, must always accept these
213 * IOCTLs. 4 byte pads can occur based on arch with
214 * above structure. Wish to re-align, but cannot.
216 struct mpt_ioctl_iocinfo_rev0 {
217 mpt_ioctl_header hdr;
218 int adapterType; /* SCSI or FCP */
219 int port; /* port number */
220 int pciId; /* PCI Id. */
221 int hwRev; /* hardware revision */
222 int subSystemDevice; /* PCI subsystem Device ID */
223 int subSystemVendor; /* PCI subsystem Vendor ID */
224 int numDevices; /* number of devices */
225 int FWVersion; /* FW Version (integer) */
226 int BIOSVersion; /* BIOS Version (integer) */
227 char driverVersion[MPT_IOCTL_VERSION_LENGTH]; /* Driver Version (string) */
228 char busChangeEvent;
229 char hostId;
230 char rsvd[2];
234 * Device Information Page
235 * Report the number of, and ids of, all targets
236 * on this IOC. The ids array is a packed structure
237 * of the known targetInfo.
238 * bits 31-24: reserved
239 * 23-16: LUN
240 * 15- 8: Bus Number
241 * 7- 0: Target ID
243 struct mpt_ioctl_targetinfo {
244 mpt_ioctl_header hdr;
245 int numDevices; /* Num targets on this ioc */
246 int targetInfo[1];
251 * Event reporting IOCTL's. These IOCTL's will
252 * use the following defines:
254 struct mpt_ioctl_eventquery {
255 mpt_ioctl_header hdr;
256 unsigned short eventEntries;
257 unsigned short reserved;
258 unsigned int eventTypes;
261 struct mpt_ioctl_eventenable {
262 mpt_ioctl_header hdr;
263 unsigned int eventTypes;
266 #ifndef __KERNEL__
267 typedef struct {
268 uint event;
269 uint eventContext;
270 uint data[2];
271 } MPT_IOCTL_EVENTS;
272 #endif
274 struct mpt_ioctl_eventreport {
275 mpt_ioctl_header hdr;
276 MPT_IOCTL_EVENTS eventData[1];
279 #define MPT_MAX_NAME 32
280 struct mpt_ioctl_test {
281 mpt_ioctl_header hdr;
282 u8 name[MPT_MAX_NAME];
283 int chip_type;
284 u8 product [MPT_PRODUCT_LENGTH];
287 /* Replace the FW image cached in host driver memory
288 * newImageSize - image size in bytes
289 * newImage - first byte of the new image
291 typedef struct mpt_ioctl_replace_fw {
292 mpt_ioctl_header hdr;
293 int newImageSize;
294 u8 newImage[1];
295 } mpt_ioctl_replace_fw_t;
297 /* General MPT Pass through data strucutre
299 * iocnum
300 * timeout - in seconds, command timeout. If 0, set by driver to
301 * default value.
302 * replyFrameBufPtr - reply location
303 * dataInBufPtr - destination for read
304 * dataOutBufPtr - data source for write
305 * senseDataPtr - sense data location
306 * maxReplyBytes - maximum number of reply bytes to be sent to app.
307 * dataInSize - num bytes for data transfer in (read)
308 * dataOutSize - num bytes for data transfer out (write)
309 * dataSgeOffset - offset in words from the start of the request message
310 * to the first SGL
311 * MF[1];
313 * Remark: Some config pages have bi-directional transfer,
314 * both a read and a write. The basic structure allows for
315 * a bidirectional set up. Normal messages will have one or
316 * both of these buffers NULL.
318 struct mpt_ioctl_command {
319 mpt_ioctl_header hdr;
320 int timeout; /* optional (seconds) */
321 char __user *replyFrameBufPtr;
322 char __user *dataInBufPtr;
323 char __user *dataOutBufPtr;
324 char __user *senseDataPtr;
325 int maxReplyBytes;
326 int dataInSize;
327 int dataOutSize;
328 int maxSenseBytes;
329 int dataSgeOffset;
330 char MF[1];
334 * SPARC PLATFORM: See earlier remark.
336 #if defined(__KERNEL__) && defined(CONFIG_COMPAT)
337 struct mpt_ioctl_command32 {
338 mpt_ioctl_header hdr;
339 int timeout;
340 u32 replyFrameBufPtr;
341 u32 dataInBufPtr;
342 u32 dataOutBufPtr;
343 u32 senseDataPtr;
344 int maxReplyBytes;
345 int dataInSize;
346 int dataOutSize;
347 int maxSenseBytes;
348 int dataSgeOffset;
349 char MF[1];
351 #endif /*}*/
354 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
356 * HP Specific IOCTL Defines and Structures
359 #define CPQFCTS_IOC_MAGIC 'Z'
360 #define HP_IOC_MAGIC 'Z'
361 #define HP_GETHOSTINFO _IOR(HP_IOC_MAGIC, 20, hp_host_info_t)
362 #define HP_GETHOSTINFO1 _IOR(HP_IOC_MAGIC, 20, hp_host_info_rev0_t)
363 #define HP_GETTARGETINFO _IOR(HP_IOC_MAGIC, 21, hp_target_info_t)
365 /* All HP IOCTLs must include this header
367 typedef struct _hp_header {
368 unsigned int iocnum;
369 unsigned int host;
370 unsigned int channel;
371 unsigned int id;
372 unsigned int lun;
373 } hp_header_t;
376 * Header:
377 * iocnum required (input)
378 * host ignored
379 * channe ignored
380 * id ignored
381 * lun ignored
383 typedef struct _hp_host_info {
384 hp_header_t hdr;
385 u16 vendor;
386 u16 device;
387 u16 subsystem_vendor;
388 u16 subsystem_id;
389 u8 devfn;
390 u8 bus;
391 ushort host_no; /* SCSI Host number, if scsi driver not loaded*/
392 u8 fw_version[16]; /* string */
393 u8 serial_number[24]; /* string */
394 u32 ioc_status;
395 u32 bus_phys_width;
396 u32 base_io_addr;
397 u32 rsvd;
398 unsigned int hard_resets; /* driver initiated resets */
399 unsigned int soft_resets; /* ioc, external resets */
400 unsigned int timeouts; /* num timeouts */
401 } hp_host_info_t;
403 /* replace ulongs with uints, need to preserve backwards
404 * compatibility.
406 typedef struct _hp_host_info_rev0 {
407 hp_header_t hdr;
408 u16 vendor;
409 u16 device;
410 u16 subsystem_vendor;
411 u16 subsystem_id;
412 u8 devfn;
413 u8 bus;
414 ushort host_no; /* SCSI Host number, if scsi driver not loaded*/
415 u8 fw_version[16]; /* string */
416 u8 serial_number[24]; /* string */
417 u32 ioc_status;
418 u32 bus_phys_width;
419 u32 base_io_addr;
420 u32 rsvd;
421 unsigned long hard_resets; /* driver initiated resets */
422 unsigned long soft_resets; /* ioc, external resets */
423 unsigned long timeouts; /* num timeouts */
424 } hp_host_info_rev0_t;
427 * Header:
428 * iocnum required (input)
429 * host required
430 * channel required (bus number)
431 * id required
432 * lun ignored
434 * All error values between 0 and 0xFFFF in size.
436 typedef struct _hp_target_info {
437 hp_header_t hdr;
438 u32 parity_errors;
439 u32 phase_errors;
440 u32 select_timeouts;
441 u32 message_rejects;
442 u32 negotiated_speed;
443 u8 negotiated_width;
444 u8 rsvd[7]; /* 8 byte alignment */
445 } hp_target_info_t;
447 #define HP_STATUS_OTHER 1
448 #define HP_STATUS_OK 2
449 #define HP_STATUS_FAILED 3
451 #define HP_BUS_WIDTH_UNK 1
452 #define HP_BUS_WIDTH_8 2
453 #define HP_BUS_WIDTH_16 3
454 #define HP_BUS_WIDTH_32 4
456 #define HP_DEV_SPEED_ASYNC 2
457 #define HP_DEV_SPEED_FAST 3
458 #define HP_DEV_SPEED_ULTRA 4
459 #define HP_DEV_SPEED_ULTRA2 5
460 #define HP_DEV_SPEED_ULTRA160 6
461 #define HP_DEV_SPEED_SCSI1 7
462 #define HP_DEV_SPEED_ULTRA320 8
464 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
467 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
469 #endif