]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Use physical addresses in debug messages
authorMichael Brown <mcb30@ipxe.org>
Mon, 16 Nov 2020 13:07:31 +0000 (13:07 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 16 Nov 2020 14:58:57 +0000 (14:58 +0000)
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>
src/drivers/net/realtek.c

index afca089ad6d16d22dac43fb19b675e6d92e24216..0f3038d364231638e82d7ef6953aefc5a017a0f1 100644 (file)
@@ -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;
 }