1// Copyright 2016 The Fuchsia Authors 2// Copyright (c) 2013, Google Inc. All rights reserved. 3// 4// Use of this source code is governed by a MIT-style 5// license that can be found in the LICENSE file or at 6// https://opensource.org/licenses/MIT 7 8#pragma once 9 10#include <dev/interrupt.h> 11#include <sys/types.h> 12 13#define GIC_BASE_SGI 0 14#define GIC_BASE_PPI 16 15#define GIC_BASE_SPI 32 16 17// GIC Revision 18enum { 19 GICV2 = 2, 20 GICV3 = 3, 21 GICV4 = 4, 22}; 23 24enum { 25 // Ignore cpu_mask and forward interrupt to all CPUs other than the current cpu 26 ARM_GIC_SGI_FLAG_TARGET_FILTER_NOT_SENDER = 0x1, 27 // Ignore cpu_mask and forward interrupt to current CPU only 28 ARM_GIC_SGI_FLAG_TARGET_FILTER_SENDER = 0x2, 29 ARM_GIC_SGI_FLAG_TARGET_FILTER_MASK = 0x3, 30 31 // Only forward the interrupt to CPUs that has the interrupt configured as group 1 (non-secure) 32 ARM_GIC_SGI_FLAG_NS = 0x4, 33}; 34 35// Registers a software generated interrupt handler. 36static inline zx_status_t gic_register_sgi_handler(unsigned int vector, int_handler handler) { 37 DEBUG_ASSERT(vector < GIC_BASE_PPI); 38 return register_int_handler(vector, handler, nullptr); 39} 40