Commit Graph

64 Commits

Author SHA1 Message Date
Victor Perevertkin
8248f02ff4
[HALX86] Restore Windows compatibility on reporting device IDs
And forwarding IRPs from FDO to PDO

This along with 8aff2c9de7 reverts the commit 74b889b397
2021-01-31 05:37:27 +03:00
Serge Gautherie
3e79cb8e6c
[HALX86] Update the PCI hardware IDs database.
Extracted from the pci.ids database at https://pci-ids.ucw.cz/ from 2020-11-14 03:15:02 .
Maintained by Albert Pool, Martin Mares, and other volunteers from the PCI ID Project.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2020-11-21 17:31:40 +01:00
Vadim Galyant
40bb3786b6
[HALX86] Implement HalQueryAMLIIllegalIOPortAddresses case in HaliQuerySystemInformation
CORE-17359

Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
Co-authored-by: Oleg Dubinskiy <oleg.dubinskij2013@yandex.ua>
2020-11-14 15:18:37 +01:00
Victor Perevertkin
f75318b606
[HALX86] Drop hacks in HalpAddDevice to work around PnP synchronization bugs
Our PnP manager handles OS boot in a synchronous manner thus we don't
need it anymore.
This effectively reverts f23e722, d974e84, 3aff101 and 4a9fcb6

CORE-5686
2020-11-09 01:28:50 +03:00
Timo Kreuzer
c5a700fd06 [HAL:X64] Fix/improve the BIOS interface
* Call HalInitializeBios both in phase 0 and 1
* In phase 0 allocate some physical memory, instead of using arbitrary hardcoded pages, that then end up as page tables and get filled with VESA tables
2020-11-07 18:46:20 +01:00
Victor Perevertkin
5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Victor Perevertkin
658f742c2d
[NDK][CMAKE] Introduce DATA_SEG and CODE_SEG macro
These are for putting code and data to non-default sections
At the same time, move INIT section attributes declaration to cmake files
2020-11-02 21:27:06 +03:00
Timo Kreuzer
0343ac4f0b [HAL] Use iretq instead of iret 2020-09-20 23:08:17 +02:00
Timo Kreuzer
3bbcc16d8e [HAL] Fix calculation of timer increment 2020-09-20 23:08:17 +02:00
Timo Kreuzer
2aca4b2795 [ASM] Fix boot with VS 16.7.3 / MSVC 19.27
See https://developercommunity.visualstudio.com/content/problem/1180800/ml-x86-assume-directive-causes-invalid-code-genera.html
2020-09-12 15:01:04 +02:00
Victor Perevertkin
8aff2c9de7
[HALX86] Report HAL root device to the stack before passing it to the driver
PnP manager now correctly delays device actions if needed, so this can
be safely done as a one operation (IoReportDetectedDevice itself creates
a PDO for us if not passed)

CORE-10456
2020-08-21 08:19:53 +03:00
Victor Perevertkin
2839c85092
[NTOS:IO] Enumerate devices only inside the PipDeviceActionWorker
Introduce the PiPerformSyncDeviceAction routine for queuing
synchronous device actions
Change all kernel code to use PiPerformSyncDeviceAction and
PiQueueDeviceAction for device enumeration

CORE-10456
2020-08-21 08:02:26 +03:00
Dmitry Borisov
b36018ff26
[HALPC98] Add Hardware Abstraction Layer for NEC PC-98 series (#3002) 2020-07-25 15:31:02 +02:00
Dmitry Borisov
17c5fb8866
[HALXBOX] Fix clock drift (#2889)
Add a new rollover table for Original Xbox (base frequency is 1.125000 MHz).
This fixes potential time issues in kernel and drivers.

CORE-16216
2020-06-03 02:14:16 +03:00
Serge Gautherie
11345aedd8
[FORMATTING] [CMAKE] Remove space in 'if (' (#2847) 2020-05-26 20:24:02 +02:00
Serge Gautherie
327813e7da
[HAL:HALPPC] HalAllocateCrashDumpRegisters(): Remove redundant MapRegisterNumber assignment (#2854)
Detected by CppCheck: redundantAssignment.
Addendum to commit 81f09273 (r28793).
2020-05-25 18:58:17 +02:00
Stanislav Motylkov
fa1ec0a2ed
[BOOTVID][HALXBOX] Implement boot video driver for Xbox (#2774)
Also make HalpBiosDisplayReset() function always return FALSE,
because we don't have a BIOS on Xbox.

CORE-16216 CORE-16219
2020-05-17 19:18:32 +03:00
Colin Finck
db7ee3a756
[HAL] Remove duplicated IRQL mask tables
With the minimum Visual Studio version now being 2015, we no longer need to maintain two variants of the same code, and can stick to the commented and better understandable version.
2020-05-15 23:46:22 +02:00
Stanislav Motylkov
cd91271796
[NTOSKRNL][HAL][BOOTVID] Some more code refactoring
- Add boot video color constants
- Refactor palette initialization
- Move some common stuff in right place
- Get rid of some magic constants and hardcoded values
- Get rid of TopDelta variable (calculated at compile time)
- Update SAL annotations

Addendum to 5f2ca473. CORE-16216 CORE-16219
2020-05-12 15:56:37 +03:00
Victor Perevertkin
7e069ccdb2
[CMAKE] Replace custom functions to built-in ones
add_target_compile_definitions -> target_compile_definitions
add_target_compile_flags -> target_compile_options
add_target_include_directories -> target_include_directories
2020-04-16 15:59:38 +03:00
Vadim Galyant
ef2323a146
[HALX86][PCIX] Statically link HALx86 and PCIX to the arbiter library. (#2471) 2020-04-09 19:41:16 +02:00
Dmitry Borisov
1610367fe2
[BOOTVID][NTOSKRNL][HALX86] Move hardcoded coordinates of bootvid into one place. (#2504)
Co-Authored-By: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-04-09 15:17:48 +02:00
Dmitry Borisov
18ae48ce51
[HALX86] Move PC/AT hardware definitions to a separate file (#2406)
This makes it easier for other ports.
2020-03-06 19:54:16 +01:00
Stanislav Motylkov
dbeaef63c1
[HAL] Fix debug prints in ShowSize() and its caller (#2377) 2020-02-23 23:02:40 +01:00
Stanislav Motylkov
35710b51af
[HALXBOX][BOOTDATA][INF] Give the Xbox HAL its own personality (#2338)
CORE-16216
2020-02-13 14:02:11 +01:00
Thomas Faber
6c93669012
[HAL] Use a spin lock for the DMA adapter list. CORE-16611
This is necessary because HalPutDmaAdapter can be called at DISPATCH_LEVEL.
2020-02-09 08:32:56 +01:00
Stanislav Motylkov
af7ec17ce1 [HALXBOX] Don't use Xbox partitions if MBR signature found (#2253)
* [HALXBOX] Formatting only.

* [HALXBOX] Don't use Xbox partitions if MBR signature found.

- Fixes BSOD 0x7B when booting from a HDD that have both MBR and BRFR signatures.
- It happens when you format Xbox (BRFR) disk as MBR.
  After that "BRFR" signature is still located at sector 3.
- Also fix pre-existing leaks.

CORE-16216 CORE-16329
2020-01-18 18:41:32 +01:00
disean
e5c0052466 [HAL][FREELDR] Fix system timer oscillator frequency on a Xbox (#2245)
See https://xboxdevwiki.net/Porting_an_Operating_System_to_the_Xbox_HOWTO#Timer_Frequency
2020-01-14 18:47:36 +01:00
Serge Gautherie
fdc787c11d [HALX86] Remove a now useless ASSERT() (#2089)
By construction now the assertion will always be verified.
Addendum to 5887b170.
2019-11-25 18:29:03 +01:00
Hermès Bélusca-Maïto
5887b17005
[HALX86] Fix the "ASSERT(j < 32);" problem in HalpStoreAndClearIopm() encountered from time to time.
CORE-11921 CORE-13715

(Regression introduced by commit 2e1b82cf, r44841.)

In some cases the number of valid (!= 0xFFFF) entries in the IOPM can be
larger than the assumed size (32) of the entries cache. The maximum
possible number of entries is equal to IOPM_SIZE / sizeof(USHORT).

A way to reproduce the problem is as follows: start ReactOS in debugging
mode using '/DEBUG /DEBUGPORT=SCREEN' . Then manage to break into the
debugger exactly during the execution of Ke386CallBios() triggered by
display initialization (for example in my case, while a video driver was
being initialized via the HwInitialize() call done by videoport inside
IntVideoPortDispatchOpen() ).

When this happens, a "concurrent" execution between Ke386CallBios() and
the HAL function HalpStoreAndClearIopm() takes place. This is due to the
fact that when entering the debugger in SCREEN mode, the following
call-chain holds:
InbvResetDisplay() -> VidResetDisplay() -> HalResetDisplay() ->
HalpBiosDisplayReset() -> HalpSetupRealModeIoPermissionsAndTask() ->
HalpStoreAndClearIopm().

However, the code of Ke386CallBios() has reset the IOPM contents with
all zeroes instead of 0xFFFF, and this triggers the caching of all the
entries of the IOPM by HalpStoreAndClearIopm(), whose number is greater
than the wrongly assumed number of '32'.

As Thomas explained to me, "Windows supports [the maximum number of IOPM entries],
it just makes a full copy of the table instead of this indexed partial copy."

And I agree that this overengineered so-called "optimization" committed
in 2e1b82cf contributed in introducing an unnecessary bug and making the
code less clear. Also it makes the IOPM cache larger than the necessary
size by twice as much. Finally, Ke386CallBios() also caches IOPM entries
before doing a 16-bit call, and obviously uses the more straightforward
way of doing a direct copy of the IOPM table (using RtlCopyMemory()).

I wonder what kind of "optimization" this tried to achieve, knowing that
we are not doing like thousands of 32->16bit BIOS interrupt calls per second
in ReactOS...
2019-11-25 00:41:55 +01:00
Hermès Bélusca-Maïto
00cb464d9d
[HALX86] Trailing whitespace fixes only. 2019-11-25 00:41:55 +01:00
Stanislav Motylkov
d4ede03e19 [HALXBOX] Implement shutdown, reboot, and power cycle routines
CORE-16216
2019-10-05 17:42:28 +02:00
Stanislav Motylkov
c360509724 [HALXBOX][CMAKE] Merge generic module with xbox module for modification 2019-10-05 17:42:28 +02:00
Hermès Bélusca-Maïto
e995147a1c
[HAL] Update the PCI hardware IDs database.
Extracted from the pci.ids database at https://pci-ids.ucw.cz/ from 2019-09-28 03:15:02 .
Maintained by Albert Pool, Martin Mares, Michal Vaner, and other volunteers from the PCI ID Project.
2019-09-28 18:52:59 +02:00
Stanislav Motylkov
07706eca3a [HAL] Fix more bugs in HalpDebugPciDumpBus (#1939)
- Don't match device id outside current vendor id list.
- Don't match subsystem id outside current device id list.
- Refactor some magic constants.

Addendum to 894635b.
2019-09-28 18:30:56 +02:00
Stanislav Motylkov
894635bb00 [HAL] Fix parser bugs in HalpDebugPciDumpBus (#1895)
- Match subclass properly, don't match third subclass.
- Don't match subclass from next class, add ClassEnd boundary.
- Use class name if subclass name not available.
- Gracefully return "Unknown" if no class name found.
2019-09-23 23:46:23 +02:00
Stanislav Motylkov
17bb6d10eb [HAL] Return correct bus handler in HaliFindBusAddressTranslation
This fixes the bug when VidInitialize asks for different translated addresses
and VgaIsPresent always returns FALSE either because the machine does not have
VGA controller at all (e.g. 86Duino Zero), or it does have video hardware
that is not compatible with VGA standard (e.g. Original Xbox).

The problem investigated by Stanislav Motylkov. Suggested fix by Thomas Faber.

CORE-14625 CORE-16216 CORE-16222

Co-authored-by: Thomas Faber <thomas.faber@reactos.org>
2019-09-01 16:37:56 +02:00
Stanislav Motylkov
b99272702c [HAL] Refactor PCI blacklisting for Xbox
- Use a separate function for detecting blacklisted PCI slots
- Blacklist PCI-to-PCI bridge to avoid stack overflow on real hardware Microsoft Xbox 1.3

CORE-16319 CORE-16216
2019-08-20 01:51:16 +02:00
Stanislav Motylkov
251bf49127 [HAL] Xbox needs more PCI blacklisting!
CORE-16216
2019-08-17 21:19:28 +02:00
Stanislav Motylkov
5d57e39655 [HAL] Add Xbox Hardware Abstraction Layer
- Create xbox.cmake based on legacy.cmake and pic.cmake
- Revive Xbox HAL files and add them to the build
- Fix boot with Xbox HAL, add missing parts from halinit_up.c
- Code style and debug logging improvements in pcibus.c
- Allow to choose Xbox HAL in usetup

CORE-16216
2019-08-16 18:28:52 +02:00
Timo Kreuzer
9ab3246d43 [HAL] Implement amd64 BIOS call support
The code uses FAST486 to emulate the BIOS code.
2019-08-15 14:13:54 +02:00
Jérôme Gardou
23373acbb9 [CMAKE] Use modules instead of shared libraries
There is no need to compile our DLLs as shared libraries since we are
managing symbols exports and imports through spec files.

On my system, this reduces the configure-time by a factor of two.
2019-04-06 17:43:38 +02:00
Extravert-ir
2b4108b2c6 [HALX86] Removed reduntant INIT_FUNCTION attribute from HalpGetSystemInterruptVector. (#1234)
This fixes livecd crashes started since 71fefa32db.
2019-01-13 01:01:31 +01:00
Timo Kreuzer
71fefa32db
[NDK][NTOS] Add global definition of INIT_FUNCTION/INIT_SECTION (#779)
* Add an NDK header to define INIT_FUNCTION/INIT_SECTION globally
* Use _declspec(allocate(x)) and _declspec(code_seg(x)) on MSVC versions that support it
* Use INIT_FUNCTION on functions only and INIT_SECTION on data only (required by MSVC)
* Place INIT_FUNCTION before the return type (required by MSVC)
* Make sure declarations and implementations share the same modifiers (required by MSVC)
* Add a global linker option to suppress warnings about defined but unused INIT section
* Merge INIT section into .text in freeldr
2018-12-30 12:19:11 +01:00
Hermès Bélusca-Maïto
94d8194376
[HAL] Update the PCI hardware IDs database.
Extracted from the pci.ids database at https://pci-ids.ucw.cz/ from 2018-11-21 03:15:02 .
Maintained by Albert Pool, Martin Mares, Michal Vaner, and other volunteers from the PCI ID Project.
2018-11-25 17:21:00 +01:00
Thomas Faber
1ed0f9ab57
[HAL] Remove misleading debug prints about USB controllers. 2018-08-08 20:08:38 +02:00
Denis Malikov
4ea570975c
[HAL] Add NT6-compatible version of HalpMapPhysicalMemory64 and HalpUnmapVirtualAddress 2018-08-05 10:14:57 +02:00
Timo Kreuzer
cf77354dce [REACTOS] Fix 64 bit issues 2018-08-04 19:19:34 +02:00
Serge Gautherie
e01f935f0e
[HALX86] Fix a Clang-Cl warning about KiUnexpectedInterrupt
"warning: cast between incompatible calling conventions 'cdecl' and 'fastcall'; calls through this pointer may abort at runtime [-Wcast-calling-convention]"

CORE-14306
2018-06-13 10:48:55 +02:00
Thomas Faber
fc9bc9390d
[HAL] Reset the stack pointer to the stack frame when calling second-entry interrupt handlers. CORE-14449
Because we can encounter pending interrupts repeatedly,
HalpEndSoftwareInterrupt and HalEndSystemInterrupt already clean up the stack
space for their arguments (done for CORE-11123/CORE-14076).
However these functions are called from C functions such as KiInterruptDispatch
and HalpDispatchInterrupt2[ndEntry]. These callers also use up stack space,
and it is unknown how much.
To fix this, we simply reset the stack pointer to the location of the trap
frame, which is where it points during a first-level dispatch. This cleans
up the stack usage of any callers higher up, and is okay because a return
will happen through the trap frame anyway.

Dedicated to Pierre.
2018-04-13 09:04:52 +02:00