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.

441 lines
7.9 KiB

  1. //
  2. // Copyright (c) 1998-1999, Microsoft Corporation, all rights reserved
  3. //
  4. // cm.c
  5. //
  6. // IEEE1394 mini-port/call-manager driver
  7. //
  8. // Call Manager routines
  9. //
  10. // 06/20/1999 ADube Created - Declarations for call-manager routines
  11. //
  12. // Debug counts of client oddities that should not be happening.
  13. //
  14. extern ULONG g_ulUnexpectedInCallCompletes;
  15. extern ULONG g_ulCallsNotClosable;
  16. //#define MaxNumSlistEntry 0x100
  17. #define MAX_NUM_ISOCH_DESCRIPTOR 0x20
  18. #define MAX_CHANNEL_BUFFER_SIZE 0x300
  19. #define MAX_CHANNEL_BYTES_PER_FRAME 0x280
  20. //-----------------------------------------------------------------------------
  21. // L O C A L T Y P E S F O R cm.c
  22. //-----------------------------------------------------------------------------
  23. typedef enum _VC_SEND_RECEIVE
  24. {
  25. TransmitVc = 0,
  26. ReceiveVc,
  27. TransmitAndReceiveVc,
  28. InvalidType
  29. } VC_SEND_RECEIVE ;
  30. //-----------------------------------------------------------------------------
  31. // N D I S C A L L - M A N A G E R H A N D L E R S
  32. //-----------------------------------------------------------------------------
  33. NDIS_STATUS
  34. NicCmOpenAf(
  35. IN NDIS_HANDLE CallMgrBindingContext,
  36. IN PCO_ADDRESS_FAMILY AddressFamily,
  37. IN NDIS_HANDLE NdisAfHandle,
  38. OUT PNDIS_HANDLE CallMgrAfContext
  39. );
  40. NDIS_STATUS
  41. NicCmCloseAf(
  42. IN NDIS_HANDLE CallMgrAfContext
  43. );
  44. NDIS_STATUS
  45. NicCmCreateVc(
  46. IN NDIS_HANDLE ProtocolAfContext,
  47. IN NDIS_HANDLE NdisVcHandle,
  48. OUT PNDIS_HANDLE ProtocolVcContext
  49. );
  50. NDIS_STATUS
  51. NicCmDeleteVc(
  52. IN NDIS_HANDLE ProtocolVcContext
  53. );
  54. NDIS_STATUS
  55. NicCmMakeCall(
  56. IN NDIS_HANDLE CallMgrVcContext,
  57. IN OUT PCO_CALL_PARAMETERS CallParameters,
  58. IN NDIS_HANDLE NdisPartyHandle,
  59. OUT PNDIS_HANDLE CallMgrPartyContext
  60. );
  61. NDIS_STATUS
  62. NicCmCloseCall(
  63. IN NDIS_HANDLE CallMgrVcContext,
  64. IN NDIS_HANDLE CallMgrPartyContext,
  65. IN PVOID CloseData,
  66. IN UINT Size
  67. );
  68. NDIS_STATUS
  69. NicCmModifyCallQoS(
  70. IN NDIS_HANDLE CallMgrVcContext,
  71. IN PCO_CALL_PARAMETERS CallParameters
  72. );
  73. NDIS_STATUS
  74. NicCmRequest(
  75. IN NDIS_HANDLE CallMgrAfContext,
  76. IN NDIS_HANDLE CallMgrVcContext,
  77. IN NDIS_HANDLE CallMgrPartyContext,
  78. IN OUT PNDIS_REQUEST NdisRequest
  79. );
  80. NDIS_STATUS
  81. nicRegisterSapHandler(
  82. IN NDIS_HANDLE CallMgrAfContext,
  83. IN PCO_SAP Sap,
  84. IN NDIS_HANDLE NdisSapHandle,
  85. OUT PNDIS_HANDLE CallMgrSapContext
  86. );
  87. NDIS_STATUS
  88. nicDeregisterSapHandler(
  89. IN NDIS_HANDLE CallMgrSapContext
  90. );
  91. NDIS_STATUS
  92. nicCmAddPartyHandler(
  93. IN NDIS_HANDLE CallMgrVcContext,
  94. IN OUT PCO_CALL_PARAMETERS CallParameters,
  95. IN NDIS_HANDLE NdisPartyHandle,
  96. OUT PNDIS_HANDLE CallMgrPartyContext
  97. );
  98. NDIS_STATUS
  99. nicCmDropPartyHandler(
  100. IN NDIS_HANDLE CallMgrPartyContext,
  101. IN PVOID CloseData OPTIONAL,
  102. IN UINT Size OPTIONAL
  103. );
  104. //-----------------------------------------------------------------------------
  105. // Local prototypes (alphabetically)
  106. //-----------------------------------------------------------------------------
  107. VOID
  108. InterceptMakeCallParameters(
  109. PCO_MEDIA_PARAMETERS pMediaParams,
  110. PNIC1394_MEDIA_PARAMETERS pN1394Params
  111. );
  112. NDIS_STATUS
  113. nicAllocateAddressRangeOnActiveRemoteNodes (
  114. IN PADAPTERCB pAdapter
  115. );
  116. VOID
  117. nicCallSetupComplete(
  118. IN VCCB* pVc
  119. );
  120. VOID
  121. nicChannelCallFreeResources (
  122. IN PCHANNEL_VCCB pChannelVc,
  123. IN PADAPTERCB pAdapter,
  124. IN HANDLE hResource,
  125. IN ULONG NumDescriptors,
  126. IN PISOCH_DESCRIPTOR pIsochDesciptor,
  127. IN BOOLEAN fChannelAllocated,
  128. IN ULONG Channel,
  129. IN PNIC_PACKET_POOL pPool
  130. );
  131. VOID
  132. nicChannelCallCleanDataStructure (
  133. IN PCHANNEL_VCCB pChannelVc,
  134. IN HANDLE hResource,
  135. IN ULONG NumDescriptors,
  136. IN PISOCH_DESCRIPTOR pIsochDesciptor,
  137. IN BOOLEAN fChannelAllocated,
  138. IN ULONG Channel,
  139. IN NDIS_HANDLE hPacketPoolHandle,
  140. OUT PULONG pNumRefsDecremented
  141. );
  142. NDIS_STATUS
  143. nicAllocateChannelResourcesAndListen (
  144. IN PADAPTERCB pAdapter,
  145. IN PCHANNEL_VCCB pChannelVc
  146. );
  147. NDIS_STATUS
  148. nicCmGenericMakeCallInit (
  149. IN PVCCB pVc
  150. );
  151. VOID
  152. nicCmGenrericMakeCallFailure (
  153. IN PVCCB pVc
  154. );
  155. VOID
  156. nicCmCloseCallComplete(
  157. NDIS_WORK_ITEM* pCloseCallCompleteWorkItem,
  158. IN PVOID Context
  159. );
  160. NDIS_STATUS
  161. nicCmCloseCallEthernet (
  162. IN PVCCB pVc
  163. );
  164. NDIS_STATUS
  165. nicCmCloseCallMultiChannel (
  166. IN PVCCB pVc
  167. );
  168. NDIS_STATUS
  169. nicCmCloseCallRecvFIFO (
  170. IN PVCCB pVc
  171. );
  172. NDIS_STATUS
  173. nicCmCloseCallSendFIFO (
  174. IN PVCCB pVc
  175. );
  176. NDIS_STATUS
  177. nicCmCloseCallSendRecvChannel (
  178. IN PVCCB pVc
  179. );
  180. NDIS_STATUS
  181. nicCmCloseCallSendChannel(
  182. IN PVCCB pVc
  183. );
  184. VOID
  185. nicCmMakeCallComplete (
  186. NDIS_WORK_ITEM* pMakeCallCompleteWorkItem,
  187. IN PVOID Context
  188. );
  189. VOID
  190. nicCmMakeCallCompleteFailureCleanUp(
  191. IN OUT PVCCB pVc
  192. );
  193. NDIS_STATUS
  194. nicCmMakeCallInitRecvChannelVc(
  195. IN OUT PVCCB pVc
  196. );
  197. NDIS_STATUS
  198. nicCmMakeCallInitSendChannelVc(
  199. IN OUT PVCCB pVc
  200. );
  201. NDIS_STATUS
  202. nicCmMakeCallInitSendRecvChannelVc(
  203. IN OUT PVCCB pVc
  204. );
  205. NDIS_STATUS
  206. nicCmMakeCallInitEthernet(
  207. IN PVCCB pVc
  208. );
  209. NDIS_STATUS
  210. nicCmMakeCallSendChannel (
  211. IN PVCCB pVc
  212. );
  213. NDIS_STATUS
  214. nicCmMakeCallMultiChannel (
  215. IN PVCCB pVc
  216. );
  217. NDIS_STATUS
  218. nicAllocateRequestedChannelMakeCallComplete (
  219. IN PADAPTERCB pAdapter,
  220. IN PCHANNEL_VCCB pChannelVc,
  221. IN OUT PULONG pChannel
  222. );
  223. NDIS_STATUS
  224. nicCmMakeCallInitRecvFIFOVc(
  225. IN OUT PVCCB pVc
  226. );
  227. NDIS_STATUS
  228. nicCmMakeCallInitSendFIFOVc(
  229. IN OUT PVCCB pVc
  230. );
  231. VOID
  232. nicDereferenceAF(
  233. IN AFCB* pAF
  234. );
  235. ULONG
  236. nicGetMaxPayLoadForSpeed(
  237. IN ULONG Speed,
  238. IN ULONG mtu
  239. );
  240. VOID
  241. nicInactiveCallCleanUp(
  242. IN VCCB* pVc
  243. );
  244. NDIS_STATUS
  245. nicInitRecvFifoDataStructures (
  246. IN PRECVFIFO_VCCB pRecvFIFOVc
  247. );
  248. VOID
  249. nicUnInitRecvFifoDataStructures (
  250. IN PRECVFIFO_VCCB pRecvFIFOVc
  251. );
  252. VOID
  253. nicFreeAF(
  254. IN AFCB* pAF
  255. );
  256. VOID
  257. nicReferenceAF(
  258. IN AFCB* pAF
  259. );
  260. #if TODO
  261. VOID
  262. nicTimerQTerminateComplete(
  263. IN TIMERQ* pTimerQ,
  264. IN VOID* pContext );
  265. #endif // TODO
  266. NDIS_STATUS
  267. nicCmQueryInformation(
  268. IN NDIS_HANDLE CallMgrAfContext,
  269. IN NDIS_HANDLE CallMgrVcContext,
  270. IN NDIS_HANDLE CallMgrPartyContext,
  271. IN NDIS_OID Oid,
  272. IN PVOID InformationBuffer,
  273. IN ULONG InformationBufferLength,
  274. OUT PULONG BytesWritten,
  275. OUT PULONG BytesNeeded
  276. );
  277. NDIS_STATUS
  278. nicCmSetInformation(
  279. IN NDIS_HANDLE CallMgrAfContext,
  280. IN NDIS_HANDLE CallMgrVcContext,
  281. IN NDIS_HANDLE CallMgrPartyContext,
  282. IN NDIS_OID Oid,
  283. IN PVOID InformationBuffer,
  284. IN ULONG InformationBufferLength,
  285. OUT PULONG BytesRead,
  286. OUT PULONG BytesNeeded
  287. );
  288. NDIS_STATUS
  289. nicGetActiveRemoteNode (
  290. PADAPTERCB pAdpater,
  291. PREMOTE_NODE* ppRemoteNodePdoCb
  292. );
  293. NDIS_STATUS
  294. nicChangeChannelChar (
  295. PVCCB pVc,
  296. PNIC1394_CHANNEL_CHARACTERISTICS pMcChar
  297. );
  298. NDIS_STATUS
  299. nicCmGenericMakeCallInitChannels (
  300. IN PCHANNEL_VCCB pChannelVc,
  301. VC_SEND_RECEIVE VcType
  302. );
  303. NDIS_STATUS
  304. nicCmGenericMakeCallInitFifo (
  305. IN PVCCB pVc,
  306. VC_SEND_RECEIVE VcType
  307. );
  308. NDIS_STATUS
  309. nicCmGenericMakeCallMutilChannel (
  310. IN PVCCB pVc,
  311. VC_SEND_RECEIVE VcType
  312. );
  313. NDIS_STATUS
  314. nicCmGenericMakeCallEthernet(
  315. IN PVCCB pVc,
  316. IN VC_SEND_RECEIVE VcType
  317. );
  318. VOID
  319. nicInterceptMakeCallParameters (
  320. PCO_MEDIA_PARAMETERS pMedia
  321. );
  322. NDIS_STATUS
  323. nicQueryRemoteNodeCaps (
  324. IN PADAPTERCB pAdapter,
  325. IN PREMOTE_NODE pRemoteNode,
  326. OUT PULONG pSpeed,
  327. OUT PULONG pMaxBufferSize,
  328. OUT PULONG pMaxRec
  329. );
  330. UINT
  331. nicSpeedFlagsToSCode(
  332. IN UINT SpeedFlags
  333. );