summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2014-02-25 17:46:27 -0300
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2014-02-25 18:00:53 -0300
commit37773d91d9b56f9f06c86e405e8dc9343f2c71c1 (patch)
tree940af85b6dbb98feab2bb7f1abcc58b5e2d7f448 /tests
parent31b20f7478a27e159482ac23f3d128e90ca98d23 (diff)
tests/pm_pc8: add pci-d3-state subtest
Currently the test suite just looks at the files provided by the runtime power management framework to check if the device is runtime suspended. Add a test that reads the PCI config space to check if the device is actually in PCI D3 state or not. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/pm_pc8.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/pm_pc8.c b/tests/pm_pc8.c
index e0f91388..54d04b1a 100644
--- a/tests/pm_pc8.c
+++ b/tests/pm_pc8.c
@@ -1406,6 +1406,35 @@ static void reg_read_ioctl_subtest(void)
igt_assert(wait_for_suspended());
}
+static bool device_in_pci_d3(void)
+{
+ struct pci_device *pci_dev;
+ int rc;
+ uint16_t val;
+
+ pci_dev = intel_get_pci_device();
+
+ rc = pci_device_cfg_read_u16(pci_dev, &val, 0xd4);
+ igt_assert(rc == 0);
+
+ return (val & 0x3) == 0x3;
+}
+
+static void pci_d3_state_subtest(void)
+{
+ igt_require(has_runtime_pm);
+
+ disable_all_screens(&ms_data);
+ igt_assert(wait_for_suspended());
+
+ igt_assert(device_in_pci_d3());
+
+ enable_one_screen(&ms_data);
+ igt_assert(wait_for_active());
+
+ igt_assert(!device_in_pci_d3());
+}
+
int main(int argc, char *argv[])
{
int rounds = 50;
@@ -1429,6 +1458,8 @@ int main(int argc, char *argv[])
basic_subtest();
igt_subtest("drm-resources-equal")
drm_resources_equal_subtest();
+ igt_subtest("pci-d3-state")
+ pci_d3_state_subtest();
/* Basic modeset */
igt_subtest("modeset-lpsp")