Commit Graph

78 Commits

Author SHA1 Message Date
Volker Ruppert
e34d017f60 Some fixes for compiling for WIN64 with MSVC.
- Added check in config.h whether or not Bochs is configured and compiled for
  the same target platform (WIN32 / WIN64).
- Fixed some warnings that occur in the MSVC WIN64 case.
2021-07-12 19:05:25 +00:00
Volker Ruppert
4dd5816108 Some changes in the Bochs plugins code.
- Changed variable type of the plugin_t "type" member from enum to Bit16u.
- Added support for returning device flags with the new mode PLUGIN_FLAGS in
  the plugin entry functions. It is currently only used for devices that can
  be connected to a PCI slot.
- Code cleanup in core device plugins: checking type no longer necessary.
- The "non-plugin" mode now also uses the "loadtype" member of plugin_t.

TODO: Change PCI slot options to bx_param_enum_c and build the choices list
using the new capabilities of the plugin API.
2021-02-26 20:37:49 +00:00
Volker Ruppert
0d425037df Improved plugin type detection at Bochs startup.
- Added special mode to all plugin entry functions that returns the plugin type.
- The plugins search function now temporarily loads all available plugins and
  reads the plugin type using the new mode PLUGIN_PROBE.
- Added "loadtype" to the plugin structure to store the type used for plugin
  loading (currently only the voodoo plugin provides two types).
2021-02-07 16:16:06 +00:00
Volker Ruppert
e0142872e9 Changed bx_bool to bool type in a bunch of devices. 2021-01-31 10:50:53 +00:00
Volker Ruppert
f9dfaf1cca Changed bx_bool to bool type in iodev.h and affected code. 2021-01-31 08:22:55 +00:00
Volker Ruppert
8db0a2b001 Replaced the plugin init / fini functions with one single function called
plugin_entry(). The additional boolean argument "init" is used to select the
requested action. The entry points still have unique names for compatibility
with the "non-plugin" compilation. Added macros for setting up these names
(e.g. PLUGIN_ENTRY_FOR_MODULE for device plugins).
2021-01-23 12:06:11 +00:00
Volker Ruppert
7412ebc07b Added new macros BX_DEBUG_PCI_READ and BX_DEBUG_PCI_WRITE to unify the debug
output of PCI config space handlers.
Banshee: some PCI register fixes.
2018-05-01 15:54:37 +00:00
Volker Ruppert
e7093e74d8 Started implementing the i440BX PCI/AGP chipset.
- Added new PCI chipset choice for the i440BX AGPset. Some basic work is done,
  but AGP support is not present yet.
- Added new class for the "virtual" PCI-to-PCI bridge that should manage the
  secondary bus (AGP). Since this device must appear with device number #1 at
  the primary bus, it was required to change the PCI device numbers for the
  i440BX case. Moved the PIIX4 module to device number #7. The presence of the
  PCI base address regions now depends on the header type as expected.
- Since the Bochs BIOS cannot handle the modified PCI device layout, all tests
  continued with an external BIOS designed for this chipset (GA-6BA_F1.bin).
  This BIOS requires additional changes in some devices.
- ACPI: Return value 0 for some status registers and the GPI registers.
- CMOS: Since the PIIX4 supports a 256 byte CMOS RAM, prepared support for it
  and enable it in case a 256 byte CMOS image is used.
- PCI: The device numbers for 4 slots starting at #8. The 5th slot could be
  used for AGP when available.
2018-02-24 18:04:36 +00:00
Stanislav Shwartsman
1e35e64ec6 fixed compilation warnings 2018-02-05 16:02:53 +00:00
Volker Ruppert
50c1370216 Some work on the PCI devices code.
- Added INT pin init to method init_pci_conf().
- Moved readonly register handling to the common PCI write handler.
- Moved IRQ line reporting to the common PCI write handler.
2018-02-04 18:17:28 +00:00
Volker Ruppert
87145baf61 Rewrite of the PCI base address (BAR) handling to reduce code duplication.
- Added new structure bx_pci_bar_t that contains all parameters related to the
  PCI BARs (type, size, address and r/w handlers).
- Added new methods init_bar_io() and init_bar_mem() to set up the new structure
  in the pci device init code.
- Added new method pci_write_handler_common() to handle writes to the normal
  BARs and the ROM BAR. Writes to other registers are forwarded to the device
  specific PCI write handlers. Removed BAR and ROM BAR handling from the
  specific code.
- Added new method pci_bar_change_notify() to execute specific code after BAR
  update (vga, ne2k).
- Moved normal BAR handling to method after_restore_pci_state().
- Store pointer to PCI device name in bx_pci_device_c and use it for i/o setup.
2018-02-04 09:41:50 +00:00
Volker Ruppert
eb89cdaea4 It is valid to set up the PRD size larger than the IDE transfer size. Fixed
busmaster DMA code to handle this case.
2017-05-07 07:47:08 +00:00
Volker Ruppert
4bbed47b5d THe ACPI device can use the base class pci_read_handler().
Minor other PCI code changes.
2017-03-27 19:38:37 +00:00
Volker Ruppert
d46a9b7205 Some work on the PCI devices code.
- Since the pci_read_handler() method is identical in most devices, move it
  to the base class to reduce code duplication. Only the 'pcidev' device has
  it's own implementation (NOTE: it is not maintained yet).
- Minor other fixes and cleanups in some PCI devices.
2017-03-24 19:57:25 +00:00
Volker Ruppert
458f747b48 Removed unused argc and argv parameters from plugin init functions. 2017-01-28 09:52:09 +00:00
Volker Ruppert
7e86e7956f Fixed PCI IDE controller DMA start (found with a recent Linux version:
"mode sense" command executed in DMA mode).
Updated output of "mode sense" page 0x2a (still reporting CD-ROM drive).
2015-05-05 20:10:43 +00:00
Stanislav Shwartsman
b5a603c8c7 fixed %d->%u format found by cppcheck (patch by Maxim Derbasov) 2015-01-25 21:24:13 +00:00
Volker Ruppert
f35b9b23c8 Bugfix: use memmove() if source and destination range can overlap (found with valgrind). 2014-12-14 18:53:16 +00:00
Volker Ruppert
773ac518b3 Fixed broken MSVC plugins support (many CDECL additions required)
TODO: check for remaining CDECL issues (hdimage mode 'dll') and update project files
2014-06-08 08:40:08 +00:00
Volker Ruppert
7cb5729365 Seek delay implemented for ATA/ATAPI DMA read commands
TODO: seek delay for write commands
2014-01-19 18:13:12 +00:00
Volker Ruppert
29d40bf9fe Added an optional device-specific Bit8u parameter to the timer structure.
A device can set it with setTimerParam() and read it in the timer handled using
triggeredTimerParam(). Simplified some timer handler by using these methods.
TODO: implement HD / CD seek timer
2014-01-17 18:25:13 +00:00
Volker Ruppert
c6dd095321 Added new method for the init of the readonly registers in the PCI config space
and cleaned up the PCI devices code.
2013-12-30 22:39:21 +00:00
Volker Ruppert
38addf037f PCI register behaviour fixes, updated messages and comments 2012-11-12 18:56:07 +00:00
Volker Ruppert
cc56245407 started implementing the i430FX chipset
- renamed config parameter "i440fx_support" to "enabled"
- new config parameter "chipset" added (current choices "i430FX" and "i440FX")
- don't load ACPI support if the i430FX chipset is selected
- select register values for the core PCI devices depending on the chipset
- USB UHCI must be connected to a PCI slot if the i430FX chipset is used
- rombios changes to make the i430FX chipset work
- TODO #1: implement limitation to 1 cpu and 128 MB RAM for the i430FX chipset
- TODO #2: verify register behaviour of both chipsets
2012-11-11 08:11:17 +00:00
Volker Ruppert
a2dd985aef - remove registered device state in destructor (fixes crash on Bochs exit with
MSVC plugins)
2012-08-19 08:16:20 +00:00
Volker Ruppert
de94b08a1a - class bx_list_c now contains a chained list of parameters. Removed the now
obsolete maxsize parameter from all lists.
2012-02-12 18:43:20 +00:00
Volker Ruppert
223fe998b3 - code for setting up log actions by device rewritten
- unknown module names now cause a panic
- added log function names to some more devices
- TODO: find a way to configure log actions by device in the config interface
  start menu (most of the devices do not exist at this point)
2011-12-30 11:13:37 +00:00
Stanislav Shwartsman
81f55b5be7 improved the fix for busmaster DMA transfers from device to memory done by Volker 2011-12-02 19:41:54 +00:00
Volker Ruppert
16bd4c6401 - added pci_base_address array to bx_pci_device_stub_c and use it in most of the PCI devices instead
of several base address variables (ne2k still uses base_address for both ISA and PCI)
2011-06-25 12:43:27 +00:00
Volker Ruppert
2137c8bd81 - moved pci_conf array as a protected member to the PCI device stub class (exists in all PCI devices) 2011-06-23 15:56:02 +00:00
Volker Ruppert
1df7a9131b Fixed possible buffer overflow causing segfault or memory corruption. The
buffers are not large enough for the maximum sector count in LBA48 mode. Now
resetting buffer pointers after processing a PRD (and move remaining data if
necessary). This should fix the SF bug items #3190970 and #3077616.
2011-03-06 20:51:52 +00:00
Stanislav Shwartsman
00981cd7a6 Adding Id and Rev property to all files 2011-02-24 22:05:47 +00:00
Stanislav Shwartsman
153d43520d change copyright to bochs project 2009-12-04 19:50:29 +00:00
Stanislav Shwartsman
da4722e257 optimize sr params 2009-10-16 18:29:45 +00:00
Volker Ruppert
e34262bc7d - fixed regression caused by SF patch #2812936
* buffer size must match the IDE specs to transfer max. 255 sectors
  * resetting buffer pointers during IDE command is invalid
2009-08-16 19:59:03 +00:00
Volker Ruppert
89f5147b06 - applied SF patch #2812936 by Derek
* reset buffer pointers properly to avoid overflow
  * resize buffers to match the PIIX/PIIX3 specs
2009-07-03 20:36:42 +00:00
Volker Ruppert
6a78f0d769 - removed extended debug output in some PCI config space read handlers
- small changes in some debug messages to make the log better readable
2009-04-22 18:37:06 +00:00
Volker Ruppert
def1553ab5 - removed a bunch of unnecessary io_len checks 2009-04-21 17:53:29 +00:00
Volker Ruppert
e5eac65b59 - removed wrong character from FSF address (converted invisible and useless
2-byte character)
- updated FSF address in some files
- added license to some files
2009-02-08 09:05:52 +00:00
Stanislav Shwartsman
dd03e043a3 Updated FSF address 2009-02-07 21:05:31 +00:00
Volker Ruppert
501952efdd - removed unused logfunctions member 'type' and related method 'settype()'
- updated FSF address in copyright
2009-01-10 11:30:20 +00:00
Volker Ruppert
00d404809b - reduce some more dependencies
- iodev.h already includes bochs.h
2009-01-03 08:55:00 +00:00
Stanislav Shwartsman
d56c3a18aa reduce include dependencies in iodev.h
Makefile.in in iodev folder have to be regerated !
2008-12-29 20:16:08 +00:00
Volker Ruppert
78197bae62 - fixed endianness bug (read 2 dwords instead of 1 qword) 2008-12-02 21:38:51 +00:00
Volker Ruppert
46265689aa - PACKET-DMA feature now supported by all ATAPI commands
* don't panic if byte count is zero in PACKET-DMA mode (the specs say that
    byte count is used for PIO modes. The behaviour in DMA mode is not
    mentioned, but seems to be ignored in that case.)
  * pci_ide: initialize sector size with the BM-DMA byte count (disk read
    commands will overwrite this value, some ATAPI commands are using the
    original one.)
  * non-disk-read ATAPI commands simply copy the buffer in DMA mode
2008-07-06 14:15:41 +00:00
Stanislav Shwartsman
8ea32b4279 Simplify physical memory access by devices 2008-06-11 20:59:50 +00:00
Stanislav Shwartsman
f5780a5f5c Hide some BX_MEM_C variables
Optimize resolve16 methods - by reducing their amount again - reduce chance for misspredictin
2008-05-01 20:08:37 +00:00
Stanislav Shwartsman
ae35b0276e white space cleanups and coding style changes 2008-01-26 22:24:03 +00:00
Stanislav Shwartsman
071c5c1a26 A lot of changes but everything is really trivial.
Make save/restore default feature, the configure option for save/restore removed from configure script and save/restore made available forever. All code now assume it is exists. Bochs save/restore tree previosly called "save_restore" renamed to "bochs" tree and it will be havily used everywhere, starting from save/restore and ending by various bochs debugger functions. I am going to rework debugger code to get rid of debug CPU access functions and use this "bochs" param tree instead
2007-09-28 19:52:08 +00:00
Stanislav Shwartsman
9d907b5f65 Try to specify everywhere the list size in bx_list_c constructor 2007-04-03 22:38:49 +00:00