Browse Source

Removed private hardware module MPIDR routines.

Both the GIC and the Broadcom interrupt controller need the MPIDR value in
in a few locations. Before the kernel services interface was removed, these
modules implemented their own assembly routine to get the MPIDR. This change
removes those files in favor of using the shared Ar version of the routine.
Chris Stevens 8 years ago
parent
commit
eb7d37d5aa

+ 6 - 0
include/minoca/kernel/arm.h

@@ -546,6 +546,12 @@ Author:
 
 #define EXCEPTION_STACK_COUNT 4
 
+//
+// Define which bits of the MPIDR are valid processor ID bits.
+//
+
+#define ARM_PROCESSOR_ID_MASK 0x00FFFFFF
+
 //
 // ------------------------------------------------------ Data Type Definitions
 //

+ 0 - 2
kernel/hl/Makefile

@@ -60,7 +60,6 @@ ARMV7_OBJS = armv7/am335int.o \
              armv7/cyccnt.o   \
              armv7/cycsupc.o  \
              armv7/gic.o      \
-             armv7/gicid.o    \
              armv7/gt.o       \
              armv7/gta.o      \
              armv7/omapintr.o \
@@ -75,7 +74,6 @@ ARMV7_OBJS = armv7/am335int.o \
              armv7/sp804tmr.o \
              armv7/uartpl11.o \
              armv7/uartomap.o \
-             armv7/b2709id.o  \
              armv7/b2709int.o \
              armv7/b2709tmr.o \
              ns16550.o        \

+ 0 - 72
kernel/hl/armv7/b2709id.S

@@ -1,72 +0,0 @@
-/*++
-
-Copyright (c) 2015 Minoca Corp. All Rights Reserved
-
-Module Name:
-
-    b2709id.S
-
-Abstract:
-
-    This module implements support for getting the local unit ID for the
-    BCM2709 interrupt controller.
-
-Author:
-
-    Chris Stevens 19-Apr-2015
-
-Environment:
-
-    Kernel mode
-
---*/
-
-##
-## ------------------------------------------------------------------ Includes
-##
-
-#include <minoca/kernel/arm.inc>
-
-##
-## --------------------------------------------------------------- Definitions
-##
-
-##
-## ---------------------------------------------------------------------- Code
-##
-
-ASSEMBLY_FILE_HEADER
-
-##
-## ULONG
-## HlpBcm2709GetProcessorIdRegister (
-##     VOID
-##     )
-##
-
-/*++
-
-Routine Description:
-
-    This routine retrieves the MPIDR (MultiProcessor ID register).
-
-Arguments:
-
-    None.
-
-Return Value:
-
-    Returns the value of the MPIDR.
-
---*/
-
-FUNCTION HlpBcm2709GetProcessorIdRegister
-    mrc     p15, 0, %r0, %c0, %c0, 5            @ Get the MPIDR
-    bx      %lr                                 @
-
-END_FUNCTION HlpBcm2709GetProcessorIdRegister
-
-##
-## --------------------------------------------------------- Internal Functions
-##
-

+ 9 - 21
kernel/hl/armv7/b2709int.c

@@ -30,6 +30,7 @@ Environment:
 //
 
 #include <minoca/kernel/kernel.h>
+#include <minoca/kernel/arm.h>
 #include "bcm2709.h"
 
 //
@@ -148,12 +149,6 @@ Environment:
 
 #define BCM2709_INTERRUPT_PRIORITY_COUNT 16
 
-//
-// Define which bits of the MPIDR are valid processor ID bits.
-//
-
-#define ARM_PROCESSOR_ID_MASK 0x00FFFFFF
-
 //
 // Define which bits of the MPIDR are valid processor ID bits for the local
 // BCM2709 interrupt controller.
@@ -405,11 +400,6 @@ typedef struct _BCM2709_INTERRUPT_CONTROLLER {
 // ----------------------------------------------- Internal Function Prototypes
 //
 
-ULONG
-HlpBcm2709GetProcessorIdRegister (
-    VOID
-    );
-
 KSTATUS
 HlpBcm2709InterruptEnumerateProcessors (
     PVOID Context,
@@ -842,9 +832,7 @@ Return Value:
 
     *Identifier = 0;
     if (Controller->ProcessorCount > 1) {
-        ProcessorId = HlpBcm2709GetProcessorIdRegister() &
-                      ARM_PROCESSOR_ID_MASK;
-
+        ProcessorId = ArGetMultiprocessorIdRegister() & ARM_PROCESSOR_ID_MASK;
         *Identifier = ProcessorId;
         ProcessorId &= BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
         WRITE_LOCAL_IPI_REGISTER(Bcm2709LocalIpiPending,
@@ -968,7 +956,7 @@ Return Value:
     KSTATUS Status;
     UCHAR ThisProcessorTarget;
 
-    ThisProcessorTarget = HlpBcm2709GetProcessorIdRegister() &
+    ThisProcessorTarget = ArGetMultiprocessorIdRegister() &
                           ARM_PROCESSOR_ID_MASK;
 
     switch (Target->Addressing) {
@@ -1066,8 +1054,8 @@ Return Value:
     Controller = (PBCM2709_INTERRUPT_CONTROLLER)Context;
     ProcessorId = 0;
     if (Controller->ProcessorCount > 1) {
-        ProcessorId = HlpBcm2709GetProcessorIdRegister();
-        ProcessorId &= BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
+        ProcessorId = ArGetMultiprocessorIdRegister() &
+                      BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
     }
 
     Processor = &(Controller->Processor[ProcessorId]);
@@ -1271,8 +1259,8 @@ Return Value:
     Controller = (PBCM2709_INTERRUPT_CONTROLLER)Context;
     ProcessorId = 0;
     if (Controller->ProcessorCount > 1) {
-        ProcessorId = HlpBcm2709GetProcessorIdRegister();
-        ProcessorId &= BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
+        ProcessorId = ArGetMultiprocessorIdRegister() &
+                      BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
     }
 
     //
@@ -1379,7 +1367,7 @@ Return Value:
         break;
 
     case InterruptAddressingSelf:
-        ProcessorId = HlpBcm2709GetProcessorIdRegister();
+        ProcessorId = ArGetMultiprocessorIdRegister();
         ProcessorId &= BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
         ProcessorMask = 1 << ProcessorId;
         break;
@@ -1389,7 +1377,7 @@ Return Value:
         break;
 
     case InterruptAddressingAllExcludingSelf:
-        ProcessorId = HlpBcm2709GetProcessorIdRegister();
+        ProcessorId = ArGetMultiprocessorIdRegister();
         ProcessorId &= BCM2709_INTERRUPT_PROCESSOR_ID_MASK;
         ProcessorMask = (1 << Controller->ProcessorCount) - 1;
         ProcessorMask &= ~(1 << ProcessorId);

+ 6 - 16
kernel/hl/armv7/gic.c

@@ -31,6 +31,7 @@ Environment:
 //
 
 #include <minoca/kernel/kernel.h>
+#include <minoca/kernel/arm.h>
 
 //
 // --------------------------------------------------------------------- Macros
@@ -225,12 +226,6 @@ Environment:
 
 #define GIC_CPU_INTERFACE_ACKNOWLEDGE_LINE_MASK 0x3FF
 
-//
-// Define which bits of the MPIDR are valid processor ID bits.
-//
-
-#define ARM_PROCESSOR_ID_MASK 0x00FFFFFF
-
 //
 // Define which bits of the MPIDR are valid processor ID bits for the local
 // GIC.
@@ -321,11 +316,6 @@ typedef struct _GIC_DISTRIBUTOR_DATA {
 // ----------------------------------------------- Internal Function Prototypes
 //
 
-ULONG
-HlpGicGetProcessorIdRegister (
-    VOID
-    );
-
 KSTATUS
 HlpGicEnumerateProcessors (
     PVOID Context,
@@ -779,7 +769,7 @@ Return Value:
         goto GicInitializeLocalUnitEnd;
     }
 
-    ProcessorId = HlpGicGetProcessorIdRegister();
+    ProcessorId = ArGetMultiprocessorIdRegister();
     *Identifier = ProcessorId & ARM_PROCESSOR_ID_MASK;
 
 GicInitializeLocalUnitEnd:
@@ -895,8 +885,8 @@ Return Value:
     KSTATUS Status;
     ULONG ThisProcessorTarget;
 
-    ThisProcessorTarget =
-                        HlpGicGetProcessorIdRegister() & ARM_PROCESSOR_ID_MASK;
+    ThisProcessorTarget = ArGetMultiprocessorIdRegister() &
+                          ARM_PROCESSOR_ID_MASK;
 
     switch (Target->Addressing) {
     case InterruptAddressingLogicalClustered:
@@ -1287,7 +1277,7 @@ Return Value:
         break;
 
     case InterruptAddressingSelf:
-        Target = 1 << (HlpGicGetProcessorIdRegister() & GIC_PROCESSOR_ID_MASK);
+        Target = 1 << (ArGetMultiprocessorIdRegister() & GIC_PROCESSOR_ID_MASK);
         break;
 
     case InterruptAddressingAll:
@@ -1295,7 +1285,7 @@ Return Value:
         break;
 
     case InterruptAddressingAllExcludingSelf:
-        ThisProcessorTarget = 1 << (HlpGicGetProcessorIdRegister() &
+        ThisProcessorTarget = 1 << (ArGetMultiprocessorIdRegister() &
                                     GIC_PROCESSOR_ID_MASK);
 
         Target = 0xFF & (~ThisProcessorTarget);

+ 0 - 73
kernel/hl/armv7/gicid.S

@@ -1,73 +0,0 @@
-/*++
-
-Copyright (c) 2013 Minoca Corp. All Rights Reserved
-
-Module Name:
-
-    gicid.S
-
-Abstract:
-
-    This module implements support for getting the local unit ID for the GIC
-    interrupt controller.
-
-Author:
-
-    Evan Green 14-Jul-2013
-
-Environment:
-
-    Kernel mode
-
---*/
-
-##
-## ------------------------------------------------------------------ Includes
-##
-
-#include <minoca/kernel/arm.inc>
-
-##
-## --------------------------------------------------------------- Definitions
-##
-
-##
-## ---------------------------------------------------------------------- Code
-##
-
-ASSEMBLY_FILE_HEADER
-
-##
-## ULONG
-## HlpGicGetProcessorIdRegister (
-##     VOID
-##     )
-##
-
-/*++
-
-Routine Description:
-
-    This routine retrieves the MPIDR (MultiProcessor ID register).
-
-Arguments:
-
-    None.
-
-Return Value:
-
-    Returns the value of the MPIDR.
-
---*/
-
-FUNCTION HlpGicGetProcessorIdRegister
-    mrc     p15, 0, %r0, %c0, %c0, 5            @ Get the MPIDR
-    bx      %lr                                 @
-
-END_FUNCTION HlpGicGetProcessorIdRegister
-
-##
-## --------------------------------------------------------- Internal Functions
-##
-
-

+ 0 - 2
kernel/hl/build.ck

@@ -68,7 +68,6 @@ function build() {
             "armv7/cyccnt.c",
             "armv7/cycsupc.c",
             "armv7/gic.c",
-            "armv7/gicid.S",
             "armv7/gt.c",
             "armv7/gta.S",
             "armv7/omapintr.c",
@@ -83,7 +82,6 @@ function build() {
             "armv7/sp804tmr.c",
             "armv7/uartpl11.c",
             "armv7/uartomap.c",
-            "armv7/b2709id.S",
             "armv7/b2709int.c",
             "armv7/b2709tmr.c"
         ];

+ 0 - 6
uefi/dev/gic/gic.c

@@ -142,12 +142,6 @@ Environment:
 
 #define GIC_CPU_INTERFACE_ACKNOWLEDGE_LINE_MASK 0x3FF
 
-//
-// Define which bits of the MPIDR are valid processor ID bits.
-//
-
-#define ARM_PROCESSOR_ID_MASK 0x00FFFFFF
-
 //
 // Define the priority assigned to all enabled interrupts.
 //