![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* Copyright (c) 2018-2021 Intel Corporation */ 0003 0004 #ifndef __LINUX_PECI_H 0005 #define __LINUX_PECI_H 0006 0007 #include <linux/device.h> 0008 #include <linux/kernel.h> 0009 #include <linux/mutex.h> 0010 #include <linux/types.h> 0011 0012 /* 0013 * Currently we don't support any PECI command over 32 bytes. 0014 */ 0015 #define PECI_REQUEST_MAX_BUF_SIZE 32 0016 0017 struct peci_controller; 0018 struct peci_request; 0019 0020 /** 0021 * struct peci_controller_ops - PECI controller specific methods 0022 * @xfer: PECI transfer function 0023 * 0024 * PECI controllers may have different hardware interfaces - the drivers 0025 * implementing PECI controllers can use this structure to abstract away those 0026 * differences by exposing a common interface for PECI core. 0027 */ 0028 struct peci_controller_ops { 0029 int (*xfer)(struct peci_controller *controller, u8 addr, struct peci_request *req); 0030 }; 0031 0032 /** 0033 * struct peci_controller - PECI controller 0034 * @dev: device object to register PECI controller to the device model 0035 * @ops: pointer to device specific controller operations 0036 * @bus_lock: lock used to protect multiple callers 0037 * @id: PECI controller ID 0038 * 0039 * PECI controllers usually connect to their drivers using non-PECI bus, 0040 * such as the platform bus. 0041 * Each PECI controller can communicate with one or more PECI devices. 0042 */ 0043 struct peci_controller { 0044 struct device dev; 0045 struct peci_controller_ops *ops; 0046 struct mutex bus_lock; /* held for the duration of xfer */ 0047 u8 id; 0048 }; 0049 0050 struct peci_controller *devm_peci_controller_add(struct device *parent, 0051 struct peci_controller_ops *ops); 0052 0053 static inline struct peci_controller *to_peci_controller(void *d) 0054 { 0055 return container_of(d, struct peci_controller, dev); 0056 } 0057 0058 /** 0059 * struct peci_device - PECI device 0060 * @dev: device object to register PECI device to the device model 0061 * @controller: manages the bus segment hosting this PECI device 0062 * @info: PECI device characteristics 0063 * @info.family: device family 0064 * @info.model: device model 0065 * @info.peci_revision: PECI revision supported by the PECI device 0066 * @info.socket_id: the socket ID represented by the PECI device 0067 * @addr: address used on the PECI bus connected to the parent controller 0068 * @deleted: indicates that PECI device was already deleted 0069 * 0070 * A peci_device identifies a single device (i.e. CPU) connected to a PECI bus. 0071 * The behaviour exposed to the rest of the system is defined by the PECI driver 0072 * managing the device. 0073 */ 0074 struct peci_device { 0075 struct device dev; 0076 struct { 0077 u16 family; 0078 u8 model; 0079 u8 peci_revision; 0080 u8 socket_id; 0081 } info; 0082 u8 addr; 0083 bool deleted; 0084 }; 0085 0086 static inline struct peci_device *to_peci_device(struct device *d) 0087 { 0088 return container_of(d, struct peci_device, dev); 0089 } 0090 0091 /** 0092 * struct peci_request - PECI request 0093 * @device: PECI device to which the request is sent 0094 * @tx: TX buffer specific data 0095 * @tx.buf: TX buffer 0096 * @tx.len: transfer data length in bytes 0097 * @rx: RX buffer specific data 0098 * @rx.buf: RX buffer 0099 * @rx.len: received data length in bytes 0100 * 0101 * A peci_request represents a request issued by PECI originator (TX) and 0102 * a response received from PECI responder (RX). 0103 */ 0104 struct peci_request { 0105 struct peci_device *device; 0106 struct { 0107 u8 buf[PECI_REQUEST_MAX_BUF_SIZE]; 0108 u8 len; 0109 } rx, tx; 0110 }; 0111 0112 #endif /* __LINUX_PECI_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |