[coreboot-gerrit] Change in coreboot[master]: WIP, DONOTMERGE: Add inteltool support to dump GPIOs
Angel Pons (Code Review)
gerrit at coreboot.org
Mon Nov 5 00:23:37 CET 2018
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/29459
Change subject: WIP, DONOTMERGE: Add inteltool support to dump GPIOs
......................................................................
WIP, DONOTMERGE: Add inteltool support to dump GPIOs
Change-Id: I2b0d49a175e656ef88d66c559239cac17e51b880
Signed-off-by: Angel Pons <th3fanbus at gmail.com>
---
M util/inteltool/gpio.c
M util/inteltool/inteltool.c
M util/inteltool/inteltool.h
3 files changed, 34 insertions(+), 12 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/29459/1
diff --git a/util/inteltool/gpio.c b/util/inteltool/gpio.c
index b4225a7..d50d8ca 100644
--- a/util/inteltool/gpio.c
+++ b/util/inteltool/gpio.c
@@ -836,7 +836,7 @@
}
}
-int print_gpios(struct pci_dev *sb, int show_all, int show_diffs)
+int print_gpios(struct pci_dev *sb, int show_all, int show_diffs, int gen_gpio)
{
int i, j, size, defaults_size = 0;
const io_register_t *gpio_registers;
@@ -1039,15 +1039,35 @@
return 1;
}
- if (show_diffs && !show_all)
+ printf("\nALL: %d, DIFF: %d, GEN: %d\n", show_all, show_diffs, gen_gpio);
+
+ if (gen_gpio) {
+ printf("/*\n"
+ " * This file is part of the coreboot project.\n"
+ " *\n"
+ " * This program is free software; you can redistribute it and/or modify\n"
+ " * it under the terms of the GNU General Public License as published by\n"
+ " * the Free Software Foundation; version 2 of the License.\n"
+ " *\n"
+ " * This program is distributed in the hope that it will be useful,\n"
+ " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ " * GNU General Public License for more details.\n"
+ " */\n"
+ "\n"
+ "#include <southbridge/intel/common/gpio.h>\n"
+ "\n"
+ );
+ } else if (show_diffs && !show_all)
printf("\n========== GPIO DIFFS ===========\n\n");
- else
- printf("\n============= GPIOS =============\n\n");
+ else printf("\n============= GPIOS =============\n\n");
printf("GPIOBASE = 0x%04x (IO)\n\n", gpiobase);
j = 0;
for (i = 0; i < size; i++) {
+ if (gen_gpio)
+ printf ("%08x\n", inw(gpiobase+(&gpio_registers[i])->addr));
if (show_all)
print_reg(&gpio_registers[i]);
diff --git a/util/inteltool/inteltool.c b/util/inteltool/inteltool.c
index d0b4279..814b88c 100644
--- a/util/inteltool/inteltool.c
+++ b/util/inteltool/inteltool.c
@@ -380,6 +380,7 @@
" -R | --ahci: dump AHCI registers\n"
" -g | --gpio: dump southbridge GPIO registers\n"
" -G | --gpio-diffs: show GPIO differences from defaults\n"
+ " -C | --gen-gpio: generate a gpio.c file for coreboot\n"
" -r | --rcba: dump southbridge RCBA registers\n"
" -p | --pmbase: dump southbridge Power Management registers\n\n"
" -m | --mchbar: dump northbridge Memory Controller registers\n"
@@ -411,7 +412,7 @@
int dump_pmbase = 0, dump_epbar = 0, dump_dmibar = 0;
int dump_pciexbar = 0, dump_coremsrs = 0, dump_ambs = 0;
int dump_spi = 0, dump_gfx = 0, dump_ahci = 0, dump_sgx = 0;
- int show_gpio_diffs = 0;
+ int show_gpio_diffs = 0, gen_gpio = 0;
size_t pcr_count = 0;
uint8_t dump_pcr[MAX_PCR_PORTS];
@@ -420,6 +421,7 @@
{"help", 0, 0, 'h'},
{"gpios", 0, 0, 'g'},
{"gpio-diffs", 0, 0, 'G'},
+ {"gen-gpio", 0, 0, 'C'},
{"mchbar", 0, 0, 'm'},
{"rcba", 0, 0, 'r'},
{"pmbase", 0, 0, 'p'},
@@ -438,7 +440,7 @@
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "vh?gGrpmedPMaAsfRS:x",
+ while ((opt = getopt_long(argc, argv, "vh?gGCrpmedPMaAsfRS:x",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
@@ -461,6 +463,9 @@
case 'G':
show_gpio_diffs = 1;
break;
+ case 'C':
+ gen_gpio = 1;
+ break;
case 'm':
dump_mchbar = 1;
break;
@@ -669,11 +674,8 @@
/* Now do the deed */
- if (dump_gpios) {
- print_gpios(sb, 1, show_gpio_diffs);
- printf("\n\n");
- } else if (show_gpio_diffs) {
- print_gpios(sb, 0, show_gpio_diffs);
+ if (dump_gpios || show_gpio_diffs || gen_gpio) {
+ print_gpios(sb, dump_gpios, show_gpio_diffs, gen_gpio);
printf("\n\n");
}
diff --git a/util/inteltool/inteltool.h b/util/inteltool/inteltool.h
index 5de73aa..fa13fec 100644
--- a/util/inteltool/inteltool.h
+++ b/util/inteltool/inteltool.h
@@ -318,7 +318,7 @@
int print_mchbar(struct pci_dev *nb, struct pci_access *pacc, const char *dump_spd_file);
int print_pmbase(struct pci_dev *sb, struct pci_access *pacc);
int print_rcba(struct pci_dev *sb);
-int print_gpios(struct pci_dev *sb, int show_all, int show_diffs);
+int print_gpios(struct pci_dev *sb, int show_all, int show_diffs, int gen_gpio);
void print_gpio_groups(struct pci_dev *sb);
int print_epbar(struct pci_dev *nb);
int print_dmibar(struct pci_dev *nb);
--
To view, visit https://review.coreboot.org/29459
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: I2b0d49a175e656ef88d66c559239cac17e51b880
Gerrit-Change-Number: 29459
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181104/e43acfba/attachment.html>
More information about the coreboot-gerrit
mailing list