KD System Rewrite:
[reactos.git] / reactos / ntoskrnl / ke / device.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ke/device.c
6 * PURPOSE: Kernel Device/Settings Functions
7 *
8 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
9 */
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <internal/debug.h>
14
15 /*
16 * @implemented
17 */
18 STDCALL
19 PVOID
20 KeFindConfigurationEntry(
21 IN PVOID Unknown,
22 IN ULONG Class,
23 IN CONFIGURATION_TYPE Type,
24 IN PULONG RegKey
25 )
26 {
27 /* Start Search at Root */
28 return KeFindConfigurationNextEntry(Unknown, Class, Type, RegKey, NULL);
29 }
30
31 /*
32 * @unimplemented
33 */
34 STDCALL
35 PVOID
36 KeFindConfigurationNextEntry(
37 IN PVOID Unknown,
38 IN ULONG Class,
39 IN CONFIGURATION_TYPE Type,
40 IN PULONG RegKey,
41 IN PVOID *NextLink
42 )
43 {
44 UNIMPLEMENTED;
45 return 0;
46 }
47
48 /*
49 * @implemented
50 */
51 STDCALL
52 VOID
53 KeFlushEntireTb(
54 IN BOOLEAN Unknown,
55 IN BOOLEAN CurrentCpuOnly
56 )
57 {
58 KIRQL OldIrql;
59 PKPROCESS Process = NULL;
60 PKPRCB Prcb = NULL;
61
62 /* Raise the IRQL for the TB Flush */
63 OldIrql = KeRaiseIrqlToSynchLevel();
64
65 /* All CPUs need to have the TB flushed. */
66 if (CurrentCpuOnly == FALSE) {
67 Prcb = KeGetCurrentPrcb();
68
69 /* How many CPUs is our caller using? */
70 Process = Prcb->CurrentThread->ApcState.Process;
71
72 /* More then one, so send an IPI */
73 if (Process->ActiveProcessors > 1) {
74 /* Send IPI Packet */
75 }
76 }
77
78 /* Flush the TB for the Current CPU */
79 KeFlushCurrentTb();
80
81 /* Clean up */
82 if (CurrentCpuOnly == FALSE) {
83 /* Did we send an IPI? If so, wait for completion */
84 if (Process->ActiveProcessors > 1) {
85 do {
86 } while (Prcb->TargetSet != 0);
87 }
88 }
89
90 /* FIXME: According to MSKB, we should increment a counter? */
91
92 /* Return to Original IRQL */
93 KeLowerIrql(OldIrql);
94 }
95
96
97 /*
98 * @implemented
99 */
100 STDCALL
101 VOID
102 KeSetDmaIoCoherency(
103 IN ULONG Coherency
104 )
105 {
106 KiDmaIoCoherency = Coherency;
107 }
108
109 /*
110 * @unimplemented
111 */
112 STDCALL
113 PKDEVICE_QUEUE_ENTRY
114 KeRemoveByKeyDeviceQueueIfBusy (
115 IN PKDEVICE_QUEUE DeviceQueue,
116 IN ULONG SortKey
117 )
118 {
119 UNIMPLEMENTED;
120 return 0;
121 }
122
123 /*
124 * @implemented
125 */
126 STDCALL
127 KAFFINITY
128 KeQueryActiveProcessors (
129 VOID
130 )
131 {
132 return KeActiveProcessors;
133 }
134
135
136 /*
137 * @unimplemented
138 */
139 VOID
140 __cdecl
141 KeSaveStateForHibernate(
142 IN PVOID State
143 )
144 {
145 UNIMPLEMENTED;
146 }