Add an ARC Header for future purposes (PPC, ARM, etc, ARCLoader) and implement KeFind...
authorAlex Ionescu <aionescu@gmail.com>
Tue, 14 Jun 2005 17:37:07 +0000 (17:37 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Tue, 14 Jun 2005 17:37:07 +0000 (17:37 +0000)
svn path=/trunk/; revision=15911

reactos/include/arc/arc.h [new file with mode: 0644]
reactos/include/ddk/kefuncs.h
reactos/include/ddk/ketypes.h
reactos/ntoskrnl/ke/device.c

diff --git a/reactos/include/arc/arc.h b/reactos/include/arc/arc.h
new file mode 100644 (file)
index 0000000..a913db9
--- /dev/null
@@ -0,0 +1,45 @@
+/* ARC LOADER TYPES *********************************************************/
+
+#ifndef __INCLUDE_ARC_H
+#define __INCLUDE_ARC_H
+
+/* Types */
+
+typedef enum _IDENTIFIER_FLAG
+{
+    Failed = 0x01,
+    ReadOnly = 0x02,
+    Removable = 0x04,
+    ConsoleIn = 0x08,
+    ConsoleOut = 0x10,
+    Input = 0x20,
+    Output = 0x40
+} IDENTIFIER_FLAG;
+
+typedef enum _CONFIGURATION_CLASS
+{
+    SystemClass,
+    ProcessorClass,
+    CacheClass,
+    AdapterClass,
+    ControllerClass,
+    PeripheralClass,
+    MemoryClass,
+    MaximumClass
+} CONFIGURATION_CLASS;
+
+typedef struct _CONFIGURATION_COMPONENT
+{
+    CONFIGURATION_CLASS Class;
+    CONFIGURATION_TYPE Type;
+    IDENTIFIER_FLAG Flags;
+    USHORT Version;
+    USHORT Revision;
+    ULONG Key;
+    ULONG AffinityMask;
+    ULONG ConfigurationDataLength;
+    ULONG IdentifierLength;
+    LPSTR Identifier;
+} CONFIGURATION_COMPONENT, *PCONFIGURATION_COMPONENT;
+
+#endif
index 42a91ce..1ba1f8e 100644 (file)
@@ -636,25 +636,25 @@ KeSetEventBoostPriority(
        IN PKTHREAD *Thread OPTIONAL
 );
 
        IN PKTHREAD *Thread OPTIONAL
 );
 
-PVOID
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
 STDCALL
-KeFindConfigurationEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
+KeFindConfigurationNextEntry(
+    IN PCONFIGURATION_COMPONENT_DATA Child,
+    IN CONFIGURATION_CLASS Class,
     IN CONFIGURATION_TYPE Type,
     IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey
+    IN PULONG ComponentKey OPTIONAL,
+    IN PCONFIGURATION_COMPONENT_DATA *NextLink
 );
 );
-
-PVOID
+                             
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
 STDCALL
-KeFindConfigurationNextEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
+KeFindConfigurationEntry(
+    IN PCONFIGURATION_COMPONENT_DATA Child,
+    IN CONFIGURATION_CLASS Class,
     IN CONFIGURATION_TYPE Type,
     IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey,
-    IN PVOID *NextLink
+    IN PULONG ComponentKey OPTIONAL
 );
 );
-
+                         
 VOID
 STDCALL
 KeFlushEntireTb(
 VOID
 STDCALL
 KeFlushEntireTb(
index efa3b73..1eb0b75 100644 (file)
@@ -5,6 +5,8 @@
 
 /* include ntos/ketypes.h here? */
 
 
 /* include ntos/ketypes.h here? */
 
+#include <arc/arc.h>
+
 # define RESTRICTED_POINTER __restrict
 
 struct _KMUTANT;
 # define RESTRICTED_POINTER __restrict
 
 struct _KMUTANT;
@@ -339,6 +341,14 @@ typedef struct _M128 {
     LONGLONG High;
 } M128, *PM128;
 
     LONGLONG High;
 } M128, *PM128;
 
+typedef struct _CONFIGURATION_COMPONENT_DATA 
+{
+    struct _CONFIGURATION_COMPONENT_DATA *Parent;
+    struct _CONFIGURATION_COMPONENT_DATA *Child;
+    struct _CONFIGURATION_COMPONENT_DATA *Sibling;
+    CONFIGURATION_COMPONENT Component;
+} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
+
 typedef struct _KEXCEPTION_FRAME {
     ULONG64 P1Home;
     ULONG64 P2Home;
 typedef struct _KEXCEPTION_FRAME {
     ULONG64 P1Home;
     ULONG64 P2Home;
index 11176da..07c1b0e 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/device.c
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/device.c
 #include <internal/debug.h>
 
 /*
 #include <internal/debug.h>
 
 /*
- * @unimplemented
+ * @implemented
  */
  */
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
 STDCALL
-PVOID
-KeFindConfigurationNextEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
-    IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey,
-    IN PVOID *NextLink
-)
+INIT_FUNCTION
+KeFindConfigurationEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
+                         IN CONFIGURATION_CLASS Class,
+                         IN CONFIGURATION_TYPE Type,
+                         IN PULONG ComponentKey OPTIONAL)
 {
 {
-       UNIMPLEMENTED;
-       return 0;
+    /* Start Search at Root */
+    return KeFindConfigurationNextEntry(Child, 
+                                        Class, 
+                                        Type, 
+                                        ComponentKey, 
+                                        NULL);
 }
 
 /*
  * @implemented
  */
 }
 
 /*
  * @implemented
  */
+PCONFIGURATION_COMPONENT_DATA
 STDCALL
 STDCALL
-PVOID
-KeFindConfigurationEntry(
-    IN PVOID Unknown,
-    IN ULONG Class,
-    IN CONFIGURATION_TYPE Type,
-    IN PULONG RegKey
-)
+INIT_FUNCTION
+KeFindConfigurationNextEntry(IN PCONFIGURATION_COMPONENT_DATA Child,
+                             IN CONFIGURATION_CLASS Class,
+                             IN CONFIGURATION_TYPE Type,
+                             IN PULONG ComponentKey OPTIONAL,
+                             IN PCONFIGURATION_COMPONENT_DATA *NextLink)
 {
 {
-       /* Start Search at Root */
-       return KeFindConfigurationNextEntry(Unknown, Class, Type, RegKey, NULL);
+    ULONG Key = 0;    
+    ULONG Mask = 0;
+    PCONFIGURATION_COMPONENT_DATA Sibling;
+    PCONFIGURATION_COMPONENT_DATA ReturnEntry;
+    
+    /* If we did get a key, then use it instead */
+    if (ComponentKey)
+    {
+        Key = *ComponentKey;
+        Mask = -1;
+    }
+    
+    /* Loop the Components until we find a a match */
+    while (Child)
+    {
+        /* Check if we are starting somewhere already */
+        if (*NextLink)
+        {
+            /* If we've found the place where we started, clear and continue */
+            if (Child == *NextLink) *NextLink = NULL;
+        } 
+        else
+        {
+            /* Try to get a match */
+            if (Child->Component.Class == Class &&
+                Child->Component.Type == Type &&
+                (Child->Component.Key & Mask) == Key)
+            {
+                /* Match found */
+                return Child;
+            }
+        }
+        
+        /* Now we've also got to lookup the siblings */
+        Sibling = Child->Sibling;
+        while (Sibling)
+        {
+            /* Check if we are starting somewhere already */
+            if (*NextLink)
+            {
+                /* If we've found the place where we started, clear and continue */
+                if (Sibling == *NextLink) *NextLink = NULL;
+            } 
+            else
+            {
+                /* Try to get a match */
+                if (Sibling->Component.Class == Class &&
+                    Sibling->Component.Type == Type &&
+                    (Sibling->Component.Key & Mask) == Key)
+                {
+                    /* Match found */
+                    return Sibling;
+                }
+            }
+            
+            /* We've got to check if the Sibling has a Child as well */
+            if (Sibling->Child)
+            {
+                /* We're just going to call ourselves again */
+                if ((ReturnEntry = KeFindConfigurationNextEntry(Sibling->Child,
+                                                                Class,
+                                                                Type,
+                                                                ComponentKey,
+                                                                NextLink)))
+                {
+                    return ReturnEntry;
+                }
+            }
+            
+            /* Next Sibling */
+            Sibling = Sibling->Sibling;
+        }
+        
+        /* Next Child */
+        Child = Child->Child;
+    }
+    
+    /* If we got here, nothign was found */
+    return NULL;
 }
 
 /*
  * @implemented
  */
 }
 
 /*
  * @implemented
  */
-STDCALL
 VOID
 VOID
+STDCALL
 KeFlushEntireTb(
     IN BOOLEAN Unknown,
     IN BOOLEAN CurrentCpuOnly
 KeFlushEntireTb(
     IN BOOLEAN Unknown,
     IN BOOLEAN CurrentCpuOnly
@@ -97,8 +175,8 @@ KeFlushEntireTb(
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-STDCALL
 VOID
 VOID
+STDCALL
 KeSetDmaIoCoherency(
     IN ULONG Coherency
 )
 KeSetDmaIoCoherency(
     IN ULONG Coherency
 )
@@ -109,8 +187,8 @@ KeSetDmaIoCoherency(
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-STDCALL
 KAFFINITY
 KAFFINITY
+STDCALL
 KeQueryActiveProcessors (
     VOID
     )
 KeQueryActiveProcessors (
     VOID
     )