blob: 5dbb26e87e5da0cd9da9b0710624983dfa89e51c [file] [log] [blame]
Angel Pons8a3453f2020-04-02 23:48:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Jett Rink6bdfc802019-03-01 10:20:34 -07002
Furquan Shaikh76cedd22020-05-02 10:24:23 -07003#include <acpi/acpi_device.h>
4#include <acpi/acpigen.h>
Jett Rink6bdfc802019-03-01 10:20:34 -07005#include <console/console.h>
6#include <device/pci.h>
7#include <device/pci_ids.h>
8#include "chip.h"
9
Furquan Shaikh7536a392020-04-24 21:59:21 -070010static void ish_fill_ssdt_generator(const struct device *dev)
Jett Rink6bdfc802019-03-01 10:20:34 -070011{
12 struct drivers_intel_ish_config *config = dev->chip_info;
13 struct device *root = dev->bus->dev;
14 struct acpi_dp *dsd;
15
Reka Norman6419fbf2022-12-12 10:32:53 +110016 if (!config)
Jett Rink6bdfc802019-03-01 10:20:34 -070017 return;
18
19 acpigen_write_scope(acpi_device_path(root));
20
21 dsd = acpi_dp_new_table("_DSD");
Reka Norman6419fbf2022-12-12 10:32:53 +110022
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 Rink6bdfc802019-03-01 10:20:34 -070032 acpi_dp_write(dsd);
33
34 acpigen_pop_len(); /* Scope */
Jett Rink6bdfc802019-03-01 10:20:34 -070035}
36
37static struct device_operations intel_ish_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020038 .read_resources = noop_read_resources,
39 .set_resources = noop_set_resources,
Nico Huber68680dd2020-03-31 17:34:52 +020040 .acpi_fill_ssdt = ish_fill_ssdt_generator,
Jett Rink6bdfc802019-03-01 10:20:34 -070041};
42
43static 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 */
50static 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
59static const unsigned short pci_device_ids[] = {
Wonkyu Kim9f401072020-11-13 15:16:32 -080060 PCI_DID_INTEL_MTL_ISHB,
Felix Singer43b7f412022-03-07 04:34:52 +010061 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 Ravindranathac08e8f2022-10-06 14:24:07 +053065 PCI_DID_INTEL_ADL_N_ISHB,
Jett Rink6bdfc802019-03-01 10:20:34 -070066 0
67};
68
69static const struct pci_driver ish_intel_driver __pci_driver = {
70 .ops = &pci_ish_device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010071 .vendor = PCI_VID_INTEL,
Jett Rink6bdfc802019-03-01 10:20:34 -070072 .devices = pci_device_ids,
73};
74
75struct chip_operations drivers_intel_ish_ops = {
76 CHIP_NAME("Intel ISH Chip")
77 .enable_dev = intel_ish_enable,
78};