/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1/*2* Copyright (C) 2021-2024 Advanced Micro Devices, Inc.3*/4#ifndef _AMD_APML_H_5#define _AMD_APML_H_67#include <linux/types.h>89/* Mailbox data size for data_in and data_out */10#define AMD_SBI_MB_DATA_SIZE 41112struct apml_mbox_msg {13/*14* Mailbox Message ID15*/16__u32 cmd;17/*18* [0]...[3] mailbox 32bit input/output data19*/20__u32 mb_in_out;21/*22* Error code is returned in case of soft mailbox error23*/24__u32 fw_ret_code;25};2627struct apml_cpuid_msg {28/*29* CPUID input30* [0]...[3] cpuid func,31* [4][5] cpuid: thread32* [6] cpuid: ext function & read eax/ebx or ecx/edx33* [7:0] -> bits [7:4] -> ext function &34* bit [0] read eax/ebx or ecx/edx35* CPUID output36*/37__u64 cpu_in_out;38/*39* Status code for CPUID read40*/41__u32 fw_ret_code;42__u32 pad;43};4445struct apml_mcamsr_msg {46/*47* MCAMSR input48* [0]...[3] mca msr func,49* [4][5] thread50* MCAMSR output51*/52__u64 mcamsr_in_out;53/*54* Status code for MCA/MSR access55*/56__u32 fw_ret_code;57__u32 pad;58};5960struct apml_reg_xfer_msg {61/*62* RMI register address offset63*/64__u16 reg_addr;65/*66* Register data for read/write67*/68__u8 data_in_out;69/*70* Register read or write71*/72__u8 rflag;73};7475/*76* AMD sideband interface base IOCTL77*/78#define SB_BASE_IOCTL_NR 0xF97980/**81* DOC: SBRMI_IOCTL_MBOX_CMD82*83* @Parameters84*85* @struct apml_mbox_msg86* Pointer to the &struct apml_mbox_msg that will contain the protocol87* information88*89* @Description90* IOCTL command for APML messages using generic _IOWR91* The IOCTL provides userspace access to AMD sideband mailbox protocol92* - Mailbox message read/write(0x0~0xFF)93* - returning "-EFAULT" if none of the above94* "-EPROTOTYPE" error is returned to provide additional error details95*/96#define SBRMI_IOCTL_MBOX_CMD _IOWR(SB_BASE_IOCTL_NR, 0, struct apml_mbox_msg)9798/**99* DOC: SBRMI_IOCTL_CPUID_CMD100*101* @Parameters102*103* @struct apml_cpuid_msg104* Pointer to the &struct apml_cpuid_msg that will contain the protocol105* information106*107* @Description108* IOCTL command for APML messages using generic _IOWR109* The IOCTL provides userspace access to AMD sideband cpuid protocol110* - CPUID protocol to get CPU details for Function/Ext Function111* at thread level112* - returning "-EFAULT" if none of the above113* "-EPROTOTYPE" error is returned to provide additional error details114*/115#define SBRMI_IOCTL_CPUID_CMD _IOWR(SB_BASE_IOCTL_NR, 1, struct apml_cpuid_msg)116117/**118* DOC: SBRMI_IOCTL_MCAMSR_CMD119*120* @Parameters121*122* @struct apml_mcamsr_msg123* Pointer to the &struct apml_mcamsr_msg that will contain the protocol124* information125*126* @Description127* IOCTL command for APML messages using generic _IOWR128* The IOCTL provides userspace access to AMD sideband MCAMSR protocol129* - MCAMSR protocol to get MCA bank details for Function at thread level130* - returning "-EFAULT" if none of the above131* "-EPROTOTYPE" error is returned to provide additional error details132*/133#define SBRMI_IOCTL_MCAMSR_CMD _IOWR(SB_BASE_IOCTL_NR, 2, struct apml_mcamsr_msg)134135/**136* DOC: SBRMI_IOCTL_REG_XFER_CMD137*138* @Parameters139*140* @struct apml_reg_xfer_msg141* Pointer to the &struct apml_reg_xfer_msg that will contain the protocol142* information143*144* @Description145* IOCTL command for APML messages using generic _IOWR146* The IOCTL provides userspace access to AMD sideband register xfer protocol147* - Register xfer protocol to get/set hardware register for given offset148*/149#define SBRMI_IOCTL_REG_XFER_CMD _IOWR(SB_BASE_IOCTL_NR, 3, struct apml_reg_xfer_msg)150151#endif /*_AMD_APML_H_*/152153154