Lines Matching defs:tl

15 void transfer_list_dump(struct transfer_list_header *tl)
20 if (!tl) {
24 NOTICE("signature 0x%x\n", tl->signature);
25 NOTICE("checksum 0x%x\n", tl->checksum);
26 NOTICE("version 0x%x\n", tl->version);
27 NOTICE("hdr_size 0x%x\n", tl->hdr_size);
28 NOTICE("alignment 0x%x\n", tl->alignment);
29 NOTICE("size 0x%x\n", tl->size);
30 NOTICE("max_size 0x%x\n", tl->max_size);
32 te = transfer_list_next(tl, te);
52 struct transfer_list_header *tl = addr;
60 max_size < sizeof(*tl)) {
64 memset(tl, 0, max_size);
65 tl->signature = TRANSFER_LIST_SIGNATURE;
66 tl->version = TRANSFER_LIST_VERSION;
67 tl->hdr_size = sizeof(*tl);
68 tl->alignment = TRANSFER_LIST_INIT_MAX_ALIGN; // initial max align
69 tl->size = sizeof(*tl); // initial size is the size of header
70 tl->max_size = max_size;
72 transfer_list_update_checksum(tl);
74 return tl;
83 struct transfer_list_header *tl,
90 if (!tl || !addr || max_size == 0) {
94 align_mask = (1 << tl->alignment) - 1;
95 align_off = (uintptr_t)tl & align_mask;
99 new_addr += (1 << tl->alignment);
104 // the new space is not sufficient for the tl
105 if (tl->size > new_max_size) {
110 memmove(new_tl, tl, tl->size);
124 const struct transfer_list_header *tl)
126 if (!tl) {
130 if (tl->signature != TRANSFER_LIST_SIGNATURE) {
132 tl->signature);
136 if (!tl->max_size) {
138 tl->max_size);
142 if (tl->size > tl->max_size) {
143 ERROR("Bad transfer list size %#"PRIx32"\n", tl->size);
147 if (tl->hdr_size != sizeof(struct transfer_list_header)) {
148 ERROR("Bad transfer list header size %#"PRIx32"\n", tl->hdr_size);
152 if (!transfer_list_verify_checksum(tl)) {
153 ERROR("Bad transfer list checksum %#"PRIx32"\n", tl->checksum);
157 if (tl->version == 0) {
160 } else if (tl->version == TRANSFER_LIST_VERSION) {
163 } else if (tl->version > TRANSFER_LIST_VERSION) {
176 struct transfer_list_entry *transfer_list_next(struct transfer_list_header *tl,
185 if (!tl) {
189 tl_ev = (uintptr_t)tl + tl->size;
204 va = (uintptr_t)tl + tl->hdr_size;
223 static uint8_t calc_byte_sum(const struct transfer_list_header *tl)
225 uint8_t *b = (uint8_t *)tl;
229 if (!tl) {
233 for (n = 0; n < tl->size; n++) {
244 void transfer_list_update_checksum(struct transfer_list_header *tl)
248 if (!tl) {
252 cs = calc_byte_sum(tl);
253 cs -= tl->checksum;
255 tl->checksum = cs;
256 assert(transfer_list_verify_checksum(tl));
263 bool transfer_list_verify_checksum(const struct transfer_list_header *tl)
265 return !calc_byte_sum(tl);
272 bool transfer_list_set_data_size(struct transfer_list_header *tl,
282 if (!tl || !te) {
285 tl_old_ev = (uintptr_t)tl + tl->size;
306 if (round_up_overflow(mov_dis, 1 << tl->alignment,
307 &mov_dis) || tl->size + mov_dis > tl->max_size) {
312 tl->size += mov_dis;
329 transfer_list_update_checksum(tl);
337 bool transfer_list_rem(struct transfer_list_header *tl,
340 if (!tl || !te || (uintptr_t)te > (uintptr_t)tl + tl->size) {
345 transfer_list_update_checksum(tl);
354 struct transfer_list_entry *transfer_list_add(struct transfer_list_header *tl,
364 if (!tl) {
368 max_tl_ev = (uintptr_t)tl + tl->max_size;
369 tl_ev = (uintptr_t)tl + tl->size;
385 tl->size += ev - tl_ev;
396 transfer_list_update_checksum(tl);
408 struct transfer_list_header *tl,
416 if (!tl) {
420 tl_ev = (uintptr_t)tl + tl->size;
431 if (!transfer_list_add(tl, TL_TAG_EMPTY, dummy_te_data_sz,
437 te = transfer_list_add(tl, tag_id, data_size, data);
439 if (alignment > tl->alignment) {
440 tl->alignment = alignment;
441 transfer_list_update_checksum(tl);
452 struct transfer_list_entry *transfer_list_find(struct transfer_list_header *tl,
458 te = transfer_list_next(tl, te);