Lines Matching refs:parm
190 usbd_transfer_setup_sub_malloc(struct usb_setup_params *parm, in usbd_transfer_setup_sub_malloc() argument
247 if (parm->buf == NULL) { in usbd_transfer_setup_sub_malloc()
249 parm->dma_page_ptr += n_dma_pc * n_dma_pg; in usbd_transfer_setup_sub_malloc()
250 parm->dma_page_cache_ptr += n_dma_pc; in usbd_transfer_setup_sub_malloc()
253 parm->dma_page_ptr += count * n_dma_pg; in usbd_transfer_setup_sub_malloc()
254 parm->xfer_page_cache_ptr += count; in usbd_transfer_setup_sub_malloc()
259 parm->dma_page_cache_ptr[x].tag_parent = in usbd_transfer_setup_sub_malloc()
260 &parm->curr_xfer->xroot->dma_parent_tag; in usbd_transfer_setup_sub_malloc()
264 parm->xfer_page_cache_ptr[x].tag_parent = in usbd_transfer_setup_sub_malloc()
265 &parm->curr_xfer->xroot->dma_parent_tag; in usbd_transfer_setup_sub_malloc()
269 *ppc = parm->xfer_page_cache_ptr; in usbd_transfer_setup_sub_malloc()
273 pc = parm->xfer_page_cache_ptr; in usbd_transfer_setup_sub_malloc()
274 pg = parm->dma_page_ptr; in usbd_transfer_setup_sub_malloc()
282 if (usb_pc_alloc_mem(parm->dma_page_cache_ptr, in usbd_transfer_setup_sub_malloc()
287 buf = parm->dma_page_cache_ptr->buffer; in usbd_transfer_setup_sub_malloc()
289 parm->dma_page_cache_ptr++; in usbd_transfer_setup_sub_malloc()
306 parm->xfer_page_cache_ptr = pc; in usbd_transfer_setup_sub_malloc()
307 parm->dma_page_ptr = pg; in usbd_transfer_setup_sub_malloc()
322 usbd_transfer_setup_sub(struct usb_setup_params *parm) in usbd_transfer_setup_sub() argument
328 struct usb_xfer *xfer = parm->curr_xfer; in usbd_transfer_setup_sub()
329 const struct usb_config *setup = parm->curr_setup; in usbd_transfer_setup_sub()
344 if ((parm->hc_max_packet_size == 0) || in usbd_transfer_setup_sub()
345 (parm->hc_max_packet_count == 0) || in usbd_transfer_setup_sub()
346 (parm->hc_max_frame_size == 0)) { in usbd_transfer_setup_sub()
347 parm->err = USB_ERR_INVAL; in usbd_transfer_setup_sub()
364 xfer->flags_int.usb_mode = parm->udev->flags.usb_mode; in usbd_transfer_setup_sub()
366 parm->bufsize = setup->bufsize; in usbd_transfer_setup_sub()
368 switch (parm->speed) { in usbd_transfer_setup_sub()
421 if (xfer->max_packet_count > parm->hc_max_packet_count) { in usbd_transfer_setup_sub()
422 xfer->max_packet_count = parm->hc_max_packet_count; in usbd_transfer_setup_sub()
431 if ((xfer->max_packet_size > parm->hc_max_packet_size) || in usbd_transfer_setup_sub()
433 xfer->max_packet_size = parm->hc_max_packet_size; in usbd_transfer_setup_sub()
437 usbd_get_std_packet_size(&std_size, type, parm->speed); in usbd_transfer_setup_sub()
485 switch (parm->speed) { in usbd_transfer_setup_sub()
508 parm->err = USB_ERR_INVAL; in usbd_transfer_setup_sub()
515 parm->err = USB_ERR_ZERO_NFRAMES; in usbd_transfer_setup_sub()
529 switch (parm->speed) { in usbd_transfer_setup_sub()
562 switch (parm->speed) { in usbd_transfer_setup_sub()
583 if ((parm->bufsize <= MIN_PKT) && in usbd_transfer_setup_sub()
589 parm->bufsize = 0; /* automatic setup length */ in usbd_transfer_setup_sub()
593 parm->err = USB_ERR_ZERO_MAXP; in usbd_transfer_setup_sub()
606 if (parm->bufsize == 0) { in usbd_transfer_setup_sub()
607 parm->bufsize = xfer->max_frame_size; in usbd_transfer_setup_sub()
610 parm->bufsize *= xfer->nframes; in usbd_transfer_setup_sub()
621 parm->bufsize += (xfer->max_frame_size - 1); in usbd_transfer_setup_sub()
623 if (parm->bufsize < xfer->max_frame_size) { in usbd_transfer_setup_sub()
625 parm->err = USB_ERR_INVAL; in usbd_transfer_setup_sub()
630 parm->bufsize -= (parm->bufsize % xfer->max_frame_size); in usbd_transfer_setup_sub()
635 parm->bufsize += REQ_SIZE; /* SETUP message */ in usbd_transfer_setup_sub()
638 xfer->max_data_length = parm->bufsize; in usbd_transfer_setup_sub()
649 if (parm->bufsize <= REQ_SIZE) { in usbd_transfer_setup_sub()
677 parm->err = USB_ERR_INVAL; in usbd_transfer_setup_sub()
687 xfer->frlengths = parm->xfer_length_ptr; in usbd_transfer_setup_sub()
688 parm->xfer_length_ptr += 2 * n_frlengths; in usbd_transfer_setup_sub()
691 xfer->frbuffers = parm->xfer_page_cache_ptr; in usbd_transfer_setup_sub()
692 parm->xfer_page_cache_ptr += n_frbuffers; in usbd_transfer_setup_sub()
707 if (usbd_transfer_setup_sub_malloc(parm, in usbd_transfer_setup_sub()
708 &pc, parm->bufsize, 1, 1)) { in usbd_transfer_setup_sub()
709 parm->err = USB_ERR_NOMEM; in usbd_transfer_setup_sub()
710 } else if (parm->buf != NULL) { in usbd_transfer_setup_sub()
723 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup_sub()
725 if (parm->buf != NULL) { in usbd_transfer_setup_sub()
727 USB_ADD_BYTES(parm->buf, parm->size[0]); in usbd_transfer_setup_sub()
735 parm->size[0] += parm->bufsize; in usbd_transfer_setup_sub()
738 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup_sub()
745 if (parm->bufsize_max < parm->bufsize) { in usbd_transfer_setup_sub()
746 parm->bufsize_max = parm->bufsize; in usbd_transfer_setup_sub()
772 xfer->dma_page_ptr = parm->dma_page_ptr; in usbd_transfer_setup_sub()
773 parm->dma_page_ptr += (2 * n_frbuffers); in usbd_transfer_setup_sub()
774 parm->dma_page_ptr += (parm->bufsize / USB_PAGE_SIZE); in usbd_transfer_setup_sub()
784 (parm->hc_max_frame_size - in usbd_transfer_setup_sub()
785 (parm->hc_max_frame_size % xfer->max_frame_size)); in usbd_transfer_setup_sub()
788 parm->err = USB_ERR_INVAL; in usbd_transfer_setup_sub()
794 if (parm->buf) { in usbd_transfer_setup_sub()
800 (parm->bufsize_max > 0)) { in usbd_transfer_setup_sub()
803 parm->bufsize_max)) { in usbd_transfer_setup_sub()
804 parm->err = USB_ERR_NOMEM; in usbd_transfer_setup_sub()
812 if (parm->err) { in usbd_transfer_setup_sub()
861 struct usb_setup_params *parm; in usbd_transfer_setup() local
913 parm = &udev->scratch.xfer_setup[0].parm; in usbd_transfer_setup()
914 (void)memset_s(parm, sizeof(*parm), 0, sizeof(*parm)); in usbd_transfer_setup()
916 parm->udev = udev; in usbd_transfer_setup()
917 parm->speed = usbd_get_speed(udev); in usbd_transfer_setup()
918 parm->hc_max_packet_count = 1; in usbd_transfer_setup()
920 if (parm->speed >= USB_SPEED_MAX) { in usbd_transfer_setup()
921 parm->err = USB_ERR_INVAL; in usbd_transfer_setup()
935 info->memory_size = parm->size[0]; in usbd_transfer_setup()
938 info->dma_page_cache_start = USB_ADD_BYTES(buf, parm->size[4]); in usbd_transfer_setup()
939 info->dma_page_cache_end = USB_ADD_BYTES(buf, parm->size[5]); in usbd_transfer_setup()
941 info->xfer_page_cache_start = USB_ADD_BYTES(buf, parm->size[5]); in usbd_transfer_setup()
942 info->xfer_page_cache_end = USB_ADD_BYTES(buf, parm->size[2]); in usbd_transfer_setup()
949 parm->dma_tag_p, udev->bus->dma_parent_tag[0].tag, in usbd_transfer_setup()
950 xfer_mtx, &usb_bdma_done_event, udev->bus->dma_bits, parm->dma_tag_max); in usbd_transfer_setup()
989 parm->size[0] = 0; in usbd_transfer_setup()
990 parm->buf = buf; in usbd_transfer_setup()
991 parm->size[0] += sizeof(info[0]); in usbd_transfer_setup()
1022 parm->err = USB_ERR_NO_PIPE; in usbd_transfer_setup()
1027 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1030 parm->curr_setup = setup; in usbd_transfer_setup()
1037 xfer = USB_ADD_BYTES(buf, parm->size[0]); in usbd_transfer_setup()
1063 parm->size[0] += sizeof(xfer[0]); in usbd_transfer_setup()
1064 parm->methods = xfer->endpoint->methods; in usbd_transfer_setup()
1065 parm->curr_xfer = xfer; in usbd_transfer_setup()
1071 (udev->bus->methods->xfer_setup) (parm); in usbd_transfer_setup()
1074 if (parm->err) in usbd_transfer_setup()
1089 parm->err = USB_ERR_INVAL; in usbd_transfer_setup()
1112 if (parm->err) in usbd_transfer_setup()
1116 if ((buf != NULL) || (parm->err != 0)) in usbd_transfer_setup()
1124 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1127 parm->size[1] = parm->size[0]; in usbd_transfer_setup()
1138 parm->dma_tag_max += 3 * MIN(n_setup, USB_EP_MAX); in usbd_transfer_setup()
1143 parm->dma_tag_max += 8; in usbd_transfer_setup()
1145 parm->dma_tag_p += parm->dma_tag_max; in usbd_transfer_setup()
1147 parm->size[0] += ((uint8_t *)parm->dma_tag_p) - in usbd_transfer_setup()
1151 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1154 parm->size[3] = parm->size[0]; in usbd_transfer_setup()
1156 parm->size[0] += ((uint8_t *)parm->dma_page_ptr) - in usbd_transfer_setup()
1160 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1163 parm->size[4] = parm->size[0]; in usbd_transfer_setup()
1165 parm->size[0] += ((uint8_t *)parm->dma_page_cache_ptr) - in usbd_transfer_setup()
1169 parm->size[5] = parm->size[0]; in usbd_transfer_setup()
1171 parm->size[0] += ((uint8_t *)parm->xfer_page_cache_ptr) - in usbd_transfer_setup()
1176 parm->size[2] = parm->size[0]; in usbd_transfer_setup()
1179 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1181 parm->size[6] = parm->size[0]; in usbd_transfer_setup()
1183 parm->size[0] += ((uint8_t *)parm->xfer_length_ptr) - in usbd_transfer_setup()
1187 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in usbd_transfer_setup()
1190 buf = bsd_malloc(parm->size[0], M_USB, M_WAITOK | M_ZERO); in usbd_transfer_setup()
1193 parm->err = USB_ERR_NOMEM; in usbd_transfer_setup()
1196 parm->size[0]); in usbd_transfer_setup()
1199 parm->dma_tag_p = USB_ADD_BYTES(buf, parm->size[1]); in usbd_transfer_setup()
1200 parm->dma_page_ptr = USB_ADD_BYTES(buf, parm->size[3]); in usbd_transfer_setup()
1201 parm->dma_page_cache_ptr = USB_ADD_BYTES(buf, parm->size[4]); in usbd_transfer_setup()
1202 parm->xfer_page_cache_ptr = USB_ADD_BYTES(buf, parm->size[5]); in usbd_transfer_setup()
1203 parm->xfer_length_ptr = USB_ADD_BYTES(buf, parm->size[6]); in usbd_transfer_setup()
1221 if (parm->err) in usbd_transfer_setup()
1224 error = parm->err; in usbd_transfer_setup()