• Ivan Kokshaysky's avatar
    [PATCH] alpha ISA dma and MAX_DMA_ADDRESS · 48e7ce94
    Ivan Kokshaysky authored
    Thanks David Miller, Jay Estabrook and Richard Henderson for
    reviewing the patch and for corrections.
    
    Description:
    
    The ISA dma falls into 2 classes.
    1. True busmastering (aka DMA_MODE_CASCADE) when the ISA device
       generate bus addresses by itself. Obviously, such devices are
       limited to lower 16 Mb as there are only 24 address lines on
       the ISA bus. Drivers for these devices pass NULL pdev
       argument to pci mapping functions, and we must always use
       dma_mask = 0x00ffffff in this case.
    2. ISA devices using i8237 DMA controller functionality:
       floppy, all soundcards (AFAIK) and a lot of other cheap ISA cards.
       In this case actual device doing DMA is a PCI-to-ISA bridge.
       Quite a few of ISA bridges can do 32-bit DMA (using "high page"
       extensions), and alpha traditionally uses this.
    
    I propose the following:
    introduce 'struct pci_dev *isa_bridge' global variable; this
    will be pointer to either real bridge device found by pci
    probing code, or a fake device in special cases (like jensen running
    generic kernel). isa_bridge->dma_mask will be set depending on DMA
    capabilities of particular bridge (either using generic quirk list or
    in an arch specific manner).
    This would allow devices like floppy and audio utilize 32-bit DMA
    just by replacing 'NULL' with 'isa_bridge' in the pci mapping calls.
    
    Also, this helps to resolve ISA dma vs. MAX_DMA_ADDRESS mess on alpha.
    Setting MAX_DMA_ADDRESS depending on the number of address lines
    on the ISA bridge became bogus since early 2.4 when we started to
    use the SG windows. Basically, if we have a working iommu, we don't
    have any dma limitations. All we need is a correct dma_mask to choose
    proper dma window.
    OTOH, there are 'iommuless' alphas (rx164, nautilus, possibly early
    miata) which need to have 16 Mb GFP_DMA zone (just like i386) even
    if their ISA bridge is 32-bit.
    
    Proposed changes:
    - rename all XXX_MAX_DMA_ADDRESS to XXX_MAX_ISA_DMA_ADDRESS;
      alpha_mv.max_dma_address - ditto (it's about 90% of the patch);
    - ISA bridge on nautilus does support 32-bit dma;
    - MAX_DMA_ADDRESS is 16 Mb if there is no iommu, ~0UL (unlimited)
      otherwise;
    - if needed, fall back to GFP_DMA allocations in
      pci_alloc_consistent();
    - pci_dma_supported() also returns success if GFP_DMA is helpful;
    - isa_bridge stuff. Used only by floppy as yet.
    
    Ivan.
    48e7ce94
sys_miata.c 7.88 KB