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_memiono.c 5 * PURPOSE: Memory and I/O Port Resource 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 ArbiterInterfaceMemory = 19 { 20 &GUID_ARBITER_INTERFACE_STANDARD, 21 sizeof(ARBITER_INTERFACE), 22 0, 23 0, 24 PCI_INTERFACE_FDO, 25 0, 26 PciArb_Memory, 27 armem_Constructor, 28 armem_Initializer 29 }; 30 31 PCI_INTERFACE ArbiterInterfaceIo = 32 { 33 &GUID_ARBITER_INTERFACE_STANDARD, 34 sizeof(ARBITER_INTERFACE), 35 0, 36 0, 37 PCI_INTERFACE_FDO, 38 0, 39 PciArb_Io, 40 ario_Constructor, 41 ario_Initializer 42 }; 43 44 /* FUNCTIONS ******************************************************************/ 45 46 NTSTATUS 47 NTAPI 48 ario_Initializer(IN PVOID Instance) 49 { 50 UNREFERENCED_PARAMETER(Instance); 51 52 /* Not yet implemented */ 53 UNIMPLEMENTED; 54 //while (TRUE); 55 return STATUS_SUCCESS; 56 } 57 58 NTSTATUS 59 NTAPI 60 ario_Constructor(IN PVOID DeviceExtension, 61 IN PVOID PciInterface, 62 IN PVOID InterfaceData, 63 IN USHORT Version, 64 IN USHORT Size, 65 IN PINTERFACE Interface) 66 { 67 PPCI_FDO_EXTENSION FdoExtension = (PPCI_FDO_EXTENSION)DeviceExtension; 68 NTSTATUS Status; 69 PAGED_CODE(); 70 71 UNREFERENCED_PARAMETER(PciInterface); 72 UNREFERENCED_PARAMETER(Version); 73 UNREFERENCED_PARAMETER(Size); 74 UNREFERENCED_PARAMETER(Interface); 75 76 /* Make sure it's the expected interface */ 77 if ((ULONG_PTR)InterfaceData != CmResourceTypePort) 78 { 79 /* Arbiter support must have been initialized first */ 80 if (FdoExtension->ArbitersInitialized) 81 { 82 /* Not yet implemented */ 83 UNIMPLEMENTED; 84 while (TRUE); 85 } 86 else 87 { 88 /* No arbiters for this FDO */ 89 Status = STATUS_NOT_SUPPORTED; 90 } 91 } 92 else 93 { 94 /* Not the right interface */ 95 Status = STATUS_INVALID_PARAMETER_5; 96 } 97 98 /* Return the status */ 99 return Status; 100 } 101 102 VOID 103 NTAPI 104 ario_ApplyBrokenVideoHack(IN PPCI_FDO_EXTENSION FdoExtension) 105 { 106 PPCI_ARBITER_INSTANCE PciArbiter; 107 //PARBITER_INSTANCE CommonInstance; 108 //NTSTATUS Status; 109 110 /* Only valid for root FDOs who are being applied the hack for the first time */ 111 ASSERT(!FdoExtension->BrokenVideoHackApplied); 112 ASSERT(PCI_IS_ROOT_FDO(FdoExtension)); 113 114 /* Find the I/O arbiter */ 115 PciArbiter = (PVOID)PciFindNextSecondaryExtension(FdoExtension-> 116 SecondaryExtension.Next, 117 PciArb_Io); 118 ASSERT(PciArbiter); 119 #if 0 // when arb exist 120 /* Get the Arb instance */ 121 CommonInstance = &PciArbiter->CommonInstance; 122 123 /* Free the two lists, enabling full VGA access */ 124 ArbFreeOrderingList(&CommonInstance->OrderingList); 125 ArbFreeOrderingList(&CommonInstance->ReservedList); 126 127 /* Build the ordering for broken video PCI access */ 128 Status = ArbBuildAssignmentOrdering(CommonInstance, 129 L"Pci", 130 L"BrokenVideo", 131 NULL); 132 ASSERT(NT_SUCCESS(Status)); 133 #else 134 //Status = STATUS_SUCCESS; 135 UNIMPLEMENTED; 136 while (TRUE); 137 #endif 138 /* Now the hack has been applied */ 139 FdoExtension->BrokenVideoHackApplied = TRUE; 140 } 141 142 NTSTATUS 143 NTAPI 144 armem_Initializer(IN PVOID Instance) 145 { 146 UNREFERENCED_PARAMETER(Instance); 147 148 /* Not yet implemented */ 149 UNIMPLEMENTED; 150 //while (TRUE); 151 return STATUS_SUCCESS; 152 } 153 154 NTSTATUS 155 NTAPI 156 armem_Constructor(IN PVOID DeviceExtension, 157 IN PVOID PciInterface, 158 IN PVOID InterfaceData, 159 IN USHORT Version, 160 IN USHORT Size, 161 IN PINTERFACE Interface) 162 { 163 PPCI_FDO_EXTENSION FdoExtension = (PPCI_FDO_EXTENSION)DeviceExtension; 164 NTSTATUS Status; 165 PAGED_CODE(); 166 167 UNREFERENCED_PARAMETER(PciInterface); 168 UNREFERENCED_PARAMETER(Version); 169 UNREFERENCED_PARAMETER(Size); 170 UNREFERENCED_PARAMETER(Interface); 171 172 /* Make sure it's the expected interface */ 173 if ((ULONG_PTR)InterfaceData != CmResourceTypeMemory) 174 { 175 /* Arbiter support must have been initialized first */ 176 if (FdoExtension->ArbitersInitialized) 177 { 178 /* Not yet implemented */ 179 UNIMPLEMENTED; 180 while (TRUE); 181 } 182 else 183 { 184 /* No arbiters for this FDO */ 185 Status = STATUS_NOT_SUPPORTED; 186 } 187 } 188 else 189 { 190 /* Not the right interface */ 191 Status = STATUS_INVALID_PARAMETER_5; 192 } 193 194 /* Return the status */ 195 return Status; 196 } 197 198 /* EOF */ 199