Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 3 | |
Furquan Shaikh | 088b9e3 | 2020-04-27 15:41:35 -0700 | [diff] [blame] | 4 | #include <arch/acpigen.h> |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 5 | #include <device/device.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <device/pci_ids.h> |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 8 | #include <amdblocks/sata.h> |
| 9 | |
| 10 | void __weak soc_enable_sata_features(struct device *dev) { } |
| 11 | |
Furquan Shaikh | 69c0469 | 2020-04-27 15:34:47 -0700 | [diff] [blame] | 12 | static const char *sata_acpi_name(const struct device *dev) |
| 13 | { |
| 14 | return "STCR"; |
| 15 | } |
| 16 | |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 17 | static struct device_operations sata_ops = { |
Furquan Shaikh | d7d22a4 | 2020-04-27 15:30:04 -0700 | [diff] [blame] | 18 | .read_resources = pci_dev_read_resources, |
| 19 | .set_resources = pci_dev_set_resources, |
| 20 | .enable_resources = pci_dev_enable_resources, |
| 21 | .init = soc_enable_sata_features, |
Furquan Shaikh | 64f477b | 2020-04-27 17:57:03 -0700 | [diff] [blame] | 22 | .ops_pci = &pci_dev_ops_pci, |
Furquan Shaikh | 69c0469 | 2020-04-27 15:34:47 -0700 | [diff] [blame] | 23 | .acpi_name = sata_acpi_name, |
Furquan Shaikh | 088b9e3 | 2020-04-27 15:41:35 -0700 | [diff] [blame] | 24 | .acpi_fill_ssdt = acpi_device_write_pci_dev, |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | static const unsigned short pci_device_ids[] = { |
| 28 | PCI_DEVICE_ID_AMD_CZ_SATA, |
| 29 | PCI_DEVICE_ID_AMD_CZ_SATA_AHCI, |
Furquan Shaikh | 52f8926 | 2020-04-27 15:45:20 -0700 | [diff] [blame] | 30 | PCI_DEVICE_ID_AMD_FAM17H_SATA_AHCI_VER0, |
| 31 | PCI_DEVICE_ID_AMD_FAM17H_SATA_AHCI_VER1, |
| 32 | PCI_DEVICE_ID_AMD_FAM17H_SATA_AHCI_RAID_VER0, |
| 33 | PCI_DEVICE_ID_AMD_FAM17H_SATA_AHCI_RAID_VER1, |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 34 | 0 |
| 35 | }; |
| 36 | |
| 37 | static const struct pci_driver sata0_driver __pci_driver = { |
Furquan Shaikh | d7d22a4 | 2020-04-27 15:30:04 -0700 | [diff] [blame] | 38 | .ops = &sata_ops, |
| 39 | .vendor = PCI_VENDOR_ID_AMD, |
| 40 | .devices = pci_device_ids, |
Marshall Dawson | aa67def | 2019-05-03 16:10:34 -0600 | [diff] [blame] | 41 | }; |