Lines Matching refs:tag

67 	struct proto_tag *tag;
70 if (ioc->u.tag.bndry != 0 &&
71 (ioc->u.tag.bndry & (ioc->u.tag.bndry - 1)) != 0)
79 if (ioc->u.tag.maxsegsz > ioc->u.tag.maxsz || ioc->u.tag.nsegs == 1)
80 ioc->u.tag.maxsegsz = ioc->u.tag.maxsz;
82 tag = malloc(sizeof(*tag), M_PROTO_BUSDMA, M_WAITOK | M_ZERO);
84 tag->parent = parent;
85 LIST_INSERT_HEAD(&parent->children, tag, peers);
86 tag->align = MAX(ioc->u.tag.align, parent->align);
87 tag->bndry = BNDRY_MIN(ioc->u.tag.bndry, parent->bndry);
88 tag->maxaddr = MIN(ioc->u.tag.maxaddr, parent->maxaddr);
89 tag->maxsz = MIN(ioc->u.tag.maxsz, parent->maxsz);
90 tag->maxsegsz = MIN(ioc->u.tag.maxsegsz, parent->maxsegsz);
91 tag->nsegs = MIN(ioc->u.tag.nsegs, parent->nsegs);
92 tag->datarate = MIN(ioc->u.tag.datarate, parent->datarate);
94 ioc->u.tag.align = tag->align;
95 ioc->u.tag.bndry = tag->bndry;
96 ioc->u.tag.maxaddr = tag->maxaddr;
97 ioc->u.tag.maxsz = tag->maxsz;
98 ioc->u.tag.maxsegsz = tag->maxsegsz;
99 ioc->u.tag.nsegs = tag->nsegs;
100 ioc->u.tag.datarate = tag->datarate;
102 tag->align = ioc->u.tag.align;
103 tag->bndry = ioc->u.tag.bndry;
104 tag->maxaddr = ioc->u.tag.maxaddr;
105 tag->maxsz = ioc->u.tag.maxsz;
106 tag->maxsegsz = ioc->u.tag.maxsegsz;
107 tag->nsegs = ioc->u.tag.nsegs;
108 tag->datarate = ioc->u.tag.datarate;
110 LIST_INSERT_HEAD(&busdma->tags, tag, tags);
111 ioc->result = (uintptr_t)(void *)tag;
116 proto_busdma_tag_destroy(struct proto_busdma *busdma, struct proto_tag *tag)
119 if (!LIST_EMPTY(&tag->mds))
121 if (!LIST_EMPTY(&tag->children))
124 if (tag->parent != NULL) {
125 LIST_REMOVE(tag, peers);
126 tag->parent = NULL;
128 LIST_REMOVE(tag, tags);
129 free(tag, M_PROTO_BUSDMA);
136 struct proto_tag *tag;
138 LIST_FOREACH(tag, &busdma->tags, tags) {
139 if ((void *)tag == (void *)key)
140 return (tag);
174 proto_busdma_mem_alloc(struct proto_busdma *busdma, struct proto_tag *tag,
182 md->tag = tag;
184 error = bus_dma_tag_create(busdma->bd_roottag, tag->align, tag->bndry,
185 tag->maxaddr, BUS_SPACE_MAXADDR, NULL, NULL, tag->maxsz,
186 tag->nsegs, tag->maxsegsz, 0, NULL, NULL, &md->bd_tag);
202 tag->maxsz, proto_busdma_mem_alloc_callback, &pcb, BUS_DMA_NOWAIT);
209 LIST_INSERT_HEAD(&tag->mds, md, peers);
212 ioc->u.md.virt_size = tag->maxsz;
229 proto_busdma_md_create(struct proto_busdma *busdma, struct proto_tag *tag,
236 md->tag = tag;
238 error = bus_dma_tag_create(busdma->bd_roottag, tag->align, tag->bndry,
239 tag->maxaddr, BUS_SPACE_MAXADDR, NULL, NULL, tag->maxsz,
240 tag->nsegs, tag->maxsegsz, 0, NULL, NULL, &md->bd_tag);
252 LIST_INSERT_HEAD(&tag->mds, md, peers);
374 struct proto_tag *tag, *tag1;
378 LIST_FOREACH_SAFE(tag, &busdma->tags, tags, tag1)
379 proto_busdma_tag_destroy(busdma, tag);
387 struct proto_tag *tag;
398 tag = proto_busdma_tag_lookup(busdma, ioc->key);
399 if (tag == NULL) {
403 error = proto_busdma_tag_create(busdma, tag, ioc);
406 tag = proto_busdma_tag_lookup(busdma, ioc->key);
407 if (tag == NULL) {
411 error = proto_busdma_tag_destroy(busdma, tag);
414 tag = proto_busdma_tag_lookup(busdma, ioc->u.md.tag);
415 if (tag == NULL) {
419 error = proto_busdma_mem_alloc(busdma, tag, ioc);
430 tag = proto_busdma_tag_lookup(busdma, ioc->u.md.tag);
431 if (tag == NULL) {
435 error = proto_busdma_md_create(busdma, tag, ioc);
483 physaddr <= trunc_page(md->physaddr + md->tag->maxsz))