Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 4b32e62 | 2018-08-16 16:52:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 7 | #ifndef __GIC_V3_H__ |
| 8 | #define __GIC_V3_H__ |
| 9 | |
Soby Mathew | 3ddc972 | 2015-10-26 14:32:09 +0000 | [diff] [blame] | 10 | /****************************************************************************** |
| 11 | * THIS DRIVER IS DEPRECATED. For GICv2 systems, use the driver in gicv2.h |
| 12 | * and for GICv3 systems, use the driver in gicv3.h. |
| 13 | *****************************************************************************/ |
| 14 | #if ERROR_DEPRECATED |
| 15 | #error " The legacy ARM GIC driver is deprecated." |
| 16 | #endif |
| 17 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 18 | #include <mmio.h> |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 19 | #include <stdint.h> |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 20 | |
| 21 | /* GICv3 Re-distributor interface registers & shifts */ |
| 22 | #define GICR_PCPUBASE_SHIFT 0x11 |
| 23 | #define GICR_TYPER 0x08 |
| 24 | #define GICR_WAKER 0x14 |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 25 | |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 26 | /* GICR_WAKER bit definitions */ |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 27 | #define WAKER_CA (U(1) << 2) |
| 28 | #define WAKER_PS (U(1) << 1) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 29 | |
| 30 | /* GICR_TYPER bit definitions */ |
| 31 | #define GICR_TYPER_AFF_SHIFT 32 |
| 32 | #define GICR_TYPER_AFF_MASK 0xffffffff |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 33 | #define GICR_TYPER_LAST (U(1) << 4) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 34 | |
| 35 | /* GICv3 ICC_SRE register bit definitions*/ |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 36 | #define ICC_SRE_EN (U(1) << 3) |
| 37 | #define ICC_SRE_SRE (U(1) << 0) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 38 | |
| 39 | /******************************************************************************* |
| 40 | * GICv3 defintions |
| 41 | ******************************************************************************/ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 42 | #define GICV3_AFFLVL_MASK 0xff |
| 43 | #define GICV3_AFF0_SHIFT 0 |
| 44 | #define GICV3_AFF1_SHIFT 8 |
| 45 | #define GICV3_AFF2_SHIFT 16 |
| 46 | #define GICV3_AFF3_SHIFT 24 |
| 47 | #define GICV3_AFFINITY_MASK 0xffffffff |
| 48 | |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 49 | /******************************************************************************* |
| 50 | * Function prototypes |
| 51 | ******************************************************************************/ |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 52 | uintptr_t gicv3_get_rdist(uintptr_t gicr_base, u_register_t mpidr); |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 53 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 54 | /******************************************************************************* |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 55 | * GIC Redistributor interface accessors |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 56 | ******************************************************************************/ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 57 | static inline uint32_t gicr_read_waker(uintptr_t base) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 58 | { |
| 59 | return mmio_read_32(base + GICR_WAKER); |
| 60 | } |
| 61 | |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 62 | static inline void gicr_write_waker(uintptr_t base, uint32_t val) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 63 | { |
| 64 | mmio_write_32(base + GICR_WAKER, val); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 65 | } |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 66 | |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 67 | static inline uint64_t gicr_read_typer(uintptr_t base) |
| 68 | { |
| 69 | return mmio_read_64(base + GICR_TYPER); |
| 70 | } |
| 71 | |
| 72 | |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 73 | #endif /* __GIC_V3_H__ */ |