FreeNOS
Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
SunxiCoreServer Class Reference

Implements a CoreServer for ARM/Allwinner (sunxi) based System-on-Chips. More...

#include <SunxiCoreServer.h>

Inheritance diagram for SunxiCoreServer:
CoreServer ChannelServer< CoreServer, CoreMessage > AbstractFactory< CoreServer >

Public Member Functions

 SunxiCoreServer ()
 Class constructor function. More...
 
virtual Result initialize ()
 Initialize the server. More...
 
virtual Core::Result bootCore (uint coreId, CoreInfo *info)
 Boot a processor core. More...
 
virtual Core::Result discoverCores ()
 Discover processor cores. More...
 
virtual void waitIPI () const
 Wait for Inter-Processor-Interrupt. More...
 
virtual Core::Result sendIPI (uint coreId)
 Send Inter-Processor-Interrupt. More...
 
- Public Member Functions inherited from CoreServer
 CoreServer ()
 Class constructor function. More...
 
Core::Result test ()
 Run a ping-pong test. More...
 
int runCore ()
 Routine for the slave processor core. More...
 
- Public Member Functions inherited from ChannelServer< CoreServer, CoreMessage >
 ChannelServer (CoreServer *inst)
 Constructor function. More...
 
virtual ~ChannelServer ()
 Destructor function. More...
 
int run ()
 Enters an infinite loop, serving incoming requests. More...
 
void setTimeout (const uint msec)
 Set a sleep timeout. More...
 

Static Public Attributes

static const Address SecondaryCoreInfoOffset = (1024 * 1024 * 33)
 Offset of the CoreInfo struct relative to the kernel's physical base address. More...
 
static const Address SecondaryCoreInfoAddress = RAM_ADDR + SecondaryCoreInfoOffset
 Physical memory address for CoreInfo passed to secondary cores during bootup. More...
 

Private Attributes

SunxiCpuConfig m_cpuConfig
 CPU Configuration Module instance. More...
 

Static Private Attributes

static const Size SoftwareInterruptNumber = 0x1
 Software Generated Interrupt number for sending/receiving between cores. More...
 

Additional Inherited Members

- Public Types inherited from ChannelServer< CoreServer, CoreMessage >
enum  Result
 Result codes. More...
 
- Static Public Member Functions inherited from AbstractFactory< CoreServer >
static CoreServercreate ()
 Abstract function to create an instance of T. More...
 
- Protected Types inherited from ChannelServer< CoreServer, CoreMessage >
typedef void(CoreServer ::* IPCHandlerFunction) (CoreMessage *)
 Member function pointer inside Base, to handle IPC messages. More...
 
typedef void(CoreServer ::* IRQHandlerFunction) (Size)
 Member function pointer inside Base, to handle interrupts. More...
 
- Protected Member Functions inherited from ChannelServer< CoreServer, CoreMessage >
void addIPCHandler (const Size slot, IPCHandlerFunction h, const bool sendReply=true)
 Register a new IPC message action handler. More...
 
void addIRQHandler (const Size slot, IRQHandlerFunction h)
 Register a new IRQ message vector handler. More...
 
virtual void timeout ()
 Called when sleep timeout is reached. More...
 
virtual bool retryRequests ()
 Retry any pending requests. More...
 
virtual void onProcessTerminated (const ProcessID pid)
 Called whenever another Process is terminated. More...
 
void retryAllRequests ()
 Keep retrying requests until all served. More...
 
- Protected Attributes inherited from CoreServer
CoreManagerm_cores
 
- Protected Attributes inherited from ChannelServer< CoreServer, CoreMessage >
CoreServerm_instance
 Server object instance. More...
 
ChannelClientm_client
 Client for sending replies. More...
 
ChannelRegistrym_registry
 Contains registered channels. More...
 
MemoryChannel m_kernelEvent
 Kernel event channel. More...
 
Index< MessageHandler< IPCHandlerFunction >, MaximumHandlerCountm_ipcHandlers
 IPC handler functions. More...
 
Index< MessageHandler< IRQHandlerFunction >, MaximumHandlerCountm_irqHandlers
 IRQ handler functions. More...
 
ProcessID m_self
 ProcessID of ourselves. More...
 
Timer::Info m_time
 System timer value. More...
 
Timer::Info m_expiry
 System timer expiration value. More...
 

Detailed Description

Implements a CoreServer for ARM/Allwinner (sunxi) based System-on-Chips.

Definition at line 35 of file SunxiCoreServer.h.

Constructor & Destructor Documentation

◆ SunxiCoreServer()

SunxiCoreServer::SunxiCoreServer ( )

Class constructor function.

Definition at line 29 of file SunxiCoreServer.cpp.

References CoreServer::m_cores, and m_cpuConfig.

Member Function Documentation

◆ bootCore()

Core::Result SunxiCoreServer::bootCore ( uint  coreId,
CoreInfo info 
)
virtual

Boot a processor core.

Parameters
coreIdCore identifier number
infoCoreInfo pointer containing specific core information
Returns
Result code

Implements CoreServer.

Definition at line 69 of file SunxiCoreServer.cpp.

References SunxiCpuConfig::boot(), Core::BootError, coreId, ERROR, m_cpuConfig, CoreInfo::memory, Memory::Range::phys, API::Read, SecondaryCoreInfoAddress, SecondaryCoreInfoOffset, SELF, CoreManager::Success, Core::Success, VMCopy(), and API::Write.

◆ discoverCores()

Core::Result SunxiCoreServer::discoverCores ( )
virtual

Discover processor cores.

Returns
Result code

Implements CoreServer.

Definition at line 102 of file SunxiCoreServer.cpp.

References SunxiCpuConfig::discover(), ERROR, Core::IOError, m_cpuConfig, CoreManager::Success, and Core::Success.

◆ initialize()

SunxiCoreServer::Result SunxiCoreServer::initialize ( )
virtual

◆ sendIPI()

Core::Result SunxiCoreServer::sendIPI ( uint  coreId)
virtual

Send Inter-Processor-Interrupt.

Parameters
coreIdCore identifier number
Returns
Result code

Implements CoreServer.

Definition at line 120 of file SunxiCoreServer.cpp.

References coreId, ERROR, Core::IOError, ProcessCtl(), SELF, SendIRQ, SoftwareInterruptNumber, Core::Success, and API::Success.

◆ waitIPI()

void SunxiCoreServer::waitIPI ( ) const
virtual

Wait for Inter-Processor-Interrupt.

Implements CoreServer.

Definition at line 113 of file SunxiCoreServer.cpp.

References EnableIRQ, EnterSleep, ProcessCtl(), SELF, and SoftwareInterruptNumber.

Field Documentation

◆ m_cpuConfig

SunxiCpuConfig SunxiCoreServer::m_cpuConfig
private

CPU Configuration Module instance.

Definition at line 98 of file SunxiCoreServer.h.

Referenced by bootCore(), discoverCores(), initialize(), and SunxiCoreServer().

◆ SecondaryCoreInfoAddress

const Address SunxiCoreServer::SecondaryCoreInfoAddress = RAM_ADDR + SecondaryCoreInfoOffset
static

Physical memory address for CoreInfo passed to secondary cores during bootup.

Definition at line 43 of file SunxiCoreServer.h.

Referenced by bootCore(), initialize(), kernel_main(), and SunxiKernel::SunxiKernel().

◆ SecondaryCoreInfoOffset

const Address SunxiCoreServer::SecondaryCoreInfoOffset = (1024 * 1024 * 33)
static

Offset of the CoreInfo struct relative to the kernel's physical base address.

Definition at line 40 of file SunxiCoreServer.h.

Referenced by bootCore().

◆ SoftwareInterruptNumber

const Size SunxiCoreServer::SoftwareInterruptNumber = 0x1
staticprivate

Software Generated Interrupt number for sending/receiving between cores.

Definition at line 48 of file SunxiCoreServer.h.

Referenced by initialize(), sendIPI(), and waitIPI().


The documentation for this class was generated from the following files: