18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2014 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifndef KFD_CRAT_H_INCLUDED
248c2ecf20Sopenharmony_ci#define KFD_CRAT_H_INCLUDED
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include <linux/types.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#pragma pack(1)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * 4CC signature values for the CRAT and CDIT ACPI tables
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define CRAT_SIGNATURE	"CRAT"
358c2ecf20Sopenharmony_ci#define CDIT_SIGNATURE	"CDIT"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci * Component Resource Association Table (CRAT)
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define CRAT_OEMID_LENGTH	6
428c2ecf20Sopenharmony_ci#define CRAT_OEMTABLEID_LENGTH	8
438c2ecf20Sopenharmony_ci#define CRAT_RESERVED_LENGTH	6
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define CRAT_OEMID_64BIT_MASK ((1ULL << (CRAT_OEMID_LENGTH * 8)) - 1)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Compute Unit flags */
488c2ecf20Sopenharmony_ci#define COMPUTE_UNIT_CPU	(1 << 0)  /* Create Virtual CRAT for CPU */
498c2ecf20Sopenharmony_ci#define COMPUTE_UNIT_GPU	(1 << 1)  /* Create Virtual CRAT for GPU */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistruct crat_header {
528c2ecf20Sopenharmony_ci	uint32_t	signature;
538c2ecf20Sopenharmony_ci	uint32_t	length;
548c2ecf20Sopenharmony_ci	uint8_t		revision;
558c2ecf20Sopenharmony_ci	uint8_t		checksum;
568c2ecf20Sopenharmony_ci	uint8_t		oem_id[CRAT_OEMID_LENGTH];
578c2ecf20Sopenharmony_ci	uint8_t		oem_table_id[CRAT_OEMTABLEID_LENGTH];
588c2ecf20Sopenharmony_ci	uint32_t	oem_revision;
598c2ecf20Sopenharmony_ci	uint32_t	creator_id;
608c2ecf20Sopenharmony_ci	uint32_t	creator_revision;
618c2ecf20Sopenharmony_ci	uint32_t	total_entries;
628c2ecf20Sopenharmony_ci	uint16_t	num_domains;
638c2ecf20Sopenharmony_ci	uint8_t		reserved[CRAT_RESERVED_LENGTH];
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/*
678c2ecf20Sopenharmony_ci * The header structure is immediately followed by total_entries of the
688c2ecf20Sopenharmony_ci * data definitions
698c2ecf20Sopenharmony_ci */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/*
728c2ecf20Sopenharmony_ci * The currently defined subtype entries in the CRAT
738c2ecf20Sopenharmony_ci */
748c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_COMPUTEUNIT_AFFINITY	0
758c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_MEMORY_AFFINITY		1
768c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_CACHE_AFFINITY		2
778c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_TLB_AFFINITY		3
788c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_CCOMPUTE_AFFINITY		4
798c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_IOLINK_AFFINITY		5
808c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_MAX			6
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define CRAT_SIBLINGMAP_SIZE	32
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/*
858c2ecf20Sopenharmony_ci * ComputeUnit Affinity structure and definitions
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_ENABLED		0x00000001
888c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_HOT_PLUGGABLE	0x00000002
898c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_CPU_PRESENT	0x00000004
908c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_GPU_PRESENT	0x00000008
918c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_IOMMU_PRESENT	0x00000010
928c2ecf20Sopenharmony_ci#define CRAT_CU_FLAGS_RESERVED		0xffffffe0
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define CRAT_COMPUTEUNIT_RESERVED_LENGTH 4
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistruct crat_subtype_computeunit {
978c2ecf20Sopenharmony_ci	uint8_t		type;
988c2ecf20Sopenharmony_ci	uint8_t		length;
998c2ecf20Sopenharmony_ci	uint16_t	reserved;
1008c2ecf20Sopenharmony_ci	uint32_t	flags;
1018c2ecf20Sopenharmony_ci	uint32_t	proximity_domain;
1028c2ecf20Sopenharmony_ci	uint32_t	processor_id_low;
1038c2ecf20Sopenharmony_ci	uint16_t	num_cpu_cores;
1048c2ecf20Sopenharmony_ci	uint16_t	num_simd_cores;
1058c2ecf20Sopenharmony_ci	uint16_t	max_waves_simd;
1068c2ecf20Sopenharmony_ci	uint16_t	io_count;
1078c2ecf20Sopenharmony_ci	uint16_t	hsa_capability;
1088c2ecf20Sopenharmony_ci	uint16_t	lds_size_in_kb;
1098c2ecf20Sopenharmony_ci	uint8_t		wave_front_size;
1108c2ecf20Sopenharmony_ci	uint8_t		num_banks;
1118c2ecf20Sopenharmony_ci	uint16_t	micro_engine_id;
1128c2ecf20Sopenharmony_ci	uint8_t		array_count;
1138c2ecf20Sopenharmony_ci	uint8_t		num_cu_per_array;
1148c2ecf20Sopenharmony_ci	uint8_t		num_simd_per_cu;
1158c2ecf20Sopenharmony_ci	uint8_t		max_slots_scatch_cu;
1168c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_COMPUTEUNIT_RESERVED_LENGTH];
1178c2ecf20Sopenharmony_ci};
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/*
1208c2ecf20Sopenharmony_ci * HSA Memory Affinity structure and definitions
1218c2ecf20Sopenharmony_ci */
1228c2ecf20Sopenharmony_ci#define CRAT_MEM_FLAGS_ENABLED		0x00000001
1238c2ecf20Sopenharmony_ci#define CRAT_MEM_FLAGS_HOT_PLUGGABLE	0x00000002
1248c2ecf20Sopenharmony_ci#define CRAT_MEM_FLAGS_NON_VOLATILE	0x00000004
1258c2ecf20Sopenharmony_ci#define CRAT_MEM_FLAGS_RESERVED		0xfffffff8
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define CRAT_MEMORY_RESERVED_LENGTH 8
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cistruct crat_subtype_memory {
1308c2ecf20Sopenharmony_ci	uint8_t		type;
1318c2ecf20Sopenharmony_ci	uint8_t		length;
1328c2ecf20Sopenharmony_ci	uint16_t	reserved;
1338c2ecf20Sopenharmony_ci	uint32_t	flags;
1348c2ecf20Sopenharmony_ci	uint32_t	proximity_domain;
1358c2ecf20Sopenharmony_ci	uint32_t	base_addr_low;
1368c2ecf20Sopenharmony_ci	uint32_t	base_addr_high;
1378c2ecf20Sopenharmony_ci	uint32_t	length_low;
1388c2ecf20Sopenharmony_ci	uint32_t	length_high;
1398c2ecf20Sopenharmony_ci	uint32_t	width;
1408c2ecf20Sopenharmony_ci	uint8_t		visibility_type; /* for virtual (dGPU) CRAT */
1418c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_MEMORY_RESERVED_LENGTH - 1];
1428c2ecf20Sopenharmony_ci};
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/*
1458c2ecf20Sopenharmony_ci * HSA Cache Affinity structure and definitions
1468c2ecf20Sopenharmony_ci */
1478c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_ENABLED	0x00000001
1488c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_DATA_CACHE	0x00000002
1498c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_INST_CACHE	0x00000004
1508c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_CPU_CACHE	0x00000008
1518c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_SIMD_CACHE	0x00000010
1528c2ecf20Sopenharmony_ci#define CRAT_CACHE_FLAGS_RESERVED	0xffffffe0
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci#define CRAT_CACHE_RESERVED_LENGTH 8
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistruct crat_subtype_cache {
1578c2ecf20Sopenharmony_ci	uint8_t		type;
1588c2ecf20Sopenharmony_ci	uint8_t		length;
1598c2ecf20Sopenharmony_ci	uint16_t	reserved;
1608c2ecf20Sopenharmony_ci	uint32_t	flags;
1618c2ecf20Sopenharmony_ci	uint32_t	processor_id_low;
1628c2ecf20Sopenharmony_ci	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1638c2ecf20Sopenharmony_ci	uint32_t	cache_size;
1648c2ecf20Sopenharmony_ci	uint8_t		cache_level;
1658c2ecf20Sopenharmony_ci	uint8_t		lines_per_tag;
1668c2ecf20Sopenharmony_ci	uint16_t	cache_line_size;
1678c2ecf20Sopenharmony_ci	uint8_t		associativity;
1688c2ecf20Sopenharmony_ci	uint8_t		cache_properties;
1698c2ecf20Sopenharmony_ci	uint16_t	cache_latency;
1708c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_CACHE_RESERVED_LENGTH];
1718c2ecf20Sopenharmony_ci};
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/*
1748c2ecf20Sopenharmony_ci * HSA TLB Affinity structure and definitions
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_ENABLED	0x00000001
1778c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_DATA_TLB	0x00000002
1788c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_INST_TLB	0x00000004
1798c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_CPU_TLB	0x00000008
1808c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_SIMD_TLB	0x00000010
1818c2ecf20Sopenharmony_ci#define CRAT_TLB_FLAGS_RESERVED	0xffffffe0
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define CRAT_TLB_RESERVED_LENGTH 4
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistruct crat_subtype_tlb {
1868c2ecf20Sopenharmony_ci	uint8_t		type;
1878c2ecf20Sopenharmony_ci	uint8_t		length;
1888c2ecf20Sopenharmony_ci	uint16_t	reserved;
1898c2ecf20Sopenharmony_ci	uint32_t	flags;
1908c2ecf20Sopenharmony_ci	uint32_t	processor_id_low;
1918c2ecf20Sopenharmony_ci	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
1928c2ecf20Sopenharmony_ci	uint32_t	tlb_level;
1938c2ecf20Sopenharmony_ci	uint8_t		data_tlb_associativity_2mb;
1948c2ecf20Sopenharmony_ci	uint8_t		data_tlb_size_2mb;
1958c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_associativity_2mb;
1968c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_size_2mb;
1978c2ecf20Sopenharmony_ci	uint8_t		data_tlb_associativity_4k;
1988c2ecf20Sopenharmony_ci	uint8_t		data_tlb_size_4k;
1998c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_associativity_4k;
2008c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_size_4k;
2018c2ecf20Sopenharmony_ci	uint8_t		data_tlb_associativity_1gb;
2028c2ecf20Sopenharmony_ci	uint8_t		data_tlb_size_1gb;
2038c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_associativity_1gb;
2048c2ecf20Sopenharmony_ci	uint8_t		instruction_tlb_size_1gb;
2058c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_TLB_RESERVED_LENGTH];
2068c2ecf20Sopenharmony_ci};
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/*
2098c2ecf20Sopenharmony_ci * HSA CCompute/APU Affinity structure and definitions
2108c2ecf20Sopenharmony_ci */
2118c2ecf20Sopenharmony_ci#define CRAT_CCOMPUTE_FLAGS_ENABLED	0x00000001
2128c2ecf20Sopenharmony_ci#define CRAT_CCOMPUTE_FLAGS_RESERVED	0xfffffffe
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci#define CRAT_CCOMPUTE_RESERVED_LENGTH 16
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistruct crat_subtype_ccompute {
2178c2ecf20Sopenharmony_ci	uint8_t		type;
2188c2ecf20Sopenharmony_ci	uint8_t		length;
2198c2ecf20Sopenharmony_ci	uint16_t	reserved;
2208c2ecf20Sopenharmony_ci	uint32_t	flags;
2218c2ecf20Sopenharmony_ci	uint32_t	processor_id_low;
2228c2ecf20Sopenharmony_ci	uint8_t		sibling_map[CRAT_SIBLINGMAP_SIZE];
2238c2ecf20Sopenharmony_ci	uint32_t	apu_size;
2248c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_CCOMPUTE_RESERVED_LENGTH];
2258c2ecf20Sopenharmony_ci};
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/*
2288c2ecf20Sopenharmony_ci * HSA IO Link Affinity structure and definitions
2298c2ecf20Sopenharmony_ci */
2308c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_ENABLED		(1 << 0)
2318c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_NON_COHERENT		(1 << 1)
2328c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT	(1 << 2)
2338c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT	(1 << 3)
2348c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_NO_PEER_TO_PEER_DMA	(1 << 4)
2358c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL 	(1 << 31)
2368c2ecf20Sopenharmony_ci#define CRAT_IOLINK_FLAGS_RESERVED_MASK		0x7fffffe0
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/*
2398c2ecf20Sopenharmony_ci * IO interface types
2408c2ecf20Sopenharmony_ci */
2418c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_UNDEFINED	0
2428c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_HYPERTRANSPORT	1
2438c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_PCIEXPRESS	2
2448c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_AMBA		3
2458c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_MIPI		4
2468c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_QPI_1_1	5
2478c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_RESERVED1	6
2488c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_RESERVED2	7
2498c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_RAPID_IO	8
2508c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_INFINIBAND	9
2518c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_RESERVED3	10
2528c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_XGMI		11
2538c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_XGOP		12
2548c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_GZ		13
2558c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_ETHERNET_RDMA	14
2568c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_RDMA_OTHER	15
2578c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_OTHER		16
2588c2ecf20Sopenharmony_ci#define CRAT_IOLINK_TYPE_MAX		255
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#define CRAT_IOLINK_RESERVED_LENGTH	24
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_cistruct crat_subtype_iolink {
2638c2ecf20Sopenharmony_ci	uint8_t		type;
2648c2ecf20Sopenharmony_ci	uint8_t		length;
2658c2ecf20Sopenharmony_ci	uint16_t	reserved;
2668c2ecf20Sopenharmony_ci	uint32_t	flags;
2678c2ecf20Sopenharmony_ci	uint32_t	proximity_domain_from;
2688c2ecf20Sopenharmony_ci	uint32_t	proximity_domain_to;
2698c2ecf20Sopenharmony_ci	uint8_t		io_interface_type;
2708c2ecf20Sopenharmony_ci	uint8_t		version_major;
2718c2ecf20Sopenharmony_ci	uint16_t	version_minor;
2728c2ecf20Sopenharmony_ci	uint32_t	minimum_latency;
2738c2ecf20Sopenharmony_ci	uint32_t	maximum_latency;
2748c2ecf20Sopenharmony_ci	uint32_t	minimum_bandwidth_mbs;
2758c2ecf20Sopenharmony_ci	uint32_t	maximum_bandwidth_mbs;
2768c2ecf20Sopenharmony_ci	uint32_t	recommended_transfer_size;
2778c2ecf20Sopenharmony_ci	uint8_t		reserved2[CRAT_IOLINK_RESERVED_LENGTH - 1];
2788c2ecf20Sopenharmony_ci	uint8_t		num_hops_xgmi;
2798c2ecf20Sopenharmony_ci};
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci/*
2828c2ecf20Sopenharmony_ci * HSA generic sub-type header
2838c2ecf20Sopenharmony_ci */
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci#define CRAT_SUBTYPE_FLAGS_ENABLED 0x00000001
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_cistruct crat_subtype_generic {
2888c2ecf20Sopenharmony_ci	uint8_t		type;
2898c2ecf20Sopenharmony_ci	uint8_t		length;
2908c2ecf20Sopenharmony_ci	uint16_t	reserved;
2918c2ecf20Sopenharmony_ci	uint32_t	flags;
2928c2ecf20Sopenharmony_ci};
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/*
2958c2ecf20Sopenharmony_ci * Component Locality Distance Information Table (CDIT)
2968c2ecf20Sopenharmony_ci */
2978c2ecf20Sopenharmony_ci#define CDIT_OEMID_LENGTH	6
2988c2ecf20Sopenharmony_ci#define CDIT_OEMTABLEID_LENGTH	8
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_cistruct cdit_header {
3018c2ecf20Sopenharmony_ci	uint32_t	signature;
3028c2ecf20Sopenharmony_ci	uint32_t	length;
3038c2ecf20Sopenharmony_ci	uint8_t		revision;
3048c2ecf20Sopenharmony_ci	uint8_t		checksum;
3058c2ecf20Sopenharmony_ci	uint8_t		oem_id[CDIT_OEMID_LENGTH];
3068c2ecf20Sopenharmony_ci	uint8_t		oem_table_id[CDIT_OEMTABLEID_LENGTH];
3078c2ecf20Sopenharmony_ci	uint32_t	oem_revision;
3088c2ecf20Sopenharmony_ci	uint32_t	creator_id;
3098c2ecf20Sopenharmony_ci	uint32_t	creator_revision;
3108c2ecf20Sopenharmony_ci	uint32_t	total_entries;
3118c2ecf20Sopenharmony_ci	uint16_t	num_domains;
3128c2ecf20Sopenharmony_ci	uint8_t		entry[1];
3138c2ecf20Sopenharmony_ci};
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci#pragma pack()
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistruct kfd_dev;
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ciint kfd_create_crat_image_acpi(void **crat_image, size_t *size);
3208c2ecf20Sopenharmony_civoid kfd_destroy_crat_image(void *crat_image);
3218c2ecf20Sopenharmony_ciint kfd_parse_crat_table(void *crat_image, struct list_head *device_list,
3228c2ecf20Sopenharmony_ci			 uint32_t proximity_domain);
3238c2ecf20Sopenharmony_ciint kfd_create_crat_image_virtual(void **crat_image, size_t *size,
3248c2ecf20Sopenharmony_ci				  int flags, struct kfd_dev *kdev,
3258c2ecf20Sopenharmony_ci				  uint32_t proximity_domain);
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci#endif /* KFD_CRAT_H_INCLUDED */
328