static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx)

{

    USBPort *uport;

    char path[32];

    int i, pos, port;



    port = (slot_ctx[1]>>16) & 0xFF;




    port = xhci->ports[port-1].uport->index+1;

    pos = snprintf(path, sizeof(path), "%d", port);

    for (i = 0; i < 5; i++) {

        port = (slot_ctx[0] >> 4*i) & 0x0f;

        if (!port) {

            break;


        pos += snprintf(path + pos, sizeof(path) - pos, ".%d", port);




    QTAILQ_FOREACH(uport, &xhci->bus.used, next) {

        if (strcmp(uport->path, path) == 0) {

            return uport;




static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx)

{

    USBPort *uport;

    char path[32];

    int i, pos, port;



    port = (slot_ctx[1]>>16) & 0xFF;




    port = xhci->ports[port-1].uport->index+1;

    pos = snprintf(path, sizeof(path), "%d", port);

    for (i = 0; i < 5; i++) {

        port = (slot_ctx[0] >> 4*i) & 0x0f;

        if (!port) {

            break;


        pos += snprintf(path + pos, sizeof(path) - pos, ".%d", port);




    QTAILQ_FOREACH(uport, &xhci->bus.used, next) {

        if (strcmp(uport->path, path) == 0) {

            return uport;




static USBPort *FUNC_0(XHCIState *xhci, uint32_t *slot_ctx)

{

    USBPort *uport;

    char VAR_0[32];

    int VAR_1, VAR_2, VAR_3;



    VAR_3 = (slot_ctx[1]>>16) & 0xFF;




    VAR_3 = xhci->ports[VAR_3-1].uport->index+1;

    VAR_2 = snprintf(VAR_0, sizeof(VAR_0), "%d", VAR_3);

    for (VAR_1 = 0; VAR_1 < 5; VAR_1++) {

        VAR_3 = (slot_ctx[0] >> 4*VAR_1) & 0x0f;

        if (!VAR_3) {

            break;


        VAR_2 += snprintf(VAR_0 + VAR_2, sizeof(VAR_0) - VAR_2, ".%d", VAR_3);




    QTAILQ_FOREACH(uport, &xhci->bus.used, next) {

        if (strcmp(uport->VAR_0, VAR_0) == 0) {

            return uport;




static USBPort *FUNC_0(XHCIState *xhci, uint32_t *slot_ctx)
{ USBPort *uport; char VAR_0[32]; int VAR_1, VAR_2, VAR_3; VAR_3 = (slot_ctx[1]>>16) & 0xFF; VAR_3 = xhci->ports[VAR_3-1].uport->index+1; VAR_2 = snprintf(VAR_0, sizeof(VAR_0), "%d", VAR_3); for (VAR_1 = 0; VAR_1 < 5; VAR_1++) { VAR_3 = (slot_ctx[0] >> 4*VAR_1) & 0x0f; if (!VAR_3) { break; VAR_2 += snprintf(VAR_0 + VAR_2, sizeof(VAR_0) - VAR_2, ".%d", VAR_3); QTAILQ_FOREACH(uport, &xhci->bus.used, next) { if (strcmp(uport->VAR_0, VAR_0) == 0) { return uport;