Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Remove htolexx calls, as bnx(4) NICs are capable...
details: https://anonhg.NetBSD.org/src/rev/de9476df1634
branches: trunk
changeset: 759447:de9476df1634
user: jym <jym%NetBSD.org@localhost>
date: Thu Dec 09 23:14:06 2010 +0000
description:
Remove htolexx calls, as bnx(4) NICs are capable of swapping endianess.
The macros for PAGE_SIZE were fixed with the previous patch (if_bnxreg.h
splitting, rev 1.11).
>From OpenBSD. Their commit log reads:
bnx(4) is a bit special. The chip itself is capable of swapping endianess
so there is no need for htoleXX calls. The only thing needed is the correct
layout of the DMA-ed structures. Additionally it uses PAGE_SIZE but assumed
that it is always 4k. Fix the macros that failed to respect that so that it
works on 8k PAGE_SIZE systems. This makes bnx(4) work on sparc64.
diffstat:
sys/dev/pci/if_bnx.c | 52 ++++++++++++++++++++++++++--------------------------
1 files changed, 26 insertions(+), 26 deletions(-)
diffs (117 lines):
diff -r 3d0337a2568b -r de9476df1634 sys/dev/pci/if_bnx.c
--- a/sys/dev/pci/if_bnx.c Thu Dec 09 22:52:59 2010 +0000
+++ b/sys/dev/pci/if_bnx.c Thu Dec 09 23:14:06 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bnx.c,v 1.36 2010/12/09 22:34:37 jym Exp $ */
+/* $NetBSD: if_bnx.c,v 1.37 2010/12/09 23:14:06 jym Exp $ */
/* $OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
/*-
@@ -35,7 +35,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.36 2010/12/09 22:34:37 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.37 2010/12/09 23:14:06 jym Exp $");
/*
* The following controllers are supported by this driver:
@@ -3609,12 +3609,12 @@
*/
rxbd = &sc->rx_bd_chain[RX_PAGE(*chain_prod)][RX_IDX(*chain_prod)];
- addr = (u_int32_t)(map->dm_segs[0].ds_addr);
- rxbd->rx_bd_haddr_lo = htole32(addr);
+ addr = (u_int32_t)map->dm_segs[0].ds_addr;
+ rxbd->rx_bd_haddr_lo = addr;
addr = (u_int32_t)((u_int64_t)map->dm_segs[0].ds_addr >> 32);
- rxbd->rx_bd_haddr_hi = htole32(addr);
- rxbd->rx_bd_len = htole32(map->dm_segs[0].ds_len);
- rxbd->rx_bd_flags = htole32(RX_BD_FLAGS_START);
+ rxbd->rx_bd_haddr_hi = addr;
+ rxbd->rx_bd_len = map->dm_segs[0].ds_len;
+ rxbd->rx_bd_flags = RX_BD_FLAGS_START;
*prod_bseq += map->dm_segs[0].ds_len;
bus_dmamap_sync(sc->bnx_dmatag,
sc->rx_bd_chain_map[RX_PAGE(*chain_prod)],
@@ -3628,11 +3628,11 @@
rxbd =
&sc->rx_bd_chain[RX_PAGE(*chain_prod)][RX_IDX(*chain_prod)];
- addr = (u_int32_t)(map->dm_segs[i].ds_addr);
- rxbd->rx_bd_haddr_lo = htole32(addr);
+ addr = (u_int32_t)map->dm_segs[i].ds_addr;
+ rxbd->rx_bd_haddr_lo = addr;
addr = (u_int32_t)((u_int64_t)map->dm_segs[i].ds_addr >> 32);
- rxbd->rx_bd_haddr_hi = htole32(addr);
- rxbd->rx_bd_len = htole32(map->dm_segs[i].ds_len);
+ rxbd->rx_bd_haddr_hi = addr;
+ rxbd->rx_bd_len = map->dm_segs[i].ds_len;
rxbd->rx_bd_flags = 0;
*prod_bseq += map->dm_segs[i].ds_len;
bus_dmamap_sync(sc->bnx_dmatag,
@@ -3641,7 +3641,7 @@
sizeof(struct rx_bd), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
}
- rxbd->rx_bd_flags |= htole32(RX_BD_FLAGS_END);
+ rxbd->rx_bd_flags |= RX_BD_FLAGS_END;
bus_dmamap_sync(sc->bnx_dmatag,
sc->rx_bd_chain_map[RX_PAGE(*chain_prod)],
sizeof(struct rx_bd) * RX_IDX(*chain_prod),
@@ -3896,10 +3896,10 @@
else
j = i + 1;
- addr = (u_int32_t)(sc->tx_bd_chain_paddr[j]);
- txbd->tx_bd_haddr_lo = htole32(addr);
+ addr = (u_int32_t)sc->tx_bd_chain_paddr[j];
+ txbd->tx_bd_haddr_lo = addr;
addr = (u_int32_t)((u_int64_t)sc->tx_bd_chain_paddr[j] >> 32);
- txbd->tx_bd_haddr_hi = htole32(addr);
+ txbd->tx_bd_haddr_hi = addr;
bus_dmamap_sync(sc->bnx_dmatag, sc->tx_bd_chain_map[i], 0,
BNX_TX_CHAIN_PAGE_SZ, BUS_DMASYNC_PREWRITE);
}
@@ -4064,9 +4064,9 @@
/* Setup the chain page pointers. */
addr = (u_int32_t)((u_int64_t)sc->rx_bd_chain_paddr[j] >> 32);
- rxbd->rx_bd_haddr_hi = htole32(addr);
- addr = (u_int32_t)(sc->rx_bd_chain_paddr[j]);
- rxbd->rx_bd_haddr_lo = htole32(addr);
+ rxbd->rx_bd_haddr_hi = addr;
+ addr = (u_int32_t)sc->rx_bd_chain_paddr[j];
+ rxbd->rx_bd_haddr_lo = addr;
bus_dmamap_sync(sc->bnx_dmatag, sc->rx_bd_chain_map[i],
0, BNX_RX_CHAIN_PAGE_SZ,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -4845,20 +4845,20 @@
chain_prod = TX_CHAIN_IDX(prod);
txbd = &sc->tx_bd_chain[TX_PAGE(chain_prod)][TX_IDX(chain_prod)];
- addr = (u_int32_t)(map->dm_segs[i].ds_addr);
- txbd->tx_bd_haddr_lo = htole32(addr);
+ addr = (u_int32_t)map->dm_segs[i].ds_addr;
+ txbd->tx_bd_haddr_lo = addr;
addr = (u_int32_t)((u_int64_t)map->dm_segs[i].ds_addr >> 32);
- txbd->tx_bd_haddr_hi = htole32(addr);
- txbd->tx_bd_mss_nbytes = htole16(map->dm_segs[i].ds_len);
- txbd->tx_bd_vlan_tag = htole16(vlan_tag);
- txbd->tx_bd_flags = htole16(flags);
+ txbd->tx_bd_haddr_hi = addr;
+ txbd->tx_bd_mss_nbytes = map->dm_segs[i].ds_len;
+ txbd->tx_bd_vlan_tag = vlan_tag;
+ txbd->tx_bd_flags = flags;
prod_bseq += map->dm_segs[i].ds_len;
if (i == 0)
- txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_START);
+ txbd->tx_bd_flags |= TX_BD_FLAGS_START;
prod = NEXT_TX_BD(prod);
}
/* Set the END flag on the last TX buffer descriptor. */
- txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END);
+ txbd->tx_bd_flags |= TX_BD_FLAGS_END;
DBRUN(BNX_INFO_SEND, bnx_dump_tx_chain(sc, debug_prod, map->dm_nsegs));
Home |
Main Index |
Thread Index |
Old Index