diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-10-14 02:23:49 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-10-20 18:44:53 -0400 |
commit | e34c0e2bb4046d574224de3752642177a45a067a (patch) | |
tree | e8633c91062115aeb5ff084fbefcfb05c7a6e0e5 /drivers/acpi | |
parent | 459572a7503bccb5435936488088c8db4f51d3ab (diff) |
ACPI / EC: Add detailed command/query debugging information.
Developers really don't need to translate EC commands in mind. This patch
adds detailed debugging information for the EC commands.
The address can be found in the follow-up sequential EC_DATA(W) accesses,
thus this patch also removes some of the redundant address information.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ec.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index b15a431301a0..fcf667c3961e 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -164,6 +164,27 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | |||
164 | outb(data, ec->data_addr); | 164 | outb(data, ec->data_addr); |
165 | } | 165 | } |
166 | 166 | ||
167 | #ifdef DEBUG | ||
168 | static const char *acpi_ec_cmd_string(u8 cmd) | ||
169 | { | ||
170 | switch (cmd) { | ||
171 | case 0x80: | ||
172 | return "RD_EC"; | ||
173 | case 0x81: | ||
174 | return "WR_EC"; | ||
175 | case 0x82: | ||
176 | return "BE_EC"; | ||
177 | case 0x83: | ||
178 | return "BD_EC"; | ||
179 | case 0x84: | ||
180 | return "QR_EC"; | ||
181 | } | ||
182 | return "UNKNOWN"; | ||
183 | } | ||
184 | #else | ||
185 | #define acpi_ec_cmd_string(cmd) "UNDEF" | ||
186 | #endif | ||
187 | |||
167 | static int ec_transaction_completed(struct acpi_ec *ec) | 188 | static int ec_transaction_completed(struct acpi_ec *ec) |
168 | { | 189 | { |
169 | unsigned long flags; | 190 | unsigned long flags; |
@@ -199,7 +220,8 @@ static bool advance_transaction(struct acpi_ec *ec) | |||
199 | if (t->rlen == t->ri) { | 220 | if (t->rlen == t->ri) { |
200 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | 221 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
201 | if (t->command == ACPI_EC_COMMAND_QUERY) | 222 | if (t->command == ACPI_EC_COMMAND_QUERY) |
202 | pr_debug("hardware QR_EC completion\n"); | 223 | pr_debug("***** Command(%s) hardware completion *****\n", |
224 | acpi_ec_cmd_string(t->command)); | ||
203 | wakeup = true; | 225 | wakeup = true; |
204 | } | 226 | } |
205 | } else | 227 | } else |
@@ -222,7 +244,8 @@ static bool advance_transaction(struct acpi_ec *ec) | |||
222 | t->flags |= ACPI_EC_COMMAND_POLL; | 244 | t->flags |= ACPI_EC_COMMAND_POLL; |
223 | t->rdata[t->ri++] = 0x00; | 245 | t->rdata[t->ri++] = 0x00; |
224 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | 246 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
225 | pr_debug("software QR_EC completion\n"); | 247 | pr_debug("***** Command(%s) software completion *****\n", |
248 | acpi_ec_cmd_string(t->command)); | ||
226 | wakeup = true; | 249 | wakeup = true; |
227 | } else if ((status & ACPI_EC_FLAG_IBF) == 0) { | 250 | } else if ((status & ACPI_EC_FLAG_IBF) == 0) { |
228 | acpi_ec_write_cmd(ec, t->command); | 251 | acpi_ec_write_cmd(ec, t->command); |
@@ -303,15 +326,16 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
303 | spin_lock_irqsave(&ec->lock, tmp); | 326 | spin_lock_irqsave(&ec->lock, tmp); |
304 | /* following two actions should be kept atomic */ | 327 | /* following two actions should be kept atomic */ |
305 | ec->curr = t; | 328 | ec->curr = t; |
306 | pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", | 329 | pr_debug("***** Command(%s) started *****\n", |
307 | t->command, t->wdata ? t->wdata[0] : 0); | 330 | acpi_ec_cmd_string(t->command)); |
308 | start_transaction(ec); | 331 | start_transaction(ec); |
309 | spin_unlock_irqrestore(&ec->lock, tmp); | 332 | spin_unlock_irqrestore(&ec->lock, tmp); |
310 | ret = ec_poll(ec); | 333 | ret = ec_poll(ec); |
311 | spin_lock_irqsave(&ec->lock, tmp); | 334 | spin_lock_irqsave(&ec->lock, tmp); |
312 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | 335 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) |
313 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 336 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
314 | pr_debug("transaction end\n"); | 337 | pr_debug("***** Command(%s) stopped *****\n", |
338 | acpi_ec_cmd_string(t->command)); | ||
315 | ec->curr = NULL; | 339 | ec->curr = NULL; |
316 | spin_unlock_irqrestore(&ec->lock, tmp); | 340 | spin_unlock_irqrestore(&ec->lock, tmp); |
317 | return ret; | 341 | return ret; |