ReactOS  0.4.14-dev-317-g96040ec
resource.c File Reference
#include "videoprt.h"
#include <debug.h>
Include dependency graph for resource.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI IntVideoPortGetLegacyResources (IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, OUT PVIDEO_ACCESS_RANGE *AccessRanges, OUT PULONG AccessRangeCount)
 
NTSTATUS NTAPI IntVideoPortFilterResourceRequirements (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IntVideoPortMapPhysicalMemory (IN HANDLE Process, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG SizeInBytes, IN ULONG Protect, IN OUT PVOID *VirtualAddress OPTIONAL)
 
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)
 
VOID NTAPI IntVideoPortUnmapMemory (IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
 
PVOID NTAPI VideoPortGetDeviceBase (IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfUchars, IN UCHAR InIoSpace)
 
VOID NTAPI VideoPortFreeDeviceBase (IN PVOID HwDeviceExtension, IN PVOID MappedAddress)
 
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)
 
VP_STATUS NTAPI VideoPortMapMemory (IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN PULONG Length, IN PULONG InIoSpace, OUT PVOID *VirtualAddress)
 
VP_STATUS NTAPI VideoPortUnmapMemory (IN PVOID HwDeviceExtension, IN PVOID VirtualAddress, IN HANDLE ProcessHandle)
 
VP_STATUS NTAPI VideoPortGetAccessRanges (IN PVOID HwDeviceExtension, IN ULONG NumRequestedResources, IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, IN ULONG NumAccessRanges, IN PVIDEO_ACCESS_RANGE AccessRanges, IN PVOID VendorId, IN PVOID DeviceId, OUT PULONG Slot)
 
VP_STATUS NTAPI VideoPortVerifyAccessRanges (IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, IN PVIDEO_ACCESS_RANGE AccessRanges)
 
VP_STATUS NTAPI VideoPortGetDeviceData (IN PVOID HwDeviceExtension, IN VIDEO_DEVICE_DATA_TYPE DeviceDataType, IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine, IN PVOID Context)
 
PVOID NTAPI VideoPortAllocatePool (IN PVOID HwDeviceExtension, IN VP_POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
 
VOID NTAPI VideoPortFreePool (IN PVOID HwDeviceExtension, IN PVOID Ptr)
 
VP_STATUS NTAPI VideoPortAllocateBuffer (IN PVOID HwDeviceExtension, IN ULONG Size, OUT PVOID *Buffer)
 
VOID NTAPI VideoPortReleaseBuffer (IN PVOID HwDeviceExtension, IN PVOID Ptr)
 
PVOID NTAPI VideoPortLockBuffer (IN PVOID HwDeviceExtension, IN PVOID BaseAddress, IN ULONG Length, IN VP_LOCK_OPERATION Operation)
 
BOOLEAN NTAPI VideoPortLockPages (IN PVOID HwDeviceExtension, IN OUT PVIDEO_REQUEST_PACKET pVrp, IN PEVENT pUEvent, IN PEVENT pDisplayEvent, IN DMA_FLAGS DmaFlags)
 
VOID NTAPI VideoPortUnlockBuffer (IN PVOID HwDeviceExtension, IN PVOID Mdl)
 
VP_STATUS NTAPI VideoPortSetTrappedEmulatorPorts (IN PVOID HwDeviceExtension, IN ULONG NumAccessRanges, IN PVIDEO_ACCESS_RANGE AccessRange)
 
ULONG NTAPI VideoPortGetBusData (IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, IN ULONG SlotNumber, OUT PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 
ULONG NTAPI VideoPortSetBusData (IN PVOID HwDeviceExtension, IN BUS_DATA_TYPE BusDataType, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 24 of file resource.c.

Function Documentation

◆ IntVideoPortFilterResourceRequirements()

NTSTATUS NTAPI IntVideoPortFilterResourceRequirements ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 77 of file resource.c.

80 {
83  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
84  PVIDEO_ACCESS_RANGE AccessRanges;
85  ULONG AccessRangeCount, ListSize, i;
86  PIO_RESOURCE_REQUIREMENTS_LIST ResList, OldResList = (PVOID)Irp->IoStatus.Information;
87  PIO_RESOURCE_DESCRIPTOR CurrentDescriptor;
89 
90  DriverObject = DeviceObject->DriverObject;
93 
94  Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension, &AccessRanges, &AccessRangeCount);
95  if (!NT_SUCCESS(Status))
96  return Status;
97  if (!AccessRangeCount)
98  {
99  /* No legacy resources to report */
100  return Irp->IoStatus.Information;
101  }
102 
103  /* OK, we've got the access ranges now. Let's set up the resource requirements list */
104 
105  if (OldResList)
106  {
107  /* Already one there so let's add to it */
108  ListSize = OldResList->ListSize + sizeof(IO_RESOURCE_DESCRIPTOR) * AccessRangeCount;
109  ResList = ExAllocatePool(NonPagedPool,
110  ListSize);
111  if (!ResList) return STATUS_NO_MEMORY;
112 
113  RtlCopyMemory(ResList, OldResList, OldResList->ListSize);
114 
115  ASSERT(ResList->AlternativeLists == 1);
116 
117  ResList->ListSize = ListSize;
118  ResList->List[0].Count += AccessRangeCount;
119 
120  CurrentDescriptor = (PIO_RESOURCE_DESCRIPTOR)((PUCHAR)ResList + OldResList->ListSize);
121 
122  ExFreePool(OldResList);
123  Irp->IoStatus.Information = 0;
124  }
125  else
126  {
127  /* We need to make a new one */
128  ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (AccessRangeCount - 1);
129  ResList = ExAllocatePool(NonPagedPool,
130  ListSize);
131  if (!ResList) return STATUS_NO_MEMORY;
132 
133  RtlZeroMemory(ResList, ListSize);
134 
135  /* We need to initialize some fields */
136  ResList->ListSize = ListSize;
137  ResList->InterfaceType = DeviceExtension->AdapterInterfaceType;
138  ResList->BusNumber = DeviceExtension->SystemIoBusNumber;
139  ResList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
140  ResList->AlternativeLists = 1;
141  ResList->List[0].Version = 1;
142  ResList->List[0].Revision = 1;
143  ResList->List[0].Count = AccessRangeCount;
144 
145  CurrentDescriptor = ResList->List[0].Descriptors;
146  }
147 
148  for (i = 0; i < AccessRangeCount; i++)
149  {
150  /* This is a required resource */
151  CurrentDescriptor->Option = 0;
152 
153  if (AccessRanges[i].RangeInIoSpace)
154  CurrentDescriptor->Type = CmResourceTypePort;
155  else
156  CurrentDescriptor->Type = CmResourceTypeMemory;
157 
158  CurrentDescriptor->ShareDisposition =
160 
161  CurrentDescriptor->Flags = 0;
162 
163  if (CurrentDescriptor->Type == CmResourceTypePort)
164  {
165  CurrentDescriptor->u.Port.Length = AccessRanges[i].RangeLength;
166  CurrentDescriptor->u.Port.MinimumAddress =
167  CurrentDescriptor->u.Port.MaximumAddress = AccessRanges[i].RangeStart;
168  CurrentDescriptor->u.Port.Alignment = 1;
169  if (AccessRanges[i].RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
170  CurrentDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
171  if (AccessRanges[i].RangePassive & VIDEO_RANGE_10_BIT_DECODE)
172  CurrentDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
173  }
174  else
175  {
176  CurrentDescriptor->u.Memory.Length = AccessRanges[i].RangeLength;
177  CurrentDescriptor->u.Memory.MinimumAddress =
178  CurrentDescriptor->u.Memory.MaximumAddress = AccessRanges[i].RangeStart;
179  CurrentDescriptor->u.Memory.Alignment = 1;
180  CurrentDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
181  }
182 
183  CurrentDescriptor++;
184  }
185 
186  Irp->IoStatus.Information = (ULONG_PTR)ResList;
187 
188  return STATUS_SUCCESS;
189 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
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:30
_In_ PIRP Irp
Definition: csq.h:116
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CmResourceTypePort
Definition: hwresource.cpp:123
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
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2388
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
void * PVOID
Definition: retypes.h:9
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
struct _IO_RESOURCE_DESCRIPTOR * PIO_RESOURCE_DESCRIPTOR
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UCHAR RangeShareable
Definition: video.h:219
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2393
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2383
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
Status
Definition: gdiplustypes.h:24
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:95
return STATUS_SUCCESS
Definition: btrfs.c:2938
struct _LARGE_INTEGER::@2221 u
ULONG RangeLength
Definition: video.h:216
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215

Referenced by IntVideoPortDispatchFdoPnp().

◆ IntVideoPortGetLegacyResources()

NTSTATUS NTAPI IntVideoPortGetLegacyResources ( IN PVIDEO_PORT_DRIVER_EXTENSION  DriverExtension,
IN PVIDEO_PORT_DEVICE_EXTENSION  DeviceExtension,
OUT PVIDEO_ACCESS_RANGE AccessRanges,
OUT PULONG  AccessRangeCount 
)

Definition at line 30 of file resource.c.

35 {
36  PCI_COMMON_CONFIG PciConfig;
37  ULONG ReadLength;
38 
39  if (!DriverExtension->InitializationData.HwGetLegacyResources &&
40  !DriverExtension->InitializationData.HwLegacyResourceCount)
41  {
42  /* No legacy resources to report */
43  *AccessRangeCount = 0;
44  return STATUS_SUCCESS;
45  }
46 
47  if (DriverExtension->InitializationData.HwGetLegacyResources)
48  {
49  ReadLength = HalGetBusData(PCIConfiguration,
50  DeviceExtension->SystemIoBusNumber,
51  DeviceExtension->SystemIoSlotNumber,
52  &PciConfig,
53  sizeof(PciConfig));
54  if (ReadLength != sizeof(PciConfig))
55  {
56  /* This device doesn't exist */
57  return STATUS_NO_SUCH_DEVICE;
58  }
59 
60  DriverExtension->InitializationData.HwGetLegacyResources(PciConfig.VendorID,
61  PciConfig.DeviceID,
62  AccessRanges,
63  AccessRangeCount);
64  }
65  else
66  {
67  *AccessRanges = DriverExtension->InitializationData.HwLegacyResourceList;
68  *AccessRangeCount = DriverExtension->InitializationData.HwLegacyResourceCount;
69  }
70 
71  INFO_(VIDEOPRT, "Got %d legacy access ranges\n", *AccessRangeCount);
72 
73  return STATUS_SUCCESS;
74 }
#define INFO_(ch,...)
Definition: debug.h:159
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by IntVideoPortFilterResourceRequirements(), and VideoPortGetAccessRanges().

◆ IntVideoPortMapMemory()

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 at line 243 of file resource.c.

250 {
252  PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
254  PVOID MappedAddress;
256 
257  INFO_(VIDEOPRT, "- IoAddress: %lx\n", IoAddress.u.LowPart);
258  INFO_(VIDEOPRT, "- NumberOfUchars: %lx\n", NumberOfUchars);
259  INFO_(VIDEOPRT, "- InIoSpace: %x\n", InIoSpace);
260 
261  InIoSpace &= ~VIDEO_MEMORY_SPACE_DENSE;
262  if ((InIoSpace & VIDEO_MEMORY_SPACE_P6CACHE) != 0)
263  {
264  INFO_(VIDEOPRT, "VIDEO_MEMORY_SPACE_P6CACHE not supported, turning off\n");
265  InIoSpace &= ~VIDEO_MEMORY_SPACE_P6CACHE;
266  }
267 
268  if (ProcessHandle != NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
269  {
270  INFO_(VIDEOPRT, "ProcessHandle is not NULL (0x%x) but InIoSpace does not have "
271  "VIDEO_MEMORY_SPACE_USER_MODE set! Setting "
272  "VIDEO_MEMORY_SPACE_USER_MODE.\n",
273  ProcessHandle);
274  InIoSpace |= VIDEO_MEMORY_SPACE_USER_MODE;
275  }
276  else if (ProcessHandle == NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
277  {
278  INFO_(VIDEOPRT, "ProcessHandle is NULL (0x%x) but InIoSpace does have "
279  "VIDEO_MEMORY_SPACE_USER_MODE set! Setting ProcessHandle "
280  "to NtCurrentProcess()\n",
281  ProcessHandle);
283  }
284 
285  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0 &&
286  !IsListEmpty(&DeviceExtension->AddressMappingListHead))
287  {
288  Entry = DeviceExtension->AddressMappingListHead.Flink;
289  while (Entry != &DeviceExtension->AddressMappingListHead)
290  {
291  AddressMapping = CONTAINING_RECORD(
292  Entry,
294  List);
295  if (IoAddress.QuadPart == AddressMapping->IoAddress.QuadPart &&
296  NumberOfUchars <= AddressMapping->NumberOfUchars)
297  {
298  {
299  AddressMapping->MappingCount++;
300  if (Status)
301  *Status = NO_ERROR;
302  return AddressMapping->MappedAddress;
303  }
304  }
305  Entry = Entry->Flink;
306  }
307  }
308 
309  AddressSpace = (ULONG)InIoSpace;
312  DeviceExtension->AdapterInterfaceType,
313  DeviceExtension->SystemIoBusNumber,
314  IoAddress,
315  &AddressSpace,
317  {
318  if (Status)
320 
321  return NULL;
322  }
323 
324  /* I/O space */
325  if (AddressSpace != 0)
326  {
327  ASSERT(0 == TranslatedAddress.u.HighPart);
328  if (Status)
329  *Status = NO_ERROR;
330 
331  return (PVOID)(ULONG_PTR)TranslatedAddress.u.LowPart;
332  }
333 
334  /* user space */
335  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
336  {
337  NTSTATUS NtStatus;
338  MappedAddress = NULL;
341  NumberOfUchars,
342  PAGE_READWRITE/* | PAGE_WRITECOMBINE*/,
343  &MappedAddress);
344  if (!NT_SUCCESS(NtStatus))
345  {
346  WARN_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
347  if (Status)
348  *Status = NO_ERROR;
349  return NULL;
350  }
351  INFO_(VIDEOPRT, "Mapped user address = 0x%08x\n", MappedAddress);
352  }
353  else /* kernel space */
354  {
355  MappedAddress = MmMapIoSpace(
357  NumberOfUchars,
358  MmNonCached);
359  }
360 
361  if (MappedAddress != NULL)
362  {
363  if (Status)
364  {
365  *Status = NO_ERROR;
366  }
367  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
368  {
369  AddressMapping = ExAllocatePoolWithTag(
370  PagedPool,
373 
374  if (AddressMapping == NULL)
375  return MappedAddress;
376 
377  RtlZeroMemory(AddressMapping, sizeof(VIDEO_PORT_ADDRESS_MAPPING));
378  AddressMapping->NumberOfUchars = NumberOfUchars;
379  AddressMapping->IoAddress = IoAddress;
380  AddressMapping->SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
381  AddressMapping->MappedAddress = MappedAddress;
382  AddressMapping->MappingCount = 1;
384  &DeviceExtension->AddressMappingListHead,
385  &AddressMapping->List);
386  }
387 
388  return MappedAddress;
389  }
390 
391  if (Status)
392  *Status = NO_ERROR;
393 
394  return NULL;
395 }
#define VIDEO_MEMORY_SPACE_DENSE
Definition: video.h:135
#define TAG_VIDEO_PORT
Definition: videoprt.h:35
#define INFO_(ch,...)
Definition: debug.h:159
struct _Entry Entry
Definition: kefuncs.h:640
#define VIDEO_MEMORY_SPACE_P6CACHE
Definition: video.h:136
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
Definition: iofuncs.h:2268
PHYSICAL_ADDRESS IoAddress
Definition: videoprt.h:46
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
#define NO_ERROR
Definition: dderror.h:5
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
NTSTATUS NTAPI IntVideoPortMapPhysicalMemory(IN HANDLE Process, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG SizeInBytes, IN ULONG Protect, IN OUT PVOID *VirtualAddress OPTIONAL)
Definition: resource.c:192
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NtCurrentProcess()
Definition: nt_native.h:1657
LIST_ENTRY List
Definition: psmgr.c:57
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Definition: typedefs.h:117
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
Status
Definition: gdiplustypes.h:24
#define VIDEO_MEMORY_SPACE_USER_MODE
Definition: video.h:134
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
struct _LARGE_INTEGER::@2221 u
#define WARN_(ch,...)
Definition: debug.h:157
base of all file and directory entries
Definition: entries.h:82
LONGLONG QuadPart
Definition: typedefs.h:112
#define PAGE_READWRITE
Definition: nt_native.h:1304

Referenced by VideoPortGetDeviceBase(), and VideoPortMapMemory().

◆ IntVideoPortMapPhysicalMemory()

NTSTATUS NTAPI IntVideoPortMapPhysicalMemory ( IN HANDLE  Process,
IN PHYSICAL_ADDRESS  PhysicalAddress,
IN ULONG  SizeInBytes,
IN ULONG  Protect,
IN OUT PVOID *VirtualAddress  OPTIONAL 
)

Definition at line 192 of file resource.c.

198 {
199  OBJECT_ATTRIBUTES ObjAttribs;
201  HANDLE hMemObj;
203  SIZE_T Size;
204 
205  /* Initialize object attribs */
206  RtlInitUnicodeString(&UnicodeString, L"\\Device\\PhysicalMemory");
207  InitializeObjectAttributes(&ObjAttribs,
208  &UnicodeString,
210  NULL, NULL);
211 
212  /* Open physical memory section */
213  Status = ZwOpenSection(&hMemObj, SECTION_ALL_ACCESS, &ObjAttribs);
214  if (!NT_SUCCESS(Status))
215  {
216  WARN_(VIDEOPRT, "ZwOpenSection() failed! (0x%x)\n", Status);
217  return Status;
218  }
219 
220  /* Map view of section */
221  Size = SizeInBytes;
222  Status = ZwMapViewOfSection(hMemObj,
223  Process,
225  0,
226  Size,
228  &Size,
229  ViewUnmap,
230  0,
231  Protect);
232  ZwClose(hMemObj);
233  if (!NT_SUCCESS(Status))
234  {
235  WARN_(VIDEOPRT, "ZwMapViewOfSection() failed! (0x%x)\n", Status);
236  }
237 
238  return Status;
239 }
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect
Definition: zwfuncs.h:214
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
static const WCHAR L[]
Definition: oid.c:1250
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI ZwOpenSection(_Out_ PHANDLE SectionHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define WARN_(ch,...)
Definition: debug.h:157

Referenced by IntAgpCommitVirtual(), and IntVideoPortMapMemory().

◆ IntVideoPortUnmapMemory()

VOID NTAPI IntVideoPortUnmapMemory ( IN PVIDEO_PORT_DEVICE_EXTENSION  DeviceExtension,
IN PVOID  MappedAddress 
)

Definition at line 398 of file resource.c.

401 {
402  PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
405 
406  Entry = DeviceExtension->AddressMappingListHead.Flink;
407  while (Entry != &DeviceExtension->AddressMappingListHead)
408  {
409  AddressMapping = CONTAINING_RECORD(
410  Entry,
412  List);
413  if (AddressMapping->MappedAddress == MappedAddress)
414  {
415  ASSERT(AddressMapping->MappingCount > 0);
416  AddressMapping->MappingCount--;
417  if (AddressMapping->MappingCount == 0)
418  {
420  AddressMapping->MappedAddress,
421  AddressMapping->NumberOfUchars);
423  ExFreePool(AddressMapping);
424  }
425  return;
426  }
427 
428  Entry = Entry->Flink;
429  }
430 
431  /* If there was no kernelmode mapping for the given address found we assume
432  * that the given address is a usermode mapping and try to unmap it.
433  *
434  * FIXME: Is it ok to use NtCurrentProcess?
435  */
436  Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
437  if (!NT_SUCCESS(Status))
438  {
439  WARN_(VIDEOPRT, "Warning: Mapping for address 0x%p not found!\n", MappedAddress);
440  }
441 }
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NtCurrentProcess()
Definition: nt_native.h:1657
LIST_ENTRY List
Definition: psmgr.c:57
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193
#define WARN_(ch,...)
Definition: debug.h:157
base of all file and directory entries
Definition: entries.h:82
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by VideoPortFreeDeviceBase(), and VideoPortUnmapMemory().

◆ VideoPortAllocateBuffer()

VP_STATUS NTAPI VideoPortAllocateBuffer ( IN PVOID  HwDeviceExtension,
IN ULONG  Size,
OUT PVOID Buffer 
)

Definition at line 940 of file resource.c.

944 {
945  TRACE_(VIDEOPRT, "VideoPortAllocateBuffer\n");
948 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NO_ERROR
Definition: dderror.h:5
#define TAG_VIDEO_PORT_BUFFER
Definition: videoprt.h:36
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:66
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359

◆ VideoPortAllocatePool()

PVOID NTAPI VideoPortAllocatePool ( IN PVOID  HwDeviceExtension,
IN VP_POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes,
IN ULONG  Tag 
)

Definition at line 913 of file resource.c.

918 {
919  TRACE_(VIDEOPRT, "VideoPortAllocatePool\n");
921 }
#define TRACE_(x)
Definition: compat.h:66
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444

Referenced by InitializeModeTable(), VbeGetVideoMemoryBaseAddress(), VBEInitialize(), and VbeSetColorLookup().

◆ VideoPortFreeDeviceBase()

VOID NTAPI VideoPortFreeDeviceBase ( IN PVOID  HwDeviceExtension,
IN PVOID  MappedAddress 
)

Definition at line 471 of file resource.c.

474 {
475  TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
477  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
478  MappedAddress);
479 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
#define TRACE_(x)
Definition: compat.h:66
VOID NTAPI IntVideoPortUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:398

Referenced by InitializeModeTable().

◆ VideoPortFreePool()

VOID NTAPI VideoPortFreePool ( IN PVOID  HwDeviceExtension,
IN PVOID  Ptr 
)

Definition at line 928 of file resource.c.

931 {
932  ExFreePool(Ptr);
933 }
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by InitializeModeTable(), VbeGetVideoMemoryBaseAddress(), and VbeSetColorLookup().

◆ VideoPortGetAccessRanges()

VP_STATUS NTAPI VideoPortGetAccessRanges ( IN PVOID  HwDeviceExtension,
IN ULONG  NumRequestedResources,
IN PIO_RESOURCE_DESCRIPTOR RequestedResources  OPTIONAL,
IN ULONG  NumAccessRanges,
IN PVIDEO_ACCESS_RANGE  AccessRanges,
IN PVOID  VendorId,
IN PVOID  DeviceId,
OUT PULONG  Slot 
)

Definition at line 557 of file resource.c.

566 {
567  PCI_SLOT_NUMBER PciSlotNumber;
569  ULONG FunctionNumber;
573  UINT AssignedCount = 0;
574  CM_FULL_RESOURCE_DESCRIPTOR *FullList;
576  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
578  USHORT VendorIdToFind;
579  USHORT DeviceIdToFind;
581  PVIDEO_ACCESS_RANGE LegacyAccessRanges;
582  ULONG LegacyAccessRangeCount;
584  ULONG ListSize;
586  BOOLEAN DeviceAndVendorFound = FALSE;
587 
588  TRACE_(VIDEOPRT, "VideoPortGetAccessRanges(%d, %p, %d, %p)\n", NumRequestedResources, RequestedResources, NumAccessRanges, AccessRanges);
589 
590  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
591  DriverObject = DeviceExtension->DriverObject;
593 
594  if (NumRequestedResources == 0)
595  {
596  AllocatedResources = DeviceExtension->AllocatedResources;
597  if (AllocatedResources == NULL &&
598  DeviceExtension->AdapterInterfaceType == PCIBus)
599  {
600  if (DeviceExtension->PhysicalDeviceObject != NULL)
601  {
602  PciSlotNumber.u.AsULONG = DeviceExtension->SystemIoSlotNumber;
603 
605  DeviceExtension->SystemIoBusNumber,
606  PciSlotNumber.u.AsULONG,
607  &Config,
608  sizeof(PCI_COMMON_CONFIG));
609 
610  if (ReturnedLength != sizeof(PCI_COMMON_CONFIG))
611  {
613  }
614  }
615  else
616  {
617  VendorIdToFind = VendorId != NULL ? *(PUSHORT)VendorId : 0;
618  DeviceIdToFind = DeviceId != NULL ? *(PUSHORT)DeviceId : 0;
619 
620  if (VendorIdToFind == 0 && DeviceIdToFind == 0)
621  {
622  /* We're screwed */
623  return ERROR_DEV_NOT_EXIST;
624  }
625 
626  INFO_(VIDEOPRT, "Looking for VendorId 0x%04x DeviceId 0x%04x\n",
627  VendorIdToFind, DeviceIdToFind);
628 
629  /*
630  * Search for the device id and vendor id on this bus.
631  */
632  PciSlotNumber.u.bits.Reserved = 0;
634  {
635  PciSlotNumber.u.bits.DeviceNumber = DeviceNumber;
636  for (FunctionNumber = 0; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++)
637  {
638  INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
639  PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
641  DeviceExtension->SystemIoBusNumber,
642  PciSlotNumber.u.AsULONG,
643  &Config,
644  sizeof(PCI_COMMON_CONFIG));
645  INFO_(VIDEOPRT, "- Length of data: %x\n", ReturnedLength);
646  if (ReturnedLength == sizeof(PCI_COMMON_CONFIG))
647  {
648  INFO_(VIDEOPRT, "- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
649  "DeviceId 0x%04x\n",
650  PciSlotNumber.u.AsULONG,
651  PciSlotNumber.u.bits.DeviceNumber,
652  PciSlotNumber.u.bits.FunctionNumber,
653  Config.VendorID,
654  Config.DeviceID);
655 
656  if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
657  (DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
658  {
659  DeviceAndVendorFound = TRUE;
660  break;
661  }
662  }
663  }
664  if (DeviceAndVendorFound) break;
665  }
666  if (FunctionNumber == PCI_MAX_FUNCTION)
667  {
668  WARN_(VIDEOPRT, "Didn't find device.\n");
669  return ERROR_DEV_NOT_EXIST;
670  }
671  }
672 
673  Status = HalAssignSlotResources(&DeviceExtension->RegistryPath,
674  NULL,
675  DeviceExtension->DriverObject,
676  DeviceExtension->DriverObject->DeviceObject,
677  DeviceExtension->AdapterInterfaceType,
678  DeviceExtension->SystemIoBusNumber,
679  PciSlotNumber.u.AsULONG,
681 
682  if (!NT_SUCCESS(Status))
683  {
684  WARN_(VIDEOPRT, "HalAssignSlotResources failed with status %x.\n",Status);
685  return Status;
686  }
687  DeviceExtension->AllocatedResources = AllocatedResources;
688  DeviceExtension->SystemIoSlotNumber = PciSlotNumber.u.AsULONG;
689 
690  /* Add legacy resources to the resources from HAL */
692  &LegacyAccessRanges, &LegacyAccessRangeCount);
693  if (!NT_SUCCESS(Status))
694  return ERROR_DEV_NOT_EXIST;
695 
696  if (NumAccessRanges < LegacyAccessRangeCount)
697  {
698  ERR_(VIDEOPRT, "Too many legacy access ranges found\n");
700  }
701 
702  RtlCopyMemory(AccessRanges, LegacyAccessRanges, LegacyAccessRangeCount * sizeof(VIDEO_ACCESS_RANGE));
703  AssignedCount = LegacyAccessRangeCount;
704  }
705  }
706  else
707  {
708  ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + (NumRequestedResources - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
709  ResReqList = ExAllocatePool(NonPagedPool, ListSize);
710  if (!ResReqList) return ERROR_NOT_ENOUGH_MEMORY;
711 
712  ResReqList->ListSize = ListSize;
713  ResReqList->InterfaceType = DeviceExtension->AdapterInterfaceType;
714  ResReqList->BusNumber = DeviceExtension->SystemIoBusNumber;
715  ResReqList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
716  ResReqList->AlternativeLists = 1;
717  ResReqList->List[0].Version = 1;
718  ResReqList->List[0].Revision = 1;
719  ResReqList->List[0].Count = NumRequestedResources;
720 
721  /* Copy in the caller's resource list */
722  RtlCopyMemory(ResReqList->List[0].Descriptors,
723  RequestedResources,
724  NumRequestedResources * sizeof(IO_RESOURCE_DESCRIPTOR));
725 
726  Status = IoAssignResources(&DeviceExtension->RegistryPath,
727  NULL,
728  DeviceExtension->DriverObject,
729  DeviceExtension->PhysicalDeviceObject ?
730  DeviceExtension->PhysicalDeviceObject :
731  DeviceExtension->DriverObject->DeviceObject,
732  ResReqList,
734 
735  if (!NT_SUCCESS(Status))
736  return Status;
737 
738  if (!DeviceExtension->AllocatedResources)
739  DeviceExtension->AllocatedResources = AllocatedResources;
740  }
741 
742  if (AllocatedResources == NULL)
744 
745  /* Return the slot number if the caller wants it */
746  if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber;
747 
748  FullList = AllocatedResources->List;
749  ASSERT(AllocatedResources->Count == 1);
750  INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
751  FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
752 
753  ASSERT(FullList->InterfaceType == PCIBus);
754  ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
755  ASSERT(1 == FullList->PartialResourceList.Version);
756  ASSERT(1 == FullList->PartialResourceList.Revision);
758  Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
759  Descriptor++)
760  {
761  if ((Descriptor->Type == CmResourceTypeMemory ||
762  Descriptor->Type == CmResourceTypePort) &&
763  AssignedCount >= NumAccessRanges)
764  {
765  ERR_(VIDEOPRT, "Too many access ranges found\n");
767  }
768  if (Descriptor->Type == CmResourceTypeMemory)
769  {
770  INFO_(VIDEOPRT, "Memory range starting at 0x%08x length 0x%08x\n",
771  Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
772  AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
773  AccessRanges[AssignedCount].RangeLength = Descriptor->u.Memory.Length;
774  AccessRanges[AssignedCount].RangeInIoSpace = 0;
775  AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
776  AccessRanges[AssignedCount].RangeShareable =
777  (Descriptor->ShareDisposition == CmResourceShareShared);
778  AccessRanges[AssignedCount].RangePassive = 0;
779  AssignedCount++;
780  }
781  else if (Descriptor->Type == CmResourceTypePort)
782  {
783  INFO_(VIDEOPRT, "Port range starting at 0x%04x length %d\n",
784  Descriptor->u.Port.Start.u.LowPart, Descriptor->u.Port.Length);
785  AccessRanges[AssignedCount].RangeStart = Descriptor->u.Port.Start;
786  AccessRanges[AssignedCount].RangeLength = Descriptor->u.Port.Length;
787  AccessRanges[AssignedCount].RangeInIoSpace = 1;
788  AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
789  AccessRanges[AssignedCount].RangeShareable =
790  (Descriptor->ShareDisposition == CmResourceShareShared);
791  AccessRanges[AssignedCount].RangePassive = 0;
793  AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_10_BIT_DECODE;
795  AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_PASSIVE_DECODE;
796  AssignedCount++;
797  }
798  else if (Descriptor->Type == CmResourceTypeInterrupt)
799  {
800  DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
801  DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
802  if (Descriptor->ShareDisposition == CmResourceShareShared)
803  DeviceExtension->InterruptShared = TRUE;
804  else
805  DeviceExtension->InterruptShared = FALSE;
806  }
807  }
808 
809  return NO_ERROR;
810 }
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
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:30
#define INFO_(ch,...)
Definition: debug.h:159
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
#define ERR_(ch,...)
Definition: debug.h:156
static int Config(const char **args)
Definition: vfdcmd.c:778
LONG NTSTATUS
Definition: precomp.h:26
struct _PCI_SLOT_NUMBER::@3660::@3661 bits
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PCM_RESOURCE_LIST AllocatedResources
Definition: videoprt.h:91
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define NO_ERROR
Definition: dderror.h:5
#define CmResourceTypePort
Definition: hwresource.cpp:123
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2388
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define TRACE_(x)
Definition: compat.h:66
union _PCI_SLOT_NUMBER::@3660 u
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PCI_MAX_DEVICES
Definition: iotypes.h:3242
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2393
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:187
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2383
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
Status
Definition: gdiplustypes.h:24
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3243
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:83
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
unsigned int ULONG
Definition: retypes.h:1
UNICODE_STRING RegistryPath
Definition: videoprt.h:87
NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(PUNICODE_STRING, PUNICODE_STRING, PDRIVER_OBJECT, PDEVICE_OBJECT, INTERFACE_TYPE, ULONG, ULONG, PCM_RESOURCE_LIST *)
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1036
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:95
#define ERROR_DEV_NOT_EXIST
Definition: dderror.h:8
#define WARN_(ch,...)
Definition: debug.h:157
unsigned short * PUSHORT
Definition: retypes.h:2
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2169
NTSTATUS NTAPI IoAssignResources(IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, IN OUT PCM_RESOURCE_LIST *AllocatedResources)
Definition: iorsrce.c:944
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

◆ VideoPortGetBusData()

ULONG NTAPI VideoPortGetBusData ( IN PVOID  HwDeviceExtension,
IN BUS_DATA_TYPE  BusDataType,
IN ULONG  SlotNumber,
OUT PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 1064 of file resource.c.

1071 {
1072  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1073 
1074  TRACE_(VIDEOPRT, "VideoPortGetBusData\n");
1075 
1076  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1077 
1078  if (BusDataType != Cmos)
1079  {
1080  /* Legacy vs. PnP behaviour */
1081  if (DeviceExtension->PhysicalDeviceObject != NULL)
1082  SlotNumber = DeviceExtension->SystemIoSlotNumber;
1083  }
1084 
1085  return HalGetBusDataByOffset(
1086  BusDataType,
1087  DeviceExtension->SystemIoBusNumber,
1088  SlotNumber,
1089  Buffer,
1090  Offset,
1091  Length);
1092 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:66
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
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

◆ VideoPortGetDeviceBase()

PVOID NTAPI VideoPortGetDeviceBase ( IN PVOID  HwDeviceExtension,
IN PHYSICAL_ADDRESS  IoAddress,
IN ULONG  NumberOfUchars,
IN UCHAR  InIoSpace 
)

Definition at line 450 of file resource.c.

455 {
456  TRACE_(VIDEOPRT, "VideoPortGetDeviceBase\n");
457  return IntVideoPortMapMemory(
458  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
459  IoAddress,
460  NumberOfUchars,
461  InIoSpace,
462  NULL,
463  NULL);
464 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
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:243

Referenced by InitializeModeTable(), and VgaFindAdapter().

◆ VideoPortGetDeviceData()

VP_STATUS NTAPI VideoPortGetDeviceData ( IN PVOID  HwDeviceExtension,
IN VIDEO_DEVICE_DATA_TYPE  DeviceDataType,
IN PMINIPORT_QUERY_DEVICE_ROUTINE  CallbackRoutine,
IN PVOID  Context 
)

Definition at line 897 of file resource.c.

902 {
903  TRACE_(VIDEOPRT, "VideoPortGetDeviceData\n");
905  return ERROR_INVALID_FUNCTION;
906 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define TRACE_(x)
Definition: compat.h:66
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by VgaFindAdapter().

◆ VideoPortLockBuffer()

PVOID NTAPI VideoPortLockBuffer ( IN PVOID  HwDeviceExtension,
IN PVOID  BaseAddress,
IN ULONG  Length,
IN VP_LOCK_OPERATION  Operation 
)

Definition at line 968 of file resource.c.

973 {
974  PMDL Mdl;
975 
977  if (!Mdl)
978  {
979  return NULL;
980  }
981  /* FIXME use seh */
983  return Mdl;
984 }
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468

Referenced by VideoPortLockPages().

◆ VideoPortLockPages()

BOOLEAN NTAPI VideoPortLockPages ( IN PVOID  HwDeviceExtension,
IN OUT PVIDEO_REQUEST_PACKET  pVrp,
IN PEVENT  pUEvent,
IN PEVENT  pDisplayEvent,
IN DMA_FLAGS  DmaFlags 
)

Definition at line 992 of file resource.c.

998 {
999  PVOID Buffer;
1000 
1001  /* clear output buffer */
1002  pVrp->OutputBuffer = NULL;
1003 
1004  if (DmaFlags != VideoPortDmaInitOnly)
1005  {
1006  /* VideoPortKeepPagesLocked / VideoPortUnlockAfterDma is no-op */
1007  return FALSE;
1008  }
1009 
1010  /* lock the buffer */
1011  Buffer = VideoPortLockBuffer(HwDeviceExtension, pVrp->InputBuffer, pVrp->InputBufferLength, IoModifyAccess);
1012 
1013  if (Buffer)
1014  {
1015  /* store result buffer & length */
1016  pVrp->OutputBuffer = Buffer;
1017  pVrp->OutputBufferLength = pVrp->InputBufferLength;
1018 
1019  /* operation succeeded */
1020  return TRUE;
1021  }
1022 
1023  /* operation failed */
1024  return FALSE;
1025 }
#define TRUE
Definition: types.h:120
PVOID NTAPI VideoPortLockBuffer(IN PVOID HwDeviceExtension, IN PVOID BaseAddress, IN ULONG Length, IN VP_LOCK_OPERATION Operation)
Definition: resource.c:968
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ VideoPortMapBankedMemory()

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 at line 486 of file resource.c.

496 {
497  TRACE_(VIDEOPRT, "VideoPortMapBankedMemory\n");
499  return ERROR_INVALID_FUNCTION;
500 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define TRACE_(x)
Definition: compat.h:66
#define UNIMPLEMENTED
Definition: debug.h:114

◆ VideoPortMapMemory()

VP_STATUS NTAPI VideoPortMapMemory ( IN PVOID  HwDeviceExtension,
IN PHYSICAL_ADDRESS  PhysicalAddress,
IN PULONG  Length,
IN PULONG  InIoSpace,
OUT PVOID VirtualAddress 
)

Definition at line 508 of file resource.c.

514 {
515  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
517 
518  TRACE_(VIDEOPRT, "VideoPortMapMemory\n");
519  INFO_(VIDEOPRT, "- *VirtualAddress: 0x%x\n", *VirtualAddress);
520 
521  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
523  DeviceExtension,
525  *Length,
526  *InIoSpace,
528  &Status);
529 
530  return Status;
531 }
#define INFO_(ch,...)
Definition: debug.h:159
LONG NTSTATUS
Definition: precomp.h:26
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
#define TRACE_(x)
Definition: compat.h:66
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
Status
Definition: gdiplustypes.h:24
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:243

◆ VideoPortReleaseBuffer()

VOID NTAPI VideoPortReleaseBuffer ( IN PVOID  HwDeviceExtension,
IN PVOID  Ptr 
)

Definition at line 955 of file resource.c.

958 {
959  TRACE_(VIDEOPRT, "VideoPortReleaseBuffer\n");
960  ExFreePool(Ptr);
961 }
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define TRACE_(x)
Definition: compat.h:66
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ VideoPortSetBusData()

ULONG NTAPI VideoPortSetBusData ( IN PVOID  HwDeviceExtension,
IN BUS_DATA_TYPE  BusDataType,
IN ULONG  SlotNumber,
IN PVOID  Buffer,
IN ULONG  Offset,
IN ULONG  Length 
)

Definition at line 1099 of file resource.c.

1106 {
1107  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1108 
1109  TRACE_(VIDEOPRT, "VideoPortSetBusData\n");
1110 
1111  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1112 
1113  if (BusDataType != Cmos)
1114  {
1115  /* Legacy vs. PnP behaviour */
1116  if (DeviceExtension->PhysicalDeviceObject != NULL)
1117  SlotNumber = DeviceExtension->SystemIoSlotNumber;
1118  }
1119 
1120  return HalSetBusDataByOffset(
1121  BusDataType,
1122  DeviceExtension->SystemIoBusNumber,
1123  SlotNumber,
1124  Buffer,
1125  Offset,
1126  Length);
1127 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:66
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
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

◆ VideoPortSetTrappedEmulatorPorts()

VP_STATUS NTAPI VideoPortSetTrappedEmulatorPorts ( IN PVOID  HwDeviceExtension,
IN ULONG  NumAccessRanges,
IN PVIDEO_ACCESS_RANGE  AccessRange 
)

Definition at line 1049 of file resource.c.

1053 {
1054  UNIMPLEMENTED;
1055  /* Should store the ranges in the device extension for use by ntvdm. */
1056  return NO_ERROR;
1057 }
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:114

◆ VideoPortUnlockBuffer()

VOID NTAPI VideoPortUnlockBuffer ( IN PVOID  HwDeviceExtension,
IN PVOID  Mdl 
)

Definition at line 1033 of file resource.c.

1036 {
1037  if (Mdl)
1038  {
1039  MmUnlockPages((PMDL)Mdl);
1040  IoFreeMdl(Mdl);
1041  }
1042 }
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1439
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146

◆ VideoPortUnmapMemory()

VP_STATUS NTAPI VideoPortUnmapMemory ( IN PVOID  HwDeviceExtension,
IN PVOID  VirtualAddress,
IN HANDLE  ProcessHandle 
)

Definition at line 538 of file resource.c.

542 {
543  TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
544 
546  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
548 
549  return NO_ERROR;
550 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
#define NO_ERROR
Definition: dderror.h:5
#define TRACE_(x)
Definition: compat.h:66
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
VOID NTAPI IntVideoPortUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:398

◆ VideoPortVerifyAccessRanges()

VP_STATUS NTAPI VideoPortVerifyAccessRanges ( IN PVOID  HwDeviceExtension,
IN ULONG  NumAccessRanges,
IN PVIDEO_ACCESS_RANGE  AccessRanges 
)

Definition at line 817 of file resource.c.

821 {
822  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
823  BOOLEAN ConflictDetected;
824  ULONG i;
825  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
827  ULONG ResourceListSize;
829 
830  TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
831 
832  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
833 
834  /* Create the resource list */
835  ResourceListSize = sizeof(CM_RESOURCE_LIST)
836  + (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
837  ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
838  if (!ResourceList)
839  {
840  WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
842  }
843 
844  /* Fill resource list */
845  ResourceList->Count = 1;
846  ResourceList->List[0].InterfaceType = DeviceExtension->AdapterInterfaceType;
847  ResourceList->List[0].BusNumber = DeviceExtension->SystemIoBusNumber;
848  ResourceList->List[0].PartialResourceList.Version = 1;
849  ResourceList->List[0].PartialResourceList.Revision = 1;
850  ResourceList->List[0].PartialResourceList.Count = NumAccessRanges;
851  for (i = 0; i < NumAccessRanges; i++, AccessRanges++)
852  {
853  PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
854  if (AccessRanges->RangeInIoSpace)
855  {
856  PartialDescriptor->Type = CmResourceTypePort;
857  PartialDescriptor->u.Port.Start = AccessRanges->RangeStart;
858  PartialDescriptor->u.Port.Length = AccessRanges->RangeLength;
859  }
860  else
861  {
862  PartialDescriptor->Type = CmResourceTypeMemory;
863  PartialDescriptor->u.Memory.Start = AccessRanges->RangeStart;
864  PartialDescriptor->u.Memory.Length = AccessRanges->RangeLength;
865  }
866  if (AccessRanges->RangeShareable)
867  PartialDescriptor->ShareDisposition = CmResourceShareShared;
868  else
870  PartialDescriptor->Flags = 0;
871  if (AccessRanges->RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
872  PartialDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
873  if (AccessRanges->RangePassive & VIDEO_RANGE_10_BIT_DECODE)
874  PartialDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
875  }
876 
877  /* Try to acquire all resource ranges */
879  DeviceExtension->DriverObject,
880  NULL, 0, /* Driver List */
881  DeviceExtension->PhysicalDeviceObject,
882  ResourceList, ResourceListSize,
883  &ConflictDetected);
885 
886  if (!NT_SUCCESS(Status) || ConflictDetected)
888  else
889  return NO_ERROR;
890 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
LONG NTSTATUS
Definition: precomp.h:26
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:415
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:133
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378 u
#define NO_ERROR
Definition: dderror.h:5
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@380 Port
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:84
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@383 Memory
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define TRACE_(x)
Definition: compat.h:66
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
Status
Definition: gdiplustypes.h:24
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:83
unsigned int ULONG
Definition: retypes.h:1
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:95
#define WARN_(ch,...)
Definition: debug.h:157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by VgaAcquireResources().