static void ehci_reset(void *opaque)

{

    EHCIState *s = opaque;

    int i;

    USBDevice *devs[NB_PORTS];



    trace_usb_ehci_reset();



    /*

     * Do the detach before touching portsc, so that it correctly gets send to

     * us or to our companion based on PORTSC_POWNER before the reset.

     */

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

        devs[i] = s->ports[i].dev;

        if (devs[i]) {

            usb_attach(&s->ports[i], NULL);

        }

    }



    memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);



    s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH;

    s->usbsts = USBSTS_HALT;



    s->astate = EST_INACTIVE;

    s->pstate = EST_INACTIVE;

    s->isoch_pause = -1;

    s->attach_poll_counter = 0;



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

        if (s->companion_ports[i]) {

            s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER;

        } else {

            s->portsc[i] = PORTSC_PPOWER;

        }

        if (devs[i]) {

            usb_attach(&s->ports[i], devs[i]);

        }

    }

    ehci_queues_rip_all(s);

}

static void ehci_reset(void *opaque)

{

    EHCIState *s = opaque;

    int i;

    USBDevice *devs[NB_PORTS];



    trace_usb_ehci_reset();



    







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

        devs[i] = s->ports[i].dev;

        if (devs[i]) {

            usb_attach(&s->ports[i], NULL);

        }

    }



    memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);



    s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH;

    s->usbsts = USBSTS_HALT;



    s->astate = EST_INACTIVE;

    s->pstate = EST_INACTIVE;

    s->isoch_pause = -1;

    s->attach_poll_counter = 0;



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

        if (s->companion_ports[i]) {

            s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER;

        } else {

            s->portsc[i] = PORTSC_PPOWER;

        }

        if (devs[i]) {

            usb_attach(&s->ports[i], devs[i]);

        }

    }

    ehci_queues_rip_all(s);

}

static void FUNC_0(void *VAR_0)

{

    EHCIState *s = VAR_0;

    int VAR_1;

    USBDevice *devs[NB_PORTS];



    trace_usb_ehci_reset();



    







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

        devs[VAR_1] = s->ports[VAR_1].dev;

        if (devs[VAR_1]) {

            usb_attach(&s->ports[VAR_1], NULL);

        }

    }



    memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE);



    s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH;

    s->usbsts = USBSTS_HALT;



    s->astate = EST_INACTIVE;

    s->pstate = EST_INACTIVE;

    s->isoch_pause = -1;

    s->attach_poll_counter = 0;



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

        if (s->companion_ports[VAR_1]) {

            s->portsc[VAR_1] = PORTSC_POWNER | PORTSC_PPOWER;

        } else {

            s->portsc[VAR_1] = PORTSC_PPOWER;

        }

        if (devs[VAR_1]) {

            usb_attach(&s->ports[VAR_1], devs[VAR_1]);

        }

    }

    ehci_queues_rip_all(s);

}

static void FUNC_0(void *VAR_0)
{ EHCIState *s = VAR_0; int VAR_1; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) { devs[VAR_1] = s->ports[VAR_1].dev; if (devs[VAR_1]) { usb_attach(&s->ports[VAR_1], NULL); } } memset(&s->mmio[OPREGBASE], 0x00, MMIO_SIZE - OPREGBASE); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; s->isoch_pause = -1; s->attach_poll_counter = 0; for(VAR_1 = 0; VAR_1 < NB_PORTS; VAR_1++) { if (s->companion_ports[VAR_1]) { s->portsc[VAR_1] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[VAR_1] = PORTSC_PPOWER; } if (devs[VAR_1]) { usb_attach(&s->ports[VAR_1], devs[VAR_1]); } } ehci_queues_rip_all(s); }