VirtualBox

source: vbox/trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.h@ 78374

Last change on this file since 78374 was 76565, checked in by vboxsync, 6 years ago

Devices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 129.3 KB
Line 
1/* $Id: DevLsiLogicSCSI.h 76565 2019-01-01 04:23:20Z vboxsync $ */
2/** @file
3 * VBox storage devices: LsiLogic LSI53c1030 SCSI controller - Defines and structures.
4 */
5
6/*
7 * Copyright (C) 2006-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef VBOX_INCLUDED_SRC_Storage_DevLsiLogicSCSI_h
19#define VBOX_INCLUDED_SRC_Storage_DevLsiLogicSCSI_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include <iprt/stdint.h>
25
26/*
27 * Custom fixed I/O ports for BIOS controller access. Note that these should
28 * not be in the ISA range (below 400h) to avoid conflicts with ISA device
29 * probing. Addresses in the 300h-340h range should be especially avoided.
30 */
31#define LSILOGIC_BIOS_IO_PORT 0x434
32#define LSILOGIC_SAS_BIOS_IO_PORT 0x438
33
34#define LSILOGICSCSI_REQUEST_QUEUE_DEPTH_DEFAULT 256
35#define LSILOGICSCSI_REPLY_QUEUE_DEPTH_DEFAULT 256
36
37#define LSILOGICSCSI_MAXIMUM_CHAIN_DEPTH 3
38
39#define LSILOGIC_NR_OF_ALLOWED_BIGGER_LISTS 100
40
41/** Equal for all devices */
42#define LSILOGICSCSI_PCI_VENDOR_ID (0x1000)
43
44/** SPI SCSI controller (LSI53C1030) */
45#define LSILOGICSCSI_PCI_SPI_CTRLNAME "LSI53C1030"
46#define LSILOGICSCSI_PCI_SPI_DEVICE_ID (0x0030)
47#define LSILOGICSCSI_PCI_SPI_REVISION_ID (0x00)
48#define LSILOGICSCSI_PCI_SPI_CLASS_CODE (0x01)
49#define LSILOGICSCSI_PCI_SPI_SUBSYSTEM_VENDOR_ID (0x1000)
50#define LSILOGICSCSI_PCI_SPI_SUBSYSTEM_ID (0x8000)
51#define LSILOGICSCSI_PCI_SPI_PORTS_MAX 1
52#define LSILOGICSCSI_PCI_SPI_BUSES_MAX 1
53#define LSILOGICSCSI_PCI_SPI_DEVICES_PER_BUS_MAX 16
54#define LSILOGICSCSI_PCI_SPI_DEVICES_MAX (LSILOGICSCSI_PCI_SPI_BUSES_MAX*LSILOGICSCSI_PCI_SPI_DEVICES_PER_BUS_MAX)
55
56/** SAS SCSI controller (SAS1068 PCI-X Fusion-MPT SAS) */
57#define LSILOGICSCSI_PCI_SAS_CTRLNAME "SAS1068"
58#define LSILOGICSCSI_PCI_SAS_DEVICE_ID (0x0054)
59#define LSILOGICSCSI_PCI_SAS_REVISION_ID (0x00)
60#define LSILOGICSCSI_PCI_SAS_CLASS_CODE (0x00)
61#define LSILOGICSCSI_PCI_SAS_SUBSYSTEM_VENDOR_ID (0x1000)
62#define LSILOGICSCSI_PCI_SAS_SUBSYSTEM_ID (0x8000)
63#define LSILOGICSCSI_PCI_SAS_PORTS_MAX 256
64#define LSILOGICSCSI_PCI_SAS_PORTS_DEFAULT 8
65#define LSILOGICSCSI_PCI_SAS_DEVICES_PER_PORT_MAX 1
66#define LSILOGICSCSI_PCI_SAS_DEVICES_MAX (LSILOGICSCSI_PCI_SAS_PORTS_MAX * LSILOGICSCSI_PCI_SAS_DEVICES_PER_PORT_MAX)
67
68/**
69 * A SAS address.
70 */
71#pragma pack(1)
72typedef union SASADDRESS
73{
74 /** 64bit view. */
75 uint64_t u64Address;
76 /** 32bit view. */
77 uint32_t u32Address[2];
78 /** 16bit view. */
79 uint16_t u16Address[4];
80 /** Byte view. */
81 uint8_t u8Address[8];
82} SASADDRESS, *PSASADDRESS;
83#pragma pack()
84AssertCompileSize(SASADDRESS, 8);
85
86/**
87 * Possible device types we support.
88 */
89typedef enum LSILOGICCTRLTYPE
90{
91 /** SPI SCSI controller (PCI dev id 0x0030) */
92 LSILOGICCTRLTYPE_SCSI_SPI = 0,
93 /** SAS SCSI controller (PCI dev id 0x0054) */
94 LSILOGICCTRLTYPE_SCSI_SAS = 1,
95 /** 32bit hack */
96 LSILOGICCTRLTYPE_32BIT_HACK = 0x7fffffff
97} LSILOGICCTRLTYPE, *PLSILOGICCTRLTYPE;
98
99/**
100 * A simple SG element for a 64bit address.
101 */
102#pragma pack(1)
103typedef struct MptSGEntrySimple64
104{
105 /** Length of the buffer this entry describes. */
106 unsigned u24Length: 24;
107 /** Flag whether this element is the end of the list. */
108 unsigned fEndOfList: 1;
109 /** Flag whether the address is 32bit or 64bits wide. */
110 unsigned f64BitAddress: 1;
111 /** Flag whether this buffer contains data to be transferred or is the destination. */
112 unsigned fBufferContainsData: 1;
113 /** Flag whether this is a local address or a system address. */
114 unsigned fLocalAddress: 1;
115 /** Element type. */
116 unsigned u2ElementType: 2;
117 /** Flag whether this is the last element of the buffer. */
118 unsigned fEndOfBuffer: 1;
119 /** Flag whether this is the last element of the current segment. */
120 unsigned fLastElement: 1;
121 /** Lower 32bits of the address of the data buffer. */
122 unsigned u32DataBufferAddressLow: 32;
123 /** Upper 32bits of the address of the data buffer. */
124 unsigned u32DataBufferAddressHigh: 32;
125} MptSGEntrySimple64, *PMptSGEntrySimple64;
126#pragma pack()
127AssertCompileSize(MptSGEntrySimple64, 12);
128
129/**
130 * A simple SG element for a 32bit address.
131 */
132#pragma pack(1)
133typedef struct MptSGEntrySimple32
134{
135 /** Length of the buffer this entry describes. */
136 unsigned u24Length: 24;
137 /** Flag whether this element is the end of the list. */
138 unsigned fEndOfList: 1;
139 /** Flag whether the address is 32bit or 64bits wide. */
140 unsigned f64BitAddress: 1;
141 /** Flag whether this buffer contains data to be transferred or is the destination. */
142 unsigned fBufferContainsData: 1;
143 /** Flag whether this is a local address or a system address. */
144 unsigned fLocalAddress: 1;
145 /** Element type. */
146 unsigned u2ElementType: 2;
147 /** Flag whether this is the last element of the buffer. */
148 unsigned fEndOfBuffer: 1;
149 /** Flag whether this is the last element of the current segment. */
150 unsigned fLastElement: 1;
151 /** Lower 32bits of the address of the data buffer. */
152 unsigned u32DataBufferAddressLow: 32;
153} MptSGEntrySimple32, *PMptSGEntrySimple32;
154#pragma pack()
155AssertCompileSize(MptSGEntrySimple32, 8);
156
157/**
158 * A chain SG element.
159 */
160#pragma pack(1)
161typedef struct MptSGEntryChain
162{
163 /** Size of the segment. */
164 unsigned u16Length: 16;
165 /** Offset in 32bit words of the next chain element in the segment
166 * identified by this element. */
167 unsigned u8NextChainOffset: 8;
168 /** Reserved. */
169 unsigned fReserved0: 1;
170 /** Flag whether the address is 32bit or 64bits wide. */
171 unsigned f64BitAddress: 1;
172 /** Reserved. */
173 unsigned fReserved1: 1;
174 /** Flag whether this is a local address or a system address. */
175 unsigned fLocalAddress: 1;
176 /** Element type. */
177 unsigned u2ElementType: 2;
178 /** Flag whether this is the last element of the buffer. */
179 unsigned u2Reserved2: 2;
180 /** Lower 32bits of the address of the data buffer. */
181 unsigned u32SegmentAddressLow: 32;
182 /** Upper 32bits of the address of the data buffer. */
183 unsigned u32SegmentAddressHigh: 32;
184} MptSGEntryChain, *PMptSGEntryChain;
185#pragma pack()
186AssertCompileSize(MptSGEntryChain, 12);
187
188typedef union MptSGEntryUnion
189{
190 MptSGEntrySimple64 Simple64;
191 MptSGEntrySimple32 Simple32;
192 MptSGEntryChain Chain;
193} MptSGEntryUnion, *PMptSGEntryUnion;
194
195/**
196 * MPT Fusion message header - Common for all message frames.
197 * This is filled in by the guest.
198 */
199#pragma pack(1)
200typedef struct MptMessageHdr
201{
202 /** Function dependent data. */
203 uint16_t u16FunctionDependent;
204 /** Chain offset. */
205 uint8_t u8ChainOffset;
206 /** The function code. */
207 uint8_t u8Function;
208 /** Function dependent data. */
209 uint8_t au8FunctionDependent[3];
210 /** Message flags. */
211 uint8_t u8MessageFlags;
212 /** Message context - Unique ID from the guest unmodified by the device. */
213 uint32_t u32MessageContext;
214} MptMessageHdr, *PMptMessageHdr;
215#pragma pack()
216AssertCompileSize(MptMessageHdr, 12);
217
218/** Defined function codes found in the message header. */
219#define MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST (0x00)
220#define MPT_MESSAGE_HDR_FUNCTION_SCSI_TASK_MGMT (0x01)
221#define MPT_MESSAGE_HDR_FUNCTION_IOC_INIT (0x02)
222#define MPT_MESSAGE_HDR_FUNCTION_IOC_FACTS (0x03)
223#define MPT_MESSAGE_HDR_FUNCTION_CONFIG (0x04)
224#define MPT_MESSAGE_HDR_FUNCTION_PORT_FACTS (0x05)
225#define MPT_MESSAGE_HDR_FUNCTION_PORT_ENABLE (0x06)
226#define MPT_MESSAGE_HDR_FUNCTION_EVENT_NOTIFICATION (0x07)
227#define MPT_MESSAGE_HDR_FUNCTION_EVENT_ACK (0x08)
228#define MPT_MESSAGE_HDR_FUNCTION_FW_DOWNLOAD (0x09)
229#define MPT_MESSAGE_HDR_FUNCTION_TARGET_CMD_BUFFER_POST (0x0A)
230#define MPT_MESSAGE_HDR_FUNCTION_TARGET_ASSIST (0x0B)
231#define MPT_MESSAGE_HDR_FUNCTION_TARGET_STATUS_SEND (0x0C)
232#define MPT_MESSAGE_HDR_FUNCTION_TARGET_MODE_ABORT (0x0D)
233#define MPT_MESSAGE_HDR_FUNCTION_FW_UPLOAD (0x12)
234
235#ifdef DEBUG
236/**
237 * Function names
238 */
239static const char * const g_apszMPTFunctionNames[] =
240{
241 "SCSI I/O Request",
242 "SCSI Task Management",
243 "IOC Init",
244 "IOC Facts",
245 "Config",
246 "Port Facts",
247 "Port Enable",
248 "Event Notification",
249 "Event Ack",
250 "Firmware Download"
251};
252#endif
253
254/**
255 * Default reply message.
256 * Send from the device to the guest upon completion of a request.
257 */
258 #pragma pack(1)
259typedef struct MptDefaultReplyMessage
260{
261 /** Function dependent data. */
262 uint16_t u16FunctionDependent;
263 /** Length of the message in 32bit DWords. */
264 uint8_t u8MessageLength;
265 /** Function which completed. */
266 uint8_t u8Function;
267 /** Function dependent. */
268 uint8_t au8FunctionDependent[3];
269 /** Message flags. */
270 uint8_t u8MessageFlags;
271 /** Message context given in the request. */
272 uint32_t u32MessageContext;
273 /** Function dependent status code. */
274 uint16_t u16FunctionDependentStatus;
275 /** Status of the IOC. */
276 uint16_t u16IOCStatus;
277 /** Additional log info. */
278 uint32_t u32IOCLogInfo;
279} MptDefaultReplyMessage, *PMptDefaultReplyMessage;
280#pragma pack()
281AssertCompileSize(MptDefaultReplyMessage, 20);
282
283/**
284 * IO controller init request.
285 */
286#pragma pack(1)
287typedef struct MptIOCInitRequest
288{
289 /** Which system send this init request. */
290 uint8_t u8WhoInit;
291 /** Reserved */
292 uint8_t u8Reserved;
293 /** Chain offset in the SG list. */
294 uint8_t u8ChainOffset;
295 /** Function to execute. */
296 uint8_t u8Function;
297 /** Flags */
298 uint8_t u8Flags;
299 /** Maximum number of devices the driver can handle. */
300 uint8_t u8MaxDevices;
301 /** Maximum number of buses the driver can handle. */
302 uint8_t u8MaxBuses;
303 /** Message flags. */
304 uint8_t u8MessageFlags;
305 /** Message context ID. */
306 uint32_t u32MessageContext;
307 /** Reply frame size. */
308 uint16_t u16ReplyFrameSize;
309 /** Reserved */
310 uint16_t u16Reserved;
311 /** Upper 32bit part of the 64bit address the message frames are in.
312 * That means all frames must be in the same 4GB segment. */
313 uint32_t u32HostMfaHighAddr;
314 /** Upper 32bit of the sense buffer. */
315 uint32_t u32SenseBufferHighAddr;
316} MptIOCInitRequest, *PMptIOCInitRequest;
317#pragma pack()
318AssertCompileSize(MptIOCInitRequest, 24);
319
320/**
321 * IO controller init reply.
322 */
323#pragma pack(1)
324typedef struct MptIOCInitReply
325{
326 /** Which subsystem send this init request. */
327 uint8_t u8WhoInit;
328 /** Reserved */
329 uint8_t u8Reserved;
330 /** Message length */
331 uint8_t u8MessageLength;
332 /** Function. */
333 uint8_t u8Function;
334 /** Flags */
335 uint8_t u8Flags;
336 /** Maximum number of devices the driver can handle. */
337 uint8_t u8MaxDevices;
338 /** Maximum number of busses the driver can handle. */
339 uint8_t u8MaxBuses;
340 /** Message flags. */
341 uint8_t u8MessageFlags;
342 /** Message context ID */
343 uint32_t u32MessageContext;
344 /** Reserved */
345 uint16_t u16Reserved;
346 /** IO controller status. */
347 uint16_t u16IOCStatus;
348 /** IO controller log information. */
349 uint32_t u32IOCLogInfo;
350} MptIOCInitReply, *PMptIOCInitReply;
351#pragma pack()
352AssertCompileSize(MptIOCInitReply, 20);
353
354/**
355 * IO controller facts request.
356 */
357#pragma pack(1)
358typedef struct MptIOCFactsRequest
359{
360 /** Reserved. */
361 uint16_t u16Reserved;
362 /** Chain offset in SG list. */
363 uint8_t u8ChainOffset;
364 /** Function number. */
365 uint8_t u8Function;
366 /** Reserved */
367 uint8_t u8Reserved[3];
368 /** Message flags. */
369 uint8_t u8MessageFlags;
370 /** Message context ID. */
371 uint32_t u32MessageContext;
372} MptIOCFactsRequest, *PMptIOCFactsRequest;
373#pragma pack()
374AssertCompileSize(MptIOCFactsRequest, 12);
375
376/**
377 * IO controller facts reply.
378 */
379#pragma pack(1)
380typedef struct MptIOCFactsReply
381{
382 /** Message version. */
383 uint16_t u16MessageVersion;
384 /** Message length. */
385 uint8_t u8MessageLength;
386 /** Function number. */
387 uint8_t u8Function;
388 /** Reserved */
389 uint16_t u16Reserved1;
390 /** IO controller number */
391 uint8_t u8IOCNumber;
392 /** Message flags. */
393 uint8_t u8MessageFlags;
394 /** Message context ID. */
395 uint32_t u32MessageContext;
396 /** IO controller exceptions */
397 uint16_t u16IOCExceptions;
398 /** IO controller status. */
399 uint16_t u16IOCStatus;
400 /** IO controller log information. */
401 uint32_t u32IOCLogInfo;
402 /** Maximum chain depth. */
403 uint8_t u8MaxChainDepth;
404 /** The current value of the WhoInit field. */
405 uint8_t u8WhoInit;
406 /** Block size. */
407 uint8_t u8BlockSize;
408 /** Flags. */
409 uint8_t u8Flags;
410 /** Depth of the reply queue. */
411 uint16_t u16ReplyQueueDepth;
412 /** Size of a request frame. */
413 uint16_t u16RequestFrameSize;
414 /** Reserved */
415 uint16_t u16Reserved2;
416 /** Product ID. */
417 uint16_t u16ProductID;
418 /** Current value of the high 32bit MFA address. */
419 uint32_t u32CurrentHostMFAHighAddr;
420 /** Global credits - Number of entries allocated to queues */
421 uint16_t u16GlobalCredits;
422 /** Number of ports on the IO controller */
423 uint8_t u8NumberOfPorts;
424 /** Event state. */
425 uint8_t u8EventState;
426 /** Current value of the high 32bit sense buffer address. */
427 uint32_t u32CurrentSenseBufferHighAddr;
428 /** Current reply frame size. */
429 uint16_t u16CurReplyFrameSize;
430 /** Maximum number of devices. */
431 uint8_t u8MaxDevices;
432 /** Maximum number of buses. */
433 uint8_t u8MaxBuses;
434 /** Size of the firmware image. */
435 uint32_t u32FwImageSize;
436 /** Reserved. */
437 uint32_t u32Reserved;
438 /** Firmware version */
439 uint32_t u32FWVersion;
440} MptIOCFactsReply, *PMptIOCFactsReply;
441#pragma pack()
442AssertCompileSize(MptIOCFactsReply, 60);
443
444/**
445 * Port facts request
446 */
447#pragma pack(1)
448typedef struct MptPortFactsRequest
449{
450 /** Reserved */
451 uint16_t u16Reserved1;
452 /** Message length. */
453 uint8_t u8MessageLength;
454 /** Function number. */
455 uint8_t u8Function;
456 /** Reserved */
457 uint16_t u16Reserved2;
458 /** Port number to get facts for. */
459 uint8_t u8PortNumber;
460 /** Message flags. */
461 uint8_t u8MessageFlags;
462 /** Message context ID. */
463 uint32_t u32MessageContext;
464} MptPortFactsRequest, *PMptPortFactsRequest;
465#pragma pack()
466AssertCompileSize(MptPortFactsRequest, 12);
467
468/**
469 * Port facts reply.
470 */
471#pragma pack(1)
472typedef struct MptPortFactsReply
473{
474 /** Reserved. */
475 uint16_t u16Reserved1;
476 /** Message length. */
477 uint8_t u8MessageLength;
478 /** Function number. */
479 uint8_t u8Function;
480 /** Reserved */
481 uint16_t u16Reserved2;
482 /** Port number the facts are for. */
483 uint8_t u8PortNumber;
484 /** Message flags. */
485 uint8_t u8MessageFlags;
486 /** Message context ID. */
487 uint32_t u32MessageContext;
488 /** Reserved. */
489 uint16_t u16Reserved3;
490 /** IO controller status. */
491 uint16_t u16IOCStatus;
492 /** IO controller log information. */
493 uint32_t u32IOCLogInfo;
494 /** Reserved */
495 uint8_t u8Reserved;
496 /** Port type */
497 uint8_t u8PortType;
498 /** Maximum number of devices on this port. */
499 uint16_t u16MaxDevices;
500 /** SCSI ID of this port on the attached bus. */
501 uint16_t u16PortSCSIID;
502 /** Protocol flags. */
503 uint16_t u16ProtocolFlags;
504 /** Maximum number of target command buffers which can be posted to this port at a time. */
505 uint16_t u16MaxPostedCmdBuffers;
506 /** Maximum number of target IDs that remain persistent between power/reset cycles. */
507 uint16_t u16MaxPersistentIDs;
508 /** Maximum number of LAN buckets. */
509 uint16_t u16MaxLANBuckets;
510 /** Reserved. */
511 uint16_t u16Reserved4;
512 /** Reserved. */
513 uint32_t u32Reserved;
514} MptPortFactsReply, *PMptPortFactsReply;
515#pragma pack()
516AssertCompileSize(MptPortFactsReply, 40);
517
518/**
519 * Port Enable request.
520 */
521#pragma pack(1)
522typedef struct MptPortEnableRequest
523{
524 /** Reserved. */
525 uint16_t u16Reserved1;
526 /** Message length. */
527 uint8_t u8MessageLength;
528 /** Function number. */
529 uint8_t u8Function;
530 /** Reserved. */
531 uint16_t u16Reserved2;
532 /** Port number to enable. */
533 uint8_t u8PortNumber;
534 /** Message flags. */
535 uint8_t u8MessageFlags;
536 /** Message context ID. */
537 uint32_t u32MessageContext;
538} MptPortEnableRequest, *PMptPortEnableRequest;
539#pragma pack()
540AssertCompileSize(MptPortEnableRequest, 12);
541
542/**
543 * Port enable reply.
544 */
545#pragma pack(1)
546typedef struct MptPortEnableReply
547{
548 /** Reserved. */
549 uint16_t u16Reserved1;
550 /** Message length. */
551 uint8_t u8MessageLength;
552 /** Function number. */
553 uint8_t u8Function;
554 /** Reserved */
555 uint16_t u16Reserved2;
556 /** Port number which was enabled. */
557 uint8_t u8PortNumber;
558 /** Message flags. */
559 uint8_t u8MessageFlags;
560 /** Message context ID. */
561 uint32_t u32MessageContext;
562 /** Reserved. */
563 uint16_t u16Reserved3;
564 /** IO controller status */
565 uint16_t u16IOCStatus;
566 /** IO controller log information. */
567 uint32_t u32IOCLogInfo;
568} MptPortEnableReply, *PMptPortEnableReply;
569#pragma pack()
570AssertCompileSize(MptPortEnableReply, 20);
571
572/**
573 * Event notification request.
574 */
575#pragma pack(1)
576typedef struct MptEventNotificationRequest
577{
578 /** Switch - Turns event notification on and off. */
579 uint8_t u8Switch;
580 /** Reserved. */
581 uint8_t u8Reserved1;
582 /** Chain offset. */
583 uint8_t u8ChainOffset;
584 /** Function number. */
585 uint8_t u8Function;
586 /** Reserved. */
587 uint8_t u8reserved2[3];
588 /** Message flags. */
589 uint8_t u8MessageFlags;
590 /** Message context ID. */
591 uint32_t u32MessageContext;
592} MptEventNotificationRequest, *PMptEventNotificationRequest;
593#pragma pack()
594AssertCompileSize(MptEventNotificationRequest, 12);
595
596/**
597 * Event notification reply.
598 */
599#pragma pack(1)
600typedef struct MptEventNotificationReply
601{
602 /** Event data length. */
603 uint16_t u16EventDataLength;
604 /** Message length. */
605 uint8_t u8MessageLength;
606 /** Function number. */
607 uint8_t u8Function;
608 /** Reserved. */
609 uint16_t u16Reserved1;
610 /** Ack required. */
611 uint8_t u8AckRequired;
612 /** Message flags. */
613 uint8_t u8MessageFlags;
614 /** Message context ID. */
615 uint32_t u32MessageContext;
616 /** Reserved. */
617 uint16_t u16Reserved2;
618 /** IO controller status. */
619 uint16_t u16IOCStatus;
620 /** IO controller log information. */
621 uint32_t u32IOCLogInfo;
622 /** Notification event. */
623 uint32_t u32Event;
624 /** Event context. */
625 uint32_t u32EventContext;
626 /** Event data. */
627 uint32_t u32EventData;
628} MptEventNotificationReply, *PMptEventNotificationReply;
629#pragma pack()
630AssertCompileSize(MptEventNotificationReply, 32);
631
632#define MPT_EVENT_EVENT_CHANGE (0x0000000a)
633
634/**
635 * FW download request.
636 */
637#pragma pack(1)
638typedef struct MptFWDownloadRequest
639{
640 /** Switch - Turns event notification on and off. */
641 uint8_t u8ImageType;
642 /** Reserved. */
643 uint8_t u8Reserved1;
644 /** Chain offset. */
645 uint8_t u8ChainOffset;
646 /** Function number. */
647 uint8_t u8Function;
648 /** Reserved. */
649 uint8_t u8Reserved2[3];
650 /** Message flags. */
651 uint8_t u8MessageFlags;
652 /** Message context ID. */
653 uint32_t u32MessageContext;
654} MptFWDownloadRequest, *PMptFWDownloadRequest;
655#pragma pack()
656AssertCompileSize(MptFWDownloadRequest, 12);
657
658#define MPT_FW_DOWNLOAD_REQUEST_IMAGE_TYPE_RESERVED 0
659#define MPT_FW_DOWNLOAD_REQUEST_IMAGE_TYPE_FIRMWARE 1
660#define MPT_FW_DOWNLOAD_REQUEST_IMAGE_TYPE_MPI_BIOS 2
661#define MPT_FW_DOWNLOAD_REQUEST_IMAGE_TYPE_NVDATA 3
662
663/**
664 * FW download reply.
665 */
666#pragma pack(1)
667typedef struct MptFWDownloadReply
668{
669 /** Reserved. */
670 uint16_t u16Reserved1;
671 /** Message length. */
672 uint8_t u8MessageLength;
673 /** Function number. */
674 uint8_t u8Function;
675 /** Reserved. */
676 uint8_t u8Reserved2[3];
677 /** Message flags. */
678 uint8_t u8MessageFlags;
679 /** Message context ID. */
680 uint32_t u32MessageContext;
681 /** Reserved. */
682 uint16_t u16Reserved2;
683 /** IO controller status. */
684 uint16_t u16IOCStatus;
685 /** IO controller log information. */
686 uint32_t u32IOCLogInfo;
687} MptFWDownloadReply, *PMptFWDownloadReply;
688#pragma pack()
689AssertCompileSize(MptFWDownloadReply, 20);
690
691/**
692 * FW upload request.
693 */
694#pragma pack(1)
695typedef struct MptFWUploadRequest
696{
697 /** Requested image type. */
698 uint8_t u8ImageType;
699 /** Reserved. */
700 uint8_t u8Reserved1;
701 /** Chain offset. */
702 uint8_t u8ChainOffset;
703 /** Function number. */
704 uint8_t u8Function;
705 /** Reserved. */
706 uint8_t u8Reserved2[3];
707 /** Message flags. */
708 uint8_t u8MessageFlags;
709 /** Message context ID. */
710 uint32_t u32MessageContext;
711} MptFWUploadRequest, *PMptFWUploadRequest;
712#pragma pack()
713AssertCompileSize(MptFWUploadRequest, 12);
714
715/**
716 * FW upload reply.
717 */
718#pragma pack(1)
719typedef struct MptFWUploadReply
720{
721 /** Image type. */
722 uint8_t u8ImageType;
723 /** Reserved. */
724 uint8_t u8Reserved1;
725 /** Message length. */
726 uint8_t u8MessageLength;
727 /** Function number. */
728 uint8_t u8Function;
729 /** Reserved. */
730 uint8_t u8Reserved2[3];
731 /** Message flags. */
732 uint8_t u8MessageFlags;
733 /** Message context ID. */
734 uint32_t u32MessageContext;
735 /** Reserved. */
736 uint16_t u16Reserved2;
737 /** IO controller status. */
738 uint16_t u16IOCStatus;
739 /** IO controller log information. */
740 uint32_t u32IOCLogInfo;
741 /** Uploaded image size. */
742 uint32_t u32ActualImageSize;
743} MptFWUploadReply, *PMptFWUploadReply;
744#pragma pack()
745AssertCompileSize(MptFWUploadReply, 24);
746
747/**
748 * SCSI IO Request
749 */
750#pragma pack(1)
751typedef struct MptSCSIIORequest
752{
753 /** Target ID */
754 uint8_t u8TargetID;
755 /** Bus number */
756 uint8_t u8Bus;
757 /** Chain offset */
758 uint8_t u8ChainOffset;
759 /** Function number. */
760 uint8_t u8Function;
761 /** CDB length. */
762 uint8_t u8CDBLength;
763 /** Sense buffer length. */
764 uint8_t u8SenseBufferLength;
765 /** Reserved */
766 uint8_t u8Reserved;
767 /** Message flags. */
768 uint8_t u8MessageFlags;
769 /** Message context ID. */
770 uint32_t u32MessageContext;
771 /** LUN */
772 uint8_t au8LUN[8];
773 /** Control values. */
774 uint32_t u32Control;
775 /** The CDB. */
776 uint8_t au8CDB[16];
777 /** Data length. */
778 uint32_t u32DataLength;
779 /** Sense buffer low 32bit address. */
780 uint32_t u32SenseBufferLowAddress;
781} MptSCSIIORequest, *PMptSCSIIORequest;
782#pragma pack()
783AssertCompileSize(MptSCSIIORequest, 48);
784
785#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_GET(x) (((x) & 0x3000000) >> 24)
786#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_NONE (0x0)
787#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_WRITE (0x1)
788#define MPT_SCSIIO_REQUEST_CONTROL_TXDIR_READ (0x2)
789
790/**
791 * SCSI IO error reply.
792 */
793#pragma pack(1)
794typedef struct MptSCSIIOErrorReply
795{
796 /** Target ID */
797 uint8_t u8TargetID;
798 /** Bus number */
799 uint8_t u8Bus;
800 /** Message length. */
801 uint8_t u8MessageLength;
802 /** Function number. */
803 uint8_t u8Function;
804 /** CDB length */
805 uint8_t u8CDBLength;
806 /** Sense buffer length */
807 uint8_t u8SenseBufferLength;
808 /** Reserved */
809 uint8_t u8Reserved;
810 /** Message flags */
811 uint8_t u8MessageFlags;
812 /** Message context ID */
813 uint32_t u32MessageContext;
814 /** SCSI status. */
815 uint8_t u8SCSIStatus;
816 /** SCSI state */
817 uint8_t u8SCSIState;
818 /** IO controller status */
819 uint16_t u16IOCStatus;
820 /** IO controller log information */
821 uint32_t u32IOCLogInfo;
822 /** Transfer count */
823 uint32_t u32TransferCount;
824 /** Sense count */
825 uint32_t u32SenseCount;
826 /** Response information */
827 uint32_t u32ResponseInfo;
828} MptSCSIIOErrorReply, *PMptSCSIIOErrorReply;
829#pragma pack()
830AssertCompileSize(MptSCSIIOErrorReply, 32);
831
832#define MPT_SCSI_IO_ERROR_SCSI_STATE_AUTOSENSE_VALID (0x01)
833#define MPT_SCSI_IO_ERROR_SCSI_STATE_TERMINATED (0x08)
834
835/**
836 * IOC status codes specific to the SCSI I/O error reply.
837 */
838#define MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_BUS (0x0041)
839#define MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_TARGETID (0x0042)
840#define MPT_SCSI_IO_ERROR_IOCSTATUS_DEVICE_NOT_THERE (0x0043)
841
842/**
843 * SCSI task management request.
844 */
845#pragma pack(1)
846typedef struct MptSCSITaskManagementRequest
847{
848 /** Target ID */
849 uint8_t u8TargetID;
850 /** Bus number */
851 uint8_t u8Bus;
852 /** Chain offset */
853 uint8_t u8ChainOffset;
854 /** Function number */
855 uint8_t u8Function;
856 /** Reserved */
857 uint8_t u8Reserved1;
858 /** Task type */
859 uint8_t u8TaskType;
860 /** Reserved */
861 uint8_t u8Reserved2;
862 /** Message flags */
863 uint8_t u8MessageFlags;
864 /** Message context ID */
865 uint32_t u32MessageContext;
866 /** LUN */
867 uint8_t au8LUN[8];
868 /** Reserved */
869 uint8_t auReserved[28];
870 /** Task message context ID. */
871 uint32_t u32TaskMessageContext;
872} MptSCSITaskManagementRequest, *PMptSCSITaskManagementRequest;
873#pragma pack()
874AssertCompileSize(MptSCSITaskManagementRequest, 52);
875
876/**
877 * SCSI task management reply.
878 */
879#pragma pack(1)
880typedef struct MptSCSITaskManagementReply
881{
882 /** Target ID */
883 uint8_t u8TargetID;
884 /** Bus number */
885 uint8_t u8Bus;
886 /** Message length */
887 uint8_t u8MessageLength;
888 /** Function number */
889 uint8_t u8Function;
890 /** Reserved */
891 uint8_t u8Reserved1;
892 /** Task type */
893 uint8_t u8TaskType;
894 /** Reserved */
895 uint8_t u8Reserved2;
896 /** Message flags */
897 uint8_t u8MessageFlags;
898 /** Message context ID */
899 uint32_t u32MessageContext;
900 /** Reserved */
901 uint16_t u16Reserved;
902 /** IO controller status */
903 uint16_t u16IOCStatus;
904 /** IO controller log information */
905 uint32_t u32IOCLogInfo;
906 /** Termination count */
907 uint32_t u32TerminationCount;
908} MptSCSITaskManagementReply, *PMptSCSITaskManagementReply;
909#pragma pack()
910AssertCompileSize(MptSCSITaskManagementReply, 24);
911
912/**
913 * Page address for SAS expander page types.
914 */
915#pragma pack(1)
916typedef union MptConfigurationPageAddressSASExpander
917{
918 struct
919 {
920 uint16_t u16Handle;
921 uint16_t u16Reserved;
922 } Form0And2;
923 struct
924 {
925 uint16_t u16Handle;
926 uint8_t u8PhyNum;
927 uint8_t u8Reserved;
928 } Form1;
929} MptConfigurationPageAddressSASExpander, *PMptConfigurationPageAddressSASExpander;
930#pragma pack()
931
932/**
933 * Page address for SAS device page types.
934 */
935#pragma pack(1)
936typedef union MptConfigurationPageAddressSASDevice
937{
938 struct
939 {
940 uint16_t u16Handle;
941 uint16_t u16Reserved;
942 } Form0And2;
943 struct
944 {
945 uint8_t u8TargetID;
946 uint8_t u8Bus;
947 uint8_t u8Reserved;
948 } Form1;
949} MptConfigurationPageAddressSASDevice, *PMptConfigurationPageAddressSASDevice;
950#pragma pack()
951
952/**
953 * Page address for SAS PHY page types.
954 */
955#pragma pack(1)
956typedef union MptConfigurationPageAddressSASPHY
957{
958 struct
959 {
960 uint8_t u8PhyNumber;
961 uint8_t u8Reserved[3];
962 } Form0;
963 struct
964 {
965 uint16_t u16Index;
966 uint16_t u16Reserved;
967 } Form1;
968} MptConfigurationPageAddressSASPHY, *PMptConfigurationPageAddressSASPHY;
969#pragma pack()
970
971/**
972 * Page address for SAS Enclosure page types.
973 */
974#pragma pack(1)
975typedef struct MptConfigurationPageAddressSASEnclosure
976{
977 uint16_t u16Handle;
978 uint16_t u16Reserved;
979} MptConfigurationPageAddressSASEnclosure, *PMptConfigurationPageAddressSASEnclosure;
980#pragma pack()
981
982/**
983 * Union of all possible address types.
984 */
985#pragma pack(1)
986typedef union MptConfigurationPageAddress
987{
988 /** 32bit view. */
989 uint32_t u32PageAddress;
990 struct
991 {
992 /** Port number to get the configuration page for. */
993 uint8_t u8PortNumber;
994 /** Reserved. */
995 uint8_t u8Reserved[3];
996 } MPIPortNumber;
997 struct
998 {
999 /** Target ID to get the configuration page for. */
1000 uint8_t u8TargetID;
1001 /** Bus number to get the configuration page for. */
1002 uint8_t u8Bus;
1003 /** Reserved. */
1004 uint8_t u8Reserved[2];
1005 } BusAndTargetId;
1006 MptConfigurationPageAddressSASExpander SASExpander;
1007 MptConfigurationPageAddressSASDevice SASDevice;
1008 MptConfigurationPageAddressSASPHY SASPHY;
1009 MptConfigurationPageAddressSASEnclosure SASEnclosure;
1010} MptConfigurationPageAddress, *PMptConfigurationPageAddress;
1011#pragma pack()
1012AssertCompileSize(MptConfigurationPageAddress, 4);
1013
1014#define MPT_CONFIGURATION_PAGE_ADDRESS_GET_SAS_FORM(x) (((x).u32PageAddress >> 28) & 0x0f)
1015
1016/**
1017 * Configuration request
1018 */
1019#pragma pack(1)
1020typedef struct MptConfigurationRequest
1021{
1022 /** Action code. */
1023 uint8_t u8Action;
1024 /** Reserved. */
1025 uint8_t u8Reserved1;
1026 /** Chain offset. */
1027 uint8_t u8ChainOffset;
1028 /** Function number. */
1029 uint8_t u8Function;
1030 /** Extended page length. */
1031 uint16_t u16ExtPageLength;
1032 /** Extended page type */
1033 uint8_t u8ExtPageType;
1034 /** Message flags. */
1035 uint8_t u8MessageFlags;
1036 /** Message context ID. */
1037 uint32_t u32MessageContext;
1038 /** Reserved. */
1039 uint8_t u8Reserved2[8];
1040 /** Version number of the page. */
1041 uint8_t u8PageVersion;
1042 /** Length of the page in 32bit Dwords. */
1043 uint8_t u8PageLength;
1044 /** Page number to access. */
1045 uint8_t u8PageNumber;
1046 /** Type of the page being accessed. */
1047 uint8_t u8PageType;
1048 /** Page type dependent address. */
1049 MptConfigurationPageAddress PageAddress;
1050 /** Simple SG element describing the buffer. */
1051 MptSGEntrySimple64 SimpleSGElement;
1052} MptConfigurationRequest, *PMptConfigurationRequest;
1053#pragma pack()
1054AssertCompileSize(MptConfigurationRequest, 40);
1055
1056/** Possible action codes. */
1057#define MPT_CONFIGURATION_REQUEST_ACTION_HEADER (0x00)
1058#define MPT_CONFIGURATION_REQUEST_ACTION_READ_CURRENT (0x01)
1059#define MPT_CONFIGURATION_REQUEST_ACTION_WRITE_CURRENT (0x02)
1060#define MPT_CONFIGURATION_REQUEST_ACTION_DEFAULT (0x03)
1061#define MPT_CONFIGURATION_REQUEST_ACTION_WRITE_NVRAM (0x04)
1062#define MPT_CONFIGURATION_REQUEST_ACTION_READ_DEFAULT (0x05)
1063#define MPT_CONFIGURATION_REQUEST_ACTION_READ_NVRAM (0x06)
1064
1065/** Page type codes. */
1066#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_IO_UNIT (0x00)
1067#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_IOC (0x01)
1068#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_BIOS (0x02)
1069#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_SCSI_PORT (0x03)
1070#define MPT_CONFIGURATION_REQUEST_PAGE_TYPE_EXTENDED (0x0F)
1071
1072/**
1073 * Configuration reply.
1074 */
1075#pragma pack(1)
1076typedef struct MptConfigurationReply
1077{
1078 /** Action code. */
1079 uint8_t u8Action;
1080 /** Reserved. */
1081 uint8_t u8Reserved;
1082 /** Message length. */
1083 uint8_t u8MessageLength;
1084 /** Function number. */
1085 uint8_t u8Function;
1086 /** Extended page length. */
1087 uint16_t u16ExtPageLength;
1088 /** Extended page type */
1089 uint8_t u8ExtPageType;
1090 /** Message flags. */
1091 uint8_t u8MessageFlags;
1092 /** Message context ID. */
1093 uint32_t u32MessageContext;
1094 /** Reserved. */
1095 uint16_t u16Reserved;
1096 /** I/O controller status. */
1097 uint16_t u16IOCStatus;
1098 /** I/O controller log information. */
1099 uint32_t u32IOCLogInfo;
1100 /** Version number of the page. */
1101 uint8_t u8PageVersion;
1102 /** Length of the page in 32bit Dwords. */
1103 uint8_t u8PageLength;
1104 /** Page number to access. */
1105 uint8_t u8PageNumber;
1106 /** Type of the page being accessed. */
1107 uint8_t u8PageType;
1108} MptConfigurationReply, *PMptConfigurationReply;
1109#pragma pack()
1110AssertCompileSize(MptConfigurationReply, 24);
1111
1112/** Additional I/O controller status codes for the configuration reply. */
1113#define MPT_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020)
1114#define MPT_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021)
1115#define MPT_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022)
1116#define MPT_IOCSTATUS_CONFIG_INVALID_DATA (0x0023)
1117#define MPT_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024)
1118#define MPT_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025)
1119
1120/**
1121 * Union of all possible request messages.
1122 */
1123typedef union MptRequestUnion
1124{
1125 MptMessageHdr Header;
1126 MptIOCInitRequest IOCInit;
1127 MptIOCFactsRequest IOCFacts;
1128 MptPortFactsRequest PortFacts;
1129 MptPortEnableRequest PortEnable;
1130 MptEventNotificationRequest EventNotification;
1131 MptSCSIIORequest SCSIIO;
1132 MptSCSITaskManagementRequest SCSITaskManagement;
1133 MptConfigurationRequest Configuration;
1134 MptFWDownloadRequest FWDownload;
1135 MptFWUploadRequest FWUpload;
1136} MptRequestUnion, *PMptRequestUnion;
1137
1138/**
1139 * Union of all possible reply messages.
1140 */
1141typedef union MptReplyUnion
1142{
1143 /** 16bit view. */
1144 uint16_t au16Reply[30];
1145 MptDefaultReplyMessage Header;
1146 MptIOCInitReply IOCInit;
1147 MptIOCFactsReply IOCFacts;
1148 MptPortFactsReply PortFacts;
1149 MptPortEnableReply PortEnable;
1150 MptEventNotificationReply EventNotification;
1151 MptSCSIIOErrorReply SCSIIOError;
1152 MptSCSITaskManagementReply SCSITaskManagement;
1153 MptConfigurationReply Configuration;
1154 MptFWDownloadReply FWDownload;
1155 MptFWUploadReply FWUpload;
1156} MptReplyUnion, *PMptReplyUnion;
1157AssertCompileSize(MptReplyUnion, 60);
1158
1159/**
1160 * Firmware image header.
1161 */
1162#pragma pack(1)
1163typedef struct FwImageHdr
1164{
1165 /** ARM branch instruction. */
1166 uint32_t u32ArmBrInsn;
1167 /** Signature part 1. */
1168 uint32_t u32Signature1;
1169 /** Signature part 2. */
1170 uint32_t u32Signature2;
1171 /** Signature part 3. */
1172 uint32_t u32Signature3;
1173 /** Another ARM branch instruction. */
1174 uint32_t u32ArmBrInsn2;
1175 /** Yet another ARM branch instruction. */
1176 uint32_t u32ArmBrInsn3;
1177 /** Reserved. */
1178 uint32_t u32Reserved;
1179 /** Checksum of the image. */
1180 uint32_t u32Checksum;
1181 /** Vendor ID. */
1182 uint16_t u16VendorId;
1183 /** Product ID. */
1184 uint16_t u16ProductId;
1185 /** Firmware version. */
1186 uint32_t u32FwVersion;
1187 /** Firmware sequencer Code version. */
1188 uint32_t u32SeqCodeVersion;
1189 /** Image size in bytes including the header. */
1190 uint32_t u32ImageSize;
1191 /** Offset of the first extended image header. */
1192 uint32_t u32NextImageHeaderOffset;
1193 /** Start address of the image in IOC memory. */
1194 uint32_t u32LoadStartAddress;
1195 /** Absolute start address of the Iop ARM. */
1196 uint32_t u32IopResetVectorValue;
1197 /** Address of the IopResetVector register. */
1198 uint32_t u32IopResetVectorRegAddr;
1199 /** Marker value for what utility. */
1200 uint32_t u32VersionNameWhat;
1201 /** ASCII string of version. */
1202 uint8_t aszVersionName[256];
1203 /** Marker value for what utility. */
1204 uint32_t u32VendorNameWhat;
1205 /** ASCII string of vendor name. */
1206 uint8_t aszVendorName[256];
1207} FwImageHdr, *PFwImageHdr;
1208#pragma pack()
1209AssertCompileSize(FwImageHdr, 584);
1210
1211/** First part of the signature. */
1212#define LSILOGIC_FWIMGHDR_SIGNATURE1 UINT32_C(0x5aeaa55a)
1213/** Second part of the signature. */
1214#define LSILOGIC_FWIMGHDR_SIGNATURE2 UINT32_C(0xa55aeaa5)
1215/** Third part of the signature. */
1216#define LSILOGIC_FWIMGHDR_SIGNATURE3 UINT32_C(0x5aa55aea)
1217/** Load address of the firmware image to watch for,
1218 * seen used by Solaris 9. When this value is written to the
1219 * diagnostic address register we know a firmware image is downloaded.
1220 */
1221#define LSILOGIC_FWIMGHDR_LOAD_ADDRESS UINT32_C(0x21ff5e00)
1222
1223/**
1224 * Configuration Page attributes.
1225 */
1226#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_READONLY (0x00)
1227#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE (0x10)
1228#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT (0x20)
1229#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY (0x30)
1230
1231#define MPT_CONFIGURATION_PAGE_ATTRIBUTE_GET(u8PageType) ((u8PageType) & 0xf0)
1232
1233/**
1234 * Configuration Page types.
1235 */
1236#define MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT (0x00)
1237#define MPT_CONFIGURATION_PAGE_TYPE_IOC (0x01)
1238#define MPT_CONFIGURATION_PAGE_TYPE_BIOS (0x02)
1239#define MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT (0x03)
1240#define MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE (0x04)
1241#define MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING (0x09)
1242#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED (0x0F)
1243
1244#define MPT_CONFIGURATION_PAGE_TYPE_GET(u8PageType) ((u8PageType) & 0x0f)
1245
1246/**
1247 * Extented page types.
1248 */
1249#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASIOUNIT (0x10)
1250#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASEXPANDER (0x11)
1251#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASDEVICE (0x12)
1252#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASPHYS (0x13)
1253#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_LOG (0x14)
1254#define MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_ENCLOSURE (0x15)
1255
1256/**
1257 * Configuration Page header - Common to all pages.
1258 */
1259#pragma pack(1)
1260typedef struct MptConfigurationPageHeader
1261{
1262 /** Version of the page. */
1263 uint8_t u8PageVersion;
1264 /** The length of the page in 32bit D-Words. */
1265 uint8_t u8PageLength;
1266 /** Number of the page. */
1267 uint8_t u8PageNumber;
1268 /** Type of the page. */
1269 uint8_t u8PageType;
1270} MptConfigurationPageHeader, *PMptConfigurationPageHeader;
1271#pragma pack()
1272AssertCompileSize(MptConfigurationPageHeader, 4);
1273
1274/**
1275 * Extended configuration page header - Common to all extended pages.
1276 */
1277#pragma pack(1)
1278typedef struct MptExtendedConfigurationPageHeader
1279{
1280 /** Version of the page. */
1281 uint8_t u8PageVersion;
1282 /** Reserved. */
1283 uint8_t u8Reserved1;
1284 /** Number of the page. */
1285 uint8_t u8PageNumber;
1286 /** Type of the page. */
1287 uint8_t u8PageType;
1288 /** Extended page length. */
1289 uint16_t u16ExtPageLength;
1290 /** Extended page type. */
1291 uint8_t u8ExtPageType;
1292 /** Reserved */
1293 uint8_t u8Reserved2;
1294} MptExtendedConfigurationPageHeader, *PMptExtendedConfigurationPageHeader;
1295#pragma pack()
1296AssertCompileSize(MptExtendedConfigurationPageHeader, 8);
1297
1298/**
1299 * Manufacturing page 0. - Readonly.
1300 */
1301#pragma pack(1)
1302typedef struct MptConfigurationPageManufacturing0
1303{
1304 /** Union. */
1305 union
1306 {
1307 /** Byte view. */
1308 uint8_t abPageData[76];
1309 /** Field view. */
1310 struct
1311 {
1312 /** The omnipresent header. */
1313 MptConfigurationPageHeader Header;
1314 /** Name of the chip. */
1315 uint8_t abChipName[16];
1316 /** Chip revision. */
1317 uint8_t abChipRevision[8];
1318 /** Board name. */
1319 uint8_t abBoardName[16];
1320 /** Board assembly. */
1321 uint8_t abBoardAssembly[16];
1322 /** Board tracer number. */
1323 uint8_t abBoardTracerNumber[16];
1324 } fields;
1325 } u;
1326} MptConfigurationPageManufacturing0, *PMptConfigurationPageManufacturing0;
1327#pragma pack()
1328AssertCompileSize(MptConfigurationPageManufacturing0, 76);
1329
1330/**
1331 * Manufacturing page 1. - Readonly Persistent.
1332 */
1333#pragma pack(1)
1334typedef struct MptConfigurationPageManufacturing1
1335{
1336 /** Union */
1337 union
1338 {
1339 /** Byte view */
1340 uint8_t abPageData[260];
1341 /** Field view */
1342 struct
1343 {
1344 /** The omnipresent header. */
1345 MptConfigurationPageHeader Header;
1346 /** VPD info - don't know what belongs here so all zero. */
1347 uint8_t abVPDInfo[256];
1348 } fields;
1349 } u;
1350} MptConfigurationPageManufacturing1, *PMptConfigurationPageManufacturing1;
1351#pragma pack()
1352AssertCompileSize(MptConfigurationPageManufacturing1, 260);
1353
1354/**
1355 * Manufacturing page 2. - Readonly.
1356 */
1357#pragma pack(1)
1358typedef struct MptConfigurationPageManufacturing2
1359{
1360 /** Union. */
1361 union
1362 {
1363 /** Byte view. */
1364 uint8_t abPageData[8];
1365 /** Field view. */
1366 struct
1367 {
1368 /** The omnipresent header. */
1369 MptConfigurationPageHeader Header;
1370 /** PCI Device ID. */
1371 uint16_t u16PCIDeviceID;
1372 /** PCI Revision ID. */
1373 uint8_t u8PCIRevisionID;
1374 /** Reserved. */
1375 uint8_t u8Reserved;
1376 /** Hardware specific settings... */
1377 } fields;
1378 } u;
1379} MptConfigurationPageManufacturing2, *PMptConfigurationPageManufacturing2;
1380#pragma pack()
1381AssertCompileSize(MptConfigurationPageManufacturing2, 8);
1382
1383/**
1384 * Manufacturing page 3. - Readonly.
1385 */
1386#pragma pack(1)
1387typedef struct MptConfigurationPageManufacturing3
1388{
1389 /** Union. */
1390 union
1391 {
1392 /** Byte view. */
1393 uint8_t abPageData[8];
1394 /** Field view. */
1395 struct
1396 {
1397 /** The omnipresent header. */
1398 MptConfigurationPageHeader Header;
1399 /** PCI Device ID. */
1400 uint16_t u16PCIDeviceID;
1401 /** PCI Revision ID. */
1402 uint8_t u8PCIRevisionID;
1403 /** Reserved. */
1404 uint8_t u8Reserved;
1405 /** Chip specific settings... */
1406 } fields;
1407 } u;
1408} MptConfigurationPageManufacturing3, *PMptConfigurationPageManufacturing3;
1409#pragma pack()
1410AssertCompileSize(MptConfigurationPageManufacturing3, 8);
1411
1412/**
1413 * Manufacturing page 4. - Readonly.
1414 */
1415#pragma pack(1)
1416typedef struct MptConfigurationPageManufacturing4
1417{
1418 /** Union. */
1419 union
1420 {
1421 /** Byte view. */
1422 uint8_t abPageData[84];
1423 /** Field view. */
1424 struct
1425 {
1426 /** The omnipresent header. */
1427 MptConfigurationPageHeader Header;
1428 /** Reserved. */
1429 uint32_t u32Reserved;
1430 /** InfoOffset0. */
1431 uint8_t u8InfoOffset0;
1432 /** Info size. */
1433 uint8_t u8InfoSize0;
1434 /** InfoOffset1. */
1435 uint8_t u8InfoOffset1;
1436 /** Info size. */
1437 uint8_t u8InfoSize1;
1438 /** Size of the inquiry data. */
1439 uint8_t u8InquirySize;
1440 /** Reserved. */
1441 uint8_t abReserved[3];
1442 /** Inquiry data. */
1443 uint8_t abInquiryData[56];
1444 /** IS volume settings. */
1445 uint32_t u32ISVolumeSettings;
1446 /** IME volume settings. */
1447 uint32_t u32IMEVolumeSettings;
1448 /** IM volume settings. */
1449 uint32_t u32IMVolumeSettings;
1450 } fields;
1451 } u;
1452} MptConfigurationPageManufacturing4, *PMptConfigurationPageManufacturing4;
1453#pragma pack()
1454AssertCompileSize(MptConfigurationPageManufacturing4, 84);
1455
1456/**
1457 * Manufacturing page 5 - Readonly.
1458 */
1459#pragma pack(1)
1460typedef struct MptConfigurationPageManufacturing5
1461{
1462 /** Union. */
1463 union
1464 {
1465 /** Byte view. */
1466 uint8_t abPageData[88];
1467 /** Field view. */
1468 struct
1469 {
1470 /** The omnipresent header. */
1471 MptConfigurationPageHeader Header;
1472 /** Base WWID. */
1473 uint64_t u64BaseWWID;
1474 /** Flags */
1475 uint8_t u8Flags;
1476 /** Number of ForceWWID fields in this page. */
1477 uint8_t u8NumForceWWID;
1478 /** Reserved */
1479 uint16_t u16Reserved;
1480 /** Reserved */
1481 uint32_t au32Reserved[2];
1482 /** ForceWWID entries Maximum of 8 because the SAS controller doesn't has more */
1483 uint64_t au64ForceWWID[8];
1484 } fields;
1485 } u;
1486} MptConfigurationPageManufacturing5, *PMptConfigurationPageManufacturing5;
1487#pragma pack()
1488AssertCompileSize(MptConfigurationPageManufacturing5, 24+64);
1489
1490/**
1491 * Manufacturing page 6 - Readonly.
1492 */
1493#pragma pack(1)
1494typedef struct MptConfigurationPageManufacturing6
1495{
1496 /** Union. */
1497 union
1498 {
1499 /** Byte view. */
1500 uint8_t abPageData[4];
1501 /** Field view. */
1502 struct
1503 {
1504 /** The omnipresent header. */
1505 MptConfigurationPageHeader Header;
1506 /** Product specific data - 0 for now */
1507 } fields;
1508 } u;
1509} MptConfigurationPageManufacturing6, *PMptConfigurationPageManufacturing6;
1510#pragma pack()
1511AssertCompileSize(MptConfigurationPageManufacturing6, 4);
1512
1513/**
1514 * Manufacutring page 7 - PHY element.
1515 */
1516#pragma pack(1)
1517typedef struct MptConfigurationPageManufacturing7PHY
1518{
1519 /** Pinout */
1520 uint32_t u32Pinout;
1521 /** Connector name */
1522 uint8_t szConnector[16];
1523 /** Location */
1524 uint8_t u8Location;
1525 /** reserved */
1526 uint8_t u8Reserved;
1527 /** Slot */
1528 uint16_t u16Slot;
1529} MptConfigurationPageManufacturing7PHY, *PMptConfigurationPageManufacturing7PHY;
1530#pragma pack()
1531AssertCompileSize(MptConfigurationPageManufacturing7PHY, 24);
1532
1533/**
1534 * Manufacturing page 7 - Readonly.
1535 */
1536#pragma pack(1)
1537typedef struct MptConfigurationPageManufacturing7
1538{
1539 /** Union. */
1540 union
1541 {
1542 /** Byte view. */
1543 uint8_t abPageData[1];
1544 /** Field view. */
1545 struct
1546 {
1547 /** The omnipresent header. */
1548 MptConfigurationPageHeader Header;
1549 /** Reserved */
1550 uint32_t au32Reserved[2];
1551 /** Flags */
1552 uint32_t u32Flags;
1553 /** Enclosure name */
1554 uint8_t szEnclosureName[16];
1555 /** Number of PHYs */
1556 uint8_t u8NumPhys;
1557 /** Reserved */
1558 uint8_t au8Reserved[3];
1559 /** PHY list for the SAS controller - variable depending on the number of ports */
1560 MptConfigurationPageManufacturing7PHY aPHY[1];
1561 } fields;
1562 } u;
1563} MptConfigurationPageManufacturing7, *PMptConfigurationPageManufacturing7;
1564#pragma pack()
1565AssertCompileSize(MptConfigurationPageManufacturing7, 36+sizeof(MptConfigurationPageManufacturing7PHY));
1566
1567#define LSILOGICSCSI_MANUFACTURING7_GET_SIZE(ports) (sizeof(MptConfigurationPageManufacturing7) + ((ports) - 1) * sizeof(MptConfigurationPageManufacturing7PHY))
1568
1569/** Flags for the flags field */
1570#define LSILOGICSCSI_MANUFACTURING7_FLAGS_USE_PROVIDED_INFORMATION RT_BIT(0)
1571
1572/** Flags for the pinout field */
1573#define LSILOGICSCSI_MANUFACTURING7_PINOUT_UNKNOWN RT_BIT(0)
1574#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8482 RT_BIT(1)
1575#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8470_LANE1 RT_BIT(8)
1576#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8470_LANE2 RT_BIT(9)
1577#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8470_LANE3 RT_BIT(10)
1578#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8470_LANE4 RT_BIT(11)
1579#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8484_LANE1 RT_BIT(16)
1580#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8484_LANE2 RT_BIT(17)
1581#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8484_LANE3 RT_BIT(18)
1582#define LSILOGICSCSI_MANUFACTURING7_PINOUT_SFF8484_LANE4 RT_BIT(19)
1583
1584/** Flags for the location field */
1585#define LSILOGICSCSI_MANUFACTURING7_LOCATION_UNKNOWN 0x01
1586#define LSILOGICSCSI_MANUFACTURING7_LOCATION_INTERNAL 0x02
1587#define LSILOGICSCSI_MANUFACTURING7_LOCATION_EXTERNAL 0x04
1588#define LSILOGICSCSI_MANUFACTURING7_LOCATION_SWITCHABLE 0x08
1589#define LSILOGICSCSI_MANUFACTURING7_LOCATION_AUTO 0x10
1590#define LSILOGICSCSI_MANUFACTURING7_LOCATION_NOT_PRESENT 0x20
1591#define LSILOGICSCSI_MANUFACTURING7_LOCATION_NOT_CONNECTED 0x80
1592
1593/**
1594 * Manufacturing page 8 - Readonly.
1595 */
1596#pragma pack(1)
1597typedef struct MptConfigurationPageManufacturing8
1598{
1599 /** Union. */
1600 union
1601 {
1602 /** Byte view. */
1603 uint8_t abPageData[4];
1604 /** Field view. */
1605 struct
1606 {
1607 /** The omnipresent header. */
1608 MptConfigurationPageHeader Header;
1609 /** Product specific information */
1610 } fields;
1611 } u;
1612} MptConfigurationPageManufacturing8, *PMptConfigurationPageManufacturing8;
1613#pragma pack()
1614AssertCompileSize(MptConfigurationPageManufacturing8, 4);
1615
1616/**
1617 * Manufacturing page 9 - Readonly.
1618 */
1619#pragma pack(1)
1620typedef struct MptConfigurationPageManufacturing9
1621{
1622 /** Union. */
1623 union
1624 {
1625 /** Byte view. */
1626 uint8_t abPageData[4];
1627 /** Field view. */
1628 struct
1629 {
1630 /** The omnipresent header. */
1631 MptConfigurationPageHeader Header;
1632 /** Product specific information */
1633 } fields;
1634 } u;
1635} MptConfigurationPageManufacturing9, *PMptConfigurationPageManufacturing9;
1636#pragma pack()
1637AssertCompileSize(MptConfigurationPageManufacturing9, 4);
1638
1639/**
1640 * Manufacturing page 10 - Readonly.
1641 */
1642#pragma pack(1)
1643typedef struct MptConfigurationPageManufacturing10
1644{
1645 /** Union. */
1646 union
1647 {
1648 /** Byte view. */
1649 uint8_t abPageData[4];
1650 /** Field view. */
1651 struct
1652 {
1653 /** The omnipresent header. */
1654 MptConfigurationPageHeader Header;
1655 /** Product specific information */
1656 } fields;
1657 } u;
1658} MptConfigurationPageManufacturing10, *PMptConfigurationPageManufacturing10;
1659#pragma pack()
1660AssertCompileSize(MptConfigurationPageManufacturing10, 4);
1661
1662/**
1663 * IO Unit page 0. - Readonly.
1664 */
1665#pragma pack(1)
1666typedef struct MptConfigurationPageIOUnit0
1667{
1668 /** Union. */
1669 union
1670 {
1671 /** Byte view. */
1672 uint8_t abPageData[12];
1673 /** Field view. */
1674 struct
1675 {
1676 /** The omnipresent header. */
1677 MptConfigurationPageHeader Header;
1678 /** A unique identifier. */
1679 uint64_t u64UniqueIdentifier;
1680 } fields;
1681 } u;
1682} MptConfigurationPageIOUnit0, *PMptConfigurationPageIOUnit0;
1683#pragma pack()
1684AssertCompileSize(MptConfigurationPageIOUnit0, 12);
1685
1686/**
1687 * IO Unit page 1. - Read/Write.
1688 */
1689#pragma pack(1)
1690typedef struct MptConfigurationPageIOUnit1
1691{
1692 /** Union. */
1693 union
1694 {
1695 /** Byte view. */
1696 uint8_t abPageData[8];
1697 /** Field view. */
1698 struct
1699 {
1700 /** The omnipresent header. */
1701 MptConfigurationPageHeader Header;
1702 /** Flag whether this is a single function PCI device. */
1703 unsigned fSingleFunction: 1;
1704 /** Flag whether all possible paths to a device are mapped. */
1705 unsigned fAllPathsMapped: 1;
1706 /** Reserved. */
1707 unsigned u4Reserved: 4;
1708 /** Flag whether all RAID functionality is disabled. */
1709 unsigned fIntegratedRAIDDisabled: 1;
1710 /** Flag whether 32bit PCI accesses are forced. */
1711 unsigned f32BitAccessForced: 1;
1712 /** Reserved. */
1713 unsigned abReserved: 24;
1714 } fields;
1715 } u;
1716} MptConfigurationPageIOUnit1, *PMptConfigurationPageIOUnit1;
1717#pragma pack()
1718AssertCompileSize(MptConfigurationPageIOUnit1, 8);
1719
1720/**
1721 * Adapter Ordering.
1722 */
1723#pragma pack(1)
1724typedef struct MptConfigurationPageIOUnit2AdapterOrdering
1725{
1726 /** PCI bus number. */
1727 unsigned u8PCIBusNumber: 8;
1728 /** PCI device and function number. */
1729 unsigned u8PCIDevFn: 8;
1730 /** Flag whether the adapter is embedded. */
1731 unsigned fAdapterEmbedded: 1;
1732 /** Flag whether the adapter is enabled. */
1733 unsigned fAdapterEnabled: 1;
1734 /** Reserved. */
1735 unsigned u6Reserved: 6;
1736 /** Reserved. */
1737 unsigned u8Reserved: 8;
1738} MptConfigurationPageIOUnit2AdapterOrdering, *PMptConfigurationPageIOUnit2AdapterOrdering;
1739#pragma pack()
1740AssertCompileSize(MptConfigurationPageIOUnit2AdapterOrdering, 4);
1741
1742/**
1743 * IO Unit page 2. - Read/Write.
1744 */
1745#pragma pack(1)
1746typedef struct MptConfigurationPageIOUnit2
1747{
1748 /** Union. */
1749 union
1750 {
1751 /** Byte view. */
1752 uint8_t abPageData[28];
1753 /** Field view. */
1754 struct
1755 {
1756 /** The omnipresent header. */
1757 MptConfigurationPageHeader Header;
1758 /** Reserved. */
1759 unsigned fReserved: 1;
1760 /** Flag whether Pause on error is enabled. */
1761 unsigned fPauseOnError: 1;
1762 /** Flag whether verbose mode is enabled. */
1763 unsigned fVerboseModeEnabled: 1;
1764 /** Set to disable color video. */
1765 unsigned fDisableColorVideo: 1;
1766 /** Flag whether int 40h is hooked. */
1767 unsigned fNotHookInt40h: 1;
1768 /** Reserved. */
1769 unsigned u3Reserved: 3;
1770 /** Reserved. */
1771 unsigned abReserved: 24;
1772 /** BIOS version. */
1773 uint32_t u32BIOSVersion;
1774 /** Adapter ordering. */
1775 MptConfigurationPageIOUnit2AdapterOrdering aAdapterOrder[4];
1776 } fields;
1777 } u;
1778} MptConfigurationPageIOUnit2, *PMptConfigurationPageIOUnit2;
1779#pragma pack()
1780AssertCompileSize(MptConfigurationPageIOUnit2, 28);
1781
1782/*
1783 * IO Unit page 3. - Read/Write.
1784 */
1785#pragma pack(1)
1786typedef struct MptConfigurationPageIOUnit3
1787{
1788 /** Union. */
1789 union
1790 {
1791 /** Byte view. */
1792 uint8_t abPageData[8];
1793 /** Field view. */
1794 struct
1795 {
1796 /** The omnipresent header. */
1797 MptConfigurationPageHeader Header;
1798 /** Number of GPIO values. */
1799 uint8_t u8GPIOCount;
1800 /** Reserved. */
1801 uint8_t abReserved[3];
1802 } fields;
1803 } u;
1804} MptConfigurationPageIOUnit3, *PMptConfigurationPageIOUnit3;
1805#pragma pack()
1806AssertCompileSize(MptConfigurationPageIOUnit3, 8);
1807
1808/*
1809 * IO Unit page 4. - Readonly for everyone except the BIOS.
1810 */
1811#pragma pack(1)
1812typedef struct MptConfigurationPageIOUnit4
1813{
1814 /** Union. */
1815 union
1816 {
1817 /** Byte view. */
1818 uint8_t abPageData[20];
1819 /** Field view. */
1820 struct
1821 {
1822 /** The omnipresent header. */
1823 MptConfigurationPageHeader Header;
1824 /** Reserved */
1825 uint32_t u32Reserved;
1826 /** SG entry describing the Firmware location. */
1827 MptSGEntrySimple64 FWImageSGE;
1828 } fields;
1829 } u;
1830} MptConfigurationPageIOUnit4, *PMptConfigurationPageIOUnit4;
1831#pragma pack()
1832AssertCompileSize(MptConfigurationPageIOUnit4, 20);
1833
1834/**
1835 * IOC page 0. - Readonly
1836 */
1837#pragma pack(1)
1838typedef struct MptConfigurationPageIOC0
1839{
1840 /** Union. */
1841 union
1842 {
1843 /** Byte view. */
1844 uint8_t abPageData[28];
1845 /** Field view. */
1846 struct
1847 {
1848 /** The omnipresent header. */
1849 MptConfigurationPageHeader Header;
1850 /** Total amount of NV memory in bytes. */
1851 uint32_t u32TotalNVStore;
1852 /** Number of free bytes in the NV store. */
1853 uint32_t u32FreeNVStore;
1854 /** PCI vendor ID. */
1855 uint16_t u16VendorId;
1856 /** PCI device ID. */
1857 uint16_t u16DeviceId;
1858 /** PCI revision ID. */
1859 uint8_t u8RevisionId;
1860 /** Reserved. */
1861 uint8_t abReserved[3];
1862 /** PCI class code. */
1863 uint32_t u32ClassCode;
1864 /** Subsystem vendor Id. */
1865 uint16_t u16SubsystemVendorId;
1866 /** Subsystem Id. */
1867 uint16_t u16SubsystemId;
1868 } fields;
1869 } u;
1870} MptConfigurationPageIOC0, *PMptConfigurationPageIOC0;
1871#pragma pack()
1872AssertCompileSize(MptConfigurationPageIOC0, 28);
1873
1874/**
1875 * IOC page 1. - Read/Write
1876 */
1877#pragma pack(1)
1878typedef struct MptConfigurationPageIOC1
1879{
1880 /** Union. */
1881 union
1882 {
1883 /** Byte view. */
1884 uint8_t abPageData[16];
1885 /** Field view. */
1886 struct
1887 {
1888 /** The omnipresent header. */
1889 MptConfigurationPageHeader Header;
1890 /** Flag whether reply coalescing is enabled. */
1891 unsigned fReplyCoalescingEnabled: 1;
1892 /** Reserved. */
1893 unsigned u31Reserved: 31;
1894 /** Coalescing Timeout in microseconds. */
1895 unsigned u32CoalescingTimeout: 32;
1896 /** Coalescing depth. */
1897 unsigned u8CoalescingDepth: 8;
1898 /** Reserved. */
1899 unsigned u8Reserved0: 8;
1900 unsigned u8Reserved1: 8;
1901 unsigned u8Reserved2: 8;
1902 } fields;
1903 } u;
1904} MptConfigurationPageIOC1, *PMptConfigurationPageIOC1;
1905#pragma pack()
1906AssertCompileSize(MptConfigurationPageIOC1, 16);
1907
1908/**
1909 * IOC page 2. - Readonly
1910 */
1911#pragma pack(1)
1912typedef struct MptConfigurationPageIOC2
1913{
1914 /** Union. */
1915 union
1916 {
1917 /** Byte view. */
1918 uint8_t abPageData[12];
1919 /** Field view. */
1920 struct
1921 {
1922 /** The omnipresent header. */
1923 MptConfigurationPageHeader Header;
1924 /** Flag whether striping is supported. */
1925 unsigned fStripingSupported: 1;
1926 /** Flag whether enhanced mirroring is supported. */
1927 unsigned fEnhancedMirroringSupported: 1;
1928 /** Flag whether mirroring is supported. */
1929 unsigned fMirroringSupported: 1;
1930 /** Reserved. */
1931 unsigned u26Reserved: 26;
1932 /** Flag whether SES is supported. */
1933 unsigned fSESSupported: 1;
1934 /** Flag whether SAF-TE is supported. */
1935 unsigned fSAFTESupported: 1;
1936 /** Flag whether cross channel volumes are supported. */
1937 unsigned fCrossChannelVolumesSupported: 1;
1938 /** Number of active integrated RAID volumes. */
1939 unsigned u8NumActiveVolumes: 8;
1940 /** Maximum number of integrated RAID volumes supported. */
1941 unsigned u8MaxVolumes: 8;
1942 /** Number of active integrated RAID physical disks. */
1943 unsigned u8NumActivePhysDisks: 8;
1944 /** Maximum number of integrated RAID physical disks supported. */
1945 unsigned u8MaxPhysDisks: 8;
1946 /** RAID volumes... - not supported. */
1947 } fields;
1948 } u;
1949} MptConfigurationPageIOC2, *PMptConfigurationPageIOC2;
1950#pragma pack()
1951AssertCompileSize(MptConfigurationPageIOC2, 12);
1952
1953/**
1954 * IOC page 3. - Readonly
1955 */
1956#pragma pack(1)
1957typedef struct MptConfigurationPageIOC3
1958{
1959 /** Union. */
1960 union
1961 {
1962 /** Byte view. */
1963 uint8_t abPageData[8];
1964 /** Field view. */
1965 struct
1966 {
1967 /** The omnipresent header. */
1968 MptConfigurationPageHeader Header;
1969 /** Number of active integrated RAID physical disks. */
1970 uint8_t u8NumPhysDisks;
1971 /** Reserved. */
1972 uint8_t abReserved[3];
1973 } fields;
1974 } u;
1975} MptConfigurationPageIOC3, *PMptConfigurationPageIOC3;
1976#pragma pack()
1977AssertCompileSize(MptConfigurationPageIOC3, 8);
1978
1979/**
1980 * IOC page 4. - Read/Write
1981 */
1982#pragma pack(1)
1983typedef struct MptConfigurationPageIOC4
1984{
1985 /** Union. */
1986 union
1987 {
1988 /** Byte view. */
1989 uint8_t abPageData[8];
1990 /** Field view. */
1991 struct
1992 {
1993 /** The omnipresent header. */
1994 MptConfigurationPageHeader Header;
1995 /** Number of SEP entries in this page. */
1996 uint8_t u8ActiveSEP;
1997 /** Maximum number of SEp entries supported. */
1998 uint8_t u8MaxSEP;
1999 /** Reserved. */
2000 uint16_t u16Reserved;
2001 /** SEP entries... - not supported. */
2002 } fields;
2003 } u;
2004} MptConfigurationPageIOC4, *PMptConfigurationPageIOC4;
2005#pragma pack()
2006AssertCompileSize(MptConfigurationPageIOC4, 8);
2007
2008/**
2009 * IOC page 6. - Read/Write
2010 */
2011#pragma pack(1)
2012typedef struct MptConfigurationPageIOC6
2013{
2014 /** Union. */
2015 union
2016 {
2017 /** Byte view. */
2018 uint8_t abPageData[60];
2019 /** Field view. */
2020 struct
2021 {
2022 /** The omnipresent header. */
2023 MptConfigurationPageHeader Header;
2024 uint32_t u32CapabilitiesFlags;
2025 uint8_t u8MaxDrivesIS;
2026 uint8_t u8MaxDrivesIM;
2027 uint8_t u8MaxDrivesIME;
2028 uint8_t u8Reserved1;
2029 uint8_t u8MinDrivesIS;
2030 uint8_t u8MinDrivesIM;
2031 uint8_t u8MinDrivesIME;
2032 uint8_t u8Reserved2;
2033 uint8_t u8MaxGlobalHotSpares;
2034 uint8_t u8Reserved3;
2035 uint16_t u16Reserved4;
2036 uint32_t u32Reserved5;
2037 uint32_t u32SupportedStripeSizeMapIS;
2038 uint32_t u32SupportedStripeSizeMapIME;
2039 uint32_t u32Reserved6;
2040 uint8_t u8MetadataSize;
2041 uint8_t u8Reserved7;
2042 uint16_t u16Reserved8;
2043 uint16_t u16MaxBadBlockTableEntries;
2044 uint16_t u16Reserved9;
2045 uint16_t u16IRNvsramUsage;
2046 uint16_t u16Reserved10;
2047 uint32_t u32IRNvsramVersion;
2048 uint32_t u32Reserved11;
2049 } fields;
2050 } u;
2051} MptConfigurationPageIOC6, *PMptConfigurationPageIOC6;
2052#pragma pack()
2053AssertCompileSize(MptConfigurationPageIOC6, 60);
2054
2055/**
2056 * BIOS page 1 - Read/write.
2057 */
2058#pragma pack(1)
2059typedef struct MptConfigurationPageBIOS1
2060{
2061 /** Union. */
2062 union
2063 {
2064 /** Byte view. */
2065 uint8_t abPageData[48];
2066 /** Field view. */
2067 struct
2068 {
2069 /** The omnipresent header. */
2070 MptConfigurationPageHeader Header;
2071 /** BIOS options */
2072 uint32_t u32BiosOptions;
2073 /** IOC settings */
2074 uint32_t u32IOCSettings;
2075 /** Reserved */
2076 uint32_t u32Reserved;
2077 /** Device settings */
2078 uint32_t u32DeviceSettings;
2079 /** Number of devices */
2080 uint16_t u16NumberOfDevices;
2081 /** Expander spinup */
2082 uint8_t u8ExpanderSpinup;
2083 /** Reserved */
2084 uint8_t u8Reserved;
2085 /** I/O timeout of block devices without removable media */
2086 uint16_t u16IOTimeoutBlockDevicesNonRM;
2087 /** I/O timeout sequential */
2088 uint16_t u16IOTimeoutSequential;
2089 /** I/O timeout other */
2090 uint16_t u16IOTimeoutOther;
2091 /** I/O timeout of block devices with removable media */
2092 uint16_t u16IOTimeoutBlockDevicesRM;
2093 } fields;
2094 } u;
2095} MptConfigurationPageBIOS1, *PMptConfigurationPageBIOS1;
2096#pragma pack()
2097AssertCompileSize(MptConfigurationPageBIOS1, 48);
2098
2099#define LSILOGICSCSI_BIOS1_BIOSOPTIONS_BIOS_DISABLE RT_BIT(0)
2100#define LSILOGICSCSI_BIOS1_BIOSOPTIONS_SCAN_FROM_HIGH_TO_LOW RT_BIT(1)
2101#define LSILOGICSCSI_BIOS1_BIOSOPTIONS_BIOS_EXTENDED_SAS_SUPPORT RT_BIT(8)
2102#define LSILOGICSCSI_BIOS1_BIOSOPTIONS_BIOS_EXTENDED_FC_SUPPORT RT_BIT(9)
2103#define LSILOGICSCSI_BIOS1_BIOSOPTIONS_BIOS_EXTENDED_SPI_SUPPORT RT_BIT(10)
2104
2105#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ALTERNATE_CHS RT_BIT(3)
2106
2107#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ADAPTER_SUPPORT_SET(x) ((x) << 4)
2108#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ADAPTER_SUPPORT_DISABLED 0x00
2109#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ADAPTER_SUPPORT_BIOS_ONLY 0x01
2110#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ADAPTER_SUPPORT_OS_ONLY 0x02
2111#define LSILOGICSCSI_BIOS1_IOCSETTINGS_ADAPTER_SUPPORT_BOT 0x03
2112
2113#define LSILOGICSCSI_BIOS1_IOCSETTINGS_REMOVABLE_MEDIA_SET(x) ((x) << 6)
2114#define LSILOGICSCSI_BIOS1_IOCSETTINGS_REMOVABLE_MEDIA_NO_INT13H 0x00
2115#define LSILOGICSCSI_BIOS1_IOCSETTINGS_REMOVABLE_BOOT_MEDIA_INT13H 0x01
2116#define LSILOGICSCSI_BIOS1_IOCSETTINGS_REMOVABLE_MEDIA_INT13H 0x02
2117
2118#define LSILOGICSCSI_BIOS1_IOCSETTINGS_SPINUP_DELAY_SET(x) ((x & 0xF) << 8)
2119#define LSILOGICSCSI_BIOS1_IOCSETTINGS_SPINUP_DELAY_GET(x) ((x >> 8) & 0x0F)
2120#define LSILOGICSCSI_BIOS1_IOCSETTINGS_MAX_TARGET_SPINUP_SET(x) ((x & 0xF) << 12)
2121#define LSILOGICSCSI_BIOS1_IOCSETTINGS_MAX_TARGET_SPINUP_GET(x) ((x >> 12) & 0x0F)
2122
2123#define LSILOGICSCSI_BIOS1_IOCSETTINGS_BOOT_PREFERENCE_SET(x) (((x) & 0x3) << 16)
2124#define LSILOGICSCSI_BIOS1_IOCSETTINGS_BOOT_PREFERENCE_ENCLOSURE 0x0
2125#define LSILOGICSCSI_BIOS1_IOCSETTINGS_BOOT_PREFERENCE_SAS_ADDRESS 0x1
2126
2127#define LSILOGICSCSI_BIOS1_IOCSETTINGS_DIRECT_ATTACH_SPINUP_MODE_ALL RT_BIT(18)
2128#define LSILOGICSCSI_BIOS1_IOCSETTINGS_AUTO_PORT_ENABLE RT_BIT(19)
2129
2130#define LSILOGICSCSI_BIOS1_IOCSETTINGS_PORT_ENABLE_REPLY_DELAY_SET(x) (((x) & 0xF) << 20)
2131#define LSILOGICSCSI_BIOS1_IOCSETTINGS_PORT_ENABLE_REPLY_DELAY_GET(x) ((x >> 20) & 0x0F)
2132
2133#define LSILOGICSCSI_BIOS1_IOCSETTINGS_PORT_ENABLE_SPINUP_DELAY_SET(x) (((x) & 0xF) << 24)
2134#define LSILOGICSCSI_BIOS1_IOCSETTINGS_PORT_ENABLE_SPINUP_DELAY_GET(x) ((x >> 24) & 0x0F)
2135
2136#define LSILOGICSCSI_BIOS1_DEVICESETTINGS_DISABLE_LUN_SCANS RT_BIT(0)
2137#define LSILOGICSCSI_BIOS1_DEVICESETTINGS_DISABLE_LUN_SCANS_FOR_NON_REMOVABLE_DEVICES RT_BIT(1)
2138#define LSILOGICSCSI_BIOS1_DEVICESETTINGS_DISABLE_LUN_SCANS_FOR_REMOVABLE_DEVICES RT_BIT(2)
2139#define LSILOGICSCSI_BIOS1_DEVICESETTINGS_DISABLE_LUN_SCANS2 RT_BIT(3)
2140#define LSILOGICSCSI_BIOS1_DEVICESETTINGS_DISABLE_SMART_POLLING RT_BIT(4)
2141
2142#define LSILOGICSCSI_BIOS1_EXPANDERSPINUP_SPINUP_DELAY_SET(x) ((x) & 0x0F)
2143#define LSILOGICSCSI_BIOS1_EXPANDERSPINUP_SPINUP_DELAY_GET(x) ((x) & 0x0F)
2144#define LSILOGICSCSI_BIOS1_EXPANDERSPINUP_MAX_SPINUP_DELAY_SET(x) (((x) & 0x0F) << 4)
2145#define LSILOGICSCSI_BIOS1_EXPANDERSPINUP_MAX_SPINUP_DELAY_GET(x) ((x >> 4) & 0x0F)
2146
2147/**
2148 * BIOS page 2 - Read/write.
2149 */
2150#pragma pack(1)
2151typedef struct MptConfigurationPageBIOS2
2152{
2153 /** Union. */
2154 union
2155 {
2156 /** Byte view. */
2157 uint8_t abPageData[384];
2158 /** Field view. */
2159 struct
2160 {
2161 /** The omnipresent header. */
2162 MptConfigurationPageHeader Header;
2163 /** Reserved */
2164 uint32_t au32Reserved[6];
2165 /** Format of the boot device field. */
2166 uint8_t u8BootDeviceForm;
2167 /** Previous format of the boot device field. */
2168 uint8_t u8PrevBootDeviceForm;
2169 /** Reserved */
2170 uint16_t u16Reserved;
2171 /** Boot device fields - dependent on the format */
2172 union
2173 {
2174 /** Device for AdapterNumber:Bus:Target:LUN */
2175 struct
2176 {
2177 /** Target ID */
2178 uint8_t u8TargetID;
2179 /** Bus */
2180 uint8_t u8Bus;
2181 /** Adapter Number */
2182 uint8_t u8AdapterNumber;
2183 /** Reserved */
2184 uint8_t u8Reserved;
2185 /** Reserved */
2186 uint32_t au32Reserved[3];
2187 /** LUN */
2188 uint32_t aLUN[5];
2189 /** Reserved */
2190 uint32_t au32Reserved2[56];
2191 } AdapterNumberBusTargetLUN;
2192 /** Device for PCIAddress:Bus:Target:LUN */
2193 struct
2194 {
2195 /** Target ID */
2196 uint8_t u8TargetID;
2197 /** Bus */
2198 uint8_t u8Bus;
2199 /** Adapter Number */
2200 uint16_t u16PCIAddress;
2201 /** Reserved */
2202 uint32_t au32Reserved[3];
2203 /** LUN */
2204 uint32_t aLUN[5];
2205 /** Reserved */
2206 uint32_t au32Reserved2[56];
2207 } PCIAddressBusTargetLUN;
2208 /** Device for PCISlotNo:Bus:Target:LUN */
2209 struct
2210 {
2211 /** Target ID */
2212 uint8_t u8TargetID;
2213 /** Bus */
2214 uint8_t u8Bus;
2215 /** PCI Slot Number */
2216 uint8_t u16PCISlotNo;
2217 /** Reserved */
2218 uint32_t au32Reserved[3];
2219 /** LUN */
2220 uint32_t aLUN[5];
2221 /** Reserved */
2222 uint32_t au32Reserved2[56];
2223 } PCIAddressBusSlotLUN;
2224 /** Device for FC channel world wide name */
2225 struct
2226 {
2227 /** World wide port name low */
2228 uint32_t u32WorldWidePortNameLow;
2229 /** World wide port name high */
2230 uint32_t u32WorldWidePortNameHigh;
2231 /** Reserved */
2232 uint32_t au32Reserved[3];
2233 /** LUN */
2234 uint32_t aLUN[5];
2235 /** Reserved */
2236 uint32_t au32Reserved2[56];
2237 } FCWorldWideName;
2238 /** Device for FC channel world wide name */
2239 struct
2240 {
2241 /** SAS address */
2242 SASADDRESS SASAddress;
2243 /** Reserved */
2244 uint32_t au32Reserved[3];
2245 /** LUN */
2246 uint32_t aLUN[5];
2247 /** Reserved */
2248 uint32_t au32Reserved2[56];
2249 } SASWorldWideName;
2250 /** Device for Enclosure/Slot */
2251 struct
2252 {
2253 /** Enclosure logical ID */
2254 uint64_t u64EnclosureLogicalID;
2255 /** Reserved */
2256 uint32_t au32Reserved[3];
2257 /** LUN */
2258 uint32_t aLUN[5];
2259 /** Reserved */
2260 uint32_t au32Reserved2[56];
2261 } EnclosureSlot;
2262 } BootDevice;
2263 } fields;
2264 } u;
2265} MptConfigurationPageBIOS2, *PMptConfigurationPageBIOS2;
2266#pragma pack()
2267AssertCompileSize(MptConfigurationPageBIOS2, 384);
2268
2269#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_SET(x) ((x) & 0x0F)
2270#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_FIRST 0x0
2271#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_ADAPTER_BUS_TARGET_LUN 0x1
2272#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_PCIADDR_BUS_TARGET_LUN 0x2
2273#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_PCISLOT_BUS_TARGET_LUN 0x3
2274#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_FC_WWN 0x4
2275#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_SAS_WWN 0x5
2276#define LSILOGICSCSI_BIOS2_BOOT_DEVICE_FORM_ENCLOSURE_SLOT 0x6
2277
2278/**
2279 * BIOS page 4 - Read/Write (Where is 3? - not defined in the spec)
2280 */
2281#pragma pack(1)
2282typedef struct MptConfigurationPageBIOS4
2283{
2284 /** Union. */
2285 union
2286 {
2287 /** Byte view. */
2288 uint8_t abPageData[12];
2289 /** Field view. */
2290 struct
2291 {
2292 /** The omnipresent header. */
2293 MptConfigurationPageHeader Header;
2294 /** Reassignment Base WWID */
2295 uint64_t u64ReassignmentBaseWWID;
2296 } fields;
2297 } u;
2298} MptConfigurationPageBIOS4, *PMptConfigurationPageBIOS4;
2299#pragma pack()
2300AssertCompileSize(MptConfigurationPageBIOS4, 12);
2301
2302/**
2303 * SCSI-SPI port page 0. - Readonly
2304 */
2305#pragma pack(1)
2306typedef struct MptConfigurationPageSCSISPIPort0
2307{
2308 /** Union. */
2309 union
2310 {
2311 /** Byte view. */
2312 uint8_t abPageData[12];
2313 /** Field view. */
2314 struct
2315 {
2316 /** The omnipresent header. */
2317 MptConfigurationPageHeader Header;
2318 /** Flag whether this port is information unit transfers capable. */
2319 unsigned fInformationUnitTransfersCapable: 1;
2320 /** Flag whether the port is DT (Dual Transfer) capable. */
2321 unsigned fDTCapable: 1;
2322 /** Flag whether the port is QAS (Quick Arbitrate and Select) capable. */
2323 unsigned fQASCapable: 1;
2324 /** Reserved. */
2325 unsigned u5Reserved1: 5;
2326 /** Minimum Synchronous transfer period. */
2327 unsigned u8MinimumSynchronousTransferPeriod: 8;
2328 /** Maximum synchronous offset. */
2329 unsigned u8MaximumSynchronousOffset: 8;
2330 /** Reserved. */
2331 unsigned u5Reserved2: 5;
2332 /** Flag whether indicating the width of the bus - 0 narrow and 1 for wide. */
2333 unsigned fWide: 1;
2334 /** Reserved */
2335 unsigned fReserved: 1;
2336 /** Flag whether the port is AIP (Asynchronous Information Protection) capable. */
2337 unsigned fAIPCapable: 1;
2338 /** Signaling Type. */
2339 unsigned u2SignalingType: 2;
2340 /** Reserved. */
2341 unsigned u30Reserved: 30;
2342 } fields;
2343 } u;
2344} MptConfigurationPageSCSISPIPort0, *PMptConfigurationPageSCSISPIPort0;
2345#pragma pack()
2346AssertCompileSize(MptConfigurationPageSCSISPIPort0, 12);
2347
2348/**
2349 * SCSI-SPI port page 1. - Read/Write
2350 */
2351#pragma pack(1)
2352typedef struct MptConfigurationPageSCSISPIPort1
2353{
2354 /** Union. */
2355 union
2356 {
2357 /** Byte view. */
2358 uint8_t abPageData[12];
2359 /** Field view. */
2360 struct
2361 {
2362 /** The omnipresent header. */
2363 MptConfigurationPageHeader Header;
2364 /** The SCSI ID of the port. */
2365 uint8_t u8SCSIID;
2366 /** Reserved. */
2367 uint8_t u8Reserved;
2368 /** Port response IDs Bit mask field. */
2369 uint16_t u16PortResponseIDsBitmask;
2370 /** Value for the on BUS timer. */
2371 uint32_t u32OnBusTimerValue;
2372 } fields;
2373 } u;
2374} MptConfigurationPageSCSISPIPort1, *PMptConfigurationPageSCSISPIPort1;
2375#pragma pack()
2376AssertCompileSize(MptConfigurationPageSCSISPIPort1, 12);
2377
2378/**
2379 * Device settings for one device.
2380 */
2381#pragma pack(1)
2382typedef struct MptDeviceSettings
2383{
2384 /** Timeout for I/O in seconds. */
2385 unsigned u8Timeout: 8;
2386 /** Minimum synchronous factor. */
2387 unsigned u8SyncFactor: 8;
2388 /** Flag whether disconnect is enabled. */
2389 unsigned fDisconnectEnable: 1;
2390 /** Flag whether Scan ID is enabled. */
2391 unsigned fScanIDEnable: 1;
2392 /** Flag whether Scan LUNs is enabled. */
2393 unsigned fScanLUNEnable: 1;
2394 /** Flag whether tagged queuing is enabled. */
2395 unsigned fTaggedQueuingEnabled: 1;
2396 /** Flag whether wide is enabled. */
2397 unsigned fWideDisable: 1;
2398 /** Flag whether this device is bootable. */
2399 unsigned fBootChoice: 1;
2400 /** Reserved. */
2401 unsigned u10Reserved: 10;
2402} MptDeviceSettings, *PMptDeviceSettings;
2403#pragma pack()
2404AssertCompileSize(MptDeviceSettings, 4);
2405
2406/**
2407 * SCSI-SPI port page 2. - Read/Write for the BIOS
2408 */
2409#pragma pack(1)
2410typedef struct MptConfigurationPageSCSISPIPort2
2411{
2412 /** Union. */
2413 union
2414 {
2415 /** Byte view. */
2416 uint8_t abPageData[76];
2417 /** Field view. */
2418 struct
2419 {
2420 /** The omnipresent header. */
2421 MptConfigurationPageHeader Header;
2422 /** Flag indicating the bus scan order. */
2423 unsigned fBusScanOrderHighToLow: 1;
2424 /** Reserved. */
2425 unsigned fReserved: 1;
2426 /** Flag whether SCSI Bus resets are avoided. */
2427 unsigned fAvoidSCSIBusResets: 1;
2428 /** Flag whether alternate CHS is used. */
2429 unsigned fAlternateCHS: 1;
2430 /** Flag whether termination is disabled. */
2431 unsigned fTerminationDisabled: 1;
2432 /** Reserved. */
2433 unsigned u27Reserved: 27;
2434 /** Host SCSI ID. */
2435 unsigned u4HostSCSIID: 4;
2436 /** Initialize HBA. */
2437 unsigned u2InitializeHBA: 2;
2438 /** Removeable media setting. */
2439 unsigned u2RemovableMediaSetting: 2;
2440 /** Spinup delay. */
2441 unsigned u4SpinupDelay: 4;
2442 /** Negotiating settings. */
2443 unsigned u2NegotitatingSettings: 2;
2444 /** Reserved. */
2445 unsigned u18Reserved: 18;
2446 /** Device Settings. */
2447 MptDeviceSettings aDeviceSettings[16];
2448 } fields;
2449 } u;
2450} MptConfigurationPageSCSISPIPort2, *PMptConfigurationPageSCSISPIPort2;
2451#pragma pack()
2452AssertCompileSize(MptConfigurationPageSCSISPIPort2, 76);
2453
2454/**
2455 * SCSI-SPI device page 0. - Readonly
2456 */
2457#pragma pack(1)
2458typedef struct MptConfigurationPageSCSISPIDevice0
2459{
2460 /** Union. */
2461 union
2462 {
2463 /** Byte view. */
2464 uint8_t abPageData[12];
2465 /** Field view. */
2466 struct
2467 {
2468 /** The omnipresent header. */
2469 MptConfigurationPageHeader Header;
2470 /** Negotiated Parameters. */
2471 /** Information Units enabled. */
2472 unsigned fInformationUnitsEnabled: 1;
2473 /** Dual Transfers Enabled. */
2474 unsigned fDTEnabled: 1;
2475 /** QAS enabled. */
2476 unsigned fQASEnabled: 1;
2477 /** Reserved. */
2478 unsigned u5Reserved1: 5;
2479 /** Synchronous Transfer period. */
2480 unsigned u8NegotiatedSynchronousTransferPeriod: 8;
2481 /** Synchronous offset. */
2482 unsigned u8NegotiatedSynchronousOffset: 8;
2483 /** Reserved. */
2484 unsigned u5Reserved2: 5;
2485 /** Width - 0 for narrow and 1 for wide. */
2486 unsigned fWide: 1;
2487 /** Reserved. */
2488 unsigned fReserved: 1;
2489 /** AIP enabled. */
2490 unsigned fAIPEnabled: 1;
2491 /** Flag whether negotiation occurred. */
2492 unsigned fNegotationOccured: 1;
2493 /** Flag whether a SDTR message was rejected. */
2494 unsigned fSDTRRejected: 1;
2495 /** Flag whether a WDTR message was rejected. */
2496 unsigned fWDTRRejected: 1;
2497 /** Flag whether a PPR message was rejected. */
2498 unsigned fPPRRejected: 1;
2499 /** Reserved. */
2500 unsigned u28Reserved: 28;
2501 } fields;
2502 } u;
2503} MptConfigurationPageSCSISPIDevice0, *PMptConfigurationPageSCSISPIDevice0;
2504#pragma pack()
2505AssertCompileSize(MptConfigurationPageSCSISPIDevice0, 12);
2506
2507/**
2508 * SCSI-SPI device page 1. - Read/Write
2509 */
2510#pragma pack(1)
2511typedef struct MptConfigurationPageSCSISPIDevice1
2512{
2513 /** Union. */
2514 union
2515 {
2516 /** Byte view. */
2517 uint8_t abPageData[16];
2518 /** Field view. */
2519 struct
2520 {
2521 /** The omnipresent header. */
2522 MptConfigurationPageHeader Header;
2523 /** Requested Parameters. */
2524 /** Information Units enable. */
2525 bool fInformationUnitsEnable: 1;
2526 /** Dual Transfers Enable. */
2527 bool fDTEnable: 1;
2528 /** QAS enable. */
2529 bool fQASEnable: 1;
2530 /** Reserved. */
2531 unsigned u5Reserved1: 5;
2532 /** Synchronous Transfer period. */
2533 unsigned u8NegotiatedSynchronousTransferPeriod: 8;
2534 /** Synchronous offset. */
2535 unsigned u8NegotiatedSynchronousOffset: 8;
2536 /** Reserved. */
2537 unsigned u5Reserved2: 5;
2538 /** Width - 0 for narrow and 1 for wide. */
2539 bool fWide: 1;
2540 /** Reserved. */
2541 bool fReserved1: 1;
2542 /** AIP enable. */
2543 bool fAIPEnable: 1;
2544 /** Reserved. */
2545 bool fReserved2: 1;
2546 /** WDTR disallowed. */
2547 bool fWDTRDisallowed: 1;
2548 /** SDTR disallowed. */
2549 bool fSDTRDisallowed: 1;
2550 /** Reserved. */
2551 unsigned u29Reserved: 29;
2552 } fields;
2553 } u;
2554} MptConfigurationPageSCSISPIDevice1, *PMptConfigurationPageSCSISPIDevice1;
2555#pragma pack()
2556AssertCompileSize(MptConfigurationPageSCSISPIDevice1, 16);
2557
2558/**
2559 * SCSI-SPI device page 2. - Read/Write
2560 */
2561#pragma pack(1)
2562typedef struct MptConfigurationPageSCSISPIDevice2
2563{
2564 /** Union. */
2565 union
2566 {
2567 /** Byte view. */
2568 uint8_t abPageData[16];
2569 /** Field view. */
2570 struct
2571 {
2572 /** The omnipresent header. */
2573 MptConfigurationPageHeader Header;
2574 /** Reserved. */
2575 unsigned u4Reserved: 4;
2576 /** ISI enable. */
2577 unsigned fISIEnable: 1;
2578 /** Secondary driver enable. */
2579 unsigned fSecondaryDriverEnable: 1;
2580 /** Reserved. */
2581 unsigned fReserved: 1;
2582 /** Slew create controller. */
2583 unsigned u3SlewRateControler: 3;
2584 /** Primary drive strength controller. */
2585 unsigned u3PrimaryDriveStrengthControl: 3;
2586 /** Secondary drive strength controller. */
2587 unsigned u3SecondaryDriveStrengthControl: 3;
2588 /** Reserved. */
2589 unsigned u12Reserved: 12;
2590 /** XCLKH_ST. */
2591 unsigned fXCLKH_ST: 1;
2592 /** XCLKS_ST. */
2593 unsigned fXCLKS_ST: 1;
2594 /** XCLKH_DT. */
2595 unsigned fXCLKH_DT: 1;
2596 /** XCLKS_DT. */
2597 unsigned fXCLKS_DT: 1;
2598 /** Parity pipe select. */
2599 unsigned u2ParityPipeSelect: 2;
2600 /** Reserved. */
2601 unsigned u30Reserved: 30;
2602 /** Data bit pipeline select. */
2603 unsigned u32DataPipelineSelect: 32;
2604 } fields;
2605 } u;
2606} MptConfigurationPageSCSISPIDevice2, *PMptConfigurationPageSCSISPIDevice2;
2607#pragma pack()
2608AssertCompileSize(MptConfigurationPageSCSISPIDevice2, 16);
2609
2610/**
2611 * SCSI-SPI device page 3 (Revision G). - Readonly
2612 */
2613#pragma pack(1)
2614typedef struct MptConfigurationPageSCSISPIDevice3
2615{
2616 /** Union. */
2617 union
2618 {
2619 /** Byte view. */
2620 uint8_t abPageData[1];
2621 /** Field view. */
2622 struct
2623 {
2624 /** The omnipresent header. */
2625 MptConfigurationPageHeader Header;
2626 /** Number of times the IOC rejected a message because it doesn't support the operation. */
2627 uint16_t u16MsgRejectCount;
2628 /** Number of times the SCSI bus entered an invalid operation state. */
2629 uint16_t u16PhaseErrorCount;
2630 /** Number of parity errors. */
2631 uint16_t u16ParityCount;
2632 /** Reserved. */
2633 uint16_t u16Reserved;
2634 } fields;
2635 } u;
2636} MptConfigurationPageSCSISPIDevice3, *PMptConfigurationPageSCSISPIDevice3;
2637#pragma pack()
2638AssertCompileSize(MptConfigurationPageSCSISPIDevice3, 12);
2639
2640/**
2641 * PHY entry for the SAS I/O unit page 0
2642 */
2643#pragma pack(1)
2644typedef struct MptConfigurationPageSASIOUnit0PHY
2645{
2646 /** Port number */
2647 uint8_t u8Port;
2648 /** Port flags */
2649 uint8_t u8PortFlags;
2650 /** Phy flags */
2651 uint8_t u8PhyFlags;
2652 /** negotiated link rate */
2653 uint8_t u8NegotiatedLinkRate;
2654 /** Controller phy device info */
2655 uint32_t u32ControllerPhyDeviceInfo;
2656 /** Attached device handle */
2657 uint16_t u16AttachedDevHandle;
2658 /** Controller device handle */
2659 uint16_t u16ControllerDevHandle;
2660 /** Discovery status */
2661 uint32_t u32DiscoveryStatus;
2662} MptConfigurationPageSASIOUnit0PHY, *PMptConfigurationPageSASIOUnit0PHY;
2663#pragma pack()
2664AssertCompileSize(MptConfigurationPageSASIOUnit0PHY, 16);
2665
2666/**
2667 * SAS I/O Unit page 0 - Readonly
2668 */
2669#pragma pack(1)
2670typedef struct MptConfigurationPageSASIOUnit0
2671{
2672 /** Union. */
2673 union
2674 {
2675 /** Byte view - variable. */
2676 uint8_t abPageData[1];
2677 /** Field view. */
2678 struct
2679 {
2680 /** The omnipresent header. */
2681 MptExtendedConfigurationPageHeader ExtHeader;
2682 /** Nvdata version default */
2683 uint16_t u16NvdataVersionDefault;
2684 /** Nvdata version persistent */
2685 uint16_t u16NvdataVersionPersistent;
2686 /** Number of physical ports */
2687 uint8_t u8NumPhys;
2688 /** Reserved */
2689 uint8_t au8Reserved[3];
2690 /** Content for each physical port - variable depending on the amount of ports. */
2691 MptConfigurationPageSASIOUnit0PHY aPHY[1];
2692 } fields;
2693 } u;
2694} MptConfigurationPageSASIOUnit0, *PMptConfigurationPageSASIOUnit0;
2695#pragma pack()
2696AssertCompileSize(MptConfigurationPageSASIOUnit0, 8+2+2+1+3+sizeof(MptConfigurationPageSASIOUnit0PHY));
2697
2698#define LSILOGICSCSI_SASIOUNIT0_GET_SIZE(ports) (sizeof(MptConfigurationPageSASIOUnit0) + ((ports) - 1) * sizeof(MptConfigurationPageSASIOUnit0PHY))
2699
2700#define LSILOGICSCSI_SASIOUNIT0_PORT_CONFIGURATION_AUTO RT_BIT(0)
2701#define LSILOGICSCSI_SASIOUNIT0_PORT_TARGET_IOC RT_BIT(2)
2702#define LSILOGICSCSI_SASIOUNIT0_PORT_DISCOVERY_IN_STATUS RT_BIT(3)
2703
2704#define LSILOGICSCSI_SASIOUNIT0_PHY_RX_INVERTED RT_BIT(0)
2705#define LSILOGICSCSI_SASIOUNIT0_PHY_TX_INVERTED RT_BIT(1)
2706#define LSILOGICSCSI_SASIOUNIT0_PHY_DISABLED RT_BIT(2)
2707
2708#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_SET(x) ((x) & 0x0F)
2709#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_GET(x) ((x) & 0x0F)
2710#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_UNKNOWN 0x00
2711#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_DISABLED 0x01
2712#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_FAILED 0x02
2713#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_SATA_OOB 0x03
2714#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_15GB 0x08
2715#define LSILOGICSCSI_SASIOUNIT0_NEGOTIATED_RATE_30GB 0x09
2716
2717#define LSILOGICSCSI_SASIOUNIT0_DEVICE_TYPE_SET(x) ((x) & 0x3)
2718#define LSILOGICSCSI_SASIOUNIT0_DEVICE_TYPE_NO 0x0
2719#define LSILOGICSCSI_SASIOUNIT0_DEVICE_TYPE_END 0x1
2720#define LSILOGICSCSI_SASIOUNIT0_DEVICE_TYPE_EDGE_EXPANDER 0x2
2721#define LSILOGICSCSI_SASIOUNIT0_DEVICE_TYPE_FANOUT_EXPANDER 0x3
2722
2723#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SATA_HOST RT_BIT(3)
2724#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SMP_INITIATOR RT_BIT(4)
2725#define LSILOGICSCSI_SASIOUNIT0_DEVICE_STP_INITIATOR RT_BIT(5)
2726#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SSP_INITIATOR RT_BIT(6)
2727#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SATA RT_BIT(7)
2728#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SMP_TARGET RT_BIT(8)
2729#define LSILOGICSCSI_SASIOUNIT0_DEVICE_STP_TARGET RT_BIT(9)
2730#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SSP_TARGET RT_BIT(10)
2731#define LSILOGICSCSI_SASIOUNIT0_DEVICE_DIRECT_ATTACHED RT_BIT(11)
2732#define LSILOGICSCSI_SASIOUNIT0_DEVICE_LSI RT_BIT(12)
2733#define LSILOGICSCSI_SASIOUNIT0_DEVICE_ATAPI_DEVICE RT_BIT(13)
2734#define LSILOGICSCSI_SASIOUNIT0_DEVICE_SEP_DEVICE RT_BIT(14)
2735
2736#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_LOOP RT_BIT(0)
2737#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_UNADDRESSABLE RT_BIT(1)
2738#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_SAME_SAS_ADDR RT_BIT(2)
2739#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_EXPANDER_ERROR RT_BIT(3)
2740#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_SMP_TIMEOUT RT_BIT(4)
2741#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_EXP_ROUTE_OOE RT_BIT(5)
2742#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_EXP_ROUTE_IDX RT_BIT(6)
2743#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_SMP_FUNC_FAILED RT_BIT(7)
2744#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_SMP_CRC_ERROR RT_BIT(8)
2745#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_SUBTRSCTIVE_LNK RT_BIT(9)
2746#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_TBL_LNK RT_BIT(10)
2747#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_UNSUPPORTED_DEV RT_BIT(11)
2748#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_MAX_SATA_TGTS RT_BIT(12)
2749#define LSILOGICSCSI_SASIOUNIT0_DISCOVERY_STATUS_MULT_CTRLS RT_BIT(13)
2750
2751/**
2752 * PHY entry for the SAS I/O unit page 1
2753 */
2754#pragma pack(1)
2755typedef struct MptConfigurationPageSASIOUnit1PHY
2756{
2757 /** Port number */
2758 uint8_t u8Port;
2759 /** Port flags */
2760 uint8_t u8PortFlags;
2761 /** Phy flags */
2762 uint8_t u8PhyFlags;
2763 /** Max link rate */
2764 uint8_t u8MaxMinLinkRate;
2765 /** Controller phy device info */
2766 uint32_t u32ControllerPhyDeviceInfo;
2767 /** Maximum target port connect time */
2768 uint16_t u16MaxTargetPortConnectTime;
2769 /** Reserved */
2770 uint16_t u16Reserved;
2771} MptConfigurationPageSASIOUnit1PHY, *PMptConfigurationPageSASIOUnit1PHY;
2772#pragma pack()
2773AssertCompileSize(MptConfigurationPageSASIOUnit1PHY, 12);
2774
2775/**
2776 * SAS I/O Unit page 1 - Read/Write
2777 */
2778#pragma pack(1)
2779typedef struct MptConfigurationPageSASIOUnit1
2780{
2781 /** Union. */
2782 union
2783 {
2784 /** Byte view - variable. */
2785 uint8_t abPageData[1];
2786 /** Field view. */
2787 struct
2788 {
2789 /** The omnipresent header. */
2790 MptExtendedConfigurationPageHeader ExtHeader;
2791 /** Control flags */
2792 uint16_t u16ControlFlags;
2793 /** maximum number of SATA targets */
2794 uint16_t u16MaxNumSATATargets;
2795 /** additional control flags */
2796 uint16_t u16AdditionalControlFlags;
2797 /** Reserved */
2798 uint16_t u16Reserved;
2799 /** Number of PHYs */
2800 uint8_t u8NumPhys;
2801 /** maximum SATA queue depth */
2802 uint8_t u8SATAMaxQDepth;
2803 /** Delay for reporting missing devices. */
2804 uint8_t u8ReportDeviceMissingDelay;
2805 /** I/O device missing delay */
2806 uint8_t u8IODeviceMissingDelay;
2807 /** Content for each physical port - variable depending on the number of ports */
2808 MptConfigurationPageSASIOUnit1PHY aPHY[1];
2809 } fields;
2810 } u;
2811} MptConfigurationPageSASIOUnit1, *PMptConfigurationPageSASIOUnit1;
2812#pragma pack()
2813AssertCompileSize(MptConfigurationPageSASIOUnit1, 8+12+sizeof(MptConfigurationPageSASIOUnit1PHY));
2814
2815#define LSILOGICSCSI_SASIOUNIT1_GET_SIZE(ports) (sizeof(MptConfigurationPageSASIOUnit1) + ((ports) - 1) * sizeof(MptConfigurationPageSASIOUnit1PHY))
2816
2817#define LSILOGICSCSI_SASIOUNIT1_CONTROL_CLEAR_SATA_AFFILIATION RT_BIT(0)
2818#define LSILOGICSCSI_SASIOUNIT1_CONTROL_FIRST_LEVEL_DISCOVERY_ONLY RT_BIT(1)
2819#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SUBTRACTIVE_LNK_ILLEGAL RT_BIT(2)
2820#define LSILOGICSCSI_SASIOUNIT1_CONTROL_IOC_ENABLE_HIGH_PHY RT_BIT(3)
2821#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_FUA_REQUIRED RT_BIT(4)
2822#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_NCQ_REQUIRED RT_BIT(5)
2823#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_SMART_REQUIRED RT_BIT(6)
2824#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_LBA48_REQUIRED RT_BIT(7)
2825#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_INIT_POSTPONED RT_BIT(8)
2826
2827#define LSILOGICSCSI_SASIOUNIT1_CONTROL_DEVICE_SUPPORT_SET(x) (((x) & 0x3) << 9)
2828#define LSILOGICSCSI_SASIOUNIT1_CONTROL_DEVICE_SUPPORT_GET(x) (((x) >> 9) & 0x3)
2829#define LSILOGICSCSI_SASIOUNIT1_CONTROL_DEVICE_SUPPORT_SAS_AND_SATA 0x00
2830#define LSILOGICSCSI_SASIOUNIT1_CONTROL_DEVICE_SUPPORT_SAS 0x01
2831#define LSILOGICSCSI_SASIOUNIT1_CONTROL_DEVICE_SUPPORT_SATA 0x02
2832
2833#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_EXP_ADDR RT_BIT(11)
2834#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_SETTINGS_PRESERV_REQUIRED RT_BIT(12)
2835#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_LIMIT_RATE_15GB RT_BIT(13)
2836#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SATA_LIMIT_RATE_30GB RT_BIT(14)
2837#define LSILOGICSCSI_SASIOUNIT1_CONTROL_SAS_SELF_TEST_ENABLED RT_BIT(15)
2838
2839#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_TBL_LNKS_ALLOW RT_BIT(0)
2840#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_SATA_RST_NO_AFFIL RT_BIT(1)
2841#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_SATA_RST_SELF_AFFIL RT_BIT(2)
2842#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_SATA_RST_OTHER_AFFIL RT_BIT(3)
2843#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_SATA_RST_PORT_EN_ONLY RT_BIT(4)
2844#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_HIDE_NON_ZERO_PHYS RT_BIT(5)
2845#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_SATA_ASYNC_NOTIF RT_BIT(6)
2846#define LSILOGICSCSI_SASIOUNIT1_ADDITIONAL_CONTROL_MULT_PORTS_ILL_SAME_DOMAIN RT_BIT(7)
2847
2848#define LSILOGICSCSI_SASIOUNIT1_MISSING_DEVICE_DELAY_UNITS_16_SEC RT_BIT(7)
2849#define LSILOGICSCSI_SASIOUNIT1_MISSING_DEVICE_DELAY_SET(x) ((x) & 0x7F)
2850#define LSILOGICSCSI_SASIOUNIT1_MISSING_DEVICE_DELAY_GET(x) ((x) & 0x7F)
2851
2852#define LSILOGICSCSI_SASIOUNIT1_PORT_CONFIGURATION_AUTO RT_BIT(0)
2853#define LSILOGICSCSI_SASIOUNIT1_PORT_CONFIGURATION_IOC1 RT_BIT(2)
2854
2855#define LSILOGICSCSI_SASIOUNIT1_PHY_RX_INVERT RT_BIT(0)
2856#define LSILOGICSCSI_SASIOUNIT1_PHY_TX_INVERT RT_BIT(1)
2857#define LSILOGICSCSI_SASIOUNIT1_PHY_DISABLE RT_BIT(2)
2858
2859#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_MIN_SET(x) ((x) & 0x0F)
2860#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_MIN_GET(x) ((x) & 0x0F)
2861#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_MAX_SET(x) (((x) & 0x0F) << 4)
2862#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_MAX_GET(x) ((x >> 4) & 0x0F)
2863#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_15GB 0x8
2864#define LSILOGICSCSI_SASIOUNIT1_LINK_RATE_30GB 0x9
2865
2866#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_SET(x) ((x) & 0x3)
2867#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_GET(x) ((x) & 0x3)
2868#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_NO 0x0
2869#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_END 0x1
2870#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_EDGE_EXPANDER 0x2
2871#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_TYPE_FANOUT_EXPANDER 0x3
2872#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_SMP_INITIATOR RT_BIT(4)
2873#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_STP_INITIATOR RT_BIT(5)
2874#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_SSP_INITIATOR RT_BIT(6)
2875#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_SMP_TARGET RT_BIT(8)
2876#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_STP_TARGET RT_BIT(9)
2877#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_SSP_TARGET RT_BIT(10)
2878#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_DIRECT_ATTACHED RT_BIT(11)
2879#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_LSI RT_BIT(12)
2880#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_ATAPI RT_BIT(13)
2881#define LSILOGICSCSI_SASIOUNIT1_CTL_PHY_DEVICE_SEP RT_BIT(14)
2882
2883/**
2884 * SAS I/O unit page 2 - Read/Write
2885 */
2886#pragma pack(1)
2887typedef struct MptConfigurationPageSASIOUnit2
2888{
2889 /** Union. */
2890 union
2891 {
2892 /** Byte view - variable. */
2893 uint8_t abPageData[1];
2894 /** Field view. */
2895 struct
2896 {
2897 /** The omnipresent header. */
2898 MptExtendedConfigurationPageHeader ExtHeader;
2899 /** Device numbers per enclosure */
2900 uint8_t u8NumDevsPerEnclosure;
2901 /** Boot device wait time */
2902 uint8_t u8BootDeviceWaitTime;
2903 /** Reserved */
2904 uint16_t u16Reserved;
2905 /** Maximum number of persistent Bus and target ID mappings */
2906 uint16_t u16MaxPersistentIDs;
2907 /** Number of persistent IDs used */
2908 uint16_t u16NumPersistentIDsUsed;
2909 /** Status */
2910 uint8_t u8Status;
2911 /** Flags */
2912 uint8_t u8Flags;
2913 /** Maximum number of physical mapped IDs */
2914 uint16_t u16MaxNumPhysicalMappedIDs;
2915 } fields;
2916 } u;
2917} MptConfigurationPageSASIOUnit2, *PMptConfigurationPageSASIOUnit2;
2918#pragma pack()
2919AssertCompileSize(MptConfigurationPageSASIOUnit2, 20);
2920
2921#define LSILOGICSCSI_SASIOUNIT2_STATUS_PERSISTENT_MAP_TBL_FULL RT_BIT(0)
2922#define LSILOGICSCSI_SASIOUNIT2_STATUS_PERSISTENT_MAP_DISABLED RT_BIT(1)
2923#define LSILOGICSCSI_SASIOUNIT2_STATUS_PERSISTENT_ENC_DEV_UNMAPPED RT_BIT(2)
2924#define LSILOGICSCSI_SASIOUNIT2_STATUS_PERSISTENT_DEV_LIMIT_EXCEEDED RT_BIT(3)
2925
2926#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_MAP_DISABLE RT_BIT(0)
2927#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_SET(x) ((x & 0x7) << 1)
2928#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_GET(x) ((x >> 1) & 0x7)
2929#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_NO 0x0
2930#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_DIRECT_ATTACHED 0x1
2931#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_ENC 0x2
2932#define LSILOGICSCSI_SASIOUNIT2_FLAGS_PERSISTENT_PHYS_MAP_MODE_HOST 0x7
2933#define LSILOGICSCSI_SASIOUNIT2_FLAGS_RESERVE_TARGET_ID_ZERO RT_BIT(4)
2934#define LSILOGICSCSI_SASIOUNIT2_FLAGS_START_SLOT_NUMBER_ONE RT_BIT(5)
2935
2936/**
2937 * SAS I/O unit page 3 - Read/Write
2938 */
2939#pragma pack(1)
2940typedef struct MptConfigurationPageSASIOUnit3
2941{
2942 /** Union. */
2943 union
2944 {
2945 /** Byte view - variable. */
2946 uint8_t abPageData[1];
2947 /** Field view. */
2948 struct
2949 {
2950 /** The omnipresent header. */
2951 MptExtendedConfigurationPageHeader ExtHeader;
2952 /** Reserved */
2953 uint32_t u32Reserved;
2954 uint32_t u32MaxInvalidDwordCount;
2955 uint32_t u32InvalidDwordCountTime;
2956 uint32_t u32MaxRunningDisparityErrorCount;
2957 uint32_t u32RunningDisparityErrorTime;
2958 uint32_t u32MaxLossDwordSynchCount;
2959 uint32_t u32LossDwordSynchCountTime;
2960 uint32_t u32MaxPhysResetProblemCount;
2961 uint32_t u32PhyResetProblemTime;
2962 } fields;
2963 } u;
2964} MptConfigurationPageSASIOUnit3, *PMptConfigurationPageSASIOUnit3;
2965#pragma pack()
2966AssertCompileSize(MptConfigurationPageSASIOUnit3, 44);
2967
2968/**
2969 * SAS PHY page 0 - Readonly
2970 */
2971#pragma pack(1)
2972typedef struct MptConfigurationPageSASPHY0
2973{
2974 /** Union. */
2975 union
2976 {
2977 /** Byte view - variable. */
2978 uint8_t abPageData[1];
2979 /** Field view. */
2980 struct
2981 {
2982 /** The omnipresent header. */
2983 MptExtendedConfigurationPageHeader ExtHeader;
2984 /** Owner dev handle. */
2985 uint16_t u16OwnerDevHandle;
2986 /** Reserved */
2987 uint16_t u16Reserved0;
2988 /** SAS address */
2989 SASADDRESS SASAddress;
2990 /** Attached device handle */
2991 uint16_t u16AttachedDevHandle;
2992 /** Attached phy identifier */
2993 uint8_t u8AttachedPhyIdentifier;
2994 /** Reserved */
2995 uint8_t u8Reserved1;
2996 /** Attached device information */
2997 uint32_t u32AttachedDeviceInfo;
2998 /** Programmed link rate */
2999 uint8_t u8ProgrammedLinkRate;
3000 /** Hardware link rate */
3001 uint8_t u8HwLinkRate;
3002 /** Change count */
3003 uint8_t u8ChangeCount;
3004 /** Flags */
3005 uint8_t u8Flags;
3006 /** Phy information */
3007 uint32_t u32PhyInfo;
3008 } fields;
3009 } u;
3010} MptConfigurationPageSASPHY0, *PMptConfigurationPageSASPHY0;
3011#pragma pack()
3012AssertCompileSize(MptConfigurationPageSASPHY0, 36);
3013
3014#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_SET(x) ((x) & 0x3)
3015#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_GET(x) ((x) & 0x3)
3016#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_NO 0x0
3017#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_END 0x1
3018#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_EDGE_EXPANDER 0x2
3019#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_TYPE_FANOUT_EXPANDER 0x3
3020#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_SMP_INITIATOR RT_BIT(4)
3021#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_STP_INITIATOR RT_BIT(5)
3022#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_SSP_INITIATOR RT_BIT(6)
3023#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_SMP_TARGET RT_BIT(8)
3024#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_STP_TARGET RT_BIT(9)
3025#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_SSP_TARGET RT_BIT(10)
3026#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_DIRECT_ATTACHED RT_BIT(11)
3027#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_LSI RT_BIT(12)
3028#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_ATAPI RT_BIT(13)
3029#define LSILOGICSCSI_SASPHY0_DEV_INFO_DEVICE_SEP RT_BIT(14)
3030
3031/**
3032 * SAS PHY page 1 - Readonly
3033 */
3034#pragma pack(1)
3035typedef struct MptConfigurationPageSASPHY1
3036{
3037 /** Union. */
3038 union
3039 {
3040 /** Byte view - variable. */
3041 uint8_t abPageData[1];
3042 /** Field view. */
3043 struct
3044 {
3045 /** The omnipresent header. */
3046 MptExtendedConfigurationPageHeader ExtHeader;
3047 /** Reserved */
3048 uint32_t u32Reserved0;
3049 uint32_t u32InvalidDwordCound;
3050 uint32_t u32RunningDisparityErrorCount;
3051 uint32_t u32LossDwordSynchCount;
3052 uint32_t u32PhyResetProblemCount;
3053 } fields;
3054 } u;
3055} MptConfigurationPageSASPHY1, *PMptConfigurationPageSASPHY1;
3056#pragma pack()
3057AssertCompileSize(MptConfigurationPageSASPHY1, 28);
3058
3059/**
3060 * SAS Device page 0 - Readonly
3061 */
3062#pragma pack(1)
3063typedef struct MptConfigurationPageSASDevice0
3064{
3065 /** Union. */
3066 union
3067 {
3068 /** Byte view - variable. */
3069 uint8_t abPageData[1];
3070 /** Field view. */
3071 struct
3072 {
3073 /** The omnipresent header. */
3074 MptExtendedConfigurationPageHeader ExtHeader;
3075 /** Slot number */
3076 uint16_t u16Slot;
3077 /** Enclosure handle. */
3078 uint16_t u16EnclosureHandle;
3079 /** SAS address */
3080 SASADDRESS SASAddress;
3081 /** Parent device handle */
3082 uint16_t u16ParentDevHandle;
3083 /** Phy number */
3084 uint8_t u8PhyNum;
3085 /** Access status */
3086 uint8_t u8AccessStatus;
3087 /** Device handle */
3088 uint16_t u16DevHandle;
3089 /** Target ID */
3090 uint8_t u8TargetID;
3091 /** Bus */
3092 uint8_t u8Bus;
3093 /** Device info */
3094 uint32_t u32DeviceInfo;
3095 /** Flags */
3096 uint16_t u16Flags;
3097 /** Physical port */
3098 uint8_t u8PhysicalPort;
3099 /** Reserved */
3100 uint8_t u8Reserved0;
3101 } fields;
3102 } u;
3103} MptConfigurationPageSASDevice0, *PMptConfigurationPageSASDevice0;
3104#pragma pack()
3105AssertCompileSize(MptConfigurationPageSASDevice0, 36);
3106
3107#define LSILOGICSCSI_SASDEVICE0_STATUS_NO_ERRORS (0x00)
3108
3109#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_SET(x) ((x) & 0x3)
3110#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_GET(x) ((x) & 0x3)
3111#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_NO 0x0
3112#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_END 0x1
3113#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_EDGE_EXPANDER 0x2
3114#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_TYPE_FANOUT_EXPANDER 0x3
3115#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_SMP_INITIATOR RT_BIT(4)
3116#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_STP_INITIATOR RT_BIT(5)
3117#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_SSP_INITIATOR RT_BIT(6)
3118#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_SMP_TARGET RT_BIT(8)
3119#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_STP_TARGET RT_BIT(9)
3120#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_SSP_TARGET RT_BIT(10)
3121#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_DIRECT_ATTACHED RT_BIT(11)
3122#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_LSI RT_BIT(12)
3123#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_ATAPI RT_BIT(13)
3124#define LSILOGICSCSI_SASDEVICE0_DEV_INFO_DEVICE_SEP RT_BIT(14)
3125
3126#define LSILOGICSCSI_SASDEVICE0_FLAGS_DEVICE_PRESENT (RT_BIT(0))
3127#define LSILOGICSCSI_SASDEVICE0_FLAGS_DEVICE_MAPPED_TO_BUS_AND_TARGET_ID (RT_BIT(1))
3128#define LSILOGICSCSI_SASDEVICE0_FLAGS_DEVICE_MAPPING_PERSISTENT (RT_BIT(2))
3129
3130/**
3131 * SAS Device page 1 - Readonly
3132 */
3133#pragma pack(1)
3134typedef struct MptConfigurationPageSASDevice1
3135{
3136 /** Union. */
3137 union
3138 {
3139 /** Byte view - variable. */
3140 uint8_t abPageData[1];
3141 /** Field view. */
3142 struct
3143 {
3144 /** The omnipresent header. */
3145 MptExtendedConfigurationPageHeader ExtHeader;
3146 /** Reserved */
3147 uint32_t u32Reserved0;
3148 /** SAS address */
3149 SASADDRESS SASAddress;
3150 /** Reserved */
3151 uint32_t u32Reserved;
3152 /** Device handle */
3153 uint16_t u16DevHandle;
3154 /** Target ID */
3155 uint8_t u8TargetID;
3156 /** Bus */
3157 uint8_t u8Bus;
3158 /** Initial REgister device FIS */
3159 uint32_t au32InitialRegDeviceFIS[5];
3160 } fields;
3161 } u;
3162} MptConfigurationPageSASDevice1, *PMptConfigurationPageSASDevice1;
3163#pragma pack()
3164AssertCompileSize(MptConfigurationPageSASDevice1, 48);
3165
3166/**
3167 * SAS Device page 2 - Read/Write persistent
3168 */
3169#pragma pack(1)
3170typedef struct MptConfigurationPageSASDevice2
3171{
3172 /** Union. */
3173 union
3174 {
3175 /** Byte view - variable. */
3176 uint8_t abPageData[1];
3177 /** Field view. */
3178 struct
3179 {
3180 /** The omnipresent header. */
3181 MptExtendedConfigurationPageHeader ExtHeader;
3182 /** Physical identifier */
3183 SASADDRESS SASAddress;
3184 /** Enclosure mapping */
3185 uint32_t u32EnclosureMapping;
3186 } fields;
3187 } u;
3188} MptConfigurationPageSASDevice2, *PMptConfigurationPageSASDevice2;
3189#pragma pack()
3190AssertCompileSize(MptConfigurationPageSASDevice2, 20);
3191
3192/**
3193 * A device entitiy containing all pages.
3194 */
3195typedef struct MptSASDevice
3196{
3197 /** Pointer to the next device if any. */
3198 struct MptSASDevice *pNext;
3199 /** Pointer to the previous device if any. */
3200 struct MptSASDevice *pPrev;
3201
3202 MptConfigurationPageSASDevice0 SASDevicePage0;
3203 MptConfigurationPageSASDevice1 SASDevicePage1;
3204 MptConfigurationPageSASDevice2 SASDevicePage2;
3205} MptSASDevice, *PMptSASDevice;
3206
3207/**
3208 * SAS Expander page 0 - Readonly
3209 */
3210#pragma pack(1)
3211typedef struct MptConfigurationPageSASExpander0
3212{
3213 /** Union. */
3214 union
3215 {
3216 /** Byte view - variable. */
3217 uint8_t abPageData[1];
3218 /** Field view. */
3219 struct
3220 {
3221 /** The omnipresent header. */
3222 MptExtendedConfigurationPageHeader ExtHeader;
3223 /** Physical port */
3224 uint8_t u8PhysicalPort;
3225 /** Reserved */
3226 uint8_t u8Reserved0;
3227 /** Enclosure handle */
3228 uint16_t u16EnclosureHandle;
3229 /** SAS address */
3230 SASADDRESS SASAddress;
3231 /** Discovery status */
3232 uint32_t u32DiscoveryStatus;
3233 /** Device handle. */
3234 uint16_t u16DevHandle;
3235 /** Parent device handle */
3236 uint16_t u16ParentDevHandle;
3237 /** Expander change count */
3238 uint16_t u16ExpanderChangeCount;
3239 /** Expander route indexes */
3240 uint16_t u16ExpanderRouteIndexes;
3241 /** Number of PHys in this expander */
3242 uint8_t u8NumPhys;
3243 /** SAS level */
3244 uint8_t u8SASLevel;
3245 /** Flags */
3246 uint8_t u8Flags;
3247 /** Reserved */
3248 uint8_t u8Reserved1;
3249 } fields;
3250 } u;
3251} MptConfigurationPageSASExpander0, *PMptConfigurationPageSASExpander0;
3252#pragma pack()
3253AssertCompileSize(MptConfigurationPageSASExpander0, 36);
3254
3255/**
3256 * SAS Expander page 1 - Readonly
3257 */
3258#pragma pack(1)
3259typedef struct MptConfigurationPageSASExpander1
3260{
3261 /** Union. */
3262 union
3263 {
3264 /** Byte view - variable. */
3265 uint8_t abPageData[1];
3266 /** Field view. */
3267 struct
3268 {
3269 /** The omnipresent header. */
3270 MptExtendedConfigurationPageHeader ExtHeader;
3271 /** Physical port */
3272 uint8_t u8PhysicalPort;
3273 /** Reserved */
3274 uint8_t u8Reserved0[3];
3275 /** Number of PHYs */
3276 uint8_t u8NumPhys;
3277 /** Number of the Phy the information in this page is for. */
3278 uint8_t u8Phy;
3279 /** Number of routing table entries */
3280 uint16_t u16NumTableEntriesProgrammed;
3281 /** Programmed link rate */
3282 uint8_t u8ProgrammedLinkRate;
3283 /** Hardware link rate */
3284 uint8_t u8HwLinkRate;
3285 /** Attached device handle */
3286 uint16_t u16AttachedDevHandle;
3287 /** Phy information */
3288 uint32_t u32PhyInfo;
3289 /** Attached device information */
3290 uint32_t u32AttachedDeviceInfo;
3291 /** Owner device handle. */
3292 uint16_t u16OwnerDevHandle;
3293 /** Change count */
3294 uint8_t u8ChangeCount;
3295 /** Negotiated link rate */
3296 uint8_t u8NegotiatedLinkRate;
3297 /** Phy identifier */
3298 uint8_t u8PhyIdentifier;
3299 /** Attached phy identifier */
3300 uint8_t u8AttachedPhyIdentifier;
3301 /** Reserved */
3302 uint8_t u8Reserved1;
3303 /** Discovery information */
3304 uint8_t u8DiscoveryInfo;
3305 /** Reserved */
3306 uint32_t u32Reserved;
3307 } fields;
3308 } u;
3309} MptConfigurationPageSASExpander1, *PMptConfigurationPageSASExpander1;
3310#pragma pack()
3311AssertCompileSize(MptConfigurationPageSASExpander1, 40);
3312
3313/**
3314 * Structure of all supported pages for the SCSI SPI controller.
3315 * Used to load the device state from older versions.
3316 */
3317typedef struct MptConfigurationPagesSupported_SSM_V2
3318{
3319 MptConfigurationPageManufacturing0 ManufacturingPage0;
3320 MptConfigurationPageManufacturing1 ManufacturingPage1;
3321 MptConfigurationPageManufacturing2 ManufacturingPage2;
3322 MptConfigurationPageManufacturing3 ManufacturingPage3;
3323 MptConfigurationPageManufacturing4 ManufacturingPage4;
3324 MptConfigurationPageIOUnit0 IOUnitPage0;
3325 MptConfigurationPageIOUnit1 IOUnitPage1;
3326 MptConfigurationPageIOUnit2 IOUnitPage2;
3327 MptConfigurationPageIOUnit3 IOUnitPage3;
3328 MptConfigurationPageIOC0 IOCPage0;
3329 MptConfigurationPageIOC1 IOCPage1;
3330 MptConfigurationPageIOC2 IOCPage2;
3331 MptConfigurationPageIOC3 IOCPage3;
3332 MptConfigurationPageIOC4 IOCPage4;
3333 MptConfigurationPageIOC6 IOCPage6;
3334 struct
3335 {
3336 MptConfigurationPageSCSISPIPort0 SCSISPIPortPage0;
3337 MptConfigurationPageSCSISPIPort1 SCSISPIPortPage1;
3338 MptConfigurationPageSCSISPIPort2 SCSISPIPortPage2;
3339 } aPortPages[1]; /* Currently only one port supported. */
3340 struct
3341 {
3342 struct
3343 {
3344 MptConfigurationPageSCSISPIDevice0 SCSISPIDevicePage0;
3345 MptConfigurationPageSCSISPIDevice1 SCSISPIDevicePage1;
3346 MptConfigurationPageSCSISPIDevice2 SCSISPIDevicePage2;
3347 MptConfigurationPageSCSISPIDevice3 SCSISPIDevicePage3;
3348 } aDevicePages[LSILOGICSCSI_PCI_SPI_DEVICES_MAX];
3349 } aBuses[1]; /* Only one bus at the moment. */
3350} MptConfigurationPagesSupported_SSM_V2, *PMptConfigurationPagesSupported_SSM_V2;
3351
3352typedef struct MptConfigurationPagesSpi
3353{
3354 struct
3355 {
3356 MptConfigurationPageSCSISPIPort0 SCSISPIPortPage0;
3357 MptConfigurationPageSCSISPIPort1 SCSISPIPortPage1;
3358 MptConfigurationPageSCSISPIPort2 SCSISPIPortPage2;
3359 } aPortPages[1]; /* Currently only one port supported. */
3360 struct
3361 {
3362 struct
3363 {
3364 MptConfigurationPageSCSISPIDevice0 SCSISPIDevicePage0;
3365 MptConfigurationPageSCSISPIDevice1 SCSISPIDevicePage1;
3366 MptConfigurationPageSCSISPIDevice2 SCSISPIDevicePage2;
3367 MptConfigurationPageSCSISPIDevice3 SCSISPIDevicePage3;
3368 } aDevicePages[LSILOGICSCSI_PCI_SPI_DEVICES_MAX];
3369 } aBuses[1]; /* Only one bus at the moment. */
3370} MptConfigurationPagesSpi, *PMptConfigurationPagesSpi;
3371
3372typedef struct MptPHY
3373{
3374 MptConfigurationPageSASPHY0 SASPHYPage0;
3375 MptConfigurationPageSASPHY1 SASPHYPage1;
3376} MptPHY, *PMptPHY;
3377
3378#pragma pack(1)
3379typedef struct MptConfigurationPagesSas
3380{
3381 /** Size of the manufacturing page 7 */
3382 uint32_t cbManufacturingPage7;
3383 /** Pointer to the manufacturing page 7 */
3384 PMptConfigurationPageManufacturing7 pManufacturingPage7;
3385 /** Size of the I/O unit page 0 */
3386 uint32_t cbSASIOUnitPage0;
3387 /** Pointer to the I/O unit page 0 */
3388 PMptConfigurationPageSASIOUnit0 pSASIOUnitPage0;
3389 /** Size of the I/O unit page 1 */
3390 uint32_t cbSASIOUnitPage1;
3391 /** Pointer to the I/O unit page 1 */
3392 PMptConfigurationPageSASIOUnit1 pSASIOUnitPage1;
3393 /** I/O unit page 2 */
3394 MptConfigurationPageSASIOUnit2 SASIOUnitPage2;
3395 /** I/O unit page 3 */
3396 MptConfigurationPageSASIOUnit3 SASIOUnitPage3;
3397
3398 /** Number of PHYs in the array. */
3399 uint32_t cPHYs;
3400 /** Pointer to an array of per PHYS pages. */
3401 R3PTRTYPE(PMptPHY) paPHYs;
3402
3403 /** Number of devices detected. */
3404 uint32_t cDevices;
3405 /** Pointer to the first SAS device. */
3406 R3PTRTYPE(PMptSASDevice) pSASDeviceHead;
3407 /** Pointer to the last SAS device. */
3408 R3PTRTYPE(PMptSASDevice) pSASDeviceTail;
3409} MptConfigurationPagesSas, *PMptConfigurationPagesSas;
3410#pragma pack()
3411
3412/**
3413 * Structure of all supported pages for both controllers.
3414 */
3415typedef struct MptConfigurationPagesSupported
3416{
3417 MptConfigurationPageManufacturing0 ManufacturingPage0;
3418 MptConfigurationPageManufacturing1 ManufacturingPage1;
3419 MptConfigurationPageManufacturing2 ManufacturingPage2;
3420 MptConfigurationPageManufacturing3 ManufacturingPage3;
3421 MptConfigurationPageManufacturing4 ManufacturingPage4;
3422 MptConfigurationPageManufacturing5 ManufacturingPage5;
3423 MptConfigurationPageManufacturing6 ManufacturingPage6;
3424 MptConfigurationPageManufacturing8 ManufacturingPage8;
3425 MptConfigurationPageManufacturing9 ManufacturingPage9;
3426 MptConfigurationPageManufacturing10 ManufacturingPage10;
3427 MptConfigurationPageIOUnit0 IOUnitPage0;
3428 MptConfigurationPageIOUnit1 IOUnitPage1;
3429 MptConfigurationPageIOUnit2 IOUnitPage2;
3430 MptConfigurationPageIOUnit3 IOUnitPage3;
3431 MptConfigurationPageIOUnit4 IOUnitPage4;
3432 MptConfigurationPageIOC0 IOCPage0;
3433 MptConfigurationPageIOC1 IOCPage1;
3434 MptConfigurationPageIOC2 IOCPage2;
3435 MptConfigurationPageIOC3 IOCPage3;
3436 MptConfigurationPageIOC4 IOCPage4;
3437 MptConfigurationPageIOC6 IOCPage6;
3438 /* BIOS page 0 is not described */
3439 MptConfigurationPageBIOS1 BIOSPage1;
3440 MptConfigurationPageBIOS2 BIOSPage2;
3441 /* BIOS page 3 is not described */
3442 MptConfigurationPageBIOS4 BIOSPage4;
3443
3444 /** Controller dependent data. */
3445 union
3446 {
3447 MptConfigurationPagesSpi SpiPages;
3448 MptConfigurationPagesSas SasPages;
3449 } u;
3450} MptConfigurationPagesSupported, *PMptConfigurationPagesSupported;
3451
3452/**
3453 * Initializes a page header.
3454 */
3455#define MPT_CONFIG_PAGE_HEADER_INIT(pg, type, nr, flags) \
3456 (pg)->u.fields.Header.u8PageType = flags; \
3457 (pg)->u.fields.Header.u8PageNumber = nr; \
3458 (pg)->u.fields.Header.u8PageLength = sizeof(type) / 4
3459
3460#define MPT_CONFIG_PAGE_HEADER_INIT_MANUFACTURING(pg, type, nr, flags) \
3461 MPT_CONFIG_PAGE_HEADER_INIT(pg, type, nr, flags | MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING)
3462
3463#define MPT_CONFIG_PAGE_HEADER_INIT_IO_UNIT(pg, type, nr, flags) \
3464 MPT_CONFIG_PAGE_HEADER_INIT(pg, type, nr, flags | MPT_CONFIGURATION_PAGE_TYPE_IO_UNIT)
3465
3466#define MPT_CONFIG_PAGE_HEADER_INIT_IOC(pg, type, nr, flags) \
3467 MPT_CONFIG_PAGE_HEADER_INIT(pg, type, nr, flags | MPT_CONFIGURATION_PAGE_TYPE_IOC)
3468
3469#define MPT_CONFIG_PAGE_HEADER_INIT_BIOS(pg, type, nr, flags) \
3470 MPT_CONFIG_PAGE_HEADER_INIT(pg, type, nr, flags | MPT_CONFIGURATION_PAGE_TYPE_BIOS)
3471
3472/**
3473 * Initializes a extended page header.
3474 */
3475#define MPT_CONFIG_EXTENDED_PAGE_HEADER_INIT(pg, cb, nr, flags, exttype) \
3476 (pg)->u.fields.ExtHeader.u8PageType = flags | MPT_CONFIGURATION_PAGE_TYPE_EXTENDED; \
3477 (pg)->u.fields.ExtHeader.u8PageNumber = nr; \
3478 (pg)->u.fields.ExtHeader.u8ExtPageType = exttype; \
3479 (pg)->u.fields.ExtHeader.u16ExtPageLength = cb / 4
3480
3481/**
3482 * Possible SG element types.
3483 */
3484enum MPTSGENTRYTYPE
3485{
3486 MPTSGENTRYTYPE_TRANSACTION_CONTEXT = 0x00,
3487 MPTSGENTRYTYPE_SIMPLE = 0x01,
3488 MPTSGENTRYTYPE_CHAIN = 0x03
3489};
3490
3491/**
3492 * Register interface.
3493 */
3494
3495/**
3496 * Defined states that the SCSI controller can have.
3497 */
3498typedef enum LSILOGICSTATE
3499{
3500 /** Reset state. */
3501 LSILOGICSTATE_RESET = 0x00,
3502 /** Ready state. */
3503 LSILOGICSTATE_READY = 0x01,
3504 /** Operational state. */
3505 LSILOGICSTATE_OPERATIONAL = 0x02,
3506 /** Fault state. */
3507 LSILOGICSTATE_FAULT = 0x04,
3508 /** 32bit size hack */
3509 LSILOGICSTATE_32BIT_HACK = 0x7fffffff
3510} LSILOGICSTATE;
3511
3512/**
3513 * Which entity needs to initialize the controller
3514 * to get into the operational state.
3515 */
3516typedef enum LSILOGICWHOINIT
3517{
3518 /** Not initialized. */
3519 LSILOGICWHOINIT_NOT_INITIALIZED = 0x00,
3520 /** System BIOS. */
3521 LSILOGICWHOINIT_SYSTEM_BIOS = 0x01,
3522 /** ROM Bios. */
3523 LSILOGICWHOINIT_ROM_BIOS = 0x02,
3524 /** PCI Peer. */
3525 LSILOGICWHOINIT_PCI_PEER = 0x03,
3526 /** Host driver. */
3527 LSILOGICWHOINIT_HOST_DRIVER = 0x04,
3528 /** Manufacturing. */
3529 LSILOGICWHOINIT_MANUFACTURING = 0x05,
3530 /** 32bit size hack. */
3531 LSILOGICWHOINIT_32BIT_HACK = 0x7fffffff
3532} LSILOGICWHOINIT;
3533
3534
3535/**
3536 * Doorbell state.
3537 */
3538typedef enum LSILOGICDOORBELLSTATE
3539{
3540 /** Invalid value. */
3541 LSILOGICDOORBELLSTATE_INVALID = 0,
3542 /** Doorbell not in use. */
3543 LSILOGICDOORBELLSTATE_NOT_IN_USE,
3544 /** Reply frame removal, transfer number of entries, low 16bits. */
3545 LSILOGICDOORBELLSTATE_RFR_FRAME_COUNT_LOW,
3546 /** Reply frame removal, transfer number of entries, high 16bits. */
3547 LSILOGICDOORBELLSTATE_RFR_FRAME_COUNT_HIGH,
3548 /** Reply frame removal, remove next free frame, low part. */
3549 LSILOGICDOORBELLSTATE_RFR_NEXT_FRAME_LOW,
3550 /** Reply frame removal, remove next free frame, high part. */
3551 LSILOGICDOORBELLSTATE_RFR_NEXT_FRAME_HIGH,
3552 /** Function handshake. */
3553 LSILOGICDOORBELLSTATE_FN_HANDSHAKE,
3554 /** 32bit hack. */
3555 LSILOGICDOORBELLSTATE_32BIT_HACK = 0x7fffffff
3556} LSILOGICDOORBELLSTATE;
3557/** Pointer to a doorbell state. */
3558typedef LSILOGICDOORBELLSTATE *PLSILOGICDOORBELLSTATE;
3559
3560
3561/**
3562 * IOC status codes.
3563 */
3564#define LSILOGIC_IOCSTATUS_SUCCESS 0x0000
3565#define LSILOGIC_IOCSTATUS_INVALID_FUNCTION 0x0001
3566#define LSILOGIC_IOCSTATUS_BUSY 0x0002
3567#define LSILOGIC_IOCSTATUS_INVALID_SGL 0x0003
3568#define LSILOGIC_IOCSTATUS_INTERNAL_ERROR 0x0004
3569#define LSILOGIC_IOCSTATUS_RESERVED 0x0005
3570#define LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES 0x0006
3571#define LSILOGIC_IOCSTATUS_INVALID_FIELD 0x0007
3572#define LSILOGIC_IOCSTATUS_INVALID_STATE 0x0008
3573#define LSILOGIC_IOCSTATUS_OP_STATE_NOT_SUPPOTED 0x0009
3574
3575/**
3576 * Size of the I/O and MMIO space.
3577 */
3578#define LSILOGIC_PCI_SPACE_IO_SIZE 256
3579#define LSILOGIC_PCI_SPACE_MEM_SIZE 128 * _1K
3580
3581/**
3582 * Doorbell register - Used to get the status of the controller and
3583 * initialise it.
3584 */
3585#define LSILOGIC_REG_DOORBELL 0x00
3586# define LSILOGIC_REG_DOORBELL_SET_STATE(enmState) (((enmState) & 0x0f) << 28)
3587# define LSILOGIC_REG_DOORBELL_SET_USED(enmDoorbell) (((enmDoorbell != LSILOGICDOORBELLSTATE_NOT_IN_USE) ? 1 : 0) << 27)
3588# define LSILOGIC_REG_DOORBELL_SET_WHOINIT(enmWhoInit) (((enmWhoInit) & 0x07) << 24)
3589# define LSILOGIC_REG_DOORBELL_SET_FAULT_CODE(u16Code) (u16Code)
3590# define LSILOGIC_REG_DOORBELL_GET_FUNCTION(x) (((x) & 0xff000000) >> 24)
3591# define LSILOGIC_REG_DOORBELL_GET_SIZE(x) (((x) & 0x00ff0000) >> 16)
3592
3593/**
3594 * Functions which can be passed through the system doorbell.
3595 */
3596#define LSILOGIC_DOORBELL_FUNCTION_IOC_MSG_UNIT_RESET 0x40
3597#define LSILOGIC_DOORBELL_FUNCTION_IO_UNIT_RESET 0x41
3598#define LSILOGIC_DOORBELL_FUNCTION_HANDSHAKE 0x42
3599#define LSILOGIC_DOORBELL_FUNCTION_REPLY_FRAME_REMOVAL 0x43
3600
3601/**
3602 * Write sequence register for the diagnostic register.
3603 */
3604#define LSILOGIC_REG_WRITE_SEQUENCE 0x04
3605
3606/**
3607 * Diagnostic register - used to reset the controller.
3608 */
3609#define LSILOGIC_REG_HOST_DIAGNOSTIC 0x08
3610# define LSILOGIC_REG_HOST_DIAGNOSTIC_DIAG_MEM_ENABLE (RT_BIT(0))
3611# define LSILOGIC_REG_HOST_DIAGNOSTIC_DISABLE_ARM (RT_BIT(1))
3612# define LSILOGIC_REG_HOST_DIAGNOSTIC_RESET_ADAPTER (RT_BIT(2))
3613# define LSILOGIC_REG_HOST_DIAGNOSTIC_DIAG_RW_ENABLE (RT_BIT(4))
3614# define LSILOGIC_REG_HOST_DIAGNOSTIC_RESET_HISTORY (RT_BIT(5))
3615# define LSILOGIC_REG_HOST_DIAGNOSTIC_FLASH_BAD_SIG (RT_BIT(6))
3616# define LSILOGIC_REG_HOST_DIAGNOSTIC_DRWE (RT_BIT(7))
3617# define LSILOGIC_REG_HOST_DIAGNOSTIC_PREVENT_IOC_BOOT (RT_BIT(9))
3618# define LSILOGIC_REG_HOST_DIAGNOSTIC_CLEAR_FLASH_BAD_SIG (RT_BIT(10))
3619
3620#define LSILOGIC_REG_TEST_BASE_ADDRESS 0x0c
3621#define LSILOGIC_REG_DIAG_RW_DATA 0x10
3622#define LSILOGIC_REG_DIAG_RW_ADDRESS 0x14
3623
3624/**
3625 * Interrupt status register.
3626 */
3627#define LSILOGIC_REG_HOST_INTR_STATUS 0x30
3628# define LSILOGIC_REG_HOST_INTR_STATUS_W_MASK (RT_BIT(3))
3629# define LSILOGIC_REG_HOST_INTR_STATUS_DOORBELL_STS (RT_BIT(31))
3630# define LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR (RT_BIT(3))
3631# define LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL (RT_BIT(0))
3632
3633/**
3634 * Interrupt mask register.
3635 */
3636#define LSILOGIC_REG_HOST_INTR_MASK 0x34
3637# define LSILOGIC_REG_HOST_INTR_MASK_W_MASK (RT_BIT(0) | RT_BIT(3) | RT_BIT(8) | RT_BIT(9))
3638# define LSILOGIC_REG_HOST_INTR_MASK_IRQ_ROUTING (RT_BIT(8) | RT_BIT(9))
3639# define LSILOGIC_REG_HOST_INTR_MASK_DOORBELL RT_BIT(0)
3640# define LSILOGIC_REG_HOST_INTR_MASK_REPLY RT_BIT(3)
3641
3642/**
3643 * Queue registers.
3644 */
3645#define LSILOGIC_REG_REQUEST_QUEUE 0x40
3646#define LSILOGIC_REG_REPLY_QUEUE 0x44
3647
3648#endif /* !VBOX_INCLUDED_SRC_Storage_DevLsiLogicSCSI_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette