Print this page
5255 uts shouldn't open-code ISP2


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"
  27 
  28 /*
  29  * t1394.c
  30  *    1394 Target Driver Interface
  31  *    This file contains all of the 1394 Software Framework routines called
  32  *    by target drivers
  33  */
  34 

  35 #include <sys/conf.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/types.h>
  39 #include <sys/kmem.h>
  40 #include <sys/disp.h>
  41 #include <sys/tnf_probe.h>
  42 
  43 #include <sys/1394/t1394.h>
  44 #include <sys/1394/s1394.h>
  45 #include <sys/1394/h1394.h>
  46 #include <sys/1394/ieee1394.h>
  47 
  48 static int s1394_allow_detach = 0;
  49 
  50 /*
  51  * Function:    t1394_attach()
  52  * Input(s):    dip                     The dip given to the target driver
  53  *                                          in it's attach() routine
  54  *              version                 The version of the target driver -


1892         ASSERT(t1394_hdl != NULL);
1893         ASSERT(t1394_isoch_cec_hdl != NULL);
1894         ASSERT(props != NULL);
1895 
1896         hal = ((s1394_target_t *)t1394_hdl)->on_hal;
1897 
1898         /* Check for invalid channel_mask */
1899         if (props->cec_channel_mask == 0) {
1900                 TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1901                     S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1902                     "Invalid channel mask");
1903                 TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1904                     S1394_TNF_SL_ISOCH_STACK, "");
1905                 return (DDI_FAILURE);
1906         }
1907 
1908         /* Test conditions specific to T1394_NO_IRM_ALLOC */
1909         temp = props->cec_channel_mask;
1910         if (props->cec_options & T1394_NO_IRM_ALLOC) {
1911                 /* If T1394_NO_IRM_ALLOC, then only one bit should be set */
1912                 if ((temp & (temp - 1)) != 0) {
1913                         TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1914                             S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1915                             "Invalid channel mask");
1916                         TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1917                             S1394_TNF_SL_ISOCH_STACK, "");
1918                         return (DDI_FAILURE);
1919                 }
1920 
1921                 /* If T1394_NO_IRM_ALLOC, then speeds should be equal */
1922                 if (props->cec_min_speed != props->cec_max_speed) {
1923                         TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1924                             S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1925                             "Invalid speeds (min != max)");
1926                         TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1927                             S1394_TNF_SL_ISOCH_STACK, "");
1928                         return (DDI_FAILURE);
1929                 }
1930         }
1931 
1932         /* Check for invalid bandwidth */




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


  26 /*
  27  * t1394.c
  28  *    1394 Target Driver Interface
  29  *    This file contains all of the 1394 Software Framework routines called
  30  *    by target drivers
  31  */
  32 
  33 #include <sys/sysmacros.h>
  34 #include <sys/conf.h>
  35 #include <sys/ddi.h>
  36 #include <sys/sunddi.h>
  37 #include <sys/types.h>
  38 #include <sys/kmem.h>
  39 #include <sys/disp.h>
  40 #include <sys/tnf_probe.h>
  41 
  42 #include <sys/1394/t1394.h>
  43 #include <sys/1394/s1394.h>
  44 #include <sys/1394/h1394.h>
  45 #include <sys/1394/ieee1394.h>
  46 
  47 static int s1394_allow_detach = 0;
  48 
  49 /*
  50  * Function:    t1394_attach()
  51  * Input(s):    dip                     The dip given to the target driver
  52  *                                          in it's attach() routine
  53  *              version                 The version of the target driver -


1891         ASSERT(t1394_hdl != NULL);
1892         ASSERT(t1394_isoch_cec_hdl != NULL);
1893         ASSERT(props != NULL);
1894 
1895         hal = ((s1394_target_t *)t1394_hdl)->on_hal;
1896 
1897         /* Check for invalid channel_mask */
1898         if (props->cec_channel_mask == 0) {
1899                 TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1900                     S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1901                     "Invalid channel mask");
1902                 TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1903                     S1394_TNF_SL_ISOCH_STACK, "");
1904                 return (DDI_FAILURE);
1905         }
1906 
1907         /* Test conditions specific to T1394_NO_IRM_ALLOC */
1908         temp = props->cec_channel_mask;
1909         if (props->cec_options & T1394_NO_IRM_ALLOC) {
1910                 /* If T1394_NO_IRM_ALLOC, then only one bit should be set */
1911                 if (!ISP2(temp)) {
1912                         TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1913                             S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1914                             "Invalid channel mask");
1915                         TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1916                             S1394_TNF_SL_ISOCH_STACK, "");
1917                         return (DDI_FAILURE);
1918                 }
1919 
1920                 /* If T1394_NO_IRM_ALLOC, then speeds should be equal */
1921                 if (props->cec_min_speed != props->cec_max_speed) {
1922                         TNF_PROBE_1(t1394_alloc_isoch_cec_error,
1923                             S1394_TNF_SL_ISOCH_ERROR, "", tnf_string, msg,
1924                             "Invalid speeds (min != max)");
1925                         TNF_PROBE_0_DEBUG(t1394_alloc_isoch_cec_exit,
1926                             S1394_TNF_SL_ISOCH_STACK, "");
1927                         return (DDI_FAILURE);
1928                 }
1929         }
1930 
1931         /* Check for invalid bandwidth */