[FREELDR]: VaToPa/PaToVa are assuming all architectures have VA at PA | KSEG0_BASE...
[reactos.git] / reactos / boot / freeldr / freeldr / windows / conversion.c
index 18395ce..2f58a5f 100644 (file)
@@ -15,6 +15,7 @@
 
 /* FUNCTIONS **************************************************************/
 
+#ifndef _ZOOM2_
 /* Arch-specific addresses translation implementation */
 PVOID
 VaToPa(PVOID Va)
@@ -27,6 +28,19 @@ PaToVa(PVOID Pa)
 {
        return (PVOID)((ULONG_PTR)Pa | KSEG0_BASE);
 }
+#else
+PVOID
+VaToPa(PVOID Va)
+{
+    return Va;
+}
+
+PVOID
+PaToVa(PVOID Pa)
+{
+    return Pa;
+}
+#endif
 
 VOID
 List_PaToVa(LIST_ENTRY *ListEntry)
@@ -70,7 +84,7 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
        PCONFIGURATION_COMPONENT_DATA Child;
        PCONFIGURATION_COMPONENT_DATA Sibling;
 
-       DbgPrint((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)", Start));
+       DPRINTM(DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start);
        Child = Start;
 
        while (Child != NULL)
@@ -87,11 +101,14 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
                if (Child->Sibling)
                        Child->Sibling = PaToVa(Child->Sibling);
 
-               DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d", Child, Child->ComponentEntry.Class));
+               if (Child->ComponentEntry.Identifier)
+                       Child->ComponentEntry.Identifier = PaToVa(Child->ComponentEntry.Identifier);
 
-               // If the child has a sibling list, then search the sibling list
-               // for an entry that matches the specified class, type, and key.
-               Sibling = Child->Sibling;
+               DPRINTM(DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Child,
+                       Child->ComponentEntry.Class, Child->ComponentEntry.Type, VaToPa(Child->ComponentEntry.Identifier), Child->Parent);
+
+               // Go through siblings list
+               Sibling = VaToPa(Child->Sibling);
                while (Sibling != NULL)
                {
                        if (Sibling->ConfigurationData)
@@ -106,16 +123,20 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
                        if (Sibling->Sibling)
                                Sibling->Sibling = PaToVa(Sibling->Sibling);
 
-                       DbgPrint((DPRINT_WINDOWS, "Device 0x%X class %d", Sibling, Sibling->ComponentEntry.Class));
+                       if (Sibling->ComponentEntry.Identifier)
+                               Sibling->ComponentEntry.Identifier = PaToVa(Sibling->ComponentEntry.Identifier);
+
+                       DPRINTM(DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Sibling,
+                               Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type, VaToPa(Sibling->ComponentEntry.Identifier), Sibling->Parent);
 
-                       // If the sibling has a child tree, then search the child tree
-                       // for an entry that matches the specified class, type, and key.
+                       // Recurse into the Child tree
                        if (VaToPa(Sibling->Child) != NULL)
                                ConvertConfigToVA(VaToPa(Sibling->Child));
 
                        Sibling = VaToPa(Sibling->Sibling);
                }
 
+               // Go to the next child
                Child = VaToPa(Child->Child);
        }
 }