Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 3 | |
| 4 | #include <arch/acpi_device.h> |
| 5 | #include <arch/acpigen.h> |
| 6 | #include <console/console.h> |
| 7 | #include <device/pci.h> |
| 8 | #include <device/pci_ids.h> |
| 9 | #include "chip.h" |
| 10 | |
| 11 | static void ish_fill_ssdt_generator(struct device *dev) |
| 12 | { |
| 13 | struct drivers_intel_ish_config *config = dev->chip_info; |
| 14 | struct device *root = dev->bus->dev; |
| 15 | struct acpi_dp *dsd; |
| 16 | |
| 17 | if (!dev->enabled || !config || !config->firmware_name) |
| 18 | return; |
| 19 | |
| 20 | acpigen_write_scope(acpi_device_path(root)); |
| 21 | |
| 22 | dsd = acpi_dp_new_table("_DSD"); |
| 23 | acpi_dp_add_string(dsd, "firmware-name", config->firmware_name); |
| 24 | acpi_dp_write(dsd); |
| 25 | |
| 26 | acpigen_pop_len(); /* Scope */ |
| 27 | |
| 28 | printk(BIOS_INFO, "%s: Set firmware-name: %s\n", |
| 29 | acpi_device_path(root), config->firmware_name); |
| 30 | } |
| 31 | |
| 32 | static struct device_operations intel_ish_ops = { |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 33 | .read_resources = DEVICE_NOOP, |
| 34 | .set_resources = DEVICE_NOOP, |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 35 | .acpi_fill_ssdt = ish_fill_ssdt_generator, |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | static void intel_ish_enable(struct device *dev) |
| 39 | { |
| 40 | /* This dev is a generic device that is a child to the ISH PCI device */ |
| 41 | dev->ops = &intel_ish_ops; |
| 42 | } |
| 43 | |
| 44 | /* Copy of default_pci_ops_dev with scan_bus addition */ |
| 45 | static const struct device_operations pci_ish_device_ops = { |
| 46 | .read_resources = pci_dev_read_resources, |
| 47 | .set_resources = pci_dev_set_resources, |
| 48 | .enable_resources = pci_dev_enable_resources, |
| 49 | .init = pci_dev_init, |
| 50 | .scan_bus = &scan_generic_bus, /* Non-default */ |
| 51 | .ops_pci = &pci_dev_ops_pci, |
| 52 | }; |
| 53 | |
| 54 | static const unsigned short pci_device_ids[] = { |
| 55 | PCI_DEVICE_ID_INTEL_CNL_ISHB, |
Bernardo Perez Priego | ab9a7c0 | 2019-08-02 18:25:01 -0700 | [diff] [blame] | 56 | PCI_DEVICE_ID_INTEL_CML_ISHB, |
li feng | db992ac | 2020-03-12 11:37:13 -0700 | [diff] [blame] | 57 | PCI_DEVICE_ID_INTEL_TGL_ISHB, |
Jett Rink | 6bdfc80 | 2019-03-01 10:20:34 -0700 | [diff] [blame] | 58 | 0 |
| 59 | }; |
| 60 | |
| 61 | static const struct pci_driver ish_intel_driver __pci_driver = { |
| 62 | .ops = &pci_ish_device_ops, |
| 63 | .vendor = PCI_VENDOR_ID_INTEL, |
| 64 | .devices = pci_device_ids, |
| 65 | }; |
| 66 | |
| 67 | struct chip_operations drivers_intel_ish_ops = { |
| 68 | CHIP_NAME("Intel ISH Chip") |
| 69 | .enable_dev = intel_ish_enable, |
| 70 | }; |