4 * Copyright (C) 2002 - 2005 ReactOS Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /* PRIVATE FUNCTIONS **********************************************************/
29 IntVideoPortMapPhysicalMemory(
31 IN PHYSICAL_ADDRESS PhysicalAddress
,
34 IN OUT PVOID
*VirtualAddress OPTIONAL
)
36 OBJECT_ATTRIBUTES ObjAttribs
;
37 UNICODE_STRING UnicodeString
;
42 /* Initialize object attribs */
43 RtlInitUnicodeString(&UnicodeString
, L
"\\Device\\PhysicalMemory");
44 InitializeObjectAttributes(&ObjAttribs
,
46 OBJ_CASE_INSENSITIVE
| OBJ_KERNEL_HANDLE
,
49 /* Open physical memory section */
50 Status
= ZwOpenSection(&hMemObj
, SECTION_ALL_ACCESS
, &ObjAttribs
);
51 if (!NT_SUCCESS(Status
))
53 DPRINT("ZwOpenSection() failed! (0x%x)\n", Status
);
57 /* Map view of section */
59 Status
= ZwMapViewOfSection(hMemObj
,
64 (PLARGE_INTEGER
)(&PhysicalAddress
),
70 if (!NT_SUCCESS(Status
))
72 DPRINT("ZwMapViewOfSection() failed! (0x%x)\n", Status
);
80 IntVideoPortMapMemory(
81 IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
,
82 IN PHYSICAL_ADDRESS IoAddress
,
83 IN ULONG NumberOfUchars
,
85 IN HANDLE ProcessHandle
,
86 OUT VP_STATUS
*Status
)
88 PHYSICAL_ADDRESS TranslatedAddress
;
89 PVIDEO_PORT_ADDRESS_MAPPING AddressMapping
;
94 DPRINT("- IoAddress: %lx\n", IoAddress
.u
.LowPart
);
95 DPRINT("- NumberOfUchars: %lx\n", NumberOfUchars
);
96 DPRINT("- InIoSpace: %x\n", InIoSpace
);
98 InIoSpace
&= ~VIDEO_MEMORY_SPACE_DENSE
;
99 if ((InIoSpace
& VIDEO_MEMORY_SPACE_P6CACHE
) != 0)
101 DPRINT("VIDEO_MEMORY_SPACE_P6CACHE not supported, turning off\n");
102 InIoSpace
&= ~VIDEO_MEMORY_SPACE_P6CACHE
;
105 if (ProcessHandle
!= NULL
&& (InIoSpace
& VIDEO_MEMORY_SPACE_USER_MODE
) == 0)
107 DPRINT("ProcessHandle is not NULL (0x%x) but InIoSpace does not have "
108 "VIDEO_MEMORY_SPACE_USER_MODE set! Setting "
109 "VIDEO_MEMORY_SPACE_USER_MODE.\n",
111 InIoSpace
|= VIDEO_MEMORY_SPACE_USER_MODE
;
113 else if (ProcessHandle
== NULL
&& (InIoSpace
& VIDEO_MEMORY_SPACE_USER_MODE
) != 0)
115 DPRINT("ProcessHandle is NULL (0x%x) but InIoSpace does have "
116 "VIDEO_MEMORY_SPACE_USER_MODE set! Setting ProcessHandle "
117 "to NtCurrentProcess()\n",
119 ProcessHandle
= NtCurrentProcess();
122 if ((InIoSpace
& VIDEO_MEMORY_SPACE_USER_MODE
) == 0 &&
123 !IsListEmpty(&DeviceExtension
->AddressMappingListHead
))
125 Entry
= DeviceExtension
->AddressMappingListHead
.Flink
;
126 while (Entry
!= &DeviceExtension
->AddressMappingListHead
)
128 AddressMapping
= CONTAINING_RECORD(
130 VIDEO_PORT_ADDRESS_MAPPING
,
132 if (IoAddress
.QuadPart
== AddressMapping
->IoAddress
.QuadPart
&&
133 NumberOfUchars
<= AddressMapping
->NumberOfUchars
)
136 AddressMapping
->MappingCount
++;
139 return AddressMapping
->MappedAddress
;
142 Entry
= Entry
->Flink
;
146 AddressSpace
= (ULONG
)InIoSpace
;
147 AddressSpace
&= ~VIDEO_MEMORY_SPACE_USER_MODE
;
148 if (HalTranslateBusAddress(
149 DeviceExtension
->AdapterInterfaceType
,
150 DeviceExtension
->SystemIoBusNumber
,
153 &TranslatedAddress
) == FALSE
)
156 *Status
= ERROR_NOT_ENOUGH_MEMORY
;
162 if (AddressSpace
!= 0)
164 ASSERT(0 == TranslatedAddress
.u
.HighPart
);
168 return (PVOID
)TranslatedAddress
.u
.LowPart
;
172 if ((InIoSpace
& VIDEO_MEMORY_SPACE_USER_MODE
) != 0)
175 MappedAddress
= NULL
;
176 NtStatus
= IntVideoPortMapPhysicalMemory(ProcessHandle
,
179 PAGE_READWRITE
/* | PAGE_WRITECOMBINE*/,
181 if (!NT_SUCCESS(NtStatus
))
183 DPRINT("IntVideoPortMapPhysicalMemory() failed! (0x%x)\n", NtStatus
);
188 DPRINT("Mapped user address = 0x%08x\n", MappedAddress
);
190 else /* kernel space */
192 MappedAddress
= MmMapIoSpace(
198 if (MappedAddress
!= NULL
)
204 if ((InIoSpace
& VIDEO_MEMORY_SPACE_USER_MODE
) == 0)
206 AddressMapping
= ExAllocatePoolWithTag(
208 sizeof(VIDEO_PORT_ADDRESS_MAPPING
),
211 if (AddressMapping
== NULL
)
212 return MappedAddress
;
214 RtlZeroMemory(AddressMapping
, sizeof(VIDEO_PORT_ADDRESS_MAPPING
));
215 AddressMapping
->NumberOfUchars
= NumberOfUchars
;
216 AddressMapping
->IoAddress
= IoAddress
;
217 AddressMapping
->SystemIoBusNumber
= DeviceExtension
->SystemIoBusNumber
;
218 AddressMapping
->MappedAddress
= MappedAddress
;
219 AddressMapping
->MappingCount
= 1;
221 &DeviceExtension
->AddressMappingListHead
,
222 &AddressMapping
->List
);
225 return MappedAddress
;
235 IntVideoPortUnmapMemory(
236 IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
,
237 IN PVOID MappedAddress
)
239 PVIDEO_PORT_ADDRESS_MAPPING AddressMapping
;
243 Entry
= DeviceExtension
->AddressMappingListHead
.Flink
;
244 while (Entry
!= &DeviceExtension
->AddressMappingListHead
)
246 AddressMapping
= CONTAINING_RECORD(
248 VIDEO_PORT_ADDRESS_MAPPING
,
250 if (AddressMapping
->MappedAddress
== MappedAddress
)
252 ASSERT(AddressMapping
->MappingCount
> 0);
253 AddressMapping
->MappingCount
--;
254 if (AddressMapping
->MappingCount
== 0)
257 AddressMapping
->MappedAddress
,
258 AddressMapping
->NumberOfUchars
);
259 RemoveEntryList(Entry
);
260 ExFreePool(AddressMapping
);
265 Entry
= Entry
->Flink
;
268 /* If there was no kernelmode mapping for the given address found we assume
269 * that the given address is a usermode mapping and try to unmap it.
271 * FIXME: Is it ok to use NtCurrentProcess?
273 Status
= ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress
);
274 if (!NT_SUCCESS(Status
))
276 DPRINT1("Warning: Mapping for address 0x%x not found!\n", (ULONG
)MappedAddress
);
280 /* PUBLIC FUNCTIONS ***********************************************************/
287 VideoPortGetDeviceBase(
288 IN PVOID HwDeviceExtension
,
289 IN PHYSICAL_ADDRESS IoAddress
,
290 IN ULONG NumberOfUchars
,
293 DPRINT("VideoPortGetDeviceBase\n");
294 return IntVideoPortMapMemory(
295 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
),
308 VideoPortFreeDeviceBase(
309 IN PVOID HwDeviceExtension
,
310 IN PVOID MappedAddress
)
312 DPRINT("VideoPortFreeDeviceBase\n");
313 IntVideoPortUnmapMemory(
314 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
),
323 VideoPortMapBankedMemory(
324 IN PVOID HwDeviceExtension
,
325 IN PHYSICAL_ADDRESS PhysicalAddress
,
328 OUT PVOID
*VirtualAddress
,
330 IN UCHAR ReadWriteBank
,
331 IN PBANKED_SECTION_ROUTINE BankRoutine
,
334 DPRINT("VideoPortMapBankedMemory\n");
336 return ERROR_CALL_NOT_IMPLEMENTED
;
346 IN PVOID HwDeviceExtension
,
347 IN PHYSICAL_ADDRESS PhysicalAddress
,
350 OUT PVOID
*VirtualAddress
)
352 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
355 DPRINT("VideoPortMapMemory\n");
356 DPRINT("- *VirtualAddress: 0x%x\n", *VirtualAddress
);
358 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
359 *VirtualAddress
= IntVideoPortMapMemory(
364 (HANDLE
)*VirtualAddress
,
375 VideoPortUnmapMemory(
376 IN PVOID HwDeviceExtension
,
377 IN PVOID VirtualAddress
,
378 IN HANDLE ProcessHandle
)
380 DPRINT("VideoPortFreeDeviceBase\n");
382 IntVideoPortUnmapMemory(
383 VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
),
394 VideoPortGetAccessRanges(
395 IN PVOID HwDeviceExtension
,
396 IN ULONG NumRequestedResources
,
397 IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL
,
398 IN ULONG NumAccessRanges
,
399 IN PVIDEO_ACCESS_RANGE AccessRanges
,
404 PCI_SLOT_NUMBER PciSlotNumber
;
405 ULONG FunctionNumber
;
406 PCI_COMMON_CONFIG Config
;
407 PCM_RESOURCE_LIST AllocatedResources
;
410 CM_FULL_RESOURCE_DESCRIPTOR
*FullList
;
411 CM_PARTIAL_RESOURCE_DESCRIPTOR
*Descriptor
;
412 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
413 USHORT VendorIdToFind
;
414 USHORT DeviceIdToFind
;
416 ULONG ReturnedLength
;
418 DPRINT("VideoPortGetAccessRanges\n");
420 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
422 if (NumRequestedResources
== 0)
424 AllocatedResources
= DeviceExtension
->AllocatedResources
;
425 if (AllocatedResources
== NULL
&&
426 DeviceExtension
->AdapterInterfaceType
== PCIBus
)
428 if (DeviceExtension
->PhysicalDeviceObject
!= NULL
)
430 PciSlotNumber
.u
.AsULONG
= DeviceExtension
->SystemIoSlotNumber
;
432 ReturnedLength
= HalGetBusData(
434 DeviceExtension
->SystemIoBusNumber
,
435 PciSlotNumber
.u
.AsULONG
,
437 sizeof(PCI_COMMON_CONFIG
));
439 if (ReturnedLength
!= sizeof(PCI_COMMON_CONFIG
))
441 return ERROR_NO_SYSTEM_RESOURCES
;
446 VendorIdToFind
= VendorId
!= NULL
? *(PUSHORT
)VendorId
: 0;
447 DeviceIdToFind
= DeviceId
!= NULL
? *(PUSHORT
)DeviceId
: 0;
448 SlotIdToFind
= Slot
!= NULL
? *Slot
: 0;
449 PciSlotNumber
.u
.AsULONG
= SlotIdToFind
;
451 DPRINT("Looking for VendorId 0x%04x DeviceId 0x%04x\n",
452 VendorIdToFind
, DeviceIdToFind
);
455 * Search for the device id and vendor id on this bus.
458 for (FunctionNumber
= 0; FunctionNumber
< 8; FunctionNumber
++)
460 DPRINT("- Function number: %d\n", FunctionNumber
);
461 PciSlotNumber
.u
.bits
.FunctionNumber
= FunctionNumber
;
462 ReturnedLength
= HalGetBusData(
464 DeviceExtension
->SystemIoBusNumber
,
465 PciSlotNumber
.u
.AsULONG
,
467 sizeof(PCI_COMMON_CONFIG
));
468 DPRINT("- Length of data: %x\n", ReturnedLength
);
469 if (ReturnedLength
== sizeof(PCI_COMMON_CONFIG
))
471 DPRINT("- Slot 0x%02x (Device %d Function %d) VendorId 0x%04x "
473 PciSlotNumber
.u
.AsULONG
,
474 PciSlotNumber
.u
.bits
.DeviceNumber
,
475 PciSlotNumber
.u
.bits
.FunctionNumber
,
479 if ((VendorIdToFind
== 0 || Config
.VendorID
== VendorIdToFind
) &&
480 (DeviceIdToFind
== 0 || Config
.DeviceID
== DeviceIdToFind
))
487 if (FunctionNumber
== 8)
489 DPRINT("Didn't find device.\n");
490 return ERROR_DEV_NOT_EXIST
;
494 Status
= HalAssignSlotResources(
495 NULL
, NULL
, NULL
, NULL
,
496 DeviceExtension
->AdapterInterfaceType
,
497 DeviceExtension
->SystemIoBusNumber
,
498 PciSlotNumber
.u
.AsULONG
,
499 &AllocatedResources
);
501 if (!NT_SUCCESS(Status
))
505 DeviceExtension
->AllocatedResources
= AllocatedResources
;
507 if (AllocatedResources
== NULL
)
508 return ERROR_NO_SYSTEM_RESOURCES
;
511 for (FullList
= AllocatedResources
->List
;
512 FullList
< AllocatedResources
->List
+ AllocatedResources
->Count
;
515 ASSERT(FullList
->InterfaceType
== PCIBus
&&
516 FullList
->BusNumber
== DeviceExtension
->SystemIoBusNumber
&&
517 1 == FullList
->PartialResourceList
.Version
&&
518 1 == FullList
->PartialResourceList
.Revision
);
519 for (Descriptor
= FullList
->PartialResourceList
.PartialDescriptors
;
520 Descriptor
< FullList
->PartialResourceList
.PartialDescriptors
+ FullList
->PartialResourceList
.Count
;
523 if ((Descriptor
->Type
== CmResourceTypeMemory
||
524 Descriptor
->Type
== CmResourceTypePort
) &&
525 AssignedCount
>= NumAccessRanges
)
527 DPRINT1("Too many access ranges found\n");
528 return ERROR_NO_SYSTEM_RESOURCES
;
530 if (Descriptor
->Type
== CmResourceTypeMemory
)
532 if (NumAccessRanges
<= AssignedCount
)
534 DPRINT1("Too many access ranges found\n");
535 return ERROR_NO_SYSTEM_RESOURCES
;
537 DPRINT("Memory range starting at 0x%08x length 0x%08x\n",
538 Descriptor
->u
.Memory
.Start
.u
.LowPart
, Descriptor
->u
.Memory
.Length
);
539 AccessRanges
[AssignedCount
].RangeStart
= Descriptor
->u
.Memory
.Start
;
540 AccessRanges
[AssignedCount
].RangeLength
= Descriptor
->u
.Memory
.Length
;
541 AccessRanges
[AssignedCount
].RangeInIoSpace
= 0;
542 AccessRanges
[AssignedCount
].RangeVisible
= 0; /* FIXME: Just guessing */
543 AccessRanges
[AssignedCount
].RangeShareable
=
544 (Descriptor
->ShareDisposition
== CmResourceShareShared
);
547 else if (Descriptor
->Type
== CmResourceTypePort
)
549 DPRINT("Port range starting at 0x%04x length %d\n",
550 Descriptor
->u
.Memory
.Start
.u
.LowPart
, Descriptor
->u
.Memory
.Length
);
551 AccessRanges
[AssignedCount
].RangeStart
= Descriptor
->u
.Port
.Start
;
552 AccessRanges
[AssignedCount
].RangeLength
= Descriptor
->u
.Port
.Length
;
553 AccessRanges
[AssignedCount
].RangeInIoSpace
= 1;
554 AccessRanges
[AssignedCount
].RangeVisible
= 0; /* FIXME: Just guessing */
555 AccessRanges
[AssignedCount
].RangeShareable
= 0;
558 else if (Descriptor
->Type
== CmResourceTypeInterrupt
)
560 DeviceExtension
->InterruptLevel
= Descriptor
->u
.Interrupt
.Level
;
561 DeviceExtension
->InterruptVector
= Descriptor
->u
.Interrupt
.Vector
;
562 if (Descriptor
->ShareDisposition
== CmResourceShareShared
)
563 DeviceExtension
->InterruptShared
= TRUE
;
565 DeviceExtension
->InterruptShared
= FALSE
;
583 VideoPortVerifyAccessRanges(
584 IN PVOID HwDeviceExtension
,
585 IN ULONG NumAccessRanges
,
586 IN PVIDEO_ACCESS_RANGE AccessRanges
)
588 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
589 BOOLEAN ConflictDetected
;
591 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor
;
592 PCM_RESOURCE_LIST ResourceList
;
593 ULONG ResourceListSize
;
596 DPRINT("VideoPortVerifyAccessRanges\n");
598 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
600 /* Create the resource list */
601 ResourceListSize
= sizeof(CM_RESOURCE_LIST
)
602 + (NumAccessRanges
- 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR
);
603 ResourceList
= ExAllocatePool(PagedPool
, ResourceListSize
);
606 DPRINT("ExAllocatePool() failed\n");
607 return ERROR_INVALID_PARAMETER
;
610 /* Fill resource list */
611 ResourceList
->Count
= 1;
612 ResourceList
->List
[0].InterfaceType
= DeviceExtension
->AdapterInterfaceType
;
613 ResourceList
->List
[0].BusNumber
= DeviceExtension
->SystemIoBusNumber
;
614 ResourceList
->List
[0].PartialResourceList
.Version
= 1;
615 ResourceList
->List
[0].PartialResourceList
.Revision
= 1;
616 ResourceList
->List
[0].PartialResourceList
.Count
= NumAccessRanges
;
617 for (i
= 0; i
< NumAccessRanges
; i
++, AccessRanges
++)
619 PartialDescriptor
= &ResourceList
->List
[0].PartialResourceList
.PartialDescriptors
[i
];
620 if (AccessRanges
->RangeInIoSpace
)
622 PartialDescriptor
->Type
= CmResourceTypePort
;
623 PartialDescriptor
->u
.Port
.Start
= AccessRanges
->RangeStart
;
624 PartialDescriptor
->u
.Port
.Length
= AccessRanges
->RangeLength
;
628 PartialDescriptor
->Type
= CmResourceTypeMemory
;
629 PartialDescriptor
->u
.Memory
.Start
= AccessRanges
->RangeStart
;
630 PartialDescriptor
->u
.Memory
.Length
= AccessRanges
->RangeLength
;
632 if (AccessRanges
->RangeShareable
)
633 PartialDescriptor
->ShareDisposition
= CmResourceShareShared
;
635 PartialDescriptor
->ShareDisposition
= CmResourceShareDeviceExclusive
;
636 PartialDescriptor
->Flags
= 0;
637 if (AccessRanges
->RangePassive
& VIDEO_RANGE_PASSIVE_DECODE
)
638 PartialDescriptor
->Flags
|= CM_RESOURCE_PORT_PASSIVE_DECODE
;
639 if (AccessRanges
->RangePassive
& VIDEO_RANGE_10_BIT_DECODE
)
640 PartialDescriptor
->Flags
|= CM_RESOURCE_PORT_10_BIT_DECODE
;
643 /* Try to acquire all resource ranges */
644 Status
= IoReportResourceForDetection(
645 DeviceExtension
->DriverObject
,
646 NULL
, 0, /* Driver List */
647 DeviceExtension
->PhysicalDeviceObject
,
648 ResourceList
, ResourceListSize
,
650 ExFreePool(ResourceList
);
652 if (!NT_SUCCESS(Status
) || ConflictDetected
)
653 return ERROR_INVALID_PARAMETER
;
663 VideoPortGetDeviceData(
664 IN PVOID HwDeviceExtension
,
665 IN VIDEO_DEVICE_DATA_TYPE DeviceDataType
,
666 IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine
,
669 DPRINT("VideoPortGetDeviceData\n");
671 return ERROR_CALL_NOT_IMPLEMENTED
;
679 VideoPortAllocatePool(
680 IN PVOID HwDeviceExtension
,
681 IN VP_POOL_TYPE PoolType
,
682 IN SIZE_T NumberOfBytes
,
685 DPRINT("VideoPortAllocatePool\n");
686 return ExAllocatePoolWithTag(PoolType
, NumberOfBytes
, Tag
);
695 IN PVOID HwDeviceExtension
,
706 VideoPortAllocateBuffer(
707 IN PVOID HwDeviceExtension
,
711 DPRINT("VideoPortAllocateBuffer\n");
712 *Buffer
= ExAllocatePool(PagedPool
, Size
);
713 return *Buffer
== NULL
? ERROR_NOT_ENOUGH_MEMORY
: NO_ERROR
;
721 VideoPortReleaseBuffer(
722 IN PVOID HwDeviceExtension
,
725 DPRINT("VideoPortReleaseBuffer\n");
735 IN PVOID HwDeviceExtension
,
736 IN PVOID BaseAddress
,
738 IN VP_LOCK_OPERATION Operation
)
740 DPRINT1("VideoPortLockBuffer: Unimplemented.\n");
749 VideoPortUnlockBuffer(
750 IN PVOID HwDeviceExtension
,
753 DPRINT1("VideoPortUnlockBuffer: Unimplemented.\n");
761 VideoPortSetTrappedEmulatorPorts(
762 IN PVOID HwDeviceExtension
,
763 IN ULONG NumAccessRanges
,
764 IN PVIDEO_ACCESS_RANGE AccessRange
)
766 DPRINT("VideoPortSetTrappedEmulatorPorts\n");
767 /* Should store the ranges in the device extension for use by ntvdm. */
777 IN PVOID HwDeviceExtension
,
778 IN BUS_DATA_TYPE BusDataType
,
784 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
786 DPRINT("VideoPortGetBusData\n");
788 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
790 if (BusDataType
!= Cmos
)
792 /* Legacy vs. PnP behaviour */
793 if (DeviceExtension
->PhysicalDeviceObject
!= NULL
)
794 SlotNumber
= DeviceExtension
->SystemIoSlotNumber
;
797 return HalGetBusDataByOffset(
799 DeviceExtension
->SystemIoBusNumber
,
812 IN PVOID HwDeviceExtension
,
813 IN BUS_DATA_TYPE BusDataType
,
819 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
821 DPRINT("VideoPortSetBusData\n");
823 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
825 if (BusDataType
!= Cmos
)
827 /* Legacy vs. PnP behaviour */
828 if (DeviceExtension
->PhysicalDeviceObject
!= NULL
)
829 SlotNumber
= DeviceExtension
->SystemIoSlotNumber
;
832 return HalSetBusDataByOffset(
834 DeviceExtension
->SystemIoBusNumber
,