ReactOS  0.4.15-dev-4914-g2220e56
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 PIO_STACK_LOCATION IrpStack, 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 PIO_STACK_LOCATION  IrpStack,
IN PIRP  Irp 
)

Definition at line 77 of file resource.c.

81 {
84  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
85  PVIDEO_ACCESS_RANGE AccessRanges;
86  ULONG AccessRangeCount, ListSize, i;
88  PIO_RESOURCE_REQUIREMENTS_LIST OldResList = IrpStack->Parameters.FilterResourceRequirements.IoResourceRequirementList;
89  PIO_RESOURCE_DESCRIPTOR CurrentDescriptor;
91 
92  DriverObject = DeviceObject->DriverObject;
94  DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
95 
96  Status = IntVideoPortGetLegacyResources(DriverExtension, DeviceExtension, &AccessRanges, &AccessRangeCount);
97  if (!NT_SUCCESS(Status))
98  return Status;
99  if (!AccessRangeCount)
100  {
101  /* No legacy resources to report */
102  return Irp->IoStatus.Status;
103  }
104 
105  /* OK, we've got the access ranges now. Let's set up the resource requirements list */
106 
107  if (OldResList)
108  {
109  /* Already one there so let's add to it */
110  ListSize = OldResList->ListSize + sizeof(IO_RESOURCE_DESCRIPTOR) * AccessRangeCount;
111  ResList = ExAllocatePool(NonPagedPool,
112  ListSize);
113  if (!ResList) return STATUS_NO_MEMORY;
114 
115  RtlCopyMemory(ResList, OldResList, OldResList->ListSize);
116 
117  ASSERT(ResList->AlternativeLists == 1);
118 
119  ResList->ListSize = ListSize;
120  ResList->List[0].Count += AccessRangeCount;
121 
122  CurrentDescriptor = (PIO_RESOURCE_DESCRIPTOR)((PUCHAR)ResList + OldResList->ListSize);
123 
124  ExFreePool(OldResList);
125  Irp->IoStatus.Information = 0;
126  }
127  else
128  {
129  /* We need to make a new one */
130  ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (AccessRangeCount - 1);
131  ResList = ExAllocatePool(NonPagedPool,
132  ListSize);
133  if (!ResList) return STATUS_NO_MEMORY;
134 
135  RtlZeroMemory(ResList, ListSize);
136 
137  /* We need to initialize some fields */
138  ResList->ListSize = ListSize;
139  ResList->InterfaceType = DeviceExtension->AdapterInterfaceType;
140  ResList->BusNumber = DeviceExtension->SystemIoBusNumber;
141  ResList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
142  ResList->AlternativeLists = 1;
143  ResList->List[0].Version = 1;
144  ResList->List[0].Revision = 1;
145  ResList->List[0].Count = AccessRangeCount;
146 
147  CurrentDescriptor = ResList->List[0].Descriptors;
148  }
149 
150  for (i = 0; i < AccessRangeCount; i++)
151  {
152  /* This is a required resource */
153  CurrentDescriptor->Option = 0;
154 
155  if (AccessRanges[i].RangeInIoSpace)
156  CurrentDescriptor->Type = CmResourceTypePort;
157  else
158  CurrentDescriptor->Type = CmResourceTypeMemory;
159 
160  CurrentDescriptor->ShareDisposition =
162 
163  CurrentDescriptor->Flags = 0;
164 
165  if (CurrentDescriptor->Type == CmResourceTypePort)
166  {
167  CurrentDescriptor->u.Port.Length = AccessRanges[i].RangeLength;
168  CurrentDescriptor->u.Port.MinimumAddress = AccessRanges[i].RangeStart;
169  CurrentDescriptor->u.Port.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
170  CurrentDescriptor->u.Port.Alignment = 1;
171  if (AccessRanges[i].RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
172  CurrentDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
173  if (AccessRanges[i].RangePassive & VIDEO_RANGE_10_BIT_DECODE)
174  CurrentDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
175  }
176  else
177  {
178  CurrentDescriptor->u.Memory.Length = AccessRanges[i].RangeLength;
179  CurrentDescriptor->u.Memory.MinimumAddress = AccessRanges[i].RangeStart;
180  CurrentDescriptor->u.Memory.MaximumAddress.QuadPart = AccessRanges[i].RangeStart.QuadPart + AccessRanges[i].RangeLength - 1;
181  CurrentDescriptor->u.Memory.Alignment = 1;
182  CurrentDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
183  }
184 
185  CurrentDescriptor++;
186  }
187 
188  Irp->IoStatus.Information = (ULONG_PTR)ResList;
189 
190  return STATUS_SUCCESS;
191 }
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
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
struct _IO_RESOURCE_DESCRIPTOR::@1529::@1530 Port
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CmResourceTypePort
Definition: hwresource.cpp:123
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ PIRP Irp
Definition: csq.h:116
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
union _IO_RESOURCE_DESCRIPTOR::@1529 u
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
Status
Definition: gdiplustypes.h:24
IO_RESOURCE_DESCRIPTOR Descriptors[1]
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
UCHAR RangeShareable
Definition: video.h:219
struct _IO_RESOURCE_DESCRIPTOR * PIO_RESOURCE_DESCRIPTOR
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1875
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 STATUS_NO_MEMORY
Definition: ntstatus.h:260
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
struct _IO_RESOURCE_DESCRIPTOR::@1529::@1531 Memory
#define STATUS_SUCCESS
Definition: shellext.h:65
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
ULONG RangeLength
Definition: video.h:216
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
LONGLONG QuadPart
Definition: typedefs.h:114
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;
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  {
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
ULONG ReadLength
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
unsigned int ULONG
Definition: retypes.h:1
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define STATUS_SUCCESS
Definition: shellext.h:65

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 245 of file resource.c.

252 {
254  PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
256  PVOID MappedAddress;
258 
259  INFO_(VIDEOPRT, "- IoAddress: %lx\n", IoAddress.u.LowPart);
260  INFO_(VIDEOPRT, "- NumberOfUchars: %lx\n", NumberOfUchars);
261  INFO_(VIDEOPRT, "- InIoSpace: %x\n", InIoSpace);
262 
263  InIoSpace &= ~VIDEO_MEMORY_SPACE_DENSE;
264  if ((InIoSpace & VIDEO_MEMORY_SPACE_P6CACHE) != 0)
265  {
266  INFO_(VIDEOPRT, "VIDEO_MEMORY_SPACE_P6CACHE not supported, turning off\n");
267  InIoSpace &= ~VIDEO_MEMORY_SPACE_P6CACHE;
268  }
269 
270  if (ProcessHandle != NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
271  {
272  INFO_(VIDEOPRT, "ProcessHandle is not NULL (0x%x) but InIoSpace does not have "
273  "VIDEO_MEMORY_SPACE_USER_MODE set! Setting "
274  "VIDEO_MEMORY_SPACE_USER_MODE.\n",
275  ProcessHandle);
276  InIoSpace |= VIDEO_MEMORY_SPACE_USER_MODE;
277  }
278  else if (ProcessHandle == NULL && (InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
279  {
280  INFO_(VIDEOPRT, "ProcessHandle is NULL (0x%x) but InIoSpace does have "
281  "VIDEO_MEMORY_SPACE_USER_MODE set! Setting ProcessHandle "
282  "to NtCurrentProcess()\n",
283  ProcessHandle);
285  }
286 
287  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0 &&
288  !IsListEmpty(&DeviceExtension->AddressMappingListHead))
289  {
290  Entry = DeviceExtension->AddressMappingListHead.Flink;
291  while (Entry != &DeviceExtension->AddressMappingListHead)
292  {
293  AddressMapping = CONTAINING_RECORD(
294  Entry,
296  List);
297  if (IoAddress.QuadPart == AddressMapping->IoAddress.QuadPart &&
298  NumberOfUchars <= AddressMapping->NumberOfUchars)
299  {
300  {
301  AddressMapping->MappingCount++;
302  if (Status)
303  *Status = NO_ERROR;
304  return AddressMapping->MappedAddress;
305  }
306  }
307  Entry = Entry->Flink;
308  }
309  }
310 
311  AddressSpace = (ULONG)InIoSpace;
314  DeviceExtension->AdapterInterfaceType,
315  DeviceExtension->SystemIoBusNumber,
316  IoAddress,
317  &AddressSpace,
319  {
320  if (Status)
322 
323  return NULL;
324  }
325 
326  /* I/O space */
327  if (AddressSpace != 0)
328  {
329  ASSERT(0 == TranslatedAddress.u.HighPart);
330  if (Status)
331  *Status = NO_ERROR;
332 
333  return (PVOID)(ULONG_PTR)TranslatedAddress.u.LowPart;
334  }
335 
336  /* user space */
337  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) != 0)
338  {
339  NTSTATUS NtStatus;
340  MappedAddress = NULL;
343  NumberOfUchars,
344  PAGE_READWRITE/* | PAGE_WRITECOMBINE*/,
345  &MappedAddress);
346  if (!NT_SUCCESS(NtStatus))
347  {
348  WARN_(VIDEOPRT, "IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus);
349  if (Status)
350  *Status = NO_ERROR;
351  return NULL;
352  }
353  INFO_(VIDEOPRT, "Mapped user address = 0x%08x\n", MappedAddress);
354  }
355  else /* kernel space */
356  {
357  MappedAddress = MmMapIoSpace(
359  NumberOfUchars,
360  MmNonCached);
361  }
362 
363  if (MappedAddress != NULL)
364  {
365  if (Status)
366  {
367  *Status = NO_ERROR;
368  }
369  if ((InIoSpace & VIDEO_MEMORY_SPACE_USER_MODE) == 0)
370  {
371  AddressMapping = ExAllocatePoolWithTag(
372  PagedPool,
375 
376  if (AddressMapping == NULL)
377  return MappedAddress;
378 
379  RtlZeroMemory(AddressMapping, sizeof(VIDEO_PORT_ADDRESS_MAPPING));
380  AddressMapping->NumberOfUchars = NumberOfUchars;
381  AddressMapping->IoAddress = IoAddress;
382  AddressMapping->SystemIoBusNumber = DeviceExtension->SystemIoBusNumber;
383  AddressMapping->MappedAddress = MappedAddress;
384  AddressMapping->MappingCount = 1;
386  &DeviceExtension->AddressMappingListHead,
387  &AddressMapping->List);
388  }
389 
390  return MappedAddress;
391  }
392 
393  if (Status)
394  *Status = NO_ERROR;
395 
396  return NULL;
397 }
#define VIDEO_MEMORY_SPACE_DENSE
Definition: video.h:135
#define TAG_VIDEO_PORT
Definition: videoprt.h:38
#define INFO_(ch,...)
Definition: debug.h:159
struct _Entry Entry
Definition: kefuncs.h:629
#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:2272
PHYSICAL_ADDRESS IoAddress
Definition: videoprt.h:49
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:2272
#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:194
#define FALSE
Definition: types.h:117
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
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
Definition: typedefs.h:119
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
#define NULL
Definition: types.h:112
#define VIDEO_MEMORY_SPACE_USER_MODE
Definition: video.h:134
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
struct _LARGE_INTEGER::@2247 u
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
#define WARN_(ch,...)
Definition: debug.h:157
base of all file and directory entries
Definition: entries.h:82
LONGLONG QuadPart
Definition: typedefs.h:114
#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 194 of file resource.c.

200 {
201  OBJECT_ATTRIBUTES ObjAttribs;
203  HANDLE hMemObj;
205  SIZE_T Size;
206 
207  /* Initialize object attribs */
208  RtlInitUnicodeString(&UnicodeString, L"\\Device\\PhysicalMemory");
209  InitializeObjectAttributes(&ObjAttribs,
210  &UnicodeString,
212  NULL, NULL);
213 
214  /* Open physical memory section */
215  Status = ZwOpenSection(&hMemObj, SECTION_ALL_ACCESS, &ObjAttribs);
216  if (!NT_SUCCESS(Status))
217  {
218  WARN_(VIDEOPRT, "ZwOpenSection() failed! (0x%x)\n", Status);
219  return Status;
220  }
221 
222  /* Map view of section */
223  Size = SizeInBytes;
224  Status = ZwMapViewOfSection(hMemObj,
225  Process,
227  0,
228  Size,
230  &Size,
231  ViewUnmap,
232  0,
233  Protect);
234  ZwClose(hMemObj);
235  if (!NT_SUCCESS(Status))
236  {
237  WARN_(VIDEOPRT, "ZwMapViewOfSection() failed! (0x%x)\n", Status);
238  }
239 
240  return Status;
241 }
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define NULL
Definition: types.h:112
_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 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 400 of file resource.c.

403 {
404  PVIDEO_PORT_ADDRESS_MAPPING AddressMapping;
407 
408  Entry = DeviceExtension->AddressMappingListHead.Flink;
409  while (Entry != &DeviceExtension->AddressMappingListHead)
410  {
411  AddressMapping = CONTAINING_RECORD(
412  Entry,
414  List);
415  if (AddressMapping->MappedAddress == MappedAddress)
416  {
417  ASSERT(AddressMapping->MappingCount > 0);
418  AddressMapping->MappingCount--;
419  if (AddressMapping->MappingCount == 0)
420  {
422  AddressMapping->MappedAddress,
423  AddressMapping->NumberOfUchars);
425  ExFreePool(AddressMapping);
426  }
427  return;
428  }
429 
430  Entry = Entry->Flink;
431  }
432 
433  /* If there was no kernelmode mapping for the given address found we assume
434  * that the given address is a usermode mapping and try to unmap it.
435  *
436  * FIXME: Is it ok to use NtCurrentProcess?
437  */
438  Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
439  if (!NT_SUCCESS(Status))
440  {
441  WARN_(VIDEOPRT, "Warning: Mapping for address 0x%p not found!\n", MappedAddress);
442  }
443 }
struct _Entry Entry
Definition: kefuncs.h:629
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
Status
Definition: gdiplustypes.h:24
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
Definition: typedefs.h:119
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 947 of file resource.c.

951 {
952  TRACE_(VIDEOPRT, "VideoPortAllocateBuffer\n");
955 }
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define NO_ERROR
Definition: dderror.h:5
#define TAG_VIDEO_PORT_BUFFER
Definition: videoprt.h:39
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:76
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NULL
Definition: types.h:112

◆ VideoPortAllocatePool()

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

Definition at line 920 of file resource.c.

925 {
926  TRACE_(VIDEOPRT, "VideoPortAllocatePool\n");
928 }
#define TRACE_(x)
Definition: compat.h:76
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1035
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3810

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

◆ VideoPortFreeDeviceBase()

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

Definition at line 473 of file resource.c.

476 {
477  TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
479  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
480  MappedAddress);
481 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
#define TRACE_(x)
Definition: compat.h:76
VOID NTAPI IntVideoPortUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:400

Referenced by InitializeModeTable().

◆ VideoPortFreePool()

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

Definition at line 935 of file resource.c.

938 {
939  ExFreePool(Ptr);
940 }
_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 559 of file resource.c.

568 {
569  PCI_SLOT_NUMBER PciSlotNumber;
571  ULONG FunctionNumber;
575  UINT AssignedCount = 0;
576  CM_FULL_RESOURCE_DESCRIPTOR *FullList;
578  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
580  USHORT VendorIdToFind;
581  USHORT DeviceIdToFind;
583  PVIDEO_ACCESS_RANGE LegacyAccessRanges;
584  ULONG LegacyAccessRangeCount;
586  ULONG ListSize;
588  BOOLEAN DeviceAndVendorFound = FALSE;
589 
590  TRACE_(VIDEOPRT, "VideoPortGetAccessRanges(%d, %p, %d, %p)\n", NumRequestedResources, RequestedResources, NumAccessRanges, AccessRanges);
591 
592  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
593  DriverObject = DeviceExtension->DriverObject;
595 
596  if (NumRequestedResources == 0)
597  {
598  AllocatedResources = DeviceExtension->AllocatedResources;
599  if (AllocatedResources == NULL &&
600  DeviceExtension->AdapterInterfaceType == PCIBus)
601  {
602  if (DeviceExtension->PhysicalDeviceObject != NULL)
603  {
604  PciSlotNumber.u.AsULONG = DeviceExtension->SystemIoSlotNumber;
605 
607  DeviceExtension->SystemIoBusNumber,
608  PciSlotNumber.u.AsULONG,
609  &Config,
610  sizeof(PCI_COMMON_CONFIG));
611 
612  if (ReturnedLength != sizeof(PCI_COMMON_CONFIG))
613  {
615  }
616  }
617  else
618  {
619  VendorIdToFind = VendorId != NULL ? *(PUSHORT)VendorId : 0;
620  DeviceIdToFind = DeviceId != NULL ? *(PUSHORT)DeviceId : 0;
621 
622  if (VendorIdToFind == 0 && DeviceIdToFind == 0)
623  {
624  /* We're screwed */
625  return ERROR_DEV_NOT_EXIST;
626  }
627 
628  INFO_(VIDEOPRT, "Looking for VendorId 0x%04x DeviceId 0x%04x\n",
629  VendorIdToFind, DeviceIdToFind);
630 
631  /*
632  * Search for the device id and vendor id on this bus.
633  */
634  PciSlotNumber.u.bits.Reserved = 0;
636  {
637  PciSlotNumber.u.bits.DeviceNumber = DeviceNumber;
638  for (FunctionNumber = 0; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++)
639  {
640  INFO_(VIDEOPRT, "- Function number: %d\n", FunctionNumber);
641  PciSlotNumber.u.bits.FunctionNumber = FunctionNumber;
643  DeviceExtension->SystemIoBusNumber,
644  PciSlotNumber.u.AsULONG,
645  &Config,
646  sizeof(PCI_COMMON_CONFIG));
647  INFO_(VIDEOPRT, "- Length of data: %x\n", ReturnedLength);
648  if (ReturnedLength == sizeof(PCI_COMMON_CONFIG))
649  {
650  INFO_(VIDEOPRT, "- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
651  "DeviceId 0x%04x\n",
652  PciSlotNumber.u.AsULONG,
653  PciSlotNumber.u.bits.DeviceNumber,
654  PciSlotNumber.u.bits.FunctionNumber,
655  Config.VendorID,
656  Config.DeviceID);
657 
658  if ((VendorIdToFind == 0 || Config.VendorID == VendorIdToFind) &&
659  (DeviceIdToFind == 0 || Config.DeviceID == DeviceIdToFind))
660  {
661  DeviceAndVendorFound = TRUE;
662  break;
663  }
664  }
665  }
666  if (DeviceAndVendorFound) break;
667  }
668  if (FunctionNumber == PCI_MAX_FUNCTION)
669  {
670  WARN_(VIDEOPRT, "Didn't find device.\n");
671  return ERROR_DEV_NOT_EXIST;
672  }
673  }
674 
675  Status = HalAssignSlotResources(&DeviceExtension->RegistryPath,
676  NULL,
677  DeviceExtension->DriverObject,
678  DeviceExtension->DriverObject->DeviceObject,
679  DeviceExtension->AdapterInterfaceType,
680  DeviceExtension->SystemIoBusNumber,
681  PciSlotNumber.u.AsULONG,
683 
684  if (!NT_SUCCESS(Status))
685  {
686  WARN_(VIDEOPRT, "HalAssignSlotResources failed with status %x.\n",Status);
687  return Status;
688  }
689  DeviceExtension->AllocatedResources = AllocatedResources;
690  DeviceExtension->SystemIoSlotNumber = PciSlotNumber.u.AsULONG;
691 
692  /* Add legacy resources to the resources from HAL */
694  &LegacyAccessRanges, &LegacyAccessRangeCount);
695  if (!NT_SUCCESS(Status))
696  return ERROR_DEV_NOT_EXIST;
697 
698  if (NumAccessRanges < LegacyAccessRangeCount)
699  {
700  ERR_(VIDEOPRT, "Too many legacy access ranges found\n");
702  }
703 
704  RtlCopyMemory(AccessRanges, LegacyAccessRanges, LegacyAccessRangeCount * sizeof(VIDEO_ACCESS_RANGE));
705  AssignedCount = LegacyAccessRangeCount;
706  }
707  }
708  else
709  {
710  ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + (NumRequestedResources - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
711  ResReqList = ExAllocatePool(NonPagedPool, ListSize);
712  if (!ResReqList) return ERROR_NOT_ENOUGH_MEMORY;
713 
714  ResReqList->ListSize = ListSize;
715  ResReqList->InterfaceType = DeviceExtension->AdapterInterfaceType;
716  ResReqList->BusNumber = DeviceExtension->SystemIoBusNumber;
717  ResReqList->SlotNumber = DeviceExtension->SystemIoSlotNumber;
718  ResReqList->AlternativeLists = 1;
719  ResReqList->List[0].Version = 1;
720  ResReqList->List[0].Revision = 1;
721  ResReqList->List[0].Count = NumRequestedResources;
722 
723  /* Copy in the caller's resource list */
724  RtlCopyMemory(ResReqList->List[0].Descriptors,
725  RequestedResources,
726  NumRequestedResources * sizeof(IO_RESOURCE_DESCRIPTOR));
727 
728  Status = IoAssignResources(&DeviceExtension->RegistryPath,
729  NULL,
730  DeviceExtension->DriverObject,
731  DeviceExtension->PhysicalDeviceObject ?
732  DeviceExtension->PhysicalDeviceObject :
733  DeviceExtension->DriverObject->DeviceObject,
734  ResReqList,
736 
737  if (!NT_SUCCESS(Status))
738  return Status;
739 
740  if (!DeviceExtension->AllocatedResources)
741  DeviceExtension->AllocatedResources = AllocatedResources;
742  }
743 
744  if (AllocatedResources == NULL)
746 
747  /* Return the slot number if the caller wants it */
748  if (Slot != NULL) *Slot = DeviceExtension->SystemIoBusNumber;
749 
750  FullList = AllocatedResources->List;
751  ASSERT(AllocatedResources->Count == 1);
752  INFO_(VIDEOPRT, "InterfaceType %u BusNumber List %u Device BusNumber %u Version %u Revision %u\n",
753  FullList->InterfaceType, FullList->BusNumber, DeviceExtension->SystemIoBusNumber, FullList->PartialResourceList.Version, FullList->PartialResourceList.Revision);
754 
755  ASSERT(FullList->InterfaceType == PCIBus);
756  ASSERT(FullList->BusNumber == DeviceExtension->SystemIoBusNumber);
757  ASSERT(1 == FullList->PartialResourceList.Version);
758  ASSERT(1 == FullList->PartialResourceList.Revision);
760  Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
761  Descriptor++)
762  {
763  if ((Descriptor->Type == CmResourceTypeMemory ||
764  Descriptor->Type == CmResourceTypePort) &&
765  AssignedCount >= NumAccessRanges)
766  {
767  ERR_(VIDEOPRT, "Too many access ranges found\n");
769  }
770  else if (Descriptor->Type == CmResourceTypeMemory)
771  {
772  INFO_(VIDEOPRT, "Memory range starting at 0x%08x length 0x%08x\n",
773  Descriptor->u.Memory.Start.u.LowPart, Descriptor->u.Memory.Length);
774  AccessRanges[AssignedCount].RangeStart = Descriptor->u.Memory.Start;
775  AccessRanges[AssignedCount].RangeLength = Descriptor->u.Memory.Length;
776  AccessRanges[AssignedCount].RangeInIoSpace = 0;
777  AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
778  AccessRanges[AssignedCount].RangeShareable =
779  (Descriptor->ShareDisposition == CmResourceShareShared);
780  AccessRanges[AssignedCount].RangePassive = 0;
781  AssignedCount++;
782  }
783  else if (Descriptor->Type == CmResourceTypePort)
784  {
785  INFO_(VIDEOPRT, "Port range starting at 0x%04x length %d\n",
786  Descriptor->u.Port.Start.u.LowPart, Descriptor->u.Port.Length);
787  AccessRanges[AssignedCount].RangeStart = Descriptor->u.Port.Start;
788  AccessRanges[AssignedCount].RangeLength = Descriptor->u.Port.Length;
789  AccessRanges[AssignedCount].RangeInIoSpace = 1;
790  AccessRanges[AssignedCount].RangeVisible = 0; /* FIXME: Just guessing */
791  AccessRanges[AssignedCount].RangeShareable =
792  (Descriptor->ShareDisposition == CmResourceShareShared);
793  AccessRanges[AssignedCount].RangePassive = 0;
795  AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_10_BIT_DECODE;
797  AccessRanges[AssignedCount].RangePassive |= VIDEO_RANGE_PASSIVE_DECODE;
798  AssignedCount++;
799  }
800  else if (Descriptor->Type == CmResourceTypeInterrupt)
801  {
802  DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
803  DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
804  if (Descriptor->ShareDisposition == CmResourceShareShared)
805  DeviceExtension->InterruptShared = TRUE;
806  else
807  DeviceExtension->InterruptShared = FALSE;
808  }
809  else
810  {
811  ASSERT(FALSE);
813  }
814  }
815 
816  return NO_ERROR;
817 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
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 TRUE
Definition: types.h:120
#define ERR_(ch,...)
Definition: debug.h:156
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
PCM_RESOURCE_LIST AllocatedResources
Definition: videoprt.h:94
union _PCI_SLOT_NUMBER::@3802 u
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
#define NO_ERROR
Definition: dderror.h:5
#define CmResourceTypePort
Definition: hwresource.cpp:123
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
#define FALSE
Definition: types.h:117
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
unsigned char BOOLEAN
#define VIDEO_RANGE_10_BIT_DECODE
Definition: video.h:99
NTHALAPI NTSTATUS NTAPI HalAssignSlotResources(PUNICODE_STRING, PUNICODE_STRING, PDRIVER_OBJECT, PDEVICE_OBJECT, INTERFACE_TYPE, ULONG, ULONG, PCM_RESOURCE_LIST *)
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
Status
Definition: gdiplustypes.h:24
#define TRACE_(x)
Definition: compat.h:76
IO_RESOURCE_DESCRIPTOR Descriptors[1]
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PCI_MAX_DEVICES
Definition: iotypes.h:3598
#define CM_RESOURCE_PORT_PASSIVE_DECODE
Definition: cmtypes.h:114
struct _PCI_SLOT_NUMBER::@3802::@3803 bits
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1875
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:187
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
Definition: wdfchildlist.h:474
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3599
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
unsigned short USHORT
Definition: pedump.c:61
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
unsigned int ULONG
Definition: retypes.h:1
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
UNICODE_STRING RegistryPath
Definition: videoprt.h:90
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1229
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
#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:2277
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:953

◆ 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 1071 of file resource.c.

1078 {
1079  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1080 
1081  TRACE_(VIDEOPRT, "VideoPortGetBusData\n");
1082 
1083  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1084 
1085  if (BusDataType != Cmos)
1086  {
1087  /* Legacy vs. PnP behaviour */
1088  if (DeviceExtension->PhysicalDeviceObject != NULL)
1089  SlotNumber = DeviceExtension->SystemIoSlotNumber;
1090  }
1091 
1092  return HalGetBusDataByOffset(
1093  BusDataType,
1094  DeviceExtension->SystemIoBusNumber,
1095  SlotNumber,
1096  Buffer,
1097  Offset,
1098  Length);
1099 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:76
Definition: miniport.h:89
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
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define NULL
Definition: types.h:112

◆ VideoPortGetDeviceBase()

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

Definition at line 452 of file resource.c.

457 {
458  TRACE_(VIDEOPRT, "VideoPortGetDeviceBase\n");
459  return IntVideoPortMapMemory(
460  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
461  IoAddress,
462  NumberOfUchars,
463  InIoSpace,
464  NULL,
465  NULL);
466 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
#define TRACE_(x)
Definition: compat.h:76
#define NULL
Definition: types.h:112
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:245

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 904 of file resource.c.

909 {
910  TRACE_(VIDEOPRT, "VideoPortGetDeviceData\n");
912  return ERROR_INVALID_FUNCTION;
913 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define TRACE_(x)
Definition: compat.h:76
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by VgaFindAdapter().

◆ VideoPortLockBuffer()

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

Definition at line 975 of file resource.c.

980 {
981  PMDL Mdl;
982 
984  if (!Mdl)
985  {
986  return NULL;
987  }
988  /* FIXME use seh */
990  return Mdl;
991 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FALSE
Definition: types.h:117
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
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:931
#define NULL
Definition: types.h:112
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1467

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 999 of file resource.c.

1005 {
1006  PVOID Buffer;
1007 
1008  /* clear output buffer */
1009  pVrp->OutputBuffer = NULL;
1010 
1011  if (DmaFlags != VideoPortDmaInitOnly)
1012  {
1013  /* VideoPortKeepPagesLocked / VideoPortUnlockAfterDma is no-op */
1014  return FALSE;
1015  }
1016 
1017  /* lock the buffer */
1018  Buffer = VideoPortLockBuffer(HwDeviceExtension, pVrp->InputBuffer, pVrp->InputBufferLength, IoModifyAccess);
1019 
1020  if (Buffer)
1021  {
1022  /* store result buffer & length */
1023  pVrp->OutputBuffer = Buffer;
1024  pVrp->OutputBufferLength = pVrp->InputBufferLength;
1025 
1026  /* operation succeeded */
1027  return TRUE;
1028  }
1029 
1030  /* operation failed */
1031  return FALSE;
1032 }
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#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:975
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
#define NULL
Definition: types.h:112

◆ 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 488 of file resource.c.

498 {
499  TRACE_(VIDEOPRT, "VideoPortMapBankedMemory\n");
501  return ERROR_INVALID_FUNCTION;
502 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define TRACE_(x)
Definition: compat.h:76
#define UNIMPLEMENTED
Definition: debug.h:115

◆ VideoPortMapMemory()

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

Definition at line 510 of file resource.c.

516 {
517  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
519 
520  TRACE_(VIDEOPRT, "VideoPortMapMemory\n");
521  INFO_(VIDEOPRT, "- *VirtualAddress: 0x%x\n", *VirtualAddress);
522 
523  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
525  DeviceExtension,
527  *Length,
528  *InIoSpace,
530  &Status);
531 
532  return Status;
533 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define INFO_(ch,...)
Definition: debug.h:159
LONG NTSTATUS
Definition: precomp.h:26
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
Status
Definition: gdiplustypes.h:24
#define TRACE_(x)
Definition: compat.h:76
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
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:245

◆ VideoPortReleaseBuffer()

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

Definition at line 962 of file resource.c.

965 {
966  TRACE_(VIDEOPRT, "VideoPortReleaseBuffer\n");
967  ExFreePool(Ptr);
968 }
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define TRACE_(x)
Definition: compat.h:76
#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 1106 of file resource.c.

1113 {
1114  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
1115 
1116  TRACE_(VIDEOPRT, "VideoPortSetBusData\n");
1117 
1118  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
1119 
1120  if (BusDataType != Cmos)
1121  {
1122  /* Legacy vs. PnP behaviour */
1123  if (DeviceExtension->PhysicalDeviceObject != NULL)
1124  SlotNumber = DeviceExtension->SystemIoSlotNumber;
1125  }
1126 
1127  return HalSetBusDataByOffset(
1128  BusDataType,
1129  DeviceExtension->SystemIoBusNumber,
1130  SlotNumber,
1131  Buffer,
1132  Offset,
1133  Length);
1134 }
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
Definition: bufpool.h:45
#define TRACE_(x)
Definition: compat.h:76
Definition: miniport.h:89
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define NULL
Definition: types.h:112
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 1056 of file resource.c.

1060 {
1061  UNIMPLEMENTED;
1062  /* Should store the ranges in the device extension for use by ntvdm. */
1063  return NO_ERROR;
1064 }
#define NO_ERROR
Definition: dderror.h:5
#define UNIMPLEMENTED
Definition: debug.h:115

◆ VideoPortUnlockBuffer()

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

Definition at line 1040 of file resource.c.

1043 {
1044  if (Mdl)
1045  {
1047  IoFreeMdl(Mdl);
1048  }
1049 }
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl

◆ VideoPortUnmapMemory()

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

Definition at line 540 of file resource.c.

544 {
545  TRACE_(VIDEOPRT, "VideoPortFreeDeviceBase\n");
546 
548  VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension),
550 
551  return NO_ERROR;
552 }
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
#define NO_ERROR
Definition: dderror.h:5
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
#define TRACE_(x)
Definition: compat.h:76
VOID NTAPI IntVideoPortUnmapMemory(IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PVOID MappedAddress)
Definition: resource.c:400

◆ VideoPortVerifyAccessRanges()

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

Definition at line 824 of file resource.c.

828 {
829  PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
830  BOOLEAN ConflictDetected;
831  ULONG i;
832  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
834  ULONG ResourceListSize;
836 
837  TRACE_(VIDEOPRT, "VideoPortVerifyAccessRanges\n");
838 
839  DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
840 
841  /* Create the resource list */
842  ResourceListSize = sizeof(CM_RESOURCE_LIST)
843  + (NumAccessRanges - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
844  ResourceList = ExAllocatePool(PagedPool, ResourceListSize);
845  if (!ResourceList)
846  {
847  WARN_(VIDEOPRT, "ExAllocatePool() failed\n");
849  }
850 
851  /* Fill resource list */
852  ResourceList->Count = 1;
853  ResourceList->List[0].InterfaceType = DeviceExtension->AdapterInterfaceType;
854  ResourceList->List[0].BusNumber = DeviceExtension->SystemIoBusNumber;
855  ResourceList->List[0].PartialResourceList.Version = 1;
856  ResourceList->List[0].PartialResourceList.Revision = 1;
857  ResourceList->List[0].PartialResourceList.Count = NumAccessRanges;
858  for (i = 0; i < NumAccessRanges; i++, AccessRanges++)
859  {
860  PartialDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[i];
861  if (AccessRanges->RangeInIoSpace)
862  {
863  PartialDescriptor->Type = CmResourceTypePort;
864  PartialDescriptor->u.Port.Start = AccessRanges->RangeStart;
865  PartialDescriptor->u.Port.Length = AccessRanges->RangeLength;
866  }
867  else
868  {
869  PartialDescriptor->Type = CmResourceTypeMemory;
870  PartialDescriptor->u.Memory.Start = AccessRanges->RangeStart;
871  PartialDescriptor->u.Memory.Length = AccessRanges->RangeLength;
872  }
873  if (AccessRanges->RangeShareable)
874  PartialDescriptor->ShareDisposition = CmResourceShareShared;
875  else
877  PartialDescriptor->Flags = 0;
878  if (AccessRanges->RangePassive & VIDEO_RANGE_PASSIVE_DECODE)
879  PartialDescriptor->Flags |= CM_RESOURCE_PORT_PASSIVE_DECODE;
880  if (AccessRanges->RangePassive & VIDEO_RANGE_10_BIT_DECODE)
881  PartialDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
882  }
883 
884  /* Try to acquire all resource ranges */
886  DeviceExtension->DriverObject,
887  NULL, 0, /* Driver List */
888  DeviceExtension->PhysicalDeviceObject,
889  ResourceList, ResourceListSize,
890  &ConflictDetected);
892 
893  if (!NT_SUCCESS(Status) || ConflictDetected)
895  else
896  return NO_ERROR;
897 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
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:393
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378 u
#define NO_ERROR
Definition: dderror.h:5
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define CmResourceTypePort
Definition: hwresource.cpp:123
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@378::@380 Port
PDEVICE_OBJECT PhysicalDeviceObject
Definition: videoprt.h:87
#define VIDEO_RANGE_PASSIVE_DECODE
Definition: video.h:98
unsigned char BOOLEAN
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
Status
Definition: gdiplustypes.h:24
#define TRACE_(x)
Definition: compat.h:76
#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
PDRIVER_OBJECT DriverObject
Definition: videoprt.h:86
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 NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
INTERFACE_TYPE AdapterInterfaceType
Definition: videoprt.h:98
#define WARN_(ch,...)
Definition: debug.h:157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by Pc98VidFindAdapter(), VgaAcquireResources(), and VGAFindAdapter().