Lines Matching refs:state
1089 * pci_update_current_state - Read power state of given device and cache it
1091 * @state: State to cache in case the device doesn't have the PM capability
1093 * The power state is read from the PMCSR register, which however is
1096 * reports an incorrect state or the device isn't power manageable by the
1100 void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
1114 dev->current_state = state;
1119 * pci_refresh_power_state - Refresh the given device's power state data
1122 * Ask the platform to refresh the devices power state information and invoke
1123 * pci_update_current_state() to update its current PCI power state.
1132 * pci_platform_power_transition - Use platform to change device power state
1134 * @state: State to put the device into.
1136 int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
1140 error = platform_pci_set_power_state(dev, state);
1142 pci_update_current_state(dev, state);
1240 pci_power_t state;
1246 state = platform_pci_get_power_state(dev);
1247 if (state == PCI_UNKNOWN)
1250 dev->current_state = state;
1257 pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n",
1263 state = pmcsr & PCI_PM_CTRL_STATE_MASK;
1265 need_restore = (state == PCI_D3hot || dev->current_state >= PCI_D3hot) &&
1268 if (state == PCI_D0)
1278 if (state == PCI_D3hot)
1280 else if (state == PCI_D2)
1292 * pci_set_full_power_state - Put a PCI device into D0 and update its state
1296 * to confirm the state change, restore its BARs if they might be lost and
1297 * reconfigure ASPM in accordance with the new power state.
1299 * If pci_restore_state() is going to be called right after a power state change
1319 pci_info_ratelimited(dev, "Refused to change power state from %s to D0\n",
1331 * devices in a D3hot state at boot. Consequently, we need to
1345 * __pci_dev_set_current_state - Set current state of a PCI device
1347 * @data: pointer to state to be set
1351 pci_power_t state = *(pci_power_t *)data;
1353 dev->current_state = state;
1358 * pci_bus_set_current_state - Walk given bus and set current state of devices
1360 * @state: state to be set
1362 void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state)
1365 pci_walk_bus(bus, __pci_dev_set_current_state, &state);
1369 * pci_set_low_power_state - Put a PCI device into a low-power state.
1371 * @state: PCI power state (D1, D2, D3hot) to put the device into.
1373 * Use the device's PCI_PM_CTRL register to put it into a low-power state.
1376 * -EINVAL if the requested state is invalid.
1378 * wrong version, or device doesn't support the requested state.
1379 * 0 if device already is in the requested state.
1380 * 0 if device's power state has been successfully changed.
1382 static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state)
1390 * Validate transition: We can enter D0 from any state, but if
1391 * we're already in a low-power state, we can only go deeper. E.g.,
1395 if (dev->current_state <= PCI_D3cold && dev->current_state > state) {
1398 pci_power_name(state));
1402 /* Check if this device supports the desired state */
1403 if ((state == PCI_D1 && !dev->d1_support)
1404 || (state == PCI_D2 && !dev->d2_support))
1409 pci_err(dev, "Unable to change power state from %s to %s, device inaccessible\n",
1411 pci_power_name(state));
1417 pmcsr |= state;
1419 /* Enter specified state */
1423 if (state == PCI_D3hot)
1425 else if (state == PCI_D2)
1430 if (dev->current_state != state)
1431 pci_info_ratelimited(dev, "Refused to change power state from %s to %s\n",
1433 pci_power_name(state));
1442 * pci_set_power_state - Set the power state of a PCI device
1444 * @state: PCI power state (D0, D1, D2, D3hot) to put the device into.
1446 * Transition a device to a new power state, using the platform firmware and/or
1450 * -EINVAL if the requested state is invalid.
1452 * wrong version, or device doesn't support the requested state.
1454 * 0 if device already is in the requested state.
1456 * 0 if device's power state has been successfully changed.
1458 int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1462 /* Bound the state we're entering */
1463 if (state > PCI_D3cold)
1464 state = PCI_D3cold;
1465 else if (state < PCI_D0)
1466 state = PCI_D0;
1467 else if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev))
1478 if (dev->current_state == state)
1481 if (state == PCI_D0)
1488 if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3))
1491 if (state == PCI_D3cold) {
1505 error = pci_set_low_power_state(dev, state);
1507 if (pci_platform_power_transition(dev, state))
1805 * pci_restore_state - Restore the saved state of a PCI device
1836 /* Restore ACS and IOV configuration state */
1851 * the device saved state.
1854 * Return NULL if no state or error.
1858 struct pci_saved_state *state;
1866 size = sizeof(*state) + sizeof(struct pci_cap_saved_data);
1871 state = kzalloc(size, GFP_KERNEL);
1872 if (!state)
1875 memcpy(state->config_space, dev->saved_config_space,
1876 sizeof(state->config_space));
1878 cap = state->cap;
1886 return state;
1891 * pci_load_saved_state - Reload the provided save state into struct pci_dev.
1893 * @state: Saved state returned from pci_store_saved_state()
1896 struct pci_saved_state *state)
1902 if (!state)
1905 memcpy(dev->saved_config_space, state->config_space,
1906 sizeof(state->config_space));
1908 cap = state->cap;
1927 * pci_load_and_free_saved_state - Reload the save state pointed to by state,
1930 * @state: Pointer to saved state returned from pci_store_saved_state()
1933 struct pci_saved_state **state)
1935 int ret = pci_load_saved_state(dev, *state);
1936 kfree(*state);
1937 *state = NULL;
2025 * Power state could be unknown at this point, either due to a fresh
2026 * boot or a device removal call. So get the current power state
2301 * pcibios_set_pcie_reset_state - set reset state for device dev
2303 * @state: Reset state to enter into
2305 * Set the PCIe reset state for the device. This is the default
2309 enum pcie_reset_state state)
2315 * pci_set_pcie_reset_state - set reset state for device dev
2317 * @state: Reset state to enter into
2319 * Sets the PCI reset state for the device.
2321 int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state)
2323 return pcibios_set_pcie_reset_state(dev, state);
2415 * @state: PCI state from which device will issue PME#.
2417 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state)
2422 return !!(dev->pme_support & (1 << state));
2442 * state or the configuration space of subordinate
2585 * @state: PCI state from which device will issue wakeup events
2601 static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
2631 * the current target state, because that will allow it to
2635 if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold))
2656 * @state: PCI state from which device will issue wakeup events
2662 int pci_enable_wake(struct pci_dev *pci_dev, pci_power_t state, bool enable)
2667 return __pci_enable_wake(pci_dev, state, enable);
2694 * pci_target_state - find an appropriate low power state for a given PCI dev
2698 * Use underlying platform code to find a supported low power state for @dev.
2699 * If the platform can't manage @dev, return the deepest state from which it
2706 * Call the platform to find the target state for the device.
2708 pci_power_t state = platform_pci_choose_state(dev);
2710 switch (state) {
2721 return state;
2735 pci_power_t state = PCI_D3hot;
2738 * Find the deepest state from which the device can generate
2741 while (state && !(dev->pme_support & (1 << state)))
2742 state--;
2744 if (state)
2745 return state;
2755 * into a sleep state
2758 * Choose the power state appropriate for the device depending on whether
2760 * (PCI_D3hot is the default) and put the device into that state.
2784 * into working state
2806 * power state.
2842 /* PME-capable in principle, but not from the target power state */
2872 * suspend, or the current power state of it is not suitable for the upcoming
2902 * Note that if the device's power state is D3cold and the platform check in
2943 * pci_choose_state - Choose the power state of a PCI device.
2945 * @state: Target state for the whole system.
2947 * Returns PCI power state suitable for @dev and @state.
2949 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
2951 if (state.event == PM_EVENT_ON)
4873 * PCI_D0. If that's the case and the device is not in a low-power state
5209 * Devices on the secondary bus are left in power-on state.
5315 * to a non-D0 state anyway.
5536 * state.
5570 * clears all the state associated with the device. This function differs
5571 * from __pci_reset_function_locked() in that it saves and restores device state
5605 * clears all the state associated with the device. This function differs
5606 * from __pci_reset_function_locked() in that it saves and restores device state
6456 * pci_set_vga_state - set VGA decode state on device and parents if requested