aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/hcd-uhci.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-02-22 12:42:52 +0000
committerPeter Maydell <peter.maydell@linaro.org>2024-02-22 12:42:52 +0000
commit6630bc04bccadcf868165ad6bca5a964bb69b067 (patch)
tree59c4c5667b7c4731d4d96dcab194232b5e768fc8 /hw/usb/hcd-uhci.c
parent5cd3ae4903e33982e7a9bbd04674af517e796d6e (diff)
parent185311130f54ead75c407cdf83004d575829b5d2 (diff)
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
trivial patches for 2024-02-22 # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmXXLtwPHG1qdEB0bHMu # bXNrLnJ1AAoJEHAbT2saaT5ZKH0H/0qdQXdoc/ZTdAtUPFJGhEc6KMeOO1w9928w # OSOB7w4dJiKt6I53WtmY9f2+7/CMJHyscV3xlClRaaZeJVFzgwOo8Wjqkmwa8uOw # Nl5GcL2egBPuY7Ucc1eNIj/I4RbS1pX5vURkUfTG3AH1SEbFAv9Gk6qBtrmer2YA # hg2DdCskvPd8EOovx3sWQRH+Ra4w3hxaAELS9sa9ZKLBAaYvucYan9IjLaJqSY84 # b441QXu3ht/DpLw6d/HDWUqwYUOJD0HUhPSvba1xCsrzQVXFE7VhR5O/cDrqs2qm # 2fcMW6j62raPdK1u77WaRdslPy34YUmjk7lwZ8wiS7fmDx0Aqcg= # =0va1 # -----END PGP SIGNATURE----- # gpg: Signature made Thu 22 Feb 2024 11:24:12 GMT # gpg: using RSA key 7B73BAD68BE7A2C289314B22701B4F6B1A693E59 # gpg: issuer "mjt@tls.msk.ru" # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" [full] # gpg: aka "Michael Tokarev <mjt@corpit.ru>" [full] # gpg: aka "Michael Tokarev <mjt@debian.org>" [full] # Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D 4324 457C E0A0 8044 65C5 # Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931 4B22 701B 4F6B 1A69 3E59 * tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu: (34 commits) system/vl: Update description for input grab key docs/system: Update description for input grab key hw/hppa/Kconfig: Fix building with "configure --without-default-devices" target/sparc: correct typos s390x: correct typos m68k: correct typos hexagon: correct typos ci/gitlab-pipeline-status: correct typos qemu-options.hx: correct typos qapi/ui: correct typos pc-bios/README: correct typos hw/riscv/virt.h: correct typos hw/net/npcm_gmac.h: correct typos hw/cxl/cxl_device.h: correct typos hw/arm/omap.h: correct typos include/exec/memory.h: correct typos sh4: correct typos ppc: correct typos loongson3: correct typos accel/tcg: correct typos ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/usb/hcd-uhci.c')
-rw-r--r--hw/usb/hcd-uhci.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 7d3c026dae..a03cf22e69 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -322,7 +322,7 @@ static void uhci_reset(DeviceState *dev)
s->fl_base_addr = 0;
s->sof_timing = 64;
- for(i = 0; i < NB_PORTS; i++) {
+ for(i = 0; i < UHCI_PORTS; i++) {
port = &s->ports[i];
port->ctrl = 0x0080;
if (port->port.dev && port->port.dev->attached) {
@@ -364,7 +364,7 @@ static const VMStateDescription vmstate_uhci = {
.fields = (const VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, UHCIState),
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState, NULL),
- VMSTATE_STRUCT_ARRAY(ports, UHCIState, NB_PORTS, 1,
+ VMSTATE_STRUCT_ARRAY(ports, UHCIState, UHCI_PORTS, 1,
vmstate_uhci_port, UHCIPort),
VMSTATE_UINT16(cmd, UHCIState),
VMSTATE_UINT16(status, UHCIState),
@@ -404,7 +404,7 @@ static void uhci_port_write(void *opaque, hwaddr addr,
int i;
/* send reset on the USB bus */
- for(i = 0; i < NB_PORTS; i++) {
+ for(i = 0; i < UHCI_PORTS; i++) {
port = &s->ports[i];
usb_device_reset(port->port.dev);
}
@@ -457,8 +457,9 @@ static void uhci_port_write(void *opaque, hwaddr addr,
int n;
n = (addr >> 1) & 7;
- if (n >= NB_PORTS)
+ if (n >= UHCI_PORTS) {
return;
+ }
port = &s->ports[n];
dev = port->port.dev;
if (dev && dev->attached) {
@@ -513,8 +514,9 @@ static uint64_t uhci_port_read(void *opaque, hwaddr addr, unsigned size)
UHCIPort *port;
int n;
n = (addr >> 1) & 7;
- if (n >= NB_PORTS)
+ if (n >= UHCI_PORTS) {
goto read_default;
+ }
port = &s->ports[n];
val = port->ctrl;
}
@@ -607,7 +609,7 @@ static USBDevice *uhci_find_device(UHCIState *s, uint8_t addr)
USBDevice *dev;
int i;
- for (i = 0; i < NB_PORTS; i++) {
+ for (i = 0; i < UHCI_PORTS; i++) {
UHCIPort *port = &s->ports[i];
if (!(port->ctrl & UHCI_PORT_EN)) {
continue;
@@ -1171,11 +1173,11 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
s->irq = pci_allocate_irq(dev);
if (s->masterbus) {
- USBPort *ports[NB_PORTS];
- for(i = 0; i < NB_PORTS; i++) {
+ USBPort *ports[UHCI_PORTS];
+ for(i = 0; i < UHCI_PORTS; i++) {
ports[i] = &s->ports[i].port;
}
- usb_register_companion(s->masterbus, ports, NB_PORTS,
+ usb_register_companion(s->masterbus, ports, UHCI_PORTS,
s->firstport, s, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
&err);
@@ -1185,14 +1187,14 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
}
} else {
usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
- for (i = 0; i < NB_PORTS; i++) {
+ for (i = 0; i < UHCI_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
}
}
s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
- s->num_ports_vmstate = NB_PORTS;
+ s->num_ports_vmstate = UHCI_PORTS;
QTAILQ_INIT(&s->queues);
memory_region_init_io(&s->io_bar, OBJECT(s), &uhci_ioport_ops, s,