summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorAlmudena Garcia <liberamenso10000@gmail.com>2020-08-13 15:23:13 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-09-19 21:17:45 +0200
commit8c412290d2b3137bb88d4d259058b8761c2e5392 (patch)
treef016059dc0175ebc1f2995340b3c229a15e607a4 /i386
parent8bfb2df9ed2bcbf84e5b21f3a637e0deef4237be (diff)
smp: Add generic smp pseudoclass
This pseudoclass generalize the initialization and access of SMP data, allowing expands it to other architectures. In x86, the functions calls to apic functions. *kern/smp.c: Source file. Implements a interface to load the SMP functions for the current architecture. *kern/smp.h: Header file. Add declaration for smp_data structure. *i386/i386/smp.c: Source file. Implements a set of functions to manage the SMP actions in i386 *i386/i386/smp.h: Header file. Add declarations for SMP functions in i386.
Diffstat (limited to 'i386')
-rw-r--r--i386/Makefrag.am2
-rw-r--r--i386/i386/smp.c53
-rw-r--r--i386/i386/smp.h21
3 files changed, 76 insertions, 0 deletions
diff --git a/i386/Makefrag.am b/i386/Makefrag.am
index 0f788f30..73df45f4 100644
--- a/i386/Makefrag.am
+++ b/i386/Makefrag.am
@@ -132,6 +132,8 @@ libkernel_a_SOURCES += \
i386/i386/seg.c \
i386/i386/seg.h \
i386/i386/setjmp.h \
+ i386/i386/smp.h \
+ i386/i386/smp.c \
i386/i386/spl.S \
i386/i386/spl.h \
i386/i386/strings.c \
diff --git a/i386/i386/smp.c b/i386/i386/smp.c
new file mode 100644
index 00000000..f64fb7f7
--- /dev/null
+++ b/i386/i386/smp.c
@@ -0,0 +1,53 @@
+/* smp.h - i386 SMP controller for Mach
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Written by Almudena Garcia Jurado-Centurion
+
+ This file is part of GNU Mach.
+
+ GNU Mach is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Mach is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
+
+#include <i386/i386/apic.h>
+#include <i386/i386/smp.h>
+#include <i386/i386at/acpi_parse_apic.h>
+
+#include <kern/smp.h>
+
+
+/*
+ * smp_data_init: initialize smp_data structure
+ * Must be called after smp_init(), once all APIC structures
+ * has been initialized
+ */
+static void smp_data_init(void)
+{
+ uint8_t numcpus = apic_get_numcpus();
+ smp_set_numcpus(numcpus);
+}
+
+/*
+ * smp_init: initialize the SMP support, starting the cpus searching
+ * and enumeration.
+ */
+int smp_init(void)
+{
+ int apic_success;
+
+ apic_success = acpi_apic_init();
+ if (apic_success == ACPI_SUCCESS) {
+ smp_data_init();
+ }
+
+ return apic_success;
+}
diff --git a/i386/i386/smp.h b/i386/i386/smp.h
new file mode 100644
index 00000000..b36ead08
--- /dev/null
+++ b/i386/i386/smp.h
@@ -0,0 +1,21 @@
+/* smp.h - i386 SMP controller for Mach. Header file
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ Written by Almudena Garcia Jurado-Centurion
+
+ This file is part of GNU Mach.
+
+ GNU Mach is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Mach is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
+
+int smp_init(void);