From abc4a11a9a4de69d77d9f74d0026ca149c9583f6 Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Sat, 20 Nov 2004 21:20:40 +0000 Subject: [PATCH] added missing cpu and cpu_bus support git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1788 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/newconfig/config.g | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/util/newconfig/config.g b/util/newconfig/config.g index 2e7f4dc6bf..45d24ac2d5 100644 --- a/util/newconfig/config.g +++ b/util/newconfig/config.g @@ -939,6 +939,12 @@ class partobj: fatal("Invalid device") self.set_path(".type=DEVICE_PATH_APIC,.u={.apic={ .apic_id = 0x%x }}" % (apic_id)) + def addcpupath(self, cpu_id): + """ Add a relative path to a cpu device hanging off our parent """ + if ((cpu_id < 0) or (cpu_id > 255)): + fatal("Invalid device") + self.set_path(".type=DEVICE_PATH_CPU,.u={.cpu={ .id = 0x%x }}" % (cpu_id)) + def addpci_domainpath(self, pci_domain): """ Add a pci_domain number to a chip """ if ((pci_domain < 0) or (pci_domain > 0xffff)): @@ -951,6 +957,11 @@ class partobj: fatal("Invalid apic cluster: %d is out of the range 0 to ff" % cluster) self.set_path(".type=DEVICE_PATH_APIC_CLUSTER,.u={.apic_cluster={ .cluster = 0x%x }}" % (cluster)) + def addcpu_buspath(self, bus): + if ((bus < 0) or (bus > 15)): + fatal("Invalid cpu bus: %d is out of the range 0 to ff" % bus) + self.set_path(".type=DEVICE_PATH_CPU_BUS,.u={.cpu_bus={ .id = 0x%x }}" % (bus)) + def usesoption(self, name): """Declare option that can be used by this part""" global global_options @@ -1604,6 +1615,8 @@ parser Config: token I2C: 'i2c' token APIC: 'apic' token APIC_CLUSTER: 'apic_cluster' + token CPU: 'cpu' + token CPU_BUS: 'cpu_bus' token PCI_DOMAIN: 'pci_domain' @@ -1755,6 +1768,14 @@ parser Config: HEX_NUM {{ cluster = int(HEX_NUM, 16) }} {{ if (C): partstack.tos().addapic_clusterpath(cluster) }} + rule cpu<>: CPU {{ if (C): devicepart('cpu') }} + HEX_NUM {{ id = int(HEX_NUM, 16) }} + {{ if (C): partstack.tos().addcpupath(id) }} + + rule cpu_bus<>: CPU_BUS {{ if (C): devicepart('cpu_bus') }} + HEX_NUM {{ bus = int(HEX_NUM, 16) }} + {{ if (C): partstack.tos().addcpu_buspath(bus) }} + rule dev_path<>: pci<> {{ return pci }} | pci_domain<> {{ return pci_domain }} @@ -1762,6 +1783,8 @@ parser Config: | i2c<> {{ return i2c }} | apic<> {{ return apic }} | apic_cluster<> {{ return apic_cluster }} + | cpu<> {{ return cpu }} + | cpu_bus<> {{ return cpu_bus }} rule prtval: expr {{ return str(expr) }} | STR {{ return STR }}