ReactOS  0.4.14-dev-49-gfb4591c
config.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for config.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL)
 
INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry (IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *NextLink)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file config.c.

Function Documentation

◆ KeFindConfigurationEntry()

INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationEntry ( IN PCONFIGURATION_COMPONENT_DATA  Child,
IN CONFIGURATION_CLASS  Class,
IN CONFIGURATION_TYPE  Type,
IN PULONG ComponentKey  OPTIONAL 
)

Definition at line 23 of file config.c.

27 {
29 
30  /* Start Search at Root */
32  Class,
33  Type,
34  ComponentKey,
35  &NextLink);
36 }
Type
Definition: Type.h:6
smooth NULL
Definition: ftsmooth.c:416
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:722
INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *NextLink)
Definition: config.c:44

◆ KeFindConfigurationNextEntry()

INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry ( IN PCONFIGURATION_COMPONENT_DATA  Child,
IN CONFIGURATION_CLASS  Class,
IN CONFIGURATION_TYPE  Type,
IN PULONG ComponentKey  OPTIONAL,
IN PCONFIGURATION_COMPONENT_DATA NextLink 
)

Definition at line 44 of file config.c.

49 {
50  ULONG Key = 0;
51  ULONG Mask = 0;
54 
55  /* If we did get a key, then use it instead */
56  if (ComponentKey)
57  {
58  Key = *ComponentKey;
59  Mask = -1;
60  }
61 
62  /* Loop the Components until we find a a match */
63  while (Child)
64  {
65  /* Check if we are starting somewhere already */
66  if (*NextLink)
67  {
68  /* If we've found the place where we started, clear and continue */
69  if (Child == *NextLink) *NextLink = NULL;
70  }
71  else
72  {
73  /* Try to get a match */
74  if ((Child->ComponentEntry.Class) == Class &&
75  (Child->ComponentEntry.Type) == Type &&
76  (Child->ComponentEntry.Key & Mask) == Key)
77  {
78  /* Match found */
79  return Child;
80  }
81  }
82 
83  /* Now we've also got to lookup the siblings */
84  Sibling = Child->Sibling;
85  while (Sibling)
86  {
87  /* Check if we are starting somewhere already */
88  if (*NextLink)
89  {
90  /* If we've found the place where we started, clear and continue */
91  if (Sibling == *NextLink) *NextLink = NULL;
92  }
93  else
94  {
95  /* Try to get a match */
96  if ((Sibling->ComponentEntry.Class == Class) &&
97  (Sibling->ComponentEntry.Type == Type) &&
98  (Sibling->ComponentEntry.Key & Mask) == Key)
99  {
100  /* Match found */
101  return Sibling;
102  }
103  }
104 
105  /* We've got to check if the Sibling has a Child as well */
106  if (Sibling->Child)
107  {
108  /* We're just going to call ourselves again */
109  ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
110  Class,
111  Type,
112  ComponentKey,
113  NextLink);
114  if (ReturnEntry) return ReturnEntry;
115  }
116 
117  /* Next Sibling */
118  Sibling = Sibling->Sibling;
119  }
120 
121  /* Next Child */
122  Child = Child->Child;
123  }
124 
125  /* If we got here, nothing was found */
126  return NULL;
127 }
Type
Definition: Type.h:6
struct _CONFIGURATION_COMPONENT_DATA * Child
Definition: arc.h:119
CONFIGURATION_TYPE Type
Definition: arc.h:105
smooth NULL
Definition: ftsmooth.c:416
CONFIGURATION_CLASS Class
Definition: arc.h:104
CONFIGURATION_COMPONENT ComponentEntry
Definition: arc.h:121
struct _CONFIGURATION_COMPONENT_DATA * Sibling
Definition: arc.h:120
unsigned int ULONG
Definition: retypes.h:1
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:722
INIT_FUNCTION PCONFIGURATION_COMPONENT_DATA NTAPI KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, IN PULONG ComponentKey OPTIONAL, IN PCONFIGURATION_COMPONENT_DATA *NextLink)
Definition: config.c:44

Referenced by HalpAcpiFindRsdtPhase0(), and KeFindConfigurationEntry().