Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Matt DeVillier | fddcae7 | 2024-01-17 16:10:58 -0600 | [diff] [blame^] | 3 | #include <acpi/acpigen.h> |
| 4 | #include <acpi/acpigen_pci.h> |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 5 | #include <device/device.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <device/pci_ids.h> |
Matt DeVillier | fddcae7 | 2024-01-17 16:10:58 -0600 | [diff] [blame^] | 8 | #include <intelblocks/acpi.h> |
| 9 | |
| 10 | static void sata_acpi_fill_ssdt(const struct device *dev) |
| 11 | { |
| 12 | const char *scope = acpi_device_path(dev); |
| 13 | |
| 14 | if (!scope) |
| 15 | return; |
| 16 | |
| 17 | acpigen_write_scope(scope); |
| 18 | acpigen_write_device(soc_acpi_name(dev)); |
| 19 | acpigen_write_ADR_pci_device(dev); |
| 20 | acpigen_write_STA(acpi_device_status(dev)); |
| 21 | acpigen_pop_len(); /* Device */ |
| 22 | acpigen_pop_len(); /* Scope */ |
| 23 | } |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 24 | |
Nico Huber | 5768619 | 2022-08-06 19:11:55 +0200 | [diff] [blame] | 25 | struct device_operations sata_ops = { |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 26 | .read_resources = pci_dev_read_resources, |
| 27 | .set_resources = pci_dev_set_resources, |
| 28 | .enable_resources = pci_dev_enable_resources, |
Subrata Banik | 7ad46df | 2020-09-13 17:05:04 +0530 | [diff] [blame] | 29 | .final = pci_dev_request_bus_master, |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 30 | .ops_pci = &pci_dev_ops_pci, |
Matt DeVillier | fddcae7 | 2024-01-17 16:10:58 -0600 | [diff] [blame^] | 31 | #if CONFIG(HAVE_ACPI_TABLES) |
| 32 | .acpi_fill_ssdt = sata_acpi_fill_ssdt, |
| 33 | #endif |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | static const unsigned short pci_device_ids[] = { |
Wonkyu Kim | 9f40107 | 2020-11-13 15:16:32 -0800 | [diff] [blame] | 37 | PCI_DID_INTEL_MTL_SATA, |
Bora Guvendik | a15b25f | 2022-02-28 14:43:49 -0800 | [diff] [blame] | 38 | PCI_DID_INTEL_RPP_P_SATA_1, |
| 39 | PCI_DID_INTEL_RPP_P_SATA_2, |
Jeremy Soller | 14d69d0 | 2023-05-17 14:52:03 -0600 | [diff] [blame] | 40 | PCI_DID_INTEL_RPP_S_SATA, |
Felix Singer | 43b7f41 | 2022-03-07 04:34:52 +0100 | [diff] [blame] | 41 | PCI_DID_INTEL_LWB_SATA_AHCI, |
| 42 | PCI_DID_INTEL_LWB_SSATA_AHCI, |
| 43 | PCI_DID_INTEL_LWB_SATA_RAID, |
| 44 | PCI_DID_INTEL_LWB_SSATA_RAID, |
| 45 | PCI_DID_INTEL_LWB_SATA_AHCI_SUPER, |
| 46 | PCI_DID_INTEL_LWB_SSATA_AHCI_SUPER, |
| 47 | PCI_DID_INTEL_LWB_SATA_RAID_SUPER, |
| 48 | PCI_DID_INTEL_LWB_SSATA_RAID_SUPER, |
| 49 | PCI_DID_INTEL_LWB_SATA_ALT, |
| 50 | PCI_DID_INTEL_LWB_SATA_ALT_RST, |
| 51 | PCI_DID_INTEL_LWB_SSATA_ALT, |
| 52 | PCI_DID_INTEL_LWB_SSATA_ALT_RST, |
| 53 | PCI_DID_INTEL_CNL_SATA, |
| 54 | PCI_DID_INTEL_CNL_PREMIUM_SATA, |
| 55 | PCI_DID_INTEL_CNP_CMP_COMPAT_SATA, |
| 56 | PCI_DID_INTEL_CNP_H_SATA, |
| 57 | PCI_DID_INTEL_CNP_H_HALO_SATA, |
| 58 | PCI_DID_INTEL_CNP_LP_SATA, |
| 59 | PCI_DID_INTEL_ICP_U_SATA, |
| 60 | PCI_DID_INTEL_CMP_SATA, |
| 61 | PCI_DID_INTEL_CMP_PREMIUM_SATA, |
| 62 | PCI_DID_INTEL_CMP_LP_SATA, |
| 63 | PCI_DID_INTEL_CMP_H_SATA, |
| 64 | PCI_DID_INTEL_CMP_H_HALO_SATA, |
| 65 | PCI_DID_INTEL_CMP_H_PREMIUM_SATA, |
| 66 | PCI_DID_INTEL_TGP_LP_SATA, |
| 67 | PCI_DID_INTEL_TGP_SATA, |
| 68 | PCI_DID_INTEL_TGP_PREMIUM_SATA, |
| 69 | PCI_DID_INTEL_TGP_COMPAT_SATA, |
| 70 | PCI_DID_INTEL_TGP_H_SATA, |
| 71 | PCI_DID_INTEL_MCC_AHCI_SATA, |
| 72 | PCI_DID_INTEL_JSP_SATA_1, |
| 73 | PCI_DID_INTEL_JSP_SATA_2, |
| 74 | PCI_DID_INTEL_ADP_P_SATA_1, |
| 75 | PCI_DID_INTEL_ADP_P_SATA_2, |
| 76 | PCI_DID_INTEL_ADP_P_SATA_3, |
| 77 | PCI_DID_INTEL_ADP_P_SATA_4, |
| 78 | PCI_DID_INTEL_ADP_P_SATA_5, |
| 79 | PCI_DID_INTEL_ADP_P_SATA_6, |
| 80 | PCI_DID_INTEL_ADP_S_SATA_1, |
| 81 | PCI_DID_INTEL_ADP_S_SATA_2, |
| 82 | PCI_DID_INTEL_ADP_S_SATA_3, |
| 83 | PCI_DID_INTEL_ADP_S_SATA_4, |
| 84 | PCI_DID_INTEL_ADP_S_SATA_5, |
| 85 | PCI_DID_INTEL_ADP_S_SATA_6, |
| 86 | PCI_DID_INTEL_ADP_M_SATA_1, |
| 87 | PCI_DID_INTEL_ADP_M_SATA_2, |
| 88 | PCI_DID_INTEL_ADP_M_SATA_3, |
Sean Rhodes | 561f7df | 2022-07-18 16:22:33 +0100 | [diff] [blame] | 89 | PCI_DID_INTEL_APL_SATA, |
| 90 | PCI_DID_INTEL_GLK_SATA, |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 91 | 0 |
| 92 | }; |
| 93 | |
| 94 | static const struct pci_driver pch_sata __pci_driver = { |
| 95 | .ops = &sata_ops, |
Felix Singer | 43b7f41 | 2022-03-07 04:34:52 +0100 | [diff] [blame] | 96 | .vendor = PCI_VID_INTEL, |
Subrata Banik | 41934bf | 2020-08-08 12:34:25 +0530 | [diff] [blame] | 97 | .devices = pci_device_ids, |
| 98 | }; |