Lines Matching +full:label +full:- +full:revision

33 #include "hw/acpi/aml-build.h"
34 #include "hw/acpi/bios-linker-loader.h"
37 #include "qemu/nvdimm-utils.h"
157 * ACPI device - nfit_memdev.nfit_handle matches with the value returned
192 for (list = device_list; list; list = list->next) { in nvdimm_get_device_by_handle()
193 NVDIMMDevice *nvd = list->data; in nvdimm_get_device_by_handle()
223 nfit_spa->type = cpu_to_le16(0 /* System Physical Address Range in nvdimm_build_structure_spa()
225 nfit_spa->length = cpu_to_le16(sizeof(*nfit_spa)); in nvdimm_build_structure_spa()
226 nfit_spa->spa_index = cpu_to_le16(nvdimm_slot_to_spa_index(slot)); in nvdimm_build_structure_spa()
232 nfit_spa->flags = cpu_to_le16(1 /* Control region is strictly for in nvdimm_build_structure_spa()
239 nfit_spa->proximity_domain = cpu_to_le32(node); in nvdimm_build_structure_spa()
241 memcpy(nfit_spa->type_guid, nvdimm_nfit_spa_uuid, in nvdimm_build_structure_spa()
244 nfit_spa->spa_base = cpu_to_le64(addr); in nvdimm_build_structure_spa()
245 nfit_spa->spa_length = cpu_to_le64(size); in nvdimm_build_structure_spa()
248 nfit_spa->mem_attr = cpu_to_le64(0x8ULL /* EFI_MEMORY_WB */ | in nvdimm_build_structure_spa()
269 nfit_memdev->type = cpu_to_le16(1 /* Memory Device to System Address in nvdimm_build_structure_memdev()
271 nfit_memdev->length = cpu_to_le16(sizeof(*nfit_memdev)); in nvdimm_build_structure_memdev()
272 nfit_memdev->nfit_handle = cpu_to_le32(handle); in nvdimm_build_structure_memdev()
278 nfit_memdev->spa_index = cpu_to_le16(nvdimm_slot_to_spa_index(slot)); in nvdimm_build_structure_memdev()
280 nfit_memdev->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(slot)); in nvdimm_build_structure_memdev()
283 nfit_memdev->region_len = cpu_to_le64(size); in nvdimm_build_structure_memdev()
285 nfit_memdev->region_dpa = cpu_to_le64(0); in nvdimm_build_structure_memdev()
288 nfit_memdev->interleave_ways = cpu_to_le16(1); in nvdimm_build_structure_memdev()
290 if (nvdimm->unarmed) { in nvdimm_build_structure_memdev()
291 nfit_memdev->flags |= cpu_to_le16(ACPI_NFIT_MEM_NOT_ARMED); in nvdimm_build_structure_memdev()
307 nfit_dcr->type = cpu_to_le16(4 /* NVDIMM Control Region Structure */); in nvdimm_build_structure_dcr()
308 nfit_dcr->length = cpu_to_le16(sizeof(*nfit_dcr)); in nvdimm_build_structure_dcr()
309 nfit_dcr->dcr_index = cpu_to_le16(nvdimm_slot_to_dcr_index(slot)); in nvdimm_build_structure_dcr()
312 nfit_dcr->vendor_id = cpu_to_le16(0x8086); in nvdimm_build_structure_dcr()
313 nfit_dcr->device_id = cpu_to_le16(1); in nvdimm_build_structure_dcr()
316 nfit_dcr->revision_id = cpu_to_le16(1 /* Current Revision supported in nvdimm_build_structure_dcr()
318 nfit_dcr->serial_number = cpu_to_le32(sn); in nvdimm_build_structure_dcr()
319 nfit_dcr->fic = cpu_to_le16(0x301 /* Format Interface Code: in nvdimm_build_structure_dcr()
335 nfit_caps->type = cpu_to_le16(7 /* NVDIMM Platform Capabilities */); in nvdimm_build_structure_caps()
336 nfit_caps->length = cpu_to_le16(sizeof(*nfit_caps)); in nvdimm_build_structure_caps()
337 nfit_caps->highest_cap = 31 - clz32(capabilities); in nvdimm_build_structure_caps()
338 nfit_caps->capabilities = cpu_to_le32(capabilities); in nvdimm_build_structure_caps()
346 for (device_list = list; device_list; device_list = device_list->next) { in nvdimm_build_device_structure()
347 DeviceState *dev = device_list->data; in nvdimm_build_device_structure()
363 if (state->persistence) { in nvdimm_build_device_structure()
364 nvdimm_build_structure_caps(structures, state->persistence); in nvdimm_build_device_structure()
372 fit_buf->fit = g_array_new(false, true /* clear */, 1); in nvdimm_init_fit_buffer()
377 NvdimmFitBuffer *fit_buf = &state->fit_buf; in nvdimm_build_fit_buffer()
379 g_array_free(fit_buf->fit, true); in nvdimm_build_fit_buffer()
380 fit_buf->fit = nvdimm_build_device_structure(state); in nvdimm_build_fit_buffer()
381 fit_buf->dirty = true; in nvdimm_build_fit_buffer()
404 NvdimmFitBuffer *fit_buf = &state->fit_buf; in nvdimm_build_nfit()
414 g_array_append_vals(table_data, fit_buf->fit->data, fit_buf->fit->len); in nvdimm_build_nfit()
422 uint32_t revision; member
458 uint32_t label_size; /* the size of label data area. */
460 * Maximum size of the namespace label data length supported by
461 * the platform in Get/Set Namespace Label Data functions.
469 uint32_t offset; /* the offset in the namespace label data area. */
480 uint8_t out_buf[]; /* the data got via Get Namespace Label function. */
486 uint32_t offset; /* the offset in the namespace label data area. */
488 uint8_t in_buf[]; /* the data written to label data area. */
532 #define NVDIMM_DSM_RET_STATUS_NOMEMDEV 2 /* Non-Existing Memory Device */
542 NvdimmFitBuffer *fit_buf = &state->fit_buf; in nvdimm_dsm_func_read_fit()
549 read_fit = (NvdimmFuncReadFITIn *)in->arg3; in nvdimm_dsm_func_read_fit()
550 read_fit->offset = le32_to_cpu(read_fit->offset); in nvdimm_dsm_func_read_fit()
552 fit = fit_buf->fit; in nvdimm_dsm_func_read_fit()
554 trace_acpi_nvdimm_read_fit(read_fit->offset, fit->len, in nvdimm_dsm_func_read_fit()
555 fit_buf->dirty ? "Yes" : "No"); in nvdimm_dsm_func_read_fit()
557 if (read_fit->offset > fit->len) { in nvdimm_dsm_func_read_fit()
563 if (!read_fit->offset) { in nvdimm_dsm_func_read_fit()
564 fit_buf->dirty = false; in nvdimm_dsm_func_read_fit()
565 } else if (fit_buf->dirty) { /* FIT has been changed during RFIT. */ in nvdimm_dsm_func_read_fit()
571 read_len = MIN(fit->len - read_fit->offset, in nvdimm_dsm_func_read_fit()
572 NVDIMM_DSM_MEMORY_SIZE - sizeof(NvdimmFuncReadFITOut)); in nvdimm_dsm_func_read_fit()
578 read_fit_out->len = cpu_to_le32(size); in nvdimm_dsm_func_read_fit()
579 read_fit_out->func_ret_status = cpu_to_le32(func_ret_status); in nvdimm_dsm_func_read_fit()
580 memcpy(read_fit_out->fit, fit->data + read_fit->offset, read_len); in nvdimm_dsm_func_read_fit()
591 switch (in->function) { in nvdimm_dsm_handle_reserved_root_method()
609 if (!in->function) { in nvdimm_dsm_root()
621 * 'Get Namespace Label Data' function and a 'Set Namespace Label Data'
632 * the response of 'Get Namespace Label Data' function. in nvdimm_get_max_xfer_label_size()
634 max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut); in nvdimm_get_max_xfer_label_size()
638 * 'Set Namespace Label Data' function. in nvdimm_get_max_xfer_label_size()
640 max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) - in nvdimm_get_max_xfer_label_size()
647 * DSM Spec Rev1 4.4 Get Namespace Label Size (Function Index 4).
649 * It gets the size of Namespace Label data area and the max data size
650 * that Get/Set Namespace Label Data functions can transfer.
659 label_size = nvdimm->label_size; in nvdimm_dsm_label_size()
683 if (nvdimm->label_size < offset + length) { in nvdimm_rw_label_data_check()
684 trace_acpi_nvdimm_label_oversize(offset + length, nvdimm->label_size); in nvdimm_rw_label_data_check()
694 if (is_write && nvdimm->readonly) { in nvdimm_rw_label_data_check()
702 * DSM Spec Rev1 4.5 Get Namespace Label Data (Function Index 5).
713 get_label_data = (NvdimmFuncGetLabelDataIn *)in->arg3; in nvdimm_dsm_get_label_data()
714 get_label_data->offset = le32_to_cpu(get_label_data->offset); in nvdimm_dsm_get_label_data()
715 get_label_data->length = le32_to_cpu(get_label_data->length); in nvdimm_dsm_get_label_data()
717 trace_acpi_nvdimm_read_label(get_label_data->offset, in nvdimm_dsm_get_label_data()
718 get_label_data->length); in nvdimm_dsm_get_label_data()
720 status = nvdimm_rw_label_data_check(nvdimm, get_label_data->offset, in nvdimm_dsm_get_label_data()
721 get_label_data->length, false); in nvdimm_dsm_get_label_data()
727 size = sizeof(*get_label_data_out) + get_label_data->length; in nvdimm_dsm_get_label_data()
731 get_label_data_out->len = cpu_to_le32(size); in nvdimm_dsm_get_label_data()
732 get_label_data_out->func_ret_status = in nvdimm_dsm_get_label_data()
734 nvc->read_label_data(nvdimm, get_label_data_out->out_buf, in nvdimm_dsm_get_label_data()
735 get_label_data->length, get_label_data->offset); in nvdimm_dsm_get_label_data()
742 * DSM Spec Rev1 4.6 Set Namespace Label Data (Function Index 6).
751 set_label_data = (NvdimmFuncSetLabelDataIn *)in->arg3; in nvdimm_dsm_set_label_data()
753 set_label_data->offset = le32_to_cpu(set_label_data->offset); in nvdimm_dsm_set_label_data()
754 set_label_data->length = le32_to_cpu(set_label_data->length); in nvdimm_dsm_set_label_data()
756 trace_acpi_nvdimm_write_label(set_label_data->offset, in nvdimm_dsm_set_label_data()
757 set_label_data->length); in nvdimm_dsm_set_label_data()
759 status = nvdimm_rw_label_data_check(nvdimm, set_label_data->offset, in nvdimm_dsm_set_label_data()
760 set_label_data->length, true); in nvdimm_dsm_set_label_data()
767 set_label_data->length <= NVDIMM_DSM_MEMORY_SIZE); in nvdimm_dsm_set_label_data()
769 nvc->write_label_data(nvdimm, set_label_data->in_buf, in nvdimm_dsm_set_label_data()
770 set_label_data->length, set_label_data->offset); in nvdimm_dsm_set_label_data()
776 NVDIMMDevice *nvdimm = nvdimm_get_device_by_handle(in->handle); in nvdimm_dsm_device()
779 if (!in->function) { in nvdimm_dsm_device()
782 if (nvdimm && nvdimm->label_size) { in nvdimm_dsm_device()
786 1 << 4 /* Get Namespace Label Size */ | in nvdimm_dsm_device()
787 1 << 5 /* Get Namespace Label Data */ | in nvdimm_dsm_device()
788 1 << 6 /* Set Namespace Label Data */; in nvdimm_dsm_device()
801 switch (in->function) { in nvdimm_dsm_device()
802 case 4 /* Get Namespace Label Size */: in nvdimm_dsm_device()
803 if (nvdimm->label_size) { in nvdimm_dsm_device()
808 case 5 /* Get Namespace Label Data */: in nvdimm_dsm_device()
809 if (nvdimm->label_size) { in nvdimm_dsm_device()
814 case 0x6 /* Set Namespace Label Data */: in nvdimm_dsm_device()
815 if (nvdimm->label_size) { in nvdimm_dsm_device()
849 in->revision = le32_to_cpu(in->revision); in nvdimm_dsm_write()
850 in->function = le32_to_cpu(in->function); in nvdimm_dsm_write()
851 in->handle = le32_to_cpu(in->handle); in nvdimm_dsm_write()
853 trace_acpi_nvdimm_dsm_info(in->revision, in->handle, in->function); in nvdimm_dsm_write()
855 if (in->revision != 0x1 /* Currently we only support DSM Spec Rev1. */) { in nvdimm_dsm_write()
856 trace_acpi_nvdimm_invalid_revision(in->revision); in nvdimm_dsm_write()
861 if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) { in nvdimm_dsm_write()
867 if (!in->handle) { in nvdimm_dsm_write()
890 if (dev->hotplugged) { in nvdimm_acpi_plug_cb()
899 state->dsm_io = dsm_io; in nvdimm_init_acpi_state()
900 memory_region_init_io(&state->io_mr, owner, &nvdimm_dsm_ops, state, in nvdimm_init_acpi_state()
901 "nvdimm-acpi-io", dsm_io.bit_width >> 3); in nvdimm_init_acpi_state()
902 memory_region_add_subregion(io, dsm_io.address, &state->io_mr); in nvdimm_init_acpi_state()
904 state->dsm_mem = g_array_new(false, true /* clear */, 1); in nvdimm_init_acpi_state()
905 acpi_data_push(state->dsm_mem, sizeof(NvdimmDsmIn)); in nvdimm_init_acpi_state()
906 fw_cfg_add_file(fw_cfg, NVDIMM_DSM_MEM_FILE, state->dsm_mem->data, in nvdimm_init_acpi_state()
907 state->dsm_mem->len); in nvdimm_init_acpi_state()
909 nvdimm_init_fit_buffer(&state->fit_buf); in nvdimm_init_acpi_state()
929 #define NVDIMM_QEMU_RSVD_UUID "648B9CF2-CDA1-4312-8AD9-49C4AF32BD62"
930 #define NVDIMM_DEVICE_DSM_UUID "4309AC30-0D11-11E4-9191-0800200C9A66"
951 if (nvdimm_state->dsm_io.space_id == AML_AS_SYSTEM_IO) { in nvdimm_build_common_dsm()
959 aml_int(nvdimm_state->dsm_io.address), in nvdimm_build_common_dsm()
960 nvdimm_state->dsm_io.bit_width >> 3)); in nvdimm_build_common_dsm()
969 * It is the IO port so that accessing them will cause VM-exit, the in nvdimm_build_common_dsm()
975 nvdimm_state->dsm_io.bit_width)); in nvdimm_build_common_dsm()
985 * containing function-specific arguments. in nvdimm_build_common_dsm()
988 * VM-EXIT. in nvdimm_build_common_dsm()
995 sizeof(typeof_field(NvdimmDsmIn, revision)) * BITS_PER_BYTE)); in nvdimm_build_common_dsm()
999 (sizeof(NvdimmDsmIn) - offsetof(NvdimmDsmIn, arg3)) * BITS_PER_BYTE)); in nvdimm_build_common_dsm()
1016 (sizeof(NvdimmDsmOut) - offsetof(NvdimmDsmOut, data)) * BITS_PER_BYTE)); in nvdimm_build_common_dsm()
1029 aml_touuid("2F10E7A4-9E91-11E4-89D3-123B93F75CBA") in nvdimm_build_common_dsm()
1073 * Revision ID (Arg1) and Function Index (Arg2) which are documented in nvdimm_build_common_dsm()
1100 * As per ACPI spec 6.3, Table 19-419 Object Conversion Rules, if in nvdimm_build_common_dsm()
1103 * DSDT tables revision number. If revision number is < 2, integer in nvdimm_build_common_dsm()
1175 aml_int(1) /* Revision 1 */, in nvdimm_build_fit()
1270 * ACPI v6.4: Section 6.5.10 NVDIMM Label Methods in nvdimm_build_nvdimm_devices()
1411 g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len); in nvdimm_build_ssdt()
1416 NVDIMM_DSM_MEM_FILE, nvdimm_state->dsm_mem, in nvdimm_build_ssdt()
1434 for (device_list = list; device_list; device_list = device_list->next) { in nvdimm_build_srat()
1435 DeviceState *dev = device_list->data; in nvdimm_build_srat()