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.

347 lines
8.7 KiB

  1. /*++
  2. Copyright (c) 1998-99 Microsoft Corporation
  3. Module Name:
  4. 1394enum.h
  5. Abstract:
  6. Definitions for 1394 Ndis enumerator
  7. Author:
  8. Alireza Dabagh (alid) Nov 98
  9. Environment:
  10. Kernel mode only
  11. Revision History:
  12. --*/
  13. #ifndef _NDISENUM1394_
  14. #define _NDISENUM1394_
  15. typedef struct _NDISENUM1394_LOCAL_HOST NDISENUM1394_LOCAL_HOST,*PNDISENUM1394_LOCAL_HOST;
  16. typedef struct _NDISENUM1394_REMOTE_NODE NDISENUM1394_REMOTE_NODE,*PNDISENUM1394_REMOTE_NODE;
  17. //
  18. // flags for LocalHost->Flags
  19. //
  20. #define NDISENUM1394_LOCALHOST_REGISTERED 0x00000001
  21. //
  22. // flags for RemoteNode->Flags
  23. //
  24. #define NDISENUM1394_NODE_INDICATED 0x00000001
  25. #define NDISENUM1394_NODE_ADDED 0x00000002
  26. #define NDISENUM1394_NODE_PNP_STARTED 0x00000004
  27. #define NDISENUM1394_NODE_PNP_REMOVED 0x00000008
  28. #define NDISENUM1394_TAG_LOCAL_HOST 'hl4N'
  29. #define NDISENUM1394_TAG_WORK_ITEM 'iw4N'
  30. #define NDISENUM1394_TAG_IRB 'br4N'
  31. #define NDISENUM1394_TAG_DEVICE_NAME 'nd4N'
  32. #define NDISENUM1394_TAG_1394API_REQ 'qr4N'
  33. #define NDISENUM1394_TAG_DEFAULT ' 4N'
  34. #define ENUM_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
  35. #define ENUM_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
  36. #define ENUM_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
  37. #define ENUM_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
  38. typedef enum _NDIS_PNP_DEVICE_STATE
  39. {
  40. PnPDeviceAdded,
  41. PnPDeviceStarted,
  42. PnPDeviceQueryStopped,
  43. PnPDeviceStopped,
  44. PnPDeviceQueryRemoved,
  45. PnPDeviceRemoved,
  46. PnPDeviceSurpriseRemoved
  47. } NDIS_PNP_DEVICE_STATE;
  48. typedef enum _NDISENUM1394_PNP_OP
  49. {
  50. NdisEnum1394_StopDevice,
  51. NdisEnum1394_RemoveDevice,
  52. NdisEnum1394_SurpriseRemoveDevice,
  53. } NDISENUM1394_PNP_OP, *PNDISENUM1394_PNP_OP;
  54. //
  55. // block used for references...
  56. //
  57. typedef struct _REFERENCE
  58. {
  59. KSPIN_LOCK SpinLock;
  60. USHORT ReferenceCount;
  61. BOOLEAN Closing;
  62. } REFERENCE, * PREFERENCE;
  63. //
  64. // one per 1394 local host. all remote 1394 controllers connected to a local host
  65. // will be queued on this structure
  66. //
  67. struct _NDISENUM1394_LOCAL_HOST
  68. {
  69. PNDISENUM1394_LOCAL_HOST Next; // next local host node
  70. PVOID Nic1394AdapterContext; // Nic1394 context for the local host
  71. LARGE_INTEGER UniqueId; // unique ID for local host
  72. PDEVICE_OBJECT PhysicalDeviceObject; // PDO created by 1394 bus
  73. PNDISENUM1394_REMOTE_NODE RemoteNodeList; // remote Nodes on local host
  74. KSPIN_LOCK Lock;
  75. ULONG Flags;
  76. REFERENCE Reference;
  77. };
  78. //
  79. // one per remote node
  80. //
  81. struct _NDISENUM1394_REMOTE_NODE
  82. {
  83. PNDISENUM1394_REMOTE_NODE Next;
  84. PVOID Nic1394NodeContext; // Nic1394 context for the remote node
  85. PDEVICE_OBJECT DeviceObject;
  86. PDEVICE_OBJECT NextDeviceObject;
  87. PDEVICE_OBJECT PhysicalDeviceObject;
  88. KSPIN_LOCK Lock;
  89. PNDISENUM1394_LOCAL_HOST LocalHost;
  90. ULONG Flags;
  91. ULONG UniqueId[2];
  92. NDIS_PNP_DEVICE_STATE PnPDeviceState;
  93. REFERENCE Reference;
  94. };
  95. #define INITIALIZE_EVENT(_pEvent_) KeInitializeEvent(_pEvent_, NotificationEvent, FALSE)
  96. #define SET_EVENT(_pEvent_) KeSetEvent(_pEvent_, 0, FALSE)
  97. #define RESET_EVENT(_pEvent_) KeResetEvent(_pEvent_)
  98. #define WAIT_FOR_OBJECT(_O_, _TO_) KeWaitForSingleObject(_O_, \
  99. Executive, \
  100. KernelMode, \
  101. FALSE, \
  102. _TO_) \
  103. #define ALLOC_FROM_POOL(_Size_, _Tag_) ExAllocatePoolWithTag(NonPagedPool, \
  104. _Size_, \
  105. _Tag_)
  106. #define FREE_POOL(_P_) ExFreePool(_P_)
  107. NTSTATUS
  108. DriverEntry(
  109. IN PDRIVER_OBJECT DriverObject,
  110. IN PUNICODE_STRING RegistryPath
  111. );
  112. VOID
  113. ndisEnum1394InitializeRef(
  114. IN PREFERENCE RefP
  115. );
  116. BOOLEAN
  117. ndisEnum1394ReferenceRef(
  118. IN PREFERENCE RefP
  119. );
  120. BOOLEAN
  121. ndisEnum1394DereferenceRef(
  122. IN PREFERENCE RefP
  123. );
  124. BOOLEAN
  125. ndisEnum1394CloseRef(
  126. IN PREFERENCE RefP
  127. );
  128. BOOLEAN
  129. ndisEnum1394ReferenceLocalHost(
  130. IN PNDISENUM1394_LOCAL_HOST LocalHost
  131. );
  132. BOOLEAN
  133. ndisEnum1394DereferenceLocalHost(
  134. IN PNDISENUM1394_LOCAL_HOST LocalHost
  135. );
  136. NTSTATUS
  137. ndisEnum1394AddDevice(
  138. PDRIVER_OBJECT DriverObject,
  139. PDEVICE_OBJECT PhysicalDeviceObject
  140. );
  141. NTSTATUS
  142. ndisEnum1394PnpDispatch(
  143. IN PDEVICE_OBJECT DeviceObject,
  144. IN PIRP Irp
  145. );
  146. NTSTATUS
  147. ndisEnum1394PowerDispatch(
  148. IN PDEVICE_OBJECT DeviceObject,
  149. IN PIRP Irp
  150. );
  151. NTSTATUS
  152. ndisEnum1394WMIDispatch(
  153. IN PDEVICE_OBJECT DeviceObject,
  154. IN PIRP Irp
  155. );
  156. NTSTATUS
  157. ndisEnum1394StartDevice(
  158. IN PDEVICE_OBJECT DeviceObject,
  159. IN PIRP Irp
  160. );
  161. NTSTATUS
  162. ndisEnum1394RemoveDevice(
  163. PDEVICE_OBJECT DeviceObject,
  164. PIRP Irp,
  165. NDISENUM1394_PNP_OP PnpOp
  166. );
  167. NTSTATUS
  168. ndisEnum1394CreateIrpHandler(
  169. IN PDEVICE_OBJECT DeviceObject,
  170. IN PIRP Irp
  171. );
  172. NTSTATUS
  173. ndisEnum1394CloseIrpHandler(
  174. IN PDEVICE_OBJECT DeviceObject,
  175. IN PIRP Irp
  176. );
  177. NTSTATUS
  178. ndisEnum1394DeviceIoControl(
  179. IN PDEVICE_OBJECT DeviceObject,
  180. IN PIRP Irp
  181. );
  182. VOID
  183. ndisEnum1394Unload(
  184. IN PDRIVER_OBJECT DriverObject
  185. );
  186. NTSTATUS
  187. ndisEnum1394GetLocalHostForRemoteNode(
  188. IN PNDISENUM1394_REMOTE_NODE RemoteNode,
  189. OUT PNDISENUM1394_LOCAL_HOST * pLocalHost
  190. );
  191. VOID
  192. ndisEnum1394GetLocalHostForUniqueId(
  193. LARGE_INTEGER UniqueId,
  194. OUT PNDISENUM1394_LOCAL_HOST * pLocalHost
  195. );
  196. NTSTATUS
  197. ndisEnum1394BusRequest(
  198. PDEVICE_OBJECT DeviceObject,
  199. PIRB Irb
  200. );
  201. NTSTATUS
  202. ndisEnum1394IrpCompletion(
  203. IN PDEVICE_OBJECT DeviceObject,
  204. IN PIRP Irp,
  205. IN PVOID Context
  206. );
  207. NTSTATUS
  208. ndisEnum1394PassIrpDownTheStack(
  209. IN PIRP pIrp,
  210. IN PDEVICE_OBJECT pNextDeviceObject
  211. );
  212. VOID
  213. ndisEnum1394FreeLocalHost(
  214. IN PNDISENUM1394_LOCAL_HOST LocalHost
  215. );
  216. VOID
  217. ndisEnum1394IndicateNodes(
  218. PNDISENUM1394_LOCAL_HOST LocalHost
  219. );
  220. NTSTATUS
  221. ndisEnum1394DummyIrpHandler(
  222. IN PDEVICE_OBJECT DeviceObject,
  223. IN PIRP Irp
  224. );
  225. NTSTATUS
  226. NdisEnum1394RegisterDriver(
  227. IN PNIC1394_CHARACTERISTICS Characteristics
  228. );
  229. VOID
  230. NdisEnum1394DeregisterDriver(
  231. VOID
  232. );
  233. NTSTATUS
  234. NdisEnum1394RegisterAdapter(
  235. IN PVOID Nic1394AdapterContext,
  236. IN PDEVICE_OBJECT PhysicalDeviceObject,
  237. OUT PVOID* pEnum1394AdapterHandle,
  238. OUT PLARGE_INTEGER pLocalHostUniqueId
  239. );
  240. VOID
  241. NdisEnum1394DeregisterAdapter(
  242. IN PVOID Enum1394AdapterHandle
  243. );
  244. VOID
  245. Enum1394Callback(
  246. PVOID CallBackContext,
  247. PVOID Source,
  248. PVOID Characteristics
  249. );
  250. //
  251. // different debug level defines
  252. //
  253. #define ENUM1394_DBGLEVEL_NONE 0
  254. #define ENUM1394_DBGLEVEL_ERROR 1
  255. #define ENUM1394_DBGLEVEL_WARN 2
  256. #define ENUM1394_DBGLEVEL_INFO 3
  257. #if DBG
  258. #define DBGBREAK DbgBreakPoint
  259. #define DbgIsNull(_Ptr) ( ((PVOID)(_Ptr)) == NULL )
  260. #define DBGPRINT(Level, Fmt) \
  261. { \
  262. if (Enum1394DebugLevel >= Level) \
  263. { \
  264. DbgPrint Fmt; \
  265. } \
  266. }
  267. #else
  268. #define DBGPRINT
  269. #define DBGBREAK()
  270. #define DbgIsNull(_Ptr) FALSE
  271. #endif
  272. #endif //_NDIS_1394_ENUM_
  273.