1 | /** @file
|
---|
2 |
|
---|
3 | Macros and type definitions for LSI Fusion MPT SCSI devices.
|
---|
4 |
|
---|
5 | Copyright (C) 2020, Oracle and/or its affiliates.
|
---|
6 |
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 |
|
---|
11 | #ifndef __FUSION_MPT_SCSI_H__
|
---|
12 | #define __FUSION_MPT_SCSI_H__
|
---|
13 |
|
---|
14 | //
|
---|
15 | // Device offsets and constants
|
---|
16 | //
|
---|
17 |
|
---|
18 | #define LSI_LOGIC_PCI_VENDOR_ID 0x1000
|
---|
19 | #define LSI_53C1030_PCI_DEVICE_ID 0x0030
|
---|
20 | #define LSI_SAS1068_PCI_DEVICE_ID 0x0054
|
---|
21 | #define LSI_SAS1068E_PCI_DEVICE_ID 0x0058
|
---|
22 |
|
---|
23 | #define MPT_REG_DOORBELL 0x00
|
---|
24 | #define MPT_REG_WRITE_SEQ 0x04
|
---|
25 | #define MPT_REG_HOST_DIAG 0x08
|
---|
26 | #define MPT_REG_TEST 0x0c
|
---|
27 | #define MPT_REG_DIAG_DATA 0x10
|
---|
28 | #define MPT_REG_DIAG_ADDR 0x14
|
---|
29 | #define MPT_REG_ISTATUS 0x30
|
---|
30 | #define MPT_REG_IMASK 0x34
|
---|
31 | #define MPT_REG_REQ_Q 0x40
|
---|
32 | #define MPT_REG_REP_Q 0x44
|
---|
33 |
|
---|
34 | #define MPT_DOORBELL_RESET 0x40
|
---|
35 | #define MPT_DOORBELL_HANDSHAKE 0x42
|
---|
36 |
|
---|
37 | #define MPT_IMASK_DOORBELL 0x01
|
---|
38 | #define MPT_IMASK_REPLY 0x08
|
---|
39 |
|
---|
40 | #define MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST 0x00
|
---|
41 | #define MPT_MESSAGE_HDR_FUNCTION_IOC_INIT 0x02
|
---|
42 |
|
---|
43 | #define MPT_SG_ENTRY_TYPE_SIMPLE 0x01
|
---|
44 |
|
---|
45 | #define MPT_IOC_WHOINIT_ROM_BIOS 0x02
|
---|
46 |
|
---|
47 | #define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE (0x00 << 24)
|
---|
48 | #define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_WRITE (0x01 << 24)
|
---|
49 | #define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_READ (0x02 << 24)
|
---|
50 |
|
---|
51 | #define MPT_SCSI_IOCSTATUS_SUCCESS 0x0000
|
---|
52 | #define MPT_SCSI_IOCSTATUS_DEVICE_NOT_THERE 0x0043
|
---|
53 | #define MPT_SCSI_IOCSTATUS_DATA_OVERRUN 0x0044
|
---|
54 | #define MPT_SCSI_IOCSTATUS_DATA_UNDERRUN 0x0045
|
---|
55 |
|
---|
56 | //
|
---|
57 | // Device structures
|
---|
58 | //
|
---|
59 |
|
---|
60 | #pragma pack (1)
|
---|
61 | typedef struct {
|
---|
62 | UINT8 WhoInit;
|
---|
63 | UINT8 Reserved1;
|
---|
64 | UINT8 ChainOffset;
|
---|
65 | UINT8 Function;
|
---|
66 | UINT8 Flags;
|
---|
67 | UINT8 MaxDevices;
|
---|
68 | UINT8 MaxBuses;
|
---|
69 | UINT8 MessageFlags;
|
---|
70 | UINT32 MessageContext;
|
---|
71 | UINT16 ReplyFrameSize;
|
---|
72 | UINT16 Reserved2;
|
---|
73 | UINT32 HostMfaHighAddr;
|
---|
74 | UINT32 SenseBufferHighAddr;
|
---|
75 | } MPT_IO_CONTROLLER_INIT_REQUEST;
|
---|
76 |
|
---|
77 | typedef struct {
|
---|
78 | UINT8 WhoInit;
|
---|
79 | UINT8 Reserved1;
|
---|
80 | UINT8 MessageLength;
|
---|
81 | UINT8 Function;
|
---|
82 | UINT8 Flags;
|
---|
83 | UINT8 MaxDevices;
|
---|
84 | UINT8 MaxBuses;
|
---|
85 | UINT8 MessageFlags;
|
---|
86 | UINT32 MessageContext;
|
---|
87 | UINT16 Reserved2;
|
---|
88 | UINT16 IocStatus;
|
---|
89 | UINT32 IocLogInfo;
|
---|
90 | } MPT_IO_CONTROLLER_INIT_REPLY;
|
---|
91 |
|
---|
92 | typedef struct {
|
---|
93 | UINT8 TargetId;
|
---|
94 | UINT8 Bus;
|
---|
95 | UINT8 ChainOffset;
|
---|
96 | UINT8 Function;
|
---|
97 | UINT8 CdbLength;
|
---|
98 | UINT8 SenseBufferLength;
|
---|
99 | UINT8 Reserved;
|
---|
100 | UINT8 MessageFlags;
|
---|
101 | UINT32 MessageContext;
|
---|
102 | UINT8 Lun[8];
|
---|
103 | UINT32 Control;
|
---|
104 | UINT8 Cdb[16];
|
---|
105 | UINT32 DataLength;
|
---|
106 | UINT32 SenseBufferLowAddress;
|
---|
107 | } MPT_SCSI_IO_REQUEST;
|
---|
108 |
|
---|
109 | typedef struct {
|
---|
110 | UINT32 Length : 24;
|
---|
111 | UINT32 EndOfList : 1;
|
---|
112 | UINT32 Is64BitAddress : 1;
|
---|
113 | //
|
---|
114 | // True when the buffer contains data to be transfered. Otherwise it's the
|
---|
115 | // destination buffer
|
---|
116 | //
|
---|
117 | UINT32 BufferContainsData : 1;
|
---|
118 | UINT32 LocalAddress : 1;
|
---|
119 | UINT32 ElementType : 2;
|
---|
120 | UINT32 EndOfBuffer : 1;
|
---|
121 | UINT32 LastElement : 1;
|
---|
122 | UINT64 DataBufferAddress;
|
---|
123 | } MPT_SG_ENTRY_SIMPLE;
|
---|
124 |
|
---|
125 | typedef struct {
|
---|
126 | UINT8 TargetId;
|
---|
127 | UINT8 Bus;
|
---|
128 | UINT8 MessageLength;
|
---|
129 | UINT8 Function;
|
---|
130 | UINT8 CdbLength;
|
---|
131 | UINT8 SenseBufferLength;
|
---|
132 | UINT8 Reserved;
|
---|
133 | UINT8 MessageFlags;
|
---|
134 | UINT32 MessageContext;
|
---|
135 | UINT8 ScsiStatus;
|
---|
136 | UINT8 ScsiState;
|
---|
137 | UINT16 IocStatus;
|
---|
138 | UINT32 IocLogInfo;
|
---|
139 | UINT32 TransferCount;
|
---|
140 | UINT32 SenseCount;
|
---|
141 | UINT32 ResponseInfo;
|
---|
142 | } MPT_SCSI_IO_REPLY;
|
---|
143 |
|
---|
144 | typedef struct {
|
---|
145 | MPT_SCSI_IO_REQUEST Header;
|
---|
146 | MPT_SG_ENTRY_SIMPLE Sg;
|
---|
147 | } MPT_SCSI_REQUEST_WITH_SG;
|
---|
148 | #pragma pack ()
|
---|
149 |
|
---|
150 | typedef union {
|
---|
151 | MPT_SCSI_IO_REPLY Data;
|
---|
152 | UINT64 Uint64; // 8 byte alignment required by HW
|
---|
153 | } MPT_SCSI_IO_REPLY_ALIGNED;
|
---|
154 |
|
---|
155 | typedef union {
|
---|
156 | MPT_SCSI_REQUEST_WITH_SG Data;
|
---|
157 | UINT64 Uint64; // 8 byte alignment required by HW
|
---|
158 | } MPT_SCSI_REQUEST_ALIGNED;
|
---|
159 |
|
---|
160 | #endif // __FUSION_MPT_SCSI_H__
|
---|