1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef __ACPI_IORT_H__ 4 #define __ACPI_IORT_H__ 5 6 #include <acpi/acpi.h> 7 #include <types.h> 8 9 /* IORT - IO Remapping Table revision 6 10 * Document number: ARM DEN 0049E.e, Sep 2022 11 */ 12 typedef struct acpi_table_iort { 13 acpi_header_t header; /* Common ACPI table header */ 14 u32 node_count; 15 u32 node_offset; 16 u32 reserved; 17 } __packed acpi_iort_t; 18 19 /* 20 * IORT subtables 21 */ 22 typedef struct acpi_iort_node { 23 u8 type; 24 u16 length; 25 u8 revision; 26 u32 identifier; 27 u32 mapping_count; 28 u32 mapping_offset; 29 char node_data[]; 30 } __packed acpi_iort_node_t; 31 32 /* Values for subtable Type above */ 33 enum acpi_iort_node_type { 34 ACPI_IORT_NODE_ITS_GROUP = 0x00, 35 ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, 36 ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, 37 ACPI_IORT_NODE_SMMU = 0x03, 38 ACPI_IORT_NODE_SMMU_V3 = 0x04, 39 ACPI_IORT_NODE_PMCG = 0x05, 40 ACPI_IORT_NODE_RMR = 0x06, 41 }; 42 43 /* ITS Group revision 1 */ 44 typedef struct acpi_iort_its_group { 45 u32 its_count; 46 u32 identifiers[]; /* GIC ITS identifier array */ 47 } __packed acpi_iort_its_group_t; 48 49 /* SMMUv3 revision 5 */ 50 typedef struct acpi_iort_smmu_v3 { 51 u64 base_address; /* SMMUv3 base address */ 52 u32 flags; 53 u32 reserved; 54 u64 vatos_address; 55 u32 model; 56 u32 event_gsiv; 57 u32 pri_gsiv; 58 u32 gerr_gsiv; 59 u32 sync_gsiv; 60 u32 pxm; 61 u32 id_mapping_index; 62 } __packed acpi_iort_smmu_v3_t; 63 64 /* Masks for Flags field above */ 65 #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1) 66 #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (3<<1) 67 #define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3) 68 #define ACPI_IORT_SMMU_V3_DEVICEID_VALID (1<<4) 69 70 typedef struct acpi_iort_id_mapping { 71 u32 input_base; /* Lowest value in input range */ 72 u32 id_count; /* Number of IDs */ 73 u32 output_base; /* Lowest value in output range */ 74 u32 output_reference; /* A reference to the output node */ 75 u32 flags; 76 } __packed acpi_iort_id_mapping_t; 77 78 /* Masks for Flags field above for IORT subtable */ 79 #define ACPI_IORT_ID_SINGLE_MAPPING (1) 80 81 /* Named Component revision 4 */ 82 typedef struct acpi_iort_named_component { 83 u32 node_flags; 84 u64 memory_properties; /* Memory access properties */ 85 u8 memory_address_limit; /* Memory address size limit */ 86 char device_name[]; /* Path of namespace object */ 87 } __packed acpi_iort_named_component_t; 88 89 /* Masks for Flags field above */ 90 #define ACPI_IORT_NC_STALL_SUPPORTED (1) 91 #define ACPI_IORT_NC_PASID_BITS (31<<1) 92 93 typedef struct acpi_iort_root_complex { 94 u64 memory_properties; /* Memory access properties */ 95 u32 ats_attribute; 96 u32 pci_segment_number; 97 u8 memory_address_limit;/* Memory address size limit */ 98 u16 pasid_capabilities; /* PASID Capabilities */ 99 u8 reserved; /* Reserved, must be zero */ 100 u32 flags; /* Flags */ 101 } __packed acpi_iort_root_complex_t; 102 103 /* Masks for ats_attribute field above */ 104 #define ACPI_IORT_ATS_SUPPORTED (1) /* The root complex ATS support */ 105 #define ACPI_IORT_PRI_SUPPORTED (1<<1) /* The root complex PRI support */ 106 #define ACPI_IORT_PASID_FWD_SUPPORTED (1<<2) /* The root complex PASID forward support */ 107 108 /* Masks for pasid_capabilities field above */ 109 #define ACPI_IORT_PASID_MAX_WIDTH (0x1F) /* Bits 0-4 */ 110 111 unsigned long acpi_soc_fill_iort(acpi_iort_t *iort, unsigned long current); 112 113 #endif 114