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.

105 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. extlist.h
  5. Abstract:
  6. This is the header for managing ACPI extension lists
  7. Author:
  8. Adrian J. Oney (AdriaO)
  9. Environment:
  10. NT Kernel Model Driver only
  11. --*/
  12. #ifndef _EXTLIST_H_
  13. #define _EXTLIST_H_
  14. typedef enum {
  15. WALKSCHEME_NO_PROTECTION,
  16. WALKSCHEME_REFERENCE_ENTRIES,
  17. WALKSCHEME_HOLD_SPINLOCK
  18. } WALKSCHEME ;
  19. //
  20. // The following structures and functions are used to simiplify (ok, abstract)
  21. // walking lists of device extensions that happen to be stored inside other
  22. // extensions (eg Children, Ejectee's, etc)
  23. //
  24. typedef struct {
  25. PLIST_ENTRY pListHead ;
  26. PKSPIN_LOCK pSpinLock ;
  27. KIRQL oldIrql;
  28. PDEVICE_EXTENSION pDevExtCurrent ;
  29. ULONG_PTR ExtOffset ;
  30. WALKSCHEME WalkScheme ;
  31. } EXTENSIONLIST_ENUMDATA, *PEXTENSIONLIST_ENUMDATA ;
  32. //
  33. // This is like CONTAINING_RECORD, only it's hardcoded for DEVICE_EXTENSION
  34. // type and it uses precalculated field offsets instead of record names
  35. //
  36. #define CONTAINING_EXTENSION(address, fieldoffset) \
  37. ((PDEVICE_EXTENSION) ((PCHAR)(address) - (ULONG_PTR)(fieldoffset)))
  38. #define CONTAINING_LIST(address, fieldoffset) \
  39. ((PLIST_ENTRY) ((PCHAR)(address)+(ULONG_PTR)(fieldoffset)))
  40. #define ACPIExtListSetupEnum(PExtList_EnumData, pListHeadArg, pSpinLockArg, OffsetField, WalkSchemeArg) \
  41. { \
  42. PEXTENSIONLIST_ENUMDATA peled = (PExtList_EnumData) ; \
  43. peled->pListHead = (pListHeadArg) ; \
  44. peled->pSpinLock = (pSpinLockArg) ; \
  45. peled->ExtOffset = FIELD_OFFSET(DEVICE_EXTENSION, OffsetField) ; \
  46. peled->WalkScheme = (WalkSchemeArg) ; \
  47. }
  48. PDEVICE_EXTENSION
  49. EXPORT
  50. ACPIExtListStartEnum(
  51. IN OUT PEXTENSIONLIST_ENUMDATA PExtList_EnumData
  52. ) ;
  53. BOOLEAN
  54. EXPORT
  55. ACPIExtListTestElement(
  56. IN OUT PEXTENSIONLIST_ENUMDATA PExtList_EnumData,
  57. IN BOOLEAN ContinueEnumeration
  58. ) ;
  59. PDEVICE_EXTENSION
  60. EXPORT
  61. ACPIExtListEnumNext(
  62. IN OUT PEXTENSIONLIST_ENUMDATA PExtList_EnumData
  63. ) ;
  64. VOID
  65. EXPORT
  66. ACPIExtListExitEnumEarly(
  67. IN OUT PEXTENSIONLIST_ENUMDATA PExtList_EnumData
  68. );
  69. BOOLEAN
  70. EXPORT
  71. ACPIExtListIsMemberOfRelation(
  72. IN PDEVICE_OBJECT DeviceObject,
  73. IN PDEVICE_RELATIONS DeviceRelations
  74. );
  75. #endif // _EXTLIST_H_