2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ke/device.c
5 * PURPOSE: Kernel Device/Settings Functions
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
12 #include <internal/debug.h>
14 #if defined (ALLOC_PRAGMA)
15 #pragma alloc_text(INIT, KeFindConfigurationEntry)
16 #pragma alloc_text(INIT, KeFindConfigurationNextEntry)
22 PCONFIGURATION_COMPONENT_DATA
25 KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
26 IN CONFIGURATION_CLASS Class
,
27 IN CONFIGURATION_TYPE Type
,
28 IN PULONG ComponentKey OPTIONAL
)
30 /* Start Search at Root */
31 return KeFindConfigurationNextEntry(Child
,
41 PCONFIGURATION_COMPONENT_DATA
44 KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child
,
45 IN CONFIGURATION_CLASS Class
,
46 IN CONFIGURATION_TYPE Type
,
47 IN PULONG ComponentKey OPTIONAL
,
48 IN PCONFIGURATION_COMPONENT_DATA
*NextLink
)
52 PCONFIGURATION_COMPONENT_DATA Sibling
;
53 PCONFIGURATION_COMPONENT_DATA ReturnEntry
;
55 /* If we did get a key, then use it instead */
62 /* Loop the Components until we find a a match */
65 /* Check if we are starting somewhere already */
68 /* If we've found the place where we started, clear and continue */
69 if (Child
== *NextLink
) *NextLink
= NULL
;
73 /* Try to get a match */
74 if (Child
->Component
.Class
== Class
&&
75 Child
->Component
.Type
== Type
&&
76 (Child
->Component
.Key
& Mask
) == Key
)
83 /* Now we've also got to lookup the siblings */
84 Sibling
= Child
->Sibling
;
87 /* Check if we are starting somewhere already */
90 /* If we've found the place where we started, clear and continue */
91 if (Sibling
== *NextLink
) *NextLink
= NULL
;
95 /* Try to get a match */
96 if (Sibling
->Component
.Class
== Class
&&
97 Sibling
->Component
.Type
== Type
&&
98 (Sibling
->Component
.Key
& Mask
) == Key
)
105 /* We've got to check if the Sibling has a Child as well */
108 /* We're just going to call ourselves again */
109 if ((ReturnEntry
= KeFindConfigurationNextEntry(Sibling
->Child
,
120 Sibling
= Sibling
->Sibling
;
124 Child
= Child
->Child
;
127 /* If we got here, nothign was found */
138 IN BOOLEAN CurrentCpuOnly
142 PKPROCESS Process
= NULL
;
145 /* Raise the IRQL for the TB Flush */
146 OldIrql
= KeRaiseIrqlToSynchLevel();
148 /* All CPUs need to have the TB flushed. */
149 if (CurrentCpuOnly
== FALSE
) {
150 Prcb
= KeGetCurrentPrcb();
152 /* How many CPUs is our caller using? */
153 Process
= Prcb
->CurrentThread
->ApcState
.Process
;
155 /* More then one, so send an IPI */
156 if (Process
->ActiveProcessors
> 1) {
157 /* Send IPI Packet */
161 /* Flush the TB for the Current CPU */
165 if (CurrentCpuOnly
== FALSE
) {
166 /* Did we send an IPI? If so, wait for completion */
167 if (Process
->ActiveProcessors
> 1) {
169 } while (Prcb
->TargetSet
!= 0);
173 /* FIXME: According to MSKB, we should increment a counter? */
175 /* Return to Original IRQL */
176 KeLowerIrql(OldIrql
);
189 KiDmaIoCoherency
= Coherency
;
197 KeQueryActiveProcessors (
201 return KeActiveProcessors
;
210 KeSaveStateForHibernate(