Pyro Private Functions
Functions
Pyro Internal Functions: Cpu support

Functions

void init_cpuid (void)
 Reads the cpuid and enables features like SSE. More...
 
void write_mtrr_descs (void)
 Writes the mtrr descriptors into the msr registers. More...
 
status_t alloc_mtrr_desc (uint64 nBase, uint64 nSize, int nType)
 Allocates a mtrr descriptor. More...
 
status_t free_mtrr_desc (uint64 nBase)
 Frees a mtrr descriptor. More...
 
void enable_mmu (void)
 Enables the MMU and reads the MTRR descriptors. More...
 
void init_descriptors ()
 Initializes the intel descriptors for code and data segments. More...
 
status_t get_cpu_extended_info (int nPhysicalCPUId, CPU_Extended_Info_s *_psInfo, int nVersion)
 Get a copy of the Extended CPU Info record for a specified CPU. More...
 
void update_cpu_speed (int nPhysicalCPUId, uint64 nCoreSpeed, uint32 nDelayCount)
 Update (set) speed metrics for a specified CPU. More...
 
void set_cpu_time_handler (bigtime_t(*pHandler)(int))
 Overrides the cpu time handler. More...
 
bigtime_t get_cpu_time (int nProcessorID)
 Returns the current cpu time. More...
 
void shutdown_ap_processors (void)
 Shutdown all but the boot processor. More...
 
void shutdown_processor (void)
 Shutdown the current processor. More...
 
void set_idle_loop_handler (void(*pHandler)(int))
 Overrides the idle handler. More...
 

Detailed Description

Function Documentation

status_t alloc_mtrr_desc ( uint64  nBase,
uint64  nSize,
int  nType 
)

Allocates a mtrr descriptor.

Parameters
nBase- Base address of the region.
nSize- Size of the region.
nType- Type.
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
void enable_mmu ( void  )

Enables the MMU and reads the MTRR descriptors.

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
status_t free_mtrr_desc ( uint64  nBase)

Frees a mtrr descriptor.

Parameters
nBase- Base address of the mtrr descriptor.
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
status_t get_cpu_extended_info ( int  nPhysicalCPUId,
CPU_Extended_Info_s _psInfo,
int  nVersion 
)

Get a copy of the Extended CPU Info record for a specified CPU.

NOTE: This function currently does NO locking, as there is no lock for g_asProcessorDescs. If the processor's info is being updated during copying, the copy may be inconsistent

Parameters
nPhysicalCPUId- Physical ID for the CPU to get info for (as returned by get_processor_id() )
psInfo- pointer to pre-allocated CPU_Extended_Info_s struct, destination of CPU record.
nVersion- Version of the CPU_Extended_Info_s struct to use
Author
Tim ter Laak (timl [At] scintilla [DoT] utwente [DoT] nl)
bigtime_t get_cpu_time ( int  nProcessorID)
inline

Returns the current cpu time.

The functions calls the handler set by the set_cpu_time_handler() function or get_system_time();

Parameters
nProcessorID- The processor id.
Author
Arno Klenke
void init_cpuid ( void  )

Reads the cpuid and enables features like SSE.

Called by init_kernel() (init.c).

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
void init_descriptors ( )

Initializes the intel descriptors for code and data segments.

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
void set_cpu_time_handler ( bigtime_t(*)(int)  pHandler)

Overrides the cpu time handler.

Parameters
pHandler- Pointer to the handler function. The parameter is the processor id.
Author
Arno Klenke
void set_idle_loop_handler ( void(*)(int)  pHandler)

Overrides the idle handler.

Parameters
pHandler- Pointer to the handler function. The parameter is the processor id.
Author
Arno Klenke
void shutdown_ap_processors ( void  )

Shutdown all but the boot processor.

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
void shutdown_processor ( void  )

Shutdown the current processor.

Needs to be called with disabled interrupts.

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)
void update_cpu_speed ( int  nPhysicalCPUId,
uint64  nCoreSpeed,
uint32  nDelayCount 
)

Update (set) speed metrics for a specified CPU.

NOTE: This function currently does NO locking, as there is no lock for g_asProcessorDescs. If another thread reads between updating the two fields, its data may be inconsistent for our speed data.

Parameters
nPhysicalCPUId- Physical ID for the CPU to get info for (as returned by get_processor_id() )
nCoreSpeed- New CPU core speed in Hz
nDelayCount- New pi_nDelayCount value, used for busy-looping delays
Author
Tim ter Laak (timl [At] scintilla [DoT] utwente [DoT] nl)
void write_mtrr_descs ( void  )

Writes the mtrr descriptors into the msr registers.

Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)