linux/include/uapi/linux/isst_if.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
   2/*
   3 * Intel Speed Select Interface: OS to hardware Interface
   4 * Copyright (c) 2019, Intel Corporation.
   5 * All rights reserved.
   6 *
   7 * Author: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
   8 */
   9
  10#ifndef __ISST_IF_H
  11#define __ISST_IF_H
  12
  13#include <linux/types.h>
  14
  15/**
  16 * struct isst_if_platform_info - Define platform information
  17 * @api_version:        Version of the firmware document, which this driver
  18 *                      can communicate
  19 * @driver_version:     Driver version, which will help user to send right
  20 *                      commands. Even if the firmware is capable, driver may
  21 *                      not be ready
  22 * @max_cmds_per_ioctl: Returns the maximum number of commands driver will
  23 *                      accept in a single ioctl
  24 * @mbox_supported:     Support of mail box interface
  25 * @mmio_supported:     Support of mmio interface for core-power feature
  26 *
  27 * Used to return output of IOCTL ISST_IF_GET_PLATFORM_INFO. This
  28 * information can be used by the user space, to get the driver, firmware
  29 * support and also number of commands to send in a single IOCTL request.
  30 */
  31struct isst_if_platform_info {
  32        __u16 api_version;
  33        __u16 driver_version;
  34        __u16 max_cmds_per_ioctl;
  35        __u8 mbox_supported;
  36        __u8 mmio_supported;
  37};
  38
  39/**
  40 * struct isst_if_cpu_map - CPU mapping between logical and physical CPU
  41 * @logical_cpu:        Linux logical CPU number
  42 * @physical_cpu:       PUNIT CPU number
  43 *
  44 * Used to convert from Linux logical CPU to PUNIT CPU numbering scheme.
  45 * The PUNIT CPU number is different than APIC ID based CPU numbering.
  46 */
  47struct isst_if_cpu_map {
  48        __u32 logical_cpu;
  49        __u32 physical_cpu;
  50};
  51
  52/**
  53 * struct isst_if_cpu_maps - structure for CPU map IOCTL
  54 * @cmd_count:  Number of CPU mapping command in cpu_map[]
  55 * @cpu_map[]:  Holds one or more CPU map data structure
  56 *
  57 * This structure used with ioctl ISST_IF_GET_PHY_ID to send
  58 * one or more CPU mapping commands. Here IOCTL return value indicates
  59 * number of commands sent or error number if no commands have been sent.
  60 */
  61struct isst_if_cpu_maps {
  62        __u32 cmd_count;
  63        struct isst_if_cpu_map cpu_map[1];
  64};
  65
  66/**
  67 * struct isst_if_io_reg - Read write PUNIT IO register
  68 * @read_write:         Value 0: Read, 1: Write
  69 * @logical_cpu:        Logical CPU number to get target PCI device.
  70 * @reg:                PUNIT register offset
  71 * @value:              For write operation value to write and for
  72 *                      read placeholder read value
  73 *
  74 * Structure to specify read/write data to PUNIT registers.
  75 */
  76struct isst_if_io_reg {
  77        __u32 read_write; /* Read:0, Write:1 */
  78        __u32 logical_cpu;
  79        __u32 reg;
  80        __u32 value;
  81};
  82
  83/**
  84 * struct isst_if_io_regs - structure for IO register commands
  85 * @cmd_count:  Number of io reg commands in io_reg[]
  86 * @io_reg[]:   Holds one or more io_reg command structure
  87 *
  88 * This structure used with ioctl ISST_IF_IO_CMD to send
  89 * one or more read/write commands to PUNIT. Here IOCTL return value
  90 * indicates number of requests sent or error number if no requests have
  91 * been sent.
  92 */
  93struct isst_if_io_regs {
  94        __u32 req_count;
  95        struct isst_if_io_reg io_reg[1];
  96};
  97
  98/**
  99 * struct isst_if_mbox_cmd - Structure to define mail box command
 100 * @logical_cpu:        Logical CPU number to get target PCI device
 101 * @parameter:          Mailbox parameter value
 102 * @req_data:           Request data for the mailbox
 103 * @resp_data:          Response data for mailbox command response
 104 * @command:            Mailbox command value
 105 * @sub_command:        Mailbox sub command value
 106 * @reserved:           Unused, set to 0
 107 *
 108 * Structure to specify mailbox command to be sent to PUNIT.
 109 */
 110struct isst_if_mbox_cmd {
 111        __u32 logical_cpu;
 112        __u32 parameter;
 113        __u32 req_data;
 114        __u32 resp_data;
 115        __u16 command;
 116        __u16 sub_command;
 117        __u32 reserved;
 118};
 119
 120/**
 121 * struct isst_if_mbox_cmds - structure for mailbox commands
 122 * @cmd_count:  Number of mailbox commands in mbox_cmd[]
 123 * @mbox_cmd[]: Holds one or more mbox commands
 124 *
 125 * This structure used with ioctl ISST_IF_MBOX_COMMAND to send
 126 * one or more mailbox commands to PUNIT. Here IOCTL return value
 127 * indicates number of commands sent or error number if no commands have
 128 * been sent.
 129 */
 130struct isst_if_mbox_cmds {
 131        __u32 cmd_count;
 132        struct isst_if_mbox_cmd mbox_cmd[1];
 133};
 134
 135/**
 136 * struct isst_if_msr_cmd - Structure to define msr command
 137 * @read_write:         Value 0: Read, 1: Write
 138 * @logical_cpu:        Logical CPU number
 139 * @msr:                MSR number
 140 * @data:               For write operation, data to write, for read
 141 *                      place holder
 142 *
 143 * Structure to specify MSR command related to PUNIT.
 144 */
 145struct isst_if_msr_cmd {
 146        __u32 read_write; /* Read:0, Write:1 */
 147        __u32 logical_cpu;
 148        __u64 msr;
 149        __u64 data;
 150};
 151
 152/**
 153 * struct isst_if_msr_cmds - structure for msr commands
 154 * @cmd_count:  Number of mailbox commands in msr_cmd[]
 155 * @msr_cmd[]:  Holds one or more msr commands
 156 *
 157 * This structure used with ioctl ISST_IF_MSR_COMMAND to send
 158 * one or more MSR commands. IOCTL return value indicates number of
 159 * commands sent or error number if no commands have been sent.
 160 */
 161struct isst_if_msr_cmds {
 162        __u32 cmd_count;
 163        struct isst_if_msr_cmd msr_cmd[1];
 164};
 165
 166#define ISST_IF_MAGIC                   0xFE
 167#define ISST_IF_GET_PLATFORM_INFO       _IOR(ISST_IF_MAGIC, 0, struct isst_if_platform_info *)
 168#define ISST_IF_GET_PHY_ID              _IOWR(ISST_IF_MAGIC, 1, struct isst_if_cpu_map *)
 169#define ISST_IF_IO_CMD          _IOW(ISST_IF_MAGIC, 2, struct isst_if_io_regs *)
 170#define ISST_IF_MBOX_COMMAND    _IOWR(ISST_IF_MAGIC, 3, struct isst_if_mbox_cmds *)
 171#define ISST_IF_MSR_COMMAND     _IOWR(ISST_IF_MAGIC, 4, struct isst_if_msr_cmds *)
 172#endif
 173