static void nvdimm_dsm_get_label_data(NVDIMMDevice *nvdimm, NvdimmDsmIn *in,

                                      hwaddr dsm_mem_addr)

{

    NVDIMMClass *nvc = NVDIMM_GET_CLASS(nvdimm);

    NvdimmFuncGetLabelDataIn *get_label_data;

    NvdimmFuncGetLabelDataOut *get_label_data_out;

    uint32_t status;

    int size;



    get_label_data = (NvdimmFuncGetLabelDataIn *)in->arg3;

    le32_to_cpus(&get_label_data->offset);

    le32_to_cpus(&get_label_data->length);



    nvdimm_debug("Read Label Data: offset %#x length %#x.\n",

                 get_label_data->offset, get_label_data->length);



    status = nvdimm_rw_label_data_check(nvdimm, get_label_data->offset,

                                        get_label_data->length);

    if (status != 0 /* Success */) {

        nvdimm_dsm_no_payload(status, dsm_mem_addr);

        return;

    }



    size = sizeof(*get_label_data_out) + get_label_data->length;

    assert(size <= 4096);

    get_label_data_out = g_malloc(size);



    get_label_data_out->len = cpu_to_le32(size);

    get_label_data_out->func_ret_status = cpu_to_le32(0 /* Success */);

    nvc->read_label_data(nvdimm, get_label_data_out->out_buf,

                         get_label_data->length, get_label_data->offset);



    cpu_physical_memory_write(dsm_mem_addr, get_label_data_out, size);

    g_free(get_label_data_out);

}

static void nvdimm_dsm_get_label_data(NVDIMMDevice *nvdimm, NvdimmDsmIn *in,

                                      hwaddr dsm_mem_addr)

{

    NVDIMMClass *nvc = NVDIMM_GET_CLASS(nvdimm);

    NvdimmFuncGetLabelDataIn *get_label_data;

    NvdimmFuncGetLabelDataOut *get_label_data_out;

    uint32_t status;

    int size;



    get_label_data = (NvdimmFuncGetLabelDataIn *)in->arg3;

    le32_to_cpus(&get_label_data->offset);

    le32_to_cpus(&get_label_data->length);



    nvdimm_debug("Read Label Data: offset %#x length %#x.\n",

                 get_label_data->offset, get_label_data->length);



    status = nvdimm_rw_label_data_check(nvdimm, get_label_data->offset,

                                        get_label_data->length);

    if (status != 0 ) {

        nvdimm_dsm_no_payload(status, dsm_mem_addr);

        return;

    }



    size = sizeof(*get_label_data_out) + get_label_data->length;

    assert(size <= 4096);

    get_label_data_out = g_malloc(size);



    get_label_data_out->len = cpu_to_le32(size);

    get_label_data_out->func_ret_status = cpu_to_le32(0 );

    nvc->read_label_data(nvdimm, get_label_data_out->out_buf,

                         get_label_data->length, get_label_data->offset);



    cpu_physical_memory_write(dsm_mem_addr, get_label_data_out, size);

    g_free(get_label_data_out);

}

static void FUNC_0(NVDIMMDevice *VAR_0, NvdimmDsmIn *VAR_1,

                                      hwaddr VAR_2)

{

    NVDIMMClass *nvc = NVDIMM_GET_CLASS(VAR_0);

    NvdimmFuncGetLabelDataIn *get_label_data;

    NvdimmFuncGetLabelDataOut *get_label_data_out;

    uint32_t status;

    int VAR_3;



    get_label_data = (NvdimmFuncGetLabelDataIn *)VAR_1->arg3;

    le32_to_cpus(&get_label_data->offset);

    le32_to_cpus(&get_label_data->length);



    nvdimm_debug("Read Label Data: offset %#x length %#x.\n",

                 get_label_data->offset, get_label_data->length);



    status = nvdimm_rw_label_data_check(VAR_0, get_label_data->offset,

                                        get_label_data->length);

    if (status != 0 ) {

        nvdimm_dsm_no_payload(status, VAR_2);

        return;

    }



    VAR_3 = sizeof(*get_label_data_out) + get_label_data->length;

    assert(VAR_3 <= 4096);

    get_label_data_out = g_malloc(VAR_3);



    get_label_data_out->len = cpu_to_le32(VAR_3);

    get_label_data_out->func_ret_status = cpu_to_le32(0 );

    nvc->read_label_data(VAR_0, get_label_data_out->out_buf,

                         get_label_data->length, get_label_data->offset);



    cpu_physical_memory_write(VAR_2, get_label_data_out, VAR_3);

    g_free(get_label_data_out);

}

static void FUNC_0(NVDIMMDevice *VAR_0, NvdimmDsmIn *VAR_1,
hwaddr VAR_2)
{ NVDIMMClass *nvc = NVDIMM_GET_CLASS(VAR_0); NvdimmFuncGetLabelDataIn *get_label_data; NvdimmFuncGetLabelDataOut *get_label_data_out; uint32_t status; int VAR_3; get_label_data = (NvdimmFuncGetLabelDataIn *)VAR_1->arg3; le32_to_cpus(&get_label_data->offset); le32_to_cpus(&get_label_data->length); nvdimm_debug("Read Label Data: offset %#x length %#x.\n",
get_label_data->offset, get_label_data->length); status = nvdimm_rw_label_data_check(VAR_0, get_label_data->offset,
get_label_data->length); if (status != 0 ) { nvdimm_dsm_no_payload(status, VAR_2); return; } VAR_3 = sizeof(*get_label_data_out) + get_label_data->length; assert(VAR_3 <= 4096); get_label_data_out = g_malloc(VAR_3); get_label_data_out->len = cpu_to_le32(VAR_3); get_label_data_out->func_ret_status = cpu_to_le32(0 ); nvc->read_label_data(VAR_0, get_label_data_out->out_buf,
get_label_data->length, get_label_data->offset); cpu_physical_memory_write(VAR_2, get_label_data_out, VAR_3); g_free(get_label_data_out); }