Source code of Windows XP (NT5)
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.

537 lines
9.8 KiB

  1. //
  2. // Copyright (c) 1998-1999, Microsoft Corporation, all rights reserved
  3. //
  4. // mp.h
  5. //
  6. // IEEE1394 mini-port/call-manager driver
  7. //
  8. // Mini-port routines - header file
  9. //
  10. // 06/20/99 ADube - Created - Declaration for miniport routines
  11. //
  12. //-------------------------------------------------------------------
  13. // G L O B A L D E C L A R A T I O N S
  14. //-------------------------------------------------------------------
  15. #ifdef PSDEBUG
  16. // List of all allocated PAYLOADSENT contexts and the lock that protects the
  17. // list. (for debug purposes only)
  18. //
  19. NDIS_SPIN_LOCK g_lockDebugPs;
  20. LIST_ENTRY g_listDebugPs;
  21. #endif
  22. #define DEFAULT_TOPOLOGY_MAP_LENGTH 0x400
  23. #define FIVE_SECONDS_IN_MILLSECONDS 2000 /*Incorrect value during debugging */
  24. //
  25. // Used to generate a MAC address amd for informational use
  26. //
  27. extern ULONG AdapterNum ;
  28. extern BOOLEAN g_AdapterFreed;
  29. // Call statistics totals for all calls since loading, calls and the lock
  30. // protecting access to them. For this global only, the 'ullCallUp' field is
  31. // the number of calls recorded, rather than a time.
  32. //
  33. CALLSTATS g_stats;
  34. NDIS_SPIN_LOCK g_lockStats;
  35. // Global driver list lock
  36. //
  37. NDIS_SPIN_LOCK g_DriverLock;
  38. // Global adapter list, serialized by g_DriverLock;
  39. //
  40. LIST_ENTRY g_AdapterList;
  41. //-----------------------------------------------------------------------------
  42. // N D I S M I N I P O R T H A N D L E R S
  43. //-----------------------------------------------------------------------------
  44. NDIS_STATUS
  45. NicMpInitialize(
  46. OUT PNDIS_STATUS OpenErrorStatus,
  47. OUT PUINT SelectedMediumIndex,
  48. IN PNDIS_MEDIUM MediumArray,
  49. IN UINT MediumArraySize,
  50. IN NDIS_HANDLE MiniportAdapterHandle,
  51. IN NDIS_HANDLE WrapperConfigurationContext
  52. );
  53. VOID
  54. NicMpHalt(
  55. IN NDIS_HANDLE MiniportAdapterContext
  56. );
  57. NDIS_STATUS
  58. NicMpReset(
  59. OUT PBOOLEAN AddressingReset,
  60. IN NDIS_HANDLE MiniportAdapterContext
  61. );
  62. VOID
  63. NicMpReturnPacket(
  64. IN NDIS_HANDLE MiniportAdapterContext,
  65. IN PNDIS_PACKET Packet
  66. );
  67. NDIS_STATUS
  68. NicMpQueryInformation(
  69. IN NDIS_HANDLE MiniportAdapterContext,
  70. IN NDIS_OID Oid,
  71. IN PVOID InformationBuffer,
  72. IN ULONG InformationBufferLength,
  73. OUT PULONG BytesWritten,
  74. OUT PULONG BytesNeeded
  75. );
  76. NDIS_STATUS
  77. NicMpSetInformation(
  78. IN NDIS_HANDLE MiniportAdapterContext,
  79. IN NDIS_OID Oid,
  80. IN PVOID InformationBuffer,
  81. IN ULONG InformationBufferLength,
  82. OUT PULONG BytesRead,
  83. OUT PULONG BytesNeeded
  84. );
  85. NDIS_STATUS
  86. NicMpCoActivateVc(
  87. IN NDIS_HANDLE MiniportVcContext,
  88. IN OUT PCO_CALL_PARAMETERS CallParameters
  89. );
  90. NDIS_STATUS
  91. NicMpCoDeactivateVc(
  92. IN NDIS_HANDLE MiniportVcContext
  93. );
  94. VOID
  95. NicMpCoSendPackets(
  96. IN NDIS_HANDLE MiniportVcContext,
  97. IN PPNDIS_PACKET PacketArray,
  98. IN UINT NumberOfPackets
  99. );
  100. NDIS_STATUS
  101. NicMpCoRequest(
  102. IN NDIS_HANDLE MiniportAdapterContext,
  103. IN NDIS_HANDLE MiniportVcContext,
  104. IN OUT PNDIS_REQUEST NdisRequest
  105. );
  106. BOOLEAN
  107. CheckForHang(
  108. IN NDIS_HANDLE MiniportAdapterContext
  109. );
  110. //-----------------------------------------------------------------------------
  111. // prototypes for miniport.c (alphabetically)
  112. //-----------------------------------------------------------------------------
  113. NDIS_STATUS
  114. nicAllocateAddressRangeOnNewPdo (
  115. IN PADAPTERCB pAdapter,
  116. IN PREMOTE_NODE pRemoteNode
  117. );
  118. VOID
  119. nicResetNotificationCallback (
  120. IN PVOID pContext
  121. );
  122. VOID
  123. nicBusResetWorkItem(
  124. NDIS_WORK_ITEM* pResetWorkItem,
  125. IN PVOID Context
  126. );
  127. VOID
  128. nicFreeAdapter(
  129. IN ADAPTERCB* pAdapter
  130. );
  131. NDIS_STATUS
  132. nicFreeRemoteNode(
  133. IN REMOTE_NODE *pRemoteNode
  134. );
  135. NDIS_STATUS
  136. nicGetRegistrySettings(
  137. IN NDIS_HANDLE WrapperConfigurationContext,
  138. IN ADAPTERCB * pAdapter
  139. );
  140. NDIS_STATUS
  141. nicQueryInformation(
  142. IN ADAPTERCB* pAdapter,
  143. IN VCCB* pVc,
  144. IN OUT PNDIS_REQUEST NdisRequest
  145. );
  146. NDIS_STATUS
  147. nicSetInformation(
  148. IN ADAPTERCB* pAdapter,
  149. IN VCCB* pVc,
  150. IN OUT PNDIS_REQUEST NdisRequest
  151. );
  152. VOID
  153. nicIssueBusReset (
  154. PADAPTERCB pAdapter,
  155. ULONG Flags
  156. );
  157. VOID
  158. nicResetReallocateChannels (
  159. IN PADAPTERCB pAdapter
  160. );
  161. VOID
  162. nicResetRestartBCM (
  163. IN PADAPTERCB pAdapter
  164. );
  165. VOID
  166. nicReallocateChannels (
  167. IN PNDIS_WORK_ITEM pWorkItem,
  168. IN PVOID Context
  169. );
  170. VOID
  171. nicUpdateLocalHostSpeed (
  172. IN PADAPTERCB pAdapter
  173. );
  174. VOID
  175. nicInitializeAllEvents (
  176. IN PADAPTERCB pAdapter
  177. );
  178. VOID
  179. nicAddRemoteNodeChannelVc (
  180. IN PADAPTERCB pAdapter,
  181. IN PREMOTE_NODE pRemoteNode
  182. );
  183. VOID
  184. nicNoRemoteNodesLeft (
  185. IN PADAPTERCB pAdapter
  186. );
  187. VOID
  188. nicDeleteLookasideList (
  189. IN OUT PNIC_NPAGED_LOOKASIDE_LIST pLookasideList
  190. );
  191. VOID
  192. nicInitializeAdapterLookasideLists (
  193. IN PADAPTERCB pAdapter
  194. );
  195. VOID
  196. nicInitializeLookasideList(
  197. IN OUT PNIC_NPAGED_LOOKASIDE_LIST pLookasideList,
  198. ULONG Size,
  199. ULONG Tag,
  200. USHORT Depth
  201. );
  202. VOID
  203. nicDeleteAdapterLookasideLists (
  204. IN PADAPTERCB pAdapter
  205. );
  206. VOID
  207. nicFillRemoteNodeTable (
  208. IN PADAPTERCB pAdapter
  209. );
  210. VOID
  211. ReassemblyTimerFunction (
  212. IN PVOID SystemSpecific1,
  213. IN PVOID FunctionContext,
  214. IN PVOID SystemSpecific2,
  215. IN PVOID SystemSpecific3
  216. );
  217. extern const PUCHAR pnic1394DriverDescription;
  218. extern const USHORT nic1394DriverGeneration;
  219. extern const unsigned char Net1394ConfigRom[48];
  220. NDIS_STATUS
  221. nicAddIP1394ToConfigRom (
  222. IN PADAPTERCB pAdapter
  223. );
  224. VOID
  225. nicUpdateRemoteNodeTable (
  226. IN PADAPTERCB pAdapter
  227. );
  228. NTSTATUS
  229. nicUpdateRemoteNodeCompletion (
  230. IN PDEVICE_OBJECT pDeviceObject,
  231. IN PIRP pIrp,
  232. IN PVOID pContext
  233. );
  234. NDIS_STATUS
  235. nicMCmRegisterAddressFamily (
  236. IN PADAPTERCB pAdapter
  237. );
  238. VOID
  239. nicFreeReassembliesOnRemoteNode (
  240. IN PREMOTE_NODE pRemoteNode,
  241. IN PLIST_ENTRY pReassemblyList
  242. );
  243. VOID
  244. nicFreeReassembliesOnRemoteNode (
  245. IN PREMOTE_NODE pRemoteNode,
  246. PLIST_ENTRY pToBeFreedList
  247. );
  248. UCHAR
  249. nicGetMaxRecFromBytes(
  250. IN ULONG ByteSize
  251. );
  252. UCHAR
  253. nicGetMaxRecFromSpeed(
  254. IN ULONG Scode
  255. );
  256. PREMOTE_NODE
  257. nicGetRemoteNodeFromTable (
  258. ULONG NodeNumber,
  259. PADAPTERCB pAdapter
  260. );
  261. //
  262. // ConnectionLess Handlers
  263. //
  264. NDIS_STATUS
  265. NicEthQueryInformation(
  266. IN NDIS_HANDLE MiniportAdapterContext,
  267. IN NDIS_OID Oid,
  268. IN PVOID InformationBuffer,
  269. IN ULONG InformationBufferLength,
  270. OUT PULONG BytesWritten,
  271. OUT PULONG BytesNeeded
  272. );
  273. NDIS_STATUS
  274. NicEthSetInformation(
  275. IN NDIS_HANDLE MiniportAdapterContext,
  276. NDIS_OID Oid,
  277. PVOID InformationBuffer,
  278. ULONG InformationBufferLength,
  279. PULONG BytesRead,
  280. PULONG BytesNeeded
  281. );
  282. VOID
  283. NicMpSendPackets(
  284. IN NDIS_HANDLE MiniportAdapterContext,
  285. IN PPNDIS_PACKET PacketArray,
  286. IN UINT NumberOfPackets
  287. );
  288. NDIS_STATUS
  289. nicFillNicInfo (
  290. IN PADAPTERCB pAdapter,
  291. PNIC1394_NICINFO pInNicInfo,
  292. PNIC1394_NICINFO pOutNicInfo
  293. );
  294. NDIS_STATUS
  295. nicFillBusInfo(
  296. IN PADAPTERCB pAdapter,
  297. IN OUT PNIC1394_BUSINFO pBi
  298. );
  299. NDIS_STATUS
  300. nicFillChannelInfo(
  301. IN PADAPTERCB pAdapter,
  302. IN OUT PNIC1394_CHANNELINFO pCi
  303. );
  304. NDIS_STATUS
  305. nicFillRemoteNodeInfo(
  306. IN PADAPTERCB pAdapter,
  307. IN OUT PNIC1394_REMOTENODEINFO pRni
  308. );
  309. VOID
  310. nicCopyPacketStats (
  311. NIC1394_PACKET_STATS* pStats,
  312. UINT TotNdisPackets, // Total number of NDIS packets sent/indicated
  313. UINT NdisPacketsFailures,// Number of NDIS packets failed/discarded
  314. UINT TotBusPackets, // Total number of BUS-level reads/writes
  315. UINT BusPacketFailures // Number of BUS-level failures(sends)/discards(recv)
  316. );
  317. VOID
  318. nicAddPacketStats(
  319. NIC1394_PACKET_STATS* pStats,
  320. UINT TotNdisPackets, // Total number of NDIS packets sent/indicated
  321. UINT NdisPacketsFailures,// Number of NDIS packets failed/discarded
  322. UINT TotBusPackets, // Total number of BUS-level reads/writes
  323. UINT BusPacketFailures // Number of BUS-level failures(sends)/discards(recv)
  324. );
  325. NDIS_STATUS
  326. nicResetStats (
  327. IN PADAPTERCB pAdapter,
  328. PNIC1394_RESETSTATS pResetStats
  329. );
  330. VOID
  331. nicInformProtocolsOfReset(
  332. IN PADAPTERCB pAdapter
  333. );
  334. VOID
  335. nicUpdateSpeedInAllVCs (
  336. PADAPTERCB pAdapter,
  337. ULONG Speed
  338. );
  339. VOID
  340. nicUpdateRemoteNodeCaps(
  341. PADAPTERCB pAdapter
  342. );
  343. VOID
  344. nicQueryInformationWorkItem(
  345. IN PNDIS_WORK_ITEM pWorkItem,
  346. IN PVOID Context
  347. );
  348. VOID
  349. nicIndicateStatusTimer(
  350. IN PVOID SystemSpecific1,
  351. IN PVOID FunctionContext,
  352. IN PVOID SystemSpecific2,
  353. IN PVOID SystemSpecific3
  354. );
  355. VOID
  356. nicMIndicateStatus(
  357. IN PADAPTERCB pAdapter ,
  358. IN NDIS_STATUS GeneralStatus,
  359. IN PVOID StatusBuffer,
  360. IN UINT StatusBufferSize
  361. );
  362. NDIS_STATUS
  363. nicInitSerializedStatusStruct(
  364. PADAPTERCB pAdapter
  365. );
  366. VOID
  367. nicDeInitSerializedStatusStruct(
  368. PADAPTERCB pAdapter
  369. );
  370. NDIS_STATUS
  371. nicEthLoadArpModule (
  372. IN PADAPTERCB pAdapter,
  373. IN ULONG StartArp,
  374. IN PNDIS_REQUEST pRequest
  375. );
  376. VOID
  377. nicGetAdapterName (
  378. IN PADAPTERCB pAdapter,
  379. IN WCHAR *pAdapterName,
  380. IN ULONG BufferSize,
  381. IN PULONG SizeReturned
  382. );
  383. NDIS_STATUS
  384. nicQueueRequestToArp(
  385. PADAPTERCB pAdapter,
  386. ARP_ACTION Action,
  387. PNDIS_REQUEST pRequest
  388. );
  389. NTSTATUS
  390. nicSubmitIrp(
  391. IN PDEVICE_OBJECT pPdo,
  392. IN PIRP pIrp,
  393. IN PIRB pIrb,
  394. IN PIO_COMPLETION_ROUTINE pCompletion,
  395. IN PVOID pContext
  396. );