diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-12-17 18:08:10 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-12-17 18:08:10 -0500 |
commit | c44ef859ceff45db1c72f9ccbfae96843c4b1501 (patch) | |
tree | c97d8cab54f9d62faa5a5713298418ab93a452e0 /tools | |
parent | 325896ffdf90f7cbd59fb873b7ba20d60d1ddf3c (diff) | |
parent | d7fe1a67f658b50ec98ee1afb86df7b35c2b2593 (diff) |
Merge branch 'for-4.10/libnvdimm' into libnvdimm-for-next
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 71620fa95953..45be8b55a663 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -125,12 +125,13 @@ struct nfit_test_dcr { | |||
125 | (((node & 0xfff) << 16) | ((socket & 0xf) << 12) \ | 125 | (((node & 0xfff) << 16) | ((socket & 0xf) << 12) \ |
126 | | ((imc & 0xf) << 8) | ((chan & 0xf) << 4) | (dimm & 0xf)) | 126 | | ((imc & 0xf) << 8) | ((chan & 0xf) << 4) | (dimm & 0xf)) |
127 | 127 | ||
128 | static u32 handle[NUM_DCR] = { | 128 | static u32 handle[] = { |
129 | [0] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 0), | 129 | [0] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 0), |
130 | [1] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 1), | 130 | [1] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 1), |
131 | [2] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 0), | 131 | [2] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 0), |
132 | [3] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 1), | 132 | [3] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 1), |
133 | [4] = NFIT_DIMM_HANDLE(0, 1, 0, 0, 0), | 133 | [4] = NFIT_DIMM_HANDLE(0, 1, 0, 0, 0), |
134 | [5] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 0), | ||
134 | }; | 135 | }; |
135 | 136 | ||
136 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; | 137 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; |
@@ -142,6 +143,7 @@ struct nfit_test { | |||
142 | void *nfit_buf; | 143 | void *nfit_buf; |
143 | dma_addr_t nfit_dma; | 144 | dma_addr_t nfit_dma; |
144 | size_t nfit_size; | 145 | size_t nfit_size; |
146 | int dcr_idx; | ||
145 | int num_dcr; | 147 | int num_dcr; |
146 | int num_pm; | 148 | int num_pm; |
147 | void **dimm; | 149 | void **dimm; |
@@ -426,11 +428,11 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc, | |||
426 | break; | 428 | break; |
427 | case ND_CMD_GET_CONFIG_DATA: | 429 | case ND_CMD_GET_CONFIG_DATA: |
428 | rc = nfit_test_cmd_get_config_data(buf, buf_len, | 430 | rc = nfit_test_cmd_get_config_data(buf, buf_len, |
429 | t->label[i]); | 431 | t->label[i - t->dcr_idx]); |
430 | break; | 432 | break; |
431 | case ND_CMD_SET_CONFIG_DATA: | 433 | case ND_CMD_SET_CONFIG_DATA: |
432 | rc = nfit_test_cmd_set_config_data(buf, buf_len, | 434 | rc = nfit_test_cmd_set_config_data(buf, buf_len, |
433 | t->label[i]); | 435 | t->label[i - t->dcr_idx]); |
434 | break; | 436 | break; |
435 | case ND_CMD_SMART: | 437 | case ND_CMD_SMART: |
436 | rc = nfit_test_cmd_smart(buf, buf_len); | 438 | rc = nfit_test_cmd_smart(buf, buf_len); |
@@ -682,7 +684,7 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
682 | if (!t->spa_set[2]) | 684 | if (!t->spa_set[2]) |
683 | return -ENOMEM; | 685 | return -ENOMEM; |
684 | 686 | ||
685 | for (i = 0; i < NUM_DCR; i++) { | 687 | for (i = 0; i < t->num_dcr; i++) { |
686 | t->dimm[i] = test_alloc(t, DIMM_SIZE, &t->dimm_dma[i]); | 688 | t->dimm[i] = test_alloc(t, DIMM_SIZE, &t->dimm_dma[i]); |
687 | if (!t->dimm[i]) | 689 | if (!t->dimm[i]) |
688 | return -ENOMEM; | 690 | return -ENOMEM; |
@@ -699,7 +701,7 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
699 | return -ENOMEM; | 701 | return -ENOMEM; |
700 | } | 702 | } |
701 | 703 | ||
702 | for (i = 0; i < NUM_DCR; i++) { | 704 | for (i = 0; i < t->num_dcr; i++) { |
703 | t->dcr[i] = test_alloc(t, LABEL_SIZE, &t->dcr_dma[i]); | 705 | t->dcr[i] = test_alloc(t, LABEL_SIZE, &t->dcr_dma[i]); |
704 | if (!t->dcr[i]) | 706 | if (!t->dcr[i]) |
705 | return -ENOMEM; | 707 | return -ENOMEM; |
@@ -728,6 +730,7 @@ static int nfit_test1_alloc(struct nfit_test *t) | |||
728 | size_t nfit_size = sizeof(struct acpi_nfit_system_address) * 2 | 730 | size_t nfit_size = sizeof(struct acpi_nfit_system_address) * 2 |
729 | + sizeof(struct acpi_nfit_memory_map) | 731 | + sizeof(struct acpi_nfit_memory_map) |
730 | + offsetof(struct acpi_nfit_control_region, window_size); | 732 | + offsetof(struct acpi_nfit_control_region, window_size); |
733 | int i; | ||
731 | 734 | ||
732 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); | 735 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); |
733 | if (!t->nfit_buf) | 736 | if (!t->nfit_buf) |
@@ -738,6 +741,13 @@ static int nfit_test1_alloc(struct nfit_test *t) | |||
738 | if (!t->spa_set[0]) | 741 | if (!t->spa_set[0]) |
739 | return -ENOMEM; | 742 | return -ENOMEM; |
740 | 743 | ||
744 | for (i = 0; i < t->num_dcr; i++) { | ||
745 | t->label[i] = test_alloc(t, LABEL_SIZE, &t->label_dma[i]); | ||
746 | if (!t->label[i]) | ||
747 | return -ENOMEM; | ||
748 | sprintf(t->label[i], "label%d", i); | ||
749 | } | ||
750 | |||
741 | t->spa_set[1] = test_alloc(t, SPA_VCD_SIZE, &t->spa_set_dma[1]); | 751 | t->spa_set[1] = test_alloc(t, SPA_VCD_SIZE, &t->spa_set_dma[1]); |
742 | if (!t->spa_set[1]) | 752 | if (!t->spa_set[1]) |
743 | return -ENOMEM; | 753 | return -ENOMEM; |
@@ -1450,7 +1460,7 @@ static void nfit_test1_setup(struct nfit_test *t) | |||
1450 | memdev = nfit_buf + offset; | 1460 | memdev = nfit_buf + offset; |
1451 | memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP; | 1461 | memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP; |
1452 | memdev->header.length = sizeof(*memdev); | 1462 | memdev->header.length = sizeof(*memdev); |
1453 | memdev->device_handle = 0; | 1463 | memdev->device_handle = handle[5]; |
1454 | memdev->physical_id = 0; | 1464 | memdev->physical_id = 0; |
1455 | memdev->region_id = 0; | 1465 | memdev->region_id = 0; |
1456 | memdev->range_index = 0+1; | 1466 | memdev->range_index = 0+1; |
@@ -1472,7 +1482,7 @@ static void nfit_test1_setup(struct nfit_test *t) | |||
1472 | window_size); | 1482 | window_size); |
1473 | dcr->region_index = 0+1; | 1483 | dcr->region_index = 0+1; |
1474 | dcr_common_init(dcr); | 1484 | dcr_common_init(dcr); |
1475 | dcr->serial_number = ~0; | 1485 | dcr->serial_number = ~handle[5]; |
1476 | dcr->code = NFIT_FIC_BYTE; | 1486 | dcr->code = NFIT_FIC_BYTE; |
1477 | dcr->windows = 0; | 1487 | dcr->windows = 0; |
1478 | 1488 | ||
@@ -1483,6 +1493,9 @@ static void nfit_test1_setup(struct nfit_test *t) | |||
1483 | set_bit(ND_CMD_ARS_START, &acpi_desc->bus_cmd_force_en); | 1493 | set_bit(ND_CMD_ARS_START, &acpi_desc->bus_cmd_force_en); |
1484 | set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en); | 1494 | set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en); |
1485 | set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en); | 1495 | set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en); |
1496 | set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_cmd_force_en); | ||
1497 | set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); | ||
1498 | set_bit(ND_CMD_SET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); | ||
1486 | } | 1499 | } |
1487 | 1500 | ||
1488 | static int nfit_test_blk_do_io(struct nd_blk_region *ndbr, resource_size_t dpa, | 1501 | static int nfit_test_blk_do_io(struct nd_blk_region *ndbr, resource_size_t dpa, |
@@ -1886,12 +1899,15 @@ static __init int nfit_test_init(void) | |||
1886 | switch (i) { | 1899 | switch (i) { |
1887 | case 0: | 1900 | case 0: |
1888 | nfit_test->num_pm = NUM_PM; | 1901 | nfit_test->num_pm = NUM_PM; |
1902 | nfit_test->dcr_idx = 0; | ||
1889 | nfit_test->num_dcr = NUM_DCR; | 1903 | nfit_test->num_dcr = NUM_DCR; |
1890 | nfit_test->alloc = nfit_test0_alloc; | 1904 | nfit_test->alloc = nfit_test0_alloc; |
1891 | nfit_test->setup = nfit_test0_setup; | 1905 | nfit_test->setup = nfit_test0_setup; |
1892 | break; | 1906 | break; |
1893 | case 1: | 1907 | case 1: |
1894 | nfit_test->num_pm = 1; | 1908 | nfit_test->num_pm = 1; |
1909 | nfit_test->dcr_idx = NUM_DCR; | ||
1910 | nfit_test->num_dcr = 1; | ||
1895 | nfit_test->alloc = nfit_test1_alloc; | 1911 | nfit_test->alloc = nfit_test1_alloc; |
1896 | nfit_test->setup = nfit_test1_setup; | 1912 | nfit_test->setup = nfit_test1_setup; |
1897 | break; | 1913 | break; |