Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 2 | * Copyright (c) 2013-2016, 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> |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 20 | #include <types.h> |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 21 | |
| 22 | |
| 23 | /* GICv3 Re-distributor interface registers & shifts */ |
| 24 | #define GICR_PCPUBASE_SHIFT 0x11 |
| 25 | #define GICR_TYPER 0x08 |
| 26 | #define GICR_WAKER 0x14 |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 27 | |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 28 | /* GICR_WAKER bit definitions */ |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 29 | #define WAKER_CA (U(1) << 2) |
| 30 | #define WAKER_PS (U(1) << 1) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 31 | |
| 32 | /* GICR_TYPER bit definitions */ |
| 33 | #define GICR_TYPER_AFF_SHIFT 32 |
| 34 | #define GICR_TYPER_AFF_MASK 0xffffffff |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 35 | #define GICR_TYPER_LAST (U(1) << 4) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 36 | |
| 37 | /* GICv3 ICC_SRE register bit definitions*/ |
Antonio Nino Diaz | f94e40d | 2017-09-14 15:57:44 +0100 | [diff] [blame] | 38 | #define ICC_SRE_EN (U(1) << 3) |
| 39 | #define ICC_SRE_SRE (U(1) << 0) |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 40 | |
| 41 | /******************************************************************************* |
| 42 | * GICv3 defintions |
| 43 | ******************************************************************************/ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 44 | #define GICV3_AFFLVL_MASK 0xff |
| 45 | #define GICV3_AFF0_SHIFT 0 |
| 46 | #define GICV3_AFF1_SHIFT 8 |
| 47 | #define GICV3_AFF2_SHIFT 16 |
| 48 | #define GICV3_AFF3_SHIFT 24 |
| 49 | #define GICV3_AFFINITY_MASK 0xffffffff |
| 50 | |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 51 | /******************************************************************************* |
| 52 | * Function prototypes |
| 53 | ******************************************************************************/ |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 54 | 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] | 55 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 56 | /******************************************************************************* |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 57 | * GIC Redistributor interface accessors |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 58 | ******************************************************************************/ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 59 | static inline uint32_t gicr_read_waker(uintptr_t base) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 60 | { |
| 61 | return mmio_read_32(base + GICR_WAKER); |
| 62 | } |
| 63 | |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 64 | static inline void gicr_write_waker(uintptr_t base, uint32_t val) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 65 | { |
| 66 | mmio_write_32(base + GICR_WAKER, val); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 67 | } |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 68 | |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 69 | static inline uint64_t gicr_read_typer(uintptr_t base) |
| 70 | { |
| 71 | return mmio_read_64(base + GICR_TYPER); |
| 72 | } |
| 73 | |
| 74 | |
Sandrine Bailleux | 27866d8 | 2013-10-25 15:33:39 +0100 | [diff] [blame] | 75 | #endif /* __GIC_V3_H__ */ |