18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2013-2014, Intel Corporation. All rights reserved. 48c2ecf20Sopenharmony_ci * Intel Management Engine Interface (Intel MEI) Linux driver 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef _MEI_HW_TXE_REGS_H_ 78c2ecf20Sopenharmony_ci#define _MEI_HW_TXE_REGS_H_ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include "hw.h" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#define SEC_ALIVENESS_TIMER_TIMEOUT (5 * MSEC_PER_SEC) 128c2ecf20Sopenharmony_ci#define SEC_ALIVENESS_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 138c2ecf20Sopenharmony_ci#define SEC_RESET_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 148c2ecf20Sopenharmony_ci#define SEC_READY_WAIT_TIMEOUT (5 * MSEC_PER_SEC) 158c2ecf20Sopenharmony_ci#define START_MESSAGE_RESPONSE_WAIT_TIMEOUT (5 * MSEC_PER_SEC) 168c2ecf20Sopenharmony_ci#define RESET_CANCEL_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cienum { 198c2ecf20Sopenharmony_ci SEC_BAR, 208c2ecf20Sopenharmony_ci BRIDGE_BAR, 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci NUM_OF_MEM_BARS 238c2ecf20Sopenharmony_ci}; 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* SeC FW Status Register 268c2ecf20Sopenharmony_ci * 278c2ecf20Sopenharmony_ci * FW uses this register in order to report its status to host. 288c2ecf20Sopenharmony_ci * This register resides in PCI-E config space. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci#define PCI_CFG_TXE_FW_STS0 0x40 318c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_WRK_ST_MSK 0x0000000F 328c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_OP_ST_MSK 0x000001C0 338c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_FW_INIT_CMPLT 0x00000200 348c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_ERR_CODE_MSK 0x0000F000 358c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_OP_MODE_MSK 0x000F0000 368c2ecf20Sopenharmony_ci# define PCI_CFG_TXE_FW_STS0_RST_CNT_MSK 0x00F00000 378c2ecf20Sopenharmony_ci#define PCI_CFG_TXE_FW_STS1 0x48 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define IPC_BASE_ADDR 0x80400 /* SeC IPC Base Address */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* IPC Input Doorbell Register */ 428c2ecf20Sopenharmony_ci#define SEC_IPC_INPUT_DOORBELL_REG (0x0000 + IPC_BASE_ADDR) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci/* IPC Input Status Register 458c2ecf20Sopenharmony_ci * This register indicates whether or not processing of 468c2ecf20Sopenharmony_ci * the most recent command has been completed by the SEC 478c2ecf20Sopenharmony_ci * New commands and payloads should not be written by the Host 488c2ecf20Sopenharmony_ci * until this indicates that the previous command has been processed. 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci#define SEC_IPC_INPUT_STATUS_REG (0x0008 + IPC_BASE_ADDR) 518c2ecf20Sopenharmony_ci# define SEC_IPC_INPUT_STATUS_RDY BIT(0) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* IPC Host Interrupt Status Register */ 548c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_REG (0x0010 + IPC_BASE_ADDR) 558c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_OUT_DB BIT(0) 568c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_IN_RDY BIT(1) 578c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_HDCP_M0_RCVD BIT(5) 588c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_ILL_MEM_ACCESS BIT(17) 598c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_AES_HKEY_ERR BIT(18) 608c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_DES_HKEY_ERR BIT(19) 618c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_TMRMTB_OVERFLOW BIT(21) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* Convenient mask for pending interrupts */ 648c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_STATUS_PENDING \ 658c2ecf20Sopenharmony_ci (SEC_IPC_HOST_INT_STATUS_OUT_DB| \ 668c2ecf20Sopenharmony_ci SEC_IPC_HOST_INT_STATUS_IN_RDY) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* IPC Host Interrupt Mask Register */ 698c2ecf20Sopenharmony_ci#define SEC_IPC_HOST_INT_MASK_REG (0x0014 + IPC_BASE_ADDR) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci# define SEC_IPC_HOST_INT_MASK_OUT_DB BIT(0) /* Output Doorbell Int Mask */ 728c2ecf20Sopenharmony_ci# define SEC_IPC_HOST_INT_MASK_IN_RDY BIT(1) /* Input Ready Int Mask */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* IPC Input Payload RAM */ 758c2ecf20Sopenharmony_ci#define SEC_IPC_INPUT_PAYLOAD_REG (0x0100 + IPC_BASE_ADDR) 768c2ecf20Sopenharmony_ci/* IPC Shared Payload RAM */ 778c2ecf20Sopenharmony_ci#define IPC_SHARED_PAYLOAD_REG (0x0200 + IPC_BASE_ADDR) 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* SeC Address Translation Table Entry 2 - Ctrl 808c2ecf20Sopenharmony_ci * 818c2ecf20Sopenharmony_ci * This register resides also in SeC's PCI-E Memory space. 828c2ecf20Sopenharmony_ci */ 838c2ecf20Sopenharmony_ci#define SATT2_CTRL_REG 0x1040 848c2ecf20Sopenharmony_ci# define SATT2_CTRL_VALID_MSK BIT(0) 858c2ecf20Sopenharmony_ci# define SATT2_CTRL_BR_BASE_ADDR_REG_SHIFT 8 868c2ecf20Sopenharmony_ci# define SATT2_CTRL_BRIDGE_HOST_EN_MSK BIT(12) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* SATT Table Entry 2 SAP Base Address Register */ 898c2ecf20Sopenharmony_ci#define SATT2_SAP_BA_REG 0x1044 908c2ecf20Sopenharmony_ci/* SATT Table Entry 2 SAP Size Register. */ 918c2ecf20Sopenharmony_ci#define SATT2_SAP_SIZE_REG 0x1048 928c2ecf20Sopenharmony_ci /* SATT Table Entry 2 SAP Bridge Address - LSB Register */ 938c2ecf20Sopenharmony_ci#define SATT2_BRG_BA_LSB_REG 0x104C 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* Host High-level Interrupt Status Register */ 968c2ecf20Sopenharmony_ci#define HHISR_REG 0x2020 978c2ecf20Sopenharmony_ci/* Host High-level Interrupt Enable Register 988c2ecf20Sopenharmony_ci * 998c2ecf20Sopenharmony_ci * Resides in PCI memory space. This is the top hierarchy for 1008c2ecf20Sopenharmony_ci * interrupts from SeC to host, aggregating both interrupts that 1018c2ecf20Sopenharmony_ci * arrive through HICR registers as well as interrupts 1028c2ecf20Sopenharmony_ci * that arrive via IPC. 1038c2ecf20Sopenharmony_ci */ 1048c2ecf20Sopenharmony_ci#define HHIER_REG 0x2024 1058c2ecf20Sopenharmony_ci#define IPC_HHIER_SEC BIT(0) 1068c2ecf20Sopenharmony_ci#define IPC_HHIER_BRIDGE BIT(1) 1078c2ecf20Sopenharmony_ci#define IPC_HHIER_MSK (IPC_HHIER_SEC | IPC_HHIER_BRIDGE) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* Host High-level Interrupt Mask Register. 1108c2ecf20Sopenharmony_ci * 1118c2ecf20Sopenharmony_ci * Resides in PCI memory space. 1128c2ecf20Sopenharmony_ci * This is the top hierarchy for masking interrupts from SeC to host. 1138c2ecf20Sopenharmony_ci */ 1148c2ecf20Sopenharmony_ci#define HHIMR_REG 0x2028 1158c2ecf20Sopenharmony_ci#define IPC_HHIMR_SEC BIT(0) 1168c2ecf20Sopenharmony_ci#define IPC_HHIMR_BRIDGE BIT(1) 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci/* Host High-level IRQ Status Register */ 1198c2ecf20Sopenharmony_ci#define HHIRQSR_REG 0x202C 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* Host Interrupt Cause Register 0 - SeC IPC Readiness 1228c2ecf20Sopenharmony_ci * 1238c2ecf20Sopenharmony_ci * This register is both an ICR to Host from PCI Memory Space 1248c2ecf20Sopenharmony_ci * and it is also exposed in the SeC memory space. 1258c2ecf20Sopenharmony_ci * This register is used by SeC's IPC driver in order 1268c2ecf20Sopenharmony_ci * to synchronize with host about IPC interface state. 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_READINESS_REG 0x2040 1298c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_READINESS_HOST_RDY BIT(0) 1308c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_READINESS_SEC_RDY BIT(1) 1318c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_READINESS_SYS_RDY \ 1328c2ecf20Sopenharmony_ci (HICR_SEC_IPC_READINESS_HOST_RDY | \ 1338c2ecf20Sopenharmony_ci HICR_SEC_IPC_READINESS_SEC_RDY) 1348c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_READINESS_RDY_CLR BIT(2) 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci/* Host Interrupt Cause Register 1 - Aliveness Response */ 1378c2ecf20Sopenharmony_ci/* This register is both an ICR to Host from PCI Memory Space 1388c2ecf20Sopenharmony_ci * and it is also exposed in the SeC memory space. 1398c2ecf20Sopenharmony_ci * The register may be used by SeC to ACK a host request for aliveness. 1408c2ecf20Sopenharmony_ci */ 1418c2ecf20Sopenharmony_ci#define HICR_HOST_ALIVENESS_RESP_REG 0x2044 1428c2ecf20Sopenharmony_ci#define HICR_HOST_ALIVENESS_RESP_ACK BIT(0) 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* Host Interrupt Cause Register 2 - SeC IPC Output Doorbell */ 1458c2ecf20Sopenharmony_ci#define HICR_SEC_IPC_OUTPUT_DOORBELL_REG 0x2048 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* Host Interrupt Status Register. 1488c2ecf20Sopenharmony_ci * 1498c2ecf20Sopenharmony_ci * Resides in PCI memory space. 1508c2ecf20Sopenharmony_ci * This is the main register involved in generating interrupts 1518c2ecf20Sopenharmony_ci * from SeC to host via HICRs. 1528c2ecf20Sopenharmony_ci * The interrupt generation rules are as follows: 1538c2ecf20Sopenharmony_ci * An interrupt will be generated whenever for any i, 1548c2ecf20Sopenharmony_ci * there is a transition from a state where at least one of 1558c2ecf20Sopenharmony_ci * the following conditions did not hold, to a state where 1568c2ecf20Sopenharmony_ci * ALL the following conditions hold: 1578c2ecf20Sopenharmony_ci * A) HISR.INT[i]_STS == 1. 1588c2ecf20Sopenharmony_ci * B) HIER.INT[i]_EN == 1. 1598c2ecf20Sopenharmony_ci */ 1608c2ecf20Sopenharmony_ci#define HISR_REG 0x2060 1618c2ecf20Sopenharmony_ci#define HISR_INT_0_STS BIT(0) 1628c2ecf20Sopenharmony_ci#define HISR_INT_1_STS BIT(1) 1638c2ecf20Sopenharmony_ci#define HISR_INT_2_STS BIT(2) 1648c2ecf20Sopenharmony_ci#define HISR_INT_3_STS BIT(3) 1658c2ecf20Sopenharmony_ci#define HISR_INT_4_STS BIT(4) 1668c2ecf20Sopenharmony_ci#define HISR_INT_5_STS BIT(5) 1678c2ecf20Sopenharmony_ci#define HISR_INT_6_STS BIT(6) 1688c2ecf20Sopenharmony_ci#define HISR_INT_7_STS BIT(7) 1698c2ecf20Sopenharmony_ci#define HISR_INT_STS_MSK \ 1708c2ecf20Sopenharmony_ci (HISR_INT_0_STS | HISR_INT_1_STS | HISR_INT_2_STS) 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/* Host Interrupt Enable Register. Resides in PCI memory space. */ 1738c2ecf20Sopenharmony_ci#define HIER_REG 0x2064 1748c2ecf20Sopenharmony_ci#define HIER_INT_0_EN BIT(0) 1758c2ecf20Sopenharmony_ci#define HIER_INT_1_EN BIT(1) 1768c2ecf20Sopenharmony_ci#define HIER_INT_2_EN BIT(2) 1778c2ecf20Sopenharmony_ci#define HIER_INT_3_EN BIT(3) 1788c2ecf20Sopenharmony_ci#define HIER_INT_4_EN BIT(4) 1798c2ecf20Sopenharmony_ci#define HIER_INT_5_EN BIT(5) 1808c2ecf20Sopenharmony_ci#define HIER_INT_6_EN BIT(6) 1818c2ecf20Sopenharmony_ci#define HIER_INT_7_EN BIT(7) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define HIER_INT_EN_MSK \ 1848c2ecf20Sopenharmony_ci (HIER_INT_0_EN | HIER_INT_1_EN | HIER_INT_2_EN) 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci/* SEC Memory Space IPC output payload. 1888c2ecf20Sopenharmony_ci * 1898c2ecf20Sopenharmony_ci * This register is part of the output payload which SEC provides to host. 1908c2ecf20Sopenharmony_ci */ 1918c2ecf20Sopenharmony_ci#define BRIDGE_IPC_OUTPUT_PAYLOAD_REG 0x20C0 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci/* SeC Interrupt Cause Register - Host Aliveness Request 1948c2ecf20Sopenharmony_ci * This register is both an ICR to SeC and it is also exposed 1958c2ecf20Sopenharmony_ci * in the host-visible PCI memory space. 1968c2ecf20Sopenharmony_ci * The register is used by host to request SeC aliveness. 1978c2ecf20Sopenharmony_ci */ 1988c2ecf20Sopenharmony_ci#define SICR_HOST_ALIVENESS_REQ_REG 0x214C 1998c2ecf20Sopenharmony_ci#define SICR_HOST_ALIVENESS_REQ_REQUESTED BIT(0) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci/* SeC Interrupt Cause Register - Host IPC Readiness 2038c2ecf20Sopenharmony_ci * 2048c2ecf20Sopenharmony_ci * This register is both an ICR to SeC and it is also exposed 2058c2ecf20Sopenharmony_ci * in the host-visible PCI memory space. 2068c2ecf20Sopenharmony_ci * This register is used by the host's SeC driver uses in order 2078c2ecf20Sopenharmony_ci * to synchronize with SeC about IPC interface state. 2088c2ecf20Sopenharmony_ci */ 2098c2ecf20Sopenharmony_ci#define SICR_HOST_IPC_READINESS_REQ_REG 0x2150 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci#define SICR_HOST_IPC_READINESS_HOST_RDY BIT(0) 2138c2ecf20Sopenharmony_ci#define SICR_HOST_IPC_READINESS_SEC_RDY BIT(1) 2148c2ecf20Sopenharmony_ci#define SICR_HOST_IPC_READINESS_SYS_RDY \ 2158c2ecf20Sopenharmony_ci (SICR_HOST_IPC_READINESS_HOST_RDY | \ 2168c2ecf20Sopenharmony_ci SICR_HOST_IPC_READINESS_SEC_RDY) 2178c2ecf20Sopenharmony_ci#define SICR_HOST_IPC_READINESS_RDY_CLR BIT(2) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci/* SeC Interrupt Cause Register - SeC IPC Output Status 2208c2ecf20Sopenharmony_ci * 2218c2ecf20Sopenharmony_ci * This register indicates whether or not processing of the most recent 2228c2ecf20Sopenharmony_ci * command has been completed by the Host. 2238c2ecf20Sopenharmony_ci * New commands and payloads should not be written by SeC until this 2248c2ecf20Sopenharmony_ci * register indicates that the previous command has been processed. 2258c2ecf20Sopenharmony_ci */ 2268c2ecf20Sopenharmony_ci#define SICR_SEC_IPC_OUTPUT_STATUS_REG 0x2154 2278c2ecf20Sopenharmony_ci# define SEC_IPC_OUTPUT_STATUS_RDY BIT(0) 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/* MEI IPC Message payload size 64 bytes */ 2328c2ecf20Sopenharmony_ci#define PAYLOAD_SIZE 64 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/* MAX size for SATT range 32MB */ 2358c2ecf20Sopenharmony_ci#define SATT_RANGE_MAX (32 << 20) 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci#endif /* _MEI_HW_TXE_REGS_H_ */ 2398c2ecf20Sopenharmony_ci 240