Lines Matching full:ch
67 struct ata_channel *ch = device_get_softc(dev); in ata_dmainit() local
70 if (ch->dma.alloc == NULL) in ata_dmainit()
71 ch->dma.alloc = ata_dmaalloc; in ata_dmainit()
72 if (ch->dma.free == NULL) in ata_dmainit()
73 ch->dma.free = ata_dmafree; in ata_dmainit()
74 if (ch->dma.setprd == NULL) in ata_dmainit()
75 ch->dma.setprd = ata_dmasetprd; in ata_dmainit()
76 if (ch->dma.load == NULL) in ata_dmainit()
77 ch->dma.load = ata_dmaload; in ata_dmainit()
78 if (ch->dma.unload == NULL) in ata_dmainit()
79 ch->dma.unload = ata_dmaunload; in ata_dmainit()
80 if (ch->dma.alignment == 0) in ata_dmainit()
81 ch->dma.alignment = 2; in ata_dmainit()
82 if (ch->dma.boundary == 0) in ata_dmainit()
83 ch->dma.boundary = 65536; in ata_dmainit()
84 if (ch->dma.segsize == 0) in ata_dmainit()
85 ch->dma.segsize = 65536; in ata_dmainit()
86 if (ch->dma.max_iosize == 0) in ata_dmainit()
87 ch->dma.max_iosize = (ATA_DMA_ENTRIES - 1) * PAGE_SIZE; in ata_dmainit()
88 if (ch->dma.max_address == 0) in ata_dmainit()
89 ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT; in ata_dmainit()
90 if (ch->dma.dma_slots == 0) in ata_dmainit()
91 ch->dma.dma_slots = 1; in ata_dmainit()
93 if (bus_dma_tag_create(bus_get_dma_tag(dev), ch->dma.alignment, 0, in ata_dmainit()
94 ch->dma.max_address, BUS_SPACE_MAXADDR, in ata_dmainit()
95 NULL, NULL, ch->dma.max_iosize, in ata_dmainit()
96 ATA_DMA_ENTRIES, ch->dma.segsize, in ata_dmainit()
97 0, NULL, NULL, &ch->dma.dmatag)) in ata_dmainit()
100 if (bus_dma_tag_create(ch->dma.dmatag, PAGE_SIZE, 64 * 1024, in ata_dmainit()
101 ch->dma.max_address, BUS_SPACE_MAXADDR, in ata_dmainit()
103 0, NULL, NULL, &ch->dma.work_tag)) in ata_dmainit()
106 if (bus_dmamem_alloc(ch->dma.work_tag, (void **)&ch->dma.work, in ata_dmainit()
108 &ch->dma.work_map)) in ata_dmainit()
111 if (bus_dmamap_load(ch->dma.work_tag, ch->dma.work_map, ch->dma.work, in ata_dmainit()
114 bus_dmamem_free(ch->dma.work_tag, ch->dma.work, ch->dma.work_map); in ata_dmainit()
117 ch->dma.work_bus = dcba.maddr; in ata_dmainit()
128 struct ata_channel *ch = device_get_softc(dev); in ata_dmafini() local
130 if (ch->dma.work_bus) { in ata_dmafini()
131 bus_dmamap_unload(ch->dma.work_tag, ch->dma.work_map); in ata_dmafini()
132 bus_dmamem_free(ch->dma.work_tag, ch->dma.work, ch->dma.work_map); in ata_dmafini()
133 ch->dma.work_bus = 0; in ata_dmafini()
134 ch->dma.work = NULL; in ata_dmafini()
136 if (ch->dma.work_tag) { in ata_dmafini()
137 bus_dma_tag_destroy(ch->dma.work_tag); in ata_dmafini()
138 ch->dma.work_tag = NULL; in ata_dmafini()
140 if (ch->dma.dmatag) { in ata_dmafini()
141 bus_dma_tag_destroy(ch->dma.dmatag); in ata_dmafini()
142 ch->dma.dmatag = NULL; in ata_dmafini()
158 struct ata_channel *ch = device_get_softc(dev); in ata_dmaalloc() local
163 bzero(ch->dma.slot, sizeof(struct ata_dmaslot) * ATA_DMA_SLOTS); in ata_dmaalloc()
164 for (i = 0; i < ch->dma.dma_slots; i++) { in ata_dmaalloc()
165 struct ata_dmaslot *slot = &ch->dma.slot[i]; in ata_dmaalloc()
167 if (bus_dma_tag_create(ch->dma.dmatag, PAGE_SIZE, PAGE_SIZE, in ata_dmaalloc()
168 ch->dma.max_address, BUS_SPACE_MAXADDR, in ata_dmaalloc()
171 device_printf(ch->dev, "FAILURE - create sg_tag\n"); in ata_dmaalloc()
177 device_printf(ch->dev, "FAILURE - alloc sg_map\n"); in ata_dmaalloc()
183 device_printf(ch->dev, "FAILURE - load sg\n"); in ata_dmaalloc()
188 if (bus_dma_tag_create(ch->dma.dmatag, in ata_dmaalloc()
189 ch->dma.alignment, ch->dma.boundary, in ata_dmaalloc()
190 ch->dma.max_address, BUS_SPACE_MAXADDR, in ata_dmaalloc()
191 NULL, NULL, ch->dma.max_iosize, in ata_dmaalloc()
192 ATA_DMA_ENTRIES, ch->dma.segsize, in ata_dmaalloc()
194 device_printf(ch->dev, "FAILURE - create data_tag\n"); in ata_dmaalloc()
199 device_printf(ch->dev, "FAILURE - create data_map\n"); in ata_dmaalloc()
214 struct ata_channel *ch = device_get_softc(dev); in ata_dmafree() local
219 struct ata_dmaslot *slot = &ch->dma.slot[i]; in ata_dmafree()
266 struct ata_channel *ch = device_get_softc(request->parent); in ata_dmaload() local
282 if (request->bytecount & (ch->dma.alignment - 1)) { in ata_dmaload()
285 request->bytecount, ch->dma.alignment); in ata_dmaload()
288 if (request->bytecount > ch->dma.max_iosize) { in ata_dmaload()
291 request->bytecount, ch->dma.max_iosize); in ata_dmaload()
296 request->dma = &ch->dma.slot[0]; in ata_dmaload()
306 ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); in ata_dmaload()
310 ch->dma.setprd, &dspa, BUS_DMA_NOWAIT); in ata_dmaload()