xref: /reactos/drivers/network/dd/dc21x4/dc21x4.h (revision 59d8a77d)
1*59d8a77dSDmitry Borisov /*
2*59d8a77dSDmitry Borisov  * PROJECT:     ReactOS DC21x4 Driver
3*59d8a77dSDmitry Borisov  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4*59d8a77dSDmitry Borisov  * PURPOSE:     Main header file
5*59d8a77dSDmitry Borisov  * COPYRIGHT:   Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
6*59d8a77dSDmitry Borisov  */
7*59d8a77dSDmitry Borisov 
8*59d8a77dSDmitry Borisov #pragma once
9*59d8a77dSDmitry Borisov 
10*59d8a77dSDmitry Borisov #if !DBG
11*59d8a77dSDmitry Borisov #define NO_KERNEL_LIST_ENTRY_CHECKS
12*59d8a77dSDmitry Borisov #endif
13*59d8a77dSDmitry Borisov #include <ndis.h>
14*59d8a77dSDmitry Borisov #include <section_attribs.h>
15*59d8a77dSDmitry Borisov 
16*59d8a77dSDmitry Borisov #include "dc21x4hw.h"
17*59d8a77dSDmitry Borisov #include "eeprom.h"
18*59d8a77dSDmitry Borisov #include "media.h"
19*59d8a77dSDmitry Borisov #include "util.h"
20*59d8a77dSDmitry Borisov 
21*59d8a77dSDmitry Borisov #define DC21X4_TAG   '4x12'
22*59d8a77dSDmitry Borisov 
23*59d8a77dSDmitry Borisov #define DC_TRANSMIT_DESCRIPTORS    64
24*59d8a77dSDmitry Borisov #define DC_TRANSMIT_BLOCKS         48
25*59d8a77dSDmitry Borisov #define DC_TRANSMIT_BUFFERS        4
26*59d8a77dSDmitry Borisov #define DC_LOOPBACK_FRAMES         4
27*59d8a77dSDmitry Borisov 
28*59d8a77dSDmitry Borisov #define DC_RECEIVE_BUFFERS_DEFAULT     64
29*59d8a77dSDmitry Borisov #define DC_RECEIVE_BUFFERS_MIN         8
30*59d8a77dSDmitry Borisov #define DC_RECEIVE_BUFFERS_EXTRA       16
31*59d8a77dSDmitry Borisov 
32*59d8a77dSDmitry Borisov #define DC_RECEIVE_ARRAY_SIZE      16
33*59d8a77dSDmitry Borisov 
34*59d8a77dSDmitry Borisov #define DC_MULTICAST_LIST_SIZE     36
35*59d8a77dSDmitry Borisov 
36*59d8a77dSDmitry Borisov #define DC_MAXIMUM_FRAME_SIZE      1514
37*59d8a77dSDmitry Borisov #define DC_TRANSMIT_BLOCK_SIZE     1536
38*59d8a77dSDmitry Borisov #define DC_RECEIVE_BLOCK_SIZE      1536
39*59d8a77dSDmitry Borisov #define DC_ETHERNET_HEADER_SIZE    14
40*59d8a77dSDmitry Borisov 
41*59d8a77dSDmitry Borisov #define DC_TX_UNDERRUN_LIMIT    5
42*59d8a77dSDmitry Borisov #define DC_INTERRUPT_PROCESSING_LIMIT    8
43*59d8a77dSDmitry Borisov 
44*59d8a77dSDmitry Borisov #define DC_FRAGMENTATION_THRESHOLD    32
45*59d8a77dSDmitry Borisov 
46*59d8a77dSDmitry Borisov #define DC_PACKET_FILTERS ( \
47*59d8a77dSDmitry Borisov     NDIS_PACKET_TYPE_DIRECTED | \
48*59d8a77dSDmitry Borisov     NDIS_PACKET_TYPE_MULTICAST | \
49*59d8a77dSDmitry Borisov     NDIS_PACKET_TYPE_BROADCAST | \
50*59d8a77dSDmitry Borisov     NDIS_PACKET_TYPE_PROMISCUOUS | \
51*59d8a77dSDmitry Borisov     NDIS_PACKET_TYPE_ALL_MULTICAST)
52*59d8a77dSDmitry Borisov 
53*59d8a77dSDmitry Borisov #define DC_LOOPBACK_FRAME_SIZE    64
54*59d8a77dSDmitry Borisov 
55*59d8a77dSDmitry Borisov /* Transmit descriptors reserved for internal use */
56*59d8a77dSDmitry Borisov #define DC_TBD_RESERVE     (2 + DC_LOOPBACK_FRAMES) /* (+2 for setup frame) */
57*59d8a77dSDmitry Borisov #define DC_TCB_RESERVE     (1 + DC_LOOPBACK_FRAMES) /* (+1 for setup frame) */
58*59d8a77dSDmitry Borisov 
59*59d8a77dSDmitry Borisov #define DC_EVENT_SETUP_FRAME_COMPLETED    0x00000001
60*59d8a77dSDmitry Borisov 
61*59d8a77dSDmitry Borisov typedef struct _DC21X4_ADAPTER       DC21X4_ADAPTER, *PDC21X4_ADAPTER;
62*59d8a77dSDmitry Borisov typedef struct _DC_TCB               DC_TCB, *PDC_TCB;
63*59d8a77dSDmitry Borisov typedef struct _DC_RCB               DC_RCB, *PDC_RCB;
64*59d8a77dSDmitry Borisov typedef struct _DC_COALESCE_BUFFER   DC_COALESCE_BUFFER, *PDC_COALESCE_BUFFER;
65*59d8a77dSDmitry Borisov 
66*59d8a77dSDmitry Borisov typedef VOID
67*59d8a77dSDmitry Borisov (MEDIA_HANDLE_LINK_STATE_CHANGE)(
68*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
69*59d8a77dSDmitry Borisov     _In_ ULONG InterruptStatus);
70*59d8a77dSDmitry Borisov typedef MEDIA_HANDLE_LINK_STATE_CHANGE *PMEDIA_HANDLE_LINK_STATE_CHANGE;
71*59d8a77dSDmitry Borisov 
72*59d8a77dSDmitry Borisov typedef struct _DC_TX_BUFFER_DATA
73*59d8a77dSDmitry Borisov {
74*59d8a77dSDmitry Borisov     PVOID VirtualAddress;
75*59d8a77dSDmitry Borisov     NDIS_PHYSICAL_ADDRESS PhysicalAddress;
76*59d8a77dSDmitry Borisov } DC_TX_BUFFER_DATA, *PDC_TX_BUFFER_DATA;
77*59d8a77dSDmitry Borisov 
78*59d8a77dSDmitry Borisov typedef struct _DC_STATISTICS
79*59d8a77dSDmitry Borisov {
80*59d8a77dSDmitry Borisov     ULONG64 TransmitOk;
81*59d8a77dSDmitry Borisov     ULONG64 TransmitDeferred;
82*59d8a77dSDmitry Borisov     ULONG64 TransmitHeartbeatErrors;
83*59d8a77dSDmitry Borisov     ULONG64 TransmitOneRetry;
84*59d8a77dSDmitry Borisov     ULONG64 TransmitMoreCollisions;
85*59d8a77dSDmitry Borisov     ULONG64 TransmitErrors;
86*59d8a77dSDmitry Borisov     ULONG64 TransmitExcessiveCollisions;
87*59d8a77dSDmitry Borisov     ULONG64 TransmitUnderrunErrors;
88*59d8a77dSDmitry Borisov     ULONG64 TransmitLostCarrierSense;
89*59d8a77dSDmitry Borisov     ULONG64 TransmitLateCollisions;
90*59d8a77dSDmitry Borisov     ULONG64 ReceiveOk;
91*59d8a77dSDmitry Borisov     ULONG64 ReceiveBroadcast;
92*59d8a77dSDmitry Borisov     ULONG64 ReceiveMulticast;
93*59d8a77dSDmitry Borisov     ULONG64 ReceiveUnicast;
94*59d8a77dSDmitry Borisov     ULONG64 ReceiveErrors;
95*59d8a77dSDmitry Borisov     ULONG64 ReceiveOverrunErrors;
96*59d8a77dSDmitry Borisov     ULONG64 ReceiveNoBuffers;
97*59d8a77dSDmitry Borisov     ULONG64 ReceiveCrcErrors;
98*59d8a77dSDmitry Borisov     ULONG64 ReceiveAlignmentErrors;
99*59d8a77dSDmitry Borisov } DC_STATISTICS, *PDC_STATISTICS;
100*59d8a77dSDmitry Borisov 
101*59d8a77dSDmitry Borisov typedef struct _DC21X4_ADAPTER
102*59d8a77dSDmitry Borisov {
103*59d8a77dSDmitry Borisov     PUCHAR IoBase;
104*59d8a77dSDmitry Borisov     ULONG InterruptMask;
105*59d8a77dSDmitry Borisov     ULONG CurrentInterruptMask;
106*59d8a77dSDmitry Borisov 
107*59d8a77dSDmitry Borisov     ULONG Features;
108*59d8a77dSDmitry Borisov #define DC_NEED_RX_OVERFLOW_WORKAROUND              0x80000000
109*59d8a77dSDmitry Borisov #define DC_SIA_GPIO                                 0x00000001
110*59d8a77dSDmitry Borisov #define DC_SIA_ANALOG_CONTROL                       0x00000002
111*59d8a77dSDmitry Borisov #define DC_HAS_POWER_MANAGEMENT                     0x00000004
112*59d8a77dSDmitry Borisov #define DC_HAS_POWER_SAVING                         0x00000008
113*59d8a77dSDmitry Borisov #define DC_HAS_MII                                  0x00000010
114*59d8a77dSDmitry Borisov #define DC_PERFECT_FILTERING_ONLY                   0x00000020
115*59d8a77dSDmitry Borisov #define DC_ENABLE_PCI_COMMANDS                      0x00000040
116*59d8a77dSDmitry Borisov #define DC_MII_AUTOSENSE                            0x00000080
117*59d8a77dSDmitry Borisov #define DC_HAS_TIMER                                0x00000100
118*59d8a77dSDmitry Borisov 
119*59d8a77dSDmitry Borisov     ULONG Flags;
120*59d8a77dSDmitry Borisov #define DC_ACTIVE                                   0x80000000
121*59d8a77dSDmitry Borisov #define DC_IO_MAPPED                                0x00000001
122*59d8a77dSDmitry Borisov #define DC_IRQ_SHARED                               0x00000002
123*59d8a77dSDmitry Borisov #define DC_FIRST_SETUP                              0x00000004
124*59d8a77dSDmitry Borisov #define DC_AUTOSENSE                                0x00000008
125*59d8a77dSDmitry Borisov 
126*59d8a77dSDmitry Borisov     ULONG InterruptStatus;
127*59d8a77dSDmitry Borisov     PMEDIA_HANDLE_LINK_STATE_CHANGE HandleLinkStateChange;
128*59d8a77dSDmitry Borisov 
129*59d8a77dSDmitry Borisov     DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK SendLock;
130*59d8a77dSDmitry Borisov     PDC_TCB TailTcb;
131*59d8a77dSDmitry Borisov     PDC_TCB LastTcb;
132*59d8a77dSDmitry Borisov     PDC_TCB CurrentTcb;
133*59d8a77dSDmitry Borisov     PDC_TBD CurrentTbd;
134*59d8a77dSDmitry Borisov     PDC_TBD HeadTbd;
135*59d8a77dSDmitry Borisov     PDC_TBD TailTbd;
136*59d8a77dSDmitry Borisov     LIST_ENTRY SendQueueList;
137*59d8a77dSDmitry Borisov     ULONG TcbSlots;
138*59d8a77dSDmitry Borisov     ULONG TbdSlots;
139*59d8a77dSDmitry Borisov     ULONG TcbCompleted;
140*59d8a77dSDmitry Borisov     ULONG LastTcbCompleted;
141*59d8a77dSDmitry Borisov     PDC_TCB HeadTcb;
142*59d8a77dSDmitry Borisov     SINGLE_LIST_ENTRY SendBufferList;
143*59d8a77dSDmitry Borisov     SCATTER_GATHER_LIST LocalSgList;
144*59d8a77dSDmitry Borisov 
145*59d8a77dSDmitry Borisov     DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK ReceiveLock;
146*59d8a77dSDmitry Borisov     PDC_RCB* RcbArray;
147*59d8a77dSDmitry Borisov     PDC_RBD CurrentRbd;
148*59d8a77dSDmitry Borisov     PDC_RBD HeadRbd;
149*59d8a77dSDmitry Borisov     PDC_RBD TailRbd;
150*59d8a77dSDmitry Borisov     SINGLE_LIST_ENTRY FreeRcbList;
151*59d8a77dSDmitry Borisov     ULONG RcbFree;
152*59d8a77dSDmitry Borisov 
153*59d8a77dSDmitry Borisov     ULONG TransmitUnderruns;
154*59d8a77dSDmitry Borisov     ULONG PacketFilter;
155*59d8a77dSDmitry Borisov 
156*59d8a77dSDmitry Borisov     DC_STATISTICS Statistics;
157*59d8a77dSDmitry Borisov 
158*59d8a77dSDmitry Borisov     NDIS_HANDLE AdapterHandle;
159*59d8a77dSDmitry Borisov     NDIS_HANDLE WrapperConfigurationHandle;
160*59d8a77dSDmitry Borisov 
161*59d8a77dSDmitry Borisov     DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK ModeLock;
162*59d8a77dSDmitry Borisov     ULONG ModeFlags;
163*59d8a77dSDmitry Borisov #define DC_MODE_AUTONEG_MASK                 0x0000000F
164*59d8a77dSDmitry Borisov #define DC_MODE_PORT_AUTOSENSE               0x00000010
165*59d8a77dSDmitry Borisov #define DC_MODE_TEST_PACKET                  0x00000020
166*59d8a77dSDmitry Borisov #define DC_MODE_AUI_FAILED                   0x00000040
167*59d8a77dSDmitry Borisov #define DC_MODE_BNC_FAILED                   0x00000080
168*59d8a77dSDmitry Borisov 
169*59d8a77dSDmitry Borisov #define DC_MODE_AUTONEG_NONE                 0x00000000
170*59d8a77dSDmitry Borisov #define DC_MODE_AUTONEG_WAIT_INTERRUPT       0x00000001
171*59d8a77dSDmitry Borisov #define DC_MODE_AUTONEG_LINK_STATUS_CHECK    0x00000002
172*59d8a77dSDmitry Borisov 
173*59d8a77dSDmitry Borisov     ULONG OpMode;
174*59d8a77dSDmitry Borisov     ULONG MediaNumber;
175*59d8a77dSDmitry Borisov     ULONG MediaBitmap;
176*59d8a77dSDmitry Borisov     BOOLEAN LinkUp;
177*59d8a77dSDmitry Borisov     ULONG PhyAddress;
178*59d8a77dSDmitry Borisov     ULONG SiaSetting;
179*59d8a77dSDmitry Borisov     ULONG LastReceiveActivity;
180*59d8a77dSDmitry Borisov     volatile LONG MediaTestStatus;
181*59d8a77dSDmitry Borisov     NDIS_MINIPORT_TIMER MediaMonitorTimer;
182*59d8a77dSDmitry Borisov     DC_MII_MEDIA MiiMedia;
183*59d8a77dSDmitry Borisov     DC_MEDIA Media[MEDIA_LIST_MAX];
184*59d8a77dSDmitry Borisov 
185*59d8a77dSDmitry Borisov     ULONG AnalogControl;
186*59d8a77dSDmitry Borisov     ULONG SymAdvertising;
187*59d8a77dSDmitry Borisov     ULONG MiiAdvertising;
188*59d8a77dSDmitry Borisov     ULONG MiiControl;
189*59d8a77dSDmitry Borisov     DC_CHIP_TYPE ChipType;
190*59d8a77dSDmitry Borisov     ULONG LinkStateChangeMask;
191*59d8a77dSDmitry Borisov 
192*59d8a77dSDmitry Borisov     ULONG WakeUpFlags;
193*59d8a77dSDmitry Borisov     NDIS_DEVICE_POWER_STATE PowerState;
194*59d8a77dSDmitry Borisov     NDIS_DEVICE_POWER_STATE PrevPowerState;
195*59d8a77dSDmitry Borisov 
196*59d8a77dSDmitry Borisov     ULONG HpnaInitBitmap;
197*59d8a77dSDmitry Borisov     UCHAR HpnaRegister[32];
198*59d8a77dSDmitry Borisov 
199*59d8a77dSDmitry Borisov     UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS];
200*59d8a77dSDmitry Borisov     UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS];
201*59d8a77dSDmitry Borisov 
202*59d8a77dSDmitry Borisov     ULONG MulticastMaxEntries;
203*59d8a77dSDmitry Borisov     _Field_range_(0, MulticastMaxEntries)
204*59d8a77dSDmitry Borisov     ULONG MulticastCount;
205*59d8a77dSDmitry Borisov     struct
206*59d8a77dSDmitry Borisov     {
207*59d8a77dSDmitry Borisov         UCHAR MacAddress[ETH_LENGTH_OF_ADDRESS];
208*59d8a77dSDmitry Borisov     } MulticastList[DC_MULTICAST_LIST_SIZE];
209*59d8a77dSDmitry Borisov 
210*59d8a77dSDmitry Borisov     ULONG LinkSpeedMbps;
211*59d8a77dSDmitry Borisov     ULONG BusMode;
212*59d8a77dSDmitry Borisov     ULONG DefaultMedia;
213*59d8a77dSDmitry Borisov     ULONG RcbCount;
214*59d8a77dSDmitry Borisov     BOOLEAN OidPending;
215*59d8a77dSDmitry Borisov     BOOLEAN ProgramHashPerfectFilter;
216*59d8a77dSDmitry Borisov     PULONG SetupFrame;
217*59d8a77dSDmitry Borisov     PULONG SetupFrameSaved;
218*59d8a77dSDmitry Borisov     ULONG SetupFramePhys;
219*59d8a77dSDmitry Borisov     ULONG LoopbackFrameSlots;
220*59d8a77dSDmitry Borisov     ULONG LoopbackFrameNumber;
221*59d8a77dSDmitry Borisov     ULONG LoopbackFramePhys[DC_LOOPBACK_FRAMES];
222*59d8a77dSDmitry Borisov     ULONG BusNumber;
223*59d8a77dSDmitry Borisov     UCHAR DeviceNumber;
224*59d8a77dSDmitry Borisov     UCHAR RevisionId;
225*59d8a77dSDmitry Borisov     UCHAR ControllerIndex;
226*59d8a77dSDmitry Borisov     UCHAR ResetStreamLength;
227*59d8a77dSDmitry Borisov     USHORT ResetStream[SROM_MAX_STREAM_REGS];
228*59d8a77dSDmitry Borisov     USHORT DeviceId;
229*59d8a77dSDmitry Borisov     SINGLE_LIST_ENTRY AllocRcbList;
230*59d8a77dSDmitry Borisov     SINGLE_LIST_ENTRY UsedRcbList;
231*59d8a77dSDmitry Borisov     NDIS_MINIPORT_INTERRUPT Interrupt;
232*59d8a77dSDmitry Borisov     ULONG InterruptVector;
233*59d8a77dSDmitry Borisov     ULONG InterruptLevel;
234*59d8a77dSDmitry Borisov     ULONG InterruptFlags;
235*59d8a77dSDmitry Borisov     ULONG AdapterSize;
236*59d8a77dSDmitry Borisov     NDIS_WORK_ITEM PowerWorkItem;
237*59d8a77dSDmitry Borisov     NDIS_WORK_ITEM ResetWorkItem;
238*59d8a77dSDmitry Borisov     NDIS_WORK_ITEM TxRecoveryWorkItem;
239*59d8a77dSDmitry Borisov     _Interlocked_ volatile LONG ResetLock;
240*59d8a77dSDmitry Borisov     NDIS_PHYSICAL_ADDRESS IoBaseAddress;
241*59d8a77dSDmitry Borisov     PDC_SROM_ENTRY SRomEntry;
242*59d8a77dSDmitry Borisov     PVOID AdapterOriginal;
243*59d8a77dSDmitry Borisov     PVOID TbdOriginal;
244*59d8a77dSDmitry Borisov     PVOID RbdOriginal;
245*59d8a77dSDmitry Borisov     ULONG TbdPhys;
246*59d8a77dSDmitry Borisov     ULONG RbdPhys;
247*59d8a77dSDmitry Borisov     NDIS_HANDLE BufferPool;
248*59d8a77dSDmitry Borisov     NDIS_HANDLE PacketPool;
249*59d8a77dSDmitry Borisov     NDIS_PHYSICAL_ADDRESS TbdPhysOriginal;
250*59d8a77dSDmitry Borisov     NDIS_PHYSICAL_ADDRESS RbdPhysOriginal;
251*59d8a77dSDmitry Borisov     PVOID LoopbackFrame[DC_LOOPBACK_FRAMES];
252*59d8a77dSDmitry Borisov     PDC_COALESCE_BUFFER CoalesceBuffer;
253*59d8a77dSDmitry Borisov     DC_TX_BUFFER_DATA SendBufferData[DC_TRANSMIT_BUFFERS];
254*59d8a77dSDmitry Borisov } DC21X4_ADAPTER, *PDC21X4_ADAPTER;
255*59d8a77dSDmitry Borisov 
256*59d8a77dSDmitry Borisov #include "sendrcv.h"
257*59d8a77dSDmitry Borisov 
258*59d8a77dSDmitry Borisov extern LIST_ENTRY SRompAdapterList;
259*59d8a77dSDmitry Borisov 
260*59d8a77dSDmitry Borisov FORCEINLINE
261*59d8a77dSDmitry Borisov ULONG
DC_READ(_In_ PDC21X4_ADAPTER Adapter,_In_ DC_CSR Register)262*59d8a77dSDmitry Borisov DC_READ(
263*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
264*59d8a77dSDmitry Borisov     _In_ DC_CSR Register)
265*59d8a77dSDmitry Borisov {
266*59d8a77dSDmitry Borisov     ULONG Value;
267*59d8a77dSDmitry Borisov 
268*59d8a77dSDmitry Borisov     NdisRawReadPortUlong((PULONG)(Adapter->IoBase + Register), &Value);
269*59d8a77dSDmitry Borisov     return Value;
270*59d8a77dSDmitry Borisov }
271*59d8a77dSDmitry Borisov 
272*59d8a77dSDmitry Borisov #define DC_WRITE(Adapter, Register, Value)  \
273*59d8a77dSDmitry Borisov     NdisRawWritePortUlong((PULONG)((Adapter)->IoBase + (Register)), (Value));
274*59d8a77dSDmitry Borisov 
275*59d8a77dSDmitry Borisov CODE_SEG("INIT")
276*59d8a77dSDmitry Borisov DRIVER_INITIALIZE DriverEntry;
277*59d8a77dSDmitry Borisov 
278*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
279*59d8a77dSDmitry Borisov NDIS_STATUS
280*59d8a77dSDmitry Borisov NTAPI
281*59d8a77dSDmitry Borisov DcInitialize(
282*59d8a77dSDmitry Borisov     _Out_ PNDIS_STATUS OpenErrorStatus,
283*59d8a77dSDmitry Borisov     _Out_ PUINT SelectedMediumIndex,
284*59d8a77dSDmitry Borisov     _In_ PNDIS_MEDIUM MediumArray,
285*59d8a77dSDmitry Borisov     _In_ UINT MediumArraySize,
286*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterHandle,
287*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE WrapperConfigurationContext);
288*59d8a77dSDmitry Borisov 
289*59d8a77dSDmitry Borisov VOID
290*59d8a77dSDmitry Borisov NTAPI
291*59d8a77dSDmitry Borisov DcSendPackets(
292*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext,
293*59d8a77dSDmitry Borisov     _In_ PPNDIS_PACKET PacketArray,
294*59d8a77dSDmitry Borisov     _In_ UINT NumberOfPackets);
295*59d8a77dSDmitry Borisov 
296*59d8a77dSDmitry Borisov VOID
297*59d8a77dSDmitry Borisov NTAPI
298*59d8a77dSDmitry Borisov DcCancelSendPackets(
299*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext,
300*59d8a77dSDmitry Borisov     _In_ PVOID CancelId);
301*59d8a77dSDmitry Borisov 
302*59d8a77dSDmitry Borisov VOID
303*59d8a77dSDmitry Borisov DcProcessPendingPackets(
304*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
305*59d8a77dSDmitry Borisov 
306*59d8a77dSDmitry Borisov VOID
307*59d8a77dSDmitry Borisov NTAPI
308*59d8a77dSDmitry Borisov DcReturnPacket(
309*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext,
310*59d8a77dSDmitry Borisov     _In_ PNDIS_PACKET Packet);
311*59d8a77dSDmitry Borisov 
312*59d8a77dSDmitry Borisov NDIS_STATUS
313*59d8a77dSDmitry Borisov NTAPI
314*59d8a77dSDmitry Borisov DcQueryInformation(
315*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext,
316*59d8a77dSDmitry Borisov     _In_ NDIS_OID Oid,
317*59d8a77dSDmitry Borisov     _In_ PVOID InformationBuffer,
318*59d8a77dSDmitry Borisov     _In_ ULONG InformationBufferLength,
319*59d8a77dSDmitry Borisov     _Out_ PULONG BytesWritten,
320*59d8a77dSDmitry Borisov     _Out_ PULONG BytesNeeded);
321*59d8a77dSDmitry Borisov 
322*59d8a77dSDmitry Borisov NDIS_STATUS
323*59d8a77dSDmitry Borisov NTAPI
324*59d8a77dSDmitry Borisov DcSetInformation(
325*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext,
326*59d8a77dSDmitry Borisov     _In_ NDIS_OID Oid,
327*59d8a77dSDmitry Borisov     _In_ PVOID InformationBuffer,
328*59d8a77dSDmitry Borisov     _In_ ULONG InformationBufferLength,
329*59d8a77dSDmitry Borisov     _Out_ PULONG BytesRead,
330*59d8a77dSDmitry Borisov     _Out_ PULONG BytesNeeded);
331*59d8a77dSDmitry Borisov 
332*59d8a77dSDmitry Borisov VOID
333*59d8a77dSDmitry Borisov NTAPI
334*59d8a77dSDmitry Borisov DcIsr(
335*59d8a77dSDmitry Borisov     _Out_ PBOOLEAN InterruptRecognized,
336*59d8a77dSDmitry Borisov     _Out_ PBOOLEAN QueueMiniportHandleInterrupt,
337*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext);
338*59d8a77dSDmitry Borisov 
339*59d8a77dSDmitry Borisov VOID
340*59d8a77dSDmitry Borisov NTAPI
341*59d8a77dSDmitry Borisov DcHandleInterrupt(
342*59d8a77dSDmitry Borisov     _In_ NDIS_HANDLE MiniportAdapterContext);
343*59d8a77dSDmitry Borisov 
344*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
345*59d8a77dSDmitry Borisov VOID
346*59d8a77dSDmitry Borisov NTAPI
347*59d8a77dSDmitry Borisov DcPowerWorker(
348*59d8a77dSDmitry Borisov     _In_ PNDIS_WORK_ITEM WorkItem,
349*59d8a77dSDmitry Borisov     _In_opt_ PVOID Context);
350*59d8a77dSDmitry Borisov 
351*59d8a77dSDmitry Borisov NDIS_STATUS
352*59d8a77dSDmitry Borisov DcSetPower(
353*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
354*59d8a77dSDmitry Borisov     _In_ NDIS_DEVICE_POWER_STATE PowerState);
355*59d8a77dSDmitry Borisov 
356*59d8a77dSDmitry Borisov NDIS_STATUS
357*59d8a77dSDmitry Borisov DcAddWakeUpPattern(
358*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
359*59d8a77dSDmitry Borisov     _In_ PNDIS_PM_PACKET_PATTERN PmPattern);
360*59d8a77dSDmitry Borisov 
361*59d8a77dSDmitry Borisov NDIS_STATUS
362*59d8a77dSDmitry Borisov DcRemoveWakeUpPattern(
363*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
364*59d8a77dSDmitry Borisov     _In_ PNDIS_PM_PACKET_PATTERN PmPattern);
365*59d8a77dSDmitry Borisov 
366*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
367*59d8a77dSDmitry Borisov VOID
368*59d8a77dSDmitry Borisov DcFreeAdapter(
369*59d8a77dSDmitry Borisov     _In_ __drv_freesMem(Mem) PDC21X4_ADAPTER Adapter);
370*59d8a77dSDmitry Borisov 
371*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
372*59d8a77dSDmitry Borisov VOID
373*59d8a77dSDmitry Borisov NTAPI
374*59d8a77dSDmitry Borisov DcResetWorker(
375*59d8a77dSDmitry Borisov     _In_ PNDIS_WORK_ITEM WorkItem,
376*59d8a77dSDmitry Borisov     _In_opt_ PVOID Context);
377*59d8a77dSDmitry Borisov 
378*59d8a77dSDmitry Borisov DECLSPEC_NOINLINE
379*59d8a77dSDmitry Borisov VOID
380*59d8a77dSDmitry Borisov DcStopAdapter(
381*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
382*59d8a77dSDmitry Borisov     _In_ BOOLEAN WaitForPackets);
383*59d8a77dSDmitry Borisov 
384*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
385*59d8a77dSDmitry Borisov VOID
386*59d8a77dSDmitry Borisov DcStartAdapter(
387*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
388*59d8a77dSDmitry Borisov 
389*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
390*59d8a77dSDmitry Borisov NDIS_STATUS
391*59d8a77dSDmitry Borisov DcSetupAdapter(
392*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
393*59d8a77dSDmitry Borisov 
394*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
395*59d8a77dSDmitry Borisov NDIS_STATUS
396*59d8a77dSDmitry Borisov DcReadEeprom(
397*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
398*59d8a77dSDmitry Borisov 
399*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
400*59d8a77dSDmitry Borisov VOID
401*59d8a77dSDmitry Borisov DcFreeEeprom(
402*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
403*59d8a77dSDmitry Borisov 
404*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
405*59d8a77dSDmitry Borisov VOID
406*59d8a77dSDmitry Borisov DcInitTxRing(
407*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
408*59d8a77dSDmitry Borisov 
409*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
410*59d8a77dSDmitry Borisov VOID
411*59d8a77dSDmitry Borisov DcInitRxRing(
412*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
413*59d8a77dSDmitry Borisov 
414*59d8a77dSDmitry Borisov ULONG
415*59d8a77dSDmitry Borisov DcEthernetCrc(
416*59d8a77dSDmitry Borisov     _In_reads_bytes_(Size) const VOID* Buffer,
417*59d8a77dSDmitry Borisov     _In_ ULONG Size);
418*59d8a77dSDmitry Borisov 
419*59d8a77dSDmitry Borisov VOID
420*59d8a77dSDmitry Borisov DcDisableHw(
421*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
422*59d8a77dSDmitry Borisov 
423*59d8a77dSDmitry Borisov VOID
424*59d8a77dSDmitry Borisov DcStopTxRxProcess(
425*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
426*59d8a77dSDmitry Borisov 
427*59d8a77dSDmitry Borisov VOID
428*59d8a77dSDmitry Borisov DcWriteGpio(
429*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
430*59d8a77dSDmitry Borisov     _In_ ULONG Value);
431*59d8a77dSDmitry Borisov 
432*59d8a77dSDmitry Borisov VOID
433*59d8a77dSDmitry Borisov DcWriteSia(
434*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
435*59d8a77dSDmitry Borisov     _In_ ULONG Csr13,
436*59d8a77dSDmitry Borisov     _In_ ULONG Csr14,
437*59d8a77dSDmitry Borisov     _In_ ULONG Csr15);
438*59d8a77dSDmitry Borisov 
439*59d8a77dSDmitry Borisov VOID
440*59d8a77dSDmitry Borisov DcTestPacket(
441*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
442*59d8a77dSDmitry Borisov 
443*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
444*59d8a77dSDmitry Borisov VOID
445*59d8a77dSDmitry Borisov DcSetupFrameInitialize(
446*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
447*59d8a77dSDmitry Borisov 
448*59d8a77dSDmitry Borisov BOOLEAN
449*59d8a77dSDmitry Borisov DcSetupFrameDownload(
450*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
451*59d8a77dSDmitry Borisov     _In_ BOOLEAN WaitForCompletion);
452*59d8a77dSDmitry Borisov 
453*59d8a77dSDmitry Borisov NDIS_STATUS
454*59d8a77dSDmitry Borisov DcApplyPacketFilter(
455*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
456*59d8a77dSDmitry Borisov     _In_ ULONG PacketFilter);
457*59d8a77dSDmitry Borisov 
458*59d8a77dSDmitry Borisov NDIS_STATUS
459*59d8a77dSDmitry Borisov DcUpdateMulticastList(
460*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
461*59d8a77dSDmitry Borisov 
462*59d8a77dSDmitry Borisov VOID
463*59d8a77dSDmitry Borisov DcPowerSave(
464*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
465*59d8a77dSDmitry Borisov     _In_ BOOLEAN Enable);
466*59d8a77dSDmitry Borisov 
467*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
468*59d8a77dSDmitry Borisov BOOLEAN
469*59d8a77dSDmitry Borisov DcFindMiiPhy(
470*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
471*59d8a77dSDmitry Borisov 
472*59d8a77dSDmitry Borisov BOOLEAN
473*59d8a77dSDmitry Borisov MiiWrite(
474*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
475*59d8a77dSDmitry Borisov     _In_ ULONG PhyAddress,
476*59d8a77dSDmitry Borisov     _In_ ULONG RegAddress,
477*59d8a77dSDmitry Borisov     _In_ ULONG Data);
478*59d8a77dSDmitry Borisov 
479*59d8a77dSDmitry Borisov BOOLEAN
480*59d8a77dSDmitry Borisov MiiRead(
481*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
482*59d8a77dSDmitry Borisov     _In_ ULONG PhyAddress,
483*59d8a77dSDmitry Borisov     _In_ ULONG RegAddress,
484*59d8a77dSDmitry Borisov     _Out_ PULONG Data);
485*59d8a77dSDmitry Borisov 
486*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
487*59d8a77dSDmitry Borisov VOID
488*59d8a77dSDmitry Borisov HpnaPhyInit(
489*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
490*59d8a77dSDmitry Borisov 
491*59d8a77dSDmitry Borisov VOID
492*59d8a77dSDmitry Borisov NTAPI
493*59d8a77dSDmitry Borisov DcTransmitTimeoutRecoveryWorker(
494*59d8a77dSDmitry Borisov     _In_ PNDIS_WORK_ITEM WorkItem,
495*59d8a77dSDmitry Borisov     _In_opt_ PVOID Context);
496*59d8a77dSDmitry Borisov 
497*59d8a77dSDmitry Borisov NDIS_TIMER_FUNCTION MediaMonitor21040Dpc;
498*59d8a77dSDmitry Borisov NDIS_TIMER_FUNCTION MediaMonitor21041Dpc;
499*59d8a77dSDmitry Borisov NDIS_TIMER_FUNCTION MediaMonitor21140Dpc;
500*59d8a77dSDmitry Borisov NDIS_TIMER_FUNCTION MediaMonitor21143Dpc;
501*59d8a77dSDmitry Borisov 
502*59d8a77dSDmitry Borisov MEDIA_HANDLE_LINK_STATE_CHANGE MediaLinkStateChange21040;
503*59d8a77dSDmitry Borisov MEDIA_HANDLE_LINK_STATE_CHANGE MediaLinkStateChange21041;
504*59d8a77dSDmitry Borisov MEDIA_HANDLE_LINK_STATE_CHANGE MediaLinkStateChange21143;
505*59d8a77dSDmitry Borisov 
506*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
507*59d8a77dSDmitry Borisov VOID
508*59d8a77dSDmitry Borisov MediaInitMediaList(
509*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
510*59d8a77dSDmitry Borisov 
511*59d8a77dSDmitry Borisov CODE_SEG("PAGE")
512*59d8a77dSDmitry Borisov VOID
513*59d8a77dSDmitry Borisov MediaInitDefaultMedia(
514*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
515*59d8a77dSDmitry Borisov     _In_ ULONG MediaNumber);
516*59d8a77dSDmitry Borisov 
517*59d8a77dSDmitry Borisov VOID
518*59d8a77dSDmitry Borisov MediaIndicateConnect(
519*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
520*59d8a77dSDmitry Borisov     _In_ BOOLEAN LinkUp);
521*59d8a77dSDmitry Borisov 
522*59d8a77dSDmitry Borisov VOID
523*59d8a77dSDmitry Borisov MediaSelectMiiPort(
524*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter,
525*59d8a77dSDmitry Borisov     _In_ BOOLEAN ResetPhy);
526*59d8a77dSDmitry Borisov 
527*59d8a77dSDmitry Borisov VOID
528*59d8a77dSDmitry Borisov MediaMiiSelect(
529*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
530*59d8a77dSDmitry Borisov 
531*59d8a77dSDmitry Borisov BOOLEAN
532*59d8a77dSDmitry Borisov MediaMiiCheckLink(
533*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
534*59d8a77dSDmitry Borisov 
535*59d8a77dSDmitry Borisov VOID
536*59d8a77dSDmitry Borisov MediaSiaSelect(
537*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
538*59d8a77dSDmitry Borisov 
539*59d8a77dSDmitry Borisov VOID
540*59d8a77dSDmitry Borisov MediaGprSelect(
541*59d8a77dSDmitry Borisov     _In_ PDC21X4_ADAPTER Adapter);
542