blob: 5f90250572be6d39bfad00236fafda9c6f8a720b [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2*
3* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
4* Copyright (c) Huawei Technologies Co., Ltd. 2013. All rights reserved.
5*
6* This program and the accompanying materials
7* are licensed and made available under the terms and conditions of the BSD License
8* which accompanies this distribution. The full text of the license may be found at
9* http://opensource.org/licenses/bsd-license.php
10*
11* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13*
14**/
15
16#include <Uefi.h>
17#include <Library/IoLib.h>
18#include <Library/ArmGicLib.h>
19#include <Library/PcdLib.h>
20
21UINTN
22EFIAPI
23ArmGicGetMaxNumInterrupts (
24 IN INTN GicDistributorBase
25 )
26{
27 return 32 * ((MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F) + 1);
28}
29
30VOID
31EFIAPI
32ArmGicSendSgiTo (
33 IN INTN GicDistributorBase,
34 IN INTN TargetListFilter,
35 IN INTN CPUTargetList,
36 IN INTN SgiId
37 )
38{
39 MmioWrite32 (GicDistributorBase + ARM_GIC_ICDSGIR, ((TargetListFilter & 0x3) << 24) | ((CPUTargetList & 0xFF) << 16) | SgiId);
40}
41