From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, lersek@redhat.com,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 2/2] Silicon/SynQuacerI2cDxe: remove special runtime treatment of DEBUG()s
Date: Sat, 24 Feb 2018 14:25:15 +0000 [thread overview]
Message-ID: <20180224142515.461-2-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180224142515.461-1-ard.biesheuvel@linaro.org>
It is no longer necessary to inhibit DEBUG() calls at runtime, due to
the fact that we switched to a DebugLib implementation that takes care
of this. Since a platform could theoretically wire up DXE_RUNTIME_DRIVER
modules to a DebugLib/SerialPortLib implementation combo that does remap
the UART MMIO region for runtime and produces UEFI debug output on a UART
that is not owned by the OS, it is better not to handle this in the
driver directly.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c | 28 +++++++++-----------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
index 5e70f9d921c3..415e3f0804ed 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c
@@ -13,8 +13,6 @@
#include "SynQuacerI2cDxe.h"
-#define BOOTTIME_DEBUG(x) do { if (!EfiAtRuntime()) DEBUG (x); } while (0)
-
//
// We cannot use Stall () or timer events at runtime, so we need to busy-wait
// for the controller to signal the completion interrupts. This value was
@@ -168,27 +166,27 @@ SynQuacerI2cMasterStart (
MmioWrite8 (I2c->MmioBase + F_I2C_REG_DAR, SlaveAddress << 1);
}
- BOOTTIME_DEBUG ((DEBUG_INFO, "%a: slave:0x%02x\n", __FUNCTION__,
+ DEBUG ((DEBUG_INFO, "%a: slave:0x%02x\n", __FUNCTION__,
SlaveAddress));
Bsr = MmioRead8 (I2c->MmioBase + F_I2C_REG_BSR);
Bcr = MmioRead8 (I2c->MmioBase + F_I2C_REG_BCR);
if ((Bsr & F_I2C_BSR_BB) && !(Bcr & F_I2C_BCR_MSS)) {
- BOOTTIME_DEBUG ((DEBUG_INFO, "%a: bus is busy\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a: bus is busy\n", __FUNCTION__));
return EFI_ALREADY_STARTED;
}
if (Bsr & F_I2C_BSR_BB) { // Bus is busy
- BOOTTIME_DEBUG ((DEBUG_INFO, "%a: Continuous Start\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a: Continuous Start\n", __FUNCTION__));
MmioWrite8 (I2c->MmioBase + F_I2C_REG_BCR, Bcr | F_I2C_BCR_SCC);
} else {
if (Bcr & F_I2C_BCR_MSS) {
- BOOTTIME_DEBUG ((DEBUG_WARN,
+ DEBUG ((DEBUG_WARN,
"%a: is not in master mode\n", __FUNCTION__));
return EFI_DEVICE_ERROR;
}
- BOOTTIME_DEBUG ((DEBUG_INFO, "%a: Start Condition\n", __FUNCTION__));
+ DEBUG ((DEBUG_INFO, "%a: Start Condition\n", __FUNCTION__));
MmioWrite8 (I2c->MmioBase + F_I2C_REG_BCR,
Bcr | F_I2C_BCR_MSS | F_I2C_BCR_INTE | F_I2C_BCR_BEIE);
}
@@ -329,13 +327,13 @@ SynQuacerI2cStartRequest (
Status = WaitForInterrupt (I2c);
if (EFI_ERROR (Status)) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Timeout waiting for interrupt - %r\n",
+ DEBUG ((DEBUG_WARN, "%a: Timeout waiting for interrupt - %r\n",
__FUNCTION__, Status));
break;
}
if (MmioRead8 (I2c->MmioBase + F_I2C_REG_BSR) & F_I2C_BSR_LRB) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: No ack received\n", __FUNCTION__));
+ DEBUG ((DEBUG_WARN, "%a: No ack received\n", __FUNCTION__));
Status = EFI_DEVICE_ERROR;
break;
}
@@ -346,13 +344,13 @@ SynQuacerI2cStartRequest (
Bcr = MmioRead8 (I2c->MmioBase + F_I2C_REG_BCR);
if (Bcr & F_I2C_BCR_BER) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Bus error detected\n", __FUNCTION__));
+ DEBUG ((DEBUG_WARN, "%a: Bus error detected\n", __FUNCTION__));
Status = EFI_DEVICE_ERROR;
break;
}
if ((Bsr & F_I2C_BSR_AL) || !(Bcr & F_I2C_BCR_MSS)) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: Arbitration lost\n", __FUNCTION__));
+ DEBUG ((DEBUG_WARN, "%a: Arbitration lost\n", __FUNCTION__));
Status = EFI_DEVICE_ERROR;
break;
}
@@ -368,7 +366,7 @@ SynQuacerI2cStartRequest (
Status = WaitForInterrupt (I2c);
if (EFI_ERROR (Status)) {
- BOOTTIME_DEBUG ((DEBUG_WARN,
+ DEBUG ((DEBUG_WARN,
"%a: Timeout waiting for interrupt - %r\n", __FUNCTION__, Status));
break;
}
@@ -383,13 +381,13 @@ SynQuacerI2cStartRequest (
Status = WaitForInterrupt (I2c);
if (EFI_ERROR (Status)) {
- BOOTTIME_DEBUG ((DEBUG_WARN,
+ DEBUG ((DEBUG_WARN,
"%a: Timeout waiting for interrupt - %r\n", __FUNCTION__, Status));
break;
}
if (MmioRead8 (I2c->MmioBase + F_I2C_REG_BSR) & F_I2C_BSR_LRB) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: No ack received\n", __FUNCTION__));
+ DEBUG ((DEBUG_WARN, "%a: No ack received\n", __FUNCTION__));
Status = EFI_DEVICE_ERROR;
break;
}
@@ -486,7 +484,7 @@ SynQuacerI2cInit (
Dev->Resources[0].AddrLen,
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
if (EFI_ERROR (Status)) {
- BOOTTIME_DEBUG ((DEBUG_WARN, "%a: failed to add memory space - %r\n",
+ DEBUG ((DEBUG_WARN, "%a: failed to add memory space - %r\n",
__FUNCTION__, Status));
}
--
2.11.0
next prev parent reply other threads:[~2018-02-24 14:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-24 14:25 [PATCH edk2-platforms 1/2] Platform, Silicon: use DxeRuntimeDebugLibSerialPort for runtime DXE drivers Ard Biesheuvel
2018-02-24 14:25 ` Ard Biesheuvel [this message]
2018-02-26 14:50 ` Laszlo Ersek
2018-02-27 1:50 ` Guo Heyi
2018-02-27 9:23 ` Ard Biesheuvel
2018-02-27 10:43 ` Laszlo Ersek
2018-02-27 11:30 ` Guo Heyi
2018-02-27 15:59 ` Laszlo Ersek
2018-02-27 14:21 ` Ard Biesheuvel
2018-02-27 16:09 ` Laszlo Ersek
2018-02-27 16:10 ` Ard Biesheuvel
2018-02-27 17:33 ` Ard Biesheuvel
2018-02-27 17:47 ` Laszlo Ersek
2018-02-27 17:55 ` Ard Biesheuvel
2018-02-27 10:39 ` Leif Lindholm
2018-02-27 10:45 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180224142515.461-2-ard.biesheuvel@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox