From f11282522b6c6f9cc467cae9a806fa06e10bd946 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 3 Feb 2004 18:52:55 -0800 Subject: [PATCH] [PATCH] Altix update: add MINIMAL_ATE_FLAG From: Pat Gefre 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 --git a/arch/ia64/sn/io/machvec/pci_dma.c b/arch/ia64/sn/io/machvec/pci_dma.c index bb530cf55a429..de4f5c6b42b64 100644 --- a/arch/ia64/sn/io/machvec/pci_dma.c +++ b/arch/ia64/sn/io/machvec/pci_dma.c @@ -138,6 +138,8 @@ sn_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_hand 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 *hwdev, size_t size, dma_addr_t *dma_hand *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, void *ptr, size_t size, int direction) * 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 --git a/include/asm-ia64/sn/pci/pcibr.h b/include/asm-ia64/sn/pci/pcibr.h index 70910c97d8804..550bf7e392664 100644 --- a/include/asm-ia64/sn/pci/pcibr.h +++ b/include/asm-ia64/sn/pci/pcibr.h @@ -286,6 +286,12 @@ extern void * pcibr_bridge_ptr_get(vertex_hdl_t, int); 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 -- 2.53.0