ReactOS 0.4.16-dev-122-g325d74c
requests.c File Reference
#include "dc21x4.h"
#include <debug.h>
Include dependency graph for requests.c:

Go to the source code of this file.

Functions

static VOID DcQueryStatisticCounter (_In_ PDC21X4_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
 
static ULONG DcGetLinkSpeed (_In_ PDC21X4_ADAPTER Adapter)
 
NDIS_STATUS NTAPI DcQueryInformation (_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
 
NDIS_STATUS NTAPI DcSetInformation (_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesRead, _Out_ PULONG BytesNeeded)
 

Variables

static const NDIS_OID DcpSupportedOidList []
 

Function Documentation

◆ DcGetLinkSpeed()

static ULONG DcGetLinkSpeed ( _In_ PDC21X4_ADAPTER  Adapter)
static

Definition at line 167 of file requests.c.

169{
170 ULONG LinkSpeedMbps;
171
172 switch (Adapter->MediaNumber)
173 {
174 case MEDIA_HMR:
175 LinkSpeedMbps = 1;
176 break;
177
178 case MEDIA_10T:
179 case MEDIA_BNC:
180 case MEDIA_AUI:
181 case MEDIA_10T_FD:
182 LinkSpeedMbps = 10;
183 break;
184
185 case MEDIA_100TX_HD:
186 case MEDIA_100TX_FD:
187 case MEDIA_100T4:
188 case MEDIA_100FX_HD:
189 case MEDIA_100FX_FD:
190 LinkSpeedMbps = 100;
191 break;
192
193 case MEDIA_MII:
194 LinkSpeedMbps = Adapter->LinkSpeedMbps;
195 break;
196
197 default:
198 ASSERT(FALSE);
200 break;
201 }
202
203 return LinkSpeedMbps;
204}
#define FALSE
Definition: types.h:117
#define MEDIA_AUI
Definition: media.h:48
#define MEDIA_MII
Definition: media.h:67
#define MEDIA_100TX_FD
Definition: media.h:52
#define MEDIA_100FX_FD
Definition: media.h:55
#define MEDIA_10T_FD
Definition: media.h:51
#define MEDIA_10T
Definition: media.h:46
#define MEDIA_100FX_HD
Definition: media.h:54
#define MEDIA_HMR
Definition: media.h:56
#define MEDIA_100T4
Definition: media.h:53
#define MEDIA_BNC
Definition: media.h:47
#define MEDIA_100TX_HD
Definition: media.h:49
#define ASSERT(a)
Definition: mode.c:44
#define UNREACHABLE
uint32_t ULONG
Definition: typedefs.h:59

Referenced by DcQueryInformation().

◆ DcQueryInformation()

NDIS_STATUS NTAPI DcQueryInformation ( _In_ NDIS_HANDLE  MiniportAdapterContext,
_In_ NDIS_OID  Oid,
_In_ PVOID  InformationBuffer,
_In_ ULONG  InformationBufferLength,
_Out_ PULONG  BytesWritten,
_Out_ PULONG  BytesNeeded 
)

Definition at line 208 of file requests.c.

215{
216 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
218 ULONG InfoLength;
219 PVOID InfoPtr;
220 union _GENERIC_INFORMATION
221 {
223 ULONG Ulong;
224 ULONG64 Ulong64;
225 NDIS_MEDIUM Medium;
228 } GenericInfo;
229
230 InfoLength = sizeof(ULONG);
231 InfoPtr = &GenericInfo;
232
233 switch (Oid)
234 {
236 InfoPtr = (PVOID)&DcpSupportedOidList;
237 InfoLength = sizeof(DcpSupportedOidList);
238 break;
239
241 GenericInfo.Ulong = Adapter->PacketFilter;
242 break;
243
245 InfoPtr = Adapter->MulticastList;
246 InfoLength = Adapter->MulticastCount * ETH_LENGTH_OF_ADDRESS;
247 break;
248
250 GenericInfo.Ulong = Adapter->MulticastMaxEntries;
251 break;
252
255 {
256 GenericInfo.Medium = NdisMedium802_3;
257 InfoLength = sizeof(NDIS_MEDIUM);
258 break;
259 }
260
262 {
263 ULONG InterruptStatus;
264
265 /* NOTE: Reading the status register has no effect on the events */
266 InterruptStatus = DC_READ(Adapter, DcCsr5_Status);
267
268 /* Inserted into the motherboard */
269 if (InterruptStatus != 0xFFFFFFFF)
270 GenericInfo.Status = NdisHardwareStatusReady;
271 else
272 GenericInfo.Status = NdisHardwareStatusNotReady;
273
274 InfoLength = sizeof(NDIS_HARDWARE_STATUS);
275 break;
276 }
277
282 break;
283
285 GenericInfo.Ulong = DC_MAXIMUM_FRAME_SIZE;
286 break;
287
289 GenericInfo.Ulong = DC_TRANSMIT_BLOCK_SIZE;
290 break;
291
293 GenericInfo.Ulong = DC_TRANSMIT_BLOCK_SIZE * DC_TRANSMIT_BLOCKS;
294 break;
295
297 GenericInfo.Ulong = DC_RECEIVE_BLOCK_SIZE;
298 break;
299
301 GenericInfo.Ulong = DC_RECEIVE_BLOCK_SIZE * Adapter->RcbCount;
302 break;
303
305 GenericInfo.Ulong = DcGetLinkSpeed(Adapter) * 10000;
306 break;
307
309 GenericInfo.Ulong = 0;
310 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[0] << 16);
311 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[1] << 8);
312 GenericInfo.Ulong |= (Adapter->PermanentMacAddress[2] & 0xFF);
313 break;
314
316 {
317 static const CHAR VendorDesc[] = "DC21x4 compatible Ethernet Adapter";
318 InfoPtr = (PVOID)&VendorDesc;
319 InfoLength = sizeof(VendorDesc);
320 break;
321 }
322
324 /* 1.0.0 */
325 GenericInfo.Ulong = 0x100;
326 break;
327
329 {
330 InfoLength = sizeof(USHORT);
331 GenericInfo.Ushort = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
332 break;
333 }
334
336 GenericInfo.Ulong = DC_TRANSMIT_BLOCKS - DC_TCB_RESERVE;
337 break;
338
340 GenericInfo.Ulong = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
343 break;
344
346 GenericInfo.Ulong = Adapter->LinkUp ? NdisMediaStateConnected
348 break;
349
351 InfoPtr = Adapter->PermanentMacAddress;
352 InfoLength = ETH_LENGTH_OF_ADDRESS;
353 break;
354
356 InfoPtr = Adapter->CurrentMacAddress;
357 InfoLength = ETH_LENGTH_OF_ADDRESS;
358 break;
359
360 case OID_GEN_XMIT_OK:
361 case OID_GEN_RCV_OK:
379 {
380 DcQueryStatisticCounter(Adapter, Oid, &GenericInfo.Ulong64);
381
382 *BytesNeeded = sizeof(ULONG64);
383 if (InformationBufferLength < sizeof(ULONG))
384 {
385 *BytesWritten = 0;
387 }
388 if (InformationBufferLength >= sizeof(ULONG64))
389 {
390 *BytesWritten = sizeof(ULONG64);
391 NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG64));
392 }
393 else
394 {
395 *BytesWritten = sizeof(ULONG);
396 NdisMoveMemory(InformationBuffer, InfoPtr, sizeof(ULONG));
397 }
398
399 return NDIS_STATUS_SUCCESS;
400 }
401
403 GenericInfo.Ulong = (DC_TRANSMIT_BLOCKS - DC_TCB_RESERVE) - Adapter->TcbSlots;
404 break;
405
407 {
409
410 InfoLength = sizeof(NDIS_PNP_CAPABILITIES);
411
412 if (InformationBufferLength < InfoLength)
413 {
414 *BytesWritten = 0;
415 *BytesNeeded = InfoLength;
417 }
418
419 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
421
422 *BytesWritten = InfoLength;
423 *BytesNeeded = 0;
424
425 Capabilities = InformationBuffer;
426 Capabilities->WakeUpCapabilities.MinMagicPacketWakeUp = NdisDeviceStateD3;
427 Capabilities->WakeUpCapabilities.MinPatternWakeUp = NdisDeviceStateD3;
428 Capabilities->WakeUpCapabilities.MinLinkChangeWakeUp = NdisDeviceStateD3;
429
430 return NDIS_STATUS_SUCCESS;
431 }
432
434 {
435 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
437
438 return NDIS_STATUS_SUCCESS;
439 }
440
442 {
443 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
445
446 GenericInfo.Ulong = Adapter->WakeUpFlags & (NDIS_PNP_WAKE_UP_MAGIC_PACKET |
449 break;
450 }
451
452 default:
454 break;
455 }
456
458 {
459 if (InfoLength > InformationBufferLength)
460 {
461 *BytesWritten = 0;
462 *BytesNeeded = InfoLength;
464 }
465 else
466 {
467 NdisMoveMemory(InformationBuffer, InfoPtr, InfoLength);
468 *BytesWritten = InfoLength;
469 *BytesNeeded = 0;
470 }
471 }
472 else
473 {
474 *BytesWritten = 0;
475 *BytesNeeded = 0;
476 }
477
478 return Status;
479}
static const NDIS_OID DcpSupportedOidList[]
Definition: requests.c:16
static ULONG DcGetLinkSpeed(_In_ PDC21X4_ADAPTER Adapter)
Definition: requests.c:167
static VOID DcQueryStatisticCounter(_In_ PDC21X4_ADAPTER Adapter, _In_ NDIS_OID Oid, _Out_ PULONG64 Counter)
Definition: requests.c:79
#define DC_MAXIMUM_FRAME_SIZE
Definition: dc21x4.h:36
#define DC_HAS_POWER_MANAGEMENT
Definition: dc21x4.h:111
#define DC_TCB_RESERVE
Definition: dc21x4.h:57
struct _DC21X4_ADAPTER * PDC21X4_ADAPTER
Definition: dc21x4.h:61
FORCEINLINE ULONG DC_READ(_In_ PDC21X4_ADAPTER Adapter, _In_ DC_CSR Register)
Definition: dc21x4.h:262
#define DC_TRANSMIT_BLOCKS
Definition: dc21x4.h:24
#define DC_TRANSMIT_BLOCK_SIZE
Definition: dc21x4.h:37
#define DC_RECEIVE_BLOCK_SIZE
Definition: dc21x4.h:38
#define DC_ETHERNET_HEADER_SIZE
Definition: dc21x4.h:39
@ DcCsr5_Status
Definition: dc21x4hw.h:179
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
Status
Definition: gdiplustypes.h:25
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
unsigned __int64 ULONG64
Definition: imports.h:198
#define NDIS_STATUS_NOT_SUPPORTED
Definition: ndis.h:479
#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND
Definition: ndis.h:684
#define NDIS_STATUS_INVALID_OID
Definition: ndis.h:488
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_STATUS_BUFFER_TOO_SHORT
Definition: ndis.h:487
#define NDIS_MAC_OPTION_NO_LOOPBACK
Definition: ndis.h:685
#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA
Definition: ndis.h:682
#define NdisMoveMemory(Destination, Source, Length)
Definition: ndis.h:3896
#define NDIS_PNP_WAKE_UP_MAGIC_PACKET
Definition: ntddndis.h:372
enum _NDIS_MEDIUM NDIS_MEDIUM
#define OID_GEN_TRANSMIT_BLOCK_SIZE
Definition: ntddndis.h:242
#define OID_GEN_XMIT_OK
Definition: ntddndis.h:267
#define OID_GEN_MAXIMUM_TOTAL_SIZE
Definition: ntddndis.h:249
#define OID_GEN_XMIT_ERROR
Definition: ntddndis.h:269
#define OID_GEN_VENDOR_DRIVER_VERSION
Definition: ntddndis.h:254
#define OID_802_3_PERMANENT_ADDRESS
Definition: ntddndis.h:302
#define OID_GEN_LINK_SPEED
Definition: ntddndis.h:239
#define OID_GEN_VENDOR_ID
Definition: ntddndis.h:244
#define OID_802_3_RCV_OVERRUN
Definition: ntddndis.h:312
#define OID_GEN_CURRENT_PACKET_FILTER
Definition: ntddndis.h:246
@ NdisMediaStateConnected
Definition: ntddndis.h:470
@ NdisMediaStateDisconnected
Definition: ntddndis.h:471
#define OID_GEN_RCV_NO_BUFFER
Definition: ntddndis.h:271
#define OID_802_3_XMIT_HEARTBEAT_FAILURE
Definition: ntddndis.h:314
enum _NDIS_DEVICE_POWER_STATE NDIS_DEVICE_POWER_STATE
#define OID_802_3_XMIT_ONE_COLLISION
Definition: ntddndis.h:308
#define OID_802_3_XMIT_MORE_COLLISIONS
Definition: ntddndis.h:309
#define OID_802_3_XMIT_MAX_COLLISIONS
Definition: ntddndis.h:311
#define OID_GEN_RECEIVE_BUFFER_SPACE
Definition: ntddndis.h:241
#define OID_802_3_XMIT_TIMES_CRS_LOST
Definition: ntddndis.h:315
#define OID_802_3_MAXIMUM_LIST_SIZE
Definition: ntddndis.h:305
#define OID_GEN_DRIVER_VERSION
Definition: ntddndis.h:248
#define OID_802_3_XMIT_UNDERRUN
Definition: ntddndis.h:313
#define OID_802_3_XMIT_LATE_COLLISIONS
Definition: ntddndis.h:316
#define OID_802_3_CURRENT_ADDRESS
Definition: ntddndis.h:303
#define OID_802_3_MULTICAST_LIST
Definition: ntddndis.h:304
#define OID_GEN_DIRECTED_FRAMES_RCV
Definition: ntddndis.h:281
#define OID_PNP_ENABLE_WAKE_UP
Definition: ntddndis.h:366
#define OID_GEN_TRANSMIT_BUFFER_SPACE
Definition: ntddndis.h:240
#define OID_GEN_MEDIA_SUPPORTED
Definition: ntddndis.h:235
@ NdisMedium802_3
Definition: ntddndis.h:188
#define OID_GEN_BROADCAST_FRAMES_RCV
Definition: ntddndis.h:285
#define OID_GEN_MAXIMUM_FRAME_SIZE
Definition: ntddndis.h:238
#define OID_GEN_RCV_CRC_ERROR
Definition: ntddndis.h:286
#define OID_GEN_MEDIA_IN_USE
Definition: ntddndis.h:236
#define OID_GEN_MEDIA_CONNECT_STATUS
Definition: ntddndis.h:252
#define OID_GEN_RCV_OK
Definition: ntddndis.h:268
#define OID_GEN_MAXIMUM_LOOKAHEAD
Definition: ntddndis.h:237
#define OID_802_3_RCV_ERROR_ALIGNMENT
Definition: ntddndis.h:307
int NDIS_STATUS
Definition: ntddndis.h:475
#define OID_PNP_QUERY_POWER
Definition: ntddndis.h:362
#define NDIS_PNP_WAKE_UP_LINK_CHANGE
Definition: ntddndis.h:374
#define OID_GEN_RCV_ERROR
Definition: ntddndis.h:270
@ NdisHardwareStatusNotReady
Definition: ntddndis.h:454
@ NdisHardwareStatusReady
Definition: ntddndis.h:450
#define OID_PNP_CAPABILITIES
Definition: ntddndis.h:360
#define OID_GEN_CURRENT_LOOKAHEAD
Definition: ntddndis.h:247
#define OID_GEN_MAC_OPTIONS
Definition: ntddndis.h:251
#define OID_GEN_VENDOR_DESCRIPTION
Definition: ntddndis.h:245
#define OID_GEN_SUPPORTED_LIST
Definition: ntddndis.h:233
@ NdisDeviceStateD3
Definition: ntddndis.h:41
#define OID_802_3_XMIT_DEFERRED
Definition: ntddndis.h:310
#define OID_GEN_RECEIVE_BLOCK_SIZE
Definition: ntddndis.h:243
#define OID_GEN_MAXIMUM_SEND_PACKETS
Definition: ntddndis.h:253
#define OID_GEN_TRANSMIT_QUEUE_LENGTH
Definition: ntddndis.h:287
#define OID_GEN_HARDWARE_STATUS
Definition: ntddndis.h:234
#define OID_GEN_MULTICAST_FRAMES_RCV
Definition: ntddndis.h:283
#define NDIS_PNP_WAKE_UP_PATTERN_MATCH
Definition: ntddndis.h:373
enum _NDIS_HARDWARE_STATUS NDIS_HARDWARE_STATUS
unsigned short USHORT
Definition: pedump.c:61
ULONG MulticastMaxEntries
Definition: dc21x4.h:202
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: dc21x4.h:200
ULONG TcbSlots
Definition: dc21x4.h:137
ULONG RcbCount
Definition: dc21x4.h:213
ULONG PacketFilter
Definition: dc21x4.h:154
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: dc21x4.h:199
BOOLEAN LinkUp
Definition: dc21x4.h:176
struct _DC21X4_ADAPTER::@992 MulticastList[DC_MULTICAST_LIST_SIZE]
ULONG Features
Definition: dc21x4.h:107
ULONG WakeUpFlags
Definition: dc21x4.h:192
void * PVOID
Definition: typedefs.h:50
unsigned short Ushort
Definition: utypes.h:44
unsigned long Ulong
Definition: utypes.h:42
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
Definition: wdfdevice.h:3034
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960
char CHAR
Definition: xmlstorage.h:175

Referenced by DriverEntry().

◆ DcQueryStatisticCounter()

static VOID DcQueryStatisticCounter ( _In_ PDC21X4_ADAPTER  Adapter,
_In_ NDIS_OID  Oid,
_Out_ PULONG64  Counter 
)
static

Definition at line 79 of file requests.c.

83{
84 /* When there is no workaround, this function is used to read the hardware RX counters */
85 if (!(Adapter->Features & DC_NEED_RX_OVERFLOW_WORKAROUND))
86 {
87 ULONG RxCounters;
88
89 /*
90 * Read the RX missed frame counter. Note that the RX overflow counter is not supported
91 * on older chips without the workaround enabled and reads will return 0xFFFE****.
92 */
93 RxCounters = DC_READ(Adapter, DcCsr8_RxCounters);
94
95 Adapter->Statistics.ReceiveNoBuffers += RxCounters & DC_COUNTER_RX_NO_BUFFER_MASK;
96 }
97
98 switch (Oid)
99 {
100 case OID_GEN_XMIT_OK:
101 *Counter = Adapter->Statistics.TransmitOk;
102 break;
103 case OID_GEN_RCV_OK:
104 *Counter = Adapter->Statistics.ReceiveOk;
105 break;
107 *Counter = Adapter->Statistics.TransmitErrors;
108 break;
110 *Counter = Adapter->Statistics.ReceiveErrors;
111 break;
113 *Counter = Adapter->Statistics.ReceiveNoBuffers;
114 break;
116 *Counter = Adapter->Statistics.ReceiveUnicast;
117 break;
119 *Counter = Adapter->Statistics.ReceiveMulticast;
120 break;
122 *Counter = Adapter->Statistics.ReceiveBroadcast;
123 break;
125 *Counter = Adapter->Statistics.ReceiveCrcErrors;
126 break;
128 *Counter = Adapter->Statistics.ReceiveAlignmentErrors;
129 break;
131 *Counter = Adapter->Statistics.TransmitOneRetry;
132 break;
134 *Counter = Adapter->Statistics.TransmitMoreCollisions;
135 break;
137 *Counter = Adapter->Statistics.TransmitDeferred;
138 break;
140 *Counter = Adapter->Statistics.TransmitExcessiveCollisions;
141 break;
143 *Counter = Adapter->Statistics.ReceiveOverrunErrors;
144 break;
146 *Counter = Adapter->Statistics.TransmitUnderrunErrors;
147 break;
149 *Counter = Adapter->Statistics.TransmitHeartbeatErrors;
150 break;
152 *Counter = Adapter->Statistics.TransmitLostCarrierSense;
153 break;
155 *Counter = Adapter->Statistics.TransmitLateCollisions;
156 break;
157
158 default:
159 ASSERT(FALSE);
161 break;
162 }
163}
#define DC_NEED_RX_OVERFLOW_WORKAROUND
Definition: dc21x4.h:108
@ DcCsr8_RxCounters
Definition: dc21x4hw.h:182
#define DC_COUNTER_RX_NO_BUFFER_MASK
Definition: dc21x4hw.h:365
static LARGE_INTEGER Counter
Definition: clock.c:43

Referenced by DcQueryInformation().

◆ DcSetInformation()

NDIS_STATUS NTAPI DcSetInformation ( _In_ NDIS_HANDLE  MiniportAdapterContext,
_In_ NDIS_OID  Oid,
_In_ PVOID  InformationBuffer,
_In_ ULONG  InformationBufferLength,
_Out_ PULONG  BytesRead,
_Out_ PULONG  BytesNeeded 
)

Definition at line 483 of file requests.c.

490{
491 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
493 ULONG GenericUlong;
494
495 *BytesRead = 0;
496 *BytesNeeded = 0;
497
498 switch (Oid)
499 {
501 {
502 if (InformationBufferLength < sizeof(ULONG))
503 {
504 *BytesNeeded = sizeof(ULONG);
506 break;
507 }
508
509 *BytesRead = sizeof(ULONG);
510 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
511
512 if (GenericUlong & ~DC_PACKET_FILTERS)
513 {
515 break;
516 }
517
518 Status = DcApplyPacketFilter(Adapter, GenericUlong);
519 break;
520 }
521
523 {
524 ULONG Size;
525
526 if (InformationBufferLength % ETH_LENGTH_OF_ADDRESS)
527 {
528 *BytesNeeded = (InformationBufferLength / ETH_LENGTH_OF_ADDRESS) *
531 break;
532 }
533
535 if (InformationBufferLength > Size)
536 {
537 *BytesNeeded = Size;
539 break;
540 }
541
542 *BytesRead = InformationBufferLength;
543 NdisMoveMemory(Adapter->MulticastList, InformationBuffer, InformationBufferLength);
544
545 Adapter->MulticastCount = InformationBufferLength / ETH_LENGTH_OF_ADDRESS;
546
547 Status = DcUpdateMulticastList(Adapter);
548 break;
549 }
550
552 {
553 if (InformationBufferLength < sizeof(ULONG))
554 {
555 *BytesNeeded = sizeof(ULONG);
557 break;
558 }
559
560 /* Nothing to do */
561 *BytesRead = sizeof(ULONG);
562 break;
563 }
564
566 {
567 if (InformationBufferLength < sizeof(ULONG))
568 {
569 *BytesNeeded = sizeof(ULONG);
571 break;
572 }
573
574 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
575 {
577 }
578
579 *BytesRead = sizeof(ULONG);
580 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
581
582 Adapter->WakeUpFlags = GenericUlong;
583 break;
584 }
585
587 {
588 if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
589 {
590 *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
592 break;
593 }
594
595 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
596 {
598 }
599
601
602 Status = DcAddWakeUpPattern(Adapter, InformationBuffer);
603 break;
604 }
605
607 {
608 if (InformationBufferLength < sizeof(NDIS_PM_PACKET_PATTERN))
609 {
610 *BytesNeeded = sizeof(NDIS_PM_PACKET_PATTERN);
612 break;
613 }
614
615 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
616 {
618 }
619
621
622 Status = DcRemoveWakeUpPattern(Adapter, InformationBuffer);
623 break;
624 }
625
627 {
628 if (InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE))
629 {
630 *BytesNeeded = sizeof(NDIS_DEVICE_POWER_STATE);
632 break;
633 }
634
635 if (!(Adapter->Features & DC_HAS_POWER_MANAGEMENT))
636 {
638 }
639
640 *BytesRead = sizeof(ULONG);
641 NdisMoveMemory(&GenericUlong, InformationBuffer, sizeof(ULONG));
642
643 if (GenericUlong < NdisDeviceStateD0 || GenericUlong > NdisDeviceStateD3)
644 {
645 ASSERT(FALSE);
647 break;
648 }
649
650 DcSetPower(Adapter, GenericUlong);
651 break;
652 }
653
654 default:
656 break;
657 }
658
659 return Status;
660}
NDIS_STATUS DcUpdateMulticastList(_In_ PDC21X4_ADAPTER Adapter)
Definition: hardware.c:375
NDIS_STATUS DcSetPower(_In_ PDC21X4_ADAPTER Adapter, _In_ NDIS_DEVICE_POWER_STATE PowerState)
Definition: power.c:191
#define DC_PACKET_FILTERS
Definition: dc21x4.h:46
NDIS_STATUS DcApplyPacketFilter(_In_ PDC21X4_ADAPTER Adapter, _In_ ULONG PacketFilter)
Definition: hardware.c:401
NDIS_STATUS DcRemoveWakeUpPattern(_In_ PDC21X4_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN PmPattern)
Definition: power.c:205
NDIS_STATUS DcAddWakeUpPattern(_In_ PDC21X4_ADAPTER Adapter, _In_ PNDIS_PM_PACKET_PATTERN PmPattern)
Definition: power.c:215
#define NDIS_STATUS_INVALID_DATA
Definition: ndis.h:486
#define NDIS_STATUS_INVALID_LENGTH
Definition: ndis.h:485
#define NDIS_STATUS_MULTICAST_FULL
Definition: ndis.h:473
struct _NDIS_PM_PACKET_PATTERN NDIS_PM_PACKET_PATTERN
#define OID_PNP_SET_POWER
Definition: ntddndis.h:361
#define OID_PNP_ADD_WAKE_UP_PATTERN
Definition: ntddndis.h:363
#define OID_PNP_REMOVE_WAKE_UP_PATTERN
Definition: ntddndis.h:364
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870

Referenced by DriverEntry().

Variable Documentation

◆ DcpSupportedOidList

const NDIS_OID DcpSupportedOidList[]
static

Definition at line 16 of file requests.c.

Referenced by DcQueryInformation().