Print this page
8368 remove warlock leftovers from usr/src/uts


   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 /*
  30  * hci1394_buf.c
  31  *   These routines handle IO mapped memory.  They include routines to alloc and
  32  *   free  IO mapped memory and a routine to get the adapters default dma
  33  *   attributes. These routines are meant to be called from the base context.
  34  *   They should not be called from an interrupt handler.
  35  */
  36 
  37 #include <sys/conf.h>
  38 #include <sys/ddi.h>
  39 #include <sys/modctl.h>
  40 #include <sys/stat.h>
  41 #include <sys/sunddi.h>
  42 #include <sys/kmem.h>
  43 
  44 #include <sys/1394/h1394.h>
  45 #include <sys/1394/adapters/hci1394.h>
  46 
  47 
  48 /*


  90         int status;
  91 
  92 
  93         ASSERT(drvinfo != NULL);
  94         ASSERT(parms != NULL);
  95         ASSERT(info != NULL);
  96         ASSERT(handle != NULL);
  97         TNF_PROBE_0_DEBUG(hci1394_buf_alloc_enter, HCI1394_TNF_HAL_STACK, "");
  98 
  99         /* alloc the space to keep track of the buffer */
 100         buf = kmem_alloc(sizeof (hci1394_buf_t), KM_SLEEP);
 101 
 102         /* setup the return parameter */
 103         *handle = buf;
 104 
 105         /* save away pointer to general info */
 106         buf->bu_drvinfo = drvinfo;
 107 
 108         /* Get the default DMA attributes and override sgllen and alignment */
 109 
 110         _NOTE(SCHEME_PROTECTS_DATA("unique (on stack)", ddi_dma_attr_t))
 111         hci1394_buf_attr_get(&dma_attr);
 112         dma_attr.dma_attr_sgllen = parms->bp_max_cookies;
 113         dma_attr.dma_attr_align = parms->bp_alignment;
 114 
 115         status = ddi_dma_alloc_handle(drvinfo->di_dip, &dma_attr,
 116             DDI_DMA_SLEEP, NULL, &buf->bu_dma_handle);
 117         if (status != DDI_SUCCESS) {
 118                 kmem_free(buf, sizeof (hci1394_buf_t));
 119                 TNF_PROBE_0(hci1394_buf_alloc_dah_fail, HCI1394_TNF_HAL_ERROR,
 120                     "");
 121                 TNF_PROBE_0_DEBUG(hci1394_buf_alloc_exit, HCI1394_TNF_HAL_STACK,
 122                     "");
 123                 return (DDI_FAILURE);
 124         }
 125 
 126         status = ddi_dma_mem_alloc(buf->bu_dma_handle, parms->bp_length,
 127             &drvinfo->di_buf_attr, DDI_DMA_STREAMING, DDI_DMA_SLEEP,
 128             NULL, &info->bi_kaddr, &info->bi_real_length, &buf->bu_handle);
 129         if (status != DDI_SUCCESS) {
 130                 ddi_dma_free_handle(&buf->bu_dma_handle);




   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 


  27 /*
  28  * hci1394_buf.c
  29  *   These routines handle IO mapped memory.  They include routines to alloc and
  30  *   free  IO mapped memory and a routine to get the adapters default dma
  31  *   attributes. These routines are meant to be called from the base context.
  32  *   They should not be called from an interrupt handler.
  33  */
  34 
  35 #include <sys/conf.h>
  36 #include <sys/ddi.h>
  37 #include <sys/modctl.h>
  38 #include <sys/stat.h>
  39 #include <sys/sunddi.h>
  40 #include <sys/kmem.h>
  41 
  42 #include <sys/1394/h1394.h>
  43 #include <sys/1394/adapters/hci1394.h>
  44 
  45 
  46 /*


  88         int status;
  89 
  90 
  91         ASSERT(drvinfo != NULL);
  92         ASSERT(parms != NULL);
  93         ASSERT(info != NULL);
  94         ASSERT(handle != NULL);
  95         TNF_PROBE_0_DEBUG(hci1394_buf_alloc_enter, HCI1394_TNF_HAL_STACK, "");
  96 
  97         /* alloc the space to keep track of the buffer */
  98         buf = kmem_alloc(sizeof (hci1394_buf_t), KM_SLEEP);
  99 
 100         /* setup the return parameter */
 101         *handle = buf;
 102 
 103         /* save away pointer to general info */
 104         buf->bu_drvinfo = drvinfo;
 105 
 106         /* Get the default DMA attributes and override sgllen and alignment */
 107 

 108         hci1394_buf_attr_get(&dma_attr);
 109         dma_attr.dma_attr_sgllen = parms->bp_max_cookies;
 110         dma_attr.dma_attr_align = parms->bp_alignment;
 111 
 112         status = ddi_dma_alloc_handle(drvinfo->di_dip, &dma_attr,
 113             DDI_DMA_SLEEP, NULL, &buf->bu_dma_handle);
 114         if (status != DDI_SUCCESS) {
 115                 kmem_free(buf, sizeof (hci1394_buf_t));
 116                 TNF_PROBE_0(hci1394_buf_alloc_dah_fail, HCI1394_TNF_HAL_ERROR,
 117                     "");
 118                 TNF_PROBE_0_DEBUG(hci1394_buf_alloc_exit, HCI1394_TNF_HAL_STACK,
 119                     "");
 120                 return (DDI_FAILURE);
 121         }
 122 
 123         status = ddi_dma_mem_alloc(buf->bu_dma_handle, parms->bp_length,
 124             &drvinfo->di_buf_attr, DDI_DMA_STREAMING, DDI_DMA_SLEEP,
 125             NULL, &info->bi_kaddr, &info->bi_real_length, &buf->bu_handle);
 126         if (status != DDI_SUCCESS) {
 127                 ddi_dma_free_handle(&buf->bu_dma_handle);