Add startup option to enable/disable SMP.

This commit is contained in:
Martin Whitaker 2020-12-10 12:52:58 +00:00
parent b508b528d0
commit 27c5fe363f
5 changed files with 25 additions and 7 deletions

View File

@ -99,13 +99,15 @@ the system was booted in UEFI mode, graphics mode must be used.
Once booted, PCMemTest will initialise its display, then pause for a few
seconds to allow the user to configure its operation. If no key is pressed,
it will automatically start running all tests using all available CPU cores,
it will automatically start running all tests using a single CPU core,
continuing indefinitely until the user reboots or halts the machine.
At startup, and when running tests, PCMemTest responds to the following keys:
* F1
* enters the configuration menu
* F2
* toggles detection and use of multiple CPU cores (SMP)
* Space
* toggles scroll lock (stops/starts error message scrolling)
* Enter

View File

@ -586,9 +586,11 @@ void config_menu(bool initial)
void initial_config(void)
{
display_notice("Press <F1> to configure, <Enter> to start testing");
display_notice("Press <F1> to configure, <F2> to enable SMP, <Enter> to start testing ");
bool got_key = false;
bool smp_enabled = false;
bool smp_init_done = false;
for (int i = 0; i < 5000 && !got_key; i++) {
usleep(1000);
switch (get_key()) {
@ -598,9 +600,20 @@ void initial_config(void)
reboot();
break;
case '1':
smp_init(smp_enabled);
smp_init_done = true;
config_menu(true);
got_key = true;
break;
case '2':
smp_enabled = !smp_enabled;
if (smp_enabled) {
display_notice("Press <F1> to configure, <F2> to disable SMP, <Enter> to start testing");
} else {
display_notice("Press <F1> to configure, <F2> to enable SMP, <Enter> to start testing ");
}
i = 0;
break;
case ' ':
toggle_scroll_lock();
break;
@ -611,4 +624,7 @@ void initial_config(void)
break;
}
}
if (!smp_init_done) {
smp_init(smp_enabled);
}
}

View File

@ -155,8 +155,6 @@ static void global_init(void)
error_init();
smp_init();
initial_config();
clear_message_area();

View File

@ -631,7 +631,7 @@ static smp_error_t start_cpu(int pcpu_num)
// Public Functions
//------------------------------------------------------------------------------
void smp_init(void)
void smp_init(bool smp_enable)
{
for (int i = 0; i < MAX_APIC_IDS; i++) {
apic_id_to_pcpu_num[i] = 0;
@ -644,7 +644,9 @@ void smp_init(void)
num_pcpus = 1;
(void)(find_cpus_in_rsdp() || find_cpus_in_floating_mp_struct());
if (smp_enable) {
(void)(find_cpus_in_rsdp() || find_cpus_in_floating_mp_struct());
}
for (int i = 0; i < num_pcpus; i++) {
apic_id_to_pcpu_num[pcpu_num_to_apic_id[i]] = i;

View File

@ -39,7 +39,7 @@ extern int num_pcpus;
/*
* Initialises the SMP state and detects the number of physical CPUs.
*/
void smp_init(void);
void smp_init(bool smp_enable);
/*
* Starts the selected APs.