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.

2088 lines
53 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. miniport.h
  5. Abstract:
  6. Type definitions for miniport drivers.
  7. Revision History:
  8. --*/
  9. #ifndef _MINIPORT_
  10. #define _MINIPORT_
  11. #include "stddef.h"
  12. #define ASSERT( exp )
  13. #ifndef FAR
  14. #define FAR
  15. #endif
  16. #ifndef IN
  17. #define IN
  18. #endif
  19. #ifndef OUT
  20. #define OUT
  21. #endif
  22. #ifndef OPTIONAL
  23. #define OPTIONAL
  24. #endif
  25. #ifndef NOTHING
  26. #define NOTHING
  27. #endif
  28. #ifndef CRITICAL
  29. #define CRITICAL
  30. #endif
  31. #ifndef ANYSIZE_ARRAY
  32. #define ANYSIZE_ARRAY 1 // winnt
  33. #endif
  34. // begin_winnt
  35. #if defined(_M_MRX000) && !(defined(MIDL_PASS) || defined(RC_INVOKED)) && defined(ENABLE_RESTRICTED)
  36. #define RESTRICTED_POINTER __restrict
  37. #else
  38. #define RESTRICTED_POINTER
  39. #endif
  40. #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
  41. #define UNALIGNED __unaligned
  42. #if defined(_WIN64)
  43. #define UNALIGNED64 __unaligned
  44. #else
  45. #define UNALIGNED64
  46. #endif
  47. #else
  48. #define UNALIGNED
  49. #define UNALIGNED64
  50. #endif
  51. #if defined(_WIN64) || defined(_M_ALPHA)
  52. #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
  53. #define MEMORY_ALLOCATION_ALIGNMENT 16
  54. #else
  55. #define MAX_NATURAL_ALIGNMENT sizeof(ULONG)
  56. #define MEMORY_ALLOCATION_ALIGNMENT 8
  57. #endif
  58. //
  59. // TYPE_ALIGNMENT will return the alignment requirements of a given type for
  60. // the current platform.
  61. //
  62. #ifdef __cplusplus
  63. #if _MSC_VER >= 1300
  64. #define TYPE_ALIGNMENT( t ) __alignof(t)
  65. #endif
  66. #else
  67. #define TYPE_ALIGNMENT( t ) \
  68. FIELD_OFFSET( struct { char x; t test; }, test )
  69. #endif
  70. #if defined(_WIN64)
  71. #define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( ULONG ) ? \
  72. TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( ULONG ))
  73. #define PROBE_ALIGNMENT32( _s ) TYPE_ALIGNMENT( ULONG )
  74. #else
  75. #define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( ULONG )
  76. #endif
  77. //
  78. // C_ASSERT() can be used to perform many compile-time assertions:
  79. // type sizes, field offsets, etc.
  80. //
  81. // An assertion failure results in error C2118: negative subscript.
  82. //
  83. #define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
  84. #if !defined(_MAC) && (defined(_M_MRX000) || defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_VER >= 1100) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
  85. #define POINTER_64 __ptr64
  86. typedef unsigned __int64 POINTER_64_INT;
  87. #if defined(_WIN64)
  88. #define POINTER_32 __ptr32
  89. #else
  90. #define POINTER_32
  91. #endif
  92. #else
  93. #if defined(_MAC) && defined(_MAC_INT_64)
  94. #define POINTER_64 __ptr64
  95. typedef unsigned __int64 POINTER_64_INT;
  96. #else
  97. #define POINTER_64
  98. typedef unsigned long POINTER_64_INT;
  99. #endif
  100. #define POINTER_32
  101. #endif
  102. #if defined(_IA64_) || defined(_AMD64_)
  103. #define FIRMWARE_PTR
  104. #else
  105. #define FIRMWARE_PTR POINTER_32
  106. #endif
  107. #include <basetsd.h>
  108. // end_winnt
  109. #ifndef CONST
  110. #define CONST const
  111. #endif
  112. // begin_winnt
  113. #if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS)
  114. #define DECLSPEC_IMPORT __declspec(dllimport)
  115. #else
  116. #define DECLSPEC_IMPORT
  117. #endif
  118. #ifndef DECLSPEC_NORETURN
  119. #if (_MSC_VER >= 1200) && !defined(MIDL_PASS)
  120. #define DECLSPEC_NORETURN __declspec(noreturn)
  121. #else
  122. #define DECLSPEC_NORETURN
  123. #endif
  124. #endif
  125. #ifndef DECLSPEC_ALIGN
  126. #if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
  127. #define DECLSPEC_ALIGN(x) __declspec(align(x))
  128. #else
  129. #define DECLSPEC_ALIGN(x)
  130. #endif
  131. #endif
  132. #ifndef DECLSPEC_CACHEALIGN
  133. #define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
  134. #endif
  135. #ifndef DECLSPEC_UUID
  136. #if (_MSC_VER >= 1100) && defined (__cplusplus)
  137. #define DECLSPEC_UUID(x) __declspec(uuid(x))
  138. #else
  139. #define DECLSPEC_UUID(x)
  140. #endif
  141. #endif
  142. #ifndef DECLSPEC_NOVTABLE
  143. #if (_MSC_VER >= 1100) && defined(__cplusplus)
  144. #define DECLSPEC_NOVTABLE __declspec(novtable)
  145. #else
  146. #define DECLSPEC_NOVTABLE
  147. #endif
  148. #endif
  149. #ifndef DECLSPEC_SELECTANY
  150. #if (_MSC_VER >= 1100)
  151. #define DECLSPEC_SELECTANY __declspec(selectany)
  152. #else
  153. #define DECLSPEC_SELECTANY
  154. #endif
  155. #endif
  156. #ifndef NOP_FUNCTION
  157. #if (_MSC_VER >= 1210)
  158. #define NOP_FUNCTION __noop
  159. #else
  160. #define NOP_FUNCTION (void)0
  161. #endif
  162. #endif
  163. #ifndef DECLSPEC_ADDRSAFE
  164. #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
  165. #define DECLSPEC_ADDRSAFE __declspec(address_safe)
  166. #else
  167. #define DECLSPEC_ADDRSAFE
  168. #endif
  169. #endif
  170. #ifndef DECLSPEC_NOINLINE
  171. #if (_MSC_VER >= 1300)
  172. #define DECLSPEC_NOINLINE __declspec(noinline)
  173. #else
  174. #define DECLSPEC_NOINLINE
  175. #endif
  176. #endif
  177. #ifndef FORCEINLINE
  178. #if (_MSC_VER >= 1200)
  179. #define FORCEINLINE __forceinline
  180. #else
  181. #define FORCEINLINE __inline
  182. #endif
  183. #endif
  184. #ifndef DECLSPEC_DEPRECATED
  185. #if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
  186. #define DECLSPEC_DEPRECATED __declspec(deprecated)
  187. #define DEPRECATE_SUPPORTED
  188. #else
  189. #define DECLSPEC_DEPRECATED
  190. #undef DEPRECATE_SUPPORTED
  191. #endif
  192. #endif
  193. #ifdef DEPRECATE_DDK_FUNCTIONS
  194. #ifdef _NTDDK_
  195. #define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
  196. #ifdef DEPRECATE_SUPPORTED
  197. #define PRAGMA_DEPRECATED_DDK 1
  198. #endif
  199. #else
  200. #define DECLSPEC_DEPRECATED_DDK
  201. #define PRAGMA_DEPRECATED_DDK 1
  202. #endif
  203. #else
  204. #define DECLSPEC_DEPRECATED_DDK
  205. #define PRAGMA_DEPRECATED_DDK 0
  206. #endif
  207. //
  208. // Void
  209. //
  210. typedef void *PVOID;
  211. typedef void * POINTER_64 PVOID64;
  212. // end_winnt
  213. #if defined(_M_IX86)
  214. #define FASTCALL _fastcall
  215. #else
  216. #define FASTCALL
  217. #endif
  218. //
  219. // Basics
  220. //
  221. #ifndef VOID
  222. #define VOID void
  223. typedef char CHAR;
  224. typedef short SHORT;
  225. typedef long LONG;
  226. #endif
  227. //
  228. // UNICODE (Wide Character) types
  229. //
  230. #ifndef _MAC
  231. typedef wchar_t WCHAR; // wc, 16-bit UNICODE character
  232. #else
  233. // some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char
  234. typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
  235. #endif
  236. typedef WCHAR *PWCHAR;
  237. typedef WCHAR *LPWCH, *PWCH;
  238. typedef CONST WCHAR *LPCWCH, *PCWCH;
  239. typedef WCHAR *NWPSTR;
  240. typedef WCHAR *LPWSTR, *PWSTR;
  241. typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
  242. typedef CONST WCHAR *LPCWSTR, *PCWSTR;
  243. typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR;
  244. //
  245. // ANSI (Multi-byte Character) types
  246. //
  247. typedef CHAR *PCHAR;
  248. typedef CHAR *LPCH, *PCH;
  249. typedef CONST CHAR *LPCCH, *PCCH;
  250. typedef CHAR *NPSTR;
  251. typedef CHAR *LPSTR, *PSTR;
  252. typedef CONST CHAR *LPCSTR, *PCSTR;
  253. //
  254. // Neutral ANSI/UNICODE types and macros
  255. //
  256. #ifdef UNICODE // r_winnt
  257. #ifndef _TCHAR_DEFINED
  258. typedef WCHAR TCHAR, *PTCHAR;
  259. typedef WCHAR TUCHAR, *PTUCHAR;
  260. #define _TCHAR_DEFINED
  261. #endif /* !_TCHAR_DEFINED */
  262. typedef LPWSTR LPTCH, PTCH;
  263. typedef LPWSTR PTSTR, LPTSTR;
  264. typedef LPCWSTR PCTSTR, LPCTSTR;
  265. typedef LPUWSTR PUTSTR, LPUTSTR;
  266. typedef LPCUWSTR PCUTSTR, LPCUTSTR;
  267. typedef LPWSTR LP;
  268. #define __TEXT(quote) L##quote // r_winnt
  269. #else /* UNICODE */ // r_winnt
  270. #ifndef _TCHAR_DEFINED
  271. typedef char TCHAR, *PTCHAR;
  272. typedef unsigned char TUCHAR, *PTUCHAR;
  273. #define _TCHAR_DEFINED
  274. #endif /* !_TCHAR_DEFINED */
  275. typedef LPSTR LPTCH, PTCH;
  276. typedef LPSTR PTSTR, LPTSTR, PUTSTR, LPUTSTR;
  277. typedef LPCSTR PCTSTR, LPCTSTR, PCUTSTR, LPCUTSTR;
  278. #define __TEXT(quote) quote // r_winnt
  279. #endif /* UNICODE */ // r_winnt
  280. #define TEXT(quote) __TEXT(quote) // r_winnt
  281. // end_winnt
  282. typedef double DOUBLE;
  283. typedef struct _QUAD { // QUAD is for those times we want
  284. double DoNotUseThisField; // an 8 byte aligned 8 byte long structure
  285. } QUAD; // which is NOT really a floating point
  286. // number. Use DOUBLE if you want an FP
  287. // number.
  288. //
  289. // Pointer to Basics
  290. //
  291. typedef SHORT *PSHORT; // winnt
  292. typedef LONG *PLONG; // winnt
  293. typedef QUAD *PQUAD;
  294. //
  295. // Unsigned Basics
  296. //
  297. // Tell windef.h that some types are already defined.
  298. #define BASETYPES
  299. typedef unsigned char UCHAR;
  300. typedef unsigned short USHORT;
  301. typedef unsigned long ULONG;
  302. typedef QUAD UQUAD;
  303. //
  304. // Pointer to Unsigned Basics
  305. //
  306. typedef UCHAR *PUCHAR;
  307. typedef USHORT *PUSHORT;
  308. typedef ULONG *PULONG;
  309. typedef UQUAD *PUQUAD;
  310. //
  311. // Signed characters
  312. //
  313. typedef signed char SCHAR;
  314. typedef SCHAR *PSCHAR;
  315. #ifndef NO_STRICT
  316. #ifndef STRICT
  317. #define STRICT 1
  318. #endif
  319. #endif
  320. //
  321. // Handle to an Object
  322. //
  323. // begin_winnt
  324. #ifdef STRICT
  325. typedef void *HANDLE;
  326. #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
  327. #else
  328. typedef PVOID HANDLE;
  329. #define DECLARE_HANDLE(name) typedef HANDLE name
  330. #endif
  331. typedef HANDLE *PHANDLE;
  332. //
  333. // Flag (bit) fields
  334. //
  335. typedef UCHAR FCHAR;
  336. typedef USHORT FSHORT;
  337. typedef ULONG FLONG;
  338. // Component Object Model defines, and macros
  339. #ifndef _HRESULT_DEFINED
  340. #define _HRESULT_DEFINED
  341. typedef LONG HRESULT;
  342. #endif // !_HRESULT_DEFINED
  343. #ifdef __cplusplus
  344. #define EXTERN_C extern "C"
  345. #else
  346. #define EXTERN_C extern
  347. #endif
  348. #if defined(_WIN32) || defined(_MPPC_)
  349. // Win32 doesn't support __export
  350. #ifdef _68K_
  351. #define STDMETHODCALLTYPE __cdecl
  352. #else
  353. #define STDMETHODCALLTYPE __stdcall
  354. #endif
  355. #define STDMETHODVCALLTYPE __cdecl
  356. #define STDAPICALLTYPE __stdcall
  357. #define STDAPIVCALLTYPE __cdecl
  358. #else
  359. #define STDMETHODCALLTYPE __export __stdcall
  360. #define STDMETHODVCALLTYPE __export __cdecl
  361. #define STDAPICALLTYPE __export __stdcall
  362. #define STDAPIVCALLTYPE __export __cdecl
  363. #endif
  364. #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
  365. #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
  366. #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
  367. #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
  368. // The 'V' versions allow Variable Argument lists.
  369. #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
  370. #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
  371. #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
  372. #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
  373. // end_winnt
  374. //
  375. // Low order two bits of a handle are ignored by the system and available
  376. // for use by application code as tag bits. The remaining bits are opaque
  377. // and used to store a serial number and table index.
  378. //
  379. #define OBJ_HANDLE_TAGBITS 0x00000003L
  380. //
  381. // Cardinal Data Types [0 - 2**N-2)
  382. //
  383. typedef char CCHAR; // winnt
  384. typedef short CSHORT;
  385. typedef ULONG CLONG;
  386. typedef CCHAR *PCCHAR;
  387. typedef CSHORT *PCSHORT;
  388. typedef CLONG *PCLONG;
  389. //
  390. // __int64 is only supported by 2.0 and later midl.
  391. // __midl is set by the 2.0 midl and not by 1.0 midl.
  392. //
  393. #define _ULONGLONG_
  394. #if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
  395. typedef __int64 LONGLONG;
  396. typedef unsigned __int64 ULONGLONG;
  397. #define MAXLONGLONG (0x7fffffffffffffff)
  398. #else
  399. #if defined(_MAC) && defined(_MAC_INT_64)
  400. typedef __int64 LONGLONG;
  401. typedef unsigned __int64 ULONGLONG;
  402. #define MAXLONGLONG (0x7fffffffffffffff)
  403. #else
  404. typedef double LONGLONG;
  405. typedef double ULONGLONG;
  406. #endif //_MAC and int64
  407. #endif
  408. typedef LONGLONG *PLONGLONG;
  409. typedef ULONGLONG *PULONGLONG;
  410. // Update Sequence Number
  411. typedef LONGLONG USN;
  412. #if defined(MIDL_PASS)
  413. typedef struct _LARGE_INTEGER {
  414. #else // MIDL_PASS
  415. typedef union _LARGE_INTEGER {
  416. struct {
  417. ULONG LowPart;
  418. LONG HighPart;
  419. };
  420. struct {
  421. ULONG LowPart;
  422. LONG HighPart;
  423. } u;
  424. #endif //MIDL_PASS
  425. LONGLONG QuadPart;
  426. } LARGE_INTEGER;
  427. typedef LARGE_INTEGER *PLARGE_INTEGER;
  428. #if defined(MIDL_PASS)
  429. typedef struct _ULARGE_INTEGER {
  430. #else // MIDL_PASS
  431. typedef union _ULARGE_INTEGER {
  432. struct {
  433. ULONG LowPart;
  434. ULONG HighPart;
  435. };
  436. struct {
  437. ULONG LowPart;
  438. ULONG HighPart;
  439. } u;
  440. #endif //MIDL_PASS
  441. ULONGLONG QuadPart;
  442. } ULARGE_INTEGER;
  443. typedef ULARGE_INTEGER *PULARGE_INTEGER;
  444. //
  445. // Physical address.
  446. //
  447. typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
  448. //
  449. // Boolean
  450. //
  451. typedef UCHAR BOOLEAN; // winnt
  452. typedef BOOLEAN *PBOOLEAN; // winnt
  453. //
  454. // Constants
  455. //
  456. #define FALSE 0
  457. #define TRUE 1
  458. #ifndef NULL
  459. #ifdef __cplusplus
  460. #define NULL 0
  461. #define NULL64 0
  462. #else
  463. #define NULL ((void *)0)
  464. #define NULL64 ((void * POINTER_64)0)
  465. #endif
  466. #endif // NULL
  467. //
  468. // Calculate the byte offset of a field in a structure of type type.
  469. //
  470. #define FIELD_OFFSET(type, field) ((LONG)(LONG_PTR)&(((type *)0)->field))
  471. //
  472. // Calculate the size of a field in a structure of type type, without
  473. // knowing or stating the type of the field.
  474. //
  475. #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field))
  476. //
  477. // Calculate the size of a structure of type type up through and
  478. // including a field.
  479. //
  480. #define RTL_SIZEOF_THROUGH_FIELD(type, field) \
  481. (FIELD_OFFSET(type, field) + RTL_FIELD_SIZE(type, field))
  482. //
  483. // RTL_CONTAINS_FIELD usage:
  484. //
  485. // if (RTL_CONTAINS_FIELD(pBlock, pBlock->cbSize, dwMumble)) { // safe to use pBlock->dwMumble
  486. //
  487. #define RTL_CONTAINS_FIELD(Struct, Size, Field) \
  488. ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) )
  489. //
  490. // Return the number of elements in a statically sized array.
  491. // ULONG Buffer[100];
  492. // RTL_NUMBER_OF(Buffer) == 100
  493. // This is also popularly known as: NUMBER_OF, ARRSIZE, _countof, NELEM, etc.
  494. //
  495. #define RTL_NUMBER_OF(A) (sizeof(A)/sizeof((A)[0]))
  496. //
  497. // An expression that yields the type of a field in a struct.
  498. //
  499. #define RTL_FIELD_TYPE(type, field) (((type*)0)->field)
  500. // RTL_ to avoid collisions in the global namespace.
  501. //
  502. // Given typedef struct _FOO { BYTE Bar[123]; } FOO;
  503. // RTL_NUMBER_OF_FIELD(FOO, Bar) == 123
  504. //
  505. #define RTL_NUMBER_OF_FIELD(type, field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type, field)))
  506. //
  507. // eg:
  508. // typedef struct FOO {
  509. // ULONG Integer;
  510. // PVOID Pointer;
  511. // } FOO;
  512. //
  513. // RTL_PADDING_BETWEEN_FIELDS(FOO, Integer, Pointer) == 0 for Win32, 4 for Win64
  514. //
  515. #define RTL_PADDING_BETWEEN_FIELDS(T, F1, F2) \
  516. ((FIELD_OFFSET(T, F2) > FIELD_OFFSET(T, F1)) \
  517. ? (FIELD_OFFSET(T, F2) - FIELD_OFFSET(T, F1) - RTL_FIELD_SIZE(T, F1)) \
  518. : (FIELD_OFFSET(T, F1) - FIELD_OFFSET(T, F2) - RTL_FIELD_SIZE(T, F2)))
  519. // RTL_ to avoid collisions in the global namespace.
  520. #if defined(__cplusplus)
  521. #define RTL_CONST_CAST(type) const_cast<type>
  522. #else
  523. #define RTL_CONST_CAST(type) (type)
  524. #endif
  525. // end_winnt
  526. //
  527. // This works "generically" for Unicode and Ansi/Oem strings.
  528. // Usage:
  529. // const static UNICODE_STRING FooU = RTL_CONSTANT_STRING(L"Foo");
  530. // const static STRING Foo = RTL_CONSTANT_STRING( "Foo");
  531. // instead of the slower:
  532. // UNICODE_STRING FooU;
  533. // STRING Foo;
  534. // RtlInitUnicodeString(&FooU, L"Foo");
  535. // RtlInitString(&Foo , "Foo");
  536. //
  537. #define RTL_CONSTANT_STRING(s) { sizeof( s ) - sizeof( (s)[0] ), sizeof( s ), s }
  538. // begin_winnt
  539. // like sizeof
  540. // usually this would be * CHAR_BIT, but we don't necessarily have #include <limits.h>
  541. #define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) * 8)
  542. #define RTL_BITS_OF_FIELD(type, field) (RTL_BITS_OF(RTL_FIELD_TYPE(type, field)))
  543. //
  544. // Calculate the address of the base of the structure given its type, and an
  545. // address of a field within the structure.
  546. //
  547. #define CONTAINING_RECORD(address, type, field) ((type *)( \
  548. (PCHAR)(address) - \
  549. (ULONG_PTR)(&((type *)0)->field)))
  550. //
  551. // Interrupt Request Level (IRQL)
  552. //
  553. typedef UCHAR KIRQL;
  554. typedef KIRQL *PKIRQL;
  555. //
  556. // Macros used to eliminate compiler warning generated when formal
  557. // parameters or local variables are not declared.
  558. //
  559. // Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
  560. // referenced but will be once the module is completely developed.
  561. //
  562. // Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
  563. // referenced but will be once the module is completely developed.
  564. //
  565. // Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
  566. //
  567. // DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
  568. // eventually be made into a null macro to help determine whether there
  569. // is unfinished work.
  570. //
  571. #if ! defined(lint)
  572. #define UNREFERENCED_PARAMETER(P) (P)
  573. #define DBG_UNREFERENCED_PARAMETER(P) (P)
  574. #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
  575. #else // lint
  576. // Note: lint -e530 says don't complain about uninitialized variables for
  577. // this varible. Error 527 has to do with unreachable code.
  578. // -restore restores checking to the -save state
  579. #define UNREFERENCED_PARAMETER(P) \
  580. /*lint -save -e527 -e530 */ \
  581. { \
  582. (P) = (P); \
  583. } \
  584. /*lint -restore */
  585. #define DBG_UNREFERENCED_PARAMETER(P) \
  586. /*lint -save -e527 -e530 */ \
  587. { \
  588. (P) = (P); \
  589. } \
  590. /*lint -restore */
  591. #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
  592. /*lint -save -e527 -e530 */ \
  593. { \
  594. (V) = (V); \
  595. } \
  596. /*lint -restore */
  597. #endif // lint
  598. //
  599. // Macro used to eliminate compiler warning 4715 within a switch statement
  600. // when all possible cases have already been accounted for.
  601. //
  602. // switch (a & 3) {
  603. // case 0: return 1;
  604. // case 1: return Foo();
  605. // case 2: return Bar();
  606. // case 3: return 1;
  607. // DEFAULT_UNREACHABLE;
  608. //
  609. #if (_MSC_VER > 1200)
  610. #define DEFAULT_UNREACHABLE default: __assume(0)
  611. #else
  612. //
  613. // Older compilers do not support __assume(), and there is no other free
  614. // method of eliminating the warning.
  615. //
  616. #define DEFAULT_UNREACHABLE
  617. #endif
  618. // end_winnt
  619. //
  620. // Define standard min and max macros
  621. //
  622. #ifndef NOMINMAX
  623. #ifndef min
  624. #define min(a,b) (((a) < (b)) ? (a) : (b))
  625. #endif
  626. #ifndef max
  627. #define max(a,b) (((a) > (b)) ? (a) : (b))
  628. #endif
  629. #endif // NOMINMAX
  630. #ifdef _X86_
  631. //
  632. // Disable these two pragmas that evaluate to "sti" "cli" on x86 so that driver
  633. // writers to not leave them inadvertantly in their code.
  634. //
  635. #if !defined(MIDL_PASS)
  636. #if !defined(RC_INVOKED)
  637. #if _MSC_VER >= 1200
  638. #pragma warning(push)
  639. #endif
  640. #pragma warning(disable:4164) // disable C4164 warning so that apps that
  641. // build with /Od don't get weird errors !
  642. #ifdef _M_IX86
  643. #pragma function(_enable)
  644. #pragma function(_disable)
  645. #endif
  646. #if _MSC_VER >= 1200
  647. #pragma warning(pop)
  648. #else
  649. #pragma warning(default:4164) // reenable C4164 warning
  650. #endif
  651. #endif
  652. #endif
  653. #if !defined(MIDL_PASS) || defined(_M_IX86)
  654. #if (_MSC_FULL_VER >= 13012035)
  655. //
  656. // Define bit scan intrinsics.
  657. //
  658. //#define BitScanForward _BitScanForward
  659. //#define BitScanReverse _BitScanReverse
  660. //BOOLEAN
  661. //_BitScanForward (
  662. // OUT ULONG *Index,
  663. // IN ULONG Mask
  664. // );
  665. //BOOLEAN
  666. //_BitScanReverse (
  667. // OUT ULONG *Index,
  668. // IN ULONG Mask
  669. // );
  670. //#pragma intrinsic(_BitScanForward)
  671. //#pragma intrinsic(_BitScanReverse)
  672. //
  673. // Define FS referencing intrinsics
  674. //
  675. #ifdef __cplusplus
  676. extern "C" {
  677. #endif
  678. UCHAR
  679. __readfsbyte (
  680. IN ULONG Offset
  681. );
  682. USHORT
  683. __readfsword (
  684. IN ULONG Offset
  685. );
  686. ULONG
  687. __readfsdword (
  688. IN ULONG Offset
  689. );
  690. VOID
  691. __writefsbyte (
  692. IN ULONG Offset,
  693. IN UCHAR Data
  694. );
  695. VOID
  696. __writefsword (
  697. IN ULONG Offset,
  698. IN USHORT Data
  699. );
  700. VOID
  701. __writefsdword (
  702. IN ULONG Offset,
  703. IN ULONG Data
  704. );
  705. #ifdef __cplusplus
  706. }
  707. #endif
  708. #pragma intrinsic(__readfsbyte)
  709. #pragma intrinsic(__readfsword)
  710. #pragma intrinsic(__readfsdword)
  711. #pragma intrinsic(__writefsbyte)
  712. #pragma intrinsic(__writefsword)
  713. #pragma intrinsic(__writefsdword)
  714. #endif
  715. #endif
  716. #endif //_X86_
  717. //
  718. // Define the I/O bus interface types.
  719. //
  720. typedef enum _INTERFACE_TYPE {
  721. InterfaceTypeUndefined = -1,
  722. Internal,
  723. Isa,
  724. Eisa,
  725. MicroChannel,
  726. TurboChannel,
  727. PCIBus,
  728. VMEBus,
  729. NuBus,
  730. PCMCIABus,
  731. CBus,
  732. MPIBus,
  733. MPSABus,
  734. ProcessorInternal,
  735. InternalPowerBus,
  736. PNPISABus,
  737. PNPBus,
  738. MaximumInterfaceType
  739. }INTERFACE_TYPE, *PINTERFACE_TYPE;
  740. //
  741. // Define the DMA transfer widths.
  742. //
  743. typedef enum _DMA_WIDTH {
  744. Width8Bits,
  745. Width16Bits,
  746. Width32Bits,
  747. MaximumDmaWidth
  748. }DMA_WIDTH, *PDMA_WIDTH;
  749. //
  750. // Define DMA transfer speeds.
  751. //
  752. typedef enum _DMA_SPEED {
  753. Compatible,
  754. TypeA,
  755. TypeB,
  756. TypeC,
  757. TypeF,
  758. MaximumDmaSpeed
  759. }DMA_SPEED, *PDMA_SPEED;
  760. //
  761. // Define Interface reference/dereference routines for
  762. // Interfaces exported by IRP_MN_QUERY_INTERFACE
  763. //
  764. typedef VOID (*PINTERFACE_REFERENCE)(PVOID Context);
  765. typedef VOID (*PINTERFACE_DEREFERENCE)(PVOID Context);
  766. // end_wdm
  767. //
  768. // Define types of bus information.
  769. //
  770. typedef enum _BUS_DATA_TYPE {
  771. ConfigurationSpaceUndefined = -1,
  772. Cmos,
  773. EisaConfiguration,
  774. Pos,
  775. CbusConfiguration,
  776. PCIConfiguration,
  777. VMEConfiguration,
  778. NuBusConfiguration,
  779. PCMCIAConfiguration,
  780. MPIConfiguration,
  781. MPSAConfiguration,
  782. PNPISAConfiguration,
  783. SgiInternalConfiguration,
  784. MaximumBusDataType
  785. } BUS_DATA_TYPE, *PBUS_DATA_TYPE;
  786. #include <guiddef.h>
  787. //
  788. // Interrupt modes.
  789. //
  790. typedef enum _KINTERRUPT_MODE {
  791. LevelSensitive,
  792. Latched
  793. } KINTERRUPT_MODE;
  794. //
  795. // Structures used by the kernel drivers to describe which ports must be
  796. // hooked out directly from the V86 emulator to the driver.
  797. //
  798. typedef enum _EMULATOR_PORT_ACCESS_TYPE {
  799. Uchar,
  800. Ushort,
  801. Ulong
  802. } EMULATOR_PORT_ACCESS_TYPE, *PEMULATOR_PORT_ACCESS_TYPE;
  803. //
  804. // Access Modes
  805. //
  806. #define EMULATOR_READ_ACCESS 0x01
  807. #define EMULATOR_WRITE_ACCESS 0x02
  808. typedef struct _EMULATOR_ACCESS_ENTRY {
  809. ULONG BasePort;
  810. ULONG NumConsecutivePorts;
  811. EMULATOR_PORT_ACCESS_TYPE AccessType;
  812. UCHAR AccessMode;
  813. UCHAR StringSupport;
  814. PVOID Routine;
  815. } EMULATOR_ACCESS_ENTRY, *PEMULATOR_ACCESS_ENTRY;
  816. typedef struct _PCI_SLOT_NUMBER {
  817. union {
  818. struct {
  819. ULONG DeviceNumber:5;
  820. ULONG FunctionNumber:3;
  821. ULONG Reserved:24;
  822. } bits;
  823. ULONG AsULONG;
  824. } u;
  825. } PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
  826. #define PCI_TYPE0_ADDRESSES 6
  827. #define PCI_TYPE1_ADDRESSES 2
  828. #define PCI_TYPE2_ADDRESSES 5
  829. typedef struct _PCI_COMMON_CONFIG {
  830. USHORT VendorID; // (ro)
  831. USHORT DeviceID; // (ro)
  832. USHORT Command; // Device control
  833. USHORT Status;
  834. UCHAR RevisionID; // (ro)
  835. UCHAR ProgIf; // (ro)
  836. UCHAR SubClass; // (ro)
  837. UCHAR BaseClass; // (ro)
  838. UCHAR CacheLineSize; // (ro+)
  839. UCHAR LatencyTimer; // (ro+)
  840. UCHAR HeaderType; // (ro)
  841. UCHAR BIST; // Built in self test
  842. union {
  843. struct _PCI_HEADER_TYPE_0 {
  844. ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
  845. ULONG CIS;
  846. USHORT SubVendorID;
  847. USHORT SubSystemID;
  848. ULONG ROMBaseAddress;
  849. UCHAR CapabilitiesPtr;
  850. UCHAR Reserved1[3];
  851. ULONG Reserved2;
  852. UCHAR InterruptLine; //
  853. UCHAR InterruptPin; // (ro)
  854. UCHAR MinimumGrant; // (ro)
  855. UCHAR MaximumLatency; // (ro)
  856. } type0;
  857. } u;
  858. UCHAR DeviceSpecific[192];
  859. } PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
  860. #define PCI_COMMON_HDR_LENGTH (FIELD_OFFSET (PCI_COMMON_CONFIG, DeviceSpecific))
  861. #define PCI_MAX_DEVICES 32
  862. #define PCI_MAX_FUNCTION 8
  863. #define PCI_MAX_BRIDGE_NUMBER 0xFF
  864. #define PCI_INVALID_VENDORID 0xFFFF
  865. //
  866. // Bit encodings for PCI_COMMON_CONFIG.HeaderType
  867. //
  868. #define PCI_MULTIFUNCTION 0x80
  869. #define PCI_DEVICE_TYPE 0x00
  870. #define PCI_BRIDGE_TYPE 0x01
  871. #define PCI_CARDBUS_BRIDGE_TYPE 0x02
  872. #define PCI_CONFIGURATION_TYPE(PciData) \
  873. (((PPCI_COMMON_CONFIG)(PciData))->HeaderType & ~PCI_MULTIFUNCTION)
  874. #define PCI_MULTIFUNCTION_DEVICE(PciData) \
  875. ((((PPCI_COMMON_CONFIG)(PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
  876. //
  877. // Bit encodings for PCI_COMMON_CONFIG.Command
  878. //
  879. #define PCI_ENABLE_IO_SPACE 0x0001
  880. #define PCI_ENABLE_MEMORY_SPACE 0x0002
  881. #define PCI_ENABLE_BUS_MASTER 0x0004
  882. #define PCI_ENABLE_SPECIAL_CYCLES 0x0008
  883. #define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
  884. #define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
  885. #define PCI_ENABLE_PARITY 0x0040 // (ro+)
  886. #define PCI_ENABLE_WAIT_CYCLE 0x0080 // (ro+)
  887. #define PCI_ENABLE_SERR 0x0100 // (ro+)
  888. #define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200 // (ro)
  889. //
  890. // Bit encodings for PCI_COMMON_CONFIG.Status
  891. //
  892. #define PCI_STATUS_CAPABILITIES_LIST 0x0010 // (ro)
  893. #define PCI_STATUS_66MHZ_CAPABLE 0x0020 // (ro)
  894. #define PCI_STATUS_UDF_SUPPORTED 0x0040 // (ro)
  895. #define PCI_STATUS_FAST_BACK_TO_BACK 0x0080 // (ro)
  896. #define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
  897. #define PCI_STATUS_DEVSEL 0x0600 // 2 bits wide
  898. #define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
  899. #define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
  900. #define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
  901. #define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
  902. #define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
  903. //
  904. // The NT PCI Driver uses a WhichSpace parameter on its CONFIG_READ/WRITE
  905. // routines. The following values are defined-
  906. //
  907. #define PCI_WHICHSPACE_CONFIG 0x0
  908. #define PCI_WHICHSPACE_ROM 0x52696350
  909. // end_wdm
  910. //
  911. // PCI Capability IDs
  912. //
  913. #define PCI_CAPABILITY_ID_POWER_MANAGEMENT 0x01
  914. #define PCI_CAPABILITY_ID_AGP 0x02
  915. #define PCI_CAPABILITY_ID_MSI 0x05
  916. #define PCI_CAPABILITY_ID_AGP_TARGET 0x0E
  917. //
  918. // All PCI Capability structures have the following header.
  919. //
  920. // CapabilityID is used to identify the type of the structure (is
  921. // one of the PCI_CAPABILITY_ID values above.
  922. //
  923. // Next is the offset in PCI Configuration space (0x40 - 0xfc) of the
  924. // next capability structure in the list, or 0x00 if there are no more
  925. // entries.
  926. //
  927. typedef struct _PCI_CAPABILITIES_HEADER {
  928. UCHAR CapabilityID;
  929. UCHAR Next;
  930. } PCI_CAPABILITIES_HEADER, *PPCI_CAPABILITIES_HEADER;
  931. //
  932. // Power Management Capability
  933. //
  934. typedef struct _PCI_PMC {
  935. UCHAR Version:3;
  936. UCHAR PMEClock:1;
  937. UCHAR Rsvd1:1;
  938. UCHAR DeviceSpecificInitialization:1;
  939. UCHAR Rsvd2:2;
  940. struct _PM_SUPPORT {
  941. UCHAR Rsvd2:1;
  942. UCHAR D1:1;
  943. UCHAR D2:1;
  944. UCHAR PMED0:1;
  945. UCHAR PMED1:1;
  946. UCHAR PMED2:1;
  947. UCHAR PMED3Hot:1;
  948. UCHAR PMED3Cold:1;
  949. } Support;
  950. } PCI_PMC, *PPCI_PMC;
  951. typedef struct _PCI_PMCSR {
  952. USHORT PowerState:2;
  953. USHORT Rsvd1:6;
  954. USHORT PMEEnable:1;
  955. USHORT DataSelect:4;
  956. USHORT DataScale:2;
  957. USHORT PMEStatus:1;
  958. } PCI_PMCSR, *PPCI_PMCSR;
  959. typedef struct _PCI_PMCSR_BSE {
  960. UCHAR Rsvd1:6;
  961. UCHAR D3HotSupportsStopClock:1; // B2_B3#
  962. UCHAR BusPowerClockControlEnabled:1; // BPCC_EN
  963. } PCI_PMCSR_BSE, *PPCI_PMCSR_BSE;
  964. typedef struct _PCI_PM_CAPABILITY {
  965. PCI_CAPABILITIES_HEADER Header;
  966. //
  967. // Power Management Capabilities (Offset = 2)
  968. //
  969. union {
  970. PCI_PMC Capabilities;
  971. USHORT AsUSHORT;
  972. } PMC;
  973. //
  974. // Power Management Control/Status (Offset = 4)
  975. //
  976. union {
  977. PCI_PMCSR ControlStatus;
  978. USHORT AsUSHORT;
  979. } PMCSR;
  980. //
  981. // PMCSR PCI-PCI Bridge Support Extensions
  982. //
  983. union {
  984. PCI_PMCSR_BSE BridgeSupport;
  985. UCHAR AsUCHAR;
  986. } PMCSR_BSE;
  987. //
  988. // Optional read only 8 bit Data register. Contents controlled by
  989. // DataSelect and DataScale in ControlStatus.
  990. //
  991. UCHAR Data;
  992. } PCI_PM_CAPABILITY, *PPCI_PM_CAPABILITY;
  993. //
  994. // AGP Capability
  995. //
  996. typedef struct _PCI_AGP_CAPABILITY {
  997. PCI_CAPABILITIES_HEADER Header;
  998. USHORT Minor:4;
  999. USHORT Major:4;
  1000. USHORT Rsvd1:8;
  1001. struct _PCI_AGP_STATUS {
  1002. ULONG Rate:3;
  1003. ULONG Agp3Mode:1;
  1004. ULONG FastWrite:1;
  1005. ULONG FourGB:1;
  1006. ULONG HostTransDisable:1;
  1007. ULONG Gart64:1;
  1008. ULONG ITA_Coherent:1;
  1009. ULONG SideBandAddressing:1; // SBA
  1010. ULONG CalibrationCycle:3;
  1011. ULONG AsyncRequestSize:3;
  1012. ULONG Rsvd1:1;
  1013. ULONG Isoch:1;
  1014. ULONG Rsvd2:6;
  1015. ULONG RequestQueueDepthMaximum:8; // RQ
  1016. } AGPStatus;
  1017. struct _PCI_AGP_COMMAND {
  1018. ULONG Rate:3;
  1019. ULONG Rsvd1:1;
  1020. ULONG FastWriteEnable:1;
  1021. ULONG FourGBEnable:1;
  1022. ULONG Rsvd2:1;
  1023. ULONG Gart64:1;
  1024. ULONG AGPEnable:1;
  1025. ULONG SBAEnable:1;
  1026. ULONG CalibrationCycle:3;
  1027. ULONG AsyncReqSize:3;
  1028. ULONG Rsvd3:8;
  1029. ULONG RequestQueueDepth:8;
  1030. } AGPCommand;
  1031. } PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY;
  1032. //
  1033. // An AGPv3 Target must have an extended capability,
  1034. // but it's only present for a Master when the Isoch
  1035. // bit is set in its status register
  1036. //
  1037. typedef enum _EXTENDED_AGP_REGISTER {
  1038. IsochStatus,
  1039. AgpControl,
  1040. ApertureSize,
  1041. AperturePageSize,
  1042. GartLow,
  1043. GartHigh,
  1044. IsochCommand
  1045. } EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER;
  1046. typedef struct _PCI_AGP_ISOCH_STATUS {
  1047. ULONG ErrorCode: 2;
  1048. ULONG Rsvd1: 1;
  1049. ULONG Isoch_L: 3;
  1050. ULONG Isoch_Y: 2;
  1051. ULONG Isoch_N: 8;
  1052. ULONG Rsvd2: 16;
  1053. } PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS;
  1054. typedef struct _PCI_AGP_CONTROL {
  1055. ULONG Rsvd1: 7;
  1056. ULONG GTLB_Enable: 1;
  1057. ULONG AP_Enable: 1;
  1058. ULONG CAL_Disable: 1;
  1059. ULONG Rsvd2: 22;
  1060. } PCI_AGP_CONTROL, *PPCI_AGP_CONTROL;
  1061. typedef struct _PCI_AGP_APERTURE_PAGE_SIZE {
  1062. USHORT PageSizeMask: 11;
  1063. USHORT Rsvd1: 1;
  1064. USHORT PageSizeSelect: 4;
  1065. } PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE;
  1066. typedef struct _PCI_AGP_ISOCH_COMMAND {
  1067. USHORT Rsvd1: 6;
  1068. USHORT Isoch_Y: 2;
  1069. USHORT Isoch_N: 8;
  1070. } PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND;
  1071. typedef struct PCI_AGP_EXTENDED_CAPABILITY {
  1072. PCI_AGP_ISOCH_STATUS IsochStatus;
  1073. //
  1074. // Target only ----------------<<-begin->>
  1075. //
  1076. PCI_AGP_CONTROL AgpControl;
  1077. USHORT ApertureSize;
  1078. PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize;
  1079. ULONG GartLow;
  1080. ULONG GartHigh;
  1081. //
  1082. // ------------------------------<<-end->>
  1083. //
  1084. PCI_AGP_ISOCH_COMMAND IsochCommand;
  1085. } PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY;
  1086. #define PCI_AGP_RATE_1X 0x1
  1087. #define PCI_AGP_RATE_2X 0x2
  1088. #define PCI_AGP_RATE_4X 0x4
  1089. //
  1090. // MSI (Message Signalled Interrupts) Capability
  1091. //
  1092. typedef struct _PCI_MSI_CAPABILITY {
  1093. PCI_CAPABILITIES_HEADER Header;
  1094. struct _PCI_MSI_MESSAGE_CONTROL {
  1095. USHORT MSIEnable:1;
  1096. USHORT MultipleMessageCapable:3;
  1097. USHORT MultipleMessageEnable:3;
  1098. USHORT CapableOf64Bits:1;
  1099. USHORT Reserved:8;
  1100. } MessageControl;
  1101. union {
  1102. struct _PCI_MSI_MESSAGE_ADDRESS {
  1103. ULONG_PTR Reserved:2; // always zero, DWORD aligned address
  1104. ULONG_PTR Address:30;
  1105. } Register;
  1106. ULONG_PTR Raw;
  1107. } MessageAddress;
  1108. //
  1109. // The rest of the Capability structure differs depending on whether
  1110. // 32bit or 64bit addressing is being used.
  1111. //
  1112. // (The CapableOf64Bits bit above determines this)
  1113. //
  1114. union {
  1115. // For 64 bit devices
  1116. struct _PCI_MSI_64BIT_DATA {
  1117. ULONG MessageUpperAddress;
  1118. USHORT MessageData;
  1119. } Bit64;
  1120. // For 32 bit devices
  1121. struct _PCI_MSI_32BIT_DATA {
  1122. USHORT MessageData;
  1123. ULONG Unused;
  1124. } Bit32;
  1125. } Data;
  1126. } PCI_MSI_CAPABILITY, *PPCI_PCI_CAPABILITY;
  1127. // begin_wdm
  1128. //
  1129. // Base Class Code encodings for Base Class (from PCI spec rev 2.1).
  1130. //
  1131. #define PCI_CLASS_PRE_20 0x00
  1132. #define PCI_CLASS_MASS_STORAGE_CTLR 0x01
  1133. #define PCI_CLASS_NETWORK_CTLR 0x02
  1134. #define PCI_CLASS_DISPLAY_CTLR 0x03
  1135. #define PCI_CLASS_MULTIMEDIA_DEV 0x04
  1136. #define PCI_CLASS_MEMORY_CTLR 0x05
  1137. #define PCI_CLASS_BRIDGE_DEV 0x06
  1138. #define PCI_CLASS_SIMPLE_COMMS_CTLR 0x07
  1139. #define PCI_CLASS_BASE_SYSTEM_DEV 0x08
  1140. #define PCI_CLASS_INPUT_DEV 0x09
  1141. #define PCI_CLASS_DOCKING_STATION 0x0a
  1142. #define PCI_CLASS_PROCESSOR 0x0b
  1143. #define PCI_CLASS_SERIAL_BUS_CTLR 0x0c
  1144. #define PCI_CLASS_WIRELESS_CTLR 0x0d
  1145. #define PCI_CLASS_INTELLIGENT_IO_CTLR 0x0e
  1146. #define PCI_CLASS_SATELLITE_COMMS_CTLR 0x0f
  1147. #define PCI_CLASS_ENCRYPTION_DECRYPTION 0x10
  1148. #define PCI_CLASS_DATA_ACQ_SIGNAL_PROC 0x11
  1149. // 0d thru fe reserved
  1150. #define PCI_CLASS_NOT_DEFINED 0xff
  1151. //
  1152. // Sub Class Code encodings (PCI rev 2.1).
  1153. //
  1154. // Class 00 - PCI_CLASS_PRE_20
  1155. #define PCI_SUBCLASS_PRE_20_NON_VGA 0x00
  1156. #define PCI_SUBCLASS_PRE_20_VGA 0x01
  1157. // Class 01 - PCI_CLASS_MASS_STORAGE_CTLR
  1158. #define PCI_SUBCLASS_MSC_SCSI_BUS_CTLR 0x00
  1159. #define PCI_SUBCLASS_MSC_IDE_CTLR 0x01
  1160. #define PCI_SUBCLASS_MSC_FLOPPY_CTLR 0x02
  1161. #define PCI_SUBCLASS_MSC_IPI_CTLR 0x03
  1162. #define PCI_SUBCLASS_MSC_RAID_CTLR 0x04
  1163. #define PCI_SUBCLASS_MSC_OTHER 0x80
  1164. // Class 02 - PCI_CLASS_NETWORK_CTLR
  1165. #define PCI_SUBCLASS_NET_ETHERNET_CTLR 0x00
  1166. #define PCI_SUBCLASS_NET_TOKEN_RING_CTLR 0x01
  1167. #define PCI_SUBCLASS_NET_FDDI_CTLR 0x02
  1168. #define PCI_SUBCLASS_NET_ATM_CTLR 0x03
  1169. #define PCI_SUBCLASS_NET_ISDN_CTLR 0x04
  1170. #define PCI_SUBCLASS_NET_OTHER 0x80
  1171. // Class 03 - PCI_CLASS_DISPLAY_CTLR
  1172. // N.B. Sub Class 00 could be VGA or 8514 depending on Interface byte
  1173. #define PCI_SUBCLASS_VID_VGA_CTLR 0x00
  1174. #define PCI_SUBCLASS_VID_XGA_CTLR 0x01
  1175. #define PCI_SUBLCASS_VID_3D_CTLR 0x02
  1176. #define PCI_SUBCLASS_VID_OTHER 0x80
  1177. // Class 04 - PCI_CLASS_MULTIMEDIA_DEV
  1178. #define PCI_SUBCLASS_MM_VIDEO_DEV 0x00
  1179. #define PCI_SUBCLASS_MM_AUDIO_DEV 0x01
  1180. #define PCI_SUBCLASS_MM_TELEPHONY_DEV 0x02
  1181. #define PCI_SUBCLASS_MM_OTHER 0x80
  1182. // Class 05 - PCI_CLASS_MEMORY_CTLR
  1183. #define PCI_SUBCLASS_MEM_RAM 0x00
  1184. #define PCI_SUBCLASS_MEM_FLASH 0x01
  1185. #define PCI_SUBCLASS_MEM_OTHER 0x80
  1186. // Class 06 - PCI_CLASS_BRIDGE_DEV
  1187. #define PCI_SUBCLASS_BR_HOST 0x00
  1188. #define PCI_SUBCLASS_BR_ISA 0x01
  1189. #define PCI_SUBCLASS_BR_EISA 0x02
  1190. #define PCI_SUBCLASS_BR_MCA 0x03
  1191. #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04
  1192. #define PCI_SUBCLASS_BR_PCMCIA 0x05
  1193. #define PCI_SUBCLASS_BR_NUBUS 0x06
  1194. #define PCI_SUBCLASS_BR_CARDBUS 0x07
  1195. #define PCI_SUBCLASS_BR_RACEWAY 0x08
  1196. #define PCI_SUBCLASS_BR_OTHER 0x80
  1197. // Class 07 - PCI_CLASS_SIMPLE_COMMS_CTLR
  1198. // N.B. Sub Class 00 and 01 additional info in Interface byte
  1199. #define PCI_SUBCLASS_COM_SERIAL 0x00
  1200. #define PCI_SUBCLASS_COM_PARALLEL 0x01
  1201. #define PCI_SUBCLASS_COM_MULTIPORT 0x02
  1202. #define PCI_SUBCLASS_COM_MODEM 0x03
  1203. #define PCI_SUBCLASS_COM_OTHER 0x80
  1204. // Class 08 - PCI_CLASS_BASE_SYSTEM_DEV
  1205. // N.B. See Interface byte for additional info.
  1206. #define PCI_SUBCLASS_SYS_INTERRUPT_CTLR 0x00
  1207. #define PCI_SUBCLASS_SYS_DMA_CTLR 0x01
  1208. #define PCI_SUBCLASS_SYS_SYSTEM_TIMER 0x02
  1209. #define PCI_SUBCLASS_SYS_REAL_TIME_CLOCK 0x03
  1210. #define PCI_SUBCLASS_SYS_GEN_HOTPLUG_CTLR 0x04
  1211. #define PCI_SUBCLASS_SYS_OTHER 0x80
  1212. // Class 09 - PCI_CLASS_INPUT_DEV
  1213. #define PCI_SUBCLASS_INP_KEYBOARD 0x00
  1214. #define PCI_SUBCLASS_INP_DIGITIZER 0x01
  1215. #define PCI_SUBCLASS_INP_MOUSE 0x02
  1216. #define PCI_SUBCLASS_INP_SCANNER 0x03
  1217. #define PCI_SUBCLASS_INP_GAMEPORT 0x04
  1218. #define PCI_SUBCLASS_INP_OTHER 0x80
  1219. // Class 0a - PCI_CLASS_DOCKING_STATION
  1220. #define PCI_SUBCLASS_DOC_GENERIC 0x00
  1221. #define PCI_SUBCLASS_DOC_OTHER 0x80
  1222. // Class 0b - PCI_CLASS_PROCESSOR
  1223. #define PCI_SUBCLASS_PROC_386 0x00
  1224. #define PCI_SUBCLASS_PROC_486 0x01
  1225. #define PCI_SUBCLASS_PROC_PENTIUM 0x02
  1226. #define PCI_SUBCLASS_PROC_ALPHA 0x10
  1227. #define PCI_SUBCLASS_PROC_POWERPC 0x20
  1228. #define PCI_SUBCLASS_PROC_COPROCESSOR 0x40
  1229. // Class 0c - PCI_CLASS_SERIAL_BUS_CTLR
  1230. #define PCI_SUBCLASS_SB_IEEE1394 0x00
  1231. #define PCI_SUBCLASS_SB_ACCESS 0x01
  1232. #define PCI_SUBCLASS_SB_SSA 0x02
  1233. #define PCI_SUBCLASS_SB_USB 0x03
  1234. #define PCI_SUBCLASS_SB_FIBRE_CHANNEL 0x04
  1235. #define PCI_SUBCLASS_SB_SMBUS 0x05
  1236. // Class 0d - PCI_CLASS_WIRELESS_CTLR
  1237. #define PCI_SUBCLASS_WIRELESS_IRDA 0x00
  1238. #define PCI_SUBCLASS_WIRELESS_CON_IR 0x01
  1239. #define PCI_SUBCLASS_WIRELESS_RF 0x10
  1240. #define PCI_SUBCLASS_WIRELESS_OTHER 0x80
  1241. // Class 0e - PCI_CLASS_INTELLIGENT_IO_CTLR
  1242. #define PCI_SUBCLASS_INTIO_I2O 0x00
  1243. // Class 0f - PCI_CLASS_SATELLITE_CTLR
  1244. #define PCI_SUBCLASS_SAT_TV 0x01
  1245. #define PCI_SUBCLASS_SAT_AUDIO 0x02
  1246. #define PCI_SUBCLASS_SAT_VOICE 0x03
  1247. #define PCI_SUBCLASS_SAT_DATA 0x04
  1248. // Class 10 - PCI_CLASS_ENCRYPTION_DECRYPTION
  1249. #define PCI_SUBCLASS_CRYPTO_NET_COMP 0x00
  1250. #define PCI_SUBCLASS_CRYPTO_ENTERTAINMENT 0x10
  1251. #define PCI_SUBCLASS_CRYPTO_OTHER 0x80
  1252. // Class 11 - PCI_CLASS_DATA_ACQ_SIGNAL_PROC
  1253. #define PCI_SUBCLASS_DASP_DPIO 0x00
  1254. #define PCI_SUBCLASS_DASP_OTHER 0x80
  1255. // end_ntndis
  1256. //
  1257. // Bit encodes for PCI_COMMON_CONFIG.u.type0.BaseAddresses
  1258. //
  1259. #define PCI_ADDRESS_IO_SPACE 0x00000001 // (ro)
  1260. #define PCI_ADDRESS_MEMORY_TYPE_MASK 0x00000006 // (ro)
  1261. #define PCI_ADDRESS_MEMORY_PREFETCHABLE 0x00000008 // (ro)
  1262. #define PCI_ADDRESS_IO_ADDRESS_MASK 0xfffffffc
  1263. #define PCI_ADDRESS_MEMORY_ADDRESS_MASK 0xfffffff0
  1264. #define PCI_ADDRESS_ROM_ADDRESS_MASK 0xfffff800
  1265. #define PCI_TYPE_32BIT 0
  1266. #define PCI_TYPE_20BIT 2
  1267. #define PCI_TYPE_64BIT 4
  1268. //
  1269. // Bit encodes for PCI_COMMON_CONFIG.u.type0.ROMBaseAddresses
  1270. //
  1271. #define PCI_ROMADDRESS_ENABLED 0x00000001
  1272. //
  1273. // Reference notes for PCI configuration fields:
  1274. //
  1275. // ro these field are read only. changes to these fields are ignored
  1276. //
  1277. // ro+ these field are intended to be read only and should be initialized
  1278. // by the system to their proper values. However, driver may change
  1279. // these settings.
  1280. //
  1281. // ---
  1282. //
  1283. // All resources comsumed by a PCI device start as unitialized
  1284. // under NT. An uninitialized memory or I/O base address can be
  1285. // determined by checking it's corrisponding enabled bit in the
  1286. // PCI_COMMON_CONFIG.Command value. An InterruptLine is unitialized
  1287. // if it contains the value of -1.
  1288. //
  1289. //
  1290. // Graphics support routines.
  1291. //
  1292. typedef
  1293. VOID
  1294. (*PBANKED_SECTION_ROUTINE) (
  1295. IN ULONG ReadBank,
  1296. IN ULONG WriteBank,
  1297. IN PVOID Context
  1298. );
  1299. //
  1300. // WMI minor function codes under IRP_MJ_SYSTEM_CONTROL
  1301. //
  1302. #define IRP_MN_QUERY_ALL_DATA 0x00
  1303. #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
  1304. #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
  1305. #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
  1306. #define IRP_MN_ENABLE_EVENTS 0x04
  1307. #define IRP_MN_DISABLE_EVENTS 0x05
  1308. #define IRP_MN_ENABLE_COLLECTION 0x06
  1309. #define IRP_MN_DISABLE_COLLECTION 0x07
  1310. #define IRP_MN_REGINFO 0x08
  1311. #define IRP_MN_EXECUTE_METHOD 0x09
  1312. // Minor code 0x0a is reserved
  1313. #define IRP_MN_REGINFO_EX 0x0b
  1314. // workaround overloaded definition (rpc generated headers all define INTERFACE
  1315. // to match the class name).
  1316. #undef INTERFACE
  1317. typedef struct _INTERFACE {
  1318. USHORT Size;
  1319. USHORT Version;
  1320. PVOID Context;
  1321. PINTERFACE_REFERENCE InterfaceReference;
  1322. PINTERFACE_DEREFERENCE InterfaceDereference;
  1323. // interface specific entries go here
  1324. } INTERFACE, *PINTERFACE;
  1325. //
  1326. // Defines the Type in the RESOURCE_DESCRIPTOR
  1327. //
  1328. // NOTE: For all CM_RESOURCE_TYPE values, there must be a
  1329. // corresponding ResType value in the 32-bit ConfigMgr headerfile
  1330. // (cfgmgr32.h). Values in the range [0x6,0x80) use the same values
  1331. // as their ConfigMgr counterparts. CM_RESOURCE_TYPE values with
  1332. // the high bit set (i.e., in the range [0x80,0xFF]), are
  1333. // non-arbitrated resources. These correspond to the same values
  1334. // in cfgmgr32.h that have their high bit set (however, since
  1335. // cfgmgr32.h uses 16 bits for ResType values, these values are in
  1336. // the range [0x8000,0x807F). Note that ConfigMgr ResType values
  1337. // cannot be in the range [0x8080,0xFFFF), because they would not
  1338. // be able to map into CM_RESOURCE_TYPE values. (0xFFFF itself is
  1339. // a special value, because it maps to CmResourceTypeDeviceSpecific.)
  1340. //
  1341. typedef int CM_RESOURCE_TYPE;
  1342. // CmResourceTypeNull is reserved
  1343. #define CmResourceTypeNull 0 // ResType_All or ResType_None (0x0000)
  1344. #define CmResourceTypePort 1 // ResType_IO (0x0002)
  1345. #define CmResourceTypeInterrupt 2 // ResType_IRQ (0x0004)
  1346. #define CmResourceTypeMemory 3 // ResType_Mem (0x0001)
  1347. #define CmResourceTypeDma 4 // ResType_DMA (0x0003)
  1348. #define CmResourceTypeDeviceSpecific 5 // ResType_ClassSpecific (0xFFFF)
  1349. #define CmResourceTypeBusNumber 6 // ResType_BusNumber (0x0006)
  1350. // end_wdm
  1351. #define CmResourceTypeMaximum 7
  1352. // begin_wdm
  1353. #define CmResourceTypeNonArbitrated 128 // Not arbitrated if 0x80 bit set
  1354. #define CmResourceTypeConfigData 128 // ResType_Reserved (0x8000)
  1355. #define CmResourceTypeDevicePrivate 129 // ResType_DevicePrivate (0x8001)
  1356. #define CmResourceTypePcCardConfig 130 // ResType_PcCardConfig (0x8002)
  1357. #define CmResourceTypeMfCardConfig 131 // ResType_MfCardConfig (0x8003)
  1358. //
  1359. // Defines the ShareDisposition in the RESOURCE_DESCRIPTOR
  1360. //
  1361. typedef enum _CM_SHARE_DISPOSITION {
  1362. CmResourceShareUndetermined = 0, // Reserved
  1363. CmResourceShareDeviceExclusive,
  1364. CmResourceShareDriverExclusive,
  1365. CmResourceShareShared
  1366. } CM_SHARE_DISPOSITION;
  1367. //
  1368. // Define the bit masks for Flags when type is CmResourceTypeInterrupt
  1369. //
  1370. #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0
  1371. #define CM_RESOURCE_INTERRUPT_LATCHED 1
  1372. //
  1373. // Define the bit masks for Flags when type is CmResourceTypeMemory
  1374. //
  1375. #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
  1376. #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
  1377. #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
  1378. #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
  1379. #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
  1380. #define CM_RESOURCE_MEMORY_24 0x0010
  1381. #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
  1382. //
  1383. // Define the bit masks for Flags when type is CmResourceTypePort
  1384. //
  1385. #define CM_RESOURCE_PORT_MEMORY 0x0000
  1386. #define CM_RESOURCE_PORT_IO 0x0001
  1387. #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
  1388. #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
  1389. #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
  1390. #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
  1391. #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
  1392. #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
  1393. //
  1394. // Define the bit masks for Flags when type is CmResourceTypeDma
  1395. //
  1396. #define CM_RESOURCE_DMA_8 0x0000
  1397. #define CM_RESOURCE_DMA_16 0x0001
  1398. #define CM_RESOURCE_DMA_32 0x0002
  1399. #define CM_RESOURCE_DMA_8_AND_16 0x0004
  1400. #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
  1401. #define CM_RESOURCE_DMA_TYPE_A 0x0010
  1402. #define CM_RESOURCE_DMA_TYPE_B 0x0020
  1403. #define CM_RESOURCE_DMA_TYPE_F 0x0040
  1404. #include "pshpack1.h"
  1405. //
  1406. // Define Mca POS data block for slot
  1407. //
  1408. typedef struct _CM_MCA_POS_DATA {
  1409. USHORT AdapterId;
  1410. UCHAR PosData1;
  1411. UCHAR PosData2;
  1412. UCHAR PosData3;
  1413. UCHAR PosData4;
  1414. } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
  1415. //
  1416. // Memory configuration of eisa data block structure
  1417. //
  1418. typedef struct _EISA_MEMORY_TYPE {
  1419. UCHAR ReadWrite: 1;
  1420. UCHAR Cached : 1;
  1421. UCHAR Reserved0 :1;
  1422. UCHAR Type:2;
  1423. UCHAR Shared:1;
  1424. UCHAR Reserved1 :1;
  1425. UCHAR MoreEntries : 1;
  1426. } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
  1427. typedef struct _EISA_MEMORY_CONFIGURATION {
  1428. EISA_MEMORY_TYPE ConfigurationByte;
  1429. UCHAR DataSize;
  1430. USHORT AddressLowWord;
  1431. UCHAR AddressHighByte;
  1432. USHORT MemorySize;
  1433. } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
  1434. //
  1435. // Interrupt configurationn of eisa data block structure
  1436. //
  1437. typedef struct _EISA_IRQ_DESCRIPTOR {
  1438. UCHAR Interrupt : 4;
  1439. UCHAR Reserved :1;
  1440. UCHAR LevelTriggered :1;
  1441. UCHAR Shared : 1;
  1442. UCHAR MoreEntries : 1;
  1443. } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
  1444. typedef struct _EISA_IRQ_CONFIGURATION {
  1445. EISA_IRQ_DESCRIPTOR ConfigurationByte;
  1446. UCHAR Reserved;
  1447. } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
  1448. //
  1449. // DMA description of eisa data block structure
  1450. //
  1451. typedef struct _DMA_CONFIGURATION_BYTE0 {
  1452. UCHAR Channel : 3;
  1453. UCHAR Reserved : 3;
  1454. UCHAR Shared :1;
  1455. UCHAR MoreEntries :1;
  1456. } DMA_CONFIGURATION_BYTE0;
  1457. typedef struct _DMA_CONFIGURATION_BYTE1 {
  1458. UCHAR Reserved0 : 2;
  1459. UCHAR TransferSize : 2;
  1460. UCHAR Timing : 2;
  1461. UCHAR Reserved1 : 2;
  1462. } DMA_CONFIGURATION_BYTE1;
  1463. typedef struct _EISA_DMA_CONFIGURATION {
  1464. DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
  1465. DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
  1466. } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
  1467. //
  1468. // Port description of eisa data block structure
  1469. //
  1470. typedef struct _EISA_PORT_DESCRIPTOR {
  1471. UCHAR NumberPorts : 5;
  1472. UCHAR Reserved :1;
  1473. UCHAR Shared :1;
  1474. UCHAR MoreEntries : 1;
  1475. } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
  1476. typedef struct _EISA_PORT_CONFIGURATION {
  1477. EISA_PORT_DESCRIPTOR Configuration;
  1478. USHORT PortAddress;
  1479. } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
  1480. //
  1481. // Eisa slot information definition
  1482. // N.B. This structure is different from the one defined
  1483. // in ARC eisa addendum.
  1484. //
  1485. typedef struct _CM_EISA_SLOT_INFORMATION {
  1486. UCHAR ReturnCode;
  1487. UCHAR ReturnFlags;
  1488. UCHAR MajorRevision;
  1489. UCHAR MinorRevision;
  1490. USHORT Checksum;
  1491. UCHAR NumberFunctions;
  1492. UCHAR FunctionInformation;
  1493. ULONG CompressedId;
  1494. } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
  1495. //
  1496. // Eisa function information definition
  1497. //
  1498. typedef struct _CM_EISA_FUNCTION_INFORMATION {
  1499. ULONG CompressedId;
  1500. UCHAR IdSlotFlags1;
  1501. UCHAR IdSlotFlags2;
  1502. UCHAR MinorRevision;
  1503. UCHAR MajorRevision;
  1504. UCHAR Selections[26];
  1505. UCHAR FunctionFlags;
  1506. UCHAR TypeString[80];
  1507. EISA_MEMORY_CONFIGURATION EisaMemory[9];
  1508. EISA_IRQ_CONFIGURATION EisaIrq[7];
  1509. EISA_DMA_CONFIGURATION EisaDma[4];
  1510. EISA_PORT_CONFIGURATION EisaPort[20];
  1511. UCHAR InitializationData[60];
  1512. } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
  1513. //
  1514. // The following defines the way pnp bios information is stored in
  1515. // the registry \\HKEY_LOCAL_MACHINE\HARDWARE\Description\System\MultifunctionAdapter\x
  1516. // key, where x is an integer number indicating adapter instance. The
  1517. // "Identifier" of the key must equal to "PNP BIOS" and the
  1518. // "ConfigurationData" is organized as follow:
  1519. //
  1520. // CM_PNP_BIOS_INSTALLATION_CHECK +
  1521. // CM_PNP_BIOS_DEVICE_NODE for device 1 +
  1522. // CM_PNP_BIOS_DEVICE_NODE for device 2 +
  1523. // ...
  1524. // CM_PNP_BIOS_DEVICE_NODE for device n
  1525. //
  1526. //
  1527. // Pnp BIOS device node structure
  1528. //
  1529. typedef struct _CM_PNP_BIOS_DEVICE_NODE {
  1530. USHORT Size;
  1531. UCHAR Node;
  1532. ULONG ProductId;
  1533. UCHAR DeviceType[3];
  1534. USHORT DeviceAttributes;
  1535. // followed by AllocatedResourceBlock, PossibleResourceBlock
  1536. // and CompatibleDeviceId
  1537. } CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
  1538. //
  1539. // Pnp BIOS Installation check
  1540. //
  1541. typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK {
  1542. UCHAR Signature[4]; // $PnP (ascii)
  1543. UCHAR Revision;
  1544. UCHAR Length;
  1545. USHORT ControlField;
  1546. UCHAR Checksum;
  1547. ULONG EventFlagAddress; // Physical address
  1548. USHORT RealModeEntryOffset;
  1549. USHORT RealModeEntrySegment;
  1550. USHORT ProtectedModeEntryOffset;
  1551. ULONG ProtectedModeCodeBaseAddress;
  1552. ULONG OemDeviceId;
  1553. USHORT RealModeDataBaseAddress;
  1554. ULONG ProtectedModeDataBaseAddress;
  1555. } CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
  1556. #include "poppack.h"
  1557. //
  1558. // Masks for EISA function information
  1559. //
  1560. #define EISA_FUNCTION_ENABLED 0x80
  1561. #define EISA_FREE_FORM_DATA 0x40
  1562. #define EISA_HAS_PORT_INIT_ENTRY 0x20
  1563. #define EISA_HAS_PORT_RANGE 0x10
  1564. #define EISA_HAS_DMA_ENTRY 0x08
  1565. #define EISA_HAS_IRQ_ENTRY 0x04
  1566. #define EISA_HAS_MEMORY_ENTRY 0x02
  1567. #define EISA_HAS_TYPE_ENTRY 0x01
  1568. #define EISA_HAS_INFORMATION EISA_HAS_PORT_RANGE + \
  1569. EISA_HAS_DMA_ENTRY + \
  1570. EISA_HAS_IRQ_ENTRY + \
  1571. EISA_HAS_MEMORY_ENTRY + \
  1572. EISA_HAS_TYPE_ENTRY
  1573. //
  1574. // Masks for EISA memory configuration
  1575. //
  1576. #define EISA_MORE_ENTRIES 0x80
  1577. #define EISA_SYSTEM_MEMORY 0x00
  1578. #define EISA_MEMORY_TYPE_RAM 0x01
  1579. //
  1580. // Returned error code for EISA bios call
  1581. //
  1582. #define EISA_INVALID_SLOT 0x80
  1583. #define EISA_INVALID_FUNCTION 0x81
  1584. #define EISA_INVALID_CONFIGURATION 0x82
  1585. #define EISA_EMPTY_SLOT 0x83
  1586. #define EISA_INVALID_BIOS_CALL 0x86
  1587. //
  1588. // Defines Resource Options
  1589. //
  1590. #define IO_RESOURCE_PREFERRED 0x01
  1591. #define IO_RESOURCE_DEFAULT 0x02
  1592. #define IO_RESOURCE_ALTERNATIVE 0x08
  1593. //
  1594. // This structure defines one type of resource requested by the driver
  1595. //
  1596. typedef struct _IO_RESOURCE_DESCRIPTOR {
  1597. UCHAR Option;
  1598. UCHAR Type; // use CM_RESOURCE_TYPE
  1599. UCHAR ShareDisposition; // use CM_SHARE_DISPOSITION
  1600. UCHAR Spare1;
  1601. USHORT Flags; // use CM resource flag defines
  1602. USHORT Spare2; // align
  1603. union {
  1604. struct {
  1605. ULONG Length;
  1606. ULONG Alignment;
  1607. PHYSICAL_ADDRESS MinimumAddress;
  1608. PHYSICAL_ADDRESS MaximumAddress;
  1609. } Port;
  1610. struct {
  1611. ULONG Length;
  1612. ULONG Alignment;
  1613. PHYSICAL_ADDRESS MinimumAddress;
  1614. PHYSICAL_ADDRESS MaximumAddress;
  1615. } Memory;
  1616. struct {
  1617. ULONG MinimumVector;
  1618. ULONG MaximumVector;
  1619. } Interrupt;
  1620. struct {
  1621. ULONG MinimumChannel;
  1622. ULONG MaximumChannel;
  1623. } Dma;
  1624. struct {
  1625. ULONG Length;
  1626. ULONG Alignment;
  1627. PHYSICAL_ADDRESS MinimumAddress;
  1628. PHYSICAL_ADDRESS MaximumAddress;
  1629. } Generic;
  1630. struct {
  1631. ULONG Data[3];
  1632. } DevicePrivate;
  1633. //
  1634. // Bus Number information.
  1635. //
  1636. struct {
  1637. ULONG Length;
  1638. ULONG MinBusNumber;
  1639. ULONG MaxBusNumber;
  1640. ULONG Reserved;
  1641. } BusNumber;
  1642. struct {
  1643. ULONG Priority; // use LCPRI_Xxx values in cfg.h
  1644. ULONG Reserved1;
  1645. ULONG Reserved2;
  1646. } ConfigData;
  1647. } u;
  1648. } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
  1649. #endif /* _MINIPORT_ */