usb/uhci: Disallow user creating a vt82c686-uhci-pci device
authorBALATON Zoltan <balaton@eik.bme.hu>
Mon, 25 Oct 2021 11:33:49 +0000 (13:33 +0200)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tue, 2 Nov 2021 13:32:32 +0000 (14:32 +0100)
Because this device only works as part of VIA superio chips set user
creatable to false. Since the class init method is common for UHCI
variants introduce a flag in UHCIInfo for this.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <e6abf1f19ca72bbc2d8a5a6aa941edbf87a9845f.1635161629.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/usb/hcd-uhci.c
hw/usb/hcd-uhci.h
hw/usb/vt82c686-uhci-pci.c

index c557566ec26f98857ab3e0eefec3a0df35c1e2f2..7d26e3519429666474fa1445211d46a9c9d15040 100644 (file)
@@ -1282,6 +1282,9 @@ void uhci_data_class_init(ObjectClass *klass, void *data)
     } else {
         device_class_set_props(dc, uhci_properties_standalone);
     }
+    if (info->notuser) {
+        dc->user_creatable = false;
+    }
     u->info = *info;
 }
 
index e61d8fcb19210db180fef62185196e099e8c5d98..316693f80bd2dd8a0a3fe9aca547a00c54aa85f9 100644 (file)
@@ -85,6 +85,7 @@ typedef struct UHCIInfo {
     uint8_t    irq_pin;
     void       (*realize)(PCIDevice *dev, Error **errp);
     bool       unplug;
+    bool       notuser; /* disallow user_creatable */
 } UHCIInfo;
 
 void uhci_data_class_init(ObjectClass *klass, void *data);
index b109c2160335afd5063b17942ad24c334329232b..ea262e6d70900e3a1e94b534287703aac2bd9fc2 100644 (file)
@@ -25,6 +25,8 @@ static UHCIInfo uhci_info[] = {
         .irq_pin   = 3,
         .realize   = usb_uhci_vt82c686b_realize,
         .unplug    = true,
+        /* Reason: only works as USB function of VT82xx superio chips */
+        .notuser   = true,
     }
 };