FreeNOS
SunxiCpuConfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIBARCH_ARM_SUNXI_SUNXICPUCONFIG_H
19 #define __LIBARCH_ARM_SUNXI_SUNXICPUCONFIG_H
20 
21 #include <FreeNOS/System.h>
22 #include <CoreManager.h>
23 #include "SunxiPowerManagement.h"
24 
40 {
41  private:
42 
44  static const Size NumberOfCores = 4;
45 
47  static const Address IOBase = 0x01F01C00;
48 
52  enum Registers
53  {
54  CpusRstCtrl = 0x0000,
55  Cpu0RstCtrl = 0x0040,
56  Cpu0Ctrl = 0x0044,
57  Cpu0Status = 0x0048,
58  Cpu1RstCtrl = 0x0080,
59  Cpu1Ctrl = 0x0084,
60  Cpu1Status = 0x0088,
61  Cpu2RstCtrl = 0x00C0,
62  Cpu2Ctrl = 0x00C4,
63  Cpu2Status = 0x00C8,
64  Cpu3RstCtrl = 0x0100,
65  Cpu3Ctrl = 0x0104,
66  Cpu3Status = 0x0108,
67  Cpu0PwrClamp = 0x0120,
68  Cpu1PwrClamp = 0x0124,
69  Cpu2PwrClamp = 0x0128,
70  Cpu3PwrClamp = 0x012C,
71  CpuSysRst = 0x0140,
72  ClkGating = 0x0144,
73  GenCtrl = 0x0184,
74  SuperStandby = 0x01A0,
75  EntryAddr = 0x01A4,
76  DbgExtern = 0x01E4,
77  Cnt64Ctrl = 0x0280,
78  Cnt64Low = 0x0284,
79  Cnt64High = 0x0288,
80  };
81 
86  {
87  CpuCoreReset = (1 << 1)
88  };
89 
90  public:
91 
97  virtual Result initialize();
98 
104  virtual Result discover();
105 
113  virtual Result boot(CoreInfo *info);
114 
115  private:
116 
119 
122 };
123 
130 #endif /* __LIBARCH_ARM_SUNXI_SUNXICPUCONFIG_H */
SunxiCpuConfig::IOBase
static const Address IOBase
Physical base memory address of CPU Configuration Module.
Definition: SunxiCpuConfig.h:47
CoreManager.h
ARMIO
Input/Output operations specific to the ARM architecture.
Definition: ARMIO.h:39
SunxiCpuConfig::Cpu0Status
@ Cpu0Status
CPU#0 Status.
Definition: SunxiCpuConfig.h:57
CoreManager
Generic Core Manager.
Definition: CoreManager.h:36
SunxiCpuConfig::EntryAddr
@ EntryAddr
Reset Entry Address.
Definition: SunxiCpuConfig.h:75
SunxiCpuConfig
Allwinner sunxi CPU configuration module support.
Definition: SunxiCpuConfig.h:39
Address
unsigned long Address
A memory address.
Definition: Types.h:131
SunxiCpuConfig::initialize
virtual Result initialize()
Perform initialization.
Definition: SunxiCpuConfig.cpp:21
SunxiCpuConfig::boot
virtual Result boot(CoreInfo *info)
Boot a processor.
Definition: SunxiCpuConfig.cpp:52
SunxiCpuConfig::m_io
Arch::IO m_io
Memory I/O object.
Definition: SunxiCpuConfig.h:118
SunxiCpuConfig::Cpu3Status
@ Cpu3Status
CPU#3 Status.
Definition: SunxiCpuConfig.h:66
SunxiCpuConfig::Cpu2PwrClamp
@ Cpu2PwrClamp
CPU#0 Power Clamp.
Definition: SunxiCpuConfig.h:69
SunxiCpuConfig::DbgExtern
@ DbgExtern
Debug External.
Definition: SunxiCpuConfig.h:76
SunxiCpuConfig::CpuRstCtrlFlags
CpuRstCtrlFlags
CPU::X Reset Control flags.
Definition: SunxiCpuConfig.h:85
SunxiCpuConfig::NumberOfCores
static const Size NumberOfCores
Number of CPU processor cores is fixed.
Definition: SunxiCpuConfig.h:44
SunxiCpuConfig::SuperStandby
@ SuperStandby
Super Standby Flag.
Definition: SunxiCpuConfig.h:74
SunxiCpuConfig::Cpu3PwrClamp
@ Cpu3PwrClamp
CPU#0 Power Clamp.
Definition: SunxiCpuConfig.h:70
SunxiCpuConfig::Cpu1Ctrl
@ Cpu1Ctrl
CPU#1 Control.
Definition: SunxiCpuConfig.h:59
SunxiCpuConfig::Cnt64Ctrl
@ Cnt64Ctrl
64-bit Counter Control
Definition: SunxiCpuConfig.h:77
SunxiCpuConfig::Cpu3RstCtrl
@ Cpu3RstCtrl
CPU#3 Reset Control.
Definition: SunxiCpuConfig.h:64
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
SunxiCpuConfig::Registers
Registers
Hardware registers.
Definition: SunxiCpuConfig.h:52
SunxiCpuConfig::GenCtrl
@ GenCtrl
General Control.
Definition: SunxiCpuConfig.h:73
SunxiCpuConfig::CpuSysRst
@ CpuSysRst
CPU System Reset.
Definition: SunxiCpuConfig.h:71
SunxiCpuConfig::Cpu2RstCtrl
@ Cpu2RstCtrl
CPU#2 Reset Control.
Definition: SunxiCpuConfig.h:61
CoreInfo
Per-Core information structure.
Definition: CoreInfo.h:60
SunxiCpuConfig::CpuCoreReset
@ CpuCoreReset
Definition: SunxiCpuConfig.h:87
SunxiPowerManagement
Allwinner Power, Reset and Clock Management (PRCM) module.
Definition: SunxiPowerManagement.h:38
SunxiCpuConfig::Cnt64Low
@ Cnt64Low
64-bit Counter Low
Definition: SunxiCpuConfig.h:78
SunxiCpuConfig::Cpu1RstCtrl
@ Cpu1RstCtrl
CPU#1 Reset Control.
Definition: SunxiCpuConfig.h:58
SunxiCpuConfig::Cpu0PwrClamp
@ Cpu0PwrClamp
CPU#0 Power Clamp.
Definition: SunxiCpuConfig.h:67
SunxiCpuConfig::Cpu3Ctrl
@ Cpu3Ctrl
CPU#3 Control.
Definition: SunxiCpuConfig.h:65
SunxiCpuConfig::Cpu1PwrClamp
@ Cpu1PwrClamp
CPU#0 Power Clamp.
Definition: SunxiCpuConfig.h:68
SunxiCpuConfig::ClkGating
@ ClkGating
CPU Clock Gating.
Definition: SunxiCpuConfig.h:72
SunxiCpuConfig::Cpu0RstCtrl
@ Cpu0RstCtrl
CPU#0 Reset Control.
Definition: SunxiCpuConfig.h:55
SunxiCpuConfig::Cnt64High
@ Cnt64High
64-bit Counter High
Definition: SunxiCpuConfig.h:79
SunxiCpuConfig::Cpu2Status
@ Cpu2Status
CPU#2 Status.
Definition: SunxiCpuConfig.h:63
SunxiCpuConfig::Cpu1Status
@ Cpu1Status
CPU#1 Status.
Definition: SunxiCpuConfig.h:60
SunxiCpuConfig::discover
virtual Result discover()
Discover processors.
Definition: SunxiCpuConfig.cpp:44
SunxiPowerManagement.h
SunxiCpuConfig::Cpu0Ctrl
@ Cpu0Ctrl
CPU#0 Control.
Definition: SunxiCpuConfig.h:56
CoreManager::Result
Result
Result codes.
Definition: CoreManager.h:45
SunxiCpuConfig::m_power
SunxiPowerManagement m_power
Power Management module.
Definition: SunxiCpuConfig.h:121
SunxiCpuConfig::CpusRstCtrl
@ CpusRstCtrl
CPUs Reset Control.
Definition: SunxiCpuConfig.h:54
SunxiCpuConfig::Cpu2Ctrl
@ Cpu2Ctrl
CPU#2 Control.
Definition: SunxiCpuConfig.h:62