From e8474cf3bc079868b1d6ddd43ba5a316bb9a5080 Mon Sep 17 00:00:00 2001 From: Mike Line Date: Mon, 1 Nov 2010 18:14:37 -0400 Subject: [PATCH] Updated romparse and the makefiles with the new i2c layout The I2C eeprom now contains a section that is used to locate the big and little endian images in the i2c eeprom. --- src/make/Makefile | 1 + src/make/makestg2 | 12 +- src/util/romparse/Makefile | 2 +- src/util/romparse/romparse.c | 295 ++++++++++++++++++++++++++++++--- src/util/romparse/romparse.h | 20 ++- src/util/romparse/rparse.flex | 34 ++-- src/util/romparse/rparse.tab.c | 176 +++++++++++--------- src/util/romparse/rparse.tab.h | 2 + src/util/romparse/rparse.y | 15 +- 9 files changed, 427 insertions(+), 130 deletions(-) diff --git a/src/make/Makefile b/src/make/Makefile index bd0137b..616e392 100644 --- a/src/make/Makefile +++ b/src/make/Makefile @@ -25,6 +25,7 @@ export DEBUG $(IBLS_C6X): make -f makestg2 ARCH=c64x TARGET=$@ ENDIAN=big $@ make -f makestg2 ARCH=c64x TARGET=$@ ENDIAN=little $@ + make -f makestg2 ARCH=c64x TARGET=$@ i2cRom # will need to add a line for each additional ARCH type added diff --git a/src/make/makestg2 b/src/make/makestg2 index 03f0eb0..6a1bad0 100644 --- a/src/make/makestg2 +++ b/src/make/makestg2 @@ -39,6 +39,12 @@ export TARGET $(TARGETS): iblMain +i2cRom: + ../util/romparse/romparse $(COMPACT) ibl_$(TARGET)/i2crom.map + $(CP) i2crom.ccs ibl_$(TARGET)/i2crom.ccs + $(CP) i2crom.ccs ibl_$(TARGET)/i2crom.dat + $(RM) i2crom.ccs ibl_le.b ibl.b + # For the init code a raw image is created as well as the i2c code to verify # endian independent code is generated. The symbols required for linking @@ -54,7 +60,7 @@ iblInit: $(MODULES) utils ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b $(CP) ibl.b ibl_$(TARGET) ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b - ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl.i2c.$(IEXT).ccs + ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl_init.i2c.$(IEXT).ccs bash ../util/symExtract/symExtract ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init_symbols.inc $(COMMON_SYMBOLS) @@ -66,10 +72,6 @@ iblMain: iblInit $(MODULES) $(CP) ibl.b ibl_$(TARGET) ../util/btoccs/b2i2c ibl_$(TARGET)/ibl.b ibl_$(TARGET)/ibl.i2c.b ../util/btoccs/b2ccs ibl_$(TARGET)/ibl.i2c.b ibl_$(TARGET)/ibl.i2c.$(IEXT).ccs - ../util/romparse/romparse $(COMPACT) ibl_$(TARGET)/i2crom_$(IEXT).map - $(CP) i2crom.ccs ibl_$(TARGET)/i2crom_$(IEXT).ccs - $(CP) i2crom.ccs ibl_$(TARGET)/i2crom_$(IEXT).dat - $(RM) i2crom.ccs ibl_le.b ibl.b $(MODULES): diff --git a/src/util/romparse/Makefile b/src/util/romparse/Makefile index 6b74cb3..aa70f8f 100644 --- a/src/util/romparse/Makefile +++ b/src/util/romparse/Makefile @@ -3,7 +3,7 @@ all: gen_cdefdep romparse romparse: cdefdep rparse.tab.o lex.yy.o romparse.c - gcc -o romparse romparse.c rparse.tab.o lex.yy.o -I../.. -I. -D$(TARGET) + gcc -o romparse -g romparse.c rparse.tab.o lex.yy.o -I../.. -I. -D$(TARGET) rparse.tab.o: rparse.y diff --git a/src/util/romparse/romparse.c b/src/util/romparse/romparse.c index 87f7ee6..aa57ba8 100644 --- a/src/util/romparse/romparse.c +++ b/src/util/romparse/romparse.c @@ -10,6 +10,7 @@ *************************************************************************************/ #include #include +#include #include "rparse.tab.h" #include "romparse.h" @@ -26,6 +27,12 @@ *************************************************************************************/ extern FILE *yyin; +/************************************************************************************* + * Declaration: currentType identifies the current parse mode, either SECTION + * or LAYOUT. + *************************************************************************************/ +int currentType; + /************************************************************************************* * Declaration: The boot parameter tables. The current table is copied into position * when the section parse is complete. @@ -36,6 +43,12 @@ int current_file; /* Identifies the program file in the current int ctable_index = -1; /* Destination of current table */ int max_index = 0; /* maximum table index, used for compacting output */ +/************************************************************************************ + * Declaration: Layout tables. + ************************************************************************************/ +layout_t layouts[MAX_LAYOUTS]; /* Array of layout structures */ +int currentLayout = 0; /* Currently active layout */ + /************************************************************************************ * Declaration: The structure storing the program data files, and the number of * programs used. @@ -101,6 +114,7 @@ void initProgFile (void) for (i = 0; i < NUM_BOOT_PARAM_TABLES; i++) { progFile[i].sizeBytes = 0; + progFile[i].align = 0; for (j = 0; j < NUM_BOOT_PARAM_TABLES; j++) progFile[i].tag[j] = -1; @@ -109,6 +123,63 @@ void initProgFile (void) } + +/************************************************************************************* + * FUNCTION PURPOSE: Set the currently active parse type + ************************************************************************************* + * DESCRIPTION: Indicates if the subsequent parameters belong to a section or + * a layout + *************************************************************************************/ +void rBegin (int blockType) +{ + currentType = blockType; +} + +/************************************************************************************* + * FUNCTION PURPOSE: Initialize a layout structure + ************************************************************************************* + * DESCRIPTION: The layout is set to the initial state + *************************************************************************************/ +void initLayout (layout_t *cl) +{ + + cl->nFiles = 0; + cl->dev_addr = 0x50; + cl->address = 0; + cl->align = 0; + +} + +/************************************************************************************* + * FUNCTION PURPOSE: Complete a layout + ************************************************************************************* + * DESCRIPTION: The parser has found a complete layout specification. Complete + * a layout structure + *************************************************************************************/ +void setLayout (void) +{ + int i; + int currentAlign; + int newAlign; + + for (i = 0; i < layouts[currentLayout].nFiles; i++) { + currentAlign = progFile[layouts[currentLayout].file[i]].align; + newAlign = layouts[currentLayout].align; + + if (newAlign > currentAlign) + progFile[layouts[currentLayout].file[i]].align = newAlign; + + } + + currentLayout += 1; /* Advance to the next layout */ + + if (currentLayout < MAX_LAYOUTS) + initLayout (&layouts[currentLayout]); + +} + + + /************************************************************************************* * FUNCTION PURPOSE: Complete a section ************************************************************************************* @@ -182,9 +253,6 @@ int openProgFile (char *fname) exit (-1); } - /* Put the section at the next available i2c rom address */ - /* progFile[nProgFiles].addressBytes = romBase; */ - /* Read the one line ccs header. The length field in terms of lines */ fgets (iline, 132, str); sscanf (iline, "%x %x %x %x %x", &a, &b, &c, &d, &e); @@ -198,9 +266,6 @@ int openProgFile (char *fname) fclose (str); - /* Update the next free rom base */ - /* romBase = romBase + progFile[nProgFiles].sizeBytes; */ - i = nProgFiles; nProgFiles += 1; @@ -268,6 +333,14 @@ int setPciParams (char *fname) ***************************************************************************************/ void assignKeyVal (int field, int value) { + + if ((currentType == SECTION) && (currentLayout >= MAX_LAYOUTS)) { + fprintf (stderr, "romparse: Too many layout sections (max = %d\n", MAX_LAYOUTS); + return; + } + + + switch (field) { case BOOT_MODE: current_table.common.boot_mode = value; @@ -293,6 +366,7 @@ void assignKeyVal (int field, int value) case NEXT_DEV_ADDR: current_table.i2c.next_dev_addr = value; break; + case NEXT_DEV_ADDR_EXT: current_table.i2c.next_dev_addr_ext = value; break; @@ -305,10 +379,21 @@ void assignKeyVal (int field, int value) break; #endif - case DEV_ADDR_EXT: current_table.i2c.dev_addr_ext = value; + case DEV_ADDR_EXT: if (currentType == SECTION) + current_table.i2c.dev_addr_ext = value; + else + layouts[currentLayout].dev_addr = value; + + break; + + case DEV_ADDR: if (currentType == SECTION) + current_table.i2c.dev_addr = value; + else + layouts[currentLayout].address = value; + break; - case DEV_ADDR: current_table.i2c.dev_addr = value; + case ALIGN: layouts[currentLayout].align = value; break; @@ -337,11 +422,26 @@ void assignKeyStr (int value, char *y) for (i = 0; i < nProgFiles; i++) { if (!strcmp (z, progFile[i].fname)) { - /* Found a match - copy the address */ - current_file = i; - /* current_table.i2c.dev_addr = progFile[i].addressBytes & 0xffff; */ - if (current_table.i2c.dev_addr_ext == 0) - current_table.i2c.dev_addr_ext = 0x50; /* hard coded to i2c rom slave address */ + + /* Found a match */ + + if (currentType == SECTION) { + + current_file = i; + + if (current_table.i2c.dev_addr_ext == 0) + current_table.i2c.dev_addr_ext = 0x50; /* hard coded to i2c rom slave address */ + + } else { /* LAYOUT */ + + if (currentLayout < MAX_LAYOUTS) + layouts[currentLayout].file[layouts[currentLayout].nFiles++] = i; + else + fprintf (stderr, "romparse: Number of layout sections exceeded (max = %d)\n", MAX_LAYOUTS); + + } + + return; } @@ -350,14 +450,84 @@ void assignKeyStr (int value, char *y) /* Open and read the ccs file, set the ROM address */ i = openProgFile (z); if (i >= 0) { - /* current_table.i2c.dev_addr = progFile[i].addressBytes & 0xffff; */ - current_file = i; - if (current_table.i2c.dev_addr_ext == 0) - current_table.i2c.dev_addr_ext = 0x50; + + if (currentType == SECTION) { + + current_file = i; + if (current_table.i2c.dev_addr_ext == 0) + current_table.i2c.dev_addr_ext = 0x50; + + } else { /* LAYOUT */ + + if (currentLayout < MAX_LAYOUTS) + layouts[currentLayout].file[layouts[currentLayout].nFiles++] = i; + else + fprintf (stderr, "romparse: Number of layout sections exceeded (max = %d)\n", MAX_LAYOUTS); + + } + + } } /* assignKeyStr */ +/************************************************************************************ + * FUNCTION PURPOSE: Put a 32 bit value into the i2c image memory + ************************************************************************************ + * DESCRIPTION: The 32 bit value is placed in memory in big endian format. The + * new offset is returned (4 bytes more then the input offset) + ************************************************************************************/ +unsigned int imageWord (unsigned int base, unsigned char *image, unsigned int value) +{ + image[base+0] = (value >> 24) & 0xff; + image[base+1] = (value >> 16) & 0xff; + image[base+2] = (value >> 8) & 0xff; + image[base+3] = (value >> 0) & 0xff; + + return (base + 4); + +} + +/************************************************************************************ + * FUNCTION PURPOSE: Create a 32 bit value from the image array + ************************************************************************************ + * DESCRIPTION: A 32 bit word in big endian format is created + ************************************************************************************/ +unsigned int formWord (unsigned int p, unsigned char *image) +{ + unsigned int v; + + v = (image[p+0] << 24) | + (image[p+1] << 16) | + (image[p+2] << 8) | + (image[p+3] << 0) ; + + return (v); + +} + +/************************************************************************************ + * FUNCTION PURPOSE: Pad the image array + ************************************************************************************ + * DESCRIPTION: Byte (value 0) are added to the image to reach the desired address + * The desired address is returned. + ************************************************************************************/ +unsigned int imagePad (unsigned int base, unsigned char *image, unsigned int desired) +{ + int i; + + if (desired < base) { + fprintf (stderr, "romparse: Padd to %d requested, but current base (%d) is already past this point\n", + desired, base); + exit (-1); + } + + for (i = base; i < desired; i++) + image[i] = 0; + + return (desired); + +} /************************************************************************************ * FUNCTION PURPOSE: Opens and writes the output file @@ -369,9 +539,10 @@ void createOutput (void) FILE *str; int totalLenBytes; int i, j; - int nTables; + int nTables, len; unsigned int value, v1, v2; - unsigned int base; + unsigned int base, obase; + unsigned char *image; str = fopen ("i2crom.ccs", "w"); if (str == NULL) { @@ -391,8 +562,38 @@ void createOutput (void) if (pciSet) base = base + PCI_EEAI_PARAM_SIZE; + /* Layout tables */ + for (i = 0; i < currentLayout; i++) { + + /* Determine the size of the table. Four bytes for each file, plus the 4 byte header */ + v1 = (layouts[i].nFiles * 4) + 4; + + v2 = (layouts[i].dev_addr << 16) + layouts[i].address; + + if (v2 == 0) + base = base + v1; + + else { + + /* Mask out device address bits but extend past 64k */ + v2 = v2 & I2C_ADDR_MASK; + + if (base > v2) { + fprintf (stderr, "romparse: fatal error - layout block %d specified a start address of 0x%04x\n", i, layouts[i].address); + fprintf (stderr, " but this conflicts with the base mapping (ends at 0x%04x)\n", base); + exit (-1); + } + + base = layouts[i].address + v1; + + } + + } + for (i = 0; i < NUM_BOOT_PARAM_TABLES; i++) { + if (progFile[i].align > 0) + base = ((base + progFile[i].align - 1) / progFile[i].align) * progFile[i].align; progFile[i].addressBytes = base; base = base + progFile[i].sizeBytes; } @@ -405,20 +606,33 @@ void createOutput (void) boot_params[progFile[i].tag[j]].i2c.dev_addr = progFile[i].addressBytes; } } + + /* Round up the size to a multiple of 4 bytes to fit into a ccs data file */ + base = (base + 3) & ~3; + /* The total length of the i2c eeprom is now stored in base */ /* Write out the ccs header */ fprintf (str, "1651 1 10000 1 %x\n", base >> 2); + + /* Create the image in memory */ + image = malloc (base * sizeof (unsigned char)); + if (image == NULL) { + fprintf (stderr, "romparse: malloc failed creating the output image\n"); + exit (-1); + } + /* Write out the boot parameter tables. 0x80 bytes will be written out. * There are 16 bits in every parameter field, which is why the index * is from 0 to 0x40 */ + base = 0; for (i = 0; i < nTables; i++) { for (j = 0; j < (0x80 >> 1); j += 2) { v1 = boot_params[i].parameter[j]; v2 = boot_params[i].parameter[j+1]; value = (v1 << 16) | v2; - fprintf (str, "0x%08x\n", value); + base = imageWord (base, image, value); } } @@ -426,18 +640,48 @@ void createOutput (void) * written out */ if (pciSet) { for (i = 0; i < PCI_DATA_LEN_32bit; i++) { - fprintf (str, "0x%08x\n", pciFile.data[i]); + base = imageWord (base, image, pciFile.data[i]); } } + + + /* Layout sections */ + for (i = 0; i < currentLayout; i++) { + + v1 = (layouts[i].dev_addr << 16) + layouts[i].address; + + /* Mask out device address bits */ + v1 = v1 & I2C_ADDR_MASK; + if (v1 > 0) + base = imagePad (base, image, v1); + obase = base; + len = (layouts[i].nFiles * 4) + 4; + + /* Write out the block size and checksum */ + base = imageWord(base, image, len << 16); + + for (j = 0; j < layouts[i].nFiles; j++) + base = imageWord (base, image, progFile[layouts[i].file[j]].addressBytes); + + } /* Write out each of the program files */ - for (i = 0; i < nProgFiles; i++) + for (i = 0; i < nProgFiles; i++) { + + base = imagePad (base, image, progFile[i].addressBytes); + for (j = 0; j < progFile[i].sizeBytes >> 2; j++) - fprintf (str, "0x%08x\n", (progFile[i]).data[j]); + base = imageWord (base, image, (progFile[i]).data[j]); + } + + /* Write out the data file */ + for (i = 0; i < base; i += 4) + fprintf (str, "0x%08x\n", formWord (i, image)); + free (image); - /* Close the input file */ + /* Close the output file */ fclose (str); } /* createOutput */ @@ -516,6 +760,9 @@ int main (int argc, char *argv[]) /* Initialize the PCI param table */ initPciParams (); + /* Initialize the layout structures */ + currentLayout = 0; + initLayout (&layouts[currentLayout]); /* Parse the input parameters */ if (parseIt (argc, argv)) diff --git a/src/util/romparse/romparse.h b/src/util/romparse/romparse.h index 8c3fa95..2d4f912 100644 --- a/src/util/romparse/romparse.h +++ b/src/util/romparse/romparse.h @@ -36,9 +36,10 @@ typedef struct { char fname[MAX_FNAME_LEN]; int sizeBytes; - int addressBytes; + unsigned int addressBytes; unsigned int data[MAX_DATA_LEN_32bit]; int tag[NUM_BOOT_PARAM_TABLES]; /* identifies boot parameter tables which use this file */ + int align; /* alignment requirements for the file */ } progFile_t; /* Define the PCI parameter structure */ @@ -51,6 +52,23 @@ typedef struct { } pciFile_t; +/* Define a layout table. A layout table is a block of data which contains the addresses + * of data files. Each address is 32 bits, with the upper 16 bits specifying the i2c + * id, the lower address the byte address of the 1st block in the table */ +#define MAX_LAYOUTS 2 +#define MAX_LAYOUT_FILES 8 +typedef struct { + int nFiles; /* Number of files in file list*/ + int file[MAX_LAYOUT_FILES]; /* Index of each file in progFile array */ + + unsigned int address; /* I2c data address of the table */ + unsigned int dev_addr; /* I2c device address of the table */ + int align; +} layout_t; + +/* The i2c address masking is chosen to be 20 bits. This allows eproms to be stacked to use addresses + * from 0x50 - 0x5f */ +#define I2C_ADDR_MASK 0x0fffff #endif /* ROMPARSE_H */ diff --git a/src/util/romparse/rparse.flex b/src/util/romparse/rparse.flex index c84d535..33b2b35 100644 --- a/src/util/romparse/rparse.flex +++ b/src/util/romparse/rparse.flex @@ -8,22 +8,24 @@ "}" return (RBRACE); "=" return (EQU); -section { yylval = SECTION; return (SECTION); } -boot_mode { yylval = BOOT_MODE; return (BOOT_MODE); } -param_index { yylval = PARAM_INDEX; return (PARAM_INDEX); } -options { yylval = OPTIONS; return (OPTIONS); } -multi_i2c_id { yylval = MULTI_I2C_ID; return (MULTI_I2C_ID); } -my_i2c_id { yylval = MY_I2C_ID; return (MY_I2C_ID); } -core_freq_mhz { yylval = CORE_FREQ_MHZ; return (CORE_FREQ_MHZ); } -i2c_clk_freq_khz { yylval = I2C_CLK_FREQ_KHZ; return (I2C_CLK_FREQ_KHZ); } -exe_file { yylval = EXE_FILE; return (EXE_FILE); } -pci_parm { yylval = PCI_PARMS; return (PCI_PARMS); } -dev_addr_ext { yylval = DEV_ADDR_EXT; return (DEV_ADDR_EXT); } -dev_addr { yylval = DEV_ADDR; return (DEV_ADDR); } -next_dev_addr { yylval = NEXT_DEV_ADDR; return (NEXT_DEV_ADDR); } -next_dev_addr_ext { yylval = NEXT_DEV_ADDR_EXT; return (NEXT_DEV_ADDR_EXT); } -address_delay { yylval = ADDRESS_DELAY; return (ADDRESS_DELAY); } -sw_pll { yylval = SWPLL; return (SWPLL); } +section { yylval = SECTION; rBegin(SECTION); return (SECTION); } +layout { yylval = LAYOUT; rBegin(LAYOUT); return (LAYOUT); } +boot_mode { yylval = BOOT_MODE; return (BOOT_MODE); } +param_index { yylval = PARAM_INDEX; return (PARAM_INDEX); } +options { yylval = OPTIONS; return (OPTIONS); } +multi_i2c_id { yylval = MULTI_I2C_ID; return (MULTI_I2C_ID); } +my_i2c_id { yylval = MY_I2C_ID; return (MY_I2C_ID); } +core_freq_mhz { yylval = CORE_FREQ_MHZ; return (CORE_FREQ_MHZ); } +i2c_clk_freq_khz { yylval = I2C_CLK_FREQ_KHZ; return (I2C_CLK_FREQ_KHZ); } +exe_file { yylval = EXE_FILE; return (EXE_FILE); } +pci_parm { yylval = PCI_PARMS; return (PCI_PARMS); } +dev_addr_ext { yylval = DEV_ADDR_EXT; return (DEV_ADDR_EXT); } +dev_addr { yylval = DEV_ADDR; return (DEV_ADDR); } +next_dev_addr { yylval = NEXT_DEV_ADDR; return (NEXT_DEV_ADDR); } +next_dev_addr_ext { yylval = NEXT_DEV_ADDR_EXT; return (NEXT_DEV_ADDR_EXT); } +address_delay { yylval = ADDRESS_DELAY; return (ADDRESS_DELAY); } +sw_pll { yylval = SWPLL; return (SWPLL); } +align { yylval = ALIGN; return (ALIGN); } [0-9]+ { yylval = atoi(yytext); return (VALUE); } diff --git a/src/util/romparse/rparse.tab.c b/src/util/romparse/rparse.tab.c index 0d42fde..9f15351 100644 --- a/src/util/romparse/rparse.tab.c +++ b/src/util/romparse/rparse.tab.c @@ -26,6 +26,8 @@ #define SWPLL 276 #define DEV_ADDR_EXT 277 #define DEV_ADDR 278 +#define LAYOUT 279 +#define ALIGN 280 #line 2 "rparse.y" @@ -44,11 +46,11 @@ extern char *yytext; -#define YYFINAL 32 +#define YYFINAL 39 #define YYFLAG -32768 -#define YYNTBASE 24 +#define YYNTBASE 26 -#define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yytranslate[x] : 29) +#define YYTRANSLATE(x) ((unsigned)(x) <= 280 ? yytranslate[x] : 33) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -78,32 +80,33 @@ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, - 0, 2, 5, 10, 14, 16, 19, 23, 27, 29, - 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, - 51, 53 + 0, 2, 5, 7, 9, 14, 18, 23, 25, 28, + 32, 36, 38, 40, 42, 44, 46, 48, 50, 52, + 54, 56, 58, 60, 62, 64 }; -static const short yyrhs[] = { 25, - 0, 24, 25, 0, 5, 3, 26, 4, 0, 17, - 6, 8, 0, 27, 0, 26, 27, 0, 28, 6, - 7, 0, 28, 6, 8, 0, 9, 0, 10, 0, - 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, - 16, 0, 18, 0, 19, 0, 22, 0, 20, 0, - 21, 0, 23, 0 +static const short yyrhs[] = { 27, + 0, 26, 27, 0, 28, 0, 29, 0, 5, 3, + 30, 4, 0, 17, 6, 8, 0, 24, 3, 30, + 4, 0, 31, 0, 30, 31, 0, 32, 6, 7, + 0, 32, 6, 8, 0, 9, 0, 10, 0, 11, + 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, + 0, 18, 0, 19, 0, 22, 0, 20, 0, 21, + 0, 23, 0, 25, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 12, 13, 16, 18, 23, 24, 27, 29, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46 + 12, 13, 16, 17, 20, 22, 26, 31, 32, 35, + 37, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55 }; #endif @@ -114,64 +117,69 @@ static const char * const yytname[] = { "$","error","$undefined.","LBRACE", "RBRACE","SECTION","EQU","VALUE","STRING","BOOT_MODE","PARAM_INDEX","OPTIONS", "MULTI_I2C_ID","MY_I2C_ID","CORE_FREQ_MHZ","I2C_CLK_FREQ_KHZ","EXE_FILE","PCI_PARMS", "NEXT_DEV_ADDR","NEXT_DEV_ADDR_EXT","ADDRESS_DELAY","SWPLL","DEV_ADDR_EXT","DEV_ADDR", -"promspec","bootParams","assigns","assign","keyword", NULL +"LAYOUT","ALIGN","promspec","segment","bootParams","layout","assigns","assign", +"keyword", NULL }; #endif static const short yyr1[] = { 0, - 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28 + 26, 26, 27, 27, 28, 28, 29, 30, 30, 31, + 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32 }; static const short yyr2[] = { 0, - 1, 2, 4, 3, 1, 2, 3, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1 + 1, 2, 1, 1, 4, 3, 4, 1, 2, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1 }; static const short yydefact[] = { 0, - 0, 0, 0, 1, 0, 0, 2, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 20, 21, 19, - 22, 0, 5, 0, 4, 3, 6, 0, 7, 8, - 0, 0 + 0, 0, 0, 0, 1, 3, 4, 0, 0, 0, + 2, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 23, 24, 22, 25, 26, 0, 8, 0, 6, + 0, 5, 9, 0, 7, 10, 11, 0, 0 }; -static const short yydefgoto[] = { 3, - 4, 22, 23, 24 +static const short yydefgoto[] = { 4, + 5, 6, 7, 27, 28, 29 }; -static const short yypact[] = { 16, - 0, -2, 20,-32768, 29, 5,-32768,-32768,-32768,-32768, +static const short yypact[] = { -3, + -2, 4, 3, 0,-32768,-32768,-32768, 53, -4, 53, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, -4,-32768, 17,-32768,-32768,-32768, -6,-32768,-32768, - 22,-32768 +-32768,-32768,-32768,-32768,-32768,-32768, 16,-32768, 5,-32768, + 36,-32768,-32768, 1,-32768,-32768,-32768, 12,-32768 }; static const short yypgoto[] = {-32768, - 21,-32768, 4,-32768 + 9,-32768,-32768, 6, -24,-32768 }; -#define YYLAST 52 +#define YYLAST 78 -static const short yytable[] = { 26, - 29, 30, 5, 6, 8, 9, 10, 11, 12, 13, - 14, 15, 25, 16, 17, 18, 19, 20, 21, 31, - 1, 32, 28, 7, 1, 27, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 2, 8, 9, 10, - 11, 12, 13, 14, 15, 0, 16, 17, 18, 19, - 20, 21 +static const short yytable[] = { 38, + 8, 1, 33, 30, 1, 10, 33, 36, 37, 9, + 34, 39, 11, 2, 0, 31, 2, 0, 0, 32, + 3, 0, 0, 3, 12, 13, 14, 15, 16, 17, + 18, 19, 0, 20, 21, 22, 23, 24, 25, 35, + 26, 0, 0, 0, 12, 13, 14, 15, 16, 17, + 18, 19, 0, 20, 21, 22, 23, 24, 25, 0, + 26, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 20, 21, 22, 23, 24, 25, 0, 26 }; -static const short yycheck[] = { 4, - 7, 8, 3, 6, 9, 10, 11, 12, 13, 14, - 15, 16, 8, 18, 19, 20, 21, 22, 23, 0, - 5, 0, 6, 3, 5, 22, -1, -1, -1, -1, - -1, -1, 17, -1, -1, -1, 17, 9, 10, 11, - 12, 13, 14, 15, 16, -1, 18, 19, 20, 21, - 22, 23 +static const short yycheck[] = { 0, + 3, 5, 27, 8, 5, 3, 31, 7, 8, 6, + 6, 0, 4, 17, -1, 10, 17, -1, -1, 4, + 24, -1, -1, 24, 9, 10, 11, 12, 13, 14, + 15, 16, -1, 18, 19, 20, 21, 22, 23, 4, + 25, -1, -1, -1, 9, 10, 11, 12, 13, 14, + 15, 16, -1, 18, 19, 20, 21, 22, 23, -1, + 25, 9, 10, 11, 12, 13, 14, 15, 16, -1, + 18, 19, 20, 21, 22, 23, -1, 25 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "bison.simple" @@ -671,76 +679,84 @@ yyreduce: switch (yyn) { -case 3: -#line 17 "rparse.y" +case 5: +#line 21 "rparse.y" { section (); ; break;} -case 4: -#line 19 "rparse.y" +case 6: +#line 23 "rparse.y" { setPciParams (yytext); ; break;} case 7: -#line 28 "rparse.y" -{ assignKeyVal (yyvsp[-2], yyvsp[0]); ; - break;} -case 8: -#line 30 "rparse.y" -{ assignKeyStr (yyvsp[-2], yytext); ; - break;} -case 9: -#line 33 "rparse.y" -{ yyval=yyvsp[0]; ; +#line 27 "rparse.y" +{ setLayout (); ; break;} case 10: -#line 34 "rparse.y" -{ yyval=yyvsp[0]; ; +#line 36 "rparse.y" +{ assignKeyVal (yyvsp[-2], yyvsp[0]); ; break;} case 11: -#line 35 "rparse.y" -{ yyval=yyvsp[0]; ; +#line 38 "rparse.y" +{ assignKeyStr (yyvsp[-2], yytext); ; break;} case 12: -#line 36 "rparse.y" +#line 41 "rparse.y" { yyval=yyvsp[0]; ; break;} case 13: -#line 37 "rparse.y" +#line 42 "rparse.y" { yyval=yyvsp[0]; ; break;} case 14: -#line 38 "rparse.y" +#line 43 "rparse.y" { yyval=yyvsp[0]; ; break;} case 15: -#line 39 "rparse.y" +#line 44 "rparse.y" { yyval=yyvsp[0]; ; break;} case 16: -#line 40 "rparse.y" +#line 45 "rparse.y" { yyval=yyvsp[0]; ; break;} case 17: -#line 41 "rparse.y" +#line 46 "rparse.y" { yyval=yyvsp[0]; ; break;} case 18: -#line 42 "rparse.y" +#line 47 "rparse.y" { yyval=yyvsp[0]; ; break;} case 19: -#line 43 "rparse.y" +#line 48 "rparse.y" { yyval=yyvsp[0]; ; break;} case 20: -#line 44 "rparse.y" +#line 49 "rparse.y" { yyval=yyvsp[0]; ; break;} case 21: -#line 45 "rparse.y" +#line 50 "rparse.y" { yyval=yyvsp[0]; ; break;} case 22: -#line 46 "rparse.y" +#line 51 "rparse.y" +{ yyval=yyvsp[0]; ; + break;} +case 23: +#line 52 "rparse.y" +{ yyval=yyvsp[0]; ; + break;} +case 24: +#line 53 "rparse.y" +{ yyval=yyvsp[0]; ; + break;} +case 25: +#line 54 "rparse.y" +{ yyval=yyvsp[0]; ; + break;} +case 26: +#line 55 "rparse.y" { yyval=yyvsp[0]; ; break;} } @@ -941,7 +957,7 @@ yyerrhandle: yystate = yyn; goto yynewstate; } -#line 49 "rparse.y" +#line 58 "rparse.y" diff --git a/src/util/romparse/rparse.tab.h b/src/util/romparse/rparse.tab.h index 09c5a8e..563ab6c 100644 --- a/src/util/romparse/rparse.tab.h +++ b/src/util/romparse/rparse.tab.h @@ -22,6 +22,8 @@ #define SWPLL 276 #define DEV_ADDR_EXT 277 #define DEV_ADDR 278 +#define LAYOUT 279 +#define ALIGN 280 extern YYSTYPE yylval; diff --git a/src/util/romparse/rparse.y b/src/util/romparse/rparse.y index e3ebf07..288681d 100644 --- a/src/util/romparse/rparse.y +++ b/src/util/romparse/rparse.y @@ -6,19 +6,27 @@ extern char *yytext; %token LBRACE RBRACE SECTION EQU VALUE STRING BOOT_MODE PARAM_INDEX OPTIONS %token MULTI_I2C_ID MY_I2C_ID CORE_FREQ_MHZ I2C_CLK_FREQ_KHZ %token EXE_FILE PCI_PARMS NEXT_DEV_ADDR NEXT_DEV_ADDR_EXT ADDRESS_DELAY SWPLL -%token DEV_ADDR_EXT DEV_ADDR +%token DEV_ADDR_EXT DEV_ADDR LAYOUT ALIGN %% -promspec : bootParams - | promspec bootParams +promspec : segment + | promspec segment ; +segment : bootParams + | layout + ; + bootParams : SECTION LBRACE assigns RBRACE { section (); } | PCI_PARMS EQU STRING { setPciParams (yytext); } ; +layout : LAYOUT LBRACE assigns RBRACE + { setLayout (); } + ; + assigns : assign | assigns assign @@ -44,6 +52,7 @@ keyword : BOOT_MODE { $$=$1; } | ADDRESS_DELAY { $$=$1; } | SWPLL { $$=$1; } | DEV_ADDR { $$=$1; } + | ALIGN { $$=$1; } ; %% -- 2.39.2