18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_APICDEF_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_APICDEF_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Alan Cox <Alan.Cox@linux.org>, 1995.
98c2ecf20Sopenharmony_ci * Ingo Molnar <mingo@redhat.com>, 1999, 2000
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define IO_APIC_DEFAULT_PHYS_BASE	0xfec00000
138c2ecf20Sopenharmony_ci#define	APIC_DEFAULT_PHYS_BASE		0xfee00000
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * This is the IO-APIC register space as specified
178c2ecf20Sopenharmony_ci * by Intel docs:
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci#define IO_APIC_SLOT_SIZE		1024
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define	APIC_ID		0x20
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define	APIC_LVR	0x30
248c2ecf20Sopenharmony_ci#define		APIC_LVR_MASK		0xFF00FF
258c2ecf20Sopenharmony_ci#define		APIC_LVR_DIRECTED_EOI	(1 << 24)
268c2ecf20Sopenharmony_ci#define		GET_APIC_VERSION(x)	((x) & 0xFFu)
278c2ecf20Sopenharmony_ci#define		GET_APIC_MAXLVT(x)	(((x) >> 16) & 0xFFu)
288c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
298c2ecf20Sopenharmony_ci#  define	APIC_INTEGRATED(x)	((x) & 0xF0u)
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_ci#  define	APIC_INTEGRATED(x)	(1)
328c2ecf20Sopenharmony_ci#endif
338c2ecf20Sopenharmony_ci#define		APIC_XAPIC(x)		((x) >= 0x14)
348c2ecf20Sopenharmony_ci#define		APIC_EXT_SPACE(x)	((x) & 0x80000000)
358c2ecf20Sopenharmony_ci#define	APIC_TASKPRI	0x80
368c2ecf20Sopenharmony_ci#define		APIC_TPRI_MASK		0xFFu
378c2ecf20Sopenharmony_ci#define	APIC_ARBPRI	0x90
388c2ecf20Sopenharmony_ci#define		APIC_ARBPRI_MASK	0xFFu
398c2ecf20Sopenharmony_ci#define	APIC_PROCPRI	0xA0
408c2ecf20Sopenharmony_ci#define	APIC_EOI	0xB0
418c2ecf20Sopenharmony_ci#define		APIC_EOI_ACK		0x0 /* Docs say 0 for future compat. */
428c2ecf20Sopenharmony_ci#define	APIC_RRR	0xC0
438c2ecf20Sopenharmony_ci#define	APIC_LDR	0xD0
448c2ecf20Sopenharmony_ci#define		APIC_LDR_MASK		(0xFFu << 24)
458c2ecf20Sopenharmony_ci#define		GET_APIC_LOGICAL_ID(x)	(((x) >> 24) & 0xFFu)
468c2ecf20Sopenharmony_ci#define		SET_APIC_LOGICAL_ID(x)	(((x) << 24))
478c2ecf20Sopenharmony_ci#define		APIC_ALL_CPUS		0xFFu
488c2ecf20Sopenharmony_ci#define	APIC_DFR	0xE0
498c2ecf20Sopenharmony_ci#define		APIC_DFR_CLUSTER		0x0FFFFFFFul
508c2ecf20Sopenharmony_ci#define		APIC_DFR_FLAT			0xFFFFFFFFul
518c2ecf20Sopenharmony_ci#define	APIC_SPIV	0xF0
528c2ecf20Sopenharmony_ci#define		APIC_SPIV_DIRECTED_EOI		(1 << 12)
538c2ecf20Sopenharmony_ci#define		APIC_SPIV_FOCUS_DISABLED	(1 << 9)
548c2ecf20Sopenharmony_ci#define		APIC_SPIV_APIC_ENABLED		(1 << 8)
558c2ecf20Sopenharmony_ci#define	APIC_ISR	0x100
568c2ecf20Sopenharmony_ci#define	APIC_ISR_NR     0x8     /* Number of 32 bit ISR registers. */
578c2ecf20Sopenharmony_ci#define	APIC_TMR	0x180
588c2ecf20Sopenharmony_ci#define	APIC_IRR	0x200
598c2ecf20Sopenharmony_ci#define	APIC_ESR	0x280
608c2ecf20Sopenharmony_ci#define		APIC_ESR_SEND_CS	0x00001
618c2ecf20Sopenharmony_ci#define		APIC_ESR_RECV_CS	0x00002
628c2ecf20Sopenharmony_ci#define		APIC_ESR_SEND_ACC	0x00004
638c2ecf20Sopenharmony_ci#define		APIC_ESR_RECV_ACC	0x00008
648c2ecf20Sopenharmony_ci#define		APIC_ESR_SENDILL	0x00020
658c2ecf20Sopenharmony_ci#define		APIC_ESR_RECVILL	0x00040
668c2ecf20Sopenharmony_ci#define		APIC_ESR_ILLREGA	0x00080
678c2ecf20Sopenharmony_ci#define 	APIC_LVTCMCI	0x2f0
688c2ecf20Sopenharmony_ci#define	APIC_ICR	0x300
698c2ecf20Sopenharmony_ci#define		APIC_DEST_SELF		0x40000
708c2ecf20Sopenharmony_ci#define		APIC_DEST_ALLINC	0x80000
718c2ecf20Sopenharmony_ci#define		APIC_DEST_ALLBUT	0xC0000
728c2ecf20Sopenharmony_ci#define		APIC_ICR_RR_MASK	0x30000
738c2ecf20Sopenharmony_ci#define		APIC_ICR_RR_INVALID	0x00000
748c2ecf20Sopenharmony_ci#define		APIC_ICR_RR_INPROG	0x10000
758c2ecf20Sopenharmony_ci#define		APIC_ICR_RR_VALID	0x20000
768c2ecf20Sopenharmony_ci#define		APIC_INT_LEVELTRIG	0x08000
778c2ecf20Sopenharmony_ci#define		APIC_INT_ASSERT		0x04000
788c2ecf20Sopenharmony_ci#define		APIC_ICR_BUSY		0x01000
798c2ecf20Sopenharmony_ci#define		APIC_DEST_LOGICAL	0x00800
808c2ecf20Sopenharmony_ci#define		APIC_DEST_PHYSICAL	0x00000
818c2ecf20Sopenharmony_ci#define		APIC_DM_FIXED		0x00000
828c2ecf20Sopenharmony_ci#define		APIC_DM_FIXED_MASK	0x00700
838c2ecf20Sopenharmony_ci#define		APIC_DM_LOWEST		0x00100
848c2ecf20Sopenharmony_ci#define		APIC_DM_SMI		0x00200
858c2ecf20Sopenharmony_ci#define		APIC_DM_REMRD		0x00300
868c2ecf20Sopenharmony_ci#define		APIC_DM_NMI		0x00400
878c2ecf20Sopenharmony_ci#define		APIC_DM_INIT		0x00500
888c2ecf20Sopenharmony_ci#define		APIC_DM_STARTUP		0x00600
898c2ecf20Sopenharmony_ci#define		APIC_DM_EXTINT		0x00700
908c2ecf20Sopenharmony_ci#define		APIC_VECTOR_MASK	0x000FF
918c2ecf20Sopenharmony_ci#define	APIC_ICR2	0x310
928c2ecf20Sopenharmony_ci#define		GET_APIC_DEST_FIELD(x)	(((x) >> 24) & 0xFF)
938c2ecf20Sopenharmony_ci#define		SET_APIC_DEST_FIELD(x)	((x) << 24)
948c2ecf20Sopenharmony_ci#define	APIC_LVTT	0x320
958c2ecf20Sopenharmony_ci#define	APIC_LVTTHMR	0x330
968c2ecf20Sopenharmony_ci#define	APIC_LVTPC	0x340
978c2ecf20Sopenharmony_ci#define	APIC_LVT0	0x350
988c2ecf20Sopenharmony_ci#define		APIC_LVT_TIMER_BASE_MASK	(0x3 << 18)
998c2ecf20Sopenharmony_ci#define		GET_APIC_TIMER_BASE(x)		(((x) >> 18) & 0x3)
1008c2ecf20Sopenharmony_ci#define		SET_APIC_TIMER_BASE(x)		(((x) << 18))
1018c2ecf20Sopenharmony_ci#define		APIC_TIMER_BASE_CLKIN		0x0
1028c2ecf20Sopenharmony_ci#define		APIC_TIMER_BASE_TMBASE		0x1
1038c2ecf20Sopenharmony_ci#define		APIC_TIMER_BASE_DIV		0x2
1048c2ecf20Sopenharmony_ci#define		APIC_LVT_TIMER_ONESHOT		(0 << 17)
1058c2ecf20Sopenharmony_ci#define		APIC_LVT_TIMER_PERIODIC		(1 << 17)
1068c2ecf20Sopenharmony_ci#define		APIC_LVT_TIMER_TSCDEADLINE	(2 << 17)
1078c2ecf20Sopenharmony_ci#define		APIC_LVT_MASKED			(1 << 16)
1088c2ecf20Sopenharmony_ci#define		APIC_LVT_LEVEL_TRIGGER		(1 << 15)
1098c2ecf20Sopenharmony_ci#define		APIC_LVT_REMOTE_IRR		(1 << 14)
1108c2ecf20Sopenharmony_ci#define		APIC_INPUT_POLARITY		(1 << 13)
1118c2ecf20Sopenharmony_ci#define		APIC_SEND_PENDING		(1 << 12)
1128c2ecf20Sopenharmony_ci#define		APIC_MODE_MASK			0x700
1138c2ecf20Sopenharmony_ci#define		GET_APIC_DELIVERY_MODE(x)	(((x) >> 8) & 0x7)
1148c2ecf20Sopenharmony_ci#define		SET_APIC_DELIVERY_MODE(x, y)	(((x) & ~0x700) | ((y) << 8))
1158c2ecf20Sopenharmony_ci#define			APIC_MODE_FIXED		0x0
1168c2ecf20Sopenharmony_ci#define			APIC_MODE_NMI		0x4
1178c2ecf20Sopenharmony_ci#define			APIC_MODE_EXTINT	0x7
1188c2ecf20Sopenharmony_ci#define	APIC_LVT1	0x360
1198c2ecf20Sopenharmony_ci#define	APIC_LVTERR	0x370
1208c2ecf20Sopenharmony_ci#define	APIC_TMICT	0x380
1218c2ecf20Sopenharmony_ci#define	APIC_TMCCT	0x390
1228c2ecf20Sopenharmony_ci#define	APIC_TDCR	0x3E0
1238c2ecf20Sopenharmony_ci#define APIC_SELF_IPI	0x3F0
1248c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_TMBASE	(1 << 2)
1258c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_1		0xB
1268c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_2		0x0
1278c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_4		0x1
1288c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_8		0x2
1298c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_16		0x3
1308c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_32		0x8
1318c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_64		0x9
1328c2ecf20Sopenharmony_ci#define		APIC_TDR_DIV_128	0xA
1338c2ecf20Sopenharmony_ci#define	APIC_EFEAT	0x400
1348c2ecf20Sopenharmony_ci#define	APIC_ECTRL	0x410
1358c2ecf20Sopenharmony_ci#define APIC_EILVTn(n)	(0x500 + 0x10 * n)
1368c2ecf20Sopenharmony_ci#define		APIC_EILVT_NR_AMD_K8	1	/* # of extended interrupts */
1378c2ecf20Sopenharmony_ci#define		APIC_EILVT_NR_AMD_10H	4
1388c2ecf20Sopenharmony_ci#define		APIC_EILVT_NR_MAX	APIC_EILVT_NR_AMD_10H
1398c2ecf20Sopenharmony_ci#define		APIC_EILVT_LVTOFF(x)	(((x) >> 4) & 0xF)
1408c2ecf20Sopenharmony_ci#define		APIC_EILVT_MSG_FIX	0x0
1418c2ecf20Sopenharmony_ci#define		APIC_EILVT_MSG_SMI	0x2
1428c2ecf20Sopenharmony_ci#define		APIC_EILVT_MSG_NMI	0x4
1438c2ecf20Sopenharmony_ci#define		APIC_EILVT_MSG_EXT	0x7
1448c2ecf20Sopenharmony_ci#define		APIC_EILVT_MASKED	(1 << 16)
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
1478c2ecf20Sopenharmony_ci#define APIC_BASE_MSR	0x800
1488c2ecf20Sopenharmony_ci#define XAPIC_ENABLE	(1UL << 11)
1498c2ecf20Sopenharmony_ci#define X2APIC_ENABLE	(1UL << 10)
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
1528c2ecf20Sopenharmony_ci# define MAX_IO_APICS 64
1538c2ecf20Sopenharmony_ci# define MAX_LOCAL_APIC 256
1548c2ecf20Sopenharmony_ci#else
1558c2ecf20Sopenharmony_ci# define MAX_IO_APICS 128
1568c2ecf20Sopenharmony_ci# define MAX_LOCAL_APIC 32768
1578c2ecf20Sopenharmony_ci#endif
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/*
1608c2ecf20Sopenharmony_ci * All x86-64 systems are xAPIC compatible.
1618c2ecf20Sopenharmony_ci * In the following, "apicid" is a physical APIC ID.
1628c2ecf20Sopenharmony_ci */
1638c2ecf20Sopenharmony_ci#define XAPIC_DEST_CPUS_SHIFT	4
1648c2ecf20Sopenharmony_ci#define XAPIC_DEST_CPUS_MASK	((1u << XAPIC_DEST_CPUS_SHIFT) - 1)
1658c2ecf20Sopenharmony_ci#define XAPIC_DEST_CLUSTER_MASK	(XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT)
1668c2ecf20Sopenharmony_ci#define APIC_CLUSTER(apicid)	((apicid) & XAPIC_DEST_CLUSTER_MASK)
1678c2ecf20Sopenharmony_ci#define APIC_CLUSTERID(apicid)	(APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT)
1688c2ecf20Sopenharmony_ci#define APIC_CPUID(apicid)	((apicid) & XAPIC_DEST_CPUS_MASK)
1698c2ecf20Sopenharmony_ci#define NUM_APIC_CLUSTERS	((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT)
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/*
1728c2ecf20Sopenharmony_ci * the local APIC register structure, memory mapped. Not terribly well
1738c2ecf20Sopenharmony_ci * tested, but we might eventually use this one in the future - the
1748c2ecf20Sopenharmony_ci * problem why we cannot use it right now is the P5 APIC, it has an
1758c2ecf20Sopenharmony_ci * errata which cannot take 8-bit reads and writes, only 32-bit ones ...
1768c2ecf20Sopenharmony_ci */
1778c2ecf20Sopenharmony_ci#define u32 unsigned int
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_cistruct local_apic {
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/*000*/	struct { u32 __reserved[4]; } __reserved_01;
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/*010*/	struct { u32 __reserved[4]; } __reserved_02;
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/*020*/	struct { /* APIC ID Register */
1868c2ecf20Sopenharmony_ci		u32   __reserved_1	: 24,
1878c2ecf20Sopenharmony_ci			phys_apic_id	:  4,
1888c2ecf20Sopenharmony_ci			__reserved_2	:  4;
1898c2ecf20Sopenharmony_ci		u32 __reserved[3];
1908c2ecf20Sopenharmony_ci	} id;
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/*030*/	const
1938c2ecf20Sopenharmony_ci	struct { /* APIC Version Register */
1948c2ecf20Sopenharmony_ci		u32   version		:  8,
1958c2ecf20Sopenharmony_ci			__reserved_1	:  8,
1968c2ecf20Sopenharmony_ci			max_lvt		:  8,
1978c2ecf20Sopenharmony_ci			__reserved_2	:  8;
1988c2ecf20Sopenharmony_ci		u32 __reserved[3];
1998c2ecf20Sopenharmony_ci	} version;
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci/*040*/	struct { u32 __reserved[4]; } __reserved_03;
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/*050*/	struct { u32 __reserved[4]; } __reserved_04;
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci/*060*/	struct { u32 __reserved[4]; } __reserved_05;
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/*070*/	struct { u32 __reserved[4]; } __reserved_06;
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/*080*/	struct { /* Task Priority Register */
2108c2ecf20Sopenharmony_ci		u32   priority	:  8,
2118c2ecf20Sopenharmony_ci			__reserved_1	: 24;
2128c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
2138c2ecf20Sopenharmony_ci	} tpr;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/*090*/	const
2168c2ecf20Sopenharmony_ci	struct { /* Arbitration Priority Register */
2178c2ecf20Sopenharmony_ci		u32   priority	:  8,
2188c2ecf20Sopenharmony_ci			__reserved_1	: 24;
2198c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
2208c2ecf20Sopenharmony_ci	} apr;
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/*0A0*/	const
2238c2ecf20Sopenharmony_ci	struct { /* Processor Priority Register */
2248c2ecf20Sopenharmony_ci		u32   priority	:  8,
2258c2ecf20Sopenharmony_ci			__reserved_1	: 24;
2268c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
2278c2ecf20Sopenharmony_ci	} ppr;
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci/*0B0*/	struct { /* End Of Interrupt Register */
2308c2ecf20Sopenharmony_ci		u32   eoi;
2318c2ecf20Sopenharmony_ci		u32 __reserved[3];
2328c2ecf20Sopenharmony_ci	} eoi;
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/*0C0*/	struct { u32 __reserved[4]; } __reserved_07;
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/*0D0*/	struct { /* Logical Destination Register */
2378c2ecf20Sopenharmony_ci		u32   __reserved_1	: 24,
2388c2ecf20Sopenharmony_ci			logical_dest	:  8;
2398c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
2408c2ecf20Sopenharmony_ci	} ldr;
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/*0E0*/	struct { /* Destination Format Register */
2438c2ecf20Sopenharmony_ci		u32   __reserved_1	: 28,
2448c2ecf20Sopenharmony_ci			model		:  4;
2458c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
2468c2ecf20Sopenharmony_ci	} dfr;
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/*0F0*/	struct { /* Spurious Interrupt Vector Register */
2498c2ecf20Sopenharmony_ci		u32	spurious_vector	:  8,
2508c2ecf20Sopenharmony_ci			apic_enabled	:  1,
2518c2ecf20Sopenharmony_ci			focus_cpu	:  1,
2528c2ecf20Sopenharmony_ci			__reserved_2	: 22;
2538c2ecf20Sopenharmony_ci		u32 __reserved_3[3];
2548c2ecf20Sopenharmony_ci	} svr;
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/*100*/	struct { /* In Service Register */
2578c2ecf20Sopenharmony_ci/*170*/		u32 bitfield;
2588c2ecf20Sopenharmony_ci		u32 __reserved[3];
2598c2ecf20Sopenharmony_ci	} isr [8];
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci/*180*/	struct { /* Trigger Mode Register */
2628c2ecf20Sopenharmony_ci/*1F0*/		u32 bitfield;
2638c2ecf20Sopenharmony_ci		u32 __reserved[3];
2648c2ecf20Sopenharmony_ci	} tmr [8];
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/*200*/	struct { /* Interrupt Request Register */
2678c2ecf20Sopenharmony_ci/*270*/		u32 bitfield;
2688c2ecf20Sopenharmony_ci		u32 __reserved[3];
2698c2ecf20Sopenharmony_ci	} irr [8];
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/*280*/	union { /* Error Status Register */
2728c2ecf20Sopenharmony_ci		struct {
2738c2ecf20Sopenharmony_ci			u32   send_cs_error			:  1,
2748c2ecf20Sopenharmony_ci				receive_cs_error		:  1,
2758c2ecf20Sopenharmony_ci				send_accept_error		:  1,
2768c2ecf20Sopenharmony_ci				receive_accept_error		:  1,
2778c2ecf20Sopenharmony_ci				__reserved_1			:  1,
2788c2ecf20Sopenharmony_ci				send_illegal_vector		:  1,
2798c2ecf20Sopenharmony_ci				receive_illegal_vector		:  1,
2808c2ecf20Sopenharmony_ci				illegal_register_address	:  1,
2818c2ecf20Sopenharmony_ci				__reserved_2			: 24;
2828c2ecf20Sopenharmony_ci			u32 __reserved_3[3];
2838c2ecf20Sopenharmony_ci		} error_bits;
2848c2ecf20Sopenharmony_ci		struct {
2858c2ecf20Sopenharmony_ci			u32 errors;
2868c2ecf20Sopenharmony_ci			u32 __reserved_3[3];
2878c2ecf20Sopenharmony_ci		} all_errors;
2888c2ecf20Sopenharmony_ci	} esr;
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci/*290*/	struct { u32 __reserved[4]; } __reserved_08;
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci/*2A0*/	struct { u32 __reserved[4]; } __reserved_09;
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci/*2B0*/	struct { u32 __reserved[4]; } __reserved_10;
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci/*2C0*/	struct { u32 __reserved[4]; } __reserved_11;
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/*2D0*/	struct { u32 __reserved[4]; } __reserved_12;
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci/*2E0*/	struct { u32 __reserved[4]; } __reserved_13;
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/*2F0*/	struct { u32 __reserved[4]; } __reserved_14;
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci/*300*/	struct { /* Interrupt Command Register 1 */
3058c2ecf20Sopenharmony_ci		u32   vector			:  8,
3068c2ecf20Sopenharmony_ci			delivery_mode		:  3,
3078c2ecf20Sopenharmony_ci			destination_mode	:  1,
3088c2ecf20Sopenharmony_ci			delivery_status		:  1,
3098c2ecf20Sopenharmony_ci			__reserved_1		:  1,
3108c2ecf20Sopenharmony_ci			level			:  1,
3118c2ecf20Sopenharmony_ci			trigger			:  1,
3128c2ecf20Sopenharmony_ci			__reserved_2		:  2,
3138c2ecf20Sopenharmony_ci			shorthand		:  2,
3148c2ecf20Sopenharmony_ci			__reserved_3		:  12;
3158c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3168c2ecf20Sopenharmony_ci	} icr1;
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci/*310*/	struct { /* Interrupt Command Register 2 */
3198c2ecf20Sopenharmony_ci		union {
3208c2ecf20Sopenharmony_ci			u32   __reserved_1	: 24,
3218c2ecf20Sopenharmony_ci				phys_dest	:  4,
3228c2ecf20Sopenharmony_ci				__reserved_2	:  4;
3238c2ecf20Sopenharmony_ci			u32   __reserved_3	: 24,
3248c2ecf20Sopenharmony_ci				logical_dest	:  8;
3258c2ecf20Sopenharmony_ci		} dest;
3268c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3278c2ecf20Sopenharmony_ci	} icr2;
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/*320*/	struct { /* LVT - Timer */
3308c2ecf20Sopenharmony_ci		u32   vector		:  8,
3318c2ecf20Sopenharmony_ci			__reserved_1	:  4,
3328c2ecf20Sopenharmony_ci			delivery_status	:  1,
3338c2ecf20Sopenharmony_ci			__reserved_2	:  3,
3348c2ecf20Sopenharmony_ci			mask		:  1,
3358c2ecf20Sopenharmony_ci			timer_mode	:  1,
3368c2ecf20Sopenharmony_ci			__reserved_3	: 14;
3378c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3388c2ecf20Sopenharmony_ci	} lvt_timer;
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/*330*/	struct { /* LVT - Thermal Sensor */
3418c2ecf20Sopenharmony_ci		u32  vector		:  8,
3428c2ecf20Sopenharmony_ci			delivery_mode	:  3,
3438c2ecf20Sopenharmony_ci			__reserved_1	:  1,
3448c2ecf20Sopenharmony_ci			delivery_status	:  1,
3458c2ecf20Sopenharmony_ci			__reserved_2	:  3,
3468c2ecf20Sopenharmony_ci			mask		:  1,
3478c2ecf20Sopenharmony_ci			__reserved_3	: 15;
3488c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3498c2ecf20Sopenharmony_ci	} lvt_thermal;
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/*340*/	struct { /* LVT - Performance Counter */
3528c2ecf20Sopenharmony_ci		u32   vector		:  8,
3538c2ecf20Sopenharmony_ci			delivery_mode	:  3,
3548c2ecf20Sopenharmony_ci			__reserved_1	:  1,
3558c2ecf20Sopenharmony_ci			delivery_status	:  1,
3568c2ecf20Sopenharmony_ci			__reserved_2	:  3,
3578c2ecf20Sopenharmony_ci			mask		:  1,
3588c2ecf20Sopenharmony_ci			__reserved_3	: 15;
3598c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3608c2ecf20Sopenharmony_ci	} lvt_pc;
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/*350*/	struct { /* LVT - LINT0 */
3638c2ecf20Sopenharmony_ci		u32   vector		:  8,
3648c2ecf20Sopenharmony_ci			delivery_mode	:  3,
3658c2ecf20Sopenharmony_ci			__reserved_1	:  1,
3668c2ecf20Sopenharmony_ci			delivery_status	:  1,
3678c2ecf20Sopenharmony_ci			polarity	:  1,
3688c2ecf20Sopenharmony_ci			remote_irr	:  1,
3698c2ecf20Sopenharmony_ci			trigger		:  1,
3708c2ecf20Sopenharmony_ci			mask		:  1,
3718c2ecf20Sopenharmony_ci			__reserved_2	: 15;
3728c2ecf20Sopenharmony_ci		u32 __reserved_3[3];
3738c2ecf20Sopenharmony_ci	} lvt_lint0;
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci/*360*/	struct { /* LVT - LINT1 */
3768c2ecf20Sopenharmony_ci		u32   vector		:  8,
3778c2ecf20Sopenharmony_ci			delivery_mode	:  3,
3788c2ecf20Sopenharmony_ci			__reserved_1	:  1,
3798c2ecf20Sopenharmony_ci			delivery_status	:  1,
3808c2ecf20Sopenharmony_ci			polarity	:  1,
3818c2ecf20Sopenharmony_ci			remote_irr	:  1,
3828c2ecf20Sopenharmony_ci			trigger		:  1,
3838c2ecf20Sopenharmony_ci			mask		:  1,
3848c2ecf20Sopenharmony_ci			__reserved_2	: 15;
3858c2ecf20Sopenharmony_ci		u32 __reserved_3[3];
3868c2ecf20Sopenharmony_ci	} lvt_lint1;
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/*370*/	struct { /* LVT - Error */
3898c2ecf20Sopenharmony_ci		u32   vector		:  8,
3908c2ecf20Sopenharmony_ci			__reserved_1	:  4,
3918c2ecf20Sopenharmony_ci			delivery_status	:  1,
3928c2ecf20Sopenharmony_ci			__reserved_2	:  3,
3938c2ecf20Sopenharmony_ci			mask		:  1,
3948c2ecf20Sopenharmony_ci			__reserved_3	: 15;
3958c2ecf20Sopenharmony_ci		u32 __reserved_4[3];
3968c2ecf20Sopenharmony_ci	} lvt_error;
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/*380*/	struct { /* Timer Initial Count Register */
3998c2ecf20Sopenharmony_ci		u32   initial_count;
4008c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
4018c2ecf20Sopenharmony_ci	} timer_icr;
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci/*390*/	const
4048c2ecf20Sopenharmony_ci	struct { /* Timer Current Count Register */
4058c2ecf20Sopenharmony_ci		u32   curr_count;
4068c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
4078c2ecf20Sopenharmony_ci	} timer_ccr;
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/*3A0*/	struct { u32 __reserved[4]; } __reserved_16;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci/*3B0*/	struct { u32 __reserved[4]; } __reserved_17;
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci/*3C0*/	struct { u32 __reserved[4]; } __reserved_18;
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_ci/*3D0*/	struct { u32 __reserved[4]; } __reserved_19;
4168c2ecf20Sopenharmony_ci
4178c2ecf20Sopenharmony_ci/*3E0*/	struct { /* Timer Divide Configuration Register */
4188c2ecf20Sopenharmony_ci		u32   divisor		:  4,
4198c2ecf20Sopenharmony_ci			__reserved_1	: 28;
4208c2ecf20Sopenharmony_ci		u32 __reserved_2[3];
4218c2ecf20Sopenharmony_ci	} timer_dcr;
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci/*3F0*/	struct { u32 __reserved[4]; } __reserved_20;
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci} __attribute__ ((packed));
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#undef u32
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
4308c2ecf20Sopenharmony_ci #define BAD_APICID 0xFFu
4318c2ecf20Sopenharmony_ci#else
4328c2ecf20Sopenharmony_ci #define BAD_APICID 0xFFFFu
4338c2ecf20Sopenharmony_ci#endif
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cienum ioapic_irq_destination_types {
4368c2ecf20Sopenharmony_ci	dest_Fixed		= 0,
4378c2ecf20Sopenharmony_ci	dest_LowestPrio		= 1,
4388c2ecf20Sopenharmony_ci	dest_SMI		= 2,
4398c2ecf20Sopenharmony_ci	dest__reserved_1	= 3,
4408c2ecf20Sopenharmony_ci	dest_NMI		= 4,
4418c2ecf20Sopenharmony_ci	dest_INIT		= 5,
4428c2ecf20Sopenharmony_ci	dest__reserved_2	= 6,
4438c2ecf20Sopenharmony_ci	dest_ExtINT		= 7
4448c2ecf20Sopenharmony_ci};
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci#endif /* _ASM_X86_APICDEF_H */
447