AGESA f15 vendorcode: Remove AM3r2 refcode
[coreboot.git] / util / sconfig / sconfig.y
blob7108e67a3a5ff5a9bf73b7e80767a70a43f62263
1 %{
2 /*
3 * sconfig, coreboot device tree compiler
5 * Copyright (C) 2010 coresystems GmbH
6 * written by Patrick Georgi <patrick@georgi-clan.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 int yylex();
21 void yyerror(const char *s);
23 static struct device *cur_parent, *cur_bus;
26 %union {
27 struct device *device;
28 char *string;
29 int number;
32 %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 GENERIC SPI
34 devtree: { cur_parent = cur_bus = head; } chip { postprocess_devtree(); } ;
36 chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ;
38 devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | /* empty */ ;
40 chip: CHIP STRING /* == path */ {
41 $<device>$ = new_chip(cur_parent, cur_bus, $<string>2);
42 cur_parent = $<device>$;
44 chipchildren END {
45 cur_parent = $<device>3->parent;
46 fold_in($<device>3);
47 add_header($<device>3);
50 device: DEVICE BUS NUMBER /* == devnum */ BOOL {
51 $<device>$ = new_device(cur_parent, cur_bus, $<number>2, $<string>3, $<number>4);
52 cur_parent = $<device>$;
53 cur_bus = $<device>$;
55 devicechildren END {
56 cur_parent = $<device>5->parent;
57 cur_bus = $<device>5->bus;
58 fold_in($<device>5);
59 alias_siblings($<device>5->children);
62 resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
63 { add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;
65 registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */
66 { add_register(cur_parent, $<string>2, $<string>4); } ;
68 subsystemid: SUBSYSTEMID NUMBER NUMBER
69 { add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 0); };
71 subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT
72 { add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 1); };
74 ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER
75 { add_ioapic_info(cur_parent, strtol($<string>2, NULL, 16), $<string>3, strtol($<string>4, NULL, 16)); };