| 1 |
|
| 2 |
|
| 3 |
#ifndef __ACPI_IORT_H__ |
| 4 |
#define __ACPI_IORT_H__ |
| 5 |
|
| 6 |
#include <acpi/acpi.h> |
| 7 |
#include <types.h> |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
typedef struct acpi_table_iort { |
| 13 |
acpi_header_t header; |
| 14 |
u32 node_count; |
| 15 |
u32 node_offset; |
| 16 |
u32 reserved; |
| 17 |
} __packed acpi_iort_t; |
| 18 |
|
| 19 |
|
| 20 |
|
| 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 |
|
| 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 |
|
| 44 |
typedef struct acpi_iort_its_group { |
| 45 |
u32 its_count; |
| 46 |
u32 identifiers[]; |
| 47 |
} __packed acpi_iort_its_group_t; |
| 48 |
|
| 49 |
|
| 50 |
typedef struct acpi_iort_smmu_v3 { |
| 51 |
u64 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 |
|
| 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; |
| 72 |
u32 id_count; |
| 73 |
u32 output_base; |
| 74 |
u32 output_reference; |
| 75 |
u32 flags; |
| 76 |
} __packed acpi_iort_id_mapping_t; |
| 77 |
|
| 78 |
|
| 79 |
#define ACPI_IORT_ID_SINGLE_MAPPING (1) |
| 80 |
|
| 81 |
|
| 82 |
typedef struct acpi_iort_named_component { |
| 83 |
u32 node_flags; |
| 84 |
u64 memory_properties; |
| 85 |
u8 memory_address_limit; |
| 86 |
char device_name[]; |
| 87 |
} __packed acpi_iort_named_component_t; |
| 88 |
|
| 89 |
|
| 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; |
| 95 |
u32 ats_attribute; |
| 96 |
u32 pci_segment_number; |
| 97 |
u8 memory_address_limit; |
| 98 |
u16 pasid_capabilities; |
| 99 |
u8 reserved; |
| 100 |
u32 flags; |
| 101 |
} __packed acpi_iort_root_complex_t; |
| 102 |
|
| 103 |
|
| 104 |
#define ACPI_IORT_ATS_SUPPORTED (1) |
| 105 |
#define ACPI_IORT_PRI_SUPPORTED (1<<1) |
| 106 |
#define ACPI_IORT_PASID_FWD_SUPPORTED (1<<2) |
| 107 |
|
| 108 |
|
| 109 |
#define ACPI_IORT_PASID_MAX_WIDTH (0x1F) |
| 110 |
|
| 111 |
unsigned long acpi_soc_fill_iort(acpi_iort_t *iort, unsigned long current); |
| 112 |
|
| 113 |
|
| 114 |
unsigned long acpi_iort_its_entry(unsigned long current, acpi_iort_t *iort, acpi_iort_node_t **its, |
| 115 |
u32 its_count, u32 *identifiers); |
| 116 |
|
| 117 |
|
| 118 |
unsigned long acpi_iort_smmuv3_entry(unsigned long current, acpi_iort_t *iort, |
| 119 |
acpi_iort_node_t **smmu_v3, u64 base, u32 flags); |
| 120 |
|
| 121 |
|
| 122 |
unsigned long acpi_iort_id_map_entry(unsigned long current, acpi_iort_node_t *node, u32 input_base, |
| 123 |
u32 id_count, u32 output_base, u32 output_reference, |
| 124 |
u32 flags); |
| 125 |
|
| 126 |
|
| 127 |
unsigned long acpi_iort_nc_entry(unsigned long current, acpi_iort_t *iort, acpi_iort_node_t **nc, |
| 128 |
u32 node_flags, u64 memory_properties, u32 memory_address_limit, |
| 129 |
char *device_name); |
| 130 |
|
| 131 |
unsigned long acpi_iort_rc_entry(unsigned long current, acpi_iort_t *node, acpi_iort_node_t **rc, |
| 132 |
u64 memory_properties, u32 ats_attribute, u32 pci_segment_number, |
| 133 |
u8 memory_address_limit, u16 pasid_capabilities); |
| 134 |
|
| 135 |
#endif |