https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ef2323a146dd440f86261ac5844ffffa3e147d8b

commit ef2323a146dd440f86261ac5844ffffa3e147d8b
Author:     Vadim Galyant <[email protected]>
AuthorDate: Thu Apr 9 19:19:00 2020 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Thu Apr 9 19:41:16 2020 +0200

    [HALX86][PCIX] Statically link HALx86 and PCIX to the arbiter library. 
(#2471)
---
 drivers/bus/pcix/CMakeLists.txt |  3 +++
 drivers/bus/pcix/arb/ar_busno.c | 33 ++++++++++++++++++++++++++++++---
 drivers/bus/pcix/pci.h          |  3 ++-
 hal/halx86/CMakeLists.txt       |  7 ++++++-
 4 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/pcix/CMakeLists.txt b/drivers/bus/pcix/CMakeLists.txt
index 3bd5089972d..9389bde01eb 100644
--- a/drivers/bus/pcix/CMakeLists.txt
+++ b/drivers/bus/pcix/CMakeLists.txt
@@ -1,3 +1,5 @@
+include_directories(
+    ${REACTOS_SOURCE_DIR}/sdk/lib/drivers/arbiter)
 
 list(APPEND SOURCE
     arb/ar_busno.c
@@ -41,6 +43,7 @@ add_library(pcix MODULE
     pci.rc)
 
 set_module_type(pcix kernelmodedriver)
+target_link_libraries(pcix arbiter)
 add_importlibs(pcix ntoskrnl hal)
 add_pch(pcix pci.h SOURCE)
 add_dependencies(pcix pciclass)
diff --git a/drivers/bus/pcix/arb/ar_busno.c b/drivers/bus/pcix/arb/ar_busno.c
index 9618146aa31..1082c0b41ab 100644
--- a/drivers/bus/pcix/arb/ar_busno.c
+++ b/drivers/bus/pcix/arb/ar_busno.c
@@ -34,11 +34,38 @@ NTSTATUS
 NTAPI
 arbusno_Initializer(IN PVOID Instance)
 {
-    UNREFERENCED_PARAMETER(Instance);
+    PPCI_ARBITER_INSTANCE Arbiter = Instance;
+    PPCI_FDO_EXTENSION FdoExtension;
+    NTSTATUS Status;
+
+    PAGED_CODE();
+
+    RtlZeroMemory(&Arbiter->CommonInstance, sizeof(Arbiter->CommonInstance));
+
+    FdoExtension = Arbiter->BusFdoExtension;
+
     /* Not yet implemented */
     UNIMPLEMENTED;
-    //while (TRUE);
-    return STATUS_SUCCESS;
+
+#if 0
+    Arbiter->CommonInstance.UnpackRequirement = arbusno_UnpackRequirement;
+    Arbiter->CommonInstance.PackResource = arbusno_PackResource;
+    Arbiter->CommonInstance.UnpackResource = arbusno_UnpackResource;
+    Arbiter->CommonInstance.ScoreRequirement = arbusno_ScoreRequirement;
+#endif
+
+    Status = ArbInitializeArbiterInstance(&Arbiter->CommonInstance,
+                                          FdoExtension->FunctionalDeviceObject,
+                                          CmResourceTypeBusNumber,
+                                          Arbiter->InstanceName,
+                                          L"Pci",
+                                          NULL);
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("arbusno_Initializer: init arbiter return %X", Status);
+    }
+
+    return Status;
 }
 
 NTSTATUS
diff --git a/drivers/bus/pcix/pci.h b/drivers/bus/pcix/pci.h
index 52b6fd5e45c..fc6b578c24d 100644
--- a/drivers/bus/pcix/pci.h
+++ b/drivers/bus/pcix/pci.h
@@ -18,6 +18,7 @@
 #include <ndk/halfuncs.h>
 #include <ndk/rtlfuncs.h>
 #include <ndk/vffuncs.h>
+#include <arbiter.h>
 
 //
 // Tag used in all pool allocations (Pci Bus)
@@ -402,7 +403,7 @@ typedef struct PCI_ARBITER_INSTANCE
     PPCI_INTERFACE Interface;
     PPCI_FDO_EXTENSION BusFdoExtension;
     WCHAR InstanceName[24];
-    //ARBITER_INSTANCE CommonInstance; FIXME: Need Arbiter Headers
+    ARBITER_INSTANCE CommonInstance;
 } PCI_ARBITER_INSTANCE, *PPCI_ARBITER_INSTANCE;
 
 //
diff --git a/hal/halx86/CMakeLists.txt b/hal/halx86/CMakeLists.txt
index b95b69b7723..c462dc1e69d 100644
--- a/hal/halx86/CMakeLists.txt
+++ b/hal/halx86/CMakeLists.txt
@@ -32,7 +32,12 @@ function(add_hal _halname)
         target_link_libraries(${_halname} ${_haldata_LIBS})
     endif()
 
-    target_link_libraries(${_halname} libcntpr)
+    if (${_halname} STREQUAL "hal")
+        target_link_libraries(${_halname} libcntpr arbiter)
+    else()
+        target_link_libraries(${_halname} libcntpr)
+    endif()
+
     add_importlibs(${_halname} ntoskrnl)
     #add_pch(${_halname} include/hal.h)
     add_dependencies(${_halname} psdk asm)

Reply via email to