162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_X86_APICDEF_H 362306a36Sopenharmony_ci#define _ASM_X86_APICDEF_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/bits.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* 862306a36Sopenharmony_ci * Constants for various Intel APICs. (local APIC, IOAPIC, etc.) 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * Alan Cox <Alan.Cox@linux.org>, 1995. 1162306a36Sopenharmony_ci * Ingo Molnar <mingo@redhat.com>, 1999, 2000 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define IO_APIC_DEFAULT_PHYS_BASE 0xfec00000 1562306a36Sopenharmony_ci#define APIC_DEFAULT_PHYS_BASE 0xfee00000 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/* 1862306a36Sopenharmony_ci * This is the IO-APIC register space as specified 1962306a36Sopenharmony_ci * by Intel docs: 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ci#define IO_APIC_SLOT_SIZE 1024 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define APIC_ID 0x20 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define APIC_LVR 0x30 2662306a36Sopenharmony_ci#define APIC_LVR_MASK 0xFF00FF 2762306a36Sopenharmony_ci#define APIC_LVR_DIRECTED_EOI (1 << 24) 2862306a36Sopenharmony_ci#define GET_APIC_VERSION(x) ((x) & 0xFFu) 2962306a36Sopenharmony_ci#define GET_APIC_MAXLVT(x) (((x) >> 16) & 0xFFu) 3062306a36Sopenharmony_ci#ifdef CONFIG_X86_32 3162306a36Sopenharmony_ci# define APIC_INTEGRATED(x) ((x) & 0xF0u) 3262306a36Sopenharmony_ci#else 3362306a36Sopenharmony_ci# define APIC_INTEGRATED(x) (1) 3462306a36Sopenharmony_ci#endif 3562306a36Sopenharmony_ci#define APIC_XAPIC(x) ((x) >= 0x14) 3662306a36Sopenharmony_ci#define APIC_EXT_SPACE(x) ((x) & 0x80000000) 3762306a36Sopenharmony_ci#define APIC_TASKPRI 0x80 3862306a36Sopenharmony_ci#define APIC_TPRI_MASK 0xFFu 3962306a36Sopenharmony_ci#define APIC_ARBPRI 0x90 4062306a36Sopenharmony_ci#define APIC_ARBPRI_MASK 0xFFu 4162306a36Sopenharmony_ci#define APIC_PROCPRI 0xA0 4262306a36Sopenharmony_ci#define APIC_EOI 0xB0 4362306a36Sopenharmony_ci#define APIC_EOI_ACK 0x0 /* Docs say 0 for future compat. */ 4462306a36Sopenharmony_ci#define APIC_RRR 0xC0 4562306a36Sopenharmony_ci#define APIC_LDR 0xD0 4662306a36Sopenharmony_ci#define APIC_LDR_MASK (0xFFu << 24) 4762306a36Sopenharmony_ci#define GET_APIC_LOGICAL_ID(x) (((x) >> 24) & 0xFFu) 4862306a36Sopenharmony_ci#define SET_APIC_LOGICAL_ID(x) (((x) << 24)) 4962306a36Sopenharmony_ci#define APIC_ALL_CPUS 0xFFu 5062306a36Sopenharmony_ci#define APIC_DFR 0xE0 5162306a36Sopenharmony_ci#define APIC_DFR_CLUSTER 0x0FFFFFFFul 5262306a36Sopenharmony_ci#define APIC_DFR_FLAT 0xFFFFFFFFul 5362306a36Sopenharmony_ci#define APIC_SPIV 0xF0 5462306a36Sopenharmony_ci#define APIC_SPIV_DIRECTED_EOI (1 << 12) 5562306a36Sopenharmony_ci#define APIC_SPIV_FOCUS_DISABLED (1 << 9) 5662306a36Sopenharmony_ci#define APIC_SPIV_APIC_ENABLED (1 << 8) 5762306a36Sopenharmony_ci#define APIC_ISR 0x100 5862306a36Sopenharmony_ci#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */ 5962306a36Sopenharmony_ci#define APIC_TMR 0x180 6062306a36Sopenharmony_ci#define APIC_IRR 0x200 6162306a36Sopenharmony_ci#define APIC_ESR 0x280 6262306a36Sopenharmony_ci#define APIC_ESR_SEND_CS 0x00001 6362306a36Sopenharmony_ci#define APIC_ESR_RECV_CS 0x00002 6462306a36Sopenharmony_ci#define APIC_ESR_SEND_ACC 0x00004 6562306a36Sopenharmony_ci#define APIC_ESR_RECV_ACC 0x00008 6662306a36Sopenharmony_ci#define APIC_ESR_SENDILL 0x00020 6762306a36Sopenharmony_ci#define APIC_ESR_RECVILL 0x00040 6862306a36Sopenharmony_ci#define APIC_ESR_ILLREGA 0x00080 6962306a36Sopenharmony_ci#define APIC_LVTCMCI 0x2f0 7062306a36Sopenharmony_ci#define APIC_ICR 0x300 7162306a36Sopenharmony_ci#define APIC_DEST_SELF 0x40000 7262306a36Sopenharmony_ci#define APIC_DEST_ALLINC 0x80000 7362306a36Sopenharmony_ci#define APIC_DEST_ALLBUT 0xC0000 7462306a36Sopenharmony_ci#define APIC_ICR_RR_MASK 0x30000 7562306a36Sopenharmony_ci#define APIC_ICR_RR_INVALID 0x00000 7662306a36Sopenharmony_ci#define APIC_ICR_RR_INPROG 0x10000 7762306a36Sopenharmony_ci#define APIC_ICR_RR_VALID 0x20000 7862306a36Sopenharmony_ci#define APIC_INT_LEVELTRIG 0x08000 7962306a36Sopenharmony_ci#define APIC_INT_ASSERT 0x04000 8062306a36Sopenharmony_ci#define APIC_ICR_BUSY 0x01000 8162306a36Sopenharmony_ci#define APIC_DEST_LOGICAL 0x00800 8262306a36Sopenharmony_ci#define APIC_DEST_PHYSICAL 0x00000 8362306a36Sopenharmony_ci#define APIC_DM_FIXED 0x00000 8462306a36Sopenharmony_ci#define APIC_DM_FIXED_MASK 0x00700 8562306a36Sopenharmony_ci#define APIC_DM_LOWEST 0x00100 8662306a36Sopenharmony_ci#define APIC_DM_SMI 0x00200 8762306a36Sopenharmony_ci#define APIC_DM_REMRD 0x00300 8862306a36Sopenharmony_ci#define APIC_DM_NMI 0x00400 8962306a36Sopenharmony_ci#define APIC_DM_INIT 0x00500 9062306a36Sopenharmony_ci#define APIC_DM_STARTUP 0x00600 9162306a36Sopenharmony_ci#define APIC_DM_EXTINT 0x00700 9262306a36Sopenharmony_ci#define APIC_VECTOR_MASK 0x000FF 9362306a36Sopenharmony_ci#define APIC_ICR2 0x310 9462306a36Sopenharmony_ci#define GET_XAPIC_DEST_FIELD(x) (((x) >> 24) & 0xFF) 9562306a36Sopenharmony_ci#define SET_XAPIC_DEST_FIELD(x) ((x) << 24) 9662306a36Sopenharmony_ci#define APIC_LVTT 0x320 9762306a36Sopenharmony_ci#define APIC_LVTTHMR 0x330 9862306a36Sopenharmony_ci#define APIC_LVTPC 0x340 9962306a36Sopenharmony_ci#define APIC_LVT0 0x350 10062306a36Sopenharmony_ci#define APIC_LVT_TIMER_ONESHOT (0 << 17) 10162306a36Sopenharmony_ci#define APIC_LVT_TIMER_PERIODIC (1 << 17) 10262306a36Sopenharmony_ci#define APIC_LVT_TIMER_TSCDEADLINE (2 << 17) 10362306a36Sopenharmony_ci#define APIC_LVT_MASKED (1 << 16) 10462306a36Sopenharmony_ci#define APIC_LVT_LEVEL_TRIGGER (1 << 15) 10562306a36Sopenharmony_ci#define APIC_LVT_REMOTE_IRR (1 << 14) 10662306a36Sopenharmony_ci#define APIC_INPUT_POLARITY (1 << 13) 10762306a36Sopenharmony_ci#define APIC_SEND_PENDING (1 << 12) 10862306a36Sopenharmony_ci#define APIC_MODE_MASK 0x700 10962306a36Sopenharmony_ci#define GET_APIC_DELIVERY_MODE(x) (((x) >> 8) & 0x7) 11062306a36Sopenharmony_ci#define SET_APIC_DELIVERY_MODE(x, y) (((x) & ~0x700) | ((y) << 8)) 11162306a36Sopenharmony_ci#define APIC_MODE_FIXED 0x0 11262306a36Sopenharmony_ci#define APIC_MODE_NMI 0x4 11362306a36Sopenharmony_ci#define APIC_MODE_EXTINT 0x7 11462306a36Sopenharmony_ci#define APIC_LVT1 0x360 11562306a36Sopenharmony_ci#define APIC_LVTERR 0x370 11662306a36Sopenharmony_ci#define APIC_TMICT 0x380 11762306a36Sopenharmony_ci#define APIC_TMCCT 0x390 11862306a36Sopenharmony_ci#define APIC_TDCR 0x3E0 11962306a36Sopenharmony_ci#define APIC_SELF_IPI 0x3F0 12062306a36Sopenharmony_ci#define APIC_TDR_DIV_TMBASE (1 << 2) 12162306a36Sopenharmony_ci#define APIC_TDR_DIV_1 0xB 12262306a36Sopenharmony_ci#define APIC_TDR_DIV_2 0x0 12362306a36Sopenharmony_ci#define APIC_TDR_DIV_4 0x1 12462306a36Sopenharmony_ci#define APIC_TDR_DIV_8 0x2 12562306a36Sopenharmony_ci#define APIC_TDR_DIV_16 0x3 12662306a36Sopenharmony_ci#define APIC_TDR_DIV_32 0x8 12762306a36Sopenharmony_ci#define APIC_TDR_DIV_64 0x9 12862306a36Sopenharmony_ci#define APIC_TDR_DIV_128 0xA 12962306a36Sopenharmony_ci#define APIC_EFEAT 0x400 13062306a36Sopenharmony_ci#define APIC_ECTRL 0x410 13162306a36Sopenharmony_ci#define APIC_EILVTn(n) (0x500 + 0x10 * n) 13262306a36Sopenharmony_ci#define APIC_EILVT_NR_AMD_K8 1 /* # of extended interrupts */ 13362306a36Sopenharmony_ci#define APIC_EILVT_NR_AMD_10H 4 13462306a36Sopenharmony_ci#define APIC_EILVT_NR_MAX APIC_EILVT_NR_AMD_10H 13562306a36Sopenharmony_ci#define APIC_EILVT_LVTOFF(x) (((x) >> 4) & 0xF) 13662306a36Sopenharmony_ci#define APIC_EILVT_MSG_FIX 0x0 13762306a36Sopenharmony_ci#define APIC_EILVT_MSG_SMI 0x2 13862306a36Sopenharmony_ci#define APIC_EILVT_MSG_NMI 0x4 13962306a36Sopenharmony_ci#define APIC_EILVT_MSG_EXT 0x7 14062306a36Sopenharmony_ci#define APIC_EILVT_MASKED (1 << 16) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci#define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) 14362306a36Sopenharmony_ci#define APIC_BASE_MSR 0x800 14462306a36Sopenharmony_ci#define APIC_X2APIC_ID_MSR 0x802 14562306a36Sopenharmony_ci#define XAPIC_ENABLE BIT(11) 14662306a36Sopenharmony_ci#define X2APIC_ENABLE BIT(10) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#ifdef CONFIG_X86_32 14962306a36Sopenharmony_ci# define MAX_IO_APICS 64 15062306a36Sopenharmony_ci# define MAX_LOCAL_APIC 256 15162306a36Sopenharmony_ci#else 15262306a36Sopenharmony_ci# define MAX_IO_APICS 128 15362306a36Sopenharmony_ci# define MAX_LOCAL_APIC 32768 15462306a36Sopenharmony_ci#endif 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci/* 15762306a36Sopenharmony_ci * All x86-64 systems are xAPIC compatible. 15862306a36Sopenharmony_ci * In the following, "apicid" is a physical APIC ID. 15962306a36Sopenharmony_ci */ 16062306a36Sopenharmony_ci#define XAPIC_DEST_CPUS_SHIFT 4 16162306a36Sopenharmony_ci#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1) 16262306a36Sopenharmony_ci#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT) 16362306a36Sopenharmony_ci#define APIC_CLUSTER(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK) 16462306a36Sopenharmony_ci#define APIC_CLUSTERID(apicid) (APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT) 16562306a36Sopenharmony_ci#define APIC_CPUID(apicid) ((apicid) & XAPIC_DEST_CPUS_MASK) 16662306a36Sopenharmony_ci#define NUM_APIC_CLUSTERS ((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 16962306a36Sopenharmony_ci/* 17062306a36Sopenharmony_ci * the local APIC register structure, memory mapped. Not terribly well 17162306a36Sopenharmony_ci * tested, but we might eventually use this one in the future - the 17262306a36Sopenharmony_ci * problem why we cannot use it right now is the P5 APIC, it has an 17362306a36Sopenharmony_ci * errata which cannot take 8-bit reads and writes, only 32-bit ones ... 17462306a36Sopenharmony_ci */ 17562306a36Sopenharmony_ci#define u32 unsigned int 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_cistruct local_apic { 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci/*000*/ struct { u32 __reserved[4]; } __reserved_01; 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci/*010*/ struct { u32 __reserved[4]; } __reserved_02; 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci/*020*/ struct { /* APIC ID Register */ 18462306a36Sopenharmony_ci u32 __reserved_1 : 24, 18562306a36Sopenharmony_ci phys_apic_id : 4, 18662306a36Sopenharmony_ci __reserved_2 : 4; 18762306a36Sopenharmony_ci u32 __reserved[3]; 18862306a36Sopenharmony_ci } id; 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci/*030*/ const 19162306a36Sopenharmony_ci struct { /* APIC Version Register */ 19262306a36Sopenharmony_ci u32 version : 8, 19362306a36Sopenharmony_ci __reserved_1 : 8, 19462306a36Sopenharmony_ci max_lvt : 8, 19562306a36Sopenharmony_ci __reserved_2 : 8; 19662306a36Sopenharmony_ci u32 __reserved[3]; 19762306a36Sopenharmony_ci } version; 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci/*040*/ struct { u32 __reserved[4]; } __reserved_03; 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/*050*/ struct { u32 __reserved[4]; } __reserved_04; 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/*060*/ struct { u32 __reserved[4]; } __reserved_05; 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci/*070*/ struct { u32 __reserved[4]; } __reserved_06; 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci/*080*/ struct { /* Task Priority Register */ 20862306a36Sopenharmony_ci u32 priority : 8, 20962306a36Sopenharmony_ci __reserved_1 : 24; 21062306a36Sopenharmony_ci u32 __reserved_2[3]; 21162306a36Sopenharmony_ci } tpr; 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci/*090*/ const 21462306a36Sopenharmony_ci struct { /* Arbitration Priority Register */ 21562306a36Sopenharmony_ci u32 priority : 8, 21662306a36Sopenharmony_ci __reserved_1 : 24; 21762306a36Sopenharmony_ci u32 __reserved_2[3]; 21862306a36Sopenharmony_ci } apr; 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci/*0A0*/ const 22162306a36Sopenharmony_ci struct { /* Processor Priority Register */ 22262306a36Sopenharmony_ci u32 priority : 8, 22362306a36Sopenharmony_ci __reserved_1 : 24; 22462306a36Sopenharmony_ci u32 __reserved_2[3]; 22562306a36Sopenharmony_ci } ppr; 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci/*0B0*/ struct { /* End Of Interrupt Register */ 22862306a36Sopenharmony_ci u32 eoi; 22962306a36Sopenharmony_ci u32 __reserved[3]; 23062306a36Sopenharmony_ci } eoi; 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci/*0C0*/ struct { u32 __reserved[4]; } __reserved_07; 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci/*0D0*/ struct { /* Logical Destination Register */ 23562306a36Sopenharmony_ci u32 __reserved_1 : 24, 23662306a36Sopenharmony_ci logical_dest : 8; 23762306a36Sopenharmony_ci u32 __reserved_2[3]; 23862306a36Sopenharmony_ci } ldr; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci/*0E0*/ struct { /* Destination Format Register */ 24162306a36Sopenharmony_ci u32 __reserved_1 : 28, 24262306a36Sopenharmony_ci model : 4; 24362306a36Sopenharmony_ci u32 __reserved_2[3]; 24462306a36Sopenharmony_ci } dfr; 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci/*0F0*/ struct { /* Spurious Interrupt Vector Register */ 24762306a36Sopenharmony_ci u32 spurious_vector : 8, 24862306a36Sopenharmony_ci apic_enabled : 1, 24962306a36Sopenharmony_ci focus_cpu : 1, 25062306a36Sopenharmony_ci __reserved_2 : 22; 25162306a36Sopenharmony_ci u32 __reserved_3[3]; 25262306a36Sopenharmony_ci } svr; 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/*100*/ struct { /* In Service Register */ 25562306a36Sopenharmony_ci/*170*/ u32 bitfield; 25662306a36Sopenharmony_ci u32 __reserved[3]; 25762306a36Sopenharmony_ci } isr [8]; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci/*180*/ struct { /* Trigger Mode Register */ 26062306a36Sopenharmony_ci/*1F0*/ u32 bitfield; 26162306a36Sopenharmony_ci u32 __reserved[3]; 26262306a36Sopenharmony_ci } tmr [8]; 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci/*200*/ struct { /* Interrupt Request Register */ 26562306a36Sopenharmony_ci/*270*/ u32 bitfield; 26662306a36Sopenharmony_ci u32 __reserved[3]; 26762306a36Sopenharmony_ci } irr [8]; 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci/*280*/ union { /* Error Status Register */ 27062306a36Sopenharmony_ci struct { 27162306a36Sopenharmony_ci u32 send_cs_error : 1, 27262306a36Sopenharmony_ci receive_cs_error : 1, 27362306a36Sopenharmony_ci send_accept_error : 1, 27462306a36Sopenharmony_ci receive_accept_error : 1, 27562306a36Sopenharmony_ci __reserved_1 : 1, 27662306a36Sopenharmony_ci send_illegal_vector : 1, 27762306a36Sopenharmony_ci receive_illegal_vector : 1, 27862306a36Sopenharmony_ci illegal_register_address : 1, 27962306a36Sopenharmony_ci __reserved_2 : 24; 28062306a36Sopenharmony_ci u32 __reserved_3[3]; 28162306a36Sopenharmony_ci } error_bits; 28262306a36Sopenharmony_ci struct { 28362306a36Sopenharmony_ci u32 errors; 28462306a36Sopenharmony_ci u32 __reserved_3[3]; 28562306a36Sopenharmony_ci } all_errors; 28662306a36Sopenharmony_ci } esr; 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci/*290*/ struct { u32 __reserved[4]; } __reserved_08; 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci/*2A0*/ struct { u32 __reserved[4]; } __reserved_09; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_ci/*2B0*/ struct { u32 __reserved[4]; } __reserved_10; 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci/*2C0*/ struct { u32 __reserved[4]; } __reserved_11; 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci/*2D0*/ struct { u32 __reserved[4]; } __reserved_12; 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci/*2E0*/ struct { u32 __reserved[4]; } __reserved_13; 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci/*2F0*/ struct { u32 __reserved[4]; } __reserved_14; 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci/*300*/ struct { /* Interrupt Command Register 1 */ 30362306a36Sopenharmony_ci u32 vector : 8, 30462306a36Sopenharmony_ci delivery_mode : 3, 30562306a36Sopenharmony_ci destination_mode : 1, 30662306a36Sopenharmony_ci delivery_status : 1, 30762306a36Sopenharmony_ci __reserved_1 : 1, 30862306a36Sopenharmony_ci level : 1, 30962306a36Sopenharmony_ci trigger : 1, 31062306a36Sopenharmony_ci __reserved_2 : 2, 31162306a36Sopenharmony_ci shorthand : 2, 31262306a36Sopenharmony_ci __reserved_3 : 12; 31362306a36Sopenharmony_ci u32 __reserved_4[3]; 31462306a36Sopenharmony_ci } icr1; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/*310*/ struct { /* Interrupt Command Register 2 */ 31762306a36Sopenharmony_ci union { 31862306a36Sopenharmony_ci u32 __reserved_1 : 24, 31962306a36Sopenharmony_ci phys_dest : 4, 32062306a36Sopenharmony_ci __reserved_2 : 4; 32162306a36Sopenharmony_ci u32 __reserved_3 : 24, 32262306a36Sopenharmony_ci logical_dest : 8; 32362306a36Sopenharmony_ci } dest; 32462306a36Sopenharmony_ci u32 __reserved_4[3]; 32562306a36Sopenharmony_ci } icr2; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci/*320*/ struct { /* LVT - Timer */ 32862306a36Sopenharmony_ci u32 vector : 8, 32962306a36Sopenharmony_ci __reserved_1 : 4, 33062306a36Sopenharmony_ci delivery_status : 1, 33162306a36Sopenharmony_ci __reserved_2 : 3, 33262306a36Sopenharmony_ci mask : 1, 33362306a36Sopenharmony_ci timer_mode : 1, 33462306a36Sopenharmony_ci __reserved_3 : 14; 33562306a36Sopenharmony_ci u32 __reserved_4[3]; 33662306a36Sopenharmony_ci } lvt_timer; 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci/*330*/ struct { /* LVT - Thermal Sensor */ 33962306a36Sopenharmony_ci u32 vector : 8, 34062306a36Sopenharmony_ci delivery_mode : 3, 34162306a36Sopenharmony_ci __reserved_1 : 1, 34262306a36Sopenharmony_ci delivery_status : 1, 34362306a36Sopenharmony_ci __reserved_2 : 3, 34462306a36Sopenharmony_ci mask : 1, 34562306a36Sopenharmony_ci __reserved_3 : 15; 34662306a36Sopenharmony_ci u32 __reserved_4[3]; 34762306a36Sopenharmony_ci } lvt_thermal; 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ci/*340*/ struct { /* LVT - Performance Counter */ 35062306a36Sopenharmony_ci u32 vector : 8, 35162306a36Sopenharmony_ci delivery_mode : 3, 35262306a36Sopenharmony_ci __reserved_1 : 1, 35362306a36Sopenharmony_ci delivery_status : 1, 35462306a36Sopenharmony_ci __reserved_2 : 3, 35562306a36Sopenharmony_ci mask : 1, 35662306a36Sopenharmony_ci __reserved_3 : 15; 35762306a36Sopenharmony_ci u32 __reserved_4[3]; 35862306a36Sopenharmony_ci } lvt_pc; 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci/*350*/ struct { /* LVT - LINT0 */ 36162306a36Sopenharmony_ci u32 vector : 8, 36262306a36Sopenharmony_ci delivery_mode : 3, 36362306a36Sopenharmony_ci __reserved_1 : 1, 36462306a36Sopenharmony_ci delivery_status : 1, 36562306a36Sopenharmony_ci polarity : 1, 36662306a36Sopenharmony_ci remote_irr : 1, 36762306a36Sopenharmony_ci trigger : 1, 36862306a36Sopenharmony_ci mask : 1, 36962306a36Sopenharmony_ci __reserved_2 : 15; 37062306a36Sopenharmony_ci u32 __reserved_3[3]; 37162306a36Sopenharmony_ci } lvt_lint0; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci/*360*/ struct { /* LVT - LINT1 */ 37462306a36Sopenharmony_ci u32 vector : 8, 37562306a36Sopenharmony_ci delivery_mode : 3, 37662306a36Sopenharmony_ci __reserved_1 : 1, 37762306a36Sopenharmony_ci delivery_status : 1, 37862306a36Sopenharmony_ci polarity : 1, 37962306a36Sopenharmony_ci remote_irr : 1, 38062306a36Sopenharmony_ci trigger : 1, 38162306a36Sopenharmony_ci mask : 1, 38262306a36Sopenharmony_ci __reserved_2 : 15; 38362306a36Sopenharmony_ci u32 __reserved_3[3]; 38462306a36Sopenharmony_ci } lvt_lint1; 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci/*370*/ struct { /* LVT - Error */ 38762306a36Sopenharmony_ci u32 vector : 8, 38862306a36Sopenharmony_ci __reserved_1 : 4, 38962306a36Sopenharmony_ci delivery_status : 1, 39062306a36Sopenharmony_ci __reserved_2 : 3, 39162306a36Sopenharmony_ci mask : 1, 39262306a36Sopenharmony_ci __reserved_3 : 15; 39362306a36Sopenharmony_ci u32 __reserved_4[3]; 39462306a36Sopenharmony_ci } lvt_error; 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_ci/*380*/ struct { /* Timer Initial Count Register */ 39762306a36Sopenharmony_ci u32 initial_count; 39862306a36Sopenharmony_ci u32 __reserved_2[3]; 39962306a36Sopenharmony_ci } timer_icr; 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci/*390*/ const 40262306a36Sopenharmony_ci struct { /* Timer Current Count Register */ 40362306a36Sopenharmony_ci u32 curr_count; 40462306a36Sopenharmony_ci u32 __reserved_2[3]; 40562306a36Sopenharmony_ci } timer_ccr; 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci/*3A0*/ struct { u32 __reserved[4]; } __reserved_16; 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_ci/*3B0*/ struct { u32 __reserved[4]; } __reserved_17; 41062306a36Sopenharmony_ci 41162306a36Sopenharmony_ci/*3C0*/ struct { u32 __reserved[4]; } __reserved_18; 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci/*3D0*/ struct { u32 __reserved[4]; } __reserved_19; 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci/*3E0*/ struct { /* Timer Divide Configuration Register */ 41662306a36Sopenharmony_ci u32 divisor : 4, 41762306a36Sopenharmony_ci __reserved_1 : 28; 41862306a36Sopenharmony_ci u32 __reserved_2[3]; 41962306a36Sopenharmony_ci } timer_dcr; 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci/*3F0*/ struct { u32 __reserved[4]; } __reserved_20; 42262306a36Sopenharmony_ci 42362306a36Sopenharmony_ci} __attribute__ ((packed)); 42462306a36Sopenharmony_ci 42562306a36Sopenharmony_ci#undef u32 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci#ifdef CONFIG_X86_32 42862306a36Sopenharmony_ci #define BAD_APICID 0xFFu 42962306a36Sopenharmony_ci#else 43062306a36Sopenharmony_ci #define BAD_APICID 0xFFFFu 43162306a36Sopenharmony_ci#endif 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_cienum apic_delivery_modes { 43462306a36Sopenharmony_ci APIC_DELIVERY_MODE_FIXED = 0, 43562306a36Sopenharmony_ci APIC_DELIVERY_MODE_LOWESTPRIO = 1, 43662306a36Sopenharmony_ci APIC_DELIVERY_MODE_SMI = 2, 43762306a36Sopenharmony_ci APIC_DELIVERY_MODE_NMI = 4, 43862306a36Sopenharmony_ci APIC_DELIVERY_MODE_INIT = 5, 43962306a36Sopenharmony_ci APIC_DELIVERY_MODE_EXTINT = 7, 44062306a36Sopenharmony_ci}; 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 44362306a36Sopenharmony_ci#endif /* _ASM_X86_APICDEF_H */ 444