Changes to support the 3Com 3c90x ndis5 driver and other bugfixes:
[reactos.git] / reactos / drivers / net / ndis / ndis / hardware.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndis/hardware.c
5 * PURPOSE: Hardware related routines
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Vizzini (vizzini@plasmic.com)
8 * REVISIONS:
9 * CSH 01/08-2000 Created
10 * 25 Aug 2003 Vizzini - NDIS4/5 and PnP additions
11 * 3 Oct 2003 Vizzini - formatting and minor bugfixes
12 *
13 * TODO:
14 * - Fix HalGetBusDataByOffset() param 2 in most calls below
15 */
16 #include <ndis.h>
17 #include <ndissys.h>
18 #include "../include/miniport.h"
19
20 \f
21 /*
22 * @implemented
23 */
24 ULONG
25 EXPORT
26 NdisImmediateReadPciSlotInformation(
27 IN NDIS_HANDLE WrapperConfigurationContext,
28 IN ULONG SlotNumber,
29 IN ULONG Offset,
30 IN PVOID Buffer,
31 IN ULONG Length)
32 {
33 return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
34 }
35
36 \f
37 /*
38 * @implemented
39 */
40 ULONG
41 EXPORT
42 NdisImmediateWritePciSlotInformation(
43 IN NDIS_HANDLE WrapperConfigurationContext,
44 IN ULONG SlotNumber,
45 IN ULONG Offset,
46 IN PVOID Buffer,
47 IN ULONG Length)
48 {
49 return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
50 }
51
52 \f
53 /*
54 * @implemented
55 */
56 NDIS_STATUS
57 EXPORT
58 NdisMPciAssignResources(
59 IN NDIS_HANDLE MiniportHandle,
60 IN ULONG SlotNumber,
61 OUT PNDIS_RESOURCE_LIST *AssignedResources)
62 /*
63 * NOTES:
64 * - I think this is fundamentally broken
65 */
66 {
67 PCM_RESOURCE_LIST ResourceList;
68 NTSTATUS Status;
69 PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportHandle;
70
71 ResourceList = NULL;
72 Status = HalAssignSlotResources (Adapter->Miniport->RegistryPath,
73 0,
74 Adapter->Miniport->DriverObject,
75 0,
76 PCIBus,
77 Adapter->BusNumber,
78 SlotNumber,
79 &ResourceList);
80 if (!NT_SUCCESS (Status))
81 {
82 *AssignedResources = NULL;
83 return NDIS_STATUS_FAILURE;
84 }
85
86 *AssignedResources = (PNDIS_RESOURCE_LIST)&ResourceList->List[0].PartialResourceList;
87
88 return NDIS_STATUS_SUCCESS;
89 }
90
91 \f
92 /*
93 * @implemented
94 */
95 VOID
96 EXPORT
97 NdisMQueryAdapterResources(
98 OUT PNDIS_STATUS Status,
99 IN NDIS_HANDLE WrapperConfigurationContext,
100 OUT PNDIS_RESOURCE_LIST ResourceList,
101 IN OUT PUINT BufferSize)
102 /*
103 * FUNCTION: returns a nic's hardware resources
104 * ARGUMENTS:
105 * Status: on return, contains the status of the operation
106 * WrapperConfigurationContext: handle input to MiniportInitialize
107 * ResourceList: on return, contains the list of resources for the nic
108 * BufferSize: size of ResourceList
109 * NOTES:
110 * - Caller must allocate Status and ResourceList
111 * - Must be called at IRQL = PASSIVE_LEVEL;
112 * BUGS:
113 * - Needs an implementation; for now i think we are waiting on pnp
114 */
115 {
116 PAGED_CODE();
117 ASSERT(Status && ResourceList);
118
119 NDIS_DbgPrint(MIN_TRACE, ("Unimplemented!\n"));
120
121 *Status = STATUS_NOT_SUPPORTED;
122 }
123
124
125 /*
126 * @implemented
127 */
128 NDIS_STATUS
129 EXPORT
130 NdisQueryMapRegisterCount(
131 IN NDIS_INTERFACE_TYPE BusType,
132 OUT PUINT MapRegisterCount)
133 /*
134 * On X86 (and all other current hardware), map registers aren't real hardware,
135 * and there is no real limit to the number that can be allocated.
136 * As such, we do what microsoft does on the x86 hals and return as follows
137 */
138 {
139 return NDIS_STATUS_NOT_SUPPORTED;
140 }
141
142 \f
143 /*
144 * @unimplemented
145 */
146 VOID
147 EXPORT
148 NdisReadEisaSlotInformation(
149 OUT PNDIS_STATUS Status,
150 IN NDIS_HANDLE WrapperConfigurationContext,
151 OUT PUINT SlotNumber,
152 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData)
153 {
154 UNIMPLEMENTED
155 }
156
157
158 /*
159 * @unimplemented
160 */
161 VOID
162 EXPORT
163 NdisReadEisaSlotInformationEx(
164 OUT PNDIS_STATUS Status,
165 IN NDIS_HANDLE WrapperConfigurationContext,
166 OUT PUINT SlotNumber,
167 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
168 OUT PUINT NumberOfFunctions)
169 {
170 UNIMPLEMENTED
171 }
172
173
174 /*
175 * @implemented
176 */
177 ULONG
178 EXPORT
179 NdisReadPciSlotInformation(
180 IN NDIS_HANDLE NdisAdapterHandle,
181 IN ULONG SlotNumber,
182 IN ULONG Offset,
183 IN PVOID Buffer,
184 IN ULONG Length)
185 {
186 return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
187 }
188
189 \f
190 /*
191 * @implemented
192 */
193 ULONG
194 EXPORT
195 NdisWritePciSlotInformation(
196 IN NDIS_HANDLE NdisAdapterHandle,
197 IN ULONG SlotNumber,
198 IN ULONG Offset,
199 IN PVOID Buffer,
200 IN ULONG Length)
201 {
202 return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
203 }
204
205 /* EOF */
206