xref: /OK3568_Linux_fs/kernel/Documentation/scsi/hptiop.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun.. include:: <isonum.txt>
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun======================================================
5*4882a593SmuzhiyunHighpoint RocketRAID 3xxx/4xxx Adapter Driver (hptiop)
6*4882a593Smuzhiyun======================================================
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunController Register Map
9*4882a593Smuzhiyun-----------------------
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunFor RR44xx Intel IOP based adapters, the controller IOP is accessed via PCI BAR0 and BAR2
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun     ============== ==================================
14*4882a593Smuzhiyun     BAR0 offset    Register
15*4882a593Smuzhiyun     ============== ==================================
16*4882a593Smuzhiyun            0x11C5C Link Interface IRQ Set
17*4882a593Smuzhiyun            0x11C60 Link Interface IRQ Clear
18*4882a593Smuzhiyun     ============== ==================================
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun     ============== ==================================
21*4882a593Smuzhiyun     BAR2 offset    Register
22*4882a593Smuzhiyun     ============== ==================================
23*4882a593Smuzhiyun            0x10    Inbound Message Register 0
24*4882a593Smuzhiyun            0x14    Inbound Message Register 1
25*4882a593Smuzhiyun            0x18    Outbound Message Register 0
26*4882a593Smuzhiyun            0x1C    Outbound Message Register 1
27*4882a593Smuzhiyun            0x20    Inbound Doorbell Register
28*4882a593Smuzhiyun            0x24    Inbound Interrupt Status Register
29*4882a593Smuzhiyun            0x28    Inbound Interrupt Mask Register
30*4882a593Smuzhiyun            0x30    Outbound Interrupt Status Register
31*4882a593Smuzhiyun            0x34    Outbound Interrupt Mask Register
32*4882a593Smuzhiyun            0x40    Inbound Queue Port
33*4882a593Smuzhiyun            0x44    Outbound Queue Port
34*4882a593Smuzhiyun     ============== ==================================
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunFor Intel IOP based adapters, the controller IOP is accessed via PCI BAR0:
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun     ============== ==================================
39*4882a593Smuzhiyun     BAR0 offset    Register
40*4882a593Smuzhiyun     ============== ==================================
41*4882a593Smuzhiyun            0x10    Inbound Message Register 0
42*4882a593Smuzhiyun            0x14    Inbound Message Register 1
43*4882a593Smuzhiyun            0x18    Outbound Message Register 0
44*4882a593Smuzhiyun            0x1C    Outbound Message Register 1
45*4882a593Smuzhiyun            0x20    Inbound Doorbell Register
46*4882a593Smuzhiyun            0x24    Inbound Interrupt Status Register
47*4882a593Smuzhiyun            0x28    Inbound Interrupt Mask Register
48*4882a593Smuzhiyun            0x30    Outbound Interrupt Status Register
49*4882a593Smuzhiyun            0x34    Outbound Interrupt Mask Register
50*4882a593Smuzhiyun            0x40    Inbound Queue Port
51*4882a593Smuzhiyun            0x44    Outbound Queue Port
52*4882a593Smuzhiyun     ============== ==================================
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunFor Marvell not Frey IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun     ============== ==================================
57*4882a593Smuzhiyun     BAR0 offset    Register
58*4882a593Smuzhiyun     ============== ==================================
59*4882a593Smuzhiyun         0x20400    Inbound Doorbell Register
60*4882a593Smuzhiyun         0x20404    Inbound Interrupt Mask Register
61*4882a593Smuzhiyun         0x20408    Outbound Doorbell Register
62*4882a593Smuzhiyun         0x2040C    Outbound Interrupt Mask Register
63*4882a593Smuzhiyun     ============== ==================================
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun     ============== ==================================
66*4882a593Smuzhiyun     BAR1 offset    Register
67*4882a593Smuzhiyun     ============== ==================================
68*4882a593Smuzhiyun             0x0    Inbound Queue Head Pointer
69*4882a593Smuzhiyun             0x4    Inbound Queue Tail Pointer
70*4882a593Smuzhiyun             0x8    Outbound Queue Head Pointer
71*4882a593Smuzhiyun             0xC    Outbound Queue Tail Pointer
72*4882a593Smuzhiyun            0x10    Inbound Message Register
73*4882a593Smuzhiyun            0x14    Outbound Message Register
74*4882a593Smuzhiyun     0x40-0x1040    Inbound Queue
75*4882a593Smuzhiyun     0x1040-0x2040  Outbound Queue
76*4882a593Smuzhiyun     ============== ==================================
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunFor Marvell Frey IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun     ============== ==================================
81*4882a593Smuzhiyun     BAR0 offset    Register
82*4882a593Smuzhiyun     ============== ==================================
83*4882a593Smuzhiyun             0x0    IOP configuration information.
84*4882a593Smuzhiyun     ============== ==================================
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun     ============== ===================================================
87*4882a593Smuzhiyun     BAR1 offset    Register
88*4882a593Smuzhiyun     ============== ===================================================
89*4882a593Smuzhiyun          0x4000    Inbound List Base Address Low
90*4882a593Smuzhiyun          0x4004    Inbound List Base Address High
91*4882a593Smuzhiyun          0x4018    Inbound List Write Pointer
92*4882a593Smuzhiyun          0x402C    Inbound List Configuration and Control
93*4882a593Smuzhiyun          0x4050    Outbound List Base Address Low
94*4882a593Smuzhiyun          0x4054    Outbound List Base Address High
95*4882a593Smuzhiyun          0x4058    Outbound List Copy Pointer Shadow Base Address Low
96*4882a593Smuzhiyun          0x405C    Outbound List Copy Pointer Shadow Base Address High
97*4882a593Smuzhiyun          0x4088    Outbound List Interrupt Cause
98*4882a593Smuzhiyun          0x408C    Outbound List Interrupt Enable
99*4882a593Smuzhiyun         0x1020C    PCIe Function 0 Interrupt Enable
100*4882a593Smuzhiyun         0x10400    PCIe Function 0 to CPU Message A
101*4882a593Smuzhiyun         0x10420    CPU to PCIe Function 0 Message A
102*4882a593Smuzhiyun         0x10480    CPU to PCIe Function 0 Doorbell
103*4882a593Smuzhiyun         0x10484    CPU to PCIe Function 0 Doorbell Enable
104*4882a593Smuzhiyun     ============== ===================================================
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunI/O Request Workflow of Not Marvell Frey
108*4882a593Smuzhiyun----------------------------------------
109*4882a593Smuzhiyun
110*4882a593SmuzhiyunAll queued requests are handled via inbound/outbound queue port.
111*4882a593SmuzhiyunA request packet can be allocated in either IOP or host memory.
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunTo send a request to the controller:
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun    - Get a free request packet by reading the inbound queue port or
116*4882a593Smuzhiyun      allocate a free request in host DMA coherent memory.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun      The value returned from the inbound queue port is an offset
119*4882a593Smuzhiyun      relative to the IOP BAR0.
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun      Requests allocated in host memory must be aligned on 32-bytes boundary.
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun    - Fill the packet.
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun    - Post the packet to IOP by writing it to inbound queue. For requests
126*4882a593Smuzhiyun      allocated in IOP memory, write the offset to inbound queue port. For
127*4882a593Smuzhiyun      requests allocated in host memory, write (0x80000000|(bus_addr>>5))
128*4882a593Smuzhiyun      to the inbound queue port.
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun    - The IOP process the request. When the request is completed, it
131*4882a593Smuzhiyun      will be put into outbound queue. An outbound interrupt will be
132*4882a593Smuzhiyun      generated.
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun      For requests allocated in IOP memory, the request offset is posted to
135*4882a593Smuzhiyun      outbound queue.
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun      For requests allocated in host memory, (0x80000000|(bus_addr>>5))
138*4882a593Smuzhiyun      is posted to the outbound queue. If IOP_REQUEST_FLAG_OUTPUT_CONTEXT
139*4882a593Smuzhiyun      flag is set in the request, the low 32-bit context value will be
140*4882a593Smuzhiyun      posted instead.
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun    - The host read the outbound queue and complete the request.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun      For requests allocated in IOP memory, the host driver free the request
145*4882a593Smuzhiyun      by writing it to the outbound queue.
146*4882a593Smuzhiyun
147*4882a593SmuzhiyunNon-queued requests (reset/flush etc) can be sent via inbound message
148*4882a593Smuzhiyunregister 0. An outbound message with the same value indicates the completion
149*4882a593Smuzhiyunof an inbound message.
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun
152*4882a593SmuzhiyunI/O Request Workflow of Marvell Frey
153*4882a593Smuzhiyun------------------------------------
154*4882a593Smuzhiyun
155*4882a593SmuzhiyunAll queued requests are handled via inbound/outbound list.
156*4882a593Smuzhiyun
157*4882a593SmuzhiyunTo send a request to the controller:
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun    - Allocate a free request in host DMA coherent memory.
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun      Requests allocated in host memory must be aligned on 32-bytes boundary.
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun    - Fill the request with index of the request in the flag.
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun      Fill a free inbound list unit with the physical address and the size of
166*4882a593Smuzhiyun      the request.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun      Set up the inbound list write pointer with the index of previous unit,
169*4882a593Smuzhiyun      round to 0 if the index reaches the supported count of requests.
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun    - Post the inbound list writer pointer to IOP.
172*4882a593Smuzhiyun
173*4882a593Smuzhiyun    - The IOP process the request. When the request is completed, the flag of
174*4882a593Smuzhiyun      the request with or-ed IOPMU_QUEUE_MASK_HOST_BITS will be put into a
175*4882a593Smuzhiyun      free outbound list unit and the index of the outbound list unit will be
176*4882a593Smuzhiyun      put into the copy pointer shadow register. An outbound interrupt will be
177*4882a593Smuzhiyun      generated.
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun    - The host read the outbound list copy pointer shadow register and compare
180*4882a593Smuzhiyun      with previous saved read pointer N. If they are different, the host will
181*4882a593Smuzhiyun      read the (N+1)th outbound list unit.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun      The host get the index of the request from the (N+1)th outbound list
184*4882a593Smuzhiyun      unit and complete the request.
185*4882a593Smuzhiyun
186*4882a593SmuzhiyunNon-queued requests (reset communication/reset/flush etc) can be sent via PCIe
187*4882a593SmuzhiyunFunction 0 to CPU Message A register. The CPU to PCIe Function 0 Message register
188*4882a593Smuzhiyunwith the same value indicates the completion of message.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunUser-level Interface
192*4882a593Smuzhiyun---------------------
193*4882a593Smuzhiyun
194*4882a593SmuzhiyunThe driver exposes following sysfs attributes:
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun     ==================   ===    ========================
197*4882a593Smuzhiyun     NAME                 R/W    Description
198*4882a593Smuzhiyun     ==================   ===    ========================
199*4882a593Smuzhiyun     driver-version        R     driver version string
200*4882a593Smuzhiyun     firmware-version      R     firmware version string
201*4882a593Smuzhiyun     ==================   ===    ========================
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun-----------------------------------------------------------------------------
205*4882a593Smuzhiyun
206*4882a593SmuzhiyunCopyright |copy| 2006-2012 HighPoint Technologies, Inc. All Rights Reserved.
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun  This file is distributed in the hope that it will be useful,
209*4882a593Smuzhiyun  but WITHOUT ANY WARRANTY; without even the implied warranty of
210*4882a593Smuzhiyun  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
211*4882a593Smuzhiyun  GNU General Public License for more details.
212*4882a593Smuzhiyun
213*4882a593Smuzhiyun  linux@highpoint-tech.com
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun  http://www.highpoint-tech.com
216