fpvigx: more changes for multiprocessor support

This commit is contained in:
Rairii
2025-05-21 17:24:02 +01:00
parent c5be079465
commit b81cae3d77

View File

@@ -932,6 +932,7 @@ VP_STATUS ViFindAdapter(PVOID HwDeviceExtension, PVOID HwContext, PWSTR Argument
if (SetupddLoaded) { if (SetupddLoaded) {
// Also initialise the timer and DPC. // Also initialise the timer and DPC.
KeInitializeDpc(&Extension->TimerDpc, FbpTimerCallback, Extension); KeInitializeDpc(&Extension->TimerDpc, FbpTimerCallback, Extension);
KeSetTargetProcessorDpc(&Extension->TimerDpc, 0);
KeInitializeTimer(&Extension->Timer); KeInitializeTimer(&Extension->Timer);
} else { } else {
// Allocate and map the bank buffer. Must be used uncached here as the physical page will get mapped elsewhere as uncached. // Allocate and map the bank buffer. Must be used uncached here as the physical page will get mapped elsewhere as uncached.
@@ -1464,12 +1465,21 @@ VP_STATUS ViStartIoImpl(PDEVICE_EXTENSION Extension, PVIDEO_REQUEST_PACKET Reque
} }
BOOLEAN ViStartIo(PVOID HwDeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket) { BOOLEAN ViStartIo(PVOID HwDeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket) {
// This code must run on CPU 0.
KAFFINITY OldAffinity = KeSetAffinityThread(PsGetCurrentThread(), 1);
PDEVICE_EXTENSION Extension = (PDEVICE_EXTENSION)HwDeviceExtension; PDEVICE_EXTENSION Extension = (PDEVICE_EXTENSION)HwDeviceExtension;
RequestPacket->StatusBlock->Status = ViStartIoImpl(Extension, RequestPacket); RequestPacket->StatusBlock->Status = ViStartIoImpl(Extension, RequestPacket);
// Switch affinity back to what it was.
KeSetAffinityThread(PsGetCurrentThread(), OldAffinity);
return TRUE; return TRUE;
} }
NTSTATUS DriverEntry(PVOID DriverObject, PVOID RegistryPath) { NTSTATUS DriverEntry(PVOID DriverObject, PVOID RegistryPath) {
// This code must run on CPU 0.
KAFFINITY OldAffinity = KeSetAffinityThread(PsGetCurrentThread(), 1);
VIDEO_HW_INITIALIZATION_DATA InitData; VIDEO_HW_INITIALIZATION_DATA InitData;
RtlZeroMemory(&InitData, sizeof(InitData)); RtlZeroMemory(&InitData, sizeof(InitData));
@@ -1486,5 +1496,8 @@ NTSTATUS DriverEntry(PVOID DriverObject, PVOID RegistryPath) {
// Our HAL(s) configure VMEBus to be equal to Internal, nothing else uses it. // Our HAL(s) configure VMEBus to be equal to Internal, nothing else uses it.
InitData.AdapterInterfaceType = VMEBus; InitData.AdapterInterfaceType = VMEBus;
NTSTATUS Status = VideoPortInitialize(DriverObject, RegistryPath, &InitData, NULL); NTSTATUS Status = VideoPortInitialize(DriverObject, RegistryPath, &InitData, NULL);
// Switch affinity back to what it was.
KeSetAffinityThread(PsGetCurrentThread(), OldAffinity);
return Status; return Status;
} }