Force coreboot mconf to create temp files in the output directory
[coreboot.git] / util / ectool / ectool.c
index 91d42fe02d531a9d06268e09161ef6020249e8ae..ab7728238f3d3d2c52346e5feb3a219e067c2ccd 100644 (file)
@@ -45,16 +45,17 @@ void print_version(void)
 
 void print_usage(const char *name)
 {
-       printf("usage: %s [-vh?V]\n", name);
+       printf("usage: %s [-vh?Vi]\n", name);
        printf("\n"
               "   -v | --version:                   print the version\n"
               "   -h | --help:                      print this help\n\n"
               "   -V | --verbose:                   print debug information\n"
+              "   -i | --idx:                       print IDX RAM\n"
               "\n");
        exit(1);
 }
 
-int verbose = 0;
+int verbose = 0, dump_idx = 0;
 
 int main(int argc, char *argv[])
 {
@@ -64,10 +65,11 @@ int main(int argc, char *argv[])
                {"version", 0, 0, 'v'},
                {"help", 0, 0, 'h'},
                {"verbose", 0, 0, 'V'},
+               {"idx", 0, 0, 'i'},
                {0, 0, 0, 0}
        };
 
-       while ((opt = getopt_long(argc, argv, "vh?V",
+       while ((opt = getopt_long(argc, argv, "vh?Vi",
                                  long_options, &option_index)) != EOF) {
                switch (opt) {
                case 'v':
@@ -77,6 +79,9 @@ int main(int argc, char *argv[])
                case 'V':
                        verbose = 1;
                        break;
+               case 'i':
+                       dump_idx = 1;
+                       break;
                case 'h':
                case '?':
                default:
@@ -99,5 +104,17 @@ int main(int argc, char *argv[])
        }
        printf("\n\n");
 
+       if (dump_idx) {
+               printf("EC IDX RAM:\n");
+               for (i = 0; i < 0x10000; i++) {
+                       if ((i % 0x10) == 0)
+                               printf("\n%04x: ", i);
+                       printf("%02x ", ec_idx_read(i));
+               }
+               printf("\n\n");
+       } else {
+               printf("Not dumping EC IDX RAM.\n");
+       }
+
        return 0;
 }