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