Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 1 | %{ |
Patrick Georgi | ea063cb | 2020-05-08 19:28:13 +0200 | [diff] [blame] | 2 | /* sconfig, coreboot device tree compiler */ |
Patrick Georgi | 7333a11 | 2020-05-08 20:48:04 +0200 | [diff] [blame] | 3 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 4 | |
| 5 | #include "sconfig.tab.h" |
| 6 | |
| 7 | int linenum = 0; |
| 8 | %} |
| 9 | %option nodebug |
| 10 | %% |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 11 | [ \t]+ {} |
| 12 | #.*\n {linenum++;} |
| 13 | \r?\n {linenum++;} |
| 14 | chip {return(CHIP);} |
| 15 | device {return(DEVICE);} |
Nico Huber | 8e1ea52 | 2020-06-03 10:20:07 -0700 | [diff] [blame] | 16 | alias {return(ALIAS);} |
Nico Huber | c0fc38e | 2022-08-06 19:02:59 +0200 | [diff] [blame] | 17 | ops {return(OPS);} |
Nico Huber | 8e1ea52 | 2020-06-03 10:20:07 -0700 | [diff] [blame] | 18 | use {return(REFERENCE);} |
Duncan Laurie | e335c2e | 2020-07-29 16:28:43 -0700 | [diff] [blame] | 19 | ref {return(REFERENCE);} |
Nico Huber | 8e1ea52 | 2020-06-03 10:20:07 -0700 | [diff] [blame] | 20 | as {return(ASSOCIATION);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 21 | register {return(REGISTER);} |
Duncan Laurie | 47b7b34 | 2020-05-15 15:39:08 -0700 | [diff] [blame] | 22 | fw_config {return(FW_CONFIG_TABLE);} |
| 23 | field {return(FW_CONFIG_FIELD);} |
| 24 | option {return(FW_CONFIG_OPTION);} |
| 25 | probe {return(FW_CONFIG_PROBE);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 26 | on {yylval.number=1; return(BOOL);} |
| 27 | off {yylval.number=0; return(BOOL);} |
Ronald G. Minnich | 466ca2c | 2019-10-22 02:02:24 +0000 | [diff] [blame] | 28 | hidden {yylval.number=3; return(STATUS);} |
| 29 | mandatory {yylval.number=5; return(STATUS);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 30 | pci {yylval.number=PCI; return(BUS);} |
| 31 | ioapic {yylval.number=IOAPIC; return(BUS);} |
| 32 | pnp {yylval.number=PNP; return(BUS);} |
| 33 | i2c {yylval.number=I2C; return(BUS);} |
| 34 | lapic {yylval.number=APIC; return(BUS);} |
| 35 | cpu_cluster {yylval.number=CPU_CLUSTER; return(BUS);} |
| 36 | cpu {yylval.number=CPU; return(BUS);} |
| 37 | domain {yylval.number=DOMAIN; return(BUS);} |
| 38 | generic {yylval.number=GENERIC; return(BUS);} |
| 39 | mmio {yylval.number=MMIO; return(BUS);} |
| 40 | spi {yylval.number=SPI; return(BUS);} |
| 41 | usb {yylval.number=USB; return(BUS);} |
Michael Niewöhner | dbb667a | 2020-12-11 21:26:02 +0100 | [diff] [blame] | 42 | gpio {yylval.number=GPIO; return(BUS);} |
Mario Scheithauer | 67f63e7 | 2022-11-02 15:57:10 +0100 | [diff] [blame] | 43 | mdio {yylval.number=MDIO; return(BUS);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 44 | irq {yylval.number=IRQ; return(RESOURCE);} |
| 45 | drq {yylval.number=DRQ; return(RESOURCE);} |
| 46 | io {yylval.number=IO; return(RESOURCE);} |
| 47 | ioapic_irq {return(IOAPIC_IRQ);} |
| 48 | inherit {return(INHERIT);} |
| 49 | subsystemid {return(SUBSYSTEMID);} |
| 50 | end {return(END);} |
| 51 | smbios_slot_desc {return(SLOT_DESC);} |
Angel Pons | 437da71 | 2021-09-03 16:51:40 +0200 | [diff] [blame] | 52 | smbios_dev_info {return(SMBIOS_DEV_INFO);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 53 | = {return(EQUALS);} |
Tim Wawrzynczak | 13e240c | 2021-04-28 14:03:07 -0600 | [diff] [blame] | 54 | \| {return(PIPE);} |
Patrick Rudolph | ac24d3c | 2019-04-12 14:42:17 +0200 | [diff] [blame] | 55 | 0x[0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 56 | [0-9.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 57 | [0-9a-fA-F.]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);} |
| 58 | INT[A-D] {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);} |
| 59 | \"\"[^\"]+\"\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} |
| 60 | \"[^\"]+\" {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);} |
| 61 | [^ \n\t]+ {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);} |
Patrick Georgi | 7e8c9aa | 2010-04-08 11:37:43 +0000 | [diff] [blame] | 62 | %% |