Commit 68be222f authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'tegra-for-5.9-firmware' of...

Merge tag 'tegra-for-5.9-firmware' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers

firmware: tegra: Changes for v5.9-rc1

This has a few cleanups and the addition of a new mechanism to query
debug information from the BPMP.

* tag 'tegra-for-5.9-firmware' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  firmware: tegra: Update BPMP ABI
  firmware: tegra: Add support for in-band debug
  firmware: tegra: Prepare for supporting in-band debugfs
  firmware: tegra: Use consistent return variable name
  firmware: tegra: Add return code checks and increase debugfs size

Link: https://lore.kernel.org/r/20200717161300.1661002-2-thierry.reding@gmail.comSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents a0edee63 4e871899
......@@ -4,11 +4,14 @@
*/
#include <linux/debugfs.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <soc/tegra/bpmp.h>
#include <soc/tegra/bpmp-abi.h>
static DEFINE_MUTEX(bpmp_debug_lock);
struct seqbuf {
char *buf;
size_t pos;
......@@ -96,6 +99,354 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
return filename;
}
static int mrq_debug_open(struct tegra_bpmp *bpmp, const char *name,
uint32_t *fd, uint32_t *len, bool write)
{
struct mrq_debug_request req = {
.cmd = cpu_to_le32(write ? CMD_DEBUG_OPEN_WO : CMD_DEBUG_OPEN_RO),
};
struct mrq_debug_response resp;
struct tegra_bpmp_message msg = {
.mrq = MRQ_DEBUG,
.tx = {
.data = &req,
.size = sizeof(req),
},
.rx = {
.data = &resp,
.size = sizeof(resp),
},
};
ssize_t sz_name;
int err = 0;
sz_name = strscpy(req.fop.name, name, sizeof(req.fop.name));
if (sz_name < 0) {
pr_err("File name too large: %s\n", name);
return -EINVAL;
}
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0)
return err;
else if (msg.rx.ret < 0)
return -EINVAL;
*len = resp.fop.datalen;
*fd = resp.fop.fd;
return 0;
}
static int mrq_debug_close(struct tegra_bpmp *bpmp, uint32_t fd)
{
struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_CLOSE),
.frd = {
.fd = fd,
},
};
struct mrq_debug_response resp;
struct tegra_bpmp_message msg = {
.mrq = MRQ_DEBUG,
.tx = {
.data = &req,
.size = sizeof(req),
},
.rx = {
.data = &resp,
.size = sizeof(resp),
},
};
int err = 0;
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0)
return err;
else if (msg.rx.ret < 0)
return -EINVAL;
return 0;
}
static int mrq_debug_read(struct tegra_bpmp *bpmp, const char *name,
char *data, size_t sz_data, uint32_t *nbytes)
{
struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_READ),
};
struct mrq_debug_response resp;
struct tegra_bpmp_message msg = {
.mrq = MRQ_DEBUG,
.tx = {
.data = &req,
.size = sizeof(req),
},
.rx = {
.data = &resp,
.size = sizeof(resp),
},
};
uint32_t fd = 0, len = 0;
int remaining, err;
mutex_lock(&bpmp_debug_lock);
err = mrq_debug_open(bpmp, name, &fd, &len, 0);
if (err)
goto out;
if (len > sz_data) {
err = -EFBIG;
goto close;
}
req.frd.fd = fd;
remaining = len;
while (remaining > 0) {
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0) {
goto close;
} else if (msg.rx.ret < 0) {
err = -EINVAL;
goto close;
}
if (resp.frd.readlen > remaining) {
pr_err("%s: read data length invalid\n", __func__);
err = -EINVAL;
goto close;
}
memcpy(data, resp.frd.data, resp.frd.readlen);
data += resp.frd.readlen;
remaining -= resp.frd.readlen;
}
*nbytes = len;
close:
err = mrq_debug_close(bpmp, fd);
out:
mutex_unlock(&bpmp_debug_lock);
return err;
}
static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
uint8_t *data, size_t sz_data)
{
struct mrq_debug_request req = {
.cmd = cpu_to_le32(CMD_DEBUG_WRITE)
};
struct mrq_debug_response resp;
struct tegra_bpmp_message msg = {
.mrq = MRQ_DEBUG,
.tx = {
.data = &req,
.size = sizeof(req),
},
.rx = {
.data = &resp,
.size = sizeof(resp),
},
};
uint32_t fd = 0, len = 0;
size_t remaining;
int err;
mutex_lock(&bpmp_debug_lock);
err = mrq_debug_open(bpmp, name, &fd, &len, 1);
if (err)
goto out;
if (sz_data > len) {
err = -EINVAL;
goto close;
}
req.fwr.fd = fd;
remaining = sz_data;
while (remaining > 0) {
len = min(remaining, sizeof(req.fwr.data));
memcpy(req.fwr.data, data, len);
req.fwr.datalen = len;
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0) {
goto close;
} else if (msg.rx.ret < 0) {
err = -EINVAL;
goto close;
}
data += req.fwr.datalen;
remaining -= req.fwr.datalen;
}
close:
err = mrq_debug_close(bpmp, fd);
out:
mutex_unlock(&bpmp_debug_lock);
return err;
}
static int bpmp_debug_show(struct seq_file *m, void *p)
{
struct file *file = m->private;
struct inode *inode = file_inode(file);
struct tegra_bpmp *bpmp = inode->i_private;
char *databuf = NULL;
char fnamebuf[256];
const char *filename;
uint32_t nbytes = 0;
size_t len;
int err;
len = seq_get_buf(m, &databuf);
if (!databuf)
return -ENOMEM;
filename = get_filename(bpmp, file, fnamebuf, sizeof(fnamebuf));
if (!filename)
return -ENOENT;
err = mrq_debug_read(bpmp, filename, databuf, len, &nbytes);
if (!err)
seq_commit(m, nbytes);
return err;
}
static ssize_t bpmp_debug_store(struct file *file, const char __user *buf,
size_t count, loff_t *f_pos)
{
struct inode *inode = file_inode(file);
struct tegra_bpmp *bpmp = inode->i_private;
char *databuf = NULL;
char fnamebuf[256];
const char *filename;
ssize_t err;
filename = get_filename(bpmp, file, fnamebuf, sizeof(fnamebuf));
if (!filename)
return -ENOENT;
databuf = kmalloc(count, GFP_KERNEL);
if (!databuf)
return -ENOMEM;
if (copy_from_user(databuf, buf, count)) {
err = -EFAULT;
goto free_ret;
}
err = mrq_debug_write(bpmp, filename, databuf, count);
free_ret:
kfree(databuf);
return err ?: count;
}
static int bpmp_debug_open(struct inode *inode, struct file *file)
{
return single_open_size(file, bpmp_debug_show, file, SZ_256K);
}
static const struct file_operations bpmp_debug_fops = {
.open = bpmp_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.write = bpmp_debug_store,
.release = single_release,
};
static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp,
struct dentry *parent,
char *ppath)
{
const size_t pathlen = SZ_256;
const size_t bufsize = SZ_16K;
uint32_t dsize, attrs = 0;
struct dentry *dentry;
struct seqbuf seqbuf;
char *buf, *pathbuf;
const char *name;
int err = 0;
if (!bpmp || !parent || !ppath)
return -EINVAL;
buf = kmalloc(bufsize, GFP_KERNEL);
if (!buf)
return -ENOMEM;
pathbuf = kzalloc(pathlen, GFP_KERNEL);
if (!pathbuf) {
kfree(buf);
return -ENOMEM;
}
err = mrq_debug_read(bpmp, ppath, buf, bufsize, &dsize);
if (err)
goto out;
seqbuf_init(&seqbuf, buf, dsize);
while (!seqbuf_eof(&seqbuf)) {
err = seqbuf_read_u32(&seqbuf, &attrs);
if (err)
goto out;
err = seqbuf_read_str(&seqbuf, &name);
if (err < 0)
goto out;
if (attrs & DEBUGFS_S_ISDIR) {
size_t len;
dentry = debugfs_create_dir(name, parent);
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
goto out;
}
len = strlen(ppath) + strlen(name) + 1;
if (len >= pathlen) {
err = -EINVAL;
goto out;
}
strncpy(pathbuf, ppath, pathlen);
strncat(pathbuf, name, strlen(name));
strcat(pathbuf, "/");
err = bpmp_populate_debugfs_inband(bpmp, dentry,
pathbuf);
if (err < 0)
goto out;
} else {
umode_t mode;
mode = attrs & DEBUGFS_S_IRUSR ? 0400 : 0;
mode |= attrs & DEBUGFS_S_IWUSR ? 0200 : 0;
dentry = debugfs_create_file(name, mode, parent, bpmp,
&bpmp_debug_fops);
if (!dentry) {
err = -ENOMEM;
goto out;
}
}
}
out:
kfree(pathbuf);
kfree(buf);
return err;
}
static int mrq_debugfs_read(struct tegra_bpmp *bpmp,
dma_addr_t name, size_t sz_name,
dma_addr_t data, size_t sz_data,
......@@ -127,6 +478,8 @@ static int mrq_debugfs_read(struct tegra_bpmp *bpmp,
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0)
return err;
else if (msg.rx.ret < 0)
return -EINVAL;
*nbytes = (size_t)resp.fop.nbytes;
......@@ -184,6 +537,8 @@ static int mrq_debugfs_dumpdir(struct tegra_bpmp *bpmp, dma_addr_t addr,
err = tegra_bpmp_transfer(bpmp, &msg);
if (err < 0)
return err;
else if (msg.rx.ret < 0)
return -EINVAL;
*nbytes = (size_t)resp.dumpdir.nbytes;
......@@ -202,7 +557,7 @@ static int debugfs_show(struct seq_file *m, void *p)
char buf[256];
const char *filename;
size_t len, nbytes;
int ret;
int err;
filename = get_filename(bpmp, file, buf, sizeof(buf));
if (!filename)
......@@ -216,24 +571,24 @@ static int debugfs_show(struct seq_file *m, void *p)
datavirt = dma_alloc_coherent(bpmp->dev, datasize, &dataphys,
GFP_KERNEL | GFP_DMA32);
if (!datavirt) {
ret = -ENOMEM;
err = -ENOMEM;
goto free_namebuf;
}
len = strlen(filename);
strncpy(namevirt, filename, namesize);
ret = mrq_debugfs_read(bpmp, namephys, len, dataphys, datasize,
err = mrq_debugfs_read(bpmp, namephys, len, dataphys, datasize,
&nbytes);
if (!ret)
if (!err)
seq_write(m, datavirt, nbytes);
dma_free_coherent(bpmp->dev, datasize, datavirt, dataphys);
free_namebuf:
dma_free_coherent(bpmp->dev, namesize, namevirt, namephys);
return ret;
return err;
}
static int debugfs_open(struct inode *inode, struct file *file)
......@@ -253,7 +608,7 @@ static ssize_t debugfs_store(struct file *file, const char __user *buf,
char fnamebuf[256];
const char *filename;
size_t len;
int ret;
int err;
filename = get_filename(bpmp, file, fnamebuf, sizeof(fnamebuf));
if (!filename)
......@@ -267,7 +622,7 @@ static ssize_t debugfs_store(struct file *file, const char __user *buf,
datavirt = dma_alloc_coherent(bpmp->dev, datasize, &dataphys,
GFP_KERNEL | GFP_DMA32);
if (!datavirt) {
ret = -ENOMEM;
err = -ENOMEM;
goto free_namebuf;
}
......@@ -275,11 +630,11 @@ static ssize_t debugfs_store(struct file *file, const char __user *buf,
strncpy(namevirt, filename, namesize);
if (copy_from_user(datavirt, buf, count)) {
ret = -EFAULT;
err = -EFAULT;
goto free_databuf;
}
ret = mrq_debugfs_write(bpmp, namephys, len, dataphys,
err = mrq_debugfs_write(bpmp, namephys, len, dataphys,
count);
free_databuf:
......@@ -287,7 +642,7 @@ static ssize_t debugfs_store(struct file *file, const char __user *buf,
free_namebuf:
dma_free_coherent(bpmp->dev, namesize, namevirt, namephys);
return ret ?: count;
return err ?: count;
}
static const struct file_operations debugfs_fops = {
......@@ -350,59 +705,66 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf,
return 0;
}
static int create_debugfs_mirror(struct tegra_bpmp *bpmp, void *buf,
size_t bufsize, struct dentry *root)
static int bpmp_populate_debugfs_shmem(struct tegra_bpmp *bpmp)
{
struct seqbuf seqbuf;
const size_t sz = SZ_512K;
dma_addr_t phys;
size_t nbytes;
void *virt;
int err;
bpmp->debugfs_mirror = debugfs_create_dir("debug", root);
if (!bpmp->debugfs_mirror)
virt = dma_alloc_coherent(bpmp->dev, sz, &phys,
GFP_KERNEL | GFP_DMA32);
if (!virt)
return -ENOMEM;
seqbuf_init(&seqbuf, buf, bufsize);
err = bpmp_populate_dir(bpmp, &seqbuf, bpmp->debugfs_mirror, 0);
err = mrq_debugfs_dumpdir(bpmp, phys, sz, &nbytes);
if (err < 0) {
debugfs_remove_recursive(bpmp->debugfs_mirror);
bpmp->debugfs_mirror = NULL;
goto free;
} else if (nbytes > sz) {
err = -EINVAL;
goto free;
}
seqbuf_init(&seqbuf, virt, nbytes);
err = bpmp_populate_dir(bpmp, &seqbuf, bpmp->debugfs_mirror, 0);
free:
dma_free_coherent(bpmp->dev, sz, virt, phys);
return err;
}
int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp)
{
dma_addr_t phys;
void *virt;
const size_t sz = SZ_256K;
size_t nbytes;
int ret;
struct dentry *root;
bool inband;
int err;
inband = tegra_bpmp_mrq_is_supported(bpmp, MRQ_DEBUG);
if (!tegra_bpmp_mrq_is_supported(bpmp, MRQ_DEBUGFS))
if (!inband && !tegra_bpmp_mrq_is_supported(bpmp, MRQ_DEBUGFS))
return 0;
root = debugfs_create_dir("bpmp", NULL);
if (!root)
return -ENOMEM;
virt = dma_alloc_coherent(bpmp->dev, sz, &phys,
GFP_KERNEL | GFP_DMA32);
if (!virt) {
ret = -ENOMEM;
bpmp->debugfs_mirror = debugfs_create_dir("debug", root);
if (!bpmp->debugfs_mirror) {
err = -ENOMEM;
goto out;
}
ret = mrq_debugfs_dumpdir(bpmp, phys, sz, &nbytes);
if (ret < 0)
goto free;
if (inband)
err = bpmp_populate_debugfs_inband(bpmp, bpmp->debugfs_mirror,
"/");
else
err = bpmp_populate_debugfs_shmem(bpmp);
ret = create_debugfs_mirror(bpmp, virt, nbytes, root);
free:
dma_free_coherent(bpmp->dev, sz, virt, phys);
out:
if (ret < 0)
debugfs_remove(root);
if (err < 0)
debugfs_remove_recursive(root);
return ret;
return err;
}
......@@ -515,10 +515,10 @@ bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq)
.size = sizeof(resp),
},
};
int ret;
int err;
ret = tegra_bpmp_transfer(bpmp, &msg);
if (ret || msg.rx.ret)
err = tegra_bpmp_transfer(bpmp, &msg);
if (err || msg.rx.ret)
return false;
return resp.status == 0;
......
......@@ -3,28 +3,38 @@
* Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
*/
#ifndef _ABI_BPMP_ABI_H_
#define _ABI_BPMP_ABI_H_
#ifndef ABI_BPMP_ABI_H
#define ABI_BPMP_ABI_H
#ifdef LK
#if defined(LK) || defined(BPMP_ABI_HAVE_STDC)
#include <stddef.h>
#include <stdint.h>
#endif
#ifndef __ABI_PACKED
#define __ABI_PACKED __attribute__((packed))
#ifndef BPMP_ABI_PACKED
#ifdef __ABI_PACKED
#define BPMP_ABI_PACKED __ABI_PACKED
#else
#define BPMP_ABI_PACKED __attribute__((packed))
#endif
#endif
#ifdef NO_GCC_EXTENSIONS
#define EMPTY char empty;
#define EMPTY_ARRAY 1
#define BPMP_ABI_EMPTY char empty;
#define BPMP_ABI_EMPTY_ARRAY 1
#else
#define EMPTY
#define EMPTY_ARRAY 0
#define BPMP_ABI_EMPTY
#define BPMP_ABI_EMPTY_ARRAY 0
#endif
#ifndef __UNION_ANON
#define __UNION_ANON
#ifndef BPMP_UNION_ANON
#ifdef __UNION_ANON
#define BPMP_UNION_ANON __UNION_ANON
#else
#define BPMP_UNION_ANON
#endif
#endif
/**
* @file
*/
......@@ -73,6 +83,7 @@
struct mrq_request {
/** @brief MRQ number of the request */
uint32_t mrq;
/**
* @brief Flags providing follow up directions to the receiver
*
......@@ -82,7 +93,7 @@ struct mrq_request {
* | 0 | should be 1 |
*/
uint32_t flags;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Format
......@@ -98,18 +109,18 @@ struct mrq_response {
int32_t err;
/** @brief Reserved for future use */
uint32_t flags;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Format
* Minimum needed size for an IPC message buffer
*/
#define MSG_MIN_SZ 128
#define MSG_MIN_SZ 128U
/**
* @ingroup MRQ_Format
* Minimum size guaranteed for data in an IPC message buffer
*/
#define MSG_DATA_MIN_SZ 120
#define MSG_DATA_MIN_SZ 120U
/**
* @ingroup MRQ_Codes
......@@ -118,36 +129,36 @@ struct mrq_response {
* @{
*/
#define MRQ_PING 0
#define MRQ_QUERY_TAG 1
#define MRQ_MODULE_LOAD 4
#define MRQ_MODULE_UNLOAD 5
#define MRQ_TRACE_MODIFY 7
#define MRQ_WRITE_TRACE 8
#define MRQ_THREADED_PING 9
#define MRQ_MODULE_MAIL 11
#define MRQ_DEBUGFS 19
#define MRQ_RESET 20
#define MRQ_I2C 21
#define MRQ_CLK 22
#define MRQ_QUERY_ABI 23
#define MRQ_PG_READ_STATE 25
#define MRQ_PG_UPDATE_STATE 26
#define MRQ_THERMAL 27
#define MRQ_CPU_VHINT 28
#define MRQ_ABI_RATCHET 29
#define MRQ_EMC_DVFS_LATENCY 31
#define MRQ_TRACE_ITER 64
#define MRQ_RINGBUF_CONSOLE 65
#define MRQ_PG 66
#define MRQ_CPU_NDIV_LIMITS 67
#define MRQ_STRAP 68
#define MRQ_UPHY 69
#define MRQ_CPU_AUTO_CC3 70
#define MRQ_QUERY_FW_TAG 71
#define MRQ_FMON 72
#define MRQ_EC 73
#define MRQ_FBVOLT_STATUS 74
#define MRQ_PING 0U
#define MRQ_QUERY_TAG 1U
#define MRQ_MODULE_LOAD 4U
#define MRQ_MODULE_UNLOAD 5U
#define MRQ_TRACE_MODIFY 7U
#define MRQ_WRITE_TRACE 8U
#define MRQ_THREADED_PING 9U
#define MRQ_MODULE_MAIL 11U
#define MRQ_DEBUGFS 19U
#define MRQ_RESET 20U
#define MRQ_I2C 21U
#define MRQ_CLK 22U
#define MRQ_QUERY_ABI 23U
#define MRQ_PG_READ_STATE 25U
#define MRQ_PG_UPDATE_STATE 26U
#define MRQ_THERMAL 27U
#define MRQ_CPU_VHINT 28U
#define MRQ_ABI_RATCHET 29U
#define MRQ_EMC_DVFS_LATENCY 31U
#define MRQ_TRACE_ITER 64U
#define MRQ_RINGBUF_CONSOLE 65U
#define MRQ_PG 66U
#define MRQ_CPU_NDIV_LIMITS 67U
#define MRQ_STRAP 68U
#define MRQ_UPHY 69U
#define MRQ_CPU_AUTO_CC3 70U
#define MRQ_QUERY_FW_TAG 71U
#define MRQ_FMON 72U
#define MRQ_EC 73U
#define MRQ_DEBUG 75U
/** @} */
......@@ -156,7 +167,7 @@ struct mrq_response {
* @brief Maximum MRQ code to be sent by CPU software to
* BPMP. Subject to change in future
*/
#define MAX_CPU_MRQ_ID 74
#define MAX_CPU_MRQ_ID 75U
/**
* @addtogroup MRQ_Payloads
......@@ -223,7 +234,7 @@ struct mrq_response {
struct mrq_ping_request {
/** @brief Arbitrarily chosen value */
uint32_t challenge;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Ping
......@@ -237,7 +248,7 @@ struct mrq_ping_request {
struct mrq_ping_response {
/** @brief Response to the MRQ_PING challege */
uint32_t reply;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
......@@ -264,7 +275,7 @@ struct mrq_ping_response {
struct mrq_query_tag_request {
/** @brief Base address to store the firmware tag */
uint32_t addr;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
......@@ -291,15 +302,15 @@ struct mrq_query_tag_request {
struct mrq_query_fw_tag_response {
/** @brief Array to store tag information */
uint8_t tag[32];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
* @def MRQ_MODULE_LOAD
* @brief Dynamically load a BPMP code module
*
* * Platforms: T210, T214, T186
* @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
* * Platforms: T210, T210B01, T186
* @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
* * Initiators: CCPLEX
* * Targets: BPMP
* * Request Payload: @ref mrq_module_load_request
......@@ -327,11 +338,11 @@ struct mrq_query_fw_tag_response {
*
*/
struct mrq_module_load_request {
/** @brief Base address of the code to load. Treated as (void *) */
uint32_t phys_addr; /* (void *) */
/** @brief Base address of the code to load */
uint32_t phys_addr;
/** @brief Size in bytes of code to load */
uint32_t size;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Module
......@@ -342,7 +353,7 @@ struct mrq_module_load_request {
struct mrq_module_load_response {
/** @brief Handle to the loaded module */
uint32_t base;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond*/
/**
......@@ -350,8 +361,8 @@ struct mrq_module_load_response {
* @def MRQ_MODULE_UNLOAD
* @brief Unload a previously loaded code module
*
* * Platforms: T210, T214, T186
* @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
* * Platforms: T210, T210B01, T186
* @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
* * Initiators: CCPLEX
* * Targets: BPMP
* * Request Payload: @ref mrq_module_unload_request
......@@ -370,7 +381,7 @@ struct mrq_module_load_response {
struct mrq_module_unload_request {
/** @brief Handle of the module to unload */
uint32_t base;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond*/
/**
......@@ -378,6 +389,8 @@ struct mrq_module_unload_request {
* @def MRQ_TRACE_MODIFY
* @brief Modify the set of enabled trace events
*
* @deprecated
*
* * Platforms: All
* * Initiators: CCPLEX
* * Targets: BPMP
......@@ -400,7 +413,7 @@ struct mrq_trace_modify_request {
uint32_t clr;
/** @brief Bit mask of trace events to enable */
uint32_t set;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Trace
......@@ -414,13 +427,15 @@ struct mrq_trace_modify_request {
struct mrq_trace_modify_response {
/** @brief Bit mask of trace event enable states */
uint32_t mask;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
* @def MRQ_WRITE_TRACE
* @brief Write trace data to a buffer
*
* @deprecated
*
* * Platforms: All
* * Initiators: CCPLEX
* * Targets: BPMP
......@@ -454,7 +469,7 @@ struct mrq_write_trace_request {
uint32_t area;
/** @brief Size in bytes of the output buffer */
uint32_t size;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Trace
......@@ -471,25 +486,25 @@ struct mrq_write_trace_response {
* drained to the outputbuffer. Value is 0 otherwise.
*/
uint32_t eof;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct mrq_threaded_ping_request {
uint32_t challenge;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct mrq_threaded_ping_response {
uint32_t reply;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
* @def MRQ_MODULE_MAIL
* @brief Send a message to a loadable module
*
* * Platforms: T210, T214, T186
* @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
* * Platforms: T210, T210B01, T186
* @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
* * Initiators: Any
* * Targets: BPMP
* * Request Payload: @ref mrq_module_mail_request
......@@ -510,8 +525,8 @@ struct mrq_module_mail_request {
* The length of data[ ] is unknown to the BPMP core firmware
* but it is limited to the size of an IPC message.
*/
uint8_t data[EMPTY_ARRAY];
} __ABI_PACKED;
uint8_t data[BPMP_ABI_EMPTY_ARRAY];
} BPMP_ABI_PACKED;
/**
* @ingroup Module
......@@ -523,8 +538,8 @@ struct mrq_module_mail_response {
* The length of data[ ] is unknown to the BPMP core firmware
* but it is limited to the size of an IPC message.
*/
uint8_t data[EMPTY_ARRAY];
} __ABI_PACKED;
uint8_t data[BPMP_ABI_EMPTY_ARRAY];
} BPMP_ABI_PACKED;
/** @endcond */
/**
......@@ -532,6 +547,8 @@ struct mrq_module_mail_response {
* @def MRQ_DEBUGFS
* @brief Interact with BPMP's debugfs file nodes
*
* @deprecated use MRQ_DEBUG instead.
*
* * Platforms: T186, T194
* * Initiators: Any
* * Targets: BPMP
......@@ -587,7 +604,7 @@ struct cmd_debugfs_fileop_request {
uint32_t dataaddr;
/** @brief Length in bytes of data buffer */
uint32_t datalen;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
......@@ -598,7 +615,7 @@ struct cmd_debugfs_dumpdir_request {
uint32_t dataaddr;
/** @brief Length in bytes of data buffer */
uint32_t datalen;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
......@@ -609,7 +626,7 @@ struct cmd_debugfs_fileop_response {
uint32_t reserved;
/** @brief Number of bytes read from or written to data buffer */
uint32_t nbytes;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
......@@ -620,7 +637,7 @@ struct cmd_debugfs_dumpdir_response {
uint32_t reserved;
/** @brief Number of bytes read from or written to data buffer */
uint32_t nbytes;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
......@@ -643,8 +660,8 @@ struct mrq_debugfs_request {
union {
struct cmd_debugfs_fileop_request fop;
struct cmd_debugfs_dumpdir_request dumpdir;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
......@@ -659,8 +676,8 @@ struct mrq_debugfs_response {
struct cmd_debugfs_fileop_response fop;
/** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
struct cmd_debugfs_dumpdir_response dumpdir;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @addtogroup Debugfs
......@@ -671,6 +688,190 @@ struct mrq_debugfs_response {
#define DEBUGFS_S_IWUSR (1 << 7)
/** @} */
/**
* @ingroup MRQ_Codes
* @def MRQ_DEBUG
* @brief Interact with BPMP's debugfs file nodes. Use message payload
* for exchanging data. This is functionally equivalent to
* @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.
* When software running on CPU tries to read a debugfs file,
* the file path and read data will be stored in message payload.
* Since the message payload size is limited, a debugfs file
* transaction might require multiple frames of data exchanged
* between BPMP and CPU until the transaction completes.
*
* * Platforms: T194
* * Initiators: Any
* * Targets: BPMP
* * Request Payload: @ref mrq_debug_request
* * Response Payload: @ref mrq_debug_response
*/
/** @ingroup Debugfs */
enum mrq_debug_commands {
/** @brief Open required file for read operation */
CMD_DEBUG_OPEN_RO = 0,
/** @brief Open required file for write operation */
CMD_DEBUG_OPEN_WO = 1,
/** @brief Perform read */
CMD_DEBUG_READ = 2,
/** @brief Perform write */
CMD_DEBUG_WRITE = 3,
/** @brief Close file */
CMD_DEBUG_CLOSE = 4,
/** @brief Not a command */
CMD_DEBUG_MAX
};
/**
* @ingroup Debugfs
* @brief Maximum number of files that can be open at a given time
*/
#define DEBUG_MAX_OPEN_FILES 1
/**
* @ingroup Debugfs
* @brief Maximum size of null-terminated file name string in bytes.
* Value is derived from memory available in message payload while
* using @ref cmd_debug_fopen_request
* Value 4 corresponds to size of @ref mrq_debug_commands
* in @ref mrq_debug_request.
* 120 - 4 dbg_cmd(32bit) = 116
*/
#define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4)
/**
* @ingroup Debugfs
* @brief Parameters for CMD_DEBUG_OPEN command
*/
struct cmd_debug_fopen_request {
/** @brief File name - Null-terminated string with maximum
* length @ref DEBUG_FNAME_MAX_SZ
*/
char name[DEBUG_FNAME_MAX_SZ];
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Response data for CMD_DEBUG_OPEN_RO/WO command
*/
struct cmd_debug_fopen_response {
/** @brief Identifier for file access */
uint32_t fd;
/** @brief Data length. File data size for READ command.
* Maximum allowed length for WRITE command
*/
uint32_t datalen;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Parameters for CMD_DEBUG_READ command
*/
struct cmd_debug_fread_request {
/** @brief File access identifier received in response
* to CMD_DEBUG_OPEN_RO request
*/
uint32_t fd;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Maximum size of read data in bytes.
* Value is derived from memory available in message payload while
* using @ref cmd_debug_fread_response.
*/
#define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4)
/**
* @ingroup Debugfs
* @brief Response data for CMD_DEBUG_READ command
*/
struct cmd_debug_fread_response {
/** @brief Size of data provided in this response in bytes */
uint32_t readlen;
/** @brief File data from seek position */
char data[DEBUG_READ_MAX_SZ];
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Maximum size of write data in bytes.
* Value is derived from memory available in message payload while
* using @ref cmd_debug_fwrite_request.
*/
#define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12)
/**
* @ingroup Debugfs
* @brief Parameters for CMD_DEBUG_WRITE command
*/
struct cmd_debug_fwrite_request {
/** @brief File access identifier received in response
* to CMD_DEBUG_OPEN_RO request
*/
uint32_t fd;
/** @brief Size of write data in bytes */
uint32_t datalen;
/** @brief Data to be written */
char data[DEBUG_WRITE_MAX_SZ];
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Parameters for CMD_DEBUG_CLOSE command
*/
struct cmd_debug_fclose_request {
/** @brief File access identifier received in response
* to CMD_DEBUG_OPEN_RO request
*/
uint32_t fd;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
* @brief Request with #MRQ_DEBUG.
*
* The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
* command to execute. Legal commands are the values of @ref
* mrq_debug_commands. Each command requires a specific additional
* payload of data.
*
* |command |payload|
* |-------------------|-------|
* |CMD_DEBUG_OPEN_RO |fop |
* |CMD_DEBUG_OPEN_WO |fop |
* |CMD_DEBUG_READ |frd |
* |CMD_DEBUG_WRITE |fwr |
* |CMD_DEBUG_CLOSE |fcl |
*/
struct mrq_debug_request {
/** @brief Sub-command (@ref mrq_debug_commands) */
uint32_t cmd;
union {
/** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */
struct cmd_debug_fopen_request fop;
/** @brief Request payload for CMD_DEBUG_READ command */
struct cmd_debug_fread_request frd;
/** @brief Request payload for CMD_DEBUG_WRITE command */
struct cmd_debug_fwrite_request fwr;
/** @brief Request payload for CMD_DEBUG_CLOSE command */
struct cmd_debug_fclose_request fcl;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup Debugfs
*/
struct mrq_debug_response {
union {
/** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */
struct cmd_debug_fopen_response fop;
/** @brief Response data for CMD_DEBUG_READ command */
struct cmd_debug_fread_response frd;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
* @def MRQ_RESET
......@@ -687,14 +888,41 @@ struct mrq_debugfs_response {
*/
enum mrq_reset_commands {
/** @brief Assert module reset */
/**
* @brief Assert module reset
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
* -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
* -#BPMP_ENOTSUP if target domain h/w state does not allow reset
*/
CMD_RESET_ASSERT = 1,
/** @brief Deassert module reset */
/**
* @brief Deassert module reset
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
* -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
* -#BPMP_ENOTSUP if target domain h/w state does not allow reset
*/
CMD_RESET_DEASSERT = 2,
/** @brief Assert and deassert the module reset */
/**
* @brief Assert and deassert the module reset
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
* -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
* -#BPMP_ENOTSUP if target domain h/w state does not allow reset
*/
CMD_RESET_MODULE = 3,
/** @brief Get the highest reset ID */
/**
* @brief Get the highest reset ID
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)
*/
CMD_RESET_GET_MAX_ID = 4,
/** @brief Not part of ABI and subject to change */
CMD_RESET_MAX,
};
......@@ -710,7 +938,7 @@ struct mrq_reset_request {
uint32_t cmd;
/** @brief Id of the reset to affected */
uint32_t reset_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
......@@ -720,7 +948,7 @@ struct mrq_reset_request {
struct cmd_reset_get_max_id_response {
/** @brief Max reset id */
uint32_t max_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response with MRQ_RESET
......@@ -739,8 +967,8 @@ struct cmd_reset_get_max_id_response {
struct mrq_reset_response {
union {
struct cmd_reset_get_max_id_response reset_get_max_id;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
......@@ -758,17 +986,17 @@ struct mrq_reset_response {
* @addtogroup I2C
* @{
*/
#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12U)
#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4U)
#define SERIALI2C_TEN 0x0010
#define SERIALI2C_RD 0x0001
#define SERIALI2C_STOP 0x8000
#define SERIALI2C_NOSTART 0x4000
#define SERIALI2C_REV_DIR_ADDR 0x2000
#define SERIALI2C_IGNORE_NAK 0x1000
#define SERIALI2C_NO_RD_ACK 0x0800
#define SERIALI2C_RECV_LEN 0x0400
#define SERIALI2C_TEN 0x0010U
#define SERIALI2C_RD 0x0001U
#define SERIALI2C_STOP 0x8000U
#define SERIALI2C_NOSTART 0x4000U
#define SERIALI2C_REV_DIR_ADDR 0x2000U
#define SERIALI2C_IGNORE_NAK 0x1000U
#define SERIALI2C_NO_RD_ACK 0x0800U
#define SERIALI2C_RECV_LEN 0x0400U
enum {
CMD_I2C_XFER = 1
......@@ -798,7 +1026,7 @@ struct serial_i2c_request {
uint16_t len;
/** @brief For write transactions only, #len bytes of data */
uint8_t data[];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Trigger one or more i2c transactions
......@@ -812,7 +1040,7 @@ struct cmd_i2c_xfer_request {
/** @brief Serialized packed instances of @ref serial_i2c_request*/
uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Container for data read from the i2c bus
......@@ -826,7 +1054,7 @@ struct cmd_i2c_xfer_response {
uint32_t data_size;
/** @brief I2c read data */
uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Request with #MRQ_I2C
......@@ -836,14 +1064,25 @@ struct mrq_i2c_request {
uint32_t cmd;
/** @brief Parameters of the transfer request */
struct cmd_i2c_xfer_request xfer;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response to #MRQ_I2C
*
* mrq_response:err is
* 0: Success
* -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1
* -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request
* -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP
* -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules
* -#BPMP_ETIMEDOUT: if i2c transaction times out
* -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction
* -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller
* -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST
*/
struct mrq_i2c_response {
struct cmd_i2c_xfer_response xfer;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
......@@ -876,90 +1115,105 @@ enum {
CMD_CLK_MAX,
};
#define BPMP_CLK_HAS_MUX (1 << 0)
#define BPMP_CLK_HAS_SET_RATE (1 << 1)
#define BPMP_CLK_IS_ROOT (1 << 2)
#define BPMP_CLK_HAS_MUX (1U << 0U)
#define BPMP_CLK_HAS_SET_RATE (1U << 1U)
#define BPMP_CLK_IS_ROOT (1U << 2U)
#define BPMP_CLK_IS_VAR_ROOT (1U << 3U)
#define MRQ_CLK_NAME_MAXLEN 40
#define MRQ_CLK_MAX_PARENTS 16
#define MRQ_CLK_NAME_MAXLEN 40U
#define MRQ_CLK_MAX_PARENTS 16U
/** @private */
struct cmd_clk_get_rate_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_clk_get_rate_response {
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_set_rate_request {
int32_t unused;
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_set_rate_response {
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_round_rate_request {
int32_t unused;
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_round_rate_response {
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_get_parent_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_clk_get_parent_response {
uint32_t parent_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_set_parent_request {
uint32_t parent_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_clk_set_parent_response {
uint32_t parent_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_is_enabled_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/**
* @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED
*/
struct cmd_clk_is_enabled_response {
/**
* @brief The state of the clock that has been succesfully
* requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
* master invoking the command earlier.
*
* The state may not reflect the physical state of the clock
* if there are some other masters requesting it to be
* enabled.
*
* Value 0 is disabled, all other values indicate enabled.
*/
int32_t state;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_enable_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_enable_response {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_disable_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_disable_response {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_get_all_info_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_clk_get_all_info_response {
uint32_t flags;
......@@ -967,25 +1221,25 @@ struct cmd_clk_get_all_info_response {
uint32_t parents[MRQ_CLK_MAX_PARENTS];
uint8_t num_parents;
uint8_t name[MRQ_CLK_NAME_MAXLEN];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_get_max_clk_id_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_clk_get_max_clk_id_response {
uint32_t max_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_clk_get_fmax_at_vmin_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_clk_get_fmax_at_vmin_response {
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Clocks
......@@ -1040,8 +1294,8 @@ struct mrq_clk_request {
struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
/** @private */
struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup Clocks
......@@ -1082,8 +1336,8 @@ struct mrq_clk_response {
struct cmd_clk_get_all_info_response clk_get_all_info;
struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
......@@ -1109,7 +1363,7 @@ struct mrq_clk_response {
struct mrq_query_abi_request {
/** @brief MRQ code to query */
uint32_t mrq;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup ABI_info
......@@ -1121,7 +1375,7 @@ struct mrq_query_abi_request {
struct mrq_query_abi_response {
/** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
int32_t status;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup MRQ_Codes
......@@ -1146,7 +1400,7 @@ struct mrq_query_abi_response {
struct mrq_pg_read_state_request {
/** @brief ID of partition */
uint32_t partition_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup Powergating
......@@ -1161,7 +1415,7 @@ struct mrq_pg_read_state_response {
* * 1 : on
*/
uint32_t logic_state;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond*/
/** @} */
......@@ -1211,7 +1465,7 @@ struct mrq_pg_update_state_request {
* @ref logic_state == 0x3)
*/
uint32_t clock_state;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond*/
/**
......@@ -1307,25 +1561,38 @@ enum pg_states {
struct cmd_pg_query_abi_request {
/** @ref mrq_pg_cmd */
uint32_t type;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_pg_set_state_request {
/** @ref pg_states */
uint32_t state;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE
*/
struct cmd_pg_get_state_response {
/** @ref pg_states */
/**
* @brief The state of the power partition that has been
* succesfuly requested by the master earlier using #MRQ_PG
* command #CMD_PG_SET_STATE.
*
* The state may not reflect the physical state of the power
* partition if there are some other masters requesting it to
* be enabled.
*
* See @ref pg_states for possible values
*/
uint32_t state;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_pg_get_name_response {
uint8_t name[MRQ_PG_NAME_MAXLEN];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_pg_get_max_id_response {
uint32_t max_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Request with #MRQ_PG
......@@ -1350,8 +1617,8 @@ struct mrq_pg_request {
union {
struct cmd_pg_query_abi_request query_abi;
struct cmd_pg_set_state_request set_state;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @brief Response to MRQ_PG
......@@ -1373,8 +1640,8 @@ struct mrq_pg_response {
struct cmd_pg_get_state_response get_state;
struct cmd_pg_get_name_response get_name;
struct cmd_pg_get_max_id_response get_max_id;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
......@@ -1463,6 +1730,20 @@ enum mrq_thermal_host_to_bpmp_cmd {
*/
CMD_THERMAL_GET_NUM_ZONES = 3,
/**
* @brief Get the thermtrip of the specified zone.
*
* Host needs to supply request parameters.
*
* mrq_response::err is
* * 0: Valid zone information returned.
* * -#BPMP_EINVAL: Invalid request parameters.
* * -#BPMP_ENOENT: No driver registered for thermal zone.
* * -#BPMP_ERANGE if thermtrip is invalid or disabled.
* * -#BPMP_EFAULT: Problem reading zone information.
*/
CMD_THERMAL_GET_THERMTRIP = 4,
/** @brief: number of supported host-to-bpmp commands. May
* increase in future
*/
......@@ -1493,7 +1774,7 @@ enum mrq_thermal_bpmp_to_host_cmd {
*/
struct cmd_thermal_query_abi_request {
uint32_t type;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
......@@ -1502,7 +1783,7 @@ struct cmd_thermal_query_abi_request {
*/
struct cmd_thermal_get_temp_request {
uint32_t zone;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
......@@ -1515,7 +1796,7 @@ struct cmd_thermal_get_temp_request {
*/
struct cmd_thermal_get_temp_response {
int32_t temp;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
......@@ -1530,7 +1811,7 @@ struct cmd_thermal_set_trip_request {
int32_t low;
int32_t high;
uint32_t enabled;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
......@@ -1539,7 +1820,7 @@ struct cmd_thermal_set_trip_request {
*/
struct cmd_thermal_host_trip_reached_request {
uint32_t zone;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
......@@ -1549,7 +1830,25 @@ struct cmd_thermal_host_trip_reached_request {
*/
struct cmd_thermal_get_num_zones_response {
uint32_t num;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/*
* Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP
*
* zone: Number of thermal zone.
*/
struct cmd_thermal_get_thermtrip_request {
uint32_t zone;
} BPMP_ABI_PACKED;
/*
* BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP
*
* thermtrip: HW shutdown temperature in millicelsius.
*/
struct cmd_thermal_get_thermtrip_response {
int32_t thermtrip;
} BPMP_ABI_PACKED;
/*
* Host->BPMP request data.
......@@ -1565,8 +1864,9 @@ struct mrq_thermal_host_to_bpmp_request {
struct cmd_thermal_query_abi_request query_abi;
struct cmd_thermal_get_temp_request get_temp;
struct cmd_thermal_set_trip_request set_trip;
} __UNION_ANON;
} __ABI_PACKED;
struct cmd_thermal_get_thermtrip_request get_thermtrip;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/*
* BPMP->Host request data.
......@@ -1578,16 +1878,17 @@ struct mrq_thermal_bpmp_to_host_request {
uint32_t type;
union {
struct cmd_thermal_host_trip_reached_request host_trip_reached;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/*
* Data in reply to a Host->BPMP request.
*/
union mrq_thermal_bpmp_to_host_response {
struct cmd_thermal_get_temp_response get_temp;
struct cmd_thermal_get_thermtrip_response get_thermtrip;
struct cmd_thermal_get_num_zones_response get_num_zones;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
/**
......@@ -1619,7 +1920,7 @@ struct mrq_cpu_vhint_request {
uint32_t addr;
/** @brief ID of the cluster whose data is requested */
uint32_t cluster_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Description of the CPU v/f relation
......@@ -1646,7 +1947,7 @@ struct cpu_vhint_data {
uint16_t vindex_div;
/** reserved for future use */
uint16_t reserved[328];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond */
/** @} */
......@@ -1735,11 +2036,11 @@ struct mrq_abi_ratchet_response {
* @brief Used by @ref mrq_emc_dvfs_latency_response
*/
struct emc_dvfs_latency {
/** @brief EMC frequency in kHz */
/** @brief EMC DVFS node frequency in kHz */
uint32_t freq;
/** @brief EMC DVFS latency in nanoseconds */
uint32_t latency;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
#define EMC_DVFS_LATENCY_MAX_SIZE 14
/**
......@@ -1748,9 +2049,9 @@ struct emc_dvfs_latency {
struct mrq_emc_dvfs_latency_response {
/** @brief The number valid entries in #pairs */
uint32_t num_pairs;
/** @brief EMC <frequency, latency> information */
/** @brief EMC DVFS node <frequency, latency> information */
struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
......@@ -1775,7 +2076,7 @@ struct mrq_emc_dvfs_latency_response {
struct mrq_cpu_ndiv_limits_request {
/** @brief Enum cluster_id */
uint32_t cluster_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response to #MRQ_CPU_NDIV_LIMITS
......@@ -1791,7 +2092,7 @@ struct mrq_cpu_ndiv_limits_response {
uint16_t ndiv_max;
/** @brief Minimum allowed NDIV value */
uint16_t ndiv_min;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
/** @endcond */
......@@ -1823,7 +2124,7 @@ struct mrq_cpu_ndiv_limits_response {
struct mrq_cpu_auto_cc3_request {
/** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
uint32_t cluster_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @brief Response to #MRQ_CPU_AUTO_CC3
......@@ -1837,7 +2138,7 @@ struct mrq_cpu_auto_cc3_response {
* - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
*/
uint32_t auto_cc3_config;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
/** @endcond */
......@@ -1847,6 +2148,8 @@ struct mrq_cpu_auto_cc3_response {
* @def MRQ_TRACE_ITER
* @brief Manage the trace iterator
*
* @deprecated
*
* * Platforms: All
* * Initiators: CCPLEX
* * Targets: BPMP
......@@ -1868,7 +2171,7 @@ enum {
struct mrq_trace_iter_request {
/** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
uint32_t cmd;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
......@@ -1944,12 +2247,12 @@ enum mrq_ringbuf_console_host_to_bpmp_cmd {
struct cmd_ringbuf_console_query_abi_req {
/** @brief Command identifier to be queried */
uint32_t cmd;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_ringbuf_console_query_abi_resp {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -1960,7 +2263,7 @@ struct cmd_ringbuf_console_read_req {
* @brief Number of bytes requested to be read from the BPMP TX buffer
*/
uint8_t len;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -1971,7 +2274,7 @@ struct cmd_ringbuf_console_read_resp {
uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
/** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
uint8_t len;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -1982,7 +2285,7 @@ struct cmd_ringbuf_console_write_req {
uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
/** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
uint8_t len;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -1993,12 +2296,12 @@ struct cmd_ringbuf_console_write_resp {
uint32_t space_avail;
/** @brief Number of bytes that were written to the BPMP RX buffer */
uint8_t len;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_ringbuf_console_get_fifo_req {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -2013,7 +2316,7 @@ struct cmd_ringbuf_console_get_fifo_resp {
uint64_t bpmp_tx_tail_addr;
/** @brief Length of the BPMP TX buffer */
uint32_t bpmp_tx_buf_len;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -2033,8 +2336,8 @@ struct mrq_ringbuf_console_host_to_bpmp_request {
struct cmd_ringbuf_console_read_req read;
struct cmd_ringbuf_console_write_req write;
struct cmd_ringbuf_console_get_fifo_req get_fifo;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup RingbufConsole
......@@ -2047,7 +2350,7 @@ union mrq_ringbuf_console_bpmp_to_host_response {
struct cmd_ringbuf_console_read_resp read;
struct cmd_ringbuf_console_write_resp write;
struct cmd_ringbuf_console_get_fifo_resp get_fifo;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @} */
/**
......@@ -2091,7 +2394,7 @@ struct mrq_strap_request {
uint32_t id;
/** @brief Desired value for strap (if cmd is #STRAP_SET) */
uint32_t value;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @defgroup Strap_Ids Strap Identifiers
......@@ -2134,28 +2437,28 @@ struct cmd_uphy_margin_control_request {
uint32_t y;
/** @brief Set number of bit blocks for each margin section */
uint32_t nblks;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_uphy_margin_status_response {
/** @brief Number of errors observed */
uint32_t status;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_uphy_ep_controller_pll_init_request {
/** @brief EP controller number, valid: 0, 4, 5 */
uint8_t ep_controller;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_uphy_pcie_controller_state_request {
/** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */
uint8_t pcie_controller;
uint8_t enable;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_uphy_ep_controller_pll_off_request {
/** @brief EP controller number, valid: 0, 4, 5 */
uint8_t ep_controller;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup UPHY
......@@ -2186,8 +2489,8 @@ struct mrq_uphy_request {
struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
struct cmd_uphy_pcie_controller_state_request controller_state;
struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup UPHY
......@@ -2207,8 +2510,8 @@ struct mrq_uphy_request {
struct mrq_uphy_response {
union {
struct cmd_uphy_margin_status_response uphy_get_margin_status;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
/** @endcond */
......@@ -2258,31 +2561,31 @@ enum {
struct cmd_fmon_gear_clamp_request {
int32_t unused;
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @private */
struct cmd_fmon_gear_clamp_response {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_fmon_gear_free_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_fmon_gear_free_response {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
/** @private */
struct cmd_fmon_gear_get_request {
EMPTY
} __ABI_PACKED;
BPMP_ABI_EMPTY
} BPMP_ABI_PACKED;
struct cmd_fmon_gear_get_response {
int64_t rate;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* @ingroup FMON
......@@ -2315,8 +2618,8 @@ struct mrq_fmon_request {
struct cmd_fmon_gear_free_request fmon_gear_free;
/** @private */
struct cmd_fmon_gear_get_request fmon_gear_get;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup FMON
......@@ -2340,8 +2643,8 @@ struct mrq_fmon_response {
/** @private */
struct cmd_fmon_gear_free_response fmon_gear_free;
struct cmd_fmon_gear_get_response fmon_gear_get;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
/** @endcond */
......@@ -2366,13 +2669,27 @@ struct mrq_fmon_response {
*/
enum {
/**
* @cond DEPRECATED
* @brief Retrieve specified EC status.
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_ENODEV if target EC is not owned by BPMP @n
* -#BPMP_EACCES if target EC power domain is turned off
* -#BPMP_EACCES if target EC power domain is turned off @n
* -#BPMP_EBADCMD if subcommand is not supported
* @endcond
*/
CMD_EC_STATUS_GET = 1,
CMD_EC_STATUS_GET = 1, /* deprecated */
/**
* @brief Retrieve specified EC extended status (includes error
* counter and user values).
*
* mrq_response::err is 0 if the operation was successful, or @n
* -#BPMP_ENODEV if target EC is not owned by BPMP @n
* -#BPMP_EACCES if target EC power domain is turned off @n
* -#BPMP_EBADCMD if subcommand is not supported
*/
CMD_EC_STATUS_EX_GET = 2,
CMD_EC_NUM,
};
......@@ -2428,13 +2745,13 @@ enum bpmp_ec_err_type {
/** @brief SW Correctable error
*
* Error descriptor @ref ec_err_simple_desc.
* Error descriptor @ref ec_err_sw_error_desc.
*/
EC_ERR_TYPE_SW_CORRECTABLE = 16,
/** @brief SW Uncorrectable error
*
* Error descriptor @ref ec_err_simple_desc.
* Error descriptor @ref ec_err_sw_error_desc.
*/
EC_ERR_TYPE_SW_UNCORRECTABLE = 17,
......@@ -2454,9 +2771,9 @@ enum bpmp_ec_err_type {
/** @brief Group of registers with parity error. */
enum ec_registers_group {
/** @brief Functional registers group */
EC_ERR_GROUP_FUNC_REG = 0,
EC_ERR_GROUP_FUNC_REG = 0U,
/** @brief SCR registers group */
EC_ERR_GROUP_SCR_REG = 1,
EC_ERR_GROUP_SCR_REG = 1U,
};
/**
......@@ -2465,11 +2782,11 @@ enum ec_registers_group {
* @{
*/
/** @brief No EC error found flag */
#define EC_STATUS_FLAG_NO_ERROR 0x0001
#define EC_STATUS_FLAG_NO_ERROR 0x0001U
/** @brief Last EC error found flag */
#define EC_STATUS_FLAG_LAST_ERROR 0x0002
#define EC_STATUS_FLAG_LAST_ERROR 0x0002U
/** @brief EC latent error flag */
#define EC_STATUS_FLAG_LATENT_ERROR 0x0004
#define EC_STATUS_FLAG_LATENT_ERROR 0x0004U
/** @} */
/**
......@@ -2478,9 +2795,9 @@ enum ec_registers_group {
* @{
*/
/** @brief EC descriptor error resolved flag */
#define EC_DESC_FLAG_RESOLVED 0x0001
#define EC_DESC_FLAG_RESOLVED 0x0001U
/** @brief EC descriptor failed to retrieve id flag */
#define EC_DESC_FLAG_NO_ID 0x0002
#define EC_DESC_FLAG_NO_ID 0x0002U
/** @} */
/**
......@@ -2497,7 +2814,7 @@ struct ec_err_fmon_desc {
uint32_t fmon_faults;
/** @brief FMON faults access error */
int32_t fmon_access_error;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* |error type | vmon_adc_id values |
......@@ -2513,7 +2830,7 @@ struct ec_err_vmon_desc {
uint32_t vmon_faults;
/** @brief VMON faults access error */
int32_t vmon_access_error;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* |error type | reg_id values |
......@@ -2527,7 +2844,22 @@ struct ec_err_reg_parity_desc {
uint16_t reg_id;
/** @brief Register group @ref ec_registers_group */
uint16_t reg_group;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/**
* |error type | err_source_id values |
* |--------------------------------- |--------------------------|
* |@ref EC_ERR_TYPE_SW_CORRECTABLE | @ref bpmp_ec_ce_swd_ids |
* |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | @ref bpmp_ec_ue_swd_ids |
*/
struct ec_err_sw_error_desc {
/** @brief Bitmask of @ref bpmp_ec_desc_flags */
uint16_t desc_flags;
/** @brief Error source id */
uint16_t err_source_id;
/** @brief Sw error data */
uint32_t sw_error_data;
} BPMP_ABI_PACKED;
/**
* |error type | err_source_id values |
......@@ -2537,34 +2869,36 @@ struct ec_err_reg_parity_desc {
* |@ref EC_ERR_TYPE_ECC_DED_INTERNAL |@ref bpmp_ec_ipath_ids |
* |@ref EC_ERR_TYPE_COMPARATOR |@ref bpmp_ec_comparator_ids|
* |@ref EC_ERR_TYPE_PARITY_SRAM |@ref bpmp_clock_ids |
* |@ref EC_ERR_TYPE_SW_CORRECTABLE |@ref bpmp_ec_misc_ids |
* |@ref EC_ERR_TYPE_SW_UNCORRECTABLE |@ref bpmp_ec_misc_ids |
* |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_ids |
* |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_ids |
* |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_hwd_ids |
* |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_hwd_ids |
*/
struct ec_err_simple_desc {
/** @brief Bitmask of @ref bpmp_ec_desc_flags */
uint16_t desc_flags;
/** @brief Error source id. Id space depends on error type. */
uint16_t err_source_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @brief Union of EC error descriptors */
union ec_err_desc {
struct ec_err_fmon_desc fmon_desc;
struct ec_err_vmon_desc vmon_desc;
struct ec_err_reg_parity_desc reg_parity_desc;
struct ec_err_sw_error_desc sw_error_desc;
struct ec_err_simple_desc simple_desc;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
struct cmd_ec_status_get_request {
/** @brief HSM error line number that identifies target EC. */
uint32_t ec_hsm_id;
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** EC status maximum number of descriptors */
#define EC_ERR_STATUS_DESC_MAX_NUM 4
#define EC_ERR_STATUS_DESC_MAX_NUM 4U
/**
* @cond DEPRECATED
*/
struct cmd_ec_status_get_response {
/** @brief Target EC id (the same id received with request). */
uint32_t ec_hsm_id;
......@@ -2582,7 +2916,33 @@ struct cmd_ec_status_get_response {
uint32_t error_desc_num;
/** @brief EC error descriptors */
union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
} __ABI_PACKED;
} BPMP_ABI_PACKED;
/** @endcond */
struct cmd_ec_status_ex_get_response {
/** @brief Target EC id (the same id received with request). */
uint32_t ec_hsm_id;
/**
* @brief Bitmask of @ref bpmp_ec_status_flags
*
* If NO_ERROR flag is set, error_ fields should be ignored
*/
uint32_t ec_status_flags;
/** @brief Found EC error index. */
uint32_t error_idx;
/** @brief Found EC error type @ref bpmp_ec_err_type. */
uint32_t error_type;
/** @brief Found EC mission error counter value */
uint32_t error_counter;
/** @brief Found EC mission error user value */
uint32_t error_uval;
/** @brief Reserved entry */
uint32_t reserved;
/** @brief Number of returned EC error descriptors */
uint32_t error_desc_num;
/** @brief EC error descriptors */
union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
} BPMP_ABI_PACKED;
/**
* @ingroup EC
......@@ -2591,9 +2951,15 @@ struct cmd_ec_status_get_response {
* Used by the sender of an #MRQ_EC message to access ECs owned
* by BPMP.
*
* @cond DEPRECATED
* |sub-command |payload |
* |----------------------------|-----------------------|
* |@ref CMD_EC_STATUS_GET |ec_status_get |
* @endcond
*
* |sub-command |payload |
* |----------------------------|-----------------------|
* |@ref CMD_EC_STATUS_EX_GET |ec_status_get |
*
*/
......@@ -2603,8 +2969,8 @@ struct mrq_ec_request {
union {
struct cmd_ec_status_get_request ec_status_get;
} __UNION_ANON;
} __ABI_PACKED;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/**
* @ingroup EC
......@@ -2613,49 +2979,28 @@ struct mrq_ec_request {
* Each sub-command supported by @ref mrq_ec_request may return
* sub-command-specific data as indicated below.
*
* @cond DEPRECATED
* |sub-command |payload |
* |----------------------------|------------------------|
* |@ref CMD_EC_STATUS_GET |ec_status_get |
* @endcond
*
* |sub-command |payload |
* |----------------------------|------------------------|
* |@ref CMD_EC_STATUS_EX_GET |ec_status_ex_get |
*
*/
struct mrq_ec_response {
union {
struct cmd_ec_status_get_response ec_status_get;
} __UNION_ANON;
} __ABI_PACKED;
/** @} */
/** @endcond */
/**
* @ingroup MRQ_Codes
* @def MRQ_FBVOLT_STATUS
* @brief Provides status information about voltage state for fuse burning
*
* * Platforms: T194 onwards
* @cond bpmp_t194
* * Initiators: CCPLEX
* * Target: BPMP
* * Request Payload: None
* * Response Payload: @ref mrq_fbvolt_status_response
* @{
*/
/**
* @ingroup Fbvolt_status
* @brief Response to #MRQ_FBVOLT_STATUS
*
* Value of #ready reflects if core voltages are in a suitable state for buring
* fuses. A value of 0x1 indicates that core voltages are ready for burning
* fuses. A value of 0x0 indicates that core voltages are not ready.
/**
* @cond DEPRECATED
*/
struct mrq_fbvolt_status_response {
/** @brief Bit [0:0] - ready status, bits [31:1] - reserved */
uint32_t ready;
/** @brief Reserved */
uint32_t unused;
} __ABI_PACKED;
struct cmd_ec_status_get_response ec_status_get;
/** @endcond */
struct cmd_ec_status_ex_get_response ec_status_ex_get;
} BPMP_UNION_ANON;
} BPMP_ABI_PACKED;
/** @} */
/** @endcond */
......@@ -2668,6 +3013,8 @@ struct mrq_fbvolt_status_response {
* @{
*/
/** @brief Operation not permitted */
#define BPMP_EPERM 1
/** @brief No such file or directory */
#define BPMP_ENOENT 2
/** @brief No MRQ handler */
......@@ -2676,12 +3023,16 @@ struct mrq_fbvolt_status_response {
#define BPMP_EIO 5
/** @brief Bad sub-MRQ command */
#define BPMP_EBADCMD 6
/** @brief Resource temporarily unavailable */
#define BPMP_EAGAIN 11
/** @brief Not enough memory */
#define BPMP_ENOMEM 12
/** @brief Permission denied */
#define BPMP_EACCES 13
/** @brief Bad address */
#define BPMP_EFAULT 14
/** @brief Resource busy */
#define BPMP_EBUSY 16
/** @brief No such device */
#define BPMP_ENODEV 19
/** @brief Argument is a directory */
......@@ -2696,7 +3047,15 @@ struct mrq_fbvolt_status_response {
#define BPMP_ENOSYS 38
/** @brief Invalid slot */
#define BPMP_EBADSLT 57
/** @brief Not supported */
#define BPMP_ENOTSUP 134
/** @brief No such device or address */
#define BPMP_ENXIO 140
/** @} */
#if defined(BPMP_ABI_CHECKS)
#include "bpmp_abi_checks.h"
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment