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)
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
14 * - Fix HalGetBusDataByOffset() param 2 in most calls below
18 #include "../include/miniport.h"
26 NdisImmediateReadPciSlotInformation(
27 IN NDIS_HANDLE WrapperConfigurationContext
,
33 return HalGetBusDataByOffset (PCIConfiguration
, 0, SlotNumber
, Buffer
, Offset
, Length
);
42 NdisImmediateWritePciSlotInformation(
43 IN NDIS_HANDLE WrapperConfigurationContext
,
49 return HalSetBusDataByOffset (PCIConfiguration
, 0, SlotNumber
, Buffer
, Offset
, Length
);
58 NdisMPciAssignResources(
59 IN NDIS_HANDLE MiniportHandle
,
61 OUT PNDIS_RESOURCE_LIST
*AssignedResources
)
64 * - I think this is fundamentally broken
67 PCM_RESOURCE_LIST ResourceList
;
69 PLOGICAL_ADAPTER Adapter
= (PLOGICAL_ADAPTER
)MiniportHandle
;
72 Status
= HalAssignSlotResources (Adapter
->Miniport
->RegistryPath
,
74 Adapter
->Miniport
->DriverObject
,
80 if (!NT_SUCCESS (Status
))
82 *AssignedResources
= NULL
;
83 return NDIS_STATUS_FAILURE
;
86 *AssignedResources
= (PNDIS_RESOURCE_LIST
)&ResourceList
->List
[0].PartialResourceList
;
88 return NDIS_STATUS_SUCCESS
;
97 NdisMQueryAdapterResources(
98 OUT PNDIS_STATUS Status
,
99 IN NDIS_HANDLE WrapperConfigurationContext
,
100 OUT PNDIS_RESOURCE_LIST ResourceList
,
101 IN OUT PUINT BufferSize
)
103 * FUNCTION: returns a nic's hardware resources
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
110 * - Caller must allocate Status and ResourceList
111 * - Must be called at IRQL = PASSIVE_LEVEL;
113 * - Needs an implementation; for now i think we are waiting on pnp
117 ASSERT(Status
&& ResourceList
);
119 NDIS_DbgPrint(MIN_TRACE
, ("Unimplemented!\n"));
121 *Status
= STATUS_NOT_SUPPORTED
;
130 NdisQueryMapRegisterCount(
131 IN NDIS_INTERFACE_TYPE BusType
,
132 OUT PUINT MapRegisterCount
)
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
139 return NDIS_STATUS_NOT_SUPPORTED
;
148 NdisReadEisaSlotInformation(
149 OUT PNDIS_STATUS Status
,
150 IN NDIS_HANDLE WrapperConfigurationContext
,
151 OUT PUINT SlotNumber
,
152 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData
)
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
)
179 NdisReadPciSlotInformation(
180 IN NDIS_HANDLE NdisAdapterHandle
,
186 return HalGetBusDataByOffset (PCIConfiguration
, 0, SlotNumber
, Buffer
, Offset
, Length
);
195 NdisWritePciSlotInformation(
196 IN NDIS_HANDLE NdisAdapterHandle
,
202 return HalSetBusDataByOffset (PCIConfiguration
, 0, SlotNumber
, Buffer
, Offset
, Length
);