| 36 | */ |
| 37 | |
| 38 | void rt_pci_pme_init(struct rt_pci_device *pdev) |
| 39 | { |
| 40 | rt_uint16_t pmc; |
| 41 | |
| 42 | if (!pdev || !(pdev->pme_cap = rt_pci_find_capability(pdev, PCIY_PMG))) |
| 43 | { |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | rt_pci_read_config_u16(pdev, pdev->pme_cap + PCIR_POWER_CAP, &pmc); |
| 48 | |
| 49 | if ((pmc & PCIM_PCAP_SPEC) > 3) |
| 50 | { |
| 51 | LOG_E("%s: Unsupported PME CAP regs spec %u", |
| 52 | rt_dm_dev_get_name(&pdev->parent), pmc & PCIM_PCAP_SPEC); |
| 53 | |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | pmc &= PCIM_PCAP_PMEMASK; |
| 58 | |
| 59 | if (pmc) |
| 60 | { |
| 61 | pdev->pme_support = RT_FIELD_GET(PCIM_PCAP_PMEMASK, pmc); |
| 62 | |
| 63 | rt_pci_pme_active(pdev, RT_FALSE); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | rt_err_t rt_pci_enable_wake(struct rt_pci_device *pdev, |
| 68 | enum rt_pci_power state, rt_bool_t enable) |
no test coverage detected