1 /* 2 * PROJECT: ReactOS PCI Bus Driver 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: drivers/bus/pci/arb/ar_busno.c 5 * PURPOSE: Bus Number Arbitration 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 /* INCLUDES *******************************************************************/ 10 11 #include <pci.h> 12 13 #define NDEBUG 14 #include <debug.h> 15 16 /* GLOBALS ********************************************************************/ 17 18 PCI_INTERFACE ArbiterInterfaceBusNumber = 19 { 20 &GUID_ARBITER_INTERFACE_STANDARD, 21 sizeof(ARBITER_INTERFACE), 22 0, 23 0, 24 PCI_INTERFACE_FDO, 25 0, 26 PciArb_BusNumber, 27 arbusno_Constructor, 28 arbusno_Initializer 29 }; 30 31 /* FUNCTIONS ******************************************************************/ 32 33 NTSTATUS 34 NTAPI 35 arbusno_Initializer(IN PVOID Instance) 36 { 37 PPCI_ARBITER_INSTANCE Arbiter = Instance; 38 PPCI_FDO_EXTENSION FdoExtension; 39 NTSTATUS Status; 40 41 PAGED_CODE(); 42 43 RtlZeroMemory(&Arbiter->CommonInstance, sizeof(Arbiter->CommonInstance)); 44 45 FdoExtension = Arbiter->BusFdoExtension; 46 47 /* Not yet implemented */ 48 UNIMPLEMENTED; 49 50 #if 0 51 Arbiter->CommonInstance.UnpackRequirement = arbusno_UnpackRequirement; 52 Arbiter->CommonInstance.PackResource = arbusno_PackResource; 53 Arbiter->CommonInstance.UnpackResource = arbusno_UnpackResource; 54 Arbiter->CommonInstance.ScoreRequirement = arbusno_ScoreRequirement; 55 #endif 56 57 Status = ArbInitializeArbiterInstance(&Arbiter->CommonInstance, 58 FdoExtension->FunctionalDeviceObject, 59 CmResourceTypeBusNumber, 60 Arbiter->InstanceName, 61 L"Pci", 62 NULL); 63 if (!NT_SUCCESS(Status)) 64 { 65 DPRINT1("arbusno_Initializer: init arbiter return %X", Status); 66 } 67 68 return Status; 69 } 70 71 NTSTATUS 72 NTAPI 73 arbusno_Constructor(IN PVOID DeviceExtension, 74 IN PVOID PciInterface, 75 IN PVOID InterfaceData, 76 IN USHORT Version, 77 IN USHORT Size, 78 IN PINTERFACE Interface) 79 { 80 PPCI_FDO_EXTENSION FdoExtension = (PPCI_FDO_EXTENSION)DeviceExtension; 81 NTSTATUS Status; 82 PAGED_CODE(); 83 84 UNREFERENCED_PARAMETER(PciInterface); 85 UNREFERENCED_PARAMETER(Version); 86 UNREFERENCED_PARAMETER(Size); 87 UNREFERENCED_PARAMETER(Interface); 88 89 /* Make sure it's the expected interface */ 90 if ((ULONG_PTR)InterfaceData != CmResourceTypeBusNumber) 91 { 92 /* Arbiter support must have been initialized first */ 93 if (FdoExtension->ArbitersInitialized) 94 { 95 /* Not yet implemented */ 96 UNIMPLEMENTED; 97 while (TRUE); 98 } 99 else 100 { 101 /* No arbiters for this FDO */ 102 Status = STATUS_NOT_SUPPORTED; 103 } 104 } 105 else 106 { 107 /* Not the right interface */ 108 Status = STATUS_INVALID_PARAMETER_5; 109 } 110 111 /* Return the status */ 112 return Status; 113 } 114 115 /* EOF */ 116