XenevaOS
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
gic.h File Reference
#include <aa64hcode.h>
#include <stdint.h>
#include <aurora.h>
Include dependency graph for gic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _gic_
 

Typedefs

typedef struct _gic_ GIC
 

Functions

GICAuGetSystemGIC ()
 
void GICInitialize ()
 GICInitialize – initialize the gic controller, it can be parsed through ACPI MADT or hard-coding.
 
AU_EXTERN AU_EXPORT void GICEnableIRQ (uint32_t irq)
 
AU_EXTERN AU_EXPORT void GICEnableSPIIRQ (uint32_t irq)
 GICEnableIRQ – enable an SPI IRQ.
 
AU_EXTERN AU_EXPORT void GICClearPendingIRQ (uint32_t irq)
 
uint32_t GICReadIAR ()
 GICReadIAR – read interrupt acknowledge register.
 
void GICCheckPending (uint32_t irq)
 
AU_EXTERN AU_EXPORT uint64_t AuGICGetMSIAddress (int interruptID)
 AuGICGetMSIAddress – calculate and return MSI address for given spi offset.
 
AU_EXTERN AU_EXPORT uint32_t AuGICGetMSIData (int interruptID)
 AuGICGetMSIData – obtains composited MSI data address of respected interruptID, useful in PCIe.
 
AU_EXTERN AU_EXPORT int AuGICAllocateSPI ()
 AuGICAllocateSPI – allocates Shared Peripheral interrupt ID.
 
AU_EXTERN AU_EXPORT void AuGICDeallocateSPI (int spiID)
 AuGICDeallocateSPI – free up an used SPI id.
 
AU_EXTERN AU_EXPORT void GICSendEOI (uint32_t irqnum)
 GICSendEOI –sends end of interrupt to GIC cpu interface.
 
void GICSetupTimer ()
 
AU_EXTERN AU_EXPORT void GICSetTargetCPU (int spi)
 
AU_EXTERN AU_EXPORT void GICRegisterSPIHandler (void *fptr, int spi)
 GICRegisterSPIHandler – register a spi handler to callback list.
 
void GICCallSPIHandler (int spi)
 GICCallSPIHandler – jump to a callback handler associated with given spi number.
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2025, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Typedef Documentation

◆ GIC

typedef struct _gic_ GIC

Function Documentation

◆ AuGetSystemGIC()

GIC * AuGetSystemGIC ( )

◆ AuGICAllocateSPI()

AU_EXTERN AU_EXPORT int AuGICAllocateSPI ( )

AuGICAllocateSPI – allocates Shared Peripheral interrupt ID.

◆ AuGICDeallocateSPI()

AU_EXTERN AU_EXPORT void AuGICDeallocateSPI ( int  spiID)

AuGICDeallocateSPI – free up an used SPI id.

Parameters
spiID– target spi id

◆ AuGICGetMSIAddress()

AU_EXTERN AU_EXPORT uint64_t AuGICGetMSIAddress ( int  interruptID)

AuGICGetMSIAddress – calculate and return MSI address for given spi offset.

Parameters
interruptID– spi offset
Returns
composited MSI address

◆ AuGICGetMSIData()

AU_EXTERN AU_EXPORT uint32_t AuGICGetMSIData ( int  interruptID)

AuGICGetMSIData – obtains composited MSI data address of respected interruptID, useful in PCIe.

Parameters
interruptID– interrupt ID of device

◆ GICCallSPIHandler()

void GICCallSPIHandler ( int  spi)
extern

GICCallSPIHandler – jump to a callback handler associated with given spi number.

Parameters
spi– SPI number

◆ GICCheckPending()

void GICCheckPending ( uint32_t  irq)
extern

◆ GICClearPendingIRQ()

AU_EXTERN AU_EXPORT void GICClearPendingIRQ ( uint32_t  irq)

◆ GICEnableIRQ()

AU_EXTERN AU_EXPORT void GICEnableIRQ ( uint32_t  irq)

@briefGICEnableIRQ – enable an IRQ

Parameters
irq– IRQ number

◆ GICEnableSPIIRQ()

AU_EXTERN AU_EXPORT void GICEnableSPIIRQ ( uint32_t  irq)

GICEnableIRQ – enable an SPI IRQ.

Parameters
irq– IRQ number

GICEnableIRQ – enable an SPI IRQ.

Parameters
irq– IRQ number

route it to cpu0

◆ GICInitialize()

void GICInitialize ( )
extern

GICInitialize – initialize the gic controller, it can be parsed through ACPI MADT or hard-coding.

@TODO : we need to rely on DTB, here we're doing it manually according to SOC_TARGET build

map Redist to MMIO, for one redistributor 128 KiB, for 4 cores, it consumes 512 KiB 128 pages, for now not supporting multi cores, only one core is needed

◆ GICReadIAR()

uint32_t GICReadIAR ( )
extern

GICReadIAR – read interrupt acknowledge register.

◆ GICRegisterSPIHandler()

AU_EXTERN AU_EXPORT void GICRegisterSPIHandler ( void *  fptr,
int  spi 
)

GICRegisterSPIHandler – register a spi handler to callback list.

Parameters
fptr– SPI Callback address
spi– SPI number

◆ GICSendEOI()

AU_EXTERN AU_EXPORT void GICSendEOI ( uint32_t  irqnum)

GICSendEOI –sends end of interrupt to GIC cpu interface.

Parameters
irqnum– interrupt ID of the device

◆ GICSetTargetCPU()

AU_EXTERN AU_EXPORT void GICSetTargetCPU ( int  spi)

◆ GICSetupTimer()

void GICSetupTimer ( )
extern