#include <pci.h>
#include <debug.h>
Go to the source code of this file.
|
| static BOOLEAN NTAPI | PciEcamParseWindow (_In_ PKEY_VALUE_PARTIAL_INFORMATION Value) |
| |
| static NTSTATUS NTAPI | PciEcamQueryWindow (VOID) |
| |
| static PUCHAR NTAPI | PciEcamMapBus (_In_ ULONG Bus) |
| |
| static VOID NTAPI | PciEcamDiscardWindow (VOID) |
| |
| static PUCHAR NTAPI | PciEcamFunctionBase (_In_ ULONG Bus, _In_ PCI_SLOT_NUMBER Slot) |
| |
| static VOID NTAPI | PciEcamTransfer (_In_ PUCHAR Function, _Inout_updates_bytes_(Length) PUCHAR Buffer, _In_ ULONG Offset, _In_ ULONG Length, _In_ BOOLEAN Read) |
| |
| static NTSTATUS NTAPI | PciEcamVerifyBus (_In_ PPCI_FDO_EXTENSION FdoExtension) |
| |
| VOID NTAPI | PciInitializeEcam (_In_ PPCI_FDO_EXTENSION FdoExtension) |
| | Maps the bus an FDO decodes into the ECAM window and verifies the window the first time a bus with devices on it is seen.
|
| |
| VOID NTAPI | PciReleaseEcam (VOID) |
| | Unmaps every bus mapped through the ECAM window.
|
| |
| BOOLEAN NTAPI | PciEcamReadWriteConfig (_In_ ULONG Bus, _In_ PCI_SLOT_NUMBER Slot, _Inout_updates_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length, _In_ BOOLEAN Read) |
| | Performs a configuration space access through the ECAM window.
|
| |
◆ NDEBUG
◆ PCI_ECAM_BUS_COUNT
◆ PCI_ECAM_BUS_SIZE
◆ PciEcamDiscardWindow()
Definition at line 184 of file ecam.c.
185{
188
190 {
192
195 }
196
198}
static PUCHAR PciEcamBusView[PCI_ECAM_BUS_COUNT]
#define PCI_ECAM_BUS_SIZE
static ULONG PciEcamWindowBuses
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Referenced by PciInitializeEcam(), and PciReleaseEcam().
◆ PciEcamFunctionBase()
Definition at line 203 of file ecam.c.
206{
208
210
212 (Bus == 0) &&
213 (Slot.u.bits.DeviceNumber >= 0x18))
214 {
216 }
217
220}
static BOOLEAN PciEcamSkipK8Northbridge
_In_ WDFCOLLECTION _In_ ULONG Index
#define PCI_EXTENDED_CONFIG_LENGTH
Referenced by PciEcamReadWriteConfig(), and PciEcamVerifyBus().
◆ PciEcamMapBus()
Definition at line 162 of file ecam.c.
164{
167
170
174 {
175 DPRINT1(
"PCIX - Unable to map ECAM for bus 0x%lx\n", Bus);
176 }
177
179}
static ULONGLONG PciEcamWindowStart
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Referenced by PciInitializeEcam().
◆ PciEcamParseWindow()
Definition at line 34 of file ecam.c.
36{
41
44 {
46 }
47
50
54 {
56 }
57
61
64
68}
static _Out_opt_ PULONGLONG Start
#define PCI_ECAM_BUS_COUNT
#define REG_RESOURCE_REQUIREMENTS_LIST
#define CmResourceTypeMemory
IO_RESOURCE_DESCRIPTOR Descriptors[1]
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define CmResourceTypeMemoryLarge
struct _IO_RESOURCE_REQUIREMENTS_LIST * PIO_RESOURCE_REQUIREMENTS_LIST
Referenced by PciEcamQueryWindow().
◆ PciEcamQueryWindow()
Definition at line 74 of file ecam.c.
75{
82
83 if (!
PciOpenKey(
L"\\Registry\\Machine\\System\\CurrentControlSet"
84 L"\\Control\\Arbiters\\ReservedResources",
89 {
91 }
92
98 0,
101 {
104 }
105
108 {
111 }
112
120
122 {
124 }
125
128}
#define NT_SUCCESS(StatCode)
BOOLEAN NTAPI PciOpenKey(IN PWCHAR KeyName, IN HANDLE RootKey, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle, OUT PNTSTATUS KeyStatus)
static BOOLEAN NTAPI PciEcamParseWindow(_In_ PKEY_VALUE_PARTIAL_INFORMATION Value)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define ExFreePoolWithTag(_P, _T)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Referenced by PciInitializeEcam().
◆ PciEcamReadWriteConfig()
Performs a configuration space access through the ECAM window.
- Returns
- FALSE if the window cannot serve the access, in which case the caller falls back to the legacy mechanism.
Definition at line 401 of file ecam.c.
408{
410
412
415 {
417 }
418
421
424}
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
static VOID NTAPI PciEcamTransfer(_In_ PUCHAR Function, _Inout_updates_bytes_(Length) PUCHAR Buffer, _In_ ULONG Offset, _In_ ULONG Length, _In_ BOOLEAN Read)
static PUCHAR NTAPI PciEcamFunctionBase(_In_ ULONG Bus, _In_ PCI_SLOT_NUMBER Slot)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
Referenced by PciReadWriteConfigSpace().
◆ PciEcamTransfer()
Definition at line 226 of file ecam.c.
232{
235
237 {
239
241 {
244 {
246 }
247 else
248 {
250 }
251 }
253 {
256 {
258 }
259 else
260 {
262 }
263 }
264 else
265 {
268 {
270 }
271 else
272 {
274 }
275 }
276
280 }
281}
#define WRITE_REGISTER_USHORT(r, v)
#define READ_REGISTER_USHORT(r)
#define WRITE_REGISTER_ULONG(r, v)
#define READ_REGISTER_ULONG(r)
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT * Width
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)
Referenced by PciEcamReadWriteConfig().
◆ PciEcamVerifyBus()
Definition at line 287 of file ecam.c.
289{
294
296 Matched = 0;
297
299 {
301
304
308
310 if (EcamIds != LegacyIds)
311 {
312 DPRINT1(
"PCIX - ECAM mismatch at %02lx:%02lx.0, read %08lx expected %08lx\n",
315 EcamIds,
316 LegacyIds);
318 }
319
320 Matched++;
321 }
322
324}
VOID NTAPI PciReadSlotConfig(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
#define STATUS_DEVICE_CONFIGURATION_ERROR
struct _PCI_SLOT_NUMBER::@5064::@5065 bits
union _PCI_SLOT_NUMBER::@5064 u
#define STATUS_NO_SUCH_DEVICE
#define PCI_INVALID_VENDORID
Referenced by PciInitializeEcam().
◆ PciInitializeEcam()
Maps the bus an FDO decodes into the ECAM window and verifies the window the first time a bus with devices on it is seen.
- Parameters
-
| [in] | FdoExtension | The FDO extension of the bus being started. |
Definition at line 336 of file ecam.c.
338{
341
343 {
345
348 {
349 DPRINT1(
"PCIX - No ECAM window available (0x%lx)\n",
Status);
350 return;
351 }
352
353#if defined(_M_IX86) || defined(_M_AMD64)
355#endif
356 DPRINT1(
"PCIX - ECAM window at 0x%I64x for 0x%lx buses\n",
359 }
360
362
363
366 {
368 }
370 {
373 }
374}
static VOID NTAPI PciEcamDiscardWindow(VOID)
static PUCHAR NTAPI PciEcamMapBus(_In_ ULONG Bus)
static NTSTATUS NTAPI PciEcamQueryWindow(VOID)
static NTSTATUS NTAPI PciEcamVerifyBus(_In_ PPCI_FDO_EXTENSION FdoExtension)
static BOOLEAN PciEcamWindowQueried
Referenced by PciAddDevice().
◆ PciReleaseEcam()
◆ PciEcamBusView
◆ PciEcamSkipK8Northbridge
◆ PciEcamVerified
◆ PciEcamWindowBuses
◆ PciEcamWindowQueried
◆ PciEcamWindowStart