Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.13-rc4 137 lines 2.8 kB view raw
1/* dvma.c: Routines that are used to access DMA on the Sparc SBus. 2 * 3 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 */ 5 6#include <linux/config.h> 7#include <linux/string.h> 8#include <linux/kernel.h> 9#include <linux/slab.h> 10#include <linux/init.h> 11#include <linux/delay.h> 12 13#include <asm/oplib.h> 14#include <asm/io.h> 15#include <asm/dma.h> 16#include <asm/sbus.h> 17 18struct sbus_dma *dma_chain; 19 20void __init init_one_dvma(struct sbus_dma *dma, int num_dma) 21{ 22 printk("dma%d: ", num_dma); 23 24 dma->next = NULL; 25 dma->running = 0; /* No transfers going on as of yet */ 26 dma->allocated = 0; /* No one has allocated us yet */ 27 switch(sbus_readl(dma->regs + DMA_CSR)&DMA_DEVICE_ID) { 28 case DMA_VERS0: 29 dma->revision = dvmarev0; 30 printk("Revision 0 "); 31 break; 32 case DMA_ESCV1: 33 dma->revision = dvmaesc1; 34 printk("ESC Revision 1 "); 35 break; 36 case DMA_VERS1: 37 dma->revision = dvmarev1; 38 printk("Revision 1 "); 39 break; 40 case DMA_VERS2: 41 dma->revision = dvmarev2; 42 printk("Revision 2 "); 43 break; 44 case DMA_VERHME: 45 dma->revision = dvmahme; 46 printk("HME DVMA gate array "); 47 break; 48 case DMA_VERSPLUS: 49 dma->revision = dvmarevplus; 50 printk("Revision 1 PLUS "); 51 break; 52 default: 53 printk("unknown dma version %08x", 54 sbus_readl(dma->regs + DMA_CSR) & DMA_DEVICE_ID); 55 dma->allocated = 1; 56 break; 57 } 58 printk("\n"); 59} 60 61/* Probe this SBus DMA module(s) */ 62void __init dvma_init(struct sbus_bus *sbus) 63{ 64 struct sbus_dev *this_dev; 65 struct sbus_dma *dma; 66 struct sbus_dma *dchain; 67 static int num_dma = 0; 68 69 for_each_sbusdev(this_dev, sbus) { 70 char *name = this_dev->prom_name; 71 int hme = 0; 72 73 if(!strcmp(name, "SUNW,fas")) 74 hme = 1; 75 else if(strcmp(name, "dma") && 76 strcmp(name, "ledma") && 77 strcmp(name, "espdma")) 78 continue; 79 80 /* Found one... */ 81 dma = kmalloc(sizeof(struct sbus_dma), GFP_ATOMIC); 82 83 dma->sdev = this_dev; 84 85 /* Put at end of dma chain */ 86 dchain = dma_chain; 87 if(dchain) { 88 while(dchain->next) 89 dchain = dchain->next; 90 dchain->next = dma; 91 } else { 92 /* We're the first in line */ 93 dma_chain = dma; 94 } 95 96 dma->regs = sbus_ioremap(&dma->sdev->resource[0], 0, 97 dma->sdev->resource[0].end - dma->sdev->resource[0].start + 1, 98 "dma"); 99 100 dma->node = dma->sdev->prom_node; 101 102 init_one_dvma(dma, num_dma++); 103 } 104} 105 106#ifdef CONFIG_SUN4 107 108#include <asm/sun4paddr.h> 109 110void __init sun4_dvma_init(void) 111{ 112 struct sbus_dma *dma; 113 struct resource r; 114 115 if(sun4_dma_physaddr) { 116 dma = kmalloc(sizeof(struct sbus_dma), GFP_ATOMIC); 117 118 /* No SBUS */ 119 dma->sdev = NULL; 120 121 /* Only one DMA device */ 122 dma_chain = dma; 123 124 memset(&r, 0, sizeof(r)); 125 r.start = sun4_dma_physaddr; 126 dma->regs = sbus_ioremap(&r, 0, PAGE_SIZE, "dma"); 127 128 /* No prom node */ 129 dma->node = 0x0; 130 131 init_one_dvma(dma, 0); 132 } else { 133 dma_chain = NULL; 134 } 135} 136 137#endif