mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +00:00
DM USB: xHCI: limit bus and port numbers of xHCI
Currently the maximum number of bus and port for xHCI are both set to 255, it is theoretically possible but in fact not neccessary. This patch changes those two values to be more proper: 4 buses and 20 ports. Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Reviewed-by: Liang Yang <liang3.yang@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
2abec44e15
commit
5cc389aa29
@ -373,7 +373,7 @@ struct pci_xhci_vdev {
|
||||
int (*excap_write)(struct pci_xhci_vdev *, uint64_t, uint64_t);
|
||||
int usb2_port_start;
|
||||
int usb3_port_start;
|
||||
uint8_t *native_assign_ports[USB_NATIVE_NUM_BUS];
|
||||
uint8_t native_assign_ports[USB_NATIVE_NUM_BUS][USB_NATIVE_NUM_PORT];
|
||||
struct timespec mf_prev_time; /* previous time of accessing MFINDEX */
|
||||
};
|
||||
|
||||
@ -500,8 +500,7 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data)
|
||||
UPRINTF(LDBG, "%04x:%04x %d-%d connecting.\r\n",
|
||||
di->vid, di->pid, di->bus, di->port);
|
||||
|
||||
if (!xdev->native_assign_ports[di->bus] ||
|
||||
!xdev->native_assign_ports[di->bus][di->port]) {
|
||||
if (!xdev->native_assign_ports[di->bus][di->port]) {
|
||||
UPRINTF(LDBG, "%04x:%04x %d-%d doesn't belong to this vm, bye."
|
||||
"\r\n", di->vid, di->pid, di->bus, di->port);
|
||||
goto errout;
|
||||
@ -3361,15 +3360,6 @@ pci_xhci_parse_bus_port(struct pci_xhci_vdev *xdev, char *opts)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
if (!xdev->native_assign_ports[bus]) {
|
||||
xdev->native_assign_ports[bus] = calloc(USB_NATIVE_NUM_PORT,
|
||||
sizeof(uint8_t));
|
||||
if (!xdev->native_assign_ports[bus]) {
|
||||
rc = -3;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
xdev->native_assign_ports[bus][port] = 1;
|
||||
errout:
|
||||
if (rc)
|
||||
|
@ -223,8 +223,8 @@ enum USB_ERRCODE {
|
||||
#define NATIVE_USBSYS_DEVDIR "/sys/bus/usb/devices"
|
||||
#define NATIVE_USB2_SPEED "480"
|
||||
#define NATIVE_USB3_SPEED "5000"
|
||||
#define USB_NATIVE_NUM_PORT 255
|
||||
#define USB_NATIVE_NUM_BUS 255
|
||||
#define USB_NATIVE_NUM_PORT 20
|
||||
#define USB_NATIVE_NUM_BUS 4
|
||||
|
||||
extern int usb_log_level;
|
||||
inline int usb_get_log_level(void) { return usb_log_level; }
|
||||
|
Loading…
Reference in New Issue
Block a user