ReactOS 0.4.17-dev-1190-g4c812f4
resource.c
Go to the documentation of this file.
1/*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002 - 2005 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include "videoprt.h"
23
24#define NDEBUG
25#include <debug.h>
26
27extern BOOLEAN VpBaseVideo;
28
30
31/* PRIVATE FUNCTIONS **********************************************************/
32
36 IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
37 OUT PVIDEO_ACCESS_RANGE *AccessRanges,
38 OUT PULONG AccessRangeCount)
39{
42
43 if (!DriverExtension->InitializationData.HwGetLegacyResources &&
44 !DriverExtension->InitializationData.HwLegacyResourceCount)
45 {
46 /* No legacy resources to report */
47 *AccessRangeCount = 0;
48 return STATUS_SUCCESS;
49 }
50
51 if (DriverExtension->InitializationData.HwGetLegacyResources)
52 {
54 DeviceExtension->SystemIoBusNumber,
55 DeviceExtension->SystemIoSlotNumber,
56 &PciConfig,
57 sizeof(PciConfig));
58 if (ReadLength != sizeof(PciConfig))
59 {
60 /* This device doesn't exist */
62 }
63
64 DriverExtension->InitializationData.HwGetLegacyResources(PciConfig.VendorID,
65 PciConfig.DeviceID,
66 AccessRanges,
67 AccessRangeCount);
68 }
69 else
70 {
71 *AccessRanges = DriverExtension->InitializationData.HwLegacyResourceList;
72 *AccessRangeCount = DriverExtension->InitializationData.HwLegacyResourceCount;
73 }
74
75 INFO_(VIDEOPRT, "Got %d legacy access ranges\n", *AccessRangeCount);
76
77 return STATUS_SUCCESS;
78}
79
83 IN PIO_STACK_LOCATION IrpStack,
84 IN PIRP Irp)
85{
88 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
89 PVIDEO_ACCESS_RANGE AccessRanges;
90 ULONG AccessRangeCount, ListSize, i;
92 PIO_RESOURCE_REQUIREMENTS_LIST OldResList = IrpStack->Parameters.FilterResourceRequirements.IoResourceRequirementList;
93 PIO_RESOURCE_DESCRIPTOR CurrentDescriptor;
95
96 DriverObject = DeviceObject->DriverObject;
98 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
99
100 Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension, &AccessRanges, &AccessRangeCount);
101 if (!NT_SUCCESS(Status))
102 return Status;
103 if (!AccessRangeCount)
104 {
105 /* No legacy resources to report */
106 return Irp->IoStatus.Status;
107 }
108
109 /* OK, we've got the access ranges now. Let's set up the resource requirements list */
110
111 if (OldResList)
112 {
113 /* Already one there so let's add to it */
114 ListSize = OldResList->ListSize + sizeof(IO_RESOURCE_DESCRIPTOR) * AccessRangeCount;
116 ListSize);
117 if (!ResList) return STATUS_NO_MEMORY;
118
119 RtlCopyMemory(ResList, OldResList, OldResList->ListSize);
120
121 ASSERT(ResList->AlternativeLists == 1);
122
123 ResList->ListSize = ListSize;
124 ResList->List[0].Count += AccessRangeCount;
125
126 CurrentDescriptor = (PIO_RESOURCE_DESCRIPTOR)((PUCHAR)ResList + OldResList->ListSize);
127
128 ExFreePool(OldResList);
129 Irp->IoStatus.Information = 0;
130 }
131 else
132 {
133 /* We need to make a new one */
134 ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (AccessRangeCount - 1);
136 ListSize);
137 if (!ResList) return STATUS_NO_MEMORY;
138
139 RtlZeroMemory(ResList, ListSize);
140
141 /* We need to initialize some fields */
142 ResList->ListSize = ListSize;
143 ResList->InterfaceType = DeviceExtension->AdapterInterfaceType;
144 ResList->BusNumber = DeviceExtension->SystemIoBusNumber;
145 ResList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
146 ResList->AlternativeLists = 1;
147 ResList->List[0].Version = 1;
148 ResList->List[0].Revision = 1;
149 ResList->List[0].Count = AccessRangeCount;
150
151 CurrentDescriptor = ResList->List[0].Descriptors;
152 }
153
154 for (i = 0; i < AccessRangeCount; i++)
155 {
156 /* This is a required resource */
157 CurrentDescriptor->Option = 0;
158
159 if (AccessRanges[i].RangeInIoSpace)
160 CurrentDescriptor->Type = CmResourceTypePort;
161 else
162 CurrentDescriptor->Type = CmResourceTypeMemory;
163
164 CurrentDescriptor->ShareDisposition =
166
167 CurrentDescriptor->Flags = 0;
168
169 if (CurrentDescriptor->Type == CmResourceTypePort)
170 {
171 CurrentDescriptor->u.Port.Length = AccessRanges[i].RangeLength;
172 CurrentDescriptor->u.Port.MinimumAddress = AccessRanges[i].RangeStart;
173 CurrentDescriptor->u.Port.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
174 CurrentDescriptor->u.Port.Alignment = 1;
175 if (AccessRanges[i].RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
176 CurrentDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
177 if (AccessRanges[i].RangePassive & VIDEO_RANGE_10_BIT_DECODE)
178 CurrentDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
179 }
180 else
181 {
182 CurrentDescriptor->u.Memory.Length = AccessRanges[i].RangeLength;
183 CurrentDescriptor->u.Memory.MinimumAddress = AccessRanges[i].RangeStart;
184 CurrentDescriptor->u.Memory.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
185 CurrentDescriptor->u.Memory.Alignment = 1;
186 CurrentDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
187 }
188
189 CurrentDescriptor++;
190 }
191
192 Irp->IoStatus.Information = (ULONG_PTR)ResList;
193
194 return STATUS_SUCCESS;
195}
196
197VOID
199 _In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
200{
202 BOOLEAN ConflictDetected;
203 // An empty CM_RESOURCE_LIST
204 UCHAR EmptyResourceList[FIELD_OFFSET(CM_RESOURCE_LIST, List)] = {0};
205
206 if (DeviceExtension->IsLegacyDevice || DeviceExtension->IsLegacyDetect || DeviceExtension->IsVgaDetect)
207 {
209 DeviceExtension->DriverObject,
210 NULL, 0, /* Driver List */
211 DeviceExtension->PhysicalDeviceObject,
212 (PCM_RESOURCE_LIST)EmptyResourceList,
213 sizeof(EmptyResourceList),
214 &ConflictDetected);
215
216 if (!NT_SUCCESS(Status))
217 {
218 ERR_(VIDEOPRT,
219 "VideoPortReleaseResources (Detect) failed with 0x%08lx ; ConflictDetected: %s\n",
220 Status, ConflictDetected ? "TRUE" : "FALSE");
221 }
222 }
223 else
224 {
226 DeviceExtension->DriverObject,
227 NULL,
228 0,
229 DeviceExtension->PhysicalDeviceObject,
230 (PCM_RESOURCE_LIST)EmptyResourceList,
231 sizeof(EmptyResourceList),
232 FALSE,
233 &ConflictDetected);
234 if (!NT_SUCCESS(Status))
235 {
236 ERR_(VIDEOPRT,
237 "VideoPortReleaseResources (Usage) failed with 0x%08lx ; ConflictDetected: %s\n",
238 Status, ConflictDetected ? "TRUE" : "FALSE");
239 }
240 }
241}
242
247 IN ULONG SizeInBytes,
250{
251 OBJECT_ATTRIBUTES ObjAttribs;
253 HANDLE hMemObj;
255 SIZE_T Size;
256
257 /* Initialize object attribs */
258 RtlInitUnicodeString(&UnicodeString, L"\\Device\\PhysicalMemory");
259 InitializeObjectAttributes(&ObjAttribs,
262 NULL, NULL);
263
264 /* Open physical memory section */
265 Status = ZwOpenSection(&hMemObj, SECTION_ALL_ACCESS, &ObjAttribs);
266 if (!NT_SUCCESS(Status))
267 {
268 WARN_(VIDEOPRT, "ZwOpenSection() failed! (0x%x)\n", Status);
269 return Status;
270 }
271
272 /* Map view of section */
273 Size = SizeInBytes;
274 Status = ZwMapViewOfSection(hMemObj,
275 Process,
277 0,
278 Size,
280 &Size,
281 ViewUnmap,
282 0,
283 Protect);
284 ZwClose(hMemObj);
285 if (!NT_SUCCESS(Status))
286 {
287 WARN_(VIDEOPRT, "ZwMapViewOfSection() failed! (0x%x)\n", Status);
288 }
289
290 return Status;
291}
292
293static BOOLEAN
295 _In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
297{
298 CM_RESOURCE_LIST *Res = DeviceExtension->AllocatedResources;
301
302 if (!Res || Res->Count == 0)
303 return FALSE;
304 Full = &Res->List[0];
305 for (Desc = Full->PartialResourceList.PartialDescriptors;
306 Desc < Full->PartialResourceList.PartialDescriptors + Full->PartialResourceList.Count;
307 ++Desc)
308 {
309 if (Range->RangeInIoSpace && Desc->Type == CmResourceTypePort)
310 {
311 if (Desc->u.Port.Start.QuadPart == Range->RangeStart.QuadPart &&
312 Desc->u.Port.Length == Range->RangeLength)
313 return TRUE;
314 }
315 else if (!Range->RangeInIoSpace && Desc->Type == CmResourceTypeMemory)
316 {
317 if (Desc->u.Memory.Start.QuadPart == Range->RangeStart.QuadPart &&
318 Desc->u.Memory.Length == Range->RangeLength)
319 return TRUE;
320 }
321 }
322 return FALSE;
323}
324
325
328 IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
329 IN PHYSICAL_ADDRESS IoAddress,
330 IN ULONG NumberOfUchars,
331 IN ULONG InIoSpace,
334{
336 PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
338 PVOID MappedAddress;
341
342 INFO_(VIDEOPRT, "- IoAddress: %lx\n", IoAddress.u.LowPart);
343 INFO_(VIDEOPRT, "- NumberOfUchars: %lx\n", NumberOfUchars);
344 INFO_(VIDEOPRT, "- InIoSpace: %x\n", InIoSpace);
345
346 InIoSpace &= ~VIDEO_MEMORY_SPACE_DENSE;
347
348 if (ProcessHandle != NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
349 {
350 INFO_(VIDEOPRT, "ProcessHandle is not NULL (0x%x) but InIoSpace does not have "
351 "VIDEO_MEMORY_SPACE_USER_MODE set! Setting "
352 "VIDEO_MEMORY_SPACE_USER_MODE.\n",
354 InIoSpace |= VIDEO_MEMORY_SPACE_USER_MODE;
355 }
356 else if (ProcessHandle == NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
357 {
358 INFO_(VIDEOPRT, "ProcessHandle is NULL (0x%x) but InIoSpace does have "
359 "VIDEO_MEMORY_SPACE_USER_MODE set! Setting ProcessHandle "
360 "to NtCurrentProcess()\n",
363 }
364
365 CacheType = (InIoSpace & VIDEO_MEMORY_SPACE_P6CACHE) ?
367
368 if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0 &&
369 !IsListEmpty(&DeviceExtension->AddressMappingListHead))
370 {
371 Entry = DeviceExtension->AddressMappingListHead.Flink;
372 while (Entry != &DeviceExtension->AddressMappingListHead)
373 {
374 AddressMapping = CONTAINING_RECORD(
375 Entry,
377 List);
378 if (IoAddress.QuadPart == AddressMapping->IoAddress.QuadPart &&
379 NumberOfUchars <= AddressMapping->NumberOfUchars &&
380 CacheType == AddressMapping->CacheType)
381 {
382 {
383 AddressMapping->MappingCount++;
384 if (Status)
385 *Status = NO_ERROR;
386 return AddressMapping->MappedAddress;
387 }
388 }
389 Entry = Entry->Flink;
390 }
391 }
392
393 AddressSpace = (ULONG)InIoSpace;
396 DeviceExtension->AdapterInterfaceType,
397 DeviceExtension->SystemIoBusNumber,
398 IoAddress,
401 {
402 if (Status)
404
405 return NULL;
406 }
407
408 /* I/O space */
409 if (AddressSpace != 0)
410 {
411 ASSERT(0 == TranslatedAddress.u.HighPart);
412 if (Status)
413 *Status = NO_ERROR;
414
415 return (PVOID)(ULONG_PTR)TranslatedAddress.u.LowPart;
416 }
417
418 /* user space */
419 if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
420 {
421 NTSTATUS NtStatus;
425 else
427 MappedAddress = NULL;
430 NumberOfUchars,
431 Protect,
432 &MappedAddress);
433 if (!NT_SUCCESS(NtStatus))
434 {
435 ERR_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
436 if (Status)
438 return NULL;
439 }
440 INFO_(VIDEOPRT, "Mapped user address = 0x%08x\n", MappedAddress);
441 }
442 else /* kernel space */
443 {
444 MappedAddress = MmMapIoSpace(
446 NumberOfUchars,
447 CacheType);
448 }
449
450 if (MappedAddress != NULL)
451 {
452 if (Status)
453 {
454 *Status = NO_ERROR;
455 }
456 if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
457 {
458 AddressMapping = ExAllocatePoolWithTag(
459 PagedPool,
462
463 if (AddressMapping == NULL)
464 return MappedAddress;
465
466 RtlZeroMemory(AddressMapping, sizeof(VIDEO_PORT_ADDRESS_MAPPING));
467 AddressMapping->NumberOfUchars = NumberOfUchars;
468 AddressMapping->IoAddress = IoAddress;
469 AddressMapping->SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
470 AddressMapping->MappedAddress = MappedAddress;
471 AddressMapping->CacheType = CacheType;
472 AddressMapping->MappingCount = 1;
474 &DeviceExtension->AddressMappingListHead,
475 &AddressMapping->List);
476 }
477
478 return MappedAddress;
479 }
480
481 ERR_(VIDEOPRT,
482 "Couldn't map video memory. IoAddress: 0x%lx, NumberOfUchars: 0x%lx, InIoSpace: 0x%x\n",
483 IoAddress.u.LowPart, NumberOfUchars, InIoSpace);
484 if (Status)
486
487 return NULL;
488}
489
492 IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
493 IN PVOID MappedAddress)
494{
495 PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
498
499 Entry = DeviceExtension->AddressMappingListHead.Flink;
500 while (Entry != &DeviceExtension->AddressMappingListHead)
501 {
502 AddressMapping = CONTAINING_RECORD(
503 Entry,
505 List);
506 if (AddressMapping->MappedAddress == MappedAddress)
507 {
508 ASSERT(AddressMapping->MappingCount > 0);
509 AddressMapping->MappingCount--;
510 if (AddressMapping->MappingCount == 0)
511 {
513 AddressMapping->MappedAddress,
514 AddressMapping->NumberOfUchars);
516 ExFreePool(AddressMapping);
517 }
518 return;
519 }
520
521 Entry = Entry->Flink;
522 }
523
524 /* If there was no kernelmode mapping for the given address found we assume
525 * that the given address is a usermode mapping and try to unmap it.
526 *
527 * FIXME: Is it ok to use NtCurrentProcess?
528 */
529 Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
530 if (!NT_SUCCESS(Status))
531 {
532 WARN_(VIDEOPRT, "Warning: Mapping for address 0x%p not found!\n", MappedAddress);
533 }
534}
535
536/* PUBLIC FUNCTIONS ***********************************************************/
537
538/*
539 * @implemented
540 */
541
544 IN PVOID HwDeviceExtension,
545 IN PHYSICAL_ADDRESS IoAddress,
546 IN ULONG NumberOfUchars,
547 IN UCHAR InIoSpace)
548{
549 TRACE_(VIDEOPRT, "VideoPortGetDeviceBase\n");
551 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
552 IoAddress,
553 NumberOfUchars,
554 InIoSpace,
555 NULL,
556 NULL);
557}
558
559/*
560 * @implemented
561 */
562
565 IN PVOID HwDeviceExtension,
566 IN PVOID MappedAddress)
567{
568 TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
570 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
571 MappedAddress);
572}
573
574/*
575 * @unimplemented
576 */
577
580 IN PVOID HwDeviceExtension,
583 IN PULONG InIoSpace,
585 IN ULONG BankLength,
586 IN UCHAR ReadWriteBank,
587 IN PBANKED_SECTION_ROUTINE BankRoutine,
589{
590 TRACE_(VIDEOPRT, "VideoPortMapBankedMemory\n");
593}
594
595
596/*
597 * @implemented
598 */
599
602 IN PVOID HwDeviceExtension,
605 IN PULONG InIoSpace,
607{
608 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
610
611 TRACE_(VIDEOPRT, "VideoPortMapMemory\n");
612 INFO_(VIDEOPRT, "- *VirtualAddress: 0x%x\n", *VirtualAddress);
613
614 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
616 DeviceExtension,
618 *Length,
619 *InIoSpace,
621 &Status);
622
623 return Status;
624}
625
626/*
627 * @implemented
628 */
629
632 IN PVOID HwDeviceExtension,
635{
636 TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
637
639 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
641
642 return NO_ERROR;
643}
644
691NTAPI
693 _In_ PVOID HwDeviceExtension,
694 _In_opt_ ULONG NumRequestedResources,
695 _In_reads_opt_(NumRequestedResources)
696 PIO_RESOURCE_DESCRIPTOR RequestedResources,
697 _In_ ULONG NumAccessRanges,
698 _Out_writes_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges,
699 _In_ PVOID VendorId,
700 _In_ PVOID DeviceId,
701 _Out_ PULONG Slot)
702{
703 PCI_SLOT_NUMBER PciSlotNumber;
705 ULONG FunctionNumber;
709 UINT AssignedCount = 0;
712 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
714 USHORT VendorIdToFind;
715 USHORT DeviceIdToFind;
717 PVIDEO_ACCESS_RANGE LegacyAccessRanges;
718 ULONG LegacyAccessRangeCount;
720 ULONG ListSize;
722 BOOLEAN DeviceAndVendorFound = FALSE;
723
724 TRACE_(VIDEOPRT, "VideoPortGetAccessRanges(%d, %p, %d, %p)\n",
725 NumRequestedResources, RequestedResources, NumAccessRanges, AccessRanges);
726
727 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
728 DriverObject = DeviceExtension->DriverObject;
730
731 if (NumRequestedResources == 0)
732 {
733 AllocatedResources = DeviceExtension->AllocatedResources;
734 if (AllocatedResources == NULL &&
735 DeviceExtension->AdapterInterfaceType == PCIBus)
736 {
737 if (DeviceExtension->PhysicalDeviceObject != NULL)
738 {
739 PciSlotNumber.u.AsULONG = DeviceExtension->SystemIoSlotNumber;
740
742 DeviceExtension->SystemIoBusNumber,
743 PciSlotNumber.u.AsULONG,
744 &Config,
745 sizeof(Config));
746
747 if (ReturnedLength != sizeof(Config))
748 {
750 }
751 }
752 else
753 {
754 VendorIdToFind = VendorId != NULL ? *(PUSHORT)VendorId : 0;
755 DeviceIdToFind = DeviceId != NULL ? *(PUSHORT)DeviceId : 0;
756
757 if (VendorIdToFind == 0 && DeviceIdToFind == 0)
758 {
759 /* We're screwed */
760 return ERROR_DEV_NOT_EXIST;
761 }
762
763 INFO_(VIDEOPRT, "Looking for VendorId 0x%04x DeviceId 0x%04x\n",
764 VendorIdToFind, DeviceIdToFind);
765
766 /*
767 * Search for the device id and vendor id on this bus.
768 */
769 PciSlotNumber.u.bits.Reserved = 0;
771 {
772 PciSlotNumber.u.bits.DeviceNumber = DeviceNumber;
773 for (FunctionNumber = 0; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++)
774 {
775 INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
776 PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
778 DeviceExtension->SystemIoBusNumber,
779 PciSlotNumber.u.AsULONG,
780 &Config,
781 sizeof(Config));
782
783 INFO_(VIDEOPRT, "- Length of data: %x\n", ReturnedLength);
784
785 if (ReturnedLength == sizeof(Config))
786 {
787 INFO_(VIDEOPRT, "- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
788 "DeviceId 0x%04x\n",
789 PciSlotNumber.u.AsULONG,
790 PciSlotNumber.u.bits.DeviceNumber,
791 PciSlotNumber.u.bits.FunctionNumber,
792 Config.VendorID,
793 Config.DeviceID);
794
795 if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
796 (DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
797 {
798 DeviceAndVendorFound = TRUE;
799 break;
800 }
801 }
802 }
803 if (DeviceAndVendorFound)
804 break;
805 }
806 if (FunctionNumber == PCI_MAX_FUNCTION)
807 {
808 WARN_(VIDEOPRT, "Didn't find device.\n");
809 return ERROR_DEV_NOT_EXIST;
810 }
811 }
812
813 Status = HalAssignSlotResources(&DeviceExtension->RegistryPath,
814 NULL,
815 DeviceExtension->DriverObject,
816 DeviceExtension->DriverObject->DeviceObject,
817 DeviceExtension->AdapterInterfaceType,
818 DeviceExtension->SystemIoBusNumber,
819 PciSlotNumber.u.AsULONG,
821 if (!NT_SUCCESS(Status))
822 {
823 WARN_(VIDEOPRT, "HalAssignSlotResources failed with status %x.\n",Status);
824 return Status;
825 }
826 DeviceExtension->AllocatedResources = AllocatedResources;
827 DeviceExtension->SystemIoSlotNumber = PciSlotNumber.u.AsULONG;
828
829 /* Add legacy resources to the resources from HAL */
831 &LegacyAccessRanges, &LegacyAccessRangeCount);
832 if (!NT_SUCCESS(Status))
833 return ERROR_DEV_NOT_EXIST;
834
835 if (NumAccessRanges < LegacyAccessRangeCount)
836 {
837 ERR_(VIDEOPRT, "Too many legacy access ranges found\n");
838 return ERROR_NOT_ENOUGH_MEMORY; // ERROR_MORE_DATA;
839 }
840
841 RtlCopyMemory(AccessRanges, LegacyAccessRanges, LegacyAccessRangeCount * sizeof(VIDEO_ACCESS_RANGE));
842 AssignedCount = LegacyAccessRangeCount;
843 }
844 }
845 else
846 {
847 ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + (NumRequestedResources - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
848 ResReqList = ExAllocatePool(NonPagedPool, ListSize);
849 if (!ResReqList)
851
852 ResReqList->ListSize = ListSize;
853 ResReqList->InterfaceType = DeviceExtension->AdapterInterfaceType;
854 ResReqList->BusNumber = DeviceExtension->SystemIoBusNumber;
855 ResReqList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
856 ResReqList->AlternativeLists = 1;
857 ResReqList->List[0].Version = 1;
858 ResReqList->List[0].Revision = 1;
859 ResReqList->List[0].Count = NumRequestedResources;
860
861 /* Copy in the caller's resource list */
862 RtlCopyMemory(ResReqList->List[0].Descriptors,
863 RequestedResources,
864 NumRequestedResources * sizeof(IO_RESOURCE_DESCRIPTOR));
865
866 Status = IoAssignResources(&DeviceExtension->RegistryPath,
867 NULL,
868 DeviceExtension->DriverObject,
869 DeviceExtension->PhysicalDeviceObject ?
870 DeviceExtension->PhysicalDeviceObject :
871 DeviceExtension->DriverObject->DeviceObject,
872 ResReqList,
874
875 if (!NT_SUCCESS(Status))
876 return Status;
877
878 if (!DeviceExtension->AllocatedResources)
879 DeviceExtension->AllocatedResources = AllocatedResources;
880 }
881
884
885 /* Return the slot number if the caller wants it */
886 if (Slot != NULL) *Slot = DeviceExtension->SystemIoSlotNumber;
887
888 FullList = AllocatedResources->List;
889 ASSERT(AllocatedResources->Count == 1);
890 INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
891 FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber,
893
894 ASSERT(FullList->InterfaceType == PCIBus);
895 ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
896 ASSERT(1 == FullList->PartialResourceList.Version);
897 ASSERT(1 == FullList->PartialResourceList.Revision);
898
900 Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
901 Descriptor++)
902 {
903 if ((Descriptor->Type == CmResourceTypeMemory ||
904 Descriptor->Type == CmResourceTypePort) &&
905 AssignedCount >= NumAccessRanges)
906 {
907 ERR_(VIDEOPRT, "Too many access ranges found\n");
908 return ERROR_MORE_DATA;
909 }
910 else if (Descriptor->Type == CmResourceTypeMemory)
911 {
912 INFO_(VIDEOPRT, "Memory range starting at 0x%08x length 0x%08x\n",
913 Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
914 AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
915 AccessRanges[AssignedCount].RangeLength = Descriptor->u.Memory.Length;
916 AccessRanges[AssignedCount].RangeInIoSpace = 0;
917 AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
918 AccessRanges[AssignedCount].RangeShareable =
919 (Descriptor->ShareDisposition == CmResourceShareShared);
920 AccessRanges[AssignedCount].RangePassive = 0;
921 AssignedCount++;
922 }
923 else if (Descriptor->Type == CmResourceTypePort)
924 {
925 INFO_(VIDEOPRT, "Port range starting at 0x%04x length %d\n",
926 Descriptor->u.Port.Start.u.LowPart, Descriptor->u.Port.Length);
927 AccessRanges[AssignedCount].RangeStart = Descriptor->u.Port.Start;
928 AccessRanges[AssignedCount].RangeLength = Descriptor->u.Port.Length;
929 AccessRanges[AssignedCount].RangeInIoSpace = 1;
930 AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
931 AccessRanges[AssignedCount].RangeShareable =
932 (Descriptor->ShareDisposition == CmResourceShareShared);
933 AccessRanges[AssignedCount].RangePassive = 0;
935 AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_10_BIT_DECODE;
937 AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_PASSIVE_DECODE;
938 AssignedCount++;
939 }
940 else if (Descriptor->Type == CmResourceTypeInterrupt)
941 {
942 DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
943 DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
944 if (Descriptor->ShareDisposition == CmResourceShareShared)
945 DeviceExtension->InterruptShared = TRUE;
946 else
947 DeviceExtension->InterruptShared = FALSE;
948 }
949 // else if (Descriptor->Type == CmResourceTypeDma) // TODO!
950 else
951 {
952 ASSERT(FALSE);
954 }
955 }
956
957 return NO_ERROR;
958}
959
981NTAPI
983 _In_ PVOID HwDeviceExtension,
984 _In_opt_ ULONG NumAccessRanges,
985 _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
986{
987 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
988 BOOLEAN ConflictDetected;
989 ULONG ResourceListSize;
991 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
992 ULONG i;
994
995 TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
996
997 /* Verify parameters */
998 if (NumAccessRanges && !AccessRanges)
1000
1001 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1002
1003 if (NumAccessRanges == 0)
1004 {
1005 /* Release the resources and do nothing more for now... */
1006 IntVideoPortReleaseResources(DeviceExtension);
1007 /* If releasing VGA device resources, clear tracked ranges */
1008 if (DeviceExtension->IsVgaDriver)
1009 {
1011 if (VgaRanges)
1012 {
1014 VgaRanges = NULL;
1015 }
1016 NumOfVgaRanges = 0;
1019 }
1020 return NO_ERROR;
1021 }
1022
1023 /*
1024 * For non-legacy PCI devices, validate that the relevant I/O or memory
1025 * decoding bits are enabled in the PCI command register before claiming
1026 */
1027 if (!DeviceExtension->IsLegacyDevice && DeviceExtension->AdapterInterfaceType == PCIBus)
1028 {
1029 USHORT PciCommand;
1031
1033 DeviceExtension->SystemIoBusNumber,
1034 DeviceExtension->SystemIoSlotNumber,
1035 &PciCommand,
1037 sizeof(PciCommand));
1038 if (BytesRead == sizeof(PciCommand))
1039 {
1040 for (i = 0; i < NumAccessRanges; i++)
1041 {
1042 if (AccessRanges[i].RangeInIoSpace)
1043 {
1044 if ((PciCommand & PCI_ENABLE_IO_SPACE) == 0)
1045 {
1046 WARN_(VIDEOPRT, "PCI I/O space disabled; refusing access range claim\n");
1048 }
1049 }
1050 else
1051 {
1052 if ((PciCommand & PCI_ENABLE_MEMORY_SPACE) == 0)
1053 {
1054 WARN_(VIDEOPRT, "PCI memory space disabled; refusing access range claim\n");
1056 }
1057 }
1058 }
1059 }
1060 }
1061
1062 /* Determine which ranges need to be claimed (exclude PnP-assigned ones) */
1063 ULONG Needed = 0;
1064 for (i = 0; i < NumAccessRanges; ++i)
1065 {
1066 if (DeviceExtension->PhysicalDeviceObject && !DeviceExtension->IsLegacyDevice)
1067 {
1068 if (IntAccessRangeIsInAllocatedResources(DeviceExtension, &AccessRanges[i]))
1069 continue;
1070 }
1071 ++Needed;
1072 }
1073
1074 if (Needed == 0)
1075 {
1076 /* Nothing to report/claim */
1077 return NO_ERROR;
1078 }
1079
1080 /* Create the resource list for the non-PnP-assigned ranges */
1081 ResourceListSize = sizeof(CM_RESOURCE_LIST)
1082 + (Needed - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
1084 if (!ResourceList)
1085 {
1086 WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
1088 }
1089
1090 /* Fill resource list */
1091 ResourceList->Count = 1;
1092 ResourceList->List[0].InterfaceType = DeviceExtension->AdapterInterfaceType;
1093 ResourceList->List[0].BusNumber = DeviceExtension->SystemIoBusNumber;
1094 ResourceList->List[0].PartialResourceList.Version = 1;
1095 ResourceList->List[0].PartialResourceList.Revision = 1;
1096 ResourceList->List[0].PartialResourceList.Count = Needed;
1097
1098 ULONG j = 0;
1099 for (i = 0; i < NumAccessRanges; ++i)
1100 {
1101 if (DeviceExtension->PhysicalDeviceObject && !DeviceExtension->IsLegacyDevice)
1102 {
1103 if (IntAccessRangeIsInAllocatedResources(DeviceExtension, &AccessRanges[i]))
1104 continue;
1105 }
1106
1107 PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[j++];
1108 if (AccessRanges[i].RangeInIoSpace)
1109 {
1110 PartialDescriptor->Type = CmResourceTypePort;
1111 PartialDescriptor->u.Port.Start = AccessRanges[i].RangeStart;
1112 PartialDescriptor->u.Port.Length = AccessRanges[i].RangeLength;
1113 }
1114 else
1115 {
1116 PartialDescriptor->Type = CmResourceTypeMemory;
1117 PartialDescriptor->u.Memory.Start = AccessRanges[i].RangeStart;
1118 PartialDescriptor->u.Memory.Length = AccessRanges[i].RangeLength;
1119 }
1120 PartialDescriptor->ShareDisposition = AccessRanges[i].RangeShareable ?
1122 PartialDescriptor->Flags = 0;
1123 if (AccessRanges[i].RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
1124 PartialDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
1125 if (AccessRanges[i].RangePassive & VIDEO_RANGE_10_BIT_DECODE)
1126 PartialDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1127 }
1128
1129 if (DeviceExtension->IsLegacyDevice || DeviceExtension->IsLegacyDetect || DeviceExtension->IsVgaDetect)
1130 {
1132 DeviceExtension->DriverObject,
1133 NULL, 0, /* Driver List */
1134 DeviceExtension->PhysicalDeviceObject,
1135 ResourceList, ResourceListSize,
1136 &ConflictDetected);
1137
1138 /* IntIsVgaSaveDriver() will later ignore STATUS_CONFLICTING_ADDRESSES, but we still claim it */
1139 if (!NT_SUCCESS(Status) && DeviceExtension->IsVgaDriver)
1140 {
1141 NTSTATUS fbStatus;
1142 BOOLEAN fbConflict = FALSE;
1144 DeviceExtension->DriverObject,
1145 NULL,
1146 0,
1147 DeviceExtension->PhysicalDeviceObject,
1149 ResourceListSize,
1150 FALSE,
1151 &fbConflict);
1152 INFO_(VIDEOPRT, "VGA detect->usage fallback: Status=0x%lx Conflict=%d fbStatus=0x%lx fbConflict=%d\n",
1153 Status, ConflictDetected, fbStatus, fbConflict);
1154 Status = fbStatus;
1155 ConflictDetected = fbConflict;
1156 }
1157 }
1158 else
1159 {
1161 DeviceExtension->DriverObject,
1162 NULL,
1163 0,
1164 DeviceExtension->PhysicalDeviceObject,
1166 ResourceListSize,
1167 FALSE,
1168 &ConflictDetected);
1169 }
1171
1172 /* If VgaSave driver is conflicting and we don't explicitly want
1173 * to use it, ignore the problem (because win32k will try to use
1174 * this driver only if all other ones are failing). */
1175 if ((Status == STATUS_CONFLICTING_ADDRESSES || ConflictDetected) &&
1176 DeviceExtension->IsVgaDriver && !VpBaseVideo)
1177 {
1178 return NO_ERROR;
1179 }
1180
1181 if (!NT_SUCCESS(Status) || ConflictDetected)
1183 else
1184 {
1185 /* Track VGA access ranges on success for fallback handling */
1186 if (DeviceExtension->IsVgaDriver && AccessRanges != VgaRanges)
1187 {
1189 if (VgaRanges)
1190 {
1192 VgaRanges = NULL;
1193 NumOfVgaRanges = 0;
1194 }
1195 if (NumAccessRanges)
1196 {
1197 SIZE_T sz = NumAccessRanges * sizeof(VIDEO_ACCESS_RANGE);
1199 if (VgaRanges)
1200 {
1201 RtlCopyMemory(VgaRanges, AccessRanges, sz);
1202 NumOfVgaRanges = NumAccessRanges;
1203 VgaDeviceExtension = DeviceExtension;
1204 }
1205 }
1207 }
1208 /* Leave VGA detect phase after first successful claim */
1209 DeviceExtension->IsVgaDetect = FALSE;
1210 return NO_ERROR;
1211 }
1212}
1213
1214/*
1215 * @unimplemented
1216 */
1217
1220 IN PVOID HwDeviceExtension,
1221 IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
1224{
1225 TRACE_(VIDEOPRT, "VideoPortGetDeviceData\n");
1228}
1229
1230/*
1231 * @implemented
1232 */
1233
1236 IN PVOID HwDeviceExtension,
1239 IN ULONG Tag)
1240{
1241 TRACE_(VIDEOPRT, "VideoPortAllocatePool\n");
1243}
1244
1245/*
1246 * @implemented
1247 */
1248
1249VOID NTAPI
1251 IN PVOID HwDeviceExtension,
1252 IN PVOID Ptr)
1253{
1254 ExFreePool(Ptr);
1255}
1256
1257/*
1258 * @implemented
1259 */
1260
1263 IN PVOID HwDeviceExtension,
1264 IN ULONG Size,
1265 OUT PVOID *Buffer)
1266{
1267 TRACE_(VIDEOPRT, "VideoPortAllocateBuffer\n");
1270}
1271
1272/*
1273 * @implemented
1274 */
1275
1276VOID NTAPI
1278 IN PVOID HwDeviceExtension,
1279 IN PVOID Ptr)
1280{
1281 TRACE_(VIDEOPRT, "VideoPortReleaseBuffer\n");
1282 ExFreePool(Ptr);
1283}
1284
1285/*
1286 * @implemented
1287 */
1288
1291 IN PVOID HwDeviceExtension,
1293 IN ULONG Length,
1295{
1296 PMDL Mdl;
1297
1299 if (!Mdl)
1300 {
1301 return NULL;
1302 }
1303 /* FIXME use seh */
1305 return Mdl;
1306}
1307
1308/*
1309 * @implemented
1310 */
1311
1312BOOLEAN
1313NTAPI
1315 IN PVOID HwDeviceExtension,
1317 IN PEVENT pUEvent,
1318 IN PEVENT pDisplayEvent,
1319 IN DMA_FLAGS DmaFlags)
1320{
1321 PVOID Buffer;
1322
1323 /* clear output buffer */
1324 pVrp->OutputBuffer = NULL;
1325
1326 if (DmaFlags != VideoPortDmaInitOnly)
1327 {
1328 /* VideoPortKeepPagesLocked / VideoPortUnlockAfterDma is no-op */
1329 return FALSE;
1330 }
1331
1332 /* lock the buffer */
1333 Buffer = VideoPortLockBuffer(HwDeviceExtension, pVrp->InputBuffer, pVrp->InputBufferLength, IoModifyAccess);
1334
1335 if (Buffer)
1336 {
1337 /* store result buffer & length */
1338 pVrp->OutputBuffer = Buffer;
1339 pVrp->OutputBufferLength = pVrp->InputBufferLength;
1340
1341 /* operation succeeded */
1342 return TRUE;
1343 }
1344
1345 /* operation failed */
1346 return FALSE;
1347}
1348
1349
1350/*
1351 * @implemented
1352 */
1353
1354VOID NTAPI
1356 IN PVOID HwDeviceExtension,
1357 IN PVOID Mdl)
1358{
1359 if (Mdl)
1360 {
1362 IoFreeMdl(Mdl);
1363 }
1364}
1365
1366/*
1367 * @unimplemented
1368 */
1369
1372 IN PVOID HwDeviceExtension,
1373 IN ULONG NumAccessRanges,
1374 IN PVIDEO_ACCESS_RANGE AccessRange)
1375{
1377 /* Should store the ranges in the device extension for use by ntvdm. */
1378 return NO_ERROR;
1379}
1380
1381/*
1382 * @implemented
1383 */
1384
1387 IN PVOID HwDeviceExtension,
1388 IN BUS_DATA_TYPE BusDataType,
1391 IN ULONG Offset,
1392 IN ULONG Length)
1393{
1394 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1395
1396 TRACE_(VIDEOPRT, "VideoPortGetBusData\n");
1397
1398 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1399
1400 if (BusDataType != Cmos)
1401 {
1402 /* Legacy vs. PnP behaviour */
1403 if (DeviceExtension->PhysicalDeviceObject != NULL)
1404 SlotNumber = DeviceExtension->SystemIoSlotNumber;
1405 }
1406
1407 return HalGetBusDataByOffset(
1408 BusDataType,
1409 DeviceExtension->SystemIoBusNumber,
1410 SlotNumber,
1411 Buffer,
1412 Offset,
1413 Length);
1414}
1415
1416/*
1417 * @implemented
1418 */
1419
1422 IN PVOID HwDeviceExtension,
1423 IN BUS_DATA_TYPE BusDataType,
1425 IN PVOID Buffer,
1426 IN ULONG Offset,
1427 IN ULONG Length)
1428{
1429 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1430
1431 TRACE_(VIDEOPRT, "VideoPortSetBusData\n");
1432
1433 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1434
1435 if (BusDataType != Cmos)
1436 {
1437 /* Legacy vs. PnP behaviour */
1438 if (DeviceExtension->PhysicalDeviceObject != NULL)
1439 SlotNumber = DeviceExtension->SystemIoSlotNumber;
1440 }
1441
1442 return HalSetBusDataByOffset(
1443 BusDataType,
1444 DeviceExtension->SystemIoBusNumber,
1445 SlotNumber,
1446 Buffer,
1447 Offset,
1448 Length);
1449}
ULONG ReadLength
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:188
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
Definition: bufpool.h:45
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1230
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS PhysicalAddress
Definition: dispmprt.h:714
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS _Out_ PVOID * VirtualAddress
Definition: dispmprt.h:716
VOID(NTAPI * PBANKED_SECTION_ROUTINE)(_In_ ULONG ReadBank, _In_ ULONG WriteBank, _In_ PVOID Context)
Definition: dispmprt.h:39
_In_ ULONG _In_ MEMORY_CACHING_TYPE CacheType
Definition: dispmprt.h:713
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRACE_(x)
Definition: compat.h:76
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(PUNICODE_STRING, PUNICODE_STRING, PDRIVER_OBJECT, PDEVICE_OBJECT, INTERFACE_TYPE, ULONG, ULONG, PCM_RESOURCE_LIST *)
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
FP_OP Operation
Definition: fpcontrol.c:150
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
Status
Definition: gdiplustypes.h:24
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 const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
ULONG NTAPI HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:123
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bus.c:140
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73
unsigned int UINT
Definition: sysinfo.c:13
NTSTATUS NTAPI IoReportResourceUsage(_In_opt_ PUNICODE_STRING DriverClassName, _In_ PDRIVER_OBJECT DriverObject, _In_reads_bytes_opt_(DriverListSize) PCM_RESOURCE_LIST DriverList, _In_opt_ ULONG DriverListSize, _In_opt_ PDEVICE_OBJECT DeviceObject, _In_reads_bytes_opt_(DeviceListSize) PCM_RESOURCE_LIST DeviceList, _In_opt_ ULONG DeviceListSize, _In_ BOOLEAN OverrideConflict, _Out_ PBOOLEAN ConflictDetected)
Reports hardware resources in the \Registry\Machine\Hardware\ResourceMap tree, so that a subsequently...
Definition: iorsrce.c:1041
NTSTATUS NTAPI IoAssignResources(_In_ PUNICODE_STRING RegistryPath, _In_opt_ PUNICODE_STRING DriverClassName, _In_ PDRIVER_OBJECT DriverObject, _In_opt_ PDEVICE_OBJECT DeviceObject, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, _Inout_ PCM_RESOURCE_LIST *AllocatedResources)
Definition: iorsrce.c:1134
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:192
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_In_ PIRP Irp
Definition: kse.h:79
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:928
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1432
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4643
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:121
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define KernelMode
Definition: asm.h:38
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:407
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _Out_
Definition: no_sal2.h:160
#define _In_reads_opt_(s)
Definition: no_sal2.h:222
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define PAGE_NOCACHE
Definition: nt_native.h:1314
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1296
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define NtCurrentProcess()
Definition: nt_native.h:1660
@ ViewUnmap
Definition: nt_native.h:1282
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1925
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define STATUS_CONFLICTING_ADDRESSES
Definition: ntstatus.h:354
static BOOL Full
Definition: pageheap.c:12
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
_In_ ULONG _In_ PCI_SLOT_NUMBER _In_ PPCI_COMMON_HEADER PciConfig
Definition: pciidex.h:67
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject, IN PCM_RESOURCE_LIST DriverList OPTIONAL, IN ULONG DriverListSize OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PCM_RESOURCE_LIST DeviceList OPTIONAL, IN ULONG DeviceListSize OPTIONAL, OUT PBOOLEAN ConflictDetected)
Definition: pnpreport.c:394
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define CmResourceTypeMemory
Definition: restypes.h:106
@ PCIBus
Definition: restypes.h:127
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: restypes.h:104
#define CmResourceTypeInterrupt
Definition: restypes.h:105
struct _IO_RESOURCE_DESCRIPTOR * PIO_RESOURCE_DESCRIPTOR
@ Cmos
Definition: miniport.h:89
@ PCIConfiguration
Definition: miniport.h:93
enum _BUS_DATA_TYPE BUS_DATA_TYPE
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
LONG VP_STATUS
Definition: video.h:153
@ VideoPortDmaInitOnly
Definition: video.h:551
#define VIDEO_MEMORY_SPACE_USER_MODE
Definition: video.h:134
enum _DMA_FLAGS DMA_FLAGS
enum _VP_POOL_TYPE VP_POOL_TYPE
VP_STATUS(NTAPI * PMINIPORT_QUERY_DEVICE_ROUTINE)(IN PVOID HwDeviceExtension, IN PVOID Context, IN VIDEO_DEVICE_DATA_TYPE DeviceDataType, IN PVOID Identifier, IN ULONG IdentifierLength, IN PVOID ConfigurationData, IN ULONG ConfigurationDataLength, IN OUT PVOID ComponentInformation, IN ULONG ComponentInformationLength)
Definition: video.h:498
#define VIDEO_MEMORY_SPACE_P6CACHE
Definition: video.h:136
enum _VIDEO_DEVICE_DATA_TYPE VIDEO_DEVICE_DATA_TYPE
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
struct _VIDEO_ACCESS_RANGE VIDEO_ACCESS_RANGE
enum _VP_LOCK_OPERATION VP_LOCK_OPERATION
#define INFO_(ch,...)
Definition: debug.h:159
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
Entry
Definition: section.c:5216
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: shell.h:41
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:145
INTERFACE_TYPE InterfaceType
Definition: restypes.h:143
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@496 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@499 Memory
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: restypes.h:150
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2292
struct _IO_RESOURCE_DESCRIPTOR::@2498::@2499 Port
union _IO_RESOURCE_DESCRIPTOR::@2498 u
struct _IO_RESOURCE_DESCRIPTOR::@2498::@2500 Memory
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2752
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2757
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2762
Definition: typedefs.h:120
struct _PCI_SLOT_NUMBER::@5064::@5065 bits
union _PCI_SLOT_NUMBER::@5064 u
ULONG RangeLength
Definition: video.h:216
UCHAR RangeShareable
Definition: video.h:219
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215
MEMORY_CACHING_TYPE CacheType
Definition: videoprt.h:51
PHYSICAL_ADDRESS IoAddress
Definition: videoprt.h:49
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:88
PCM_RESOURCE_LIST AllocatedResources
Definition: videoprt.h:95
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:99
UNICODE_STRING RegistryPath
Definition: videoprt.h:91
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:87
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config
_Must_inspect_result_ _In_ UCXENDPOINT _In_ PVOID Tag
Definition: ucxendpoint.h:325
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2753 u
static int Protect(const char **args)
Definition: vfdcmd.c:2132
ULONG NumOfVgaRanges
Definition: videoprt.c:48
PVIDEO_PORT_DEVICE_EXTENSION VgaDeviceExtension
Definition: videoprt.c:46
KMUTEX VgaSyncLock
Definition: videoprt.c:45
PVIDEO_ACCESS_RANGE VgaRanges
Definition: videoprt.c:47
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:146
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
#define TAG_VIDEO_PORT_BUFFER
Definition: videoprt.h:39
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3821
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
VOID NTAPI VideoPortFreeDeviceBase(IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:564
VP_STATUS NTAPI VideoPortGetAccessRanges(_In_ PVOID HwDeviceExtension, _In_opt_ ULONG NumRequestedResources, _In_reads_opt_(NumRequestedResources) PIO_RESOURCE_DESCRIPTOR RequestedResources, _In_ ULONG NumAccessRanges, _Out_writes_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges, _In_ PVOID VendorId, _In_ PVOID DeviceId, _Out_ PULONG Slot)
Retrieves bus-relative (mainly PCI) hardware resources access ranges and, if possible,...
Definition: resource.c:692
NTSTATUS NTAPI IntVideoPortMapPhysicalMemory(IN HANDLE Process, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG SizeInBytes, IN ULONG Protect, IN OUT PVOID *VirtualAddress OPTIONAL)
Definition: resource.c:244
VOID NTAPI VideoPortUnlockBuffer(IN PVOID HwDeviceExtension, IN PVOID Mdl)
Definition: resource.c:1355
static UNICODE_STRING VideoClassName
Definition: resource.c:29
ULONG NTAPI VideoPortSetBusData(IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: resource.c:1421
static BOOLEAN IntAccessRangeIsInAllocatedResources(_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, _In_ PVIDEO_ACCESS_RANGE Range)
Definition: resource.c:294
VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN PULONG Length, IN PULONG InIoSpace, OUT PVOID *VirtualAddress)
Definition: resource.c:601
VP_STATUS NTAPI VideoPortMapBankedMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN PULONG Length, IN PULONG InIoSpace, OUT PVOID *VirtualAddress, IN ULONG BankLength, IN UCHAR ReadWriteBank, IN PBANKED_SECTION_ROUTINE BankRoutine, IN PVOID Context)
Definition: resource.c:579
PVOID NTAPI VideoPortLockBuffer(IN PVOID HwDeviceExtension, IN PVOID BaseAddress, IN ULONG Length, IN VP_LOCK_OPERATION Operation)
Definition: resource.c:1290
PVOID NTAPI IntVideoPortMapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfUchars, IN ULONG InIoSpace, IN HANDLE ProcessHandle, OUT VP_STATUS *Status)
Definition: resource.c:327
VOID NTAPI VideoPortFreePool(IN PVOID HwDeviceExtension, IN PVOID Ptr)
Definition: resource.c:1250
VOID NTAPI IntVideoPortUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:491
ULONG NTAPI VideoPortGetBusData(IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, IN ULONG SlotNumber, OUT PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: resource.c:1386
VP_STATUS NTAPI VideoPortGetDeviceData(IN PVOID HwDeviceExtension, IN VIDEO_DEVICE_DATA_TYPE DeviceDataType, IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine, IN PVOID Context)
Definition: resource.c:1219
VP_STATUS NTAPI VideoPortVerifyAccessRanges(_In_ PVOID HwDeviceExtension, _In_opt_ ULONG NumAccessRanges, _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges)
Claims or releases a range of hardware resources and checks for conflicts.
Definition: resource.c:982
PVOID NTAPI VideoPortAllocatePool(IN PVOID HwDeviceExtension, IN VP_POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: resource.c:1235
VP_STATUS NTAPI VideoPortSetTrappedEmulatorPorts(IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, IN PVIDEO_ACCESS_RANGE AccessRange)
Definition: resource.c:1371
NTSTATUS NTAPI IntVideoPortFilterResourceRequirements(IN PDEVICE_OBJECT DeviceObject, IN PIO_STACK_LOCATION IrpStack, IN PIRP Irp)
Definition: resource.c:81
BOOLEAN VpBaseVideo
Definition: videoprt.c:36
VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN PVOID VirtualAddress, IN HANDLE ProcessHandle)
Definition: resource.c:631
VP_STATUS NTAPI VideoPortAllocateBuffer(IN PVOID HwDeviceExtension, IN ULONG Size, OUT PVOID *Buffer)
Definition: resource.c:1262
VOID NTAPI VideoPortReleaseBuffer(IN PVOID HwDeviceExtension, IN PVOID Ptr)
Definition: resource.c:1277
VOID IntVideoPortReleaseResources(_In_ PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension)
Definition: resource.c:198
PVOID NTAPI VideoPortGetDeviceBase(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfUchars, IN UCHAR InIoSpace)
Definition: resource.c:543
BOOLEAN NTAPI VideoPortLockPages(IN PVOID HwDeviceExtension, IN OUT PVIDEO_REQUEST_PACKET pVrp, IN PEVENT pUEvent, IN PEVENT pDisplayEvent, IN DMA_FLAGS DmaFlags)
Definition: resource.c:1314
NTSTATUS NTAPI IntVideoPortGetLegacyResources(IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, OUT PVIDEO_ACCESS_RANGE *AccessRanges, OUT PULONG AccessRangeCount)
Definition: resource.c:34
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareShared
Definition: cmtypes.h:243
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2274
#define PCI_ENABLE_IO_SPACE
Definition: iotypes.h:3631
#define PCI_ENABLE_MEMORY_SPACE
Definition: iotypes.h:3632
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3614
#define PCI_MAX_DEVICES
Definition: iotypes.h:3613
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define KeWaitForMutexObject
Definition: kefuncs.h:543
@ Executive
Definition: ketypes.h:467
@ IoModifyAccess
Definition: ketypes.h:933
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
@ MmNonCached
Definition: mmtypes.h:129
@ MmWriteCombined
Definition: mmtypes.h:131
#define PAGE_WRITECOMBINE
Definition: mmtypes.h:78