Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * I2O user space accessible structures/APIs
0004  *
0005  * (c) Copyright 1999, 2000 Red Hat Software
0006  *
0007  * This program is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU General Public License
0009  * as published by the Free Software Foundation; either version
0010  * 2 of the License, or (at your option) any later version.
0011  *
0012  *************************************************************************
0013  *
0014  * This header file defines the I2O APIs that are available to both
0015  * the kernel and user level applications.  Kernel specific structures
0016  * are defined in i2o_osm. OSMs should include _only_ i2o_osm.h which
0017  * automatically includes this file.
0018  *
0019  */
0020 
0021 #ifndef _I2O_DEV_H
0022 #define _I2O_DEV_H
0023 
0024 /* How many controllers are we allowing */
0025 #define MAX_I2O_CONTROLLERS 32
0026 
0027 #include <linux/ioctl.h>
0028 #include <linux/types.h>
0029 
0030 /*
0031  * I2O Control IOCTLs and structures
0032  */
0033 #define I2O_MAGIC_NUMBER    'i'
0034 #define I2OGETIOPS      _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS])
0035 #define I2OHRTGET       _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct)
0036 #define I2OLCTGET       _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct)
0037 #define I2OPARMSET      _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget)
0038 #define I2OPARMGET      _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget)
0039 #define I2OSWDL         _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer)
0040 #define I2OSWUL         _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer)
0041 #define I2OSWDEL        _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer)
0042 #define I2OVALIDATE     _IOR(I2O_MAGIC_NUMBER,8,__u32)
0043 #define I2OHTML         _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
0044 #define I2OEVTREG       _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id)
0045 #define I2OEVTGET       _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info)
0046 #define I2OPASSTHRU     _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru)
0047 #define I2OPASSTHRU32       _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32)
0048 
0049 struct i2o_cmd_passthru32 {
0050     unsigned int iop;   /* IOP unit number */
0051     __u32 msg;      /* message */
0052 };
0053 
0054 struct i2o_cmd_passthru {
0055     unsigned int iop;   /* IOP unit number */
0056     void __user *msg;   /* message */
0057 };
0058 
0059 struct i2o_cmd_hrtlct {
0060     unsigned int iop;   /* IOP unit number */
0061     void __user *resbuf;    /* Buffer for result */
0062     unsigned int __user *reslen;    /* Buffer length in bytes */
0063 };
0064 
0065 struct i2o_cmd_psetget {
0066     unsigned int iop;   /* IOP unit number */
0067     unsigned int tid;   /* Target device TID */
0068     void __user *opbuf; /* Operation List buffer */
0069     unsigned int oplen; /* Operation List buffer length in bytes */
0070     void __user *resbuf;    /* Result List buffer */
0071     unsigned int __user *reslen;    /* Result List buffer length in bytes */
0072 };
0073 
0074 struct i2o_sw_xfer {
0075     unsigned int iop;   /* IOP unit number */
0076     unsigned char flags;    /* Flags field */
0077     unsigned char sw_type;  /* Software type */
0078     unsigned int sw_id; /* Software ID */
0079     void __user *buf;   /* Pointer to software buffer */
0080     unsigned int __user *swlen; /* Length of software data */
0081     unsigned int __user *maxfrag;   /* Maximum fragment count */
0082     unsigned int __user *curfrag;   /* Current fragment count */
0083 };
0084 
0085 struct i2o_html {
0086     unsigned int iop;   /* IOP unit number */
0087     unsigned int tid;   /* Target device ID */
0088     unsigned int page;  /* HTML page */
0089     void __user *resbuf;    /* Buffer for reply HTML page */
0090     unsigned int __user *reslen;    /* Length in bytes of reply buffer */
0091     void __user *qbuf;  /* Pointer to HTTP query string */
0092     unsigned int qlen;  /* Length in bytes of query string buffer */
0093 };
0094 
0095 #define I2O_EVT_Q_LEN 32
0096 
0097 struct i2o_evt_id {
0098     unsigned int iop;
0099     unsigned int tid;
0100     unsigned int evt_mask;
0101 };
0102 
0103 /* Event data size = frame size - message header + evt indicator */
0104 #define I2O_EVT_DATA_SIZE 88
0105 
0106 struct i2o_evt_info {
0107     struct i2o_evt_id id;
0108     unsigned char evt_data[I2O_EVT_DATA_SIZE];
0109     unsigned int data_size;
0110 };
0111 
0112 struct i2o_evt_get {
0113     struct i2o_evt_info info;
0114     int pending;
0115     int lost;
0116 };
0117 
0118 typedef struct i2o_sg_io_hdr {
0119     unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */
0120 } i2o_sg_io_hdr_t;
0121 
0122 /**************************************************************************
0123  * HRT related constants and structures
0124  **************************************************************************/
0125 #define I2O_BUS_LOCAL   0
0126 #define I2O_BUS_ISA 1
0127 #define I2O_BUS_EISA    2
0128 /* was  I2O_BUS_MCA 3 */
0129 #define I2O_BUS_PCI 4
0130 #define I2O_BUS_PCMCIA  5
0131 #define I2O_BUS_NUBUS   6
0132 #define I2O_BUS_CARDBUS 7
0133 #define I2O_BUS_UNKNOWN 0x80
0134 
0135 typedef struct _i2o_pci_bus {
0136     __u8 PciFunctionNumber;
0137     __u8 PciDeviceNumber;
0138     __u8 PciBusNumber;
0139     __u8 reserved;
0140     __u16 PciVendorID;
0141     __u16 PciDeviceID;
0142 } i2o_pci_bus;
0143 
0144 typedef struct _i2o_local_bus {
0145     __u16 LbBaseIOPort;
0146     __u16 reserved;
0147     __u32 LbBaseMemoryAddress;
0148 } i2o_local_bus;
0149 
0150 typedef struct _i2o_isa_bus {
0151     __u16 IsaBaseIOPort;
0152     __u8 CSN;
0153     __u8 reserved;
0154     __u32 IsaBaseMemoryAddress;
0155 } i2o_isa_bus;
0156 
0157 typedef struct _i2o_eisa_bus_info {
0158     __u16 EisaBaseIOPort;
0159     __u8 reserved;
0160     __u8 EisaSlotNumber;
0161     __u32 EisaBaseMemoryAddress;
0162 } i2o_eisa_bus;
0163 
0164 typedef struct _i2o_mca_bus {
0165     __u16 McaBaseIOPort;
0166     __u8 reserved;
0167     __u8 McaSlotNumber;
0168     __u32 McaBaseMemoryAddress;
0169 } i2o_mca_bus;
0170 
0171 typedef struct _i2o_other_bus {
0172     __u16 BaseIOPort;
0173     __u16 reserved;
0174     __u32 BaseMemoryAddress;
0175 } i2o_other_bus;
0176 
0177 typedef struct _i2o_hrt_entry {
0178     __u32 adapter_id;
0179     __u32 parent_tid:12;
0180     __u32 state:4;
0181     __u32 bus_num:8;
0182     __u32 bus_type:8;
0183     union {
0184         i2o_pci_bus pci_bus;
0185         i2o_local_bus local_bus;
0186         i2o_isa_bus isa_bus;
0187         i2o_eisa_bus eisa_bus;
0188         i2o_mca_bus mca_bus;
0189         i2o_other_bus other_bus;
0190     } bus;
0191 } i2o_hrt_entry;
0192 
0193 typedef struct _i2o_hrt {
0194     __u16 num_entries;
0195     __u8 entry_len;
0196     __u8 hrt_version;
0197     __u32 change_ind;
0198     i2o_hrt_entry hrt_entry[1];
0199 } i2o_hrt;
0200 
0201 typedef struct _i2o_lct_entry {
0202     __u32 entry_size:16;
0203     __u32 tid:12;
0204     __u32 reserved:4;
0205     __u32 change_ind;
0206     __u32 device_flags;
0207     __u32 class_id:12;
0208     __u32 version:4;
0209     __u32 vendor_id:16;
0210     __u32 sub_class;
0211     __u32 user_tid:12;
0212     __u32 parent_tid:12;
0213     __u32 bios_info:8;
0214     __u8 identity_tag[8];
0215     __u32 event_capabilities;
0216 } i2o_lct_entry;
0217 
0218 typedef struct _i2o_lct {
0219     __u32 table_size:16;
0220     __u32 boot_tid:12;
0221     __u32 lct_ver:4;
0222     __u32 iop_flags;
0223     __u32 change_ind;
0224     i2o_lct_entry lct_entry[1];
0225 } i2o_lct;
0226 
0227 typedef struct _i2o_status_block {
0228     __u16 org_id;
0229     __u16 reserved;
0230     __u16 iop_id:12;
0231     __u16 reserved1:4;
0232     __u16 host_unit_id;
0233     __u16 segment_number:12;
0234     __u16 i2o_version:4;
0235     __u8 iop_state;
0236     __u8 msg_type;
0237     __u16 inbound_frame_size;
0238     __u8 init_code;
0239     __u8 reserved2;
0240     __u32 max_inbound_frames;
0241     __u32 cur_inbound_frames;
0242     __u32 max_outbound_frames;
0243     char product_id[24];
0244     __u32 expected_lct_size;
0245     __u32 iop_capabilities;
0246     __u32 desired_mem_size;
0247     __u32 current_mem_size;
0248     __u32 current_mem_base;
0249     __u32 desired_io_size;
0250     __u32 current_io_size;
0251     __u32 current_io_base;
0252     __u32 reserved3:24;
0253     __u32 cmd_status:8;
0254 } i2o_status_block;
0255 
0256 /* Event indicator mask flags */
0257 #define I2O_EVT_IND_STATE_CHANGE        0x80000000
0258 #define I2O_EVT_IND_GENERAL_WARNING     0x40000000
0259 #define I2O_EVT_IND_CONFIGURATION_FLAG      0x20000000
0260 #define I2O_EVT_IND_LOCK_RELEASE        0x10000000
0261 #define I2O_EVT_IND_CAPABILITY_CHANGE       0x08000000
0262 #define I2O_EVT_IND_DEVICE_RESET        0x04000000
0263 #define I2O_EVT_IND_EVT_MASK_MODIFIED       0x02000000
0264 #define I2O_EVT_IND_FIELD_MODIFIED      0x01000000
0265 #define I2O_EVT_IND_VENDOR_EVT          0x00800000
0266 #define I2O_EVT_IND_DEVICE_STATE        0x00400000
0267 
0268 /* Executive event indicitors */
0269 #define I2O_EVT_IND_EXEC_RESOURCE_LIMITS    0x00000001
0270 #define I2O_EVT_IND_EXEC_CONNECTION_FAIL    0x00000002
0271 #define I2O_EVT_IND_EXEC_ADAPTER_FAULT      0x00000004
0272 #define I2O_EVT_IND_EXEC_POWER_FAIL     0x00000008
0273 #define I2O_EVT_IND_EXEC_RESET_PENDING      0x00000010
0274 #define I2O_EVT_IND_EXEC_RESET_IMMINENT     0x00000020
0275 #define I2O_EVT_IND_EXEC_HW_FAIL        0x00000040
0276 #define I2O_EVT_IND_EXEC_XCT_CHANGE     0x00000080
0277 #define I2O_EVT_IND_EXEC_NEW_LCT_ENTRY      0x00000100
0278 #define I2O_EVT_IND_EXEC_MODIFIED_LCT       0x00000200
0279 #define I2O_EVT_IND_EXEC_DDM_AVAILABILITY   0x00000400
0280 
0281 /* Random Block Storage Event Indicators */
0282 #define I2O_EVT_IND_BSA_VOLUME_LOAD     0x00000001
0283 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD       0x00000002
0284 #define I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ   0x00000004
0285 #define I2O_EVT_IND_BSA_CAPACITY_CHANGE     0x00000008
0286 #define I2O_EVT_IND_BSA_SCSI_SMART      0x00000010
0287 
0288 /* Event data for generic events */
0289 #define I2O_EVT_STATE_CHANGE_NORMAL     0x00
0290 #define I2O_EVT_STATE_CHANGE_SUSPENDED      0x01
0291 #define I2O_EVT_STATE_CHANGE_RESTART        0x02
0292 #define I2O_EVT_STATE_CHANGE_NA_RECOVER     0x03
0293 #define I2O_EVT_STATE_CHANGE_NA_NO_RECOVER  0x04
0294 #define I2O_EVT_STATE_CHANGE_QUIESCE_REQUEST    0x05
0295 #define I2O_EVT_STATE_CHANGE_FAILED     0x10
0296 #define I2O_EVT_STATE_CHANGE_FAULTED        0x11
0297 
0298 #define I2O_EVT_GEN_WARNING_NORMAL      0x00
0299 #define I2O_EVT_GEN_WARNING_ERROR_THRESHOLD 0x01
0300 #define I2O_EVT_GEN_WARNING_MEDIA_FAULT     0x02
0301 
0302 #define I2O_EVT_CAPABILITY_OTHER        0x01
0303 #define I2O_EVT_CAPABILITY_CHANGED      0x02
0304 
0305 #define I2O_EVT_SENSOR_STATE_CHANGED        0x01
0306 
0307 /*
0308  *  I2O classes / subclasses
0309  */
0310 
0311 /*  Class ID and Code Assignments
0312  *  (LCT.ClassID.Version field)
0313  */
0314 #define I2O_CLASS_VERSION_10            0x00
0315 #define I2O_CLASS_VERSION_11            0x01
0316 
0317 /*  Class code names
0318  *  (from v1.5 Table 6-1 Class Code Assignments.)
0319  */
0320 
0321 #define I2O_CLASS_EXECUTIVE         0x000
0322 #define I2O_CLASS_DDM               0x001
0323 #define I2O_CLASS_RANDOM_BLOCK_STORAGE      0x010
0324 #define I2O_CLASS_SEQUENTIAL_STORAGE        0x011
0325 #define I2O_CLASS_LAN               0x020
0326 #define I2O_CLASS_WAN               0x030
0327 #define I2O_CLASS_FIBRE_CHANNEL_PORT        0x040
0328 #define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL  0x041
0329 #define I2O_CLASS_SCSI_PERIPHERAL       0x051
0330 #define I2O_CLASS_ATE_PORT          0x060
0331 #define I2O_CLASS_ATE_PERIPHERAL        0x061
0332 #define I2O_CLASS_FLOPPY_CONTROLLER     0x070
0333 #define I2O_CLASS_FLOPPY_DEVICE         0x071
0334 #define I2O_CLASS_BUS_ADAPTER           0x080
0335 #define I2O_CLASS_PEER_TRANSPORT_AGENT      0x090
0336 #define I2O_CLASS_PEER_TRANSPORT        0x091
0337 #define I2O_CLASS_END               0xfff
0338 
0339 /*
0340  *  Rest of 0x092 - 0x09f reserved for peer-to-peer classes
0341  */
0342 
0343 #define I2O_CLASS_MATCH_ANYCLASS        0xffffffff
0344 
0345 /*
0346  *  Subclasses
0347  */
0348 
0349 #define I2O_SUBCLASS_i960           0x001
0350 #define I2O_SUBCLASS_HDM            0x020
0351 #define I2O_SUBCLASS_ISM            0x021
0352 
0353 /* Operation functions */
0354 
0355 #define I2O_PARAMS_FIELD_GET            0x0001
0356 #define I2O_PARAMS_LIST_GET         0x0002
0357 #define I2O_PARAMS_MORE_GET         0x0003
0358 #define I2O_PARAMS_SIZE_GET         0x0004
0359 #define I2O_PARAMS_TABLE_GET            0x0005
0360 #define I2O_PARAMS_FIELD_SET            0x0006
0361 #define I2O_PARAMS_LIST_SET         0x0007
0362 #define I2O_PARAMS_ROW_ADD          0x0008
0363 #define I2O_PARAMS_ROW_DELETE           0x0009
0364 #define I2O_PARAMS_TABLE_CLEAR          0x000A
0365 
0366 /*
0367  * I2O serial number conventions / formats
0368  * (circa v1.5)
0369  */
0370 
0371 #define I2O_SNFORMAT_UNKNOWN            0
0372 #define I2O_SNFORMAT_BINARY         1
0373 #define I2O_SNFORMAT_ASCII          2
0374 #define I2O_SNFORMAT_UNICODE            3
0375 #define I2O_SNFORMAT_LAN48_MAC          4
0376 #define I2O_SNFORMAT_WAN            5
0377 
0378 /*
0379  * Plus new in v2.0 (Yellowstone pdf doc)
0380  */
0381 
0382 #define I2O_SNFORMAT_LAN64_MAC          6
0383 #define I2O_SNFORMAT_DDM            7
0384 #define I2O_SNFORMAT_IEEE_REG64         8
0385 #define I2O_SNFORMAT_IEEE_REG128        9
0386 #define I2O_SNFORMAT_UNKNOWN2           0xff
0387 
0388 /*
0389  *  I2O Get Status State values
0390  */
0391 
0392 #define ADAPTER_STATE_INITIALIZING      0x01
0393 #define ADAPTER_STATE_RESET         0x02
0394 #define ADAPTER_STATE_HOLD          0x04
0395 #define ADAPTER_STATE_READY         0x05
0396 #define ADAPTER_STATE_OPERATIONAL       0x08
0397 #define ADAPTER_STATE_FAILED            0x10
0398 #define ADAPTER_STATE_FAULTED           0x11
0399 
0400 /*
0401  *  Software module types
0402  */
0403 #define I2O_SOFTWARE_MODULE_IRTOS       0x11
0404 #define I2O_SOFTWARE_MODULE_IOP_PRIVATE     0x22
0405 #define I2O_SOFTWARE_MODULE_IOP_CONFIG      0x23
0406 
0407 /*
0408  *  Vendors
0409  */
0410 #define I2O_VENDOR_DPT              0x001b
0411 
0412 /*
0413  * DPT / Adaptec specific values for i2o_sg_io_hdr flags.
0414  */
0415 #define I2O_DPT_SG_FLAG_INTERPRET       0x00010000
0416 #define I2O_DPT_SG_FLAG_PHYSICAL        0x00020000
0417 
0418 #define I2O_DPT_FLASH_FRAG_SIZE         0x10000
0419 #define I2O_DPT_FLASH_READ          0x0101
0420 #define I2O_DPT_FLASH_WRITE         0x0102
0421 
0422 #endif              /* _I2O_DEV_H */