Lines Matching refs:dctx
538 static int sb_grow_dcd(struct sb_dcd_ctx *dctx, unsigned int inc_size) in sb_grow_dcd() argument
545 dctx->size += inc_size; in sb_grow_dcd()
546 tmp = realloc(dctx->payload, dctx->size); in sb_grow_dcd()
550 dctx->payload = tmp; in sb_grow_dcd()
553 dctx->payload[0] = htonl((SB_HAB_DCD_TAG << 24) | in sb_grow_dcd()
554 (dctx->size << 8) | in sb_grow_dcd()
562 struct sb_dcd_ctx *dctx; in sb_build_dcd() local
568 dctx = calloc(1, sizeof(*dctx)); in sb_build_dcd()
569 if (!dctx) in sb_build_dcd()
572 ret = sb_grow_dcd(dctx, 4); in sb_build_dcd()
593 dctx->id = id; in sb_build_dcd()
601 ictx->dcd_head = dctx; in sb_build_dcd()
602 ictx->dcd_tail = dctx; in sb_build_dcd()
604 ictx->dcd_tail->dcd = dctx; in sb_build_dcd()
605 ictx->dcd_tail = dctx; in sb_build_dcd()
611 free(dctx->payload); in sb_build_dcd()
612 free(dctx); in sb_build_dcd()
624 struct sb_dcd_ctx *dctx = ictx->dcd_tail; in sb_build_dcd_block() local
627 if (dctx->prev_dcd_head && (type != SB_DCD_NOOP) && in sb_build_dcd_block()
628 ((dctx->prev_dcd_head[0] & 0xff0000ff) == type)) { in sb_build_dcd_block()
630 ret = sb_grow_dcd(dctx, 8); in sb_build_dcd_block()
634 ret = sb_grow_dcd(dctx, 4); in sb_build_dcd_block()
639 dctx->prev_dcd_head = dctx->payload + in sb_build_dcd_block()
640 dctx->size / sizeof(*dctx->payload) - 1; in sb_build_dcd_block()
649 ret = sb_grow_dcd(dctx, 12); in sb_build_dcd_block()
654 dctx->prev_dcd_head = dctx->payload + in sb_build_dcd_block()
655 dctx->size / sizeof(*dctx->payload) - 3; in sb_build_dcd_block()
658 dcd = dctx->payload + dctx->size / sizeof(*dctx->payload) - 2; in sb_build_dcd_block()
701 length = dctx->size - in sb_build_dcd_block()
702 ((dctx->prev_dcd_head - dctx->payload) * in sb_build_dcd_block()
703 sizeof(*dctx->payload)); in sb_build_dcd_block()
704 dctx->prev_dcd_head[0] = htonl(type | (length << 8)); in sb_build_dcd_block()
949 struct sb_dcd_ctx *dctx = ictx->dcd_head; in sb_build_command_load() local
962 while (dctx) { in sb_build_command_load()
963 if (dctx->id == dcdid) in sb_build_command_load()
965 dctx = dctx->dcd; in sb_build_command_load()
968 if (!dctx) { in sb_build_command_load()
974 asize = roundup(dctx->size, SB_BLOCK_SIZE); in sb_build_command_load()
981 memcpy(payload, dctx->payload, dctx->size); in sb_build_command_load()
2138 struct sb_dcd_ctx *dctx = ictx->dcd_head, *d_head; in sb_free_image() local
2157 while (dctx) { in sb_free_image()
2158 d_head = dctx; in sb_free_image()
2159 dctx = dctx->dcd; in sb_free_image()