ReactOS 0.4.16-dev-197-g92996da
hardware.c File Reference
#include "ndissys.h"
Include dependency graph for hardware.c:

Go to the source code of this file.

Functions

ULONG EXPORT NdisImmediateReadPciSlotInformation (IN NDIS_HANDLE WrapperConfigurationContext, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
ULONG EXPORT NdisImmediateWritePciSlotInformation (IN NDIS_HANDLE WrapperConfigurationContext, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
NDIS_STATUS EXPORT NdisMPciAssignResources (IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG SlotNumber, OUT PNDIS_RESOURCE_LIST *AssignedResources)
 
NDIS_STATUS EXPORT NdisPciAssignResources (IN NDIS_HANDLE NdisMacHandle, IN NDIS_HANDLE NdisWrapperHandle, IN NDIS_HANDLE WrapperConfigurationContext, IN ULONG SlotNumber, OUT PNDIS_RESOURCE_LIST *AssignedResources)
 
VOID EXPORT NdisMQueryAdapterResources (OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
 
NDIS_STATUS EXPORT NdisQueryMapRegisterCount (IN NDIS_INTERFACE_TYPE BusType, OUT PUINT MapRegisterCount)
 
ULONG EXPORT NdisReadPciSlotInformation (IN NDIS_HANDLE NdisAdapterHandle, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
ULONG EXPORT NdisWritePciSlotInformation (IN NDIS_HANDLE NdisAdapterHandle, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
VOID EXPORT NdisReadEisaSlotInformation (OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PUINT SlotNumber, OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData)
 
ULONG EXPORT NdisReadPcmciaAttributeMemory (IN NDIS_HANDLE NdisAdapterHandle, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
ULONG EXPORT NdisWritePcmciaAttributeMemory (IN NDIS_HANDLE NdisAdapterHandle, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
 
VOID EXPORT NdisOverrideBusNumber (IN NDIS_HANDLE WrapperConfigurationContext, IN NDIS_HANDLE MiniportAdapterHandle OPTIONAL, IN ULONG BusNumber)
 

Function Documentation

◆ NdisImmediateReadPciSlotInformation()

ULONG EXPORT NdisImmediateReadPciSlotInformation ( IN NDIS_HANDLE  WrapperConfigurationContext,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 22 of file hardware.c.

28{
30 /* Slot number is ignored. */
31 return HalGetBusDataByOffset(PCIConfiguration, WrapperContext->BusNumber,
32 WrapperContext->SlotNumber, Buffer, Offset, Length);
33}
Definition: bufpool.h:45
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT
ULONG NTAPI HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:73
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3946
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ PCIConfiguration
Definition: miniport.h:93

◆ NdisImmediateWritePciSlotInformation()

ULONG EXPORT NdisImmediateWritePciSlotInformation ( IN NDIS_HANDLE  WrapperConfigurationContext,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 40 of file hardware.c.

46{
48 /* Slot number is ignored. */
49 return HalSetBusDataByOffset(PCIConfiguration, WrapperContext->BusNumber,
50 WrapperContext->SlotNumber, Buffer, Offset, Length);
51}
ULONG NTAPI HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: bus.c:123

◆ NdisMPciAssignResources()

NDIS_STATUS EXPORT NdisMPciAssignResources ( IN NDIS_HANDLE  MiniportAdapterHandle,
IN ULONG  SlotNumber,
OUT PNDIS_RESOURCE_LIST AssignedResources 
)

Definition at line 58 of file hardware.c.

62{
64
66 Adapter->NdisMiniportBlock.AllocatedResources == NULL)
67 {
68 NDIS_DbgPrint(MIN_TRACE, ("Bad bus type or no resources\n"));
69 *AssignedResources = NULL;
71 }
72
73 *AssignedResources = &Adapter->NdisMiniportBlock.AllocatedResources->List[0].PartialResourceList;
74
76}
#define MIN_TRACE
Definition: debug.h:14
#define NULL
Definition: types.h:112
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
@ NdisInterfacePci
Definition: ndis.h:905
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
NDIS_INTERFACE_TYPE BusType
Definition: ndis.h:2550

Referenced by NdisPciAssignResources().

◆ NdisMQueryAdapterResources()

VOID EXPORT NdisMQueryAdapterResources ( OUT PNDIS_STATUS  Status,
IN NDIS_HANDLE  WrapperConfigurationContext,
OUT PNDIS_RESOURCE_LIST  ResourceList,
IN OUT PUINT  BufferSize 
)

Definition at line 103 of file hardware.c.

119{
121 PLOGICAL_ADAPTER Adapter = WrapperContext->DeviceObject->DeviceExtension;
122 ULONG ResourceListSize;
123
124 PAGED_CODE();
125 ASSERT((Status && ResourceList) || (BufferSize && *BufferSize == 0));
126
127 NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
128
129 if (Adapter->NdisMiniportBlock.AllocatedResources == NULL)
130 {
131 NDIS_DbgPrint(MIN_TRACE, ("No allocated resources!\n"));
133 return;
134 }
135
136 ResourceListSize =
137 FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
138 Adapter->NdisMiniportBlock.AllocatedResources->List[0].PartialResourceList.Count *
140
141 if (*BufferSize >= ResourceListSize)
142 {
144 &Adapter->NdisMiniportBlock.AllocatedResources->List[0].PartialResourceList,
145 ResourceListSize);
146 *BufferSize = ResourceListSize;
148 }
149 else
150 {
151 *BufferSize = ResourceListSize;
153 }
154}
#define PAGED_CODE()
#define MAX_TRACE
Definition: debug.h:16
Status
Definition: gdiplustypes.h:25
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
#define ASSERT(a)
Definition: mode.c:44
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT DeviceObject
Definition: miniport.h:79
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by DcInitializeAdapterResources(), MiniportInitialize(), MiQueryResources(), NvNetInitializeAdapterResources(), and ParaNdis5_Initialize().

◆ NdisOverrideBusNumber()

VOID EXPORT NdisOverrideBusNumber ( IN NDIS_HANDLE  WrapperConfigurationContext,
IN NDIS_HANDLE MiniportAdapterHandle  OPTIONAL,
IN ULONG  BusNumber 
)

Definition at line 326 of file hardware.c.

336{
339
340 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
341
342 Wrapper->BusNumber = BusNumber;
343
344 if (Adapter)
346}
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

◆ NdisPciAssignResources()

NDIS_STATUS EXPORT NdisPciAssignResources ( IN NDIS_HANDLE  NdisMacHandle,
IN NDIS_HANDLE  NdisWrapperHandle,
IN NDIS_HANDLE  WrapperConfigurationContext,
IN ULONG  SlotNumber,
OUT PNDIS_RESOURCE_LIST AssignedResources 
)

Definition at line 83 of file hardware.c.

89{
91 PLOGICAL_ADAPTER Adapter = WrapperContext->DeviceObject->DeviceExtension;
92
93 return NdisMPciAssignResources(Adapter,
95 AssignedResources);
96}
NDIS_STATUS EXPORT NdisMPciAssignResources(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG SlotNumber, OUT PNDIS_RESOURCE_LIST *AssignedResources)
Definition: hardware.c:58
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68

◆ NdisQueryMapRegisterCount()

NDIS_STATUS EXPORT NdisQueryMapRegisterCount ( IN NDIS_INTERFACE_TYPE  BusType,
OUT PUINT  MapRegisterCount 
)

Definition at line 162 of file hardware.c.

170{
172}
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479

◆ NdisReadEisaSlotInformation()

VOID EXPORT NdisReadEisaSlotInformation ( OUT PNDIS_STATUS  Status,
IN NDIS_HANDLE  WrapperConfigurationContext,
OUT PUINT  SlotNumber,
OUT PNDIS_EISA_FUNCTION_INFORMATION  EisaData 
)

Definition at line 219 of file hardware.c.

224{
226 ULONG Ret;
228
229 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
230
231 /* We are called only at PASSIVE_LEVEL */
233 if (!Buffer) {
234 NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
236 return;
237 }
238
240 Wrapper->BusNumber,
241 Wrapper->SlotNumber,
242 Buffer,
244
245 if (Ret == 0 || Ret == 2) {
246 NDIS_DbgPrint(MIN_TRACE, ("HalGetBusData failed.\n"));
249 return;
250 }
251
252 *SlotNumber = Wrapper->SlotNumber;
253
255
257
259}
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
@ EisaConfiguration
Definition: miniport.h:90

◆ NdisReadPciSlotInformation()

ULONG EXPORT NdisReadPciSlotInformation ( IN NDIS_HANDLE  NdisAdapterHandle,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 180 of file hardware.c.

186{
187 PLOGICAL_ADAPTER Adapter = NdisAdapterHandle;
188 /* Slot number is ignored since W2K for all NDIS drivers. */
190 Adapter->NdisMiniportBlock.BusNumber, Adapter->NdisMiniportBlock.SlotNumber,
192}

Referenced by DcPowerSave(), DcRecognizeHardware(), GetAdapterResources(), MiniportInitialize(), MiQueryCard(), NvNetRecognizeHardware(), and PCIReadConfig().

◆ NdisReadPcmciaAttributeMemory()

ULONG EXPORT NdisReadPcmciaAttributeMemory ( IN NDIS_HANDLE  NdisAdapterHandle,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 267 of file hardware.c.

278{
279 PLOGICAL_ADAPTER Adapter = NdisAdapterHandle;
280
281 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
282
285 Adapter->NdisMiniportBlock.SlotNumber,
286 Buffer,
287 Offset,
288 Length);
289}
@ PCMCIAConfiguration
Definition: miniport.h:96

◆ NdisWritePciSlotInformation()

ULONG EXPORT NdisWritePciSlotInformation ( IN NDIS_HANDLE  NdisAdapterHandle,
IN ULONG  SlotNumber,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 199 of file hardware.c.

205{
206 PLOGICAL_ADAPTER Adapter = NdisAdapterHandle;
207 /* Slot number is ignored since W2K for all NDIS drivers. */
209 Adapter->NdisMiniportBlock.BusNumber, Adapter->NdisMiniportBlock.SlotNumber,
211}

Referenced by DcPowerSave(), and MiQueryCard().

◆ NdisWritePcmciaAttributeMemory()

ULONG EXPORT NdisWritePcmciaAttributeMemory ( IN NDIS_HANDLE  NdisAdapterHandle,
IN ULONG  Offset,
IN PVOID  Buffer,
IN ULONG  Length 
)

Definition at line 297 of file hardware.c.

308{
309 PLOGICAL_ADAPTER Adapter = NdisAdapterHandle;
310
311 NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
312
315 Adapter->NdisMiniportBlock.SlotNumber,
316 Buffer,
317 Offset,
318 Length);
319}