Xhci options (#92)

This adds a "hint" to the xHCI port configuration "option" entries,
hinting that the port number must or must not be super-speed.
This commit is contained in:
Benjamin David Lunt 2023-10-15 11:47:24 -07:00 committed by GitHub
parent 8316d7698f
commit e7910a30a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 11 deletions

View File

@ -125,7 +125,7 @@ void bx_set_log_actions_by_device(bool panic_flag);
void bx_init_std_nic_options(const char *name, bx_list_c *menu);
#endif
#if BX_SUPPORT_PCIUSB
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports);
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports, int param0);
#endif
int bx_parse_param_from_list(const char *context, const char *input, bx_list_c *list);
int bx_parse_nic_params(const char *context, const char *param, bx_list_c *base);

View File

@ -213,7 +213,7 @@ void bx_init_std_nic_options(const char *name, bx_list_c *menu)
#endif
#if BX_SUPPORT_PCIUSB
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports)
void bx_init_usb_options(const char *usb_name, const char *pname, int maxports, int param0)
{
char group[16], name[8], descr[512], label[512];
bx_list_c *usb, *usbrt, *deplist, *deplist2;
@ -267,9 +267,18 @@ void bx_init_usb_options(const char *usb_name, const char *pname, int maxports)
bx_usbdev_ctl.get_device_names(),
0, 0);
sprintf(descr, "Options for device connected to %s port #%u", usb_name, i+1);
#if BX_SUPPORT_USB_XHCI
if (!strcmp(usb_name, "xHCI")) {
if (i < (param0 / 2))
strcpy(label, "Options: (Must be super-speed)");
else
strcpy(label, "Options: (Must NOT be super-speed)");
} else
#endif
strcpy(label, "Options");
bx_param_string_c *options = new bx_param_string_c(port,
"options",
"Options",
label,
descr,
"", BX_PATHNAME_LEN);
bx_param_bool_c *overcurrent = new bx_param_bool_c(port,

View File

@ -217,7 +217,7 @@ public:
virtual void init_std_nic_options(const char *name, bx_list_c *menu);
#endif
#if BX_SUPPORT_PCIUSB
virtual void init_usb_options(const char *usb_name, const char *pname, int maxports);
virtual void init_usb_options(const char *usb_name, const char *pname, int maxports, int param0);
#endif
virtual int parse_param_from_list(const char *context, const char *param, bx_list_c *base);
virtual int parse_nic_params(const char *context, const char *param, bx_list_c *base);
@ -1490,9 +1490,9 @@ void bx_real_sim_c::init_std_nic_options(const char *name, bx_list_c *menu)
#endif
#if BX_SUPPORT_PCIUSB
void bx_real_sim_c::init_usb_options(const char *usb_name, const char *pname, int maxports)
void bx_real_sim_c::init_usb_options(const char *usb_name, const char *pname, int maxports, int param0)
{
bx_init_usb_options(usb_name, pname, maxports);
bx_init_usb_options(usb_name, pname, maxports, param0);
}
#endif

View File

@ -743,7 +743,7 @@ public:
// special config parameter and options functions for plugins
virtual bool opt_plugin_ctrl(const char *plugname, bool load) {return 0;}
virtual void init_std_nic_options(const char *name, bx_list_c *menu) {}
virtual void init_usb_options(const char *usb_name, const char *pname, int maxports) {}
virtual void init_usb_options(const char *usb_name, const char *pname, int maxports, int param0) {}
virtual int parse_param_from_list(const char *context, const char *param, bx_list_c *base) {return 0;}
virtual int parse_nic_params(const char *context, const char *param, bx_list_c *base) {return 0;}
virtual int parse_usb_port_params(const char *context, const char *param,

View File

@ -161,7 +161,7 @@ PLUGIN_ENTRY_FOR_MODULE(usb_ehci)
theUSB_EHCI = new bx_usb_ehci_c();
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theUSB_EHCI, BX_PLUGIN_USB_EHCI);
// add new configuration parameter for the config interface
SIM->init_usb_options("EHCI", "ehci", USB_EHCI_PORTS);
SIM->init_usb_options("EHCI", "ehci", USB_EHCI_PORTS, 0);
// register add-on option for bochsrc and command line
SIM->register_addon_option("usb_ehci", usb_ehci_options_parser, usb_ehci_options_save);
} else if (mode == PLUGIN_FINI) {

View File

@ -109,7 +109,7 @@ PLUGIN_ENTRY_FOR_MODULE(usb_ohci)
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
SIM->init_usb_options("OHCI", "ohci", USB_OHCI_PORTS);
SIM->init_usb_options("OHCI", "ohci", USB_OHCI_PORTS, 0);
// register add-on option for bochsrc and command line
SIM->register_addon_option("usb_ohci", usb_ohci_options_parser, usb_ohci_options_save);
} else if (mode == PLUGIN_FINI) {

View File

@ -81,7 +81,7 @@ PLUGIN_ENTRY_FOR_MODULE(usb_uhci)
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
SIM->init_usb_options("UHCI", "uhci", USB_UHCI_PORTS);
SIM->init_usb_options("UHCI", "uhci", USB_UHCI_PORTS, 0);
// register add-on option for bochsrc and command line
SIM->register_addon_option("usb_uhci", usb_uhci_options_parser, usb_uhci_options_save);
} else if (mode == PLUGIN_FINI) {

View File

@ -195,7 +195,7 @@ PLUGIN_ENTRY_FOR_MODULE(usb_xhci)
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
SIM->init_usb_options("xHCI", "xhci", USB_XHCI_PORTS_MAX);
SIM->init_usb_options("xHCI", "xhci", USB_XHCI_PORTS_MAX, 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);
} else if (mode == PLUGIN_FINI) {