static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_action)

{

    struct hp_log_full *new_hp;

    struct rtas_error_log *hdr;

    struct rtas_event_log_v6 *v6hdr;

    struct rtas_event_log_v6_maina *maina;

    struct rtas_event_log_v6_mainb *mainb;

    struct rtas_event_log_v6_hp *hp;

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    sPAPRDRConnectorType drc_type = drck->get_type(drc);



    new_hp = g_malloc0(sizeof(struct hp_log_full));

    hdr = &new_hp->hdr;

    v6hdr = &new_hp->v6hdr;

    maina = &new_hp->maina;

    mainb = &new_hp->mainb;

    hp = &new_hp->hp;



    hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6

                               | RTAS_LOG_SEVERITY_EVENT

                               | RTAS_LOG_DISPOSITION_NOT_RECOVERED

                               | RTAS_LOG_OPTIONAL_PART_PRESENT

                               | RTAS_LOG_INITIATOR_HOTPLUG

                               | RTAS_LOG_TYPE_HOTPLUG);

    hdr->extended_length = cpu_to_be32(sizeof(*new_hp)

                                       - sizeof(new_hp->hdr));



    spapr_init_v6hdr(v6hdr);

    spapr_init_maina(maina, 3 /* Main-A, Main-B, HP */);



    mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);

    mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb));

    mainb->subsystem_id = 0x80; /* External environment */

    mainb->event_severity = 0x00; /* Informational / non-error */

    mainb->event_subtype = 0x00; /* Normal shutdown */



    hp->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG);

    hp->hdr.section_length = cpu_to_be16(sizeof(*hp));

    hp->hdr.section_version = 1; /* includes extended modifier */

    hp->hotplug_action = hp_action;





    switch (drc_type) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        hp->drc.index = cpu_to_be32(drck->get_index(drc));

        hp->hotplug_identifier = RTAS_LOG_V6_HP_ID_DRC_INDEX;

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        break;

    default:

        /* we shouldn't be signaling hotplug events for resources

         * that don't support them

         */

        g_assert(false);

        return;

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp);



    qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq));

}

static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_action)

{

    struct hp_log_full *new_hp;

    struct rtas_error_log *hdr;

    struct rtas_event_log_v6 *v6hdr;

    struct rtas_event_log_v6_maina *maina;

    struct rtas_event_log_v6_mainb *mainb;

    struct rtas_event_log_v6_hp *hp;

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    sPAPRDRConnectorType drc_type = drck->get_type(drc);



    new_hp = g_malloc0(sizeof(struct hp_log_full));

    hdr = &new_hp->hdr;

    v6hdr = &new_hp->v6hdr;

    maina = &new_hp->maina;

    mainb = &new_hp->mainb;

    hp = &new_hp->hp;



    hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6

                               | RTAS_LOG_SEVERITY_EVENT

                               | RTAS_LOG_DISPOSITION_NOT_RECOVERED

                               | RTAS_LOG_OPTIONAL_PART_PRESENT

                               | RTAS_LOG_INITIATOR_HOTPLUG

                               | RTAS_LOG_TYPE_HOTPLUG);

    hdr->extended_length = cpu_to_be32(sizeof(*new_hp)

                                       - sizeof(new_hp->hdr));



    spapr_init_v6hdr(v6hdr);

    spapr_init_maina(maina, 3 );



    mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);

    mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb));

    mainb->subsystem_id = 0x80; 

    mainb->event_severity = 0x00; 

    mainb->event_subtype = 0x00; 



    hp->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG);

    hp->hdr.section_length = cpu_to_be16(sizeof(*hp));

    hp->hdr.section_version = 1; 

    hp->hotplug_action = hp_action;





    switch (drc_type) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        hp->drc.index = cpu_to_be32(drck->get_index(drc));

        hp->hotplug_identifier = RTAS_LOG_V6_HP_ID_DRC_INDEX;

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        break;

    default:

        





        g_assert(false);

        return;

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp);



    qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq));

}

static void FUNC_0(sPAPRDRConnector *VAR_0, uint8_t VAR_1)

{

    struct hp_log_full *VAR_2;

    struct rtas_error_log *VAR_3;

    struct rtas_event_log_v6 *VAR_4;

    struct rtas_event_log_v6_maina *VAR_5;

    struct rtas_event_log_v6_mainb *VAR_6;

    struct rtas_event_log_v6_hp *VAR_7;

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(VAR_0);

    sPAPRDRConnectorType drc_type = drck->get_type(VAR_0);



    VAR_2 = g_malloc0(sizeof(struct hp_log_full));

    VAR_3 = &VAR_2->VAR_3;

    VAR_4 = &VAR_2->VAR_4;

    VAR_5 = &VAR_2->VAR_5;

    VAR_6 = &VAR_2->VAR_6;

    VAR_7 = &VAR_2->VAR_7;



    VAR_3->summary = cpu_to_be32(RTAS_LOG_VERSION_6

                               | RTAS_LOG_SEVERITY_EVENT

                               | RTAS_LOG_DISPOSITION_NOT_RECOVERED

                               | RTAS_LOG_OPTIONAL_PART_PRESENT

                               | RTAS_LOG_INITIATOR_HOTPLUG

                               | RTAS_LOG_TYPE_HOTPLUG);

    VAR_3->extended_length = cpu_to_be32(sizeof(*VAR_2)

                                       - sizeof(VAR_2->VAR_3));



    spapr_init_v6hdr(VAR_4);

    spapr_init_maina(VAR_5, 3 );



    VAR_6->VAR_3.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);

    VAR_6->VAR_3.section_length = cpu_to_be16(sizeof(*VAR_6));

    VAR_6->subsystem_id = 0x80; 

    VAR_6->event_severity = 0x00; 

    VAR_6->event_subtype = 0x00; 



    VAR_7->VAR_3.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG);

    VAR_7->VAR_3.section_length = cpu_to_be16(sizeof(*VAR_7));

    VAR_7->VAR_3.section_version = 1; 

    VAR_7->hotplug_action = VAR_1;





    switch (drc_type) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        VAR_7->VAR_0.index = cpu_to_be32(drck->get_index(VAR_0));

        VAR_7->hotplug_identifier = RTAS_LOG_V6_HP_ID_DRC_INDEX;

        VAR_7->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        break;

    default:

        





        g_assert(false);

        return;

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, VAR_2);



    qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq));

}

static void FUNC_0(sPAPRDRConnector *VAR_0, uint8_t VAR_1)
{ struct hp_log_full *VAR_2; struct rtas_error_log *VAR_3; struct rtas_event_log_v6 *VAR_4; struct rtas_event_log_v6_maina *VAR_5; struct rtas_event_log_v6_mainb *VAR_6; struct rtas_event_log_v6_hp *VAR_7; sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(VAR_0); sPAPRDRConnectorType drc_type = drck->get_type(VAR_0); VAR_2 = g_malloc0(sizeof(struct hp_log_full)); VAR_3 = &VAR_2->VAR_3; VAR_4 = &VAR_2->VAR_4; VAR_5 = &VAR_2->VAR_5; VAR_6 = &VAR_2->VAR_6; VAR_7 = &VAR_2->VAR_7; VAR_3->summary = cpu_to_be32(RTAS_LOG_VERSION_6
| RTAS_LOG_SEVERITY_EVENT
| RTAS_LOG_DISPOSITION_NOT_RECOVERED
| RTAS_LOG_OPTIONAL_PART_PRESENT
| RTAS_LOG_INITIATOR_HOTPLUG
| RTAS_LOG_TYPE_HOTPLUG); VAR_3->extended_length = cpu_to_be32(sizeof(*VAR_2)
- sizeof(VAR_2->VAR_3)); spapr_init_v6hdr(VAR_4); spapr_init_maina(VAR_5, 3 ); VAR_6->VAR_3.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB); VAR_6->VAR_3.section_length = cpu_to_be16(sizeof(*VAR_6)); VAR_6->subsystem_id = 0x80; VAR_6->event_severity = 0x00; VAR_6->event_subtype = 0x00; VAR_7->VAR_3.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG); VAR_7->VAR_3.section_length = cpu_to_be16(sizeof(*VAR_7)); VAR_7->VAR_3.section_version = 1; VAR_7->hotplug_action = VAR_1; switch (drc_type) { case SPAPR_DR_CONNECTOR_TYPE_PCI:
VAR_7->VAR_0.index = cpu_to_be32(drck->get_index(VAR_0)); VAR_7->hotplug_identifier = RTAS_LOG_V6_HP_ID_DRC_INDEX; VAR_7->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI; break; default:
g_assert(false); return; } rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, VAR_2); qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)); }