Synchronize with trunk r58457.
[reactos.git] / boot / freeldr / freeldr / reactos / archwsup.c
index 31291d8..4d4dfd7 100644 (file)
 
 /* GLOBALS ********************************************************************/
 
-extern CHAR reactos_arc_hardware_data[];
-SIZE_T FldrpHwHeapLocation;
 PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot;
 
-BOOLEAN UseRealHeap = FALSE;
-
-VOID
-NTAPI
-FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
-                         IN PCM_PARTIAL_RESOURCE_LIST ResourceList,
-                         IN ULONG Size);
-
 /* FUNCTIONS ******************************************************************/
 
 PVOID
@@ -34,26 +24,8 @@ FldrpHwHeapAlloc(IN SIZE_T Size)
 {
     PVOID Buffer;
 
-    if (UseRealHeap)
-    {
-        /* Allocate memory from generic bootloader heap */
-        Buffer = MmHeapAlloc(Size);
-    }
-    else
-    {
-        /* Return a block of memory from the ARC Hardware Heap */
-        Buffer = &reactos_arc_hardware_data[FldrpHwHeapLocation];
-
-        /* Increment the heap location */
-        FldrpHwHeapLocation += Size;
-        if (FldrpHwHeapLocation > HW_MAX_ARC_HEAP_SIZE) Buffer = NULL;
-    }
-
-    /* Clear it */
-    if (Buffer)
-        RtlZeroMemory(Buffer, Size);
-
-    /* Return the buffer */
+    /* Allocate memory from generic bootloader heap */
+    Buffer = MmHeapAlloc(Size);
     return Buffer;
 }
 
@@ -65,10 +37,10 @@ FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
     SIZE_T IdentifierLength;
     PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
     PCHAR Identifier;
-    
+
     /* Allocate memory for the identifier */
     IdentifierLength = strlen(IdentifierString) + 1;
-    Identifier = FldrpHwHeapAlloc(IdentifierLength);
+    Identifier = MmHeapAlloc(IdentifierLength);
     if (!Identifier) return;
 
     /* Copy the identifier */
@@ -84,11 +56,11 @@ NTAPI
 FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
 {
     PCONFIGURATION_COMPONENT Component;
-    
+
     /* Allocate the root */
-    FldrArcHwTreeRoot = FldrpHwHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
+    FldrArcHwTreeRoot = MmHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
     if (!FldrArcHwTreeRoot) return;
-    
+
     /* Set it up */
     Component = &FldrArcHwTreeRoot->ComponentEntry;
     Component->Class = SystemClass;
@@ -101,7 +73,7 @@ FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
     Component->Revision = 0;
     Component->Key = 0;
     Component->AffinityMask = 0xFFFFFFFF;
-    
+
     /* Return the node */
     *SystemNode = FldrArcHwTreeRoot;
 }
@@ -130,7 +102,7 @@ FldrLinkToParent(IN PCONFIGURATION_COMPONENT_DATA Parent,
             /* This is now the parent */
             Parent = Sibling;
         } while ((Sibling = Sibling->Sibling));
-        
+
         /* Found the lowest sibling; mark us as its sibling too */
         Parent->Sibling = Child;
     }
@@ -153,16 +125,16 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
     PCONFIGURATION_COMPONENT Component;
 
     /* Allocate the node for this component */
-    ComponentData = FldrpHwHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
+    ComponentData = MmHeapAlloc(sizeof(CONFIGURATION_COMPONENT_DATA));
     if (!ComponentData) return;
-    
+
     /* Now save our parent */
     ComponentData->Parent = SystemNode;
-    
+
     /* Link us to the parent */
     if (SystemNode)
         FldrLinkToParent(SystemNode, ComponentData);
-    
+
     /* Set us up */
     Component = &ComponentData->ComponentEntry;
     Component->Class = Class;
@@ -170,36 +142,19 @@ FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode,
     Component->Flags = Flags;
     Component->Key = Key;
     Component->AffinityMask = Affinity;
-    
+
     /* Set identifier */
     if (IdentifierString)
         FldrSetIdentifier(ComponentData, IdentifierString);
-    
+
     /* Set configuration data */
     if (ResourceList)
-        FldrSetConfigurationData(ComponentData, ResourceList, Size);
-    
+    {
+        ComponentData->ConfigurationData = ResourceList;
+        ComponentData->ComponentEntry.ConfigurationDataLength = Size;
+    }
+
     /* Return the child */
-    *ComponentKey = ComponentData; 
+    *ComponentKey = ComponentData;
 }
 
-VOID
-NTAPI
-FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData,
-                         IN PCM_PARTIAL_RESOURCE_LIST ResourceList,
-                         IN ULONG Size)
-{
-    PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry;
-    PVOID ConfigurationData;
-
-    /* Allocate a buffer from the hardware heap */
-    ConfigurationData = FldrpHwHeapAlloc(Size);
-    if (!ConfigurationData) return;
-
-    /* Copy component information */
-    RtlCopyMemory(ConfigurationData, ResourceList, Size);
-
-    /* Set component information */
-    ComponentData->ConfigurationData = ConfigurationData;
-    Component->ConfigurationDataLength = Size;
-}