~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/peci.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /* Copyright (c) 2018-2021 Intel Corporation */
  3 
  4 #ifndef __LINUX_PECI_H
  5 #define __LINUX_PECI_H
  6 
  7 #include <linux/device.h>
  8 #include <linux/kernel.h>
  9 #include <linux/mutex.h>
 10 #include <linux/types.h>
 11 
 12 /*
 13  * Currently we don't support any PECI command over 32 bytes.
 14  */
 15 #define PECI_REQUEST_MAX_BUF_SIZE 32
 16 
 17 struct peci_controller;
 18 struct peci_request;
 19 
 20 /**
 21  * struct peci_controller_ops - PECI controller specific methods
 22  * @xfer: PECI transfer function
 23  *
 24  * PECI controllers may have different hardware interfaces - the drivers
 25  * implementing PECI controllers can use this structure to abstract away those
 26  * differences by exposing a common interface for PECI core.
 27  */
 28 struct peci_controller_ops {
 29         int (*xfer)(struct peci_controller *controller, u8 addr, struct peci_request *req);
 30 };
 31 
 32 /**
 33  * struct peci_controller - PECI controller
 34  * @dev: device object to register PECI controller to the device model
 35  * @ops: pointer to device specific controller operations
 36  * @bus_lock: lock used to protect multiple callers
 37  * @id: PECI controller ID
 38  *
 39  * PECI controllers usually connect to their drivers using non-PECI bus,
 40  * such as the platform bus.
 41  * Each PECI controller can communicate with one or more PECI devices.
 42  */
 43 struct peci_controller {
 44         struct device dev;
 45         const struct peci_controller_ops *ops;
 46         struct mutex bus_lock; /* held for the duration of xfer */
 47         u8 id;
 48 };
 49 
 50 struct peci_controller *devm_peci_controller_add(struct device *parent,
 51                                                  const struct peci_controller_ops *ops);
 52 
 53 static inline struct peci_controller *to_peci_controller(void *d)
 54 {
 55         return container_of(d, struct peci_controller, dev);
 56 }
 57 
 58 /**
 59  * struct peci_device - PECI device
 60  * @dev: device object to register PECI device to the device model
 61  * @info: PECI device characteristics
 62  * @info.x86_vfm: device vendor-family-model
 63  * @info.peci_revision: PECI revision supported by the PECI device
 64  * @info.socket_id: the socket ID represented by the PECI device
 65  * @addr: address used on the PECI bus connected to the parent controller
 66  * @deleted: indicates that PECI device was already deleted
 67  *
 68  * A peci_device identifies a single device (i.e. CPU) connected to a PECI bus.
 69  * The behaviour exposed to the rest of the system is defined by the PECI driver
 70  * managing the device.
 71  */
 72 struct peci_device {
 73         struct device dev;
 74         struct {
 75                 u32 x86_vfm;
 76                 u8 peci_revision;
 77                 u8 socket_id;
 78         } info;
 79         u8 addr;
 80         bool deleted;
 81 };
 82 
 83 static inline struct peci_device *to_peci_device(struct device *d)
 84 {
 85         return container_of(d, struct peci_device, dev);
 86 }
 87 
 88 /**
 89  * struct peci_request - PECI request
 90  * @device: PECI device to which the request is sent
 91  * @tx: TX buffer specific data
 92  * @tx.buf: TX buffer
 93  * @tx.len: transfer data length in bytes
 94  * @rx: RX buffer specific data
 95  * @rx.buf: RX buffer
 96  * @rx.len: received data length in bytes
 97  *
 98  * A peci_request represents a request issued by PECI originator (TX) and
 99  * a response received from PECI responder (RX).
100  */
101 struct peci_request {
102         struct peci_device *device;
103         struct {
104                 u8 buf[PECI_REQUEST_MAX_BUF_SIZE];
105                 u8 len;
106         } rx, tx;
107 };
108 
109 #endif /* __LINUX_PECI_H */
110 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php