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_ */