hw/usb/uhci: Rename NB_PORTS -> UHCI_PORTS
Rename NB_PORTS as UHCI_PORTS to avoid definition clash with EHCI equivalent: hw/usb/hcd-uhci.h:38:9: error: 'NB_PORTS' macro redefined [-Werror,-Wmacro-redefined] #define NB_PORTS 2 ^ hw/usb/hcd-ehci.h:40:9: note: previous definition is here #define NB_PORTS 6 /* Max. Number of downstream ports */ ^ Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
455177ffc4
commit
fe693e32c8
@ -322,7 +322,7 @@ static void uhci_reset(DeviceState *dev)
|
|||||||
s->fl_base_addr = 0;
|
s->fl_base_addr = 0;
|
||||||
s->sof_timing = 64;
|
s->sof_timing = 64;
|
||||||
|
|
||||||
for(i = 0; i < NB_PORTS; i++) {
|
for(i = 0; i < UHCI_PORTS; i++) {
|
||||||
port = &s->ports[i];
|
port = &s->ports[i];
|
||||||
port->ctrl = 0x0080;
|
port->ctrl = 0x0080;
|
||||||
if (port->port.dev && port->port.dev->attached) {
|
if (port->port.dev && port->port.dev->attached) {
|
||||||
@ -364,7 +364,7 @@ static const VMStateDescription vmstate_uhci = {
|
|||||||
.fields = (const VMStateField[]) {
|
.fields = (const VMStateField[]) {
|
||||||
VMSTATE_PCI_DEVICE(dev, UHCIState),
|
VMSTATE_PCI_DEVICE(dev, UHCIState),
|
||||||
VMSTATE_UINT8_EQUAL(num_ports_vmstate, UHCIState, NULL),
|
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_uhci_port, UHCIPort),
|
||||||
VMSTATE_UINT16(cmd, UHCIState),
|
VMSTATE_UINT16(cmd, UHCIState),
|
||||||
VMSTATE_UINT16(status, UHCIState),
|
VMSTATE_UINT16(status, UHCIState),
|
||||||
@ -404,7 +404,7 @@ static void uhci_port_write(void *opaque, hwaddr addr,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* send reset on the USB bus */
|
/* send reset on the USB bus */
|
||||||
for(i = 0; i < NB_PORTS; i++) {
|
for(i = 0; i < UHCI_PORTS; i++) {
|
||||||
port = &s->ports[i];
|
port = &s->ports[i];
|
||||||
usb_device_reset(port->port.dev);
|
usb_device_reset(port->port.dev);
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ static void uhci_port_write(void *opaque, hwaddr addr,
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = (addr >> 1) & 7;
|
n = (addr >> 1) & 7;
|
||||||
if (n >= NB_PORTS) {
|
if (n >= UHCI_PORTS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
port = &s->ports[n];
|
port = &s->ports[n];
|
||||||
@ -514,7 +514,7 @@ static uint64_t uhci_port_read(void *opaque, hwaddr addr, unsigned size)
|
|||||||
UHCIPort *port;
|
UHCIPort *port;
|
||||||
int n;
|
int n;
|
||||||
n = (addr >> 1) & 7;
|
n = (addr >> 1) & 7;
|
||||||
if (n >= NB_PORTS) {
|
if (n >= UHCI_PORTS) {
|
||||||
goto read_default;
|
goto read_default;
|
||||||
}
|
}
|
||||||
port = &s->ports[n];
|
port = &s->ports[n];
|
||||||
@ -609,7 +609,7 @@ static USBDevice *uhci_find_device(UHCIState *s, uint8_t addr)
|
|||||||
USBDevice *dev;
|
USBDevice *dev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < NB_PORTS; i++) {
|
for (i = 0; i < UHCI_PORTS; i++) {
|
||||||
UHCIPort *port = &s->ports[i];
|
UHCIPort *port = &s->ports[i];
|
||||||
if (!(port->ctrl & UHCI_PORT_EN)) {
|
if (!(port->ctrl & UHCI_PORT_EN)) {
|
||||||
continue;
|
continue;
|
||||||
@ -1173,11 +1173,11 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
|
|||||||
s->irq = pci_allocate_irq(dev);
|
s->irq = pci_allocate_irq(dev);
|
||||||
|
|
||||||
if (s->masterbus) {
|
if (s->masterbus) {
|
||||||
USBPort *ports[NB_PORTS];
|
USBPort *ports[UHCI_PORTS];
|
||||||
for(i = 0; i < NB_PORTS; i++) {
|
for(i = 0; i < UHCI_PORTS; i++) {
|
||||||
ports[i] = &s->ports[i].port;
|
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,
|
s->firstport, s, &uhci_port_ops,
|
||||||
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
|
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
|
||||||
&err);
|
&err);
|
||||||
@ -1187,14 +1187,14 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
|
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_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
|
||||||
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
|
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
|
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->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);
|
QTAILQ_INIT(&s->queues);
|
||||||
|
|
||||||
memory_region_init_io(&s->io_bar, OBJECT(s), &uhci_ioport_ops, s,
|
memory_region_init_io(&s->io_bar, OBJECT(s), &uhci_ioport_ops, s,
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
typedef struct UHCIQueue UHCIQueue;
|
typedef struct UHCIQueue UHCIQueue;
|
||||||
|
|
||||||
#define NB_PORTS 2
|
#define UHCI_PORTS 2
|
||||||
|
|
||||||
typedef struct UHCIPort {
|
typedef struct UHCIPort {
|
||||||
USBPort port;
|
USBPort port;
|
||||||
@ -59,7 +59,7 @@ typedef struct UHCIState {
|
|||||||
uint32_t frame_bytes;
|
uint32_t frame_bytes;
|
||||||
uint32_t frame_bandwidth;
|
uint32_t frame_bandwidth;
|
||||||
bool completions_only;
|
bool completions_only;
|
||||||
UHCIPort ports[NB_PORTS];
|
UHCIPort ports[UHCI_PORTS];
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
/* Interrupts that should be raised at the end of the current frame. */
|
/* Interrupts that should be raised at the end of the current frame. */
|
||||||
uint32_t pending_int_mask;
|
uint32_t pending_int_mask;
|
||||||
|
Loading…
Reference in New Issue
Block a user