HV: irq: convert hexadecimals used in bitops to unsigned

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao
2018-06-19 18:31:41 +08:00
committed by lijinxia
parent f4bd0798e0
commit 41a1035f9b
9 changed files with 372 additions and 370 deletions

View File

@@ -268,161 +268,161 @@ struct ioapic {
*/
/* default physical locations of LOCAL (CPU) APICs */
#define DEFAULT_APIC_BASE 0xfee00000
#define DEFAULT_APIC_BASE 0xfee00000U
/* constants relating to APIC ID registers */
#define APIC_ID_MASK 0xff000000
#define APIC_ID_MASK 0xff000000U
#define APIC_ID_SHIFT 24
#define APIC_ID_CLUSTER 0xf0
#define APIC_ID_CLUSTER_ID 0x0f
#define APIC_MAX_CLUSTER 0xe
#define APIC_ID_CLUSTER 0xf0U
#define APIC_ID_CLUSTER_ID 0x0fU
#define APIC_MAX_CLUSTER 0xeU
#define APIC_MAX_INTRACLUSTER_ID 3
#define APIC_ID_CLUSTER_SHIFT 4
/* fields in VER */
#define APIC_VER_VERSION 0x000000ff
#define APIC_VER_MAXLVT 0x00ff0000
#define APIC_VER_VERSION 0x000000ffU
#define APIC_VER_MAXLVT 0x00ff0000U
#define MAXLVTSHIFT 16
#define APIC_VER_EOI_SUPPRESSION 0x01000000
#define APIC_VER_AMD_EXT_SPACE 0x80000000
#define APIC_VER_EOI_SUPPRESSION 0x01000000U
#define APIC_VER_AMD_EXT_SPACE 0x80000000U
/* fields in LDR */
#define APIC_LDR_RESERVED 0x00ffffff
#define APIC_LDR_RESERVED 0x00ffffffU
/* fields in DFR */
#define APIC_DFR_RESERVED 0x0fffffff
#define APIC_DFR_MODEL_MASK 0xf0000000
#define APIC_DFR_MODEL_FLAT 0xf0000000
#define APIC_DFR_MODEL_CLUSTER 0x00000000
#define APIC_DFR_RESERVED 0x0fffffffU
#define APIC_DFR_MODEL_MASK 0xf0000000U
#define APIC_DFR_MODEL_FLAT 0xf0000000U
#define APIC_DFR_MODEL_CLUSTER 0x00000000U
/* fields in SVR */
#define APIC_SVR_VECTOR 0x000000ff
#define APIC_SVR_VEC_PROG 0x000000f0
#define APIC_SVR_VEC_FIX 0x0000000f
#define APIC_SVR_ENABLE 0x00000100
#define APIC_SVR_SWDIS 0x00000000
#define APIC_SVR_SWEN 0x00000100
#define APIC_SVR_FOCUS 0x00000200
#define APIC_SVR_FEN 0x00000000
#define APIC_SVR_FDIS 0x00000200
#define APIC_SVR_EOI_SUPPRESSION 0x00001000
#define APIC_SVR_VECTOR 0x000000ffU
#define APIC_SVR_VEC_PROG 0x000000f0U
#define APIC_SVR_VEC_FIX 0x0000000fU
#define APIC_SVR_ENABLE 0x00000100U
#define APIC_SVR_SWDIS 0x00000000U
#define APIC_SVR_SWEN 0x00000100U
#define APIC_SVR_FOCUS 0x00000200U
#define APIC_SVR_FEN 0x00000000U
#define APIC_SVR_FDIS 0x00000200U
#define APIC_SVR_EOI_SUPPRESSION 0x00001000U
/* fields in TPR */
#define APIC_TPR_PRIO 0x000000ff
#define APIC_TPR_INT 0x000000f0
#define APIC_TPR_SUB 0x0000000f
#define APIC_TPR_PRIO 0x000000ffU
#define APIC_TPR_INT 0x000000f0U
#define APIC_TPR_SUB 0x0000000fU
/* fields in ESR */
#define APIC_ESR_SEND_CS_ERROR 0x00000001
#define APIC_ESR_RECEIVE_CS_ERROR 0x00000002
#define APIC_ESR_SEND_ACCEPT 0x00000004
#define APIC_ESR_RECEIVE_ACCEPT 0x00000008
#define APIC_ESR_SEND_ILLEGAL_VECTOR 0x00000020
#define APIC_ESR_RECEIVE_ILLEGAL_VECTOR 0x00000040
#define APIC_ESR_ILLEGAL_REGISTER 0x00000080
#define APIC_ESR_SEND_CS_ERROR 0x00000001U
#define APIC_ESR_RECEIVE_CS_ERROR 0x00000002U
#define APIC_ESR_SEND_ACCEPT 0x00000004U
#define APIC_ESR_RECEIVE_ACCEPT 0x00000008U
#define APIC_ESR_SEND_ILLEGAL_VECTOR 0x00000020U
#define APIC_ESR_RECEIVE_ILLEGAL_VECTOR 0x00000040U
#define APIC_ESR_ILLEGAL_REGISTER 0x00000080U
/* fields in ICR_LOW */
#define APIC_VECTOR_MASK 0x000000ff
#define APIC_VECTOR_MASK 0x000000ffU
#define APIC_DELMODE_MASK 0x00000700
#define APIC_DELMODE_FIXED 0x00000000
#define APIC_DELMODE_LOWPRIO 0x00000100
#define APIC_DELMODE_SMI 0x00000200
#define APIC_DELMODE_RR 0x00000300
#define APIC_DELMODE_NMI 0x00000400
#define APIC_DELMODE_INIT 0x00000500
#define APIC_DELMODE_STARTUP 0x00000600
#define APIC_DELMODE_RESV 0x00000700
#define APIC_DELMODE_MASK 0x00000700U
#define APIC_DELMODE_FIXED 0x00000000U
#define APIC_DELMODE_LOWPRIO 0x00000100U
#define APIC_DELMODE_SMI 0x00000200U
#define APIC_DELMODE_RR 0x00000300U
#define APIC_DELMODE_NMI 0x00000400U
#define APIC_DELMODE_INIT 0x00000500U
#define APIC_DELMODE_STARTUP 0x00000600U
#define APIC_DELMODE_RESV 0x00000700U
#define APIC_DESTMODE_MASK 0x00000800
#define APIC_DESTMODE_PHY 0x00000000
#define APIC_DESTMODE_LOG 0x00000800
#define APIC_DESTMODE_MASK 0x00000800U
#define APIC_DESTMODE_PHY 0x00000000U
#define APIC_DESTMODE_LOG 0x00000800U
#define APIC_DELSTAT_MASK 0x00001000
#define APIC_DELSTAT_IDLE 0x00000000
#define APIC_DELSTAT_PEND 0x00001000
#define APIC_DELSTAT_MASK 0x00001000U
#define APIC_DELSTAT_IDLE 0x00000000U
#define APIC_DELSTAT_PEND 0x00001000U
#define APIC_RESV1_MASK 0x00002000
#define APIC_RESV1_MASK 0x00002000U
#define APIC_LEVEL_MASK 0x00004000
#define APIC_LEVEL_DEASSERT 0x00000000
#define APIC_LEVEL_ASSERT 0x00004000
#define APIC_LEVEL_MASK 0x00004000U
#define APIC_LEVEL_DEASSERT 0x00000000U
#define APIC_LEVEL_ASSERT 0x00004000U
#define APIC_TRIGMOD_MASK 0x00008000
#define APIC_TRIGMOD_EDGE 0x00000000
#define APIC_TRIGMOD_LEVEL 0x00008000
#define APIC_TRIGMOD_MASK 0x00008000U
#define APIC_TRIGMOD_EDGE 0x00000000U
#define APIC_TRIGMOD_LEVEL 0x00008000U
#define APIC_RRSTAT_MASK 0x00030000
#define APIC_RRSTAT_INVALID 0x00000000
#define APIC_RRSTAT_INPROG 0x00010000
#define APIC_RRSTAT_VALID 0x00020000
#define APIC_RRSTAT_RESV 0x00030000
#define APIC_RRSTAT_MASK 0x00030000U
#define APIC_RRSTAT_INVALID 0x00000000U
#define APIC_RRSTAT_INPROG 0x00010000U
#define APIC_RRSTAT_VALID 0x00020000U
#define APIC_RRSTAT_RESV 0x00030000U
#define APIC_DEST_MASK 0x000c0000
#define APIC_DEST_DESTFLD 0x00000000
#define APIC_DEST_SELF 0x00040000
#define APIC_DEST_ALLISELF 0x00080000
#define APIC_DEST_ALLESELF 0x000c0000
#define APIC_DEST_MASK 0x000c0000U
#define APIC_DEST_DESTFLD 0x00000000U
#define APIC_DEST_SELF 0x00040000U
#define APIC_DEST_ALLISELF 0x00080000U
#define APIC_DEST_ALLESELF 0x000c0000U
#define APIC_RESV2_MASK 0xfff00000
#define APIC_RESV2_MASK 0xfff00000U
#define APIC_ICRLO_RESV_MASK (APIC_RESV1_MASK | APIC_RESV2_MASK)
/* fields in LVT1/2 */
#define APIC_LVT_VECTOR 0x000000ff
#define APIC_LVT_DM 0x00000700
#define APIC_LVT_DM_FIXED 0x00000000
#define APIC_LVT_DM_SMI 0x00000200
#define APIC_LVT_DM_NMI 0x00000400
#define APIC_LVT_DM_INIT 0x00000500
#define APIC_LVT_DM_EXTINT 0x00000700
#define APIC_LVT_DS 0x00001000
#define APIC_LVT_IIPP 0x00002000
#define APIC_LVT_IIPP_INTALO 0x00002000
#define APIC_LVT_IIPP_INTAHI 0x00000000
#define APIC_LVT_RIRR 0x00004000
#define APIC_LVT_TM 0x00008000
#define APIC_LVT_M 0x00010000
#define APIC_LVT_VECTOR 0x000000ffU
#define APIC_LVT_DM 0x00000700U
#define APIC_LVT_DM_FIXED 0x00000000U
#define APIC_LVT_DM_SMI 0x00000200U
#define APIC_LVT_DM_NMI 0x00000400U
#define APIC_LVT_DM_INIT 0x00000500U
#define APIC_LVT_DM_EXTINT 0x00000700U
#define APIC_LVT_DS 0x00001000U
#define APIC_LVT_IIPP 0x00002000U
#define APIC_LVT_IIPP_INTALO 0x00002000U
#define APIC_LVT_IIPP_INTAHI 0x00000000U
#define APIC_LVT_RIRR 0x00004000U
#define APIC_LVT_TM 0x00008000U
#define APIC_LVT_M 0x00010000U
/* fields in LVT Timer */
#define APIC_LVTT_VECTOR 0x000000ff
#define APIC_LVTT_DS 0x00001000
#define APIC_LVTT_M 0x00010000
#define APIC_LVTT_TM 0x00060000
#define APIC_LVTT_TM_ONE_SHOT 0x00000000
#define APIC_LVTT_TM_PERIODIC 0x00020000
#define APIC_LVTT_TM_TSCDLT 0x00040000
#define APIC_LVTT_TM_RSRV 0x00060000
#define APIC_LVTT_VECTOR 0x000000ffU
#define APIC_LVTT_DS 0x00001000U
#define APIC_LVTT_M 0x00010000U
#define APIC_LVTT_TM 0x00060000U
#define APIC_LVTT_TM_ONE_SHOT 0x00000000U
#define APIC_LVTT_TM_PERIODIC 0x00020000U
#define APIC_LVTT_TM_TSCDLT 0x00040000U
#define APIC_LVTT_TM_RSRV 0x00060000U
/* APIC timer current count */
#define APIC_TIMER_MAX_COUNT 0xffffffff
#define APIC_TIMER_MAX_COUNT 0xffffffffU
/* fields in TDCR */
#define APIC_TDCR_2 0x00
#define APIC_TDCR_4 0x01
#define APIC_TDCR_8 0x02
#define APIC_TDCR_16 0x03
#define APIC_TDCR_32 0x08
#define APIC_TDCR_64 0x09
#define APIC_TDCR_128 0x0a
#define APIC_TDCR_1 0x0b
#define APIC_TDCR_2 0x00U
#define APIC_TDCR_4 0x01U
#define APIC_TDCR_8 0x02U
#define APIC_TDCR_16 0x03U
#define APIC_TDCR_32 0x08U
#define APIC_TDCR_64 0x09U
#define APIC_TDCR_128 0x0aU
#define APIC_TDCR_1 0x0bU
/* Constants related to AMD Extended APIC Features Register */
#define APIC_EXTF_ELVT_MASK 0x00ff0000
#define APIC_EXTF_ELVT_MASK 0x00ff0000U
#define APIC_EXTF_ELVT_SHIFT 16
#define APIC_EXTF_EXTID_CAP 0x00000004
#define APIC_EXTF_SEIO_CAP 0x00000002
#define APIC_EXTF_IER_CAP 0x00000001
#define APIC_EXTF_EXTID_CAP 0x00000004U
#define APIC_EXTF_SEIO_CAP 0x00000002U
#define APIC_EXTF_IER_CAP 0x00000001U
/* LVT table indices */
#define APIC_LVT_TIMER 0
#define APIC_LVT_THERMAL 1
#define APIC_LVT_PMC 2
#define APIC_LVT_LINT0 3
#define APIC_LVT_LINT1 4
#define APIC_LVT_ERROR 5
#define APIC_LVT_CMCI 6
#define APIC_LVT_TIMER 0U
#define APIC_LVT_THERMAL 1U
#define APIC_LVT_PMC 2U
#define APIC_LVT_LINT0 3U
#define APIC_LVT_LINT1 4U
#define APIC_LVT_ERROR 5U
#define APIC_LVT_CMCI 6U
#define APIC_LVT_MAX APIC_LVT_CMCI
/* AMD extended LVT constants, seem to be assigned by fiat */
@@ -437,83 +437,83 @@ struct ioapic {
*/
/* default physical locations of an IO APIC */
#define DEFAULT_IO_APIC_BASE 0xfec00000
#define DEFAULT_IO_APIC_BASE 0xfec00000U
/* window register offset */
#define IOAPIC_WINDOW 0x10
#define IOAPIC_EOIR 0x40
#define IOAPIC_WINDOW 0x10U
#define IOAPIC_EOIR 0x40U
/* indexes into IO APIC */
#define IOAPIC_ID 0x00
#define IOAPIC_VER 0x01
#define IOAPIC_ARB 0x02
#define IOAPIC_REDTBL 0x10
#define IOAPIC_ID 0x00U
#define IOAPIC_VER 0x01U
#define IOAPIC_ARB 0x02U
#define IOAPIC_REDTBL 0x10U
#define IOAPIC_REDTBL0 IOAPIC_REDTBL
#define IOAPIC_REDTBL1 (IOAPIC_REDTBL+0x02)
#define IOAPIC_REDTBL2 (IOAPIC_REDTBL+0x04)
#define IOAPIC_REDTBL3 (IOAPIC_REDTBL+0x06)
#define IOAPIC_REDTBL4 (IOAPIC_REDTBL+0x08)
#define IOAPIC_REDTBL5 (IOAPIC_REDTBL+0x0a)
#define IOAPIC_REDTBL6 (IOAPIC_REDTBL+0x0c)
#define IOAPIC_REDTBL7 (IOAPIC_REDTBL+0x0e)
#define IOAPIC_REDTBL8 (IOAPIC_REDTBL+0x10)
#define IOAPIC_REDTBL9 (IOAPIC_REDTBL+0x12)
#define IOAPIC_REDTBL10 (IOAPIC_REDTBL+0x14)
#define IOAPIC_REDTBL11 (IOAPIC_REDTBL+0x16)
#define IOAPIC_REDTBL12 (IOAPIC_REDTBL+0x18)
#define IOAPIC_REDTBL13 (IOAPIC_REDTBL+0x1a)
#define IOAPIC_REDTBL14 (IOAPIC_REDTBL+0x1c)
#define IOAPIC_REDTBL15 (IOAPIC_REDTBL+0x1e)
#define IOAPIC_REDTBL16 (IOAPIC_REDTBL+0x20)
#define IOAPIC_REDTBL17 (IOAPIC_REDTBL+0x22)
#define IOAPIC_REDTBL18 (IOAPIC_REDTBL+0x24)
#define IOAPIC_REDTBL19 (IOAPIC_REDTBL+0x26)
#define IOAPIC_REDTBL20 (IOAPIC_REDTBL+0x28)
#define IOAPIC_REDTBL21 (IOAPIC_REDTBL+0x2a)
#define IOAPIC_REDTBL22 (IOAPIC_REDTBL+0x2c)
#define IOAPIC_REDTBL23 (IOAPIC_REDTBL+0x2e)
#define IOAPIC_REDTBL1 (IOAPIC_REDTBL+0x02U)
#define IOAPIC_REDTBL2 (IOAPIC_REDTBL+0x04U)
#define IOAPIC_REDTBL3 (IOAPIC_REDTBL+0x06U)
#define IOAPIC_REDTBL4 (IOAPIC_REDTBL+0x08U)
#define IOAPIC_REDTBL5 (IOAPIC_REDTBL+0x0aU)
#define IOAPIC_REDTBL6 (IOAPIC_REDTBL+0x0cU)
#define IOAPIC_REDTBL7 (IOAPIC_REDTBL+0x0eU)
#define IOAPIC_REDTBL8 (IOAPIC_REDTBL+0x10U)
#define IOAPIC_REDTBL9 (IOAPIC_REDTBL+0x12U)
#define IOAPIC_REDTBL10 (IOAPIC_REDTBL+0x14U)
#define IOAPIC_REDTBL11 (IOAPIC_REDTBL+0x16U)
#define IOAPIC_REDTBL12 (IOAPIC_REDTBL+0x18U)
#define IOAPIC_REDTBL13 (IOAPIC_REDTBL+0x1aU)
#define IOAPIC_REDTBL14 (IOAPIC_REDTBL+0x1cU)
#define IOAPIC_REDTBL15 (IOAPIC_REDTBL+0x1eU)
#define IOAPIC_REDTBL16 (IOAPIC_REDTBL+0x20U)
#define IOAPIC_REDTBL17 (IOAPIC_REDTBL+0x22U)
#define IOAPIC_REDTBL18 (IOAPIC_REDTBL+0x24U)
#define IOAPIC_REDTBL19 (IOAPIC_REDTBL+0x26U)
#define IOAPIC_REDTBL20 (IOAPIC_REDTBL+0x28U)
#define IOAPIC_REDTBL21 (IOAPIC_REDTBL+0x2aU)
#define IOAPIC_REDTBL22 (IOAPIC_REDTBL+0x2cU)
#define IOAPIC_REDTBL23 (IOAPIC_REDTBL+0x2eU)
/* fields in VER, for redirection entry */
#define IOAPIC_MAX_RTE_MASK 0x00ff0000
#define MAX_RTE_SHIFT 16
#define IOAPIC_MAX_RTE_MASK 0x00ff0000U
#define MAX_RTE_SHIFT 16U
/*
* fields in the IO APIC's redirection table entries
*/
#define IOAPIC_RTE_DEST APIC_ID_MASK /* broadcast addr: all APICs */
#define IOAPIC_RTE_RESV 0x00fe0000 /* reserved */
#define IOAPIC_RTE_RESV 0x00fe0000UL /* reserved */
#define IOAPIC_RTE_INTMASK 0x00010000 /* R/W: INTerrupt mask */
#define IOAPIC_RTE_INTMCLR 0x00000000 /* clear, allow INTs */
#define IOAPIC_RTE_INTMSET 0x00010000 /* set, inhibit INTs */
#define IOAPIC_RTE_INTMASK 0x00010000UL /* R/W: INTerrupt mask */
#define IOAPIC_RTE_INTMCLR 0x00000000UL /* clear, allow INTs */
#define IOAPIC_RTE_INTMSET 0x00010000UL /* set, inhibit INTs */
#define IOAPIC_RTE_TRGRMOD 0x00008000 /* R/W: trigger mode */
#define IOAPIC_RTE_TRGREDG 0x00000000 /* edge */
#define IOAPIC_RTE_TRGRLVL 0x00008000 /* level */
#define IOAPIC_RTE_TRGRMOD 0x00008000UL /* R/W: trigger mode */
#define IOAPIC_RTE_TRGREDG 0x00000000UL /* edge */
#define IOAPIC_RTE_TRGRLVL 0x00008000UL /* level */
#define IOAPIC_RTE_REM_IRR 0x00004000 /* RO: remote IRR */
#define IOAPIC_RTE_REM_IRR 0x00004000UL /* RO: remote IRR */
#define IOAPIC_RTE_INTPOL 0x00002000 /*R/W:INT input pin polarity*/
#define IOAPIC_RTE_INTAHI 0x00000000 /* active high */
#define IOAPIC_RTE_INTALO 0x00002000 /* active low */
#define IOAPIC_RTE_INTPOL 0x00002000UL /*R/W:INT input pin polarity*/
#define IOAPIC_RTE_INTAHI 0x00000000UL /* active high */
#define IOAPIC_RTE_INTALO 0x00002000UL /* active low */
#define IOAPIC_RTE_DELIVS 0x00001000 /* RO: delivery status */
#define IOAPIC_RTE_DELIVS 0x00001000UL /* RO: delivery status */
#define IOAPIC_RTE_DESTMOD 0x00000800 /*R/W:destination mode*/
#define IOAPIC_RTE_DESTPHY 0x00000000 /* physical */
#define IOAPIC_RTE_DESTLOG 0x00000800 /* logical */
#define IOAPIC_RTE_DESTMOD 0x00000800UL /*R/W:destination mode*/
#define IOAPIC_RTE_DESTPHY 0x00000000UL /* physical */
#define IOAPIC_RTE_DESTLOG 0x00000800UL /* logical */
#define IOAPIC_RTE_DELMOD 0x00000700 /* R/W: delivery mode */
#define IOAPIC_RTE_DELFIXED 0x00000000 /* fixed */
#define IOAPIC_RTE_DELLOPRI 0x00000100 /* lowest priority */
#define IOAPIC_RTE_DELSMI 0x00000200 /*System Management INT*/
#define IOAPIC_RTE_DELRSV1 0x00000300 /* reserved */
#define IOAPIC_RTE_DELNMI 0x00000400 /* NMI signal */
#define IOAPIC_RTE_DELINIT 0x00000500 /* INIT signal */
#define IOAPIC_RTE_DELRSV2 0x00000600 /* reserved */
#define IOAPIC_RTE_DELEXINT 0x00000700 /* External INTerrupt */
#define IOAPIC_RTE_DELMOD 0x00000700UL /* R/W: delivery mode */
#define IOAPIC_RTE_DELFIXED 0x00000000UL /* fixed */
#define IOAPIC_RTE_DELLOPRI 0x00000100UL /* lowest priority */
#define IOAPIC_RTE_DELSMI 0x00000200UL /*System Management INT*/
#define IOAPIC_RTE_DELRSV1 0x00000300UL /* reserved */
#define IOAPIC_RTE_DELNMI 0x00000400UL /* NMI signal */
#define IOAPIC_RTE_DELINIT 0x00000500UL /* INIT signal */
#define IOAPIC_RTE_DELRSV2 0x00000600UL /* reserved */
#define IOAPIC_RTE_DELEXINT 0x00000700UL /* External INTerrupt */
#define IOAPIC_RTE_INTVEC 0x000000ff /*R/W: INT vector field*/
#define IOAPIC_RTE_INTVEC 0x000000ffUL /*R/W: INT vector field*/
#endif /* _APICREG_H_ */

View File

@@ -30,14 +30,14 @@
#ifndef _VPIC_H_
#define _VPIC_H_
#define ICU_IMR_OFFSET 1
#define ICU_IMR_OFFSET 1U
/* Initialization control word 1. Written to even address. */
#define ICW1_IC4 0x01 /* ICW4 present */
#define ICW1_SNGL 0x02 /* 1 = single, 0 = cascaded */
#define ICW1_ADI 0x04 /* 1 = 4, 0 = 8 byte vectors */
#define ICW1_LTIM 0x08 /* 1 = level trigger, 0 = edge */
#define ICW1_RESET 0x10 /* must be 1 */
#define ICW1_IC4 0x01U /* ICW4 present */
#define ICW1_SNGL 0x02U /* 1 = single, 0 = cascaded */
#define ICW1_ADI 0x04U /* 1 = 4, 0 = 8 byte vectors */
#define ICW1_LTIM 0x08U /* 1 = level trigger, 0 = edge */
#define ICW1_RESET 0x10U /* must be 1 */
/* 0x20 - 0x80 - in 8080/8085 mode only */
/* Initialization control word 2. Written to the odd address. */
@@ -48,11 +48,11 @@
/* For slave, lower 3 bits are the slave's ID binary id on master */
/* Initialization control word 4. Written to the odd address. */
#define ICW4_8086 0x01 /* 1 = 8086, 0 = 8080 */
#define ICW4_AEOI 0x02 /* 1 = Auto EOI */
#define ICW4_MS 0x04 /* 1 = buffered master, 0 = slave */
#define ICW4_BUF 0x08 /* 1 = enable buffer mode */
#define ICW4_SFNM 0x10 /* 1 = special fully nested mode */
#define ICW4_8086 0x01U /* 1 = 8086, 0 = 8080 */
#define ICW4_AEOI 0x02U /* 1 = Auto EOI */
#define ICW4_MS 0x04U /* 1 = buffered master, 0 = slave */
#define ICW4_BUF 0x08U /* 1 = enable buffer mode */
#define ICW4_SFNM 0x10U /* 1 = special fully nested mode */
/* Operation control words. Written after initialization. */
@@ -63,27 +63,27 @@
*/
/* Operation control word type 2. Bit 3 (0x08) must be zero. Even address. */
#define OCW2_L0 0x01 /* Level */
#define OCW2_L1 0x02
#define OCW2_L2 0x04
#define OCW2_L0 0x01U /* Level */
#define OCW2_L1 0x02U
#define OCW2_L2 0x04U
/* 0x08 must be 0 to select OCW2 vs OCW3 */
/* 0x10 must be 0 to select OCW2 vs ICW1 */
#define OCW2_EOI 0x20 /* 1 = EOI */
#define OCW2_SL 0x40 /* EOI mode */
#define OCW2_R 0x80 /* EOI mode */
#define OCW2_EOI 0x20U /* 1 = EOI */
#define OCW2_SL 0x40U /* EOI mode */
#define OCW2_R 0x80U /* EOI mode */
/* Operation control word type 3. Bit 3 (0x08) must be set. Even address. */
#define OCW3_RIS 0x01 /* 1 = read IS, 0 = read IR */
#define OCW3_RR 0x02 /* register read */
#define OCW3_P 0x04 /* poll mode command */
#define OCW3_RIS 0x01U /* 1 = read IS, 0 = read IR */
#define OCW3_RR 0x02U /* register read */
#define OCW3_P 0x04U /* poll mode command */
/* 0x08 must be 1 to select OCW3 vs OCW2 */
#define OCW3_SEL 0x08 /* must be 1 */
#define OCW3_SEL 0x08U /* must be 1 */
/* 0x10 must be 0 to select OCW3 vs ICW1 */
#define OCW3_SMM 0x20 /* special mode mask */
#define OCW3_ESMM 0x40 /* enable SMM */
#define OCW3_SMM 0x20U /* special mode mask */
#define OCW3_ESMM 0x40U /* enable SMM */
#define IO_ELCR1 0x4d0
#define IO_ELCR2 0x4d1
#define IO_ELCR1 0x4d0U
#define IO_ELCR2 0x4d1U
enum vpic_trigger {
EDGE_TRIGGER,

View File

@@ -8,30 +8,30 @@
#define IRQ_H
/* vectors for normal, usually for devices */
#define VECTOR_FOR_NOR_LOWPRI_START 0x20
#define VECTOR_FOR_NOR_LOWPRI_END 0x7F
#define VECTOR_FOR_NOR_HIGHPRI_START 0x80
#define VECTOR_FOR_NOR_HIGHPRI_END 0xDF
#define VECTOR_FOR_NOR_LOWPRI_START 0x20U
#define VECTOR_FOR_NOR_LOWPRI_END 0x7FU
#define VECTOR_FOR_NOR_HIGHPRI_START 0x80U
#define VECTOR_FOR_NOR_HIGHPRI_END 0xDFU
#define VECTOR_FOR_NOR_END VECTOR_FOR_NOR_HIGHPRI_END
#define VECTOR_FOR_INTR_START VECTOR_FOR_NOR_LOWPRI_START
/* vectors for priority, usually for HV service */
#define VECTOR_FOR_PRI_START 0xE0
#define VECTOR_FOR_PRI_END 0xFF
#define VECTOR_TIMER 0xEF
#define VECTOR_NOTIFY_VCPU 0xF0
#define VECTOR_VIRT_IRQ_VHM 0xF7
#define VECTOR_SPURIOUS 0xFF
#define VECTOR_FOR_PRI_START 0xE0U
#define VECTOR_FOR_PRI_END 0xFFU
#define VECTOR_TIMER 0xEFU
#define VECTOR_NOTIFY_VCPU 0xF0U
#define VECTOR_VIRT_IRQ_VHM 0xF7U
#define VECTOR_SPURIOUS 0xFFU
#define NR_MAX_VECTOR 0xFF
#define VECTOR_INVALID (NR_MAX_VECTOR + 1)
#define NR_MAX_IRQS (256+16)
#define IRQ_INVALID (NR_MAX_IRQS+1)
#define NR_MAX_VECTOR 0xFFU
#define VECTOR_INVALID (NR_MAX_VECTOR + 1U)
#define NR_MAX_IRQS (256U + 16U)
#define IRQ_INVALID (NR_MAX_IRQS + 1U)
#define DEFAULT_DEST_MODE IOAPIC_RTE_DESTLOG
#define DEFAULT_DELIVERY_MODE IOAPIC_RTE_DELLOPRI
#define ALL_CPUS_MASK ((1 << phy_cpu_num) - 1)
#define ALL_CPUS_MASK ((1U << phy_cpu_num) - 1U)
struct irq_desc;
@@ -145,17 +145,17 @@ extern spurious_handler_t spurious_handler;
/*
* Some MSI message definitions
*/
#define MSI_ADDR_MASK 0xfff00000
#define MSI_ADDR_BASE 0xfee00000
#define MSI_ADDR_RH 0x00000008 /* Redirection Hint */
#define MSI_ADDR_LOG 0x00000004 /* Destination Mode */
#define MSI_ADDR_MASK 0xfff00000U
#define MSI_ADDR_BASE 0xfee00000U
#define MSI_ADDR_RH 0x00000008U /* Redirection Hint */
#define MSI_ADDR_LOG 0x00000004U /* Destination Mode */
/* RFLAGS */
#define HV_ARCH_VCPU_RFLAGS_IF (1<<9)
#define HV_ARCH_VCPU_RFLAGS_IF (1U<<9)
/* Interruptability State info */
#define HV_ARCH_VCPU_BLOCKED_BY_MOVSS (1<<1)
#define HV_ARCH_VCPU_BLOCKED_BY_STI (1<<0)
#define HV_ARCH_VCPU_BLOCKED_BY_MOVSS (1U<<1)
#define HV_ARCH_VCPU_BLOCKED_BY_STI (1U<<0)
void vcpu_inject_extint(struct vcpu *vcpu);
void vcpu_inject_nmi(struct vcpu *vcpu);

View File

@@ -41,75 +41,75 @@ enum intr_lapic_icr_shorthand {
};
/* Default LAPIC base */
#define LAPIC_BASE 0xFEE00000
#define LAPIC_BASE 0xFEE00000U
/* LAPIC register offset for memory mapped IO access */
#define LAPIC_ID_REGISTER 0x00000020
#define LAPIC_VERSION_REGISTER 0x00000030
#define LAPIC_TASK_PRIORITY_REGISTER 0x00000080
#define LAPIC_ARBITRATION_PRIORITY_REGISTER 0x00000090
#define LAPIC_PROCESSOR_PRIORITY_REGISTER 0x000000A0
#define LAPIC_EOI_REGISTER 0x000000B0
#define LAPIC_REMOTE_READ_REGISTER 0x000000C0
#define LAPIC_LOGICAL_DESTINATION_REGISTER 0x000000D0
#define LAPIC_DESTINATION_FORMAT_REGISTER 0x000000E0
#define LAPIC_SPURIOUS_VECTOR_REGISTER 0x000000F0
#define LAPIC_IN_SERVICE_REGISTER_0 0x00000100
#define LAPIC_IN_SERVICE_REGISTER_1 0x00000110
#define LAPIC_IN_SERVICE_REGISTER_2 0x00000120
#define LAPIC_IN_SERVICE_REGISTER_3 0x00000130
#define LAPIC_IN_SERVICE_REGISTER_4 0x00000140
#define LAPIC_IN_SERVICE_REGISTER_5 0x00000150
#define LAPIC_IN_SERVICE_REGISTER_6 0x00000160
#define LAPIC_IN_SERVICE_REGISTER_7 0x00000170
#define LAPIC_TRIGGER_MODE_REGISTER_0 0x00000180
#define LAPIC_TRIGGER_MODE_REGISTER_1 0x00000190
#define LAPIC_TRIGGER_MODE_REGISTER_2 0x000001A0
#define LAPIC_TRIGGER_MODE_REGISTER_3 0x000001B0
#define LAPIC_TRIGGER_MODE_REGISTER_4 0x000001C0
#define LAPIC_TRIGGER_MODE_REGISTER_5 0x000001D0
#define LAPIC_TRIGGER_MODE_REGISTER_6 0x000001E0
#define LAPIC_TRIGGER_MODE_REGISTER_7 0x000001F0
#define LAPIC_INT_REQUEST_REGISTER_0 0x00000200
#define LAPIC_INT_REQUEST_REGISTER_1 0x00000210
#define LAPIC_INT_REQUEST_REGISTER_2 0x00000220
#define LAPIC_INT_REQUEST_REGISTER_3 0x00000230
#define LAPIC_INT_REQUEST_REGISTER_4 0x00000240
#define LAPIC_INT_REQUEST_REGISTER_5 0x00000250
#define LAPIC_INT_REQUEST_REGISTER_6 0x00000260
#define LAPIC_INT_REQUEST_REGISTER_7 0x00000270
#define LAPIC_ERROR_STATUS_REGISTER 0x00000280
#define LAPIC_LVT_CMCI_REGISTER 0x000002F0
#define LAPIC_INT_COMMAND_REGISTER_0 0x00000300
#define LAPIC_INT_COMMAND_REGISTER_1 0x00000310
#define LAPIC_LVT_TIMER_REGISTER 0x00000320
#define LAPIC_LVT_THERMAL_SENSOR_REGISTER 0x00000330
#define LAPIC_LVT_PMC_REGISTER 0x00000340
#define LAPIC_LVT_LINT0_REGISTER 0x00000350
#define LAPIC_LVT_LINT1_REGISTER 0x00000360
#define LAPIC_LVT_ERROR_REGISTER 0x00000370
#define LAPIC_INITIAL_COUNT_REGISTER 0x00000380
#define LAPIC_CURRENT_COUNT_REGISTER 0x00000390
#define LAPIC_DIVIDE_CONFIGURATION_REGISTER 0x000003E0
#define LAPIC_ID_REGISTER 0x00000020U
#define LAPIC_VERSION_REGISTER 0x00000030U
#define LAPIC_TASK_PRIORITY_REGISTER 0x00000080U
#define LAPIC_ARBITRATION_PRIORITY_REGISTER 0x00000090U
#define LAPIC_PROCESSOR_PRIORITY_REGISTER 0x000000A0U
#define LAPIC_EOI_REGISTER 0x000000B0U
#define LAPIC_REMOTE_READ_REGISTER 0x000000C0U
#define LAPIC_LOGICAL_DESTINATION_REGISTER 0x000000D0U
#define LAPIC_DESTINATION_FORMAT_REGISTER 0x000000E0U
#define LAPIC_SPURIOUS_VECTOR_REGISTER 0x000000F0U
#define LAPIC_IN_SERVICE_REGISTER_0 0x00000100U
#define LAPIC_IN_SERVICE_REGISTER_1 0x00000110U
#define LAPIC_IN_SERVICE_REGISTER_2 0x00000120U
#define LAPIC_IN_SERVICE_REGISTER_3 0x00000130U
#define LAPIC_IN_SERVICE_REGISTER_4 0x00000140U
#define LAPIC_IN_SERVICE_REGISTER_5 0x00000150U
#define LAPIC_IN_SERVICE_REGISTER_6 0x00000160U
#define LAPIC_IN_SERVICE_REGISTER_7 0x00000170U
#define LAPIC_TRIGGER_MODE_REGISTER_0 0x00000180U
#define LAPIC_TRIGGER_MODE_REGISTER_1 0x00000190U
#define LAPIC_TRIGGER_MODE_REGISTER_2 0x000001A0U
#define LAPIC_TRIGGER_MODE_REGISTER_3 0x000001B0U
#define LAPIC_TRIGGER_MODE_REGISTER_4 0x000001C0U
#define LAPIC_TRIGGER_MODE_REGISTER_5 0x000001D0U
#define LAPIC_TRIGGER_MODE_REGISTER_6 0x000001E0U
#define LAPIC_TRIGGER_MODE_REGISTER_7 0x000001F0U
#define LAPIC_INT_REQUEST_REGISTER_0 0x00000200U
#define LAPIC_INT_REQUEST_REGISTER_1 0x00000210U
#define LAPIC_INT_REQUEST_REGISTER_2 0x00000220U
#define LAPIC_INT_REQUEST_REGISTER_3 0x00000230U
#define LAPIC_INT_REQUEST_REGISTER_4 0x00000240U
#define LAPIC_INT_REQUEST_REGISTER_5 0x00000250U
#define LAPIC_INT_REQUEST_REGISTER_6 0x00000260U
#define LAPIC_INT_REQUEST_REGISTER_7 0x00000270U
#define LAPIC_ERROR_STATUS_REGISTER 0x00000280U
#define LAPIC_LVT_CMCI_REGISTER 0x000002F0U
#define LAPIC_INT_COMMAND_REGISTER_0 0x00000300U
#define LAPIC_INT_COMMAND_REGISTER_1 0x00000310U
#define LAPIC_LVT_TIMER_REGISTER 0x00000320U
#define LAPIC_LVT_THERMAL_SENSOR_REGISTER 0x00000330U
#define LAPIC_LVT_PMC_REGISTER 0x00000340U
#define LAPIC_LVT_LINT0_REGISTER 0x00000350U
#define LAPIC_LVT_LINT1_REGISTER 0x00000360U
#define LAPIC_LVT_ERROR_REGISTER 0x00000370U
#define LAPIC_INITIAL_COUNT_REGISTER 0x00000380U
#define LAPIC_CURRENT_COUNT_REGISTER 0x00000390U
#define LAPIC_DIVIDE_CONFIGURATION_REGISTER 0x000003E0U
/* LAPIC CPUID bit and bitmask definitions */
#define CPUID_OUT_RDX_APIC_PRESENT ((uint64_t) 1 << 9)
#define CPUID_OUT_RCX_X2APIC_PRESENT ((uint64_t) 1 << 21)
#define CPUID_OUT_RDX_APIC_PRESENT ((uint64_t) 1UL << 9)
#define CPUID_OUT_RCX_X2APIC_PRESENT ((uint64_t) 1UL << 21)
/* LAPIC MSR bit and bitmask definitions */
#define MSR_01B_XAPIC_GLOBAL_ENABLE ((uint64_t) 1 << 11)
#define MSR_01B_XAPIC_GLOBAL_ENABLE ((uint64_t) 1UL << 11)
/* LAPIC register bit and bitmask definitions */
#define LAPIC_SVR_VECTOR 0x000000FF
#define LAPIC_SVR_APIC_ENABLE_MASK 0x00000100
#define LAPIC_SVR_VECTOR 0x000000FFU
#define LAPIC_SVR_APIC_ENABLE_MASK 0x00000100U
#define LAPIC_LVT_MASK 0x00010000
#define LAPIC_DELIVERY_MODE_EXTINT_MASK 0x00000700
#define LAPIC_LVT_MASK 0x00010000U
#define LAPIC_DELIVERY_MODE_EXTINT_MASK 0x00000700U
/* LAPIC Timer bit and bitmask definitions */
#define LAPIC_TMR_ONESHOT ((uint32_t) 0x0 << 17)
#define LAPIC_TMR_PERIODIC ((uint32_t) 0x1 << 17)
#define LAPIC_TMR_TSC_DEADLINE ((uint32_t) 0x2 << 17)
#define LAPIC_TMR_ONESHOT ((uint32_t) 0x0U << 17)
#define LAPIC_TMR_PERIODIC ((uint32_t) 0x1U << 17)
#define LAPIC_TMR_TSC_DEADLINE ((uint32_t) 0x2U << 17)
enum intr_cpu_startup_shorthand {
INTR_CPU_STARTUP_USE_DEST,