]> rtime.felk.cvut.cz Git - jailhouse.git/blob - tools/root-cell-config.c.tmpl
tools: config-create: include PM timer in root cell config
[jailhouse.git] / tools / root-cell-config.c.tmpl
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2014
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2.  See
7  * the COPYING file in the top-level directory.
8  *
9  * Configuration for ${product[0]} ${product[1]}
10  * created with '${argstr}'
11  *
12  * NOTE: This config expects the following to be appended to your kernel cmdline
13  *       "memmap=${hex(ourmem[1])}$${hex(ourmem[0])}"
14  */
15
16 #include <linux/types.h>
17 #include <jailhouse/cell-config.h>
18
19 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
20
21 struct {
22         struct jailhouse_system header;
23         __u64 cpus[1];
24         struct jailhouse_memory mem_regions[${len(regions)}];
25         struct jailhouse_irqchip irqchips[1];
26         __u8 pio_bitmap[0x2000];
27         struct jailhouse_pci_device pci_devices[${len(pcidevices)}];
28 } __attribute__((packed)) config = {
29         .header = {
30                 .hypervisor_memory = {
31                         .phys_start = ${hex(hvmem[0])},
32                         .size = ${hex(hvmem[1])},
33                 },
34                 .config_memory = {
35                         .phys_start = ${hex(confmem[0])},
36                         .size = ${hex(confmem[1])},
37                 },
38                 .platform_info.x86 = {
39                         .pm_timer_address = ${hex(pm_timer_base)},
40                 },
41                 .root_cell = {
42                         .name = "${product[1]}",
43                         .cpu_set_size = sizeof(config.cpus),
44                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
45                         .num_irqchips = ARRAY_SIZE(config.irqchips),
46                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
47                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
48                 },
49         },
50
51         .cpus = {
52                 0b${'1'*cpucount},
53         },
54
55         .mem_regions = {
56                 % for r in regions:
57                 /* ${str(r)} */
58                 % for c in r.comments:
59                 /* ${c} */
60                 % endfor
61                 {
62                         .phys_start = ${hex(r.start)},
63                         .virt_start = ${hex(r.start)},
64                         .size = ${hex(r.size())},
65                         .flags = ${r.flagstr('\t\t')},
66                 },
67                 % endfor
68         },
69
70         .irqchips = {
71                 /* IOAPIC */ {
72                         .address = 0xfec00000,
73                         .id = ${hex(ioapic_id)},
74                         .pin_bitmap = 0xffffff,
75                 },
76         },
77
78         .pio_bitmap = {
79                 [     0/8 ...   0x1f/8] = -1,
80                 [  0x20/8 ...   0x27/8] = 0xfc, /* HACK: PIC */
81                 [  0x28/8 ...   0x3f/8] = -1,
82                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
83                 [  0x48/8 ...   0x5f/8] = -1,
84                 [  0x60/8 ...   0x67/8] = 0, /* HACK: 8042, NMI status/control */
85                 [  0x68/8 ...   0x6f/8] = -1,
86                 [  0x70/8 ...   0x77/8] = 0xfc, /* RTC */
87                 [  0x78/8 ...  0x3af/8] = -1,
88                 [ 0x3b0/8 ...  0x3df/8] = 0x00, /* VGA */
89                 [ 0x3e0/8 ...  0x3ff/8] = -1,
90                 [ 0x400/8 ...  0x47f/8] = 0, /* HACK: ACPI */
91                 [ 0x480/8 ...  0xcff/8] = -1,
92                 [ 0xd00/8 ... 0xffff/8] = 0, /* HACK: PCI bus */
93         },
94
95         .pci_devices = {
96                 % for d in pcidevices:
97                 /* ${str(d)} */
98                 {
99                         .type = ${d.type},
100                         .domain = ${hex(d.domain)},
101                         .bus = ${hex(d.bus)},
102                         .devfn = ${hex(d.devfn())},
103                 },
104                 % endfor
105         },
106 };