aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-07-15 00:47:00 -0400
committerDan Williams <dan.j.williams@intel.com>2016-07-21 17:12:18 -0400
commit7bfe97c763fe7cb214f687e0f4d384b6908fec48 (patch)
tree106bc57cb939068b7ae8757b7ae8d08422b844b3 /tools
parentc2f32acdf848ddc784b73189033592a3134ac651 (diff)
tools/testing/nvdimm: add virtual ramdisk range
Test the virtual disk ranges that platform firmware like EDK2/OVMF might emit. Tested-by: "Lee, Chun-Yi" <jlee@suse.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/nvdimm/test/nfit.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index ff09a28890ed..2b9e8a59d45b 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -104,6 +104,7 @@ enum {
104 NUM_MEM = NUM_DCR + NUM_BDW + 2 /* spa0 iset */ + 4 /* spa1 iset */, 104 NUM_MEM = NUM_DCR + NUM_BDW + 2 /* spa0 iset */ + 4 /* spa1 iset */,
105 DIMM_SIZE = SZ_32M, 105 DIMM_SIZE = SZ_32M,
106 LABEL_SIZE = SZ_128K, 106 LABEL_SIZE = SZ_128K,
107 SPA_VCD_SIZE = SZ_4M,
107 SPA0_SIZE = DIMM_SIZE, 108 SPA0_SIZE = DIMM_SIZE,
108 SPA1_SIZE = DIMM_SIZE*2, 109 SPA1_SIZE = DIMM_SIZE*2,
109 SPA2_SIZE = DIMM_SIZE, 110 SPA2_SIZE = DIMM_SIZE,
@@ -618,7 +619,7 @@ static int nfit_test0_alloc(struct nfit_test *t)
618 619
619static int nfit_test1_alloc(struct nfit_test *t) 620static int nfit_test1_alloc(struct nfit_test *t)
620{ 621{
621 size_t nfit_size = sizeof(struct acpi_nfit_system_address) 622 size_t nfit_size = sizeof(struct acpi_nfit_system_address) * 2
622 + sizeof(struct acpi_nfit_memory_map) 623 + sizeof(struct acpi_nfit_memory_map)
623 + offsetof(struct acpi_nfit_control_region, window_size); 624 + offsetof(struct acpi_nfit_control_region, window_size);
624 625
@@ -631,6 +632,10 @@ static int nfit_test1_alloc(struct nfit_test *t)
631 if (!t->spa_set[0]) 632 if (!t->spa_set[0])
632 return -ENOMEM; 633 return -ENOMEM;
633 634
635 t->spa_set[1] = test_alloc(t, SPA_VCD_SIZE, &t->spa_set_dma[1]);
636 if (!t->spa_set[1])
637 return -ENOMEM;
638
634 return ars_state_init(&t->pdev.dev, &t->ars_state); 639 return ars_state_init(&t->pdev.dev, &t->ars_state);
635} 640}
636 641
@@ -1335,7 +1340,16 @@ static void nfit_test1_setup(struct nfit_test *t)
1335 spa->address = t->spa_set_dma[0]; 1340 spa->address = t->spa_set_dma[0];
1336 spa->length = SPA2_SIZE; 1341 spa->length = SPA2_SIZE;
1337 1342
1338 offset += sizeof(*spa); 1343 /* virtual cd region */
1344 spa = nfit_buf + sizeof(*spa);
1345 spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS;
1346 spa->header.length = sizeof(*spa);
1347 memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_VCD), 16);
1348 spa->range_index = 0;
1349 spa->address = t->spa_set_dma[1];
1350 spa->length = SPA_VCD_SIZE;
1351
1352 offset += sizeof(*spa) * 2;
1339 /* mem-region0 (spa0, dimm0) */ 1353 /* mem-region0 (spa0, dimm0) */
1340 memdev = nfit_buf + offset; 1354 memdev = nfit_buf + offset;
1341 memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP; 1355 memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP;