Commit graph

307 commits

Author SHA1 Message Date
StrikerX3 836c30a8b2 Initial implementation of ATA device drivers
ATA device drivers act as virtual devices attached to ATA channels. They typically interact with real hardware by accessing a hard drive image, an XISO, a host DVD drive or similar methods.

Implemented two ATA device drivers:
- Null: absence of a device (cable disconnected)
- Dummy: a fake, empty hard drive (still incomplete; mostly to aid development)

Added ATA device drivers to the Xbox class. They need to be made configurable later.

Implemented the command processing part of the Identify Device command. Still need to implement the data buffer and reading from the buffer.

Allow 8-bit and 32-bit reads from and writes to the Data register

Reads from various command registers will now return 0 if there is no device attached to the selected port. Only the Status register is valid in this case. Writes go through but are largely ignored.
2018-12-04 14:33:30 -02:00
StrikerX3 bf4637f268 Introduced ATADevice and moved Set Features to it
Moved ATA registers into a separate struct, embedded into ATAChannel and referenced by ATADevices

Stubbed Identify Device command

Converted ATAChannel to a class and improved initialization of ATA classes
2018-12-03 23:38:59 -02:00
StrikerX3 9e457bfe57 Implement our first command! 2018-12-03 22:34:18 -02:00
StrikerX3 6de45364a7 ATA controller registers are not part of devices 2018-12-03 21:54:10 -02:00
StrikerX3 0f074a7070 Stub our first ATA command 2018-12-03 21:41:59 -02:00
StrikerX3 60d3db0cde Devices that use IRQ should use the IRQHandler base type instead of the i8259 2018-12-03 20:37:19 -02:00
StrikerX3 2b59883eae Some fixes 2018-12-03 20:04:40 -02:00
StrikerX3 7d51dd13c1 Refine ATA channel methods
Moved files around
2018-12-03 19:56:13 -02:00
StrikerX3 fa769c1212 Restructure ATA implementation 2018-12-03 19:33:57 -02:00
StrikerX3 7be0a89e32 IRQ assertion level is better represented by a bool
Improve documentation on ATA emulation
2018-12-03 18:55:56 -02:00
StrikerX3 685c764f2e Fix compilation error
Namespaces are annoying...
2018-12-03 17:14:22 -02:00
StrikerX3 db01ec0263 Begin structuring the ATA emulator 2018-12-03 16:27:17 -02:00
StrikerX3 9d0c3c8518 Stub ATA device 2018-12-03 12:56:41 -02:00
StrikerX3 26d6f9d529 Write 0 on unimplemented reads 2018-12-03 12:56:33 -02:00
StrikerX3 9f0baa2ef0 Reduce log verbosity 2018-12-03 12:56:12 -02:00
StrikerX3 e1c24c52b9 Sync OHCI code up to Cxbx-R commit 169806b2
This is the latest OHCI related code. Nothing related to SDL2 was ported. Needs major improvements.
2018-12-03 01:58:23 -02:00
StrikerX3 b81de821a9 HostBridgeDevice::PCIMMIORead: zero out values 2018-12-02 23:45:03 -02:00
StrikerX3 e1540cb2d4 Allow expanding RAM to 128 MiB on retail systems
This allows modified BIOSes to use the extra RAM
2018-12-02 23:44:36 -02:00
StrikerX3 931ed595e0 Fix SMC revision retrieval 2018-12-02 23:02:03 -02:00
StrikerX3 8e9539f8a9 Refactored CPU modules
Moved eveything related to modules to a new namespace: openxbox::modules. Likewise, all CPU module source code now belongs to the openxbox::modules::cpu namespace.

CPU code has been moved to openxbox::cpu.

CPU module capabilities are now exported by libraries. Users can check for optional features.
2018-12-02 21:53:50 -02:00
StrikerX3 8015b4a1d7 Remove unused label 2018-12-02 21:48:28 -02:00
StrikerX3 664f3b9ec9 Implemented status codes for CPU modules
Added methods to read/write registers in bulk
Made CPU single stepping an optional operation
2018-12-02 19:21:44 -02:00
StrikerX3 f53bcee8cd Use proper status codes for initialization operations 2018-12-02 17:06:10 -02:00
StrikerX3 3525d85329 Reorganized initialization and cleanup code
With this, using the Xbox class is much easier and less error-prone.

Also removed XBE related code since we can't load an XBE into the guest just yet
2018-12-02 16:40:13 -02:00
StrikerX3 e9100ca189 Preinitialize settings within Xbox
Settings can now be modified by getting a pointer to the OpenXBOXSettings struct embedded in the Xbox class
2018-12-02 16:22:16 -02:00
StrikerX3 c7f61099c9 Improved/simplified interrupt handling
Will no longer skip interrupts, but runs the risk of overloading the CPU with interrupt work or creating a long queue of outstanding interrupt requests
2018-12-02 16:20:55 -02:00
StrikerX3 090755d21d Make dumping stack and disassembly on exit optional 2018-12-02 16:01:30 -02:00
StrikerX3 de834a3438 Clarify kernel detection message
Previously it would seem that the emulator was extracting and decrypting the kernel itself, which is not the case
2018-12-02 15:43:49 -02:00
StrikerX3 5df763cfa7 Extract and log kernel version 2018-12-02 15:40:19 -02:00
StrikerX3 da92a7f38f Add option to stop emulation on bug checks
This will only work on original or modified Microsoft kernels
2018-12-02 15:28:16 -02:00
StrikerX3 30c0a1204c Always log fatal errors 2018-12-02 15:06:31 -02:00
StrikerX3 55bdef212b Configurable SMC fatal error code handling
One toggle enables fatal error logging, the other causes the emulator to stop when a fatal error is detected
2018-12-02 15:04:30 -02:00
StrikerX3 68f388a219 Reduce log clutter 2018-12-02 15:03:32 -02:00
StrikerX3 810b55a984 Allow Super I/O to be enabled on retail systems
Some modified BIOSes run on retail systems and include the kernel debugger that uses the serial port for communication. Having this as an option is very useful, as specifying a debug kit modifies hardware in a way that might be incompatible with those BIOSes.

The Super I/O hardware is always enabled on debug kits.
2018-12-02 14:52:07 -02:00
StrikerX3 9c24a77856 SMBus: handle word reads/writes correctly 2018-12-02 14:41:15 -02:00
StrikerX3 a1adbaad4a Fix NVAPU initialization 2018-12-02 14:40:57 -02:00
StrikerX3 e10b25cd02 Start fixing SMBus 2018-12-02 14:27:26 -02:00
StrikerX3 4d8d77451c Parse LED sequences correctly
Don't stop emulation when a fatal error occurs (for now)
2018-12-02 13:57:34 -02:00
StrikerX3 d35fd70a2f Parse fatal error codes sent to the SMC
Stop emulation upon hitting a fatal error

Fix kernel executable header parsing; should consistently find the kernel thunk table now
2018-12-02 12:57:06 -02:00
StrikerX3 a74ac1d986 MCPX ROM should only replace the last 512 bytes of x86 address space 2018-12-02 10:38:48 -02:00
StrikerX3 00b5e62d08 Replicate ROM even if MCPX is not enabled 2018-12-02 02:12:12 -02:00
StrikerX3 e047a6c9bb Let the LPC device handle ROM
When the LPC PCI configuration is changed to disable the MCPX ROM, it will restore the original BIOS image automatically
2018-12-02 01:53:09 -02:00
StrikerX3 19a2ca6870 Move IOMapper to common module 2018-12-02 01:50:09 -02:00
StrikerX3 04bcf0970b Include util.h in precompiled header 2018-12-02 01:49:51 -02:00
StrikerX3 22ab117688 Fix small typo 2018-12-02 01:49:31 -02:00
StrikerX3 7920ed9431 IDE controller PCI BAR for I/O is 4, not 0 2018-12-01 18:58:11 -02:00
StrikerX3 df1fb0680f Should not check PCI_COMMAND when mapping I/O 2018-12-01 18:57:39 -02:00
StrikerX3 84f770ece0 Properly initialize NV2A structs 2018-12-01 18:56:54 -02:00
StrikerX3 4d7ee3cf0d Properly initialize NV2A structs 2018-12-01 18:56:34 -02:00
StrikerX3 5113f68040 Add support for guest breakpoints 2018-12-01 17:00:38 -02:00