ACPI: Check StorageD3Enable _DSD property in ACPI code
[linux-2.6-microblaze.git] / drivers / nvme / host / pci.c
index 09d4c5f..8fbc4c8 100644 (file)
@@ -933,6 +933,9 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
        if (unlikely(!test_bit(NVMEQ_ENABLED, &nvmeq->flags)))
                return BLK_STS_IOERR;
 
+       if (!nvme_check_ready(&dev->ctrl, req, true))
+               return nvme_fail_nonready_command(&dev->ctrl, req);
+
        ret = nvme_setup_cmd(ns, req);
        if (ret)
                return ret;
@@ -2825,54 +2828,6 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
        return 0;
 }
 
-#ifdef CONFIG_ACPI
-static bool nvme_acpi_storage_d3(struct pci_dev *dev)
-{
-       struct acpi_device *adev;
-       struct pci_dev *root;
-       acpi_handle handle;
-       acpi_status status;
-       u8 val;
-
-       /*
-        * Look for _DSD property specifying that the storage device on the port
-        * must use D3 to support deep platform power savings during
-        * suspend-to-idle.
-        */
-       root = pcie_find_root_port(dev);
-       if (!root)
-               return false;
-
-       adev = ACPI_COMPANION(&root->dev);
-       if (!adev)
-               return false;
-
-       /*
-        * The property is defined in the PXSX device for South complex ports
-        * and in the PEGP device for North complex ports.
-        */
-       status = acpi_get_handle(adev->handle, "PXSX", &handle);
-       if (ACPI_FAILURE(status)) {
-               status = acpi_get_handle(adev->handle, "PEGP", &handle);
-               if (ACPI_FAILURE(status))
-                       return false;
-       }
-
-       if (acpi_bus_get_device(handle, &adev))
-               return false;
-
-       if (fwnode_property_read_u8(acpi_fwnode_handle(adev), "StorageD3Enable",
-                       &val))
-               return false;
-       return val == 1;
-}
-#else
-static inline bool nvme_acpi_storage_d3(struct pci_dev *dev)
-{
-       return false;
-}
-#endif /* CONFIG_ACPI */
-
 static void nvme_async_probe(void *data, async_cookie_t cookie)
 {
        struct nvme_dev *dev = data;
@@ -2922,7 +2877,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        quirks |= check_vendor_combination_bug(pdev);
 
-       if (!noacpi && nvme_acpi_storage_d3(pdev)) {
+       if (!noacpi && acpi_storage_d3(&pdev->dev)) {
                /*
                 * Some systems use a bios work around to ask for D3 on
                 * platforms that support kernel managed suspend.