Added: new boot.S, serial out for Xeon Phi
[barrelfish] / kernel / Hakefile
1 --------------------------------------------------------------------------
2 -- Copyright (c) 2007-2013, ETH Zurich.
3 -- All rights reserved.
4 --
5 -- This file is distributed under the terms in the attached LICENSE file.
6 -- If you do not find this file, copies can be found by writing to:
7 -- ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich. 
8 -- Attn: Systems Group.
9 --
10 -- Hakefile for Barrelfish CPU drivers
11 -- 
12 --------------------------------------------------------------------------
13
14 --
15 -- Missing from this new Hakefile is the rule to build kernel debug
16 -- symbols, since this requires some thinking about naming
17 -- conventions.  Here is the rule we need:
18 --
19 --                Rule ( [ Str "OBJDUMP=objdump",
20 --                         In SrcTree "src" "/tools/gen-gdbscript.sh",
21 --                         In SrcTree "src" "/tools/debug.gdb.in",
22 --                         In BuildTree arch "../sbin/cpu",
23 --                         Str ">", Out arch "/debug.gdb"
24 --                        ] )
25
26
27
28 let
29   scheduler = case Config.scheduler of
30       Config.RR   -> "schedule_rr.c"
31       Config.RBED -> "schedule_rbed.c"
32   common_c = [ "gdb_stub.c", 
33                "capabilities.c", 
34                "dispatch.c",
35                scheduler, 
36                "memset.c", 
37                "memmove.c", 
38                "paging_generic.c",
39                "printf.c",
40                "startup.c", 
41                "stdlib.c", 
42                "string.c", 
43                "syscall.c",
44                "wakeup.c", 
45                "useraccess.c" ]
46              ++ (if Config.microbenchmarks then ["microbenchmarks.c"] else [])
47              ++ (if Config.oneshot_timer then ["timer.c"] else [])
48   common_libs = [ "getopt", "mdb_kernel" ]
49   
50   link_cpudriver arg = linkKernel opts name objs libs
51     where 
52       opts = (kernelOptions $ head $ Args.architectures arg)
53       suffix = if "cpu" == Args.target arg 
54              then "" 
55              else "_" ++ (Args.target arg)
56       name = "cpu" ++ suffix
57       objs = [ objectFilePath opts f 
58              | f <- (Args.assemblyFiles arg) ++ (Args.cFiles arg) ++ common_c ] 
59       libs = (Args.addLibraries arg) ++ common_libs
60     
61   cpudrivers arglist = 
62     let 
63       cafiles = Data.List.nub $ concat [ [ [ arch, cfile ] 
64                                          | arch <- Args.architectures arg,
65                                            cfile <- common_c ++ (Args.cFiles arg) ]
66                                        | arg <- arglist ]
67       safiles = Data.List.nub $ concat [ [ [ arch, sfile ]
68                                          | arch <- Args.architectures arg,
69                                            sfile <- Args.assemblyFiles arg ]
70                                        | arg <- arglist ]
71       mafiles = Data.List.nub $ concat [ [ [ arch, mfile ]
72                                          | arch <- Args.architectures arg,
73                                            mfile <- Args.mackerelDevices arg ]
74                                        | arg <- arglist ]
75     in
76      ( [ compileCFile (kernelOptions a) f | [a,f] <- cafiles ]
77        ++
78        [ assembleSFile (kernelOptions a) f | [a,f] <- safiles ]
79        ++
80        [ mackerelDependencies (kernelOptions a) f [ c | [a,c] <- cafiles]  
81        | [a,f] <- mafiles ]
82        ++
83        [ link_cpudriver arg | arg <- arglist ]
84      )
85          
86   in cpudrivers [
87   --
88   -- Generic Intel/AMD amd64 64-bit x86 core
89   --
90   cpuDriver { 
91      architectures = [ "x86_64" ],
92      assemblyFiles = [ "arch/x86_64/boot.S", 
93                        "arch/x86_64/entry.S", 
94                        "arch/x86/init_ap_x86_64.S", 
95                        "arch/x86/init_ap_x86_32.S" ],
96      cFiles = [ "arch/x86_64/debug.c", 
97                 "arch/x86_64/gdb_arch.c", 
98                 "arch/x86_64/init.c", 
99                 "arch/x86_64/irq.c",
100                 "arch/x86_64/startup_arch.c", 
101                 "arch/x86_64/exec.c", 
102                 "arch/x86_64/syscall.c", 
103                 "arch/x86_64/paging.c",
104                 "arch/x86_64/vmkit.c" , 
105                 "arch/x86_64/page_mappings_arch.c",
106                 "arch/x86/apic.c", 
107                 "arch/x86/pic.c", 
108                 "arch/x86/start_aps.c", 
109                 "arch/x86/cmos.c", 
110                 "arch/x86/misc.c",
111                 "arch/x86/serial.c", 
112                 "arch/x86/multiboot.c", 
113                 "arch/x86/conio.c", 
114                 "arch/x86/syscall.c", 
115                 "arch/x86/debugregs.c",
116                 "arch/x86/perfmon.c", 
117                 "arch/x86/perfmon_intel.c", 
118                 "arch/x86/perfmon_amd.c", 
119                 "arch/x86/rtc.c", 
120                 "arch/x86/timing.c",
121                 "arch/x86/startup_x86.c", 
122                 "arch/x86/mcheck.c", 
123                 "arch/x86/ipi_notify.c"
124               ],
125      mackerelDevices = [ "lpc_pic", 
126                          "pc16550d", 
127                          "ia32", 
128                          "amd64", 
129                          "xapic", 
130                          "amd_vmcb", 
131                          "cpuid", 
132                          "lpc_rtc" ],
133      addLibraries = [ "elf_kernel" ]
134      },
135   --
136   -- Intel Xeon Phi (K1OM)
137   --
138   cpuDriver { 
139      architectures = [ "k1om" ],
140      assemblyFiles = [ "arch/k1om/boot.S", 
141                        "arch/k1om/entry.S", 
142                        "arch/x86/init_ap_x86_64.S", 
143                        "arch/x86/init_ap_x86_32.S" ],
144      cFiles = [ "arch/k1om/debug.c", 
145                 "arch/k1om/gdb_arch.c", 
146                 "arch/k1om/init.c", 
147                 "arch/k1om/irq.c",
148                 "arch/k1om/startup_arch.c", 
149                 "arch/k1om/exec.c", 
150                 "arch/k1om/syscall.c", 
151                 "arch/k1om/paging.c",
152                 "arch/k1om/vmkit.c" , 
153                 "arch/k1om/page_mappings_arch.c",
154                 "arch/k1om/serial.c",
155                 "arch/x86/apic.c", 
156                 "arch/x86/pic.c", 
157                 "arch/x86/start_aps.c", 
158                 "arch/x86/cmos.c", 
159                 "arch/x86/misc.c",
160                 "arch/x86/multiboot.c", 
161                 "arch/x86/conio.c", 
162                 "arch/x86/syscall.c", 
163                 "arch/x86/debugregs.c",
164                 "arch/x86/perfmon.c", 
165                 "arch/x86/perfmon_intel.c", 
166                 "arch/x86/perfmon_amd.c", 
167                 "arch/x86/rtc.c", 
168                 "arch/x86/timing.c",
169                 "arch/x86/startup_x86.c", 
170                 "arch/x86/mcheck.c", 
171                 "arch/x86/ipi_notify.c"
172               ],
173      mackerelDevices = [ "lpc_pic", 
174                          "pc16550d", 
175                          "ia32", 
176                          "amd64", 
177                          "xapic", 
178                          "amd_vmcb", 
179                          "cpuid", 
180                          "lpc_rtc" ],
181      addLibraries = [ "elf_kernel" ]
182      },
183   --
184   -- Generic Intel ia32 32-bit x86 core
185   --
186   cpuDriver {   
187      architectures = [ "x86_32" ],
188      assemblyFiles = [ "arch/x86_32/boot.S", 
189                        "arch/x86_32/entry.S", 
190                        "arch/x86_32/pic.S",
191                        "arch/x86/init_ap_x86_64.S", 
192                        "arch/x86/init_ap_x86_32.S" ],
193      cFiles = [ "arch/x86_32/debug.c", 
194                 "arch/x86_32/gdb_arch.c", 
195                 "arch/x86_32/init.c", 
196                 "arch/x86_32/irq.c",
197                 "arch/x86_32/startup_arch.c", 
198                 "arch/x86_32/exec.c", 
199                 "arch/x86_32/syscall.c", 
200                 "arch/x86_32/paging.c",
201                 "arch/x86_32/page_mappings_arch.c",
202                 "arch/x86/apic.c", 
203                 "arch/x86/pic.c", 
204                 "arch/x86/start_aps.c", 
205                 "arch/x86/cmos.c", 
206                 "arch/x86/misc.c",
207                 "arch/x86/serial.c", 
208                 "arch/x86/multiboot.c", 
209                 "arch/x86/conio.c", 
210                 "arch/x86/syscall.c", 
211                 "arch/x86/debugregs.c",
212                 "arch/x86/perfmon.c", 
213                 "arch/x86/perfmon_intel.c", 
214                 "arch/x86/perfmon_amd.c", 
215                 "arch/x86/rtc.c", 
216                 "arch/x86/timing.c",
217                 "arch/x86/startup_x86.c", 
218                 "arch/x86/ipi_notify.c"
219               ],
220      mackerelDevices = [ "lpc_pic", 
221                          "pc16550d", 
222                          "ia32", 
223                          "amd64", 
224                          "xapic", 
225                          "cpuid", 
226                          "lpc_rtc" ],
227      addLibraries = [ "elf_kernel" ]
228      },
229   --
230   -- Intel Gauss Lake P54C core in the Rock Creek Single-Chip Cloud Computer
231   --
232   cpuDriver { 
233      architectures = [ "scc" ],
234      assemblyFiles = [ "arch/scc/boot.S",
235                        "arch/x86_32/entry.S", 
236                        "arch/x86_32/pic.S" ],
237      cFiles = [ "arch/scc/rck.c",
238                 "arch/x86_32/debug.c", 
239                 "arch/x86_32/gdb_arch.c", 
240                 "arch/x86_32/init.c", 
241                 "arch/x86_32/irq.c",
242                 "arch/x86_32/startup_arch.c", 
243                 "arch/x86_32/exec.c", 
244                 "arch/x86_32/syscall.c", 
245                 "arch/x86_32/paging.c",
246                 "arch/x86_32/page_mappings_arch.c",
247                 "arch/x86/apic.c", 
248                 "arch/x86/misc.c",
249                 "arch/x86/serial.c", 
250                 "arch/x86/multiboot.c", 
251                 "arch/x86/syscall.c", 
252                 "arch/x86/debugregs.c",
253                 "arch/x86/timing.c",
254                 "arch/x86/startup_x86.c"
255               ],
256      mackerelDevices = [ "pc16550d", 
257                          "ia32", 
258                          "xapic", 
259                          "rck", 
260                          "eMAC", 
261                          "cpuid", 
262                          "lpc_rtc" ],
263      addLibraries = [ "elf_kernel" ]
264      },
265   --
266   -- Generic ARMv5 core, unused?
267   --
268   cpuDriver {
269      architectures = [ "armv5" ],
270      assemblyFiles = [ "arch/armv5/boot.S", 
271                        "arch/armv5/exceptions.S" ],
272      cFiles = [ "arch/arm/exn.c", 
273                 "arch/arm/exec.c", 
274                 "arch/arm/misc.c", 
275                 "arch/arm/phys_mmap.c", 
276                 "arch/armv5/init.c", 
277                 "arch/armv5/integrator.c", 
278                 "arch/armv5/kludges.c", 
279                 "arch/armv5/kputchar.c", 
280                 "arch/armv5/pl011_uart.c", 
281                 "arch/armv5/cp15.c",
282                 "arch/armv5/paging.c", 
283                 "arch/armv5/startup_arch.c", 
284                 "arch/armv5/syscall.c" ],
285      mackerelDevices = [ "arm", 
286                          "arm_icp_pit", 
287                          "arm_icp_pic0", 
288                          "pl011_uart" ],
289      addLibraries = [ "elf", "cpio" ]
290      },
291   --
292   -- ARM11MP ARMv6 core, currently unsupported.
293   -- XXX: reorganize sources for ARMv6
294   --
295   cpuDriver {
296      architectures = [ "arm11mp" ],
297      assemblyFiles = [ "arch/armv5/boot.S", 
298                        "arch/armv5/exceptions.S", 
299                        "arch/paging_cp.S" ],
300      cFiles = [ "arch/arm/exn.c", 
301                 "arch/arm/exec.c", 
302                 "arch/arm/misc.c", 
303                 "arch/arm/phys_mmap.c", 
304                 "arch/armv5/init.c", 
305                 "arch/armv5/integrator.c", 
306                 "arch/armv5/kludges.c", 
307                 "arch/armv5/kputchar.c", 
308                 "arch/armv5/pl011_uart.c", 
309                 "arch/armv5/paging.c", 
310                 "arch/armv5/startup_arch.c", 
311                 "arch/armv5/syscall.c" ],
312      mackerelDevices = [ "arm", 
313                          "arm_icp_pit", 
314                          "arm_icp_pic0", 
315                          "pl011_uart" ],
316      addLibraries = [ "elf", "cpio" ]
317      },
318   --
319   -- ARM Gem5 Cortex-A series ARMv7 core
320   --
321   cpuDriver { 
322     target = "arm_gem5",
323     architectures = [ "armv7" ],
324     assemblyFiles = [ "arch/arm_gem5/boot.S",
325                       "arch/armv7/cp15.S",
326                       "arch/armv7/exceptions.S" ],
327     cFiles = [ "arch/arm/exec.c", 
328                "arch/arm/misc.c", 
329                "arch/arm/phys_mmap.c",
330                "arch/arm/exn.c", 
331                "arch/arm_gem5/init.c", 
332                "arch/arm_gem5/integrator.c", 
333                "arch/arm_gem5/paging.c", 
334                "arch/arm_gem5/gem5_serial.c", 
335                "arch/arm_gem5/pl011_uart.c", 
336                "arch/arm_gem5/startup_arch.c", 
337                "arch/armv7/gic.c",
338                "arch/armv7/kludges.c", 
339                "arch/armv7/multiboot.c", 
340                "arch/armv7/syscall.c",
341                "arch/armv7/irq.c", 
342                "arch/arm_gem5/start_aps.c", 
343                "arch/armv7/kputchar.c" ],
344     mackerelDevices = [ "arm", 
345                         "arm_icp_pit", 
346                         "pl011_uart", 
347                         "pl130_gic", 
348                         "sp804_pit", 
349                         "cortex_a9_pit", 
350                         "a9scu" ],
351     addLibraries = [ "elf", "cpio" ]
352     },
353   --
354   -- Intel ixp2800 XScale core
355   --
356   cpuDriver {
357      target = "ixp2800",
358      architectures = [ "xscale" ],
359      assemblyFiles = [ "arch/xscale/boot.S", 
360                        "arch/armv5/exceptions.S"  ],
361      cFiles = [ "arch/arm/exn.c", 
362                 "arch/arm/exec.c", 
363                 "arch/arm/misc.c", 
364                 "arch/arm/phys_mmap.c", 
365                 -- according to the Xscale documentation, the MMU is a
366                 -- standard ARMv5 design, so we should be able to use
367                 -- the armv5 cp15 code. -SG, 8/1/13
368                 "arch/armv5/cp15.c",
369                 "arch/armv5/init.c", 
370                 "arch/armv5/kludges.c", 
371                 "arch/armv5/startup_arch.c", 
372                 "arch/armv5/syscall.c", 
373                 "arch/xscale/ixp2800_integrator.c", 
374                 "arch/xscale/ixp2800_uart.c", 
375                 "arch/xscale/ixp2800_paging.c", 
376                 "arch/xscale/kputchar.c" ],
377      mackerelDevices = [ "arm", 
378                          "ixp2800_icp_pit", 
379                          "ixp2800_icp_pic0", 
380                          "ixp2800_uart" ],
381      addLibraries = [ "elf", "cpio" ]
382      },
383   --
384   -- Broadcom OMAP44xx-series dual-core Cortex-A9 SoC
385   --
386   cpuDriver {
387      target = "omap44xx",
388      architectures = [ "armv7" ],
389      assemblyFiles = [ "arch/omap44xx/boot.S",
390                        "arch/armv7/cp15.S",
391                        "arch/armv7/exceptions.S" ],
392      cFiles = [ "arch/arm/exec.c", 
393                 "arch/arm/misc.c", 
394                 "arch/arm/exn.c", 
395                 "arch/arm/phys_mmap.c",
396                 "arch/armv7/gic.c",
397                 "arch/armv7/kludges.c", 
398                 "arch/armv7/multiboot.c", 
399                 "arch/armv7/syscall.c",
400                 "arch/armv7/irq.c",
401                 "arch/omap44xx/init.c", 
402                 "arch/omap44xx/omap.c", 
403                 "arch/omap44xx/paging.c", 
404                 "arch/omap44xx/startup_arch.c", 
405                 "arch/omap44xx/omap_uart.c", 
406                 "arch/omap44xx/start_aps.c",
407                 "arch/omap44xx/spinlock.c", 
408                 "arch/omap44xx/cortexm3_heteropanda.c", --will be empty if heteropanda = False
409                 "arch/armv7/kputchar.c"],
410      mackerelDevices = [ "arm", 
411                          "arm_icp_pit", 
412                          "pl130_gic", 
413                          "sp804_pit", 
414                          "cortex_a9_pit", 
415                          "a9scu", 
416                          "omap/omap_uart", 
417                          "omap/omap44xx_id", 
418                          "omap/omap44xx_emif",
419                          "omap/omap44xx_gpio",
420                          "omap/omap44xx_sysctrl_padconf_core",
421                          "omap/omap44xx_sysctrl_padconf_wkup",
422                          "omap/omap44xx_hsusbhost",
423                          "omap/omap44xx_usbtllhs_config",
424                          "omap/omap44xx_scrm",
425                          "omap/omap44xx_ehci",
426                          "omap/omap44xx_ckgen_prm", 
427                          "omap/omap44xx_l4per_cm2", 
428                          "omap/omap44xx_l3init_cm2",
429                          "omap/omap44xx_spinlock",
430                          "omap/omap44xx_mmu",
431                          "omap/omap44xx_gpio"],
432      addLibraries = [ "elf", "cpio" ]
433      },                            
434   --
435   -- Broadcom OMAP44xx-series dual-core Cortex-M3 Coprocessor,
436   -- used to run a heterogenous system on the pandaboard 
437   --
438
439   cpuDriver {
440      target = "omap44xx",
441      architectures = [ "armv7-m" ],
442      assemblyFiles = [ "arch/armv7-m/boot.S",
443                        "arch/armv7-m/exceptions.S" ],
444      cFiles = [ 
445                 "arch/armv7-m/exec.c", 
446                 "arch/arm/misc.c", 
447                 "arch/armv7-m/exn.c", 
448                 "arch/arm/phys_mmap.c",
449                 "arch/armv7/kludges.c", 
450                 "arch/armv7/multiboot.c", 
451                 "arch/armv7/syscall.c", 
452                 "arch/armv7-m/init.c", 
453                 "arch/armv7-m/omap.c", 
454                 "arch/armv7-m/paging.c", 
455                 "arch/omap44xx/startup_arch.c", 
456                 "arch/omap44xx/omap_uart.c", 
457 --                "arch/omap44xx/start_aps.c", 
458                 "arch/armv7/kputchar.c", 
459                 "arch/omap44xx/spinlock.c"
460                 ],
461      mackerelDevices = [ "arm", 
462                          "omap/omap44xx_cortex_m3_nvic", 
463                          "omap/omap_uart", 
464                          "omap/omap44xx_id", 
465                          "omap/omap44xx_emif",
466                          "omap/omap44xx_gpio",
467                          "omap/omap44xx_mmu",
468                          "omap/omap44xx_spinlock"],
469      addLibraries = [ "elf", "cpio" ]
470      }
471   ]