ReactOS 0.4.15-dev-7918-g2a2556c
kdpci.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Hardware Abstraction Layer
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Kernel debugger PCI configurator
5 * COPYRIGHT: Copyright 2022 Dmitry Borisov <di.sean@protonmail.com>
6 */
7
8/*
9 * FIXME: We don't use a PCI resource allocator and rely on firmware to
10 * have configured PCI devices properly. The KD PCI configurator should
11 * allocate and assign PCI resources for all PCI buses
12 * before the debugging device can be enabled.
13 */
14
15/* INCLUDES *******************************************************************/
16
17#include <hal.h>
18
19/* GLOBALS ********************************************************************/
20
21#if defined(EARLY_DEBUG)
23#else
24#if defined(_MSC_VER)
25#define DPRINT0 __noop
26#else
27#define DPRINT0
28#endif
29#endif
30
32
33/* FUNCTIONS ******************************************************************/
34
35static
36CODE_SEG("INIT")
39 _In_ ULONG CurrentBar,
40 _In_ ULONG NextBar)
41{
44
45 Bar = CurrentBar;
46
47 if (CurrentBar & PCI_ADDRESS_IO_SPACE)
48 {
49 Length = 1 << 2;
50 }
51 else
52 {
53 if ((CurrentBar & PCI_ADDRESS_MEMORY_TYPE_MASK) == PCI_TYPE_64BIT)
54 {
55 Bar = ((ULONG64)NextBar << 32) | CurrentBar;
56 }
57
58 Length = 1 << 4;
59 }
60
61 while (!(Bar & Length) && Length)
62 {
63 Length <<= 1;
64 }
65
66 return Length;
67}
68
69static
70CODE_SEG("INIT")
74 _In_ ULONG PciBus,
75 _In_ PCI_SLOT_NUMBER PciSlot,
77{
79
80 Register = PciConfig->Command & ~(PCI_ENABLE_MEMORY_SPACE |
83 PciSlot,
84 &Register,
86 sizeof(USHORT));
87
88 /* Fill out the device descriptor */
89 for (i = 0; i < MAXIMUM_DEBUG_BARS; ++i)
90 {
91 ULONG Length, NextBar;
93
94 DeviceAddress = &PciDevice->BaseAddress[i];
95 DeviceAddress->Valid = FALSE;
96
97 Register = 0xFFFFFFFF;
99 PciSlot,
100 &Register,
101 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[i]),
102 sizeof(ULONG));
104 PciSlot,
105 &Register,
106 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[i]),
107 sizeof(ULONG));
109 PciSlot,
110 &PciConfig->u.type0.BaseAddresses[i],
111 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[i]),
112 sizeof(ULONG));
113
114 if (i < MAXIMUM_DEBUG_BARS - 1)
115 NextBar = PciConfig->u.type0.BaseAddresses[i + 1];
116 else
117 NextBar = 0;
118
119 Length = HalpPciBarLength(Register, NextBar);
120 if (Register == 0 || Length == 0)
121 continue;
122
123 /* I/O space */
125 {
127 DeviceAddress->Length = Length;
128 DeviceAddress->Valid = TRUE;
129 DeviceAddress->TranslatedAddress =
130 UlongToPtr(PciConfig->u.type0.BaseAddresses[i] & PCI_ADDRESS_IO_ADDRESS_MASK);
131
132 DPRINT0("BAR[%u] IO %lx, length 0x%lx, 0x%lx\n",
133 i,
134 DeviceAddress->TranslatedAddress,
135 Length,
136 Register);
137 }
138 else
139 {
141 BOOLEAN SkipBar = FALSE;
142
144 DeviceAddress->Length = Length;
145 DeviceAddress->Valid = TRUE;
146
147 /* 32-bit memory space */
150 PciConfig->u.type0.BaseAddresses[i] & PCI_ADDRESS_MEMORY_ADDRESS_MASK;
151
152 /* 64-bit memory space */
154 {
155 PhysicalAddress.HighPart = NextBar;
156 SkipBar = TRUE;
157 }
158
159 DPRINT0("BAR[%u] MEM %I64x, length 0x%lx, 0x%lx\n",
160 i,
162 Length,
163 Register);
164
165 if (SkipBar)
166 {
167 ++i;
168 }
169
170 DeviceAddress->TranslatedAddress =
172 }
173 }
174 PciDevice->Bus = PciBus;
175 PciDevice->Slot = PciSlot.u.AsULONG;
176 PciDevice->VendorID = PciConfig->VendorID;
177 PciDevice->DeviceID = PciConfig->DeviceID;
178 PciDevice->BaseClass = PciConfig->BaseClass;
179 PciDevice->SubClass = PciConfig->SubClass;
180 PciDevice->ProgIf = PciConfig->ProgIf;
181
182 /* Enable decodes */
183 PciConfig->Command |= (PCI_ENABLE_MEMORY_SPACE |
187 PciSlot,
188 &PciConfig->Command,
190 sizeof(USHORT));
191
192 return TRUE;
193}
194
195static
196CODE_SEG("INIT")
200 _In_ ULONG PciBus,
201 _In_ PCI_SLOT_NUMBER PciSlot,
202 _In_ PPCI_COMMON_HEADER PciConfig)
203{
204 /* Check if we weren't given a specific device location */
205 if (PciDevice->Bus == 0xFFFFFFFF && PciDevice->Slot == 0xFFFFFFFF)
206 {
207 if (PciDevice->DeviceID == 0xFFFF && PciDevice->VendorID == 0xFFFF)
208 {
209 if (PciDevice->BaseClass == PciConfig->BaseClass &&
210 PciDevice->SubClass == PciConfig->SubClass)
211 {
212 if (PciDevice->ProgIf == 0xFF ||
213 PciDevice->ProgIf == PciConfig->ProgIf)
214 {
215 return TRUE;
216 }
217 }
218 }
219 else if (PciDevice->DeviceID == PciConfig->DeviceID &&
220 PciDevice->VendorID == PciConfig->VendorID)
221 {
222 return TRUE;
223 }
224 }
225 else if (PciDevice->Bus == PciBus &&
226 PciDevice->Slot == PciSlot.u.AsULONG)
227 {
228 return TRUE;
229 }
230
231 return FALSE;
232}
233
234static
235CODE_SEG("INIT")
239{
240 ULONG BusNumber, DeviceNumber, FunctionNumber;
241
242 for (BusNumber = 0; BusNumber < 0xFF; ++BusNumber)
243 {
245 {
246 for (FunctionNumber = 0; FunctionNumber < PCI_MAX_FUNCTION; ++FunctionNumber)
247 {
248 ULONG Bytes;
249 PCI_SLOT_NUMBER PciSlot;
250 PCI_COMMON_HEADER PciConfig;
251
252 PciSlot.u.bits.DeviceNumber = DeviceNumber;
253 PciSlot.u.bits.FunctionNumber = FunctionNumber;
254 PciSlot.u.bits.Reserved = 0;
256 PciSlot,
257 &PciConfig,
258 0,
261 PciConfig.VendorID == PCI_INVALID_VENDORID ||
262 PciConfig.VendorID == 0)
263 {
264 if (FunctionNumber == 0)
265 {
266 /* This slot has no single- or a multi-function device */
267 break;
268 }
269 else
270 {
271 /* Continue scanning the functions */
272 continue;
273 }
274 }
275
276 DPRINT0("Check %02x:%02x.%x [%04x:%04x]\n",
277 BusNumber, DeviceNumber, FunctionNumber,
278 PciConfig.VendorID, PciConfig.DeviceID);
279
280 switch (PCI_CONFIGURATION_TYPE(&PciConfig))
281 {
282 case PCI_DEVICE_TYPE:
283 {
284 if (HalpMatchDebuggingDevice(PciDevice, BusNumber, PciSlot, &PciConfig))
285 {
286 DPRINT0("Found device\n");
287
288 if (HalpConfigureDebuggingDevice(PciDevice,
289 BusNumber,
290 PciSlot,
291 &PciConfig))
292 {
293 DPRINT0("Device is ready\n");
294 return TRUE;
295 }
296 }
297 break;
298 }
299
300 case PCI_BRIDGE_TYPE:
301 {
302 /* FIXME: Implement PCI resource allocator */
303 break;
304 }
305
307 {
308 /* FIXME: Implement PCI resource allocator */
309 break;
310 }
311
312 default:
313 break;
314 }
315
316 if (!PCI_MULTIFUNCTION_DEVICE(&PciConfig))
317 {
318 /* The device is a single function device */
319 break;
320 }
321 }
322 }
323 }
324
325 return FALSE;
326}
327
328CODE_SEG("INIT")
329VOID
330NTAPI
332{
333 ULONG i;
337 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\"
338 L"CurrentControlSet\\Services\\PCI\\Debug");
340
341 PAGED_CODE();
342
343 for (i = 0; i < RTL_NUMBER_OF(HalpPciDebuggingDevice); ++i)
344 {
345 if (HalpPciDebuggingDevice[i].InUse)
346 {
348 break;
349 }
350 }
352 {
353 /* Nothing to register */
354 return;
355 }
356
358 if (!NT_SUCCESS(Status))
359 return;
360
361 for (i = 0; i < RTL_NUMBER_OF(HalpPciDebuggingDevice); ++i)
362 {
363 ULONG Value;
364 PCI_SLOT_NUMBER PciSlot;
365
366 if (!HalpPciDebuggingDevice[i].InUse)
367 continue;
368
369 RtlInitEmptyUnicodeString(&KeyName, StringBuffer, sizeof(StringBuffer));
372 Handle,
373 &KeyName,
375 TRUE);
376 if (!NT_SUCCESS(Status))
377 continue;
378
381 ZwSetValueKey(KeyHandle,
382 &KeyName,
383 0,
384 REG_DWORD,
385 &Value,
386 sizeof(Value));
387
388 PciSlot.u.AsULONG = 0;
389 PciSlot.u.bits.DeviceNumber = HalpPciDebuggingDevice[i].DeviceNumber;
390 PciSlot.u.bits.FunctionNumber = HalpPciDebuggingDevice[i].FunctionNumber;
391 Value = PciSlot.u.AsULONG;
393 ZwSetValueKey(KeyHandle,
394 &KeyName,
395 0,
396 REG_DWORD,
397 &Value,
398 sizeof(Value));
399
401 }
402
404}
405
418CODE_SEG("INIT")
420NTAPI
423{
424 ULONG i;
425
426 DPRINT0("%s(%p) called\n", __FUNCTION__, PciDevice);
427
428 for (i = 0; i < MAXIMUM_DEBUG_BARS; ++i)
429 {
430 PDEBUG_DEVICE_ADDRESS DeviceAddress = &PciDevice->BaseAddress[i];
431
432 if (DeviceAddress->Type == CmResourceTypeMemory && DeviceAddress->Valid)
433 {
434 HalpUnmapVirtualAddress(DeviceAddress->TranslatedAddress,
436
437 DeviceAddress->Valid = FALSE;
438 }
439 }
440
441 return STATUS_SUCCESS;
442}
443
480CODE_SEG("INIT")
482NTAPI
484 _In_opt_ PVOID LoaderBlock,
486{
487 ULONG i;
488 ULONG64 MaxAddress;
489 PFN_NUMBER PageCount;
490 PCI_SLOT_NUMBER PciSlot;
492 PPCI_TYPE1_CFG_CYCLE_BITS DebuggingDevice;
493
494#if defined(EARLY_DEBUG)
495 if (LoaderBlock)
496 {
497 /* Define your own function or use the trick with FreeLoader */
498 DPRINT0 = ((PLOADER_PARAMETER_BLOCK)LoaderBlock)->u.I386.CommonDataArea;
499 }
500#endif
501
502 DPRINT0("%s(%p, %p) called\n", __FUNCTION__, LoaderBlock, PciDevice);
503
504 if (!HalpFindMatchingDebuggingDevice(PciDevice))
505 {
506 DPRINT0("No device found matching given device descriptor!\n");
508 }
509
510 if (PciDevice->Initialized)
511 return STATUS_SUCCESS;
512
513 PciSlot.u.AsULONG = PciDevice->Slot;
514
515 /* Check if the device is already present */
516 for (i = 0; i < RTL_NUMBER_OF(HalpPciDebuggingDevice); ++i)
517 {
518 DebuggingDevice = &HalpPciDebuggingDevice[i];
519
520 if (DebuggingDevice->InUse &&
521 DebuggingDevice->DeviceNumber == PciSlot.u.bits.DeviceNumber &&
522 DebuggingDevice->FunctionNumber == PciSlot.u.bits.FunctionNumber &&
523 DebuggingDevice->BusNumber == PciDevice->Bus)
524 {
525 DPRINT0("Device %p(0x%lx) is already in use!\n", PciDevice, PciDevice->Slot);
526 return STATUS_UNSUCCESSFUL;
527 }
528 }
529
530 /* Save the device location */
531 for (i = 0; i < RTL_NUMBER_OF(HalpPciDebuggingDevice); ++i)
532 {
533 DebuggingDevice = &HalpPciDebuggingDevice[i];
534
535 if (!DebuggingDevice->InUse)
536 {
537 DebuggingDevice->DeviceNumber = PciSlot.u.bits.DeviceNumber;
538 DebuggingDevice->FunctionNumber = PciSlot.u.bits.FunctionNumber;
539 DebuggingDevice->BusNumber = PciDevice->Bus;
540 DebuggingDevice->InUse = TRUE;
541
542 PciDevice->Initialized = TRUE;
543 break;
544 }
545 }
547 {
548 DPRINT0("Maximum device count reached!\n");
549 return STATUS_UNSUCCESSFUL;
550 }
551
552 if (!PciDevice->Memory.Length)
553 return STATUS_SUCCESS;
554
555 if (!LoaderBlock)
557
558 if (!PciDevice->Memory.MaxEnd.QuadPart)
559 {
560 PciDevice->Memory.MaxEnd.QuadPart = (ULONG64)-1;
561 }
562 MaxAddress = min(PciDevice->Memory.MaxEnd.QuadPart, 0xFFFFFFFF);
563 PageCount = BYTES_TO_PAGES(PciDevice->Memory.Length);
564
565 /* Allocate the device context */
567 MaxAddress,
568 PageCount,
569 FALSE);
570 PciDevice->Memory.Start = PhysicalAddress;
572 {
574 }
575 PciDevice->Memory.VirtualAddress = HalpMapPhysicalMemory64(PhysicalAddress, PageCount);
576
577 return STATUS_SUCCESS;
578}
#define PAGED_CODE()
#define CODE_SEG(...)
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LONG NTSTATUS
Definition: precomp.h:26
ULONG HalpPhase0SetPciDataByOffset(_In_ ULONG Bus, _In_ PCI_SLOT_NUMBER PciSlot, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Definition: pcibus.c:437
ULONG HalpPhase0GetPciDataByOffset(_In_ ULONG Bus, _In_ PCI_SLOT_NUMBER PciSlot, _Out_writes_bytes_all_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Definition: pcibus.c:368
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define __FUNCTION__
Definition: types.h:116
#define UlongToPtr(u)
Definition: config.h:106
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
VOID NTAPI HalpUnmapVirtualAddress(IN PVOID VirtualAddress, IN PFN_COUNT PageCount)
Definition: memory.c:148
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount)
Definition: memory.c:140
ULONG64 NTAPI HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG64 MaxAddress, IN PFN_NUMBER PageCount, IN BOOLEAN Aligned)
Definition: memory.c:29
NTSTATUS NTAPI HalpOpenRegistryKey(IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create)
Definition: misc.c:104
_In_ PUSB_DEVICE_HANDLE _Out_ PUSHORT DeviceAddress
Definition: hubbusif.h:360
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypePort
Definition: hwresource.cpp:123
VOID NTAPI HalpRegisterPciDebuggingDeviceInfo(VOID)
Definition: kdpci.c:331
NTSTATUS NTAPI HalpReleasePciDeviceForDebugging(_Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Releases the PCI device MMIO mappings previously allocated with HalpSetupPciDeviceForDebugging().
Definition: kdpci.c:421
static BOOLEAN HalpFindMatchingDebuggingDevice(_In_ PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: kdpci.c:237
PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2]
Definition: kdpci.c:31
static BOOLEAN HalpConfigureDebuggingDevice(_In_ PDEBUG_DEVICE_DESCRIPTOR PciDevice, _In_ ULONG PciBus, _In_ PCI_SLOT_NUMBER PciSlot, _Inout_ PPCI_COMMON_HEADER PciConfig)
Definition: kdpci.c:72
static BOOLEAN HalpMatchDebuggingDevice(_In_ PDEBUG_DEVICE_DESCRIPTOR PciDevice, _In_ ULONG PciBus, _In_ PCI_SLOT_NUMBER PciSlot, _In_ PPCI_COMMON_HEADER PciConfig)
Definition: kdpci.c:198
static ULONG HalpPciBarLength(_In_ ULONG CurrentBar, _In_ ULONG NextBar)
Definition: kdpci.c:38
#define DPRINT0
Definition: kdpci.c:27
NTSTATUS NTAPI HalpSetupPciDeviceForDebugging(_In_opt_ PVOID LoaderBlock, _Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Finds and fully initializes the PCI device associated with the supplied debug device descriptor.
Definition: kdpci.c:483
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
_In_ UINT Bytes
Definition: mmcopy.h:9
unsigned __int64 ULONG64
Definition: imports.h:198
void Bar(void)
Definition: terminate.cpp:70
#define min(a, b)
Definition: monoChain.cc:55
#define _Inout_
Definition: ms_sal.h:378
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define _Printf_format_string_
Definition: ms_sal.h:561
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:428
#define L(x)
Definition: ntvdm.h:50
BOOLEAN HasDebuggingDevice
Definition: pci.c:32
unsigned short USHORT
Definition: pedump.c:61
#define REG_DWORD
Definition: sdbapi.c:596
struct _LOADER_PARAMETER_BLOCK * PLOADER_PARAMETER_BLOCK
ULONG PFN_NUMBER
Definition: ke.h:9
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: shell.h:41
union _PCI_SLOT_NUMBER::@4022 u
struct _PCI_SLOT_NUMBER::@4022::@4023 bits
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
#define PCI_TYPE_64BIT
Definition: iotypes.h:4239
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3601
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:4233
#define PCI_ENABLE_BUS_MASTER
Definition: iotypes.h:3618
#define PCI_ENABLE_IO_SPACE
Definition: iotypes.h:3616
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:4230
#define PCI_CONFIGURATION_TYPE(PciData)
Definition: iotypes.h:3609
#define PCI_ENABLE_MEMORY_SPACE
Definition: iotypes.h:3617
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3599
#define PCI_BRIDGE_TYPE
Definition: iotypes.h:3606
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:4234
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594
#define PCI_MAX_DEVICES
Definition: iotypes.h:3598
#define PCI_ADDRESS_MEMORY_TYPE_MASK
Definition: iotypes.h:4231
#define PCI_MULTIFUNCTION_DEVICE(PciData)
Definition: iotypes.h:3612
#define PCI_DEVICE_TYPE
Definition: iotypes.h:3605
#define PCI_CARDBUS_BRIDGE_TYPE
Definition: iotypes.h:3607
#define MAXIMUM_DEBUG_BARS
Definition: kdtypes.h:53
* PDEBUG_DEVICE_ADDRESS
Definition: kdtypes.h:21
#define BYTES_TO_PAGES(Size)
__wchar_t WCHAR
Definition: xmlstorage.h:180