usb: use defines instead of magic numbers for USB serial bus release number
cover usb: use defines instead of magic numbers for USB serial bus release number
There is some commonality between the UHCI and EHCI (and xHCI, future) drivers. So we can make nice defines instead of magic numbers.
usb-ehci.c | 2 +- usb-uhci.c | 2 +- usb.h | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-)
PATCH 1/3 usb: Add defines for USB Serial Bus Release Number register
Signed-off-by Brad Hards <[email protected]>
--- hw/usb.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/usb.h +6 -0
@@ -26,6 +26,12 @@#include "qdev.h" #include "qemu-queue.h" +/* Constants related to the USB / PCI interaction */ +#define USB_SBRN 0x60/* Serial Bus Release Number Register */ +#define USB_RELEASE_1 0x10/* USB 1.0 */ +#define USB_RELEASE_2 0x20/* USB 2.0 */ +#define USB_RELEASE_3 0x30/* USB 3.0 */ +#define USB_TOKEN_SETUP 0x2d#define USB_TOKEN_IN 0x69/* device -> host */ #define USB_TOKEN_OUT 0xe1/* host -> device */
Signature · 1 line
1.7.4.1
PATCH 2/3 usb: Use defines for serial bus release number register for UHCI
In reply to Brad HardsSigned-off-by Brad Hards <[email protected]>
--- hw/usb-uhci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/usb-uhci.c +1 -1
@@ -1098,7 +1098,7 @@ static int usb_uhci_common_initfn(UHCIState *s)pci_config_set_class (pci_conf,PCI_CLASS_SERIAL_USB );/* TODO: reset value should be 0. */ pci_conf[PCI_INTERRUPT_PIN ] =4 ;// interrupt pin 3 - pci_conf[0x60 ] =0x10 ;// release number + pci_conf[USB_SBRN ] =USB_RELEASE_1 ;// release number usb_bus_new (&s->bus, &s->dev.qdev);for (i =0 ; i <NB_PORTS ; i++) {
Signature · 1 line
1.7.4.1
PATCH 3/3 usb: Use defines for serial bus release number register for EHCI
In reply to Brad HardsSigned-off-by Brad Hards <[email protected]>
--- hw/usb-ehci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/usb-ehci.c +1 -1
@@ -1970,7 +1970,7 @@ static int usb_ehci_initfn(PCIDevice *dev)// pci_conf[0x50] = 0x01; // power management caps -pci_set_byte (&pci_conf[0x60 ],0x20 );// spec release number (2.1.4) +pci_set_byte (&pci_conf[USB_SBRN ],USB_RELEASE_2 );// release number (2.1.4) pci_set_byte (&pci_conf[0x61 ],0x20 );// frame length adjustment (2.1.5) pci_set_word (&pci_conf[0x62 ],0x00 );// port wake up capability (2.1.6)
Signature · 1 line
1.7.4.1