static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action,

                                    sPAPRDRConnectorType drc_type,

                                    uint32_t drc)

{

    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());

    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;



    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;

    hp->hotplug_identifier = hp_id;



    switch (drc_type) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        if (hp->hotplug_action == RTAS_LOG_V6_HP_ACTION_ADD) {

            spapr_hotplug_set_signalled(drc);

        }

        break;

    case SPAPR_DR_CONNECTOR_TYPE_LMB:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_MEMORY;

        break;

    case SPAPR_DR_CONNECTOR_TYPE_CPU:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_CPU;

        break;

    default:

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

         * that don't support them

         */

        g_assert(false);

        return;

    }



    if (hp_id == RTAS_LOG_V6_HP_ID_DRC_COUNT) {

        hp->drc.count = cpu_to_be32(drc);

    } else if (hp_id == RTAS_LOG_V6_HP_ID_DRC_INDEX) {

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

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true);



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

}

static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action,

                                    sPAPRDRConnectorType drc_type,

                                    uint32_t drc)

{

    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());

    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;



    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;

    hp->hotplug_identifier = hp_id;



    switch (drc_type) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        if (hp->hotplug_action == RTAS_LOG_V6_HP_ACTION_ADD) {

            spapr_hotplug_set_signalled(drc);

        }

        break;

    case SPAPR_DR_CONNECTOR_TYPE_LMB:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_MEMORY;

        break;

    case SPAPR_DR_CONNECTOR_TYPE_CPU:

        hp->hotplug_type = RTAS_LOG_V6_HP_TYPE_CPU;

        break;

    default:

        





        g_assert(false);

        return;

    }



    if (hp_id == RTAS_LOG_V6_HP_ID_DRC_COUNT) {

        hp->drc.count = cpu_to_be32(drc);

    } else if (hp_id == RTAS_LOG_V6_HP_ID_DRC_INDEX) {

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

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true);



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

}

static void FUNC_0(uint8_t VAR_0, uint8_t VAR_1,

                                    sPAPRDRConnectorType VAR_2,

                                    uint32_t VAR_3)

{

    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());

    struct hp_log_full *VAR_4;

    struct rtas_error_log *VAR_5;

    struct rtas_event_log_v6 *VAR_6;

    struct rtas_event_log_v6_maina *VAR_7;

    struct rtas_event_log_v6_mainb *VAR_8;

    struct rtas_event_log_v6_hp *VAR_9;



    VAR_4 = g_malloc0(sizeof(struct hp_log_full));

    VAR_5 = &VAR_4->VAR_5;

    VAR_6 = &VAR_4->VAR_6;

    VAR_7 = &VAR_4->VAR_7;

    VAR_8 = &VAR_4->VAR_8;

    VAR_9 = &VAR_4->VAR_9;



    VAR_5->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_5->extended_length = cpu_to_be32(sizeof(*VAR_4)

                                       - sizeof(VAR_4->VAR_5));



    spapr_init_v6hdr(VAR_6);

    spapr_init_maina(VAR_7, 3 );



    VAR_8->VAR_5.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);

    VAR_8->VAR_5.section_length = cpu_to_be16(sizeof(*VAR_8));

    VAR_8->subsystem_id = 0x80; 

    VAR_8->event_severity = 0x00; 

    VAR_8->event_subtype = 0x00; 



    VAR_9->VAR_5.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG);

    VAR_9->VAR_5.section_length = cpu_to_be16(sizeof(*VAR_9));

    VAR_9->VAR_5.section_version = 1; 

    VAR_9->hotplug_action = VAR_1;

    VAR_9->hotplug_identifier = VAR_0;



    switch (VAR_2) {

    case SPAPR_DR_CONNECTOR_TYPE_PCI:

        VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI;

        if (VAR_9->hotplug_action == RTAS_LOG_V6_HP_ACTION_ADD) {

            spapr_hotplug_set_signalled(VAR_3);

        }

        break;

    case SPAPR_DR_CONNECTOR_TYPE_LMB:

        VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_MEMORY;

        break;

    case SPAPR_DR_CONNECTOR_TYPE_CPU:

        VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_CPU;

        break;

    default:

        





        g_assert(false);

        return;

    }



    if (VAR_0 == RTAS_LOG_V6_HP_ID_DRC_COUNT) {

        VAR_9->VAR_3.count = cpu_to_be32(VAR_3);

    } else if (VAR_0 == RTAS_LOG_V6_HP_ID_DRC_INDEX) {

        VAR_9->VAR_3.index = cpu_to_be32(VAR_3);

    }



    rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, VAR_4, true);



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

}

static void FUNC_0(uint8_t VAR_0, uint8_t VAR_1,
sPAPRDRConnectorType VAR_2,
uint32_t VAR_3)
{ sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); struct hp_log_full *VAR_4; struct rtas_error_log *VAR_5; struct rtas_event_log_v6 *VAR_6; struct rtas_event_log_v6_maina *VAR_7; struct rtas_event_log_v6_mainb *VAR_8; struct rtas_event_log_v6_hp *VAR_9; VAR_4 = g_malloc0(sizeof(struct hp_log_full)); VAR_5 = &VAR_4->VAR_5; VAR_6 = &VAR_4->VAR_6; VAR_7 = &VAR_4->VAR_7; VAR_8 = &VAR_4->VAR_8; VAR_9 = &VAR_4->VAR_9; VAR_5->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_5->extended_length = cpu_to_be32(sizeof(*VAR_4)
- sizeof(VAR_4->VAR_5)); spapr_init_v6hdr(VAR_6); spapr_init_maina(VAR_7, 3 ); VAR_8->VAR_5.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB); VAR_8->VAR_5.section_length = cpu_to_be16(sizeof(*VAR_8)); VAR_8->subsystem_id = 0x80; VAR_8->event_severity = 0x00; VAR_8->event_subtype = 0x00; VAR_9->VAR_5.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_HOTPLUG); VAR_9->VAR_5.section_length = cpu_to_be16(sizeof(*VAR_9)); VAR_9->VAR_5.section_version = 1; VAR_9->hotplug_action = VAR_1; VAR_9->hotplug_identifier = VAR_0; switch (VAR_2) { case SPAPR_DR_CONNECTOR_TYPE_PCI:
VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_PCI; if (VAR_9->hotplug_action == RTAS_LOG_V6_HP_ACTION_ADD) { spapr_hotplug_set_signalled(VAR_3); } break; case SPAPR_DR_CONNECTOR_TYPE_LMB:
VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_MEMORY; break; case SPAPR_DR_CONNECTOR_TYPE_CPU:
VAR_9->hotplug_type = RTAS_LOG_V6_HP_TYPE_CPU; break; default:
g_assert(false); return; } if (VAR_0 == RTAS_LOG_V6_HP_ID_DRC_COUNT) { VAR_9->VAR_3.count = cpu_to_be32(VAR_3); } else if (VAR_0 == RTAS_LOG_V6_HP_ID_DRC_INDEX) { VAR_9->VAR_3.index = cpu_to_be32(VAR_3); } rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, VAR_4, true); qemu_irq_pulse(xics_get_qirq(spapr->xics, spapr->check_exception_irq)); }