Lines Matching defs:pRing

923 			struct amd8111s_dma_ringbuf *pRing,
932 pRing->dma_buf_sz = msg_size;
933 pRing->ring_size = ring_size;
934 pRing->trunk_num = AMD8111S_SPLIT;
935 pRing->buf_sz = msg_size * ring_size;
936 if (ring_size < pRing->trunk_num)
937 pRing->trunk_num = ring_size;
938 ASSERT((pRing->buf_sz % pRing->trunk_num) == 0);
940 pRing->trunk_sz = pRing->buf_sz / pRing->trunk_num;
941 ASSERT((pRing->trunk_sz % pRing->dma_buf_sz) == 0);
943 pRing->msg_buf = kmem_zalloc(sizeof (struct amd8111s_msgbuf) *
945 pRing->dma_hdl = kmem_zalloc(sizeof (ddi_dma_handle_t) *
946 pRing->trunk_num, KM_NOSLEEP);
947 pRing->acc_hdl = kmem_zalloc(sizeof (ddi_acc_handle_t) *
948 pRing->trunk_num, KM_NOSLEEP);
949 pRing->dma_cookie = kmem_zalloc(sizeof (ddi_dma_cookie_t) *
950 pRing->trunk_num, KM_NOSLEEP);
951 pRing->trunk_addr = kmem_zalloc(sizeof (caddr_t) *
952 pRing->trunk_num, KM_NOSLEEP);
953 if (pRing->msg_buf == NULL || pRing->dma_hdl == NULL ||
954 pRing->acc_hdl == NULL || pRing->trunk_addr == NULL ||
955 pRing->dma_cookie == NULL) {
961 for (idx = 0; idx < pRing->trunk_num; ++idx) {
963 DDI_DMA_SLEEP, NULL, &(pRing->dma_hdl[idx]))
969 } else if (ddi_dma_mem_alloc(pRing->dma_hdl[idx],
970 pRing->trunk_sz, &pcn_acc_attr, DDI_DMA_STREAMING,
972 (caddr_t *)&(pRing->trunk_addr[idx]),
973 (size_t *)(&real_length), &pRing->acc_hdl[idx])
979 } else if (real_length != pRing->trunk_sz) {
983 } else if (ddi_dma_addr_bind_handle(pRing->dma_hdl[idx],
984 NULL, (caddr_t)pRing->trunk_addr[idx], real_length,
986 &pRing->dma_cookie[idx], &count) != DDI_DMA_MAPPED) {
993 msg_acc < pRing->trunk_sz / pRing->dma_buf_sz;
995 pRing->msg_buf[msg_idx].offset =
996 msg_acc * pRing->dma_buf_sz;
997 pRing->msg_buf[msg_idx].vir_addr =
998 pRing->trunk_addr[idx] +
999 pRing->msg_buf[msg_idx].offset;
1000 pRing->msg_buf[msg_idx].phy_addr =
1001 pRing->dma_cookie[idx].dmac_laddress +
1002 pRing->msg_buf[msg_idx].offset;
1003 pRing->msg_buf[msg_idx].p_hdl =
1004 pRing->dma_hdl[idx];
1010 pRing->free = pRing->msg_buf;
1011 pRing->next = pRing->msg_buf;
1012 pRing->curr = pRing->msg_buf;
1016 amd8111s_free_dma_ringbuf(pRing);
1024 amd8111s_free_dma_ringbuf(struct amd8111s_dma_ringbuf *pRing)
1028 if (pRing->dma_cookie != NULL) {
1029 for (idx = 0; idx < pRing->trunk_num; idx ++) {
1030 if (pRing->dma_cookie[idx].dmac_laddress == 0) {
1033 (void) ddi_dma_unbind_handle(pRing->dma_hdl[idx]);
1035 kmem_free(pRing->dma_cookie,
1036 sizeof (ddi_dma_cookie_t) * pRing->trunk_num);
1039 if (pRing->acc_hdl != NULL) {
1040 for (idx = 0; idx < pRing->trunk_num; idx ++) {
1041 if (pRing->acc_hdl[idx] == NULL)
1043 ddi_dma_mem_free(&pRing->acc_hdl[idx]);
1045 kmem_free(pRing->acc_hdl,
1046 sizeof (ddi_acc_handle_t) * pRing->trunk_num);
1049 if (pRing->dma_hdl != NULL) {
1050 for (idx = 0; idx < pRing->trunk_num; idx ++) {
1051 if (pRing->dma_hdl[idx] == 0) {
1054 ddi_dma_free_handle(&pRing->dma_hdl[idx]);
1056 kmem_free(pRing->dma_hdl,
1057 sizeof (ddi_dma_handle_t) * pRing->trunk_num);
1060 if (pRing->msg_buf != NULL) {
1061 kmem_free(pRing->msg_buf,
1062 sizeof (struct amd8111s_msgbuf) * pRing->ring_size);
1065 if (pRing->trunk_addr != NULL) {
1066 kmem_free(pRing->trunk_addr,
1067 sizeof (caddr_t) * pRing->trunk_num);
1070 bzero(pRing, sizeof (*pRing));