mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
![Iwona Winiarska](/assets/img/avatar_default.png)
Intel processors provide access for various services designed to support processor and DRAM thermal management, platform manageability and processor interface tuning and diagnostics. Those services are available via the Platform Environment Control Interface (PECI) that provides a communication channel between the processor and the Baseboard Management Controller (BMC) or other platform management device. This change introduces PECI subsystem by adding the initial core module and API for controller drivers. Co-developed-by: Jason M Bills <jason.m.bills@linux.intel.com> Co-developed-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Jason M Bills <jason.m.bills@linux.intel.com> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> Link: https://lore.kernel.org/r/20220208153639.255278-5-iwona.winiarska@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
99 lines
2.8 KiB
C
99 lines
2.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* Copyright (c) 2018-2021 Intel Corporation */
|
|
|
|
#ifndef __LINUX_PECI_H
|
|
#define __LINUX_PECI_H
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/types.h>
|
|
|
|
/*
|
|
* Currently we don't support any PECI command over 32 bytes.
|
|
*/
|
|
#define PECI_REQUEST_MAX_BUF_SIZE 32
|
|
|
|
struct peci_controller;
|
|
struct peci_request;
|
|
|
|
/**
|
|
* struct peci_controller_ops - PECI controller specific methods
|
|
* @xfer: PECI transfer function
|
|
*
|
|
* PECI controllers may have different hardware interfaces - the drivers
|
|
* implementing PECI controllers can use this structure to abstract away those
|
|
* differences by exposing a common interface for PECI core.
|
|
*/
|
|
struct peci_controller_ops {
|
|
int (*xfer)(struct peci_controller *controller, u8 addr, struct peci_request *req);
|
|
};
|
|
|
|
/**
|
|
* struct peci_controller - PECI controller
|
|
* @dev: device object to register PECI controller to the device model
|
|
* @ops: pointer to device specific controller operations
|
|
* @bus_lock: lock used to protect multiple callers
|
|
* @id: PECI controller ID
|
|
*
|
|
* PECI controllers usually connect to their drivers using non-PECI bus,
|
|
* such as the platform bus.
|
|
* Each PECI controller can communicate with one or more PECI devices.
|
|
*/
|
|
struct peci_controller {
|
|
struct device dev;
|
|
struct peci_controller_ops *ops;
|
|
struct mutex bus_lock; /* held for the duration of xfer */
|
|
u8 id;
|
|
};
|
|
|
|
struct peci_controller *devm_peci_controller_add(struct device *parent,
|
|
struct peci_controller_ops *ops);
|
|
|
|
static inline struct peci_controller *to_peci_controller(void *d)
|
|
{
|
|
return container_of(d, struct peci_controller, dev);
|
|
}
|
|
|
|
/**
|
|
* struct peci_device - PECI device
|
|
* @dev: device object to register PECI device to the device model
|
|
* @controller: manages the bus segment hosting this PECI device
|
|
* @addr: address used on the PECI bus connected to the parent controller
|
|
*
|
|
* A peci_device identifies a single device (i.e. CPU) connected to a PECI bus.
|
|
* The behaviour exposed to the rest of the system is defined by the PECI driver
|
|
* managing the device.
|
|
*/
|
|
struct peci_device {
|
|
struct device dev;
|
|
u8 addr;
|
|
};
|
|
|
|
static inline struct peci_device *to_peci_device(struct device *d)
|
|
{
|
|
return container_of(d, struct peci_device, dev);
|
|
}
|
|
|
|
/**
|
|
* struct peci_request - PECI request
|
|
* @device: PECI device to which the request is sent
|
|
* @tx: TX buffer specific data
|
|
* @tx.buf: TX buffer
|
|
* @tx.len: transfer data length in bytes
|
|
* @rx: RX buffer specific data
|
|
* @rx.buf: RX buffer
|
|
* @rx.len: received data length in bytes
|
|
*
|
|
* A peci_request represents a request issued by PECI originator (TX) and
|
|
* a response received from PECI responder (RX).
|
|
*/
|
|
struct peci_request {
|
|
struct peci_device *device;
|
|
struct {
|
|
u8 buf[PECI_REQUEST_MAX_BUF_SIZE];
|
|
u8 len;
|
|
} rx, tx;
|
|
};
|
|
|
|
#endif /* __LINUX_PECI_H */
|