Lines Matching refs:buf

61 static int e1000g_dma_mem_alloc_82546(dma_buffer_t *buf,
779 dma_buffer_t *buf, size_t size) in e1000g_alloc_dvma_buffer() argument
793 &buf->dma_handle); in e1000g_alloc_dvma_buffer()
796 buf->dma_handle = NULL; in e1000g_alloc_dvma_buffer()
802 buf->address = kmem_alloc(size, KM_NOSLEEP); in e1000g_alloc_dvma_buffer()
804 if (buf->address == NULL) { in e1000g_alloc_dvma_buffer()
805 if (buf->dma_handle != NULL) { in e1000g_alloc_dvma_buffer()
806 dvma_release(buf->dma_handle); in e1000g_alloc_dvma_buffer()
807 buf->dma_handle = NULL; in e1000g_alloc_dvma_buffer()
814 dvma_kaddr_load(buf->dma_handle, in e1000g_alloc_dvma_buffer()
815 buf->address, size, 0, &cookie); in e1000g_alloc_dvma_buffer()
817 buf->dma_address = cookie.dmac_laddress; in e1000g_alloc_dvma_buffer()
818 buf->size = size; in e1000g_alloc_dvma_buffer()
819 buf->len = 0; in e1000g_alloc_dvma_buffer()
825 e1000g_free_dvma_buffer(dma_buffer_t *buf) in e1000g_free_dvma_buffer() argument
827 if (buf->dma_handle != NULL) { in e1000g_free_dvma_buffer()
828 dvma_unload(buf->dma_handle, 0, -1); in e1000g_free_dvma_buffer()
833 buf->dma_address = 0; in e1000g_free_dvma_buffer()
835 if (buf->address != NULL) { in e1000g_free_dvma_buffer()
836 kmem_free(buf->address, buf->size); in e1000g_free_dvma_buffer()
837 buf->address = NULL; in e1000g_free_dvma_buffer()
840 if (buf->dma_handle != NULL) { in e1000g_free_dvma_buffer()
841 dvma_release(buf->dma_handle); in e1000g_free_dvma_buffer()
842 buf->dma_handle = NULL; in e1000g_free_dvma_buffer()
845 buf->size = 0; in e1000g_free_dvma_buffer()
846 buf->len = 0; in e1000g_free_dvma_buffer()
852 dma_buffer_t *buf, size_t size, ddi_dma_attr_t *p_dma_attr) in e1000g_alloc_dma_buffer() argument
868 &buf->dma_handle); in e1000g_alloc_dma_buffer()
871 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer()
877 mystat = ddi_dma_mem_alloc(buf->dma_handle, in e1000g_alloc_dma_buffer()
880 &buf->address, in e1000g_alloc_dma_buffer()
881 &len, &buf->acc_handle); in e1000g_alloc_dma_buffer()
884 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer()
885 buf->address = NULL; in e1000g_alloc_dma_buffer()
886 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer()
887 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer()
888 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer()
895 mystat = ddi_dma_addr_bind_handle(buf->dma_handle, in e1000g_alloc_dma_buffer()
897 buf->address, in e1000g_alloc_dma_buffer()
902 if (buf->acc_handle != NULL) { in e1000g_alloc_dma_buffer()
903 ddi_dma_mem_free(&buf->acc_handle); in e1000g_alloc_dma_buffer()
904 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer()
905 buf->address = NULL; in e1000g_alloc_dma_buffer()
907 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer()
908 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer()
909 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer()
918 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer()
919 (void) ddi_dma_unbind_handle(buf->dma_handle); in e1000g_alloc_dma_buffer()
921 if (buf->acc_handle != NULL) { in e1000g_alloc_dma_buffer()
922 ddi_dma_mem_free(&buf->acc_handle); in e1000g_alloc_dma_buffer()
923 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer()
924 buf->address = NULL; in e1000g_alloc_dma_buffer()
926 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer()
927 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer()
928 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer()
936 buf->dma_address = cookie.dmac_laddress; in e1000g_alloc_dma_buffer()
937 buf->size = len; in e1000g_alloc_dma_buffer()
938 buf->len = 0; in e1000g_alloc_dma_buffer()
950 dma_buffer_t *buf, size_t size, ddi_dma_attr_t *p_dma_attr) in e1000g_alloc_dma_buffer_82546() argument
966 &buf->dma_handle); in e1000g_alloc_dma_buffer_82546()
969 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer_82546()
975 mystat = e1000g_dma_mem_alloc_82546(buf, size, &len); in e1000g_alloc_dma_buffer_82546()
977 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer_82546()
978 buf->address = NULL; in e1000g_alloc_dma_buffer_82546()
979 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
980 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer_82546()
981 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer_82546()
988 mystat = ddi_dma_addr_bind_handle(buf->dma_handle, in e1000g_alloc_dma_buffer_82546()
990 buf->address, in e1000g_alloc_dma_buffer_82546()
995 if (buf->acc_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
996 ddi_dma_mem_free(&buf->acc_handle); in e1000g_alloc_dma_buffer_82546()
997 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer_82546()
998 buf->address = NULL; in e1000g_alloc_dma_buffer_82546()
1000 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
1001 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer_82546()
1002 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer_82546()
1011 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
1012 (void) ddi_dma_unbind_handle(buf->dma_handle); in e1000g_alloc_dma_buffer_82546()
1014 if (buf->acc_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
1015 ddi_dma_mem_free(&buf->acc_handle); in e1000g_alloc_dma_buffer_82546()
1016 buf->acc_handle = NULL; in e1000g_alloc_dma_buffer_82546()
1017 buf->address = NULL; in e1000g_alloc_dma_buffer_82546()
1019 if (buf->dma_handle != NULL) { in e1000g_alloc_dma_buffer_82546()
1020 ddi_dma_free_handle(&buf->dma_handle); in e1000g_alloc_dma_buffer_82546()
1021 buf->dma_handle = NULL; in e1000g_alloc_dma_buffer_82546()
1029 buf->dma_address = cookie.dmac_laddress; in e1000g_alloc_dma_buffer_82546()
1030 buf->size = len; in e1000g_alloc_dma_buffer_82546()
1031 buf->len = 0; in e1000g_alloc_dma_buffer_82546()
1041 e1000g_dma_mem_alloc_82546(dma_buffer_t *buf, size_t size, size_t *len) in e1000g_dma_mem_alloc_82546() argument
1052 stat = ddi_dma_mem_alloc(buf->dma_handle, size, in e1000g_dma_mem_alloc_82546()
1054 0, &buf->address, len, &buf->acc_handle); in e1000g_dma_mem_alloc_82546()
1065 if (e1000g_cross_64k_bound(buf->address, *len)) { in e1000g_dma_mem_alloc_82546()
1066 hold[cnt] = buf->acc_handle; in e1000g_dma_mem_alloc_82546()
1098 e1000g_free_dma_buffer(dma_buffer_t *buf) in e1000g_free_dma_buffer() argument
1100 if (buf->dma_handle != NULL) { in e1000g_free_dma_buffer()
1101 (void) ddi_dma_unbind_handle(buf->dma_handle); in e1000g_free_dma_buffer()
1106 buf->dma_address = 0; in e1000g_free_dma_buffer()
1108 if (buf->acc_handle != NULL) { in e1000g_free_dma_buffer()
1109 ddi_dma_mem_free(&buf->acc_handle); in e1000g_free_dma_buffer()
1110 buf->acc_handle = NULL; in e1000g_free_dma_buffer()
1111 buf->address = NULL; in e1000g_free_dma_buffer()
1114 if (buf->dma_handle != NULL) { in e1000g_free_dma_buffer()
1115 ddi_dma_free_handle(&buf->dma_handle); in e1000g_free_dma_buffer()
1116 buf->dma_handle = NULL; in e1000g_free_dma_buffer()
1119 buf->size = 0; in e1000g_free_dma_buffer()
1120 buf->len = 0; in e1000g_free_dma_buffer()