blob: 549b4d9f320d15d0bba7a6b5df6187726ddd7179 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Antonio Nino Diaz4b32e622018-08-16 16:52:57 +01002 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005 */
6
Sandrine Bailleux27866d82013-10-25 15:33:39 +01007#ifndef __GIC_V3_H__
8#define __GIC_V3_H__
9
Soby Mathew3ddc9722015-10-26 14:32:09 +000010/******************************************************************************
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 Gupta4f6ad662013-10-25 09:08:21 +010018#include <mmio.h>
Dan Handley930ee2e2014-04-17 17:48:52 +010019#include <stdint.h>
Dan Handley930ee2e2014-04-17 17:48:52 +010020
21/* GICv3 Re-distributor interface registers & shifts */
22#define GICR_PCPUBASE_SHIFT 0x11
23#define GICR_TYPER 0x08
24#define GICR_WAKER 0x14
Achin Gupta4f6ad662013-10-25 09:08:21 +010025
Dan Handley930ee2e2014-04-17 17:48:52 +010026/* GICR_WAKER bit definitions */
Antonio Nino Diazf94e40d2017-09-14 15:57:44 +010027#define WAKER_CA (U(1) << 2)
28#define WAKER_PS (U(1) << 1)
Dan Handley930ee2e2014-04-17 17:48:52 +010029
30/* GICR_TYPER bit definitions */
31#define GICR_TYPER_AFF_SHIFT 32
32#define GICR_TYPER_AFF_MASK 0xffffffff
Antonio Nino Diazf94e40d2017-09-14 15:57:44 +010033#define GICR_TYPER_LAST (U(1) << 4)
Dan Handley930ee2e2014-04-17 17:48:52 +010034
35/* GICv3 ICC_SRE register bit definitions*/
Antonio Nino Diazf94e40d2017-09-14 15:57:44 +010036#define ICC_SRE_EN (U(1) << 3)
37#define ICC_SRE_SRE (U(1) << 0)
Dan Handley930ee2e2014-04-17 17:48:52 +010038
39/*******************************************************************************
40 * GICv3 defintions
41 ******************************************************************************/
Harry Liebeleaec5902013-12-12 13:00:29 +000042#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 Handley930ee2e2014-04-17 17:48:52 +010049/*******************************************************************************
50 * Function prototypes
51 ******************************************************************************/
Soby Mathewa0fedc42016-06-16 14:52:04 +010052uintptr_t gicv3_get_rdist(uintptr_t gicr_base, u_register_t mpidr);
Harry Liebeleaec5902013-12-12 13:00:29 +000053
Achin Gupta4f6ad662013-10-25 09:08:21 +010054/*******************************************************************************
Sandrine Bailleux27866d82013-10-25 15:33:39 +010055 * GIC Redistributor interface accessors
Achin Gupta4f6ad662013-10-25 09:08:21 +010056 ******************************************************************************/
Harry Liebeleaec5902013-12-12 13:00:29 +000057static inline uint32_t gicr_read_waker(uintptr_t base)
Achin Gupta4f6ad662013-10-25 09:08:21 +010058{
59 return mmio_read_32(base + GICR_WAKER);
60}
61
Harry Liebeleaec5902013-12-12 13:00:29 +000062static inline void gicr_write_waker(uintptr_t base, uint32_t val)
Achin Gupta4f6ad662013-10-25 09:08:21 +010063{
64 mmio_write_32(base + GICR_WAKER, val);
Achin Gupta4f6ad662013-10-25 09:08:21 +010065}
Sandrine Bailleux27866d82013-10-25 15:33:39 +010066
Harry Liebeleaec5902013-12-12 13:00:29 +000067static inline uint64_t gicr_read_typer(uintptr_t base)
68{
69 return mmio_read_64(base + GICR_TYPER);
70}
71
72
Sandrine Bailleux27866d82013-10-25 15:33:39 +010073#endif /* __GIC_V3_H__ */