Reactos
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
17KAFFINITY HalpActiveProcessors;
18KAFFINITY HalpDefaultInterruptAffinity;
19BOOLEAN HalpProcessorIdentified;
20BOOLEAN HalpTestCleanSupported;
21
22/* PRIVATE FUNCTIONS **********************************************************/
23
24VOID
25HalpIdentifyProcessor(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 */
46VOID
47NTAPI
48HalInitializeProcessor(IN ULONG ProcessorNumber,
49 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
50{
51 /* Do nothing */
52 return;
53}
54
55/*
56 * @implemented
57 */
58BOOLEAN
59NTAPI
60HalAllProcessorsStarted(VOID)
61{
62 /* Do nothing */
63 return TRUE;
64}
65
66/*
67 * @implemented
68 */
69BOOLEAN
70NTAPI
71HalStartNextProcessor(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
72 IN PKPROCESSOR_STATE ProcessorState)
73{
74 /* Ready to start */
75 return FALSE;
76}
77
78/*
79 * @implemented
80 */
81VOID
82NTAPI
83HalProcessorIdle(VOID)
84{
85 /* Enable interrupts and halt the processor */
86 _enable();
87 UNIMPLEMENTED;
88 while (TRUE);
89}
90
91/*
92 * @implemented
93 */
94VOID
95NTAPI
96HalRequestIpi(KAFFINITY TargetProcessors)
97{
98 /* Not implemented on UP */
99 UNIMPLEMENTED;
100 while (TRUE);
101}
102
103/*
104 * @implemented
105 */
106VOID
107HalSweepDcache(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 */
134VOID
135HalSweepIcache(VOID)
136{
137 /* All ARM cores support the same Icache flush command */
138 KeArmFlushIcache();
139}
140
141/* EOF */