Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi_device.h> |
| 4 | #include <acpi/acpigen.h> |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 5 | #include <console/console.h> |
| 6 | #include <device/pci.h> |
| 7 | #include <device/pci_ids.h> |
| 8 | #include "chip.h" |
| 9 | |
Furquan Shaikh | 7536a39 | 2020-04-24 21:59:21 -0700 | [diff] [blame] | 10 | static void ish_fill_ssdt_generator(const struct device *dev) |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 11 | { |
| 12 | struct drivers_intel_ish_config *config = dev->chip_info; |
| 13 | struct device *root = dev->bus->dev; |
| 14 | struct acpi_dp *dsd; |
| 15 | |
Reka Norman | 6419fbf | 2022-12-12 10:32:53 +1100 | [diff] [blame] | 16 | if (!config) |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 17 | return; |
| 18 | |
| 19 | acpigen_write_scope(acpi_device_path(root)); |
| 20 | |
| 21 | dsd = acpi_dp_new_table("_DSD"); |
Reka Norman | 6419fbf | 2022-12-12 10:32:53 +1100 | [diff] [blame] | 22 | |
| 23 | if (config->firmware_name) { |
| 24 | acpi_dp_add_string(dsd, "firmware-name", config->firmware_name); |
| 25 | printk(BIOS_INFO, "%s: Set firmware-name: %s\n", |
| 26 | acpi_device_path(root), config->firmware_name); |
| 27 | } |
| 28 | |
| 29 | if (config->add_acpi_dma_property) |
| 30 | acpi_device_add_dma_property(dsd); |
| 31 | |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 32 | acpi_dp_write(dsd); |
| 33 | |
| 34 | acpigen_pop_len(); /* Scope */ |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | static struct device_operations intel_ish_ops = { |
Nico Huber | 2f8ba69 | 2020-04-05 14:05:24 +0200 | [diff] [blame] | 38 | .read_resources = noop_read_resources, |
| 39 | .set_resources = noop_set_resources, |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 40 | .acpi_fill_ssdt = ish_fill_ssdt_generator, |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static void intel_ish_enable(struct device *dev) |
| 44 | { |
| 45 | /* This dev is a generic device that is a child to the ISH PCI device */ |
| 46 | dev->ops = &intel_ish_ops; |
| 47 | } |
| 48 | |
| 49 | /* Copy of default_pci_ops_dev with scan_bus addition */ |
| 50 | static const struct device_operations pci_ish_device_ops = { |
| 51 | .read_resources = pci_dev_read_resources, |
| 52 | .set_resources = pci_dev_set_resources, |
| 53 | .enable_resources = pci_dev_enable_resources, |
| 54 | .init = pci_dev_init, |
| 55 | .scan_bus = &scan_generic_bus, /* Non-default */ |
| 56 | .ops_pci = &pci_dev_ops_pci, |
| 57 | }; |
| 58 | |
| 59 | static const unsigned short pci_device_ids[] = { |
Wonkyu Kim | 9f40107 | 2020-11-13 15:16:32 -0800 | [diff] [blame] | 60 | PCI_DID_INTEL_MTL_ISHB, |
Felix Singer | 43b7f41 | 2022-03-07 04:34:52 +0100 | [diff] [blame] | 61 | PCI_DID_INTEL_CNL_ISHB, |
| 62 | PCI_DID_INTEL_CML_ISHB, |
| 63 | PCI_DID_INTEL_TGL_ISHB, |
| 64 | PCI_DID_INTEL_TGL_H_ISHB, |
Meera Ravindranath | ac08e8f | 2022-10-06 14:24:07 +0530 | [diff] [blame] | 65 | PCI_DID_INTEL_ADL_N_ISHB, |
Subrata Banik | 3a60e5c | 2022-12-23 18:09:11 +0000 | [diff] [blame] | 66 | PCI_DID_INTEL_ADL_P_ISHB, |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 67 | 0 |
| 68 | }; |
| 69 | |
| 70 | static const struct pci_driver ish_intel_driver __pci_driver = { |
| 71 | .ops = &pci_ish_device_ops, |
Felix Singer | 43b7f41 | 2022-03-07 04:34:52 +0100 | [diff] [blame] | 72 | .vendor = PCI_VID_INTEL, |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 73 | .devices = pci_device_ids, |
| 74 | }; |
| 75 | |
| 76 | struct chip_operations drivers_intel_ish_ops = { |
| 77 | CHIP_NAME("Intel ISH Chip") |
| 78 | .enable_dev = intel_ish_enable, |
| 79 | }; |