aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-11-16 13:07:31 +0000
committerMichael Brown <mcb30@ipxe.org>2020-11-16 14:58:57 +0000
commit810dc5d6c33b71ceec3f00f48e64ff337389ed2e (patch)
treeb03a4ec6e69c825b96eb2465080453fa490b1ee7
parentfc5cf18dab3ab88aff00e6ed2915a5e960eeb085 (diff)
downloadipxe-810dc5d6c33b71ceec3f00f48e64ff337389ed2e.zip
ipxe-810dc5d6c33b71ceec3f00f48e64ff337389ed2e.tar.gz
ipxe-810dc5d6c33b71ceec3f00f48e64ff337389ed2e.tar.bz2
[realtek] Use physical addresses in debug messages
Physical addresses in debug messages are more meaningful from an end-user perspective than potentially IOMMU-mapped I/O virtual addresses, and have the advantage of being calculable without access to the original DMA mapping entry (e.g. when displaying an address for a single failed completion within a descriptor ring). Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/drivers/net/realtek.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/drivers/net/realtek.c b/src/drivers/net/realtek.c
index afca089..0f3038d 100644
--- a/src/drivers/net/realtek.c
+++ b/src/drivers/net/realtek.c
@@ -507,7 +507,6 @@ static void realtek_check_link ( struct net_device *netdev ) {
*/
static int realtek_create_buffer ( struct realtek_nic *rtl ) {
size_t len = ( RTL_RXBUF_LEN + RTL_RXBUF_PAD );
- physaddr_t address;
/* Do nothing unless in legacy mode */
if ( ! rtl->legacy )
@@ -518,14 +517,13 @@ static int realtek_create_buffer ( struct realtek_nic *rtl ) {
&rtl->rxbuf.map );
if ( ! rtl->rxbuf.data )
return -ENOMEM;
- address = rtl->rxbuf.map.addr;
/* Program buffer address */
- writel ( address, rtl->regs + RTL_RBSTART );
- DBGC ( rtl, "REALTEK %p receive buffer is at [%08llx,%08llx,%08llx)\n",
- rtl, ( ( unsigned long long ) address ),
- ( ( unsigned long long ) address + RTL_RXBUF_LEN ),
- ( ( unsigned long long ) address + len ) );
+ writel ( rtl->rxbuf.map.addr, rtl->regs + RTL_RBSTART );
+ DBGC ( rtl, "REALTEK %p receive buffer is at [%08lx,%08lx,%08lx)\n",
+ rtl, virt_to_phys ( rtl->rxbuf.data ),
+ ( virt_to_phys ( rtl->rxbuf.data ) + RTL_RXBUF_LEN ),
+ ( virt_to_phys ( rtl->rxbuf.data ) + len ) );
return 0;
}
@@ -580,9 +578,9 @@ static int realtek_create_ring ( struct realtek_nic *rtl,
writel ( ( ( ( uint64_t ) address ) >> 32 ),
rtl->regs + ring->reg + 4 );
writel ( ( address & 0xffffffffUL ), rtl->regs + ring->reg );
- DBGC ( rtl, "REALTEK %p ring %02x is at [%08llx,%08llx)\n",
- rtl, ring->reg, ( ( unsigned long long ) address ),
- ( ( unsigned long long ) address + ring->len ) );
+ DBGC ( rtl, "REALTEK %p ring %02x is at [%08lx,%08lx)\n",
+ rtl, ring->reg, virt_to_phys ( ring->desc ),
+ ( virt_to_phys ( ring->desc ) + ring->len ) );
return 0;
}
@@ -657,9 +655,9 @@ static void realtek_refill_rx ( struct realtek_nic *rtl ) {
( is_last ? cpu_to_le16 ( RTL_DESC_EOR ) : 0 ) );
wmb();
- DBGC2 ( rtl, "REALTEK %p RX %d is [%llx,%llx)\n", rtl, rx_idx,
- ( ( unsigned long long ) map->addr ),
- ( ( unsigned long long ) map->addr + RTL_RX_MAX_LEN ) );
+ DBGC2 ( rtl, "REALTEK %p RX %d is [%lx,%lx)\n",
+ rtl, rx_idx, virt_to_phys ( iobuf->data ),
+ ( virt_to_phys ( iobuf->data ) + RTL_RX_MAX_LEN ) );
}
}
@@ -829,9 +827,9 @@ static int realtek_transmit ( struct net_device *netdev,
writeb ( RTL_TPPOLL_NPQ, rtl->regs + rtl->tppoll );
}
- DBGC2 ( rtl, "REALTEK %p TX %d is [%llx,%llx)\n", rtl, tx_idx,
- ( ( unsigned long long ) address ),
- ( ( ( unsigned long long ) address ) + iob_len ( iobuf ) ) );
+ DBGC2 ( rtl, "REALTEK %p TX %d is [%lx,%lx)\n",
+ rtl, tx_idx, virt_to_phys ( iobuf->data ),
+ virt_to_phys ( iobuf->data ) + iob_len ( iobuf ) );
return 0;
}