@@ -1219,6 +1219,11 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
acpi_handle handle)
{
struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);
+ /*
+ * _DSM 9 provides values in microseconds, but the kernel uses msleep()
+ * when waiting, so the code below rounds up when setting value in ms
+ */
+ u64 value_us;
int value;
union acpi_object *obj, *elements;
@@ -1233,12 +1238,18 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 5) {
elements = obj->package.elements;
if (elements[0].type == ACPI_TYPE_INTEGER) {
- value = (int)elements[0].integer.value / 1000;
+ value_us = elements[0].integer.value;
+ value = (int)value_us / 1000;
+ if ((int)value_us % 1000 > 0)
+ value++;
if (value < PCI_PM_D3COLD_WAIT)
pdev->d3cold_delay = value;
}
if (elements[3].type == ACPI_TYPE_INTEGER) {
- value = (int)elements[3].integer.value / 1000;
+ value_us = elements[3].integer.value;
+ value = (int)value_us / 1000;
+ if ((int)value_us % 1000 > 0)
+ value++;
if (value < PCI_PM_D3_WAIT)
pdev->d3_delay = value;
}