aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-03-29 12:34:51 -0400
committerThierry Reding <treding@nvidia.com>2017-06-13 09:16:25 -0400
commit52b8b80395835c3012bf79fc9d5a1dd82a2d922a (patch)
tree6f5208007c14f89292c7df2a760081a7095fd38a
parent408455245a48a1ecabd90133bae0baec3ec4cfb8 (diff)
soc/tegra: bpmp: Update ABI header
Update the BPMP ABI header to a more recent version. The new version adds support for a new powergating ABI as well as access to the ring buffer console, which allows debug messages to be output to the BPMP debug console. Some of the previously undocumented fields have been documented and missing bitmasks have been added. Furthermore the MRQ_RESET request now has a sub-command that allows to determine the maximum ID which in turn allows the resets to be enumerated, thereby allowing drivers to become agnostic of the Tegra generation. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--include/soc/tegra/bpmp-abi.h418
1 files changed, 408 insertions, 10 deletions
diff --git a/include/soc/tegra/bpmp-abi.h b/include/soc/tegra/bpmp-abi.h
index 0aaef5960e29..98d8d38b99a1 100644
--- a/include/soc/tegra/bpmp-abi.h
+++ b/include/soc/tegra/bpmp-abi.h
@@ -81,13 +81,18 @@
81 * Provides the MRQ number for the MRQ message: #mrq. The remainder of 81 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
82 * the MRQ message is a payload (immediately following the 82 * the MRQ message is a payload (immediately following the
83 * mrq_request) whose format depends on mrq. 83 * mrq_request) whose format depends on mrq.
84 *
85 * @todo document the flags
86 */ 84 */
87struct mrq_request { 85struct mrq_request {
88 /** @brief MRQ number of the request */ 86 /** @brief MRQ number of the request */
89 uint32_t mrq; 87 uint32_t mrq;
90 /** @brief flags for the request */ 88 /**
89 * @brief flags providing follow up directions to the receiver
90 *
91 * | Bit | Description |
92 * |-----|--------------------------------------------|
93 * | 1 | ring the sender's doorbell when responding |
94 * | 0 | should be 1 |
95 */
91 uint32_t flags; 96 uint32_t flags;
92} __ABI_PACKED; 97} __ABI_PACKED;
93 98
@@ -99,13 +104,11 @@ struct mrq_request {
99 * remainder of the MRQ response is a payload (immediately following 104 * remainder of the MRQ response is a payload (immediately following
100 * the mrq_response) whose format depends on the associated 105 * the mrq_response) whose format depends on the associated
101 * mrq_request::mrq 106 * mrq_request::mrq
102 *
103 * @todo document the flags
104 */ 107 */
105struct mrq_response { 108struct mrq_response {
106 /** @brief error code for the MRQ request itself */ 109 /** @brief error code for the MRQ request itself */
107 int32_t err; 110 int32_t err;
108 /** @brief flags for the response */ 111 /** @brief reserved for future use */
109 uint32_t flags; 112 uint32_t flags;
110} __ABI_PACKED; 113} __ABI_PACKED;
111 114
@@ -147,6 +150,8 @@ struct mrq_response {
147#define MRQ_ABI_RATCHET 29 150#define MRQ_ABI_RATCHET 29
148#define MRQ_EMC_DVFS_LATENCY 31 151#define MRQ_EMC_DVFS_LATENCY 31
149#define MRQ_TRACE_ITER 64 152#define MRQ_TRACE_ITER 64
153#define MRQ_RINGBUF_CONSOLE 65
154#define MRQ_PG 66
150 155
151/** @} */ 156/** @} */
152 157
@@ -155,7 +160,7 @@ struct mrq_response {
155 * @brief Maximum MRQ code to be sent by CPU software to 160 * @brief Maximum MRQ code to be sent by CPU software to
156 * BPMP. Subject to change in future 161 * BPMP. Subject to change in future
157 */ 162 */
158#define MAX_CPU_MRQ_ID 64 163#define MAX_CPU_MRQ_ID 66
159 164
160/** 165/**
161 * @addtogroup MRQ_Payloads Message Payloads 166 * @addtogroup MRQ_Payloads Message Payloads
@@ -175,6 +180,7 @@ struct mrq_response {
175 * @defgroup Vhint CPU Voltage hint 180 * @defgroup Vhint CPU Voltage hint
176 * @defgroup MRQ_Deprecated Deprecated MRQ messages 181 * @defgroup MRQ_Deprecated Deprecated MRQ messages
177 * @defgroup EMC 182 * @defgroup EMC
183 * @defgroup RingbufConsole
178 * @} 184 * @}
179 */ 185 */
180 186
@@ -637,7 +643,7 @@ struct mrq_debugfs_response {
637 * * Initiators: Any 643 * * Initiators: Any
638 * * Targets: BPMP 644 * * Targets: BPMP
639 * * Request Payload: @ref mrq_reset_request 645 * * Request Payload: @ref mrq_reset_request
640 * * Response Payload: N/A 646 * * Response Payload: @ref mrq_reset_response
641 */ 647 */
642 648
643/** 649/**
@@ -647,6 +653,7 @@ enum mrq_reset_commands {
647 CMD_RESET_ASSERT = 1, 653 CMD_RESET_ASSERT = 1,
648 CMD_RESET_DEASSERT = 2, 654 CMD_RESET_DEASSERT = 2,
649 CMD_RESET_MODULE = 3, 655 CMD_RESET_MODULE = 3,
656 CMD_RESET_GET_MAX_ID = 4,
650 CMD_RESET_MAX, /* not part of ABI and subject to change */ 657 CMD_RESET_MAX, /* not part of ABI and subject to change */
651}; 658};
652 659
@@ -665,6 +672,38 @@ struct mrq_reset_request {
665} __ABI_PACKED; 672} __ABI_PACKED;
666 673
667/** 674/**
675 * @ingroup Reset
676 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
677 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
678 * in mrq_response::err.
679 */
680struct cmd_reset_get_max_id_response {
681 /** @brief max reset id */
682 uint32_t max_id;
683} __ABI_PACKED;
684
685/**
686 * @ingroup Reset
687 * @brief Response with MRQ_RESET
688 *
689 * Each sub-command supported by @ref mrq_reset_request may return
690 * sub-command-specific data. Some do and some do not as indicated
691 * in the following table
692 *
693 * | sub-command | payload |
694 * |----------------------|------------------|
695 * | CMD_RESET_ASSERT | - |
696 * | CMD_RESET_DEASSERT | - |
697 * | CMD_RESET_MODULE | - |
698 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
699 */
700struct mrq_reset_response {
701 union {
702 struct cmd_reset_get_max_id_response reset_get_max_id;
703 } __UNION_ANON;
704} __ABI_PACKED;
705
706/**
668 * @ingroup MRQ_Codes 707 * @ingroup MRQ_Codes
669 * @def MRQ_I2C 708 * @def MRQ_I2C
670 * @brief issue an i2c transaction 709 * @brief issue an i2c transaction
@@ -812,6 +851,17 @@ enum {
812}; 851};
813/** @} */ 852/** @} */
814 853
854/**
855 * @name MRQ_CLK properties
856 * Flag bits for cmd_clk_properties_response::flags and
857 * cmd_clk_get_all_info_response::flags
858 * @{
859 */
860#define BPMP_CLK_HAS_MUX (1 << 0)
861#define BPMP_CLK_HAS_SET_RATE (1 << 1)
862#define BPMP_CLK_IS_ROOT (1 << 2)
863/** @} */
864
815#define MRQ_CLK_NAME_MAXLEN 40 865#define MRQ_CLK_NAME_MAXLEN 40
816#define MRQ_CLK_MAX_PARENTS 16 866#define MRQ_CLK_MAX_PARENTS 16
817 867
@@ -1010,7 +1060,7 @@ struct mrq_clk_response {
1010 * 1060 *
1011 * * Platforms: All 1061 * * Platforms: All
1012 * * Initiators: Any 1062 * * Initiators: Any
1013 * * Targets: Any 1063 * * Targets: Any except DMCE
1014 * * Request Payload: @ref mrq_query_abi_request 1064 * * Request Payload: @ref mrq_query_abi_request
1015 * * Response Payload: @ref mrq_query_abi_response 1065 * * Response Payload: @ref mrq_query_abi_response
1016 */ 1066 */
@@ -1030,6 +1080,9 @@ struct mrq_query_abi_request {
1030/** 1080/**
1031 * @ingroup ABI_info 1081 * @ingroup ABI_info
1032 * @brief response to MRQ_QUERY_ABI 1082 * @brief response to MRQ_QUERY_ABI
1083 *
1084 * @note mrq_response::err of 0 indicates that the query was
1085 * successful, not that the MRQ itself is supported!
1033 */ 1086 */
1034struct mrq_query_abi_response { 1087struct mrq_query_abi_response {
1035 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */ 1088 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
@@ -1080,7 +1133,9 @@ struct mrq_pg_read_state_response {
1080/** 1133/**
1081 * @ingroup MRQ_Codes 1134 * @ingroup MRQ_Codes
1082 * @def MRQ_PG_UPDATE_STATE 1135 * @def MRQ_PG_UPDATE_STATE
1083 * @brief modify the power-gating state of a partition 1136 * @brief modify the power-gating state of a partition. In contrast to
1137 * MRQ_PG calls, the operations that change state (on/off) of power
1138 * partition are reference counted.
1084 * 1139 *
1085 * * Platforms: T186 1140 * * Platforms: T186
1086 * * Initiators: Any 1141 * * Initiators: Any
@@ -1126,6 +1181,171 @@ struct mrq_pg_update_state_request {
1126 1181
1127/** 1182/**
1128 * @ingroup MRQ_Codes 1183 * @ingroup MRQ_Codes
1184 * @def MRQ_PG
1185 * @brief Control power-gating state of a partition. In contrast to
1186 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1187 * state are NOT reference counted
1188 *
1189 * * Platforms: T186
1190 * * Initiators: Any
1191 * * Targets: BPMP
1192 * * Request Payload: @ref mrq_pg_request
1193 * * Response Payload: @ref mrq_pg_response
1194 * @addtogroup Powergating
1195 * @{
1196 */
1197
1198/**
1199 * @name MRQ_PG sub-commands
1200 * @{
1201 */
1202enum mrq_pg_cmd {
1203 /**
1204 * @brief Check whether the BPMP driver supports the specified
1205 * request type
1206 *
1207 * mrq_response::err is 0 if the specified request is
1208 * supported and -#BPMP_ENODEV otherwise.
1209 */
1210 CMD_PG_QUERY_ABI = 0,
1211
1212 /**
1213 * @brief Set the current state of specified power domain. The
1214 * possible values for power domains are defined in enum
1215 * pg_states
1216 *
1217 * mrq_response:err is
1218 * 0: Success
1219 * -#BPMP_EINVAL: Invalid request parameters
1220 */
1221 CMD_PG_SET_STATE = 1,
1222
1223 /**
1224 * @brief Get the current state of specified power domain. The
1225 * possible values for power domains are defined in enum
1226 * pg_states
1227 *
1228 * mrq_response:err is
1229 * 0: Success
1230 * -#BPMP_EINVAL: Invalid request parameters
1231 */
1232 CMD_PG_GET_STATE = 2,
1233
1234 /**
1235 * @brief get the name string of specified power domain id.
1236 *
1237 * mrq_response:err is
1238 * 0: Success
1239 * -#BPMP_EINVAL: Invalid request parameters
1240 */
1241 CMD_PG_GET_NAME = 3,
1242
1243
1244 /**
1245 * @brief get the highest power domain id in the system. Not
1246 * all IDs between 0 and max_id are valid IDs.
1247 *
1248 * mrq_response:err is
1249 * 0: Success
1250 * -#BPMP_EINVAL: Invalid request parameters
1251 */
1252 CMD_PG_GET_MAX_ID = 4,
1253};
1254/** @} */
1255
1256#define MRQ_PG_NAME_MAXLEN 40
1257
1258/**
1259 * @brief possible power domain states in
1260 * cmd_pg_set_state_request:state and cmd_pg_get_state_response:state.
1261 * PG_STATE_OFF: power domain is OFF
1262 * PG_STATE_ON: power domain is ON
1263 * PG_STATE_RUNNING: power domain is ON and made into directly usable
1264 * state by turning on the clocks associated with
1265 * the domain
1266 */
1267enum pg_states {
1268 PG_STATE_OFF = 0,
1269 PG_STATE_ON = 1,
1270 PG_STATE_RUNNING = 2,
1271};
1272
1273struct cmd_pg_query_abi_request {
1274 uint32_t type; /* enum mrq_pg_cmd */
1275} __ABI_PACKED;
1276
1277struct cmd_pg_set_state_request {
1278 uint32_t state; /* enum pg_states */
1279} __ABI_PACKED;
1280
1281struct cmd_pg_get_state_response {
1282 uint32_t state; /* enum pg_states */
1283} __ABI_PACKED;
1284
1285struct cmd_pg_get_name_response {
1286 uint8_t name[MRQ_PG_NAME_MAXLEN];
1287} __ABI_PACKED;
1288
1289struct cmd_pg_get_max_id_response {
1290 uint32_t max_id;
1291} __ABI_PACKED;
1292
1293/**
1294 * @ingroup Powergating
1295 * @brief request with #MRQ_PG
1296 *
1297 * Used by the sender of an #MRQ_PG message to control power
1298 * partitions. The pg_request is split into several sub-commands. Some
1299 * sub-commands require no additional data. Others have a sub-command
1300 * specific payload
1301 *
1302 * |sub-command |payload |
1303 * |----------------------------|-----------------------|
1304 * |CMD_PG_QUERY_ABI | query_abi |
1305 * |CMD_PG_SET_STATE | set_state |
1306 * |CMD_PG_GET_STATE | - |
1307 * |CMD_PG_GET_NAME | - |
1308 * |CMD_PG_GET_MAX_ID | - |
1309 *
1310 */
1311
1312struct mrq_pg_request {
1313 uint32_t cmd;
1314 uint32_t id;
1315 union {
1316 struct cmd_pg_query_abi_request query_abi;
1317 struct cmd_pg_set_state_request set_state;
1318 } __UNION_ANON;
1319} __ABI_PACKED;
1320
1321/**
1322 * @ingroup Powergating
1323 * @brief response to MRQ_PG
1324 *
1325 * Each sub-command supported by @ref mrq_pg_request may return
1326 * sub-command-specific data. Some do and some do not as indicated in
1327 * the following table
1328 *
1329 * |sub-command |payload |
1330 * |----------------------------|-----------------------|
1331 * |CMD_PG_QUERY_ABI | - |
1332 * |CMD_PG_SET_STATE | - |
1333 * |CMD_PG_GET_STATE | get_state |
1334 * |CMD_PG_GET_NAME | get_name |
1335 * |CMD_PG_GET_MAX_ID | get_max_id |
1336 *
1337 */
1338
1339struct mrq_pg_response {
1340 union {
1341 struct cmd_pg_get_state_response get_state;
1342 struct cmd_pg_get_name_response get_name;
1343 struct cmd_pg_get_max_id_response get_max_id;
1344 } __UNION_ANON;
1345} __ABI_PACKED;
1346
1347/**
1348 * @ingroup MRQ_Codes
1129 * @def MRQ_THERMAL 1349 * @def MRQ_THERMAL
1130 * @brief interact with BPMP thermal framework 1350 * @brief interact with BPMP thermal framework
1131 * 1351 *
@@ -1529,6 +1749,184 @@ struct mrq_trace_iter_request {
1529 1749
1530/** @} */ 1750/** @} */
1531 1751
1752/**
1753 * @ingroup MRQ_Codes
1754 * @def MRQ_RINGBUF_CONSOLE
1755 * @brief A ring buffer debug console for BPMP
1756 * @addtogroup RingbufConsole
1757 *
1758 * The ring buffer debug console aims to be a substitute for the UART debug
1759 * console. The debug console is implemented with two ring buffers in the
1760 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
1761 * and written to the buffers by the host via the MRQ interface.
1762 *
1763 * @{
1764 */
1765
1766/**
1767 * @brief Maximum number of bytes transferred in a single write command to the
1768 * BPMP
1769 *
1770 * This is determined by the number of free bytes in the message struct,
1771 * rounded down to a multiple of four.
1772 */
1773#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
1774
1775/**
1776 * @brief Maximum number of bytes transferred in a single read command to the
1777 * BPMP
1778 *
1779 * This is determined by the number of free bytes in the message struct,
1780 * rounded down to a multiple of four.
1781 */
1782#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
1783
1784enum mrq_ringbuf_console_host_to_bpmp_cmd {
1785 /**
1786 * @brief Check whether the BPMP driver supports the specified request
1787 * type
1788 *
1789 * mrq_response::err is 0 if the specified request is supported and
1790 * -#BPMP_ENODEV otherwise
1791 */
1792 CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
1793 /**
1794 * @brief Perform a read operation on the BPMP TX buffer
1795 *
1796 * mrq_response::err is 0
1797 */
1798 CMD_RINGBUF_CONSOLE_READ = 1,
1799 /**
1800 * @brief Perform a write operation on the BPMP RX buffer
1801 *
1802 * mrq_response::err is 0 if the operation was successful and
1803 * -#BPMP_ENODEV otherwise
1804 */
1805 CMD_RINGBUF_CONSOLE_WRITE = 2,
1806 /**
1807 * @brief Get the length of the buffer and the physical addresses of
1808 * the buffer data and the head and tail counters
1809 *
1810 * mrq_response::err is 0 if the operation was successful and
1811 * -#BPMP_ENODEV otherwise
1812 */
1813 CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
1814};
1815
1816/**
1817 * @ingroup RingbufConsole
1818 * @brief Host->BPMP request data for request type
1819 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
1820 */
1821struct cmd_ringbuf_console_query_abi_req {
1822 /** @brief Command identifier to be queried */
1823 uint32_t cmd;
1824} __ABI_PACKED;
1825
1826/** @private */
1827struct cmd_ringbuf_console_query_abi_resp {
1828 EMPTY
1829} __ABI_PACKED;
1830
1831/**
1832 * @ingroup RingbufConsole
1833 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
1834 */
1835struct cmd_ringbuf_console_read_req {
1836 /**
1837 * @brief Number of bytes requested to be read from the BPMP TX buffer
1838 */
1839 uint8_t len;
1840} __ABI_PACKED;
1841
1842/**
1843 * @ingroup RingbufConsole
1844 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
1845 */
1846struct cmd_ringbuf_console_read_resp {
1847 /** @brief The actual data read from the BPMP TX buffer */
1848 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
1849 /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
1850 uint8_t len;
1851} __ABI_PACKED;
1852
1853/**
1854 * @ingroup RingbufConsole
1855 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
1856 */
1857struct cmd_ringbuf_console_write_req {
1858 /** @brief The actual data to be written to the BPMP RX buffer */
1859 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
1860 /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
1861 uint8_t len;
1862} __ABI_PACKED;
1863
1864/**
1865 * @ingroup RingbufConsole
1866 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
1867 */
1868struct cmd_ringbuf_console_write_resp {
1869 /** @brief Number of bytes of available space in the BPMP RX buffer */
1870 uint32_t space_avail;
1871 /** @brief Number of bytes that were written to the BPMP RX buffer */
1872 uint8_t len;
1873} __ABI_PACKED;
1874
1875/** @private */
1876struct cmd_ringbuf_console_get_fifo_req {
1877 EMPTY
1878} __ABI_PACKED;
1879
1880/**
1881 * @ingroup RingbufConsole
1882 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
1883 */
1884struct cmd_ringbuf_console_get_fifo_resp {
1885 /** @brief Physical address of the BPMP TX buffer */
1886 uint64_t bpmp_tx_buf_addr;
1887 /** @brief Physical address of the BPMP TX buffer head counter */
1888 uint64_t bpmp_tx_head_addr;
1889 /** @brief Physical address of the BPMP TX buffer tail counter */
1890 uint64_t bpmp_tx_tail_addr;
1891 /** @brief Length of the BPMP TX buffer */
1892 uint32_t bpmp_tx_buf_len;
1893} __ABI_PACKED;
1894
1895/**
1896 * @ingroup RingbufConsole
1897 * @brief Host->BPMP request data.
1898 *
1899 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
1900 */
1901struct mrq_ringbuf_console_host_to_bpmp_request {
1902 /**
1903 * @brief type of request. Values listed in enum
1904 * #mrq_ringbuf_console_host_to_bpmp_cmd.
1905 */
1906 uint32_t type;
1907 /** @brief request type specific parameters. */
1908 union {
1909 struct cmd_ringbuf_console_query_abi_req query_abi;
1910 struct cmd_ringbuf_console_read_req read;
1911 struct cmd_ringbuf_console_write_req write;
1912 struct cmd_ringbuf_console_get_fifo_req get_fifo;
1913 } __UNION_ANON;
1914} __ABI_PACKED;
1915
1916/**
1917 * @ingroup RingbufConsole
1918 * @brief Host->BPMP reply data
1919 *
1920 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
1921 */
1922union mrq_ringbuf_console_bpmp_to_host_response {
1923 struct cmd_ringbuf_console_query_abi_resp query_abi;
1924 struct cmd_ringbuf_console_read_resp read;
1925 struct cmd_ringbuf_console_write_resp write;
1926 struct cmd_ringbuf_console_get_fifo_resp get_fifo;
1927} __ABI_PACKED;
1928/** @} */
1929
1532/* 1930/*
1533 * 4. Enumerations 1931 * 4. Enumerations
1534 */ 1932 */