Lines Matching refs:dev
33 struct device *dev = &adev->dev;
45 dev_err(dev, "failed to parse _CRS method, error code %d\n",
51 dev_err(dev, "no IO and memory resources present in _CRS\n");
76 int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
86 dev_err(dev, "can't find _HID %s device to locate resources\n",
97 dev_err(dev, "can't get resource from %s\n",
98 dev_name(&adev->dev));
137 static void program_hpx_type0(struct pci_dev *dev, struct hpx_type0 *hpx)
145 pci_warn(dev, "PCI settings rev %d not supported; using defaults\n",
150 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, hpx->cache_line_size);
151 pci_write_config_byte(dev, PCI_LATENCY_TIMER, hpx->latency_timer);
152 pci_read_config_word(dev, PCI_COMMAND, &pci_cmd);
157 pci_write_config_word(dev, PCI_COMMAND, pci_cmd);
160 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
161 pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER,
163 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl);
166 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl);
206 static void program_hpx_type1(struct pci_dev *dev, struct hpx_type1 *hpx)
213 pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
217 pci_warn(dev, "PCI-X settings not supported\n");
247 static bool pcie_root_rcb_set(struct pci_dev *dev)
249 struct pci_dev *rp = pcie_find_root_port(dev);
283 static void program_hpx_type2(struct pci_dev *dev, struct hpx_type2 *hpx)
291 if (!pci_is_pcie(dev))
295 pci_warn(dev, "PCIe settings rev %d not supported\n",
311 pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL,
315 if (pcie_cap_has_lnkctl(dev)) {
323 if (pcie_root_rcb_set(dev))
326 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
331 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
336 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, ®32);
338 pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, reg32);
341 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, ®32);
343 pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, reg32);
346 pci_read_config_dword(dev, pos + PCI_ERR_COR_MASK, ®32);
348 pci_write_config_dword(dev, pos + PCI_ERR_COR_MASK, reg32);
351 pci_read_config_dword(dev, pos + PCI_ERR_CAP, ®32);
359 pci_write_config_dword(dev, pos + PCI_ERR_CAP, reg32);
439 static u16 hpx3_device_type(struct pci_dev *dev)
441 u16 pcie_type = pci_pcie_type(dev);
466 static u8 hpx3_function_type(struct pci_dev *dev)
468 if (dev->is_virtfn)
470 else if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV) > 0)
497 static void program_hpx_type3_register(struct pci_dev *dev,
503 if (!(hpx3_device_type(dev) & reg->device_type))
506 if (!(hpx3_function_type(dev) & reg->function_type))
514 pos = pci_find_capability(dev, reg->pci_exp_cap_id);
520 pos = pci_find_ext_capability(dev, reg->pci_exp_cap_id);
524 pci_read_config_dword(dev, pos, &header);
533 pci_warn(dev, "Encountered _HPX type 3 with unsupported config space location");
537 pci_read_config_dword(dev, pos + reg->match_offset, &match_reg);
542 pci_read_config_dword(dev, pos + reg->reg_offset, &write_reg);
550 pci_write_config_dword(dev, pos + reg->reg_offset, write_reg);
552 pci_dbg(dev, "Applied _HPX3 at [0x%x]: 0x%08x -> 0x%08x",
556 static void program_hpx_type3(struct pci_dev *dev, struct hpx_type3 *hpx)
561 if (!pci_is_pcie(dev))
564 program_hpx_type3_register(dev, hpx);
586 static acpi_status program_type3_hpx_record(struct pci_dev *dev,
611 program_hpx_type3(dev, &hpx3);
624 static acpi_status acpi_run_hpx(struct pci_dev *dev, acpi_handle handle)
666 program_hpx_type0(dev, &hpx0);
673 program_hpx_type1(dev, &hpx1);
680 program_hpx_type2(dev, &hpx2);
683 status = program_type3_hpx_record(dev, record);
699 static acpi_status acpi_run_hpp(struct pci_dev *dev, acpi_handle handle)
734 program_hpx_type0(dev, &hpx0);
743 * @dev - the pci_dev for which we want parameters
745 int pci_acpi_program_hp_params(struct pci_dev *dev)
755 for (pbus = dev->bus; pbus; pbus = pbus->parent) {
763 * encountered. If we don't find an _HPP for the input pci dev,
765 * this pci dev.
768 status = acpi_run_hpx(dev, handle);
771 status = acpi_run_hpp(dev, handle);
844 pci_dev = to_pci_dev(context->dev);
851 pm_request_resume(&pci_dev->dev);
860 pm_request_resume(&pci_dev->dev);
867 * @dev: PCI root bridge ACPI device.
869 acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev)
871 return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus);
876 * @dev: ACPI device to add the notifier for.
879 acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
882 return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev);
916 acpi_state = acpi_pm_device_sleep_state(&pdev->dev, NULL, d_max);
935 static struct acpi_device *acpi_pci_find_companion(struct device *dev);
937 static bool acpi_pci_bridge_d3(struct pci_dev *dev)
944 if (!dev->is_hotplug_bridge)
948 adev = ACPI_COMPANION(&dev->dev);
949 if (!adev && !pci_dev_is_added(dev)) {
950 adev = acpi_pci_find_companion(&dev->dev);
951 ACPI_COMPANION_SET(&dev->dev, adev);
961 root = pcie_find_root_port(dev);
965 adev = ACPI_COMPANION(&root->dev);
966 if (root == dev) {
972 adev = acpi_pci_find_companion(&root->dev);
985 static bool acpi_pci_power_manageable(struct pci_dev *dev)
987 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
991 static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
993 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
1009 if (dev_pm_qos_flags(&dev->dev, PM_QOS_FLAG_NO_POWER_OFF) ==
1023 pci_dbg(dev, "power state changed by ACPI to %s\n",
1029 static pci_power_t acpi_pci_get_power_state(struct pci_dev *dev)
1031 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
1051 static void acpi_pci_refresh_power_state(struct pci_dev *dev)
1053 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
1062 if (acpi_pm_device_can_wakeup(&bus->self->dev))
1063 return acpi_pm_set_device_wakeup(&bus->self->dev, enable);
1076 static int acpi_pci_wakeup(struct pci_dev *dev, bool enable)
1078 if (acpi_pm_device_can_wakeup(&dev->dev))
1079 return acpi_pm_set_device_wakeup(&dev->dev, enable);
1081 return acpi_pci_propagate_wakeup(dev->bus, enable);
1084 static bool acpi_pci_need_resume(struct pci_dev *dev)
1086 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
1095 if (pci_is_bridge(dev) && acpi_target_system_state() != ACPI_STATE_S0)
1102 device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
1162 static struct acpi_device *acpi_pci_find_companion(struct device *dev)
1164 struct pci_dev *pci_dev = to_pci_dev(dev);
1171 return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
1226 static void pci_acpi_set_external_facing(struct pci_dev *dev)
1230 if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT)
1232 if (device_property_read_u8(&dev->dev, "ExternalFacingPort", &val))
1240 dev->external_facing = 1;
1243 static void pci_acpi_setup(struct device *dev)
1245 struct pci_dev *pci_dev = to_pci_dev(dev);
1246 struct acpi_device *adev = ACPI_COMPANION(dev);
1259 device_set_wakeup_capable(dev, true);
1267 device_wakeup_enable(dev);
1270 acpi_device_power_add_dependent(adev, dev);
1273 static void pci_acpi_cleanup(struct device *dev)
1275 struct acpi_device *adev = ACPI_COMPANION(dev);
1276 struct pci_dev *pci_dev = to_pci_dev(dev);
1284 acpi_device_power_remove_dependent(adev, dev);
1286 device_wakeup_disable(dev);
1288 device_set_wakeup_capable(dev, false);
1292 static bool pci_acpi_bus_match(struct device *dev)
1294 return dev_is_pci(dev);
1306 static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev);
1338 fwnode = pci_msi_get_fwnode_cb(&bus->dev);