Lines Matching refs:tag

65 	struct proto_tag *tag;
68 if (ioc->u.tag.bndry != 0 &&
69 (ioc->u.tag.bndry & (ioc->u.tag.bndry - 1)) != 0)
77 if (ioc->u.tag.maxsegsz > ioc->u.tag.maxsz || ioc->u.tag.nsegs == 1)
78 ioc->u.tag.maxsegsz = ioc->u.tag.maxsz;
80 tag = malloc(sizeof(*tag), M_PROTO_BUSDMA, M_WAITOK | M_ZERO);
82 tag->parent = parent;
83 LIST_INSERT_HEAD(&parent->children, tag, peers);
84 tag->align = MAX(ioc->u.tag.align, parent->align);
85 tag->bndry = BNDRY_MIN(ioc->u.tag.bndry, parent->bndry);
86 tag->maxaddr = MIN(ioc->u.tag.maxaddr, parent->maxaddr);
87 tag->maxsz = MIN(ioc->u.tag.maxsz, parent->maxsz);
88 tag->maxsegsz = MIN(ioc->u.tag.maxsegsz, parent->maxsegsz);
89 tag->nsegs = MIN(ioc->u.tag.nsegs, parent->nsegs);
90 tag->datarate = MIN(ioc->u.tag.datarate, parent->datarate);
92 ioc->u.tag.align = tag->align;
93 ioc->u.tag.bndry = tag->bndry;
94 ioc->u.tag.maxaddr = tag->maxaddr;
95 ioc->u.tag.maxsz = tag->maxsz;
96 ioc->u.tag.maxsegsz = tag->maxsegsz;
97 ioc->u.tag.nsegs = tag->nsegs;
98 ioc->u.tag.datarate = tag->datarate;
100 tag->align = ioc->u.tag.align;
101 tag->bndry = ioc->u.tag.bndry;
102 tag->maxaddr = ioc->u.tag.maxaddr;
103 tag->maxsz = ioc->u.tag.maxsz;
104 tag->maxsegsz = ioc->u.tag.maxsegsz;
105 tag->nsegs = ioc->u.tag.nsegs;
106 tag->datarate = ioc->u.tag.datarate;
108 LIST_INSERT_HEAD(&busdma->tags, tag, tags);
109 ioc->result = (uintptr_t)(void *)tag;
114 proto_busdma_tag_destroy(struct proto_busdma *busdma, struct proto_tag *tag)
117 if (!LIST_EMPTY(&tag->mds))
119 if (!LIST_EMPTY(&tag->children))
122 if (tag->parent != NULL) {
123 LIST_REMOVE(tag, peers);
124 tag->parent = NULL;
126 LIST_REMOVE(tag, tags);
127 free(tag, M_PROTO_BUSDMA);
134 struct proto_tag *tag;
136 LIST_FOREACH(tag, &busdma->tags, tags) {
137 if ((void *)tag == (void *)key)
138 return (tag);
172 proto_busdma_mem_alloc(struct proto_busdma *busdma, struct proto_tag *tag,
180 md->tag = tag;
182 error = bus_dma_tag_create(busdma->bd_roottag, tag->align, tag->bndry,
183 tag->maxaddr, BUS_SPACE_MAXADDR, NULL, NULL, tag->maxsz,
184 tag->nsegs, tag->maxsegsz, 0, NULL, NULL, &md->bd_tag);
200 tag->maxsz, proto_busdma_mem_alloc_callback, &pcb, BUS_DMA_NOWAIT);
207 LIST_INSERT_HEAD(&tag->mds, md, peers);
210 ioc->u.md.virt_size = tag->maxsz;
227 proto_busdma_md_create(struct proto_busdma *busdma, struct proto_tag *tag,
234 md->tag = tag;
236 error = bus_dma_tag_create(busdma->bd_roottag, tag->align, tag->bndry,
237 tag->maxaddr, BUS_SPACE_MAXADDR, NULL, NULL, tag->maxsz,
238 tag->nsegs, tag->maxsegsz, 0, NULL, NULL, &md->bd_tag);
250 LIST_INSERT_HEAD(&tag->mds, md, peers);
374 struct proto_tag *tag, *tag1;
379 LIST_FOREACH_SAFE(tag, &busdma->tags, tags, tag1)
380 proto_busdma_tag_destroy(busdma, tag);
389 struct proto_tag *tag;
402 tag = proto_busdma_tag_lookup(busdma, ioc->key);
403 if (tag == NULL) {
407 error = proto_busdma_tag_create(busdma, tag, ioc);
410 tag = proto_busdma_tag_lookup(busdma, ioc->key);
411 if (tag == NULL) {
415 error = proto_busdma_tag_destroy(busdma, tag);
418 tag = proto_busdma_tag_lookup(busdma, ioc->u.md.tag);
419 if (tag == NULL) {
423 error = proto_busdma_mem_alloc(busdma, tag, ioc);
434 tag = proto_busdma_tag_lookup(busdma, ioc->u.md.tag);
435 if (tag == NULL) {
439 error = proto_busdma_md_create(busdma, tag, ioc);
494 physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) {