1 /* 2 * PROJECT: ReactOS HAL 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: hal/halarm/generic/processor.c 5 * PURPOSE: HAL Processor Routines 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 /* INCLUDES *******************************************************************/ 10 11 #include <hal.h> 12 #define NDEBUG 13 #include <debug.h> 14 15 /* GLOBALS ********************************************************************/ 16 17 LONG HalpActiveProcessors; 18 KAFFINITY HalpDefaultInterruptAffinity; 19 BOOLEAN HalpProcessorIdentified; 20 BOOLEAN HalpTestCleanSupported; 21 22 /* PRIVATE FUNCTIONS **********************************************************/ 23 24 VOID 25 HalpIdentifyProcessor(VOID) 26 { 27 ARM_ID_CODE_REGISTER IdRegister; 28 29 /* Don't do it again */ 30 HalpProcessorIdentified = TRUE; 31 32 // fixfix: Use Pcr->ProcessorId 33 34 /* Read the ID Code */ 35 IdRegister = KeArmIdCodeRegisterGet(); 36 37 /* Architecture "6" CPUs support test-and-clean (926EJ-S and 1026EJ-S) */ 38 HalpTestCleanSupported = (IdRegister.Architecture == 6); 39 } 40 41 /* FUNCTIONS ******************************************************************/ 42 43 /* 44 * @implemented 45 */ 46 VOID 47 NTAPI 48 HalInitializeProcessor(IN ULONG ProcessorNumber, 49 IN PLOADER_PARAMETER_BLOCK LoaderBlock) 50 { 51 /* Do nothing */ 52 return; 53 } 54 55 /* 56 * @implemented 57 */ 58 BOOLEAN 59 NTAPI 60 HalAllProcessorsStarted(VOID) 61 { 62 /* Do nothing */ 63 return TRUE; 64 } 65 66 /* 67 * @implemented 68 */ 69 BOOLEAN 70 NTAPI 71 HalStartNextProcessor(IN PLOADER_PARAMETER_BLOCK LoaderBlock, 72 IN PKPROCESSOR_STATE ProcessorState) 73 { 74 /* Ready to start */ 75 return FALSE; 76 } 77 78 /* 79 * @implemented 80 */ 81 VOID 82 NTAPI 83 HalProcessorIdle(VOID) 84 { 85 /* Enable interrupts and halt the processor */ 86 _enable(); 87 UNIMPLEMENTED; 88 while (TRUE); 89 } 90 91 /* 92 * @implemented 93 */ 94 VOID 95 NTAPI 96 HalRequestIpi(KAFFINITY TargetProcessors) 97 { 98 /* Not implemented on UP */ 99 UNIMPLEMENTED; 100 while (TRUE); 101 } 102 103 /* 104 * @implemented 105 */ 106 VOID 107 HalSweepDcache(VOID) 108 { 109 /* 110 * We get called very early on, before HalInitSystem or any of the Hal* 111 * processor routines, so we need to figure out what CPU we're on. 112 */ 113 if (!HalpProcessorIdentified) HalpIdentifyProcessor(); 114 115 /* 116 * Check if we can do it the ARMv5TE-J way 117 */ 118 if (HalpTestCleanSupported) 119 { 120 /* Test, clean, flush D-Cache */ 121 __asm__ __volatile__ ("1: mrc p15, 0, pc, c7, c14, 3; bne 1b"); 122 } 123 else 124 { 125 /* We need to do it it by set/way. For now always call ARMv7 function */ 126 //extern VOID v7_flush_dcache_all(VOID); 127 //v7_flush_dcache_all(); 128 } 129 } 130 131 /* 132 * @implemented 133 */ 134 VOID 135 HalSweepIcache(VOID) 136 { 137 /* All ARM cores support the same Icache flush command */ 138 KeArmFlushIcache(); 139 } 140 141 /* EOF */ 142