- devices 'usb_ohci' and 'usb_uhci': moved config parameter creation and bochsrc
option parsing to the plugin device code - added function bx_init_usb_options() to reduce code duplication - added log function names for 'usb_ohci' and 'usb_uhci' - documentation updates
This commit is contained in:
parent
9261b2fa14
commit
c403b4b699
@ -8,7 +8,8 @@
|
||||
# only available when the plugin device is loaded. The value "1" means to load
|
||||
# the plugin and "0" will unload it (if loaded before).
|
||||
# These plugins are currently supported: 'biosdev', 'e1000', 'es1370',
|
||||
# 'extfpuirq', 'gameport', 'iodebug', 'speaker', 'unmapped' and 'usb_xhci'.
|
||||
# 'extfpuirq', 'gameport', 'iodebug', 'speaker', 'unmapped', 'usb_ohci',
|
||||
# 'usb_uhci' and 'usb_xhci'.
|
||||
#=======================================================================
|
||||
#plugin_ctrl: unmapped=1, biosdev=1, speaker=1, e1000=1
|
||||
|
||||
@ -770,8 +771,8 @@ keyboard_paste_delay: 100000
|
||||
# With the mouse type option you can select the type of mouse to emulate.
|
||||
# The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
|
||||
# on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires
|
||||
# setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci'
|
||||
# or 'usb_ohci' option (requires PCI and USB support).
|
||||
# setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci',
|
||||
# 'usb_ohci' or 'usb_xhci' options (requires PCI and USB support).
|
||||
#
|
||||
# ENABLED:
|
||||
# The Bochs gui creates mouse "events" unless the 'enabled' option is
|
||||
@ -956,7 +957,7 @@ pci: enabled=1, chipset=i440fx
|
||||
# This option controls the presence of the USB root hub which is a part
|
||||
# of the i440FX PCI chipset. With the portX parameter you can connect devices
|
||||
# to the hub (currently supported: 'mouse', 'tablet', 'keypad', 'disk', 'cdrom'
|
||||
# 'hub' and 'printer').
|
||||
# 'hub' and 'printer'). NOTE: UHCI must be loaded with 'plugin_ctrl'.
|
||||
#
|
||||
# The optionsX parameter can be used to assign specific options to the device
|
||||
# connected to the corresponding USB port. Currently this feature is only used
|
||||
@ -997,7 +998,7 @@ pci: enabled=1, chipset=i440fx
|
||||
# This option controls the presence of the USB OHCI host controller with a
|
||||
# 2-port hub. The portX option accepts the same device types with the same
|
||||
# syntax as the UHCI controller (see above). The OHCI HC must be assigned to
|
||||
# a PCI slot.
|
||||
# a PCI slot and loaded with 'plugin_ctrl'.
|
||||
#=======================================================================
|
||||
#usb_ohci: enabled=1
|
||||
#usb_ohci: enabled=1, port1=printer:usbprinter.bin
|
||||
@ -1007,7 +1008,7 @@ pci: enabled=1, chipset=i440fx
|
||||
# This option controls the presence of the experimental USB xHCI host controller
|
||||
# with a 4-port hub. The portX option accepts the same device types with the
|
||||
# same syntax as the UHCI controller (see above). The xHCI HC must be assigned
|
||||
# to a PCI slot.
|
||||
# to a PCI slot and loaded with 'plugin_ctrl'.
|
||||
#=======================================================================
|
||||
#usb_xhci: enabled=1
|
||||
|
||||
|
@ -120,6 +120,7 @@ int bx_write_configuration(const char *rcfile, int overwrite);
|
||||
void bx_reset_options(void);
|
||||
// special config parameter and options functions for plugins
|
||||
void bx_init_std_nic_options(const char *name, bx_list_c *menu);
|
||||
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports);
|
||||
int bx_parse_nic_params(const char *context, const char *param, bx_list_c *base);
|
||||
int bx_parse_usb_port_params(const char *context, bx_bool devopt,
|
||||
const char *param, int maxports, bx_list_c *base);
|
||||
|
145
bochs/config.cc
145
bochs/config.cc
@ -211,6 +211,39 @@ void bx_init_std_nic_options(const char *name, bx_list_c *menu)
|
||||
bootrom->set_format("Name of boot ROM image: %s");
|
||||
}
|
||||
|
||||
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports)
|
||||
{
|
||||
char group[16], name[8], descr[512], label[512];
|
||||
|
||||
bx_param_c *usb = SIM->get_param("ports.usb");
|
||||
sprintf(group, "USB %s", usb_name);
|
||||
sprintf(label, "%s Configuration", usb_name);
|
||||
bx_list_c *menu = new bx_list_c(usb, pname, label);
|
||||
menu->set_options(menu->SHOW_PARENT);
|
||||
sprintf(label, "Enable %s emulation", usb_name);
|
||||
sprintf(descr, "Enables the %s emulation", usb_name);
|
||||
bx_param_bool_c *enabled = new bx_param_bool_c(menu, "enabled", label, descr, 0);
|
||||
bx_list_c *deplist = new bx_list_c(NULL, maxports * 3);
|
||||
for (int i = 0; i < maxports; i++) {
|
||||
sprintf(name, "port%d", i+1);
|
||||
sprintf(label, "Port #%d Configuration", i+1);
|
||||
sprintf(descr, "Device connected to %s port #%d and it's options", usb_name, i+1);
|
||||
bx_list_c *port = new bx_list_c(menu, name, label);
|
||||
port->set_options(port->SERIES_ASK | port->USE_BOX_TITLE);
|
||||
sprintf(descr, "Device connected to %s port #%d", usb_name, i+1);
|
||||
bx_param_string_c *device = new bx_param_string_c(port, "device", "Device",
|
||||
descr, "", BX_PATHNAME_LEN);
|
||||
sprintf(descr, "Options for device connected to %s port #%d", usb_name, i+1);
|
||||
bx_param_string_c *options = new bx_param_string_c(port, "options", "Options",
|
||||
descr, "", BX_PATHNAME_LEN);
|
||||
port->set_group(group);
|
||||
deplist->add(port);
|
||||
deplist->add(device);
|
||||
deplist->add(options);
|
||||
}
|
||||
enabled->set_dependent_list(deplist);
|
||||
}
|
||||
|
||||
void bx_init_options()
|
||||
{
|
||||
int i;
|
||||
@ -220,7 +253,7 @@ void bx_init_options()
|
||||
bx_param_bool_c *enabled, *readonly, *status;
|
||||
bx_param_enum_c *mode, *type, *toggle;
|
||||
bx_param_filename_c *path;
|
||||
char name[BX_PATHNAME_LEN], descr[512], group[16], label[512];
|
||||
char name[BX_PATHNAME_LEN], descr[512], label[512];
|
||||
|
||||
bx_param_c *root_param = SIM->get_param(".");
|
||||
|
||||
@ -1460,66 +1493,7 @@ void bx_init_options()
|
||||
// usb subtree
|
||||
bx_list_c *usb = new bx_list_c(ports, "usb", "USB Configuration");
|
||||
usb->set_options(usb->USE_TAB_WINDOW | usb->SHOW_PARENT);
|
||||
bx_list_c *port;
|
||||
bx_param_string_c *device, *options;
|
||||
|
||||
// UHCI options
|
||||
strcpy(group, "USB UHCI");
|
||||
menu = new bx_list_c(usb, "uhci", "UHCI Configuration");
|
||||
menu->set_options(menu->SHOW_PARENT);
|
||||
menu->set_enabled(BX_SUPPORT_USB_UHCI);
|
||||
enabled = new bx_param_bool_c(menu,
|
||||
"enabled",
|
||||
"Enable UHCI emulation",
|
||||
"Enables the UHCI emulation",
|
||||
0);
|
||||
enabled->set_enabled(BX_SUPPORT_USB_UHCI);
|
||||
deplist = new bx_list_c(NULL, BX_N_USB_UHCI_PORTS * 3);
|
||||
for (i=0; i<BX_N_USB_UHCI_PORTS; i++) {
|
||||
sprintf(name, "port%d", i+1);
|
||||
sprintf(label, "Port #%d Configuration", i+1);
|
||||
sprintf(descr, "Device connected to UHCI port #%d and it's options", i+1);
|
||||
port = new bx_list_c(menu, name, label);
|
||||
port->set_options(port->SERIES_ASK | port->USE_BOX_TITLE);
|
||||
sprintf(descr, "Device connected to UHCI port #%d", i+1);
|
||||
device = new bx_param_string_c(port, "device", "Device", descr, "", BX_PATHNAME_LEN);
|
||||
sprintf(descr, "Options for device connected to UHCI port #%d", i+1);
|
||||
options = new bx_param_string_c(port, "options", "Options", descr, "", BX_PATHNAME_LEN);
|
||||
port->set_group(group);
|
||||
deplist->add(port);
|
||||
deplist->add(device);
|
||||
deplist->add(options);
|
||||
}
|
||||
enabled->set_dependent_list(deplist);
|
||||
|
||||
// OHCI options
|
||||
strcpy(group, "USB OHCI");
|
||||
menu = new bx_list_c(usb, "ohci", "OHCI Configuration");
|
||||
menu->set_options(menu->SHOW_PARENT);
|
||||
menu->set_enabled(BX_SUPPORT_USB_OHCI);
|
||||
enabled = new bx_param_bool_c(menu,
|
||||
"enabled",
|
||||
"Enable OHCI emulation",
|
||||
"Enables the OHCI emulation",
|
||||
0);
|
||||
enabled->set_enabled(BX_SUPPORT_USB_OHCI);
|
||||
deplist = new bx_list_c(NULL, BX_N_USB_OHCI_PORTS * 3);
|
||||
for (i=0; i<BX_N_USB_OHCI_PORTS; i++) {
|
||||
sprintf(name, "port%d", i+1);
|
||||
sprintf(label, "Port #%d Configuration", i+1);
|
||||
sprintf(descr, "Device connected to OHCI port #%d and it's options", i+1);
|
||||
port = new bx_list_c(menu, name, label);
|
||||
port->set_options(port->SERIES_ASK | port->USE_BOX_TITLE);
|
||||
sprintf(descr, "Device connected to OHCI port #%d", i+1);
|
||||
device = new bx_param_string_c(port, "device", "Device", descr, "", BX_PATHNAME_LEN);
|
||||
sprintf(descr, "Options for device connected to OHCI port #%d", i+1);
|
||||
options = new bx_param_string_c(port, "options", "Options", descr, "", BX_PATHNAME_LEN);
|
||||
port->set_group(group);
|
||||
deplist->add(port);
|
||||
deplist->add(device);
|
||||
deplist->add(options);
|
||||
}
|
||||
enabled->set_dependent_list(deplist);
|
||||
// USB host controller options initialized in the devive plugin code
|
||||
|
||||
// network subtree
|
||||
bx_list_c *network = new bx_list_c(root_param, "network", "Network Configuration");
|
||||
@ -2286,6 +2260,12 @@ bx_bool is_optplugin_option(const char *param)
|
||||
#if BX_SUPPORT_ES1370
|
||||
"es1370",
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
"usb_ohci",
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
"usb_uhci",
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_XHCI
|
||||
"usb_xhci",
|
||||
#endif
|
||||
@ -3100,44 +3080,6 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
BX_ERROR(("%s: unknown parameter for parport%d ignored.", context, idx));
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(params[0], "usb1")) {
|
||||
PARSE_ERR(("%s: 'usb1' directive is now deprecated, use 'usb_uhci' instead", context));
|
||||
} else if (!strcmp(params[0], "usb_uhci")) {
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "enabled=", 8)) {
|
||||
SIM->get_param_bool(BXPN_UHCI_ENABLED)->set(atol(¶ms[i][8]));
|
||||
} else if (!strncmp(params[i], "port", 4)) {
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.uhci");
|
||||
if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_UHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!strncmp(params[i], "options", 7)) {
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.uhci");
|
||||
if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_UHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
PARSE_WARN(("%s: unknown parameter '%s' for usb_uhci ignored.", context, params[i]));
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(params[0], "usb_ohci")) {
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "enabled=", 8)) {
|
||||
SIM->get_param_bool(BXPN_OHCI_ENABLED)->set(atol(¶ms[i][8]));
|
||||
} else if (!strncmp(params[i], "port", 4)) {
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.ohci");
|
||||
if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_OHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!strncmp(params[i], "options", 7)) {
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.ohci");
|
||||
if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_OHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
PARSE_WARN(("%s: unknown parameter '%s' for usb_ohci ignored.", context, params[i]));
|
||||
}
|
||||
}
|
||||
} else if ((!strcmp(params[0], "pci")) ||
|
||||
(!strcmp(params[0], "i440fxsupport"))) {
|
||||
// new option 'pci' for future extensions
|
||||
@ -3966,11 +3908,6 @@ int bx_write_configuration(const char *rc, int overwrite)
|
||||
base = (bx_list_c*) SIM->get_param(tmpdev);
|
||||
bx_write_serial_options(fp, base, i+1);
|
||||
}
|
||||
// usb
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.uhci");
|
||||
bx_write_usb_options(fp, BX_N_USB_UHCI_PORTS, base);
|
||||
base = (bx_list_c*) SIM->get_param("ports.usb.ohci");
|
||||
bx_write_usb_options(fp, BX_N_USB_OHCI_PORTS, base);
|
||||
// pci
|
||||
fprintf(fp, "pci: enabled=%d",
|
||||
SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get());
|
||||
|
@ -520,10 +520,10 @@ currently work with.
|
||||
<row>
|
||||
<entry>USB</entry>
|
||||
<entry>incomplete</entry>
|
||||
<entry>Two types of host controllers (UHCI and OHCI) and the devices 'mouse',
|
||||
'tablet', 'keypad', 'disk', 'cdrom', 'hub' and 'printer'. are available.
|
||||
Plugging in and removing devices at runtime is possible. Access to real
|
||||
hardware is not implemented yet.
|
||||
<entry>Three types of host controllers (UHCI, OHCI and xHCI) and the devices
|
||||
'mouse', 'tablet', 'keypad', 'disk', 'cdrom', 'hub' and 'printer'. are
|
||||
available. Plugging in and removing devices at runtime is possible. Access to
|
||||
real hardware is not implemented yet.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
@ -2264,7 +2264,15 @@ turn it off.
|
||||
<entry>--enable-usb-ohci</entry>
|
||||
<entry>no</entry>
|
||||
<entry>
|
||||
Enable experimental USB OHCI support. The host controller with 2-port
|
||||
Enable USB OHCI support. The host controller with 2-port
|
||||
root hub is available (USB device types: same as UHCI).
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>--enable-usb-xhci</entry>
|
||||
<entry>no</entry>
|
||||
<entry>
|
||||
Enable experimental USB xHCI support. The host controller with 4-port
|
||||
root hub is available (USB device types: same as UHCI).
|
||||
</entry>
|
||||
</row>
|
||||
@ -2888,6 +2896,24 @@ Put this on top of your config file if the global configuration is stored in /et
|
||||
The section below lists all the supported <filename>bochsrc</filename> options.
|
||||
</para>
|
||||
|
||||
<section id="bochsopt-plugin-ctrl"><title>plugin_ctrl</title>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
plugin_ctrl: biosdev=1, speaker=1, unmapped=1, e1000=1
|
||||
</screen>
|
||||
Controls the presence of optional device plugins. These plugins are loaded
|
||||
directly with this option and some of them install a config option that is
|
||||
only available when the plugin device is loaded. The value "1" means to load
|
||||
the plugin and "0" will unload it (if loaded before).
|
||||
</para>
|
||||
<para>
|
||||
These plugins are currently supported: 'biosdev', 'e1000', 'es1370',
|
||||
'extfpuirq', 'gameport', 'iodebug', 'speaker', 'unmapped', 'usb_ohci',
|
||||
'usb_uhci' and 'usb_xhci'.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bochsopt-megs"><title>megs</title>
|
||||
<para>
|
||||
Examples:
|
||||
@ -3644,7 +3670,7 @@ Default is %t%e%d
|
||||
<para>
|
||||
Examples:
|
||||
<screen>
|
||||
debug: action=ignore
|
||||
debug: action=ignore, pci=report
|
||||
info: action=report
|
||||
error: action=report
|
||||
panic: action=ask
|
||||
@ -3673,6 +3699,12 @@ the console or log file), or ignore (do nothing). The recommended settings are
|
||||
listed in the sample above.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is also possible to specify the 'action' to do for each Bochs facility
|
||||
separately (e.g. crash on panics from everything except the cdrom, and only
|
||||
report those). TODO: add 'log function' module list to the user documentation.
|
||||
</para>
|
||||
|
||||
<tip>
|
||||
<para>
|
||||
The safest action for panics is "fatal" or "ask". If you are getting lots of
|
||||
@ -3948,8 +3980,8 @@ With the mouse type option you can select the type of mouse to emulate.
|
||||
The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
|
||||
on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires
|
||||
setting 'mode=mouse', see <link linkend="bochsopt-com">com option</link>).
|
||||
To connect a mouse to an USB port, see the <link linkend="bochsopt-usb-uhci">usb_uhci</link>
|
||||
or 'usb_ohci' option (requires PCI and USB support).
|
||||
To connect a mouse to an USB port, see the <link linkend="bochsopt-usb-uhci">usb_uhci</link>,
|
||||
'usb_ohci 'or 'usb_xhci' option (requires PCI and USB support).
|
||||
</para>
|
||||
<para><command>enabled</command></para>
|
||||
<para>
|
||||
@ -4073,7 +4105,8 @@ code to the file if the file already existed. It would probably be nice to
|
||||
overwrite the file instead, asking user first.
|
||||
</para>
|
||||
<note><para>
|
||||
PCI support must be enabled.
|
||||
PCI support must be enabled and UHCI loaded with
|
||||
<link linkend="bochsopt-plugin-ctrl">plugin_ctrl</link>.
|
||||
</para></note>
|
||||
</section>
|
||||
|
||||
@ -4081,12 +4114,27 @@ PCI support must be enabled.
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
usb_ohci: enabled=1
|
||||
usb_ohci: enabled=1, port1=printer:printdata.bin
|
||||
</screen>
|
||||
This option controls the presence of the USB OHCI host controller with a
|
||||
2-port hub. The portX option accepts the same device types with the same
|
||||
syntax as the UHCI controller (see the <link linkend="bochsopt-usb-uhci">usb_uhci option</link>).
|
||||
The OHCI HC must be assigned to a PCI slot.
|
||||
The OHCI HC must be assigned to a PCI slot and loaded with
|
||||
<link linkend="bochsopt-plugin-ctrl">plugin_ctrl</link>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="bochsopt-usb-xhci"><title>usb_xhci</title>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
usb_xhci: enabled=1
|
||||
</screen>
|
||||
This option controls the presence of the experimental USB xHCI host controller
|
||||
with a 4-port hub. The portX option accepts the same device types with the same
|
||||
syntax as the UHCI controller (see the <link linkend="bochsopt-usb-uhci">usb_uhci option</link>).
|
||||
The xHCI HC must be assigned to a PCI slot and loaded with
|
||||
<link linkend="bochsopt-plugin-ctrl">plugin_ctrl</link>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@ -4352,19 +4400,6 @@ the image is the source for the initial time.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section><title>plugin_ctrl</title>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
plugin_ctrl: biosdev=0, speaker=0
|
||||
</screen>
|
||||
Controls the presence of optional plugins without a separate option.
|
||||
By default all existing plugins are enabled. These plugins are currently
|
||||
supported: 'acpi', 'biosdev', 'extfpuirq', 'gameport', 'iodebug',
|
||||
'pci_ide', 'speaker' and 'unmapped'.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section><title>user_plugin</title>
|
||||
<para>
|
||||
Example:
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com"
|
||||
.TH bochsrc 5 "24 Dec 2011" "bochsrc" "The Bochs Project"
|
||||
.TH bochsrc 5 "8 Jan 2012" "bochsrc" "The Bochs Project"
|
||||
.\"SKIP_SECTION"
|
||||
.SH NAME
|
||||
bochsrc \- Configuration file for Bochs.
|
||||
@ -41,6 +41,18 @@ file (e.g. location of rom images).
|
||||
Example:
|
||||
#include /etc/bochsrc
|
||||
|
||||
.TP
|
||||
.I "plugin_ctrl:"
|
||||
Controls the presence of optional device plugins. These plugins are loaded
|
||||
directly with this option and some of them install a config option that is
|
||||
only available when the plugin device is loaded. The value "1" means to load
|
||||
the plugin and "0" will unload it (if loaded before).
|
||||
These plugins are currently supported: biosdev, e1000, es1370, extfpuirq,
|
||||
gameport, iodebug, speaker, unmapped, usb_ohci, usb_uhci and usb_xhci.
|
||||
|
||||
Example:
|
||||
plugin_ctrl: biosdev=1, speaker=1, unmapped=1, e1000=1
|
||||
|
||||
.TP
|
||||
.I "config_interface:"
|
||||
The configuration interface is a series of menus or dialog boxes that
|
||||
@ -828,8 +840,8 @@ type
|
||||
With the mouse type option you can select the type of mouse to emulate.
|
||||
The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
|
||||
on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires
|
||||
setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci'
|
||||
or 'usb_ohci' option (requires PCI and USB support).
|
||||
setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci',
|
||||
'usb_ohci' or 'usb_xhci' option (requires PCI and USB support).
|
||||
|
||||
enabled
|
||||
|
||||
@ -1063,19 +1075,20 @@ Example:
|
||||
This option controls the presence of the USB OHCI host controller with a
|
||||
2-port hub. The portX option accepts the same device types with the same
|
||||
syntax as the UHCI controller (see above). The OHCI HC must be assigned to
|
||||
a PCI slot.
|
||||
a PCI slot and loaded with 'plugin_ctrl'.
|
||||
|
||||
Example:
|
||||
usb_ohci: enabled=1
|
||||
|
||||
.TP
|
||||
.I "plugin_ctrl:"
|
||||
Controls the presence of optional plugins without a separate option.
|
||||
By default all existing plugins are enabled. These plugins are currently
|
||||
supported: 'acpi', 'biosdev', 'extfpuirq', 'gameport', 'iodebug', 'pci_ide', 'speaker' and 'unmapped'.
|
||||
.I "usb_xhci:"
|
||||
This option controls the presence of the experimental USB xHCI host controller
|
||||
with a 4-port hub. The portX option accepts the same device types with the same
|
||||
syntax as the UHCI controller (see above). The xHCI HC must be assigned to
|
||||
a PCI slot and loaded with 'plugin_ctrl'.
|
||||
|
||||
Example:
|
||||
plugin_ctrl: biosdev=0, speaker=0
|
||||
usb_xhci: enabled=1
|
||||
|
||||
.TP
|
||||
.I "user_plugin:"
|
||||
|
@ -218,16 +218,6 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
((!strlen(vga_ext)) || (!strcmp(vga_ext, "none")) || (!strcmp(vga_ext, "vbe")))) {
|
||||
PLUG_load_plugin(pcivga, PLUGTYPE_OPTIONAL);
|
||||
}
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
if (is_usb_uhci_enabled()) {
|
||||
PLUG_load_plugin(usb_uhci, PLUGTYPE_OPTIONAL);
|
||||
}
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
if (is_usb_ohci_enabled()) {
|
||||
PLUG_load_plugin(usb_ohci, PLUGTYPE_OPTIONAL);
|
||||
}
|
||||
#endif
|
||||
#if BX_SUPPORT_PCIDEV
|
||||
if (SIM->get_param_num(BXPN_PCIDEV_VENDOR)->get() != 0xffff) {
|
||||
PLUG_load_plugin(pcidev, PLUGTYPE_OPTIONAL);
|
||||
@ -1022,22 +1012,6 @@ bx_bool bx_devices_c::is_parallel_enabled(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_devices_c::is_usb_ohci_enabled(void)
|
||||
{
|
||||
if (SIM->get_param_bool(BXPN_OHCI_ENABLED)->get()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bx_bool bx_devices_c::is_usb_uhci_enabled(void)
|
||||
{
|
||||
if (SIM->get_param_bool(BXPN_UHCI_ENABLED)->get()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// removable keyboard/mouse registration
|
||||
void bx_devices_c::register_removable_keyboard(void *dev, bx_keyb_enq_t keyb_enq)
|
||||
{
|
||||
|
@ -592,8 +592,6 @@ private:
|
||||
bx_bool is_harddrv_enabled();
|
||||
bx_bool is_serial_enabled();
|
||||
bx_bool is_parallel_enabled();
|
||||
bx_bool is_usb_ohci_enabled();
|
||||
bx_bool is_usb_uhci_enabled();
|
||||
};
|
||||
|
||||
// memory stub has an assumption that there are no memory accesses splitting 4K page
|
||||
|
@ -70,21 +70,66 @@ const char *usb_ohci_port_name[] = {
|
||||
" **unknown** "
|
||||
};
|
||||
|
||||
// builtin configuration handling functions
|
||||
|
||||
Bit32s usb_ohci_options_parser(const char *context, int num_params, char *params[])
|
||||
{
|
||||
if (!strcmp(params[0], "usb_ohci")) {
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_OHCI);
|
||||
for (int i = 1; i < num_params; i++) {
|
||||
if (!strncmp(params[i], "enabled=", 8)) {
|
||||
SIM->get_param_bool(BXPN_OHCI_ENABLED)->set(atol(¶ms[i][8]));
|
||||
} else if (!strncmp(params[i], "port", 4)) {
|
||||
if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_OHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!strncmp(params[i], "options", 7)) {
|
||||
if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_OHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
BX_ERROR(("%s: unknown parameter '%s' for usb_ohci ignored.", context, params[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BX_PANIC(("%s: unknown directive '%s'", context, params[0]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bit32s usb_ohci_options_save(FILE *fp)
|
||||
{
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_OHCI);
|
||||
bx_write_usb_options(fp, BX_N_USB_OHCI_PORTS, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// device plugin entry points
|
||||
|
||||
int libusb_ohci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theUSB_OHCI = new bx_usb_ohci_c();
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_OHCI, BX_PLUGIN_USB_OHCI);
|
||||
// add new configuration parameter for the config interface
|
||||
bx_init_usb_options("OHCI", "ohci", BX_N_USB_OHCI_PORTS);
|
||||
// register add-on option for bochsrc and command line
|
||||
SIM->register_addon_option("usb_ohci", usb_ohci_options_parser, usb_ohci_options_save);
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void libusb_ohci_LTX_plugin_fini(void)
|
||||
{
|
||||
SIM->unregister_addon_option("usb_ohci");
|
||||
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
|
||||
menu->remove("usb_ohci");
|
||||
delete theUSB_OHCI;
|
||||
}
|
||||
|
||||
// the device object
|
||||
|
||||
bx_usb_ohci_c::bx_usb_ohci_c()
|
||||
{
|
||||
put("OHCI");
|
||||
put("usb_ohci", "OHCI");
|
||||
memset((void*)&hub, 0, sizeof(bx_usb_ohci_t));
|
||||
device_buffer = NULL;
|
||||
hub.frame_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
@ -110,9 +155,18 @@ void bx_usb_ohci_c::init(void)
|
||||
{
|
||||
unsigned i;
|
||||
char pname[6];
|
||||
bx_list_c *port;
|
||||
bx_list_c *ohci, *port;
|
||||
bx_param_string_c *device, *options;
|
||||
|
||||
// Read in values from config interface
|
||||
ohci = (bx_list_c*) SIM->get_param(BXPN_USB_OHCI);
|
||||
// Check if the device is disabled or not configured
|
||||
if (!SIM->get_param_bool("enabled", ohci)->get()) {
|
||||
BX_INFO(("USB OHCI disabled"));
|
||||
BX_UNREGISTER_DEVICE_DEVMODEL("usb_ohci");
|
||||
return;
|
||||
}
|
||||
|
||||
BX_OHCI_THIS device_buffer = new Bit8u[65536];
|
||||
|
||||
// Call our frame timer routine every 1mS (1,000uS)
|
||||
@ -137,7 +191,6 @@ void bx_usb_ohci_c::init(void)
|
||||
BX_OHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("OHCI", 1);
|
||||
|
||||
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
|
||||
bx_list_c *ohci = (bx_list_c*)SIM->get_param(BXPN_USB_OHCI);
|
||||
ohci->set_options(ohci->SHOW_PARENT);
|
||||
ohci->set_runtime_param(1);
|
||||
usb_rt->add(ohci);
|
||||
@ -155,9 +208,6 @@ void bx_usb_ohci_c::init(void)
|
||||
BX_OHCI_THIS hub.usb_port[i].HcRhPortStatus.csc = 0;
|
||||
}
|
||||
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_OHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
|
||||
// register handler for correct device connect handling after runtime config
|
||||
SIM->register_runtime_config_handler(BX_OHCI_THIS_PTR, runtime_config_handler);
|
||||
BX_OHCI_THIS hub.device_change = 0;
|
||||
|
@ -43,21 +43,66 @@ bx_usb_uhci_c* theUSB_UHCI = NULL;
|
||||
const Bit8u uhci_iomask[32] = {2, 1, 2, 1, 2, 1, 2, 0, 4, 0, 0, 0, 1, 0, 0, 0,
|
||||
3, 1, 3, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// builtin configuration handling functions
|
||||
|
||||
Bit32s usb_uhci_options_parser(const char *context, int num_params, char *params[])
|
||||
{
|
||||
if (!strcmp(params[0], "usb_uhci")) {
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_UHCI);
|
||||
for (int i = 1; i < num_params; i++) {
|
||||
if (!strncmp(params[i], "enabled=", 8)) {
|
||||
SIM->get_param_bool(BXPN_UHCI_ENABLED)->set(atol(¶ms[i][8]));
|
||||
} else if (!strncmp(params[i], "port", 4)) {
|
||||
if (bx_parse_usb_port_params(context, 0, params[i], BX_N_USB_UHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!strncmp(params[i], "options", 7)) {
|
||||
if (bx_parse_usb_port_params(context, 1, params[i], BX_N_USB_UHCI_PORTS, base) < 0) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
BX_ERROR(("%s: unknown parameter '%s' for usb_uhci ignored.", context, params[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BX_PANIC(("%s: unknown directive '%s'", context, params[0]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bit32s usb_uhci_options_save(FILE *fp)
|
||||
{
|
||||
bx_list_c *base = (bx_list_c*) SIM->get_param(BXPN_USB_UHCI);
|
||||
bx_write_usb_options(fp, BX_N_USB_UHCI_PORTS, base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// device plugin entry points
|
||||
|
||||
int libusb_uhci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
|
||||
{
|
||||
theUSB_UHCI = new bx_usb_uhci_c();
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_UHCI, BX_PLUGIN_USB_UHCI);
|
||||
// add new configuration parameter for the config interface
|
||||
bx_init_usb_options("UHCI", "uhci", BX_N_USB_UHCI_PORTS);
|
||||
// register add-on option for bochsrc and command line
|
||||
SIM->register_addon_option("usb_uhci", usb_uhci_options_parser, usb_uhci_options_save);
|
||||
return 0; // Success
|
||||
}
|
||||
|
||||
void libusb_uhci_LTX_plugin_fini(void)
|
||||
{
|
||||
SIM->unregister_addon_option("usb_uhci");
|
||||
bx_list_c *menu = (bx_list_c*)SIM->get_param("ports.usb");
|
||||
menu->remove("usb_uhci");
|
||||
delete theUSB_UHCI;
|
||||
}
|
||||
|
||||
// the device object
|
||||
|
||||
bx_usb_uhci_c::bx_usb_uhci_c()
|
||||
{
|
||||
put("UHCI");
|
||||
put("usb_uhci", "UHCI");
|
||||
memset((void*)&hub, 0, sizeof(bx_usb_uhci_t));
|
||||
device_buffer = NULL;
|
||||
hub.timer_index = BX_NULL_TIMER_HANDLE;
|
||||
@ -83,9 +128,18 @@ void bx_usb_uhci_c::init(void)
|
||||
{
|
||||
unsigned i;
|
||||
char pname[6];
|
||||
bx_list_c *port;
|
||||
bx_list_c *uhci, *port;
|
||||
bx_param_string_c *device, *options;
|
||||
|
||||
// Read in values from config interface
|
||||
uhci = (bx_list_c*) SIM->get_param(BXPN_USB_UHCI);
|
||||
// Check if the device is disabled or not configured
|
||||
if (!SIM->get_param_bool("enabled", uhci)->get()) {
|
||||
BX_INFO(("USB UHCI disabled"));
|
||||
BX_UNREGISTER_DEVICE_DEVMODEL("usb_uhci");
|
||||
return;
|
||||
}
|
||||
|
||||
BX_UHCI_THIS device_buffer = new Bit8u[65536];
|
||||
|
||||
// Call our timer routine every 1mS (1,000uS)
|
||||
@ -111,7 +165,6 @@ void bx_usb_uhci_c::init(void)
|
||||
BX_UHCI_THIS hub.statusbar_id = bx_gui->register_statusitem("UHCI", 1);
|
||||
|
||||
bx_list_c *usb_rt = (bx_list_c*)SIM->get_param(BXPN_MENU_RUNTIME_USB);
|
||||
bx_list_c *uhci = (bx_list_c*)SIM->get_param(BXPN_USB_UHCI);
|
||||
uhci->set_options(uhci->SHOW_PARENT);
|
||||
uhci->set_runtime_param(1);
|
||||
usb_rt->add(uhci);
|
||||
@ -127,9 +180,6 @@ void bx_usb_uhci_c::init(void)
|
||||
BX_UHCI_THIS hub.usb_port[i].device = NULL;
|
||||
}
|
||||
|
||||
//HACK: Turn on debug messages from the start
|
||||
//BX_UHCI_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
|
||||
|
||||
// register handler for correct device connect handling after runtime config
|
||||
SIM->register_runtime_config_handler(BX_UHCI_THIS_PTR, runtime_config_handler);
|
||||
BX_UHCI_THIS hub.device_change = 0;
|
||||
|
@ -69,42 +69,6 @@ Bit8u port_band_width[4][1 + USB_XHCI_PORTS] = {
|
||||
|
||||
// builtin configuration handling functions
|
||||
|
||||
void usb_xhci_init_options(void)
|
||||
{
|
||||
char name[BX_PATHNAME_LEN], descr[512], group[16], label[512];
|
||||
|
||||
bx_param_c *usb = SIM->get_param("ports.usb");
|
||||
strcpy(group, "USB xHCI");
|
||||
bx_list_c *menu = new bx_list_c(usb, "xhci", "xHCI Configuration");
|
||||
menu->set_options(menu->SHOW_PARENT);
|
||||
menu->set_enabled(BX_SUPPORT_USB_XHCI);
|
||||
bx_param_bool_c *enabled = new bx_param_bool_c(menu,
|
||||
"enabled",
|
||||
"Enable xHCI emulation",
|
||||
"Enables the xHCI emulation",
|
||||
0);
|
||||
enabled->set_enabled(BX_SUPPORT_USB_XHCI);
|
||||
bx_list_c *deplist = new bx_list_c(NULL, BX_N_USB_XHCI_PORTS * 3);
|
||||
for (int i = 0; i < BX_N_USB_XHCI_PORTS; i++) {
|
||||
sprintf(name, "port%d", i+1);
|
||||
sprintf(label, "Port #%d Configuration", i+1);
|
||||
sprintf(descr, "Device connected to xHCI port #%d and it's options", i+1);
|
||||
bx_list_c *port = new bx_list_c(menu, name, label);
|
||||
port->set_options(port->SERIES_ASK | port->USE_BOX_TITLE);
|
||||
sprintf(descr, "Device connected to xHCI port #%d", i+1);
|
||||
bx_param_string_c *device = new bx_param_string_c(port, "device", "Device",
|
||||
descr, "", BX_PATHNAME_LEN);
|
||||
sprintf(descr, "Options for device connected to xHCI port #%d", i+1);
|
||||
bx_param_string_c *options = new bx_param_string_c(port, "options", "Options",
|
||||
descr, "", BX_PATHNAME_LEN);
|
||||
port->set_group(group);
|
||||
deplist->add(port);
|
||||
deplist->add(device);
|
||||
deplist->add(options);
|
||||
}
|
||||
enabled->set_dependent_list(deplist);
|
||||
}
|
||||
|
||||
Bit32s usb_xhci_options_parser(const char *context, int num_params, char *params[])
|
||||
{
|
||||
if (!strcmp(params[0], "usb_xhci")) {
|
||||
@ -144,7 +108,7 @@ int libusb_xhci_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, c
|
||||
theUSB_XHCI = new bx_usb_xhci_c();
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_XHCI, BX_PLUGIN_USB_XHCI);
|
||||
// add new configuration parameter for the config interface
|
||||
usb_xhci_init_options();
|
||||
bx_init_usb_options("xHCI", "xhci", BX_N_USB_XHCI_PORTS);
|
||||
// register add-on option for bochsrc and command line
|
||||
SIM->register_addon_option("usb_xhci", usb_xhci_options_parser, usb_xhci_options_save);
|
||||
return 0; // Success
|
||||
|
@ -836,6 +836,12 @@ static builtin_plugin_t builtin_opt_plugins[] = {
|
||||
#if BX_SUPPORT_ES1370
|
||||
BUILTIN_PLUGIN_ENTRY(es1370),
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_OHCI
|
||||
BUILTIN_PLUGIN_ENTRY(usb_ohci),
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_UHCI
|
||||
BUILTIN_PLUGIN_ENTRY(usb_uhci),
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_XHCI
|
||||
BUILTIN_PLUGIN_ENTRY(usb_xhci),
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user