Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
875a85aa
Unverified
Commit
875a85aa
authored
Mar 29, 2018
by
Dimitris Papastamos
Committed by
GitHub
Mar 29, 2018
Browse files
Merge pull request #1333 from jeenu-arm/icfg-fix
GIC: Fix interrupt setting interrupt configuration
parents
79c0f525
17e84eed
Changes
3
Show whitespace changes
Inline
Side-by-side
drivers/arm/gic/common/gic_common.c
View file @
875a85aa
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -302,12 +302,15 @@ void gicd_set_ipriorityr(uintptr_t base, unsigned int id, unsigned int pri)
void
gicd_set_icfgr
(
uintptr_t
base
,
unsigned
int
id
,
unsigned
int
cfg
)
{
unsigned
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
/* Interrupt configuration is a 2-bit field */
unsigned
int
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
unsigned
int
bit_shift
=
bit_num
<<
1
;
uint32_t
reg_val
=
gicd_read_icfgr
(
base
,
id
);
/* Clear the field, and insert required configuration */
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
num
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
num
);
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
shift
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
shift
);
gicd_write_icfgr
(
base
,
id
,
reg_val
);
}
drivers/arm/gic/v3/gicv3_helpers.c
View file @
875a85aa
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -232,12 +232,15 @@ void gicr_set_ipriorityr(uintptr_t base, unsigned int id, unsigned int pri)
*/
void
gicr_set_icfgr0
(
uintptr_t
base
,
unsigned
int
id
,
unsigned
int
cfg
)
{
unsigned
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
/* Interrupt configuration is a 2-bit field */
unsigned
int
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
unsigned
int
bit_shift
=
bit_num
<<
1
;
uint32_t
reg_val
=
gicr_read_icfgr0
(
base
);
/* Clear the field, and insert required configuration */
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
num
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
num
);
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
shift
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
shift
);
gicr_write_icfgr0
(
base
,
reg_val
);
}
...
...
@@ -248,12 +251,15 @@ void gicr_set_icfgr0(uintptr_t base, unsigned int id, unsigned int cfg)
*/
void
gicr_set_icfgr1
(
uintptr_t
base
,
unsigned
int
id
,
unsigned
int
cfg
)
{
unsigned
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
/* Interrupt configuration is a 2-bit field */
unsigned
int
bit_num
=
id
&
((
1
<<
ICFGR_SHIFT
)
-
1
);
unsigned
int
bit_shift
=
bit_num
<<
1
;
uint32_t
reg_val
=
gicr_read_icfgr1
(
base
);
/* Clear the field, and insert required configuration */
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
num
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
num
);
reg_val
&=
~
(
GIC_CFG_MASK
<<
bit_
shift
);
reg_val
|=
((
cfg
&
GIC_CFG_MASK
)
<<
bit_
shift
);
gicr_write_icfgr1
(
base
,
reg_val
);
}
...
...
include/drivers/arm/gic_common.h
View file @
875a85aa
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -29,9 +29,9 @@
/* Constant to indicate a spurious interrupt in all GIC versions */
#define GIC_SPURIOUS_INTERRUPT 1023
/* Interrupt configurations */
#define GIC_INTR_CFG_LEVEL
0
#define GIC_INTR_CFG_EDGE
1
/* Interrupt configurations
: 2-bit fields with LSB reserved
*/
#define GIC_INTR_CFG_LEVEL
(0 << 1)
#define GIC_INTR_CFG_EDGE
(1 << 1)
/* Constants to categorise priorities */
#define GIC_HIGHEST_SEC_PRIORITY 0x0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment