NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
PlxTypes.h
1 #ifndef __PLX_TYPES_H
2 #define __PLX_TYPES_H
3 
4 /*******************************************************************************
5  * Copyright (c) PLX Technology, Inc.
6  *
7  * PLX Technology Inc. licenses this source file under the GNU Lesser General Public
8  * License (LGPL) version 2. This source file may be modified or redistributed
9  * under the terms of the LGPL and without express permission from PLX Technology.
10  *
11  * PLX Technology, Inc. provides this software AS IS, WITHOUT ANY WARRANTY,
12  * EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF
13  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PLX makes no guarantee
14  * or representations regarding the use of, or the results of the use of,
15  * the software and documentation in terms of correctness, accuracy,
16  * reliability, currentness, or otherwise; and you rely on the software,
17  * documentation and results solely at your own risk.
18  *
19  * IN NO EVENT SHALL PLX BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
20  * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
21  * OF ANY KIND.
22  *
23  ******************************************************************************/
24 
25 /******************************************************************************
26  *
27  * File Name:
28  *
29  * PlxTypes.h
30  *
31  * Description:
32  *
33  * This file includes PLX SDK types and definitions
34  *
35  * Revision:
36  *
37  * 07-01-13 : PLX SDK v7.00
38  *
39  ******************************************************************************/
40 
41 
42 #include "Plx.h"
43 #include "PlxDefCk.h"
44 #include "PlxStat.h"
45 #include "PciTypes.h"
46 
47 
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 
54 
55 
56 /******************************************
57  * Definitions for Code Portability
58  ******************************************/
59 // Memory set and copy
60 #if !defined(PLX_MSWINDOWS)
61  #define RtlZeroMemory(pDest, count) memset((pDest), 0, (count))
62  #define RtlCopyMemory(pDest, pSrc, count) memcpy((pDest), (pSrc), (count))
63  #define RtlFillMemory(pDest, count, value) memset((pDest), (value), (count))
64 #endif
65 
66 // Convert pointer to an integer
67 #define PLX_PTR_TO_INT( ptr ) ((PLX_UINT_PTR)(ptr))
68 
69 // Convert integer to a pointer
70 #define PLX_INT_TO_PTR( int ) ((VOID*)(PLX_UINT_PTR)(int))
71 
72 // Macros that guarantee correct endian format regardless of CPU platform
73 #if defined(PLX_BIG_ENDIAN)
74  #define PLX_LE_DATA_32(value) EndianSwap32( (value) )
75  #define PLX_BE_DATA_32(value) (value)
76 #else
77  #define PLX_LE_DATA_32(value) (value)
78  #define PLX_BE_DATA_32(value) EndianSwap32( (value) )
79 #endif
80 
81 // Macros to support portable type casting on BE/LE platforms
82 #if (PLX_SIZE_64 == 4)
83  #define PLX_64_HIGH_32(value) 0
84  #define PLX_64_LOW_32(value) ((U32)(value))
85 #else
86  #if defined(PLX_BIG_ENDIAN)
87  #define PLX_64_HIGH_32(value) ((U32)((U64)value))
88  #define PLX_64_LOW_32(value) ((U32)(((U64)value) >> 32))
89 
90  #define PLX_CAST_64_TO_8_PTR( ptr64 ) (U8*) ((U8*)(ptr64) + (7*sizeof(U8)))
91  #define PLX_CAST_64_TO_16_PTR( ptr64 ) (U16*)((U8*)(ptr64) + (6*sizeof(U8)))
92  #define PLX_CAST_64_TO_32_PTR( ptr64 ) (U32*)((U8*)(ptr64) + sizeof(U32))
93 
94  #define PLX_LE_U32_BIT( pos ) ((U32)(1 << (31 - (pos))))
95  #else
96  #define PLX_64_HIGH_32(value) ((U32)(((U64)value) >> 32))
97  #define PLX_64_LOW_32(value) ((U32)((U64)value))
98 
99  #define PLX_CAST_64_TO_8_PTR( ptr64 ) (U8*) (ptr64)
100  #define PLX_CAST_64_TO_16_PTR( ptr64 ) (U16*)(ptr64)
101  #define PLX_CAST_64_TO_32_PTR( ptr64 ) (U32*)(ptr64)
102 
103  #define PLX_LE_U32_BIT( pos ) ((U32)(1 << (pos)))
104  #endif
105 #endif
106 
107 
108 
109 /******************************************
110  * Miscellaneous definitions
111  ******************************************/
112 #if !defined(VOID)
113  typedef void VOID;
114 #endif
115 
116 // Linux actypes.h contains conflicting definition for BOOLEAN
117 #if (!defined(PLX_MSWINDOWS)) || defined(PLX_VXD_DRIVER)
118  #if !defined(BOOLEAN) && !defined(__ACTYPES_H__)
119  typedef S8 BOOLEAN;
120  #endif
121 #endif
122 
123 #if !defined(PLX_MSWINDOWS)
124  #if !defined(BOOL)
125  typedef S8 BOOL;
126  #endif
127 #endif
128 
129 #if !defined(NULL)
130  #define NULL ((VOID *) 0x0)
131 #endif
132 
133 #if !defined(TRUE)
134  #define TRUE 1
135 #endif
136 
137 #if !defined(FALSE)
138  #define FALSE 0
139 #endif
140 
141 #if defined(PLX_MSWINDOWS)
142  #define PLX_TIMEOUT_INFINITE INFINITE
143 #elif defined(PLX_LINUX) || defined(PLX_LINUX_DRIVER)
144  #define PLX_TIMEOUT_INFINITE MAX_SCHEDULE_TIMEOUT
145 
146  /*********************************************************
147  * Convert milliseconds to jiffies. The following
148  * formula is used:
149  *
150  * ms * HZ
151  * jiffies = ---------
152  * 1,000
153  *
154  * where: HZ = System-defined clock ticks per second
155  * ms = Timeout in milliseconds
156  * jiffies = Number of HZ's per second
157  ********************************************************/
158  #define Plx_ms_to_jiffies( ms ) ( ((ms) * HZ) / 1000 )
159  #define Plx_jiffies_to_ms( jiff ) ( ((jiff) * 1000) / HZ )
160 #endif
161 
162 
163 
164 
165 /******************************************
166  * PLX-specific types & structures
167  ******************************************/
168 
169 // Mode PLX API uses to access device
170 typedef enum _PLX_API_MODE
171 {
172  PLX_API_MODE_PCI, // Device accessed via PLX driver over PCI/PCIe
173  PLX_API_MODE_I2C_AARDVARK, // Device accessed via Aardvark I2C USB
174  PLX_API_MODE_TCP // Device accessed via TCP/IP
175 } PLX_API_MODE;
176 
177 
178 // Access Size Type
179 typedef enum _PLX_ACCESS_TYPE
180 {
181  BitSize8,
182  BitSize16,
183  BitSize32,
184  BitSize64
185 } PLX_ACCESS_TYPE;
186 
187 
188 // Mode PLX API uses to access device
189 typedef enum _PLX_CHIP_FAMILY
190 {
191  PLX_FAMILY_NONE = 0,
192  PLX_FAMILY_UNKNOWN,
193  PLX_FAMILY_BRIDGE_P2L, // 9000 series & 8311
194  PLX_FAMILY_BRIDGE_PCI_P2P, // 6000 series
195  PLX_FAMILY_BRIDGE_PCIE_P2P, // 8111,8112,8114
196  PLX_FAMILY_ALTAIR, // 8525,8533,8547,8548
197  PLX_FAMILY_ALTAIR_XL, // 8505,8509
198  PLX_FAMILY_VEGA, // 8516,8524,8532
199  PLX_FAMILY_VEGA_LITE, // 8508,8512,8517,8518
200  PLX_FAMILY_DENEB, // 8612,8616,8624,8632,8647,8648
201  PLX_FAMILY_SIRIUS, // 8604,8606,8608,8609,8613,8614,8615,8617,8618,8619
202  PLX_FAMILY_CYGNUS, // 8625,8636,8649,8664,8680,8696
203  PLX_FAMILY_SCOUT, // 8700
204  PLX_FAMILY_DRACO_1, // 8408,8416,8712,8716,8724,8732,8747,8748
205  PLX_FAMILY_DRACO_2, // 8713,8717,8725,8733,8749
206  PLX_FAMILY_MIRA, // 2380,3380,3382,8603,8605
207  PLX_FAMILY_CAPELLA_1, // 8714,8718,8734,8750,8764,8780,8796
208  PLX_FAMILY_CAPELLA_2 // 8715,8719,8735,8751,8765,8781,8797
209 } PLX_CHIP_FAMILY;
210 
211 
212 // PLX port flags for mask
213 typedef enum _PLX_FLAG_PORT
214 {
215  PLX_FLAG_PORT_NT_LINK_1 = 63, // Bit for NT Link port 0
216  PLX_FLAG_PORT_NT_LINK_0 = 62, // Bit for NT Link port 1
217  PLX_FLAG_PORT_NT_VIRTUAL_1 = 61, // Bit for NT Virtual port 0
218  PLX_FLAG_PORT_NT_VIRTUAL_0 = 60, // Bit for NT Virtual port 1
219  PLX_FLAG_PORT_NT_DS_P2P = 59, // Bit for NT DS P2P port (Virtual)
220  PLX_FLAG_PORT_DMA_RAM = 58, // Bit for DMA RAM
221  PLX_FLAG_PORT_DMA_3 = 57, // Bit for DMA channel 3
222  PLX_FLAG_PORT_DMA_2 = 56, // Bit for DMA channel 2
223  PLX_FLAG_PORT_DMA_1 = 55, // Bit for DMA channel 1
224  PLX_FLAG_PORT_DMA_0 = 54, // Bit for DMA ch 0 or Func 1 (all 4 ch)
225  PLX_FLAG_PORT_PCIE_TO_USB = 53, // Bit for PCIe-to-USB P2P or Root Port
226  PLX_FLAG_PORT_USB = 52, // Bit for USB Host/Bridge
227  PLX_FLAG_PORT_ALUT_3 = 51, // Bit for ALUT RAM arrays 0
228  PLX_FLAG_PORT_ALUT_2 = 50, // Bit for ALUT RAM arrays 1
229  PLX_FLAG_PORT_ALUT_1 = 49, // Bit for ALUT RAM arrays 2
230  PLX_FLAG_PORT_ALUT_0 = 48, // Bit for ALUT RAM arrays 3
231  PLX_FLAG_PORT_VS_REGS_S5 = 47, // Bit for VS mode station 0 specific regs
232  PLX_FLAG_PORT_VS_REGS_S4 = 46, // Bit for VS mode station 1 specific regs
233  PLX_FLAG_PORT_VS_REGS_S3 = 45, // Bit for VS mode station 2 specific regs
234  PLX_FLAG_PORT_VS_REGS_S2 = 44, // Bit for VS mode station 3 specific regs
235  PLX_FLAG_PORT_VS_REGS_S1 = 43, // Bit for VS mode station 4 specific regs
236  PLX_FLAG_PORT_VS_REGS_S0 = 42, // Bit for VS mode station 5 specific regs
237  PLX_FLAG_PORT_MAX = 41 // Bit for highest possible standard port
238 } PLX_FLAG_PORT;
239 
240 
241 // Generic states used internally by PLX software
242 typedef enum _PLX_STATE
243 {
244  PLX_STATE_OK,
245  PLX_STATE_WORKING,
246  PLX_STATE_ERROR,
247  PLX_STATE_ENABLED,
248  PLX_STATE_DISABLED,
249  PLX_STATE_UNINITIALIZED,
250  PLX_STATE_INITIALIZING,
251  PLX_STATE_INITIALIZED,
252  PLX_STATE_IDLE,
253  PLX_STATE_BUSY,
254  PLX_STATE_STARTED,
255  PLX_STATE_STARTING,
256  PLX_STATE_STOPPED,
257  PLX_STATE_STOPPING,
258  PLX_STATE_CANCELED,
259  PLX_STATE_DELETED,
260  PLX_STATE_MARKED_FOR_DELETE,
261  PLX_STATE_OK_TO_DELETE,
262  PLX_STATE_TRIGGERED,
263  PLX_STATE_PENDING,
264  PLX_STATE_WAITING,
265  PLX_STATE_TIMEOUT,
266  PLX_STATE_REQUESTING,
267  PLX_STATE_REQUESTED,
268  PLX_STATE_ACCEPTING,
269  PLX_STATE_ACCEPTED,
270  PLX_STATE_REJECTED,
271  PLX_STATE_COMPLETING,
272  PLX_STATE_COMPLETED,
273  PLX_STATE_CONNECTING,
274  PLX_STATE_CONNECTED,
275  PLX_STATE_DISCONNECTING,
276  PLX_STATE_DISCONNECTED
277 } PLX_STATE;
278 
279 
280 // BAR flags
281 typedef enum _PLX_BAR_FLAG
282 {
283  PLX_BAR_FLAG_MEM = (1 << 0),
284  PLX_BAR_FLAG_IO = (1 << 1),
285  PLX_BAR_FLAG_BELOW_1MB = (1 << 2),
286  PLX_BAR_FLAG_32_BIT = (1 << 3),
287  PLX_BAR_FLAG_64_BIT = (1 << 4),
288  PLX_BAR_FLAG_PREFETCHABLE = (1 << 5),
289  PLX_BAR_FLAG_UPPER_32 = (1 << 6),
290  PLX_BAR_FLAG_PROBED = (1 << 7)
291 } PLX_BAR_FLAG;
292 
293 
294 // EEPROM status
295 typedef enum _PLX_EEPROM_STATUS
296 {
297  PLX_EEPROM_STATUS_NONE = 0, // Not present
298  PLX_EEPROM_STATUS_VALID = 1, // Present with valid data
299  PLX_EEPROM_STATUS_INVALID_DATA = 2, // Present w/invalid data or CRC error
300  PLX_EEPROM_STATUS_BLANK = PLX_EEPROM_STATUS_INVALID_DATA,
301  PLX_EEPROM_STATUS_CRC_ERROR = PLX_EEPROM_STATUS_INVALID_DATA
302 } PLX_EEPROM_STATUS;
303 
304 
305 // EEPROM port numbers
306 typedef enum _PLX_EEPROM_PORT
307 {
308  PLX_EEPROM_PORT_NONE = 0,
309  PLX_EEPROM_PORT_NT_VIRT_0 = 254,
310  PLX_EEPROM_PORT_NT_LINK_0 = 253,
311  PLX_EEPROM_PORT_NT_VIRT_1 = 252,
312  PLX_EEPROM_PORT_NT_LINK_1 = 251,
313  PLX_EEPROM_PORT_DMA_0 = 250,
314  PLX_EEPROM_PORT_DMA_1 = 249,
315  PLX_EEPROM_PORT_DMA_2 = 248,
316  PLX_EEPROM_PORT_DMA_3 = 247,
317  PLX_EEPROM_PORT_SHARED_MEM = 246
318 } PLX_EEPROM_PORT;
319 
320 
321 // EEPROM CRC status
322 typedef enum _PLX_CRC_STATUS
323 {
324  PLX_CRC_INVALID = 0,
325  PLX_CRC_VALID = 1,
326  PLX_CRC_UNSUPPORTED = 2,
327  PLX_CRC_UNKNOWN = 3
328 } PLX_CRC_STATUS;
329 
330 
331 // PCI Express Link Speeds
332 typedef enum _PLX_LINK_SPEED
333 {
334  PLX_LINK_SPEED_2_5_GBPS = 1,
335  PLX_LINK_SPEED_5_0_GBPS = 2,
336  PLX_LINK_SPEED_8_0_GBPS = 3,
337  PLX_PCIE_GEN_1_0 = PLX_LINK_SPEED_2_5_GBPS,
338  PLX_PCIE_GEN_2_0 = PLX_LINK_SPEED_5_0_GBPS,
339  PLX_PCIE_GEN_3_0 = PLX_LINK_SPEED_8_0_GBPS
340 } PLX_LINK_SPEED;
341 
342 
343 // Interrupt generation types
344 typedef enum _PLX_IRQ_TYPE
345 {
346  PLX_IRQ_TYPE_NONE = 0, // No interrupt
347  PLX_IRQ_TYPE_UNKNOWN = 1, // Undefined interrupt type
348  PLX_IRQ_TYPE_INTX = 2, // Legacy INTx interrupt (INTA,INTB,etc)
349  PLX_IRQ_TYPE_MSI = 3, // MSI interrupt
350  PLX_IRQ_TYPE_MSIX = 4 // MSI-X interrupt
351 } PLX_IRQ_TYPE;
352 
353 
354 // Port types
355 typedef enum _PLX_PORT_TYPE
356 {
357  PLX_PORT_UNKNOWN = 0xFF,
358  PLX_PORT_ENDPOINT = 0,
359  PLX_PORT_LEGACY_ENDPOINT = 1,
360  PLX_PORT_ROOT_PORT = 4,
361  PLX_PORT_UPSTREAM = 5,
362  PLX_PORT_DOWNSTREAM = 6,
363  PLX_PORT_PCIE_TO_PCI_BRIDGE = 7,
364  PLX_PORT_PCI_TO_PCIE_BRIDGE = 8,
365  PLX_PORT_ROOT_ENDPOINT = 9,
366  PLX_PORT_ROOT_EVENT_COLL = 10
367 } PLX_PORT_TYPE;
368 
369 
370 // Non-transparent Port types
371 typedef enum _PLX_NT_PORT_TYPE
372 {
373  PLX_NT_PORT_NONE = 0, // Not an NT port
374  PLX_NT_PORT_PRIMARY = 1, // NT Primary Host side port
375  PLX_NT_PORT_SECONDARY = 2, // NT Seconday Host side port
376  PLX_NT_PORT_VIRTUAL = PLX_NT_PORT_PRIMARY, // NT Virtual-side port
377  PLX_NT_PORT_LINK = PLX_NT_PORT_SECONDARY, // NT Link-side port
378  PLX_NT_PORT_UNKOWN = 0xFF // NT side is undetermined
379 } PLX_NT_PORT_TYPE;
380 
381 
382 // NT port configuration types
383 typedef enum _PLX_NT_CONFIG_TYPE
384 {
385  PLX_NT_CONFIG_TYPE_NONE = 0,
386  PLX_NT_CONFIG_TYPE_LINK_DOWN,
387  PLX_NT_CONFIG_TYPE_STANDARD,
388  PLX_NT_CONFIG_TYPE_BACK_TO_BACK
389 } PLX_NT_CONFIG_TYPE;
390 
391 
392 // Non-transparent LUT flags
393 typedef enum _PLX_NT_LUT_FLAG
394 {
395  PLX_NT_LUT_FLAG_NONE = 0,
396  PLX_NT_LUT_FLAG_NO_SNOOP = (1 << 0),
397  PLX_NT_LUT_FLAG_READ = (1 << 1),
398  PLX_NT_LUT_FLAG_WRITE = (1 << 2)
399 } PLX_NT_LUT_FLAG;
400 
401 
402 // DMA control commands
403 typedef enum _PLX_DMA_COMMAND
404 {
405  DmaPause,
406  DmaPauseImmediate,
407  DmaResume,
408  DmaAbort
409 } PLX_DMA_COMMAND;
410 
411 
412 // DMA transfer direction
413 typedef enum _PLX_DMA_DIR
414 {
415  PLX_DMA_PCI_TO_LOC = 0, // DMA PCI --> Local bus (9000 DMA)
416  PLX_DMA_LOC_TO_PCI = 1, // DMA Local bus --> PCI (9000 DMA)
417  PLX_DMA_USER_TO_PCI = PLX_DMA_PCI_TO_LOC, // DMA User buffer --> PCI (8000 DMA)
418  PLX_DMA_PCI_TO_USER = PLX_DMA_LOC_TO_PCI // DMA PCI --> User buffer (8000 DMA)
419 } PLX_DMA_DIR;
420 
421 
422 // DMA Descriptor Mode
423 typedef enum _PLX_DMA_DESCR_MODE
424 {
425  PLX_DMA_MODE_BLOCK = 0, // DMA Block transfer mode
426  PLX_DMA_MODE_SGL = 1, // DMA SGL with descriptors off-chip
427  PLX_DMA_MODE_SGL_INTERNAL = 2 // DMA SGL with descriptors on-chip
428 } PLX_DMA_DESCR_MODE;
429 
430 
431 // DMA Ring Delay Period
432 typedef enum _PLX_DMA_RING_DELAY_TIME
433 {
434  PLX_DMA_RING_DELAY_0 = 0,
435  PLX_DMA_RING_DELAY_1us = 1,
436  PLX_DMA_RING_DELAY_2us = 2,
437  PLX_DMA_RING_DELAY_8us = 3,
438  PLX_DMA_RING_DELAY_32us = 4,
439  PLX_DMA_RING_DELAY_128us = 5,
440  PLX_DMA_RING_DELAY_512us = 6,
441  PLX_DMA_RING_DELAY_1ms = 7
442 } PLX_DMA_RING_DELAY_TIME;
443 
444 
445 // DMA Maximum Source Transfer Size
446 typedef enum _PLX_DMA_MAX_SRC_TSIZE
447 {
448  PLX_DMA_MAX_SRC_TSIZE_64B = 0,
449  PLX_DMA_MAX_SRC_TSIZE_128B = 1,
450  PLX_DMA_MAX_SRC_TSIZE_256B = 2,
451  PLX_DMA_MAX_SRC_TSIZE_512B = 3,
452  PLX_DMA_MAX_SRC_TSIZE_1K = 4,
453  PLX_DMA_MAX_SRC_TSIZE_2K = 5,
454  PLX_DMA_MAX_SRC_TSIZE_4K = 7
455 } PLX_DMA_SRC_MAX_TSIZE;
456 
457 
458 // Performance monitor control
459 typedef enum _PLX_PERF_CMD
460 {
461  PLX_PERF_CMD_START,
462  PLX_PERF_CMD_STOP,
463 } PLX_PERF_CMD;
464 
465 
466 // DMA Maximum Source Transfer Size
467 typedef enum _PLX_SWITCH_MODE
468 {
469  PLX_SWITCH_MODE_STANDARD = 0,
470  PLX_SWITCH_MODE_MULTI_HOST = 2
471 } PLX_SWITCH_MODE;
472 
473 
474 // Used for device power state. Added for code compatability with Linux
475 #if !defined(PLX_MSWINDOWS)
476  typedef enum _DEVICE_POWER_STATE
477  {
478  PowerDeviceUnspecified = 0,
479  PowerDeviceD0,
480  PowerDeviceD1,
481  PowerDeviceD2,
482  PowerDeviceD3,
483  PowerDeviceMaximum
484  } DEVICE_POWER_STATE;
485 #endif
486 
487 
488 // Properties of API access mode
489 typedef struct _PLX_MODE_PROP
490 {
491  union
492  {
493  struct
494  {
495  U16 I2cPort;
496  U16 SlaveAddr;
497  U32 ClockRate;
498  } I2c;
499 
500  struct
501  {
502  U64 IpAddress;
503  } Tcp;
504  };
505 } PLX_MODE_PROP;
506 
507 
508 // PLX version information
509 typedef struct _PLX_VERSION
510 {
511  PLX_API_MODE ApiMode;
512 
513  union
514  {
515  struct
516  {
517  U16 ApiLibrary; // API library version
518  U16 Software; // Software version
519  U16 Firmware; // Firmware version
520  U16 Hardware; // Hardware version
521  U16 SwReqByFw; // Firmware requires software must be >= this version
522  U16 FwReqBySw; // Software requires firmware must be >= this version
523  U16 ApiReqBySw; // Software requires API interface must be >= this version
524  U32 Features; // Bitmask of supported features
525  } I2c;
526  };
527 } PLX_VERSION;
528 
529 
530 // PCI Memory Structure
531 typedef struct _PLX_PHYSICAL_MEM
532 {
533  U64 UserAddr; // User-mode virtual address
534  U64 PhysicalAddr; // Bus physical address
535  U64 CpuPhysical; // CPU physical address
536  U32 Size; // Size of the buffer
538 
539 
540 // PLX Driver Properties
541 typedef struct _PLX_DRIVER_PROP
542 {
543  U32 Version; // Driver version
544  char Name[16]; // Driver name
545  char FullName[255]; // Full driver name
546  U8 bIsServiceDriver; // Is service driver or PnP driver?
547  U64 AcpiPcieEcam; // Base address of PCIe ECAM
548  U8 Reserved[40]; // Reserved for future use
550 
551 
552 // PCI BAR Properties
553 typedef struct _PLX_PCI_BAR_PROP
554 {
555  U64 BarValue; // Actual value in BAR
556  U64 Physical; // BAR Physical Address
557  U64 Size; // Size of BAR space
558  U32 Flags; // Additional BAR properties
560 
561 
562 // Used for getting the port properties and status
563 typedef struct _PLX_PORT_PROP
564 {
565  U8 PortType; // Port configuration
566  U8 PortNumber; // Internal port number
567  U8 LinkWidth; // Negotiated port link width
568  U8 MaxLinkWidth; // Max link width device is capable of
569  U8 LinkSpeed; // Negotiated link speed
570  U8 MaxLinkSpeed; // Max link speed device is capable of
571  U16 MaxReadReqSize; // Max read request size allowed
572  U16 MaxPayloadSize; // Max payload size setting
573  U16 MaxPayloadSupported; // Max payload size supported by device
574  U8 bNonPcieDevice; // Flag whether device is a PCIe device
575 } PLX_PORT_PROP;
576 
577 
578 // Used for getting the multi-host switch properties
579 typedef struct _PLX_MULTI_HOST_PROP
580 {
581  U8 SwitchMode; // Current switch mode
582  U16 VS_EnabledMask; // Bit for each enabled Virtual Switch
583  U8 VS_UpstreamPortNum[8]; // Upstream port number of each Virtual Switch
584  U32 VS_DownstreamPorts[8]; // Downstream ports associated with a Virtual Switch
585  U8 bIsMgmtPort; // Is selected device management port
586  U8 bMgmtPortActiveEn; // Is active management port enabled
587  U8 MgmtPortNumActive; // Active management port
588  U8 bMgmtPortRedundantEn; // Is redundant management port enabled
589  U8 MgmtPortNumRedundant; // Redundant management port
591 
592 
593 // PLX EEPROM entry
594 typedef struct _PLX_EEPROM_ENTRY
595 {
596  U8 ChipPort; // Destination port
597  U32 Offset; // Register offset
598  U32 Value; // Register value
599  char Comment[100]; // User entry-specific comments
601 
602 
603 // PLX EEEPROM structure
604 typedef struct _PLX_EEPROM_PROP
605 {
606  U8 Signature; // EEPROM signature (5Ah = Valid)
607  U8 bLoadRegs; // Load registers from EEPROM? (8111/8112)
608  U8 bLoadSharedMem; // Load shared mem from EEPROM? (8111/8112)
609  char Comment[200]; // User comments about the EEPROM
610  U16 RegCount; // Number of register entries
611  PLX_EEPROM_ENTRY RegEntry[1]; // EEPROM register entries
613 
614 
615 // PCI Device Key Identifier
616 typedef struct _PLX_DEVICE_KEY
617 {
618  U32 IsValidTag; // Magic number to determine validity
619  U8 domain; // Physical device location
620  U8 bus;
621  U8 slot;
622  U8 function;
623  U16 VendorId; // Device Identifier
624  U16 DeviceId;
625  U16 SubVendorId;
626  U16 SubDeviceId;
627  U8 Revision;
628  U16 PlxChip; // PLX chip type
629  U8 PlxRevision; // PLX chip revision
630  U8 PlxFamily; // PLX chip family
631  U8 ApiIndex; // Used internally by the API
632  U16 DeviceNumber; // Used internally by device drivers
633  U8 ApiMode; // Mode API uses to access device
634  U8 PlxPort; // PLX port number of device
635  U8 NTPortType; // If NT port, stores NT port type
636  U8 NTPortNum; // If NT port exists, store NT port number
637  U8 DeviceMode; // Device mode used internally by API
638  U32 ApiInternal[2]; // Reserved for internal PLX API use
640 
641 
642 // PLX Device Object Structure
643 typedef struct _PLX_DEVICE_OBJECT
644 {
645  U32 IsValidTag; // Magic number to determine validity
646  PLX_DEVICE_KEY Key; // Device location key identifier
647  PLX_DRIVER_HANDLE hDevice; // Handle to driver
648  PLX_PCI_BAR_PROP PciBar[6]; // PCI BAR properties
649  U64 PciBarVa[6]; // For PCI BAR user-mode BAR mappings
650  U8 BarMapRef[6]; // BAR map count used by API
651  PLX_PHYSICAL_MEM CommonBuffer; // Used to store common buffer information
652  U64 PrivateData[4];// Private storage for user application
654 
655 
656 // PLX Notification Object
657 typedef struct _PLX_NOTIFY_OBJECT
658 {
659  U32 IsValidTag; // Magic number to determine validity
660  U64 pWaitObject; // -- INTERNAL -- Wait object used by the driver
661  U64 hEvent; // User event handle (HANDLE can be 32 or 64 bit)
663 
664 
665 // PLX Interrupt Structure
666 typedef struct _PLX_INTERRUPT
667 {
668  U32 Doorbell; // Up to 32 doorbells
669  U8 PciMain :1;
670  U8 PciAbort :1;
671  U8 LocalToPci :2; // Local->PCI interrupts 1 & 2
672  U8 DmaDone :4; // DMA channel 0-3 interrupts
673  U8 DmaPauseDone :4;
674  U8 DmaAbortDone :4;
675  U8 DmaImmedStopDone :4;
676  U8 DmaInvalidDescr :4;
677  U8 DmaError :4;
678  U8 MuInboundPost :1;
679  U8 MuOutboundPost :1;
680  U8 MuOutboundOverflow :1;
681  U8 TargetRetryAbort :1;
682  U8 Message :4; // 6000 NT 0-3 message interrupts
683  U8 SwInterrupt :1;
684  U8 ResetDeassert :1;
685  U8 PmeDeassert :1;
686  U8 GPIO_4_5 :1; // 6000 NT GPIO 4/5 interrupt
687  U8 GPIO_14_15 :1; // 6000 NT GPIO 14/15 interrupt
688  U8 NTV_LE_Correctable :1; // 8000 NT Virtual - Link-side error interrupts
689  U8 NTV_LE_Uncorrectable :1;
690  U8 NTV_LE_LinkStateChange :1;
691  U8 NTV_LE_UncorrErrorMsg :1;
692  U8 HotPlugAttention :1;
693  U8 HotPlugPowerFault :1;
694  U8 HotPlugMrlSensor :1;
695  U8 HotPlugChangeDetect :1;
696  U8 HotPlugCmdCompleted :1;
697 } PLX_INTERRUPT;
698 
699 
700 // DMA Channel Properties Structure
701 typedef struct _PLX_DMA_PROP
702 {
703  // 8000 DMA properties
704  U8 CplStatusWriteBack :1;
705  U8 DescriptorMode :2;
706  U8 DescriptorPollMode :1;
707  U8 RingHaltAtEnd :1;
708  U8 RingWrapDelayTime :3;
709  U8 RelOrderDescrRead :1;
710  U8 RelOrderDescrWrite :1;
711  U8 RelOrderDataReadReq :1;
712  U8 RelOrderDataWrite :1;
713  U8 NoSnoopDescrRead :1;
714  U8 NoSnoopDescrWrite :1;
715  U8 NoSnoopDataReadReq :1;
716  U8 NoSnoopDataWrite :1;
717  U8 MaxSrcXferSize :3;
718  U8 MaxDestWriteSize :3;
719  U8 TrafficClass :3;
720  U8 MaxPendingReadReq :6;
721  U8 DescriptorPollTime;
722  U8 MaxDescriptorFetch;
723  U16 ReadReqDelayClocks;
724 
725  // 9000 DMA properties
726  U8 ReadyInput :1;
727  U8 Burst :1;
728  U8 BurstInfinite :1;
729  U8 SglMode :1;
730  U8 DoneInterrupt :1;
731  U8 RouteIntToPci :1;
732  U8 ConstAddrLocal :1;
733  U8 WriteInvalidMode :1;
734  U8 DemandMode :1;
735  U8 EnableEOT :1;
736  U8 FastTerminateMode :1;
737  U8 ClearCountMode :1;
738  U8 DualAddressMode :1;
739  U8 EOTEndLink :1;
740  U8 ValidMode :1;
741  U8 ValidStopControl :1;
742  U8 LocalBusWidth :2;
743  U8 WaitStates :4;
744 } PLX_DMA_PROP;
745 
746 
747 // DMA Transfer Parameters
748 typedef struct _PLX_DMA_PARAMS
749 {
750  U64 UserVa; // User buffer virtual address
751  U64 AddrSource; // Source address (8000 DMA)
752  U64 AddrDest; // Destination address (8000 DMA)
753  U64 PciAddr; // PCI address (9000 DMA)
754  U32 LocalAddr; // Local bus address (9000 DMA)
755  U32 ByteCount; // Number of bytes to transfer
756  U8 Direction; // Direction of transfer (Local<->PCI, User<->PCI) (9000 DMA)
757  U8 bConstAddrSrc :1; // Constant source PCI address? (8000 DMA)
758  U8 bConstAddrDest :1; // Constant destination PCI address? (8000 DMA)
759  U8 bForceFlush :1; // Force DMA to flush write on final descriptor (8000 DMA)
760  U8 bIgnoreBlockInt :1; // For block mode only, do not enable DMA done interrupt
762 
763 
764 // Performance properties
765 typedef struct _PLX_PERF_PROP
766 {
767  U32 IsValidTag; // Magic number to determine validity
768 
769  // Port properties
770  U8 PortNumber;
771  U8 LinkWidth;
772  U8 LinkSpeed;
773  U8 Station;
774  U8 StationPort;
775 
776  // Ingress counters
777  U32 IngressPostedHeader;
778  U32 IngressPostedDW;
779  U32 IngressNonpostedDW;
780  U32 IngressCplHeader;
781  U32 IngressCplDW;
782  U32 IngressDllp;
783  U32 IngressPhy;
784 
785  // Egress counters
786  U32 EgressPostedHeader;
787  U32 EgressPostedDW;
788  U32 EgressNonpostedDW;
789  U32 EgressCplHeader;
790  U32 EgressCplDW;
791  U32 EgressDllp;
792  U32 EgressPhy;
793 
794  // Storage for previous counter values
795 
796  // Previous Ingress counters
797  U32 Prev_IngressPostedHeader;
798  U32 Prev_IngressPostedDW;
799  U32 Prev_IngressNonpostedDW;
800  U32 Prev_IngressCplHeader;
801  U32 Prev_IngressCplDW;
802  U32 Prev_IngressDllp;
803  U32 Prev_IngressPhy;
804 
805  // Previous Egress counters
806  U32 Prev_EgressPostedHeader;
807  U32 Prev_EgressPostedDW;
808  U32 Prev_EgressNonpostedDW;
809  U32 Prev_EgressCplHeader;
810  U32 Prev_EgressCplDW;
811  U32 Prev_EgressDllp;
812  U32 Prev_EgressPhy;
813 } PLX_PERF_PROP;
814 
815 
816 // Performance statistics
817 typedef struct _PLX_PERF_STATS
818 {
819  S64 IngressTotalBytes; // Total bytes including overhead
820  long double IngressTotalByteRate; // Total byte rate
821  S64 IngressCplAvgPerReadReq; // Average number of completion TLPs for read requests
822  S64 IngressCplAvgBytesPerTlp; // Average number of bytes per completion TLPs
823  S64 IngressPayloadReadBytes; // Payload bytes read (Completion TLPs)
824  S64 IngressPayloadReadBytesAvg; // Average payload bytes for reads (Completion TLPs)
825  S64 IngressPayloadWriteBytes; // Payload bytes written (Posted TLPs)
826  S64 IngressPayloadWriteBytesAvg; // Average payload bytes for writes (Posted TLPs)
827  S64 IngressPayloadTotalBytes; // Payload total bytes
828  double IngressPayloadAvgPerTlp; // Payload average size per TLP
829  long double IngressPayloadByteRate; // Payload byte rate
830  long double IngressLinkUtilization; // Total link utilization
831 
832  S64 EgressTotalBytes; // Total byte including overhead
833  long double EgressTotalByteRate; // Total byte rate
834  S64 EgressCplAvgPerReadReq; // Average number of completion TLPs for read requests
835  S64 EgressCplAvgBytesPerTlp; // Average number of bytes per completion TLPs
836  S64 EgressPayloadReadBytes; // Payload bytes read (Completion TLPs)
837  S64 EgressPayloadReadBytesAvg; // Average payload bytes for reads (Completion TLPs)
838  S64 EgressPayloadWriteBytes; // Payload bytes written (Posted TLPs)
839  S64 EgressPayloadWriteBytesAvg; // Average payload bytes for writes (Posted TLPs)
840  S64 EgressPayloadTotalBytes; // Payload total bytes
841  double EgressPayloadAvgPerTlp; // Payload average size per TLP
842  long double EgressPayloadByteRate; // Payload byte rate
843  long double EgressLinkUtilization; // Total link utilization
845 
846 
847 
848 
849 #ifdef __cplusplus
850 }
851 #endif
852 
853 #endif
Definition: PlxTypes.h:657
Definition: PlxTypes.h:579
Definition: PlxTypes.h:604
Definition: PlxTypes.h:817
Definition: PlxTypes.h:594
Definition: PlxTypes.h:666
Definition: PlxTypes.h:701
Definition: PlxTypes.h:531
Definition: PlxTypes.h:765
Definition: PlxTypes.h:748
Definition: PlxTypes.h:541
Definition: PlxTypes.h:643
Definition: PlxTypes.h:489
Definition: PlxTypes.h:616
Definition: PlxTypes.h:553
Definition: PlxTypes.h:563
Definition: PlxTypes.h:509