summaryrefslogtreecommitdiff
path: root/util/inteltool/inteltool.c
diff options
context:
space:
mode:
authorFelix Singer <felix.singer@9elements.com>2019-10-25 00:16:22 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-10-28 12:00:46 +0000
commit19e353473dd09a43c922310eaf7868ce02842e77 (patch)
treee3c82c8fac202b752246a0676f71acbed17dae82 /util/inteltool/inteltool.c
parentbe9533aba957e9c43f77381f436906951c13c98b (diff)
inteltool: Add method 'print_system_info'
To get a better idea what this code does, this patch adds a new method called 'print_system_info'. Change-Id: I16f1c9cdc402b1a816fac65d1490432e39c07baf Signed-off-by: Felix Singer <felix.singer@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36315 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Michael Niewöhner Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/inteltool/inteltool.c')
-rw-r--r--util/inteltool/inteltool.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index db80bd26b1..830cdcdeaf 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -502,15 +502,55 @@ static void print_usage(const char *name)
exit(1);
}
+static void print_system_info(struct pci_dev *nb, struct pci_dev *sb, struct pci_dev *gfx)
+{
+ unsigned int id, i;
+ char *sbname = "unknown", *nbname = "unknown", *gfxname = "unknown";
+
+ id = cpuid(1);
+
+ /* Determine names */
+ for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++) {
+ if (nb->device_id == supported_chips_list[i].device_id)
+ nbname = supported_chips_list[i].name;
+ }
+ for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++) {
+ if (sb->device_id == supported_chips_list[i].device_id)
+ sbname = supported_chips_list[i].name;
+ }
+ if (gfx) {
+ for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
+ if (gfx->device_id == supported_chips_list[i].device_id)
+ gfxname = supported_chips_list[i].name;
+ }
+
+ /* Intel has suggested applications to display the family of a CPU as
+ * the sum of the "Family" and the "Extended Family" fields shown
+ * above, and the model as the sum of the "Model" and the 4-bit
+ * left-shifted "Extended Model" fields.
+ * http://download.intel.com/design/processor/applnots/24161832.pdf
+ */
+ printf("CPU: ID 0x%x, Processor Type 0x%x, Family 0x%x, Model 0x%x, Stepping 0x%x\n",
+ id, (id >> 12) & 0x3, ((id >> 8) & 0xf) + ((id >> 20) & 0xff),
+ ((id >> 12) & 0xf0) + ((id >> 4) & 0xf), (id & 0xf));
+
+ printf("Northbridge: %04x:%04x (%s)\n",
+ nb->vendor_id, nb->device_id, nbname);
+
+ printf("Southbridge: %04x:%04x (%s)\n",
+ sb->vendor_id, sb->device_id, sbname);
+
+ if (gfx)
+ printf("IGD: %04x:%04x (%s)\n",
+ gfx->vendor_id, gfx->device_id, gfxname);
+}
+
int main(int argc, char *argv[])
{
struct pci_access *pacc;
struct pci_dev *sb = NULL, *nb, *gfx = NULL, *ahci = NULL, *dev;
const char *dump_spd_file = NULL;
int opt, option_index = 0;
- unsigned int id, i;
-
- char *sbname = "unknown", *nbname = "unknown", *gfxname = "unknown";
int dump_gpios = 0, dump_mchbar = 0, dump_rcba = 0;
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
@@ -737,43 +777,9 @@ int main(int argc, char *argv[])
ahci = NULL;
}
- id = cpuid(1);
-
- /* Intel has suggested applications to display the family of a CPU as
- * the sum of the "Family" and the "Extended Family" fields shown
- * above, and the model as the sum of the "Model" and the 4-bit
- * left-shifted "Extended Model" fields.
- * http://download.intel.com/design/processor/applnots/24161832.pdf
- */
- printf("CPU: ID 0x%x, Processor Type 0x%x, Family 0x%x, Model 0x%x, Stepping 0x%x\n",
- id, (id >> 12) & 0x3, ((id >> 8) & 0xf) + ((id >> 20) & 0xff),
- ((id >> 12) & 0xf0) + ((id >> 4) & 0xf), (id & 0xf));
-
- /* Determine names */
- for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
- if (nb->device_id == supported_chips_list[i].device_id)
- nbname = supported_chips_list[i].name;
- for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
- if (sb->device_id == supported_chips_list[i].device_id)
- sbname = supported_chips_list[i].name;
- if (gfx) {
- for (i = 0; i < ARRAY_SIZE(supported_chips_list); i++)
- if (gfx->device_id == supported_chips_list[i].device_id)
- gfxname = supported_chips_list[i].name;
- }
-
- printf("Northbridge: %04x:%04x (%s)\n",
- nb->vendor_id, nb->device_id, nbname);
-
- printf("Southbridge: %04x:%04x (%s)\n",
- sb->vendor_id, sb->device_id, sbname);
-
- if (gfx)
- printf("IGD: %04x:%04x (%s)\n",
- gfx->vendor_id, gfx->device_id, gfxname);
+ print_system_info(nb, sb, gfx);
/* Now do the deed */
-
if (dump_gpios) {
print_gpios(sb, 1, show_gpio_diffs);
printf("\n\n");