19fff0425STomas Winkler /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 29fff0425STomas Winkler /* 3*1e55b609STomas Winkler * Copyright (c) 2013-2014, Intel Corporation. All rights reserved. 43da72212STomas Winkler * Intel Management Engine Interface (Intel MEI) Linux driver 59fff0425STomas Winkler */ 63da72212STomas Winkler #ifndef _MEI_HW_TXE_REGS_H_ 73da72212STomas Winkler #define _MEI_HW_TXE_REGS_H_ 83da72212STomas Winkler 93da72212STomas Winkler #include "hw.h" 103da72212STomas Winkler 113da72212STomas Winkler #define SEC_ALIVENESS_TIMER_TIMEOUT (5 * MSEC_PER_SEC) 123da72212STomas Winkler #define SEC_ALIVENESS_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 133da72212STomas Winkler #define SEC_RESET_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 143da72212STomas Winkler #define SEC_READY_WAIT_TIMEOUT (5 * MSEC_PER_SEC) 153da72212STomas Winkler #define START_MESSAGE_RESPONSE_WAIT_TIMEOUT (5 * MSEC_PER_SEC) 163da72212STomas Winkler #define RESET_CANCEL_WAIT_TIMEOUT (1 * MSEC_PER_SEC) 173da72212STomas Winkler 183da72212STomas Winkler enum { 193da72212STomas Winkler SEC_BAR, 203da72212STomas Winkler BRIDGE_BAR, 213da72212STomas Winkler 223da72212STomas Winkler NUM_OF_MEM_BARS 233da72212STomas Winkler }; 243da72212STomas Winkler 253da72212STomas Winkler /* SeC FW Status Register 263da72212STomas Winkler * 273da72212STomas Winkler * FW uses this register in order to report its status to host. 283da72212STomas Winkler * This register resides in PCI-E config space. 293da72212STomas Winkler */ 303da72212STomas Winkler #define PCI_CFG_TXE_FW_STS0 0x40 313da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_WRK_ST_MSK 0x0000000F 323da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_OP_ST_MSK 0x000001C0 333da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_FW_INIT_CMPLT 0x00000200 343da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_ERR_CODE_MSK 0x0000F000 353da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_OP_MODE_MSK 0x000F0000 363da72212STomas Winkler # define PCI_CFG_TXE_FW_STS0_RST_CNT_MSK 0x00F00000 3704dd3661SAlexander Usyskin #define PCI_CFG_TXE_FW_STS1 0x48 383da72212STomas Winkler 393da72212STomas Winkler #define IPC_BASE_ADDR 0x80400 /* SeC IPC Base Address */ 403da72212STomas Winkler 413da72212STomas Winkler /* IPC Input Doorbell Register */ 423da72212STomas Winkler #define SEC_IPC_INPUT_DOORBELL_REG (0x0000 + IPC_BASE_ADDR) 433da72212STomas Winkler 443da72212STomas Winkler /* IPC Input Status Register 453da72212STomas Winkler * This register indicates whether or not processing of 463da72212STomas Winkler * the most recent command has been completed by the SEC 473da72212STomas Winkler * New commands and payloads should not be written by the Host 483da72212STomas Winkler * until this indicates that the previous command has been processed. 493da72212STomas Winkler */ 503da72212STomas Winkler #define SEC_IPC_INPUT_STATUS_REG (0x0008 + IPC_BASE_ADDR) 513da72212STomas Winkler # define SEC_IPC_INPUT_STATUS_RDY BIT(0) 523da72212STomas Winkler 533da72212STomas Winkler /* IPC Host Interrupt Status Register */ 543da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_REG (0x0010 + IPC_BASE_ADDR) 553da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_OUT_DB BIT(0) 563da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_IN_RDY BIT(1) 573da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_HDCP_M0_RCVD BIT(5) 583da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_ILL_MEM_ACCESS BIT(17) 593da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_AES_HKEY_ERR BIT(18) 603da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_DES_HKEY_ERR BIT(19) 613da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_TMRMTB_OVERFLOW BIT(21) 623da72212STomas Winkler 633da72212STomas Winkler /* Convenient mask for pending interrupts */ 643da72212STomas Winkler #define SEC_IPC_HOST_INT_STATUS_PENDING \ 653da72212STomas Winkler (SEC_IPC_HOST_INT_STATUS_OUT_DB| \ 663da72212STomas Winkler SEC_IPC_HOST_INT_STATUS_IN_RDY) 673da72212STomas Winkler 683da72212STomas Winkler /* IPC Host Interrupt Mask Register */ 693da72212STomas Winkler #define SEC_IPC_HOST_INT_MASK_REG (0x0014 + IPC_BASE_ADDR) 703da72212STomas Winkler 713da72212STomas Winkler # define SEC_IPC_HOST_INT_MASK_OUT_DB BIT(0) /* Output Doorbell Int Mask */ 723da72212STomas Winkler # define SEC_IPC_HOST_INT_MASK_IN_RDY BIT(1) /* Input Ready Int Mask */ 733da72212STomas Winkler 743da72212STomas Winkler /* IPC Input Payload RAM */ 753da72212STomas Winkler #define SEC_IPC_INPUT_PAYLOAD_REG (0x0100 + IPC_BASE_ADDR) 763da72212STomas Winkler /* IPC Shared Payload RAM */ 773da72212STomas Winkler #define IPC_SHARED_PAYLOAD_REG (0x0200 + IPC_BASE_ADDR) 783da72212STomas Winkler 793da72212STomas Winkler /* SeC Address Translation Table Entry 2 - Ctrl 803da72212STomas Winkler * 813da72212STomas Winkler * This register resides also in SeC's PCI-E Memory space. 823da72212STomas Winkler */ 833da72212STomas Winkler #define SATT2_CTRL_REG 0x1040 843da72212STomas Winkler # define SATT2_CTRL_VALID_MSK BIT(0) 853da72212STomas Winkler # define SATT2_CTRL_BR_BASE_ADDR_REG_SHIFT 8 863da72212STomas Winkler # define SATT2_CTRL_BRIDGE_HOST_EN_MSK BIT(12) 873da72212STomas Winkler 883da72212STomas Winkler /* SATT Table Entry 2 SAP Base Address Register */ 893da72212STomas Winkler #define SATT2_SAP_BA_REG 0x1044 903da72212STomas Winkler /* SATT Table Entry 2 SAP Size Register. */ 913da72212STomas Winkler #define SATT2_SAP_SIZE_REG 0x1048 923da72212STomas Winkler /* SATT Table Entry 2 SAP Bridge Address - LSB Register */ 933da72212STomas Winkler #define SATT2_BRG_BA_LSB_REG 0x104C 943da72212STomas Winkler 953da72212STomas Winkler /* Host High-level Interrupt Status Register */ 963da72212STomas Winkler #define HHISR_REG 0x2020 973da72212STomas Winkler /* Host High-level Interrupt Enable Register 983da72212STomas Winkler * 993da72212STomas Winkler * Resides in PCI memory space. This is the top hierarchy for 1003da72212STomas Winkler * interrupts from SeC to host, aggregating both interrupts that 1013da72212STomas Winkler * arrive through HICR registers as well as interrupts 1023da72212STomas Winkler * that arrive via IPC. 1033da72212STomas Winkler */ 1043da72212STomas Winkler #define HHIER_REG 0x2024 1053da72212STomas Winkler #define IPC_HHIER_SEC BIT(0) 1063da72212STomas Winkler #define IPC_HHIER_BRIDGE BIT(1) 1073da72212STomas Winkler #define IPC_HHIER_MSK (IPC_HHIER_SEC | IPC_HHIER_BRIDGE) 1083da72212STomas Winkler 1093da72212STomas Winkler /* Host High-level Interrupt Mask Register. 1103da72212STomas Winkler * 1113da72212STomas Winkler * Resides in PCI memory space. 1123da72212STomas Winkler * This is the top hierarchy for masking interrupts from SeC to host. 1133da72212STomas Winkler */ 1143da72212STomas Winkler #define HHIMR_REG 0x2028 1153da72212STomas Winkler #define IPC_HHIMR_SEC BIT(0) 1163da72212STomas Winkler #define IPC_HHIMR_BRIDGE BIT(1) 1173da72212STomas Winkler 1183da72212STomas Winkler /* Host High-level IRQ Status Register */ 1193da72212STomas Winkler #define HHIRQSR_REG 0x202C 1203da72212STomas Winkler 1213da72212STomas Winkler /* Host Interrupt Cause Register 0 - SeC IPC Readiness 1223da72212STomas Winkler * 1233da72212STomas Winkler * This register is both an ICR to Host from PCI Memory Space 1243da72212STomas Winkler * and it is also exposed in the SeC memory space. 1253da72212STomas Winkler * This register is used by SeC's IPC driver in order 1263da72212STomas Winkler * to synchronize with host about IPC interface state. 1273da72212STomas Winkler */ 1283da72212STomas Winkler #define HICR_SEC_IPC_READINESS_REG 0x2040 1293da72212STomas Winkler #define HICR_SEC_IPC_READINESS_HOST_RDY BIT(0) 1303da72212STomas Winkler #define HICR_SEC_IPC_READINESS_SEC_RDY BIT(1) 1313da72212STomas Winkler #define HICR_SEC_IPC_READINESS_SYS_RDY \ 1323da72212STomas Winkler (HICR_SEC_IPC_READINESS_HOST_RDY | \ 1333da72212STomas Winkler HICR_SEC_IPC_READINESS_SEC_RDY) 1343da72212STomas Winkler #define HICR_SEC_IPC_READINESS_RDY_CLR BIT(2) 1353da72212STomas Winkler 1363da72212STomas Winkler /* Host Interrupt Cause Register 1 - Aliveness Response */ 1373da72212STomas Winkler /* This register is both an ICR to Host from PCI Memory Space 1383da72212STomas Winkler * and it is also exposed in the SeC memory space. 1393da72212STomas Winkler * The register may be used by SeC to ACK a host request for aliveness. 1403da72212STomas Winkler */ 1413da72212STomas Winkler #define HICR_HOST_ALIVENESS_RESP_REG 0x2044 1423da72212STomas Winkler #define HICR_HOST_ALIVENESS_RESP_ACK BIT(0) 1433da72212STomas Winkler 1443da72212STomas Winkler /* Host Interrupt Cause Register 2 - SeC IPC Output Doorbell */ 1453da72212STomas Winkler #define HICR_SEC_IPC_OUTPUT_DOORBELL_REG 0x2048 1463da72212STomas Winkler 1473da72212STomas Winkler /* Host Interrupt Status Register. 1483da72212STomas Winkler * 1493da72212STomas Winkler * Resides in PCI memory space. 1503da72212STomas Winkler * This is the main register involved in generating interrupts 1513da72212STomas Winkler * from SeC to host via HICRs. 1523da72212STomas Winkler * The interrupt generation rules are as follows: 1533da72212STomas Winkler * An interrupt will be generated whenever for any i, 1543da72212STomas Winkler * there is a transition from a state where at least one of 1553da72212STomas Winkler * the following conditions did not hold, to a state where 1563da72212STomas Winkler * ALL the following conditions hold: 1573da72212STomas Winkler * A) HISR.INT[i]_STS == 1. 1583da72212STomas Winkler * B) HIER.INT[i]_EN == 1. 1593da72212STomas Winkler */ 1603da72212STomas Winkler #define HISR_REG 0x2060 1613da72212STomas Winkler #define HISR_INT_0_STS BIT(0) 1623da72212STomas Winkler #define HISR_INT_1_STS BIT(1) 1633da72212STomas Winkler #define HISR_INT_2_STS BIT(2) 1643da72212STomas Winkler #define HISR_INT_3_STS BIT(3) 1653da72212STomas Winkler #define HISR_INT_4_STS BIT(4) 1663da72212STomas Winkler #define HISR_INT_5_STS BIT(5) 1673da72212STomas Winkler #define HISR_INT_6_STS BIT(6) 1683da72212STomas Winkler #define HISR_INT_7_STS BIT(7) 1693da72212STomas Winkler #define HISR_INT_STS_MSK \ 1703da72212STomas Winkler (HISR_INT_0_STS | HISR_INT_1_STS | HISR_INT_2_STS) 1713da72212STomas Winkler 1723da72212STomas Winkler /* Host Interrupt Enable Register. Resides in PCI memory space. */ 1733da72212STomas Winkler #define HIER_REG 0x2064 1743da72212STomas Winkler #define HIER_INT_0_EN BIT(0) 1753da72212STomas Winkler #define HIER_INT_1_EN BIT(1) 1763da72212STomas Winkler #define HIER_INT_2_EN BIT(2) 1773da72212STomas Winkler #define HIER_INT_3_EN BIT(3) 1783da72212STomas Winkler #define HIER_INT_4_EN BIT(4) 1793da72212STomas Winkler #define HIER_INT_5_EN BIT(5) 1803da72212STomas Winkler #define HIER_INT_6_EN BIT(6) 1813da72212STomas Winkler #define HIER_INT_7_EN BIT(7) 1823da72212STomas Winkler 1833da72212STomas Winkler #define HIER_INT_EN_MSK \ 1843da72212STomas Winkler (HIER_INT_0_EN | HIER_INT_1_EN | HIER_INT_2_EN) 1853da72212STomas Winkler 1863da72212STomas Winkler 1873da72212STomas Winkler /* SEC Memory Space IPC output payload. 1883da72212STomas Winkler * 1893da72212STomas Winkler * This register is part of the output payload which SEC provides to host. 1903da72212STomas Winkler */ 1913da72212STomas Winkler #define BRIDGE_IPC_OUTPUT_PAYLOAD_REG 0x20C0 1923da72212STomas Winkler 1933da72212STomas Winkler /* SeC Interrupt Cause Register - Host Aliveness Request 1943da72212STomas Winkler * This register is both an ICR to SeC and it is also exposed 1953da72212STomas Winkler * in the host-visible PCI memory space. 1963da72212STomas Winkler * The register is used by host to request SeC aliveness. 1973da72212STomas Winkler */ 1983da72212STomas Winkler #define SICR_HOST_ALIVENESS_REQ_REG 0x214C 1993da72212STomas Winkler #define SICR_HOST_ALIVENESS_REQ_REQUESTED BIT(0) 2003da72212STomas Winkler 2013da72212STomas Winkler 2023da72212STomas Winkler /* SeC Interrupt Cause Register - Host IPC Readiness 2033da72212STomas Winkler * 2043da72212STomas Winkler * This register is both an ICR to SeC and it is also exposed 2053da72212STomas Winkler * in the host-visible PCI memory space. 2063da72212STomas Winkler * This register is used by the host's SeC driver uses in order 2073da72212STomas Winkler * to synchronize with SeC about IPC interface state. 2083da72212STomas Winkler */ 2093da72212STomas Winkler #define SICR_HOST_IPC_READINESS_REQ_REG 0x2150 2103da72212STomas Winkler 2113da72212STomas Winkler 2123da72212STomas Winkler #define SICR_HOST_IPC_READINESS_HOST_RDY BIT(0) 2133da72212STomas Winkler #define SICR_HOST_IPC_READINESS_SEC_RDY BIT(1) 2143da72212STomas Winkler #define SICR_HOST_IPC_READINESS_SYS_RDY \ 2153da72212STomas Winkler (SICR_HOST_IPC_READINESS_HOST_RDY | \ 2163da72212STomas Winkler SICR_HOST_IPC_READINESS_SEC_RDY) 2173da72212STomas Winkler #define SICR_HOST_IPC_READINESS_RDY_CLR BIT(2) 2183da72212STomas Winkler 2193da72212STomas Winkler /* SeC Interrupt Cause Register - SeC IPC Output Status 2203da72212STomas Winkler * 2213da72212STomas Winkler * This register indicates whether or not processing of the most recent 2223da72212STomas Winkler * command has been completed by the Host. 2233da72212STomas Winkler * New commands and payloads should not be written by SeC until this 2243da72212STomas Winkler * register indicates that the previous command has been processed. 2253da72212STomas Winkler */ 2263da72212STomas Winkler #define SICR_SEC_IPC_OUTPUT_STATUS_REG 0x2154 2273da72212STomas Winkler # define SEC_IPC_OUTPUT_STATUS_RDY BIT(0) 2283da72212STomas Winkler 2293da72212STomas Winkler 2303da72212STomas Winkler 2313da72212STomas Winkler /* MEI IPC Message payload size 64 bytes */ 2323da72212STomas Winkler #define PAYLOAD_SIZE 64 2333da72212STomas Winkler 2343da72212STomas Winkler /* MAX size for SATT range 32MB */ 2353da72212STomas Winkler #define SATT_RANGE_MAX (32 << 20) 2363da72212STomas Winkler 2373da72212STomas Winkler 2383da72212STomas Winkler #endif /* _MEI_HW_TXE_REGS_H_ */ 2393da72212STomas Winkler 240