123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- /*++
- Copyright (c) 2015 Minoca Corp. All Rights Reserved
- Module Name:
- intr.c
- Abstract:
- This module implements platform interrupt support for the RK3288 Veyron.
- Author:
- Evan Green 10-Jul-2015
- Environment:
- Firmware
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- #include <uefifw.h>
- #include "dev/gic.h"
- #include "veyronfw.h"
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // ----------------------------------------------- Internal Function Prototypes
- //
- VOID
- EfipPlatformBeginInterrupt (
- UINT32 *InterruptNumber,
- VOID **InterruptContext
- );
- VOID
- EfipPlatformEndInterrupt (
- UINT32 InterruptNumber,
- VOID *InterruptContext
- );
- //
- // -------------------------------------------------------------------- Globals
- //
- GIC_CONTEXT EfiVeyronGic;
- //
- // ------------------------------------------------------------------ Functions
- //
- EFI_STATUS
- EfiPlatformInitializeInterrupts (
- EFI_PLATFORM_BEGIN_INTERRUPT *BeginInterruptFunction,
- EFI_PLATFORM_HANDLE_INTERRUPT *HandleInterruptFunction,
- EFI_PLATFORM_END_INTERRUPT *EndInterruptFunction
- )
- /*++
- Routine Description:
- This routine initializes support for platform interrupts. Interrupts are
- assumed to be disabled at the processor now. This routine should enable
- interrupts at the procesor core.
- Arguments:
- BeginInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called when an interrupt occurs.
- HandleInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called to handle a platform-specific interurpt.
- NULL may be returned here.
- EndInterruptFunction - Supplies a pointer where a pointer to a function
- will be returned that is called to complete an interrupt.
- Return Value:
- EFI Status code.
- --*/
- {
- EFI_STATUS Status;
- EfiVeyronGic.DistributorBase = (VOID *)RK32_GIC_DISTRIBUTOR_BASE;
- EfiVeyronGic.CpuInterfaceBase = (VOID *)RK32_GIC_CPU_INTERFACE_BASE;
- Status = EfipGicInitialize(&EfiVeyronGic);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- *BeginInterruptFunction = EfipPlatformBeginInterrupt;
- *HandleInterruptFunction = NULL;
- *EndInterruptFunction = EfipPlatformEndInterrupt;
- EfiEnableInterrupts();
- return EFI_SUCCESS;
- }
- VOID
- EfiPlatformTerminateInterrupts (
- VOID
- )
- /*++
- Routine Description:
- This routine terminates interrupt services in preparation for transitioning
- out of boot services.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- {
- return;
- }
- EFI_STATUS
- EfipPlatformSetInterruptLineState (
- UINT32 LineNumber,
- BOOLEAN Enabled,
- BOOLEAN EdgeTriggered
- )
- /*++
- Routine Description:
- This routine enables or disables an interrupt line.
- Arguments:
- LineNumber - Supplies the line number to enable or disable.
- Enabled - Supplies a boolean indicating if the line should be enabled or
- disabled.
- EdgeTriggered - Supplies a boolean indicating if the interrupt is edge
- triggered (TRUE) or level triggered (FALSE).
- Return Value:
- EFI Status code.
- --*/
- {
- EFI_STATUS Status;
- Status = EfipGicSetLineState(&EfiVeyronGic,
- LineNumber,
- Enabled,
- EdgeTriggered);
- return Status;
- }
- //
- // --------------------------------------------------------- Internal Functions
- //
- VOID
- EfipPlatformBeginInterrupt (
- UINT32 *InterruptNumber,
- VOID **InterruptContext
- )
- /*++
- Routine Description:
- This routine is called when an interrupts comes in. The platform code is
- responsible for reporting the interrupt number. Interrupts are disabled at
- the processor core at this point.
- Arguments:
- InterruptNumber - Supplies a pointer where interrupt line number will be
- returned.
- InterruptContext - Supplies a pointer where the platform can store a
- pointer's worth of context that will be passed back when ending the
- interrupt.
- Return Value:
- None.
- --*/
- {
- EfipGicBeginInterrupt(&EfiVeyronGic, InterruptNumber, InterruptContext);
- return;
- }
- VOID
- EfipPlatformEndInterrupt (
- UINT32 InterruptNumber,
- VOID *InterruptContext
- )
- /*++
- Routine Description:
- This routine is called to finish handling of a platform interrupt. This is
- where the End-Of-Interrupt would get sent to the interrupt controller.
- Arguments:
- InterruptNumber - Supplies the interrupt number that occurred.
- InterruptContext - Supplies the context returned by the interrupt
- controller when the interrupt began.
- Return Value:
- None.
- --*/
- {
- EfipGicEndInterrupt(&EfiVeyronGic, InterruptNumber, InterruptContext);
- return;
- }
|