diff options
author | Dave Jiang <dave.jiang@intel.com> | 2018-01-31 14:45:55 -0500 |
---|---|---|
committer | Ross Zwisler <ross.zwisler@linux.intel.com> | 2018-02-01 17:01:15 -0500 |
commit | f81e1d35a6e36d30888c46283b8dd1022e847124 (patch) | |
tree | 6c4fbac27750cc0c6fe3bab1739149140a6a5611 /tools | |
parent | 96c3a239054a367d1a18581384985ab9e97c5ce7 (diff) |
nfit-test: Add platform cap support from ACPI 6.2a to test
Adding NFIT platform capabilities sub table in nfit_test simulated ACPI
NFIT table. Only the first NFIT table is added with the capability
sub-table.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 7217b2b953b5..de1373a7ed4f 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -881,7 +881,8 @@ static int nfit_test0_alloc(struct nfit_test *t) | |||
881 | window_size) * NUM_DCR | 881 | window_size) * NUM_DCR |
882 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW | 882 | + sizeof(struct acpi_nfit_data_region) * NUM_BDW |
883 | + (sizeof(struct acpi_nfit_flush_address) | 883 | + (sizeof(struct acpi_nfit_flush_address) |
884 | + sizeof(u64) * NUM_HINTS) * NUM_DCR; | 884 | + sizeof(u64) * NUM_HINTS) * NUM_DCR |
885 | + sizeof(struct acpi_nfit_capabilities); | ||
885 | int i; | 886 | int i; |
886 | 887 | ||
887 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); | 888 | t->nfit_buf = test_alloc(t, nfit_size, &t->nfit_dma); |
@@ -993,6 +994,7 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
993 | struct acpi_nfit_control_region *dcr; | 994 | struct acpi_nfit_control_region *dcr; |
994 | struct acpi_nfit_data_region *bdw; | 995 | struct acpi_nfit_data_region *bdw; |
995 | struct acpi_nfit_flush_address *flush; | 996 | struct acpi_nfit_flush_address *flush; |
997 | struct acpi_nfit_capabilities *pcap; | ||
996 | unsigned int offset, i; | 998 | unsigned int offset, i; |
997 | 999 | ||
998 | /* | 1000 | /* |
@@ -1500,8 +1502,16 @@ static void nfit_test0_setup(struct nfit_test *t) | |||
1500 | for (i = 0; i < NUM_HINTS; i++) | 1502 | for (i = 0; i < NUM_HINTS; i++) |
1501 | flush->hint_address[i] = t->flush_dma[3] + i * sizeof(u64); | 1503 | flush->hint_address[i] = t->flush_dma[3] + i * sizeof(u64); |
1502 | 1504 | ||
1505 | /* platform capabilities */ | ||
1506 | pcap = nfit_buf + offset + flush_hint_size * 4; | ||
1507 | pcap->header.type = ACPI_NFIT_TYPE_CAPABILITIES; | ||
1508 | pcap->header.length = sizeof(*pcap); | ||
1509 | pcap->highest_capability = 1; | ||
1510 | pcap->capabilities = ACPI_NFIT_CAPABILITY_CACHE_FLUSH | | ||
1511 | ACPI_NFIT_CAPABILITY_MEM_FLUSH; | ||
1512 | |||
1503 | if (t->setup_hotplug) { | 1513 | if (t->setup_hotplug) { |
1504 | offset = offset + flush_hint_size * 4; | 1514 | offset = offset + flush_hint_size * 4 + sizeof(*pcap); |
1505 | /* dcr-descriptor4: blk */ | 1515 | /* dcr-descriptor4: blk */ |
1506 | dcr = nfit_buf + offset; | 1516 | dcr = nfit_buf + offset; |
1507 | dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION; | 1517 | dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION; |