FreeBSD kernel pms device code
mpi.h
Go to the documentation of this file.
1/*******************************************************************************
2*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
3*
4*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*that the following conditions are met:
6*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*following disclaimer.
8*2. Redistributions in binary form must reproduce the above copyright notice,
9*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*with the distribution.
11*
12*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20*
21* $FreeBSD$
22*
23********************************************************************************/
24
25/*******************************************************************************/
32/*******************************************************************************/
33
34#ifndef __MPI_H__
35#define __MPI_H__
36
37/*******************************************************************************/
38
39/*******************************************************************************/
40/* CONSTANTS */
41/*******************************************************************************/
42/*******************************************************************************/
43#define MPI_QUEUE_PRIORITY_HIGHEST 0xFF
44#define MPI_QUEUE_PRIORITY_LOWEST 0x00
46#define MPI_MAX_INBOUND_QUEUES 64
47#define MPI_MAX_OUTBOUND_QUEUES 64
50#define MPI_MAX_MEM_REGIONS (MPI_MAX_INBOUND_QUEUES + MPI_MAX_OUTBOUND_QUEUES) + 4
51#define MPI_LOGSIZE 4096
53#define MPI_IB_NUM_MASK 0x0000FFFF
54#define MPI_OB_NUM_MASK 0xFFFF0000
55#define MPI_OB_SHIFT 16
58#define BAR0 0x10
59#define BAR1 0x14
60#define BAR2 0x18
61#define BAR3 0x1C
62#define BAR4 0x20
63#define BAR5 0x24
64
65/*******************************************************************************/
66/*******************************************************************************/
67/* ENUMERATIONS */
68/*******************************************************************************/
69
70/*******************************************************************************/
71/*******************************************************************************/
75/*******************************************************************************/
77{
82};
83
85
86/*******************************************************************************/
87/*******************************************************************************/
88/* TYPES */
89/*******************************************************************************/
90/*******************************************************************************/
91
92
93/*******************************************************************************/
94/*******************************************************************************/
95/* DATA STRUCTURES */
96/*******************************************************************************/
97/*******************************************************************************/
98
99/*******************************************************************************/
108/*******************************************************************************/
110{
111 void* virtPtr;
112 void* appHandle;
122};
123
124typedef struct mpiMem_s mpiMem_t;
125
126/*******************************************************************************/
134/*******************************************************************************/
136{
139};
140
142
143/*******************************************************************************/
149/*******************************************************************************/
151{
160 void* piPointer;
166};
167
169
170/*******************************************************************************/
176/*******************************************************************************/
178{
186 void* ciPointer;
190#ifdef SA_FW_TEST_BUNCH_STARTS
191 bit32 BunchStarts_QPending; // un-started bunched IOs on queue
192 bit32 BunchStarts_QPendingTick; // tick value when 1st IO is bunched
193#endif /* SA_FW_TEST_BUNCH_STARTS */
195};
196
198
200{
203 /* bit0-7 inbound normal priority process depth */
204 /* bit8-15 inbound high priority process depth */
205 /* bit16-23 OQ number to receive GENERAL_EVENT Notification */
206 /* bit24-31 reserved */
208 /* bit0-7 outbound queue number of SAS_HW event for PortId 0 */
209 /* bit8-15 outbound queue number of SAS_HW event for PortId 1 */
210 /* bit16-23 outbound queue number of SAS_HW event for PortId 2 */
211 /* bit24-31 outbound queue number of SAS_HW event for PortId 3 */
213 /* bit0-7 outbound queue number of SAS_HW event for PortId 4 */
214 /* bit8-15 outbound queue number of SAS_HW event for PortId 5 */
215 /* bit16-23 outbound queue number of SAS_HW event for PortId 6 */
216 /* bit24-31 outbound queue number of SAS_HW event for PortId 7 */
218 /* bit0-7 outbound queue number of SATA_NCQ event for PortId 0 */
219 /* bit8-15 outbound queue number of SATA_NCQ event for PortId 1 */
220 /* bit16-23 outbound queue number of SATA_NCQ event for PortId 2 */
221 /* bit24-31 outbound queue number of SATA_NCQ event for PortId 3 */
223 /* bit0-7 outbound queue number of SATA_NCQ event for PortId 4 */
224 /* bit8-15 outbound queue number of SATA_NCQ event for PortId 5 */
225 /* bit16-23 outbound queue number of SATA_NCQ event for PortId 6 */
226 /* bit24-31 outbound queue number of SATA_NCQ event for PortId 7 */
228 /* bit0-7 outbound queue number of ITNexus event for PortId 0 */
229 /* bit8-15 outbound queue number of ITNexus event for PortId 1 */
230 /* bit16-23 outbound queue number of ITNexus event for PortId 2 */
231 /* bit24-31 outbound queue number of ITNexus event for PortId 3 */
233 /* bit0-7 outbound queue number of ITNexus event for PortId 4 */
234 /* bit8-15 outbound queue number of ITNexus event for PortId 5 */
235 /* bit16-23 outbound queue number of ITNexus event for PortId 6 */
236 /* bit24-31 outbound queue number of ITNexus event for PortId 7 */
238 /* bit0-7 outbound queue number of SSP event for PortId 0 */
239 /* bit8-15 outbound queue number of SSP event for PortId 1 */
240 /* bit16-23 outbound queue number of SSP event for PortId 2 */
241 /* bit24-31 outbound queue number of SSP event for PortId 3 */
243 /* bit0-7 outbound queue number of SSP event for PortId 4 */
244 /* bit8-15 outbound queue number of SSP event for PortId 5 */
245 /* bit16-23 outbound queue number of SSP event for PortId 6 */
246 /* bit24-31 outbound queue number of SSP event for PortId 7 */
247 bit32 ioAbortDelay; /* was reserved */
253 /* bit3-0 log severity, 0x0 Disable Logging */
254 /* 0x1 Critical Error */
255 /* 0x2 Minor Error */
256 /* 0x3 Warning */
257 /* 0x4 Information */
258 /* 0x5 Debugging */
259 /* 0x6 - 0xF Reserved */
264 /* bit3-0 log severity, 0x0 Disable Logging */
265 /* 0x1 Critical Error */
266 /* 0x2 Minor Error */
267 /* 0x3 Warning */
268 /* 0x4 Information */
269 /* 0x5 Debugging */
270 /* 0x6 - 0xF Reserved */
272 /* bit0 Fatal Error Interrupt Enable */
273 /* bit1 PI/CI Address */
274 /* bit5 enable or disable outbound coalesce */
275 /* bit7-6 reserved */
276 /* bit15-8 Fatal Error Interrupt Vector */
277 /* bit31-16 Reserved */
283 /* bit1-0 Bootstrap pins */
284 /* bit2 Force HDA Mode bit */
285 /* bit3 HDA Firmware load method */
287 /* bit23-0 phy calib table offset */
288 /* bit31-24 entry size */
290 /* bit23-0 interrupt vector table offset */
291 /* bit31-24 entry size */
293 /* bit23-0 phy attribute table offset */
294 /* bit31-24 entry size */
297};
298
300
301/*******************************************************************************/
308/*******************************************************************************/
310{
317 void* ciPointer;
318};
319
321
322/*******************************************************************************/
329/*******************************************************************************/
331{
343 void* piPointer;
344};
345
347
348/*******************************************************************************/
355/*******************************************************************************/
357{
358 bit32 spaReg0; /* transmitter per port configuration 1 SAS_SATA G1 */
359 bit32 spaReg1; /* transmitter per port configuration 2 SAS_SATA G1*/
360 bit32 spaReg2; /* transmitter per port configuration 3 SAS_SATA G1*/
361 bit32 spaReg3; /* transmitter configuration 1 */
362 bit32 spaReg4; /* reveiver per port configuration 1 SAS_SATA G1G2 */
363 bit32 spaReg5; /* reveiver per port configuration 2 SAS_SATA G3 */
364 bit32 spaReg6; /* reveiver per configuration 1 */
365 bit32 spaReg7; /* reveiver per configuration 2 */
366 bit32 reserved[2]; /* reserved */
367};
368
370
371#define ANALOG_SETUP_ENTRY_NO 10
372#define ANALOG_SETUP_ENTRY_SIZE 10
373
374
375/*******************************************************************************/
383/*******************************************************************************/
385{
401};
402
403/*******************************************************************************/
411/*******************************************************************************/
413{
427};
428
430
431#define TX_PORT_CFG1_OFFSET 0x00
432#define TX_PORT_CFG2_OFFSET 0x04
433#define TX_PORT_CFG3_OFFSET 0x08
434#define TX_CFG_OFFSET 0x0c
435#define RV_PORT_CFG1_OFFSET 0x10
436#define RV_PORT_CFG2_OFFSET 0x14
437#define RV_CFG1_OFFSET 0x18
438#define RV_CFG2_OFFSET 0x1c
439
440/*******************************************************************************/
441/*******************************************************************************/
442/* FUNCTIONS */
443/*******************************************************************************/
444/*******************************************************************************/
445/*******************************************************************************/
446void mpiRequirementsGet(mpiConfig_t *config, mpiMemReq_t *memoryRequirement);
447FORCEINLINE bit32 mpiMsgFreeGet(mpiICQueue_t *circularQ, bit16 messageSize, void** messagePtr);
448FORCEINLINE bit32 mpiMsgProduce(mpiICQueue_t *circularQ, void* messagePtr,
449 mpiMsgCategory_t category, bit16 opCode,
450 bit8 responseQueue, bit8 hiPriority);
451#ifdef LOOPBACK_MPI
452GLOBAL bit32 mpiMsgProduceOQ(mpiOCQueue_t *circularQ, void *messagePtr,
453 mpiMsgCategory_t category, bit16 opCode,
454 bit8 responseQueue, bit8 hiPriority);
455GLOBAL bit32 mpiMsgFreeGetOQ(mpiOCQueue_t *circularQ, bit16 messageSize,
456 void** messagePtr);
457#endif
458
459#ifdef FAST_IO_TEST
460bit32 mpiMsgPrepare(mpiICQueue_t *circularQ, void* messagePtr,
461 mpiMsgCategory_t category, bit16 opCode,
462 bit8 responseQueue, bit8 hiPriority);
463
464bit32 mpiMsgProduceSend(mpiICQueue_t *circularQ, void* messagePtr,
465 mpiMsgCategory_t category, bit16 opCode,
466 bit8 responseQueue, bit8 hiPriority, int sendFl);
467GLOBAL void mpiIBQMsgSend(mpiICQueue_t *circularQ);
468#define INQ(queueNum) (bit8)(queueNum & MPI_IB_NUM_MASK)
469#define OUQ(queueNum) (bit8)((queueNum & MPI_OB_NUM_MASK) >> MPI_OB_SHIFT)
470#endif
471
472FORCEINLINE bit32 mpiMsgConsume(mpiOCQueue_t *circularQ, void** messagePtr1, mpiMsgCategory_t *pCategory, bit16* pOpCode, bit8 *pBC);
473FORCEINLINE bit32 mpiMsgFreeSet(mpiOCQueue_t *circularQ, void* messagePtr1, bit8 bc);
474
475#endif /* __MPI_H__ */
476
#define MPI_MAX_INBOUND_QUEUES
Definition: mpi.h:46
void mpiRequirementsGet(mpiConfig_t *config, mpiMemReq_t *memoryRequirement)
Retrieves the MPI layer resource requirements.
Definition: mpi.c:67
#define MPI_MAX_OUTBOUND_QUEUES
Definition: mpi.h:47
FORCEINLINE bit32 mpiMsgFreeGet(mpiICQueue_t *circularQ, bit16 messageSize, void **messagePtr)
Retrieves a free message buffer from an inbound queue.
Definition: mpi.c:228
FORCEINLINE bit32 mpiMsgConsume(mpiOCQueue_t *circularQ, void **messagePtr1, mpiMsgCategory_t *pCategory, bit16 *pOpCode, bit8 *pBC)
Definition: mpi.c:660
FORCEINLINE bit32 mpiMsgProduce(mpiICQueue_t *circularQ, void *messagePtr, mpiMsgCategory_t category, bit16 opCode, bit8 responseQueue, bit8 hiPriority)
Definition: mpi.c:461
FORCEINLINE bit32 mpiMsgFreeSet(mpiOCQueue_t *circularQ, void *messagePtr1, bit8 bc)
Definition: mpi.c:817
#define MPI_MAX_MEM_REGIONS
Definition: mpi.h:50
mpiMsgCategory_e
MPI message categories.
Definition: mpi.h:77
@ MPI_CATEGORY_SAS_SATA
Definition: mpi.h:80
@ MPI_CATEGORY_FC
Definition: mpi.h:79
@ MPI_CATEGORY_SCSI
Definition: mpi.h:81
@ MPI_CATEGORY_ETHERNET
Definition: mpi.h:78
enum mpiMsgCategory_e mpiMsgCategory_t
Definition: mpi.h:84
unsigned short bit16
Definition: ostypes.h:98
#define GLOBAL
Definition: ostypes.h:131
unsigned int bit32
Definition: ostypes.h:99
#define FORCEINLINE
Definition: ostypes.h:86
unsigned char bit8
Definition: ostypes.h:97
data structure stores OS specific and LL specific context
Definition: sa.h:1658
MPI layer configuration parameters.
Definition: mpi.h:413
mpiInboundQueueDescriptor_t inboundQueues[MPI_MAX_INBOUND_QUEUES]
Definition: mpi.h:415
bit16 maxNumInboundQueues
Definition: mpi.h:424
bit16 numOutboundQueues
Definition: mpi.h:423
agsaPhyAnalogSetupTable_t phyAnalogConfig
Definition: mpi.h:421
bit16 numInboundQueues
Definition: mpi.h:422
bit32 queueOption
Definition: mpi.h:426
mpiOutboundQueueDescriptor_t outboundQueues[MPI_MAX_OUTBOUND_QUEUES]
Definition: mpi.h:418
mpiHostLLConfigDescriptor_t mainConfig
Definition: mpi.h:414
bit16 maxNumOutboundQueues
Definition: mpi.h:425
bit32 outboundTargetSSPEventPID0_3
Definition: mpi.h:237
bit32 PortRecoveryTimerPortResetTimer
Definition: mpi.h:295
bit32 InterruptReassertionDelay
Definition: mpi.h:296
bit32 lowerIOPeventLogAddress
Definition: mpi.h:261
bit32 outboundTargetSSPEventPID4_7
Definition: mpi.h:242
bit32 upperIOPeventLogAddress
Definition: mpi.h:260
bit32 outboundNCQEventPID4_7
Definition: mpi.h:222
bit32 outboundTargetITNexusEventPID4_7
Definition: mpi.h:232
bit32 outboundTargetITNexusEventPID0_3
Definition: mpi.h:227
bit32 outboundNCQEventPID0_3
Definition: mpi.h:217
Circular Queue descriptor.
Definition: mpi.h:178
bit32 producerIdx
Definition: mpi.h:188
bit32 PIPCIOffset
Definition: mpi.h:185
mpiMem_t memoryRegion
Definition: mpi.h:187
void * ciPointer
Definition: mpi.h:186
bit32 qNumber
Definition: mpi.h:179
bit32 priority
Definition: mpi.h:182
bit32 numElements
Definition: mpi.h:180
agsaRoot_t * agRoot
Definition: mpi.h:194
bit32 consumerIdx
Definition: mpi.h:189
bit32 elementSize
Definition: mpi.h:181
bit32 PIPCIBar
Definition: mpi.h:184
MPI inbound queue attributes.
Definition: mpi.h:310
Describes MPI memory requirements.
Definition: mpi.h:136
bit32 count
Definition: mpi.h:137
mpiMem_t region[MPI_MAX_MEM_REGIONS]
Definition: mpi.h:138
Structure that descibes memory regions.
Definition: mpi.h:110
bit32 physAddrLower
Definition: mpi.h:114
bit32 elementSize
Definition: mpi.h:117
bit32 numElements
Definition: mpi.h:116
bit32 totalLength
Definition: mpi.h:115
bit32 type
Definition: mpi.h:120
bit32 physAddrUpper
Definition: mpi.h:113
bit32 alignment
Definition: mpi.h:118
void * virtPtr
Definition: mpi.h:111
void * appHandle
Definition: mpi.h:112
bit32 reserved
Definition: mpi.h:121
void * piPointer
Definition: mpi.h:160
bit32 elementSize
Definition: mpi.h:154
bit32 consumerIdx
Definition: mpi.h:163
mpiMem_t memoryRegion
Definition: mpi.h:161
bit32 pcibar
Definition: mpi.h:164
bit32 qNumber
Definition: mpi.h:152
bit32 CIPCIBar
Definition: mpi.h:157
bit32 CIPCIOffset
Definition: mpi.h:158
agsaRoot_t * agRoot
Definition: mpi.h:165
bit32 numElements
Definition: mpi.h:153
bit32 producerIdx
Definition: mpi.h:162
bit32 DIntTOffset
Definition: mpi.h:159
bit32 priority
Definition: mpi.h:155
MPI outbound queue attributes.
Definition: mpi.h:331
MPI Phy Calibration Table.
Definition: mpi.h:357
bit32 reserved[2]
Definition: mpi.h:366
bit32 spaReg5
Definition: mpi.h:363
bit32 spaReg0
Definition: mpi.h:358
bit32 spaReg3
Definition: mpi.h:361
bit32 spaReg2
Definition: mpi.h:360
bit32 spaReg4
Definition: mpi.h:362
bit32 spaReg7
Definition: mpi.h:365
bit32 spaReg6
Definition: mpi.h:364
bit32 spaReg1
Definition: mpi.h:359
sasPhyAttribute_t phyAttributeTable
Definition: mpi.h:395
bit16 maxNumOutboundQueues
Definition: mpi.h:399
bit16 maxNumInboundQueues
Definition: mpi.h:398
bit32 queueOption
Definition: mpi.h:400
bit16 numOutboundQueues
Definition: mpi.h:397
mpiOutboundQueueDescriptor_t outboundQueues[MPI_MAX_OUTBOUND_QUEUES]
Definition: mpi.h:390
mpiInboundQueueDescriptor_t inboundQueues[MPI_MAX_INBOUND_QUEUES]
Definition: mpi.h:387
bit16 numInboundQueues
Definition: mpi.h:396
mpiInterruptVT_t interruptVTable
Definition: mpi.h:394
mpiHostLLConfigDescriptor_t mainConfig
Definition: mpi.h:386
agsaPhyAnalogSetupTable_t phyAnalogConfig
Definition: mpi.h:393