From c12c8324dc0ce0a7a5038e0d0d6792cd2df836a4 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Fri, 4 Dec 2020 17:04:40 +0000 Subject: [PATCH] Added config parameter to set up advanced PCI options as comma-separated values. Now it is possible to disable ACPI or HPET in case the i440FX chipset is selected. --- bochs/.bochsrc | 38 +++++++++++++++++-------- bochs/CHANGES | 6 ++++ bochs/PARAM_TREE.txt | 1 + bochs/config.cc | 6 ++++ bochs/doc/docbook/user/user.dbk | 50 ++++++++++++++++++++++++--------- bochs/doc/man/bochsrc.5 | 44 +++++++++++++++++++++-------- bochs/iodev/devices.cc | 26 +++++++++++++++-- bochs/iodev/iodev.h | 4 +++ bochs/param_names.h | 1 + 9 files changed, 137 insertions(+), 39 deletions(-) diff --git a/bochs/.bochsrc b/bochs/.bochsrc index f0b952bd7..28c2f9550 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -538,19 +538,35 @@ mouse: enabled=0 #======================================================================= # PCI: -# This option controls the presence of a PCI chipset in Bochs. Currently it -# supports the i430FX, i440FX and i440BX chipsets. You can also specify the -# devices connected to PCI slots. Up to 5 slots are available. For these -# combined PCI/ISA devices assigning to slot is mandatory if you want to emulate -# the PCI model: cirrus, ne2k and pcivga. These PCI-only devices are also -# supported, but they are auto-assigned if you don't use the slot configuration: -# e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci and voodoo. -# All device models except the network devices ne2k and e1000 can be used only -# once in the slot configuration. In case of the i440BX chipset, slot #5 is the -# AGP slot. Currently only the 'voodoo' device can be assigned to AGP. +# This defines the parameters to set up the Bochs PCI emulation: +# +# ENABLED: +# If Bochs is compiled with PCI support, it is enabled by default. +# +# CHIPSET: +# Currently the chipsets i430FX, i440FX and i440BX (limited) are supported and +# the default is i440FX. +# +# SLOTx: +# It is possible to specify the devices connected to PCI slots. Up to 5 slots +# are available. For combined PCI/ISA devices assigning to slot is mandatory +# if the PCI model should be emulated (cirrus, ne2k and pcivga). Setting up +# slot for PCI-only devices is also supported, but they are auto-assigned if +# not specified (e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci, +# voodoo). All device models except the network devices ne2k and e1000 can be +# used only once in the slot configuration. In case of the i440BX chipset, the +# slot #5 is the AGP slot. Currently only the 'voodoo' device can be assigned +# to AGP. +# +# ADVOPTS: +# With the advanced PCI options it is possible to control the behaviour of the +# PCI chipset. These options can be specified as comma-separated values. +# By default the "Bochs i440FX" chipset enables the ACPI and HPET devices, but +# original i440FX doesn't support them. The options 'noacpi' and 'nohpet' make +# it possible to disable them. # # Example: -# pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k +# pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k, advopts=noacpi #======================================================================= pci: enabled=1, chipset=i440fx diff --git a/bochs/CHANGES b/bochs/CHANGES index abbd150fa..d0e57de3c 100644 --- a/bochs/CHANGES +++ b/bochs/CHANGES @@ -9,6 +9,9 @@ Changes after 2.6.11: - CPU/CPUDB - Bugfixes for CPU emulation correctness (CPUID/VMX initialization fixes to support Windows Hyper-V as guest in Bochs) +- Memory + - Improved BIOS write support by implementing Intel(tm) flash chip emulation. + - Bochs Debugger and Instrumentation - Add more symbol lookups to disasm methods @@ -30,6 +33,9 @@ Changes after 2.6.11: to VRAM are always valid. Fixes GRUB bootloader menu when using Bochs VBE. - DDC: Added "ddc" parameter to the "vga" option to make it possible either to disable the DDC feature or to read the monitor EDID from file. + - PCI (general) + - Added config parameter to set up advanced PCI options. Now it is possible + to disable ACPI or HPET in case the i440FX chipset is selected. - Sound - Added PC speaker volume control for the lowlevel sound support. diff --git a/bochs/PARAM_TREE.txt b/bochs/PARAM_TREE.txt index 90f168bdf..30d77c4a3 100644 --- a/bochs/PARAM_TREE.txt +++ b/bochs/PARAM_TREE.txt @@ -118,6 +118,7 @@ pci 3 4 5 + advopts pcidev vendor device diff --git a/bochs/config.cc b/bochs/config.cc index 624a9a9da..a897c9656 100644 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -889,6 +889,10 @@ void bx_init_options() "", BX_PATHNAME_LEN); deplist->add(devname); } + bx_param_string_c *advopts = new bx_param_string_c(pci, "advopts", "Advanced PCI Options", + "Set advanced PCI options", + "", BX_PATHNAME_LEN); + deplist->add(advopts); enabled->set_dependent_list(deplist); pci->set_options(pci->SHOW_PARENT); slot->set_options(slot->SHOW_PARENT); @@ -2853,6 +2857,8 @@ static int parse_line_formatted(const char *context, int num_params, char *param } else { BX_ERROR(("%s: unknown pci slot number ignored.", context)); } + } else if (!strncmp(params[i], "advopts=", 8)) { + SIM->get_param_string(BXPN_PCI_ADV_OPTS)->set(¶ms[i][8]); } else { PARSE_ERR(("%s: pci: unknown parameter '%s'.", context, params[i])); } diff --git a/bochs/doc/docbook/user/user.dbk b/bochs/doc/docbook/user/user.dbk index 6805db723..e53de6b7e 100644 --- a/bochs/doc/docbook/user/user.dbk +++ b/bochs/doc/docbook/user/user.dbk @@ -3985,22 +3985,44 @@ or 'f12'.
pci +This defines the parameters to set up the Bochs PCI emulation: + + Examples: pci: enabled=1, chipset=i440fx # default if compiled with PCI support - pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k + pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k, advopts=noacpi pci: enabled=1, chipset=i440bx, slot5=voodoo, slot1=e1000 -This option controls the presence of a PCI chipset in Bochs. Currently it -supports the i430FX, i440FX and i440BX chipsets. You can also specify the -devices connected to PCI slots. Up to 5 slots are available. For these -combined PCI/ISA devices assigning to slot is mandatory if you want to emulate -the PCI model: cirrus, ne2k and pcivga. These PCI-only devices are also -supported, but they are auto-assigned if you don't use the slot configuration: -e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci and voodoo. -All device models except the network devices ne2k and e1000 can be used only -once in the slot configuration. In case of the i440BX chipset, slot #5 is the -AGP slot. Currently only the 'voodoo' device can be assigned to AGP. + +enabled + +If Bochs is compiled with PCI support, it is enabled by default. + +chipset + +Currently the chipsets i430FX, i440FX and i440BX (limited) are supported and +the default is i440FX. + +slotX + +It is possible to specify the devices connected to PCI slots. Up to 5 slots +are available. For combined PCI/ISA devices assigning to slot is mandatory +if the PCI model should be emulated (cirrus, ne2k and pcivga). Setting up +slot for PCI-only devices is also supported, but they are auto-assigned if +not specified (e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci, +voodoo). All device models except the network devices ne2k and e1000 can be +used only once in the slot configuration. In case of the i440BX chipset, the +slot #5 is the AGP slot. Currently only the 'voodoo' device can be assigned +to AGP. + +advopts + +With the advanced PCI options it is possible to control the behaviour of the +PCI chipset. These options can be specified as comma-separated values. +By default the "Bochs i440FX" chipset enables the ACPI and HPET devices, but +original i440FX doesn't support them. The options 'noacpi' and 'nohpet' make +it possible to disable them.
@@ -4968,7 +4990,7 @@ Example: usb_ohci: enabled=1, port1=printer:printdata.bin This option controls the presence of the USB OHCI host controller with a -2-port hub. The portX parameter accepts the same device types with the same +2-port hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on OHCI. @@ -4980,7 +5002,7 @@ Example: usb_ehci: enabled=1, port1=tablet, options1="speed:high" This option controls the presence of the USB EHCI host controller with a -6-port hub. The portX parameter accepts the same device types with the same +6-port hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on EHCI. @@ -4992,7 +5014,7 @@ Example: usb_xhci: enabled=1, port1="disk:usbdisk.img" This option controls the presence of the USB xHCI host controller with a 4-port -hub. The portX parameter accepts the same device types with the same syntax as +hub. The portX parameter accepts the same device types with the same syntax as the UHCI controller (see the usb_uhci option). The optionsX parameter is also available on xHCI. NOTE: port 1 and 2 are USB3 and only support super-speed devices, but port 3 and 4 are USB2 and support speed diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index 53263ee24..0b3252c28 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -1,5 +1,5 @@ .\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com" -.TH bochsrc 5 "29 Nov 2020" "bochsrc" "The Bochs Project" +.TH bochsrc 5 "4 Dec 2020" "bochsrc" "The Bochs Project" .\"SKIP_SECTION" .SH NAME bochsrc \- Configuration file for Bochs. @@ -595,19 +595,39 @@ Examples: .TP .I "pci:" -This option controls the presence of a PCI chipset in Bochs. Currently it -supports the i430FX, i440FX and i440BX chipsets. You can also specify the -devices connected to PCI slots. Up to 5 slots are available. For these -combined PCI/ISA devices assigning to slot is mandatory if you want to emulate -the PCI model: cirrus, ne2k and pcivga. These PCI-only devices are also -supported, but they are auto-assigned if you don't use the slot configuration: -e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci and voodoo. -All device models except the network devices ne2k and e1000 can be used only -# once in the slot configuration. In case of the i440BX chipset, slot #5 is the -AGP slot. Currently only the 'voodoo' device can be assigned to AGP. +This defines the parameters to set up the Bochs PCI emulation: + +enabled + +If Bochs is compiled with PCI support, it is enabled by default. + +chipset + +Currently the chipsets i430FX, i440FX and i440BX (limited) are supported and +the default is i440FX. + +slotX + +It is possible to specify the devices connected to PCI slots. Up to 5 slots +are available. For combined PCI/ISA devices assigning to slot is mandatory +if the PCI model should be emulated (cirrus, ne2k and pcivga). Setting up +slot for PCI-only devices is also supported, but they are auto-assigned if +not specified (e1000, es1370, pcidev, pcipnic, usb_ehci, usb_ohci, usb_xhci, +voodoo). All device models except the network devices ne2k and e1000 can be +used only once in the slot configuration. In case of the i440BX chipset, the +slot #5 is the AGP slot. Currently only the 'voodoo' device can be assigned +to AGP. + +advopts + +With the advanced PCI options it is possible to control the behaviour of the +PCI chipset. These options can be specified as comma-separated values. +By default the "Bochs i440FX" chipset enables the ACPI and HPET devices, but +original i440FX doesn't support them. The options 'noacpi' and 'nohpet' make +it possible to disable them. Example: - pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k + pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k, advopts=noacpi .TP .I "clock:" diff --git a/bochs/iodev/devices.cc b/bochs/iodev/devices.cc index 8d86522d5..9d52b70d1 100644 --- a/bochs/iodev/devices.cc +++ b/bochs/iodev/devices.cc @@ -179,6 +179,28 @@ void bx_devices_c::init(BX_MEM_C *newmem) pci.enabled = SIM->get_param_bool(BXPN_PCI_ENABLED)->get(); if (pci.enabled) { #if BX_SUPPORT_PCI + if (chipset == BX_PCI_CHIPSET_I430FX) { + pci.advopts = (BX_PCI_ADVOPT_NOHPET | BX_PCI_ADVOPT_NOACPI); + } else { + pci.advopts = 0; + } + options = SIM->get_param_string(BXPN_PCI_ADV_OPTS)->getptr(); + argc = bx_split_option_list("PCI advanced options", options, argv, 16); + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "noacpi")) { + if (chipset == BX_PCI_CHIPSET_I440FX) { + pci.advopts = BX_PCI_ADVOPT_NOACPI; + } else { + BX_ERROR(("Disabling ACPI not supported by PCI chipset")); + } + } else if (!strcmp(argv[i], "nohpet")) { + pci.advopts = BX_PCI_ADVOPT_NOHPET; + } else { + BX_ERROR(("Unknown advanced PCI option '%s'", argv[i])); + } + free(argv[i]); + argv[i] = NULL; + } PLUG_load_plugin(pci, PLUGTYPE_CORE); PLUG_load_plugin(pci2isa, PLUGTYPE_CORE); #if BX_SUPPORT_PCIUSB @@ -194,10 +216,10 @@ void bx_devices_c::init(BX_MEM_C *newmem) SIM->get_param_bool(BXPN_UHCI_ENABLED)->set(1); } #endif - if (chipset != BX_PCI_CHIPSET_I430FX) { + if ((pci.advopts & BX_PCI_ADVOPT_NOACPI) == 0) { PLUG_load_plugin(acpi, PLUGTYPE_STANDARD); } - if (chipset == BX_PCI_CHIPSET_I440FX) { + if ((pci.advopts & BX_PCI_ADVOPT_NOHPET) == 0) { PLUG_load_plugin(hpet, PLUGTYPE_STANDARD); } #else diff --git a/bochs/iodev/iodev.h b/bochs/iodev/iodev.h index 7d068e33d..61ce95649 100644 --- a/bochs/iodev/iodev.h +++ b/bochs/iodev/iodev.h @@ -108,6 +108,9 @@ class cdrom_base_c; #define BX_PCI_BAR_TYPE_MEM 1 #define BX_PCI_BAR_TYPE_IO 2 +#define BX_PCI_ADVOPT_NOACPI 0x01 +#define BX_PCI_ADVOPT_NOHPET 0x02 + typedef struct { Bit8u type; Bit32u size; @@ -563,6 +566,7 @@ private: struct { bx_bool enabled; #if BX_SUPPORT_PCI + Bit32u advopts; Bit8u handler_id[0x101]; // 256 PCI devices/functions + 1 AGP device struct { bx_pci_device_c *handler; diff --git a/bochs/param_names.h b/bochs/param_names.h index a3132a9cc..2ac092704 100644 --- a/bochs/param_names.h +++ b/bochs/param_names.h @@ -97,6 +97,7 @@ #define BXPN_CMOSIMAGE_RTC_INIT "clock_cmos.cmosimage.rtc_init" #define BXPN_PCI_ENABLED "pci.enabled" #define BXPN_PCI_CHIPSET "pci.chipset" +#define BXPN_PCI_ADV_OPTS "pci.advopts" #define BXPN_PCIDEV_VENDOR "pci.pcidev.vendor" #define BXPN_PCIDEV_DEVICE "pci.pcidev.device" #define BXPN_SEL_DISPLAY_LIBRARY "display.display_library"