usb: generic sysbus ehci, bugfixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJcNMeBAAoJEEy22O7T6HE4W48QAMi3iyjY4OUDSHyYwGD80wZ5 A9vl8RYPQQYXZANGwMhr/uHZUBpH1V55WGd5CfKJ2IrVNwi4Q1T+3rmbB+V2ROaq MPWjHP7aJHyderdUycaVK7PmlrSJKdAC096+azYsMmxT+A5yhwlqr33EdHDSmOYz CQ/Fpn1waWXxG/Q9jnVIUqT6NP25j3CxgMU3jqUa+NauseIFr/6ZFPxukjbPQ4Yu bpcPoc+W/iL8ijhrCru+n4XqM8hU6JDavRKWzUQ+ljn8hhhh2aIbWqlVdHP9szpz wo2DtdzpbFdspVnXFCf7YPDrNZsZ31+bnfJHGFjSOghNq5jnvMOx5bvqux2WiZQj WcgN/Ej59aQzDkIuFASkC/E2KVl30Qw2u3WT11zG1VO6aIHe1oa8FMbL/ys0Xj4Q XW+TRhWXxK5GlR0WEaEUXPxrK+zsJmrjSj70XH9BaWj/A12FRwLYG5VSQC0PsuAB IoDzc4rgDNsm1Mig58Oklu8PJAenxJH573VM27+XMMfkj5/hpCvDQ6P5gi1TWffE L4ICP7CDy1eBj4L8IDcdPXcOWcrWGti4A+zBcIoshHzA5KWA6mg5QxlKCO3VDQ3R 3bpWjxcHdelHLDaJ7qyemspvBdukfyOCJfieagtdCuwfw2GU5Uvx1wbu1G7vIhSh nL/gyaGei/buOhd45751 =K5K4 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/usb-20190108-pull-request' into staging usb: generic sysbus ehci, bugfixes. # gpg: Signature made Tue 08 Jan 2019 15:53:37 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20190108-pull-request: usb: move ehci_create_ich9_with_companions to hw/i386 hw/usb: Add generic sys-bus EHCI controller usb: dev-mtp: fix memory leak in error path usb: drop unnecessary usb_device_post_load checks hw/usb: fix mistaken de-initialization of CCID state Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
147923b1a9
@ -58,6 +58,59 @@
|
||||
/* ICH9 AHCI has 6 ports */
|
||||
#define MAX_SATA_PORTS 6
|
||||
|
||||
struct ehci_companions {
|
||||
const char *name;
|
||||
int func;
|
||||
int port;
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1d[] = {
|
||||
{ .name = "ich9-usb-uhci1", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci2", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci3", .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1a[] = {
|
||||
{ .name = "ich9-usb-uhci4", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci5", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci6", .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
static int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
|
||||
{
|
||||
const struct ehci_companions *comp;
|
||||
PCIDevice *ehci, *uhci;
|
||||
BusState *usbbus;
|
||||
const char *name;
|
||||
int i;
|
||||
|
||||
switch (slot) {
|
||||
case 0x1d:
|
||||
name = "ich9-usb-ehci1";
|
||||
comp = ich9_1d;
|
||||
break;
|
||||
case 0x1a:
|
||||
name = "ich9-usb-ehci2";
|
||||
comp = ich9_1a;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
ehci = pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name);
|
||||
qdev_init_nofail(&ehci->qdev);
|
||||
usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
uhci = pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].func),
|
||||
true, comp[i].name);
|
||||
qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
|
||||
qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
|
||||
qdev_init_nofail(&uhci->qdev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PC hardware initialisation */
|
||||
static void pc_q35_init(MachineState *machine)
|
||||
{
|
||||
|
@ -59,12 +59,6 @@ static int usb_device_post_load(void *opaque, int version_id)
|
||||
} else {
|
||||
dev->attached = true;
|
||||
}
|
||||
if (dev->setup_index < 0 ||
|
||||
dev->setup_len < 0 ||
|
||||
dev->setup_index > dev->setup_len ||
|
||||
dev->setup_len > sizeof(dev->data_buf)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -549,6 +549,8 @@ static void emulated_realize(CCIDCardState *base, Error **errp)
|
||||
qemu_thread_create(&card->apdu_thread_id, "ccid/apdu", handle_apdu_thread,
|
||||
card, QEMU_THREAD_JOINABLE);
|
||||
|
||||
return;
|
||||
|
||||
out2:
|
||||
clean_event_notifier(card);
|
||||
out1:
|
||||
|
@ -1729,6 +1729,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen)
|
||||
if (strchr(filename, '/')) {
|
||||
usb_mtp_queue_result(s, RES_PARAMETER_NOT_SUPPORTED, d->trans,
|
||||
0, 0, 0, 0);
|
||||
g_free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -230,56 +230,3 @@ static void ehci_pci_register_types(void)
|
||||
}
|
||||
|
||||
type_init(ehci_pci_register_types)
|
||||
|
||||
struct ehci_companions {
|
||||
const char *name;
|
||||
int func;
|
||||
int port;
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1d[] = {
|
||||
{ .name = "ich9-usb-uhci1", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci2", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci3", .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
static const struct ehci_companions ich9_1a[] = {
|
||||
{ .name = "ich9-usb-uhci4", .func = 0, .port = 0 },
|
||||
{ .name = "ich9-usb-uhci5", .func = 1, .port = 2 },
|
||||
{ .name = "ich9-usb-uhci6", .func = 2, .port = 4 },
|
||||
};
|
||||
|
||||
int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
|
||||
{
|
||||
const struct ehci_companions *comp;
|
||||
PCIDevice *ehci, *uhci;
|
||||
BusState *usbbus;
|
||||
const char *name;
|
||||
int i;
|
||||
|
||||
switch (slot) {
|
||||
case 0x1d:
|
||||
name = "ich9-usb-ehci1";
|
||||
comp = ich9_1d;
|
||||
break;
|
||||
case 0x1a:
|
||||
name = "ich9-usb-ehci2";
|
||||
comp = ich9_1a;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
ehci = pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name);
|
||||
qdev_init_nofail(&ehci->qdev);
|
||||
usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
uhci = pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].func),
|
||||
true, comp[i].name);
|
||||
qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
|
||||
qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
|
||||
qdev_init_nofail(&uhci->qdev);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -94,6 +94,22 @@ static const TypeInfo ehci_type_info = {
|
||||
.class_size = sizeof(SysBusEHCIClass),
|
||||
};
|
||||
|
||||
static void ehci_platform_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
|
||||
sec->capsbase = 0x0;
|
||||
sec->opregbase = 0x20;
|
||||
set_bit(DEVICE_CATEGORY_USB, dc->categories);
|
||||
}
|
||||
|
||||
static const TypeInfo ehci_platform_type_info = {
|
||||
.name = TYPE_PLATFORM_EHCI,
|
||||
.parent = TYPE_SYS_BUS_EHCI,
|
||||
.class_init = ehci_platform_class_init,
|
||||
};
|
||||
|
||||
static void ehci_xlnx_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
|
||||
@ -245,6 +261,7 @@ static const TypeInfo ehci_fusbh200_type_info = {
|
||||
static void ehci_sysbus_register_types(void)
|
||||
{
|
||||
type_register_static(&ehci_type_info);
|
||||
type_register_static(&ehci_platform_type_info);
|
||||
type_register_static(&ehci_xlnx_type_info);
|
||||
type_register_static(&ehci_exynos4210_type_info);
|
||||
type_register_static(&ehci_tegra2_type_info);
|
||||
|
@ -342,6 +342,7 @@ typedef struct EHCIPCIState {
|
||||
|
||||
|
||||
#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
|
||||
#define TYPE_PLATFORM_EHCI "platform-ehci-usb"
|
||||
#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb"
|
||||
#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"
|
||||
#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
|
||||
|
@ -593,8 +593,6 @@ const char *usb_device_get_product_desc(USBDevice *dev);
|
||||
|
||||
const USBDesc *usb_device_get_usb_desc(USBDevice *dev);
|
||||
|
||||
int ehci_create_ich9_with_companions(PCIBus *bus, int slot);
|
||||
|
||||
/* quirks.c */
|
||||
|
||||
/* In bulk endpoints are streaming data sources (iow behave like isoc eps) */
|
||||
|
Loading…
Reference in New Issue
Block a user