static void xhci_port_update(XHCIPort *port, int is_detach)

{

    port->portsc = PORTSC_PP;

    if (port->uport->dev && port->uport->dev->attached && !is_detach &&

        (1 << port->uport->dev->speed) & port->speedmask) {

        port->portsc |= PORTSC_CCS;

        switch (port->uport->dev->speed) {

        case USB_SPEED_LOW:

            port->portsc |= PORTSC_SPEED_LOW;

            break;

        case USB_SPEED_FULL:

            port->portsc |= PORTSC_SPEED_FULL;

            break;

        case USB_SPEED_HIGH:

            port->portsc |= PORTSC_SPEED_HIGH;

            break;

        case USB_SPEED_SUPER:

            port->portsc |= PORTSC_SPEED_SUPER;

            break;

        }

    }



    if (xhci_running(port->xhci)) {

        port->portsc |= PORTSC_CSC;

        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,

                         port->portnr << 24};

        xhci_event(port->xhci, &ev, 0);

        DPRINTF("xhci: port change event for port %d\n", port->portnr);

    }

}

static void xhci_port_update(XHCIPort *port, int is_detach)

{

    port->portsc = PORTSC_PP;

    if (port->uport->dev && port->uport->dev->attached && !is_detach &&

        (1 << port->uport->dev->speed) & port->speedmask) {

        port->portsc |= PORTSC_CCS;

        switch (port->uport->dev->speed) {

        case USB_SPEED_LOW:

            port->portsc |= PORTSC_SPEED_LOW;

            break;

        case USB_SPEED_FULL:

            port->portsc |= PORTSC_SPEED_FULL;

            break;

        case USB_SPEED_HIGH:

            port->portsc |= PORTSC_SPEED_HIGH;

            break;

        case USB_SPEED_SUPER:

            port->portsc |= PORTSC_SPEED_SUPER;

            break;

        }

    }



    if (xhci_running(port->xhci)) {

        port->portsc |= PORTSC_CSC;

        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,

                         port->portnr << 24};

        xhci_event(port->xhci, &ev, 0);

        DPRINTF("xhci: port change event for port %d\n", port->portnr);

    }

}

static void FUNC_0(XHCIPort *VAR_0, int VAR_1)

{

    VAR_0->portsc = PORTSC_PP;

    if (VAR_0->uport->dev && VAR_0->uport->dev->attached && !VAR_1 &&

        (1 << VAR_0->uport->dev->speed) & VAR_0->speedmask) {

        VAR_0->portsc |= PORTSC_CCS;

        switch (VAR_0->uport->dev->speed) {

        case USB_SPEED_LOW:

            VAR_0->portsc |= PORTSC_SPEED_LOW;

            break;

        case USB_SPEED_FULL:

            VAR_0->portsc |= PORTSC_SPEED_FULL;

            break;

        case USB_SPEED_HIGH:

            VAR_0->portsc |= PORTSC_SPEED_HIGH;

            break;

        case USB_SPEED_SUPER:

            VAR_0->portsc |= PORTSC_SPEED_SUPER;

            break;

        }

    }



    if (xhci_running(VAR_0->xhci)) {

        VAR_0->portsc |= PORTSC_CSC;

        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,

                         VAR_0->portnr << 24};

        xhci_event(VAR_0->xhci, &ev, 0);

        DPRINTF("xhci: VAR_0 change event for VAR_0 %d\n", VAR_0->portnr);

    }

}

static void FUNC_0(XHCIPort *VAR_0, int VAR_1)
{ VAR_0->portsc = PORTSC_PP; if (VAR_0->uport->dev && VAR_0->uport->dev->attached && !VAR_1 &&
(1 << VAR_0->uport->dev->speed) & VAR_0->speedmask) { VAR_0->portsc |= PORTSC_CCS; switch (VAR_0->uport->dev->speed) { case USB_SPEED_LOW:
VAR_0->portsc |= PORTSC_SPEED_LOW; break; case USB_SPEED_FULL:
VAR_0->portsc |= PORTSC_SPEED_FULL; break; case USB_SPEED_HIGH:
VAR_0->portsc |= PORTSC_SPEED_HIGH; break; case USB_SPEED_SUPER:
VAR_0->portsc |= PORTSC_SPEED_SUPER; break; } } if (xhci_running(VAR_0->xhci)) { VAR_0->portsc |= PORTSC_CSC; XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS, VAR_0->portnr << 24}; xhci_event(VAR_0->xhci, &ev, 0); DPRINTF("xhci: VAR_0 change event for VAR_0 %d\n", VAR_0->portnr); } }