Commit Graph

2522 Commits

Author SHA1 Message Date
Volker Ruppert
d22cdbdbf7 Some work on the bxhub utility.
- Added DNS service support for the server "vnet" and connected clients.
- Added command line option "-loglev=" to control whether or not there is
  BX_ERROR, BX_INFO or BX_DEBUG output. Default value is 1 (BX_ERROR only).
2017-06-17 12:40:13 +00:00
Volker Ruppert
2ae5fd563e Added destructors to some networking modules and call fclose() there for the
case the logging feature is enabled.
2017-06-16 08:27:55 +00:00
Volker Ruppert
bdd8875692 Reverted BX_THREAD_KILL() changes in the lowlevel sound code. Now using control
variables again to let the threads end normally. Re-implenented the method
closewaveoutput() for some modules, move the destructor code to it and call it
after leaving the mixer thread. This fixes a deadlock in the "soundwin" module
if Bochs is compiled with plugin support.
2017-06-02 16:56:58 +00:00
Volker Ruppert
726e39f854 Some work on the USB device plugin code.
- usb_common: init_device() now splits device name and primary option before
  detecting device type.
- usb_hub: now completely handle port option in constructor.
- plugin.h: removed obsolete defines.
2017-06-01 20:04:10 +00:00
Volker Ruppert
1de56aa05e Fixed plugins case (unloading module). 2017-05-28 08:45:23 +00:00
Volker Ruppert
bd1eb0f862 Rewrite of the USB devices plugin code similar to the network driver code.
- Removed "pseudo device plugin" containing common code and all connectable
  USB devices.
- Moved USB device base class and module handling to the Bochs core.
  Now loading USB device plugins in usb_common.cc.
- Created separate plugins for each USB device implementation.
- Modified Bochs plugin system to support new plugin type PLUGTYPE_USBDEV.
- Added entries for the non-plugin case similar to the network and sound stuff.
2017-05-28 08:13:06 +00:00
Volker Ruppert
431e9671a6 Code cleanup: removed unused definitions, functions and statistics code not
required for the emulation.
2017-05-21 18:30:25 +00:00
Volker Ruppert
5db2596317 The resampler and mixer threads are now stopped with BX_THREAD_KILL(). 2017-05-21 15:08:20 +00:00
Volker Ruppert
c160fd4830 Bochs thread handling improvements:
- Modified win32 thread macros to use the handle instead of the id.
- Added new macro BX_THREAD_KILL to terminate threads.
Voodoo thread changes:
- Let the cmdfifo_thread sleep while the CMDFIFO is disabled.
- Kill the cmdfifo_thread in destructor and removed old thread control code.
2017-05-18 18:34:00 +00:00
Volker Ruppert
495a8afeac Voodoo2 bitBLT: optimized SGRAM fill code a little bit. 2017-05-17 21:21:53 +00:00
Volker Ruppert
9912c99fd2 Continued work on Voodoo2 support (some demos now working).
- Added capability to save/restore float type values in paramtree / siminterface.
- Added Voodoo2 triangle generator data to save/restore list.
- Implemented bitBLT function "SGRAM fill".
- Minor other changes and cleanups.
- TODO: remaining bitBLT functions, thread handling improvements.
2017-05-16 20:37:01 +00:00
Volker Ruppert
9a705a3369 Fixed Voodoo2 CMDFIFO write handling (check address range first). 2017-05-15 20:55:49 +00:00
Volker Ruppert
da489b91ce Implemented CMDFIFO type 3 data support using some pieces of code from file
voodoo.h.txt which was a part of the original voodoo patch for DOSBox.
Some Voodoo2 specific parts were not integrated in the main patch file. I guess
they have been removed since Voodoo2 support was incomplete (2D stuff missing).
TODO: Voodoo2 2D support (bitblt engine), more testing, code cleanup...
2017-05-15 19:15:55 +00:00
Volker Ruppert
6265976a2c Some work on the Voodoo2 CMDFIFO support.
- Added CMDFIFO thread similar to the sound output thread.
- split register write function in 2 functions: register_w_common() handles
  the CMDFIFO writes and valid registers in CMDFIFO mode. It forwards write
  accesses to other registers to register_w() (Voodoo1 and non-CMDFIFO mode).
  The CMDFIFO thread also calls register_w() when processing data.
- The CMDFIFO thread processes all data, but it does not yet execute type 3
  requests (extended triangle generator missing).
- TODO #1: implement Voodoo2 specific triangle functions (for CMDFIFO).
- TODO #2: implement 2D bitblt engine.
2017-05-14 15:53:29 +00:00
Volker Ruppert
19f6cbc519 Continued preparing Voodoo2 CMDFIFO support.
- Zero out voodoo device state in init().
- Added the CMDFIFO state to save/restore list.
- Added CMDFIFO register handling in read/write functions.
- Added new function cmdfifo_put().
- TODO: CMDFIFO thread.
2017-05-13 11:52:49 +00:00
Volker Ruppert
a575b4aa2f Some work on the Voodoo2 CMDFIFO code.
- Fixed normal register access in CMDFIFO mode.
- Implemented cmdFifoBaseAddr register behaviour.
- Write CMDFIFO data to FBI memory (has no effect yet).
- Changed some log messages to BX_DEBUG.
- Report unimplemented Voodoo2 registers.
- TODO: Add FIFO thread to process the CMDFIFO data.
2017-05-09 19:18:58 +00:00
Volker Ruppert
e956100a60 Fixed possible segfault in win32 gui when switching back from Voodoo to VBE or
Cirrus mode. Set font height to 0 in graphics modes and fixed argument order.
2017-05-07 14:52:37 +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
78ff38fcf3 Fixed check for unimplemented CMDFIFO and return for now if write would be
valid. The hRetrace value can be set now, since Bochs no longer crashes.
TODO: Implement enough of the FIFO stuff to make the Win9x driver for the
Voodoo2 work.
2017-05-06 10:07:28 +00:00
Volker Ruppert
8b96faf99e Some work on the timing code of the Bochs display adapters.
- Voodoo: Use the VGA/Cirrus timers to drive the gui screen update.
  The vertical retrace emulation is still driven by a separate timer.
- VGA/Cirrus: Since we are using the virtual timer, we also have to read
  time_usec() from it.
- vgacore: removed unused timer methods.
2017-05-01 11:54:12 +00:00
Volker Ruppert
73c914a7f6 - Some work on the Voodoo Graphics emulation (Voodoo2 specific)
- prepared hRetrace value implementation (cannot be enabled yet, since the
    driver passes this test and gets confused in next stage (segfault).
  - Detect CMDFIFO access (not present yet).
  - Report disabling Voodoo graphics mode.
  - TODO #1: Fix Voodoo2 to make it usable.
  - TODO #2: Split update code and drive gui screen updates from the VGA timer
    (finally remove new realtime option again).
2017-05-01 09:11:12 +00:00
Volker Ruppert
d462e52a9d Implemented 'realtime' option for the Voodoo update timer similar to the VGA
realtime option (enabled by default).
2017-04-30 09:07:25 +00:00
Volker Ruppert
904984e795 Voodoo code cleanup (removed unused / disabled stuff). 2017-04-29 22:19:29 +00:00
Volker Ruppert
a7529c1e75 - Some work on the Voodoo Graphics emulation
- Since we are using the virtual timer, so we have to read time_usec()
    from it, too (TODO: realtime mode is hardcoded, maybe add an option).
  - Voodoo1 and Voodoo2 have different timing register widths.
  - Fixed vertical retrace value returned by get_retrace().
  - Prepared separate hvRetrace register (TODO: hRetrace).
2017-04-29 10:25:57 +00:00
Volker Ruppert
f4bfb6353f - Some work on the Voodoo Graphics emulation
- Store the Voodoo model in structure bx_voodoo_t.
  - The PCI initEnable register of the Voodoo2 model has a read-only secondary
    revision ID in bits 12..15. Now the Voodoo2 is correctly detected by the
    Windows driver, but display is not yet working (blank screen).
  - Reset now disables VGA override.
- PCI: Moved PCI device base class methods to the end of file devices.cc and
  re-define LOG_THIS to use the correct log module and prefix.
2017-04-28 18:45:45 +00:00
Volker Ruppert
915746a1fd Fixed slirp user-mode networking support on Cygwin 64-bit.
- Enabled Winsock2 usage and define _WIN32 symbol for Cygwin (both 32 and 64 bit).
- Changed include order in some files to resolve conflicts.
- Modified some data types to fix errors and warnings.
- Added workarounds for the incorrectly defined symbols FIONBIO, FIONREAD and
  EWOULDBLOCK.
- Verified slirp usability with Cygwin 32-bit, MinGW/MSYS and MSVC builds of
  Bochs. Other ports should not be affected.
2017-04-23 08:38:16 +00:00
Volker Ruppert
1ffac6a461 Moved method release_keys() to the common devices code to make sure this
feature also affects the removable (USB) keyboard.
2017-04-22 15:32:07 +00:00
Volker Ruppert
ec03c4bb53 Fixes in networking modules for 64-bit Cygwin.
- socket: Define the FIONBIO workaround for 64-bit Cygwin only.
- slirp: Don't mix usage of WIN32 and _WIN32 definitions.
- TODO: The slirp module still fails at UDP socket creation when Bochs is
  compiled in Cygwin64.
2017-04-21 21:07:52 +00:00
Volker Ruppert
89ed58114b Fixed compilation with DEBUG symbol defined. 2017-04-21 15:28:25 +00:00
Volker Ruppert
068795a73f Fixes in networking modules for 64-bit Cygwin.
- slirp: Increment IP packet ID outside of htons() to avoid undefined behaviour.
- socket: Workaround for a bug in the w32api code that generates a constant
  with wrong value. Setting up our own FIONBIO fixes the panic.
- TODO: The slirp module still fails when Bochs is compiled in Cygwin64.
2017-04-20 18:51:18 +00:00
Volker Ruppert
78cce73f8a Fixed error handling on Windows (avoid flooding log file with useless messages). 2017-04-19 21:03:53 +00:00
Stanislav Shwartsman
cfecb7c969 fixed compilation err in cygwin 2017-04-19 18:30:02 +00:00
Volker Ruppert
2fb6263102 Compilation fixes for Cygwin.
NOTE: networking still fails when compiled with Cygwin ('socket' mode fails
to set up non-blocking i/o / 'slirp' doesn't complain, but fails to connect
the internet).
2017-04-18 20:45:28 +00:00
Stanislav Shwartsman
2cae01edea better way of fixing shift of 1 by 64-bit to avoid integer overflow 2017-04-17 20:38:18 +00:00
Volker Ruppert
7f2191c117 Fixed MSVC warnings. 2017-04-17 19:56:41 +00:00
Stanislav Shwartsman
0702901377 fixed gcc specific ULL usage in hpet code 2017-04-17 18:44:16 +00:00
Volker Ruppert
e36b3175d1 Missed the new HPET files. 2017-04-17 07:31:08 +00:00
Volker Ruppert
1d27d67ccd Added initial version of the High Precision Event Timer (HPET) ported from Qemu.
- Created framework based on our I/O APIC code and ported HPET core from Qemu
  with some required changes for the Bochs timer and IRQ handling.
- Enabled HPET-specific code in the ACPI and rombios32 sources and generated
  new ACPI table with iasl.
- The HPET device plugin is now always loaded if the i440FX chipset is selected
  (same as ACPI). We have to rethink this when we have implemented a more
  modern chipset.
- TODO: Rewrite of the virtual timer code for nanosecond support to make the
  realtime synchronization possible with HPET.
2017-04-17 07:26:00 +00:00
Volker Ruppert
89654a4beb Prepared devices and timer code for HPET support
- PIT / CMOS: added methods to control IRQ generation (for HPET legacy mode).
- Added method for activating timer with nanosecond value.
- Removed unused declaration in the keyboard code.
- TODO: virtual timer code also needs to handle nanosecond values.
2017-04-15 20:31:07 +00:00
Volker Ruppert
73bcd4f8ca Added method to convert cpu ticks to nanoseconds (required for HPET).
I/O APIC: no need to call reset() in init().
2017-04-14 19:35:21 +00:00
Volker Ruppert
ed92dc4dfd Code cleanup: We don't need to copy data here. 2017-04-02 14:01:40 +00:00
Volker Ruppert
f7b1d77136 Fixed keypad event reporting.
FIXME: Keypad mouse function fails (cannot enable it as removable mouse yet).
2017-04-02 08:47:14 +00:00
Volker Ruppert
bd77824db6 Store configuration and interface values in the USB device object. 2017-04-01 10:35:38 +00:00
Volker Ruppert
e023b5896f Partial rewrite of the optional keyboard handling. Now the BX_KEY_* events are
directly sent to the optional keyboard (USB keypad). It is now independent
from the legacy keyboard and the check for supported keys is simplified. The
legacy keyboard still receives the unhandled key event, but now sent from the
common devices code.
2017-03-31 21:32:58 +00:00
Volker Ruppert
c897ffa619 Cleanups in the Bochs system timer code
- Now using macro DEV_register_timer() in all devices and lowlevel modules.
- Removed unused timer stuff from the plugin.cc/.h code.
2017-03-30 18:08:15 +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
76b54ecb61 Renamed bx_pci_device_stub_c to bx_pci_device_c and derive it now from class
bx_devmodel_c. The early version of the combined vga / svga_cirrus code
required the now obsolete implementation. Some related cleanups in the
devices code.
2017-03-26 08:09:28 +00:00
Volker Ruppert
880564f6ee Revoved obsolete macros and device stub methods. 2017-03-25 15:23:29 +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
f1e90c93b1 Fixed incorrect PAM setup (caused recent SeaBIOS to fail). 2017-03-23 22:44:20 +00:00
Volker Ruppert
f0afd30a9a Fixed Cirrus VGA PCI save/restore when a standard VGA mode is active. The PCI
memory setup doesn't depend on the mode and must always be done after restore.
2017-03-22 21:24:30 +00:00
Volker Ruppert
df6adaaf1f Added symbol VSIDE in the MSVC workspace files and and the manifest section
of win32res.rc to compile Bochs correctly with both IDE and nmake.
Fixed MSVC warnings in some devices.
2017-03-19 12:22:27 +00:00
Volker Ruppert
a24041d58a Updated devices list. 2017-03-18 09:40:20 +00:00
Stanislav Shwartsman
c24d5bfa94 fixed warning (and also potential bug when >4G of mem is emulated) for USB code 2017-03-18 07:26:26 +00:00
Volker Ruppert
29e9b54cfd Added dummy waveout class to make sure that resampling and mixing features
are not used. It also fixes a possible crash in the speaker code.
2017-03-17 23:09:18 +00:00
Volker Ruppert
eeec43d811 Implemented self-registering static objects in the lowlevel sound code similar
to the network module handling. Now the 'dummy' sound driver can be a real
plugin, too.
2017-03-14 18:21:05 +00:00
Volker Ruppert
18e138b0b4 Fixes and improvements for the network plugins changes in previous commit.
- In "non-plugin" mode loading and unloading network module is not necessary.
  Now enabled loading for the plugin mode only and removed unloading function
  for that case. The "pseudo plugin" entries of the dummy entry points are
  necessary to make sure the self-registering network driver objects are not
  optimized out.
- slirp / vnet: Since the plugin init function is not called in non-plugin
  mode, revert the instance count init change.
- Fixed a makefile dependecy.
- TODO: Implement self-registering objects in the sound driver code.
2017-03-12 20:26:42 +00:00
Volker Ruppert
758f4de4d4 Rewrite of the network driver plugin code.
- Removed "pseudo device plugin" containing common code and specific drivers.
- Moved network module base classes and module handling to the Bochs core.
  Now loading network driver plugins in netmod.cc.
- Moved shared networking code used by the 'vnet' driver and 'bxhub' from
  netmod.cc/.h to new files netutil.cc/.h.
- Created separate plugins for each network driver implementation.
- Modified Bochs plugin system to support new plugin type PLUGTYPE_NETWORK.
2017-03-12 07:48:08 +00:00
Volker Ruppert
d73284442f Updated makefile dependencies. 2017-03-10 19:01:11 +00:00
Stanislav Shwartsman
be235c1809 fixed compilation err under cygwin 2017-03-09 21:29:21 +00:00
Volker Ruppert
30a20ba50f Fixed compilation errors on Windows. 2017-03-08 22:09:50 +00:00
Volker Ruppert
a037c74071 Added support for connecting the 'bxhub' utility running on another machine.
The format of the 'ethdev' string must be 'host:port' to use this feature.
Using the port number only for connecting 'bxhub' on the same machine is still
supported.
2017-03-07 19:20:35 +00:00
Volker Ruppert
ffb9ef3476 For each WSAStartup() we have to call WSACleanup() on exit. 2017-03-06 21:30:05 +00:00
Volker Ruppert
a198c01aa9 Some changes in the serial port mode handling.
- Small changes to avoid crash after failure.
- Several cleanups in the socket mode.
- Fixed reporting active mode after init is done.
- Reporting sent/received byte with BX_DEBUG.
2017-03-05 12:45:45 +00:00
Volker Ruppert
c756fed13e Fixed and simplified default IP address generation. 2017-03-04 13:32:41 +00:00
Volker Ruppert
e08024f6a1 Some work on the networking modules and documentation.
- The 'vnet' module now uses the 'script' parameter for an alternative log
  file name.
- Renamed log file names in some networking modules (replaced 'ne2k' by a name
  related to the module name).
- Documentation updates (networking stuff and cmosimage).
2017-03-04 10:26:22 +00:00
Volker Ruppert
112e9016c2 Some changes in bxhub and related code.
- Increase maximum number of Bochs client sessions to 6.
- Define bx_devmodel_c to 'void' for the bxhub case to simplify netmod code.
- Minor cleanups in bxhub and related vnet code.
2017-03-03 09:56:18 +00:00
Volker Ruppert
00e140f626 Minor IOAPIC changes.
- According to the specs masked edge-sensitive IRQs are not held pending.
- Print BX_DEBUG message in set_irq_level() only in case of level change to
  avoid flooding log file.
2017-03-03 09:06:47 +00:00
Volker Ruppert
06511be14d Added support for up to 4 connections to Bochs sessions (same machine only). 2017-03-02 10:21:14 +00:00
Volker Ruppert
0011092ddb Some work on the eth_vnet and bxhub code to reduce code duplication. Moved some
shared functions to netmod.cc and modified ARP, IPv4 and ICMP code.
2017-03-01 16:53:57 +00:00
Volker Ruppert
b25d050676 Some changes in the socket networking module for Windows compatibility.
- eth_socket.cc: Added missing winsock init.
- bxhub.cc: Added missing CDECL macro to the signal handler.
- Added some definitions for non-Windows platforms similar to the serial and
  rfb code.
2017-02-28 16:52:15 +00:00
Volker Ruppert
027b3ffd41 Some work on the 'socket' networking module.
- bxhub.cc: Put all client data in a structure and added send_packet() function.
- bxhub.cc: Added SVN ID line.
- netmod.cc: Changed some DHCP messages to BX_DEBUG.
- eth_socket.cc: Minor cleanups.
2017-02-28 10:18:15 +00:00
Volker Ruppert
d6166344eb Added ethernet module 'socket'. designed to connect two Bochs instances with
external program 'bxhub' (simulating a two port ethernet hub). It is based on
an old SF patch and it has been updated and extended:
- Windows support (tested with MinGW/MSYS and MSVC nmake).
- Command line arguments for 'bxhub' (base port number, MAC address, TFTP).
- Added support for DHCP, TFTP, ARP and ICMP echo (ping). It uses parts of the
  code for the 'vnet' module with some additions from the former "slirp backend".
- TODO: code cleanup to reduce duplication, rewrite of the networking plugins
  stuff similar to the work done with the sound drivers.
2017-02-27 22:26:43 +00:00
Volker Ruppert
5366be7030 USB HID devices need to support "clear EP halt" (tested with Win98SE). 2017-02-24 20:19:00 +00:00
Volker Ruppert
0456c1034f Rewrite of the "no-plugins" code for loading/unloading gui, optional and sound
plugins. Now the plugin type is stored in the structure, so we need only one
array and one load function for plugins of these types.
2017-02-24 19:45:23 +00:00
Volker Ruppert
d501190b73 Minor cleanups in the common sound driver code. 2017-02-23 16:53:17 +00:00
Volker Ruppert
449c8ae620 Some more fixes in the new sound plugins code.
- Builtin sound driver plugin support should depend on BX_SUPPORT_SOUNDLOW.
- Added some symbols required for the MSVC plugin of sound driver "file".
- Clean up threads and audio buffers only when shutting down the primary sound
  driver (pcm_callback_id >= 0). Fixes crash on exit with wavemode 3.
2017-02-21 21:12:17 +00:00
Volker Ruppert
8310d4f448 Fixed sound plugins support for MSVC
- Added special symbols required for building MSVC plugin DLLs.
- Updated plugin DLL list in makefile.
2017-02-20 22:19:44 +00:00
Volker Ruppert
cd90506fb0 Forgot to remove renamed files. 2017-02-20 18:24:35 +00:00
Volker Ruppert
60d24943c6 Rewrite of the sound driver plugin code.
- Renamed OSS sound driver files from soundlnx.cc/.h to soundoss.cc/.h.
- Removed "pseudo device plugin" containing common code and specific drivers.
- Moved common sound code, base classes of sound drivers and the dummy driver
  to the Bochs core. Now loading sound driver plugins in soundmod.cc.
- Created separate plugins for the platform/library specific drivers and the
  "file" driver.
- Modified Bochs plugin system to support now plugin type PLUGTYPE_SOUND.
2017-02-20 18:21:19 +00:00
Volker Ruppert
4502478b50 Changed a lot of malloc() / free() calls to C++ style new / delete. 2017-02-18 11:13:56 +00:00
Volker Ruppert
a53b99f5e1 Implemented Bochs BIOS option "fastboot" for skipping the boot menu delay.
Prepared "biosdetect" option in the harddrv code.
TODO #1: Add support for a comma-separated list of BIOS options.
TODO #2: Implement support for at least "biosdetect=none" in the Bochs BIOS.
2017-02-16 21:43:52 +00:00
Volker Ruppert
90dc39eda7 Abort "format track" command if cylinder is out of range to avoid resizing
floppy disk image.
2017-02-15 22:27:34 +00:00
Volker Ruppert
72b2de2799 Clear DRQ line or NDMA mode bit if write command fails due to write protected
media (fixes SF bug #1338).
2017-02-10 21:28:05 +00:00
Volker Ruppert
f971dccddb Implemented SDL2 "wavein" service (Audio capture support is new in SDL 2.0.5
and does not yet work on all platforms).
2017-02-08 18:48:49 +00:00
Volker Ruppert
0b47bdd416 Fixed compilation on MSVC (define symbol O_ACCMODE if necessary). 2017-02-07 22:32:30 +00:00
Volker Ruppert
69dcf1c253 Fixed display in 8 bpp modes with doublescan enabled (fixes "Doom" on Win95). 2017-02-07 17:02:52 +00:00
Volker Ruppert
f844e846b7 Added PCM output data resampling in a separate thread. The resampler requires
either libsamplerate or the SoX resampler library installed. If not installed,
the data is only copied to the output buffer and sample rate of the output
driver is changed similar to legacy code. Related changes:
- Added check for libsamplerate or SoX resampler header files in configure
  script.
- Added functions for converting source format to float (requied by resampler)
  and float to output format.
- Added support for float type data in the audio buffer code. Buffer chain #0
  receives float data from sendwavepacket() and buffer #1 receives data for
  mixing and output in format "16-bit signed little endian stereo".
- ALSA: Disable builtin resampling feature if resampler is present to avoid
  doing it twice.
2017-02-05 08:33:03 +00:00
Volker Ruppert
59c828f3d3 Updated devices tree. 2017-02-01 22:03:38 +00:00
Volker Ruppert
3de865c753 Initialize 'pathname' pointer with NULL to avoid crash. 2017-01-30 22:09:13 +00:00
Volker Ruppert
7fd9194d81 Implemented lock mechanism for hard disk images (fixes SF bug #605).
- Create a file with image name plus extension ".lock" if an image is opened
  in read/write mode. This file will be deleted after closing the image.
- Check for a lock file before opening an image and fail if it exists.
- Check for a lock file before creating a undoable/volatile redolog file and
  fail if it exists.
2017-01-30 19:08:37 +00:00
Volker Ruppert
124f521797 Added support for changing the USB printer output file at runtime. 2017-01-29 08:48:08 +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
453991c437 Try opening output file only once to avoid flooding log file. 2017-01-27 16:53:59 +00:00
Volker Ruppert
ccdcb9cd1b Serial 'file' mode: added support for changing output file at runtime. 2017-01-27 16:20:04 +00:00
Volker Ruppert
c1c158c0a2 Added support for changing output file at runtime.
TODO: Do the same for the serial port 'file' mode and the USB printer.
2017-01-26 20:23:13 +00:00
Volker Ruppert
f59eaa2602 Simplified immediate shutdown code by using BX_FATAL. 2017-01-24 21:52:19 +00:00
Volker Ruppert
d0fbfb7d92 Checking the presence of the ACPI plugin makes the error message work again. 2017-01-15 13:31:11 +00:00
Volker Ruppert
400704d038 Added macro BX_FATAL() that works like BX_PANIC(), but with hardcoded action
"fatal". It can be used for all cases when there is no workaroud present to
avoid application crash or incorrect simulation behaviour. As a first step now
using BX_FATAL() for some data structure size and bit field errors.
2016-12-30 10:04:06 +00:00
Volker Ruppert
a3cbba7006 Some changes in the USB xHCI device
- The retry timer now calls process_transfer_ring() for enabled slots only.
- On USB3-only ports ignore device speed setup and try to enable super-speed mode.
2016-12-26 08:07:32 +00:00
Volker Ruppert
110a8d134e Implemented retry timer for NAK'ed transfers on xHCI. If a device returns NAK,
the transfer is retried with the given interval (stored in the endpoint context)
until it is successful. This fixes the HID device usage on xHCI.
2016-12-24 17:30:45 +00:00
Volker Ruppert
2712de0f19 Some changes in USB device descriptors depending on speed.
- Added support for HID devices in high-speed mode.
- Added separate descriptors for MSD devices in high-speed mode.
- NOTE: USB 2.0 values ported from Qemu / tested with USB EHCI.
2016-12-24 00:45:54 +00:00
Volker Ruppert
f828d3c23b Some changes in USB device speed setup
- Define minimum and maximum speed per device and panic if setting out of range.
- Allow speed value "full" for HID devices.
2016-12-21 18:35:38 +00:00
Volker Ruppert
e3e1665d6a Since all HCs now support asynchronous packet completion, we can enable the
async mode by default for all USB devices (used by disk, cdrom and floppy).
Whenever we implement a new HC model, it is still possible to set the async mode
to 0 until the async packet completion is working correctly.
2016-12-19 21:53:45 +00:00
Volker Ruppert
9cdf42d152 Asynchronous packet support implemented in the USB xHCI device. 2016-12-18 20:49:12 +00:00
Volker Ruppert
9377281239 Prepare async packet code for the usage with xHCI. 2016-12-17 08:14:04 +00:00
Volker Ruppert
c1eb6f9ff8 Fixed compilation error on MSVC. 2016-12-13 20:22:28 +00:00
Volker Ruppert
8edfb58c04 Updated makefile dependencies for USB EHCI (now complete and usable). 2016-12-11 18:54:01 +00:00
Volker Ruppert
35c61a8252 Create "Port Status Change" event only when the xHCI is initialized and running. 2016-12-11 18:27:12 +00:00
Volker Ruppert
cc1fa2bc61 Implemented USB remote wakeup mechanism in xHCI and the external hub. 2016-12-11 12:26:12 +00:00
Volker Ruppert
1f5222e096 Fixed string usage after delete. 2016-12-11 07:51:21 +00:00
Volker Ruppert
c3b608a3c9 Implemented USB remote wakeup mechanism.
- Extended USB callback definition to support different event types sent from
  device to HC. Currently we only have the two events "async completion" and
  "remote wakeup".
- Implemented event handlers in the UHCI, OHCI and EHCI. For the EHCI version
  we currently have no test case.
- The external USB hub now uses this feature at device connect/disconnect.
  Now the device change on the hub is correctly detected by the guest OS.
- TODO #1: remote wakeup and async completion for the xHCI.
- TODO #2: event handler for the external hub to make a USB device work on
  a chain of hubs.
- TODO #3: the event handler possibly could be used for the packet copy code.
2016-12-10 13:45:49 +00:00
Volker Ruppert
3fd323abc5 USB xHCI endianness and warning fixes
- use get_dwords() and put_dwords() from EHCI sources for reading / writing
  xHCI data structures as dword array. This fixes some endianness issues.
- simplified copying data from / to data structures since we can now use the
  dword array with the correct byte order directly.
- fixed all remaining "strict-aliasing" GCC warnings.
2016-12-04 18:54:51 +00:00
Volker Ruppert
91c58cffc3 Moved standard USB device request processing (set address, get status, get/set
configuration, get/set status, get descriptor) to the base class to reduce code
duplication. The device calls the common handle_control() method and then it
processes unhandled requests in it's specific code. (similar to Qemu).
2016-12-04 09:51:14 +00:00
Volker Ruppert
0d74aec48c Some more xHCI fixes by Ben Lunt (NAK handling, TRB type "No Op"). 2016-12-03 12:15:16 +00:00
Volker Ruppert
185ae80925 Some USB code changes by Ben Lunt
- USB xHCI NAK handling fix by Ben. Now openSUSE 13.2 boots without hang with
  hub connected to an xHCI port.
- Updated Ben's email address and year in some copyright headers.
2016-12-02 17:30:16 +00:00
Volker Ruppert
26af4f279b Modified xHCI packet handling similar to other HCs.
- Get rid of device_buffer and use packet init / cleanup functions.
- Read immediate data from memory location instead of possibly byte-swapped
  TRB parameter.
2016-11-29 19:19:05 +00:00
Volker Ruppert
a138f07fe1 Fixed OHCI ED / TD handling and removed hacks for async packet completion. 2016-11-27 18:16:06 +00:00
Volker Ruppert
a22e66ef13 Added support for multiple async packets on OHCI.
- Moved UHCI async packet functions to usb_common.h for using then on both
  UHCI and OHCI.
- Modified OHCI packet handling based on the UHCI implementation.
- Renamed EHCI helper function to avoid conflicts.
- TODO: async packet support on xHCI.
2016-11-27 12:18:37 +00:00
Volker Ruppert
ff3b20be1a Minor changes and comment additions in the EHCI emulation code.
- Added missing queue handling code for init, reset and device disconnect.
- Added EHCI status access methods for async and periodic state.
- Added a lot of comments (mostly from the original EHCI core code).
2016-11-27 09:19:55 +00:00
Volker Ruppert
ab69aae575 Zeroing out newly allocated structures fixes EHCI async packet support.
It has been tested successfully with USB disk in high speed mode.
2016-11-26 11:15:25 +00:00
Volker Ruppert
f6608938bf Some more small xHCI changes by Ben Lunt. 2016-11-25 13:15:27 +00:00
Volker Ruppert
1c8986f01f Return USB device status depending it's attributes.
- UFI/CBI floppy: bus-powered, no remote wakeup
- HID (mouse, tablet, keypad): bus-powered, remote wakeup
- MSD (disk, cdrom), printer: self-powered, no remote wakeup
TODO: Remote wakeup is not yet implemented. A device should be able to resume
it's upstream port if suspended.
2016-11-24 21:57:02 +00:00
Volker Ruppert
a5c2115d27 Two small xHCI changes by Ben Lunt. 2016-11-24 18:05:05 +00:00
Volker Ruppert
385ad83df3 Minor changes in the OHCI code.
- HcLSThreshold is writable, but it's usually not modified (same as Qemu).
- BX_ERROR should only occur on an attempt to change the number of ports.
- Don't register read-only items for save/restore.
2016-11-24 17:21:40 +00:00
Volker Ruppert
20e9d21fc7 Small changes in serial loopback mode
- The transmit FIFO is not used in loopback mode.
- Don't flood log file with error messages when Linux probes the FIFO.
2016-11-23 16:42:22 +00:00
Volker Ruppert
f82bb13f88 Added support for multiple async packets on UHCI (TODO: other HCs). 2016-11-22 18:06:44 +00:00
Volker Ruppert
666780dab5 Some work on the USB hub device emulation.
- Changed some device descriptor fields (using values from Qemu).
- Ported device reset code from Qemu.
- Check device speed setting on connect (only low/full speed supported yet).
- TODO: External hub doesn't work properly in some test cases (device change
  not detected by guest OS, openSUSE 13.2 hangs with hub on xHCI).
2016-11-20 20:39:32 +00:00
Volker Ruppert
72af99c372 Some more work on USB HID devices and related stuff
- Now really fixed NAK behaviour in UHCI.
- USB tablet now also returns NAK response when idle and there is no change.
2016-11-20 07:30:06 +00:00
Volker Ruppert
4660c7ad98 Some work on USB HID devices and related stuff
- USB mouse and keypad now return NAK response when idle and there is no change.
- Implemented HID commands for get/set idle duration.
- Fixed NAK behaviour in UHCI and OHCI.
TODO list: USB tablet should also return NAK (doesn't work yet), review xHCI for
the NAK behaviour, accurate implementation of the idle duration
2016-11-19 23:11:51 +00:00
Volker Ruppert
0192554c25 Started rewrite of USB packet handling required for full async packet support.
Step #1: Allocate buffer for data transfers dynamicly with the required size
(done in UHCI, OHCI and EHCI).
2016-11-18 21:27:43 +00:00
Volker Ruppert
de6ee1d7eb Added basic async packet support in the UHCI core. Only one async operation
is currently supported per hub at the same time (same as OHCI).
TODO #1: We should support at least one async operation per connected device.
TODO #2: Async packet support for EHCI and xHCI.
2016-11-16 16:49:57 +00:00
Volker Ruppert
21643ff419 Some work on the USB EHCI emulation
- added a hack to make EHCI work in Bochs, but without asynchronous packet
  support (tested with "high-speed" USB disk).
- added missing list for connected USB device state.
2016-11-13 20:57:57 +00:00
Volker Ruppert
b95ca006b8 Some work on the USB xHCI emulation
- fixed some of the endianness issues
- fixed some of the GCC warnings
- changed some BX_INFO to BX_DEBUG
- FIXME: non-bulk devices not yet working on xHCI. Linux guest hangs during boot
  when HID or hub device is connected.
2016-11-13 09:22:25 +00:00
Volker Ruppert
17b4e65bef The save/restore list for USB devices is now cleared by the device destructor
instead of the hub's remove_device() method. The external hub removes connected
devices before clearing it's own list. This fixes crash on exit when devices
are present on external hub.
2016-11-12 14:17:46 +00:00
Volker Ruppert
364bf9362c Changed handling of unsupported/invalid device speed setup. The UHCI core now
ignores connected high speed device (fixes panic with EHCI on guest OS init or
shutdown). The other HC's now panic and disconnect device if the user decides
to continue.
2016-11-11 16:11:52 +00:00
Volker Ruppert
6ba530e461 Ported most of the remaining EHCI methods to Bochs, including some ugly hacks.
Asynchronous transfers are not yet working properly (tested with USB disk device
in high speed mode). That's why the support for "speed:high" is still disabled.
Since we have no test case for the isosynchronous mode, I have not yet ported
the main code for it.
2016-11-07 21:57:56 +00:00
Volker Ruppert
5458e66f85 Added USB device method 'find_device' required for EHCI. No functional changes yet. 2016-08-20 14:20:07 +00:00
Volker Ruppert
cd68194269 Added Android host platform support to Bochs based on SF patch #534.
- added Android case to the configure script.
- renamed file memory.h to memory-bochs.h to fix conflict with NDK.
- fixed Android issues in some files.
2016-08-12 17:06:14 +00:00
Stanislav Shwartsman
7cf38247e4 fixed warnings and errors which pop up when compiling Bochs with TRUE bool as boolean type instead of Bit32u 2016-06-01 20:29:44 +00:00
Volker Ruppert
fc41b20dfe Applied current state of porting EHCI from Qemu. No functional changes yet. 2016-05-16 17:25:29 +00:00
Volker Ruppert
45232b1860 Added standard bus mouse support and inproved existing InPort mouse support
(Ben Lunt). Added new mouse type choice 'inport' for the existing one and changed
'bus' type to the new standard bus mouse,
2016-03-31 17:24:34 +00:00
Volker Ruppert
ce7afe050f Applied current state of porting EHCI from Qemu. No functional changes yet. 2016-02-09 17:11:59 +00:00
Volker Ruppert
60d5aaaacf Added QEMU queue macros (required for EHCI) as a separate file. Removed already
existing defines from the Slirp compatibility header.
2016-01-08 18:58:27 +00:00
Volker Ruppert
0ba744b9fe Started implementing USB EHCI support. The PCI and MMIO register behaviour is
almost implemented, the port owner handling and the UHCI companion controllers
are present. High speed devices are not yet supported, since the EHCI scheduler
code has not been written yet (e.g. porting from Qemu). Low and full speed
devices should be detected correctly and work after port ownership change to
UHCI. 6 ports are available and the bochsrc syntax is similar to other HCs.
2015-12-06 20:03:42 +00:00
Volker Ruppert
5e635a87bb Fixed IRQ sharing for multi-function PCI devices and removed workaround in the
UHCI core code.
2015-11-28 10:24:22 +00:00
Volker Ruppert
93f9584b1b Load USB core plugin before parsing bochsrc, since USB HC devices depend on
it's symbols. Unload this plugin in the devices init if unused.
TODO: Similar changes may be required for the networking and sound stuff.
2015-11-20 18:07:27 +00:00
Volker Ruppert
e19f28dad7 Call DEV_pci_set_irq() only if the IRQ level really changes. The Bochs IRQ
routing code is possibly buggy, since it can make multiple UHCI devices fail
in a multi-function device (like EHCI).
2015-11-12 21:45:44 +00:00
Volker Ruppert
2f94f55a82 Some work in the UHCI core for the usage as a companion controller of EHCI.
- added method to change port ownership.
- fixed UHCI reset and initialized device pointers.
- added symbol UHCI_FULL_DEBUG to reduce debug output if not set.
- renamed connection handling method.
2015-11-08 18:54:30 +00:00
Volker Ruppert
d455659bd1 Split the USB UHCI code in two parts: uhci_core.cc implements the device
emulation and usb_uhci.cc implements the setup for the PIIX3 chipset and the
runtime device change code. The UHCI core is required for the EHCI emulation,
since there can be multiple "companion" controllers for USB 1.1 device handling.
2015-11-05 21:20:54 +00:00