git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Modules/ARMv7 GIC - Clean up debug and fix a few nigglers
[tpg/acess2.git]
/
KernelLand
/
Modules
/
armv7
/
GIC
/
gic.c
diff --git
a/KernelLand/Modules/armv7/GIC/gic.c
b/KernelLand/Modules/armv7/GIC/gic.c
index
a918f68
..
1de851d
100644
(file)
--- a/
KernelLand/Modules/armv7/GIC/gic.c
+++ b/
KernelLand/Modules/armv7/GIC/gic.c
@@
-39,14
+39,11
@@
int GIC_Install(char **Arguments)
// Initialise
Log_Debug("GIC", "Dist: %P, Interface: %P",
gGIC_DistributorAddr, gGIC_InterfaceAddr);
// Initialise
Log_Debug("GIC", "Dist: %P, Interface: %P",
gGIC_DistributorAddr, gGIC_InterfaceAddr);
- gpGIC_InterfaceBase = (
void*)MM_MapHWPages(gGIC_InterfaceAddr, 1);
-
LOG("gpGIC_InterfaceBase = %p", gpGIC_InterfaceBase)
;
+ gpGIC_InterfaceBase = (
Uint32*)MM_MapHWPages(gGIC_InterfaceAddr, 1)
+
+ (gGIC_InterfaceAddr & (PAGE_SIZE-1))/4
;
gpGIC_DistributorBase = (void*)MM_MapHWPages(gGIC_DistributorAddr, 1);
gpGIC_DistributorBase = (void*)MM_MapHWPages(gGIC_DistributorAddr, 1);
- LOG("gpGIC_DistributorBase = %p", gpGIC_DistributorBase);
gpGIC_InterfaceBase[GICC_CTLR] = 0; // Disable CPU interaface
gpGIC_InterfaceBase[GICC_CTLR] = 0; // Disable CPU interaface
- LOG("GICC_IAR = %x (CTLR=0)", gpGIC_InterfaceBase[GICC_IAR]);
-
gpGIC_InterfaceBase[GICC_PMR] = 0xFF; // Effectively disable prioritories
gpGIC_InterfaceBase[GICC_CTLR] = 1; // Enable CPU
gpGIC_DistributorBase[GICD_CTLR] = 1; // Enable Distributor
gpGIC_InterfaceBase[GICC_PMR] = 0xFF; // Effectively disable prioritories
gpGIC_InterfaceBase[GICC_CTLR] = 1; // Enable CPU
gpGIC_DistributorBase[GICD_CTLR] = 1; // Enable Distributor
@@
-80,8
+77,12
@@
int GIC_Install(char **Arguments)
void GIC_IRQHandler(void)
{
Uint32 num = gpGIC_InterfaceBase[GICC_IAR];
void GIC_IRQHandler(void)
{
Uint32 num = gpGIC_InterfaceBase[GICC_IAR];
- Log_Debug("GIC", "IRQ 0x%x", num);
- gaIRQ_Handlers[num]( num, gaIRQ_HandlerData[num] );
+ if( gaIRQ_Handlers[num] ) {
+ gaIRQ_Handlers[num]( num, gaIRQ_HandlerData[num] );
+ }
+ else {
+ Log_Debug("GIC", "IRQ 0x%x unhandled", num);
+ }
gpGIC_InterfaceBase[GICC_EOIR] = num;
}
gpGIC_InterfaceBase[GICC_EOIR] = num;
}
@@
-96,6
+97,7
@@
int IRQ_AddHandler(int IRQ, tIRQ_Handler Handler, void *Ptr)
gpGIC_DistributorBase[GICD_ISENABLER0+IRQ/32] = 1 << (IRQ & (32-1));
((Uint8*)&gpGIC_DistributorBase[GICD_ITARGETSR0])[IRQ] = 1;
gpGIC_DistributorBase[GICD_ICPENDR0+IRQ/32] = 1 << (IRQ & (32-1));
gpGIC_DistributorBase[GICD_ISENABLER0+IRQ/32] = 1 << (IRQ & (32-1));
((Uint8*)&gpGIC_DistributorBase[GICD_ITARGETSR0])[IRQ] = 1;
gpGIC_DistributorBase[GICD_ICPENDR0+IRQ/32] = 1 << (IRQ & (32-1));
+ gpGIC_DistributorBase[GICD_ICFGR0+IRQ/16] |= 2 << ((IRQ & 15)*2);
// TODO: Does the GIC need to handle IRQ sharing?
if( gaIRQ_Handlers[IRQ] ) {
// TODO: Does the GIC need to handle IRQ sharing?
if( gaIRQ_Handlers[IRQ] ) {
@@
-108,9
+110,6
@@
int IRQ_AddHandler(int IRQ, tIRQ_Handler Handler, void *Ptr)
gaIRQ_HandlerData[IRQ] = Ptr;
Log_Debug("GIC", "IRQ %i handled by %p(%p)", IRQ, Handler, Ptr);
gaIRQ_HandlerData[IRQ] = Ptr;
Log_Debug("GIC", "IRQ %i handled by %p(%p)", IRQ, Handler, Ptr);
-
- // DEBUG! Trip the interrupt
- gpGIC_DistributorBase[GICD_ISPENDR0+IRQ/32] = 1 << (IRQ & (32-1));
return 0;
}
return 0;
}
UCC
git Repository :: git.ucc.asn.au