[coreboot-gerrit] Change in coreboot[master]: devicetree: Add USB device type

Duncan Laurie (Code Review) gerrit at coreboot.org
Tue May 8 23:16:45 CEST 2018


Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/26169


Change subject: devicetree: Add USB device type
......................................................................

devicetree: Add USB device type

This commit adds support for describing USB ports in devicetree.cb.
It allows a USB port location to be described in the tree with
configuration information, and ACPI code to be generated that
provides this information to the OS.

A new scan_usb_bus() is added that will scan bridges for devices so
a tree of ports and hubs can be created.

The device address is computed with a 'port type' and a 'port id'
which is flexible for SOC to handle depending on their specific USB
setup and allows USB2 and USB3 ports to be described separately.

For example a board may have devices on two ports, one with a USB2
device and one with a USB3 device, both of which are connected to an
xHCI controller with a root hub:

     xHCI
       |
    RootHub
    |     |
USB2[0]  USB3[2]

device pci 14.0 on
  chip drivers/usb/acpi
    register "name" = ""Root Hub""
    device usb 0.0 on
      chip drivers/usb/acpi
        register "name" = ""USB 2.0 Port 0""
        device usb 2.0 on end
      end
      chip drivers/usb/acpi
        register "name" = ""USB 3.0 Port 2""
        device usb 3.2 on end
      end
    end
  end
end

Change-Id: I64e6eba503cdab49be393465b535e139a8c90ef4
Signed-off-by: Duncan Laurie <dlaurie at google.com>
---
M src/device/device_util.c
M src/device/root_device.c
M src/include/device/device.h
M src/include/device/path.h
M util/sconfig/lex.yy.c_shipped
M util/sconfig/main.c
M util/sconfig/sconfig.l
M util/sconfig/sconfig.tab.c_shipped
M util/sconfig/sconfig.tab.h_shipped
M util/sconfig/sconfig.y
10 files changed, 173 insertions(+), 126 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/26169/1

diff --git a/src/device/device_util.c b/src/device/device_util.c
index a64b63a..aad3b4b 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -256,6 +256,9 @@
 	case DEVICE_PATH_SPI:
 		ret |= dev->path.spi.cs;
 		break;
+	case DEVICE_PATH_USB:
+		ret |= dev->path.usb.port_type << 8 || dev->path.usb.port_id;
+		break;
 	case DEVICE_PATH_NONE:
 	case DEVICE_PATH_MMIO:  /* don't care */
 	default:
@@ -333,6 +336,10 @@
 			snprintf(buffer, sizeof (buffer), "SPI: %02x",
 				 dev->path.spi.cs);
 			break;
+		case DEVICE_PATH_USB:
+			snprintf(buffer, sizeof (buffer), "USB%u port %u",
+				 dev->path.usb.port_type, dev->path.usb.port_id);
+			break;
 		case DEVICE_PATH_MMIO:
 			snprintf(buffer, sizeof (buffer), "MMIO: %08x",
 				 dev->path.mmio.addr);
@@ -411,6 +418,10 @@
 	case DEVICE_PATH_SPI:
 		equal = (path1->spi.cs == path2->spi.cs);
 		break;
+	case DEVICE_PATH_USB:
+		equal = (path1->usb.port_type == path2->usb.port_type) &&
+			(path1->usb.port_id == path2->usb.port_id);
+		break;
 	case DEVICE_PATH_MMIO:
 		equal = (path1->mmio.addr == path2->mmio.addr);
 		break;
diff --git a/src/device/root_device.c b/src/device/root_device.c
index a19028d..b0b6712 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -72,6 +72,21 @@
 	printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
 }
 
+void scan_usb_bus(struct device *bus)
+{
+	struct bus *link;
+
+	printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
+
+	scan_static_bus(bus);
+
+	/* Scan bridges in case this device is a hub */
+	for (link = bus->link_list; link; link = link->next)
+		scan_bridges(link);
+
+	printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
+}
+
 void scan_generic_bus(struct device *bus)
 {
 	struct device *child;
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 744836d..f3afd60 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -27,6 +27,7 @@
 struct smbus_bus_operations;
 struct pnp_mode_ops;
 struct spi_bus_operations;
+struct usb_bus_operations;
 
 /* Chip operations */
 struct chip_operations {
@@ -276,6 +277,7 @@
 void scan_generic_bus(struct device *bus);
 void scan_static_bus(struct device *bus);
 void scan_lpc_bus(struct device *bus);
+void scan_usb_bus(struct device *bus);
 
 #endif /* !defined(__ROMCC__) */
 
diff --git a/src/include/device/path.h b/src/include/device/path.h
index eaa9cc7..067a507 100644
--- a/src/include/device/path.h
+++ b/src/include/device/path.h
@@ -15,6 +15,7 @@
 	DEVICE_PATH_IOAPIC,
 	DEVICE_PATH_GENERIC,
 	DEVICE_PATH_SPI,
+	DEVICE_PATH_USB,
 	DEVICE_PATH_MMIO,
 
 	/*
@@ -37,6 +38,7 @@
 		"DEVICE_PATH_IOAPIC",		\
 		"DEVICE_PATH_GENERIC",		\
 		"DEVICE_PATH_SPI",		\
+		"DEVICE_PATH_USB",		\
 		"DEVICE_PATH_MMIO",		\
 }
 
@@ -91,6 +93,11 @@
 	unsigned int subid;
 };
 
+struct usb_path {
+	unsigned int port_type;
+	unsigned int port_id;
+};
+
 struct mmio_path {
 	uintptr_t addr;
 };
@@ -109,6 +116,7 @@
 		struct cpu_bus_path	cpu_bus;
 		struct generic_path	generic;
 		struct spi_path		spi;
+		struct usb_path		usb;
 		struct mmio_path	mmio;
 	};
 };
diff --git a/util/sconfig/lex.yy.c_shipped b/util/sconfig/lex.yy.c_shipped
index cde6f9f..dbdd8e6 100644
--- a/util/sconfig/lex.yy.c_shipped
+++ b/util/sconfig/lex.yy.c_shipped
@@ -358,8 +358,8 @@
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 35
-#define YY_END_OF_BUFFER 36
+#define YY_NUM_RULES 36
+#define YY_END_OF_BUFFER 37
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -367,23 +367,23 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[136] =
+static yyconst flex_int16_t yy_accept[139] =
     {   0,
-        0,    0,   36,   34,    1,    3,   34,   34,   34,   29,
-       29,   27,   30,   34,   30,   30,   30,   34,   34,   34,
-       34,   34,   34,   34,   34,   34,    1,    3,   34,    0,
-       34,   34,    0,    2,   29,   30,   34,   34,   34,   34,
-       30,   34,   34,   34,   34,   34,   34,   22,   34,   34,
-       34,   34,    7,   34,   34,   34,   34,   34,   33,   33,
-       34,    0,   28,   34,   34,   15,   34,   34,   21,   26,
-       34,   12,   34,   34,   20,   34,   34,    8,    9,   11,
-       34,   19,   34,   34,    0,   31,    4,   34,   34,   34,
-       34,   34,   34,   34,   18,   34,   34,   32,   32,   34,
+        0,    0,   37,   35,    1,    3,   35,   35,   35,   30,
+       30,   28,   31,   35,   31,   31,   31,   35,   35,   35,
+       35,   35,   35,   35,   35,   35,   35,    1,    3,   35,
+        0,   35,   35,    0,    2,   30,   31,   35,   35,   35,
+       35,   31,   35,   35,   35,   35,   35,   35,   23,   35,
+       35,   35,   35,    7,   35,   35,   35,   35,   35,   35,
+       34,   34,   35,    0,   29,   35,   35,   15,   35,   35,
+       22,   27,   35,   12,   35,   35,   21,   35,   35,    8,
+        9,   11,   35,   19,   35,   20,   35,    0,   32,    4,
+       35,   35,   35,   35,   35,   35,   35,   18,   35,   35,
 
-       34,   34,   34,   34,   34,   13,   34,   34,   34,    5,
-       16,   34,   34,   10,   34,   34,   34,   17,   24,   34,
-       34,   34,   34,   34,    6,   34,   34,   34,   34,   34,
-       23,   34,   14,   25,    0
+       33,   33,   35,   35,   35,   35,   35,   35,   13,   35,
+       35,   35,    5,   16,   35,   35,   10,   35,   35,   35,
+       17,   25,   35,   35,   35,   35,   35,    6,   35,   35,
+       35,   35,   35,   24,   35,   14,   26,    0
     } ;
 
 static yyconst YY_CHAR yy_ec[256] =
@@ -426,106 +426,106 @@
         1,    1,    1,    1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_uint16_t yy_base[143] =
+static yyconst flex_uint16_t yy_base[146] =
     {   0,
-        0,    0,  205,    0,  202,  206,  200,   37,   41,   38,
-      165,    0,   44,  187,   54,   78,   60,  179,   45,  182,
-      171,   42,   47,  176,   41,    0,  194,  206,   77,  190,
-       87,   91,  191,  206,    0,   88,  104,  178,  167,  156,
-       93,  163,  158,  168,  159,  167,  161,  167,  152,  152,
-      156,  158,    0,  154,  148,  154,  151,  157,    0,  206,
-      101,  169,    0,  162,  142,  155,  145,  152,    0,    0,
-      147,    0,  146,  136,    0,  140,  135,    0,    0,    0,
-      138,    0,  129,  156,  155,    0,    0,  140,  139,  132,
-      124,  123,  129,  134,    0,  119,  113,    0,  206,  124,
+        0,    0,  207,    0,  204,  208,  202,   37,   41,   38,
+      167,    0,   44,  189,   54,   78,   60,  181,   45,  184,
+      173,   42,   47,  178,   41,  165,    0,  195,  208,   77,
+      191,   87,   91,  192,  208,    0,   88,  104,  179,  168,
+      157,   93,  164,  159,  169,  160,  168,  162,  168,  153,
+      153,  157,  159,    0,  155,  149,  155,  152,  158,  157,
+        0,  208,  101,  169,    0,  162,  142,  155,  145,  152,
+        0,    0,  147,    0,  146,  136,    0,  140,  135,    0,
+        0,    0,  138,    0,  129,    0,  156,  155,    0,    0,
+      140,  139,  132,  124,  123,  129,  134,    0,  119,  113,
 
-      128,  120,  122,  121,  126,    0,  110,  110,  107,    0,
-        0,  109,   93,  104,   98,   84,   84,    0,    0,   89,
-       77,   87,   71,   66,    0,   64,   62,   50,   47,   33,
-        0,   28,    0,    0,  206,   40,  129,  131,  133,  135,
-      137,  139
+        0,  208,  124,  128,  120,  122,  121,  126,    0,  110,
+      110,  107,    0,    0,  109,   93,  104,   98,   84,   84,
+        0,    0,   89,   77,   87,   71,   66,    0,   64,   62,
+       50,   47,   33,    0,   28,    0,    0,  208,   40,  129,
+      131,  133,  135,  137,  139
     } ;
 
-static yyconst flex_int16_t yy_def[143] =
+static yyconst flex_int16_t yy_def[146] =
     {   0,
-      135,    1,  135,  136,  135,  135,  136,  137,  138,  136,
-       10,  136,   10,  136,   10,   10,   10,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  135,  135,  137,  139,
-      140,  138,  141,  135,   10,   10,   10,  136,  136,  136,
-       10,  136,  136,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  136,  136,  136,  135,
-      140,  142,   37,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  135,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  136,  136,  135,  136,
+      138,    1,  138,  139,  138,  138,  139,  140,  141,  139,
+       10,  139,   10,  139,   10,   10,   10,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  138,  138,  140,
+      142,  143,  141,  144,  138,   10,   10,   10,  139,  139,
+      139,   10,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  138,  143,  145,   38,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  138,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
 
-      136,  136,  136,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,  136,  136,  136,  136,  136,  136,
-      136,  136,  136,  136,    0,  135,  135,  135,  135,  135,
-      135,  135
+      139,  138,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
+      139,  139,  139,  139,  139,  139,  139,    0,  138,  138,
+      138,  138,  138,  138,  138
     } ;
 
-static yyconst flex_uint16_t yy_nxt[245] =
+static yyconst flex_uint16_t yy_nxt[247] =
     {   0,
         4,    5,    6,    7,    8,    9,   10,   11,   10,   12,
        13,   13,   14,    4,    4,    4,   13,   13,   15,   16,
        17,   13,   18,    4,   19,   20,   21,    4,   22,   23,
-        4,   24,   25,    4,    4,    4,    4,    4,   30,   30,
-       26,   31,   33,   34,   35,   35,   35,  134,   36,   36,
-       36,   36,   36,   46,   36,   36,   36,   36,   36,   36,
-       36,   36,   36,   52,  133,   54,   36,   36,   36,   53,
-       57,  132,   47,   48,   55,   58,   49,   39,   30,   30,
-      131,   59,  130,   40,   36,   36,   36,   44,   62,   62,
-      129,   26,   33,   34,   36,   36,   36,  128,   41,   36,
+        4,   24,   25,    4,   26,    4,    4,    4,   31,   31,
+       27,   32,   34,   35,   36,   36,   36,  137,   37,   37,
+       37,   37,   37,   47,   37,   37,   37,   37,   37,   37,
+       37,   37,   37,   53,  136,   55,   37,   37,   37,   54,
+       58,  135,   48,   49,   56,   59,   50,   40,   31,   31,
+      134,   61,  133,   41,   37,   37,   37,   45,   64,   64,
+      132,   27,   34,   35,   37,   37,   37,  131,   42,   37,
 
-       36,   36,   62,   62,  127,   84,   42,  126,  125,   43,
-       63,   63,   63,  124,   63,   63,  123,  122,  121,  120,
-       63,   63,   63,   63,   63,   63,  119,  118,   67,   29,
-       29,   32,   32,   30,   30,   61,   61,   33,   33,   62,
-       62,  117,  116,  115,  114,  113,  112,  111,  110,  109,
-      108,  107,  106,  105,  104,  103,  102,  101,  100,   99,
-       98,   97,   96,   95,   94,   93,   92,   91,   90,   89,
-       88,   87,   86,   85,   83,   82,   81,   80,   79,   78,
-       77,   76,   75,   74,   73,   72,   71,   70,   69,   68,
-       66,   65,   64,   34,   60,   27,   56,   51,   50,   45,
+       37,   37,   64,   64,  130,   87,   43,  129,  128,   44,
+       65,   65,   65,  127,   65,   65,  126,  125,  124,  123,
+       65,   65,   65,   65,   65,   65,  122,  121,   69,   30,
+       30,   33,   33,   31,   31,   63,   63,   34,   34,   64,
+       64,  120,  119,  118,  117,  116,  115,  114,  113,  112,
+      111,  110,  109,  108,  107,  106,  105,  104,  103,  102,
+      101,  100,   99,   98,   97,   96,   95,   94,   93,   92,
+       91,   90,   89,   88,   86,   85,   84,   83,   82,   81,
+       80,   79,   78,   77,   76,   75,   74,   73,   72,   71,
+       70,   68,   67,   66,   35,   62,   28,   60,   57,   52,
 
-       38,   37,   28,   27,  135,    3,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135
+       51,   46,   39,   38,   29,   28,  138,    3,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138
     } ;
 
-static yyconst flex_int16_t yy_chk[245] =
+static yyconst flex_int16_t yy_chk[247] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    8,    8,
-      136,    8,    9,    9,   10,   10,   10,  132,   10,   10,
+      139,    8,    9,    9,   10,   10,   10,  135,   10,   10,
        13,   13,   13,   19,   10,   10,   10,   10,   10,   10,
-       15,   15,   15,   22,  130,   23,   17,   17,   17,   22,
-       25,  129,   19,   19,   23,   25,   19,   15,   29,   29,
-      128,   29,  127,   15,   16,   16,   16,   17,   31,   31,
-      126,   31,   32,   32,   36,   36,   36,  124,   16,   41,
+       15,   15,   15,   22,  133,   23,   17,   17,   17,   22,
+       25,  132,   19,   19,   23,   25,   19,   15,   30,   30,
+      131,   30,  130,   15,   16,   16,   16,   17,   32,   32,
+      129,   32,   33,   33,   37,   37,   37,  127,   16,   42,
 
-       41,   41,   61,   61,  123,   61,   16,  122,  121,   16,
-       37,   37,   37,  120,   37,   37,  117,  116,  115,  114,
-       37,   37,   37,   37,   37,   37,  113,  112,   41,  137,
-      137,  138,  138,  139,  139,  140,  140,  141,  141,  142,
-      142,  109,  108,  107,  105,  104,  103,  102,  101,  100,
-       97,   96,   94,   93,   92,   91,   90,   89,   88,   85,
-       84,   83,   81,   77,   76,   74,   73,   71,   68,   67,
-       66,   65,   64,   62,   58,   57,   56,   55,   54,   52,
-       51,   50,   49,   48,   47,   46,   45,   44,   43,   42,
-       40,   39,   38,   33,   30,   27,   24,   21,   20,   18,
+       42,   42,   63,   63,  126,   63,   16,  125,  124,   16,
+       38,   38,   38,  123,   38,   38,  120,  119,  118,  117,
+       38,   38,   38,   38,   38,   38,  116,  115,   42,  140,
+      140,  141,  141,  142,  142,  143,  143,  144,  144,  145,
+      145,  112,  111,  110,  108,  107,  106,  105,  104,  103,
+      100,   99,   97,   96,   95,   94,   93,   92,   91,   88,
+       87,   85,   83,   79,   78,   76,   75,   73,   70,   69,
+       68,   67,   66,   64,   60,   59,   58,   57,   56,   55,
+       53,   52,   51,   50,   49,   48,   47,   46,   45,   44,
+       43,   41,   40,   39,   34,   31,   28,   26,   24,   21,
 
-       14,   11,    7,    5,    3,  135,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135,  135,  135,  135,  135,  135,  135,
-      135,  135,  135,  135
+       20,   18,   14,   11,    7,    5,    3,  138,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+      138,  138,  138,  138,  138,  138
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -804,13 +804,13 @@
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 136 )
+				if ( yy_current_state >= 139 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 206 );
+		while ( yy_base[yy_current_state] != 208 );
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
@@ -914,39 +914,39 @@
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-{yylval.number=IRQ; return(RESOURCE);}
+{yylval.number=USB; return(BUS);}
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-{yylval.number=DRQ; return(RESOURCE);}
+{yylval.number=IRQ; return(RESOURCE);}
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-{yylval.number=IO; return(RESOURCE);}
+{yylval.number=DRQ; return(RESOURCE);}
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-{return(IOAPIC_IRQ);}
+{yylval.number=IO; return(RESOURCE);}
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-{return(INHERIT);}
+{return(IOAPIC_IRQ);}
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-{return(SUBSYSTEMID);}
+{return(INHERIT);}
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-{return(END);}
+{return(SUBSYSTEMID);}
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-{return(EQUALS);}
+{return(END);}
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
+{return(EQUALS);}
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
@@ -958,12 +958,11 @@
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
+{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(NUMBER);}
 	YY_BREAK
 case 32:
-/* rule 32 can match eol */
 YY_RULE_SETUP
-{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
+{yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(PCIINT);}
 	YY_BREAK
 case 33:
 /* rule 33 can match eol */
@@ -971,10 +970,15 @@
 {yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
 	YY_BREAK
 case 34:
+/* rule 34 can match eol */
+YY_RULE_SETUP
+{yylval.string = malloc(yyleng-1); strncpy(yylval.string, yytext+1, yyleng-2); yylval.string[yyleng-2]='\0'; return(STRING);}
+	YY_BREAK
+case 35:
 YY_RULE_SETUP
 {yylval.string = malloc(yyleng+1); strncpy(yylval.string, yytext, yyleng); yylval.string[yyleng]='\0'; return(STRING);}
 	YY_BREAK
-case 35:
+case 36:
 YY_RULE_SETUP
 ECHO;
 	YY_BREAK
@@ -1270,7 +1274,7 @@
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 136 )
+			if ( yy_current_state >= 139 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
@@ -1298,11 +1302,11 @@
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 136 )
+		if ( yy_current_state >= 139 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
-	yy_is_jam = (yy_current_state == 135);
+	yy_is_jam = (yy_current_state == 138);
 
 		return yy_is_jam ? 0 : yy_current_state;
 }
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 8f4d7d9..2e34d85 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -290,6 +290,10 @@
 		new_d->path = ".type=DEVICE_PATH_SPI,{.spi={ .cs = 0x%x }}";
 		break;
 
+	case USB:
+		new_d->path = ".type=DEVICE_PATH_USB,{.usb={ .port_type = %d, .port_id = %d }}";
+		break;
+
 	case MMIO:
 		new_d->path = ".type=DEVICE_PATH_MMIO,{.mmio={ .addr = 0x%x }}";
 		break;
diff --git a/util/sconfig/sconfig.l b/util/sconfig/sconfig.l
index 484843d..3af70f8 100755
--- a/util/sconfig/sconfig.l
+++ b/util/sconfig/sconfig.l
@@ -40,6 +40,7 @@
 generic		{yylval.number=GENERIC; return(BUS);}
 mmio		{yylval.number=MMIO; return(BUS);}
 spi		{yylval.number=SPI; return(BUS);}
+usb		{yylval.number=USB; return(BUS);}
 irq		{yylval.number=IRQ; return(RESOURCE);}
 drq		{yylval.number=DRQ; return(RESOURCE);}
 io		{yylval.number=IO; return(RESOURCE);}
diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped
index 4c8b8ff..1832f35 100644
--- a/util/sconfig/sconfig.tab.c_shipped
+++ b/util/sconfig/sconfig.tab.c_shipped
@@ -151,7 +151,8 @@
     PCIINT = 283,
     GENERIC = 284,
     SPI = 285,
-    MMIO = 286
+    USB = 286,
+    MMIO = 287
   };
 #endif
 
@@ -428,7 +429,7 @@
 #define YYLAST   39
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  32
+#define YYNTOKENS  33
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  13
 /* YYNRULES -- Number of rules.  */
@@ -439,7 +440,7 @@
 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
    by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   286
+#define YYMAXUTOK   287
 
 #define YYTRANSLATE(YYX)                                                \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -476,7 +477,7 @@
        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,    24,
-      25,    26,    27,    28,    29,    30,    31
+      25,    26,    27,    28,    29,    30,    31,    32
 };
 
 #if YYDEBUG
@@ -498,7 +499,7 @@
   "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", "MMIO", "$accept", "devtree", "$@1", "chipchildren",
+  "SPI", "USB", "MMIO", "$accept", "devtree", "$@1", "chipchildren",
   "devicechildren", "chip", "@2", "device", "@3", "resource", "registers",
   "subsystemid", "ioapic_irq", YY_NULLPTR
 };
@@ -512,7 +513,7 @@
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
-     285,   286
+     285,   286,   287
 };
 # endif
 
@@ -586,19 +587,19 @@
      symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    33,    34,     0,     3,    37,    12,    38,    35,     4,
-       5,     9,    37,    39,    42,     7,    12,    23,    10,     6,
-      12,    40,    36,     8,     9,    24,    26,    37,    39,    41,
-      43,    44,    23,    23,    23,    10,    23,    28,    23,    25,
+       0,    34,    35,     0,     3,    38,    12,    39,    36,     4,
+       5,     9,    38,    40,    43,     7,    12,    23,    10,     6,
+      12,    41,    37,     8,     9,    24,    26,    38,    40,    42,
+      44,    45,    23,    23,    23,    10,    23,    28,    23,    25,
       23
 };
 
   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    32,    34,    33,    35,    35,    35,    35,    36,    36,
-      36,    36,    36,    36,    38,    37,    40,    39,    41,    42,
-      43,    43,    44
+       0,    33,    35,    34,    36,    36,    36,    36,    37,    37,
+      37,    37,    37,    37,    39,    38,    41,    40,    42,    43,
+      44,    44,    45
 };
 
   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
diff --git a/util/sconfig/sconfig.tab.h_shipped b/util/sconfig/sconfig.tab.h_shipped
index 3670c08..89b936a 100644
--- a/util/sconfig/sconfig.tab.h_shipped
+++ b/util/sconfig/sconfig.tab.h_shipped
@@ -73,7 +73,8 @@
     PCIINT = 283,
     GENERIC = 284,
     SPI = 285,
-    MMIO = 286
+    USB = 286,
+    MMIO = 287
   };
 #endif
 
diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y
index 05fb751..5cecbba 100755
--- a/util/sconfig/sconfig.y
+++ b/util/sconfig/sconfig.y
@@ -29,7 +29,7 @@
 	int number;
 }
 
-%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 MMIO
+%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 USB MMIO
 %%
 devtree: { cur_parent = cur_bus = head; } chip { postprocess_devtree(); } ;
 

-- 
To view, visit https://review.coreboot.org/26169
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64e6eba503cdab49be393465b535e139a8c90ef4
Gerrit-Change-Number: 26169
Gerrit-PatchSet: 1
Gerrit-Owner: Duncan Laurie <dlaurie at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180508/9ec56a57/attachment-0001.html>


More information about the coreboot-gerrit mailing list