Author: yongari
Date: Sat Mar 10 06:12:14 2012
New Revision: 232766
URL: http://svn.freebsd.org/changeset/base/232766

Log:
  After r232403, DMA transactions does not cross 4GB boundary for
  all PCI devices.  Remove driver workaround for 4GB boundary issue.

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c   Sat Mar 10 05:38:04 2012        (r232765)
+++ head/sys/dev/bge/if_bge.c   Sat Mar 10 06:12:14 2012        (r232766)
@@ -2457,14 +2457,10 @@ bge_dma_ring_alloc(struct bge_softc *sc,
     bus_addr_t *paddr, const char *msg)
 {
        struct bge_dmamap_arg ctx;
-       bus_addr_t lowaddr;
-       bus_size_t ring_end;
        int error;
 
-       lowaddr = BUS_SPACE_MAXADDR;
-again:
        error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag,
-           alignment, 0, lowaddr, BUS_SPACE_MAXADDR, NULL,
+           alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL,
            NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag);
        if (error != 0) {
                device_printf(sc->bge_dev,
@@ -2489,25 +2485,6 @@ again:
                return (ENOMEM);
        }
        *paddr = ctx.bge_busaddr;
-       ring_end = *paddr + maxsize;
-       if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0 &&
-           BGE_ADDR_HI(*paddr) != BGE_ADDR_HI(ring_end)) {
-               /*
-                * 4GB boundary crossed.  Limit maximum allowable DMA
-                * address space to 32bit and try again.
-                */
-               bus_dmamap_unload(*tag, *map);
-               bus_dmamem_free(*tag, *ring, *map);
-               bus_dma_tag_destroy(*tag);
-               if (bootverbose)
-                       device_printf(sc->bge_dev, "4GB boundary crossed, "
-                           "limit DMA address space to 32bit for %s\n", msg);
-               *ring = NULL;
-               *tag = NULL;
-               *map = NULL;
-               lowaddr = BUS_SPACE_MAXADDR_32BIT;
-               goto again;
-       }
        return (0);
 }
 
@@ -2515,7 +2492,7 @@ static int
 bge_dma_alloc(struct bge_softc *sc)
 {
        bus_addr_t lowaddr;
-       bus_size_t boundary, sbsz, rxmaxsegsz, txsegsz, txmaxsegsz;
+       bus_size_t rxmaxsegsz, sbsz, txsegsz, txmaxsegsz;
        int i, error;
 
        lowaddr = BUS_SPACE_MAXADDR;
@@ -2602,9 +2579,7 @@ bge_dma_alloc(struct bge_softc *sc)
        }
 
        /* Create parent tag for buffers. */
-       boundary = 0;
        if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) {
-               boundary = BGE_DMA_BNDRY;
                /*
                 * XXX
                 * watchdog timeout issue was observed on BCM5704 which
@@ -2615,10 +2590,10 @@ bge_dma_alloc(struct bge_softc *sc)
                if (sc->bge_flags & BGE_FLAG_PCIX)
                        lowaddr = BUS_SPACE_MAXADDR_32BIT;
        }
-       error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev),
-           1, boundary, lowaddr, BUS_SPACE_MAXADDR, NULL,
-           NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT,
-           0, NULL, NULL, &sc->bge_cdata.bge_buffer_tag);
+       error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), 1, 0, lowaddr,
+           BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0,
+           BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL,
+           &sc->bge_cdata.bge_buffer_tag);
        if (error != 0) {
                device_printf(sc->bge_dev,
                    "could not allocate buffer dma tag\n");

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h        Sat Mar 10 05:38:04 2012        
(r232765)
+++ head/sys/dev/bge/if_bgereg.h        Sat Mar 10 06:12:14 2012        
(r232766)
@@ -2691,12 +2691,6 @@ struct bge_gib {
 #define        BGE_DMA_MAXADDR         0xFFFFFFFFFF
 #endif
 
-#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF)
-#define        BGE_DMA_BNDRY           0x100000000
-#else
-#define        BGE_DMA_BNDRY           0
-#endif
-
 /*
  * Ring structures. Most of these reside in host memory and we tell
  * the NIC where they are via the ring control blocks. The exceptions
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to