From: Pat Gefre <pfg@sgi.com>

arch/ia64/sn/io/machvec/pci_dma.c
    Add MINIMAL_ATE_FLAGS() macro usage

include/asm-ia64/sn/pci/pcibr.h
    Add MINIMAL_ATE_FLAG() macro



---

 arch/ia64/sn/io/machvec/pci_dma.c |    8 ++++++--
 include/asm-ia64/sn/pci/pcibr.h   |    6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff -puN arch/ia64/sn/io/machvec/pci_dma.c~altix-04 arch/ia64/sn/io/machvec/pci_dma.c
--- 25/arch/ia64/sn/io/machvec/pci_dma.c~altix-04	2004-02-02 23:19:44.000000000 -0800
+++ 25-akpm/arch/ia64/sn/io/machvec/pci_dma.c	2004-02-02 23:19:44.000000000 -0800
@@ -138,6 +138,8 @@ sn_pci_alloc_consistent(struct pci_dev *
 	if (!(cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size))))
 		return NULL;
 
+	memset(cpuaddr, 0x0, size);
+
 	/* physical addr. of the memory we just got */
 	phys_addr = __pa(cpuaddr);
 
@@ -154,7 +156,8 @@ sn_pci_alloc_consistent(struct pci_dev *
 		*dma_handle = pcibr_dmatrans_addr(vhdl, NULL, phys_addr, size,
 					  PCIIO_DMA_CMD | PCIIO_DMA_A64);
 	else {
-		dma_map = pcibr_dmamap_alloc(vhdl, NULL, size, PCIIO_DMA_CMD);
+		dma_map = pcibr_dmamap_alloc(vhdl, NULL, size, PCIIO_DMA_CMD | 
+					     MINIMAL_ATE_FLAG(phys_addr, size));
 		if (dma_map) {
 			*dma_handle = (dma_addr_t)
 				pcibr_dmamap_addr(dma_map, phys_addr, size);
@@ -391,7 +394,8 @@ sn_pci_map_single(struct pci_dev *hwdev,
 	 * let's use the PMU instead.
 	 */
 	dma_map = NULL;
-	dma_map = pcibr_dmamap_alloc(vhdl, NULL, size, PCIIO_DMA_DATA);
+	dma_map = pcibr_dmamap_alloc(vhdl, NULL, size, PCIIO_DMA_DATA | 
+				     MINIMAL_ATE_FLAG(phys_addr, size));
 
 	if (!dma_map) {
 		printk(KERN_ERR "pci_map_single: Unable to allocate anymore "
diff -puN include/asm-ia64/sn/pci/pcibr.h~altix-04 include/asm-ia64/sn/pci/pcibr.h
--- 25/include/asm-ia64/sn/pci/pcibr.h~altix-04	2004-02-02 23:19:44.000000000 -0800
+++ 25-akpm/include/asm-ia64/sn/pci/pcibr.h	2004-02-02 23:19:44.000000000 -0800
@@ -286,6 +286,12 @@ extern void *		pcibr_bridge_ptr_get(vert
 
 typedef int		pcibr_device_flags_t;
 
+#define MINIMAL_ATES_REQUIRED(addr, size) \
+	(IOPG(IOPGOFF(addr) + (size) - 1) == IOPG((size) - 1))
+
+#define MINIMAL_ATE_FLAG(addr, size) \
+	(MINIMAL_ATES_REQUIRED((u_long)addr, size) ? PCIBR_NO_ATE_ROUNDUP : 0)
+
 /*
  * Set bits in the Bridge Device(x) register for this device.
  * "flags" are defined above. NOTE: this includes turning

_