Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

intel_th: Add ACPI glue layer

The Trace Hub devices now can be enumerated as ACPI devices, which
translates into "Host Debugger mode". There are two IDs: one for
PCH Trace Hub, and one for the uncore Trace Hub. These are expected
to stay the same across all platforms.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

+94
+12
drivers/hwtracing/intel_th/Kconfig
··· 25 25 26 26 Say Y here to enable PCI Intel TH support. 27 27 28 + config INTEL_TH_ACPI 29 + tristate "Intel(R) Trace Hub ACPI controller" 30 + depends on ACPI 31 + help 32 + Intel(R) Trace Hub may exist as an ACPI device. This option enables 33 + support glue layer for ACPI-based Intel TH. This typically implies 34 + 'host debugger' mode, that is, the trace configuration and capture 35 + is handled by an external debug host and corresponding controls will 36 + not be available on the target. 37 + 38 + Say Y here to enable ACPI Intel TH support. 39 + 28 40 config INTEL_TH_GTH 29 41 tristate "Intel(R) Trace Hub Global Trace Hub" 30 42 help
+3
drivers/hwtracing/intel_th/Makefile
··· 6 6 obj-$(CONFIG_INTEL_TH_PCI) += intel_th_pci.o 7 7 intel_th_pci-y := pci.o 8 8 9 + obj-$(CONFIG_INTEL_TH_ACPI) += intel_th_acpi.o 10 + intel_th_acpi-y := acpi.o 11 + 9 12 obj-$(CONFIG_INTEL_TH_GTH) += intel_th_gth.o 10 13 intel_th_gth-y := gth.o 11 14
+79
drivers/hwtracing/intel_th/acpi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel(R) Trace Hub ACPI driver 4 + * 5 + * Copyright (C) 2017 Intel Corporation. 6 + */ 7 + 8 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 9 + 10 + #include <linux/types.h> 11 + #include <linux/module.h> 12 + #include <linux/device.h> 13 + #include <linux/sysfs.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/acpi.h> 16 + 17 + #include "intel_th.h" 18 + 19 + #define DRIVER_NAME "intel_th_acpi" 20 + 21 + static const struct intel_th_drvdata intel_th_acpi_pch = { 22 + .host_mode_only = 1, 23 + }; 24 + 25 + static const struct intel_th_drvdata intel_th_acpi_uncore = { 26 + .host_mode_only = 1, 27 + }; 28 + 29 + static const struct acpi_device_id intel_th_acpi_ids[] = { 30 + { "INTC1000", (kernel_ulong_t)&intel_th_acpi_uncore }, 31 + { "INTC1001", (kernel_ulong_t)&intel_th_acpi_pch }, 32 + { "", 0 }, 33 + }; 34 + 35 + MODULE_DEVICE_TABLE(acpi, intel_th_acpi_ids); 36 + 37 + static int intel_th_acpi_probe(struct platform_device *pdev) 38 + { 39 + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 40 + const struct acpi_device_id *id; 41 + struct intel_th *th; 42 + 43 + id = acpi_match_device(intel_th_acpi_ids, &pdev->dev); 44 + if (!id) 45 + return -ENODEV; 46 + 47 + th = intel_th_alloc(&pdev->dev, (void *)id->driver_data, 48 + pdev->resource, pdev->num_resources, -1); 49 + if (IS_ERR(th)) 50 + return PTR_ERR(th); 51 + 52 + adev->driver_data = th; 53 + 54 + return 0; 55 + } 56 + 57 + static int intel_th_acpi_remove(struct platform_device *pdev) 58 + { 59 + struct intel_th *th = platform_get_drvdata(pdev); 60 + 61 + intel_th_free(th); 62 + 63 + return 0; 64 + } 65 + 66 + static struct platform_driver intel_th_acpi_driver = { 67 + .probe = intel_th_acpi_probe, 68 + .remove = intel_th_acpi_remove, 69 + .driver = { 70 + .name = DRIVER_NAME, 71 + .acpi_match_table = intel_th_acpi_ids, 72 + }, 73 + }; 74 + 75 + module_platform_driver(intel_th_acpi_driver); 76 + 77 + MODULE_LICENSE("GPL v2"); 78 + MODULE_DESCRIPTION("Intel(R) Trace Hub ACPI controller driver"); 79 + MODULE_AUTHOR("Alexander Shishkin <alexander.shishkin@intel.com>");