[coreboot] [commit] r5650 - trunk/util/ectool
repository service
svn at coreboot.org
Tue Jun 29 23:13:20 CEST 2010
Author: stepan
Date: Tue Jun 29 23:13:20 2010
New Revision: 5650
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5650
Log:
Add support to extended EC series
Signed-off-by: Anton Kochkov <anton.kochkov at gmail.com>
Acked-by: Stefan Reinauer <stepan at coresystems.de>
Modified:
trunk/util/ectool/ec.c
trunk/util/ectool/ec.h
trunk/util/ectool/ectool.c
Modified: trunk/util/ectool/ec.c
==============================================================================
--- trunk/util/ectool/ec.c Tue Jun 29 23:02:32 2010 (r5649)
+++ trunk/util/ectool/ec.c Tue Jun 29 23:13:20 2010 (r5650)
@@ -38,7 +38,7 @@
debug(".");
}
if (!timeout) {
- printf("Timeout while sending command 0x%02x to EC!\n",
+ debug("Timeout while sending command 0x%02x to EC!\n",
command);
// return -1;
}
@@ -57,8 +57,8 @@
if ((timeout & 0xff) == 0)
debug(".");
}
- if (!timeout) {
- printf("Timeout while sending data 0x%02x to EC!\n", data);
+ if (timeout) {
+ debug("Timeout while sending data 0x%02x to EC!\n", data);
// return -1;
}
@@ -89,7 +89,7 @@
debug(".");
}
if (!timeout) {
- printf("\nTimeout while receiving data from EC!\n");
+ debug("\nTimeout while receiving data from EC!\n");
// return -1;
}
@@ -101,15 +101,37 @@
uint8_t ec_read(uint8_t addr)
{
- send_ec_command(0x80);
+ send_ec_command(RD_EC);
send_ec_data(addr);
return recv_ec_data();
}
+uint8_t ec_ext_read(uint16_t addr)
+{
+ send_ec_command(WR_EC);
+ send_ec_data(0x02);
+ send_ec_data(addr & 0xff);
+ send_ec_command(RX_EC);
+ send_ec_data(addr >> 8);
+
+ return recv_ec_data();
+}
+
+int ec_ext_write(uint16_t addr, uint8_t data)
+{
+ send_ec_command(WR_EC);
+ send_ec_data(0x02);
+ send_ec_data(addr & 0xff);
+ send_ec_command(WX_EC);
+ send_ec_data(addr >> 8);
+
+ return send_ec_data(data);
+}
+
int ec_write(uint8_t addr, uint8_t data)
{
- send_ec_command(0x81);
+ send_ec_command(WR_EC);
send_ec_data(addr);
return send_ec_data(data);
Modified: trunk/util/ectool/ec.h
==============================================================================
--- trunk/util/ectool/ec.h Tue Jun 29 23:02:32 2010 (r5649)
+++ trunk/util/ectool/ec.h Tue Jun 29 23:13:20 2010 (r5650)
@@ -22,8 +22,8 @@
#include <stdint.h>
-#define EC_DATA 0x62
-#define EC_SC 0x66
+#define EC_DATA 0x62
+#define EC_SC 0x66
/* EC_SC input */
#define EC_SMI_EVT (1 << 6) // 1: SMI event pending
@@ -40,12 +40,16 @@
#define BE_EC 0x82 // Burst Enable Embedded Controller
#define BD_EC 0x83 // Burst Disable Embedded Controller
#define QR_EC 0x84 // Query Embedded Controller
+#define RX_EC 0xf0 // Read Extended operation
+#define WX_EC 0xf1 // Write Extended operation
int send_ec_command(uint8_t command);
int send_ec_data(uint8_t data);
int send_ec_data_nowait(uint8_t data);
uint8_t recv_ec_data(void);
uint8_t ec_read(uint8_t addr);
-
+int ec_write(uint8_t addr, uint8_t data);
+uint8_t ec_ext_read(uint16_t addr);
+int ec_ext_write(uint16_t addr, uint8_t data);
uint8_t ec_idx_read(uint16_t addr);
#endif
Modified: trunk/util/ectool/ectool.c
==============================================================================
--- trunk/util/ectool/ectool.c Tue Jun 29 23:02:32 2010 (r5649)
+++ trunk/util/ectool/ectool.c Tue Jun 29 23:13:20 2010 (r5650)
@@ -45,16 +45,17 @@
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 @@
{"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,8 @@
case 'V':
verbose = 1;
break;
+ case 'i':
+ dump_idx = 1;
case 'h':
case '?':
default:
@@ -99,14 +103,17 @@
}
printf("\n\n");
- 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));
+ 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");
}
- printf("\n\n");
-
return 0;
}
More information about the coreboot
mailing list