Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / x86_64-pc / kernel / platform_init.c
blob746debe136b1def2a3e71230b755b9f9010cc987
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define __KERNEL_NOLIBBASE__
8 #include <aros/multiboot.h>
9 #include <aros/symbolsets.h>
10 #include <asm/cpu.h>
11 #include <asm/io.h>
12 #include <exec/lists.h>
13 #include <proto/exec.h>
15 #include <inttypes.h>
17 #include "kernel_base.h"
18 #include "kernel_debug.h"
19 #include "kernel_intern.h"
20 #include "apic.h"
21 #include "smp.h"
22 #include "xtpic.h"
24 #define D(x) x
25 #define DAPIC(x)
27 /* Post exec init */
29 static int Platform_Init(struct KernelBase *LIBBASE)
31 struct PlatformData *pdata;
32 int i;
34 D(bug("[Kernel] Kernel_Init: Post-exec init. KernelBase @ %p\n", LIBBASE));
36 for (i = 0; i < IRQ_COUNT; i++)
38 switch(i)
40 case 0x00 ... 0x0f:
41 LIBBASE->kb_Interrupts[i].lh_Type = KBL_XTPIC;
42 break;
43 case 0xde:
44 LIBBASE->kb_Interrupts[i].lh_Type = KBL_APIC;
45 break;
46 default:
47 LIBBASE->kb_Interrupts[i].lh_Type = KBL_INTERNAL;
48 break;
52 D(bug("[Kernel] Kernel_Init: Interupt List initialised\n"));
54 pdata = AllocMem(sizeof(struct PlatformData), MEMF_PUBLIC|MEMF_CLEAR);
55 if (!pdata)
56 return FALSE;
58 LIBBASE->kb_PlatformData = pdata;
60 return TRUE;
63 ADD2INITLIB(Platform_Init, 10)
65 void PlatformPostInit(void)
67 struct PlatformData *pdata = KernelBase->kb_PlatformData;
69 #if (1)
70 ACPICABase = OpenLibrary("acpica.library", 0);
72 if (ACPICABase)
73 pdata->kb_APIC = acpi_APIC_Init();
74 #else
75 acpi_Initialize();
76 #endif
78 #if (0)
79 if (!pdata->kb_APIC)
81 /* No APIC was discovered by ACPI/whatever else. Do the probe. */
82 pdata->kb_APIC = core_APIC_Probe();
85 if ((!pdata->kb_APIC) || (pdata->kb_APIC->flags & APF_8259))
87 /* Initialize our XT-PIC */
88 XTPIC_Init(&pdata->xtpic_mask);
90 #else
91 // Now initialize our interrupt controller (XT-PIC or APIC)
92 ictl_Initialize();
93 #endif
95 #if (0)
96 if (pdata->kb_APIC && (pdata->kb_APIC->count > 1))
98 if (smp_Setup())
100 smp_Wake();
102 else
104 D(bug("[Kernel] Failed to prepare the environment!\n"));
106 pdata->kb_APIC->count = 1; /* We have only one workinng CPU */
109 #else
110 // The last thing to do is to start up secondary CPU cores (if any)
111 smp_Initialize();
112 #endif