coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
cpu.c File Reference
#include <types.h>
#include <soc/addressmap.h>
#include <device/mmio.h>
#include <soc/cpu.h>
#include <bdk-coreboot.h>
#include <console/console.h>
#include <timer.h>
#include <delay.h>
Include dependency graph for cpu.c:

Go to the source code of this file.

Functions

uint64_t cpu_get_available_core_mask (void)
 Return the mask of available cores. More...
 
size_t cpu_get_num_available_cores (void)
 Return the number of cores available in the chip. More...
 
void secondary_cpu_init (size_t core_id)
 Secondary CPU C entry point. More...
 
size_t cpu_self_get_core_id (void)
 Number of the Core on which the program is currently running. More...
 
uint64_t cpu_self_get_core_mask (void)
 Return a mask representing this core in a 64bit bitmask. More...
 
size_t start_cpu (size_t cpu, void(*entry_64)(size_t core_id))
 Init secondary core and call the provided entry for given core. More...
 

Variables

static void(* secondary_c_entry )(size_t core_id)
 
static size_t secondary_booted
 

Function Documentation

◆ cpu_get_available_core_mask()

uint64_t cpu_get_available_core_mask ( void  )

Return the mask of available cores.

Returns
Mask of available cores

Definition at line 12 of file cpu.c.

References read64(), and RST_PP_AVAILABLE.

Referenced by cpu_get_num_available_cores(), and start_cpu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpu_get_num_available_cores()

size_t cpu_get_num_available_cores ( void  )

Return the number of cores available in the chip.

Returns
The number of available cores.

Definition at line 17 of file cpu.c.

References cpu_get_available_core_mask().

Referenced by mainboard_print_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cpu_self_get_core_id()

size_t cpu_self_get_core_id ( void  )

Number of the Core on which the program is currently running.

Returns
Number of cores

Definition at line 36 of file cpu.c.

Referenced by cpu_self_get_core_mask(), and start_cpu().

Here is the caller graph for this function:

◆ cpu_self_get_core_mask()

uint64_t cpu_self_get_core_mask ( void  )

Return a mask representing this core in a 64bit bitmask.

Returns
The mask of active core.

Definition at line 49 of file cpu.c.

References cpu_self_get_core_id().

Here is the call graph for this function:

◆ secondary_cpu_init()

void secondary_cpu_init ( size_t  core_id)

Secondary CPU C entry point.

For internal use only.

Definition at line 25 of file cpu.c.

References dmb, secondary_booted, secondary_c_entry, and write64().

Here is the call graph for this function:

◆ start_cpu()

size_t start_cpu ( size_t  cpu,
void(*)(size_t core_id)  entry_64 
)

Init secondary core and call the provided entry for given core.

A stack of size CONFIG_STACK_SIZE is set up for each core in REGION stack_sec. The unique core id is passed to the entry point functions.

Returns
zero on success

Definition at line 54 of file cpu.c.

References BIOS_DEBUG, BIOS_ERR, BIOS_INFO, cpu_get_available_core_mask(), cpu_self_get_core_id(), dmb, MIO_BOOT_AP_JUMP, printk, read64(), REGION_SIZE, reset(), RST_PP_PENDING, RST_PP_RESET, secondary_booted, secondary_c_entry, secondary_init(), stopwatch_expired(), stopwatch_init_usecs_expire(), udelay(), and write64().

Here is the call graph for this function:

Variable Documentation

◆ secondary_booted

size_t secondary_booted
static

Definition at line 23 of file cpu.c.

Referenced by secondary_cpu_init(), and start_cpu().

◆ secondary_c_entry

void(* secondary_c_entry) (size_t core_id) ( size_t  core_id)
static

Definition at line 22 of file cpu.c.

Referenced by secondary_cpu_init(), and start_cpu().