amd-node-scraper 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- amd_node_scraper-0.0.1.dist-info/LICENSE +21 -0
- amd_node_scraper-0.0.1.dist-info/METADATA +424 -0
- amd_node_scraper-0.0.1.dist-info/RECORD +197 -0
- amd_node_scraper-0.0.1.dist-info/WHEEL +5 -0
- amd_node_scraper-0.0.1.dist-info/entry_points.txt +2 -0
- amd_node_scraper-0.0.1.dist-info/top_level.txt +1 -0
- nodescraper/__init__.py +32 -0
- nodescraper/base/__init__.py +34 -0
- nodescraper/base/inbandcollectortask.py +118 -0
- nodescraper/base/inbanddataplugin.py +39 -0
- nodescraper/base/regexanalyzer.py +120 -0
- nodescraper/cli/__init__.py +29 -0
- nodescraper/cli/cli.py +511 -0
- nodescraper/cli/constants.py +27 -0
- nodescraper/cli/dynamicparserbuilder.py +171 -0
- nodescraper/cli/helper.py +517 -0
- nodescraper/cli/inputargtypes.py +129 -0
- nodescraper/configbuilder.py +123 -0
- nodescraper/configregistry.py +66 -0
- nodescraper/configs/node_status.json +19 -0
- nodescraper/connection/__init__.py +25 -0
- nodescraper/connection/inband/__init__.py +46 -0
- nodescraper/connection/inband/inband.py +171 -0
- nodescraper/connection/inband/inbandlocal.py +93 -0
- nodescraper/connection/inband/inbandmanager.py +151 -0
- nodescraper/connection/inband/inbandremote.py +173 -0
- nodescraper/connection/inband/sshparams.py +43 -0
- nodescraper/constants.py +26 -0
- nodescraper/enums/__init__.py +40 -0
- nodescraper/enums/eventcategory.py +89 -0
- nodescraper/enums/eventpriority.py +42 -0
- nodescraper/enums/executionstatus.py +44 -0
- nodescraper/enums/osfamily.py +34 -0
- nodescraper/enums/systeminteraction.py +41 -0
- nodescraper/enums/systemlocation.py +33 -0
- nodescraper/generictypes.py +36 -0
- nodescraper/interfaces/__init__.py +44 -0
- nodescraper/interfaces/connectionmanager.py +143 -0
- nodescraper/interfaces/dataanalyzertask.py +138 -0
- nodescraper/interfaces/datacollectortask.py +185 -0
- nodescraper/interfaces/dataplugin.py +356 -0
- nodescraper/interfaces/plugin.py +127 -0
- nodescraper/interfaces/resultcollator.py +56 -0
- nodescraper/interfaces/task.py +164 -0
- nodescraper/interfaces/taskresulthook.py +39 -0
- nodescraper/models/__init__.py +48 -0
- nodescraper/models/analyzerargs.py +93 -0
- nodescraper/models/collectorargs.py +30 -0
- nodescraper/models/connectionconfig.py +34 -0
- nodescraper/models/datamodel.py +171 -0
- nodescraper/models/datapluginresult.py +39 -0
- nodescraper/models/event.py +158 -0
- nodescraper/models/pluginconfig.py +38 -0
- nodescraper/models/pluginresult.py +39 -0
- nodescraper/models/systeminfo.py +44 -0
- nodescraper/models/taskresult.py +185 -0
- nodescraper/models/timerangeargs.py +38 -0
- nodescraper/pluginexecutor.py +274 -0
- nodescraper/pluginregistry.py +152 -0
- nodescraper/plugins/__init__.py +25 -0
- nodescraper/plugins/inband/__init__.py +25 -0
- nodescraper/plugins/inband/amdsmi/__init__.py +28 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_analyzer.py +821 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_collector.py +1313 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_plugin.py +43 -0
- nodescraper/plugins/inband/amdsmi/amdsmidata.py +1002 -0
- nodescraper/plugins/inband/amdsmi/analyzer_args.py +50 -0
- nodescraper/plugins/inband/amdsmi/cper.py +65 -0
- nodescraper/plugins/inband/bios/__init__.py +29 -0
- nodescraper/plugins/inband/bios/analyzer_args.py +64 -0
- nodescraper/plugins/inband/bios/bios_analyzer.py +93 -0
- nodescraper/plugins/inband/bios/bios_collector.py +93 -0
- nodescraper/plugins/inband/bios/bios_plugin.py +43 -0
- nodescraper/plugins/inband/bios/biosdata.py +30 -0
- nodescraper/plugins/inband/cmdline/__init__.py +25 -0
- nodescraper/plugins/inband/cmdline/analyzer_args.py +80 -0
- nodescraper/plugins/inband/cmdline/cmdline_analyzer.py +113 -0
- nodescraper/plugins/inband/cmdline/cmdline_collector.py +77 -0
- nodescraper/plugins/inband/cmdline/cmdline_plugin.py +43 -0
- nodescraper/plugins/inband/cmdline/cmdlinedata.py +30 -0
- nodescraper/plugins/inband/device_enumeration/__init__.py +29 -0
- nodescraper/plugins/inband/device_enumeration/analyzer_args.py +73 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_analyzer.py +81 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_collector.py +176 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_plugin.py +45 -0
- nodescraper/plugins/inband/device_enumeration/deviceenumdata.py +36 -0
- nodescraper/plugins/inband/dimm/__init__.py +25 -0
- nodescraper/plugins/inband/dimm/collector_args.py +31 -0
- nodescraper/plugins/inband/dimm/dimm_collector.py +151 -0
- nodescraper/plugins/inband/dimm/dimm_plugin.py +40 -0
- nodescraper/plugins/inband/dimm/dimmdata.py +30 -0
- nodescraper/plugins/inband/dkms/__init__.py +25 -0
- nodescraper/plugins/inband/dkms/analyzer_args.py +85 -0
- nodescraper/plugins/inband/dkms/dkms_analyzer.py +106 -0
- nodescraper/plugins/inband/dkms/dkms_collector.py +76 -0
- nodescraper/plugins/inband/dkms/dkms_plugin.py +43 -0
- nodescraper/plugins/inband/dkms/dkmsdata.py +33 -0
- nodescraper/plugins/inband/dmesg/__init__.py +28 -0
- nodescraper/plugins/inband/dmesg/analyzer_args.py +33 -0
- nodescraper/plugins/inband/dmesg/collector_args.py +39 -0
- nodescraper/plugins/inband/dmesg/dmesg_analyzer.py +503 -0
- nodescraper/plugins/inband/dmesg/dmesg_collector.py +164 -0
- nodescraper/plugins/inband/dmesg/dmesg_plugin.py +44 -0
- nodescraper/plugins/inband/dmesg/dmesgdata.py +116 -0
- nodescraper/plugins/inband/fabrics/__init__.py +28 -0
- nodescraper/plugins/inband/fabrics/fabrics_collector.py +726 -0
- nodescraper/plugins/inband/fabrics/fabrics_plugin.py +37 -0
- nodescraper/plugins/inband/fabrics/fabricsdata.py +140 -0
- nodescraper/plugins/inband/journal/__init__.py +28 -0
- nodescraper/plugins/inband/journal/collector_args.py +33 -0
- nodescraper/plugins/inband/journal/journal_collector.py +107 -0
- nodescraper/plugins/inband/journal/journal_plugin.py +40 -0
- nodescraper/plugins/inband/journal/journaldata.py +44 -0
- nodescraper/plugins/inband/kernel/__init__.py +25 -0
- nodescraper/plugins/inband/kernel/analyzer_args.py +64 -0
- nodescraper/plugins/inband/kernel/kernel_analyzer.py +91 -0
- nodescraper/plugins/inband/kernel/kernel_collector.py +129 -0
- nodescraper/plugins/inband/kernel/kernel_plugin.py +43 -0
- nodescraper/plugins/inband/kernel/kerneldata.py +32 -0
- nodescraper/plugins/inband/kernel_module/__init__.py +25 -0
- nodescraper/plugins/inband/kernel_module/analyzer_args.py +59 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_analyzer.py +211 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_collector.py +264 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_data.py +60 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_plugin.py +43 -0
- nodescraper/plugins/inband/memory/__init__.py +25 -0
- nodescraper/plugins/inband/memory/analyzer_args.py +45 -0
- nodescraper/plugins/inband/memory/memory_analyzer.py +98 -0
- nodescraper/plugins/inband/memory/memory_collector.py +330 -0
- nodescraper/plugins/inband/memory/memory_plugin.py +43 -0
- nodescraper/plugins/inband/memory/memorydata.py +90 -0
- nodescraper/plugins/inband/network/__init__.py +28 -0
- nodescraper/plugins/inband/network/network_collector.py +1828 -0
- nodescraper/plugins/inband/network/network_plugin.py +37 -0
- nodescraper/plugins/inband/network/networkdata.py +319 -0
- nodescraper/plugins/inband/nvme/__init__.py +28 -0
- nodescraper/plugins/inband/nvme/nvme_collector.py +167 -0
- nodescraper/plugins/inband/nvme/nvme_plugin.py +37 -0
- nodescraper/plugins/inband/nvme/nvmedata.py +45 -0
- nodescraper/plugins/inband/os/__init__.py +25 -0
- nodescraper/plugins/inband/os/analyzer_args.py +64 -0
- nodescraper/plugins/inband/os/os_analyzer.py +73 -0
- nodescraper/plugins/inband/os/os_collector.py +131 -0
- nodescraper/plugins/inband/os/os_plugin.py +43 -0
- nodescraper/plugins/inband/os/osdata.py +31 -0
- nodescraper/plugins/inband/package/__init__.py +25 -0
- nodescraper/plugins/inband/package/analyzer_args.py +48 -0
- nodescraper/plugins/inband/package/package_analyzer.py +253 -0
- nodescraper/plugins/inband/package/package_collector.py +273 -0
- nodescraper/plugins/inband/package/package_plugin.py +43 -0
- nodescraper/plugins/inband/package/packagedata.py +41 -0
- nodescraper/plugins/inband/pcie/__init__.py +29 -0
- nodescraper/plugins/inband/pcie/analyzer_args.py +63 -0
- nodescraper/plugins/inband/pcie/pcie_analyzer.py +1081 -0
- nodescraper/plugins/inband/pcie/pcie_collector.py +690 -0
- nodescraper/plugins/inband/pcie/pcie_data.py +2017 -0
- nodescraper/plugins/inband/pcie/pcie_plugin.py +43 -0
- nodescraper/plugins/inband/process/__init__.py +25 -0
- nodescraper/plugins/inband/process/analyzer_args.py +45 -0
- nodescraper/plugins/inband/process/collector_args.py +31 -0
- nodescraper/plugins/inband/process/process_analyzer.py +91 -0
- nodescraper/plugins/inband/process/process_collector.py +115 -0
- nodescraper/plugins/inband/process/process_plugin.py +46 -0
- nodescraper/plugins/inband/process/processdata.py +34 -0
- nodescraper/plugins/inband/rocm/__init__.py +25 -0
- nodescraper/plugins/inband/rocm/analyzer_args.py +66 -0
- nodescraper/plugins/inband/rocm/rocm_analyzer.py +100 -0
- nodescraper/plugins/inband/rocm/rocm_collector.py +205 -0
- nodescraper/plugins/inband/rocm/rocm_plugin.py +43 -0
- nodescraper/plugins/inband/rocm/rocmdata.py +62 -0
- nodescraper/plugins/inband/storage/__init__.py +25 -0
- nodescraper/plugins/inband/storage/analyzer_args.py +38 -0
- nodescraper/plugins/inband/storage/collector_args.py +31 -0
- nodescraper/plugins/inband/storage/storage_analyzer.py +152 -0
- nodescraper/plugins/inband/storage/storage_collector.py +110 -0
- nodescraper/plugins/inband/storage/storage_plugin.py +44 -0
- nodescraper/plugins/inband/storage/storagedata.py +70 -0
- nodescraper/plugins/inband/sysctl/__init__.py +29 -0
- nodescraper/plugins/inband/sysctl/analyzer_args.py +67 -0
- nodescraper/plugins/inband/sysctl/sysctl_analyzer.py +81 -0
- nodescraper/plugins/inband/sysctl/sysctl_collector.py +101 -0
- nodescraper/plugins/inband/sysctl/sysctl_plugin.py +43 -0
- nodescraper/plugins/inband/sysctl/sysctldata.py +42 -0
- nodescraper/plugins/inband/syslog/__init__.py +28 -0
- nodescraper/plugins/inband/syslog/syslog_collector.py +121 -0
- nodescraper/plugins/inband/syslog/syslog_plugin.py +37 -0
- nodescraper/plugins/inband/syslog/syslogdata.py +46 -0
- nodescraper/plugins/inband/uptime/__init__.py +25 -0
- nodescraper/plugins/inband/uptime/uptime_collector.py +88 -0
- nodescraper/plugins/inband/uptime/uptime_plugin.py +37 -0
- nodescraper/plugins/inband/uptime/uptimedata.py +31 -0
- nodescraper/resultcollators/__init__.py +25 -0
- nodescraper/resultcollators/tablesummary.py +159 -0
- nodescraper/taskresulthooks/__init__.py +28 -0
- nodescraper/taskresulthooks/filesystemloghook.py +88 -0
- nodescraper/typeutils.py +171 -0
- nodescraper/utils.py +412 -0
|
@@ -0,0 +1,2017 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from enum import Enum
|
|
27
|
+
from typing import (
|
|
28
|
+
Annotated,
|
|
29
|
+
Any,
|
|
30
|
+
ClassVar,
|
|
31
|
+
Dict,
|
|
32
|
+
Generator,
|
|
33
|
+
List,
|
|
34
|
+
Optional,
|
|
35
|
+
TypeVar,
|
|
36
|
+
Union,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
from pydantic import (
|
|
40
|
+
AfterValidator,
|
|
41
|
+
BaseModel,
|
|
42
|
+
SerializeAsAny,
|
|
43
|
+
field_serializer,
|
|
44
|
+
field_validator,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
from nodescraper.models import DataModel
|
|
48
|
+
from nodescraper.utils import apply_bit_mask_int
|
|
49
|
+
|
|
50
|
+
AnyCap = TypeVar("AnyCap")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def validate_bdf(bdf: str) -> str:
|
|
54
|
+
"""Validate the bus-device-function string format"""
|
|
55
|
+
if not isinstance(bdf, str):
|
|
56
|
+
raise ValueError("BDF must be a string")
|
|
57
|
+
# Shall only contain hex digits, `.`, `:`, and `-`
|
|
58
|
+
if not all(c in "0123456789abcdefABCDEF.-:" for c in bdf):
|
|
59
|
+
raise ValueError("BDF must only contain hex digits, '.', ':', and '-'")
|
|
60
|
+
# TODO: Could add more specific validation for the format, e.g., 00:00.0
|
|
61
|
+
return bdf
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
BdfStr = Annotated[str, AfterValidator(validate_bdf)]
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def field_hex_val_serializer(self, value: Optional[int], _info) -> Optional[str]:
|
|
68
|
+
if value is None:
|
|
69
|
+
return None
|
|
70
|
+
return str(hex(value))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def field_hex_val_validator(value: Optional[str]) -> Optional[int]:
|
|
74
|
+
if value is None:
|
|
75
|
+
return None
|
|
76
|
+
return int(value, 16)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class CapabilityEnum(Enum):
|
|
80
|
+
"""This enum holds the capability IDs for PCI Configuration Space"""
|
|
81
|
+
|
|
82
|
+
BASE_REGISTER = 0x00 # Null Capability
|
|
83
|
+
PM = 0x01 # PCI Power Management Interface
|
|
84
|
+
AGP = 0x02 # AGP
|
|
85
|
+
VPD = 0x03 # VPD
|
|
86
|
+
SLOTID = 0x04 # Slot Identification
|
|
87
|
+
MSI = 0x05 # MSI
|
|
88
|
+
COMPACT_PCI_HS = 0x06 # CompactPCI Hot Swap
|
|
89
|
+
PCIX = 0x07 # PCI-X
|
|
90
|
+
HYPERTRANS = 0x08 # HyperTransport
|
|
91
|
+
VENDOR = 0x09 # Vendor-specific
|
|
92
|
+
DEBUG_PORT = 0x0A # Debug Port
|
|
93
|
+
COMPACT_PCI_CENTRAL = 0x0B # CompactPCI Central Resource Control
|
|
94
|
+
PCI_HP = 0x0C # PCI Hot Plug
|
|
95
|
+
PCI_BRIDGE = 0x0D # PCI Bridge Subsstem ID
|
|
96
|
+
AGP_8X = 0x0E # AGP 8x y
|
|
97
|
+
SECURE_DEV = 0x0F # Secure Device
|
|
98
|
+
PCIE_EXP = 0x10 # PCI Express
|
|
99
|
+
MSIX = 0x11 # MSI-X
|
|
100
|
+
SATA = 0x12 # Serial ATA Data/Index
|
|
101
|
+
AF = 0x13 # Advanced Features
|
|
102
|
+
EA = 0x14 # Enhanced Allocation .
|
|
103
|
+
FPB = 0x15 # Flattening Portal Bridge (FPB)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
MAX_CAP_ID = max(cap_id.value for cap_id in CapabilityEnum)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class ExtendedCapabilityEnum(Enum):
|
|
110
|
+
"""This enum holds the extended capability IDs for PCI Configuration Space"""
|
|
111
|
+
|
|
112
|
+
NULL = 0x0000 # Null Capability
|
|
113
|
+
AER = 0x0001 # Advanced Error Reporting Extended
|
|
114
|
+
VCEC = 0x0002 # Virtual Channel Extended Capability
|
|
115
|
+
DSN = 0x0003 # Device Serial Number Extended Capability
|
|
116
|
+
PWR_BUDGET = 0x0004 # Power Budgeting Extended Capability
|
|
117
|
+
LNK_DCLR = 0x0005 # Root Complex Link Declaration Extended Capability
|
|
118
|
+
LNK_CEC = 0x0006 # Root Complex Internal Link Control Extended Capability
|
|
119
|
+
RCECOLL = 0x0007 # Root Complex Event Collector Endpoint Association Extended Capability
|
|
120
|
+
MFVC = 0x0008 # Multi-Function Virtual Channel Extended Capability
|
|
121
|
+
VC2 = 0x0009 # Virtual Channel Extended Capability
|
|
122
|
+
RCRB = 0x000A # RCRB Header Extended Capability
|
|
123
|
+
VNDR = 0x000B # Vendor-specific Extended Capability
|
|
124
|
+
CAC = 0x000C # Configuration Access Correlation Extended Capability
|
|
125
|
+
ACS = 0x000D # ACS Extended Capability
|
|
126
|
+
ARI = 0x000E # ARI Extended Capability (ARI)
|
|
127
|
+
ATS = 0x000F # ATS Extended Capability
|
|
128
|
+
SRIOV = 0x0010 # SR-IOV Extended Capability
|
|
129
|
+
MRIOV = 0x0011 # MR-IOV Extended Capability (MR-IOV) Must not implement.
|
|
130
|
+
MULTCAST = 0x0012 # Multicast Extended Capability
|
|
131
|
+
PAGE_REQ = 0x0013 # Page Request Extended Capability (PRI)
|
|
132
|
+
AMD = 0x0014 # Reserved for AMD
|
|
133
|
+
RBAR = 0x0015 # Resizable BAR Extended Capability
|
|
134
|
+
DPA = 0x0016 # Dynamic Power Allocation Extended Capability (DPA)
|
|
135
|
+
TPH = 0x0017 # TPH Requester Extended Capability
|
|
136
|
+
LTR = (
|
|
137
|
+
0x0018 # LTR Extended Capability . LTR is controlled using Function 0 which is never a VF.
|
|
138
|
+
)
|
|
139
|
+
SPCI = 0x0019 # Secondary PCI Express Extended Capability
|
|
140
|
+
PMUX = 0x001A # PMUX Extended Capability . PMUX is controlled using Function 0 which is never a VF.
|
|
141
|
+
PASID = 0x001B # PASID Extended Capability
|
|
142
|
+
LN = 0x001C # LN Requester Extended Capability (LNR)
|
|
143
|
+
DPC = 0x001D # DPC Extended Capability.
|
|
144
|
+
L1PM = 0x001E # L1 PM Substates Extended Capability . L1 PM Substates is controlled using Function 0 which is never a VF.
|
|
145
|
+
PTM = 0x001F # Precision Time Management Extended Capability (PTM)
|
|
146
|
+
MPCIE = 0x0020 # PCI Express over M-PHY Extended Capability (M-PCIe)
|
|
147
|
+
FRS = 0x0021 # FRS Queueing Extended Capability
|
|
148
|
+
RTR = 0x0022 # Readiness Time Reporting Extended Capability
|
|
149
|
+
DVENDR = 0x0023 # Designated vendor-specific Extended Capability
|
|
150
|
+
VFBAR = 0x0024 # VF Resizable BAR Extended Capability
|
|
151
|
+
DLF = 0x0025 # Data Link Feature Extended Capability .
|
|
152
|
+
PL_16GT = 0x0026 # Physical Layer 16.0 GT/s Extended Capability
|
|
153
|
+
LM = 0x0027 # Lane Margining at the Receiver Extended Capability
|
|
154
|
+
HID = 0x0028 # Hierarchy ID Extended Capability
|
|
155
|
+
NPEM = 0x0029 # Native PCIe Enclosure Management Extended Capability (NPEM)
|
|
156
|
+
PL_32GT = 0x002A # Physical Layer 32.0 GT/s Extended Capability
|
|
157
|
+
ALT_PROTOCOL = 0x002B # Alternate Protocol Extended Capability
|
|
158
|
+
SFI = 0x002C # System Firmware Intermediary (SFI)Extended Capability
|
|
159
|
+
DOE = 0x2E # 0x2e Data Object Exchange
|
|
160
|
+
INT_DOE = 0x30 # 0x30 Integrity and Data Encryption
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
MAX_ECAP_ID = max(cap_id.value for cap_id in ExtendedCapabilityEnum)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class PcieBitField(BaseModel):
|
|
167
|
+
"""Holds data about a bit field including bit_mask and description and a method to get its value"""
|
|
168
|
+
|
|
169
|
+
bit_mask: int
|
|
170
|
+
desc: str
|
|
171
|
+
val: Optional[int] = None
|
|
172
|
+
|
|
173
|
+
def set_val(self, reg_val: Optional[int]):
|
|
174
|
+
"""This will apply the bitmask and shift the value to get the bit field value"""
|
|
175
|
+
if reg_val is None:
|
|
176
|
+
self.val = None
|
|
177
|
+
else:
|
|
178
|
+
self.val = apply_bit_mask_int(reg_val, self.bit_mask)
|
|
179
|
+
|
|
180
|
+
def get_val(self) -> Optional[int]:
|
|
181
|
+
"""Returns the value of the bit field"""
|
|
182
|
+
return self.val
|
|
183
|
+
|
|
184
|
+
def apply_mask(self, reg_val) -> Optional[int]:
|
|
185
|
+
"""This will apply the bitmask and shift the value to get the bit field value
|
|
186
|
+
Ex: reg_val = 0x1200, bit_mask = 0xFF00, then the value of the bit field is 0x1200 & 0xFF00 -> 0x1200 >> 8 -> 0x12
|
|
187
|
+
"""
|
|
188
|
+
if reg_val is None:
|
|
189
|
+
return None
|
|
190
|
+
else:
|
|
191
|
+
return apply_bit_mask_int(reg_val, self.bit_mask)
|
|
192
|
+
|
|
193
|
+
validate_val = field_validator("val", mode="before")(field_hex_val_validator)
|
|
194
|
+
serialize_val = field_serializer("val")(field_hex_val_serializer)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class PcieRegister(BaseModel):
|
|
198
|
+
"""Holds data about a register including its position, width, value, bit fields and a method to get the value of a bit field
|
|
199
|
+
setpci_name is the name of the register in setpci output --dumpregs"""
|
|
200
|
+
|
|
201
|
+
width: int
|
|
202
|
+
offset: int
|
|
203
|
+
val: Optional[int] = None
|
|
204
|
+
desc: str = ""
|
|
205
|
+
err: Optional[str] = None
|
|
206
|
+
|
|
207
|
+
def iter_fields(self) -> Generator[tuple[str, PcieBitField], Any, None]:
|
|
208
|
+
"""Iterator for bit fields in the register"""
|
|
209
|
+
for name, value in iter(self):
|
|
210
|
+
if isinstance(value, PcieBitField):
|
|
211
|
+
yield name, value
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
def bit_fields(self) -> dict[str, PcieBitField]:
|
|
215
|
+
"""Get all the bit fields in the register"""
|
|
216
|
+
return {name: value for name, value in self.iter_fields()}
|
|
217
|
+
|
|
218
|
+
# This will serialize the value of the register as hex
|
|
219
|
+
serialize_val = field_serializer("val")(field_hex_val_serializer)
|
|
220
|
+
|
|
221
|
+
# This will validate the value of the register from hex to int
|
|
222
|
+
validate_val = field_validator("val", mode="before")(field_hex_val_validator)
|
|
223
|
+
|
|
224
|
+
def __setattr__(self, name, value):
|
|
225
|
+
"""When the value of the register is set, set all the bit fields in the register automatically
|
|
226
|
+
otherwise just set the value"""
|
|
227
|
+
if name == "val":
|
|
228
|
+
# set all .vals in all bitfields
|
|
229
|
+
for _, field in self.iter_fields():
|
|
230
|
+
field.set_val(value)
|
|
231
|
+
super().__setattr__(name, value)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class PcieCapStructure(BaseModel):
|
|
235
|
+
"""Holds the capability and extended capability info including the ID and description as well as
|
|
236
|
+
the registers that exists within that capability structure."""
|
|
237
|
+
|
|
238
|
+
cap_id: ClassVar[Enum]
|
|
239
|
+
desc: str
|
|
240
|
+
offset: int = 0
|
|
241
|
+
extended: Optional[bool] = False
|
|
242
|
+
|
|
243
|
+
def iter_regs(self) -> Generator[tuple[str, PcieRegister], Any, None]:
|
|
244
|
+
"""Iterator for bit fields in the register"""
|
|
245
|
+
for name, value in iter(self):
|
|
246
|
+
if isinstance(value, PcieRegister):
|
|
247
|
+
yield name, value
|
|
248
|
+
|
|
249
|
+
def set_regs(self, values: Dict[str, int]):
|
|
250
|
+
for name, value in iter(self):
|
|
251
|
+
if isinstance(value, PcieRegister):
|
|
252
|
+
value.val = values.get(name, None)
|
|
253
|
+
|
|
254
|
+
def null_err_regs(self, filters: Optional[List[str]] = None):
|
|
255
|
+
"""Set all registers to None, except those in the filters list"""
|
|
256
|
+
err_null = []
|
|
257
|
+
for name, reg in self.iter_regs():
|
|
258
|
+
if filters is not None:
|
|
259
|
+
if name in filters and (reg.val is None or reg.err is not None):
|
|
260
|
+
err_null.append(name)
|
|
261
|
+
elif filters is None:
|
|
262
|
+
if reg.val is None or reg.err is not None:
|
|
263
|
+
err_null.append(name)
|
|
264
|
+
return err_null
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def cap_id_to_class(
|
|
268
|
+
cap_id: Union[CapabilityEnum, ExtendedCapabilityEnum],
|
|
269
|
+
) -> Optional[type[PcieCapStructure]]:
|
|
270
|
+
"""Convert a generic PcieCapStructure to a Specific PcieCapStructure based on the cap_id
|
|
271
|
+
|
|
272
|
+
Parameters
|
|
273
|
+
----------
|
|
274
|
+
cap_id : Union[CapabilityEnum, ExtendedCapabilityEnum]
|
|
275
|
+
A capability ID
|
|
276
|
+
|
|
277
|
+
Returns
|
|
278
|
+
-------
|
|
279
|
+
Optional[type[PcieCapStructure]]
|
|
280
|
+
A specific PcieCapStructure class or None if not found
|
|
281
|
+
"""
|
|
282
|
+
for cls in PcieCapStructure.__subclasses__():
|
|
283
|
+
if cls.cap_id == cap_id:
|
|
284
|
+
return cls
|
|
285
|
+
return None
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class CommandRegister(PcieRegister):
|
|
289
|
+
"""Command Register in PCI Configuration Space"""
|
|
290
|
+
|
|
291
|
+
offset: int = 0x04
|
|
292
|
+
width: int = 16
|
|
293
|
+
io_space_en: PcieBitField = PcieBitField(bit_mask=0x1, desc="I/O Space Enable")
|
|
294
|
+
mem_space_en: PcieBitField = PcieBitField(bit_mask=0x2, desc="Memory Space Enable")
|
|
295
|
+
bus_mstr_en: PcieBitField = PcieBitField(bit_mask=0x4, desc="Bus Master Enable")
|
|
296
|
+
spec_cyc_en: PcieBitField = PcieBitField(bit_mask=0x8, desc="Special Cycle Enable")
|
|
297
|
+
mem_wr_inval: PcieBitField = PcieBitField(bit_mask=0x10, desc="Memory Write and Invalidate")
|
|
298
|
+
vga_pal_snoop: PcieBitField = PcieBitField(bit_mask=0x20, desc="VGA Palette Snoop")
|
|
299
|
+
parity_err_res: PcieBitField = PcieBitField(bit_mask=0x40, desc="Parity Error Response")
|
|
300
|
+
idsel_step_wait_cyc_ctrl: PcieBitField = PcieBitField(
|
|
301
|
+
bit_mask=0x80, desc="IDSEL Stepping/Wait Cycle Control"
|
|
302
|
+
)
|
|
303
|
+
serr_en: PcieBitField = PcieBitField(bit_mask=0x100, desc="SERR# Enable")
|
|
304
|
+
fast_b2b_trans_en: PcieBitField = PcieBitField(
|
|
305
|
+
bit_mask=0x200, desc="Fast Back-to-Back Transactions Enable"
|
|
306
|
+
)
|
|
307
|
+
int_dis: PcieBitField = PcieBitField(bit_mask=0x400, desc="Interrupt Disable")
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class StatusRegister(PcieRegister):
|
|
311
|
+
"""Status Register in PCI Configuration Space"""
|
|
312
|
+
|
|
313
|
+
offset: int = 0x06
|
|
314
|
+
width: int = 16
|
|
315
|
+
desc: str = "Status Register"
|
|
316
|
+
immed_readiness: PcieBitField = PcieBitField(bit_mask=(1 << 0), desc="Immediate Readiness")
|
|
317
|
+
int_stat: PcieBitField = PcieBitField(bit_mask=(1 << 3), desc="Interrupt Status")
|
|
318
|
+
cap_list: PcieBitField = PcieBitField(bit_mask=(1 << 4), desc="Capabilities List")
|
|
319
|
+
sixty_six_mhz_cap: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="66 MHz Capable")
|
|
320
|
+
fast_b2b_trans_cap: PcieBitField = PcieBitField(
|
|
321
|
+
bit_mask=(1 << 7), desc="Fast Back-to-Back Transactions Capable"
|
|
322
|
+
)
|
|
323
|
+
mstr_data_par_err: PcieBitField = PcieBitField(
|
|
324
|
+
bit_mask=(1 << 8), desc="Master Data Parity Error"
|
|
325
|
+
)
|
|
326
|
+
devsel_timing: PcieBitField = PcieBitField(bit_mask=(0b11 << 9), desc="DEVSEL Timing")
|
|
327
|
+
signaled_target_abort: PcieBitField = PcieBitField(
|
|
328
|
+
bit_mask=(1 << 11), desc="Signaled Target Abort"
|
|
329
|
+
)
|
|
330
|
+
rcvd_target_abort: PcieBitField = PcieBitField(bit_mask=(1 << 12), desc="Received Target Abort")
|
|
331
|
+
rcvd_mstr_abort: PcieBitField = PcieBitField(bit_mask=(1 << 13), desc="Received Master Abort")
|
|
332
|
+
signaled_sys_err: PcieBitField = PcieBitField(bit_mask=(1 << 14), desc="Signaled System Error")
|
|
333
|
+
det_parity_err: PcieBitField = PcieBitField(bit_mask=(1 << 15), desc="Detected Parity Error")
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
class Type01Common(PcieCapStructure):
|
|
337
|
+
"""Common fields for Type 01"""
|
|
338
|
+
|
|
339
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.BASE_REGISTER
|
|
340
|
+
desc: str = "Type 0/1 Common Configuration Space"
|
|
341
|
+
vendor_id: PcieRegister = PcieRegister(width=16, offset=0x00)
|
|
342
|
+
device_id: PcieRegister = PcieRegister(width=16, offset=0x02)
|
|
343
|
+
command: CommandRegister = CommandRegister()
|
|
344
|
+
status: StatusRegister = StatusRegister()
|
|
345
|
+
revision_id: PcieRegister = PcieRegister(width=8, offset=0x08)
|
|
346
|
+
prog_if: PcieRegister = PcieRegister(width=8, offset=0x09)
|
|
347
|
+
subclass: PcieRegister = PcieRegister(width=8, offset=0x0A)
|
|
348
|
+
class_code: PcieRegister = PcieRegister(width=8, offset=0x0B)
|
|
349
|
+
cache_line_size: PcieRegister = PcieRegister(width=8, offset=0x0C)
|
|
350
|
+
latency_timer: PcieRegister = PcieRegister(width=8, offset=0x0D)
|
|
351
|
+
header_type: PcieRegister = PcieRegister(width=8, offset=0x0E)
|
|
352
|
+
bist: PcieRegister = PcieRegister(width=8, offset=0x0F)
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
class Type0Configuration(Type01Common):
|
|
356
|
+
"""Type 0 Specific Common Configuration Space"""
|
|
357
|
+
|
|
358
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.BASE_REGISTER
|
|
359
|
+
desc: str = "Type 0 Specific Common Configuration Space"
|
|
360
|
+
base_address_0: PcieRegister = PcieRegister(
|
|
361
|
+
offset=0x10,
|
|
362
|
+
width=32,
|
|
363
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h) / 7.5.1.3.1 Type 1 Base Address Registers (Offset 10h-14h)",
|
|
364
|
+
)
|
|
365
|
+
base_address_1: PcieRegister = PcieRegister(
|
|
366
|
+
offset=0x14,
|
|
367
|
+
width=32,
|
|
368
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h) / 7.5.1.3.1 Type 1 Base Address Registers (Offset 10h-14h)",
|
|
369
|
+
)
|
|
370
|
+
base_address_2: PcieRegister = PcieRegister(
|
|
371
|
+
offset=0x18,
|
|
372
|
+
width=32,
|
|
373
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h)",
|
|
374
|
+
)
|
|
375
|
+
base_address_3: PcieRegister = PcieRegister(
|
|
376
|
+
offset=0x1C,
|
|
377
|
+
width=32,
|
|
378
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h)",
|
|
379
|
+
)
|
|
380
|
+
base_address_4: PcieRegister = PcieRegister(
|
|
381
|
+
offset=0x20,
|
|
382
|
+
width=32,
|
|
383
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h)",
|
|
384
|
+
)
|
|
385
|
+
base_address_5: PcieRegister = PcieRegister(
|
|
386
|
+
offset=0x24,
|
|
387
|
+
width=32,
|
|
388
|
+
desc="7.5.1.2.1 Base Address Registers (Offset 10h - 24h)",
|
|
389
|
+
)
|
|
390
|
+
cardbus_cis: PcieRegister = PcieRegister(
|
|
391
|
+
offset=0x28,
|
|
392
|
+
width=32,
|
|
393
|
+
desc="7.5.1.2.2 Cardbus CIS Pointer Register (Offset 28h)",
|
|
394
|
+
)
|
|
395
|
+
subsystem_vendor_id: PcieRegister = PcieRegister(
|
|
396
|
+
offset=0x2C,
|
|
397
|
+
width=16,
|
|
398
|
+
desc="7.5.1.2.3 Subsystem Vendor ID Register/Subsystem ID Register (Offset 2Ch/2Eh)",
|
|
399
|
+
)
|
|
400
|
+
subsystem_id: PcieRegister = PcieRegister(
|
|
401
|
+
offset=0x2E,
|
|
402
|
+
width=16,
|
|
403
|
+
desc="7.5.1.2.3 Subsystem Vendor ID Register/Subsystem ID Register (Offset 2Ch/2Eh)",
|
|
404
|
+
)
|
|
405
|
+
rom_address: PcieRegister = PcieRegister(
|
|
406
|
+
offset=0x30,
|
|
407
|
+
width=32,
|
|
408
|
+
desc="7.5.1.2.4 Expansion ROM Base Address Register (Offset 30h)",
|
|
409
|
+
)
|
|
410
|
+
min_gnt: PcieRegister = PcieRegister(
|
|
411
|
+
offset=0x3E,
|
|
412
|
+
width=8,
|
|
413
|
+
desc="7.5.1.2.5 Min_Gnt Register/Max_Lat Register (Offset 3Eh/3Fh)",
|
|
414
|
+
)
|
|
415
|
+
max_lat: PcieRegister = PcieRegister(
|
|
416
|
+
offset=0x3F,
|
|
417
|
+
width=8,
|
|
418
|
+
desc="7.5.1.2.5 Min_Gnt Register/Max_Lat Register (Offset 3Eh/3Fh)",
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
class SecStatusRegister(PcieRegister):
|
|
423
|
+
"""Sec Status reg for Type 1"""
|
|
424
|
+
|
|
425
|
+
offset: int = 0x1E
|
|
426
|
+
width: int = 16
|
|
427
|
+
desc: str = "Secondary Status Register"
|
|
428
|
+
sixty_six_mhz_cap: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="66 MHz Capable")
|
|
429
|
+
fast_b2b_trans_cap: PcieBitField = PcieBitField(
|
|
430
|
+
bit_mask=(1 << 7), desc="Fast Back-to-Back Transactions Capable"
|
|
431
|
+
)
|
|
432
|
+
mstr_data_par_err: PcieBitField = PcieBitField(
|
|
433
|
+
bit_mask=(1 << 8), desc="Master Data Parity Error"
|
|
434
|
+
)
|
|
435
|
+
devsel_timing: PcieBitField = PcieBitField(bit_mask=(0b11 << 9), desc="DEVSEL Timing")
|
|
436
|
+
signaled_target_abort: PcieBitField = PcieBitField(
|
|
437
|
+
bit_mask=(1 << 11), desc="Signaled Target Abort"
|
|
438
|
+
)
|
|
439
|
+
rcvd_target_abort: PcieBitField = PcieBitField(bit_mask=(1 << 12), desc="Received Target Abort")
|
|
440
|
+
rcvd_mstr_abort: PcieBitField = PcieBitField(bit_mask=(1 << 13), desc="Received Master Abort")
|
|
441
|
+
rcvd_sys_err: PcieBitField = PcieBitField(bit_mask=(1 << 14), desc="Received System Error")
|
|
442
|
+
det_parity_err: PcieBitField = PcieBitField(bit_mask=(1 << 15), desc="Detected Parity Error")
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
class BridgeControlRegister(PcieRegister):
|
|
446
|
+
"""Bridge controller register Specific to Type 1"""
|
|
447
|
+
|
|
448
|
+
offset: int = 0x3E
|
|
449
|
+
width: int = 16
|
|
450
|
+
desc: str = "7.5.1.3.13 Bridge Control Register (Offset 3Eh)"
|
|
451
|
+
parity_err_res_en: PcieBitField = PcieBitField(
|
|
452
|
+
bit_mask=(1 << 0), desc="Parity Error Response Enable"
|
|
453
|
+
)
|
|
454
|
+
serr_en: PcieBitField = PcieBitField(bit_mask=(1 << 1), desc="SERR# Enable")
|
|
455
|
+
isa_en: PcieBitField = PcieBitField(bit_mask=(1 << 2), desc="ISA Enable")
|
|
456
|
+
vga_en: PcieBitField = PcieBitField(bit_mask=(1 << 3), desc="VGA Enable")
|
|
457
|
+
vga_16_bit_dec: PcieBitField = PcieBitField(bit_mask=(1 << 4), desc="VGA 16-bit Decode")
|
|
458
|
+
mstr_abort_mode: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="Master Abort Mode")
|
|
459
|
+
sec_bus_rst: PcieBitField = PcieBitField(bit_mask=(1 << 6), desc="Secondary Bus Reset")
|
|
460
|
+
fast_b2b_trans_en: PcieBitField = PcieBitField(
|
|
461
|
+
bit_mask=(1 << 7), desc="Fast Back-to-Back Transactions Enable"
|
|
462
|
+
)
|
|
463
|
+
primary_discard_timer: PcieBitField = PcieBitField(
|
|
464
|
+
bit_mask=(1 << 8), desc="Primary Discard Timer"
|
|
465
|
+
)
|
|
466
|
+
sec_discard_timer: PcieBitField = PcieBitField(
|
|
467
|
+
bit_mask=(1 << 9), desc="Secondary Discard Timer"
|
|
468
|
+
)
|
|
469
|
+
discard_timer_stat: PcieBitField = PcieBitField(bit_mask=(1 << 10), desc="Discard Timer Status")
|
|
470
|
+
discard_timer_serr_en: PcieBitField = PcieBitField(
|
|
471
|
+
bit_mask=(1 << 11), desc="Discard Timer SERR# Enable"
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
class Type1Configuration(Type01Common):
|
|
476
|
+
"""Type 1 Specific Common Configuration Space"""
|
|
477
|
+
|
|
478
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.BASE_REGISTER
|
|
479
|
+
desc: str = "Type 1 Specific Common Configuration Space"
|
|
480
|
+
PRIMARY_BUS: PcieRegister = PcieRegister(
|
|
481
|
+
offset=0x18, width=8, desc="7.5.1.3.2 Primary Bus Number Register (Offset 18h)"
|
|
482
|
+
)
|
|
483
|
+
SECONDARY_BUS: PcieRegister = PcieRegister(
|
|
484
|
+
offset=0x19,
|
|
485
|
+
width=8,
|
|
486
|
+
desc="7.5.1.3.3 Secondary Bus Number Register (Offset 19h)",
|
|
487
|
+
)
|
|
488
|
+
SUBORDINATE_BUS: PcieRegister = PcieRegister(
|
|
489
|
+
offset=0x1A,
|
|
490
|
+
width=8,
|
|
491
|
+
desc="7.5.1.3.4 Subordinate Bus Number Register (Offset 1Ah)",
|
|
492
|
+
)
|
|
493
|
+
SEC_LATENCY_TIMER: PcieRegister = PcieRegister(
|
|
494
|
+
offset=0x1B, width=8, desc="7.5.1.3.5 Secondary Latency Timer (Offset 1Bh)"
|
|
495
|
+
)
|
|
496
|
+
IO_BASE: PcieRegister = PcieRegister(
|
|
497
|
+
offset=0x1C,
|
|
498
|
+
width=8,
|
|
499
|
+
desc="7.5.1.3.6 I/O Base/I/O Limit Registers(Offset 1Ch/1Dh)",
|
|
500
|
+
)
|
|
501
|
+
IO_LIMIT: PcieRegister = PcieRegister(
|
|
502
|
+
offset=0x1D,
|
|
503
|
+
width=8,
|
|
504
|
+
desc="7.5.1.3.6 I/O Base/I/O Limit Registers(Offset 1Ch/1Dh)",
|
|
505
|
+
)
|
|
506
|
+
MEMORY_BASE: PcieRegister = PcieRegister(
|
|
507
|
+
offset=0x20,
|
|
508
|
+
width=16,
|
|
509
|
+
desc="7.5.1.3.8 Memory Base Register/Memory Limit Register(Offset 20h/22h)",
|
|
510
|
+
)
|
|
511
|
+
MEMORY_LIMIT: PcieRegister = PcieRegister(
|
|
512
|
+
offset=0x22,
|
|
513
|
+
width=16,
|
|
514
|
+
desc="7.5.1.3.8 Memory Base Register/Memory Limit Register(Offset 20h/22h)",
|
|
515
|
+
)
|
|
516
|
+
PREF_MEMORY_BASE: PcieRegister = PcieRegister(
|
|
517
|
+
offset=0x24,
|
|
518
|
+
width=16,
|
|
519
|
+
desc="7.5.1.3.9 Prefetchable Memory Base/Prefetchable Memory Limit Registers (Offset 24h/26h)",
|
|
520
|
+
)
|
|
521
|
+
PREF_MEMORY_LIMIT: PcieRegister = PcieRegister(
|
|
522
|
+
offset=0x26,
|
|
523
|
+
width=16,
|
|
524
|
+
desc="7.5.1.3.9 Prefetchable Memory Base/Prefetchable Memory Limit Registers (Offset 24h/26h)",
|
|
525
|
+
)
|
|
526
|
+
PREF_BASE_UPPER32: PcieRegister = PcieRegister(
|
|
527
|
+
offset=0x28,
|
|
528
|
+
width=32,
|
|
529
|
+
desc="7.5.1.3.10 Prefetchable Base Upper 32 Bits/Prefetchable Limit Upper 32 Bits Registers (Offset 28h/2Ch)",
|
|
530
|
+
)
|
|
531
|
+
PREF_LIMIT_UPPER32: PcieRegister = PcieRegister(
|
|
532
|
+
offset=0x2C,
|
|
533
|
+
width=32,
|
|
534
|
+
desc="7.5.1.3.10 Prefetchable Base Upper 32 Bits/Prefetchable Limit Upper 32 Bits Registers (Offset 28h/2Ch)",
|
|
535
|
+
)
|
|
536
|
+
IO_BASE_UPPER16: PcieRegister = PcieRegister(
|
|
537
|
+
offset=0x30,
|
|
538
|
+
width=16,
|
|
539
|
+
desc="7.5.1.3.11 I/O Base Upper 16 Bits/I/O Limit Upper 16 Bits Registers (Offset 30h/32h)",
|
|
540
|
+
)
|
|
541
|
+
IO_LIMIT_UPPER16: PcieRegister = PcieRegister(
|
|
542
|
+
offset=0x32,
|
|
543
|
+
width=16,
|
|
544
|
+
desc="7.5.1.3.11 I/O Base Upper 16 Bits/I/O Limit Upper 16 Bits Registers (Offset 30h/32h)",
|
|
545
|
+
)
|
|
546
|
+
BRIDGE_ROM_ADDRESS: PcieRegister = PcieRegister(
|
|
547
|
+
offset=0x38,
|
|
548
|
+
width=32,
|
|
549
|
+
desc="7.5.1.3.12 Expansion ROM Base Address Register (Offset 38h)",
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
class CapPm(PcieCapStructure):
|
|
554
|
+
"""Capability Structure for Power Management"""
|
|
555
|
+
|
|
556
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.PM
|
|
557
|
+
desc: str = "PCI Power Management Interface (9.6 SR-IOV Power Management)"
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
class CapAgp(PcieCapStructure):
|
|
561
|
+
"""Capability Structure for Accelerated Graphics Port"""
|
|
562
|
+
|
|
563
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.AGP
|
|
564
|
+
desc: str = ""
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
class CapVpd(PcieCapStructure):
|
|
568
|
+
"""Capability Structure for Virtual Product Data"""
|
|
569
|
+
|
|
570
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.VPD
|
|
571
|
+
desc: str = "VPD (9.3.6.1 VPD Capability)"
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
class CapSlotid(PcieCapStructure):
|
|
575
|
+
"""Capability Structure for Slot Identification"""
|
|
576
|
+
|
|
577
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.SLOTID
|
|
578
|
+
desc: str = "Slot Identification"
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
class CapMsi(PcieCapStructure):
|
|
582
|
+
"""Capability Structure for Message Signaled Interrupts"""
|
|
583
|
+
|
|
584
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.MSI
|
|
585
|
+
desc: str = "7.7.1 MSI Capability Structures"
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
class CapCompatHotSwp(PcieCapStructure):
|
|
589
|
+
"""Cap for CompactPCI Hot Swap"""
|
|
590
|
+
|
|
591
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.COMPACT_PCI_HS
|
|
592
|
+
desc: str = "CompactPCI Hot Swap"
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
class CapPcix(PcieCapStructure):
|
|
596
|
+
"""Cap for PCI Extensions"""
|
|
597
|
+
|
|
598
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.PCIX
|
|
599
|
+
desc: str = "PCI-X"
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
class CapHt(PcieCapStructure):
|
|
603
|
+
"""HyperTransport Capability"""
|
|
604
|
+
|
|
605
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.HYPERTRANS
|
|
606
|
+
desc: str = "HyperTransport"
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
class CapVndr(PcieCapStructure):
|
|
610
|
+
"""Vendor Specific Capability"""
|
|
611
|
+
|
|
612
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.VENDOR
|
|
613
|
+
desc: str = "7.9.4 Vendor-Specific Capability"
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
class CapDbg(PcieCapStructure):
|
|
617
|
+
"""Capability for Debug Port"""
|
|
618
|
+
|
|
619
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.DEBUG_PORT
|
|
620
|
+
desc: str = "Debug Port"
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
class CapCompatPcieCentral(PcieCapStructure):
|
|
624
|
+
"""Capability for CompactPCI Central Resource Control"""
|
|
625
|
+
|
|
626
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.COMPACT_PCI_CENTRAL
|
|
627
|
+
desc: str = "CompactPCI Central Resource Control"
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
class CapHotplug(PcieCapStructure):
|
|
631
|
+
"""Capability for PCI Hot Plug"""
|
|
632
|
+
|
|
633
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.PCI_HP
|
|
634
|
+
desc: str = "PCI Hot Plug"
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
class CapPciBridge(PcieCapStructure):
|
|
638
|
+
"""Capability for PCI Bridge Subsystem ID"""
|
|
639
|
+
|
|
640
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.PCI_BRIDGE
|
|
641
|
+
desc: str = "7.9.24 Subsystem ID and Sybsystem Vendor ID Capability"
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
class CapEnhAgp(PcieCapStructure):
|
|
645
|
+
"""Enhanced Accelerated Graphics Port (AGP) interface supporting 8x data rate."""
|
|
646
|
+
|
|
647
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.AGP
|
|
648
|
+
desc: str = "AGP 8x"
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
class CapSecure(PcieCapStructure):
|
|
652
|
+
"""Secure Device Capability"""
|
|
653
|
+
|
|
654
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.SECURE_DEV
|
|
655
|
+
desc: str = "Secure Device"
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
class PcieCapListReg(PcieRegister):
|
|
659
|
+
offset: int = 0x00
|
|
660
|
+
width: int = 16
|
|
661
|
+
cap_id_desc: PcieBitField = PcieBitField(bit_mask=0x00FF, desc="Capability ID")
|
|
662
|
+
nxt_cap_ptr: PcieBitField = PcieBitField(bit_mask=0xFF00, desc="Next Capability Pointer")
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
class DevCtrlRegister(PcieRegister):
|
|
666
|
+
offset: int = 0x08
|
|
667
|
+
width: int = 16
|
|
668
|
+
desc: str = "7.5.3.4 Device Control Register (Offset 08h)"
|
|
669
|
+
corr_err_report_en: PcieBitField = PcieBitField(
|
|
670
|
+
bit_mask=(1 << 0), desc="Correctable Error Enable"
|
|
671
|
+
)
|
|
672
|
+
non_fatal_err_report_en: PcieBitField = PcieBitField(
|
|
673
|
+
bit_mask=(1 << 1), desc="Non-fatal Error Reporting Enable"
|
|
674
|
+
)
|
|
675
|
+
fatal_err_report_en: PcieBitField = PcieBitField(
|
|
676
|
+
bit_mask=(1 << 2), desc="Fatal Error Reporting Enable"
|
|
677
|
+
)
|
|
678
|
+
ur_report_en: PcieBitField = PcieBitField(
|
|
679
|
+
bit_mask=(1 << 3), desc="Unsupported Request Reporting Enable"
|
|
680
|
+
)
|
|
681
|
+
en_relaxed_order: PcieBitField = PcieBitField(bit_mask=(1 << 4), desc="Enable Relaxed Ordering")
|
|
682
|
+
mps: PcieBitField = PcieBitField(bit_mask=(0x7 << 5), desc="Max_Payload_Size")
|
|
683
|
+
ext_tag_field_en: PcieBitField = PcieBitField(
|
|
684
|
+
bit_mask=(1 << 8), desc="Extended Tag Field Enable"
|
|
685
|
+
)
|
|
686
|
+
phantom_func_en: PcieBitField = PcieBitField(bit_mask=(1 << 9), desc="Phantom Functions Enable")
|
|
687
|
+
aux_pwr_pm_en: PcieBitField = PcieBitField(bit_mask=(1 << 10), desc="Aux Power PM Enable")
|
|
688
|
+
en_no_snoop: PcieBitField = PcieBitField(bit_mask=(1 << 11), desc="Enable No Snoop")
|
|
689
|
+
max_rd_req_size: PcieBitField = PcieBitField(bit_mask=(0x7 << 12), desc="Max_Read_Request_Size")
|
|
690
|
+
bridge_cfg_retry_en_init_func_lvl_rst: PcieBitField = PcieBitField(
|
|
691
|
+
bit_mask=(1 << 15),
|
|
692
|
+
desc="Bridge Configuration Retry Enable / Initiate Function Level Reset",
|
|
693
|
+
)
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class DevStatRegister(PcieRegister):
|
|
697
|
+
offset: int = 0x0A
|
|
698
|
+
width: int = 16
|
|
699
|
+
desc: str = "Device Status Register"
|
|
700
|
+
corr_err_det: PcieBitField = PcieBitField(bit_mask=(1 << 0), desc="Correctable Error Detected")
|
|
701
|
+
non_fatal_err_det: PcieBitField = PcieBitField(
|
|
702
|
+
bit_mask=(1 << 1), desc="Non-Fatal Error Detected"
|
|
703
|
+
)
|
|
704
|
+
fatal_err_det: PcieBitField = PcieBitField(bit_mask=(1 << 2), desc="Fatal Error Detected")
|
|
705
|
+
ur_det: PcieBitField = PcieBitField(bit_mask=(1 << 3), desc="Unsupported Request Detected")
|
|
706
|
+
aux_pwr_det: PcieBitField = PcieBitField(bit_mask=(1 << 4), desc="AUX Power Detected")
|
|
707
|
+
trans_pending: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="Transactions Pending")
|
|
708
|
+
emer_pwr_reduction_det: PcieBitField = PcieBitField(
|
|
709
|
+
bit_mask=(1 << 6), desc="Emergency Power Reduction Detected"
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
class LinkCapRegister(PcieRegister):
|
|
714
|
+
offset: int = 0x0C
|
|
715
|
+
width: int = 32
|
|
716
|
+
desc: str = "7.5.3.6 Link Capabilities Register (Offset 0Ch)"
|
|
717
|
+
max_lnk_speed: PcieBitField = PcieBitField(bit_mask=(0xF << 0), desc="Max Link Speed")
|
|
718
|
+
max_lnk_width: PcieBitField = PcieBitField(bit_mask=(0x3F << 4), desc="Maximum Link Width")
|
|
719
|
+
aspm_support: PcieBitField = PcieBitField(bit_mask=(0x3 << 10), desc="ASPM Support")
|
|
720
|
+
l0s_exit_lat: PcieBitField = PcieBitField(bit_mask=(0x7 << 12), desc="L0s Exit Latency")
|
|
721
|
+
l1_exit_lat: PcieBitField = PcieBitField(bit_mask=(0x7 << 15), desc="L1 Exit Latency")
|
|
722
|
+
clk_pwr_mgmt: PcieBitField = PcieBitField(bit_mask=(1 << 18), desc="Clock Power Management")
|
|
723
|
+
surprise_dn_err_report_cap: PcieBitField = PcieBitField(
|
|
724
|
+
bit_mask=(1 << 19), desc="Surprise Down Error Reporting Capable"
|
|
725
|
+
)
|
|
726
|
+
dll_lnk_active_report_cap: PcieBitField = PcieBitField(
|
|
727
|
+
bit_mask=(1 << 20), desc="Data Link Layer Link Active Reporting Capable"
|
|
728
|
+
)
|
|
729
|
+
lnk_bw_notif_cap: PcieBitField = PcieBitField(
|
|
730
|
+
bit_mask=(1 << 21), desc="Link Bandwidth Notification Capability"
|
|
731
|
+
)
|
|
732
|
+
aspm_optionality_comp: PcieBitField = PcieBitField(
|
|
733
|
+
bit_mask=(1 << 22), desc="ASPM Optionality Compliance"
|
|
734
|
+
)
|
|
735
|
+
port_num: PcieBitField = PcieBitField(bit_mask=(0xFF << 24), desc="Port Number")
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
class LinkStatRegister(PcieRegister):
|
|
739
|
+
"""Link stat for Type 1"""
|
|
740
|
+
|
|
741
|
+
offset: int = 0x12
|
|
742
|
+
width: int = 16
|
|
743
|
+
desc: str = "Link Status Register"
|
|
744
|
+
curr_lnk_speed: PcieBitField = PcieBitField(bit_mask=(0b1111 << 0), desc="Current Link Speed")
|
|
745
|
+
neg_lnk_width: PcieBitField = PcieBitField(
|
|
746
|
+
bit_mask=(0b111111 << 4), desc="Negotiated Link Width"
|
|
747
|
+
)
|
|
748
|
+
lnk_training: PcieBitField = PcieBitField(bit_mask=(1 << 11), desc="Link Training")
|
|
749
|
+
slot_clk_cfg: PcieBitField = PcieBitField(bit_mask=(1 << 12), desc="Slot Clock Configuration")
|
|
750
|
+
dll_lnk_active: PcieBitField = PcieBitField(
|
|
751
|
+
bit_mask=(1 << 13), desc="Data Link Layer Link Active"
|
|
752
|
+
)
|
|
753
|
+
lnk_bw_mgmt_stat: PcieBitField = PcieBitField(
|
|
754
|
+
bit_mask=(1 << 14), desc="Link Bandwidth Management Status"
|
|
755
|
+
)
|
|
756
|
+
lnk_auto_bw_stat: PcieBitField = PcieBitField(
|
|
757
|
+
bit_mask=(1 << 15), desc="Link Autonomous Bandwidth Status"
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
class DevCtrl2Register(PcieRegister):
|
|
762
|
+
offset: int = 0x28
|
|
763
|
+
width: int = 16
|
|
764
|
+
desc: str = "7.5.3.16 Device Control 2 Register (Offset 28h)"
|
|
765
|
+
completion_timeout_val: PcieBitField = PcieBitField(
|
|
766
|
+
bit_mask=(0xF << 0), desc="Completion Timeout Value"
|
|
767
|
+
)
|
|
768
|
+
completion_timeout_dis: PcieBitField = PcieBitField(
|
|
769
|
+
bit_mask=(1 << 4), desc="Completion Timeout Disable"
|
|
770
|
+
)
|
|
771
|
+
ari_forward_en: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="ARI Forwarding Enable")
|
|
772
|
+
atomic_op_req_en: PcieBitField = PcieBitField(bit_mask=(1 << 6), desc="AtomicOp Request Enable")
|
|
773
|
+
atomic_op_egress_blk: PcieBitField = PcieBitField(
|
|
774
|
+
bit_mask=(1 << 7), desc="AtomicOp Egress Blocking"
|
|
775
|
+
)
|
|
776
|
+
ido_req_en: PcieBitField = PcieBitField(bit_mask=(1 << 8), desc="IDO Request Enable")
|
|
777
|
+
ido_completion_en: PcieBitField = PcieBitField(bit_mask=(1 << 9), desc="IDO Completion Enable")
|
|
778
|
+
ltr_mechanism_en: PcieBitField = PcieBitField(bit_mask=(1 << 10), desc="LTR Mechanism Enable")
|
|
779
|
+
emergency_pwr_reduction_en: PcieBitField = PcieBitField(
|
|
780
|
+
bit_mask=(1 << 11), desc="Emergency Power Reduction Enable"
|
|
781
|
+
)
|
|
782
|
+
ten_bit_tag_req_en: PcieBitField = PcieBitField(
|
|
783
|
+
bit_mask=(1 << 12), desc="10-bit Tag Request Enable"
|
|
784
|
+
)
|
|
785
|
+
obff_en: PcieBitField = PcieBitField(bit_mask=(0x3 << 13), desc="OBFF Enable")
|
|
786
|
+
end_end_tlp_prefix_blk: PcieBitField = PcieBitField(
|
|
787
|
+
bit_mask=(1 << 15), desc="End-End TLP Prefix Blocking"
|
|
788
|
+
)
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
class LinkCap2Register(PcieRegister):
|
|
792
|
+
"""Link cap 2 for Type 1"""
|
|
793
|
+
|
|
794
|
+
offset: int = 0x2C
|
|
795
|
+
width: int = 32
|
|
796
|
+
desc: str = "7.5.3.18 Link Capabilities 2 Register (Offset 2Ch)"
|
|
797
|
+
supported_lnk_speed_vec: PcieBitField = PcieBitField(
|
|
798
|
+
bit_mask=(0b111111 << 1), desc="Supported Link Speeds Vector"
|
|
799
|
+
)
|
|
800
|
+
xlnk_supported: PcieBitField = PcieBitField(bit_mask=(1 << 8), desc="Crosslink Supported")
|
|
801
|
+
lower_skp_os_gen_supported_speeds_vec: PcieBitField = PcieBitField(
|
|
802
|
+
bit_mask=(0b111111 << 9), desc="Lower SKP OS Generation Supported Speeds Vector"
|
|
803
|
+
)
|
|
804
|
+
lower_skip_os_rec_supported_speeds_vec: PcieBitField = PcieBitField(
|
|
805
|
+
bit_mask=(0b111111 << 16), desc="Lower SKP OS Reception Supported Speeds Vector"
|
|
806
|
+
)
|
|
807
|
+
retimer_prsnc_det_supported: PcieBitField = PcieBitField(
|
|
808
|
+
bit_mask=(1 << 23), desc="Retimer Presence Detect Supported"
|
|
809
|
+
)
|
|
810
|
+
two_retimers_prsnc_det_supported: PcieBitField = PcieBitField(
|
|
811
|
+
bit_mask=(1 << 24), desc="Two Retimers Presence Detect Supported"
|
|
812
|
+
)
|
|
813
|
+
drs_supported: PcieBitField = PcieBitField(bit_mask=(1 << 31), desc="DRS Supported")
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
class PcieExp(PcieCapStructure):
|
|
817
|
+
"""PCIE Express Capability Structure 7.5.3 PCI Express Capability Structure
|
|
818
|
+
|
|
819
|
+
This structure allows identification of a PCI Express device Function
|
|
820
|
+
and indicates support for new PCI Express features.
|
|
821
|
+
"""
|
|
822
|
+
|
|
823
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.PCIE_EXP
|
|
824
|
+
desc: str = "7.5.3 PCI Express Capability Structure"
|
|
825
|
+
cap_list: PcieCapListReg = PcieCapListReg()
|
|
826
|
+
pcie_cap_reg: PcieRegister = PcieRegister(
|
|
827
|
+
offset=2,
|
|
828
|
+
width=16,
|
|
829
|
+
desc="7.5.3.2 PCI Express Capabilities Register (Offset 02h)",
|
|
830
|
+
)
|
|
831
|
+
dev_cap_reg: PcieRegister = PcieRegister(
|
|
832
|
+
offset=0x4, width=32, desc="7.5.3.3 Device Capabilities Register (Offset 04h)"
|
|
833
|
+
)
|
|
834
|
+
dev_ctrl_reg: DevCtrlRegister = DevCtrlRegister()
|
|
835
|
+
dev_stat_reg: DevStatRegister = DevStatRegister()
|
|
836
|
+
lnk_cap_reg: LinkCapRegister = LinkCapRegister()
|
|
837
|
+
lnk_ctrl_reg: PcieRegister = PcieRegister(
|
|
838
|
+
offset=0x10, width=16, desc="7.5.3.7 Link Control Register (Offset 10h)"
|
|
839
|
+
)
|
|
840
|
+
lnk_stat_reg: LinkStatRegister = LinkStatRegister()
|
|
841
|
+
dev_ctrl_2_reg: DevCtrl2Register = DevCtrl2Register()
|
|
842
|
+
lnk_cap_2_reg: LinkCap2Register = LinkCap2Register()
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
class CapMSIX(PcieCapStructure):
|
|
846
|
+
"""Capability Structure for MSI-X"""
|
|
847
|
+
|
|
848
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.MSIX
|
|
849
|
+
offset: int = 0x00
|
|
850
|
+
desc: str = "7.7.2 MSI-X Capability and Table Structure"
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
class CapSATA(PcieCapStructure):
|
|
854
|
+
"""Cap for Serial ATA Data/Index Configuration"""
|
|
855
|
+
|
|
856
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.SATA
|
|
857
|
+
offset: int = 0x00
|
|
858
|
+
desc: str = "Serial ATA Data/Index Configuration"
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
class CapAF(PcieCapStructure):
|
|
862
|
+
"""Capability for Advanced Features"""
|
|
863
|
+
|
|
864
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.AF
|
|
865
|
+
offset: int = 0x00
|
|
866
|
+
desc: str = "7.9.22 Conventional PCI Advanced Features Capability (AF)"
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
class CapEA(PcieCapStructure):
|
|
870
|
+
"""Capability for Enhanced Allocation"""
|
|
871
|
+
|
|
872
|
+
cap_id: ClassVar[Enum] = CapabilityEnum.EA
|
|
873
|
+
offset: int = 0x00
|
|
874
|
+
desc: str = "7.8.5 Enhanced Allocation Capability Structure (EA)"
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
class AerEcapHdr(PcieRegister):
|
|
878
|
+
"""Capability for Advanced Error Reporting"""
|
|
879
|
+
|
|
880
|
+
offset: int = 0x00
|
|
881
|
+
width: int = 32
|
|
882
|
+
desc: str = "7.8.4.1 Advanced Error Reporting Extended Capability Header (Offset 00h)"
|
|
883
|
+
pcie_eacp_id: PcieBitField = PcieBitField(
|
|
884
|
+
bit_mask=0x0000FFFF, desc="PCI Express Extended Capability ID"
|
|
885
|
+
)
|
|
886
|
+
cap_ver: PcieBitField = PcieBitField(bit_mask=0x000F0000, desc="Capability Version")
|
|
887
|
+
nxt_cap_offset: PcieBitField = PcieBitField(bit_mask=0xFFF00000, desc="Next Capability Offset")
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
class UncorrErrStatReg(PcieRegister):
|
|
891
|
+
"""AER register for Uncorrectable Error Status Register"""
|
|
892
|
+
|
|
893
|
+
offset: int = 0x04
|
|
894
|
+
width: int = 32
|
|
895
|
+
desc: str = "Uncorrectable Error Status Register"
|
|
896
|
+
dlnk_protocol_err_stat: PcieBitField = PcieBitField(
|
|
897
|
+
bit_mask=(1 << 4), desc="Data Link Protocol Error Status"
|
|
898
|
+
)
|
|
899
|
+
surprise_dn_err_stat: PcieBitField = PcieBitField(
|
|
900
|
+
bit_mask=(1 << 5), desc="Surprise Down Error Status"
|
|
901
|
+
)
|
|
902
|
+
poisoned_tlp_rcvd: PcieBitField = PcieBitField(bit_mask=(1 << 12), desc="Poisoned TLP Received")
|
|
903
|
+
fc_proto_err_stat: PcieBitField = PcieBitField(
|
|
904
|
+
bit_mask=(1 << 13), desc="Flow Control Protocol Error Status"
|
|
905
|
+
)
|
|
906
|
+
cpl_timeout_stat: PcieBitField = PcieBitField(
|
|
907
|
+
bit_mask=(1 << 14), desc="Completion Timeout Status"
|
|
908
|
+
)
|
|
909
|
+
ca_stat: PcieBitField = PcieBitField(bit_mask=(1 << 15), desc="Completer Abort Status")
|
|
910
|
+
unexp_cpl_stat: PcieBitField = PcieBitField(
|
|
911
|
+
bit_mask=(1 << 16), desc="Unexpected Completion Status"
|
|
912
|
+
)
|
|
913
|
+
rx_overflow_stat: PcieBitField = PcieBitField(
|
|
914
|
+
bit_mask=(1 << 17), desc="Receiver Overflow Status"
|
|
915
|
+
)
|
|
916
|
+
malformed_tlp_stat: PcieBitField = PcieBitField(bit_mask=(1 << 18), desc="Malformed TLP Status")
|
|
917
|
+
ecrc_err_stat: PcieBitField = PcieBitField(bit_mask=(1 << 19), desc="ECRC Error Status")
|
|
918
|
+
ur_err_stat: PcieBitField = PcieBitField(
|
|
919
|
+
bit_mask=(1 << 20), desc="Unsupported Request Error Status"
|
|
920
|
+
)
|
|
921
|
+
acs_violation_stat: PcieBitField = PcieBitField(bit_mask=(1 << 21), desc="ACS Violation Status")
|
|
922
|
+
uncorr_int_err_stat: PcieBitField = PcieBitField(
|
|
923
|
+
bit_mask=(1 << 22), desc="Uncorrectable Internal Error Status"
|
|
924
|
+
)
|
|
925
|
+
mc_blocked_tlp_stat: PcieBitField = PcieBitField(
|
|
926
|
+
bit_mask=(1 << 23), desc="MC Blocked TLP Status"
|
|
927
|
+
)
|
|
928
|
+
atomicop_egress_blk_stat: PcieBitField = PcieBitField(
|
|
929
|
+
bit_mask=(1 << 24), desc="AtomicOp Egress Blocked Status"
|
|
930
|
+
)
|
|
931
|
+
tlp_prefix_blk_err_stat: PcieBitField = PcieBitField(
|
|
932
|
+
bit_mask=(1 << 25), desc="TLP Prefix Blocked Error Status"
|
|
933
|
+
)
|
|
934
|
+
poisoned_tlp_egress_blk_stat: PcieBitField = PcieBitField(
|
|
935
|
+
bit_mask=(1 << 26), desc="Poisoned TLP Egress Blocked Status"
|
|
936
|
+
)
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
class UncorrErrMaskReg(PcieRegister):
|
|
940
|
+
"""AER register for Uncorrectable Error Mask Register"""
|
|
941
|
+
|
|
942
|
+
offset: int = 0x08
|
|
943
|
+
width: int = 32
|
|
944
|
+
desc: str = "7.8.4.3 Uncorrectable Error Mask Register (Offset 08h)"
|
|
945
|
+
dlnk_protocol_err_mask: PcieBitField = PcieBitField(
|
|
946
|
+
bit_mask=(1 << 4), desc="Data Link Protocol Error Mask"
|
|
947
|
+
)
|
|
948
|
+
surprise_dn_err_mask: PcieBitField = PcieBitField(
|
|
949
|
+
bit_mask=(1 << 5), desc="Surprise Down Error Mask"
|
|
950
|
+
)
|
|
951
|
+
poisoned_tlp_rcvd_mask: PcieBitField = PcieBitField(
|
|
952
|
+
bit_mask=(1 << 12), desc="Poisoned TLP Received Mask"
|
|
953
|
+
)
|
|
954
|
+
fc_proto_err_mask: PcieBitField = PcieBitField(
|
|
955
|
+
bit_mask=(1 << 13), desc="Flow Control Protocol Error Mask"
|
|
956
|
+
)
|
|
957
|
+
cpl_timeout_mask: PcieBitField = PcieBitField(
|
|
958
|
+
bit_mask=(1 << 14), desc="Completion Timeout Mask"
|
|
959
|
+
)
|
|
960
|
+
ca_mask: PcieBitField = PcieBitField(bit_mask=(1 << 15), desc="Completer Abort Mask")
|
|
961
|
+
unexp_cpl_mask: PcieBitField = PcieBitField(
|
|
962
|
+
bit_mask=(1 << 16), desc="Unexpected Completion Mask"
|
|
963
|
+
)
|
|
964
|
+
rx_overflow_mask: PcieBitField = PcieBitField(bit_mask=(1 << 17), desc="Receiver Overflow Mask")
|
|
965
|
+
malformed_tlp_mask: PcieBitField = PcieBitField(bit_mask=(1 << 18), desc="Malformed TLP Mask")
|
|
966
|
+
ecrc_err_mask: PcieBitField = PcieBitField(bit_mask=(1 << 19), desc="ECRC Error Mask")
|
|
967
|
+
ur_err_mask: PcieBitField = PcieBitField(
|
|
968
|
+
bit_mask=(1 << 20), desc="Unsupported Request Error Mask"
|
|
969
|
+
)
|
|
970
|
+
acs_violation_mask: PcieBitField = PcieBitField(bit_mask=(1 << 21), desc="ACS Violation Mask")
|
|
971
|
+
uncorr_int_err_mask: PcieBitField = PcieBitField(
|
|
972
|
+
bit_mask=(1 << 22), desc="Uncorrectable Internal Error Mask"
|
|
973
|
+
)
|
|
974
|
+
mc_blocked_tlp_mask: PcieBitField = PcieBitField(bit_mask=(1 << 23), desc="MC Blocked TLP Mask")
|
|
975
|
+
atomicop_egress_blk_mask: PcieBitField = PcieBitField(
|
|
976
|
+
bit_mask=(1 << 24), desc="AtomicOp Egress Blocked Mask"
|
|
977
|
+
)
|
|
978
|
+
tlp_prefix_blk_err_mask: PcieBitField = PcieBitField(
|
|
979
|
+
bit_mask=(1 << 25), desc="TLP Prefix Blocked Error Mask"
|
|
980
|
+
)
|
|
981
|
+
poisoned_tlp_egress_blk_mask: PcieBitField = PcieBitField(
|
|
982
|
+
bit_mask=(1 << 26), desc="Poisoned TLP Egress Blocked Mask"
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
class UncorrErrSevReg(PcieRegister):
|
|
987
|
+
"""AER register for Uncorrectable Error Severity Register"""
|
|
988
|
+
|
|
989
|
+
offset: int = 0x0C
|
|
990
|
+
width: int = 32
|
|
991
|
+
desc: str = "7.8.4.4 Uncorrectable Error Severity Register (Offset 0Ch)"
|
|
992
|
+
dlnk_protocol_err_sev: PcieBitField = PcieBitField(
|
|
993
|
+
bit_mask=(1 << 4), desc="Data Link Protocol Error Severity"
|
|
994
|
+
)
|
|
995
|
+
surprise_dn_err_sev: PcieBitField = PcieBitField(
|
|
996
|
+
bit_mask=(1 << 5), desc="Surprise Down Error Severity"
|
|
997
|
+
)
|
|
998
|
+
poisoned_tlp_rcvd_sev: PcieBitField = PcieBitField(
|
|
999
|
+
bit_mask=(1 << 12), desc="Poisoned TLP Received Severity"
|
|
1000
|
+
)
|
|
1001
|
+
fc_proto_err_sev: PcieBitField = PcieBitField(
|
|
1002
|
+
bit_mask=(1 << 13), desc="Flow Control Protocol Error Severity"
|
|
1003
|
+
)
|
|
1004
|
+
cpl_timeout_sev: PcieBitField = PcieBitField(
|
|
1005
|
+
bit_mask=(1 << 14), desc="Completion Timeout Error Severity"
|
|
1006
|
+
)
|
|
1007
|
+
ca_sev: PcieBitField = PcieBitField(bit_mask=(1 << 15), desc="Completer Abort Error Severity")
|
|
1008
|
+
unexp_cpl_sev: PcieBitField = PcieBitField(
|
|
1009
|
+
bit_mask=(1 << 16), desc="Unexpected Completion Error Severity"
|
|
1010
|
+
)
|
|
1011
|
+
rx_overflow_sev: PcieBitField = PcieBitField(
|
|
1012
|
+
bit_mask=(1 << 17), desc="Receiver Overflow Severity"
|
|
1013
|
+
)
|
|
1014
|
+
malformed_tlp_sev: PcieBitField = PcieBitField(
|
|
1015
|
+
bit_mask=(1 << 18), desc="Malformed TLP Severity"
|
|
1016
|
+
)
|
|
1017
|
+
ecrc_err_sev: PcieBitField = PcieBitField(bit_mask=(1 << 19), desc="ECRC Error Severity")
|
|
1018
|
+
ur_err_sev: PcieBitField = PcieBitField(
|
|
1019
|
+
bit_mask=(1 << 20), desc="Unsupported Request Error Severity"
|
|
1020
|
+
)
|
|
1021
|
+
acs_violation_sev: PcieBitField = PcieBitField(
|
|
1022
|
+
bit_mask=(1 << 21), desc="ACS Violation Severity"
|
|
1023
|
+
)
|
|
1024
|
+
uncorr_int_err_sev: PcieBitField = PcieBitField(
|
|
1025
|
+
bit_mask=(1 << 22), desc="Uncorrectable Internal Error Severity"
|
|
1026
|
+
)
|
|
1027
|
+
mc_blocked_tlp_sev: PcieBitField = PcieBitField(
|
|
1028
|
+
bit_mask=(1 << 23), desc="MC Blocked TLP Severity"
|
|
1029
|
+
)
|
|
1030
|
+
atomicop_egress_blk_sev: PcieBitField = PcieBitField(
|
|
1031
|
+
bit_mask=(1 << 24), desc="AtomicOp Egress Blocked Severity"
|
|
1032
|
+
)
|
|
1033
|
+
tlp_prefix_blk_err_sev: PcieBitField = PcieBitField(
|
|
1034
|
+
bit_mask=(1 << 25), desc="TLP Prefix Blocked Error Severity"
|
|
1035
|
+
)
|
|
1036
|
+
poisoned_tlp_egress_blk_sev: PcieBitField = PcieBitField(
|
|
1037
|
+
bit_mask=(1 << 26), desc="Poisoned TLP Egress Blocked Severity"
|
|
1038
|
+
)
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
class CorrErrStatReg(PcieRegister):
|
|
1042
|
+
"""AER register for Correctable Error Status Register"""
|
|
1043
|
+
|
|
1044
|
+
offset: int = 0x10
|
|
1045
|
+
width: int = 32
|
|
1046
|
+
desc: str = "Correctable Error Status Register"
|
|
1047
|
+
rx_err_stat: PcieBitField = PcieBitField(bit_mask=(1 << 0), desc="Receiver Error Status")
|
|
1048
|
+
bad_tlp_stat: PcieBitField = PcieBitField(bit_mask=(1 << 6), desc="Bad TLP Status")
|
|
1049
|
+
bad_dllp_stat: PcieBitField = PcieBitField(bit_mask=(1 << 7), desc="Bad DLLP Status")
|
|
1050
|
+
replay_num_rollover_stat: PcieBitField = PcieBitField(
|
|
1051
|
+
bit_mask=(1 << 8), desc="REPLAY_NUM Rollover Status"
|
|
1052
|
+
)
|
|
1053
|
+
replay_timer_timeout_stat: PcieBitField = PcieBitField(
|
|
1054
|
+
bit_mask=(1 << 12), desc="Replay Timer Timeout Status"
|
|
1055
|
+
)
|
|
1056
|
+
advisory_non_fatal_err_stat: PcieBitField = PcieBitField(
|
|
1057
|
+
bit_mask=(1 << 13), desc="Advisory Non-Fatal Error Status"
|
|
1058
|
+
)
|
|
1059
|
+
corrected_int_err_stat: PcieBitField = PcieBitField(
|
|
1060
|
+
bit_mask=(1 << 14), desc="Corrected Internal Error Status"
|
|
1061
|
+
)
|
|
1062
|
+
hdr_log_overflow_stat: PcieBitField = PcieBitField(
|
|
1063
|
+
bit_mask=(1 << 15), desc="Header Log Overflow Status"
|
|
1064
|
+
)
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
class CorrErrMaskReg(PcieRegister):
|
|
1068
|
+
"""AER register for Correctable Error Mask Register"""
|
|
1069
|
+
|
|
1070
|
+
offset: int = 0x14
|
|
1071
|
+
width: int = 32
|
|
1072
|
+
desc: str = "7.8.4.6 Correctable Error Mask Register (Offset 14h)"
|
|
1073
|
+
rx_err_mask: PcieBitField = PcieBitField(bit_mask=(1 << 0), desc="Receiver Error Mask")
|
|
1074
|
+
bad_tlp_mask: PcieBitField = PcieBitField(bit_mask=(1 << 6), desc="Bad TLP Mask")
|
|
1075
|
+
bad_dllp_mask: PcieBitField = PcieBitField(bit_mask=(1 << 7), desc="Bad DLLP Mask")
|
|
1076
|
+
replay_num_rollover_mask: PcieBitField = PcieBitField(
|
|
1077
|
+
bit_mask=(1 << 8), desc="REPLAY_NUM Rollover Mask"
|
|
1078
|
+
)
|
|
1079
|
+
replay_timer_timeout_mask: PcieBitField = PcieBitField(
|
|
1080
|
+
bit_mask=(1 << 12), desc="Replay Timer Timeout Mask"
|
|
1081
|
+
)
|
|
1082
|
+
advisory_non_fatal_err_mask: PcieBitField = PcieBitField(
|
|
1083
|
+
bit_mask=(1 << 13), desc="Advisory Non-Fatal Error Mask"
|
|
1084
|
+
)
|
|
1085
|
+
corrected_int_err_mask: PcieBitField = PcieBitField(
|
|
1086
|
+
bit_mask=(1 << 14), desc="Corrected Internal Error Mask"
|
|
1087
|
+
)
|
|
1088
|
+
hdr_log_overflow_mask: PcieBitField = PcieBitField(
|
|
1089
|
+
bit_mask=(1 << 15), desc="Header Log Overflow Mask"
|
|
1090
|
+
)
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
class AerCapCtrlReg(PcieRegister):
|
|
1094
|
+
"""AER register for Advanced Error Capabilities and Control Register"""
|
|
1095
|
+
|
|
1096
|
+
offset: int = 0x18
|
|
1097
|
+
width: int = 32
|
|
1098
|
+
desc: str = "7.8.4.7 Advanced Error Capabilities and Control Register (Offset 18h)"
|
|
1099
|
+
fst_err_ptr: PcieBitField = PcieBitField(bit_mask=(0x1F), desc="First Error Pointer")
|
|
1100
|
+
ecrc_gen_cap: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="ECRC Generation Capable")
|
|
1101
|
+
ecrc_gen_en: PcieBitField = PcieBitField(bit_mask=(1 << 6), desc="ECRC Generation Enable")
|
|
1102
|
+
ecrc_chk_cap: PcieBitField = PcieBitField(bit_mask=(1 << 7), desc="ECRC Check Capable")
|
|
1103
|
+
ecrc_chk_en: PcieBitField = PcieBitField(bit_mask=(1 << 8), desc="ECRC Check Enable")
|
|
1104
|
+
multi_hdr_rec_cap: PcieBitField = PcieBitField(
|
|
1105
|
+
bit_mask=(1 << 9), desc="Multiple Header Recording Capable"
|
|
1106
|
+
)
|
|
1107
|
+
multi_hdr_rec_en: PcieBitField = PcieBitField(
|
|
1108
|
+
bit_mask=(1 << 10), desc="Multiple Header Recording Enable"
|
|
1109
|
+
)
|
|
1110
|
+
tlp_prefix_log_prsnt: PcieBitField = PcieBitField(
|
|
1111
|
+
bit_mask=(1 << 11), desc="TLP Prefix Log Present"
|
|
1112
|
+
)
|
|
1113
|
+
cpl_timeout_prefix_hdr_log_cap: PcieBitField = PcieBitField(
|
|
1114
|
+
bit_mask=(1 << 12), desc="Completion Timeout Prefix/Header Log Capable"
|
|
1115
|
+
)
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
class RootErrCmdReg(PcieRegister):
|
|
1119
|
+
"""AER register for Root Error Command Register"""
|
|
1120
|
+
|
|
1121
|
+
offset: int = 0x2C
|
|
1122
|
+
width: int = 32
|
|
1123
|
+
desc: str = "7.8.4.9 Root Error Command Register (Offset 2Ch)"
|
|
1124
|
+
corr_err_report_en: PcieBitField = PcieBitField(
|
|
1125
|
+
bit_mask=(1 << 0), desc="Correctable Error Reporting Enable"
|
|
1126
|
+
)
|
|
1127
|
+
non_fatal_err_report_en: PcieBitField = PcieBitField(
|
|
1128
|
+
bit_mask=(1 << 1), desc="Non-Fatal Error Reporting Enable"
|
|
1129
|
+
)
|
|
1130
|
+
fatal_err_report_en: PcieBitField = PcieBitField(
|
|
1131
|
+
bit_mask=(1 << 2), desc="Fatal Error Reporting Enable"
|
|
1132
|
+
)
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
class RootErrStatReg(PcieRegister):
|
|
1136
|
+
"""AER register for Root Error Status Register"""
|
|
1137
|
+
|
|
1138
|
+
offset: int = 0x30
|
|
1139
|
+
width: int = 32
|
|
1140
|
+
desc: str = "Root Error Status Register"
|
|
1141
|
+
err_cor_rcvd: PcieBitField = PcieBitField(bit_mask=(1 << 0), desc="ERR_COR Received")
|
|
1142
|
+
multi_err_cor_rcvd: PcieBitField = PcieBitField(
|
|
1143
|
+
bit_mask=(1 << 1), desc="Multiple ERR_COR Received"
|
|
1144
|
+
)
|
|
1145
|
+
err_fatal_nonfatal_rcvd: PcieBitField = PcieBitField(
|
|
1146
|
+
bit_mask=(1 << 2), desc="ERR_FATAL/NONFATAL Received"
|
|
1147
|
+
)
|
|
1148
|
+
multi_err_fatal_nonfatal_rcvd: PcieBitField = PcieBitField(
|
|
1149
|
+
bit_mask=(1 << 3), desc="Multiple ERR_FATAL/NONFATAL Received"
|
|
1150
|
+
)
|
|
1151
|
+
fst_uncorr_fatal: PcieBitField = PcieBitField(
|
|
1152
|
+
bit_mask=(1 << 4), desc="First Uncorrectable Fatal"
|
|
1153
|
+
)
|
|
1154
|
+
non_fatal_err_msg_rcvd: PcieBitField = PcieBitField(
|
|
1155
|
+
bit_mask=(1 << 5), desc="Non-Fatal Error Messages Received"
|
|
1156
|
+
)
|
|
1157
|
+
fatal_err_msg_rcvd: PcieBitField = PcieBitField(
|
|
1158
|
+
bit_mask=(1 << 6), desc="Fatal Error Messages Received"
|
|
1159
|
+
)
|
|
1160
|
+
err_cor_subclass: PcieBitField = PcieBitField(bit_mask=(0x3 << 7), desc="ERR_COR Subclass")
|
|
1161
|
+
adv_err_int_msg_num: PcieBitField = PcieBitField(
|
|
1162
|
+
bit_mask=(0x1F << 27), desc="Advanced Error Interrupt Message Number"
|
|
1163
|
+
)
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
class ErrSrcIdReg(PcieRegister):
|
|
1167
|
+
"""AER register for Error Source Identification Register"""
|
|
1168
|
+
|
|
1169
|
+
offset: int = 0x34
|
|
1170
|
+
width: int = 32
|
|
1171
|
+
desc: str = "7.8.4.11 Error Source Identification Register (Offset 34h)"
|
|
1172
|
+
err_cor_src_id: PcieBitField = PcieBitField(
|
|
1173
|
+
bit_mask=0x0000FFFF, desc="ERR_COR Source Identification"
|
|
1174
|
+
)
|
|
1175
|
+
err_fatal_nonfatal_src_id: PcieBitField = PcieBitField(
|
|
1176
|
+
bit_mask=0xFFFF0000, desc="ERR_FATAL/NONFATAL Source Identification"
|
|
1177
|
+
)
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
class ECapAer(PcieCapStructure):
|
|
1181
|
+
"""Extended Capability for Advanced Error Reporting"""
|
|
1182
|
+
|
|
1183
|
+
extended: Optional[bool] = True
|
|
1184
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.AER
|
|
1185
|
+
offset: int = 0x00
|
|
1186
|
+
desc: str = "7.8.4 Advanced Error Reporting Extended Capability"
|
|
1187
|
+
aer_ecap: AerEcapHdr = AerEcapHdr()
|
|
1188
|
+
uncorr_err_stat: UncorrErrStatReg = UncorrErrStatReg()
|
|
1189
|
+
uncorr_err_mask: UncorrErrMaskReg = UncorrErrMaskReg()
|
|
1190
|
+
uncorr_err_sev: UncorrErrSevReg = UncorrErrSevReg()
|
|
1191
|
+
corr_err_stat: CorrErrStatReg = CorrErrStatReg()
|
|
1192
|
+
corr_err_mask: CorrErrMaskReg = CorrErrMaskReg()
|
|
1193
|
+
aer_cap_ctrl: AerCapCtrlReg = AerCapCtrlReg()
|
|
1194
|
+
root_err_cmd: RootErrCmdReg = RootErrCmdReg()
|
|
1195
|
+
root_err_stat: RootErrStatReg = RootErrStatReg()
|
|
1196
|
+
err_src_id: ErrSrcIdReg = ErrSrcIdReg()
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
class ECapVc(PcieCapStructure):
|
|
1200
|
+
"""Extended Capability for Virtual Channel"""
|
|
1201
|
+
|
|
1202
|
+
extended: Optional[bool] = True
|
|
1203
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.VCEC
|
|
1204
|
+
offset: int = 0x00
|
|
1205
|
+
desc: str = "7.9.1 Virtual Channel Extended Capability"
|
|
1206
|
+
|
|
1207
|
+
|
|
1208
|
+
class ECapDsn(PcieCapStructure):
|
|
1209
|
+
"""Extended Capability for Device Serial Number"""
|
|
1210
|
+
|
|
1211
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DSN
|
|
1212
|
+
offset: int = 0x00
|
|
1213
|
+
desc: str = "7.9.3 Device Serial Number Extended Capability"
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
class ECapPb(PcieCapStructure):
|
|
1217
|
+
"""Extended Capability for Power Budgeting"""
|
|
1218
|
+
|
|
1219
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PWR_BUDGET
|
|
1220
|
+
offset: int = 0x00
|
|
1221
|
+
desc: str = "7.8.1 Power Budgeting Extended Capability"
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
class ECapRclink(PcieCapStructure):
|
|
1225
|
+
"""Extended Capability for Root Complex Link Declaration"""
|
|
1226
|
+
|
|
1227
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.LNK_DCLR
|
|
1228
|
+
offset: int = 0x00
|
|
1229
|
+
desc: str = "7.9.8.1 Root Complex Link Declaration Extended Capability Header (Offset 00h)"
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
class ECapRcilink(PcieCapStructure):
|
|
1233
|
+
"""Extended Capability for Root Complex Internal Link Control"""
|
|
1234
|
+
|
|
1235
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.LNK_CEC
|
|
1236
|
+
offset: int = 0x00
|
|
1237
|
+
desc: str = "7.9.9 Root Complex Internal Link Control Extended Capability"
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
class ECapRcecoll(PcieCapStructure):
|
|
1241
|
+
"""Extended Capability for Root Complex Event Collector Endpoint Association"""
|
|
1242
|
+
|
|
1243
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.RCECOLL
|
|
1244
|
+
offset: int = 0x00
|
|
1245
|
+
desc: str = (
|
|
1246
|
+
"7.9.10 Root Complex Event Collector Endpoint Association Extended Capability (Dell)"
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
class ECapMfvc(PcieCapStructure):
|
|
1251
|
+
"""Extended Capability for Multi-Function Virtual Channel"""
|
|
1252
|
+
|
|
1253
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.MFVC
|
|
1254
|
+
offset: int = 0x00
|
|
1255
|
+
desc: str = "7.9.2 Multi-Function Virtual Channel Extended Capability"
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
class ECapVc2(PcieCapStructure):
|
|
1259
|
+
"""Extended Capability for Virtual Channel 2"""
|
|
1260
|
+
|
|
1261
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.VC2
|
|
1262
|
+
offset: int = 0x00
|
|
1263
|
+
desc: str = "7.9.1 Virtual Channel Extended Capability"
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
class ECapRcrb(PcieCapStructure):
|
|
1267
|
+
"""Extended Capability for RCRB Header"""
|
|
1268
|
+
|
|
1269
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.RCRB
|
|
1270
|
+
offset: int = 0x00
|
|
1271
|
+
desc: str = "7.9.7 RCRB Header Extended Capability"
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
class ECapVndr(PcieCapStructure):
|
|
1275
|
+
"""Extended Capability for Vendor-Specific"""
|
|
1276
|
+
|
|
1277
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.VNDR
|
|
1278
|
+
offset: int = 0x00
|
|
1279
|
+
desc: str = "7.9.5 Vendor-Specific Extended Capability"
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
class ECapCac(PcieCapStructure):
|
|
1283
|
+
"""Extended Capability for Configuration Access Correlation"""
|
|
1284
|
+
|
|
1285
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.CAC
|
|
1286
|
+
offset: int = 0x00
|
|
1287
|
+
desc: str = "7.7. Configuration Access Correlation Extended Capability"
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
class ECapAcs(PcieCapStructure):
|
|
1291
|
+
"""Extended Capability for ACS"""
|
|
1292
|
+
|
|
1293
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.ACS
|
|
1294
|
+
offset: int = 0x00
|
|
1295
|
+
desc: str = "7.7.8 ACS Extended Capability"
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
class ECapAri(PcieCapStructure):
|
|
1299
|
+
"""Extended Capability for ARI"""
|
|
1300
|
+
|
|
1301
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.ARI
|
|
1302
|
+
offset: int = 0x00
|
|
1303
|
+
desc: str = "7.8.7 ARI Extended Capability"
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
class ECapAts(PcieCapStructure):
|
|
1307
|
+
"""Extended Capability for ATS"""
|
|
1308
|
+
|
|
1309
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.ATS
|
|
1310
|
+
offset: int = 0x00
|
|
1311
|
+
desc: str = "10.5.1 ATS Extended Capability"
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
class ECapSriov(PcieCapStructure):
|
|
1315
|
+
"""Extended Capability for SR-IOV"""
|
|
1316
|
+
|
|
1317
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.SRIOV
|
|
1318
|
+
offset: int = 0x00
|
|
1319
|
+
desc: str = "9.3.3 SR-IOV Extended Capability"
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
class ECapMriov(PcieCapStructure):
|
|
1323
|
+
"""Extended Capability for MR-IOV"""
|
|
1324
|
+
|
|
1325
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.MRIOV
|
|
1326
|
+
offset: int = 0x00
|
|
1327
|
+
desc: str = "MR-IOV Extended Capability (MR-IOV)"
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
class ECapMcast(PcieCapStructure):
|
|
1331
|
+
"""Extended Capability for Multicast"""
|
|
1332
|
+
|
|
1333
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.MULTCAST
|
|
1334
|
+
offset: int = 0x00
|
|
1335
|
+
desc: str = "7.9.11 Multicast Extended Capability"
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
class ECapPri(PcieCapStructure):
|
|
1339
|
+
"""Extended Capability for Page Request Interface"""
|
|
1340
|
+
|
|
1341
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PAGE_REQ
|
|
1342
|
+
offset: int = 0x00
|
|
1343
|
+
desc: str = "10.5.2 Page Request Extended Capability Structure"
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
class ECapAMD(PcieCapStructure):
|
|
1347
|
+
"""Extended Capability for AMD"""
|
|
1348
|
+
|
|
1349
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.AMD
|
|
1350
|
+
offset: int = 0x00
|
|
1351
|
+
desc: str = "Reserved for AMD"
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
class ECapReba(PcieCapStructure):
|
|
1355
|
+
"""Extended Capability for Resizable BAR"""
|
|
1356
|
+
|
|
1357
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.RBAR
|
|
1358
|
+
offset: int = 0x00
|
|
1359
|
+
desc: str = "7.8.6 Resizable BAR Extended Capability"
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
class ECapDpa(PcieCapStructure):
|
|
1363
|
+
"""Extended Capability for Dynamic Power Allocation"""
|
|
1364
|
+
|
|
1365
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DPA
|
|
1366
|
+
offset: int = 0x00
|
|
1367
|
+
desc: str = "7.9.12 Dynamic Power Allocation Extended Capability (DPA Capability)"
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
class ECapTph(PcieCapStructure):
|
|
1371
|
+
"""Extended Capability for TPH"""
|
|
1372
|
+
|
|
1373
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.TPH
|
|
1374
|
+
offset: int = 0x00
|
|
1375
|
+
desc: str = "7.9.13.1 TPH Requester Extended Capability Header (Offset 00h)"
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
class ECapLtr(PcieCapStructure):
|
|
1379
|
+
"""Extended Capability for LTR"""
|
|
1380
|
+
|
|
1381
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.LTR
|
|
1382
|
+
offset: int = 0x00
|
|
1383
|
+
desc: str = "7.8.2 Latency Tolerance Reporting (LTR) Extended Capability"
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
class LaneErrorStatReg(PcieRegister):
|
|
1387
|
+
"""Lane error status register"""
|
|
1388
|
+
|
|
1389
|
+
desc: str = "Lane Error Status Register"
|
|
1390
|
+
offset: int = 0x08
|
|
1391
|
+
width: int = 32
|
|
1392
|
+
lane0_err_stat: PcieBitField = PcieBitField(
|
|
1393
|
+
bit_mask=0xFFFFFFFF,
|
|
1394
|
+
desc="Lane Error Status Bits - Each bit indicates if the corresponding Lane detected a Lane-based error.",
|
|
1395
|
+
)
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
class ECapSecpci(PcieCapStructure):
|
|
1399
|
+
"""Extended Capability for Secondary PCI Express"""
|
|
1400
|
+
|
|
1401
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.SPCI
|
|
1402
|
+
offset: int = 0x00
|
|
1403
|
+
desc: str = "7.7.3 Secondary PCI Express Extended Capability"
|
|
1404
|
+
lane_err_stat: LaneErrorStatReg = LaneErrorStatReg()
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
class ECapPmux(PcieCapStructure):
|
|
1408
|
+
"""Extended Capability for PMUX"""
|
|
1409
|
+
|
|
1410
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PMUX
|
|
1411
|
+
offset: int = 0x00
|
|
1412
|
+
desc: str = "G.5 PMUX Extended Capability"
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
class ECapPasid(PcieCapStructure):
|
|
1416
|
+
"""Extended Capability for PASID"""
|
|
1417
|
+
|
|
1418
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PASID
|
|
1419
|
+
offset: int = 0x00
|
|
1420
|
+
desc: str = "7.8.8 PASID Extended Capability Structure"
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
class ECapLnr(PcieCapStructure):
|
|
1424
|
+
"""Extended Capability for LN Requester"""
|
|
1425
|
+
|
|
1426
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.LN
|
|
1427
|
+
offset: int = 0x00
|
|
1428
|
+
desc: str = "7.9.14 LN Requester Extended Capability (LNR Capability)"
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
class ECapDpc(PcieCapStructure):
|
|
1432
|
+
"""Extended Capability for DPC"""
|
|
1433
|
+
|
|
1434
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DPC
|
|
1435
|
+
offset: int = 0x00
|
|
1436
|
+
desc: str = "7.9.15 DPC Extended Capability"
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
class ECapL1pm(PcieCapStructure):
|
|
1440
|
+
"""Extended Capability for L1 PM Substates"""
|
|
1441
|
+
|
|
1442
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.L1PM
|
|
1443
|
+
offset: int = 0x00
|
|
1444
|
+
desc: str = "7.8.3 L1 PM Substates Extended Capability"
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
class ECapPtm(PcieCapStructure):
|
|
1448
|
+
"""Extended Capability for PTM"""
|
|
1449
|
+
|
|
1450
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PTM
|
|
1451
|
+
offset: int = 0x00
|
|
1452
|
+
desc: str = "7.9.16 Precision Time Management Extended Capability (PTM Capability)"
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
class ECapMpcie(PcieCapStructure):
|
|
1456
|
+
"""Extended Capability for M-PCIe"""
|
|
1457
|
+
|
|
1458
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.MPCIE
|
|
1459
|
+
offset: int = 0x00
|
|
1460
|
+
desc: str = "PCI Express over M-PHY Extended Capability (M-PCIe)"
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
class ECapFrs(PcieCapStructure):
|
|
1464
|
+
"""Extended Capability for FRS Queueing"""
|
|
1465
|
+
|
|
1466
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.FRS
|
|
1467
|
+
offset: int = 0x00
|
|
1468
|
+
desc: str = "7.8.9 FRS Queueing Extended Capability"
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
class ECapRtr(PcieCapStructure):
|
|
1472
|
+
"""Extended Capability for Readiness Time Reporting"""
|
|
1473
|
+
|
|
1474
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.RTR
|
|
1475
|
+
offset: int = 0x00
|
|
1476
|
+
desc: str = "7.9.17 Readiness Time Reporting Extended Capability"
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
class ECapDvsec(PcieCapStructure):
|
|
1480
|
+
"""Extended Capability for Designated Vendor-Specific"""
|
|
1481
|
+
|
|
1482
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DVENDR
|
|
1483
|
+
offset: int = 0x00
|
|
1484
|
+
desc: str = "7.9.6 Designated Vendor-Specific Extended Capability (DVSEC)"
|
|
1485
|
+
|
|
1486
|
+
|
|
1487
|
+
class ECapVfRebar(PcieCapStructure):
|
|
1488
|
+
"""Extended Capability for VF Resizable BAR"""
|
|
1489
|
+
|
|
1490
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.VFBAR
|
|
1491
|
+
offset: int = 0x00
|
|
1492
|
+
desc: str = "9.3.7.5 VF Resizable BAR Extended Capability"
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
class ECapDlnk(PcieCapStructure):
|
|
1496
|
+
"""Extended Capability for Downstream Link"""
|
|
1497
|
+
|
|
1498
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DLF
|
|
1499
|
+
offset: int = 0x00
|
|
1500
|
+
desc: str = "7.7.4 Data Link Feature Extended Capability"
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
class Phy16GtEcapHdr(PcieRegister):
|
|
1504
|
+
"""Extended Capability for 16.0 GT/s Physical Layer"""
|
|
1505
|
+
|
|
1506
|
+
offset: int = 0x00
|
|
1507
|
+
width: int = 32
|
|
1508
|
+
desc: str = "7.7.5.1 Physical Layer 16.0 GT/s Extended Capability Header (Offset 00h)"
|
|
1509
|
+
pcie_ecap_id: PcieBitField = PcieBitField(
|
|
1510
|
+
bit_mask=0x0000FFFF, desc="PCI Express Extended Capability ID"
|
|
1511
|
+
)
|
|
1512
|
+
cap_ver: PcieBitField = PcieBitField(bit_mask=0x000F0000, desc="Capability Version")
|
|
1513
|
+
nxt_cap_offset: PcieBitField = PcieBitField(bit_mask=0xFFF00000, desc="Next Capability Offset")
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
class Phy16GtEcapStat(PcieRegister):
|
|
1517
|
+
"""Register for 16.0 GT/s Physical Layer Status"""
|
|
1518
|
+
|
|
1519
|
+
offset: int = 0x0C
|
|
1520
|
+
width: int = 32
|
|
1521
|
+
desc: str = "16.0 GT/s Status Register"
|
|
1522
|
+
eq_16gt_cpl: PcieBitField = PcieBitField(
|
|
1523
|
+
bit_mask=(1 << 0), desc="Equalization 16.0 GT/s Complete"
|
|
1524
|
+
)
|
|
1525
|
+
eq_16gt_ph1_success: PcieBitField = PcieBitField(
|
|
1526
|
+
bit_mask=(1 << 1), desc="Equalization 16.0 GT/s Phase 1 Successful"
|
|
1527
|
+
)
|
|
1528
|
+
eq_16gt_ph2_success: PcieBitField = PcieBitField(
|
|
1529
|
+
bit_mask=(1 << 2), desc="Equalization 16.0 GT/s Phase 2 Successful"
|
|
1530
|
+
)
|
|
1531
|
+
eq_16gt_ph3_success: PcieBitField = PcieBitField(
|
|
1532
|
+
bit_mask=(1 << 3), desc="Equalization 16.0 GT/s Phase 3 Successful"
|
|
1533
|
+
)
|
|
1534
|
+
lnk_eq_req_16gt: PcieBitField = PcieBitField(
|
|
1535
|
+
bit_mask=(1 << 4), desc="Link Equalization Request 16.0 GT/s"
|
|
1536
|
+
)
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
class ParityMisMatchStat16GT(PcieRegister):
|
|
1540
|
+
"""Register for 16.0 GT/s Parity Mismatch Status"""
|
|
1541
|
+
|
|
1542
|
+
pos: int = 10
|
|
1543
|
+
width: int = 32
|
|
1544
|
+
offset: int = 0x10
|
|
1545
|
+
desc: str = "16.0 GT/s Local Data Parity Mismatch Status Register"
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
class RetimerFstPartiyRetimerMismatchStat16gt(PcieRegister):
|
|
1549
|
+
"""Rgister for 16.0 GT/s First Retimer Data Parity Mismatch Status"""
|
|
1550
|
+
|
|
1551
|
+
pos: int = 14
|
|
1552
|
+
width: int = 32
|
|
1553
|
+
offset: int = 0x14
|
|
1554
|
+
desc: str = "16.0 GT/s First Retimer Data Parity Mismatch Status Register"
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
class RetimerSecPartiyRetimerMismatchStat16gt(PcieRegister):
|
|
1558
|
+
"""Register for 16.0 GT/s Second Retimer Data Parity Mismatch Status"""
|
|
1559
|
+
|
|
1560
|
+
pos: int = 18
|
|
1561
|
+
width: int = 32
|
|
1562
|
+
offset: int = 0x18
|
|
1563
|
+
desc: str = "16.0 GT/s Second Retimer Data Parity Mismatch Status Register"
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
class EqCtl16Gt0(PcieRegister):
|
|
1567
|
+
"""Register for 16.0 GT/s Equalization Control 0"""
|
|
1568
|
+
|
|
1569
|
+
offset: int
|
|
1570
|
+
width: int = 8
|
|
1571
|
+
desc: str = "7.7.5.9 16.0 GT/s Lane Equalization Control Register (Offsets 20h to 3Ch)"
|
|
1572
|
+
upstream_eq_ctl_16gt_0: PcieBitField = PcieBitField(
|
|
1573
|
+
bit_mask=0x000000FF, desc="Upstream Equalization Control 16.0 GT/s 0"
|
|
1574
|
+
)
|
|
1575
|
+
downstream_eq_ctl_16gt_0: PcieBitField = PcieBitField(
|
|
1576
|
+
bit_mask=0x0000FF00, desc="Downstream Equalization Control 16.0 GT/s 0"
|
|
1577
|
+
)
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
class ECap16Gt(PcieCapStructure):
|
|
1581
|
+
"""Extended Capability for 16.0 GT/s Physical Layer"""
|
|
1582
|
+
|
|
1583
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PL_16GT
|
|
1584
|
+
offset: int = 0x00
|
|
1585
|
+
desc: str = "7.7.5 Physical Layer 16.0 GT/s Extended Capability"
|
|
1586
|
+
header: Phy16GtEcapHdr = Phy16GtEcapHdr()
|
|
1587
|
+
status: Phy16GtEcapStat = Phy16GtEcapStat()
|
|
1588
|
+
parity_mismatch_stat: ParityMisMatchStat16GT = ParityMisMatchStat16GT()
|
|
1589
|
+
retimer_fst_parity_mismatch_stat: RetimerFstPartiyRetimerMismatchStat16gt = (
|
|
1590
|
+
RetimerFstPartiyRetimerMismatchStat16gt()
|
|
1591
|
+
)
|
|
1592
|
+
retimer_sec_parity_mismatch_stat: RetimerSecPartiyRetimerMismatchStat16gt = (
|
|
1593
|
+
RetimerSecPartiyRetimerMismatchStat16gt()
|
|
1594
|
+
)
|
|
1595
|
+
eq_ctl_16gt_0: EqCtl16Gt0 = EqCtl16Gt0(offset=0x20, desc="16GT/s Equalization Control 0")
|
|
1596
|
+
eq_ctl_16gt_1: EqCtl16Gt0 = EqCtl16Gt0(offset=0x21, desc="16GT/s Equalization Control 1")
|
|
1597
|
+
eq_ctl_16gt_2: EqCtl16Gt0 = EqCtl16Gt0(offset=0x22, desc="16GT/s Equalization Control 2")
|
|
1598
|
+
eq_ctl_16gt_3: EqCtl16Gt0 = EqCtl16Gt0(offset=0x23, desc="16GT/s Equalization Control 3")
|
|
1599
|
+
eq_ctl_16gt_4: EqCtl16Gt0 = EqCtl16Gt0(offset=0x24, desc="16GT/s Equalization Control 4")
|
|
1600
|
+
eq_ctl_16gt_5: EqCtl16Gt0 = EqCtl16Gt0(offset=0x25, desc="16GT/s Equalization Control 5")
|
|
1601
|
+
eq_ctl_16gt_6: EqCtl16Gt0 = EqCtl16Gt0(offset=0x26, desc="16GT/s Equalization Control 6")
|
|
1602
|
+
eq_ctl_16gt_7: EqCtl16Gt0 = EqCtl16Gt0(offset=0x27, desc="16GT/s Equalization Control 7")
|
|
1603
|
+
eq_ctl_16gt_8: EqCtl16Gt0 = EqCtl16Gt0(offset=0x28, desc="16GT/s Equalization Control 8")
|
|
1604
|
+
eq_ctl_16gt_9: EqCtl16Gt0 = EqCtl16Gt0(offset=0x29, desc="16GT/s Equalization Control 9")
|
|
1605
|
+
eq_ctl_16gt_10: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2A, desc="16GT/s Equalization Control 10")
|
|
1606
|
+
eq_ctl_16gt_11: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2B, desc="16GT/s Equalization Control 11")
|
|
1607
|
+
eq_ctl_16gt_12: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2C, desc="16GT/s Equalization Control 12")
|
|
1608
|
+
eq_ctl_16gt_13: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2D, desc="16GT/s Equalization Control 13")
|
|
1609
|
+
eq_ctl_16gt_14: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2E, desc="16GT/s Equalization Control 14")
|
|
1610
|
+
eq_ctl_16gt_15: EqCtl16Gt0 = EqCtl16Gt0(offset=0x2F, desc="16GT/s Equalization Control 15")
|
|
1611
|
+
eq_ctl_16gt_16: EqCtl16Gt0 = EqCtl16Gt0(offset=0x30, desc="16GT/s Equalization Control 16")
|
|
1612
|
+
eq_ctl_16gt_17: EqCtl16Gt0 = EqCtl16Gt0(offset=0x31, desc="16GT/s Equalization Control 17")
|
|
1613
|
+
eq_ctl_16gt_18: EqCtl16Gt0 = EqCtl16Gt0(offset=0x32, desc="16GT/s Equalization Control 18")
|
|
1614
|
+
eq_ctl_16gt_19: EqCtl16Gt0 = EqCtl16Gt0(offset=0x33, desc="16GT/s Equalization Control 19")
|
|
1615
|
+
eq_ctl_16gt_20: EqCtl16Gt0 = EqCtl16Gt0(offset=0x34, desc="16GT/s Equalization Control 20")
|
|
1616
|
+
eq_ctl_16gt_21: EqCtl16Gt0 = EqCtl16Gt0(offset=0x35, desc="16GT/s Equalization Control 21")
|
|
1617
|
+
eq_ctl_16gt_22: EqCtl16Gt0 = EqCtl16Gt0(offset=0x36, desc="16GT/s Equalization Control 22")
|
|
1618
|
+
eq_ctl_16gt_23: EqCtl16Gt0 = EqCtl16Gt0(offset=0x37, desc="16GT/s Equalization Control 23")
|
|
1619
|
+
eq_ctl_16gt_24: EqCtl16Gt0 = EqCtl16Gt0(offset=0x38, desc="16GT/s Equalization Control 24")
|
|
1620
|
+
eq_ctl_16gt_25: EqCtl16Gt0 = EqCtl16Gt0(offset=0x39, desc="16GT/s Equalization Control 25")
|
|
1621
|
+
eq_ctl_16gt_26: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3A, desc="16GT/s Equalization Control 26")
|
|
1622
|
+
eq_ctl_16gt_27: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3B, desc="16GT/s Equalization Control 27")
|
|
1623
|
+
eq_ctl_16gt_28: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3C, desc="16GT/s Equalization Control 28")
|
|
1624
|
+
eq_ctl_16gt_29: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3D, desc="16GT/s Equalization Control 29")
|
|
1625
|
+
eq_ctl_16gt_30: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3E, desc="16GT/s Equalization Control 30")
|
|
1626
|
+
eq_ctl_16gt_31: EqCtl16Gt0 = EqCtl16Gt0(offset=0x3F, desc="16GT/s Equalization Control 31")
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
class ECapLmr(PcieCapStructure):
|
|
1630
|
+
"""Extended Capability for Lane Margining at the Receiver"""
|
|
1631
|
+
|
|
1632
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.LM
|
|
1633
|
+
offset: int = 0x00
|
|
1634
|
+
desc: str = "7.7.7 Lane Margining at the Receiver Extended Capability"
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
class ECapHierId(PcieCapStructure):
|
|
1638
|
+
"""Extended Capability for Hierarchy ID"""
|
|
1639
|
+
|
|
1640
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.HID
|
|
1641
|
+
offset: int = 0x00
|
|
1642
|
+
desc: str = "7.9.18 Hierarchy ID Extended Capability"
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
class ECapNpem(PcieCapStructure):
|
|
1646
|
+
"""Extended Capability for Native PCIe Enclosure Management"""
|
|
1647
|
+
|
|
1648
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.NPEM
|
|
1649
|
+
offset: int = 0x00
|
|
1650
|
+
desc: str = (
|
|
1651
|
+
"7.9.20 Native PCIe Enclosure Management Extended Capability (NPEM Extended Capability)"
|
|
1652
|
+
)
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
class Phy32GtEcapHdr(PcieRegister):
|
|
1656
|
+
"""Extended Capability for 32.0 GT/s Physical Layer"""
|
|
1657
|
+
|
|
1658
|
+
offset: int = 0x00
|
|
1659
|
+
width: int = 32
|
|
1660
|
+
desc: str = "7.7.6.1 Physical Layer 32.0 GT/s Extended Capability Header (Offset 00h)"
|
|
1661
|
+
pcie_ecap_id: PcieBitField = PcieBitField(
|
|
1662
|
+
bit_mask=0x0000FFFF, desc="PCI Express Extended Capability ID"
|
|
1663
|
+
)
|
|
1664
|
+
cap_ver: PcieBitField = PcieBitField(bit_mask=0x000F0000, desc="Capability Version")
|
|
1665
|
+
nxt_cap_offset: PcieBitField = PcieBitField(bit_mask=0xFFF00000, desc="Next Capability Offset")
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
class Phy32GtEcapCapReg(PcieRegister):
|
|
1669
|
+
"""Register for 32.0 GT/s Capabilities"""
|
|
1670
|
+
|
|
1671
|
+
offset: int = 0x04
|
|
1672
|
+
width: int = 32
|
|
1673
|
+
desc: str = "7.7.6.2 32.0 GT/s Capabilities Register (Offset 04h"
|
|
1674
|
+
eq_bypass_hi_rate: PcieBitField = PcieBitField(
|
|
1675
|
+
bit_mask=(1 << 0), desc="Equalization bypass to highest rate Supported"
|
|
1676
|
+
)
|
|
1677
|
+
no_equi_needed: PcieBitField = PcieBitField(
|
|
1678
|
+
bit_mask=(1 << 1), desc="No Equalization Needed Supported - When Set"
|
|
1679
|
+
)
|
|
1680
|
+
modified_ts_usage_mode_0_supported: PcieBitField = PcieBitField(
|
|
1681
|
+
bit_mask=(1 << 8), desc="Modified TS Usage Mode 0 Supported"
|
|
1682
|
+
)
|
|
1683
|
+
modified_ts_usage_mode_1_supported: PcieBitField = PcieBitField(
|
|
1684
|
+
bit_mask=(1 << 9), desc="Modified TS Usage Mode 1 Supported"
|
|
1685
|
+
)
|
|
1686
|
+
modified_ts_usage_mode_2_supported: PcieBitField = PcieBitField(
|
|
1687
|
+
bit_mask=(1 << 10), desc="Modified TS Usage Mode 2 Supported"
|
|
1688
|
+
)
|
|
1689
|
+
modified_ts_reserved_usage_modes: PcieBitField = PcieBitField(
|
|
1690
|
+
bit_mask=(0x1F << 11), desc="Modified TS Reserved Usage Modes"
|
|
1691
|
+
)
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
class Phy32GtStatReg(PcieRegister):
|
|
1695
|
+
"""Register for 32.0 GT/s Status"""
|
|
1696
|
+
|
|
1697
|
+
offset: int = 0x0C
|
|
1698
|
+
width: int = 32
|
|
1699
|
+
desc: str = "32.0 GT/s Status Register"
|
|
1700
|
+
eq_32gt_cpl: PcieBitField = PcieBitField(
|
|
1701
|
+
bit_mask=(1 << 0), desc="Equalization 32.0 GT/s Complete"
|
|
1702
|
+
)
|
|
1703
|
+
eq_32gt_ph1_success: PcieBitField = PcieBitField(
|
|
1704
|
+
bit_mask=(1 << 1), desc="Equalization 32.0 GT/s Phase 1 Successful"
|
|
1705
|
+
)
|
|
1706
|
+
eq_32gt_ph2_success: PcieBitField = PcieBitField(
|
|
1707
|
+
bit_mask=(1 << 2), desc="Equalization 32.0 GT/s Phase 2 Successful"
|
|
1708
|
+
)
|
|
1709
|
+
eq_32gt_ph3_success: PcieBitField = PcieBitField(
|
|
1710
|
+
bit_mask=(1 << 3), desc="Equalization 32.0 GT/s Phase 3 Successful"
|
|
1711
|
+
)
|
|
1712
|
+
lnk_eq_req_32gt: PcieBitField = PcieBitField(
|
|
1713
|
+
bit_mask=(1 << 4), desc="Link Equalization Request 32.0 GT/s"
|
|
1714
|
+
)
|
|
1715
|
+
modified_ts_rcvd: PcieBitField = PcieBitField(bit_mask=(1 << 5), desc="Modified TS Received")
|
|
1716
|
+
rcvd_enhanced_link_behav_ctrl: PcieBitField = PcieBitField(
|
|
1717
|
+
bit_mask=(0x3 << 6), desc="Received Enhanced Link Behavior Control"
|
|
1718
|
+
)
|
|
1719
|
+
tx_precoding_on: PcieBitField = PcieBitField(bit_mask=(1 << 8), desc="Transmitter Precoding On")
|
|
1720
|
+
tx_precoding_req: PcieBitField = PcieBitField(
|
|
1721
|
+
bit_mask=(1 << 9), desc="Transmitter Precode Request"
|
|
1722
|
+
)
|
|
1723
|
+
no_eq_needed_rcvd: PcieBitField = PcieBitField(
|
|
1724
|
+
bit_mask=(1 << 10), desc="No Equalization Needed Received"
|
|
1725
|
+
)
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
class TransReceived32GTData1(PcieRegister):
|
|
1729
|
+
"""Register for 32.0 GT/s Received Modified TS Data 1"""
|
|
1730
|
+
|
|
1731
|
+
offset: int = 0x10
|
|
1732
|
+
width: int = 32
|
|
1733
|
+
desc: str = "7.7.6.5 Received Modified TS Data 1 Register (Offset 10h)"
|
|
1734
|
+
rcvd_mod_ts_usage_mode: PcieBitField = PcieBitField(
|
|
1735
|
+
bit_mask=(0x7 << 0), desc="Received Modified TS Usage Mode"
|
|
1736
|
+
)
|
|
1737
|
+
rcvd_mod_ts_info_1: PcieBitField = PcieBitField(
|
|
1738
|
+
bit_mask=(0xFFF << 3), desc="Received Modified TS Information 1"
|
|
1739
|
+
)
|
|
1740
|
+
rcvd_mod_ts_vendor_id: PcieBitField = PcieBitField(
|
|
1741
|
+
bit_mask=(0xFFFF << 16), desc="Received Modified TS Vendor ID"
|
|
1742
|
+
)
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
# 23:0 Received Modified TS Information 2
|
|
1746
|
+
# 25:24 Alternate Protocol Negotiation Status
|
|
1747
|
+
class TransReceived32GTData2(PcieRegister):
|
|
1748
|
+
"""Register for 32.0 GT/s Received Modified TS Data 2"""
|
|
1749
|
+
|
|
1750
|
+
offset: int = 0x14
|
|
1751
|
+
width: int = 32
|
|
1752
|
+
desc: str = "7.7.6.6 Received Modified TS Data 2 Register (Offset 14h)"
|
|
1753
|
+
rcvd_mod_ts_info_2: PcieBitField = PcieBitField(
|
|
1754
|
+
bit_mask=(0x7FF << 0), desc="Received Modified TS Information 2"
|
|
1755
|
+
)
|
|
1756
|
+
alt_proto_neg_status: PcieBitField = PcieBitField(
|
|
1757
|
+
bit_mask=(0x3 << 24), desc="Alternate Protocol Negotiation Status"
|
|
1758
|
+
)
|
|
1759
|
+
|
|
1760
|
+
|
|
1761
|
+
class EqCtl32Gt0(PcieRegister):
|
|
1762
|
+
"""Equalization Control for 32.0 GT/s"""
|
|
1763
|
+
|
|
1764
|
+
offset: int
|
|
1765
|
+
width: int = 8
|
|
1766
|
+
desc: str = "7.7.6.9 32.0 GT/s Lane Equalization Control Register (Offset 20h to 3Ch)"
|
|
1767
|
+
upstream_eq_ctl_32gt_0: PcieBitField = PcieBitField(
|
|
1768
|
+
bit_mask=0x000000FF, desc="Upstream Equalization Control 32.0 GT/s 0"
|
|
1769
|
+
)
|
|
1770
|
+
downstream_eq_ctl_32gt_0: PcieBitField = PcieBitField(
|
|
1771
|
+
bit_mask=0x0000FF00, desc="Downstream Equalization Control 32.0 GT/s 0"
|
|
1772
|
+
)
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
class ECap32Gts(PcieCapStructure):
|
|
1776
|
+
"""Extended Capability for 32.0 GT/s Physical Layer"""
|
|
1777
|
+
|
|
1778
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.PL_32GT
|
|
1779
|
+
offset: int = 0x00
|
|
1780
|
+
desc: str = "7.7.6 Physical Layer 32.0 GT/s Extended Capability"
|
|
1781
|
+
header: Phy32GtEcapHdr = Phy32GtEcapHdr()
|
|
1782
|
+
cap_reg: Phy32GtEcapCapReg = Phy32GtEcapCapReg()
|
|
1783
|
+
status: Phy32GtStatReg = Phy32GtStatReg()
|
|
1784
|
+
recv_data_1: TransReceived32GTData1 = TransReceived32GTData1()
|
|
1785
|
+
recv_data_2: TransReceived32GTData2 = TransReceived32GTData2()
|
|
1786
|
+
trans_data_1: TransReceived32GTData1 = TransReceived32GTData1(offset=0x18)
|
|
1787
|
+
trans_data_2: TransReceived32GTData2 = TransReceived32GTData2(offset=0x1C)
|
|
1788
|
+
eq_ctl_32gt_0: EqCtl32Gt0 = EqCtl32Gt0(offset=0x20, desc="32GT/s Equalization Control 0")
|
|
1789
|
+
eq_ctl_32gt_1: EqCtl32Gt0 = EqCtl32Gt0(offset=0x21, desc="32GT/s Equalization Control 1")
|
|
1790
|
+
eq_ctl_32gt_2: EqCtl32Gt0 = EqCtl32Gt0(offset=0x22, desc="32GT/s Equalization Control 2")
|
|
1791
|
+
eq_ctl_32gt_3: EqCtl32Gt0 = EqCtl32Gt0(offset=0x23, desc="32GT/s Equalization Control 3")
|
|
1792
|
+
eq_ctl_32gt_4: EqCtl32Gt0 = EqCtl32Gt0(offset=0x24, desc="32GT/s Equalization Control 4")
|
|
1793
|
+
eq_ctl_32gt_5: EqCtl32Gt0 = EqCtl32Gt0(offset=0x25, desc="32GT/s Equalization Control 5")
|
|
1794
|
+
eq_ctl_32gt_6: EqCtl32Gt0 = EqCtl32Gt0(offset=0x26, desc="32GT/s Equalization Control 6")
|
|
1795
|
+
eq_ctl_32gt_7: EqCtl32Gt0 = EqCtl32Gt0(offset=0x27, desc="32GT/s Equalization Control 7")
|
|
1796
|
+
eq_ctl_32gt_8: EqCtl32Gt0 = EqCtl32Gt0(offset=0x28, desc="32GT/s Equalization Control 8")
|
|
1797
|
+
eq_ctl_32gt_9: EqCtl32Gt0 = EqCtl32Gt0(offset=0x29, desc="32GT/s Equalization Control 9")
|
|
1798
|
+
eq_ctl_32gt_10: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2A, desc="32GT/s Equalization Control 10")
|
|
1799
|
+
eq_ctl_32gt_11: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2B, desc="32GT/s Equalization Control 11")
|
|
1800
|
+
eq_ctl_32gt_12: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2C, desc="32GT/s Equalization Control 12")
|
|
1801
|
+
eq_ctl_32gt_13: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2D, desc="32GT/s Equalization Control 13")
|
|
1802
|
+
eq_ctl_32gt_14: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2E, desc="32GT/s Equalization Control 14")
|
|
1803
|
+
eq_ctl_32gt_15: EqCtl32Gt0 = EqCtl32Gt0(offset=0x2F, desc="32GT/s Equalization Control 15")
|
|
1804
|
+
eq_ctl_32gt_32: EqCtl32Gt0 = EqCtl32Gt0(offset=0x30, desc="32GT/s Equalization Control 32")
|
|
1805
|
+
eq_ctl_32gt_17: EqCtl32Gt0 = EqCtl32Gt0(offset=0x31, desc="32GT/s Equalization Control 17")
|
|
1806
|
+
eq_ctl_32gt_18: EqCtl32Gt0 = EqCtl32Gt0(offset=0x32, desc="32GT/s Equalization Control 18")
|
|
1807
|
+
eq_ctl_32gt_19: EqCtl32Gt0 = EqCtl32Gt0(offset=0x33, desc="32GT/s Equalization Control 19")
|
|
1808
|
+
eq_ctl_32gt_20: EqCtl32Gt0 = EqCtl32Gt0(offset=0x34, desc="32GT/s Equalization Control 20")
|
|
1809
|
+
eq_ctl_32gt_21: EqCtl32Gt0 = EqCtl32Gt0(offset=0x35, desc="32GT/s Equalization Control 21")
|
|
1810
|
+
eq_ctl_32gt_22: EqCtl32Gt0 = EqCtl32Gt0(offset=0x36, desc="32GT/s Equalization Control 22")
|
|
1811
|
+
eq_ctl_32gt_23: EqCtl32Gt0 = EqCtl32Gt0(offset=0x37, desc="32GT/s Equalization Control 23")
|
|
1812
|
+
eq_ctl_32gt_24: EqCtl32Gt0 = EqCtl32Gt0(offset=0x38, desc="32GT/s Equalization Control 24")
|
|
1813
|
+
eq_ctl_32gt_25: EqCtl32Gt0 = EqCtl32Gt0(offset=0x39, desc="32GT/s Equalization Control 25")
|
|
1814
|
+
eq_ctl_32gt_26: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3A, desc="32GT/s Equalization Control 26")
|
|
1815
|
+
eq_ctl_32gt_27: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3B, desc="32GT/s Equalization Control 27")
|
|
1816
|
+
eq_ctl_32gt_28: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3C, desc="32GT/s Equalization Control 28")
|
|
1817
|
+
eq_ctl_32gt_29: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3D, desc="32GT/s Equalization Control 29")
|
|
1818
|
+
eq_ctl_32gt_30: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3E, desc="32GT/s Equalization Control 30")
|
|
1819
|
+
eq_ctl_32gt_31: EqCtl32Gt0 = EqCtl32Gt0(offset=0x3F, desc="32GT/s Equalization Control 31")
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
class ECapAltProtocol(PcieCapStructure):
|
|
1823
|
+
"""Extended Capability for Alternate Protocol"""
|
|
1824
|
+
|
|
1825
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.ALT_PROTOCOL
|
|
1826
|
+
offset: int = 0x00
|
|
1827
|
+
desc: str = "7.9.21 Alternate Protocol Extended Capability"
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
class ECapSfi(PcieCapStructure):
|
|
1831
|
+
"""Extended Capability for System Firmware Intermediary"""
|
|
1832
|
+
|
|
1833
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.SFI
|
|
1834
|
+
offset: int = 0x00
|
|
1835
|
+
desc: str = "7.9.23 System Firmware Intermediary (SFI) Extended Capability"
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
class ECapDoe(PcieCapStructure):
|
|
1839
|
+
"""Extended Capability for DOE"""
|
|
1840
|
+
|
|
1841
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.DOE
|
|
1842
|
+
offset: int = 0x00
|
|
1843
|
+
desc: str = "Cap DOE"
|
|
1844
|
+
|
|
1845
|
+
|
|
1846
|
+
class ECapIntegrityDoe(PcieCapStructure):
|
|
1847
|
+
"""Extended Capability for Integrity DOE"""
|
|
1848
|
+
|
|
1849
|
+
cap_id: ClassVar[Enum] = ExtendedCapabilityEnum.INT_DOE
|
|
1850
|
+
offset: int = 0x00
|
|
1851
|
+
desc: str = "Int Cap DOE"
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
class PcieCfgSpace(BaseModel):
|
|
1855
|
+
"""Holds the base registers and capability structures of a PCIe device
|
|
1856
|
+
|
|
1857
|
+
- type_0_configuration: Type 0 Configuration Space, this is both the shared registers and the type0 specific registers
|
|
1858
|
+
- type_1_configuration: Type 1 Configuration Space, this is both the shared registers and the type1 specific registers
|
|
1859
|
+
- capability_pointers: A dictionary of capability pointers to the offset of the capability structure
|
|
1860
|
+
- extended_capability_pointers: A dictionary of extended capability pointers to the offset of the extended capability structure
|
|
1861
|
+
- cap_structure: A dictionary of capability structures
|
|
1862
|
+
- ecap_structure: A dictionary of extended capability structures
|
|
1863
|
+
|
|
1864
|
+
"""
|
|
1865
|
+
|
|
1866
|
+
type_0_configuration: Type0Configuration = Type0Configuration()
|
|
1867
|
+
type_1_configuration: Type1Configuration = Type1Configuration()
|
|
1868
|
+
capability_pointers: Dict[CapabilityEnum, int] = {}
|
|
1869
|
+
extended_capability_pointers: Dict[ExtendedCapabilityEnum, int] = {}
|
|
1870
|
+
# SerializeAsAny is used to allow for the structure to be any of the capability structures so all registers and fields are dumped
|
|
1871
|
+
cap_structure: Dict[CapabilityEnum, SerializeAsAny[PcieCapStructure]] = {}
|
|
1872
|
+
ecap_structure: Dict[ExtendedCapabilityEnum, SerializeAsAny[PcieCapStructure]] = {}
|
|
1873
|
+
|
|
1874
|
+
def get_struct(self, struct: type[AnyCap]) -> Optional[AnyCap]:
|
|
1875
|
+
"""Get a structure from the cap_structure or ecap_structure based on the type
|
|
1876
|
+
|
|
1877
|
+
Parameters
|
|
1878
|
+
----------
|
|
1879
|
+
struct : type[AnyCap]
|
|
1880
|
+
The structure to get from the cap_structure or ecap_structure
|
|
1881
|
+
|
|
1882
|
+
Returns
|
|
1883
|
+
-------
|
|
1884
|
+
Optional[AnyCap]
|
|
1885
|
+
The structure if it exists, otherwise None
|
|
1886
|
+
"""
|
|
1887
|
+
if struct == Type0Configuration:
|
|
1888
|
+
return self.type_0_configuration # type: ignore[return-value]
|
|
1889
|
+
if struct == Type1Configuration:
|
|
1890
|
+
return self.type_1_configuration # type: ignore[return-value]
|
|
1891
|
+
|
|
1892
|
+
if hasattr(struct, "cap_id"):
|
|
1893
|
+
cap = self.cap_structure.get(struct.cap_id, None) # type: ignore[attr-defined]
|
|
1894
|
+
if cap:
|
|
1895
|
+
return cap # type: ignore[return-value]
|
|
1896
|
+
ecap = self.ecap_structure.get(struct.cap_id, None) # type: ignore[attr-defined]
|
|
1897
|
+
if ecap:
|
|
1898
|
+
return ecap # type: ignore[return-value]
|
|
1899
|
+
return None
|
|
1900
|
+
|
|
1901
|
+
@field_validator("extended_capability_pointers", mode="before")
|
|
1902
|
+
@classmethod
|
|
1903
|
+
def str_to_enum_extended(cls, dict_in: Dict[str, int]) -> Dict[Enum, int]:
|
|
1904
|
+
"""Converts a dictionary with string keys to Enum keys
|
|
1905
|
+
|
|
1906
|
+
Parameters
|
|
1907
|
+
----------
|
|
1908
|
+
dict_in : Dict[str, int]
|
|
1909
|
+
The dictionary to convert
|
|
1910
|
+
|
|
1911
|
+
Returns
|
|
1912
|
+
-------
|
|
1913
|
+
dict[Enum, int]
|
|
1914
|
+
The dictionary with Enum keys
|
|
1915
|
+
"""
|
|
1916
|
+
dict_out: Dict[Enum, int] = {}
|
|
1917
|
+
for k, v in dict_in.items():
|
|
1918
|
+
if isinstance(k, str):
|
|
1919
|
+
dict_out[ExtendedCapabilityEnum(int(k))] = v
|
|
1920
|
+
return dict_out
|
|
1921
|
+
|
|
1922
|
+
@field_validator("capability_pointers", mode="before")
|
|
1923
|
+
@classmethod
|
|
1924
|
+
def str_to_enum(cls, dict_in: Dict[str, int]) -> Dict[Enum, int]:
|
|
1925
|
+
"""Converts a dictionary with string keys to Enum keys
|
|
1926
|
+
|
|
1927
|
+
Parameters
|
|
1928
|
+
----------
|
|
1929
|
+
dict_in : Dict[str, int]
|
|
1930
|
+
The dictionary to convert
|
|
1931
|
+
|
|
1932
|
+
Returns
|
|
1933
|
+
-------
|
|
1934
|
+
dict[Enum, int]
|
|
1935
|
+
The dictionary with Enum keys
|
|
1936
|
+
"""
|
|
1937
|
+
dict_out: Dict[Enum, int] = {}
|
|
1938
|
+
for k, v in dict_in.items():
|
|
1939
|
+
if isinstance(k, str):
|
|
1940
|
+
dict_out[CapabilityEnum(int(k))] = v
|
|
1941
|
+
else:
|
|
1942
|
+
dict_out[k] = v
|
|
1943
|
+
return dict_out
|
|
1944
|
+
|
|
1945
|
+
@field_validator("cap_structure", mode="before")
|
|
1946
|
+
@classmethod
|
|
1947
|
+
def validate_cap_structure(
|
|
1948
|
+
cls, cap_in: Dict[Union[int, str, CapabilityEnum], SerializeAsAny[PcieCapStructure]]
|
|
1949
|
+
) -> Dict[CapabilityEnum, PcieCapStructure]:
|
|
1950
|
+
"""This adjust's a generic PcieCapStructure dict into a specific PcieCapStructure and therefore populating all registers and fields"""
|
|
1951
|
+
return cls.conform_json_dict_to_cap_struct(cap_in, CapabilityEnum) # type: ignore[arg-type, return-value]
|
|
1952
|
+
|
|
1953
|
+
@field_validator("ecap_structure", mode="before")
|
|
1954
|
+
@classmethod
|
|
1955
|
+
def validate_ecap_structure(
|
|
1956
|
+
cls,
|
|
1957
|
+
ecap_in: Dict[Union[int, str, ExtendedCapabilityEnum], SerializeAsAny[PcieCapStructure]],
|
|
1958
|
+
) -> Dict[ExtendedCapabilityEnum, PcieCapStructure]:
|
|
1959
|
+
"""This adjust's a generic PcieCapStructure dict into a specific PcieCapStructure and therefore populating all registers and fields"""
|
|
1960
|
+
return cls.conform_json_dict_to_cap_struct(ecap_in, ExtendedCapabilityEnum) # type: ignore[arg-type, return-value]
|
|
1961
|
+
|
|
1962
|
+
@classmethod
|
|
1963
|
+
def conform_json_dict_to_cap_struct(
|
|
1964
|
+
cls,
|
|
1965
|
+
cap_structure_in: Dict[Union[str, int, Enum], PcieCapStructure],
|
|
1966
|
+
enum_type: type[Enum],
|
|
1967
|
+
) -> Dict[Enum, PcieCapStructure]:
|
|
1968
|
+
"""This is needed for when the model is loaded from a json/dict. Since the type of PcieCapStructure
|
|
1969
|
+
does not fully describe which cap structure it is and which registers it has, pydantic just assumes
|
|
1970
|
+
it is the base class. To override this behaviour the cap_id is used to discover which structure it
|
|
1971
|
+
really should be. This is only done if the value of the validated attribute is a dict
|
|
1972
|
+
|
|
1973
|
+
Parameters
|
|
1974
|
+
----------
|
|
1975
|
+
cap_structure_in : Dict[Union[str, int, Enum], PcieCapStructure]
|
|
1976
|
+
A capability structure to fix from json input
|
|
1977
|
+
enum_type : type[Enum]
|
|
1978
|
+
Which enum to use for values
|
|
1979
|
+
|
|
1980
|
+
Returns
|
|
1981
|
+
-------
|
|
1982
|
+
dict[Enum, PcieCapStructure]
|
|
1983
|
+
A dict where the values are now the fully defined structure instead of the base class
|
|
1984
|
+
"""
|
|
1985
|
+
cap_out: Dict[Enum, PcieCapStructure] = {}
|
|
1986
|
+
for k, v in cap_structure_in.items():
|
|
1987
|
+
if isinstance(v, dict):
|
|
1988
|
+
if isinstance(k, str):
|
|
1989
|
+
enum = enum_type(int(k))
|
|
1990
|
+
elif isinstance(k, enum_type):
|
|
1991
|
+
enum = k
|
|
1992
|
+
cls = cap_id_to_class(enum)
|
|
1993
|
+
cap_out[enum] = cls(**v)
|
|
1994
|
+
else:
|
|
1995
|
+
cap_out[k] = v # type: ignore[index]
|
|
1996
|
+
return cap_out
|
|
1997
|
+
|
|
1998
|
+
|
|
1999
|
+
class PcieDataModel(DataModel):
|
|
2000
|
+
"""class for collection of PCIe data.
|
|
2001
|
+
|
|
2002
|
+
Optionals are used to allow for the data to be missing,
|
|
2003
|
+
This makes the data class more flexible for the analyzer
|
|
2004
|
+
which consumes only the required data. If any more data is
|
|
2005
|
+
required for the analyzer then they should not be set to
|
|
2006
|
+
default.
|
|
2007
|
+
|
|
2008
|
+
- pcie_cfg_space: A dictionary of PCIe cfg space for the GPUs obtained with setpci command
|
|
2009
|
+
- lspci_verbose: Verbose collection of PCIe data
|
|
2010
|
+
- lspci_verbose_tree: Tree view of PCIe data
|
|
2011
|
+
- lspci_path: Path view of PCIe data for the GPUs
|
|
2012
|
+
- lspci_hex: Hex view of PCIe data for the GPUs
|
|
2013
|
+
|
|
2014
|
+
"""
|
|
2015
|
+
|
|
2016
|
+
pcie_cfg_space: Dict[BdfStr, PcieCfgSpace]
|
|
2017
|
+
vf_pcie_cfg_space: Optional[Dict[BdfStr, PcieCfgSpace]] = None
|