1 /* 2 * PROJECT: ReactOS ISA PnP Bus driver 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Driver interface 5 * COPYRIGHT: Copyright 2021 Dmitry Borisov <di.sean@protonmail.com> 6 */ 7 8 /* INCLUDES *******************************************************************/ 9 10 #include "isapnp.h" 11 12 #define NDEBUG 13 #include <debug.h> 14 15 /* FUNCTIONS ******************************************************************/ 16 17 CODE_SEG("PAGE") 18 NTSTATUS 19 IsaFdoQueryInterface( 20 _In_ PISAPNP_FDO_EXTENSION FdoExt, 21 _In_ PIO_STACK_LOCATION IrpSp) 22 { 23 PAGED_CODE(); 24 25 if (IsEqualGUIDAligned(IrpSp->Parameters.QueryInterface.InterfaceType, 26 &GUID_TRANSLATOR_INTERFACE_STANDARD)) 27 { 28 NTSTATUS Status; 29 CM_RESOURCE_TYPE ResourceType; 30 ULONG ParentBusType, ParentBusNumber, Dummy; 31 32 ResourceType = PtrToUlong(IrpSp->Parameters.QueryInterface.InterfaceSpecificData); 33 34 if (IrpSp->Parameters.QueryInterface.Size < sizeof(TRANSLATOR_INTERFACE) || 35 ResourceType != CmResourceTypeInterrupt) 36 { 37 return STATUS_NOT_SUPPORTED; 38 } 39 40 Status = IoGetDeviceProperty(FdoExt->Pdo, 41 DevicePropertyLegacyBusType, 42 sizeof(ParentBusType), 43 &ParentBusType, 44 &Dummy); 45 if (!NT_SUCCESS(Status)) 46 { 47 DPRINT1("BusType request failed with status 0x%08lx\n", Status); 48 return Status; 49 } 50 51 Status = IoGetDeviceProperty(FdoExt->Pdo, 52 DevicePropertyBusNumber, 53 sizeof(ParentBusNumber), 54 &ParentBusNumber, 55 &Dummy); 56 if (!NT_SUCCESS(Status)) 57 { 58 DPRINT1("BusNumber request failed with status 0x%08lx\n", Status); 59 return Status; 60 } 61 62 return HalGetInterruptTranslator(ParentBusType, 63 ParentBusNumber, 64 Isa, 65 IrpSp->Parameters.QueryInterface.Size, 66 IrpSp->Parameters.QueryInterface.Version, 67 (PTRANSLATOR_INTERFACE)IrpSp-> 68 Parameters.QueryInterface.Interface, 69 &ParentBusNumber); 70 } 71 72 return STATUS_NOT_SUPPORTED; 73 } 74