soc/intel/apollolake: Reserve IMRs (Isolated Memory Regions)
[coreboot.git] / util / sconfig / sconfig.y
blob66c5b6df74035cbec45528bba8d11e61576d9ea6
1 %{
2 /*
3 * sconfig, coreboot device tree compiler
5 * Copyright (C) 2010 coresystems GmbH
6 * written by Patrick Georgi <patrick.georgi@coresystems.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #include "sconfig.h"
20 static struct device *cur_parent, *cur_bus;
23 %union {
24 struct device *device;
25 char *string;
26 int number;
29 %token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT
31 devtree: { cur_parent = cur_bus = head; } chip { postprocess_devtree(); } ;
33 chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ;
35 devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | /* empty */ ;
37 chip: CHIP STRING /* == path */ {
38 $<device>$ = new_chip(cur_parent, cur_bus, $<string>2);
39 cur_parent = $<device>$;
41 chipchildren END {
42 cur_parent = $<device>3->parent;
43 fold_in($<device>3);
44 add_header($<device>3);
47 device: DEVICE BUS NUMBER /* == devnum */ BOOL {
48 $<device>$ = new_device(cur_parent, cur_bus, $<number>2, $<string>3, $<number>4);
49 cur_parent = $<device>$;
50 cur_bus = $<device>$;
52 devicechildren END {
53 cur_parent = $<device>5->parent;
54 cur_bus = $<device>5->bus;
55 fold_in($<device>5);
56 alias_siblings($<device>5->children);
59 resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
60 { add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;
62 registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */
63 { add_register(cur_parent, $<string>2, $<string>4); } ;
65 subsystemid: SUBSYSTEMID NUMBER NUMBER
66 { add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 0); };
68 subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT
69 { add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 1); };
71 ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER
72 { add_ioapic_info(cur_parent, strtol($<string>2, NULL, 16), $<string>3, strtol($<string>4, NULL, 16)); };