coreboot-kgpe-d16/src/drivers/intel/ish/ish.c
Reka Norman 6419fbf193 drivers/intel/ish: Allow adding DmaProperty to _DSD
On nissa, the ISH is running closed source firmware, so the ChromeOS
security requirements specify it must be behind an IOMMU. Allow adding
DmaProperty to the _DSD of the ISH device. This will result in the
kernel marking the device as untrusted.

BUG=b:249846505
TEST=Check SSDT is correct, and kernel detects the DmaProperty and
firmware-name properties.

SSDT entry on yaviks with both add_acpi_dma_property and firmware_name
set in devictree:
    Scope (\_SB.PCI0.ISHB)
    {
        Name (_DSD, Package (0x04)  // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device Properties for _DSD */,
            Package (0x01)
            {
                Package (0x02)
                {
                    "firmware-name",
                    "adl_ish_lite.bin"
                }
            },

            ToUUID ("70d24161-6dd5-4c9e-8070-705531292865"),
            Package (0x01)
            {
                Package (0x02)
                {
                    "DmaProperty",
                    One
                }
            }
        })
    }

Change-Id: Ie1539fc757e72e995e98c3ecf83e705e3bede8c0
Signed-off-by: Reka Norman <rekanorman@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70632
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Kangheui Won <khwon@chromium.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
2022-12-13 14:52:37 +00:00

78 lines
2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_device.h>
#include <acpi/acpigen.h>
#include <console/console.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include "chip.h"
static void ish_fill_ssdt_generator(const struct device *dev)
{
struct drivers_intel_ish_config *config = dev->chip_info;
struct device *root = dev->bus->dev;
struct acpi_dp *dsd;
if (!config)
return;
acpigen_write_scope(acpi_device_path(root));
dsd = acpi_dp_new_table("_DSD");
if (config->firmware_name) {
acpi_dp_add_string(dsd, "firmware-name", config->firmware_name);
printk(BIOS_INFO, "%s: Set firmware-name: %s\n",
acpi_device_path(root), config->firmware_name);
}
if (config->add_acpi_dma_property)
acpi_device_add_dma_property(dsd);
acpi_dp_write(dsd);
acpigen_pop_len(); /* Scope */
}
static struct device_operations intel_ish_ops = {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.acpi_fill_ssdt = ish_fill_ssdt_generator,
};
static void intel_ish_enable(struct device *dev)
{
/* This dev is a generic device that is a child to the ISH PCI device */
dev->ops = &intel_ish_ops;
}
/* Copy of default_pci_ops_dev with scan_bus addition */
static const struct device_operations pci_ish_device_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = pci_dev_init,
.scan_bus = &scan_generic_bus, /* Non-default */
.ops_pci = &pci_dev_ops_pci,
};
static const unsigned short pci_device_ids[] = {
PCI_DID_INTEL_MTL_ISHB,
PCI_DID_INTEL_CNL_ISHB,
PCI_DID_INTEL_CML_ISHB,
PCI_DID_INTEL_TGL_ISHB,
PCI_DID_INTEL_TGL_H_ISHB,
PCI_DID_INTEL_ADL_N_ISHB,
0
};
static const struct pci_driver ish_intel_driver __pci_driver = {
.ops = &pci_ish_device_ops,
.vendor = PCI_VID_INTEL,
.devices = pci_device_ids,
};
struct chip_operations drivers_intel_ish_ops = {
CHIP_NAME("Intel ISH Chip")
.enable_dev = intel_ish_enable,
};