ReactOS  0.4.13-dev-982-g9853eab
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 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT

◆ 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 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT
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 
65  if (Adapter->NdisMiniportBlock.BusType != NdisInterfacePci ||
66  Adapter->NdisMiniportBlock.AllocatedResources == NULL)
67  {
68  NDIS_DbgPrint(MIN_TRACE, ("Bad bus type or no resources\n"));
69  *AssignedResources = NULL;
70  return NDIS_STATUS_FAILURE;
71  }
72 
73  *AssignedResources = &Adapter->NdisMiniportBlock.AllocatedResources->List[0].PartialResourceList;
74 
75  return NDIS_STATUS_SUCCESS;
76 }
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
smooth NULL
Definition: ftsmooth.c:416
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define MIN_TRACE
Definition: debug.h:14
NDIS_INTERFACE_TYPE BusType
Definition: ndis.h:2550
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465

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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
#define PAGED_CODE()
Definition: video.h:57
PDEVICE_OBJECT DeviceObject
Definition: miniport.h:79
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
#define BufferSize
Definition: classpnp.h:419
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
Status
Definition: gdiplustypes.h:24
#define MAX_TRACE
Definition: debug.h:16
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465

Referenced by MiniportInitialize(), and MiQueryResources().

◆ 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_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

◆ 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,
94  SlotNumber,
95  AssignedResources);
96 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
PDEVICE_OBJECT DeviceObject
Definition: miniport.h:79
PVOID DeviceExtension
Definition: env_spec_w32.h:418
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
NDIS_STATUS EXPORT NdisMPciAssignResources(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG SlotNumber, OUT PNDIS_RESOURCE_LIST *AssignedResources)
Definition: hardware.c:58
struct _NDIS_WRAPPER_CONTEXT * PNDIS_WRAPPER_CONTEXT

◆ 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;
227  PVOID Buffer;
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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
Definition: bufpool.h:45
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
Status
Definition: gdiplustypes.h:24
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ 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,
191  Buffer, Offset, Length);
192 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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

Referenced by MiniportInitialize(), and MiQueryCard().

◆ 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 
284  Adapter->NdisMiniportBlock.BusNumber,
285  Adapter->NdisMiniportBlock.SlotNumber,
286  Buffer,
287  Offset,
288  Length);
289 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40

◆ 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,
210  Buffer, Offset, Length);
211 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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

Referenced by 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 
314  Adapter->NdisMiniportBlock.BusNumber,
315  Adapter->NdisMiniportBlock.SlotNumber,
316  Buffer,
317  Offset,
318  Length);
319 }
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
NDIS_MINIPORT_BLOCK NdisMiniportBlock
Definition: miniport.h:89
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define MAX_TRACE
Definition: debug.h:16
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
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