Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2324 lines
69 KiB

  1. #if ARCNET
  2. #include <afilter.h>
  3. #endif
  4. #include <xfilter.h>
  5. #define NDIS_M_MAX_LOOKAHEAD 526
  6. //
  7. // Function types for NDIS_MINIPORT_CHARACTERISTICS
  8. //
  9. typedef
  10. BOOLEAN
  11. (*W_CHECK_FOR_HANG_HANDLER)(
  12. IN NDIS_HANDLE MiniportAdapterContext
  13. );
  14. typedef
  15. VOID
  16. (*W_DISABLE_INTERRUPT_HANDLER)(
  17. IN NDIS_HANDLE MiniportAdapterContext
  18. );
  19. typedef
  20. VOID
  21. (*W_ENABLE_INTERRUPT_HANDLER)(
  22. IN NDIS_HANDLE MiniportAdapterContext
  23. );
  24. typedef
  25. VOID
  26. (*W_HALT_HANDLER)(
  27. IN NDIS_HANDLE MiniportAdapterContext
  28. );
  29. typedef
  30. VOID
  31. (*W_HANDLE_INTERRUPT_HANDLER)(
  32. IN NDIS_HANDLE MiniportAdapterContext
  33. );
  34. typedef
  35. NDIS_STATUS
  36. (*W_INITIALIZE_HANDLER)(
  37. OUT PNDIS_STATUS OpenErrorStatus,
  38. OUT PUINT SelectedMediumIndex,
  39. IN PNDIS_MEDIUM MediumArray,
  40. IN UINT MediumArraySize,
  41. IN NDIS_HANDLE MiniportAdapterContext,
  42. IN NDIS_HANDLE WrapperConfigurationContext
  43. );
  44. typedef
  45. VOID
  46. (*W_ISR_HANDLER)(
  47. OUT PBOOLEAN InterruptRecognized,
  48. OUT PBOOLEAN QueueMiniportHandleInterrupt,
  49. IN NDIS_HANDLE MiniportAdapterContext
  50. );
  51. typedef
  52. NDIS_STATUS
  53. (*W_QUERY_INFORMATION_HANDLER)(
  54. IN NDIS_HANDLE MiniportAdapterContext,
  55. IN NDIS_OID Oid,
  56. IN PVOID InformationBuffer,
  57. IN ULONG InformationBufferLength,
  58. OUT PULONG BytesWritten,
  59. OUT PULONG BytesNeeded
  60. );
  61. typedef
  62. NDIS_STATUS
  63. (*W_RECONFIGURE_HANDLER)(
  64. OUT PNDIS_STATUS OpenErrorStatus,
  65. IN NDIS_HANDLE MiniportAdapterContext OPTIONAL,
  66. IN NDIS_HANDLE WrapperConfigurationContext
  67. );
  68. typedef
  69. NDIS_STATUS
  70. (*W_RESET_HANDLER)(
  71. OUT PBOOLEAN AddressingReset,
  72. IN NDIS_HANDLE MiniportAdapterContext
  73. );
  74. typedef
  75. NDIS_STATUS
  76. (*W_SEND_HANDLER)(
  77. IN NDIS_HANDLE MiniportAdapterContext,
  78. IN PNDIS_PACKET Packet,
  79. IN UINT Flags
  80. );
  81. typedef
  82. NDIS_STATUS
  83. (*WM_SEND_HANDLER)(
  84. IN NDIS_HANDLE MiniportAdapterContext,
  85. IN NDIS_HANDLE NdisLinkHandle,
  86. IN PNDIS_WAN_PACKET Packet
  87. );
  88. typedef
  89. NDIS_STATUS
  90. (*W_SET_INFORMATION_HANDLER)(
  91. IN NDIS_HANDLE MiniportAdapterContext,
  92. IN NDIS_OID Oid,
  93. IN PVOID InformationBuffer,
  94. IN ULONG InformationBufferLength,
  95. OUT PULONG BytesRead,
  96. OUT PULONG BytesNeeded
  97. );
  98. typedef
  99. NDIS_STATUS
  100. (*W_TRANSFER_DATA_HANDLER)(
  101. OUT PNDIS_PACKET Packet,
  102. OUT PUINT BytesTransferred,
  103. IN NDIS_HANDLE MiniportAdapterContext,
  104. IN NDIS_HANDLE MiniportReceiveContext,
  105. IN UINT ByteOffset,
  106. IN UINT BytesToTransfer
  107. );
  108. typedef
  109. NDIS_STATUS
  110. (*WM_TRANSFER_DATA_HANDLER)(
  111. VOID
  112. );
  113. typedef struct _NDIS30_MINIPORT_CHARACTERISTICS
  114. {
  115. UCHAR MajorNdisVersion;
  116. UCHAR MinorNdisVersion;
  117. USHORT Filler;
  118. UINT Reserved;
  119. W_CHECK_FOR_HANG_HANDLER CheckForHangHandler;
  120. W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
  121. W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
  122. W_HALT_HANDLER HaltHandler;
  123. W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
  124. W_INITIALIZE_HANDLER InitializeHandler;
  125. W_ISR_HANDLER ISRHandler;
  126. W_QUERY_INFORMATION_HANDLER QueryInformationHandler;
  127. W_RECONFIGURE_HANDLER ReconfigureHandler;
  128. W_RESET_HANDLER ResetHandler;
  129. union
  130. {
  131. W_SEND_HANDLER SendHandler;
  132. WM_SEND_HANDLER WanSendHandler;
  133. };
  134. W_SET_INFORMATION_HANDLER SetInformationHandler;
  135. union
  136. {
  137. W_TRANSFER_DATA_HANDLER TransferDataHandler;
  138. WM_TRANSFER_DATA_HANDLER WanTransferDataHandler;
  139. };
  140. } NDIS30_MINIPORT_CHARACTERISTICS;
  141. //
  142. // Miniport extensions for NDIS 4.0
  143. //
  144. typedef
  145. VOID
  146. (*W_RETURN_PACKET_HANDLER)(
  147. IN NDIS_HANDLE MiniportAdapterContext,
  148. IN PNDIS_PACKET Packet
  149. );
  150. //
  151. // NDIS 4.0 extension
  152. //
  153. typedef
  154. VOID
  155. (*W_SEND_PACKETS_HANDLER)(
  156. IN NDIS_HANDLE MiniportAdapterContext,
  157. IN PPNDIS_PACKET PacketArray,
  158. IN UINT NumberOfPackets
  159. );
  160. typedef
  161. VOID
  162. (*W_ALLOCATE_COMPLETE_HANDLER)(
  163. IN NDIS_HANDLE MiniportAdapterContext,
  164. IN PVOID VirtualAddress,
  165. IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
  166. IN ULONG Length,
  167. IN PVOID Context
  168. );
  169. typedef struct _NDIS40_MINIPORT_CHARACTERISTICS
  170. {
  171. #ifdef __cplusplus
  172. NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars;
  173. #else
  174. NDIS30_MINIPORT_CHARACTERISTICS;
  175. #endif
  176. //
  177. // Extensions for NDIS 4.0
  178. //
  179. W_RETURN_PACKET_HANDLER ReturnPacketHandler;
  180. W_SEND_PACKETS_HANDLER SendPacketsHandler;
  181. W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
  182. } NDIS40_MINIPORT_CHARACTERISTICS;
  183. //
  184. // Miniport extensions for NDIS 5.0
  185. //
  186. //
  187. // NDIS 5.0 extension - however available for miniports only
  188. //
  189. //
  190. // W_CO_CREATE_VC_HANDLER is a synchronous call
  191. //
  192. typedef
  193. NDIS_STATUS
  194. (*W_CO_CREATE_VC_HANDLER)(
  195. IN NDIS_HANDLE MiniportAdapterContext,
  196. IN NDIS_HANDLE NdisVcHandle,
  197. OUT PNDIS_HANDLE MiniportVcContext
  198. );
  199. typedef
  200. NDIS_STATUS
  201. (*W_CO_DELETE_VC_HANDLER)(
  202. IN NDIS_HANDLE MiniportVcContext
  203. );
  204. typedef
  205. NDIS_STATUS
  206. (*W_CO_ACTIVATE_VC_HANDLER)(
  207. IN NDIS_HANDLE MiniportVcContext,
  208. IN OUT PCO_CALL_PARAMETERS CallParameters
  209. );
  210. typedef
  211. NDIS_STATUS
  212. (*W_CO_DEACTIVATE_VC_HANDLER)(
  213. IN NDIS_HANDLE MiniportVcContext
  214. );
  215. typedef
  216. VOID
  217. (*W_CO_SEND_PACKETS_HANDLER)(
  218. IN NDIS_HANDLE MiniportVcContext,
  219. IN PPNDIS_PACKET PacketArray,
  220. IN UINT NumberOfPackets
  221. );
  222. typedef
  223. NDIS_STATUS
  224. (*W_CO_REQUEST_HANDLER)(
  225. IN NDIS_HANDLE MiniportAdapterContext,
  226. IN NDIS_HANDLE MiniportVcContext OPTIONAL,
  227. IN OUT PNDIS_REQUEST NdisRequest
  228. );
  229. typedef struct _NDIS50_MINIPORT_CHARACTERISTICS
  230. {
  231. #ifdef __cplusplus
  232. NDIS40_MINIPORT_CHARACTERISTICS Ndis40Chars;
  233. #else
  234. NDIS40_MINIPORT_CHARACTERISTICS;
  235. #endif
  236. //
  237. // Extensions for NDIS 5.0
  238. //
  239. W_CO_CREATE_VC_HANDLER CoCreateVcHandler;
  240. W_CO_DELETE_VC_HANDLER CoDeleteVcHandler;
  241. W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler;
  242. W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler;
  243. W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler;
  244. W_CO_REQUEST_HANDLER CoRequestHandler;
  245. } NDIS50_MINIPORT_CHARACTERISTICS;
  246. //
  247. // Miniport extensions for NDIS 5.1
  248. //
  249. typedef VOID
  250. (*W_CANCEL_SEND_PACKETS_HANDLER)(
  251. IN NDIS_HANDLE MiniportAdapterContext,
  252. IN PVOID CancelId
  253. );
  254. //
  255. // power profiles
  256. //
  257. typedef enum _NDIS_POWER_PROFILE
  258. {
  259. NdisPowerProfileBattery,
  260. NdisPowerProfileAcOnLine
  261. } NDIS_POWER_PROFILE, *PNDIS_POWER_PROFILE;
  262. typedef enum _NDIS_DEVICE_PNP_EVENT
  263. {
  264. NdisDevicePnPEventQueryRemoved,
  265. NdisDevicePnPEventRemoved,
  266. NdisDevicePnPEventSurpriseRemoved,
  267. NdisDevicePnPEventQueryStopped,
  268. NdisDevicePnPEventStopped,
  269. NdisDevicePnPEventPowerProfileChanged,
  270. NdisDevicePnPEventMaximum
  271. } NDIS_DEVICE_PNP_EVENT, *PNDIS_DEVICE_PNP_EVENT;
  272. typedef VOID
  273. (*W_PNP_EVENT_NOTIFY_HANDLER)(
  274. IN NDIS_HANDLE MiniportAdapterContext,
  275. IN NDIS_DEVICE_PNP_EVENT DevicePnPEvent,
  276. IN PVOID InformationBuffer,
  277. IN ULONG InformationBufferLength
  278. );
  279. typedef VOID
  280. (*W_MINIPORT_SHUTDOWN_HANDLER) (
  281. IN NDIS_HANDLE MiniportAdapterContext
  282. );
  283. #if NDIS_RECV_SCALE
  284. typedef
  285. BOOLEAN
  286. (*MINIPORT_ISR_HANDLER)(
  287. IN NDIS_HANDLE MiniportInterruptContext,
  288. OUT PBOOLEAN QueueDefaultInterruptDpc,
  289. OUT PULONG TargetProcessors
  290. );
  291. typedef
  292. VOID
  293. (*MINIPORT_INTERRUPT_DPC_HANDLER)(
  294. IN NDIS_HANDLE MiniportInterruptContext,
  295. OUT PULONG TargetProcessors
  296. );
  297. typedef struct _NDIS_MINIPORT_INTERRUPT_EX
  298. {
  299. PKINTERRUPT InterruptObject;
  300. KSPIN_LOCK DpcCountLock;
  301. union
  302. {
  303. PVOID Reserved;
  304. PVOID InterruptContext;
  305. };
  306. MINIPORT_ISR_HANDLER MiniportIsr;
  307. MINIPORT_INTERRUPT_DPC_HANDLER MiniportDpc;
  308. KDPC InterruptDpc;
  309. PNDIS_MINIPORT_BLOCK Miniport;
  310. UCHAR DpcCount;
  311. BOOLEAN Filler1;
  312. //
  313. // This is used to tell when all the Dpcs for the adapter are completed.
  314. //
  315. KEVENT DpcsCompletedEvent;
  316. BOOLEAN SharedInterrupt;
  317. BOOLEAN IsrRequested;
  318. struct _NDIS_MINIPORT_INTERRUPT_EX *NextInterrupt;
  319. ULONG DpcQueued; // bitmap of processors for which a Dpc is already queud
  320. KDPC Dpc[NDIS_MAX_PROCESSOR_COUNT];
  321. } NDIS_MINIPORT_INTERRUPT_EX, *PNDIS_MINIPORT_INTERRUPT_EX;
  322. EXPORT
  323. NDIS_STATUS
  324. NdisMRegisterInterruptEx(
  325. OUT PNDIS_MINIPORT_INTERRUPT_EX Interrupt,
  326. IN NDIS_HANDLE MiniportAdapterHandle,
  327. IN UINT InterruptVector,
  328. IN UINT InterruptLevel,
  329. IN BOOLEAN RequestIsr,
  330. IN BOOLEAN SharedInterrupt,
  331. IN NDIS_INTERRUPT_MODE InterruptMode
  332. );
  333. EXPORT
  334. VOID
  335. NdisMDeregisterInterruptEx(
  336. IN PNDIS_MINIPORT_INTERRUPT_EX MiniportInterrupt
  337. );
  338. //
  339. // for interrupts registered with NdisMRegisterInterruptEx
  340. // BOOLEAN
  341. // NdisMSynchronizeWithInterruptEx(
  342. // IN PNDIS_MINIPORT_INTERRUPT_EX Interrupt,
  343. // IN PVOID SynchronizeFunction,
  344. // IN PVOID SynchronizeContext
  345. // );
  346. #define NdisMSynchronizeWithInterruptEx(_Interrupt, _SynchronizeFunction, _SynchronizeContext) \
  347. NdisMSynchronizeWithInterrupt((PNDIS_MINIPORT_INTERRUPT)(_Interrupt), _SynchronizeFunction, _SynchronizeContext)
  348. #endif
  349. typedef struct _NDIS51_MINIPORT_CHARACTERISTICS
  350. {
  351. #ifdef __cplusplus
  352. NDIS50_MINIPORT_CHARACTERISTICS Ndis50Chars;
  353. #else
  354. NDIS50_MINIPORT_CHARACTERISTICS;
  355. #endif
  356. //
  357. // Extensions for NDIS 5.1
  358. //
  359. W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler;
  360. W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler;
  361. W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler;
  362. #if NDIS_RECV_SCALE
  363. MINIPORT_ISR_HANDLER MiniportISRHandler;
  364. MINIPORT_INTERRUPT_DPC_HANDLER InterruptDpcHandler;
  365. #else
  366. PVOID Reserved1;
  367. PVOID Reserved2;
  368. #endif
  369. PVOID Reserved3;
  370. PVOID Reserved4;
  371. } NDIS51_MINIPORT_CHARACTERISTICS;
  372. #ifdef NDIS51_MINIPORT
  373. typedef struct _NDIS51_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS;
  374. #else
  375. #ifdef NDIS50_MINIPORT
  376. typedef struct _NDIS50_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS;
  377. #else
  378. #ifdef NDIS40_MINIPORT
  379. typedef struct _NDIS40_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS;
  380. #else
  381. typedef struct _NDIS30_MINIPORT_CHARACTERISTICS NDIS_MINIPORT_CHARACTERISTICS;
  382. #endif
  383. #endif
  384. #endif
  385. typedef NDIS_MINIPORT_CHARACTERISTICS * PNDIS_MINIPORT_CHARACTERISTICS;
  386. typedef NDIS_MINIPORT_CHARACTERISTICS NDIS_WAN_MINIPORT_CHARACTERISTICS;
  387. typedef NDIS_WAN_MINIPORT_CHARACTERISTICS * PNDIS_MINIPORT_CHARACTERISTICS;
  388. typedef struct _NDIS_MINIPORT_INTERRUPT
  389. {
  390. PKINTERRUPT InterruptObject;
  391. KSPIN_LOCK DpcCountLock;
  392. PVOID Reserved;
  393. W_ISR_HANDLER MiniportIsr;
  394. W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
  395. KDPC InterruptDpc;
  396. PNDIS_MINIPORT_BLOCK Miniport;
  397. UCHAR DpcCount;
  398. BOOLEAN Filler1;
  399. //
  400. // This is used to tell when all the Dpcs for the adapter are completed.
  401. //
  402. KEVENT DpcsCompletedEvent;
  403. BOOLEAN SharedInterrupt;
  404. BOOLEAN IsrRequested;
  405. } NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
  406. typedef struct _NDIS_MINIPORT_TIMER
  407. {
  408. KTIMER Timer;
  409. KDPC Dpc;
  410. PNDIS_TIMER_FUNCTION MiniportTimerFunction;
  411. PVOID MiniportTimerContext;
  412. PNDIS_MINIPORT_BLOCK Miniport;
  413. struct _NDIS_MINIPORT_TIMER *NextTimer;
  414. } NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
  415. typedef
  416. VOID
  417. (*FILTER_PACKET_INDICATION_HANDLER)(
  418. IN NDIS_HANDLE Miniport,
  419. IN PPNDIS_PACKET PacketArray,
  420. IN UINT NumberOfPackets
  421. );
  422. typedef
  423. VOID
  424. (*ETH_RCV_INDICATE_HANDLER)(
  425. IN PETH_FILTER Filter,
  426. IN NDIS_HANDLE MacReceiveContext,
  427. IN PCHAR Address,
  428. IN PVOID HeaderBuffer,
  429. IN UINT HeaderBufferSize,
  430. IN PVOID LookaheadBuffer,
  431. IN UINT LookaheadBufferSize,
  432. IN UINT PacketSize
  433. );
  434. typedef
  435. VOID
  436. (*ETH_RCV_COMPLETE_HANDLER)(
  437. IN PETH_FILTER Filter
  438. );
  439. typedef
  440. VOID
  441. (*FDDI_RCV_INDICATE_HANDLER)(
  442. IN PFDDI_FILTER Filter,
  443. IN NDIS_HANDLE MacReceiveContext,
  444. IN PCHAR Address,
  445. IN UINT AddressLength,
  446. IN PVOID HeaderBuffer,
  447. IN UINT HeaderBufferSize,
  448. IN PVOID LookaheadBuffer,
  449. IN UINT LookaheadBufferSize,
  450. IN UINT PacketSize
  451. );
  452. typedef
  453. VOID
  454. (*FDDI_RCV_COMPLETE_HANDLER)(
  455. IN PFDDI_FILTER Filter
  456. );
  457. typedef
  458. VOID
  459. (*TR_RCV_INDICATE_HANDLER)(
  460. IN PTR_FILTER Filter,
  461. IN NDIS_HANDLE MacReceiveContext,
  462. IN PVOID HeaderBuffer,
  463. IN UINT HeaderBufferSize,
  464. IN PVOID LookaheadBuffer,
  465. IN UINT LookaheadBufferSize,
  466. IN UINT PacketSize
  467. );
  468. typedef
  469. VOID
  470. (*TR_RCV_COMPLETE_HANDLER)(
  471. IN PTR_FILTER Filter
  472. );
  473. typedef
  474. VOID
  475. (*WAN_RCV_HANDLER)(
  476. OUT PNDIS_STATUS Status,
  477. IN NDIS_HANDLE MiniportAdapterHandle,
  478. IN NDIS_HANDLE NdisLinkContext,
  479. IN PUCHAR Packet,
  480. IN ULONG PacketSize
  481. );
  482. typedef
  483. VOID
  484. (*WAN_RCV_COMPLETE_HANDLER)(
  485. IN NDIS_HANDLE MiniportAdapterHandle,
  486. IN NDIS_HANDLE NdisLinkContext
  487. );
  488. typedef
  489. VOID
  490. (*NDIS_M_SEND_COMPLETE_HANDLER)(
  491. IN NDIS_HANDLE MiniportAdapterHandle,
  492. IN PNDIS_PACKET Packet,
  493. IN NDIS_STATUS Status
  494. );
  495. typedef
  496. VOID
  497. (*NDIS_WM_SEND_COMPLETE_HANDLER)(
  498. IN NDIS_HANDLE MiniportAdapterHandle,
  499. IN PVOID Packet,
  500. IN NDIS_STATUS Status
  501. );
  502. typedef
  503. VOID
  504. (*NDIS_M_TD_COMPLETE_HANDLER)(
  505. IN NDIS_HANDLE MiniportAdapterHandle,
  506. IN PNDIS_PACKET Packet,
  507. IN NDIS_STATUS Status,
  508. IN UINT BytesTransferred
  509. );
  510. typedef
  511. VOID
  512. (*NDIS_M_SEND_RESOURCES_HANDLER)(
  513. IN NDIS_HANDLE MiniportAdapterHandle
  514. );
  515. typedef
  516. VOID
  517. (*NDIS_M_STATUS_HANDLER)(
  518. IN NDIS_HANDLE MiniportHandle,
  519. IN NDIS_STATUS GeneralStatus,
  520. IN PVOID StatusBuffer,
  521. IN UINT StatusBufferSize
  522. );
  523. typedef
  524. VOID
  525. (*NDIS_M_STS_COMPLETE_HANDLER)(
  526. IN NDIS_HANDLE MiniportAdapterHandle
  527. );
  528. typedef
  529. VOID
  530. (*NDIS_M_REQ_COMPLETE_HANDLER)(
  531. IN NDIS_HANDLE MiniportAdapterHandle,
  532. IN NDIS_STATUS Status
  533. );
  534. typedef
  535. VOID
  536. (*NDIS_M_RESET_COMPLETE_HANDLER)(
  537. IN NDIS_HANDLE MiniportAdapterHandle,
  538. IN NDIS_STATUS Status,
  539. IN BOOLEAN AddressingReset
  540. );
  541. typedef
  542. BOOLEAN
  543. (FASTCALL *NDIS_M_START_SENDS)(
  544. IN PNDIS_MINIPORT_BLOCK Miniport
  545. );
  546. //
  547. // Defines the type of work item.
  548. //
  549. typedef enum _NDIS_WORK_ITEM_TYPE
  550. {
  551. NdisWorkItemRequest,
  552. NdisWorkItemSend,
  553. NdisWorkItemReturnPackets,
  554. NdisWorkItemResetRequested,
  555. NdisWorkItemResetInProgress,
  556. NdisWorkItemReserved,
  557. NdisWorkItemMiniportCallback,
  558. NdisMaxWorkItems
  559. } NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
  560. #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
  561. #define NUMBER_OF_SINGLE_WORK_ITEMS 6
  562. //
  563. // Work item structure
  564. //
  565. typedef struct _NDIS_MINIPORT_WORK_ITEM
  566. {
  567. //
  568. // Link for the list of work items of this type.
  569. //
  570. SINGLE_LIST_ENTRY Link;
  571. //
  572. // type of work item and context information.
  573. //
  574. NDIS_WORK_ITEM_TYPE WorkItemType;
  575. PVOID WorkItemContext;
  576. } NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
  577. typedef
  578. NDIS_STATUS
  579. (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
  580. IN PNDIS_MINIPORT_BLOCK Miniport,
  581. IN NDIS_WORK_ITEM_TYPE WorkItemType,
  582. IN PVOID WorkItemContext
  583. );
  584. typedef
  585. NDIS_STATUS
  586. (FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
  587. IN PNDIS_MINIPORT_BLOCK Miniport,
  588. IN NDIS_WORK_ITEM_TYPE WorkItemType,
  589. IN PVOID WorkItemContext
  590. );
  591. typedef
  592. VOID
  593. (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
  594. IN PNDIS_MINIPORT_BLOCK Miniport,
  595. IN NDIS_WORK_ITEM_TYPE WorkItemType,
  596. OUT PVOID * WorkItemContext
  597. );
  598. #if defined(NDIS_WRAPPER)
  599. //
  600. // Structure used by the logging apis
  601. //
  602. typedef struct _NDIS_LOG
  603. {
  604. PNDIS_MINIPORT_BLOCK Miniport; // The owning miniport block
  605. KSPIN_LOCK LogLock; // For serialization
  606. PIRP Irp; // Pending Irp to consume this log
  607. UINT TotalSize; // Size of the log buffer
  608. UINT CurrentSize;// Size of the log buffer
  609. UINT InPtr; // IN part of the circular buffer
  610. UINT OutPtr; // OUT part of the circular buffer
  611. UCHAR LogBuf[1]; // The circular buffer
  612. } NDIS_LOG, *PNDIS_LOG;
  613. #if ARCNET
  614. //
  615. // Arcnet specific stuff
  616. //
  617. #define ARC_SEND_BUFFERS 8
  618. #define ARC_HEADER_SIZE 4
  619. typedef struct _NDIS_ARC_BUF
  620. {
  621. NDIS_HANDLE ArcnetBufferPool;
  622. PUCHAR ArcnetLookaheadBuffer;
  623. UINT NumFree;
  624. ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
  625. } NDIS_ARC_BUF, *PNDIS_ARC_BUF;
  626. #endif
  627. #endif
  628. typedef struct _NDIS_BIND_PATHS
  629. {
  630. UINT Number;
  631. NDIS_STRING Paths[1];
  632. } NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
  633. //
  634. // Do not change the structure below !!!
  635. //
  636. typedef struct
  637. {
  638. union
  639. {
  640. PETH_FILTER EthDB;
  641. PNULL_FILTER NullDB; // Default Filter
  642. };
  643. PTR_FILTER TrDB;
  644. PFDDI_FILTER FddiDB;
  645. #if ARCNET
  646. PARC_FILTER ArcDB;
  647. #else
  648. PVOID XXXDB;
  649. #endif
  650. } FILTERDBS, *PFILTERDBS;
  651. //
  652. // one of these per mini-port registered on a Driver
  653. //
  654. struct _NDIS_MINIPORT_BLOCK
  655. {
  656. PVOID Signature; // MINIPORT_DEVICE_MAGIC_VALUE
  657. PNDIS_MINIPORT_BLOCK NextMiniport; // used by driver's MiniportQueue
  658. PNDIS_M_DRIVER_BLOCK DriverHandle; // pointer to our Driver block
  659. NDIS_HANDLE MiniportAdapterContext; // context when calling mini-port functions
  660. UNICODE_STRING MiniportName; // how mini-port refers to us
  661. PNDIS_BIND_PATHS BindPaths;
  662. NDIS_HANDLE OpenQueue; // queue of opens for this mini-port
  663. REFERENCE ShortRef; // contains spinlock for OpenQueue
  664. NDIS_HANDLE DeviceContext; // Context associated with the intermediate driver
  665. UCHAR Padding1; // DO NOT REMOVE OR NDIS WILL BREAK!!!
  666. //
  667. // Synchronization stuff.
  668. //
  669. // The boolean is used to lock out several DPCs from running at the same time.
  670. //
  671. UCHAR LockAcquired; // EXPOSED via macros. Do not move
  672. UCHAR PmodeOpens; // Count of opens which turned on pmode/all_local
  673. //
  674. // This is the processor number that the miniport's
  675. // interrupt DPC and timers are running on.
  676. //
  677. UCHAR AssignedProcessor;
  678. KSPIN_LOCK Lock;
  679. PNDIS_REQUEST MediaRequest;
  680. PNDIS_MINIPORT_INTERRUPT Interrupt;
  681. ULONG Flags; // Flags to keep track of the
  682. // miniport's state.
  683. ULONG PnPFlags;
  684. //
  685. // Send information
  686. //
  687. LIST_ENTRY PacketList;
  688. PNDIS_PACKET FirstPendingPacket; // This is head of the queue of packets
  689. // waiting to be sent to miniport.
  690. PNDIS_PACKET ReturnPacketsQueue;
  691. //
  692. // Space used for temp. use during request processing
  693. //
  694. ULONG RequestBuffer;
  695. PVOID SetMCastBuffer;
  696. PNDIS_MINIPORT_BLOCK PrimaryMiniport;
  697. PVOID WrapperContext;
  698. //
  699. // context to pass to bus driver when reading or writing config space
  700. //
  701. PVOID BusDataContext;
  702. //
  703. // flag to specify PnP capabilities of the device. we need this to fail query_stop
  704. // query_remove or suspend request if the device can not handle it
  705. //
  706. ULONG PnPCapabilities;
  707. //
  708. // Resource information
  709. //
  710. PCM_RESOURCE_LIST Resources;
  711. //
  712. // Watch-dog timer
  713. //
  714. NDIS_TIMER WakeUpDpcTimer;
  715. //
  716. // Needed for PnP. Upcased version. The buffer is allocated as part of the
  717. // NDIS_MINIPORT_BLOCK itself.
  718. //
  719. // Note:
  720. // the following two fields should be explicitly UNICODE_STRING because
  721. // under Win9x the NDIS_STRING is an ANSI_STRING
  722. //
  723. UNICODE_STRING BaseName;
  724. UNICODE_STRING SymbolicLinkName;
  725. //
  726. // Check for hang stuff
  727. //
  728. ULONG CheckForHangSeconds;
  729. USHORT CFHangTicks;
  730. USHORT CFHangCurrentTick;
  731. //
  732. // Reset information
  733. //
  734. NDIS_STATUS ResetStatus;
  735. NDIS_HANDLE ResetOpen;
  736. //
  737. // Holds media specific information.
  738. //
  739. #ifdef __cplusplus
  740. FILTERDBS FilterDbs; // EXPOSED via macros. Do not move
  741. #else
  742. FILTERDBS; // EXPOSED via macros. Do not move
  743. #endif
  744. FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler;
  745. NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler;
  746. NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler;
  747. NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler;
  748. NDIS_MEDIUM MediaType;
  749. //
  750. // contains mini-port information
  751. //
  752. ULONG BusNumber;
  753. NDIS_INTERFACE_TYPE BusType;
  754. NDIS_INTERFACE_TYPE AdapterType;
  755. PDEVICE_OBJECT DeviceObject;
  756. PDEVICE_OBJECT PhysicalDeviceObject;
  757. PDEVICE_OBJECT NextDeviceObject;
  758. //
  759. // Holds the map registers for this mini-port.
  760. //
  761. struct _MAP_REGISTER_ENTRY *MapRegisters; // EXPOSED via macros. Do not move
  762. //
  763. // List of registered address families. Valid for the call-manager, Null for the client
  764. //
  765. PNDIS_AF_LIST CallMgrAfList;
  766. PVOID MiniportThread;
  767. PVOID SetInfoBuf;
  768. USHORT SetInfoBufLen;
  769. USHORT MaxSendPackets;
  770. //
  771. // Status code that is returned from the fake handlers.
  772. //
  773. NDIS_STATUS FakeStatus;
  774. PVOID LockHandler; // For the filter lock
  775. //
  776. // the following field should be explicitly UNICODE_STRING because
  777. // under Win9x the NDIS_STRING is an ANSI_STRING
  778. //
  779. PUNICODE_STRING pAdapterInstanceName; // Instance specific name for the adapter.
  780. PNDIS_MINIPORT_TIMER TimerQueue;
  781. UINT MacOptions;
  782. //
  783. // RequestInformation
  784. //
  785. PNDIS_REQUEST PendingRequest;
  786. UINT MaximumLongAddresses;
  787. UINT MaximumShortAddresses;
  788. UINT CurrentLookahead;
  789. UINT MaximumLookahead;
  790. //
  791. // For efficiency
  792. //
  793. W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
  794. W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
  795. W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
  796. W_SEND_PACKETS_HANDLER SendPacketsHandler;
  797. NDIS_M_START_SENDS DeferredSendHandler;
  798. //
  799. // The following cannot be unionized.
  800. //
  801. ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler; // EXPOSED via macros. Do not move
  802. TR_RCV_INDICATE_HANDLER TrRxIndicateHandler; // EXPOSED via macros. Do not move
  803. FDDI_RCV_INDICATE_HANDLER FddiRxIndicateHandler; // EXPOSED via macros. Do not move
  804. ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler; // EXPOSED via macros. Do not move
  805. TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler; // EXPOSED via macros. Do not move
  806. FDDI_RCV_COMPLETE_HANDLER FddiRxCompleteHandler; // EXPOSED via macros. Do not move
  807. NDIS_M_STATUS_HANDLER StatusHandler; // EXPOSED via macros. Do not move
  808. NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler; // EXPOSED via macros. Do not move
  809. NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler; // EXPOSED via macros. Do not move
  810. NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler; // EXPOSED via macros. Do not move
  811. NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler; // EXPOSED via macros. Do not move
  812. NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;// EXPOSED via macros. Do not move
  813. WAN_RCV_HANDLER WanRcvHandler; // EXPOSED via macros. Do not move
  814. WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler; // EXPOSED via macros. Do not move
  815. /********************************************************************************************/
  816. /**************** **********/
  817. /**************** STUFF ABOVE IS POTENTIALLY ACCESSED BY MACROS. ADD STUFF BELOW **********/
  818. /**************** SEVERE POSSIBILITY OF BREAKING SOMETHING IF STUFF ABOVE IS MOVED **********/
  819. /**************** **********/
  820. /********************************************************************************************/
  821. #if defined(NDIS_WRAPPER)
  822. PNDIS_MINIPORT_BLOCK NextGlobalMiniport; // used to queue miniport on global miniport queue
  823. //
  824. // Work that the miniport needs to do.
  825. //
  826. SINGLE_LIST_ENTRY WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
  827. SINGLE_LIST_ENTRY SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
  828. UCHAR SendFlags;
  829. UCHAR TrResetRing;
  830. UCHAR ArcnetAddress;
  831. UCHAR XState; // flag to indicate why we have set the fake handlers
  832. union
  833. {
  834. #if ARCNET
  835. PNDIS_ARC_BUF ArcBuf;
  836. #endif
  837. //
  838. // the following field has a different use under NT and Memphis
  839. //
  840. PVOID BusInterface;
  841. };
  842. PNDIS_LOG Log;
  843. //
  844. // Store information here to track adapters
  845. //
  846. ULONG SlotNumber;
  847. PCM_RESOURCE_LIST AllocatedResources;
  848. PCM_RESOURCE_LIST AllocatedResourcesTranslated;
  849. //
  850. // Contains a list of the packet patterns that have been added to the
  851. // adapter.
  852. //
  853. SINGLE_LIST_ENTRY PatternList;
  854. //
  855. // The driver's power management capabilities.
  856. //
  857. NDIS_PNP_CAPABILITIES PMCapabilities;
  858. //
  859. // DeviceCapabilites as received from bus driver
  860. //
  861. DEVICE_CAPABILITIES DeviceCaps;
  862. //
  863. // Contains the wake-up events that are enabled for the miniport.
  864. //
  865. ULONG WakeUpEnable;
  866. //
  867. // The current device state that the adapter is in.
  868. //
  869. DEVICE_POWER_STATE CurrentDevicePowerState;
  870. //
  871. // The following IRP is created in response to a cable disconnect
  872. // from the device. We keep a pointer around in case we need to cancel
  873. // it.
  874. //
  875. PIRP pIrpWaitWake;
  876. SYSTEM_POWER_STATE WaitWakeSystemState;
  877. //
  878. // The following is a pointer to a dynamically allocated array
  879. // of GUID structs. This is used to map GUIDs to OIDs
  880. // for custom GUIDs provided by the miniport.
  881. //
  882. LARGE_INTEGER VcIndex; // Index used to identify a VC.
  883. KSPIN_LOCK VcCountLock; // Lock used to protect VC instance count.
  884. LIST_ENTRY WmiEnabledVcs; // List of WMI enabled VCs
  885. PNDIS_GUID pNdisGuidMap; // This is a list of all the GUIDs
  886. // and OIDs supported including any
  887. // customg GUIDs.
  888. PNDIS_GUID pCustomGuidMap; // This is a pointer into
  889. // the pGuidToOidMap to the
  890. // first custom GUID.
  891. USHORT VcCount; // Number of VC's that have instance names.
  892. USHORT cNdisGuidMap; // This is the number of std. GUIDs
  893. USHORT cCustomGuidMap; // This is the number of custom GUIDs
  894. //
  895. // These two are used temporarily while allocating the map registers.
  896. //
  897. USHORT CurrentMapRegister;
  898. PKEVENT AllocationEvent;
  899. USHORT BaseMapRegistersNeeded;
  900. USHORT SGMapRegistersNeeded;
  901. ULONG MaximumPhysicalMapping;
  902. //
  903. // This timer is used for media disconnect timouts.
  904. //
  905. NDIS_TIMER MediaDisconnectTimer;
  906. //
  907. // The timeout value for media disconnect timer to fire
  908. // default is 20 seconds
  909. //
  910. USHORT MediaDisconnectTimeOut;
  911. //
  912. // Used for WMI support
  913. //
  914. USHORT InstanceNumber;
  915. //
  916. // this event will be set at the end of adapter initialization
  917. //
  918. NDIS_EVENT OpenReadyEvent;
  919. //
  920. // current PnP state of the device, ex. started, stopped, query_removed, etc.
  921. //
  922. NDIS_PNP_DEVICE_STATE PnPDeviceState;
  923. //
  924. // previous device state. to be used when we get a cancel_remove or a cancel_stop
  925. //
  926. NDIS_PNP_DEVICE_STATE OldPnPDeviceState;
  927. //
  928. // Handlers to Write/Read Bus data
  929. //
  930. PGET_SET_DEVICE_DATA SetBusData;
  931. PGET_SET_DEVICE_DATA GetBusData;
  932. KDPC DeferredDpc;
  933. //
  934. // Some NDIS gathered stats
  935. //
  936. NDIS_STATS NdisStats;
  937. //
  938. // Valid during Packet Indication
  939. //
  940. PNDIS_PACKET IndicatedPacket[MAXIMUM_PROCESSORS];
  941. //
  942. // this event is for protecting against returning from REMOVE IRP
  943. // too early and while we still have pending workitems
  944. //
  945. PKEVENT RemoveReadyEvent;
  946. //
  947. // this event gets signaled when all opens on the miniport are closed
  948. //
  949. PKEVENT AllOpensClosedEvent;
  950. //
  951. // this event gets signaled when all requests on the miniport are gone
  952. //
  953. PKEVENT AllRequestsCompletedEvent;
  954. //
  955. // Init time for the miniport in milliseconds
  956. //
  957. ULONG InitTimeMs;
  958. NDIS_MINIPORT_WORK_ITEM WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
  959. PDMA_ADAPTER SystemAdapterObject;
  960. //
  961. // flags to fail certain NDIS APIs to make sure the driver does the right things
  962. //
  963. ULONG DriverVerifyFlags;
  964. POID_LIST OidList;
  965. //
  966. // InternalResetCount: The # of times NDIS decided a miniport was hung
  967. // MiniportResetCount The # of times miniport decided it was hung
  968. //
  969. USHORT InternalResetCount;
  970. USHORT MiniportResetCount;
  971. USHORT MediaSenseConnectCount;
  972. USHORT MediaSenseDisconnectCount;
  973. PNDIS_PACKET * xPackets;
  974. //
  975. // track the user mode requests
  976. //
  977. ULONG UserModeOpenReferences;
  978. //
  979. // Saved handlers. The handlers in the NDIS_OPEN_BLOCK are saved here
  980. // by ndisMSwapOpenHandlers and restored by ndisMRestoreOpenHandlers.
  981. //
  982. union
  983. {
  984. PVOID SavedSendHandler;
  985. PVOID SavedWanSendHandler;
  986. };
  987. W_SEND_PACKETS_HANDLER SavedSendPacketsHandler;
  988. W_CANCEL_SEND_PACKETS_HANDLER SavedCancelSendPacketsHandler;
  989. //
  990. // real SendPacketsHandler
  991. //
  992. W_SEND_PACKETS_HANDLER WSendPacketsHandler;
  993. ULONG MiniportAttributes;
  994. PDMA_ADAPTER SavedSystemAdapterObject;
  995. USHORT NumOpens;
  996. //
  997. // extra check for hang ticks allowed for OID_GEN_MEDIA_CONNECT_STATUS and OID_GEN_LINK_SPEED
  998. //
  999. USHORT CFHangXTicks;
  1000. ULONG RequestCount;
  1001. ULONG IndicatedPacketsCount;
  1002. ULONG PhysicalMediumType;
  1003. //
  1004. // last request. needed for debugging purpose
  1005. //
  1006. PNDIS_REQUEST LastRequest;
  1007. LONG DmaAdapterRefCount;
  1008. PVOID FakeMac;
  1009. ULONG LockDbg;
  1010. ULONG LockDbgX;
  1011. PVOID LockThread;
  1012. ULONG InfoFlags;
  1013. KSPIN_LOCK TimerQueueLock;
  1014. PKEVENT ResetCompletedEvent;
  1015. PKEVENT QueuedBindingCompletedEvent;
  1016. PKEVENT DmaResourcesReleasedEvent;
  1017. FILTER_PACKET_INDICATION_HANDLER SavedPacketIndicateHandler;
  1018. ULONG RegisteredInterrupts;
  1019. PNPAGED_LOOKASIDE_LIST SGListLookasideList;
  1020. ULONG ScatterGatherListSize;
  1021. PKEVENT WakeUpTimerEvent;
  1022. PSECURITY_DESCRIPTOR SecurityDescriptor;
  1023. //
  1024. // both these variables are protected by Ref->SpinLock
  1025. //
  1026. ULONG NumUserOpens; // number of non-admin open handles
  1027. ULONG NumAdminOpens; // number of admin open handles
  1028. ULONG_REFERENCE Ref;
  1029. #if NDIS_RECV_SCALE
  1030. NDIS_RECEIVE_SCALE_CAPABILITIES RecvScaleCapabilities;
  1031. #endif
  1032. #if DBG
  1033. ULONG cDpcSendCompletes;
  1034. ULONG cDpcRcvIndications;
  1035. ULONG cDpcRcvIndicationCalls;
  1036. #endif
  1037. #endif // NDIS_WRAPPER defined
  1038. };
  1039. //
  1040. // Routines for intermediate miniport drivers.
  1041. //
  1042. typedef
  1043. VOID
  1044. (*W_MINIPORT_CALLBACK)(
  1045. IN NDIS_HANDLE MiniportAdapterContext,
  1046. IN PVOID CallbackContext
  1047. );
  1048. EXPORT
  1049. NDIS_STATUS
  1050. NdisIMRegisterLayeredMiniport(
  1051. IN NDIS_HANDLE NdisWrapperHandle,
  1052. IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
  1053. IN UINT CharacteristicsLength,
  1054. OUT PNDIS_HANDLE DriverHandle
  1055. );
  1056. EXPORT
  1057. VOID
  1058. NdisIMDeregisterLayeredMiniport(
  1059. IN NDIS_HANDLE DriverHandle
  1060. );
  1061. EXPORT
  1062. VOID
  1063. NdisIMAssociateMiniport(
  1064. IN NDIS_HANDLE DriverHandle,
  1065. IN NDIS_HANDLE ProtocolHandle
  1066. );
  1067. EXPORT
  1068. NDIS_STATUS
  1069. NdisMRegisterDevice(
  1070. IN NDIS_HANDLE NdisWrapperHandle,
  1071. IN PNDIS_STRING DeviceName,
  1072. IN PNDIS_STRING SymbolicName,
  1073. IN PDRIVER_DISPATCH MajorFunctions[],
  1074. OUT PDEVICE_OBJECT * pDeviceObject,
  1075. OUT NDIS_HANDLE * NdisDeviceHandle
  1076. );
  1077. EXPORT
  1078. NDIS_STATUS
  1079. NdisMDeregisterDevice(
  1080. IN NDIS_HANDLE NdisDeviceHandle
  1081. );
  1082. EXPORT
  1083. VOID
  1084. NdisMRegisterUnloadHandler(
  1085. IN NDIS_HANDLE NdisWrapperHandle,
  1086. IN PDRIVER_UNLOAD UnloadHandler
  1087. );
  1088. //
  1089. // Operating System Requests
  1090. //
  1091. typedef UCHAR NDIS_DMA_SIZE;
  1092. #define NDIS_DMA_24BITS ((NDIS_DMA_SIZE)0)
  1093. #define NDIS_DMA_32BITS ((NDIS_DMA_SIZE)1)
  1094. #define NDIS_DMA_64BITS ((NDIS_DMA_SIZE)2)
  1095. EXPORT
  1096. NDIS_STATUS
  1097. NdisMAllocateMapRegisters(
  1098. IN NDIS_HANDLE MiniportAdapterHandle,
  1099. IN UINT DmaChannel,
  1100. IN NDIS_DMA_SIZE DmaSize,
  1101. IN ULONG BaseMapRegistersNeeded,
  1102. IN ULONG MaximumPhysicalMapping
  1103. );
  1104. EXPORT
  1105. VOID
  1106. NdisMFreeMapRegisters(
  1107. IN NDIS_HANDLE MiniportAdapterHandle
  1108. );
  1109. EXPORT
  1110. NDIS_STATUS
  1111. NdisMInitializeScatterGatherDma(
  1112. IN NDIS_HANDLE MiniportAdapterHandle,
  1113. IN BOOLEAN Dma64BitAddresses,
  1114. IN ULONG MaximumPhysicalMapping
  1115. );
  1116. EXPORT
  1117. NDIS_STATUS
  1118. NdisMRegisterIoPortRange(
  1119. OUT PVOID * PortOffset,
  1120. IN NDIS_HANDLE MiniportAdapterHandle,
  1121. IN UINT InitialPort,
  1122. IN UINT NumberOfPorts
  1123. );
  1124. EXPORT
  1125. VOID
  1126. NdisMDeregisterIoPortRange(
  1127. IN NDIS_HANDLE MiniportAdapterHandle,
  1128. IN UINT InitialPort,
  1129. IN UINT NumberOfPorts,
  1130. IN PVOID PortOffset
  1131. );
  1132. EXPORT
  1133. NDIS_STATUS
  1134. NdisMMapIoSpace(
  1135. OUT PVOID * VirtualAddress,
  1136. IN NDIS_HANDLE MiniportAdapterHandle,
  1137. IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
  1138. IN UINT Length
  1139. );
  1140. EXPORT
  1141. VOID
  1142. NdisMUnmapIoSpace(
  1143. IN NDIS_HANDLE MiniportAdapterHandle,
  1144. IN PVOID VirtualAddress,
  1145. IN UINT Length
  1146. );
  1147. EXPORT
  1148. NDIS_STATUS
  1149. NdisMRegisterInterrupt(
  1150. OUT PNDIS_MINIPORT_INTERRUPT Interrupt,
  1151. IN NDIS_HANDLE MiniportAdapterHandle,
  1152. IN UINT InterruptVector,
  1153. IN UINT InterruptLevel,
  1154. IN BOOLEAN RequestIsr,
  1155. IN BOOLEAN SharedInterrupt,
  1156. IN NDIS_INTERRUPT_MODE InterruptMode
  1157. );
  1158. EXPORT
  1159. VOID
  1160. NdisMDeregisterInterrupt(
  1161. IN PNDIS_MINIPORT_INTERRUPT Interrupt
  1162. );
  1163. EXPORT
  1164. BOOLEAN
  1165. NdisMSynchronizeWithInterrupt(
  1166. IN PNDIS_MINIPORT_INTERRUPT Interrupt,
  1167. IN PVOID SynchronizeFunction,
  1168. IN PVOID SynchronizeContext
  1169. );
  1170. EXPORT
  1171. VOID
  1172. NdisMQueryAdapterResources(
  1173. OUT PNDIS_STATUS Status,
  1174. IN NDIS_HANDLE WrapperConfigurationContext,
  1175. OUT PNDIS_RESOURCE_LIST ResourceList,
  1176. IN OUT PUINT BufferSize
  1177. );
  1178. //
  1179. // Timers
  1180. //
  1181. // VOID
  1182. // NdisMSetTimer(
  1183. // IN PNDIS_MINIPORT_TIMER Timer,
  1184. // IN UINT MillisecondsToDelay
  1185. // );
  1186. #define NdisMSetTimer(_Timer, _Delay) NdisSetTimer((PNDIS_TIMER)_Timer, _Delay)
  1187. EXPORT
  1188. VOID
  1189. NdisMSetPeriodicTimer(
  1190. IN PNDIS_MINIPORT_TIMER Timer,
  1191. IN UINT MillisecondPeriod
  1192. );
  1193. EXPORT
  1194. VOID
  1195. NdisMInitializeTimer(
  1196. IN OUT PNDIS_MINIPORT_TIMER Timer,
  1197. IN NDIS_HANDLE MiniportAdapterHandle,
  1198. IN PNDIS_TIMER_FUNCTION TimerFunction,
  1199. IN PVOID FunctionContext
  1200. );
  1201. EXPORT
  1202. VOID
  1203. NdisMCancelTimer(
  1204. IN PNDIS_MINIPORT_TIMER Timer,
  1205. OUT PBOOLEAN TimerCancelled
  1206. );
  1207. EXPORT
  1208. VOID
  1209. NdisMSleep(
  1210. IN ULONG MicrosecondsToSleep
  1211. );
  1212. //
  1213. // Physical Mapping
  1214. //
  1215. EXPORT
  1216. VOID
  1217. NdisMStartBufferPhysicalMapping(
  1218. IN NDIS_HANDLE MiniportAdapterHandle,
  1219. IN PNDIS_BUFFER Buffer,
  1220. IN ULONG PhysicalMapRegister,
  1221. IN BOOLEAN WriteToDevice,
  1222. OUT PNDIS_PHYSICAL_ADDRESS_UNIT PhysicalAddressArray,
  1223. OUT PUINT ArraySize
  1224. );
  1225. EXPORT
  1226. VOID
  1227. NdisMCompleteBufferPhysicalMapping(
  1228. IN NDIS_HANDLE MiniportAdapterHandle,
  1229. IN PNDIS_BUFFER Buffer,
  1230. IN ULONG PhysicalMapRegister
  1231. );
  1232. EXPORT
  1233. ULONG
  1234. NdisMGetDmaAlignment(
  1235. IN NDIS_HANDLE MiniportAdapterHandle
  1236. );
  1237. //
  1238. // Shared memory
  1239. //
  1240. EXPORT
  1241. VOID
  1242. NdisMAllocateSharedMemory(
  1243. IN NDIS_HANDLE MiniportAdapterHandle,
  1244. IN ULONG Length,
  1245. IN BOOLEAN Cached,
  1246. OUT PVOID * VirtualAddress,
  1247. OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress
  1248. );
  1249. EXPORT
  1250. NDIS_STATUS
  1251. NdisMAllocateSharedMemoryAsync(
  1252. IN NDIS_HANDLE MiniportAdapterHandle,
  1253. IN ULONG Length,
  1254. IN BOOLEAN Cached,
  1255. IN PVOID Context
  1256. );
  1257. /*++
  1258. VOID
  1259. NdisMUpdateSharedMemory(
  1260. IN NDIS_HANDLE MiniportAdapterHandle,
  1261. IN ULONG Length,
  1262. IN PVOID VirtualAddress,
  1263. IN NDIS_PHYSICAL_ADDRESS PhysicalAddress
  1264. )
  1265. --*/
  1266. #define NdisMUpdateSharedMemory(_H, _L, _V, _P) NdisUpdateSharedMemory(_H, _L, _V, _P)
  1267. EXPORT
  1268. VOID
  1269. NdisMFreeSharedMemory(
  1270. IN NDIS_HANDLE MiniportAdapterHandle,
  1271. IN ULONG Length,
  1272. IN BOOLEAN Cached,
  1273. IN PVOID VirtualAddress,
  1274. IN NDIS_PHYSICAL_ADDRESS PhysicalAddress
  1275. );
  1276. //
  1277. // DMA operations.
  1278. //
  1279. EXPORT
  1280. NDIS_STATUS
  1281. NdisMRegisterDmaChannel(
  1282. OUT PNDIS_HANDLE MiniportDmaHandle,
  1283. IN NDIS_HANDLE MiniportAdapterHandle,
  1284. IN UINT DmaChannel,
  1285. IN BOOLEAN Dma32BitAddresses,
  1286. IN PNDIS_DMA_DESCRIPTION DmaDescription,
  1287. IN ULONG MaximumLength
  1288. );
  1289. EXPORT
  1290. VOID
  1291. NdisMDeregisterDmaChannel(
  1292. IN NDIS_HANDLE MiniportDmaHandle
  1293. );
  1294. /*++
  1295. VOID
  1296. NdisMSetupDmaTransfer(
  1297. OUT PNDIS_STATUS Status,
  1298. IN NDIS_HANDLE MiniportDmaHandle,
  1299. IN PNDIS_BUFFER Buffer,
  1300. IN ULONG Offset,
  1301. IN ULONG Length,
  1302. IN BOOLEAN WriteToDevice
  1303. )
  1304. --*/
  1305. #define NdisMSetupDmaTransfer(_S, _H, _B, _O, _L, _M_) \
  1306. NdisSetupDmaTransfer(_S, _H, _B, _O, _L, _M_)
  1307. /*++
  1308. VOID
  1309. NdisMCompleteDmaTransfer(
  1310. OUT PNDIS_STATUS Status,
  1311. IN NDIS_HANDLE MiniportDmaHandle,
  1312. IN PNDIS_BUFFER Buffer,
  1313. IN ULONG Offset,
  1314. IN ULONG Length,
  1315. IN BOOLEAN WriteToDevice
  1316. )
  1317. --*/
  1318. #define NdisMCompleteDmaTransfer(_S, _H, _B, _O, _L, _M_) \
  1319. NdisCompleteDmaTransfer(_S, _H, _B, _O, _L, _M_)
  1320. EXPORT
  1321. ULONG
  1322. NdisMReadDmaCounter(
  1323. IN NDIS_HANDLE MiniportDmaHandle
  1324. );
  1325. //
  1326. // Requests Used by Miniport Drivers
  1327. //
  1328. #define NdisMInitializeWrapper(_a,_b,_c,_d) NdisInitializeWrapper((_a),(_b),(_c),(_d))
  1329. EXPORT
  1330. NDIS_STATUS
  1331. NdisMRegisterMiniport(
  1332. IN NDIS_HANDLE NdisWrapperHandle,
  1333. IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
  1334. IN UINT CharacteristicsLength
  1335. );
  1336. // EXPORT
  1337. // NDIS_STATUS
  1338. // NdisIMInitializeDeviceInstance(
  1339. // IN NDIS_HANDLE DriverHandle,
  1340. // IN PNDIS_STRING DriverInstance
  1341. // );
  1342. #define NdisIMInitializeDeviceInstance(_H_, _I_) \
  1343. NdisIMInitializeDeviceInstanceEx(_H_, _I_, NULL)
  1344. EXPORT
  1345. NDIS_STATUS
  1346. NdisIMInitializeDeviceInstanceEx(
  1347. IN NDIS_HANDLE DriverHandle,
  1348. IN PNDIS_STRING DriverInstance,
  1349. IN NDIS_HANDLE DeviceContext OPTIONAL
  1350. );
  1351. EXPORT
  1352. NDIS_STATUS
  1353. NdisIMCancelInitializeDeviceInstance(
  1354. IN NDIS_HANDLE DriverHandle,
  1355. IN PNDIS_STRING DeviceInstance
  1356. );
  1357. EXPORT
  1358. NDIS_HANDLE
  1359. NdisIMGetDeviceContext(
  1360. IN NDIS_HANDLE MiniportAdapterHandle
  1361. );
  1362. EXPORT
  1363. NDIS_HANDLE
  1364. NdisIMGetBindingContext(
  1365. IN NDIS_HANDLE NdisBindingHandle
  1366. );
  1367. EXPORT
  1368. NDIS_STATUS
  1369. NdisIMDeInitializeDeviceInstance(
  1370. IN NDIS_HANDLE NdisMiniportHandle
  1371. );
  1372. EXPORT
  1373. VOID
  1374. NdisIMCopySendPerPacketInfo(
  1375. OUT PNDIS_PACKET DstPacket,
  1376. IN PNDIS_PACKET SrcPacket
  1377. );
  1378. EXPORT
  1379. VOID
  1380. NdisIMCopySendCompletePerPacketInfo(
  1381. OUT PNDIS_PACKET DstPacket,
  1382. IN PNDIS_PACKET SrcPacket
  1383. );
  1384. // EXPORT
  1385. // VOID
  1386. // NdisMSetAttributes(
  1387. // IN NDIS_HANDLE MiniportAdapterHandle,
  1388. // IN NDIS_HANDLE MiniportAdapterContext,
  1389. // IN BOOLEAN BusMaster,
  1390. // IN NDIS_INTERFACE_TYPE AdapterType
  1391. // );
  1392. #define NdisMSetAttributes(_H_, _C_, _M_, _T_) \
  1393. NdisMSetAttributesEx(_H_, \
  1394. _C_, \
  1395. 0, \
  1396. (_M_) ? NDIS_ATTRIBUTE_BUS_MASTER : 0, \
  1397. _T_) \
  1398. EXPORT
  1399. VOID
  1400. NdisMSetAttributesEx(
  1401. IN NDIS_HANDLE MiniportAdapterHandle,
  1402. IN NDIS_HANDLE MiniportAdapterContext,
  1403. IN UINT CheckForHangTimeInSeconds OPTIONAL,
  1404. IN ULONG AttributeFlags,
  1405. IN NDIS_INTERFACE_TYPE AdapterType OPTIONAL
  1406. );
  1407. #define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
  1408. #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
  1409. #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
  1410. #define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
  1411. #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
  1412. #define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
  1413. #define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
  1414. #define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
  1415. #define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
  1416. #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
  1417. #define NDIS_ATTRIBUTE_DO_NOT_BIND_TO_ALL_CO 0x00000400
  1418. EXPORT
  1419. NDIS_STATUS
  1420. NdisMSetMiniportSecondary(
  1421. IN NDIS_HANDLE MiniportHandle,
  1422. IN NDIS_HANDLE PrimaryMiniportHandle
  1423. );
  1424. EXPORT
  1425. NDIS_STATUS
  1426. NdisMPromoteMiniport(
  1427. IN NDIS_HANDLE MiniportHandle
  1428. );
  1429. EXPORT
  1430. NDIS_STATUS
  1431. NdisMRemoveMiniport(
  1432. IN NDIS_HANDLE MiniportHandle
  1433. );
  1434. #define NdisMSendComplete(_M, _P, _S) (*((PNDIS_MINIPORT_BLOCK)(_M))->SendCompleteHandler)(_M, _P, _S)
  1435. #define NdisMSendResourcesAvailable(_M) (*((PNDIS_MINIPORT_BLOCK)(_M))->SendResourcesHandler)(_M)
  1436. #define NdisMResetComplete(_M, _S, _A) (*((PNDIS_MINIPORT_BLOCK)(_M))->ResetCompleteHandler)(_M, _S, _A)
  1437. #define NdisMTransferDataComplete(_M, _P, _S, _B) \
  1438. (*((PNDIS_MINIPORT_BLOCK)(_M))->TDCompleteHandler)(_M, _P, _S, _B)
  1439. /*++
  1440. VOID
  1441. NdisMWanSendComplete(
  1442. IN NDIS_HANDLE MiniportAdapterHandle,
  1443. IN PVOID Packet,
  1444. IN NDIS_STATUS Status
  1445. );
  1446. --*/
  1447. #define NdisMWanSendComplete(_M_, _P_, _S_) \
  1448. (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanSendCompleteHandler)(_M_, _P_, _S_)
  1449. #define NdisMQueryInformationComplete(_M, _S) \
  1450. (*((PNDIS_MINIPORT_BLOCK)(_M))->QueryCompleteHandler)(_M, _S)
  1451. #define NdisMSetInformationComplete(_M, _S) \
  1452. (*((PNDIS_MINIPORT_BLOCK)(_M))->SetCompleteHandler)(_M, _S)
  1453. /*++
  1454. VOID
  1455. NdisMIndicateReceivePacket(
  1456. IN NDIS_HANDLE MiniportAdapterHandle,
  1457. IN PPNDIS_PACKET ReceivedPackets,
  1458. IN UINT NumberOfPackets
  1459. );
  1460. --*/
  1461. #define NdisMIndicateReceivePacket(_H, _P, _N) \
  1462. { \
  1463. (*((PNDIS_MINIPORT_BLOCK)(_H))->PacketIndicateHandler)( \
  1464. _H, \
  1465. _P, \
  1466. _N); \
  1467. }
  1468. /*++
  1469. VOID
  1470. NdisMWanIndicateReceive(
  1471. OUT PNDIS_STATUS Status,
  1472. IN NDIS_HANDLE MiniportAdapterHandle,
  1473. IN NDIS_HANDLE NdisLinkContext,
  1474. IN PUCHAR Packet,
  1475. IN ULONG PacketSize
  1476. );
  1477. --*/
  1478. #define NdisMWanIndicateReceive(_S_, _M_, _C_, _P_, _Z_) \
  1479. (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanRcvHandler)(_S_, _M_, _C_, _P_, _Z_)
  1480. /*++
  1481. VOID
  1482. NdisMWanIndicateReceiveComplete(
  1483. IN NDIS_HANDLE MiniportAdapterHandle,
  1484. IN NDIS_HANDLE NdisLinkContext
  1485. );
  1486. --*/
  1487. #define NdisMWanIndicateReceiveComplete(_M_, _C_) \
  1488. (*((PNDIS_MINIPORT_BLOCK)(_M_))->WanRcvCompleteHandler)(_M_, _C_)
  1489. /*++
  1490. VOID
  1491. NdisMEthIndicateReceive(
  1492. IN NDIS_HANDLE MiniportAdapterHandle,
  1493. IN NDIS_HANDLE MiniportReceiveContext,
  1494. IN PVOID HeaderBuffer,
  1495. IN UINT HeaderBufferSize,
  1496. IN PVOID LookaheadBuffer,
  1497. IN UINT LookaheadBufferSize,
  1498. IN UINT PacketSize
  1499. )
  1500. --*/
  1501. #define NdisMEthIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \
  1502. { \
  1503. (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxIndicateHandler)( \
  1504. ((PNDIS_MINIPORT_BLOCK)(_H))->EthDB, \
  1505. _C, \
  1506. _B, \
  1507. _B, \
  1508. _SZ, \
  1509. _L, \
  1510. _LSZ, \
  1511. _PSZ \
  1512. ); \
  1513. }
  1514. /*++
  1515. VOID
  1516. NdisMTrIndicateReceive(
  1517. IN NDIS_HANDLE MiniportAdapterHandle,
  1518. IN NDIS_HANDLE MiniportReceiveContext,
  1519. IN PVOID HeaderBuffer,
  1520. IN UINT HeaderBufferSize,
  1521. IN PVOID LookaheadBuffer,
  1522. IN UINT LookaheadBufferSize,
  1523. IN UINT PacketSize
  1524. )
  1525. --*/
  1526. #define NdisMTrIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \
  1527. { \
  1528. (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxIndicateHandler)( \
  1529. ((PNDIS_MINIPORT_BLOCK)(_H))->TrDB, \
  1530. _C, \
  1531. _B, \
  1532. _SZ, \
  1533. _L, \
  1534. _LSZ, \
  1535. _PSZ \
  1536. ); \
  1537. }
  1538. /*++
  1539. VOID
  1540. NdisMFddiIndicateReceive(
  1541. IN NDIS_HANDLE MiniportAdapterHandle,
  1542. IN NDIS_HANDLE MiniportReceiveContext,
  1543. IN PVOID HeaderBuffer,
  1544. IN UINT HeaderBufferSize,
  1545. IN PVOID LookaheadBuffer,
  1546. IN UINT LookaheadBufferSize,
  1547. IN UINT PacketSize
  1548. )
  1549. --*/
  1550. #define NdisMFddiIndicateReceive( _H, _C, _B, _SZ, _L, _LSZ, _PSZ) \
  1551. { \
  1552. (*((PNDIS_MINIPORT_BLOCK)(_H))->FddiRxIndicateHandler)( \
  1553. ((PNDIS_MINIPORT_BLOCK)(_H))->FddiDB, \
  1554. _C, \
  1555. (PUCHAR)_B + 1, \
  1556. ((((PUCHAR)_B)[0] & 0x40) ? FDDI_LENGTH_OF_LONG_ADDRESS \
  1557. : FDDI_LENGTH_OF_SHORT_ADDRESS), \
  1558. _B, \
  1559. _SZ, \
  1560. _L, \
  1561. _LSZ, \
  1562. _PSZ \
  1563. ); \
  1564. }
  1565. /*++
  1566. VOID
  1567. NdisMArcIndicateReceive(
  1568. IN NDIS_HANDLE MiniportHandle,
  1569. IN PUCHAR pRawHeader, // Pointer to Arcnet frame header
  1570. IN PUCHAR pData, // Pointer to data portion of Arcnet frame
  1571. IN UINT Length // Data Length
  1572. )
  1573. --*/
  1574. #define NdisMArcIndicateReceive( _H, _HD, _D, _SZ) \
  1575. { \
  1576. ArcFilterDprIndicateReceive(((PNDIS_MINIPORT_BLOCK)(_H))->ArcDB, \
  1577. _HD, \
  1578. _D, \
  1579. _SZ \
  1580. ); \
  1581. }
  1582. /*++
  1583. VOID
  1584. NdisMEthIndicateReceiveComplete(
  1585. IN NDIS_HANDLE MiniportHandle
  1586. );
  1587. --*/
  1588. #define NdisMEthIndicateReceiveComplete( _H ) \
  1589. { \
  1590. (*((PNDIS_MINIPORT_BLOCK)(_H))->EthRxCompleteHandler)( \
  1591. ((PNDIS_MINIPORT_BLOCK)_H)->EthDB); \
  1592. }
  1593. /*++
  1594. VOID
  1595. NdisMTrIndicateReceiveComplete(
  1596. IN NDIS_HANDLE MiniportHandle
  1597. );
  1598. --*/
  1599. #define NdisMTrIndicateReceiveComplete( _H ) \
  1600. { \
  1601. (*((PNDIS_MINIPORT_BLOCK)(_H))->TrRxCompleteHandler)( \
  1602. ((PNDIS_MINIPORT_BLOCK)_H)->TrDB); \
  1603. }
  1604. /*++
  1605. VOID
  1606. NdisMFddiIndicateReceiveComplete(
  1607. IN NDIS_HANDLE MiniportHandle
  1608. );
  1609. --*/
  1610. #define NdisMFddiIndicateReceiveComplete( _H ) \
  1611. { \
  1612. (*((PNDIS_MINIPORT_BLOCK)(_H))->FddiRxCompleteHandler)( \
  1613. ((PNDIS_MINIPORT_BLOCK)_H)->FddiDB); \
  1614. }
  1615. /*++
  1616. VOID
  1617. NdisMArcIndicateReceiveComplete(
  1618. IN NDIS_HANDLE MiniportHandle
  1619. );
  1620. --*/
  1621. #define NdisMArcIndicateReceiveComplete( _H ) \
  1622. { \
  1623. if (((PNDIS_MINIPORT_BLOCK)_H)->EthDB) \
  1624. { \
  1625. NdisMEthIndicateReceiveComplete(_H); \
  1626. } \
  1627. \
  1628. ArcFilterDprIndicateReceiveComplete(((PNDIS_MINIPORT_BLOCK)_H)->ArcDB); \
  1629. }
  1630. /*++
  1631. EXPORT
  1632. VOID
  1633. NdisMIndicateStatus(
  1634. IN NDIS_HANDLE MiniportHandle,
  1635. IN NDIS_STATUS GeneralStatus,
  1636. IN PVOID StatusBuffer,
  1637. IN UINT StatusBufferSize
  1638. );
  1639. --*/
  1640. #define NdisMIndicateStatus(_M, _G, _SB, _BS) (*((PNDIS_MINIPORT_BLOCK)(_M))->StatusHandler)(_M, _G, _SB, _BS)
  1641. /*++
  1642. EXPORT
  1643. VOID
  1644. NdisMIndicateStatusComplete(
  1645. IN NDIS_HANDLE MiniportHandle
  1646. );
  1647. --*/
  1648. #define NdisMIndicateStatusComplete(_M) (*((PNDIS_MINIPORT_BLOCK)(_M))->StatusCompleteHandler)(_M)
  1649. EXPORT
  1650. VOID
  1651. NdisMRegisterAdapterShutdownHandler(
  1652. IN NDIS_HANDLE MiniportHandle,
  1653. IN PVOID ShutdownContext,
  1654. IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler
  1655. );
  1656. EXPORT
  1657. VOID
  1658. NdisMDeregisterAdapterShutdownHandler(
  1659. IN NDIS_HANDLE MiniportHandle
  1660. );
  1661. EXPORT
  1662. NDIS_STATUS
  1663. NdisMPciAssignResources(
  1664. IN NDIS_HANDLE MiniportHandle,
  1665. IN ULONG SlotNumber,
  1666. IN PNDIS_RESOURCE_LIST * AssignedResources
  1667. );
  1668. #ifdef NDIS51_MINIPORT
  1669. EXPORT
  1670. NDIS_STATUS
  1671. NdisIMNotifyPnPEvent(
  1672. IN NDIS_HANDLE MiniportHandle,
  1673. IN PNET_PNP_EVENT NetPnPEvent
  1674. );
  1675. #endif
  1676. //
  1677. // Logging support for miniports
  1678. //
  1679. EXPORT
  1680. NDIS_STATUS
  1681. NdisMCreateLog(
  1682. IN NDIS_HANDLE MiniportAdapterHandle,
  1683. IN UINT Size,
  1684. OUT PNDIS_HANDLE LogHandle
  1685. );
  1686. EXPORT
  1687. VOID
  1688. NdisMCloseLog(
  1689. IN NDIS_HANDLE LogHandle
  1690. );
  1691. EXPORT
  1692. NDIS_STATUS
  1693. NdisMWriteLogData(
  1694. IN NDIS_HANDLE LogHandle,
  1695. IN PVOID LogBuffer,
  1696. IN UINT LogBufferSize
  1697. );
  1698. EXPORT
  1699. VOID
  1700. NdisMFlushLog(
  1701. IN NDIS_HANDLE LogHandle
  1702. );
  1703. EXPORT
  1704. VOID
  1705. NdisMGetDeviceProperty(
  1706. IN NDIS_HANDLE MiniportAdapterHandle,
  1707. IN OUT PDEVICE_OBJECT * PhysicalDeviceObject OPTIONAL,
  1708. IN OUT PDEVICE_OBJECT * FunctionalDeviceObject OPTIONAL,
  1709. IN OUT PDEVICE_OBJECT * NextDeviceObject OPTIONAL,
  1710. IN OUT PCM_RESOURCE_LIST * AllocatedResources OPTIONAL,
  1711. IN OUT PCM_RESOURCE_LIST * AllocatedResourcesTranslated OPTIONAL
  1712. );
  1713. //
  1714. // Get a pointer to the adapter's localized instance name.
  1715. //
  1716. EXPORT
  1717. NDIS_STATUS
  1718. NdisMQueryAdapterInstanceName(
  1719. OUT PNDIS_STRING pAdapterInstanceName,
  1720. IN NDIS_HANDLE MiniportHandle
  1721. );
  1722. //
  1723. // NDIS 5.0 extensions for miniports
  1724. //
  1725. EXPORT
  1726. VOID
  1727. NdisMCoIndicateReceivePacket(
  1728. IN NDIS_HANDLE NdisVcHandle,
  1729. IN PPNDIS_PACKET PacketArray,
  1730. IN UINT NumberOfPackets
  1731. );
  1732. EXPORT
  1733. VOID
  1734. NdisMCoIndicateStatus(
  1735. IN NDIS_HANDLE MiniportAdapterHandle,
  1736. IN NDIS_HANDLE NdisVcHandle OPTIONAL,
  1737. IN NDIS_STATUS GeneralStatus,
  1738. IN PVOID StatusBuffer OPTIONAL,
  1739. IN ULONG StatusBufferSize
  1740. );
  1741. EXPORT
  1742. VOID
  1743. NdisMCoReceiveComplete(
  1744. IN NDIS_HANDLE MiniportAdapterHandle
  1745. );
  1746. EXPORT
  1747. VOID
  1748. NdisMCoSendComplete(
  1749. IN NDIS_STATUS Status,
  1750. IN NDIS_HANDLE NdisVcHandle,
  1751. IN PNDIS_PACKET Packet
  1752. );
  1753. EXPORT
  1754. VOID
  1755. NdisMCoActivateVcComplete(
  1756. IN NDIS_STATUS Status,
  1757. IN NDIS_HANDLE NdisVcHandle,
  1758. IN PCO_CALL_PARAMETERS CallParameters
  1759. );
  1760. EXPORT
  1761. VOID
  1762. NdisMCoDeactivateVcComplete(
  1763. IN NDIS_STATUS Status,
  1764. IN NDIS_HANDLE NdisVcHandle
  1765. );
  1766. EXPORT
  1767. VOID
  1768. NdisMCoRequestComplete(
  1769. IN NDIS_STATUS Status,
  1770. IN NDIS_HANDLE MiniportAdapterHandle,
  1771. IN PNDIS_REQUEST Request
  1772. );
  1773. EXPORT
  1774. NDIS_STATUS
  1775. NdisMCmRegisterAddressFamily(
  1776. IN NDIS_HANDLE MiniportAdapterHandle,
  1777. IN PCO_ADDRESS_FAMILY AddressFamily,
  1778. IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
  1779. IN UINT SizeOfCmCharacteristics
  1780. );
  1781. EXPORT
  1782. NDIS_STATUS
  1783. NdisMCmCreateVc(
  1784. IN NDIS_HANDLE MiniportAdapterHandle,
  1785. IN NDIS_HANDLE NdisAfHandle,
  1786. IN NDIS_HANDLE MiniportVcContext,
  1787. OUT PNDIS_HANDLE NdisVcHandle
  1788. );
  1789. EXPORT
  1790. NDIS_STATUS
  1791. NdisMCmDeleteVc(
  1792. IN NDIS_HANDLE NdisVcHandle
  1793. );
  1794. EXPORT
  1795. NDIS_STATUS
  1796. NdisMCmActivateVc(
  1797. IN NDIS_HANDLE NdisVcHandle,
  1798. IN PCO_CALL_PARAMETERS CallParameters
  1799. );
  1800. EXPORT
  1801. NDIS_STATUS
  1802. NdisMCmDeactivateVc(
  1803. IN NDIS_HANDLE NdisVcHandle
  1804. );
  1805. EXPORT
  1806. NDIS_STATUS
  1807. NdisMCmRequest(
  1808. IN NDIS_HANDLE NdisAfHandle,
  1809. IN NDIS_HANDLE NdisVcHandle OPTIONAL,
  1810. IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
  1811. IN OUT PNDIS_REQUEST NdisRequest
  1812. );
  1813. // EXPORT
  1814. // VOID
  1815. // NdisMCmRequestComplete(
  1816. // IN NDIS_STATUS Status,
  1817. // IN NDIS_HANDLE NdisAfHandle,
  1818. // IN NDIS_HANDLE NdisVcHandle OPTIONAL,
  1819. // IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
  1820. // IN PNDIS_REQUEST NdisRequest
  1821. // );
  1822. #define NdisMCmRequestComplete(_S_, _AH_, _VH_, _PH_, _R_) \
  1823. NdisCoRequestComplete(_S_, _AH_, _VH_, _PH_, _R_)
  1824. // EXPORT
  1825. // VOID
  1826. // NdisMCmOpenAddressFamilyComplete(
  1827. // IN NDIS_STATUS Status,
  1828. // IN NDIS_HANDLE NdisAfHandle,
  1829. // IN NDIS_HANDLE CallMgrAfContext
  1830. // );
  1831. #define NdisMCmOpenAddressFamilyComplete(_S_, _H_, _C_) \
  1832. NdisCmOpenAddressFamilyComplete(_S_, _H_, _C_)
  1833. // EXPORT
  1834. // VOID
  1835. // NdisMCmCloseAddressFamilyComplete(
  1836. // IN NDIS_STATUS Status,
  1837. // IN NDIS_HANDLE NdisAfHandle
  1838. // );
  1839. #define NdisMCmCloseAddressFamilyComplete(_S_, _H_) \
  1840. NdisCmCloseAddressFamilyComplete(_S_, _H_)
  1841. // EXPORT
  1842. // VOID
  1843. // NdisMCmRegisterSapComplete(
  1844. // IN NDIS_STATUS Status,
  1845. // IN NDIS_HANDLE NdisSapHandle,
  1846. // IN NDIS_HANDLE CallMgrSapContext
  1847. // );
  1848. #define NdisMCmRegisterSapComplete(_S_, _H_, _C_) \
  1849. NdisCmRegisterSapComplete(_S_, _H_, _C_)
  1850. // EXPORT
  1851. // VOID
  1852. // NdisMCmDeregisterSapComplete(
  1853. // IN NDIS_STATUS Status,
  1854. // IN NDIS_HANDLE NdisSapHandle
  1855. // );
  1856. #define NdisMCmDeregisterSapComplete(_S_, _H_) \
  1857. NdisCmDeregisterSapComplete(_S_, _H_)
  1858. // EXPORT
  1859. // VOID
  1860. // NdisMCmMakeCallComplete(
  1861. // IN NDIS_STATUS Status,
  1862. // IN NDIS_HANDLE NdisVcHandle,
  1863. // IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
  1864. // IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
  1865. // IN PCO_CALL_PARAMETERS CallParameters
  1866. // );
  1867. #define NdisMCmMakeCallComplete(_S_, _VH_, _PH_, _CC_, _CP_) \
  1868. NdisCmMakeCallComplete(_S_, _VH_, _PH_, _CC_, _CP_)
  1869. // EXPORT
  1870. // VOID
  1871. // NdisMCmCloseCallComplete(
  1872. // IN NDIS_STATUS Status,
  1873. // IN NDIS_HANDLE NdisVcHandle,
  1874. // IN NDIS_HANDLE NdisPartyHandle OPTIONAL
  1875. // );
  1876. #define NdisMCmCloseCallComplete(_S_, _VH_, _PH_) \
  1877. NdisCmCloseCallComplete(_S_, _VH_, _PH_)
  1878. // EXPORT
  1879. // VOID
  1880. // NdisMCmAddPartyComplete(
  1881. // IN NDIS_STATUS Status,
  1882. // IN NDIS_HANDLE NdisPartyHandle,
  1883. // IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
  1884. // IN PCO_CALL_PARAMETERS CallParameters
  1885. // );
  1886. #define NdisMCmAddPartyComplete(_S_, _H_, _C_, _P_) \
  1887. NdisCmAddPartyComplete(_S_, _H_, _C_, _P_)
  1888. // EXPORT
  1889. // VOID
  1890. // NdisMCmDropPartyComplete(
  1891. // IN NDIS_STATUS Status,
  1892. // IN NDIS_HANDLE NdisPartyHandle
  1893. // );
  1894. #define NdisMCmDropPartyComplete(_S_, _H_) \
  1895. NdisCmDropPartyComplete(_S_, _H_)
  1896. // EXPORT
  1897. // NDIS_STATUS
  1898. // NdisMCmDispatchIncomingCall(
  1899. // IN NDIS_HANDLE NdisSapHandle,
  1900. // IN NDIS_HANDLE NdisVcHandle,
  1901. // IN PCO_CALL_PARAMETERS CallParameters
  1902. // );
  1903. #define NdisMCmDispatchIncomingCall(_SH_, _VH_, _CP_) \
  1904. NdisCmDispatchIncomingCall(_SH_, _VH_, _CP_)
  1905. // EXPORT
  1906. // VOID
  1907. // NdisMCmDispatchCallConnected(
  1908. // IN NDIS_HANDLE NdisVcHandle
  1909. // );
  1910. #define NdisMCmDispatchCallConnected(_H_) \
  1911. NdisCmDispatchCallConnected(_H_)
  1912. // EXPORT
  1913. // NdisMCmModifyCallQoSComplete(
  1914. // IN NDIS_STATUS Status,
  1915. // IN NDIS_HANDLE NdisVcHandle,
  1916. // IN PCO_CALL_PARAMETERS CallParameters
  1917. // );
  1918. #define NdisMCmModifyCallQoSComplete(_S_, _H_, _P_) \
  1919. NdisCmModifyCallQoSComplete(_S_, _H_, _P_)
  1920. // EXPORT
  1921. // VOID
  1922. // VOID
  1923. // NdisMCmDispatchIncomingCallQoSChange(
  1924. // IN NDIS_HANDLE NdisVcHandle,
  1925. // IN PCO_CALL_PARAMETERS CallParameters
  1926. // );
  1927. #define NdisMCmDispatchIncomingCallQoSChange(_H_, _P_) \
  1928. NdisCmDispatchIncomingCallQoSChange(_H_, _P_)
  1929. // EXPORT
  1930. // VOID
  1931. // NdisMCmDispatchIncomingCloseCall(
  1932. // IN NDIS_STATUS CloseStatus,
  1933. // IN NDIS_HANDLE NdisVcHandle,
  1934. // IN PVOID Buffer OPTIONAL,
  1935. // IN UINT Size
  1936. // );
  1937. #define NdisMCmDispatchIncomingCloseCall(_S_, _H_, _B_, _Z_) \
  1938. NdisCmDispatchIncomingCloseCall(_S_, _H_, _B_, _Z_)
  1939. // EXPORT
  1940. // VOID
  1941. // NdisMCmDispatchIncomingDropParty(
  1942. // IN NDIS_STATUS DropStatus,
  1943. // IN NDIS_HANDLE NdisPartyHandle,
  1944. // IN PVOID Buffer OPTIONAL,
  1945. // IN UINT Size
  1946. // );
  1947. #define NdisMCmDispatchIncomingDropParty(_S_, _H_, _B_, _Z_) \
  1948. NdisCmDispatchIncomingDropParty(_S_, _H_, _B_, _Z_)