// SPDX-License-Identifier: GPL-2.0-only // Copyright (c) 2021 Intel Corporation #include <linux/auxiliary_bus.h> #include <linux/module.h> #include <linux/peci.h> #include <linux/peci-cpu.h> #include <linux/slab.h> #include "internal.h" /** * peci_temp_read() - read the maximum die temperature from PECI target device * @device: PECI device to which request is going to be sent * @temp_raw: where to store the read temperature * * It uses GetTemp PECI command. * * Return: 0 if succeeded, other values in case errors. */ int peci_temp_read(struct peci_device *device, s16 *temp_raw) { … } EXPORT_SYMBOL_NS_GPL(…); /** * peci_pcs_read() - read PCS register * @device: PECI device to which request is going to be sent * @index: PCS index * @param: PCS parameter * @data: where to store the read data * * It uses RdPkgConfig PECI command. * * Return: 0 if succeeded, other values in case errors. */ int peci_pcs_read(struct peci_device *device, u8 index, u16 param, u32 *data) { … } EXPORT_SYMBOL_NS_GPL(…); /** * peci_pci_local_read() - read 32-bit memory location using raw address * @device: PECI device to which request is going to be sent * @bus: bus * @dev: device * @func: function * @reg: register * @data: where to store the read data * * It uses RdPCIConfigLocal PECI command. * * Return: 0 if succeeded, other values in case errors. */ int peci_pci_local_read(struct peci_device *device, u8 bus, u8 dev, u8 func, u16 reg, u32 *data) { … } EXPORT_SYMBOL_NS_GPL(…); /** * peci_ep_pci_local_read() - read 32-bit memory location using raw address * @device: PECI device to which request is going to be sent * @seg: PCI segment * @bus: bus * @dev: device * @func: function * @reg: register * @data: where to store the read data * * Like &peci_pci_local_read, but it uses RdEndpointConfig PECI command. * * Return: 0 if succeeded, other values in case errors. */ int peci_ep_pci_local_read(struct peci_device *device, u8 seg, u8 bus, u8 dev, u8 func, u16 reg, u32 *data) { … } EXPORT_SYMBOL_NS_GPL(…); /** * peci_mmio_read() - read 32-bit memory location using 64-bit bar offset address * @device: PECI device to which request is going to be sent * @bar: PCI bar * @seg: PCI segment * @bus: bus * @dev: device * @func: function * @address: 64-bit MMIO address * @data: where to store the read data * * It uses RdEndpointConfig PECI command. * * Return: 0 if succeeded, other values in case errors. */ int peci_mmio_read(struct peci_device *device, u8 bar, u8 seg, u8 bus, u8 dev, u8 func, u64 address, u32 *data) { … } EXPORT_SYMBOL_NS_GPL(…); static const char * const peci_adev_types[] = …; struct peci_cpu { … }; static void adev_release(struct device *dev) { … } static struct auxiliary_device *adev_alloc(struct peci_cpu *priv, int idx) { … } static void unregister_adev(void *_adev) { … } static int devm_adev_add(struct device *dev, int idx) { … } static void peci_cpu_add_adevices(struct peci_cpu *priv) { … } static int peci_cpu_probe(struct peci_device *device, const struct peci_device_id *id) { … } static const struct peci_device_id peci_cpu_device_ids[] = …; MODULE_DEVICE_TABLE(peci, peci_cpu_device_ids); static struct peci_driver peci_cpu_driver = …; module_peci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_IMPORT_NS(…);