Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenagp.c
Go to the documentation of this file.
00001 /* 00002 * VideoPort driver 00003 * 00004 * Copyright (C) 2002, 2003, 2004 ReactOS Team 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 * 00020 */ 00021 00022 #include "videoprt.h" 00023 00024 /* PRIVATE FUNCTIONS **********************************************************/ 00025 00026 NTSTATUS 00027 IopInitiatePnpIrp( 00028 PDEVICE_OBJECT DeviceObject, 00029 PIO_STATUS_BLOCK IoStatusBlock, 00030 UCHAR MinorFunction, 00031 PIO_STACK_LOCATION Stack OPTIONAL) 00032 { 00033 PDEVICE_OBJECT TopDeviceObject; 00034 PIO_STACK_LOCATION IrpSp; 00035 NTSTATUS Status; 00036 KEVENT Event; 00037 PIRP Irp; 00038 00039 /* Always call the top of the device stack */ 00040 TopDeviceObject = IoGetAttachedDeviceReference(DeviceObject); 00041 00042 KeInitializeEvent( 00043 &Event, 00044 NotificationEvent, 00045 FALSE); 00046 00047 Irp = IoBuildSynchronousFsdRequest( 00048 IRP_MJ_PNP, 00049 TopDeviceObject, 00050 NULL, 00051 0, 00052 NULL, 00053 &Event, 00054 IoStatusBlock); 00055 00056 /* PNP IRPs are always initialized with a status code of 00057 STATUS_NOT_SUPPORTED */ 00058 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; 00059 Irp->IoStatus.Information = 0; 00060 00061 IrpSp = IoGetNextIrpStackLocation(Irp); 00062 IrpSp->MinorFunction = MinorFunction; 00063 00064 if (Stack) 00065 { 00066 RtlMoveMemory( 00067 &IrpSp->Parameters, 00068 &Stack->Parameters, 00069 sizeof(Stack->Parameters)); 00070 } 00071 00072 Status = IoCallDriver(TopDeviceObject, Irp); 00073 if (Status == STATUS_PENDING) 00074 { 00075 KeWaitForSingleObject( 00076 &Event, 00077 Executive, 00078 KernelMode, 00079 FALSE, 00080 NULL); 00081 Status = IoStatusBlock->Status; 00082 } 00083 00084 ObDereferenceObject(TopDeviceObject); 00085 00086 return Status; 00087 } 00088 00089 00090 BOOLEAN NTAPI 00091 IntAgpCommitPhysical( 00092 IN PVOID HwDeviceExtension, 00093 IN PVOID PhysicalContext, 00094 IN ULONG Pages, 00095 IN ULONG Offset) 00096 { 00097 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00098 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00099 PHYSICAL_ADDRESS MappingAddr = {{0, 0}}; 00100 PVIDEO_PORT_AGP_MAPPING AgpMapping; 00101 NTSTATUS Status; 00102 00103 TRACE_(VIDEOPRT, "AgpCommitPhysical - PhysicalContext: 0x%x Pages: %d, Offset: 0x%x\n", 00104 PhysicalContext, Pages, Offset); 00105 00106 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00107 AgpBusInterface = &DeviceExtension->AgpInterface; 00108 AgpMapping = (PVIDEO_PORT_AGP_MAPPING)PhysicalContext; 00109 00110 Status = AgpBusInterface->CommitMemory(AgpBusInterface->AgpContext, 00111 AgpMapping->MapHandle, Pages, Offset, 00112 NULL, &MappingAddr); 00113 00114 if (!NT_SUCCESS(Status)) 00115 { 00116 WARN_(VIDEOPRT, "Warning: AgpBusInterface->CommitMemory failed (Status = 0x%x)\n", 00117 Status); 00118 } 00119 return NT_SUCCESS(Status); 00120 } 00121 00122 VOID NTAPI 00123 IntAgpFreePhysical( 00124 IN PVOID HwDeviceExtension, 00125 IN PVOID PhysicalContext, 00126 IN ULONG Pages, 00127 IN ULONG Offset) 00128 { 00129 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00130 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00131 PVIDEO_PORT_AGP_MAPPING AgpMapping; 00132 NTSTATUS Status; 00133 00134 TRACE_(VIDEOPRT, "AgpFreePhysical - PhysicalContext: 0x%x Pages: %d, Offset: 0x%x\n", 00135 PhysicalContext, Pages, Offset); 00136 00137 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00138 AgpBusInterface = &DeviceExtension->AgpInterface; 00139 AgpMapping = (PVIDEO_PORT_AGP_MAPPING)PhysicalContext; 00140 00141 Status = AgpBusInterface->FreeMemory(AgpBusInterface->AgpContext, 00142 AgpMapping->MapHandle, Pages, Offset); 00143 if (!NT_SUCCESS(Status)) 00144 { 00145 WARN_(VIDEOPRT, "Warning: AgpBusInterface->FreeMemory failed (Status = 0x%x)\n", 00146 Status); 00147 } 00148 } 00149 00150 VOID NTAPI 00151 IntAgpReleasePhysical( 00152 IN PVOID HwDeviceExtension, 00153 IN PVOID PhysicalContext) 00154 { 00155 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00156 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00157 PVIDEO_PORT_AGP_MAPPING AgpMapping; 00158 NTSTATUS Status; 00159 00160 TRACE_(VIDEOPRT, "AgpReleasePhysical - PhysicalContext: 0x%x\n", PhysicalContext); 00161 00162 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00163 AgpBusInterface = &DeviceExtension->AgpInterface; 00164 AgpMapping = (PVIDEO_PORT_AGP_MAPPING)PhysicalContext; 00165 00166 /* Release memory */ 00167 Status = AgpBusInterface->ReleaseMemory(AgpBusInterface->AgpContext, 00168 AgpMapping->MapHandle); 00169 if (!NT_SUCCESS(Status)) 00170 { 00171 WARN_(VIDEOPRT, "Warning: AgpBusInterface->ReleaseMemory failed (Status = 0x%x)\n", 00172 Status); 00173 } 00174 00175 /* Free resources */ 00176 ExFreePool(AgpMapping); 00177 } 00178 00179 PHYSICAL_ADDRESS NTAPI 00180 IntAgpReservePhysical( 00181 IN PVOID HwDeviceExtension, 00182 IN ULONG Pages, 00183 IN VIDEO_PORT_CACHE_TYPE Caching, 00184 OUT PVOID *PhysicalContext) 00185 { 00186 PHYSICAL_ADDRESS ZeroAddress = {{0, 0}}; 00187 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00188 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00189 MEMORY_CACHING_TYPE MemCachingType; 00190 PVIDEO_PORT_AGP_MAPPING AgpMapping; 00191 NTSTATUS Status; 00192 00193 TRACE_(VIDEOPRT, "AgpReservePhysical - Pages: %d, Caching: 0x%x\n", Pages, Caching); 00194 00195 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00196 AgpBusInterface = &DeviceExtension->AgpInterface; 00197 00198 /* Translate memory caching type */ 00199 if (Caching == VpNonCached) 00200 MemCachingType = MmNonCached; 00201 else if (Caching == VpCached) 00202 MemCachingType = MmCached; 00203 else if (Caching == VpWriteCombined) 00204 MemCachingType = MmWriteCombined; 00205 else 00206 { 00207 WARN_(VIDEOPRT, "Invalid caching type %d!\n", Caching); 00208 return ZeroAddress; 00209 } 00210 00211 /* Allocate an AGP mapping structure */ 00212 AgpMapping = ExAllocatePoolWithTag(PagedPool, 00213 sizeof(VIDEO_PORT_AGP_MAPPING), 00214 TAG_VIDEO_PORT); 00215 if (AgpMapping == NULL) 00216 { 00217 WARN_(VIDEOPRT, "Out of memory! Couldn't allocate AGP mapping structure!\n"); 00218 return ZeroAddress; 00219 } 00220 RtlZeroMemory(AgpMapping, sizeof(VIDEO_PORT_AGP_MAPPING)); 00221 00222 /* Reserve memory for the AGP bus */ 00223 Status = AgpBusInterface->ReserveMemory(AgpBusInterface->AgpContext, 00224 Pages, 00225 MemCachingType, 00226 &AgpMapping->MapHandle, 00227 &AgpMapping->PhysicalAddress); 00228 if (!NT_SUCCESS(Status) || AgpMapping->MapHandle == NULL) 00229 { 00230 ExFreePool(AgpMapping); 00231 WARN_(VIDEOPRT, "Warning: AgpBusInterface->ReserveMemory failed (Status = 0x%x)\n", 00232 Status); 00233 return ZeroAddress; 00234 } 00235 00236 /* Fill the rest of the AGP mapping */ 00237 AgpMapping->NumberOfPages = Pages; 00238 00239 *PhysicalContext = (PVOID)AgpMapping; 00240 return AgpMapping->PhysicalAddress; 00241 } 00242 00243 00244 PVOID NTAPI 00245 IntAgpCommitVirtual( 00246 IN PVOID HwDeviceExtension, 00247 IN PVOID VirtualContext, 00248 IN ULONG Pages, 00249 IN ULONG Offset) 00250 { 00251 PVIDEO_PORT_AGP_VIRTUAL_MAPPING VirtualMapping; 00252 PVOID BaseAddress = NULL; 00253 PHYSICAL_ADDRESS PhysicalAddress; 00254 NTSTATUS Status; 00255 00256 TRACE_(VIDEOPRT, "AgpCommitVirtual - VirtualContext: 0x%x Pages: %d, Offset: 0x%x\n", 00257 VirtualContext, Pages, Offset); 00258 00259 VirtualMapping = (PVIDEO_PORT_AGP_VIRTUAL_MAPPING)VirtualContext; 00260 00261 /* I think the NT API provides no way of reserving a part of the address space 00262 * and setting it up to map into a specified range of physical memory later. 00263 * This means that we will have to release some of the reserved virtual memory 00264 * and map the physical memory into it using MapViewOfSection. 00265 * 00266 * - blight (2004-12-21) 00267 */ 00268 00269 if (VirtualMapping->ProcessHandle == NULL) 00270 { 00271 /* FIXME: not implemented */ 00272 } 00273 else /* ProcessHandle != NULL */ 00274 { 00275 /* Release some virtual memory */ 00276 SIZE_T Size = Pages * PAGE_SIZE; 00277 ULONG OffsetInBytes = Offset * PAGE_SIZE; 00278 BaseAddress = (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00279 OffsetInBytes); 00280 PhysicalAddress = VirtualMapping->AgpMapping->PhysicalAddress; 00281 PhysicalAddress.QuadPart += OffsetInBytes; 00282 00283 Status = ZwFreeVirtualMemory(VirtualMapping->ProcessHandle, 00284 &BaseAddress, 00285 &Size, MEM_RELEASE); 00286 if (!NT_SUCCESS(Status)) 00287 { 00288 WARN_(VIDEOPRT, "Warning: ZwFreeVirtualMemory() failed: Status = 0x%x\n", Status); 00289 return NULL; 00290 } 00291 ASSERT(Size == Pages * PAGE_SIZE); 00292 ASSERT(BaseAddress == (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00293 OffsetInBytes)); 00294 00295 /* Map the physical memory into the released virtual memory area */ 00296 Status = IntVideoPortMapPhysicalMemory(VirtualMapping->ProcessHandle, 00297 PhysicalAddress, 00298 Size, 00299 PAGE_READWRITE, 00300 &BaseAddress); 00301 if (!NT_SUCCESS(Status)) 00302 { 00303 WARN_(VIDEOPRT, "Warning: IntVideoPortMapPhysicalMemory() failed: Status = 0x%x\n", Status); 00304 /* Reserve the released virtual memory area again */ 00305 Status = ZwAllocateVirtualMemory(VirtualMapping->ProcessHandle, 00306 &BaseAddress, 0, &Size, MEM_RESERVE, 00307 PAGE_NOACCESS); 00308 if (!NT_SUCCESS(Status)) 00309 { 00310 WARN_(VIDEOPRT, "Warning: ZwAllocateVirtualMemory() failed: Status = 0x%x\n", Status); 00311 /* FIXME: What to do now?? */ 00312 ASSERT(0); 00313 return NULL; 00314 } 00315 ASSERT(Size == Pages * PAGE_SIZE); 00316 ASSERT(BaseAddress == (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00317 OffsetInBytes)); 00318 return NULL; 00319 } 00320 ASSERT(BaseAddress == (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00321 OffsetInBytes)); 00322 } 00323 00324 return BaseAddress; 00325 } 00326 00327 VOID NTAPI 00328 IntAgpFreeVirtual( 00329 IN PVOID HwDeviceExtension, 00330 IN PVOID VirtualContext, 00331 IN ULONG Pages, 00332 IN ULONG Offset) 00333 { 00334 PVIDEO_PORT_AGP_VIRTUAL_MAPPING VirtualMapping; 00335 PVOID BaseAddress = NULL; 00336 NTSTATUS Status; 00337 00338 TRACE_(VIDEOPRT, "AgpFreeVirtual - VirtualContext: 0x%x Pages: %d, Offset: 0x%x\n", 00339 VirtualContext, Pages, Offset); 00340 00341 VirtualMapping = (PVIDEO_PORT_AGP_VIRTUAL_MAPPING)VirtualContext; 00342 00343 if (VirtualMapping->ProcessHandle == NULL) 00344 { 00345 /* FIXME: not implemented */ 00346 } 00347 else /* ProcessHandle != NULL */ 00348 { 00349 /* Unmap the section view */ 00350 SIZE_T Size = Pages * PAGE_SIZE; 00351 ULONG OffsetInBytes = Offset * PAGE_SIZE; 00352 BaseAddress = (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00353 OffsetInBytes); 00354 00355 Status = ZwUnmapViewOfSection(VirtualMapping->ProcessHandle, BaseAddress); 00356 if (!NT_SUCCESS(Status)) 00357 { 00358 WARN_(VIDEOPRT, "Warning: ZwUnmapViewOfSection() failed: Status = 0x%x\n", Status); 00359 /* FIXME: What to do now?? */ 00360 ASSERT(0); 00361 return; 00362 } 00363 00364 /* And reserve the virtual memory area again */ 00365 Status = ZwAllocateVirtualMemory(VirtualMapping->ProcessHandle, 00366 &BaseAddress, 0, &Size, MEM_RESERVE, 00367 PAGE_NOACCESS); 00368 if (!NT_SUCCESS(Status)) 00369 { 00370 WARN_(VIDEOPRT, "Warning: ZwAllocateVirtualMemory() failed: Status = 0x%x\n", Status); 00371 /* FIXME: What to do now?? */ 00372 ASSERT(0); 00373 return; 00374 } 00375 ASSERT(Size == Pages * PAGE_SIZE); 00376 ASSERT(BaseAddress == (PVOID)((ULONG_PTR)VirtualMapping->MappedAddress + 00377 OffsetInBytes)); 00378 } 00379 } 00380 00381 VOID NTAPI 00382 IntAgpReleaseVirtual( 00383 IN PVOID HwDeviceExtension, 00384 IN PVOID VirtualContext) 00385 { 00386 PVIDEO_PORT_AGP_VIRTUAL_MAPPING VirtualMapping; 00387 NTSTATUS Status; 00388 00389 TRACE_(VIDEOPRT, "AgpReleaseVirtual - VirtualContext: 0x%x\n", VirtualContext); 00390 00391 VirtualMapping = (PVIDEO_PORT_AGP_VIRTUAL_MAPPING)VirtualContext; 00392 00393 /* Release the virtual memory */ 00394 if (VirtualMapping->ProcessHandle == NULL) 00395 { 00396 /* FIXME: not implemented */ 00397 } 00398 else /* ProcessHandle != NULL */ 00399 { 00400 /* Release the allocated virtual memory */ 00401 SIZE_T Size = VirtualMapping->AgpMapping->NumberOfPages * PAGE_SIZE; 00402 Status = ZwFreeVirtualMemory(VirtualMapping->ProcessHandle, 00403 &VirtualMapping->MappedAddress, 00404 &Size, MEM_RELEASE); 00405 if (!NT_SUCCESS(Status)) 00406 { 00407 WARN_(VIDEOPRT, "Warning: ZwFreeVirtualMemory() failed: Status = 0x%x\n", Status); 00408 } 00409 } 00410 00411 /* Free resources */ 00412 ExFreePool(VirtualMapping); 00413 } 00414 00415 PVOID NTAPI 00416 IntAgpReserveVirtual( 00417 IN PVOID HwDeviceExtension, 00418 IN HANDLE ProcessHandle, 00419 IN PVOID PhysicalContext, 00420 OUT PVOID *VirtualContext) 00421 { 00422 PVIDEO_PORT_AGP_MAPPING AgpMapping; 00423 PVIDEO_PORT_AGP_VIRTUAL_MAPPING VirtualMapping; 00424 PVOID MappedAddress; 00425 NTSTATUS Status; 00426 00427 TRACE_(VIDEOPRT, "AgpReserveVirtual - ProcessHandle: 0x%x PhysicalContext: 0x%x\n", 00428 ProcessHandle, PhysicalContext); 00429 00430 AgpMapping = (PVIDEO_PORT_AGP_MAPPING)PhysicalContext; 00431 00432 /* Allocate an AGP virtual mapping structure */ 00433 VirtualMapping = ExAllocatePoolWithTag(PagedPool, 00434 sizeof(VIDEO_PORT_AGP_VIRTUAL_MAPPING), 00435 TAG_VIDEO_PORT); 00436 if (VirtualMapping == NULL) 00437 { 00438 WARN_(VIDEOPRT, "Out of memory! Couldn't allocate AGP virtual mapping structure!\n"); 00439 return NULL; 00440 } 00441 RtlZeroMemory(VirtualMapping, sizeof(VIDEO_PORT_AGP_VIRTUAL_MAPPING)); 00442 00443 /* Reserve a virtual memory area for the physical pages. */ 00444 if (ProcessHandle == NULL) 00445 { 00446 /* FIXME: What to do in this case? */ 00447 ExFreePool(VirtualMapping); 00448 return NULL; 00449 } 00450 else /* ProcessHandle != NULL */ 00451 { 00452 /* Reserve memory for usermode */ 00453 SIZE_T Size = AgpMapping->NumberOfPages * PAGE_SIZE; 00454 MappedAddress = NULL; 00455 Status = ZwAllocateVirtualMemory(ProcessHandle, &MappedAddress, 0, &Size, 00456 MEM_RESERVE, PAGE_NOACCESS); 00457 if (!NT_SUCCESS(Status)) 00458 { 00459 ExFreePool(VirtualMapping); 00460 WARN_(VIDEOPRT, "ZwAllocateVirtualMemory() failed: Status = 0x%x\n", Status); 00461 return NULL; 00462 } 00463 } 00464 00465 /* Fill the AGP virtual mapping */ 00466 VirtualMapping->AgpMapping = AgpMapping; 00467 VirtualMapping->ProcessHandle = ProcessHandle; 00468 VirtualMapping->MappedAddress = MappedAddress; 00469 00470 *VirtualContext = (PVOID)VirtualMapping; 00471 return MappedAddress; 00472 } 00473 00474 00475 BOOLEAN NTAPI 00476 IntAgpSetRate( 00477 IN PVOID HwDeviceExtension, 00478 IN ULONG Rate) 00479 { 00480 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00481 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00482 00483 TRACE_(VIDEOPRT, "AgpSetRate - Rate: %d\n", Rate); 00484 00485 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00486 AgpBusInterface = &DeviceExtension->AgpInterface; 00487 00488 return NT_SUCCESS(AgpBusInterface->SetRate(AgpBusInterface->AgpContext, Rate)); 00489 } 00490 00491 00492 NTSTATUS NTAPI 00493 IntAgpGetInterface( 00494 IN PVOID HwDeviceExtension, 00495 IN OUT PINTERFACE Interface) 00496 { 00497 IO_STATUS_BLOCK IoStatusBlock; 00498 IO_STACK_LOCATION IoStack; 00499 NTSTATUS Status; 00500 PVIDEO_PORT_AGP_INTERFACE_2 AgpInterface; 00501 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension; 00502 PAGP_BUS_INTERFACE_STANDARD AgpBusInterface; 00503 00504 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension); 00505 AgpBusInterface = &DeviceExtension->AgpInterface; 00506 AgpInterface = (PVIDEO_PORT_AGP_INTERFACE_2)Interface; 00507 00508 ASSERT(Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2 || 00509 Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1); 00510 if (Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_2) 00511 { 00512 ASSERT(Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE_2)); 00513 } 00514 else if (Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1) 00515 { 00516 ASSERT(Interface->Size >= sizeof(VIDEO_PORT_AGP_INTERFACE)); 00517 } 00518 00519 if (DeviceExtension->NextDeviceObject == NULL) 00520 { 00521 WARN_(VIDEOPRT, "DeviceExtension->NextDeviceObject is NULL!\n"); 00522 return STATUS_UNSUCCESSFUL; 00523 } 00524 00525 /* Query the interface from the AGP bus driver */ 00526 if (DeviceExtension->AgpInterface.Size == 0) 00527 { 00528 AgpBusInterface->Size = sizeof(AGP_BUS_INTERFACE_STANDARD); 00529 if (Interface->Version == VIDEO_PORT_AGP_INTERFACE_VERSION_1) 00530 AgpBusInterface->Version = AGP_BUS_INTERFACE_V1; 00531 else /* if (InterfaceVersion == VIDEO_PORT_AGP_INTERFACE_VERSION_2) */ 00532 AgpBusInterface->Version = AGP_BUS_INTERFACE_V2; 00533 IoStack.Parameters.QueryInterface.Size = AgpBusInterface->Size; 00534 IoStack.Parameters.QueryInterface.Version = AgpBusInterface->Version; 00535 IoStack.Parameters.QueryInterface.Interface = (PINTERFACE)AgpBusInterface; 00536 IoStack.Parameters.QueryInterface.InterfaceType = 00537 &GUID_AGP_TARGET_BUS_INTERFACE_STANDARD; 00538 Status = IopInitiatePnpIrp(DeviceExtension->NextDeviceObject, 00539 &IoStatusBlock, IRP_MN_QUERY_INTERFACE, &IoStack); 00540 if (!NT_SUCCESS(Status)) 00541 { 00542 WARN_(VIDEOPRT, "IopInitiatePnpIrp() failed! (Status 0x%x)\n", Status); 00543 return Status; 00544 } 00545 INFO_(VIDEOPRT, "Got AGP driver interface!\n"); 00546 } 00547 00548 /* FIXME: Not sure if we should wrap the reference/dereference functions */ 00549 AgpInterface->Context = AgpBusInterface->AgpContext; 00550 AgpInterface->InterfaceReference = AgpBusInterface->InterfaceReference; 00551 AgpInterface->InterfaceDereference = AgpBusInterface->InterfaceDereference; 00552 AgpInterface->AgpReservePhysical = IntAgpReservePhysical; 00553 AgpInterface->AgpReleasePhysical = IntAgpReleasePhysical; 00554 AgpInterface->AgpCommitPhysical = IntAgpCommitPhysical; 00555 AgpInterface->AgpFreePhysical = IntAgpFreePhysical; 00556 AgpInterface->AgpReserveVirtual = IntAgpReserveVirtual; 00557 AgpInterface->AgpReleaseVirtual = IntAgpReleaseVirtual; 00558 AgpInterface->AgpCommitVirtual = IntAgpCommitVirtual; 00559 AgpInterface->AgpFreeVirtual = IntAgpFreeVirtual; 00560 AgpInterface->AgpAllocationLimit = 0x1000000; /* FIXME: using 16 MB for now */ 00561 00562 if (AgpInterface->Version >= VIDEO_PORT_AGP_INTERFACE_VERSION_2) 00563 { 00564 AgpInterface->AgpSetRate = IntAgpSetRate; 00565 } 00566 00567 return STATUS_SUCCESS; 00568 } 00569 Generated on Sun May 27 2012 04:38:13 for ReactOS by
1.7.6.1
|