1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Copyright (C) 2021-2024 Advanced Micro Devices, Inc.
*/
#ifndef _AMD_APML_H_
#define _AMD_APML_H_
#include <linux/types.h>
/* Mailbox data size for data_in and data_out */
#define AMD_SBI_MB_DATA_SIZE 4
struct apml_mbox_msg {
/*
* Mailbox Message ID
*/
__u32 cmd;
/*
* [0]...[3] mailbox 32bit input/output data
*/
__u32 mb_in_out;
/*
* Error code is returned in case of soft mailbox error
*/
__u32 fw_ret_code;
};
struct apml_cpuid_msg {
/*
* CPUID input
* [0]...[3] cpuid func,
* [4][5] cpuid: thread
* [6] cpuid: ext function & read eax/ebx or ecx/edx
* [7:0] -> bits [7:4] -> ext function &
* bit [0] read eax/ebx or ecx/edx
* CPUID output
*/
__u64 cpu_in_out;
/*
* Status code for CPUID read
*/
__u32 fw_ret_code;
__u32 pad;
};
struct apml_mcamsr_msg {
/*
* MCAMSR input
* [0]...[3] mca msr func,
* [4][5] thread
* MCAMSR output
*/
__u64 mcamsr_in_out;
/*
* Status code for MCA/MSR access
*/
__u32 fw_ret_code;
__u32 pad;
};
struct apml_reg_xfer_msg {
/*
* RMI register address offset
*/
__u16 reg_addr;
/*
* Register data for read/write
*/
__u8 data_in_out;
/*
* Register read or write
*/
__u8 rflag;
};
/*
* AMD sideband interface base IOCTL
*/
#define SB_BASE_IOCTL_NR 0xF9
/**
* DOC: SBRMI_IOCTL_MBOX_CMD
*
* @Parameters
*
* @struct apml_mbox_msg
* Pointer to the &struct apml_mbox_msg that will contain the protocol
* information
*
* @Description
* IOCTL command for APML messages using generic _IOWR
* The IOCTL provides userspace access to AMD sideband mailbox protocol
* - Mailbox message read/write(0x0~0xFF)
* - returning "-EFAULT" if none of the above
* "-EPROTOTYPE" error is returned to provide additional error details
*/
#define SBRMI_IOCTL_MBOX_CMD _IOWR(SB_BASE_IOCTL_NR, 0, struct apml_mbox_msg)
/**
* DOC: SBRMI_IOCTL_CPUID_CMD
*
* @Parameters
*
* @struct apml_cpuid_msg
* Pointer to the &struct apml_cpuid_msg that will contain the protocol
* information
*
* @Description
* IOCTL command for APML messages using generic _IOWR
* The IOCTL provides userspace access to AMD sideband cpuid protocol
* - CPUID protocol to get CPU details for Function/Ext Function
* at thread level
* - returning "-EFAULT" if none of the above
* "-EPROTOTYPE" error is returned to provide additional error details
*/
#define SBRMI_IOCTL_CPUID_CMD _IOWR(SB_BASE_IOCTL_NR, 1, struct apml_cpuid_msg)
/**
* DOC: SBRMI_IOCTL_MCAMSR_CMD
*
* @Parameters
*
* @struct apml_mcamsr_msg
* Pointer to the &struct apml_mcamsr_msg that will contain the protocol
* information
*
* @Description
* IOCTL command for APML messages using generic _IOWR
* The IOCTL provides userspace access to AMD sideband MCAMSR protocol
* - MCAMSR protocol to get MCA bank details for Function at thread level
* - returning "-EFAULT" if none of the above
* "-EPROTOTYPE" error is returned to provide additional error details
*/
#define SBRMI_IOCTL_MCAMSR_CMD _IOWR(SB_BASE_IOCTL_NR, 2, struct apml_mcamsr_msg)
/**
* DOC: SBRMI_IOCTL_REG_XFER_CMD
*
* @Parameters
*
* @struct apml_reg_xfer_msg
* Pointer to the &struct apml_reg_xfer_msg that will contain the protocol
* information
*
* @Description
* IOCTL command for APML messages using generic _IOWR
* The IOCTL provides userspace access to AMD sideband register xfer protocol
* - Register xfer protocol to get/set hardware register for given offset
*/
#define SBRMI_IOCTL_REG_XFER_CMD _IOWR(SB_BASE_IOCTL_NR, 3, struct apml_reg_xfer_msg)
#endif /*_AMD_APML_H_*/
|