https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6f4be52a1c710ac062d35…
commit 6f4be52a1c710ac062d35a8c9083c0dcec69827e
Author: Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Thu May 26 19:40:17 2022 +0600
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu May 26 16:40:17 2022 +0300
[HALX86] Print the correct size of the BAR in HalpDebugPciDumpBus()
Reference: https://wiki.osdev.org/PCI#Address_and_size_of_the_BAR
To determine the amount of address space needed by a PCI device,
you must save the original value of the BAR, write a value
of all 1's to the register, then read it back.
Note: 64-bit BARs are not supported yet.
---
hal/halx86/include/halp.h | 2 ++
hal/halx86/legacy/bussupp.c | 32 ++++++++++++++++++++++++++------
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/hal/halx86/include/halp.h b/hal/halx86/include/halp.h
index 62d0254773e..5446482dfc8 100644
--- a/hal/halx86/include/halp.h
+++ b/hal/halx86/include/halp.h
@@ -516,6 +516,8 @@ CODE_SEG("INIT")
VOID
NTAPI
HalpDebugPciDumpBus(
+ IN PBUS_HANDLER BusHandler,
+ IN PCI_SLOT_NUMBER PciSlot,
IN ULONG i,
IN ULONG j,
IN ULONG k,
diff --git a/hal/halx86/legacy/bussupp.c b/hal/halx86/legacy/bussupp.c
index 97b535285d3..f967ece635c 100644
--- a/hal/halx86/legacy/bussupp.c
+++ b/hal/halx86/legacy/bussupp.c
@@ -787,7 +787,9 @@ ShowSize(ULONG x)
CODE_SEG("INIT")
VOID
NTAPI
-HalpDebugPciDumpBus(IN ULONG i,
+HalpDebugPciDumpBus(IN PBUS_HANDLER BusHandler,
+ IN PCI_SLOT_NUMBER PciSlot,
+ IN ULONG i,
IN ULONG j,
IN ULONG k,
IN PPCI_COMMON_CONFIG PciData)
@@ -963,12 +965,30 @@ HalpDebugPciDumpBus(IN ULONG i,
Mem = 0;
if (Mem)
{
+ ULONG PciBar = 0xFFFFFFFF;
+
+ HalpWritePCIConfig(BusHandler,
+ PciSlot,
+ &PciBar,
+ FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
+ sizeof(ULONG));
+ HalpReadPCIConfig(BusHandler,
+ PciSlot,
+ &PciBar,
+ FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
+ sizeof(ULONG));
+ HalpWritePCIConfig(BusHandler,
+ PciSlot,
+ &Mem,
+ FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
+ sizeof(ULONG));
+
/* Decode the address type */
- if (Mem & PCI_ADDRESS_IO_SPACE)
+ if (PciBar & PCI_ADDRESS_IO_SPACE)
{
/* Guess the size */
Size = 1 << 2;
- while (!(Mem & Size) && (Size)) Size <<= 1;
+ while (!(PciBar & Size) && (Size)) Size <<= 1;
/* Print it out */
DbgPrint("\tI/O ports at %04lx", Mem & PCI_ADDRESS_IO_ADDRESS_MASK);
@@ -977,8 +997,8 @@ HalpDebugPciDumpBus(IN ULONG i,
else
{
/* Guess the size */
- Size = 1 << 8;
- while (!(Mem & Size) && (Size)) Size <<= 1;
+ Size = 1 << 4;
+ while (!(PciBar & Size) && (Size)) Size <<= 1;
/* Print it out */
DbgPrint("\tMemory at %08lx (%d-bit, %sprefetchable)",
@@ -1102,7 +1122,7 @@ HalpInitializePciBus(VOID)
if (PciData->VendorID == PCI_INVALID_VENDORID) continue;
/* Print out the entry */
- HalpDebugPciDumpBus(i, j, k, PciData);
+ HalpDebugPciDumpBus(BusHandler, PciSlot, i, j, k, PciData);
/* Check if this is a Cardbus bridge */
if (PCI_CONFIGURATION_TYPE(PciData) == PCI_CARDBUS_BRIDGE_TYPE)
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3464df8c28c59b24c02c0…
commit 3464df8c28c59b24c02c0c9b28aedd75d7bd8fd0
Author: William Kent <wjk(a)sunsol.me>
AuthorDate: Fri May 13 18:33:14 2022 -0400
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Wed May 25 16:34:16 2022 +0300
[CMAKE] Search the PATH for the compilers and cache the results
We are deliberately using a macro here instead of REQUIRED parameter
because it is available only in CMake 3.18+, so it won't work with
CMake version that is being shipped with RosBE.
On my dev box the RosBE tools are only in the PATH when needed.
Since my IDE inherits the PATH from the system and not from my shell,
I needed to be able to run configure.sh with the tools in my PATH
and then be able to successfully reconfigure when building
from a "regular" command prompt.
---
toolchain-gcc.cmake | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/toolchain-gcc.cmake b/toolchain-gcc.cmake
index a7cc3bc82aa..1462e47b354 100644
--- a/toolchain-gcc.cmake
+++ b/toolchain-gcc.cmake
@@ -1,4 +1,11 @@
+macro(require_program varname execname)
+ find_program(${varname} ${execname})
+ if(NOT ${varname})
+ message(FATAL_ERROR "${execname} not found")
+ endif()
+endmacro()
+
# pass variables necessary for the toolchain (needed for try_compile)
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH)
@@ -28,15 +35,15 @@ set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR i686)
# Which tools to use
-set(CMAKE_C_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The C Compiler")
-set(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The C++ Compiler")
-set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The ASM Compiler")
+require_program(CMAKE_C_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
+require_program(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX})
+require_program(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
set(CMAKE_ASM_COMPILER_ID "GNU")
-set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
-set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
-set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
+require_program(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
+require_program(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
+require_program(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
#set(CMAKE_AR ${MINGW_TOOLCHAIN_PREFIX}gcc-ar${MINGW_TOOLCHAIN_SUFFIX})
-set(CMAKE_OBJCOPY ${MINGW_TOOLCHAIN_PREFIX}objcopy)
+require_program(CMAKE_OBJCOPY ${MINGW_TOOLCHAIN_PREFIX}objcopy)
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})