From d101bc4e2df04ea98306f0cbc37efbc32e4dae84 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 14 Jun 2005 17:37:07 +0000 Subject: [PATCH] Add an ARC Header for future purposes (PPC, ARM, etc, ARCLoader) and implement KeFindConfigurationNextEntry and fix the definition svn path=/trunk/; revision=15911 --- reactos/include/arc/arc.h | 45 ++++++++++++ reactos/include/ddk/kefuncs.h | 30 ++++---- reactos/include/ddk/ketypes.h | 10 +++ reactos/ntoskrnl/ke/device.c | 128 +++++++++++++++++++++++++++------- 4 files changed, 173 insertions(+), 40 deletions(-) create mode 100644 reactos/include/arc/arc.h diff --git a/reactos/include/arc/arc.h b/reactos/include/arc/arc.h new file mode 100644 index 00000000000..a913db9446c --- /dev/null +++ b/reactos/include/arc/arc.h @@ -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 diff --git a/reactos/include/ddk/kefuncs.h b/reactos/include/ddk/kefuncs.h index 42a91ce687f..1ba1f8e5ecf 100644 --- a/reactos/include/ddk/kefuncs.h +++ b/reactos/include/ddk/kefuncs.h @@ -636,25 +636,25 @@ KeSetEventBoostPriority( IN PKTHREAD *Thread OPTIONAL ); -PVOID -STDCALL -KeFindConfigurationEntry( - IN PVOID Unknown, - IN ULONG Class, - IN CONFIGURATION_TYPE Type, - IN PULONG RegKey -); - -PVOID +PCONFIGURATION_COMPONENT_DATA STDCALL KeFindConfigurationNextEntry( - IN PVOID Unknown, - IN ULONG Class, + IN PCONFIGURATION_COMPONENT_DATA Child, + IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, - IN PULONG RegKey, - IN PVOID *NextLink + IN PULONG ComponentKey OPTIONAL, + IN PCONFIGURATION_COMPONENT_DATA *NextLink ); - + +PCONFIGURATION_COMPONENT_DATA +STDCALL +KeFindConfigurationEntry( + IN PCONFIGURATION_COMPONENT_DATA Child, + IN CONFIGURATION_CLASS Class, + IN CONFIGURATION_TYPE Type, + IN PULONG ComponentKey OPTIONAL +); + VOID STDCALL KeFlushEntireTb( diff --git a/reactos/include/ddk/ketypes.h b/reactos/include/ddk/ketypes.h index efa3b73b11d..1eb0b75e005 100644 --- a/reactos/include/ddk/ketypes.h +++ b/reactos/include/ddk/ketypes.h @@ -5,6 +5,8 @@ /* include ntos/ketypes.h here? */ +#include + # define RESTRICTED_POINTER __restrict struct _KMUTANT; @@ -339,6 +341,14 @@ typedef struct _M128 { 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; diff --git a/reactos/ntoskrnl/ke/device.c b/reactos/ntoskrnl/ke/device.c index 11176da71d6..07c1b0ef78a 100644 --- a/reactos/ntoskrnl/ke/device.c +++ b/reactos/ntoskrnl/ke/device.c @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/device.c @@ -13,43 +12,122 @@ #include /* - * @unimplemented + * @implemented */ +PCONFIGURATION_COMPONENT_DATA 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 */ +PCONFIGURATION_COMPONENT_DATA 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 */ -STDCALL VOID +STDCALL KeFlushEntireTb( IN BOOLEAN Unknown, IN BOOLEAN CurrentCpuOnly @@ -97,8 +175,8 @@ KeFlushEntireTb( /* * @implemented */ -STDCALL VOID +STDCALL KeSetDmaIoCoherency( IN ULONG Coherency ) @@ -109,8 +187,8 @@ KeSetDmaIoCoherency( /* * @implemented */ -STDCALL KAFFINITY +STDCALL KeQueryActiveProcessors ( VOID )