ReactOS  0.4.13-dev-982-g9853eab
nic.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Intel PRO/1000 Driver
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Hardware specific functions
5  * COPYRIGHT: 2013 Cameron Gutman (cameron.gutman@reactos.org)
6  * 2018 Mark Jansen (mark.jansen@reactos.org)
7  * 2019 Victor Perevertkin (victor.perevertkin@reactos.org)
8  */
9 
10 #ifndef _E1000_PCH_
11 #define _E1000_PCH_
12 
13 #include <ndis.h>
14 
15 #include "e1000hw.h"
16 
17 #define E1000_TAG '001e'
18 
19 #define MAXIMUM_FRAME_SIZE 1522
20 #define RECEIVE_BUFFER_SIZE 2048
21 
22 #define DRIVER_VERSION 1
23 
24 #define DEFAULT_INTERRUPT_MASK (E1000_IMS_LSC | E1000_IMS_TXDW | E1000_IMS_TXQE | E1000_IMS_RXDMT0 | E1000_IMS_RXT0 | E1000_IMS_TXD_LOW)
25 
26 
27 typedef struct _E1000_ADAPTER
28 {
29  // NDIS_SPIN_LOCK AdapterLock;
30 
36 
38  struct {
41 
45 
46  /* Io Port */
49  volatile PUCHAR IoPort;
50 
51  /* NIC Memory */
54  volatile PUCHAR IoBase;
55 
56  /* Interrupt */
61 
64 
67 
68 
69  /* Transmit */
72 
74 
78 
79 
80  /* Receive */
83 
88 
90 
91 
92 BOOLEAN
93 NTAPI
95  IN PE1000_ADAPTER Adapter);
96 
98 NTAPI
100  IN PE1000_ADAPTER Adapter,
102 
104 NTAPI
106  IN PE1000_ADAPTER Adapter);
107 
109 NTAPI
111  IN PE1000_ADAPTER Adapter);
112 
114 NTAPI
116  IN PE1000_ADAPTER Adapter);
117 
119 NTAPI
121  IN PE1000_ADAPTER Adapter);
122 
124 NTAPI
125 NICPowerOn(
126  IN PE1000_ADAPTER Adapter);
127 
129 NTAPI
131  IN PE1000_ADAPTER Adapter);
132 
134 NTAPI
136  IN PE1000_ADAPTER Adapter);
137 
139 NTAPI
141  IN PE1000_ADAPTER Adapter);
142 
144 NTAPI
146  IN PE1000_ADAPTER Adapter,
147  OUT PUCHAR MacAddress);
148 
150 NTAPI
152  IN PE1000_ADAPTER Adapter);
153 
155 NTAPI
157  IN PE1000_ADAPTER Adapter);
158 
160 NTAPI
162  IN PE1000_ADAPTER Adapter);
163 
165 NTAPI
167  IN PE1000_ADAPTER Adapter);
168 
169 ULONG
170 NTAPI
172  IN PE1000_ADAPTER Adapter,
173  OUT PBOOLEAN InterruptRecognized);
174 
175 VOID
176 NTAPI
178  IN PE1000_ADAPTER Adapter);
179 
181 NTAPI
183  IN PE1000_ADAPTER Adapter,
185  IN ULONG Length);
186 
188 NTAPI
190  IN NDIS_HANDLE MiniportAdapterContext,
191  IN NDIS_OID Oid,
192  IN PVOID InformationBuffer,
193  IN ULONG InformationBufferLength,
195  OUT PULONG BytesNeeded);
196 
198 NTAPI
200  IN NDIS_HANDLE MiniportAdapterContext,
201  IN NDIS_OID Oid,
202  IN PVOID InformationBuffer,
203  IN ULONG InformationBufferLength,
205  OUT PULONG BytesNeeded);
206 
207 VOID
208 NTAPI
210  OUT PBOOLEAN InterruptRecognized,
211  OUT PBOOLEAN QueueMiniportHandleInterrupt,
212  IN NDIS_HANDLE MiniportAdapterContext);
213 
214 VOID
215 NTAPI
217  IN NDIS_HANDLE MiniportAdapterContext);
218 
219 
220 VOID
221 NTAPI
223  IN PE1000_ADAPTER Adapter,
224  IN ULONG Address,
225  OUT PULONG Value);
226 
227 VOID
228 NTAPI
230  IN PE1000_ADAPTER Adapter,
231  IN ULONG Address,
232  IN ULONG Value);
233 
234 #endif /* _E1000_PCH_ */
VOID NTAPI E1000WriteUlong(IN PE1000_ADAPTER Adapter, IN ULONG Address, IN ULONG Value)
Definition: hardware.c:65
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define IN
Definition: typedefs.h:38
#define MAXIMUM_MULTICAST_ADDRESSES
Definition: e1000hw.h:23
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
enum _E1000_RCVBUF_SIZE E1000_RCVBUF_SIZE
NDIS_STATUS NTAPI NICRegisterInterrupts(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:423
NDIS_STATUS NTAPI NICInitializeAdapterResources(IN PE1000_ADAPTER Adapter, IN PNDIS_RESOURCE_LIST ResourceList)
Definition: hardware.c:272
NDIS_STATUS NTAPI NICSoftReset(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:562
ULONG IoPortLength
Definition: nic.h:48
NDIS_PHYSICAL_ADDRESS ReceiveBufferPa
Definition: nic.h:86
NDIS_HANDLE AdapterHandle
Definition: nic.h:31
USHORT SubsystemVendorID
Definition: nic.h:35
PE1000_RECEIVE_DESCRIPTOR ReceiveDescriptors
Definition: nic.h:81
VOID NTAPI MiniportISR(OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:16
volatile PUCHAR IoPort
Definition: nic.h:49
volatile PUCHAR ReceiveBuffer
Definition: nic.h:85
unsigned char * PUCHAR
Definition: retypes.h:3
struct _E1000_ADAPTER * PE1000_ADAPTER
NDIS_PHYSICAL_ADDRESS ReceiveDescriptorsPa
Definition: nic.h:82
ULONG NDIS_OID
Definition: ntddndis.h:230
USHORT VendorID
Definition: nic.h:32
BOOLEAN InterruptShared
Definition: nic.h:59
USHORT SubsystemID
Definition: nic.h:34
#define NUM_TRANSMIT_DESCRIPTORS
Definition: e1000hw.h:108
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: nic.h:62
int NDIS_STATUS
Definition: ntddndis.h:471
BOOLEAN NTAPI NICRecognizeHardware(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:245
BOOLEAN InterruptRegistered
Definition: nic.h:63
ULONG PacketFilter
Definition: nic.h:44
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
long LONG
Definition: pedump.c:60
ULONG InterruptLevel
Definition: nic.h:58
LONG InterruptPending
Definition: nic.h:66
NDIS_STATUS NTAPI NICTransmitPacket(IN PE1000_ADAPTER Adapter, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG Length)
Definition: hardware.c:825
unsigned char BOOLEAN
static WCHAR Address[46]
Definition: ping.c:68
struct _E1000_ADAPTER::@970 MulticastList[MAXIMUM_MULTICAST_ADDRESSES]
NDIS_PHYSICAL_ADDRESS TransmitDescriptorsPa
Definition: nic.h:71
VOID NTAPI MiniportHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:40
ULONG MediaState
Definition: nic.h:43
ULONG IoLength
Definition: nic.h:53
NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
Definition: info.c:51
UCHAR MacAddress[IEEE_802_ADDR_LENGTH]
Definition: nic.h:39
NDIS_STATUS NTAPI NICReleaseIoResources(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:464
ULONG LinkSpeedMbps
Definition: nic.h:42
NDIS_STATUS NTAPI NICAllocateIoResources(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:340
#define IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
VOID NTAPI NICUpdateLinkStatus(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:808
ULONG LastTxDesc
Definition: nic.h:76
BOOLEAN TxFull
Definition: nic.h:77
ULONG InterruptVector
Definition: nic.h:57
UCHAR PermanentMacAddress[IEEE_802_ADDR_LENGTH]
Definition: nic.h:37
PE1000_TRANSMIT_DESCRIPTOR TransmitDescriptors
Definition: nic.h:70
NDIS_STATUS NTAPI NICEnableTxRx(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:605
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1060
unsigned char UCHAR
Definition: xmlstorage.h:181
char * PBOOLEAN
Definition: retypes.h:11
ULONG CurrentTxDesc
Definition: nic.h:75
NDIS_STATUS NTAPI NICDisableInterrupts(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:779
ULONG ReceiveBufferEntrySize
Definition: nic.h:87
NDIS_PHYSICAL_ADDRESS IoAddress
Definition: nic.h:52
struct _E1000_ADAPTER E1000_ADAPTER
NDIS_STATUS NTAPI NICApplyInterruptMask(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:768
PNDIS_PACKET TransmitPackets[NUM_TRANSMIT_DESCRIPTORS]
Definition: nic.h:73
NDIS_STATUS NTAPI NICDisableTxRx(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:672
NDIS_STATUS NTAPI NICPowerOn(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:540
unsigned short USHORT
Definition: pedump.c:61
ULONG NTAPI NICInterruptRecognized(IN PE1000_ADAPTER Adapter, OUT PBOOLEAN InterruptRecognized)
Definition: hardware.c:790
unsigned int * PULONG
Definition: retypes.h:1
ULONG InterruptFlags
Definition: nic.h:60
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
USHORT DeviceID
Definition: nic.h:33
LONG InterruptMask
Definition: nic.h:65
ULONG IoPortAddress
Definition: nic.h:47
volatile PUCHAR IoBase
Definition: nic.h:54
NDIS_STATUS NTAPI NICGetPermanentMacAddress(IN PE1000_ADAPTER Adapter, OUT PUCHAR MacAddress)
Definition: hardware.c:692
E1000_RCVBUF_SIZE ReceiveBufferType
Definition: nic.h:84
NDIS_STATUS NTAPI NICUpdateMulticastList(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:722
VOID NTAPI E1000ReadUlong(IN PE1000_ADAPTER Adapter, IN ULONG Address, OUT PULONG Value)
Definition: hardware.c:70
NDIS_STATUS NTAPI NICUnregisterInterrupts(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:448
NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
Definition: info.c:232
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
NDIS_STATUS NTAPI NICApplyPacketFilter(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:752